Documentation
¶
Index ¶
- Constants
- Variables
- func Asc(fields ...string) func(*sql.Selector)
- func Desc(fields ...string) func(*sql.Selector)
- func GlobalID(tp, id string) (string, error)
- func IntFromGlobalID(s string) (int, error)
- 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) NoderEx(ctx context.Context, id string) (Noder, error)
- func (c *Client) Noders(ctx context.Context, ids []int, opts ...NodeOption) ([]Noder, error)
- func (c *Client) NodersEx(ctx context.Context, ids []string, 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 Hook
- type InterceptFunc
- type Interceptor
- type MutateFunc
- type Mutation
- type Mutator
- type NoCache
- func (nc *NoCache) GlobalID(context.Context) (string, error)
- func (*NoCache) IsNode()
- func (nc *NoCache) String() string
- func (nc *NoCache) ToEdge(order *NoCacheOrder) *NoCacheEdge
- func (nc *NoCache) Unwrap() *NoCache
- func (nc *NoCache) Update() *NoCacheUpdateOne
- func (nc *NoCache) Value(name string) (ent.Value, error)
- type NoCacheClient
- func (c *NoCacheClient) Create() *NoCacheCreate
- func (c *NoCacheClient) CreateBulk(builders ...*NoCacheCreate) *NoCacheCreateBulk
- func (c *NoCacheClient) Delete() *NoCacheDelete
- func (c *NoCacheClient) DeleteOne(nc *NoCache) *NoCacheDeleteOne
- func (c *NoCacheClient) DeleteOneID(id int) *NoCacheDeleteOne
- func (c *NoCacheClient) Get(ctx context.Context, id int) (*NoCache, error)
- func (c *NoCacheClient) GetX(ctx context.Context, id int) *NoCache
- func (c *NoCacheClient) Hooks() []Hook
- func (c *NoCacheClient) Intercept(interceptors ...Interceptor)
- func (c *NoCacheClient) Interceptors() []Interceptor
- func (c *NoCacheClient) MapCreateBulk(slice any, setFunc func(*NoCacheCreate, int)) *NoCacheCreateBulk
- func (c *NoCacheClient) Query() *NoCacheQuery
- func (c *NoCacheClient) Update() *NoCacheUpdate
- func (c *NoCacheClient) UpdateOne(nc *NoCache) *NoCacheUpdateOne
- func (c *NoCacheClient) UpdateOneID(id int) *NoCacheUpdateOne
- func (c *NoCacheClient) Use(hooks ...Hook)
- type NoCacheConnection
- type NoCacheCreate
- func (ncc *NoCacheCreate) Exec(ctx context.Context) error
- func (ncc *NoCacheCreate) ExecX(ctx context.Context)
- func (ncc *NoCacheCreate) Mutation() *NoCacheMutation
- func (ncc *NoCacheCreate) Save(ctx context.Context) (*NoCache, error)
- func (ncc *NoCacheCreate) SaveX(ctx context.Context) *NoCache
- func (ncc *NoCacheCreate) SetName(s string) *NoCacheCreate
- func (ncc *NoCacheCreate) SetUserID(i int) *NoCacheCreate
- type NoCacheCreateBulk
- type NoCacheDelete
- type NoCacheDeleteOne
- type NoCacheEdge
- type NoCacheGroupBy
- func (ncgb *NoCacheGroupBy) Aggregate(fns ...AggregateFunc) *NoCacheGroupBy
- func (s *NoCacheGroupBy) Bool(ctx context.Context) (_ bool, err error)
- func (s *NoCacheGroupBy) BoolX(ctx context.Context) bool
- func (s *NoCacheGroupBy) Bools(ctx context.Context) ([]bool, error)
- func (s *NoCacheGroupBy) BoolsX(ctx context.Context) []bool
- func (s *NoCacheGroupBy) Float64(ctx context.Context) (_ float64, err error)
- func (s *NoCacheGroupBy) Float64X(ctx context.Context) float64
- func (s *NoCacheGroupBy) Float64s(ctx context.Context) ([]float64, error)
- func (s *NoCacheGroupBy) Float64sX(ctx context.Context) []float64
- func (s *NoCacheGroupBy) Int(ctx context.Context) (_ int, err error)
- func (s *NoCacheGroupBy) IntX(ctx context.Context) int
- func (s *NoCacheGroupBy) Ints(ctx context.Context) ([]int, error)
- func (s *NoCacheGroupBy) IntsX(ctx context.Context) []int
- func (ncgb *NoCacheGroupBy) Scan(ctx context.Context, v any) error
- func (s *NoCacheGroupBy) ScanX(ctx context.Context, v any)
- func (s *NoCacheGroupBy) String(ctx context.Context) (_ string, err error)
- func (s *NoCacheGroupBy) StringX(ctx context.Context) string
- func (s *NoCacheGroupBy) Strings(ctx context.Context) ([]string, error)
- func (s *NoCacheGroupBy) StringsX(ctx context.Context) []string
- type NoCacheMutation
- func (m *NoCacheMutation) AddField(name string, value ent.Value) error
- func (m *NoCacheMutation) AddUserID(i int)
- func (m *NoCacheMutation) AddedEdges() []string
- func (m *NoCacheMutation) AddedField(name string) (ent.Value, bool)
- func (m *NoCacheMutation) AddedFields() []string
- func (m *NoCacheMutation) AddedIDs(name string) []ent.Value
- func (m *NoCacheMutation) AddedUserID() (r int, exists bool)
- func (m *NoCacheMutation) ClearEdge(name string) error
- func (m *NoCacheMutation) ClearField(name string) error
- func (m *NoCacheMutation) ClearedEdges() []string
- func (m *NoCacheMutation) ClearedFields() []string
- func (m NoCacheMutation) Client() *Client
- func (m *NoCacheMutation) EdgeCleared(name string) bool
- func (m *NoCacheMutation) Field(name string) (ent.Value, bool)
- func (m *NoCacheMutation) FieldCleared(name string) bool
- func (m *NoCacheMutation) Fields() []string
- func (m *NoCacheMutation) ID() (id int, exists bool)
- func (m *NoCacheMutation) IDs(ctx context.Context) ([]int, error)
- func (m *NoCacheMutation) Name() (r string, exists bool)
- func (m *NoCacheMutation) OldField(ctx context.Context, name string) (ent.Value, error)
- func (m *NoCacheMutation) OldName(ctx context.Context) (v string, err error)
- func (m *NoCacheMutation) OldUserID(ctx context.Context) (v int, err error)
- func (m *NoCacheMutation) Op() Op
- func (m *NoCacheMutation) RemovedEdges() []string
- func (m *NoCacheMutation) RemovedIDs(name string) []ent.Value
- func (m *NoCacheMutation) ResetEdge(name string) error
- func (m *NoCacheMutation) ResetField(name string) error
- func (m *NoCacheMutation) ResetName()
- func (m *NoCacheMutation) ResetUserID()
- func (m *NoCacheMutation) SetField(name string, value ent.Value) error
- func (m *NoCacheMutation) SetName(s string)
- func (m *NoCacheMutation) SetOp(op Op)
- func (m *NoCacheMutation) SetUserID(i int)
- func (m NoCacheMutation) Tx() (*Tx, error)
- func (m *NoCacheMutation) Type() string
- func (m *NoCacheMutation) UserID() (r int, exists bool)
- func (m *NoCacheMutation) Where(ps ...predicate.NoCache)
- func (m *NoCacheMutation) WhereP(ps ...func(*sql.Selector))
- type NoCacheOrder
- type NoCacheOrderField
- type NoCachePaginateOption
- type NoCacheQuery
- func (ncq *NoCacheQuery) Aggregate(fns ...AggregateFunc) *NoCacheSelect
- func (ncq *NoCacheQuery) All(ctx context.Context) ([]*NoCache, error)
- func (ncq *NoCacheQuery) AllX(ctx context.Context) []*NoCache
- func (ncq *NoCacheQuery) Clone() *NoCacheQuery
- func (nc *NoCacheQuery) CollectFields(ctx context.Context, satisfies ...string) (*NoCacheQuery, error)
- func (ncq *NoCacheQuery) Count(ctx context.Context) (int, error)
- func (ncq *NoCacheQuery) CountX(ctx context.Context) int
- func (ncq *NoCacheQuery) Exist(ctx context.Context) (bool, error)
- func (ncq *NoCacheQuery) ExistX(ctx context.Context) bool
- func (ncq *NoCacheQuery) First(ctx context.Context) (*NoCache, error)
- func (ncq *NoCacheQuery) FirstID(ctx context.Context) (id int, err error)
- func (ncq *NoCacheQuery) FirstIDX(ctx context.Context) int
- func (ncq *NoCacheQuery) FirstX(ctx context.Context) *NoCache
- func (ncq *NoCacheQuery) GroupBy(field string, fields ...string) *NoCacheGroupBy
- func (ncq *NoCacheQuery) IDs(ctx context.Context) (ids []int, err error)
- func (ncq *NoCacheQuery) IDsX(ctx context.Context) []int
- func (ncq *NoCacheQuery) Limit(limit int) *NoCacheQuery
- func (ncq *NoCacheQuery) Offset(offset int) *NoCacheQuery
- func (ncq *NoCacheQuery) Only(ctx context.Context) (*NoCache, error)
- func (ncq *NoCacheQuery) OnlyID(ctx context.Context) (id int, err error)
- func (ncq *NoCacheQuery) OnlyIDX(ctx context.Context) int
- func (ncq *NoCacheQuery) OnlyX(ctx context.Context) *NoCache
- func (ncq *NoCacheQuery) Order(o ...nocache.OrderOption) *NoCacheQuery
- func (nc *NoCacheQuery) Paginate(ctx context.Context, after *Cursor, first *int, before *Cursor, last *int, ...) (*NoCacheConnection, error)
- func (ncq *NoCacheQuery) Select(fields ...string) *NoCacheSelect
- func (ncq *NoCacheQuery) Unique(unique bool) *NoCacheQuery
- func (ncq *NoCacheQuery) Where(ps ...predicate.NoCache) *NoCacheQuery
- type NoCacheSelect
- func (ncs *NoCacheSelect) Aggregate(fns ...AggregateFunc) *NoCacheSelect
- func (s *NoCacheSelect) Bool(ctx context.Context) (_ bool, err error)
- func (s *NoCacheSelect) BoolX(ctx context.Context) bool
- func (s *NoCacheSelect) Bools(ctx context.Context) ([]bool, error)
- func (s *NoCacheSelect) BoolsX(ctx context.Context) []bool
- func (s *NoCacheSelect) Float64(ctx context.Context) (_ float64, err error)
- func (s *NoCacheSelect) Float64X(ctx context.Context) float64
- func (s *NoCacheSelect) Float64s(ctx context.Context) ([]float64, error)
- func (s *NoCacheSelect) Float64sX(ctx context.Context) []float64
- func (s *NoCacheSelect) Int(ctx context.Context) (_ int, err error)
- func (s *NoCacheSelect) IntX(ctx context.Context) int
- func (s *NoCacheSelect) Ints(ctx context.Context) ([]int, error)
- func (s *NoCacheSelect) IntsX(ctx context.Context) []int
- func (ncs *NoCacheSelect) Scan(ctx context.Context, v any) error
- func (s *NoCacheSelect) ScanX(ctx context.Context, v any)
- func (s *NoCacheSelect) String(ctx context.Context) (_ string, err error)
- func (s *NoCacheSelect) StringX(ctx context.Context) string
- func (s *NoCacheSelect) Strings(ctx context.Context) ([]string, error)
- func (s *NoCacheSelect) StringsX(ctx context.Context) []string
- type NoCacheUpdate
- func (ncu *NoCacheUpdate) AddUserID(i int) *NoCacheUpdate
- func (ncu *NoCacheUpdate) Exec(ctx context.Context) error
- func (ncu *NoCacheUpdate) ExecX(ctx context.Context)
- func (ncu *NoCacheUpdate) Mutation() *NoCacheMutation
- func (ncu *NoCacheUpdate) Save(ctx context.Context) (int, error)
- func (ncu *NoCacheUpdate) SaveX(ctx context.Context) int
- func (ncu *NoCacheUpdate) SetName(s string) *NoCacheUpdate
- func (ncu *NoCacheUpdate) SetNillableName(s *string) *NoCacheUpdate
- func (ncu *NoCacheUpdate) SetNillableUserID(i *int) *NoCacheUpdate
- func (ncu *NoCacheUpdate) SetUserID(i int) *NoCacheUpdate
- func (ncu *NoCacheUpdate) Where(ps ...predicate.NoCache) *NoCacheUpdate
- type NoCacheUpdateOne
- func (ncuo *NoCacheUpdateOne) AddUserID(i int) *NoCacheUpdateOne
- func (ncuo *NoCacheUpdateOne) Exec(ctx context.Context) error
- func (ncuo *NoCacheUpdateOne) ExecX(ctx context.Context)
- func (ncuo *NoCacheUpdateOne) Mutation() *NoCacheMutation
- func (ncuo *NoCacheUpdateOne) Save(ctx context.Context) (*NoCache, error)
- func (ncuo *NoCacheUpdateOne) SaveX(ctx context.Context) *NoCache
- func (ncuo *NoCacheUpdateOne) Select(field string, fields ...string) *NoCacheUpdateOne
- func (ncuo *NoCacheUpdateOne) SetName(s string) *NoCacheUpdateOne
- func (ncuo *NoCacheUpdateOne) SetNillableName(s *string) *NoCacheUpdateOne
- func (ncuo *NoCacheUpdateOne) SetNillableUserID(i *int) *NoCacheUpdateOne
- func (ncuo *NoCacheUpdateOne) SetUserID(i int) *NoCacheUpdateOne
- func (ncuo *NoCacheUpdateOne) Where(ps ...predicate.NoCache) *NoCacheUpdateOne
- type NoCacheWhereInput
- type NoCaches
- 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 ResolvedGlobal
- 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. TypeNoCache = "NoCache" )
Variables ¶
var DefaultNoCacheOrder = &NoCacheOrder{ Direction: entgql.OrderDirectionAsc, Field: &NoCacheOrderField{ Value: func(nc *NoCache) (ent.Value, error) { return nc.ID, nil }, column: nocache.FieldID, toTerm: nocache.ByID, toCursor: func(nc *NoCache) Cursor { return Cursor{ID: nc.ID} }, }, }
DefaultNoCacheOrder is the default ordering of NoCache.
var ErrEmptyNoCacheWhereInput = errors.New("ent: empty predicate NoCacheWhereInput")
ErrEmptyNoCacheWhereInput is returned in case the NoCacheWhereInput is empty.
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 IntFromGlobalID ¶
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 // NoCache is the client for interacting with the NoCache builders. NoCache *NoCacheClient // 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(). NoCache. 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 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 NoCache ¶
type NoCache struct { // ID of the ent. ID int `json:"id,omitempty"` // Name holds the value of the "name" field. Name string `json:"name,omitempty"` // UserID holds the value of the "user_id" field. UserID int `json:"user_id,omitempty"` // contains filtered or unexported fields }
NoCache is the model entity for the NoCache schema.
func (*NoCache) IsNode ¶
func (*NoCache) IsNode()
IsNode implements the Node interface check for GQLGen.
func (*NoCache) ToEdge ¶
func (nc *NoCache) ToEdge(order *NoCacheOrder) *NoCacheEdge
ToEdge converts NoCache into NoCacheEdge.
func (*NoCache) Unwrap ¶
Unwrap unwraps the NoCache 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 (*NoCache) Update ¶
func (nc *NoCache) Update() *NoCacheUpdateOne
Update returns a builder for updating this NoCache. Note that you need to call NoCache.Unwrap() before calling this method if this NoCache was returned from a transaction, and the transaction was committed or rolled back.
type NoCacheClient ¶
type NoCacheClient struct {
// contains filtered or unexported fields
}
NoCacheClient is a client for the NoCache schema.
func NewNoCacheClient ¶
func NewNoCacheClient(c config) *NoCacheClient
NewNoCacheClient returns a client for the NoCache from the given config.
func (*NoCacheClient) Create ¶
func (c *NoCacheClient) Create() *NoCacheCreate
Create returns a builder for creating a NoCache entity.
func (*NoCacheClient) CreateBulk ¶
func (c *NoCacheClient) CreateBulk(builders ...*NoCacheCreate) *NoCacheCreateBulk
CreateBulk returns a builder for creating a bulk of NoCache entities.
func (*NoCacheClient) Delete ¶
func (c *NoCacheClient) Delete() *NoCacheDelete
Delete returns a delete builder for NoCache.
func (*NoCacheClient) DeleteOne ¶
func (c *NoCacheClient) DeleteOne(nc *NoCache) *NoCacheDeleteOne
DeleteOne returns a builder for deleting the given entity.
func (*NoCacheClient) DeleteOneID ¶
func (c *NoCacheClient) DeleteOneID(id int) *NoCacheDeleteOne
DeleteOneID returns a builder for deleting the given entity by its id.
func (*NoCacheClient) GetX ¶
func (c *NoCacheClient) GetX(ctx context.Context, id int) *NoCache
GetX is like Get, but panics if an error occurs.
func (*NoCacheClient) Hooks ¶
func (c *NoCacheClient) Hooks() []Hook
Hooks returns the client hooks.
func (*NoCacheClient) Intercept ¶
func (c *NoCacheClient) Intercept(interceptors ...Interceptor)
Intercept adds a list of query interceptors to the interceptors stack. A call to `Intercept(f, g, h)` equals to `nocache.Intercept(f(g(h())))`.
func (*NoCacheClient) Interceptors ¶
func (c *NoCacheClient) Interceptors() []Interceptor
Interceptors returns the client interceptors.
func (*NoCacheClient) MapCreateBulk ¶
func (c *NoCacheClient) MapCreateBulk(slice any, setFunc func(*NoCacheCreate, int)) *NoCacheCreateBulk
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 (*NoCacheClient) Query ¶
func (c *NoCacheClient) Query() *NoCacheQuery
Query returns a query builder for NoCache.
func (*NoCacheClient) Update ¶
func (c *NoCacheClient) Update() *NoCacheUpdate
Update returns an update builder for NoCache.
func (*NoCacheClient) UpdateOne ¶
func (c *NoCacheClient) UpdateOne(nc *NoCache) *NoCacheUpdateOne
UpdateOne returns an update builder for the given entity.
func (*NoCacheClient) UpdateOneID ¶
func (c *NoCacheClient) UpdateOneID(id int) *NoCacheUpdateOne
UpdateOneID returns an update builder for the given id.
func (*NoCacheClient) Use ¶
func (c *NoCacheClient) Use(hooks ...Hook)
Use adds a list of mutation hooks to the hooks stack. A call to `Use(f, g, h)` equals to `nocache.Hooks(f(g(h())))`.
type NoCacheConnection ¶
type NoCacheConnection struct { Edges []*NoCacheEdge `json:"edges"` PageInfo PageInfo `json:"pageInfo"` TotalCount int `json:"totalCount"` }
NoCacheConnection is the connection containing edges to NoCache.
type NoCacheCreate ¶
type NoCacheCreate struct {
// contains filtered or unexported fields
}
NoCacheCreate is the builder for creating a NoCache entity.
func (*NoCacheCreate) Exec ¶
func (ncc *NoCacheCreate) Exec(ctx context.Context) error
Exec executes the query.
func (*NoCacheCreate) ExecX ¶
func (ncc *NoCacheCreate) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*NoCacheCreate) Mutation ¶
func (ncc *NoCacheCreate) Mutation() *NoCacheMutation
Mutation returns the NoCacheMutation object of the builder.
func (*NoCacheCreate) Save ¶
func (ncc *NoCacheCreate) Save(ctx context.Context) (*NoCache, error)
Save creates the NoCache in the database.
func (*NoCacheCreate) SaveX ¶
func (ncc *NoCacheCreate) SaveX(ctx context.Context) *NoCache
SaveX calls Save and panics if Save returns an error.
func (*NoCacheCreate) SetName ¶
func (ncc *NoCacheCreate) SetName(s string) *NoCacheCreate
SetName sets the "name" field.
func (*NoCacheCreate) SetUserID ¶
func (ncc *NoCacheCreate) SetUserID(i int) *NoCacheCreate
SetUserID sets the "user_id" field.
type NoCacheCreateBulk ¶
type NoCacheCreateBulk struct {
// contains filtered or unexported fields
}
NoCacheCreateBulk is the builder for creating many NoCache entities in bulk.
func (*NoCacheCreateBulk) Exec ¶
func (nccb *NoCacheCreateBulk) Exec(ctx context.Context) error
Exec executes the query.
func (*NoCacheCreateBulk) ExecX ¶
func (nccb *NoCacheCreateBulk) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
type NoCacheDelete ¶
type NoCacheDelete struct {
// contains filtered or unexported fields
}
NoCacheDelete is the builder for deleting a NoCache entity.
func (*NoCacheDelete) Exec ¶
func (ncd *NoCacheDelete) Exec(ctx context.Context) (int, error)
Exec executes the deletion query and returns how many vertices were deleted.
func (*NoCacheDelete) ExecX ¶
func (ncd *NoCacheDelete) ExecX(ctx context.Context) int
ExecX is like Exec, but panics if an error occurs.
func (*NoCacheDelete) Where ¶
func (ncd *NoCacheDelete) Where(ps ...predicate.NoCache) *NoCacheDelete
Where appends a list predicates to the NoCacheDelete builder.
type NoCacheDeleteOne ¶
type NoCacheDeleteOne struct {
// contains filtered or unexported fields
}
NoCacheDeleteOne is the builder for deleting a single NoCache entity.
func (*NoCacheDeleteOne) Exec ¶
func (ncdo *NoCacheDeleteOne) Exec(ctx context.Context) error
Exec executes the deletion query.
func (*NoCacheDeleteOne) ExecX ¶
func (ncdo *NoCacheDeleteOne) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*NoCacheDeleteOne) Where ¶
func (ncdo *NoCacheDeleteOne) Where(ps ...predicate.NoCache) *NoCacheDeleteOne
Where appends a list predicates to the NoCacheDelete builder.
type NoCacheEdge ¶
NoCacheEdge is the edge representation of NoCache.
type NoCacheGroupBy ¶
type NoCacheGroupBy struct {
// contains filtered or unexported fields
}
NoCacheGroupBy is the group-by builder for NoCache entities.
func (*NoCacheGroupBy) Aggregate ¶
func (ncgb *NoCacheGroupBy) Aggregate(fns ...AggregateFunc) *NoCacheGroupBy
Aggregate adds the given aggregation functions to the group-by query.
func (*NoCacheGroupBy) Bool ¶
Bool returns a single bool from a selector. It is only allowed when selecting one field.
func (*NoCacheGroupBy) Bools ¶
Bools returns list of bools from a selector. It is only allowed when selecting one field.
func (*NoCacheGroupBy) Float64 ¶
Float64 returns a single float64 from a selector. It is only allowed when selecting one field.
func (*NoCacheGroupBy) Float64s ¶
Float64s returns list of float64s from a selector. It is only allowed when selecting one field.
func (*NoCacheGroupBy) Int ¶
Int returns a single int from a selector. It is only allowed when selecting one field.
func (*NoCacheGroupBy) Ints ¶
Ints returns list of ints from a selector. It is only allowed when selecting one field.
func (*NoCacheGroupBy) Scan ¶
func (ncgb *NoCacheGroupBy) Scan(ctx context.Context, v any) error
Scan applies the selector query and scans the result into the given value.
func (*NoCacheGroupBy) String ¶
String returns a single string from a selector. It is only allowed when selecting one field.
type NoCacheMutation ¶
type NoCacheMutation struct {
// contains filtered or unexported fields
}
NoCacheMutation represents an operation that mutates the NoCache nodes in the graph.
func (*NoCacheMutation) AddField ¶
func (m *NoCacheMutation) 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 (*NoCacheMutation) AddUserID ¶
func (m *NoCacheMutation) AddUserID(i int)
AddUserID adds i to the "user_id" field.
func (*NoCacheMutation) AddedEdges ¶
func (m *NoCacheMutation) AddedEdges() []string
AddedEdges returns all edge names that were set/added in this mutation.
func (*NoCacheMutation) AddedField ¶
func (m *NoCacheMutation) 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 (*NoCacheMutation) AddedFields ¶
func (m *NoCacheMutation) AddedFields() []string
AddedFields returns all numeric fields that were incremented/decremented during this mutation.
func (*NoCacheMutation) AddedIDs ¶
func (m *NoCacheMutation) AddedIDs(name string) []ent.Value
AddedIDs returns all IDs (to other nodes) that were added for the given edge name in this mutation.
func (*NoCacheMutation) AddedUserID ¶
func (m *NoCacheMutation) AddedUserID() (r int, exists bool)
AddedUserID returns the value that was added to the "user_id" field in this mutation.
func (*NoCacheMutation) ClearEdge ¶
func (m *NoCacheMutation) 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 (*NoCacheMutation) ClearField ¶
func (m *NoCacheMutation) 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 (*NoCacheMutation) ClearedEdges ¶
func (m *NoCacheMutation) ClearedEdges() []string
ClearedEdges returns all edge names that were cleared in this mutation.
func (*NoCacheMutation) ClearedFields ¶
func (m *NoCacheMutation) ClearedFields() []string
ClearedFields returns all nullable fields that were cleared during this mutation.
func (NoCacheMutation) Client ¶
func (m NoCacheMutation) 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 (*NoCacheMutation) EdgeCleared ¶
func (m *NoCacheMutation) EdgeCleared(name string) bool
EdgeCleared returns a boolean which indicates if the edge with the given name was cleared in this mutation.
func (*NoCacheMutation) Field ¶
func (m *NoCacheMutation) 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 (*NoCacheMutation) FieldCleared ¶
func (m *NoCacheMutation) FieldCleared(name string) bool
FieldCleared returns a boolean indicating if a field with the given name was cleared in this mutation.
func (*NoCacheMutation) Fields ¶
func (m *NoCacheMutation) 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 (*NoCacheMutation) ID ¶
func (m *NoCacheMutation) 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 (*NoCacheMutation) IDs ¶
func (m *NoCacheMutation) 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 (*NoCacheMutation) Name ¶
func (m *NoCacheMutation) Name() (r string, exists bool)
Name returns the value of the "name" field in the mutation.
func (*NoCacheMutation) 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 (*NoCacheMutation) OldName ¶
func (m *NoCacheMutation) OldName(ctx context.Context) (v string, err error)
OldName returns the old "name" field's value of the NoCache entity. If the NoCache 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 (*NoCacheMutation) OldUserID ¶
func (m *NoCacheMutation) OldUserID(ctx context.Context) (v int, err error)
OldUserID returns the old "user_id" field's value of the NoCache entity. If the NoCache 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 (*NoCacheMutation) RemovedEdges ¶
func (m *NoCacheMutation) RemovedEdges() []string
RemovedEdges returns all edge names that were removed in this mutation.
func (*NoCacheMutation) RemovedIDs ¶
func (m *NoCacheMutation) 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 (*NoCacheMutation) ResetEdge ¶
func (m *NoCacheMutation) 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 (*NoCacheMutation) ResetField ¶
func (m *NoCacheMutation) 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 (*NoCacheMutation) ResetName ¶
func (m *NoCacheMutation) ResetName()
ResetName resets all changes to the "name" field.
func (*NoCacheMutation) ResetUserID ¶
func (m *NoCacheMutation) ResetUserID()
ResetUserID resets all changes to the "user_id" field.
func (*NoCacheMutation) SetField ¶
func (m *NoCacheMutation) 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 (*NoCacheMutation) SetName ¶
func (m *NoCacheMutation) SetName(s string)
SetName sets the "name" field.
func (*NoCacheMutation) SetOp ¶
func (m *NoCacheMutation) SetOp(op Op)
SetOp allows setting the mutation operation.
func (*NoCacheMutation) SetUserID ¶
func (m *NoCacheMutation) SetUserID(i int)
SetUserID sets the "user_id" field.
func (NoCacheMutation) Tx ¶
func (m NoCacheMutation) Tx() (*Tx, error)
Tx returns an `ent.Tx` for mutations that were executed in transactions; it returns an error otherwise.
func (*NoCacheMutation) Type ¶
func (m *NoCacheMutation) Type() string
Type returns the node type of this mutation (NoCache).
func (*NoCacheMutation) UserID ¶
func (m *NoCacheMutation) UserID() (r int, exists bool)
UserID returns the value of the "user_id" field in the mutation.
func (*NoCacheMutation) Where ¶
func (m *NoCacheMutation) Where(ps ...predicate.NoCache)
Where appends a list predicates to the NoCacheMutation builder.
func (*NoCacheMutation) WhereP ¶
func (m *NoCacheMutation) WhereP(ps ...func(*sql.Selector))
WhereP appends storage-level predicates to the NoCacheMutation builder. Using this method, users can use type-assertion to append predicates that do not depend on any generated package.
type NoCacheOrder ¶
type NoCacheOrder struct { Direction OrderDirection `json:"direction"` Field *NoCacheOrderField `json:"field"` }
NoCacheOrder defines the ordering of NoCache.
type NoCacheOrderField ¶
type NoCacheOrderField struct { // Value extracts the ordering value from the given NoCache. Value func(*NoCache) (ent.Value, error) // contains filtered or unexported fields }
NoCacheOrderField defines the ordering field of NoCache.
type NoCachePaginateOption ¶
type NoCachePaginateOption func(*nocachePager) error
NoCachePaginateOption enables pagination customization.
func WithNoCacheFilter ¶
func WithNoCacheFilter(filter func(*NoCacheQuery) (*NoCacheQuery, error)) NoCachePaginateOption
WithNoCacheFilter configures pagination filter.
func WithNoCacheOrder ¶
func WithNoCacheOrder(order *NoCacheOrder) NoCachePaginateOption
WithNoCacheOrder configures pagination ordering.
type NoCacheQuery ¶
type NoCacheQuery struct {
// contains filtered or unexported fields
}
NoCacheQuery is the builder for querying NoCache entities.
func (*NoCacheQuery) Aggregate ¶
func (ncq *NoCacheQuery) Aggregate(fns ...AggregateFunc) *NoCacheSelect
Aggregate returns a NoCacheSelect configured with the given aggregations.
func (*NoCacheQuery) All ¶
func (ncq *NoCacheQuery) All(ctx context.Context) ([]*NoCache, error)
All executes the query and returns a list of NoCaches.
func (*NoCacheQuery) AllX ¶
func (ncq *NoCacheQuery) AllX(ctx context.Context) []*NoCache
AllX is like All, but panics if an error occurs.
func (*NoCacheQuery) Clone ¶
func (ncq *NoCacheQuery) Clone() *NoCacheQuery
Clone returns a duplicate of the NoCacheQuery builder, including all associated steps. It can be used to prepare common query builders and use them differently after the clone is made.
func (*NoCacheQuery) CollectFields ¶
func (nc *NoCacheQuery) CollectFields(ctx context.Context, satisfies ...string) (*NoCacheQuery, error)
CollectFields tells the query-builder to eagerly load connected nodes by resolver context.
func (*NoCacheQuery) Count ¶
func (ncq *NoCacheQuery) Count(ctx context.Context) (int, error)
Count returns the count of the given query.
func (*NoCacheQuery) CountX ¶
func (ncq *NoCacheQuery) CountX(ctx context.Context) int
CountX is like Count, but panics if an error occurs.
func (*NoCacheQuery) Exist ¶
func (ncq *NoCacheQuery) Exist(ctx context.Context) (bool, error)
Exist returns true if the query has elements in the graph.
func (*NoCacheQuery) ExistX ¶
func (ncq *NoCacheQuery) ExistX(ctx context.Context) bool
ExistX is like Exist, but panics if an error occurs.
func (*NoCacheQuery) First ¶
func (ncq *NoCacheQuery) First(ctx context.Context) (*NoCache, error)
First returns the first NoCache entity from the query. Returns a *NotFoundError when no NoCache was found.
func (*NoCacheQuery) FirstID ¶
func (ncq *NoCacheQuery) FirstID(ctx context.Context) (id int, err error)
FirstID returns the first NoCache ID from the query. Returns a *NotFoundError when no NoCache ID was found.
func (*NoCacheQuery) FirstIDX ¶
func (ncq *NoCacheQuery) FirstIDX(ctx context.Context) int
FirstIDX is like FirstID, but panics if an error occurs.
func (*NoCacheQuery) FirstX ¶
func (ncq *NoCacheQuery) FirstX(ctx context.Context) *NoCache
FirstX is like First, but panics if an error occurs.
func (*NoCacheQuery) GroupBy ¶
func (ncq *NoCacheQuery) GroupBy(field string, fields ...string) *NoCacheGroupBy
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 { Name string `json:"name,omitempty"` Count int `json:"count,omitempty"` } client.NoCache.Query(). GroupBy(nocache.FieldName). Aggregate(ent.Count()). Scan(ctx, &v)
func (*NoCacheQuery) IDs ¶
func (ncq *NoCacheQuery) IDs(ctx context.Context) (ids []int, err error)
IDs executes the query and returns a list of NoCache IDs.
func (*NoCacheQuery) IDsX ¶
func (ncq *NoCacheQuery) IDsX(ctx context.Context) []int
IDsX is like IDs, but panics if an error occurs.
func (*NoCacheQuery) Limit ¶
func (ncq *NoCacheQuery) Limit(limit int) *NoCacheQuery
Limit the number of records to be returned by this query.
func (*NoCacheQuery) Offset ¶
func (ncq *NoCacheQuery) Offset(offset int) *NoCacheQuery
Offset to start from.
func (*NoCacheQuery) Only ¶
func (ncq *NoCacheQuery) Only(ctx context.Context) (*NoCache, error)
Only returns a single NoCache entity found by the query, ensuring it only returns one. Returns a *NotSingularError when more than one NoCache entity is found. Returns a *NotFoundError when no NoCache entities are found.
func (*NoCacheQuery) OnlyID ¶
func (ncq *NoCacheQuery) OnlyID(ctx context.Context) (id int, err error)
OnlyID is like Only, but returns the only NoCache ID in the query. Returns a *NotSingularError when more than one NoCache ID is found. Returns a *NotFoundError when no entities are found.
func (*NoCacheQuery) OnlyIDX ¶
func (ncq *NoCacheQuery) OnlyIDX(ctx context.Context) int
OnlyIDX is like OnlyID, but panics if an error occurs.
func (*NoCacheQuery) OnlyX ¶
func (ncq *NoCacheQuery) OnlyX(ctx context.Context) *NoCache
OnlyX is like Only, but panics if an error occurs.
func (*NoCacheQuery) Order ¶
func (ncq *NoCacheQuery) Order(o ...nocache.OrderOption) *NoCacheQuery
Order specifies how the records should be ordered.
func (*NoCacheQuery) Paginate ¶
func (nc *NoCacheQuery) Paginate( ctx context.Context, after *Cursor, first *int, before *Cursor, last *int, opts ...NoCachePaginateOption, ) (*NoCacheConnection, error)
Paginate executes the query and returns a relay based cursor connection to NoCache.
func (*NoCacheQuery) Select ¶
func (ncq *NoCacheQuery) Select(fields ...string) *NoCacheSelect
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 { Name string `json:"name,omitempty"` } client.NoCache.Query(). Select(nocache.FieldName). Scan(ctx, &v)
func (*NoCacheQuery) Unique ¶
func (ncq *NoCacheQuery) Unique(unique bool) *NoCacheQuery
Unique configures the query builder to filter duplicate records on query. By default, unique is set to true, and can be disabled using this method.
func (*NoCacheQuery) Where ¶
func (ncq *NoCacheQuery) Where(ps ...predicate.NoCache) *NoCacheQuery
Where adds a new predicate for the NoCacheQuery builder.
type NoCacheSelect ¶
type NoCacheSelect struct { *NoCacheQuery // contains filtered or unexported fields }
NoCacheSelect is the builder for selecting fields of NoCache entities.
func (*NoCacheSelect) Aggregate ¶
func (ncs *NoCacheSelect) Aggregate(fns ...AggregateFunc) *NoCacheSelect
Aggregate adds the given aggregation functions to the selector query.
func (*NoCacheSelect) Bool ¶
Bool returns a single bool from a selector. It is only allowed when selecting one field.
func (*NoCacheSelect) Bools ¶
Bools returns list of bools from a selector. It is only allowed when selecting one field.
func (*NoCacheSelect) Float64 ¶
Float64 returns a single float64 from a selector. It is only allowed when selecting one field.
func (*NoCacheSelect) Float64s ¶
Float64s returns list of float64s from a selector. It is only allowed when selecting one field.
func (*NoCacheSelect) Int ¶
Int returns a single int from a selector. It is only allowed when selecting one field.
func (*NoCacheSelect) Ints ¶
Ints returns list of ints from a selector. It is only allowed when selecting one field.
func (*NoCacheSelect) Scan ¶
func (ncs *NoCacheSelect) Scan(ctx context.Context, v any) error
Scan applies the selector query and scans the result into the given value.
func (*NoCacheSelect) String ¶
String returns a single string from a selector. It is only allowed when selecting one field.
type NoCacheUpdate ¶
type NoCacheUpdate struct {
// contains filtered or unexported fields
}
NoCacheUpdate is the builder for updating NoCache entities.
func (*NoCacheUpdate) AddUserID ¶
func (ncu *NoCacheUpdate) AddUserID(i int) *NoCacheUpdate
AddUserID adds i to the "user_id" field.
func (*NoCacheUpdate) Exec ¶
func (ncu *NoCacheUpdate) Exec(ctx context.Context) error
Exec executes the query.
func (*NoCacheUpdate) ExecX ¶
func (ncu *NoCacheUpdate) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*NoCacheUpdate) Mutation ¶
func (ncu *NoCacheUpdate) Mutation() *NoCacheMutation
Mutation returns the NoCacheMutation object of the builder.
func (*NoCacheUpdate) Save ¶
func (ncu *NoCacheUpdate) Save(ctx context.Context) (int, error)
Save executes the query and returns the number of nodes affected by the update operation.
func (*NoCacheUpdate) SaveX ¶
func (ncu *NoCacheUpdate) SaveX(ctx context.Context) int
SaveX is like Save, but panics if an error occurs.
func (*NoCacheUpdate) SetName ¶
func (ncu *NoCacheUpdate) SetName(s string) *NoCacheUpdate
SetName sets the "name" field.
func (*NoCacheUpdate) SetNillableName ¶
func (ncu *NoCacheUpdate) SetNillableName(s *string) *NoCacheUpdate
SetNillableName sets the "name" field if the given value is not nil.
func (*NoCacheUpdate) SetNillableUserID ¶
func (ncu *NoCacheUpdate) SetNillableUserID(i *int) *NoCacheUpdate
SetNillableUserID sets the "user_id" field if the given value is not nil.
func (*NoCacheUpdate) SetUserID ¶
func (ncu *NoCacheUpdate) SetUserID(i int) *NoCacheUpdate
SetUserID sets the "user_id" field.
func (*NoCacheUpdate) Where ¶
func (ncu *NoCacheUpdate) Where(ps ...predicate.NoCache) *NoCacheUpdate
Where appends a list predicates to the NoCacheUpdate builder.
type NoCacheUpdateOne ¶
type NoCacheUpdateOne struct {
// contains filtered or unexported fields
}
NoCacheUpdateOne is the builder for updating a single NoCache entity.
func (*NoCacheUpdateOne) AddUserID ¶
func (ncuo *NoCacheUpdateOne) AddUserID(i int) *NoCacheUpdateOne
AddUserID adds i to the "user_id" field.
func (*NoCacheUpdateOne) Exec ¶
func (ncuo *NoCacheUpdateOne) Exec(ctx context.Context) error
Exec executes the query on the entity.
func (*NoCacheUpdateOne) ExecX ¶
func (ncuo *NoCacheUpdateOne) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*NoCacheUpdateOne) Mutation ¶
func (ncuo *NoCacheUpdateOne) Mutation() *NoCacheMutation
Mutation returns the NoCacheMutation object of the builder.
func (*NoCacheUpdateOne) Save ¶
func (ncuo *NoCacheUpdateOne) Save(ctx context.Context) (*NoCache, error)
Save executes the query and returns the updated NoCache entity.
func (*NoCacheUpdateOne) SaveX ¶
func (ncuo *NoCacheUpdateOne) SaveX(ctx context.Context) *NoCache
SaveX is like Save, but panics if an error occurs.
func (*NoCacheUpdateOne) Select ¶
func (ncuo *NoCacheUpdateOne) Select(field string, fields ...string) *NoCacheUpdateOne
Select allows selecting one or more fields (columns) of the returned entity. The default is selecting all fields defined in the entity schema.
func (*NoCacheUpdateOne) SetName ¶
func (ncuo *NoCacheUpdateOne) SetName(s string) *NoCacheUpdateOne
SetName sets the "name" field.
func (*NoCacheUpdateOne) SetNillableName ¶
func (ncuo *NoCacheUpdateOne) SetNillableName(s *string) *NoCacheUpdateOne
SetNillableName sets the "name" field if the given value is not nil.
func (*NoCacheUpdateOne) SetNillableUserID ¶
func (ncuo *NoCacheUpdateOne) SetNillableUserID(i *int) *NoCacheUpdateOne
SetNillableUserID sets the "user_id" field if the given value is not nil.
func (*NoCacheUpdateOne) SetUserID ¶
func (ncuo *NoCacheUpdateOne) SetUserID(i int) *NoCacheUpdateOne
SetUserID sets the "user_id" field.
func (*NoCacheUpdateOne) Where ¶
func (ncuo *NoCacheUpdateOne) Where(ps ...predicate.NoCache) *NoCacheUpdateOne
Where appends a list predicates to the NoCacheUpdate builder.
type NoCacheWhereInput ¶
type NoCacheWhereInput struct { Predicates []predicate.NoCache `json:"-"` Not *NoCacheWhereInput `json:"not,omitempty"` Or []*NoCacheWhereInput `json:"or,omitempty"` And []*NoCacheWhereInput `json:"and,omitempty"` // "id" field predicates. ID *int `json:"id,omitempty"` IDNEQ *int `json:"idNEQ,omitempty"` IDIn []int `json:"idIn,omitempty"` IDNotIn []int `json:"idNotIn,omitempty"` IDGT *int `json:"idGT,omitempty"` IDGTE *int `json:"idGTE,omitempty"` IDLT *int `json:"idLT,omitempty"` IDLTE *int `json:"idLTE,omitempty"` // "name" field predicates. Name *string `json:"name,omitempty"` NameNEQ *string `json:"nameNEQ,omitempty"` NameIn []string `json:"nameIn,omitempty"` NameNotIn []string `json:"nameNotIn,omitempty"` NameGT *string `json:"nameGT,omitempty"` NameGTE *string `json:"nameGTE,omitempty"` NameLT *string `json:"nameLT,omitempty"` NameLTE *string `json:"nameLTE,omitempty"` NameContains *string `json:"nameContains,omitempty"` NameHasPrefix *string `json:"nameHasPrefix,omitempty"` NameHasSuffix *string `json:"nameHasSuffix,omitempty"` NameEqualFold *string `json:"nameEqualFold,omitempty"` NameContainsFold *string `json:"nameContainsFold,omitempty"` // "user_id" field predicates. UserID *int `json:"userID,omitempty"` UserIDNEQ *int `json:"userIDNEQ,omitempty"` UserIDIn []int `json:"userIDIn,omitempty"` UserIDNotIn []int `json:"userIDNotIn,omitempty"` UserIDGT *int `json:"userIDGT,omitempty"` UserIDGTE *int `json:"userIDGTE,omitempty"` UserIDLT *int `json:"userIDLT,omitempty"` UserIDLTE *int `json:"userIDLTE,omitempty"` }
NoCacheWhereInput represents a where input for filtering NoCache queries.
func (*NoCacheWhereInput) AddPredicates ¶
func (i *NoCacheWhereInput) AddPredicates(predicates ...predicate.NoCache)
AddPredicates adds custom predicates to the where input to be used during the filtering phase.
func (*NoCacheWhereInput) Filter ¶
func (i *NoCacheWhereInput) Filter(q *NoCacheQuery) (*NoCacheQuery, error)
Filter applies the NoCacheWhereInput filter on the NoCacheQuery builder.
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 ResolvedGlobal ¶
type ResolvedGlobal struct{ Type, ID string }
func FromGlobalID ¶
func FromGlobalID(s string) (*ResolvedGlobal, error)
func (*ResolvedGlobal) Int ¶
func (r *ResolvedGlobal) Int() (int, error)
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 { // NoCache is the client for interacting with the NoCache builders. NoCache *NoCacheClient // 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.