Documentation
¶
Index ¶
- Constants
- Variables
- func Asc(fields ...string) func(*sql.Selector)
- func Desc(fields ...string) func(*sql.Selector)
- func IsConstraintError(err error) bool
- func IsNotFound(err error) bool
- func IsNotLoaded(err error) bool
- func IsNotSingular(err error) bool
- func IsValidationError(err error) bool
- func MaskNotFound(err error) error
- func NewContext(parent context.Context, c *Client) context.Context
- func NewTxContext(parent context.Context, tx *Tx) context.Context
- func OpenTxFromContext(ctx context.Context) (context.Context, driver.Tx, error)
- type AggregateFunc
- type Client
- func (c *Client) BeginTx(ctx context.Context, opts *sql.TxOptions) (*Tx, error)
- func (c *Client) Close() error
- func (c *Client) Debug() *Client
- func (c *Client) Intercept(interceptors ...Interceptor)
- func (c *Client) Mutate(ctx context.Context, m Mutation) (Value, error)
- func (c *Client) Noder(ctx context.Context, id int, opts ...NodeOption) (_ Noder, err error)
- func (c *Client) Noders(ctx context.Context, ids []int, opts ...NodeOption) ([]Noder, error)
- func (c *Client) OpenTx(ctx context.Context) (context.Context, driver.Tx, error)
- func (c *Client) Tx(ctx context.Context) (*Tx, error)
- func (c *Client) Use(hooks ...Hook)
- type CommitFunc
- type CommitHook
- type Committer
- type ConstraintError
- type Cursor
- type Eval
- type EvalClient
- func (c *EvalClient) Create() *EvalCreate
- func (c *EvalClient) CreateBulk(builders ...*EvalCreate) *EvalCreateBulk
- func (c *EvalClient) Delete() *EvalDelete
- func (c *EvalClient) DeleteOne(e *Eval) *EvalDeleteOne
- func (c *EvalClient) DeleteOneID(id int) *EvalDeleteOne
- func (c *EvalClient) Get(ctx context.Context, id int) (*Eval, error)
- func (c *EvalClient) GetX(ctx context.Context, id int) *Eval
- func (c *EvalClient) Hooks() []Hook
- func (c *EvalClient) Intercept(interceptors ...Interceptor)
- func (c *EvalClient) Interceptors() []Interceptor
- func (c *EvalClient) MapCreateBulk(slice any, setFunc func(*EvalCreate, int)) *EvalCreateBulk
- func (c *EvalClient) Query() *EvalQuery
- func (c *EvalClient) Update() *EvalUpdate
- func (c *EvalClient) UpdateOne(e *Eval) *EvalUpdateOne
- func (c *EvalClient) UpdateOneID(id int) *EvalUpdateOne
- func (c *EvalClient) Use(hooks ...Hook)
- type EvalConnection
- type EvalCreate
- func (ec *EvalCreate) Exec(ctx context.Context) error
- func (ec *EvalCreate) ExecX(ctx context.Context)
- func (ec *EvalCreate) Mutation() *EvalMutation
- func (ec *EvalCreate) Save(ctx context.Context) (*Eval, error)
- func (ec *EvalCreate) SaveX(ctx context.Context) *Eval
- func (ec *EvalCreate) SetResult(s []string) *EvalCreate
- func (ec *EvalCreate) SetSnippet(s string) *EvalCreate
- func (ec *EvalCreate) SetTime(s string) *EvalCreate
- type EvalCreateBulk
- type EvalDelete
- type EvalDeleteOne
- type EvalEdge
- type EvalGroupBy
- func (egb *EvalGroupBy) Aggregate(fns ...AggregateFunc) *EvalGroupBy
- func (s *EvalGroupBy) Bool(ctx context.Context) (_ bool, err error)
- func (s *EvalGroupBy) BoolX(ctx context.Context) bool
- func (s *EvalGroupBy) Bools(ctx context.Context) ([]bool, error)
- func (s *EvalGroupBy) BoolsX(ctx context.Context) []bool
- func (s *EvalGroupBy) Float64(ctx context.Context) (_ float64, err error)
- func (s *EvalGroupBy) Float64X(ctx context.Context) float64
- func (s *EvalGroupBy) Float64s(ctx context.Context) ([]float64, error)
- func (s *EvalGroupBy) Float64sX(ctx context.Context) []float64
- func (s *EvalGroupBy) Int(ctx context.Context) (_ int, err error)
- func (s *EvalGroupBy) IntX(ctx context.Context) int
- func (s *EvalGroupBy) Ints(ctx context.Context) ([]int, error)
- func (s *EvalGroupBy) IntsX(ctx context.Context) []int
- func (egb *EvalGroupBy) Scan(ctx context.Context, v any) error
- func (s *EvalGroupBy) ScanX(ctx context.Context, v any)
- func (s *EvalGroupBy) String(ctx context.Context) (_ string, err error)
- func (s *EvalGroupBy) StringX(ctx context.Context) string
- func (s *EvalGroupBy) Strings(ctx context.Context) ([]string, error)
- func (s *EvalGroupBy) StringsX(ctx context.Context) []string
- type EvalMutation
- func (m *EvalMutation) AddField(name string, value ent.Value) error
- func (m *EvalMutation) AddedEdges() []string
- func (m *EvalMutation) AddedField(name string) (ent.Value, bool)
- func (m *EvalMutation) AddedFields() []string
- func (m *EvalMutation) AddedIDs(name string) []ent.Value
- func (m *EvalMutation) AppendResult(s []string)
- func (m *EvalMutation) AppendedResult() ([]string, bool)
- func (m *EvalMutation) ClearEdge(name string) error
- func (m *EvalMutation) ClearField(name string) error
- func (m *EvalMutation) ClearedEdges() []string
- func (m *EvalMutation) ClearedFields() []string
- func (m EvalMutation) Client() *Client
- func (m *EvalMutation) EdgeCleared(name string) bool
- func (m *EvalMutation) Field(name string) (ent.Value, bool)
- func (m *EvalMutation) FieldCleared(name string) bool
- func (m *EvalMutation) Fields() []string
- func (m *EvalMutation) ID() (id int, exists bool)
- func (m *EvalMutation) IDs(ctx context.Context) ([]int, error)
- func (m *EvalMutation) OldField(ctx context.Context, name string) (ent.Value, error)
- func (m *EvalMutation) OldResult(ctx context.Context) (v []string, err error)
- func (m *EvalMutation) OldSnippet(ctx context.Context) (v string, err error)
- func (m *EvalMutation) OldTime(ctx context.Context) (v string, err error)
- func (m *EvalMutation) Op() Op
- func (m *EvalMutation) RemovedEdges() []string
- func (m *EvalMutation) RemovedIDs(name string) []ent.Value
- func (m *EvalMutation) ResetEdge(name string) error
- func (m *EvalMutation) ResetField(name string) error
- func (m *EvalMutation) ResetResult()
- func (m *EvalMutation) ResetSnippet()
- func (m *EvalMutation) ResetTime()
- func (m *EvalMutation) Result() (r []string, exists bool)
- func (m *EvalMutation) SetField(name string, value ent.Value) error
- func (m *EvalMutation) SetOp(op Op)
- func (m *EvalMutation) SetResult(s []string)
- func (m *EvalMutation) SetSnippet(s string)
- func (m *EvalMutation) SetTime(s string)
- func (m *EvalMutation) Snippet() (r string, exists bool)
- func (m *EvalMutation) Time() (r string, exists bool)
- func (m EvalMutation) Tx() (*Tx, error)
- func (m *EvalMutation) Type() string
- func (m *EvalMutation) Where(ps ...predicate.Eval)
- func (m *EvalMutation) WhereP(ps ...func(*sql.Selector))
- type EvalOrder
- type EvalOrderField
- type EvalPaginateOption
- type EvalQuery
- func (eq *EvalQuery) Aggregate(fns ...AggregateFunc) *EvalSelect
- func (eq *EvalQuery) All(ctx context.Context) ([]*Eval, error)
- func (eq *EvalQuery) AllX(ctx context.Context) []*Eval
- func (eq *EvalQuery) Clone() *EvalQuery
- func (e *EvalQuery) CollectFields(ctx context.Context, satisfies ...string) (*EvalQuery, error)
- func (eq *EvalQuery) Count(ctx context.Context) (int, error)
- func (eq *EvalQuery) CountX(ctx context.Context) int
- func (eq *EvalQuery) Exist(ctx context.Context) (bool, error)
- func (eq *EvalQuery) ExistX(ctx context.Context) bool
- func (eq *EvalQuery) First(ctx context.Context) (*Eval, error)
- func (eq *EvalQuery) FirstID(ctx context.Context) (id int, err error)
- func (eq *EvalQuery) FirstIDX(ctx context.Context) int
- func (eq *EvalQuery) FirstX(ctx context.Context) *Eval
- func (eq *EvalQuery) GroupBy(field string, fields ...string) *EvalGroupBy
- func (eq *EvalQuery) IDs(ctx context.Context) (ids []int, err error)
- func (eq *EvalQuery) IDsX(ctx context.Context) []int
- func (eq *EvalQuery) Limit(limit int) *EvalQuery
- func (eq *EvalQuery) Offset(offset int) *EvalQuery
- func (eq *EvalQuery) Only(ctx context.Context) (*Eval, error)
- func (eq *EvalQuery) OnlyID(ctx context.Context) (id int, err error)
- func (eq *EvalQuery) OnlyIDX(ctx context.Context) int
- func (eq *EvalQuery) OnlyX(ctx context.Context) *Eval
- func (eq *EvalQuery) Order(o ...eval.OrderOption) *EvalQuery
- func (e *EvalQuery) Paginate(ctx context.Context, after *Cursor, first *int, before *Cursor, last *int, ...) (*EvalConnection, error)
- func (eq *EvalQuery) Select(fields ...string) *EvalSelect
- func (eq *EvalQuery) Unique(unique bool) *EvalQuery
- func (eq *EvalQuery) Where(ps ...predicate.Eval) *EvalQuery
- type EvalSelect
- func (es *EvalSelect) Aggregate(fns ...AggregateFunc) *EvalSelect
- func (s *EvalSelect) Bool(ctx context.Context) (_ bool, err error)
- func (s *EvalSelect) BoolX(ctx context.Context) bool
- func (s *EvalSelect) Bools(ctx context.Context) ([]bool, error)
- func (s *EvalSelect) BoolsX(ctx context.Context) []bool
- func (s *EvalSelect) Float64(ctx context.Context) (_ float64, err error)
- func (s *EvalSelect) Float64X(ctx context.Context) float64
- func (s *EvalSelect) Float64s(ctx context.Context) ([]float64, error)
- func (s *EvalSelect) Float64sX(ctx context.Context) []float64
- func (s *EvalSelect) Int(ctx context.Context) (_ int, err error)
- func (s *EvalSelect) IntX(ctx context.Context) int
- func (s *EvalSelect) Ints(ctx context.Context) ([]int, error)
- func (s *EvalSelect) IntsX(ctx context.Context) []int
- func (es *EvalSelect) Scan(ctx context.Context, v any) error
- func (s *EvalSelect) ScanX(ctx context.Context, v any)
- func (s *EvalSelect) String(ctx context.Context) (_ string, err error)
- func (s *EvalSelect) StringX(ctx context.Context) string
- func (s *EvalSelect) Strings(ctx context.Context) ([]string, error)
- func (s *EvalSelect) StringsX(ctx context.Context) []string
- type EvalUpdate
- func (eu *EvalUpdate) AppendResult(s []string) *EvalUpdate
- func (eu *EvalUpdate) Exec(ctx context.Context) error
- func (eu *EvalUpdate) ExecX(ctx context.Context)
- func (eu *EvalUpdate) Mutation() *EvalMutation
- func (eu *EvalUpdate) Save(ctx context.Context) (int, error)
- func (eu *EvalUpdate) SaveX(ctx context.Context) int
- func (eu *EvalUpdate) SetResult(s []string) *EvalUpdate
- func (eu *EvalUpdate) SetSnippet(s string) *EvalUpdate
- func (eu *EvalUpdate) SetTime(s string) *EvalUpdate
- func (eu *EvalUpdate) Where(ps ...predicate.Eval) *EvalUpdate
- type EvalUpdateOne
- func (euo *EvalUpdateOne) AppendResult(s []string) *EvalUpdateOne
- func (euo *EvalUpdateOne) Exec(ctx context.Context) error
- func (euo *EvalUpdateOne) ExecX(ctx context.Context)
- func (euo *EvalUpdateOne) Mutation() *EvalMutation
- func (euo *EvalUpdateOne) Save(ctx context.Context) (*Eval, error)
- func (euo *EvalUpdateOne) SaveX(ctx context.Context) *Eval
- func (euo *EvalUpdateOne) Select(field string, fields ...string) *EvalUpdateOne
- func (euo *EvalUpdateOne) SetResult(s []string) *EvalUpdateOne
- func (euo *EvalUpdateOne) SetSnippet(s string) *EvalUpdateOne
- func (euo *EvalUpdateOne) SetTime(s string) *EvalUpdateOne
- func (euo *EvalUpdateOne) Where(ps ...predicate.Eval) *EvalUpdateOne
- type Evals
- type Hook
- type InterceptFunc
- type Interceptor
- type MutateFunc
- type Mutation
- type Mutator
- type NodeOption
- type Noder
- type NotFoundError
- type NotLoadedError
- type NotSingularError
- type Op
- type Option
- type OrderDirection
- type OrderFunc
- type PageInfo
- type Policy
- type Querier
- type QuerierFunc
- type Query
- type QueryContext
- type RollbackFunc
- type RollbackHook
- type Rollbacker
- type TraverseFunc
- type Traverser
- type Tx
- type ValidationError
- type Value
Constants ¶
const ( // Operation types. OpCreate = ent.OpCreate OpDelete = ent.OpDelete OpDeleteOne = ent.OpDeleteOne OpUpdate = ent.OpUpdate OpUpdateOne = ent.OpUpdateOne // Node types. TypeEval = "Eval" )
Variables ¶
var DefaultEvalOrder = &EvalOrder{ Direction: entgql.OrderDirectionAsc, Field: &EvalOrderField{ Value: func(e *Eval) (ent.Value, error) { return e.ID, nil }, column: eval.FieldID, toTerm: eval.ByID, toCursor: func(e *Eval) Cursor { return Cursor{ID: e.ID} }, }, }
DefaultEvalOrder is the default ordering of Eval.
var ErrTxStarted = errors.New("ent: cannot start a transaction within a transaction")
ErrTxStarted is returned when trying to start a new transaction from a transactional client.
Functions ¶
func IsConstraintError ¶
IsConstraintError returns a boolean indicating whether the error is a constraint failure.
func IsNotFound ¶
IsNotFound returns a boolean indicating whether the error is a not found error.
func IsNotLoaded ¶
IsNotLoaded returns a boolean indicating whether the error is a not loaded error.
func IsNotSingular ¶
IsNotSingular returns a boolean indicating whether the error is a not singular error.
func IsValidationError ¶
IsValidationError returns a boolean indicating whether the error is a validation error.
func NewContext ¶
NewContext returns a new context with the given Client attached.
func NewTxContext ¶
NewTxContext returns a new context with the given Tx attached.
Types ¶
type AggregateFunc ¶
AggregateFunc applies an aggregation step on the group-by traversal/selector.
func As ¶
func As(fn AggregateFunc, end string) AggregateFunc
As is a pseudo aggregation function for renaming another other functions with custom names. For example:
GroupBy(field1, field2). Aggregate(ent.As(ent.Sum(field1), "sum_field1"), (ent.As(ent.Sum(field2), "sum_field2")). Scan(ctx, &v)
func Count ¶
func Count() AggregateFunc
Count applies the "count" aggregation function on each group.
func Max ¶
func Max(field string) AggregateFunc
Max applies the "max" aggregation function on the given field of each group.
func Mean ¶
func Mean(field string) AggregateFunc
Mean applies the "mean" aggregation function on the given field of each group.
func Min ¶
func Min(field string) AggregateFunc
Min applies the "min" aggregation function on the given field of each group.
func Sum ¶
func Sum(field string) AggregateFunc
Sum applies the "sum" aggregation function on the given field of each group.
type Client ¶
type Client struct { // Schema is the client for creating, migrating and dropping schema. Schema *migrate.Schema // Eval is the client for interacting with the Eval builders. Eval *EvalClient // contains filtered or unexported fields }
Client is the client that holds all ent builders.
func FromContext ¶
FromContext returns a Client stored inside a context, or nil if there isn't one.
func Open ¶
Open opens a database/sql.DB specified by the driver name and the data source name, and returns a new client attached to it. Optional parameters can be added for configuring the client.
func (*Client) Debug ¶
Debug returns a new debug-client. It's used to get verbose logging on specific operations.
client.Debug(). Eval. Query(). Count(ctx)
func (*Client) Intercept ¶
func (c *Client) Intercept(interceptors ...Interceptor)
Intercept adds the query interceptors to all the entity clients. In order to add interceptors to a specific client, call: `client.Node.Intercept(...)`.
func (*Client) Noder ¶
Noder returns a Node by its id. If the NodeType was not provided, it will be derived from the id value according to the universal-id configuration.
c.Noder(ctx, id) c.Noder(ctx, id, ent.WithNodeType(typeResolver))
func (*Client) OpenTx ¶
OpenTx opens a transaction and returns a transactional context along with the created transaction.
type CommitFunc ¶
The CommitFunc type is an adapter to allow the use of ordinary function as a Committer. If f is a function with the appropriate signature, CommitFunc(f) is a Committer that calls f.
type CommitHook ¶
CommitHook defines the "commit middleware". A function that gets a Committer and returns a Committer. For example:
hook := func(next ent.Committer) ent.Committer { return ent.CommitFunc(func(ctx context.Context, tx *ent.Tx) error { // Do some stuff before. if err := next.Commit(ctx, tx); err != nil { return err } // Do some stuff after. return nil }) }
type ConstraintError ¶
type ConstraintError struct {
// contains filtered or unexported fields
}
ConstraintError returns when trying to create/update one or more entities and one or more of their constraints failed. For example, violation of edge or field uniqueness.
func (ConstraintError) Error ¶
func (e ConstraintError) Error() string
Error implements the error interface.
func (*ConstraintError) Unwrap ¶
func (e *ConstraintError) Unwrap() error
Unwrap implements the errors.Wrapper interface.
type Eval ¶
type Eval struct { // ID of the ent. ID int `json:"id,omitempty"` // Snippet holds the value of the "snippet" field. Snippet string `json:"snippet,omitempty"` // Result holds the value of the "result" field. Result []string `json:"result,omitempty"` // Time holds the value of the "time" field. Time string `json:"time,omitempty"` // contains filtered or unexported fields }
Eval is the model entity for the Eval schema.
func (*Eval) IsNode ¶
func (n *Eval) IsNode()
IsNode implements the Node interface check for GQLGen.
func (*Eval) Unwrap ¶
Unwrap unwraps the Eval entity that was returned from a transaction after it was closed, so that all future queries will be executed through the driver which created the transaction.
func (*Eval) Update ¶
func (e *Eval) Update() *EvalUpdateOne
Update returns a builder for updating this Eval. Note that you need to call Eval.Unwrap() before calling this method if this Eval was returned from a transaction, and the transaction was committed or rolled back.
type EvalClient ¶
type EvalClient struct {
// contains filtered or unexported fields
}
EvalClient is a client for the Eval schema.
func NewEvalClient ¶
func NewEvalClient(c config) *EvalClient
NewEvalClient returns a client for the Eval from the given config.
func (*EvalClient) Create ¶
func (c *EvalClient) Create() *EvalCreate
Create returns a builder for creating a Eval entity.
func (*EvalClient) CreateBulk ¶
func (c *EvalClient) CreateBulk(builders ...*EvalCreate) *EvalCreateBulk
CreateBulk returns a builder for creating a bulk of Eval entities.
func (*EvalClient) Delete ¶
func (c *EvalClient) Delete() *EvalDelete
Delete returns a delete builder for Eval.
func (*EvalClient) DeleteOne ¶
func (c *EvalClient) DeleteOne(e *Eval) *EvalDeleteOne
DeleteOne returns a builder for deleting the given entity.
func (*EvalClient) DeleteOneID ¶
func (c *EvalClient) DeleteOneID(id int) *EvalDeleteOne
DeleteOneID returns a builder for deleting the given entity by its id.
func (*EvalClient) GetX ¶
func (c *EvalClient) GetX(ctx context.Context, id int) *Eval
GetX is like Get, but panics if an error occurs.
func (*EvalClient) Intercept ¶
func (c *EvalClient) Intercept(interceptors ...Interceptor)
Intercept adds a list of query interceptors to the interceptors stack. A call to `Intercept(f, g, h)` equals to `eval.Intercept(f(g(h())))`.
func (*EvalClient) Interceptors ¶
func (c *EvalClient) Interceptors() []Interceptor
Interceptors returns the client interceptors.
func (*EvalClient) MapCreateBulk ¶
func (c *EvalClient) MapCreateBulk(slice any, setFunc func(*EvalCreate, int)) *EvalCreateBulk
MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates a builder and applies setFunc on it.
func (*EvalClient) Query ¶
func (c *EvalClient) Query() *EvalQuery
Query returns a query builder for Eval.
func (*EvalClient) Update ¶
func (c *EvalClient) Update() *EvalUpdate
Update returns an update builder for Eval.
func (*EvalClient) UpdateOne ¶
func (c *EvalClient) UpdateOne(e *Eval) *EvalUpdateOne
UpdateOne returns an update builder for the given entity.
func (*EvalClient) UpdateOneID ¶
func (c *EvalClient) UpdateOneID(id int) *EvalUpdateOne
UpdateOneID returns an update builder for the given id.
func (*EvalClient) Use ¶
func (c *EvalClient) Use(hooks ...Hook)
Use adds a list of mutation hooks to the hooks stack. A call to `Use(f, g, h)` equals to `eval.Hooks(f(g(h())))`.
type EvalConnection ¶
type EvalConnection struct { Edges []*EvalEdge `json:"edges"` PageInfo PageInfo `json:"pageInfo"` TotalCount int `json:"totalCount"` }
EvalConnection is the connection containing edges to Eval.
type EvalCreate ¶
type EvalCreate struct {
// contains filtered or unexported fields
}
EvalCreate is the builder for creating a Eval entity.
func (*EvalCreate) Exec ¶
func (ec *EvalCreate) Exec(ctx context.Context) error
Exec executes the query.
func (*EvalCreate) ExecX ¶
func (ec *EvalCreate) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*EvalCreate) Mutation ¶
func (ec *EvalCreate) Mutation() *EvalMutation
Mutation returns the EvalMutation object of the builder.
func (*EvalCreate) Save ¶
func (ec *EvalCreate) Save(ctx context.Context) (*Eval, error)
Save creates the Eval in the database.
func (*EvalCreate) SaveX ¶
func (ec *EvalCreate) SaveX(ctx context.Context) *Eval
SaveX calls Save and panics if Save returns an error.
func (*EvalCreate) SetResult ¶
func (ec *EvalCreate) SetResult(s []string) *EvalCreate
SetResult sets the "result" field.
func (*EvalCreate) SetSnippet ¶
func (ec *EvalCreate) SetSnippet(s string) *EvalCreate
SetSnippet sets the "snippet" field.
func (*EvalCreate) SetTime ¶
func (ec *EvalCreate) SetTime(s string) *EvalCreate
SetTime sets the "time" field.
type EvalCreateBulk ¶
type EvalCreateBulk struct {
// contains filtered or unexported fields
}
EvalCreateBulk is the builder for creating many Eval entities in bulk.
func (*EvalCreateBulk) Exec ¶
func (ecb *EvalCreateBulk) Exec(ctx context.Context) error
Exec executes the query.
func (*EvalCreateBulk) ExecX ¶
func (ecb *EvalCreateBulk) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
type EvalDelete ¶
type EvalDelete struct {
// contains filtered or unexported fields
}
EvalDelete is the builder for deleting a Eval entity.
func (*EvalDelete) Exec ¶
func (ed *EvalDelete) Exec(ctx context.Context) (int, error)
Exec executes the deletion query and returns how many vertices were deleted.
func (*EvalDelete) ExecX ¶
func (ed *EvalDelete) ExecX(ctx context.Context) int
ExecX is like Exec, but panics if an error occurs.
func (*EvalDelete) Where ¶
func (ed *EvalDelete) Where(ps ...predicate.Eval) *EvalDelete
Where appends a list predicates to the EvalDelete builder.
type EvalDeleteOne ¶
type EvalDeleteOne struct {
// contains filtered or unexported fields
}
EvalDeleteOne is the builder for deleting a single Eval entity.
func (*EvalDeleteOne) Exec ¶
func (edo *EvalDeleteOne) Exec(ctx context.Context) error
Exec executes the deletion query.
func (*EvalDeleteOne) ExecX ¶
func (edo *EvalDeleteOne) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*EvalDeleteOne) Where ¶
func (edo *EvalDeleteOne) Where(ps ...predicate.Eval) *EvalDeleteOne
Where appends a list predicates to the EvalDelete builder.
type EvalGroupBy ¶
type EvalGroupBy struct {
// contains filtered or unexported fields
}
EvalGroupBy is the group-by builder for Eval entities.
func (*EvalGroupBy) Aggregate ¶
func (egb *EvalGroupBy) Aggregate(fns ...AggregateFunc) *EvalGroupBy
Aggregate adds the given aggregation functions to the group-by query.
func (*EvalGroupBy) Bool ¶
Bool returns a single bool from a selector. It is only allowed when selecting one field.
func (*EvalGroupBy) Bools ¶
Bools returns list of bools from a selector. It is only allowed when selecting one field.
func (*EvalGroupBy) Float64 ¶
Float64 returns a single float64 from a selector. It is only allowed when selecting one field.
func (*EvalGroupBy) Float64s ¶
Float64s returns list of float64s from a selector. It is only allowed when selecting one field.
func (*EvalGroupBy) Int ¶
Int returns a single int from a selector. It is only allowed when selecting one field.
func (*EvalGroupBy) Ints ¶
Ints returns list of ints from a selector. It is only allowed when selecting one field.
func (*EvalGroupBy) Scan ¶
func (egb *EvalGroupBy) Scan(ctx context.Context, v any) error
Scan applies the selector query and scans the result into the given value.
func (*EvalGroupBy) String ¶
String returns a single string from a selector. It is only allowed when selecting one field.
type EvalMutation ¶
type EvalMutation struct {
// contains filtered or unexported fields
}
EvalMutation represents an operation that mutates the Eval nodes in the graph.
func (*EvalMutation) AddField ¶
func (m *EvalMutation) AddField(name string, value ent.Value) error
AddField adds the value to the field with the given name. It returns an error if the field is not defined in the schema, or if the type mismatched the field type.
func (*EvalMutation) AddedEdges ¶
func (m *EvalMutation) AddedEdges() []string
AddedEdges returns all edge names that were set/added in this mutation.
func (*EvalMutation) AddedField ¶
func (m *EvalMutation) AddedField(name string) (ent.Value, bool)
AddedField returns the numeric value that was incremented/decremented on a field with the given name. The second boolean return value indicates that this field was not set, or was not defined in the schema.
func (*EvalMutation) AddedFields ¶
func (m *EvalMutation) AddedFields() []string
AddedFields returns all numeric fields that were incremented/decremented during this mutation.
func (*EvalMutation) AddedIDs ¶
func (m *EvalMutation) AddedIDs(name string) []ent.Value
AddedIDs returns all IDs (to other nodes) that were added for the given edge name in this mutation.
func (*EvalMutation) AppendResult ¶
func (m *EvalMutation) AppendResult(s []string)
AppendResult adds s to the "result" field.
func (*EvalMutation) AppendedResult ¶
func (m *EvalMutation) AppendedResult() ([]string, bool)
AppendedResult returns the list of values that were appended to the "result" field in this mutation.
func (*EvalMutation) ClearEdge ¶
func (m *EvalMutation) ClearEdge(name string) error
ClearEdge clears the value of the edge with the given name. It returns an error if that edge is not defined in the schema.
func (*EvalMutation) ClearField ¶
func (m *EvalMutation) ClearField(name string) error
ClearField clears the value of the field with the given name. It returns an error if the field is not defined in the schema.
func (*EvalMutation) ClearedEdges ¶
func (m *EvalMutation) ClearedEdges() []string
ClearedEdges returns all edge names that were cleared in this mutation.
func (*EvalMutation) ClearedFields ¶
func (m *EvalMutation) ClearedFields() []string
ClearedFields returns all nullable fields that were cleared during this mutation.
func (EvalMutation) Client ¶
func (m EvalMutation) Client() *Client
Client returns a new `ent.Client` from the mutation. If the mutation was executed in a transaction (ent.Tx), a transactional client is returned.
func (*EvalMutation) EdgeCleared ¶
func (m *EvalMutation) EdgeCleared(name string) bool
EdgeCleared returns a boolean which indicates if the edge with the given name was cleared in this mutation.
func (*EvalMutation) Field ¶
func (m *EvalMutation) Field(name string) (ent.Value, bool)
Field returns the value of a field with the given name. The second boolean return value indicates that this field was not set, or was not defined in the schema.
func (*EvalMutation) FieldCleared ¶
func (m *EvalMutation) FieldCleared(name string) bool
FieldCleared returns a boolean indicating if a field with the given name was cleared in this mutation.
func (*EvalMutation) Fields ¶
func (m *EvalMutation) Fields() []string
Fields returns all fields that were changed during this mutation. Note that in order to get all numeric fields that were incremented/decremented, call AddedFields().
func (*EvalMutation) ID ¶
func (m *EvalMutation) ID() (id int, exists bool)
ID returns the ID value in the mutation. Note that the ID is only available if it was provided to the builder or after it was returned from the database.
func (*EvalMutation) IDs ¶
func (m *EvalMutation) IDs(ctx context.Context) ([]int, error)
IDs queries the database and returns the entity ids that match the mutation's predicate. That means, if the mutation is applied within a transaction with an isolation level such as sql.LevelSerializable, the returned ids match the ids of the rows that will be updated or updated by the mutation.
func (*EvalMutation) OldField ¶
OldField returns the old value of the field from the database. An error is returned if the mutation operation is not UpdateOne, or the query to the database failed.
func (*EvalMutation) OldResult ¶
func (m *EvalMutation) OldResult(ctx context.Context) (v []string, err error)
OldResult returns the old "result" field's value of the Eval entity. If the Eval object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (*EvalMutation) OldSnippet ¶
func (m *EvalMutation) OldSnippet(ctx context.Context) (v string, err error)
OldSnippet returns the old "snippet" field's value of the Eval entity. If the Eval object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (*EvalMutation) OldTime ¶
func (m *EvalMutation) OldTime(ctx context.Context) (v string, err error)
OldTime returns the old "time" field's value of the Eval entity. If the Eval object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (*EvalMutation) RemovedEdges ¶
func (m *EvalMutation) RemovedEdges() []string
RemovedEdges returns all edge names that were removed in this mutation.
func (*EvalMutation) RemovedIDs ¶
func (m *EvalMutation) RemovedIDs(name string) []ent.Value
RemovedIDs returns all IDs (to other nodes) that were removed for the edge with the given name in this mutation.
func (*EvalMutation) ResetEdge ¶
func (m *EvalMutation) ResetEdge(name string) error
ResetEdge resets all changes to the edge with the given name in this mutation. It returns an error if the edge is not defined in the schema.
func (*EvalMutation) ResetField ¶
func (m *EvalMutation) ResetField(name string) error
ResetField resets all changes in the mutation for the field with the given name. It returns an error if the field is not defined in the schema.
func (*EvalMutation) ResetResult ¶
func (m *EvalMutation) ResetResult()
ResetResult resets all changes to the "result" field.
func (*EvalMutation) ResetSnippet ¶
func (m *EvalMutation) ResetSnippet()
ResetSnippet resets all changes to the "snippet" field.
func (*EvalMutation) ResetTime ¶
func (m *EvalMutation) ResetTime()
ResetTime resets all changes to the "time" field.
func (*EvalMutation) Result ¶
func (m *EvalMutation) Result() (r []string, exists bool)
Result returns the value of the "result" field in the mutation.
func (*EvalMutation) SetField ¶
func (m *EvalMutation) SetField(name string, value ent.Value) error
SetField sets the value of a field with the given name. It returns an error if the field is not defined in the schema, or if the type mismatched the field type.
func (*EvalMutation) SetOp ¶
func (m *EvalMutation) SetOp(op Op)
SetOp allows setting the mutation operation.
func (*EvalMutation) SetResult ¶
func (m *EvalMutation) SetResult(s []string)
SetResult sets the "result" field.
func (*EvalMutation) SetSnippet ¶
func (m *EvalMutation) SetSnippet(s string)
SetSnippet sets the "snippet" field.
func (*EvalMutation) SetTime ¶
func (m *EvalMutation) SetTime(s string)
SetTime sets the "time" field.
func (*EvalMutation) Snippet ¶
func (m *EvalMutation) Snippet() (r string, exists bool)
Snippet returns the value of the "snippet" field in the mutation.
func (*EvalMutation) Time ¶
func (m *EvalMutation) Time() (r string, exists bool)
Time returns the value of the "time" field in the mutation.
func (EvalMutation) Tx ¶
func (m EvalMutation) Tx() (*Tx, error)
Tx returns an `ent.Tx` for mutations that were executed in transactions; it returns an error otherwise.
func (*EvalMutation) Type ¶
func (m *EvalMutation) Type() string
Type returns the node type of this mutation (Eval).
func (*EvalMutation) Where ¶
func (m *EvalMutation) Where(ps ...predicate.Eval)
Where appends a list predicates to the EvalMutation builder.
func (*EvalMutation) WhereP ¶
func (m *EvalMutation) WhereP(ps ...func(*sql.Selector))
WhereP appends storage-level predicates to the EvalMutation builder. Using this method, users can use type-assertion to append predicates that do not depend on any generated package.
type EvalOrder ¶
type EvalOrder struct { Direction OrderDirection `json:"direction"` Field *EvalOrderField `json:"field"` }
EvalOrder defines the ordering of Eval.
type EvalOrderField ¶
type EvalOrderField struct { // Value extracts the ordering value from the given Eval. Value func(*Eval) (ent.Value, error) // contains filtered or unexported fields }
EvalOrderField defines the ordering field of Eval.
type EvalPaginateOption ¶
type EvalPaginateOption func(*evalPager) error
EvalPaginateOption enables pagination customization.
func WithEvalFilter ¶
func WithEvalFilter(filter func(*EvalQuery) (*EvalQuery, error)) EvalPaginateOption
WithEvalFilter configures pagination filter.
func WithEvalOrder ¶
func WithEvalOrder(order *EvalOrder) EvalPaginateOption
WithEvalOrder configures pagination ordering.
type EvalQuery ¶
type EvalQuery struct {
// contains filtered or unexported fields
}
EvalQuery is the builder for querying Eval entities.
func (*EvalQuery) Aggregate ¶
func (eq *EvalQuery) Aggregate(fns ...AggregateFunc) *EvalSelect
Aggregate returns a EvalSelect configured with the given aggregations.
func (*EvalQuery) Clone ¶
Clone returns a duplicate of the EvalQuery builder, including all associated steps. It can be used to prepare common query builders and use them differently after the clone is made.
func (*EvalQuery) CollectFields ¶
CollectFields tells the query-builder to eagerly load connected nodes by resolver context.
func (*EvalQuery) First ¶
First returns the first Eval entity from the query. Returns a *NotFoundError when no Eval was found.
func (*EvalQuery) FirstID ¶
FirstID returns the first Eval ID from the query. Returns a *NotFoundError when no Eval ID was found.
func (*EvalQuery) GroupBy ¶
func (eq *EvalQuery) GroupBy(field string, fields ...string) *EvalGroupBy
GroupBy is used to group vertices by one or more fields/columns. It is often used with aggregate functions, like: count, max, mean, min, sum.
Example:
var v []struct { Snippet string `json:"snippet,omitempty"` Count int `json:"count,omitempty"` } client.Eval.Query(). GroupBy(eval.FieldSnippet). Aggregate(ent.Count()). Scan(ctx, &v)
func (*EvalQuery) Only ¶
Only returns a single Eval entity found by the query, ensuring it only returns one. Returns a *NotSingularError when more than one Eval entity is found. Returns a *NotFoundError when no Eval entities are found.
func (*EvalQuery) OnlyID ¶
OnlyID is like Only, but returns the only Eval ID in the query. Returns a *NotSingularError when more than one Eval ID is found. Returns a *NotFoundError when no entities are found.
func (*EvalQuery) Order ¶
func (eq *EvalQuery) Order(o ...eval.OrderOption) *EvalQuery
Order specifies how the records should be ordered.
func (*EvalQuery) Paginate ¶
func (e *EvalQuery) Paginate( ctx context.Context, after *Cursor, first *int, before *Cursor, last *int, opts ...EvalPaginateOption, ) (*EvalConnection, error)
Paginate executes the query and returns a relay based cursor connection to Eval.
func (*EvalQuery) Select ¶
func (eq *EvalQuery) Select(fields ...string) *EvalSelect
Select allows the selection one or more fields/columns for the given query, instead of selecting all fields in the entity.
Example:
var v []struct { Snippet string `json:"snippet,omitempty"` } client.Eval.Query(). Select(eval.FieldSnippet). Scan(ctx, &v)
type EvalSelect ¶
type EvalSelect struct { *EvalQuery // contains filtered or unexported fields }
EvalSelect is the builder for selecting fields of Eval entities.
func (*EvalSelect) Aggregate ¶
func (es *EvalSelect) Aggregate(fns ...AggregateFunc) *EvalSelect
Aggregate adds the given aggregation functions to the selector query.
func (*EvalSelect) Bool ¶
Bool returns a single bool from a selector. It is only allowed when selecting one field.
func (*EvalSelect) Bools ¶
Bools returns list of bools from a selector. It is only allowed when selecting one field.
func (*EvalSelect) Float64 ¶
Float64 returns a single float64 from a selector. It is only allowed when selecting one field.
func (*EvalSelect) Float64s ¶
Float64s returns list of float64s from a selector. It is only allowed when selecting one field.
func (*EvalSelect) Int ¶
Int returns a single int from a selector. It is only allowed when selecting one field.
func (*EvalSelect) Ints ¶
Ints returns list of ints from a selector. It is only allowed when selecting one field.
func (*EvalSelect) Scan ¶
func (es *EvalSelect) Scan(ctx context.Context, v any) error
Scan applies the selector query and scans the result into the given value.
func (*EvalSelect) String ¶
String returns a single string from a selector. It is only allowed when selecting one field.
type EvalUpdate ¶
type EvalUpdate struct {
// contains filtered or unexported fields
}
EvalUpdate is the builder for updating Eval entities.
func (*EvalUpdate) AppendResult ¶
func (eu *EvalUpdate) AppendResult(s []string) *EvalUpdate
AppendResult appends s to the "result" field.
func (*EvalUpdate) Exec ¶
func (eu *EvalUpdate) Exec(ctx context.Context) error
Exec executes the query.
func (*EvalUpdate) ExecX ¶
func (eu *EvalUpdate) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*EvalUpdate) Mutation ¶
func (eu *EvalUpdate) Mutation() *EvalMutation
Mutation returns the EvalMutation object of the builder.
func (*EvalUpdate) Save ¶
func (eu *EvalUpdate) Save(ctx context.Context) (int, error)
Save executes the query and returns the number of nodes affected by the update operation.
func (*EvalUpdate) SaveX ¶
func (eu *EvalUpdate) SaveX(ctx context.Context) int
SaveX is like Save, but panics if an error occurs.
func (*EvalUpdate) SetResult ¶
func (eu *EvalUpdate) SetResult(s []string) *EvalUpdate
SetResult sets the "result" field.
func (*EvalUpdate) SetSnippet ¶
func (eu *EvalUpdate) SetSnippet(s string) *EvalUpdate
SetSnippet sets the "snippet" field.
func (*EvalUpdate) SetTime ¶
func (eu *EvalUpdate) SetTime(s string) *EvalUpdate
SetTime sets the "time" field.
func (*EvalUpdate) Where ¶
func (eu *EvalUpdate) Where(ps ...predicate.Eval) *EvalUpdate
Where appends a list predicates to the EvalUpdate builder.
type EvalUpdateOne ¶
type EvalUpdateOne struct {
// contains filtered or unexported fields
}
EvalUpdateOne is the builder for updating a single Eval entity.
func (*EvalUpdateOne) AppendResult ¶
func (euo *EvalUpdateOne) AppendResult(s []string) *EvalUpdateOne
AppendResult appends s to the "result" field.
func (*EvalUpdateOne) Exec ¶
func (euo *EvalUpdateOne) Exec(ctx context.Context) error
Exec executes the query on the entity.
func (*EvalUpdateOne) ExecX ¶
func (euo *EvalUpdateOne) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*EvalUpdateOne) Mutation ¶
func (euo *EvalUpdateOne) Mutation() *EvalMutation
Mutation returns the EvalMutation object of the builder.
func (*EvalUpdateOne) Save ¶
func (euo *EvalUpdateOne) Save(ctx context.Context) (*Eval, error)
Save executes the query and returns the updated Eval entity.
func (*EvalUpdateOne) SaveX ¶
func (euo *EvalUpdateOne) SaveX(ctx context.Context) *Eval
SaveX is like Save, but panics if an error occurs.
func (*EvalUpdateOne) Select ¶
func (euo *EvalUpdateOne) Select(field string, fields ...string) *EvalUpdateOne
Select allows selecting one or more fields (columns) of the returned entity. The default is selecting all fields defined in the entity schema.
func (*EvalUpdateOne) SetResult ¶
func (euo *EvalUpdateOne) SetResult(s []string) *EvalUpdateOne
SetResult sets the "result" field.
func (*EvalUpdateOne) SetSnippet ¶
func (euo *EvalUpdateOne) SetSnippet(s string) *EvalUpdateOne
SetSnippet sets the "snippet" field.
func (*EvalUpdateOne) SetTime ¶
func (euo *EvalUpdateOne) SetTime(s string) *EvalUpdateOne
SetTime sets the "time" field.
func (*EvalUpdateOne) Where ¶
func (euo *EvalUpdateOne) Where(ps ...predicate.Eval) *EvalUpdateOne
Where appends a list predicates to the EvalUpdate builder.
type InterceptFunc ¶
type InterceptFunc = ent.InterceptFunc
ent aliases to avoid import conflicts in user's code.
type Interceptor ¶
type Interceptor = ent.Interceptor
ent aliases to avoid import conflicts in user's code.
type MutateFunc ¶
type MutateFunc = ent.MutateFunc
ent aliases to avoid import conflicts in user's code.
type NodeOption ¶
type NodeOption func(*nodeOptions)
NodeOption allows configuring the Noder execution using functional options.
func WithFixedNodeType ¶
func WithFixedNodeType(t string) NodeOption
WithFixedNodeType sets the Type of the node to a fixed value.
func WithNodeType ¶
WithNodeType sets the node Type resolver function (i.e. the table to query). If was not provided, the table will be derived from the universal-id configuration as described in: https://entgo.io/docs/migrate/#universal-ids.
type NotFoundError ¶
type NotFoundError struct {
// contains filtered or unexported fields
}
NotFoundError returns when trying to fetch a specific entity and it was not found in the database.
func (*NotFoundError) Error ¶
func (e *NotFoundError) Error() string
Error implements the error interface.
type NotLoadedError ¶
type NotLoadedError struct {
// contains filtered or unexported fields
}
NotLoadedError returns when trying to get a node that was not loaded by the query.
func (*NotLoadedError) Error ¶
func (e *NotLoadedError) Error() string
Error implements the error interface.
type NotSingularError ¶
type NotSingularError struct {
// contains filtered or unexported fields
}
NotSingularError returns when trying to fetch a singular entity and more then one was found in the database.
func (*NotSingularError) Error ¶
func (e *NotSingularError) Error() string
Error implements the error interface.
type OrderFunc ¶
OrderFunc applies an ordering on the sql selector. Deprecated: Use Asc/Desc functions or the package builders instead.
type QuerierFunc ¶
type QuerierFunc = ent.QuerierFunc
ent aliases to avoid import conflicts in user's code.
type QueryContext ¶
type QueryContext = ent.QueryContext
ent aliases to avoid import conflicts in user's code.
type RollbackFunc ¶
The RollbackFunc type is an adapter to allow the use of ordinary function as a Rollbacker. If f is a function with the appropriate signature, RollbackFunc(f) is a Rollbacker that calls f.
type RollbackHook ¶
type RollbackHook func(Rollbacker) Rollbacker
RollbackHook defines the "rollback middleware". A function that gets a Rollbacker and returns a Rollbacker. For example:
hook := func(next ent.Rollbacker) ent.Rollbacker { return ent.RollbackFunc(func(ctx context.Context, tx *ent.Tx) error { // Do some stuff before. if err := next.Rollback(ctx, tx); err != nil { return err } // Do some stuff after. return nil }) }
type Rollbacker ¶
Rollbacker is the interface that wraps the Rollback method.
type TraverseFunc ¶
type TraverseFunc = ent.TraverseFunc
ent aliases to avoid import conflicts in user's code.
type Tx ¶
type Tx struct { // Eval is the client for interacting with the Eval builders. Eval *EvalClient // contains filtered or unexported fields }
Tx is a transactional client that is created by calling Client.Tx().
func TxFromContext ¶
TxFromContext returns a Tx stored inside a context, or nil if there isn't one.
func (*Tx) OnRollback ¶
func (tx *Tx) OnRollback(f RollbackHook)
OnRollback adds a hook to call on rollback.
type ValidationError ¶
type ValidationError struct { Name string // Field or edge name. // contains filtered or unexported fields }
ValidationError returns when validating a field or edge fails.
func (*ValidationError) Error ¶
func (e *ValidationError) Error() string
Error implements the error interface.
func (*ValidationError) Unwrap ¶
func (e *ValidationError) Unwrap() error
Unwrap implements the errors.Wrapper interface.