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 UserFIQL(expr string) (predicate.User, 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) Tx(ctx context.Context) (*Tx, error)
- func (c *Client) Use(hooks ...Hook)
- type CommitFunc
- type CommitHook
- type Committer
- type ConstraintError
- type Hook
- type InterceptFunc
- type Interceptor
- type MutateFunc
- type Mutation
- type Mutator
- type NotFoundError
- type NotLoadedError
- type NotSingularError
- type Op
- type Option
- type OrderFunc
- type Policy
- type Post
- type PostClient
- func (c *PostClient) Create() *PostCreate
- func (c *PostClient) CreateBulk(builders ...*PostCreate) *PostCreateBulk
- func (c *PostClient) Delete() *PostDelete
- func (c *PostClient) DeleteOne(_m *Post) *PostDeleteOne
- func (c *PostClient) DeleteOneID(id int) *PostDeleteOne
- func (c *PostClient) Get(ctx context.Context, id int) (*Post, error)
- func (c *PostClient) GetX(ctx context.Context, id int) *Post
- func (c *PostClient) Hooks() []Hook
- func (c *PostClient) Intercept(interceptors ...Interceptor)
- func (c *PostClient) Interceptors() []Interceptor
- func (c *PostClient) MapCreateBulk(slice any, setFunc func(*PostCreate, int)) *PostCreateBulk
- func (c *PostClient) Query() *PostQuery
- func (c *PostClient) QueryOwner(_m *Post) *UserQuery
- func (c *PostClient) QueryPinners(_m *Post) *UserQuery
- func (c *PostClient) Update() *PostUpdate
- func (c *PostClient) UpdateOne(_m *Post) *PostUpdateOne
- func (c *PostClient) UpdateOneID(id int) *PostUpdateOne
- func (c *PostClient) Use(hooks ...Hook)
- type PostCreate
- func (_c *PostCreate) AddPinnerIDs(ids ...int) *PostCreate
- func (_c *PostCreate) AddPinners(v ...*User) *PostCreate
- func (c *PostCreate) ApplyDomain(ctx context.Context, d *domain.Post, opts ...entdomain.ApplyOption) (*PostCreate, error)
- func (c *PostCreate) ApplyDomainX(ctx context.Context, d *domain.Post, opts ...entdomain.ApplyOption) *PostCreate
- func (_c *PostCreate) Exec(ctx context.Context) error
- func (_c *PostCreate) ExecX(ctx context.Context)
- func (_c *PostCreate) Mutation() *PostMutation
- func (_c *PostCreate) OnConflict(opts ...sql.ConflictOption) *PostUpsertOne
- func (_c *PostCreate) OnConflictColumns(columns ...string) *PostUpsertOne
- func (_c *PostCreate) Save(ctx context.Context) (*Post, error)
- func (_c *PostCreate) SaveX(ctx context.Context) *Post
- func (_c *PostCreate) SetNillableOwnerID(id *int) *PostCreate
- func (_c *PostCreate) SetNillablePublished(v *bool) *PostCreate
- func (_c *PostCreate) SetOwner(v *User) *PostCreate
- func (_c *PostCreate) SetOwnerID(id int) *PostCreate
- func (_c *PostCreate) SetPublished(v bool) *PostCreate
- func (_c *PostCreate) SetTitle(v string) *PostCreate
- type PostCreateBulk
- func (_c *PostCreateBulk) Exec(ctx context.Context) error
- func (_c *PostCreateBulk) ExecX(ctx context.Context)
- func (_c *PostCreateBulk) OnConflict(opts ...sql.ConflictOption) *PostUpsertBulk
- func (_c *PostCreateBulk) OnConflictColumns(columns ...string) *PostUpsertBulk
- func (_c *PostCreateBulk) Save(ctx context.Context) ([]*Post, error)
- func (_c *PostCreateBulk) SaveX(ctx context.Context) []*Post
- type PostDelete
- type PostDeleteOne
- type PostDomainField
- type PostDomainTransformer
- type PostEdges
- type PostGroupBy
- func (_g *PostGroupBy) Aggregate(fns ...AggregateFunc) *PostGroupBy
- func (s *PostGroupBy) Bool(ctx context.Context) (_ bool, err error)
- func (s *PostGroupBy) BoolX(ctx context.Context) bool
- func (s *PostGroupBy) Bools(ctx context.Context) ([]bool, error)
- func (s *PostGroupBy) BoolsX(ctx context.Context) []bool
- func (s *PostGroupBy) Float64(ctx context.Context) (_ float64, err error)
- func (s *PostGroupBy) Float64X(ctx context.Context) float64
- func (s *PostGroupBy) Float64s(ctx context.Context) ([]float64, error)
- func (s *PostGroupBy) Float64sX(ctx context.Context) []float64
- func (s *PostGroupBy) Int(ctx context.Context) (_ int, err error)
- func (s *PostGroupBy) IntX(ctx context.Context) int
- func (s *PostGroupBy) Ints(ctx context.Context) ([]int, error)
- func (s *PostGroupBy) IntsX(ctx context.Context) []int
- func (_g *PostGroupBy) Scan(ctx context.Context, v any) error
- func (s *PostGroupBy) ScanX(ctx context.Context, v any)
- func (s *PostGroupBy) String(ctx context.Context) (_ string, err error)
- func (s *PostGroupBy) StringX(ctx context.Context) string
- func (s *PostGroupBy) Strings(ctx context.Context) ([]string, error)
- func (s *PostGroupBy) StringsX(ctx context.Context) []string
- type PostMutation
- func (m *PostMutation) AddField(name string, value ent.Value) error
- func (m *PostMutation) AddPinnerIDs(ids ...int)
- func (m *PostMutation) AddedEdges() []string
- func (m *PostMutation) AddedField(name string) (ent.Value, bool)
- func (m *PostMutation) AddedFields() []string
- func (m *PostMutation) AddedIDs(name string) []ent.Value
- func (m *PostMutation) ClearEdge(name string) error
- func (m *PostMutation) ClearField(name string) error
- func (m *PostMutation) ClearOwner()
- func (m *PostMutation) ClearPinners()
- func (m *PostMutation) ClearedEdges() []string
- func (m *PostMutation) ClearedFields() []string
- func (m PostMutation) Client() *Client
- func (m *PostMutation) EdgeCleared(name string) bool
- func (m *PostMutation) Field(name string) (ent.Value, bool)
- func (m *PostMutation) FieldCleared(name string) bool
- func (m *PostMutation) Fields() []string
- func (m *PostMutation) ID() (id int, exists bool)
- func (m *PostMutation) IDs(ctx context.Context) ([]int, error)
- func (m *PostMutation) OldField(ctx context.Context, name string) (ent.Value, error)
- func (m *PostMutation) OldPublished(ctx context.Context) (v bool, err error)
- func (m *PostMutation) OldTitle(ctx context.Context) (v string, err error)
- func (m *PostMutation) Op() Op
- func (m *PostMutation) OwnerCleared() bool
- func (m *PostMutation) OwnerID() (id int, exists bool)
- func (m *PostMutation) OwnerIDs() (ids []int)
- func (m *PostMutation) PinnersCleared() bool
- func (m *PostMutation) PinnersIDs() (ids []int)
- func (m *PostMutation) Published() (r bool, exists bool)
- func (m *PostMutation) RemovePinnerIDs(ids ...int)
- func (m *PostMutation) RemovedEdges() []string
- func (m *PostMutation) RemovedIDs(name string) []ent.Value
- func (m *PostMutation) RemovedPinnersIDs() (ids []int)
- func (m *PostMutation) ResetEdge(name string) error
- func (m *PostMutation) ResetField(name string) error
- func (m *PostMutation) ResetOwner()
- func (m *PostMutation) ResetPinners()
- func (m *PostMutation) ResetPublished()
- func (m *PostMutation) ResetTitle()
- func (m *PostMutation) SetField(name string, value ent.Value) error
- func (m *PostMutation) SetOp(op Op)
- func (m *PostMutation) SetOwnerID(id int)
- func (m *PostMutation) SetPublished(b bool)
- func (m *PostMutation) SetTitle(s string)
- func (m *PostMutation) Title() (r string, exists bool)
- func (m PostMutation) Tx() (*Tx, error)
- func (m *PostMutation) Type() string
- func (m *PostMutation) Where(ps ...predicate.Post)
- func (m *PostMutation) WhereP(ps ...func(*sql.Selector))
- type PostQuery
- func (_q *PostQuery) Aggregate(fns ...AggregateFunc) *PostSelect
- func (_q *PostQuery) All(ctx context.Context) ([]*Post, error)
- func (_q *PostQuery) AllX(ctx context.Context) []*Post
- func (_q *PostQuery) Clone() *PostQuery
- func (_q *PostQuery) Count(ctx context.Context) (int, error)
- func (_q *PostQuery) CountX(ctx context.Context) int
- func (_q *PostQuery) Exist(ctx context.Context) (bool, error)
- func (_q *PostQuery) ExistX(ctx context.Context) bool
- func (_q *PostQuery) First(ctx context.Context) (*Post, error)
- func (_q *PostQuery) FirstID(ctx context.Context) (id int, err error)
- func (_q *PostQuery) FirstIDX(ctx context.Context) int
- func (_q *PostQuery) FirstX(ctx context.Context) *Post
- func (_q *PostQuery) GroupBy(field string, fields ...string) *PostGroupBy
- func (_q *PostQuery) IDs(ctx context.Context) (ids []int, err error)
- func (_q *PostQuery) IDsX(ctx context.Context) []int
- func (_q *PostQuery) Limit(limit int) *PostQuery
- func (_q *PostQuery) Offset(offset int) *PostQuery
- func (_q *PostQuery) Only(ctx context.Context) (*Post, error)
- func (_q *PostQuery) OnlyID(ctx context.Context) (id int, err error)
- func (_q *PostQuery) OnlyIDX(ctx context.Context) int
- func (_q *PostQuery) OnlyX(ctx context.Context) *Post
- func (_q *PostQuery) Order(o ...post.OrderOption) *PostQuery
- func (_q *PostQuery) QueryOwner() *UserQuery
- func (_q *PostQuery) QueryPinners() *UserQuery
- func (_q *PostQuery) Select(fields ...string) *PostSelect
- func (_q *PostQuery) Unique(unique bool) *PostQuery
- func (_q *PostQuery) Where(ps ...predicate.Post) *PostQuery
- func (_q *PostQuery) WithOwner(opts ...func(*UserQuery)) *PostQuery
- func (_q *PostQuery) WithPinners(opts ...func(*UserQuery)) *PostQuery
- type PostSelect
- func (_s *PostSelect) Aggregate(fns ...AggregateFunc) *PostSelect
- func (s *PostSelect) Bool(ctx context.Context) (_ bool, err error)
- func (s *PostSelect) BoolX(ctx context.Context) bool
- func (s *PostSelect) Bools(ctx context.Context) ([]bool, error)
- func (s *PostSelect) BoolsX(ctx context.Context) []bool
- func (s *PostSelect) Float64(ctx context.Context) (_ float64, err error)
- func (s *PostSelect) Float64X(ctx context.Context) float64
- func (s *PostSelect) Float64s(ctx context.Context) ([]float64, error)
- func (s *PostSelect) Float64sX(ctx context.Context) []float64
- func (s *PostSelect) Int(ctx context.Context) (_ int, err error)
- func (s *PostSelect) IntX(ctx context.Context) int
- func (s *PostSelect) Ints(ctx context.Context) ([]int, error)
- func (s *PostSelect) IntsX(ctx context.Context) []int
- func (_s *PostSelect) Scan(ctx context.Context, v any) error
- func (s *PostSelect) ScanX(ctx context.Context, v any)
- func (s *PostSelect) String(ctx context.Context) (_ string, err error)
- func (s *PostSelect) StringX(ctx context.Context) string
- func (s *PostSelect) Strings(ctx context.Context) ([]string, error)
- func (s *PostSelect) StringsX(ctx context.Context) []string
- type PostUpdate
- func (_u *PostUpdate) AddPinnerIDs(ids ...int) *PostUpdate
- func (_u *PostUpdate) AddPinners(v ...*User) *PostUpdate
- func (u *PostUpdate) ApplyDomain(ctx context.Context, d *domain.Post, opts ...entdomain.ApplyOption) (*PostUpdate, error)
- func (u *PostUpdate) ApplyDomainX(ctx context.Context, d *domain.Post, opts ...entdomain.ApplyOption) *PostUpdate
- func (_u *PostUpdate) ClearOwner() *PostUpdate
- func (_u *PostUpdate) ClearPinners() *PostUpdate
- func (_u *PostUpdate) Exec(ctx context.Context) error
- func (_u *PostUpdate) ExecX(ctx context.Context)
- func (_u *PostUpdate) Mutation() *PostMutation
- func (_u *PostUpdate) RemovePinnerIDs(ids ...int) *PostUpdate
- func (_u *PostUpdate) RemovePinners(v ...*User) *PostUpdate
- func (_u *PostUpdate) Save(ctx context.Context) (int, error)
- func (_u *PostUpdate) SaveX(ctx context.Context) int
- func (_u *PostUpdate) SetNillableOwnerID(id *int) *PostUpdate
- func (_u *PostUpdate) SetNillablePublished(v *bool) *PostUpdate
- func (_u *PostUpdate) SetNillableTitle(v *string) *PostUpdate
- func (_u *PostUpdate) SetOwner(v *User) *PostUpdate
- func (_u *PostUpdate) SetOwnerID(id int) *PostUpdate
- func (_u *PostUpdate) SetPublished(v bool) *PostUpdate
- func (_u *PostUpdate) SetTitle(v string) *PostUpdate
- func (_u *PostUpdate) Where(ps ...predicate.Post) *PostUpdate
- type PostUpdateOne
- func (_u *PostUpdateOne) AddPinnerIDs(ids ...int) *PostUpdateOne
- func (_u *PostUpdateOne) AddPinners(v ...*User) *PostUpdateOne
- func (u *PostUpdateOne) ApplyDomain(ctx context.Context, d *domain.Post, opts ...entdomain.ApplyOption) (*PostUpdateOne, error)
- func (u *PostUpdateOne) ApplyDomainX(ctx context.Context, d *domain.Post, opts ...entdomain.ApplyOption) *PostUpdateOne
- func (_u *PostUpdateOne) ClearOwner() *PostUpdateOne
- func (_u *PostUpdateOne) ClearPinners() *PostUpdateOne
- func (_u *PostUpdateOne) Exec(ctx context.Context) error
- func (_u *PostUpdateOne) ExecX(ctx context.Context)
- func (_u *PostUpdateOne) Mutation() *PostMutation
- func (_u *PostUpdateOne) RemovePinnerIDs(ids ...int) *PostUpdateOne
- func (_u *PostUpdateOne) RemovePinners(v ...*User) *PostUpdateOne
- func (_u *PostUpdateOne) Save(ctx context.Context) (*Post, error)
- func (_u *PostUpdateOne) SaveX(ctx context.Context) *Post
- func (_u *PostUpdateOne) Select(field string, fields ...string) *PostUpdateOne
- func (_u *PostUpdateOne) SetNillableOwnerID(id *int) *PostUpdateOne
- func (_u *PostUpdateOne) SetNillablePublished(v *bool) *PostUpdateOne
- func (_u *PostUpdateOne) SetNillableTitle(v *string) *PostUpdateOne
- func (_u *PostUpdateOne) SetOwner(v *User) *PostUpdateOne
- func (_u *PostUpdateOne) SetOwnerID(id int) *PostUpdateOne
- func (_u *PostUpdateOne) SetPublished(v bool) *PostUpdateOne
- func (_u *PostUpdateOne) SetTitle(v string) *PostUpdateOne
- func (_u *PostUpdateOne) Where(ps ...predicate.Post) *PostUpdateOne
- type PostUpsert
- type PostUpsertBulk
- func (u *PostUpsertBulk) DoNothing() *PostUpsertBulk
- func (u *PostUpsertBulk) Exec(ctx context.Context) error
- func (u *PostUpsertBulk) ExecX(ctx context.Context)
- func (u *PostUpsertBulk) Ignore() *PostUpsertBulk
- func (u *PostUpsertBulk) SetPublished(v bool) *PostUpsertBulk
- func (u *PostUpsertBulk) SetTitle(v string) *PostUpsertBulk
- func (u *PostUpsertBulk) Update(set func(*PostUpsert)) *PostUpsertBulk
- func (u *PostUpsertBulk) UpdateNewValues() *PostUpsertBulk
- func (u *PostUpsertBulk) UpdatePublished() *PostUpsertBulk
- func (u *PostUpsertBulk) UpdateTitle() *PostUpsertBulk
- type PostUpsertOne
- func (u *PostUpsertOne) ApplyDomain(ctx context.Context, d *domain.Post, opts ...entdomain.ApplyOption) (*PostUpsertOne, error)
- func (u *PostUpsertOne) ApplyDomainX(ctx context.Context, d *domain.Post, opts ...entdomain.ApplyOption) *PostUpsertOne
- func (u *PostUpsertOne) DoNothing() *PostUpsertOne
- func (u *PostUpsertOne) Exec(ctx context.Context) error
- func (u *PostUpsertOne) ExecX(ctx context.Context)
- func (u *PostUpsertOne) ID(ctx context.Context) (id int, err error)
- func (u *PostUpsertOne) IDX(ctx context.Context) int
- func (u *PostUpsertOne) Ignore() *PostUpsertOne
- func (u *PostUpsertOne) SetPublished(v bool) *PostUpsertOne
- func (u *PostUpsertOne) SetTitle(v string) *PostUpsertOne
- func (u *PostUpsertOne) Update(set func(*PostUpsert)) *PostUpsertOne
- func (u *PostUpsertOne) UpdateNewValues() *PostUpsertOne
- func (u *PostUpsertOne) UpdatePublished() *PostUpsertOne
- func (u *PostUpsertOne) UpdateTitle() *PostUpsertOne
- type Posts
- type Querier
- type QuerierFunc
- type Query
- type QueryContext
- type RollbackFunc
- type RollbackHook
- type Rollbacker
- type Tag
- type TagClient
- func (c *TagClient) Create() *TagCreate
- func (c *TagClient) CreateBulk(builders ...*TagCreate) *TagCreateBulk
- func (c *TagClient) CreateBulkDomain(ctx context.Context, ds domain.TagList, opts ...entdomain.ApplyOption) (*TagCreateBulk, error)
- func (c *TagClient) CreateBulkDomainX(ctx context.Context, ds domain.TagList, opts ...entdomain.ApplyOption) *TagCreateBulk
- func (c *TagClient) Delete() *TagDelete
- func (c *TagClient) DeleteOne(_m *Tag) *TagDeleteOne
- func (c *TagClient) DeleteOneID(id int) *TagDeleteOne
- func (c *TagClient) Get(ctx context.Context, id int) (*Tag, error)
- func (c *TagClient) GetX(ctx context.Context, id int) *Tag
- func (c *TagClient) Hooks() []Hook
- func (c *TagClient) Intercept(interceptors ...Interceptor)
- func (c *TagClient) Interceptors() []Interceptor
- func (c *TagClient) MapCreateBulk(slice any, setFunc func(*TagCreate, int)) *TagCreateBulk
- func (c *TagClient) Query() *TagQuery
- func (c *TagClient) QueryUsers(_m *Tag) *UserQuery
- func (c *TagClient) Update() *TagUpdate
- func (c *TagClient) UpdateBulkDomain(ctx context.Context, ds domain.TagList, opts ...entdomain.ApplyOption) (*TagUpdateOneBulk, error)
- func (c *TagClient) UpdateBulkDomainX(ctx context.Context, ds domain.TagList, opts ...entdomain.ApplyOption) *TagUpdateOneBulk
- func (c *TagClient) UpdateOne(_m *Tag) *TagUpdateOne
- func (c *TagClient) UpdateOneID(id int) *TagUpdateOne
- func (c *TagClient) Use(hooks ...Hook)
- type TagCreate
- func (_c *TagCreate) AddUserIDs(ids ...int) *TagCreate
- func (_c *TagCreate) AddUsers(v ...*User) *TagCreate
- func (c *TagCreate) ApplyDomain(ctx context.Context, d *domain.Tag, opts ...entdomain.ApplyOption) (*TagCreate, error)
- func (c *TagCreate) ApplyDomainX(ctx context.Context, d *domain.Tag, opts ...entdomain.ApplyOption) *TagCreate
- func (_c *TagCreate) Exec(ctx context.Context) error
- func (_c *TagCreate) ExecX(ctx context.Context)
- func (_c *TagCreate) Mutation() *TagMutation
- func (_c *TagCreate) OnConflict(opts ...sql.ConflictOption) *TagUpsertOne
- func (_c *TagCreate) OnConflictColumns(columns ...string) *TagUpsertOne
- func (_c *TagCreate) Save(ctx context.Context) (*Tag, error)
- func (_c *TagCreate) SaveX(ctx context.Context) *Tag
- func (_c *TagCreate) SetName(v string) *TagCreate
- type TagCreateBulk
- func (_c *TagCreateBulk) Exec(ctx context.Context) error
- func (_c *TagCreateBulk) ExecX(ctx context.Context)
- func (_c *TagCreateBulk) OnConflict(opts ...sql.ConflictOption) *TagUpsertBulk
- func (_c *TagCreateBulk) OnConflictColumns(columns ...string) *TagUpsertBulk
- func (_c *TagCreateBulk) Save(ctx context.Context) ([]*Tag, error)
- func (_c *TagCreateBulk) SaveX(ctx context.Context) []*Tag
- type TagDelete
- type TagDeleteOne
- type TagDomainField
- type TagDomainTransformer
- type TagEdges
- type TagGroupBy
- func (_g *TagGroupBy) Aggregate(fns ...AggregateFunc) *TagGroupBy
- func (s *TagGroupBy) Bool(ctx context.Context) (_ bool, err error)
- func (s *TagGroupBy) BoolX(ctx context.Context) bool
- func (s *TagGroupBy) Bools(ctx context.Context) ([]bool, error)
- func (s *TagGroupBy) BoolsX(ctx context.Context) []bool
- func (s *TagGroupBy) Float64(ctx context.Context) (_ float64, err error)
- func (s *TagGroupBy) Float64X(ctx context.Context) float64
- func (s *TagGroupBy) Float64s(ctx context.Context) ([]float64, error)
- func (s *TagGroupBy) Float64sX(ctx context.Context) []float64
- func (s *TagGroupBy) Int(ctx context.Context) (_ int, err error)
- func (s *TagGroupBy) IntX(ctx context.Context) int
- func (s *TagGroupBy) Ints(ctx context.Context) ([]int, error)
- func (s *TagGroupBy) IntsX(ctx context.Context) []int
- func (_g *TagGroupBy) Scan(ctx context.Context, v any) error
- func (s *TagGroupBy) ScanX(ctx context.Context, v any)
- func (s *TagGroupBy) String(ctx context.Context) (_ string, err error)
- func (s *TagGroupBy) StringX(ctx context.Context) string
- func (s *TagGroupBy) Strings(ctx context.Context) ([]string, error)
- func (s *TagGroupBy) StringsX(ctx context.Context) []string
- type TagMutation
- func (m *TagMutation) AddField(name string, value ent.Value) error
- func (m *TagMutation) AddUserIDs(ids ...int)
- func (m *TagMutation) AddedEdges() []string
- func (m *TagMutation) AddedField(name string) (ent.Value, bool)
- func (m *TagMutation) AddedFields() []string
- func (m *TagMutation) AddedIDs(name string) []ent.Value
- func (m *TagMutation) ClearEdge(name string) error
- func (m *TagMutation) ClearField(name string) error
- func (m *TagMutation) ClearUsers()
- func (m *TagMutation) ClearedEdges() []string
- func (m *TagMutation) ClearedFields() []string
- func (m TagMutation) Client() *Client
- func (m *TagMutation) EdgeCleared(name string) bool
- func (m *TagMutation) Field(name string) (ent.Value, bool)
- func (m *TagMutation) FieldCleared(name string) bool
- func (m *TagMutation) Fields() []string
- func (m *TagMutation) ID() (id int, exists bool)
- func (m *TagMutation) IDs(ctx context.Context) ([]int, error)
- func (m *TagMutation) Name() (r string, exists bool)
- func (m *TagMutation) OldField(ctx context.Context, name string) (ent.Value, error)
- func (m *TagMutation) OldName(ctx context.Context) (v string, err error)
- func (m *TagMutation) Op() Op
- func (m *TagMutation) RemoveUserIDs(ids ...int)
- func (m *TagMutation) RemovedEdges() []string
- func (m *TagMutation) RemovedIDs(name string) []ent.Value
- func (m *TagMutation) RemovedUsersIDs() (ids []int)
- func (m *TagMutation) ResetEdge(name string) error
- func (m *TagMutation) ResetField(name string) error
- func (m *TagMutation) ResetName()
- func (m *TagMutation) ResetUsers()
- func (m *TagMutation) SetField(name string, value ent.Value) error
- func (m *TagMutation) SetName(s string)
- func (m *TagMutation) SetOp(op Op)
- func (m TagMutation) Tx() (*Tx, error)
- func (m *TagMutation) Type() string
- func (m *TagMutation) UsersCleared() bool
- func (m *TagMutation) UsersIDs() (ids []int)
- func (m *TagMutation) Where(ps ...predicate.Tag)
- func (m *TagMutation) WhereP(ps ...func(*sql.Selector))
- type TagQuery
- func (_q *TagQuery) Aggregate(fns ...AggregateFunc) *TagSelect
- func (_q *TagQuery) All(ctx context.Context) ([]*Tag, error)
- func (_q *TagQuery) AllX(ctx context.Context) []*Tag
- func (_q *TagQuery) Clone() *TagQuery
- func (_q *TagQuery) Count(ctx context.Context) (int, error)
- func (_q *TagQuery) CountX(ctx context.Context) int
- func (_q *TagQuery) Exist(ctx context.Context) (bool, error)
- func (_q *TagQuery) ExistX(ctx context.Context) bool
- func (_q *TagQuery) First(ctx context.Context) (*Tag, error)
- func (_q *TagQuery) FirstID(ctx context.Context) (id int, err error)
- func (_q *TagQuery) FirstIDX(ctx context.Context) int
- func (_q *TagQuery) FirstX(ctx context.Context) *Tag
- func (_q *TagQuery) GroupBy(field string, fields ...string) *TagGroupBy
- func (_q *TagQuery) IDs(ctx context.Context) (ids []int, err error)
- func (_q *TagQuery) IDsX(ctx context.Context) []int
- func (_q *TagQuery) Limit(limit int) *TagQuery
- func (_q *TagQuery) Offset(offset int) *TagQuery
- func (_q *TagQuery) Only(ctx context.Context) (*Tag, error)
- func (_q *TagQuery) OnlyID(ctx context.Context) (id int, err error)
- func (_q *TagQuery) OnlyIDX(ctx context.Context) int
- func (_q *TagQuery) OnlyX(ctx context.Context) *Tag
- func (_q *TagQuery) Order(o ...tag.OrderOption) *TagQuery
- func (_q *TagQuery) QueryUsers() *UserQuery
- func (_q *TagQuery) Select(fields ...string) *TagSelect
- func (_q *TagQuery) Unique(unique bool) *TagQuery
- func (_q *TagQuery) Where(ps ...predicate.Tag) *TagQuery
- func (_q *TagQuery) WithUsers(opts ...func(*UserQuery)) *TagQuery
- type TagSelect
- func (_s *TagSelect) Aggregate(fns ...AggregateFunc) *TagSelect
- func (s *TagSelect) Bool(ctx context.Context) (_ bool, err error)
- func (s *TagSelect) BoolX(ctx context.Context) bool
- func (s *TagSelect) Bools(ctx context.Context) ([]bool, error)
- func (s *TagSelect) BoolsX(ctx context.Context) []bool
- func (s *TagSelect) Float64(ctx context.Context) (_ float64, err error)
- func (s *TagSelect) Float64X(ctx context.Context) float64
- func (s *TagSelect) Float64s(ctx context.Context) ([]float64, error)
- func (s *TagSelect) Float64sX(ctx context.Context) []float64
- func (s *TagSelect) Int(ctx context.Context) (_ int, err error)
- func (s *TagSelect) IntX(ctx context.Context) int
- func (s *TagSelect) Ints(ctx context.Context) ([]int, error)
- func (s *TagSelect) IntsX(ctx context.Context) []int
- func (_s *TagSelect) Scan(ctx context.Context, v any) error
- func (s *TagSelect) ScanX(ctx context.Context, v any)
- func (s *TagSelect) String(ctx context.Context) (_ string, err error)
- func (s *TagSelect) StringX(ctx context.Context) string
- func (s *TagSelect) Strings(ctx context.Context) ([]string, error)
- func (s *TagSelect) StringsX(ctx context.Context) []string
- type TagUpdate
- func (_u *TagUpdate) AddUserIDs(ids ...int) *TagUpdate
- func (_u *TagUpdate) AddUsers(v ...*User) *TagUpdate
- func (u *TagUpdate) ApplyDomain(ctx context.Context, d *domain.Tag, opts ...entdomain.ApplyOption) (*TagUpdate, error)
- func (u *TagUpdate) ApplyDomainX(ctx context.Context, d *domain.Tag, opts ...entdomain.ApplyOption) *TagUpdate
- func (_u *TagUpdate) ClearUsers() *TagUpdate
- func (_u *TagUpdate) Exec(ctx context.Context) error
- func (_u *TagUpdate) ExecX(ctx context.Context)
- func (_u *TagUpdate) Mutation() *TagMutation
- func (_u *TagUpdate) RemoveUserIDs(ids ...int) *TagUpdate
- func (_u *TagUpdate) RemoveUsers(v ...*User) *TagUpdate
- func (_u *TagUpdate) Save(ctx context.Context) (int, error)
- func (_u *TagUpdate) SaveX(ctx context.Context) int
- func (_u *TagUpdate) SetName(v string) *TagUpdate
- func (_u *TagUpdate) SetNillableName(v *string) *TagUpdate
- func (_u *TagUpdate) Where(ps ...predicate.Tag) *TagUpdate
- type TagUpdateOne
- func (_u *TagUpdateOne) AddUserIDs(ids ...int) *TagUpdateOne
- func (_u *TagUpdateOne) AddUsers(v ...*User) *TagUpdateOne
- func (u *TagUpdateOne) ApplyDomain(ctx context.Context, d *domain.Tag, opts ...entdomain.ApplyOption) (*TagUpdateOne, error)
- func (u *TagUpdateOne) ApplyDomainX(ctx context.Context, d *domain.Tag, opts ...entdomain.ApplyOption) *TagUpdateOne
- func (_u *TagUpdateOne) ClearUsers() *TagUpdateOne
- func (_u *TagUpdateOne) Exec(ctx context.Context) error
- func (_u *TagUpdateOne) ExecX(ctx context.Context)
- func (_u *TagUpdateOne) Mutation() *TagMutation
- func (_u *TagUpdateOne) RemoveUserIDs(ids ...int) *TagUpdateOne
- func (_u *TagUpdateOne) RemoveUsers(v ...*User) *TagUpdateOne
- func (_u *TagUpdateOne) Save(ctx context.Context) (*Tag, error)
- func (_u *TagUpdateOne) SaveX(ctx context.Context) *Tag
- func (_u *TagUpdateOne) Select(field string, fields ...string) *TagUpdateOne
- func (_u *TagUpdateOne) SetName(v string) *TagUpdateOne
- func (_u *TagUpdateOne) SetNillableName(v *string) *TagUpdateOne
- func (_u *TagUpdateOne) Where(ps ...predicate.Tag) *TagUpdateOne
- type TagUpdateOneBulk
- type TagUpsert
- type TagUpsertBulk
- func (u *TagUpsertBulk) ApplyDomain(ctx context.Context, d *domain.Tag, opts ...entdomain.ApplyOption) (*TagUpsertBulk, error)
- func (u *TagUpsertBulk) ApplyDomainX(ctx context.Context, d *domain.Tag, opts ...entdomain.ApplyOption) *TagUpsertBulk
- func (u *TagUpsertBulk) DoNothing() *TagUpsertBulk
- func (u *TagUpsertBulk) Exec(ctx context.Context) error
- func (u *TagUpsertBulk) ExecX(ctx context.Context)
- func (u *TagUpsertBulk) Ignore() *TagUpsertBulk
- func (u *TagUpsertBulk) SetName(v string) *TagUpsertBulk
- func (u *TagUpsertBulk) Update(set func(*TagUpsert)) *TagUpsertBulk
- func (u *TagUpsertBulk) UpdateName() *TagUpsertBulk
- func (u *TagUpsertBulk) UpdateNewValues() *TagUpsertBulk
- type TagUpsertOne
- func (u *TagUpsertOne) ApplyDomain(ctx context.Context, d *domain.Tag, opts ...entdomain.ApplyOption) (*TagUpsertOne, error)
- func (u *TagUpsertOne) ApplyDomainX(ctx context.Context, d *domain.Tag, opts ...entdomain.ApplyOption) *TagUpsertOne
- func (u *TagUpsertOne) DoNothing() *TagUpsertOne
- func (u *TagUpsertOne) Exec(ctx context.Context) error
- func (u *TagUpsertOne) ExecX(ctx context.Context)
- func (u *TagUpsertOne) ID(ctx context.Context) (id int, err error)
- func (u *TagUpsertOne) IDX(ctx context.Context) int
- func (u *TagUpsertOne) Ignore() *TagUpsertOne
- func (u *TagUpsertOne) SetName(v string) *TagUpsertOne
- func (u *TagUpsertOne) Update(set func(*TagUpsert)) *TagUpsertOne
- func (u *TagUpsertOne) UpdateName() *TagUpsertOne
- func (u *TagUpsertOne) UpdateNewValues() *TagUpsertOne
- type Tags
- type TraverseFunc
- type Traverser
- type Tx
- type User
- func (_m *User) QueryPinnedPost() *PostQuery
- func (_m *User) QueryPosts() *PostQuery
- func (_m *User) QueryTags() *TagQuery
- func (_m *User) String() string
- func (e *User) ToDomain() *domain.User
- func (_m *User) Unwrap() *User
- func (_m *User) Update() *UserUpdateOne
- func (_m *User) Value(name string) (ent.Value, error)
- type UserClient
- func (c *UserClient) Create() *UserCreate
- func (c *UserClient) CreateBulk(builders ...*UserCreate) *UserCreateBulk
- func (c *UserClient) CreateBulkDomain(ctx context.Context, ds domain.UserList, opts ...entdomain.ApplyOption) (*UserCreateBulk, error)
- func (c *UserClient) CreateBulkDomainX(ctx context.Context, ds domain.UserList, opts ...entdomain.ApplyOption) *UserCreateBulk
- func (c *UserClient) Delete() *UserDelete
- func (c *UserClient) DeleteOne(_m *User) *UserDeleteOne
- func (c *UserClient) DeleteOneID(id int) *UserDeleteOne
- func (c *UserClient) Get(ctx context.Context, id int) (*User, error)
- func (c *UserClient) GetX(ctx context.Context, id int) *User
- func (c *UserClient) Hooks() []Hook
- func (c *UserClient) Intercept(interceptors ...Interceptor)
- func (c *UserClient) Interceptors() []Interceptor
- func (c *UserClient) MapCreateBulk(slice any, setFunc func(*UserCreate, int)) *UserCreateBulk
- func (c *UserClient) Query() *UserQuery
- func (c *UserClient) QueryPinnedPost(_m *User) *PostQuery
- func (c *UserClient) QueryPosts(_m *User) *PostQuery
- func (c *UserClient) QueryTags(_m *User) *TagQuery
- func (c *UserClient) Update() *UserUpdate
- func (c *UserClient) UpdateBulkDomain(ctx context.Context, ds domain.UserList, opts ...entdomain.ApplyOption) (*UserUpdateOneBulk, error)
- func (c *UserClient) UpdateBulkDomainX(ctx context.Context, ds domain.UserList, opts ...entdomain.ApplyOption) *UserUpdateOneBulk
- func (c *UserClient) UpdateOne(_m *User) *UserUpdateOne
- func (c *UserClient) UpdateOneID(id int) *UserUpdateOne
- func (c *UserClient) Use(hooks ...Hook)
- type UserCreate
- func (_c *UserCreate) AddPostIDs(ids ...int) *UserCreate
- func (_c *UserCreate) AddPosts(v ...*Post) *UserCreate
- func (_c *UserCreate) AddTagIDs(ids ...int) *UserCreate
- func (_c *UserCreate) AddTags(v ...*Tag) *UserCreate
- func (c *UserCreate) ApplyDomain(ctx context.Context, d *domain.User, opts ...entdomain.ApplyOption) (*UserCreate, error)
- func (c *UserCreate) ApplyDomainX(ctx context.Context, d *domain.User, opts ...entdomain.ApplyOption) *UserCreate
- func (_c *UserCreate) Exec(ctx context.Context) error
- func (_c *UserCreate) ExecX(ctx context.Context)
- func (_c *UserCreate) Mutation() *UserMutation
- func (_c *UserCreate) OnConflict(opts ...sql.ConflictOption) *UserUpsertOne
- func (_c *UserCreate) OnConflictColumns(columns ...string) *UserUpsertOne
- func (_c *UserCreate) Save(ctx context.Context) (*User, error)
- func (_c *UserCreate) SaveX(ctx context.Context) *User
- func (_c *UserCreate) SetBio(v string) *UserCreate
- func (_c *UserCreate) SetCreatedAt(v time.Time) *UserCreate
- func (_c *UserCreate) SetExternalID(v uuid.UUID) *UserCreate
- func (_c *UserCreate) SetLabels(v map[string]interface{}) *UserCreate
- func (_c *UserCreate) SetMetadata(v domain.UserMetadata) *UserCreate
- func (_c *UserCreate) SetName(v string) *UserCreate
- func (_c *UserCreate) SetNillableBio(v *string) *UserCreate
- func (_c *UserCreate) SetNillableCreatedAt(v *time.Time) *UserCreate
- func (_c *UserCreate) SetNillablePinnedPostID(id *int) *UserCreate
- func (_c *UserCreate) SetNillableScore(v *int) *UserCreate
- func (_c *UserCreate) SetNillableStatus(v *user.Status) *UserCreate
- func (_c *UserCreate) SetNillableUpdatedAt(v *time.Time) *UserCreate
- func (_c *UserCreate) SetPinnedPost(v *Post) *UserCreate
- func (_c *UserCreate) SetPinnedPostID(id int) *UserCreate
- func (_c *UserCreate) SetScore(v int) *UserCreate
- func (_c *UserCreate) SetSettings(v map[string]interface{}) *UserCreate
- func (_c *UserCreate) SetStatus(v user.Status) *UserCreate
- func (_c *UserCreate) SetTagNames(v []string) *UserCreate
- func (_c *UserCreate) SetUpdatedAt(v time.Time) *UserCreate
- func (_c *UserCreate) SetUsername(v string) *UserCreate
- type UserCreateBulk
- func (_c *UserCreateBulk) Exec(ctx context.Context) error
- func (_c *UserCreateBulk) ExecX(ctx context.Context)
- func (_c *UserCreateBulk) OnConflict(opts ...sql.ConflictOption) *UserUpsertBulk
- func (_c *UserCreateBulk) OnConflictColumns(columns ...string) *UserUpsertBulk
- func (_c *UserCreateBulk) Save(ctx context.Context) ([]*User, error)
- func (_c *UserCreateBulk) SaveX(ctx context.Context) []*User
- type UserDelete
- type UserDeleteOne
- type UserDomainField
- type UserDomainTransformer
- type UserEdges
- type UserGroupBy
- func (_g *UserGroupBy) Aggregate(fns ...AggregateFunc) *UserGroupBy
- func (s *UserGroupBy) Bool(ctx context.Context) (_ bool, err error)
- func (s *UserGroupBy) BoolX(ctx context.Context) bool
- func (s *UserGroupBy) Bools(ctx context.Context) ([]bool, error)
- func (s *UserGroupBy) BoolsX(ctx context.Context) []bool
- func (s *UserGroupBy) Float64(ctx context.Context) (_ float64, err error)
- func (s *UserGroupBy) Float64X(ctx context.Context) float64
- func (s *UserGroupBy) Float64s(ctx context.Context) ([]float64, error)
- func (s *UserGroupBy) Float64sX(ctx context.Context) []float64
- func (s *UserGroupBy) Int(ctx context.Context) (_ int, err error)
- func (s *UserGroupBy) IntX(ctx context.Context) int
- func (s *UserGroupBy) Ints(ctx context.Context) ([]int, error)
- func (s *UserGroupBy) IntsX(ctx context.Context) []int
- func (_g *UserGroupBy) Scan(ctx context.Context, v any) error
- func (s *UserGroupBy) ScanX(ctx context.Context, v any)
- func (s *UserGroupBy) String(ctx context.Context) (_ string, err error)
- func (s *UserGroupBy) StringX(ctx context.Context) string
- func (s *UserGroupBy) Strings(ctx context.Context) ([]string, error)
- func (s *UserGroupBy) StringsX(ctx context.Context) []string
- type UserMutation
- func (m *UserMutation) AddField(name string, value ent.Value) error
- func (m *UserMutation) AddPostIDs(ids ...int)
- func (m *UserMutation) AddScore(i int)
- func (m *UserMutation) AddTagIDs(ids ...int)
- func (m *UserMutation) AddedEdges() []string
- func (m *UserMutation) AddedField(name string) (ent.Value, bool)
- func (m *UserMutation) AddedFields() []string
- func (m *UserMutation) AddedIDs(name string) []ent.Value
- func (m *UserMutation) AddedScore() (r int, exists bool)
- func (m *UserMutation) AppendTagNames(s []string)
- func (m *UserMutation) AppendedTagNames() ([]string, bool)
- func (m *UserMutation) Bio() (r string, exists bool)
- func (m *UserMutation) BioCleared() bool
- func (m *UserMutation) ClearBio()
- func (m *UserMutation) ClearEdge(name string) error
- func (m *UserMutation) ClearField(name string) error
- func (m *UserMutation) ClearPinnedPost()
- func (m *UserMutation) ClearPosts()
- func (m *UserMutation) ClearScore()
- func (m *UserMutation) ClearSettings()
- func (m *UserMutation) ClearTags()
- func (m *UserMutation) ClearUpdatedAt()
- func (m *UserMutation) ClearedEdges() []string
- func (m *UserMutation) ClearedFields() []string
- func (m UserMutation) Client() *Client
- func (m *UserMutation) CreatedAt() (r time.Time, exists bool)
- func (m *UserMutation) EdgeCleared(name string) bool
- func (m *UserMutation) ExternalID() (r uuid.UUID, exists bool)
- func (m *UserMutation) Field(name string) (ent.Value, bool)
- func (m *UserMutation) FieldCleared(name string) bool
- func (m *UserMutation) Fields() []string
- func (m *UserMutation) ID() (id int, exists bool)
- func (m *UserMutation) IDs(ctx context.Context) ([]int, error)
- func (m *UserMutation) Labels() (r map[string]interface{}, exists bool)
- func (m *UserMutation) Metadata() (r domain.UserMetadata, exists bool)
- func (m *UserMutation) Name() (r string, exists bool)
- func (m *UserMutation) OldBio(ctx context.Context) (v string, err error)
- func (m *UserMutation) OldCreatedAt(ctx context.Context) (v time.Time, err error)
- func (m *UserMutation) OldExternalID(ctx context.Context) (v uuid.UUID, err error)
- func (m *UserMutation) OldField(ctx context.Context, name string) (ent.Value, error)
- func (m *UserMutation) OldLabels(ctx context.Context) (v map[string]interface{}, err error)
- func (m *UserMutation) OldMetadata(ctx context.Context) (v domain.UserMetadata, err error)
- func (m *UserMutation) OldName(ctx context.Context) (v string, err error)
- func (m *UserMutation) OldScore(ctx context.Context) (v int, err error)
- func (m *UserMutation) OldSettings(ctx context.Context) (v map[string]interface{}, err error)
- func (m *UserMutation) OldStatus(ctx context.Context) (v user.Status, err error)
- func (m *UserMutation) OldTagNames(ctx context.Context) (v []string, err error)
- func (m *UserMutation) OldUpdatedAt(ctx context.Context) (v time.Time, err error)
- func (m *UserMutation) OldUsername(ctx context.Context) (v string, err error)
- func (m *UserMutation) Op() Op
- func (m *UserMutation) PinnedPostCleared() bool
- func (m *UserMutation) PinnedPostID() (id int, exists bool)
- func (m *UserMutation) PinnedPostIDs() (ids []int)
- func (m *UserMutation) PostsCleared() bool
- func (m *UserMutation) PostsIDs() (ids []int)
- func (m *UserMutation) RemovePostIDs(ids ...int)
- func (m *UserMutation) RemoveTagIDs(ids ...int)
- func (m *UserMutation) RemovedEdges() []string
- func (m *UserMutation) RemovedIDs(name string) []ent.Value
- func (m *UserMutation) RemovedPostsIDs() (ids []int)
- func (m *UserMutation) RemovedTagsIDs() (ids []int)
- func (m *UserMutation) ResetBio()
- func (m *UserMutation) ResetCreatedAt()
- func (m *UserMutation) ResetEdge(name string) error
- func (m *UserMutation) ResetExternalID()
- func (m *UserMutation) ResetField(name string) error
- func (m *UserMutation) ResetLabels()
- func (m *UserMutation) ResetMetadata()
- func (m *UserMutation) ResetName()
- func (m *UserMutation) ResetPinnedPost()
- func (m *UserMutation) ResetPosts()
- func (m *UserMutation) ResetScore()
- func (m *UserMutation) ResetSettings()
- func (m *UserMutation) ResetStatus()
- func (m *UserMutation) ResetTagNames()
- func (m *UserMutation) ResetTags()
- func (m *UserMutation) ResetUpdatedAt()
- func (m *UserMutation) ResetUsername()
- func (m *UserMutation) Score() (r int, exists bool)
- func (m *UserMutation) ScoreCleared() bool
- func (m *UserMutation) SetBio(s string)
- func (m *UserMutation) SetCreatedAt(t time.Time)
- func (m *UserMutation) SetExternalID(u uuid.UUID)
- func (m *UserMutation) SetField(name string, value ent.Value) error
- func (m *UserMutation) SetLabels(value map[string]interface{})
- func (m *UserMutation) SetMetadata(dm domain.UserMetadata)
- func (m *UserMutation) SetName(s string)
- func (m *UserMutation) SetOp(op Op)
- func (m *UserMutation) SetPinnedPostID(id int)
- func (m *UserMutation) SetScore(i int)
- func (m *UserMutation) SetSettings(value map[string]interface{})
- func (m *UserMutation) SetStatus(u user.Status)
- func (m *UserMutation) SetTagNames(s []string)
- func (m *UserMutation) SetUpdatedAt(t time.Time)
- func (m *UserMutation) SetUsername(s string)
- func (m *UserMutation) Settings() (r map[string]interface{}, exists bool)
- func (m *UserMutation) SettingsCleared() bool
- func (m *UserMutation) Status() (r user.Status, exists bool)
- func (m *UserMutation) TagNames() (r []string, exists bool)
- func (m *UserMutation) TagsCleared() bool
- func (m *UserMutation) TagsIDs() (ids []int)
- func (m UserMutation) Tx() (*Tx, error)
- func (m *UserMutation) Type() string
- func (m *UserMutation) UpdatedAt() (r time.Time, exists bool)
- func (m *UserMutation) UpdatedAtCleared() bool
- func (m *UserMutation) Username() (r string, exists bool)
- func (m *UserMutation) Where(ps ...predicate.User)
- func (m *UserMutation) WhereP(ps ...func(*sql.Selector))
- type UserQuery
- func (_q *UserQuery) Aggregate(fns ...AggregateFunc) *UserSelect
- func (_q *UserQuery) All(ctx context.Context) ([]*User, error)
- func (_q *UserQuery) AllX(ctx context.Context) []*User
- func (_q *UserQuery) Clone() *UserQuery
- func (_q *UserQuery) Count(ctx context.Context) (int, error)
- func (_q *UserQuery) CountX(ctx context.Context) int
- func (_q *UserQuery) Exist(ctx context.Context) (bool, error)
- func (_q *UserQuery) ExistX(ctx context.Context) bool
- func (_q *UserQuery) First(ctx context.Context) (*User, error)
- func (_q *UserQuery) FirstID(ctx context.Context) (id int, err error)
- func (_q *UserQuery) FirstIDX(ctx context.Context) int
- func (_q *UserQuery) FirstX(ctx context.Context) *User
- func (_q *UserQuery) GroupBy(field string, fields ...string) *UserGroupBy
- func (_q *UserQuery) IDs(ctx context.Context) (ids []int, err error)
- func (_q *UserQuery) IDsX(ctx context.Context) []int
- func (_q *UserQuery) Limit(limit int) *UserQuery
- func (_q *UserQuery) Offset(offset int) *UserQuery
- func (_q *UserQuery) Only(ctx context.Context) (*User, error)
- func (_q *UserQuery) OnlyID(ctx context.Context) (id int, err error)
- func (_q *UserQuery) OnlyIDX(ctx context.Context) int
- func (_q *UserQuery) OnlyX(ctx context.Context) *User
- func (_q *UserQuery) Order(o ...user.OrderOption) *UserQuery
- func (_q *UserQuery) QueryPinnedPost() *PostQuery
- func (_q *UserQuery) QueryPosts() *PostQuery
- func (_q *UserQuery) QueryTags() *TagQuery
- func (_q *UserQuery) Select(fields ...string) *UserSelect
- func (_q *UserQuery) Unique(unique bool) *UserQuery
- func (_q *UserQuery) Where(ps ...predicate.User) *UserQuery
- func (_q *UserQuery) WithPinnedPost(opts ...func(*PostQuery)) *UserQuery
- func (_q *UserQuery) WithPosts(opts ...func(*PostQuery)) *UserQuery
- func (_q *UserQuery) WithTags(opts ...func(*TagQuery)) *UserQuery
- type UserSelect
- func (_s *UserSelect) Aggregate(fns ...AggregateFunc) *UserSelect
- func (s *UserSelect) Bool(ctx context.Context) (_ bool, err error)
- func (s *UserSelect) BoolX(ctx context.Context) bool
- func (s *UserSelect) Bools(ctx context.Context) ([]bool, error)
- func (s *UserSelect) BoolsX(ctx context.Context) []bool
- func (s *UserSelect) Float64(ctx context.Context) (_ float64, err error)
- func (s *UserSelect) Float64X(ctx context.Context) float64
- func (s *UserSelect) Float64s(ctx context.Context) ([]float64, error)
- func (s *UserSelect) Float64sX(ctx context.Context) []float64
- func (s *UserSelect) Int(ctx context.Context) (_ int, err error)
- func (s *UserSelect) IntX(ctx context.Context) int
- func (s *UserSelect) Ints(ctx context.Context) ([]int, error)
- func (s *UserSelect) IntsX(ctx context.Context) []int
- func (_s *UserSelect) Scan(ctx context.Context, v any) error
- func (s *UserSelect) ScanX(ctx context.Context, v any)
- func (s *UserSelect) String(ctx context.Context) (_ string, err error)
- func (s *UserSelect) StringX(ctx context.Context) string
- func (s *UserSelect) Strings(ctx context.Context) ([]string, error)
- func (s *UserSelect) StringsX(ctx context.Context) []string
- type UserUpdate
- func (_u *UserUpdate) AddPostIDs(ids ...int) *UserUpdate
- func (_u *UserUpdate) AddPosts(v ...*Post) *UserUpdate
- func (_u *UserUpdate) AddScore(v int) *UserUpdate
- func (_u *UserUpdate) AddTagIDs(ids ...int) *UserUpdate
- func (_u *UserUpdate) AddTags(v ...*Tag) *UserUpdate
- func (_u *UserUpdate) AppendTagNames(v []string) *UserUpdate
- func (u *UserUpdate) ApplyDomain(ctx context.Context, d *domain.User, opts ...entdomain.ApplyOption) (*UserUpdate, error)
- func (u *UserUpdate) ApplyDomainX(ctx context.Context, d *domain.User, opts ...entdomain.ApplyOption) *UserUpdate
- func (_u *UserUpdate) ClearBio() *UserUpdate
- func (_u *UserUpdate) ClearPinnedPost() *UserUpdate
- func (_u *UserUpdate) ClearPosts() *UserUpdate
- func (_u *UserUpdate) ClearScore() *UserUpdate
- func (_u *UserUpdate) ClearSettings() *UserUpdate
- func (_u *UserUpdate) ClearTags() *UserUpdate
- func (_u *UserUpdate) ClearUpdatedAt() *UserUpdate
- func (_u *UserUpdate) Exec(ctx context.Context) error
- func (_u *UserUpdate) ExecX(ctx context.Context)
- func (_u *UserUpdate) Mutation() *UserMutation
- func (_u *UserUpdate) RemovePostIDs(ids ...int) *UserUpdate
- func (_u *UserUpdate) RemovePosts(v ...*Post) *UserUpdate
- func (_u *UserUpdate) RemoveTagIDs(ids ...int) *UserUpdate
- func (_u *UserUpdate) RemoveTags(v ...*Tag) *UserUpdate
- func (_u *UserUpdate) Save(ctx context.Context) (int, error)
- func (_u *UserUpdate) SaveX(ctx context.Context) int
- func (_u *UserUpdate) SetBio(v string) *UserUpdate
- func (_u *UserUpdate) SetExternalID(v uuid.UUID) *UserUpdate
- func (_u *UserUpdate) SetLabels(v map[string]interface{}) *UserUpdate
- func (_u *UserUpdate) SetMetadata(v domain.UserMetadata) *UserUpdate
- func (_u *UserUpdate) SetName(v string) *UserUpdate
- func (_u *UserUpdate) SetNillableBio(v *string) *UserUpdate
- func (_u *UserUpdate) SetNillableExternalID(v *uuid.UUID) *UserUpdate
- func (_u *UserUpdate) SetNillableMetadata(v *domain.UserMetadata) *UserUpdate
- func (_u *UserUpdate) SetNillableName(v *string) *UserUpdate
- func (_u *UserUpdate) SetNillablePinnedPostID(id *int) *UserUpdate
- func (_u *UserUpdate) SetNillableScore(v *int) *UserUpdate
- func (_u *UserUpdate) SetNillableStatus(v *user.Status) *UserUpdate
- func (_u *UserUpdate) SetNillableUpdatedAt(v *time.Time) *UserUpdate
- func (_u *UserUpdate) SetPinnedPost(v *Post) *UserUpdate
- func (_u *UserUpdate) SetPinnedPostID(id int) *UserUpdate
- func (_u *UserUpdate) SetScore(v int) *UserUpdate
- func (_u *UserUpdate) SetSettings(v map[string]interface{}) *UserUpdate
- func (_u *UserUpdate) SetStatus(v user.Status) *UserUpdate
- func (_u *UserUpdate) SetTagNames(v []string) *UserUpdate
- func (_u *UserUpdate) SetUpdatedAt(v time.Time) *UserUpdate
- func (_u *UserUpdate) Where(ps ...predicate.User) *UserUpdate
- type UserUpdateOne
- func (_u *UserUpdateOne) AddPostIDs(ids ...int) *UserUpdateOne
- func (_u *UserUpdateOne) AddPosts(v ...*Post) *UserUpdateOne
- func (_u *UserUpdateOne) AddScore(v int) *UserUpdateOne
- func (_u *UserUpdateOne) AddTagIDs(ids ...int) *UserUpdateOne
- func (_u *UserUpdateOne) AddTags(v ...*Tag) *UserUpdateOne
- func (_u *UserUpdateOne) AppendTagNames(v []string) *UserUpdateOne
- func (u *UserUpdateOne) ApplyDomain(ctx context.Context, d *domain.User, opts ...entdomain.ApplyOption) (*UserUpdateOne, error)
- func (u *UserUpdateOne) ApplyDomainX(ctx context.Context, d *domain.User, opts ...entdomain.ApplyOption) *UserUpdateOne
- func (_u *UserUpdateOne) ClearBio() *UserUpdateOne
- func (_u *UserUpdateOne) ClearPinnedPost() *UserUpdateOne
- func (_u *UserUpdateOne) ClearPosts() *UserUpdateOne
- func (_u *UserUpdateOne) ClearScore() *UserUpdateOne
- func (_u *UserUpdateOne) ClearSettings() *UserUpdateOne
- func (_u *UserUpdateOne) ClearTags() *UserUpdateOne
- func (_u *UserUpdateOne) ClearUpdatedAt() *UserUpdateOne
- func (_u *UserUpdateOne) Exec(ctx context.Context) error
- func (_u *UserUpdateOne) ExecX(ctx context.Context)
- func (_u *UserUpdateOne) Mutation() *UserMutation
- func (_u *UserUpdateOne) RemovePostIDs(ids ...int) *UserUpdateOne
- func (_u *UserUpdateOne) RemovePosts(v ...*Post) *UserUpdateOne
- func (_u *UserUpdateOne) RemoveTagIDs(ids ...int) *UserUpdateOne
- func (_u *UserUpdateOne) RemoveTags(v ...*Tag) *UserUpdateOne
- func (_u *UserUpdateOne) Save(ctx context.Context) (*User, error)
- func (_u *UserUpdateOne) SaveX(ctx context.Context) *User
- func (_u *UserUpdateOne) Select(field string, fields ...string) *UserUpdateOne
- func (_u *UserUpdateOne) SetBio(v string) *UserUpdateOne
- func (_u *UserUpdateOne) SetExternalID(v uuid.UUID) *UserUpdateOne
- func (_u *UserUpdateOne) SetLabels(v map[string]interface{}) *UserUpdateOne
- func (_u *UserUpdateOne) SetMetadata(v domain.UserMetadata) *UserUpdateOne
- func (_u *UserUpdateOne) SetName(v string) *UserUpdateOne
- func (_u *UserUpdateOne) SetNillableBio(v *string) *UserUpdateOne
- func (_u *UserUpdateOne) SetNillableExternalID(v *uuid.UUID) *UserUpdateOne
- func (_u *UserUpdateOne) SetNillableMetadata(v *domain.UserMetadata) *UserUpdateOne
- func (_u *UserUpdateOne) SetNillableName(v *string) *UserUpdateOne
- func (_u *UserUpdateOne) SetNillablePinnedPostID(id *int) *UserUpdateOne
- func (_u *UserUpdateOne) SetNillableScore(v *int) *UserUpdateOne
- func (_u *UserUpdateOne) SetNillableStatus(v *user.Status) *UserUpdateOne
- func (_u *UserUpdateOne) SetNillableUpdatedAt(v *time.Time) *UserUpdateOne
- func (_u *UserUpdateOne) SetPinnedPost(v *Post) *UserUpdateOne
- func (_u *UserUpdateOne) SetPinnedPostID(id int) *UserUpdateOne
- func (_u *UserUpdateOne) SetScore(v int) *UserUpdateOne
- func (_u *UserUpdateOne) SetSettings(v map[string]interface{}) *UserUpdateOne
- func (_u *UserUpdateOne) SetStatus(v user.Status) *UserUpdateOne
- func (_u *UserUpdateOne) SetTagNames(v []string) *UserUpdateOne
- func (_u *UserUpdateOne) SetUpdatedAt(v time.Time) *UserUpdateOne
- func (_u *UserUpdateOne) Where(ps ...predicate.User) *UserUpdateOne
- type UserUpdateOneBulk
- type UserUpsert
- func (u *UserUpsert) AddScore(v int) *UserUpsert
- func (u *UserUpsert) ClearBio() *UserUpsert
- func (u *UserUpsert) ClearScore() *UserUpsert
- func (u *UserUpsert) ClearSettings() *UserUpsert
- func (u *UserUpsert) ClearUpdatedAt() *UserUpsert
- func (u *UserUpsert) SetBio(v string) *UserUpsert
- func (u *UserUpsert) SetExternalID(v uuid.UUID) *UserUpsert
- func (u *UserUpsert) SetLabels(v map[string]interface{}) *UserUpsert
- func (u *UserUpsert) SetMetadata(v domain.UserMetadata) *UserUpsert
- func (u *UserUpsert) SetName(v string) *UserUpsert
- func (u *UserUpsert) SetScore(v int) *UserUpsert
- func (u *UserUpsert) SetSettings(v map[string]interface{}) *UserUpsert
- func (u *UserUpsert) SetStatus(v user.Status) *UserUpsert
- func (u *UserUpsert) SetTagNames(v []string) *UserUpsert
- func (u *UserUpsert) SetUpdatedAt(v time.Time) *UserUpsert
- func (u *UserUpsert) UpdateBio() *UserUpsert
- func (u *UserUpsert) UpdateExternalID() *UserUpsert
- func (u *UserUpsert) UpdateLabels() *UserUpsert
- func (u *UserUpsert) UpdateMetadata() *UserUpsert
- func (u *UserUpsert) UpdateName() *UserUpsert
- func (u *UserUpsert) UpdateScore() *UserUpsert
- func (u *UserUpsert) UpdateSettings() *UserUpsert
- func (u *UserUpsert) UpdateStatus() *UserUpsert
- func (u *UserUpsert) UpdateTagNames() *UserUpsert
- func (u *UserUpsert) UpdateUpdatedAt() *UserUpsert
- type UserUpsertBulk
- func (u *UserUpsertBulk) AddScore(v int) *UserUpsertBulk
- func (u *UserUpsertBulk) ApplyDomain(ctx context.Context, d *domain.User, opts ...entdomain.ApplyOption) (*UserUpsertBulk, error)
- func (u *UserUpsertBulk) ApplyDomainX(ctx context.Context, d *domain.User, opts ...entdomain.ApplyOption) *UserUpsertBulk
- func (u *UserUpsertBulk) ClearBio() *UserUpsertBulk
- func (u *UserUpsertBulk) ClearScore() *UserUpsertBulk
- func (u *UserUpsertBulk) ClearSettings() *UserUpsertBulk
- func (u *UserUpsertBulk) ClearUpdatedAt() *UserUpsertBulk
- func (u *UserUpsertBulk) DoNothing() *UserUpsertBulk
- func (u *UserUpsertBulk) Exec(ctx context.Context) error
- func (u *UserUpsertBulk) ExecX(ctx context.Context)
- func (u *UserUpsertBulk) Ignore() *UserUpsertBulk
- func (u *UserUpsertBulk) SetBio(v string) *UserUpsertBulk
- func (u *UserUpsertBulk) SetExternalID(v uuid.UUID) *UserUpsertBulk
- func (u *UserUpsertBulk) SetLabels(v map[string]interface{}) *UserUpsertBulk
- func (u *UserUpsertBulk) SetMetadata(v domain.UserMetadata) *UserUpsertBulk
- func (u *UserUpsertBulk) SetName(v string) *UserUpsertBulk
- func (u *UserUpsertBulk) SetScore(v int) *UserUpsertBulk
- func (u *UserUpsertBulk) SetSettings(v map[string]interface{}) *UserUpsertBulk
- func (u *UserUpsertBulk) SetStatus(v user.Status) *UserUpsertBulk
- func (u *UserUpsertBulk) SetTagNames(v []string) *UserUpsertBulk
- func (u *UserUpsertBulk) SetUpdatedAt(v time.Time) *UserUpsertBulk
- func (u *UserUpsertBulk) Update(set func(*UserUpsert)) *UserUpsertBulk
- func (u *UserUpsertBulk) UpdateBio() *UserUpsertBulk
- func (u *UserUpsertBulk) UpdateExternalID() *UserUpsertBulk
- func (u *UserUpsertBulk) UpdateLabels() *UserUpsertBulk
- func (u *UserUpsertBulk) UpdateMetadata() *UserUpsertBulk
- func (u *UserUpsertBulk) UpdateName() *UserUpsertBulk
- func (u *UserUpsertBulk) UpdateNewValues() *UserUpsertBulk
- func (u *UserUpsertBulk) UpdateScore() *UserUpsertBulk
- func (u *UserUpsertBulk) UpdateSettings() *UserUpsertBulk
- func (u *UserUpsertBulk) UpdateStatus() *UserUpsertBulk
- func (u *UserUpsertBulk) UpdateTagNames() *UserUpsertBulk
- func (u *UserUpsertBulk) UpdateUpdatedAt() *UserUpsertBulk
- type UserUpsertOne
- func (u *UserUpsertOne) AddScore(v int) *UserUpsertOne
- func (u *UserUpsertOne) ApplyDomain(ctx context.Context, d *domain.User, opts ...entdomain.ApplyOption) (*UserUpsertOne, error)
- func (u *UserUpsertOne) ApplyDomainX(ctx context.Context, d *domain.User, opts ...entdomain.ApplyOption) *UserUpsertOne
- func (u *UserUpsertOne) ClearBio() *UserUpsertOne
- func (u *UserUpsertOne) ClearScore() *UserUpsertOne
- func (u *UserUpsertOne) ClearSettings() *UserUpsertOne
- func (u *UserUpsertOne) ClearUpdatedAt() *UserUpsertOne
- func (u *UserUpsertOne) DoNothing() *UserUpsertOne
- func (u *UserUpsertOne) Exec(ctx context.Context) error
- func (u *UserUpsertOne) ExecX(ctx context.Context)
- func (u *UserUpsertOne) ID(ctx context.Context) (id int, err error)
- func (u *UserUpsertOne) IDX(ctx context.Context) int
- func (u *UserUpsertOne) Ignore() *UserUpsertOne
- func (u *UserUpsertOne) SetBio(v string) *UserUpsertOne
- func (u *UserUpsertOne) SetExternalID(v uuid.UUID) *UserUpsertOne
- func (u *UserUpsertOne) SetLabels(v map[string]interface{}) *UserUpsertOne
- func (u *UserUpsertOne) SetMetadata(v domain.UserMetadata) *UserUpsertOne
- func (u *UserUpsertOne) SetName(v string) *UserUpsertOne
- func (u *UserUpsertOne) SetScore(v int) *UserUpsertOne
- func (u *UserUpsertOne) SetSettings(v map[string]interface{}) *UserUpsertOne
- func (u *UserUpsertOne) SetStatus(v user.Status) *UserUpsertOne
- func (u *UserUpsertOne) SetTagNames(v []string) *UserUpsertOne
- func (u *UserUpsertOne) SetUpdatedAt(v time.Time) *UserUpsertOne
- func (u *UserUpsertOne) Update(set func(*UserUpsert)) *UserUpsertOne
- func (u *UserUpsertOne) UpdateBio() *UserUpsertOne
- func (u *UserUpsertOne) UpdateExternalID() *UserUpsertOne
- func (u *UserUpsertOne) UpdateLabels() *UserUpsertOne
- func (u *UserUpsertOne) UpdateMetadata() *UserUpsertOne
- func (u *UserUpsertOne) UpdateName() *UserUpsertOne
- func (u *UserUpsertOne) UpdateNewValues() *UserUpsertOne
- func (u *UserUpsertOne) UpdateScore() *UserUpsertOne
- func (u *UserUpsertOne) UpdateSettings() *UserUpsertOne
- func (u *UserUpsertOne) UpdateStatus() *UserUpsertOne
- func (u *UserUpsertOne) UpdateTagNames() *UserUpsertOne
- func (u *UserUpsertOne) UpdateUpdatedAt() *UserUpsertOne
- type Users
- 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. TypePost = "Post" TypeTag = "Tag" TypeUser = "User" )
Variables ¶
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.
var UserFIQLFields = entdomain.FIQLFields[predicate.User]{ "name": entdomain.FIQLString[predicate.User]{ EQ: user.NameEQ, NEQ: user.NameNEQ, Contains: user.NameContains, }, "bio": entdomain.FIQLString[predicate.User]{ IsNil: user.BioIsNil, NotNil: user.BioNotNil, }, "status": entdomain.FIQLEnum[predicate.User]{ EQ: map[string]predicate.User{ "active": user.StatusEQ(user.StatusActive), "inactive": user.StatusEQ(user.StatusInactive), }, NEQ: map[string]predicate.User{ "active": user.StatusNEQ(user.StatusActive), "inactive": user.StatusNEQ(user.StatusInactive), }, }, "created_at": entdomain.FIQLTime[predicate.User]{ GTE: user.CreatedAtGTE, LTE: user.CreatedAtLTE, }, "score": entdomain.FIQLInt[predicate.User]{ EQ: user.ScoreEQ, GT: user.ScoreGT, LT: user.ScoreLT, GTE: user.ScoreGTE, LTE: user.ScoreLTE, In: user.ScoreIn, NotIn: user.ScoreNotIn, }, "external_id": entdomain.FIQLUUID[predicate.User]{ EQ: user.ExternalIDEQ, NEQ: user.ExternalIDNEQ, }, }
UserFIQLFields is the FIQL field registry for User. Pass it to entdomain.ParseFIQL to filter User entities.
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
// Post is the client for interacting with the Post builders.
Post *PostClient
// Tag is the client for interacting with the Tag builders.
Tag *TagClient
// User is the client for interacting with the User builders.
User *UserClient
// 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(). Post. 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(...)`.
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 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 Post ¶
type Post struct {
// ID of the ent.
ID int `json:"id,omitempty"`
// Title holds the value of the "title" field.
Title string `json:"title,omitempty"`
// Published holds the value of the "published" field.
Published bool `json:"published,omitempty"`
// Edges holds the relations/edges for other nodes in the graph.
// The values are being populated by the PostQuery when eager-loading is set.
Edges PostEdges `json:"edges"`
// contains filtered or unexported fields
}
Post is the model entity for the Post schema.
func (*Post) QueryOwner ¶
QueryOwner queries the "owner" edge of the Post entity.
func (*Post) QueryPinners ¶
QueryPinners queries the "pinners" edge of the Post entity.
func (*Post) Unwrap ¶
Unwrap unwraps the Post 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 (*Post) Update ¶
func (_m *Post) Update() *PostUpdateOne
Update returns a builder for updating this Post. Note that you need to call Post.Unwrap() before calling this method if this Post was returned from a transaction, and the transaction was committed or rolled back.
type PostClient ¶
type PostClient struct {
// contains filtered or unexported fields
}
PostClient is a client for the Post schema.
func NewPostClient ¶
func NewPostClient(c config) *PostClient
NewPostClient returns a client for the Post from the given config.
func (*PostClient) Create ¶
func (c *PostClient) Create() *PostCreate
Create returns a builder for creating a Post entity.
func (*PostClient) CreateBulk ¶
func (c *PostClient) CreateBulk(builders ...*PostCreate) *PostCreateBulk
CreateBulk returns a builder for creating a bulk of Post entities.
func (*PostClient) Delete ¶
func (c *PostClient) Delete() *PostDelete
Delete returns a delete builder for Post.
func (*PostClient) DeleteOne ¶
func (c *PostClient) DeleteOne(_m *Post) *PostDeleteOne
DeleteOne returns a builder for deleting the given entity.
func (*PostClient) DeleteOneID ¶
func (c *PostClient) DeleteOneID(id int) *PostDeleteOne
DeleteOneID returns a builder for deleting the given entity by its id.
func (*PostClient) GetX ¶
func (c *PostClient) GetX(ctx context.Context, id int) *Post
GetX is like Get, but panics if an error occurs.
func (*PostClient) Intercept ¶
func (c *PostClient) Intercept(interceptors ...Interceptor)
Intercept adds a list of query interceptors to the interceptors stack. A call to `Intercept(f, g, h)` equals to `post.Intercept(f(g(h())))`.
func (*PostClient) Interceptors ¶
func (c *PostClient) Interceptors() []Interceptor
Interceptors returns the client interceptors.
func (*PostClient) MapCreateBulk ¶
func (c *PostClient) MapCreateBulk(slice any, setFunc func(*PostCreate, int)) *PostCreateBulk
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 (*PostClient) Query ¶
func (c *PostClient) Query() *PostQuery
Query returns a query builder for Post.
func (*PostClient) QueryOwner ¶
func (c *PostClient) QueryOwner(_m *Post) *UserQuery
QueryOwner queries the owner edge of a Post.
func (*PostClient) QueryPinners ¶
func (c *PostClient) QueryPinners(_m *Post) *UserQuery
QueryPinners queries the pinners edge of a Post.
func (*PostClient) Update ¶
func (c *PostClient) Update() *PostUpdate
Update returns an update builder for Post.
func (*PostClient) UpdateOne ¶
func (c *PostClient) UpdateOne(_m *Post) *PostUpdateOne
UpdateOne returns an update builder for the given entity.
func (*PostClient) UpdateOneID ¶
func (c *PostClient) UpdateOneID(id int) *PostUpdateOne
UpdateOneID returns an update builder for the given id.
func (*PostClient) Use ¶
func (c *PostClient) Use(hooks ...Hook)
Use adds a list of mutation hooks to the hooks stack. A call to `Use(f, g, h)` equals to `post.Hooks(f(g(h())))`.
type PostCreate ¶
type PostCreate struct {
// contains filtered or unexported fields
}
PostCreate is the builder for creating a Post entity.
func (*PostCreate) AddPinnerIDs ¶
func (_c *PostCreate) AddPinnerIDs(ids ...int) *PostCreate
AddPinnerIDs adds the "pinners" edge to the User entity by IDs.
func (*PostCreate) AddPinners ¶
func (_c *PostCreate) AddPinners(v ...*User) *PostCreate
AddPinners adds the "pinners" edges to the User entity.
func (*PostCreate) ApplyDomain ¶
func (c *PostCreate) ApplyDomain(ctx context.Context, d *domain.Post, opts ...entdomain.ApplyOption) (*PostCreate, error)
ApplyDomain applies domain.Post fields to the PostCreate builder.
func (*PostCreate) ApplyDomainX ¶
func (c *PostCreate) ApplyDomainX(ctx context.Context, d *domain.Post, opts ...entdomain.ApplyOption) *PostCreate
ApplyDomainX is the panicking variant of ApplyDomain. It enables fluent chaining at the cost of converting transformer errors into panics. Mirrors ent's SaveX/FirstX/OnlyX convention: use in tests and scripts, prefer ApplyDomain on request paths where transformer errors (e.g. KMS failures) must be recoverable.
func (*PostCreate) Exec ¶
func (_c *PostCreate) Exec(ctx context.Context) error
Exec executes the query.
func (*PostCreate) ExecX ¶
func (_c *PostCreate) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*PostCreate) Mutation ¶
func (_c *PostCreate) Mutation() *PostMutation
Mutation returns the PostMutation object of the builder.
func (*PostCreate) OnConflict ¶
func (_c *PostCreate) OnConflict(opts ...sql.ConflictOption) *PostUpsertOne
OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause of the `INSERT` statement. For example:
client.Post.Create().
SetTitle(v).
OnConflict(
// Update the row with the new values
// the was proposed for insertion.
sql.ResolveWithNewValues(),
).
// Override some of the fields with custom
// update values.
Update(func(u *ent.PostUpsert) {
SetTitle(v+v).
}).
Exec(ctx)
func (*PostCreate) OnConflictColumns ¶
func (_c *PostCreate) OnConflictColumns(columns ...string) *PostUpsertOne
OnConflictColumns calls `OnConflict` and configures the columns as conflict target. Using this option is equivalent to using:
client.Post.Create(). OnConflict(sql.ConflictColumns(columns...)). Exec(ctx)
func (*PostCreate) Save ¶
func (_c *PostCreate) Save(ctx context.Context) (*Post, error)
Save creates the Post in the database.
func (*PostCreate) SaveX ¶
func (_c *PostCreate) SaveX(ctx context.Context) *Post
SaveX calls Save and panics if Save returns an error.
func (*PostCreate) SetNillableOwnerID ¶
func (_c *PostCreate) SetNillableOwnerID(id *int) *PostCreate
SetNillableOwnerID sets the "owner" edge to the User entity by ID if the given value is not nil.
func (*PostCreate) SetNillablePublished ¶
func (_c *PostCreate) SetNillablePublished(v *bool) *PostCreate
SetNillablePublished sets the "published" field if the given value is not nil.
func (*PostCreate) SetOwner ¶
func (_c *PostCreate) SetOwner(v *User) *PostCreate
SetOwner sets the "owner" edge to the User entity.
func (*PostCreate) SetOwnerID ¶
func (_c *PostCreate) SetOwnerID(id int) *PostCreate
SetOwnerID sets the "owner" edge to the User entity by ID.
func (*PostCreate) SetPublished ¶
func (_c *PostCreate) SetPublished(v bool) *PostCreate
SetPublished sets the "published" field.
func (*PostCreate) SetTitle ¶
func (_c *PostCreate) SetTitle(v string) *PostCreate
SetTitle sets the "title" field.
type PostCreateBulk ¶
type PostCreateBulk struct {
// contains filtered or unexported fields
}
PostCreateBulk is the builder for creating many Post entities in bulk.
func (*PostCreateBulk) Exec ¶
func (_c *PostCreateBulk) Exec(ctx context.Context) error
Exec executes the query.
func (*PostCreateBulk) ExecX ¶
func (_c *PostCreateBulk) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*PostCreateBulk) OnConflict ¶
func (_c *PostCreateBulk) OnConflict(opts ...sql.ConflictOption) *PostUpsertBulk
OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause of the `INSERT` statement. For example:
client.Post.CreateBulk(builders...).
OnConflict(
// Update the row with the new values
// the was proposed for insertion.
sql.ResolveWithNewValues(),
).
// Override some of the fields with custom
// update values.
Update(func(u *ent.PostUpsert) {
SetTitle(v+v).
}).
Exec(ctx)
func (*PostCreateBulk) OnConflictColumns ¶
func (_c *PostCreateBulk) OnConflictColumns(columns ...string) *PostUpsertBulk
OnConflictColumns calls `OnConflict` and configures the columns as conflict target. Using this option is equivalent to using:
client.Post.Create(). OnConflict(sql.ConflictColumns(columns...)). Exec(ctx)
type PostDelete ¶
type PostDelete struct {
// contains filtered or unexported fields
}
PostDelete is the builder for deleting a Post entity.
func (*PostDelete) Exec ¶
func (_d *PostDelete) Exec(ctx context.Context) (int, error)
Exec executes the deletion query and returns how many vertices were deleted.
func (*PostDelete) ExecX ¶
func (_d *PostDelete) ExecX(ctx context.Context) int
ExecX is like Exec, but panics if an error occurs.
func (*PostDelete) Where ¶
func (_d *PostDelete) Where(ps ...predicate.Post) *PostDelete
Where appends a list predicates to the PostDelete builder.
type PostDeleteOne ¶
type PostDeleteOne struct {
// contains filtered or unexported fields
}
PostDeleteOne is the builder for deleting a single Post entity.
func (*PostDeleteOne) Exec ¶
func (_d *PostDeleteOne) Exec(ctx context.Context) error
Exec executes the deletion query.
func (*PostDeleteOne) ExecX ¶
func (_d *PostDeleteOne) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*PostDeleteOne) Where ¶
func (_d *PostDeleteOne) Where(ps ...predicate.Post) *PostDeleteOne
Where appends a list predicates to the PostDelete builder.
type PostDomainField ¶
type PostDomainField = string
PostDomainField is the type for Post domain field constants.
const ( PostDomainFieldTitle PostDomainField = "title" PostDomainFieldPublished PostDomainField = "published" PostDomainFieldOwnerID PostDomainField = "owner_id" PostDomainFieldPinnerIDs PostDomainField = "pinner_ids" )
type PostDomainTransformer ¶
type PostDomainTransformer struct {
}
PostDomainTransformer holds optional transformer functions for Post → domain mapping.
Get* functions are pure synchronous projections invoked by ToDomain. Set*OnCreate / Set*OnUpdate are invoked during ApplyDomain and may perform I/O (e.g. KMS-backed field encryption); they receive ctx + the full domain struct so they can access sibling fields and propagate cancellation.
var PostTransformer *PostDomainTransformer
PostTransformer is the package-level transformer for Post (nil by default).
type PostEdges ¶
type PostEdges struct {
// Owner holds the value of the owner edge.
Owner *User `json:"owner,omitempty"`
// Pinners holds the value of the pinners edge.
Pinners []*User `json:"pinners,omitempty"`
// contains filtered or unexported fields
}
PostEdges holds the relations/edges for other nodes in the graph.
func (PostEdges) OwnerOrErr ¶
OwnerOrErr returns the Owner value or an error if the edge was not loaded in eager-loading, or loaded but was not found.
func (PostEdges) PinnersOrErr ¶
PinnersOrErr returns the Pinners value or an error if the edge was not loaded in eager-loading.
type PostGroupBy ¶
type PostGroupBy struct {
// contains filtered or unexported fields
}
PostGroupBy is the group-by builder for Post entities.
func (*PostGroupBy) Aggregate ¶
func (_g *PostGroupBy) Aggregate(fns ...AggregateFunc) *PostGroupBy
Aggregate adds the given aggregation functions to the group-by query.
func (*PostGroupBy) Bool ¶
Bool returns a single bool from a selector. It is only allowed when selecting one field.
func (*PostGroupBy) Bools ¶
Bools returns list of bools from a selector. It is only allowed when selecting one field.
func (*PostGroupBy) Float64 ¶
Float64 returns a single float64 from a selector. It is only allowed when selecting one field.
func (*PostGroupBy) Float64s ¶
Float64s returns list of float64s from a selector. It is only allowed when selecting one field.
func (*PostGroupBy) Int ¶
Int returns a single int from a selector. It is only allowed when selecting one field.
func (*PostGroupBy) Ints ¶
Ints returns list of ints from a selector. It is only allowed when selecting one field.
func (*PostGroupBy) Scan ¶
func (_g *PostGroupBy) Scan(ctx context.Context, v any) error
Scan applies the selector query and scans the result into the given value.
func (*PostGroupBy) String ¶
String returns a single string from a selector. It is only allowed when selecting one field.
type PostMutation ¶
type PostMutation struct {
// contains filtered or unexported fields
}
PostMutation represents an operation that mutates the Post nodes in the graph.
func (*PostMutation) AddField ¶
func (m *PostMutation) 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 (*PostMutation) AddPinnerIDs ¶
func (m *PostMutation) AddPinnerIDs(ids ...int)
AddPinnerIDs adds the "pinners" edge to the User entity by ids.
func (*PostMutation) AddedEdges ¶
func (m *PostMutation) AddedEdges() []string
AddedEdges returns all edge names that were set/added in this mutation.
func (*PostMutation) AddedField ¶
func (m *PostMutation) 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 (*PostMutation) AddedFields ¶
func (m *PostMutation) AddedFields() []string
AddedFields returns all numeric fields that were incremented/decremented during this mutation.
func (*PostMutation) AddedIDs ¶
func (m *PostMutation) AddedIDs(name string) []ent.Value
AddedIDs returns all IDs (to other nodes) that were added for the given edge name in this mutation.
func (*PostMutation) ClearEdge ¶
func (m *PostMutation) 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 (*PostMutation) ClearField ¶
func (m *PostMutation) 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 (*PostMutation) ClearOwner ¶
func (m *PostMutation) ClearOwner()
ClearOwner clears the "owner" edge to the User entity.
func (*PostMutation) ClearPinners ¶
func (m *PostMutation) ClearPinners()
ClearPinners clears the "pinners" edge to the User entity.
func (*PostMutation) ClearedEdges ¶
func (m *PostMutation) ClearedEdges() []string
ClearedEdges returns all edge names that were cleared in this mutation.
func (*PostMutation) ClearedFields ¶
func (m *PostMutation) ClearedFields() []string
ClearedFields returns all nullable fields that were cleared during this mutation.
func (PostMutation) Client ¶
func (m PostMutation) 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 (*PostMutation) EdgeCleared ¶
func (m *PostMutation) EdgeCleared(name string) bool
EdgeCleared returns a boolean which indicates if the edge with the given name was cleared in this mutation.
func (*PostMutation) Field ¶
func (m *PostMutation) 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 (*PostMutation) FieldCleared ¶
func (m *PostMutation) FieldCleared(name string) bool
FieldCleared returns a boolean indicating if a field with the given name was cleared in this mutation.
func (*PostMutation) Fields ¶
func (m *PostMutation) 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 (*PostMutation) ID ¶
func (m *PostMutation) 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 (*PostMutation) IDs ¶
func (m *PostMutation) 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 (*PostMutation) 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 (*PostMutation) OldPublished ¶
func (m *PostMutation) OldPublished(ctx context.Context) (v bool, err error)
OldPublished returns the old "published" field's value of the Post entity. If the Post 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 (*PostMutation) OldTitle ¶
func (m *PostMutation) OldTitle(ctx context.Context) (v string, err error)
OldTitle returns the old "title" field's value of the Post entity. If the Post 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 (*PostMutation) OwnerCleared ¶
func (m *PostMutation) OwnerCleared() bool
OwnerCleared reports if the "owner" edge to the User entity was cleared.
func (*PostMutation) OwnerID ¶
func (m *PostMutation) OwnerID() (id int, exists bool)
OwnerID returns the "owner" edge ID in the mutation.
func (*PostMutation) OwnerIDs ¶
func (m *PostMutation) OwnerIDs() (ids []int)
OwnerIDs returns the "owner" edge IDs in the mutation. Note that IDs always returns len(IDs) <= 1 for unique edges, and you should use OwnerID instead. It exists only for internal usage by the builders.
func (*PostMutation) PinnersCleared ¶
func (m *PostMutation) PinnersCleared() bool
PinnersCleared reports if the "pinners" edge to the User entity was cleared.
func (*PostMutation) PinnersIDs ¶
func (m *PostMutation) PinnersIDs() (ids []int)
PinnersIDs returns the "pinners" edge IDs in the mutation.
func (*PostMutation) Published ¶
func (m *PostMutation) Published() (r bool, exists bool)
Published returns the value of the "published" field in the mutation.
func (*PostMutation) RemovePinnerIDs ¶
func (m *PostMutation) RemovePinnerIDs(ids ...int)
RemovePinnerIDs removes the "pinners" edge to the User entity by IDs.
func (*PostMutation) RemovedEdges ¶
func (m *PostMutation) RemovedEdges() []string
RemovedEdges returns all edge names that were removed in this mutation.
func (*PostMutation) RemovedIDs ¶
func (m *PostMutation) 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 (*PostMutation) RemovedPinnersIDs ¶
func (m *PostMutation) RemovedPinnersIDs() (ids []int)
RemovedPinners returns the removed IDs of the "pinners" edge to the User entity.
func (*PostMutation) ResetEdge ¶
func (m *PostMutation) 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 (*PostMutation) ResetField ¶
func (m *PostMutation) 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 (*PostMutation) ResetOwner ¶
func (m *PostMutation) ResetOwner()
ResetOwner resets all changes to the "owner" edge.
func (*PostMutation) ResetPinners ¶
func (m *PostMutation) ResetPinners()
ResetPinners resets all changes to the "pinners" edge.
func (*PostMutation) ResetPublished ¶
func (m *PostMutation) ResetPublished()
ResetPublished resets all changes to the "published" field.
func (*PostMutation) ResetTitle ¶
func (m *PostMutation) ResetTitle()
ResetTitle resets all changes to the "title" field.
func (*PostMutation) SetField ¶
func (m *PostMutation) 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 (*PostMutation) SetOp ¶
func (m *PostMutation) SetOp(op Op)
SetOp allows setting the mutation operation.
func (*PostMutation) SetOwnerID ¶
func (m *PostMutation) SetOwnerID(id int)
SetOwnerID sets the "owner" edge to the User entity by id.
func (*PostMutation) SetPublished ¶
func (m *PostMutation) SetPublished(b bool)
SetPublished sets the "published" field.
func (*PostMutation) SetTitle ¶
func (m *PostMutation) SetTitle(s string)
SetTitle sets the "title" field.
func (*PostMutation) Title ¶
func (m *PostMutation) Title() (r string, exists bool)
Title returns the value of the "title" field in the mutation.
func (PostMutation) Tx ¶
func (m PostMutation) Tx() (*Tx, error)
Tx returns an `ent.Tx` for mutations that were executed in transactions; it returns an error otherwise.
func (*PostMutation) Type ¶
func (m *PostMutation) Type() string
Type returns the node type of this mutation (Post).
func (*PostMutation) Where ¶
func (m *PostMutation) Where(ps ...predicate.Post)
Where appends a list predicates to the PostMutation builder.
func (*PostMutation) WhereP ¶
func (m *PostMutation) WhereP(ps ...func(*sql.Selector))
WhereP appends storage-level predicates to the PostMutation builder. Using this method, users can use type-assertion to append predicates that do not depend on any generated package.
type PostQuery ¶
type PostQuery struct {
// contains filtered or unexported fields
}
PostQuery is the builder for querying Post entities.
func (*PostQuery) Aggregate ¶
func (_q *PostQuery) Aggregate(fns ...AggregateFunc) *PostSelect
Aggregate returns a PostSelect configured with the given aggregations.
func (*PostQuery) Clone ¶
Clone returns a duplicate of the PostQuery builder, including all associated steps. It can be used to prepare common query builders and use them differently after the clone is made.
func (*PostQuery) First ¶
First returns the first Post entity from the query. Returns a *NotFoundError when no Post was found.
func (*PostQuery) FirstID ¶
FirstID returns the first Post ID from the query. Returns a *NotFoundError when no Post ID was found.
func (*PostQuery) GroupBy ¶
func (_q *PostQuery) GroupBy(field string, fields ...string) *PostGroupBy
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 {
Title string `json:"title,omitempty"`
Count int `json:"count,omitempty"`
}
client.Post.Query().
GroupBy(post.FieldTitle).
Aggregate(ent.Count()).
Scan(ctx, &v)
func (*PostQuery) Only ¶
Only returns a single Post entity found by the query, ensuring it only returns one. Returns a *NotSingularError when more than one Post entity is found. Returns a *NotFoundError when no Post entities are found.
func (*PostQuery) OnlyID ¶
OnlyID is like Only, but returns the only Post ID in the query. Returns a *NotSingularError when more than one Post ID is found. Returns a *NotFoundError when no entities are found.
func (*PostQuery) Order ¶
func (_q *PostQuery) Order(o ...post.OrderOption) *PostQuery
Order specifies how the records should be ordered.
func (*PostQuery) QueryOwner ¶
QueryOwner chains the current query on the "owner" edge.
func (*PostQuery) QueryPinners ¶
QueryPinners chains the current query on the "pinners" edge.
func (*PostQuery) Select ¶
func (_q *PostQuery) Select(fields ...string) *PostSelect
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 {
Title string `json:"title,omitempty"`
}
client.Post.Query().
Select(post.FieldTitle).
Scan(ctx, &v)
func (*PostQuery) Unique ¶
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 (*PostQuery) WithOwner ¶
WithOwner tells the query-builder to eager-load the nodes that are connected to the "owner" edge. The optional arguments are used to configure the query builder of the edge.
func (*PostQuery) WithPinners ¶
WithPinners tells the query-builder to eager-load the nodes that are connected to the "pinners" edge. The optional arguments are used to configure the query builder of the edge.
type PostSelect ¶
type PostSelect struct {
*PostQuery
// contains filtered or unexported fields
}
PostSelect is the builder for selecting fields of Post entities.
func (*PostSelect) Aggregate ¶
func (_s *PostSelect) Aggregate(fns ...AggregateFunc) *PostSelect
Aggregate adds the given aggregation functions to the selector query.
func (*PostSelect) Bool ¶
Bool returns a single bool from a selector. It is only allowed when selecting one field.
func (*PostSelect) Bools ¶
Bools returns list of bools from a selector. It is only allowed when selecting one field.
func (*PostSelect) Float64 ¶
Float64 returns a single float64 from a selector. It is only allowed when selecting one field.
func (*PostSelect) Float64s ¶
Float64s returns list of float64s from a selector. It is only allowed when selecting one field.
func (*PostSelect) Int ¶
Int returns a single int from a selector. It is only allowed when selecting one field.
func (*PostSelect) Ints ¶
Ints returns list of ints from a selector. It is only allowed when selecting one field.
func (*PostSelect) Scan ¶
func (_s *PostSelect) Scan(ctx context.Context, v any) error
Scan applies the selector query and scans the result into the given value.
func (*PostSelect) String ¶
String returns a single string from a selector. It is only allowed when selecting one field.
type PostUpdate ¶
type PostUpdate struct {
// contains filtered or unexported fields
}
PostUpdate is the builder for updating Post entities.
func (*PostUpdate) AddPinnerIDs ¶
func (_u *PostUpdate) AddPinnerIDs(ids ...int) *PostUpdate
AddPinnerIDs adds the "pinners" edge to the User entity by IDs.
func (*PostUpdate) AddPinners ¶
func (_u *PostUpdate) AddPinners(v ...*User) *PostUpdate
AddPinners adds the "pinners" edges to the User entity.
func (*PostUpdate) ApplyDomain ¶
func (u *PostUpdate) ApplyDomain(ctx context.Context, d *domain.Post, opts ...entdomain.ApplyOption) (*PostUpdate, error)
ApplyDomain applies domain.Post fields to the PostUpdate builder. Chain .Where(...) conditions to target specific records.
Note: ctx is accepted for API symmetry with ApplyDomainCreate/UpdateOne and to allow future ctx-aware field transformers. Currently no transformer hooks fire here — the error return is always nil.
func (*PostUpdate) ApplyDomainX ¶
func (u *PostUpdate) ApplyDomainX(ctx context.Context, d *domain.Post, opts ...entdomain.ApplyOption) *PostUpdate
ApplyDomainX is the panicking variant of ApplyDomain. See *PostCreate.ApplyDomainX.
func (*PostUpdate) ClearOwner ¶
func (_u *PostUpdate) ClearOwner() *PostUpdate
ClearOwner clears the "owner" edge to the User entity.
func (*PostUpdate) ClearPinners ¶
func (_u *PostUpdate) ClearPinners() *PostUpdate
ClearPinners clears all "pinners" edges to the User entity.
func (*PostUpdate) Exec ¶
func (_u *PostUpdate) Exec(ctx context.Context) error
Exec executes the query.
func (*PostUpdate) ExecX ¶
func (_u *PostUpdate) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*PostUpdate) Mutation ¶
func (_u *PostUpdate) Mutation() *PostMutation
Mutation returns the PostMutation object of the builder.
func (*PostUpdate) RemovePinnerIDs ¶
func (_u *PostUpdate) RemovePinnerIDs(ids ...int) *PostUpdate
RemovePinnerIDs removes the "pinners" edge to User entities by IDs.
func (*PostUpdate) RemovePinners ¶
func (_u *PostUpdate) RemovePinners(v ...*User) *PostUpdate
RemovePinners removes "pinners" edges to User entities.
func (*PostUpdate) Save ¶
func (_u *PostUpdate) Save(ctx context.Context) (int, error)
Save executes the query and returns the number of nodes affected by the update operation.
func (*PostUpdate) SaveX ¶
func (_u *PostUpdate) SaveX(ctx context.Context) int
SaveX is like Save, but panics if an error occurs.
func (*PostUpdate) SetNillableOwnerID ¶
func (_u *PostUpdate) SetNillableOwnerID(id *int) *PostUpdate
SetNillableOwnerID sets the "owner" edge to the User entity by ID if the given value is not nil.
func (*PostUpdate) SetNillablePublished ¶
func (_u *PostUpdate) SetNillablePublished(v *bool) *PostUpdate
SetNillablePublished sets the "published" field if the given value is not nil.
func (*PostUpdate) SetNillableTitle ¶
func (_u *PostUpdate) SetNillableTitle(v *string) *PostUpdate
SetNillableTitle sets the "title" field if the given value is not nil.
func (*PostUpdate) SetOwner ¶
func (_u *PostUpdate) SetOwner(v *User) *PostUpdate
SetOwner sets the "owner" edge to the User entity.
func (*PostUpdate) SetOwnerID ¶
func (_u *PostUpdate) SetOwnerID(id int) *PostUpdate
SetOwnerID sets the "owner" edge to the User entity by ID.
func (*PostUpdate) SetPublished ¶
func (_u *PostUpdate) SetPublished(v bool) *PostUpdate
SetPublished sets the "published" field.
func (*PostUpdate) SetTitle ¶
func (_u *PostUpdate) SetTitle(v string) *PostUpdate
SetTitle sets the "title" field.
func (*PostUpdate) Where ¶
func (_u *PostUpdate) Where(ps ...predicate.Post) *PostUpdate
Where appends a list predicates to the PostUpdate builder.
type PostUpdateOne ¶
type PostUpdateOne struct {
// contains filtered or unexported fields
}
PostUpdateOne is the builder for updating a single Post entity.
func (*PostUpdateOne) AddPinnerIDs ¶
func (_u *PostUpdateOne) AddPinnerIDs(ids ...int) *PostUpdateOne
AddPinnerIDs adds the "pinners" edge to the User entity by IDs.
func (*PostUpdateOne) AddPinners ¶
func (_u *PostUpdateOne) AddPinners(v ...*User) *PostUpdateOne
AddPinners adds the "pinners" edges to the User entity.
func (*PostUpdateOne) ApplyDomain ¶
func (u *PostUpdateOne) ApplyDomain(ctx context.Context, d *domain.Post, opts ...entdomain.ApplyOption) (*PostUpdateOne, error)
ApplyDomain applies domain.Post fields to the PostUpdateOne builder.
func (*PostUpdateOne) ApplyDomainX ¶
func (u *PostUpdateOne) ApplyDomainX(ctx context.Context, d *domain.Post, opts ...entdomain.ApplyOption) *PostUpdateOne
ApplyDomainX is the panicking variant of ApplyDomain. See *PostCreate.ApplyDomainX.
func (*PostUpdateOne) ClearOwner ¶
func (_u *PostUpdateOne) ClearOwner() *PostUpdateOne
ClearOwner clears the "owner" edge to the User entity.
func (*PostUpdateOne) ClearPinners ¶
func (_u *PostUpdateOne) ClearPinners() *PostUpdateOne
ClearPinners clears all "pinners" edges to the User entity.
func (*PostUpdateOne) Exec ¶
func (_u *PostUpdateOne) Exec(ctx context.Context) error
Exec executes the query on the entity.
func (*PostUpdateOne) ExecX ¶
func (_u *PostUpdateOne) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*PostUpdateOne) Mutation ¶
func (_u *PostUpdateOne) Mutation() *PostMutation
Mutation returns the PostMutation object of the builder.
func (*PostUpdateOne) RemovePinnerIDs ¶
func (_u *PostUpdateOne) RemovePinnerIDs(ids ...int) *PostUpdateOne
RemovePinnerIDs removes the "pinners" edge to User entities by IDs.
func (*PostUpdateOne) RemovePinners ¶
func (_u *PostUpdateOne) RemovePinners(v ...*User) *PostUpdateOne
RemovePinners removes "pinners" edges to User entities.
func (*PostUpdateOne) Save ¶
func (_u *PostUpdateOne) Save(ctx context.Context) (*Post, error)
Save executes the query and returns the updated Post entity.
func (*PostUpdateOne) SaveX ¶
func (_u *PostUpdateOne) SaveX(ctx context.Context) *Post
SaveX is like Save, but panics if an error occurs.
func (*PostUpdateOne) Select ¶
func (_u *PostUpdateOne) Select(field string, fields ...string) *PostUpdateOne
Select allows selecting one or more fields (columns) of the returned entity. The default is selecting all fields defined in the entity schema.
func (*PostUpdateOne) SetNillableOwnerID ¶
func (_u *PostUpdateOne) SetNillableOwnerID(id *int) *PostUpdateOne
SetNillableOwnerID sets the "owner" edge to the User entity by ID if the given value is not nil.
func (*PostUpdateOne) SetNillablePublished ¶
func (_u *PostUpdateOne) SetNillablePublished(v *bool) *PostUpdateOne
SetNillablePublished sets the "published" field if the given value is not nil.
func (*PostUpdateOne) SetNillableTitle ¶
func (_u *PostUpdateOne) SetNillableTitle(v *string) *PostUpdateOne
SetNillableTitle sets the "title" field if the given value is not nil.
func (*PostUpdateOne) SetOwner ¶
func (_u *PostUpdateOne) SetOwner(v *User) *PostUpdateOne
SetOwner sets the "owner" edge to the User entity.
func (*PostUpdateOne) SetOwnerID ¶
func (_u *PostUpdateOne) SetOwnerID(id int) *PostUpdateOne
SetOwnerID sets the "owner" edge to the User entity by ID.
func (*PostUpdateOne) SetPublished ¶
func (_u *PostUpdateOne) SetPublished(v bool) *PostUpdateOne
SetPublished sets the "published" field.
func (*PostUpdateOne) SetTitle ¶
func (_u *PostUpdateOne) SetTitle(v string) *PostUpdateOne
SetTitle sets the "title" field.
func (*PostUpdateOne) Where ¶
func (_u *PostUpdateOne) Where(ps ...predicate.Post) *PostUpdateOne
Where appends a list predicates to the PostUpdate builder.
type PostUpsert ¶
PostUpsert is the "OnConflict" setter.
func (*PostUpsert) SetPublished ¶
func (u *PostUpsert) SetPublished(v bool) *PostUpsert
SetPublished sets the "published" field.
func (*PostUpsert) SetTitle ¶
func (u *PostUpsert) SetTitle(v string) *PostUpsert
SetTitle sets the "title" field.
func (*PostUpsert) UpdatePublished ¶
func (u *PostUpsert) UpdatePublished() *PostUpsert
UpdatePublished sets the "published" field to the value that was provided on create.
func (*PostUpsert) UpdateTitle ¶
func (u *PostUpsert) UpdateTitle() *PostUpsert
UpdateTitle sets the "title" field to the value that was provided on create.
type PostUpsertBulk ¶
type PostUpsertBulk struct {
// contains filtered or unexported fields
}
PostUpsertBulk is the builder for "upsert"-ing a bulk of Post nodes.
func (*PostUpsertBulk) DoNothing ¶
func (u *PostUpsertBulk) DoNothing() *PostUpsertBulk
DoNothing configures the conflict_action to `DO NOTHING`. Supported only by SQLite and PostgreSQL.
func (*PostUpsertBulk) Exec ¶
func (u *PostUpsertBulk) Exec(ctx context.Context) error
Exec executes the query.
func (*PostUpsertBulk) ExecX ¶
func (u *PostUpsertBulk) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*PostUpsertBulk) Ignore ¶
func (u *PostUpsertBulk) Ignore() *PostUpsertBulk
Ignore sets each column to itself in case of conflict. Using this option is equivalent to using:
client.Post.Create(). OnConflict(sql.ResolveWithIgnore()). Exec(ctx)
func (*PostUpsertBulk) SetPublished ¶
func (u *PostUpsertBulk) SetPublished(v bool) *PostUpsertBulk
SetPublished sets the "published" field.
func (*PostUpsertBulk) SetTitle ¶
func (u *PostUpsertBulk) SetTitle(v string) *PostUpsertBulk
SetTitle sets the "title" field.
func (*PostUpsertBulk) Update ¶
func (u *PostUpsertBulk) Update(set func(*PostUpsert)) *PostUpsertBulk
Update allows overriding fields `UPDATE` values. See the PostCreateBulk.OnConflict documentation for more info.
func (*PostUpsertBulk) UpdateNewValues ¶
func (u *PostUpsertBulk) UpdateNewValues() *PostUpsertBulk
UpdateNewValues updates the mutable fields using the new values that were set on create. Using this option is equivalent to using:
client.Post.Create(). OnConflict( sql.ResolveWithNewValues(), ). Exec(ctx)
func (*PostUpsertBulk) UpdatePublished ¶
func (u *PostUpsertBulk) UpdatePublished() *PostUpsertBulk
UpdatePublished sets the "published" field to the value that was provided on create.
func (*PostUpsertBulk) UpdateTitle ¶
func (u *PostUpsertBulk) UpdateTitle() *PostUpsertBulk
UpdateTitle sets the "title" field to the value that was provided on create.
type PostUpsertOne ¶
type PostUpsertOne struct {
// contains filtered or unexported fields
}
PostUpsertOne is the builder for "upsert"-ing
one Post node.
func (*PostUpsertOne) ApplyDomain ¶
func (u *PostUpsertOne) ApplyDomain(ctx context.Context, d *domain.Post, opts ...entdomain.ApplyOption) (*PostUpsertOne, error)
ApplyDomain applies domain.Post fields to the PostUpsertOne builder on conflict.
Note: ctx is accepted for API symmetry. Transformer hooks do not fire on upsert conflict paths; the error return is always nil.
func (*PostUpsertOne) ApplyDomainX ¶
func (u *PostUpsertOne) ApplyDomainX(ctx context.Context, d *domain.Post, opts ...entdomain.ApplyOption) *PostUpsertOne
ApplyDomainX is the panicking variant of ApplyDomain. See *PostCreate.ApplyDomainX.
func (*PostUpsertOne) DoNothing ¶
func (u *PostUpsertOne) DoNothing() *PostUpsertOne
DoNothing configures the conflict_action to `DO NOTHING`. Supported only by SQLite and PostgreSQL.
func (*PostUpsertOne) Exec ¶
func (u *PostUpsertOne) Exec(ctx context.Context) error
Exec executes the query.
func (*PostUpsertOne) ExecX ¶
func (u *PostUpsertOne) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*PostUpsertOne) ID ¶
func (u *PostUpsertOne) ID(ctx context.Context) (id int, err error)
Exec executes the UPSERT query and returns the inserted/updated ID.
func (*PostUpsertOne) IDX ¶
func (u *PostUpsertOne) IDX(ctx context.Context) int
IDX is like ID, but panics if an error occurs.
func (*PostUpsertOne) Ignore ¶
func (u *PostUpsertOne) Ignore() *PostUpsertOne
Ignore sets each column to itself in case of conflict. Using this option is equivalent to using:
client.Post.Create().
OnConflict(sql.ResolveWithIgnore()).
Exec(ctx)
func (*PostUpsertOne) SetPublished ¶
func (u *PostUpsertOne) SetPublished(v bool) *PostUpsertOne
SetPublished sets the "published" field.
func (*PostUpsertOne) SetTitle ¶
func (u *PostUpsertOne) SetTitle(v string) *PostUpsertOne
SetTitle sets the "title" field.
func (*PostUpsertOne) Update ¶
func (u *PostUpsertOne) Update(set func(*PostUpsert)) *PostUpsertOne
Update allows overriding fields `UPDATE` values. See the PostCreate.OnConflict documentation for more info.
func (*PostUpsertOne) UpdateNewValues ¶
func (u *PostUpsertOne) UpdateNewValues() *PostUpsertOne
UpdateNewValues updates the mutable fields using the new values that were set on create. Using this option is equivalent to using:
client.Post.Create(). OnConflict( sql.ResolveWithNewValues(), ). Exec(ctx)
func (*PostUpsertOne) UpdatePublished ¶
func (u *PostUpsertOne) UpdatePublished() *PostUpsertOne
UpdatePublished sets the "published" field to the value that was provided on create.
func (*PostUpsertOne) UpdateTitle ¶
func (u *PostUpsertOne) UpdateTitle() *PostUpsertOne
UpdateTitle sets the "title" field to the value that was provided on create.
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 Tag ¶
type Tag struct {
// ID of the ent.
ID int `json:"id,omitempty"`
// Name holds the value of the "name" field.
Name string `json:"name,omitempty"`
// Edges holds the relations/edges for other nodes in the graph.
// The values are being populated by the TagQuery when eager-loading is set.
Edges TagEdges `json:"edges"`
// contains filtered or unexported fields
}
Tag is the model entity for the Tag schema.
func (*Tag) QueryUsers ¶
QueryUsers queries the "users" edge of the Tag entity.
func (*Tag) Unwrap ¶
Unwrap unwraps the Tag 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 (*Tag) Update ¶
func (_m *Tag) Update() *TagUpdateOne
Update returns a builder for updating this Tag. Note that you need to call Tag.Unwrap() before calling this method if this Tag was returned from a transaction, and the transaction was committed or rolled back.
type TagClient ¶
type TagClient struct {
// contains filtered or unexported fields
}
TagClient is a client for the Tag schema.
func NewTagClient ¶
func NewTagClient(c config) *TagClient
NewTagClient returns a client for the Tag from the given config.
func (*TagClient) CreateBulk ¶
func (c *TagClient) CreateBulk(builders ...*TagCreate) *TagCreateBulk
CreateBulk returns a builder for creating a bulk of Tag entities.
func (*TagClient) CreateBulkDomain ¶
func (c *TagClient) CreateBulkDomain(ctx context.Context, ds domain.TagList, opts ...entdomain.ApplyOption) (*TagCreateBulk, error)
CreateBulkDomain creates a TagCreateBulk from domain.TagList.
If any per-row transformer returns an error, the first such error is returned immediately and partial bulk is discarded.
func (*TagClient) CreateBulkDomainX ¶
func (c *TagClient) CreateBulkDomainX(ctx context.Context, ds domain.TagList, opts ...entdomain.ApplyOption) *TagCreateBulk
CreateBulkDomainX is the panicking variant of CreateBulkDomain. See *TagCreate.ApplyDomainX for the convention.
func (*TagClient) DeleteOne ¶
func (c *TagClient) DeleteOne(_m *Tag) *TagDeleteOne
DeleteOne returns a builder for deleting the given entity.
func (*TagClient) DeleteOneID ¶
func (c *TagClient) DeleteOneID(id int) *TagDeleteOne
DeleteOneID returns a builder for deleting the given entity by its id.
func (*TagClient) Intercept ¶
func (c *TagClient) Intercept(interceptors ...Interceptor)
Intercept adds a list of query interceptors to the interceptors stack. A call to `Intercept(f, g, h)` equals to `tag.Intercept(f(g(h())))`.
func (*TagClient) Interceptors ¶
func (c *TagClient) Interceptors() []Interceptor
Interceptors returns the client interceptors.
func (*TagClient) MapCreateBulk ¶
func (c *TagClient) MapCreateBulk(slice any, setFunc func(*TagCreate, int)) *TagCreateBulk
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 (*TagClient) QueryUsers ¶
QueryUsers queries the users edge of a Tag.
func (*TagClient) UpdateBulkDomain ¶
func (c *TagClient) UpdateBulkDomain(ctx context.Context, ds domain.TagList, opts ...entdomain.ApplyOption) (*TagUpdateOneBulk, error)
UpdateBulkDomain returns a TagUpdateOneBulk from domain.TagList. Each builder is keyed on ds[i].ID.
If any per-row transformer returns an error, the first such error is returned immediately and partial bulk is discarded.
func (*TagClient) UpdateBulkDomainX ¶
func (c *TagClient) UpdateBulkDomainX(ctx context.Context, ds domain.TagList, opts ...entdomain.ApplyOption) *TagUpdateOneBulk
UpdateBulkDomainX is the panicking variant of UpdateBulkDomain. See *TagCreate.ApplyDomainX for the convention.
func (*TagClient) UpdateOne ¶
func (c *TagClient) UpdateOne(_m *Tag) *TagUpdateOne
UpdateOne returns an update builder for the given entity.
func (*TagClient) UpdateOneID ¶
func (c *TagClient) UpdateOneID(id int) *TagUpdateOne
UpdateOneID returns an update builder for the given id.
type TagCreate ¶
type TagCreate struct {
// contains filtered or unexported fields
}
TagCreate is the builder for creating a Tag entity.
func (*TagCreate) AddUserIDs ¶
AddUserIDs adds the "users" edge to the User entity by IDs.
func (*TagCreate) ApplyDomain ¶
func (c *TagCreate) ApplyDomain(ctx context.Context, d *domain.Tag, opts ...entdomain.ApplyOption) (*TagCreate, error)
ApplyDomain applies domain.Tag fields to the TagCreate builder.
func (*TagCreate) ApplyDomainX ¶
func (c *TagCreate) ApplyDomainX(ctx context.Context, d *domain.Tag, opts ...entdomain.ApplyOption) *TagCreate
ApplyDomainX is the panicking variant of ApplyDomain. It enables fluent chaining at the cost of converting transformer errors into panics. Mirrors ent's SaveX/FirstX/OnlyX convention: use in tests and scripts, prefer ApplyDomain on request paths where transformer errors (e.g. KMS failures) must be recoverable.
func (*TagCreate) Mutation ¶
func (_c *TagCreate) Mutation() *TagMutation
Mutation returns the TagMutation object of the builder.
func (*TagCreate) OnConflict ¶
func (_c *TagCreate) OnConflict(opts ...sql.ConflictOption) *TagUpsertOne
OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause of the `INSERT` statement. For example:
client.Tag.Create().
SetName(v).
OnConflict(
// Update the row with the new values
// the was proposed for insertion.
sql.ResolveWithNewValues(),
).
// Override some of the fields with custom
// update values.
Update(func(u *ent.TagUpsert) {
SetName(v+v).
}).
Exec(ctx)
func (*TagCreate) OnConflictColumns ¶
func (_c *TagCreate) OnConflictColumns(columns ...string) *TagUpsertOne
OnConflictColumns calls `OnConflict` and configures the columns as conflict target. Using this option is equivalent to using:
client.Tag.Create(). OnConflict(sql.ConflictColumns(columns...)). Exec(ctx)
type TagCreateBulk ¶
type TagCreateBulk struct {
// contains filtered or unexported fields
}
TagCreateBulk is the builder for creating many Tag entities in bulk.
func (*TagCreateBulk) Exec ¶
func (_c *TagCreateBulk) Exec(ctx context.Context) error
Exec executes the query.
func (*TagCreateBulk) ExecX ¶
func (_c *TagCreateBulk) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*TagCreateBulk) OnConflict ¶
func (_c *TagCreateBulk) OnConflict(opts ...sql.ConflictOption) *TagUpsertBulk
OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause of the `INSERT` statement. For example:
client.Tag.CreateBulk(builders...).
OnConflict(
// Update the row with the new values
// the was proposed for insertion.
sql.ResolveWithNewValues(),
).
// Override some of the fields with custom
// update values.
Update(func(u *ent.TagUpsert) {
SetName(v+v).
}).
Exec(ctx)
func (*TagCreateBulk) OnConflictColumns ¶
func (_c *TagCreateBulk) OnConflictColumns(columns ...string) *TagUpsertBulk
OnConflictColumns calls `OnConflict` and configures the columns as conflict target. Using this option is equivalent to using:
client.Tag.Create(). OnConflict(sql.ConflictColumns(columns...)). Exec(ctx)
type TagDelete ¶
type TagDelete struct {
// contains filtered or unexported fields
}
TagDelete is the builder for deleting a Tag entity.
func (*TagDelete) Exec ¶
Exec executes the deletion query and returns how many vertices were deleted.
type TagDeleteOne ¶
type TagDeleteOne struct {
// contains filtered or unexported fields
}
TagDeleteOne is the builder for deleting a single Tag entity.
func (*TagDeleteOne) Exec ¶
func (_d *TagDeleteOne) Exec(ctx context.Context) error
Exec executes the deletion query.
func (*TagDeleteOne) ExecX ¶
func (_d *TagDeleteOne) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*TagDeleteOne) Where ¶
func (_d *TagDeleteOne) Where(ps ...predicate.Tag) *TagDeleteOne
Where appends a list predicates to the TagDelete builder.
type TagDomainField ¶
type TagDomainField = string
TagDomainField is the type for Tag domain field constants.
const ( TagDomainFieldName TagDomainField = "name" TagDomainFieldUserIDs TagDomainField = "user_ids" )
type TagDomainTransformer ¶
type TagDomainTransformer struct {
}
TagDomainTransformer holds optional transformer functions for Tag → domain mapping.
Get* functions are pure synchronous projections invoked by ToDomain. Set*OnCreate / Set*OnUpdate are invoked during ApplyDomain and may perform I/O (e.g. KMS-backed field encryption); they receive ctx + the full domain struct so they can access sibling fields and propagate cancellation.
var TagTransformer *TagDomainTransformer
TagTransformer is the package-level transformer for Tag (nil by default).
type TagEdges ¶
type TagEdges struct {
// Users holds the value of the users edge.
Users []*User `json:"users,omitempty"`
// contains filtered or unexported fields
}
TagEdges holds the relations/edges for other nodes in the graph.
func (TagEdges) UsersOrErr ¶
UsersOrErr returns the Users value or an error if the edge was not loaded in eager-loading.
type TagGroupBy ¶
type TagGroupBy struct {
// contains filtered or unexported fields
}
TagGroupBy is the group-by builder for Tag entities.
func (*TagGroupBy) Aggregate ¶
func (_g *TagGroupBy) Aggregate(fns ...AggregateFunc) *TagGroupBy
Aggregate adds the given aggregation functions to the group-by query.
func (*TagGroupBy) Bool ¶
Bool returns a single bool from a selector. It is only allowed when selecting one field.
func (*TagGroupBy) Bools ¶
Bools returns list of bools from a selector. It is only allowed when selecting one field.
func (*TagGroupBy) Float64 ¶
Float64 returns a single float64 from a selector. It is only allowed when selecting one field.
func (*TagGroupBy) Float64s ¶
Float64s returns list of float64s from a selector. It is only allowed when selecting one field.
func (*TagGroupBy) Int ¶
Int returns a single int from a selector. It is only allowed when selecting one field.
func (*TagGroupBy) Ints ¶
Ints returns list of ints from a selector. It is only allowed when selecting one field.
func (*TagGroupBy) Scan ¶
func (_g *TagGroupBy) Scan(ctx context.Context, v any) error
Scan applies the selector query and scans the result into the given value.
func (*TagGroupBy) String ¶
String returns a single string from a selector. It is only allowed when selecting one field.
type TagMutation ¶
type TagMutation struct {
// contains filtered or unexported fields
}
TagMutation represents an operation that mutates the Tag nodes in the graph.
func (*TagMutation) AddField ¶
func (m *TagMutation) 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 (*TagMutation) AddUserIDs ¶
func (m *TagMutation) AddUserIDs(ids ...int)
AddUserIDs adds the "users" edge to the User entity by ids.
func (*TagMutation) AddedEdges ¶
func (m *TagMutation) AddedEdges() []string
AddedEdges returns all edge names that were set/added in this mutation.
func (*TagMutation) AddedField ¶
func (m *TagMutation) 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 (*TagMutation) AddedFields ¶
func (m *TagMutation) AddedFields() []string
AddedFields returns all numeric fields that were incremented/decremented during this mutation.
func (*TagMutation) AddedIDs ¶
func (m *TagMutation) AddedIDs(name string) []ent.Value
AddedIDs returns all IDs (to other nodes) that were added for the given edge name in this mutation.
func (*TagMutation) ClearEdge ¶
func (m *TagMutation) 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 (*TagMutation) ClearField ¶
func (m *TagMutation) 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 (*TagMutation) ClearUsers ¶
func (m *TagMutation) ClearUsers()
ClearUsers clears the "users" edge to the User entity.
func (*TagMutation) ClearedEdges ¶
func (m *TagMutation) ClearedEdges() []string
ClearedEdges returns all edge names that were cleared in this mutation.
func (*TagMutation) ClearedFields ¶
func (m *TagMutation) ClearedFields() []string
ClearedFields returns all nullable fields that were cleared during this mutation.
func (TagMutation) Client ¶
func (m TagMutation) 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 (*TagMutation) EdgeCleared ¶
func (m *TagMutation) EdgeCleared(name string) bool
EdgeCleared returns a boolean which indicates if the edge with the given name was cleared in this mutation.
func (*TagMutation) Field ¶
func (m *TagMutation) 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 (*TagMutation) FieldCleared ¶
func (m *TagMutation) FieldCleared(name string) bool
FieldCleared returns a boolean indicating if a field with the given name was cleared in this mutation.
func (*TagMutation) Fields ¶
func (m *TagMutation) 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 (*TagMutation) ID ¶
func (m *TagMutation) 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 (*TagMutation) IDs ¶
func (m *TagMutation) 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 (*TagMutation) Name ¶
func (m *TagMutation) Name() (r string, exists bool)
Name returns the value of the "name" field in the mutation.
func (*TagMutation) 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 (*TagMutation) OldName ¶
func (m *TagMutation) OldName(ctx context.Context) (v string, err error)
OldName returns the old "name" field's value of the Tag entity. If the Tag 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 (*TagMutation) RemoveUserIDs ¶
func (m *TagMutation) RemoveUserIDs(ids ...int)
RemoveUserIDs removes the "users" edge to the User entity by IDs.
func (*TagMutation) RemovedEdges ¶
func (m *TagMutation) RemovedEdges() []string
RemovedEdges returns all edge names that were removed in this mutation.
func (*TagMutation) RemovedIDs ¶
func (m *TagMutation) 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 (*TagMutation) RemovedUsersIDs ¶
func (m *TagMutation) RemovedUsersIDs() (ids []int)
RemovedUsers returns the removed IDs of the "users" edge to the User entity.
func (*TagMutation) ResetEdge ¶
func (m *TagMutation) 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 (*TagMutation) ResetField ¶
func (m *TagMutation) 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 (*TagMutation) ResetName ¶
func (m *TagMutation) ResetName()
ResetName resets all changes to the "name" field.
func (*TagMutation) ResetUsers ¶
func (m *TagMutation) ResetUsers()
ResetUsers resets all changes to the "users" edge.
func (*TagMutation) SetField ¶
func (m *TagMutation) 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 (*TagMutation) SetName ¶
func (m *TagMutation) SetName(s string)
SetName sets the "name" field.
func (*TagMutation) SetOp ¶
func (m *TagMutation) SetOp(op Op)
SetOp allows setting the mutation operation.
func (TagMutation) Tx ¶
func (m TagMutation) Tx() (*Tx, error)
Tx returns an `ent.Tx` for mutations that were executed in transactions; it returns an error otherwise.
func (*TagMutation) Type ¶
func (m *TagMutation) Type() string
Type returns the node type of this mutation (Tag).
func (*TagMutation) UsersCleared ¶
func (m *TagMutation) UsersCleared() bool
UsersCleared reports if the "users" edge to the User entity was cleared.
func (*TagMutation) UsersIDs ¶
func (m *TagMutation) UsersIDs() (ids []int)
UsersIDs returns the "users" edge IDs in the mutation.
func (*TagMutation) Where ¶
func (m *TagMutation) Where(ps ...predicate.Tag)
Where appends a list predicates to the TagMutation builder.
func (*TagMutation) WhereP ¶
func (m *TagMutation) WhereP(ps ...func(*sql.Selector))
WhereP appends storage-level predicates to the TagMutation builder. Using this method, users can use type-assertion to append predicates that do not depend on any generated package.
type TagQuery ¶
type TagQuery struct {
// contains filtered or unexported fields
}
TagQuery is the builder for querying Tag entities.
func (*TagQuery) Aggregate ¶
func (_q *TagQuery) Aggregate(fns ...AggregateFunc) *TagSelect
Aggregate returns a TagSelect configured with the given aggregations.
func (*TagQuery) Clone ¶
Clone returns a duplicate of the TagQuery builder, including all associated steps. It can be used to prepare common query builders and use them differently after the clone is made.
func (*TagQuery) First ¶
First returns the first Tag entity from the query. Returns a *NotFoundError when no Tag was found.
func (*TagQuery) FirstID ¶
FirstID returns the first Tag ID from the query. Returns a *NotFoundError when no Tag ID was found.
func (*TagQuery) GroupBy ¶
func (_q *TagQuery) GroupBy(field string, fields ...string) *TagGroupBy
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.Tag.Query().
GroupBy(tag.FieldName).
Aggregate(ent.Count()).
Scan(ctx, &v)
func (*TagQuery) Only ¶
Only returns a single Tag entity found by the query, ensuring it only returns one. Returns a *NotSingularError when more than one Tag entity is found. Returns a *NotFoundError when no Tag entities are found.
func (*TagQuery) OnlyID ¶
OnlyID is like Only, but returns the only Tag ID in the query. Returns a *NotSingularError when more than one Tag ID is found. Returns a *NotFoundError when no entities are found.
func (*TagQuery) Order ¶
func (_q *TagQuery) Order(o ...tag.OrderOption) *TagQuery
Order specifies how the records should be ordered.
func (*TagQuery) QueryUsers ¶
QueryUsers chains the current query on the "users" edge.
func (*TagQuery) Select ¶
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.Tag.Query().
Select(tag.FieldName).
Scan(ctx, &v)
func (*TagQuery) Unique ¶
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.
type TagSelect ¶
type TagSelect struct {
*TagQuery
// contains filtered or unexported fields
}
TagSelect is the builder for selecting fields of Tag entities.
func (*TagSelect) Aggregate ¶
func (_s *TagSelect) Aggregate(fns ...AggregateFunc) *TagSelect
Aggregate adds the given aggregation functions to the selector query.
func (*TagSelect) Bool ¶
Bool returns a single bool from a selector. It is only allowed when selecting one field.
func (*TagSelect) Bools ¶
Bools returns list of bools from a selector. It is only allowed when selecting one field.
func (*TagSelect) Float64 ¶
Float64 returns a single float64 from a selector. It is only allowed when selecting one field.
func (*TagSelect) Float64s ¶
Float64s returns list of float64s from a selector. It is only allowed when selecting one field.
func (*TagSelect) Int ¶
Int returns a single int from a selector. It is only allowed when selecting one field.
func (*TagSelect) Ints ¶
Ints returns list of ints from a selector. It is only allowed when selecting one field.
func (*TagSelect) String ¶
String returns a single string from a selector. It is only allowed when selecting one field.
type TagUpdate ¶
type TagUpdate struct {
// contains filtered or unexported fields
}
TagUpdate is the builder for updating Tag entities.
func (*TagUpdate) AddUserIDs ¶
AddUserIDs adds the "users" edge to the User entity by IDs.
func (*TagUpdate) ApplyDomain ¶
func (u *TagUpdate) ApplyDomain(ctx context.Context, d *domain.Tag, opts ...entdomain.ApplyOption) (*TagUpdate, error)
ApplyDomain applies domain.Tag fields to the TagUpdate builder. Chain .Where(...) conditions to target specific records.
Note: ctx is accepted for API symmetry with ApplyDomainCreate/UpdateOne and to allow future ctx-aware field transformers. Currently no transformer hooks fire here — the error return is always nil.
func (*TagUpdate) ApplyDomainX ¶
func (u *TagUpdate) ApplyDomainX(ctx context.Context, d *domain.Tag, opts ...entdomain.ApplyOption) *TagUpdate
ApplyDomainX is the panicking variant of ApplyDomain. See *TagCreate.ApplyDomainX.
func (*TagUpdate) ClearUsers ¶
ClearUsers clears all "users" edges to the User entity.
func (*TagUpdate) Mutation ¶
func (_u *TagUpdate) Mutation() *TagMutation
Mutation returns the TagMutation object of the builder.
func (*TagUpdate) RemoveUserIDs ¶
RemoveUserIDs removes the "users" edge to User entities by IDs.
func (*TagUpdate) RemoveUsers ¶
RemoveUsers removes "users" edges to User entities.
func (*TagUpdate) Save ¶
Save executes the query and returns the number of nodes affected by the update operation.
func (*TagUpdate) SetNillableName ¶
SetNillableName sets the "name" field if the given value is not nil.
type TagUpdateOne ¶
type TagUpdateOne struct {
// contains filtered or unexported fields
}
TagUpdateOne is the builder for updating a single Tag entity.
func (*TagUpdateOne) AddUserIDs ¶
func (_u *TagUpdateOne) AddUserIDs(ids ...int) *TagUpdateOne
AddUserIDs adds the "users" edge to the User entity by IDs.
func (*TagUpdateOne) AddUsers ¶
func (_u *TagUpdateOne) AddUsers(v ...*User) *TagUpdateOne
AddUsers adds the "users" edges to the User entity.
func (*TagUpdateOne) ApplyDomain ¶
func (u *TagUpdateOne) ApplyDomain(ctx context.Context, d *domain.Tag, opts ...entdomain.ApplyOption) (*TagUpdateOne, error)
ApplyDomain applies domain.Tag fields to the TagUpdateOne builder.
func (*TagUpdateOne) ApplyDomainX ¶
func (u *TagUpdateOne) ApplyDomainX(ctx context.Context, d *domain.Tag, opts ...entdomain.ApplyOption) *TagUpdateOne
ApplyDomainX is the panicking variant of ApplyDomain. See *TagCreate.ApplyDomainX.
func (*TagUpdateOne) ClearUsers ¶
func (_u *TagUpdateOne) ClearUsers() *TagUpdateOne
ClearUsers clears all "users" edges to the User entity.
func (*TagUpdateOne) Exec ¶
func (_u *TagUpdateOne) Exec(ctx context.Context) error
Exec executes the query on the entity.
func (*TagUpdateOne) ExecX ¶
func (_u *TagUpdateOne) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*TagUpdateOne) Mutation ¶
func (_u *TagUpdateOne) Mutation() *TagMutation
Mutation returns the TagMutation object of the builder.
func (*TagUpdateOne) RemoveUserIDs ¶
func (_u *TagUpdateOne) RemoveUserIDs(ids ...int) *TagUpdateOne
RemoveUserIDs removes the "users" edge to User entities by IDs.
func (*TagUpdateOne) RemoveUsers ¶
func (_u *TagUpdateOne) RemoveUsers(v ...*User) *TagUpdateOne
RemoveUsers removes "users" edges to User entities.
func (*TagUpdateOne) Save ¶
func (_u *TagUpdateOne) Save(ctx context.Context) (*Tag, error)
Save executes the query and returns the updated Tag entity.
func (*TagUpdateOne) SaveX ¶
func (_u *TagUpdateOne) SaveX(ctx context.Context) *Tag
SaveX is like Save, but panics if an error occurs.
func (*TagUpdateOne) Select ¶
func (_u *TagUpdateOne) Select(field string, fields ...string) *TagUpdateOne
Select allows selecting one or more fields (columns) of the returned entity. The default is selecting all fields defined in the entity schema.
func (*TagUpdateOne) SetName ¶
func (_u *TagUpdateOne) SetName(v string) *TagUpdateOne
SetName sets the "name" field.
func (*TagUpdateOne) SetNillableName ¶
func (_u *TagUpdateOne) SetNillableName(v *string) *TagUpdateOne
SetNillableName sets the "name" field if the given value is not nil.
func (*TagUpdateOne) Where ¶
func (_u *TagUpdateOne) Where(ps ...predicate.Tag) *TagUpdateOne
Where appends a list predicates to the TagUpdate builder.
type TagUpdateOneBulk ¶
type TagUpdateOneBulk struct {
// contains filtered or unexported fields
}
TagUpdateOneBulk holds a set of TagUpdateOne builders.
func (*TagUpdateOneBulk) Exec ¶
func (b *TagUpdateOneBulk) Exec(ctx context.Context) error
Exec executes all builders without returning the updated entities.
func (*TagUpdateOneBulk) ExecX ¶
func (b *TagUpdateOneBulk) ExecX(ctx context.Context)
ExecX is like Exec but panics on error.
type TagUpsert ¶
TagUpsert is the "OnConflict" setter.
func (*TagUpsert) UpdateName ¶
UpdateName sets the "name" field to the value that was provided on create.
type TagUpsertBulk ¶
type TagUpsertBulk struct {
// contains filtered or unexported fields
}
TagUpsertBulk is the builder for "upsert"-ing a bulk of Tag nodes.
func (*TagUpsertBulk) ApplyDomain ¶
func (u *TagUpsertBulk) ApplyDomain(ctx context.Context, d *domain.Tag, opts ...entdomain.ApplyOption) (*TagUpsertBulk, error)
ApplyDomain applies domain.Tag fields to the TagUpsertBulk builder on conflict.
Note: ctx is accepted for API symmetry. Transformer hooks do not fire on upsert conflict paths; the error return is always nil.
func (*TagUpsertBulk) ApplyDomainX ¶
func (u *TagUpsertBulk) ApplyDomainX(ctx context.Context, d *domain.Tag, opts ...entdomain.ApplyOption) *TagUpsertBulk
ApplyDomainX is the panicking variant of ApplyDomain. See *TagCreate.ApplyDomainX.
func (*TagUpsertBulk) DoNothing ¶
func (u *TagUpsertBulk) DoNothing() *TagUpsertBulk
DoNothing configures the conflict_action to `DO NOTHING`. Supported only by SQLite and PostgreSQL.
func (*TagUpsertBulk) Exec ¶
func (u *TagUpsertBulk) Exec(ctx context.Context) error
Exec executes the query.
func (*TagUpsertBulk) ExecX ¶
func (u *TagUpsertBulk) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*TagUpsertBulk) Ignore ¶
func (u *TagUpsertBulk) Ignore() *TagUpsertBulk
Ignore sets each column to itself in case of conflict. Using this option is equivalent to using:
client.Tag.Create(). OnConflict(sql.ResolveWithIgnore()). Exec(ctx)
func (*TagUpsertBulk) SetName ¶
func (u *TagUpsertBulk) SetName(v string) *TagUpsertBulk
SetName sets the "name" field.
func (*TagUpsertBulk) Update ¶
func (u *TagUpsertBulk) Update(set func(*TagUpsert)) *TagUpsertBulk
Update allows overriding fields `UPDATE` values. See the TagCreateBulk.OnConflict documentation for more info.
func (*TagUpsertBulk) UpdateName ¶
func (u *TagUpsertBulk) UpdateName() *TagUpsertBulk
UpdateName sets the "name" field to the value that was provided on create.
func (*TagUpsertBulk) UpdateNewValues ¶
func (u *TagUpsertBulk) UpdateNewValues() *TagUpsertBulk
UpdateNewValues updates the mutable fields using the new values that were set on create. Using this option is equivalent to using:
client.Tag.Create(). OnConflict( sql.ResolveWithNewValues(), ). Exec(ctx)
type TagUpsertOne ¶
type TagUpsertOne struct {
// contains filtered or unexported fields
}
TagUpsertOne is the builder for "upsert"-ing
one Tag node.
func (*TagUpsertOne) ApplyDomain ¶
func (u *TagUpsertOne) ApplyDomain(ctx context.Context, d *domain.Tag, opts ...entdomain.ApplyOption) (*TagUpsertOne, error)
ApplyDomain applies domain.Tag fields to the TagUpsertOne builder on conflict.
Note: ctx is accepted for API symmetry. Transformer hooks do not fire on upsert conflict paths; the error return is always nil.
func (*TagUpsertOne) ApplyDomainX ¶
func (u *TagUpsertOne) ApplyDomainX(ctx context.Context, d *domain.Tag, opts ...entdomain.ApplyOption) *TagUpsertOne
ApplyDomainX is the panicking variant of ApplyDomain. See *TagCreate.ApplyDomainX.
func (*TagUpsertOne) DoNothing ¶
func (u *TagUpsertOne) DoNothing() *TagUpsertOne
DoNothing configures the conflict_action to `DO NOTHING`. Supported only by SQLite and PostgreSQL.
func (*TagUpsertOne) Exec ¶
func (u *TagUpsertOne) Exec(ctx context.Context) error
Exec executes the query.
func (*TagUpsertOne) ExecX ¶
func (u *TagUpsertOne) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*TagUpsertOne) ID ¶
func (u *TagUpsertOne) ID(ctx context.Context) (id int, err error)
Exec executes the UPSERT query and returns the inserted/updated ID.
func (*TagUpsertOne) IDX ¶
func (u *TagUpsertOne) IDX(ctx context.Context) int
IDX is like ID, but panics if an error occurs.
func (*TagUpsertOne) Ignore ¶
func (u *TagUpsertOne) Ignore() *TagUpsertOne
Ignore sets each column to itself in case of conflict. Using this option is equivalent to using:
client.Tag.Create().
OnConflict(sql.ResolveWithIgnore()).
Exec(ctx)
func (*TagUpsertOne) SetName ¶
func (u *TagUpsertOne) SetName(v string) *TagUpsertOne
SetName sets the "name" field.
func (*TagUpsertOne) Update ¶
func (u *TagUpsertOne) Update(set func(*TagUpsert)) *TagUpsertOne
Update allows overriding fields `UPDATE` values. See the TagCreate.OnConflict documentation for more info.
func (*TagUpsertOne) UpdateName ¶
func (u *TagUpsertOne) UpdateName() *TagUpsertOne
UpdateName sets the "name" field to the value that was provided on create.
func (*TagUpsertOne) UpdateNewValues ¶
func (u *TagUpsertOne) UpdateNewValues() *TagUpsertOne
UpdateNewValues updates the mutable fields using the new values that were set on create. Using this option is equivalent to using:
client.Tag.Create(). OnConflict( sql.ResolveWithNewValues(), ). Exec(ctx)
type TraverseFunc ¶
type TraverseFunc = ent.TraverseFunc
ent aliases to avoid import conflicts in user's code.
type Tx ¶
type Tx struct {
// Post is the client for interacting with the Post builders.
Post *PostClient
// Tag is the client for interacting with the Tag builders.
Tag *TagClient
// User is the client for interacting with the User builders.
User *UserClient
// 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 User ¶
type User struct {
// ID of the ent.
ID int `json:"id,omitempty"`
// Name holds the value of the "name" field.
Name string `json:"name,omitempty"`
// Bio holds the value of the "bio" field.
Bio string `json:"bio,omitempty"`
// Status holds the value of the "status" field.
Status user.Status `json:"status,omitempty"`
// CreatedAt holds the value of the "created_at" field.
CreatedAt time.Time `json:"created_at,omitempty"`
// Username holds the value of the "username" field.
Username string `json:"username,omitempty"`
// Score holds the value of the "score" field.
Score int `json:"score,omitempty"`
// ExternalID holds the value of the "external_id" field.
ExternalID uuid.UUID `json:"external_id,omitempty"`
// UpdatedAt holds the value of the "updated_at" field.
UpdatedAt time.Time `json:"updated_at,omitempty"`
// Settings holds the value of the "settings" field.
Settings map[string]interface{} `json:"settings,omitempty"`
// Labels holds the value of the "labels" field.
Labels map[string]interface{} `json:"labels,omitempty"`
// TagNames holds the value of the "tag_names" field.
TagNames []string `json:"tag_names,omitempty"`
// Metadata holds the value of the "metadata" field.
Metadata domain.UserMetadata `json:"metadata,omitempty"`
// Edges holds the relations/edges for other nodes in the graph.
// The values are being populated by the UserQuery when eager-loading is set.
Edges UserEdges `json:"edges"`
// contains filtered or unexported fields
}
User is the model entity for the User schema.
func (*User) QueryPinnedPost ¶
QueryPinnedPost queries the "pinned_post" edge of the User entity.
func (*User) QueryPosts ¶
QueryPosts queries the "posts" edge of the User entity.
func (*User) Unwrap ¶
Unwrap unwraps the User 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 (*User) Update ¶
func (_m *User) Update() *UserUpdateOne
Update returns a builder for updating this User. Note that you need to call User.Unwrap() before calling this method if this User was returned from a transaction, and the transaction was committed or rolled back.
type UserClient ¶
type UserClient struct {
// contains filtered or unexported fields
}
UserClient is a client for the User schema.
func NewUserClient ¶
func NewUserClient(c config) *UserClient
NewUserClient returns a client for the User from the given config.
func (*UserClient) Create ¶
func (c *UserClient) Create() *UserCreate
Create returns a builder for creating a User entity.
func (*UserClient) CreateBulk ¶
func (c *UserClient) CreateBulk(builders ...*UserCreate) *UserCreateBulk
CreateBulk returns a builder for creating a bulk of User entities.
func (*UserClient) CreateBulkDomain ¶
func (c *UserClient) CreateBulkDomain(ctx context.Context, ds domain.UserList, opts ...entdomain.ApplyOption) (*UserCreateBulk, error)
CreateBulkDomain creates a UserCreateBulk from domain.UserList.
If any per-row transformer returns an error, the first such error is returned immediately and partial bulk is discarded.
func (*UserClient) CreateBulkDomainX ¶
func (c *UserClient) CreateBulkDomainX(ctx context.Context, ds domain.UserList, opts ...entdomain.ApplyOption) *UserCreateBulk
CreateBulkDomainX is the panicking variant of CreateBulkDomain. See *UserCreate.ApplyDomainX for the convention.
func (*UserClient) Delete ¶
func (c *UserClient) Delete() *UserDelete
Delete returns a delete builder for User.
func (*UserClient) DeleteOne ¶
func (c *UserClient) DeleteOne(_m *User) *UserDeleteOne
DeleteOne returns a builder for deleting the given entity.
func (*UserClient) DeleteOneID ¶
func (c *UserClient) DeleteOneID(id int) *UserDeleteOne
DeleteOneID returns a builder for deleting the given entity by its id.
func (*UserClient) GetX ¶
func (c *UserClient) GetX(ctx context.Context, id int) *User
GetX is like Get, but panics if an error occurs.
func (*UserClient) Intercept ¶
func (c *UserClient) Intercept(interceptors ...Interceptor)
Intercept adds a list of query interceptors to the interceptors stack. A call to `Intercept(f, g, h)` equals to `user.Intercept(f(g(h())))`.
func (*UserClient) Interceptors ¶
func (c *UserClient) Interceptors() []Interceptor
Interceptors returns the client interceptors.
func (*UserClient) MapCreateBulk ¶
func (c *UserClient) MapCreateBulk(slice any, setFunc func(*UserCreate, int)) *UserCreateBulk
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 (*UserClient) Query ¶
func (c *UserClient) Query() *UserQuery
Query returns a query builder for User.
func (*UserClient) QueryPinnedPost ¶
func (c *UserClient) QueryPinnedPost(_m *User) *PostQuery
QueryPinnedPost queries the pinned_post edge of a User.
func (*UserClient) QueryPosts ¶
func (c *UserClient) QueryPosts(_m *User) *PostQuery
QueryPosts queries the posts edge of a User.
func (*UserClient) QueryTags ¶
func (c *UserClient) QueryTags(_m *User) *TagQuery
QueryTags queries the tags edge of a User.
func (*UserClient) Update ¶
func (c *UserClient) Update() *UserUpdate
Update returns an update builder for User.
func (*UserClient) UpdateBulkDomain ¶
func (c *UserClient) UpdateBulkDomain(ctx context.Context, ds domain.UserList, opts ...entdomain.ApplyOption) (*UserUpdateOneBulk, error)
UpdateBulkDomain returns a UserUpdateOneBulk from domain.UserList. Each builder is keyed on ds[i].ID.
If any per-row transformer returns an error, the first such error is returned immediately and partial bulk is discarded.
func (*UserClient) UpdateBulkDomainX ¶
func (c *UserClient) UpdateBulkDomainX(ctx context.Context, ds domain.UserList, opts ...entdomain.ApplyOption) *UserUpdateOneBulk
UpdateBulkDomainX is the panicking variant of UpdateBulkDomain. See *UserCreate.ApplyDomainX for the convention.
func (*UserClient) UpdateOne ¶
func (c *UserClient) UpdateOne(_m *User) *UserUpdateOne
UpdateOne returns an update builder for the given entity.
func (*UserClient) UpdateOneID ¶
func (c *UserClient) UpdateOneID(id int) *UserUpdateOne
UpdateOneID returns an update builder for the given id.
func (*UserClient) Use ¶
func (c *UserClient) Use(hooks ...Hook)
Use adds a list of mutation hooks to the hooks stack. A call to `Use(f, g, h)` equals to `user.Hooks(f(g(h())))`.
type UserCreate ¶
type UserCreate struct {
// contains filtered or unexported fields
}
UserCreate is the builder for creating a User entity.
func (*UserCreate) AddPostIDs ¶
func (_c *UserCreate) AddPostIDs(ids ...int) *UserCreate
AddPostIDs adds the "posts" edge to the Post entity by IDs.
func (*UserCreate) AddPosts ¶
func (_c *UserCreate) AddPosts(v ...*Post) *UserCreate
AddPosts adds the "posts" edges to the Post entity.
func (*UserCreate) AddTagIDs ¶
func (_c *UserCreate) AddTagIDs(ids ...int) *UserCreate
AddTagIDs adds the "tags" edge to the Tag entity by IDs.
func (*UserCreate) AddTags ¶
func (_c *UserCreate) AddTags(v ...*Tag) *UserCreate
AddTags adds the "tags" edges to the Tag entity.
func (*UserCreate) ApplyDomain ¶
func (c *UserCreate) ApplyDomain(ctx context.Context, d *domain.User, opts ...entdomain.ApplyOption) (*UserCreate, error)
ApplyDomain applies domain.User fields to the UserCreate builder.
func (*UserCreate) ApplyDomainX ¶
func (c *UserCreate) ApplyDomainX(ctx context.Context, d *domain.User, opts ...entdomain.ApplyOption) *UserCreate
ApplyDomainX is the panicking variant of ApplyDomain. It enables fluent chaining at the cost of converting transformer errors into panics. Mirrors ent's SaveX/FirstX/OnlyX convention: use in tests and scripts, prefer ApplyDomain on request paths where transformer errors (e.g. KMS failures) must be recoverable.
func (*UserCreate) Exec ¶
func (_c *UserCreate) Exec(ctx context.Context) error
Exec executes the query.
func (*UserCreate) ExecX ¶
func (_c *UserCreate) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*UserCreate) Mutation ¶
func (_c *UserCreate) Mutation() *UserMutation
Mutation returns the UserMutation object of the builder.
func (*UserCreate) OnConflict ¶
func (_c *UserCreate) OnConflict(opts ...sql.ConflictOption) *UserUpsertOne
OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause of the `INSERT` statement. For example:
client.User.Create().
SetName(v).
OnConflict(
// Update the row with the new values
// the was proposed for insertion.
sql.ResolveWithNewValues(),
).
// Override some of the fields with custom
// update values.
Update(func(u *ent.UserUpsert) {
SetName(v+v).
}).
Exec(ctx)
func (*UserCreate) OnConflictColumns ¶
func (_c *UserCreate) OnConflictColumns(columns ...string) *UserUpsertOne
OnConflictColumns calls `OnConflict` and configures the columns as conflict target. Using this option is equivalent to using:
client.User.Create(). OnConflict(sql.ConflictColumns(columns...)). Exec(ctx)
func (*UserCreate) Save ¶
func (_c *UserCreate) Save(ctx context.Context) (*User, error)
Save creates the User in the database.
func (*UserCreate) SaveX ¶
func (_c *UserCreate) SaveX(ctx context.Context) *User
SaveX calls Save and panics if Save returns an error.
func (*UserCreate) SetBio ¶
func (_c *UserCreate) SetBio(v string) *UserCreate
SetBio sets the "bio" field.
func (*UserCreate) SetCreatedAt ¶
func (_c *UserCreate) SetCreatedAt(v time.Time) *UserCreate
SetCreatedAt sets the "created_at" field.
func (*UserCreate) SetExternalID ¶
func (_c *UserCreate) SetExternalID(v uuid.UUID) *UserCreate
SetExternalID sets the "external_id" field.
func (*UserCreate) SetLabels ¶
func (_c *UserCreate) SetLabels(v map[string]interface{}) *UserCreate
SetLabels sets the "labels" field.
func (*UserCreate) SetMetadata ¶
func (_c *UserCreate) SetMetadata(v domain.UserMetadata) *UserCreate
SetMetadata sets the "metadata" field.
func (*UserCreate) SetName ¶
func (_c *UserCreate) SetName(v string) *UserCreate
SetName sets the "name" field.
func (*UserCreate) SetNillableBio ¶
func (_c *UserCreate) SetNillableBio(v *string) *UserCreate
SetNillableBio sets the "bio" field if the given value is not nil.
func (*UserCreate) SetNillableCreatedAt ¶
func (_c *UserCreate) SetNillableCreatedAt(v *time.Time) *UserCreate
SetNillableCreatedAt sets the "created_at" field if the given value is not nil.
func (*UserCreate) SetNillablePinnedPostID ¶
func (_c *UserCreate) SetNillablePinnedPostID(id *int) *UserCreate
SetNillablePinnedPostID sets the "pinned_post" edge to the Post entity by ID if the given value is not nil.
func (*UserCreate) SetNillableScore ¶
func (_c *UserCreate) SetNillableScore(v *int) *UserCreate
SetNillableScore sets the "score" field if the given value is not nil.
func (*UserCreate) SetNillableStatus ¶
func (_c *UserCreate) SetNillableStatus(v *user.Status) *UserCreate
SetNillableStatus sets the "status" field if the given value is not nil.
func (*UserCreate) SetNillableUpdatedAt ¶
func (_c *UserCreate) SetNillableUpdatedAt(v *time.Time) *UserCreate
SetNillableUpdatedAt sets the "updated_at" field if the given value is not nil.
func (*UserCreate) SetPinnedPost ¶
func (_c *UserCreate) SetPinnedPost(v *Post) *UserCreate
SetPinnedPost sets the "pinned_post" edge to the Post entity.
func (*UserCreate) SetPinnedPostID ¶
func (_c *UserCreate) SetPinnedPostID(id int) *UserCreate
SetPinnedPostID sets the "pinned_post" edge to the Post entity by ID.
func (*UserCreate) SetScore ¶
func (_c *UserCreate) SetScore(v int) *UserCreate
SetScore sets the "score" field.
func (*UserCreate) SetSettings ¶
func (_c *UserCreate) SetSettings(v map[string]interface{}) *UserCreate
SetSettings sets the "settings" field.
func (*UserCreate) SetStatus ¶
func (_c *UserCreate) SetStatus(v user.Status) *UserCreate
SetStatus sets the "status" field.
func (*UserCreate) SetTagNames ¶
func (_c *UserCreate) SetTagNames(v []string) *UserCreate
SetTagNames sets the "tag_names" field.
func (*UserCreate) SetUpdatedAt ¶
func (_c *UserCreate) SetUpdatedAt(v time.Time) *UserCreate
SetUpdatedAt sets the "updated_at" field.
func (*UserCreate) SetUsername ¶
func (_c *UserCreate) SetUsername(v string) *UserCreate
SetUsername sets the "username" field.
type UserCreateBulk ¶
type UserCreateBulk struct {
// contains filtered or unexported fields
}
UserCreateBulk is the builder for creating many User entities in bulk.
func (*UserCreateBulk) Exec ¶
func (_c *UserCreateBulk) Exec(ctx context.Context) error
Exec executes the query.
func (*UserCreateBulk) ExecX ¶
func (_c *UserCreateBulk) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*UserCreateBulk) OnConflict ¶
func (_c *UserCreateBulk) OnConflict(opts ...sql.ConflictOption) *UserUpsertBulk
OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause of the `INSERT` statement. For example:
client.User.CreateBulk(builders...).
OnConflict(
// Update the row with the new values
// the was proposed for insertion.
sql.ResolveWithNewValues(),
).
// Override some of the fields with custom
// update values.
Update(func(u *ent.UserUpsert) {
SetName(v+v).
}).
Exec(ctx)
func (*UserCreateBulk) OnConflictColumns ¶
func (_c *UserCreateBulk) OnConflictColumns(columns ...string) *UserUpsertBulk
OnConflictColumns calls `OnConflict` and configures the columns as conflict target. Using this option is equivalent to using:
client.User.Create(). OnConflict(sql.ConflictColumns(columns...)). Exec(ctx)
type UserDelete ¶
type UserDelete struct {
// contains filtered or unexported fields
}
UserDelete is the builder for deleting a User entity.
func (*UserDelete) Exec ¶
func (_d *UserDelete) Exec(ctx context.Context) (int, error)
Exec executes the deletion query and returns how many vertices were deleted.
func (*UserDelete) ExecX ¶
func (_d *UserDelete) ExecX(ctx context.Context) int
ExecX is like Exec, but panics if an error occurs.
func (*UserDelete) Where ¶
func (_d *UserDelete) Where(ps ...predicate.User) *UserDelete
Where appends a list predicates to the UserDelete builder.
type UserDeleteOne ¶
type UserDeleteOne struct {
// contains filtered or unexported fields
}
UserDeleteOne is the builder for deleting a single User entity.
func (*UserDeleteOne) Exec ¶
func (_d *UserDeleteOne) Exec(ctx context.Context) error
Exec executes the deletion query.
func (*UserDeleteOne) ExecX ¶
func (_d *UserDeleteOne) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*UserDeleteOne) Where ¶
func (_d *UserDeleteOne) Where(ps ...predicate.User) *UserDeleteOne
Where appends a list predicates to the UserDelete builder.
type UserDomainField ¶
type UserDomainField = string
UserDomainField is the type for User domain field constants.
const ( UserDomainFieldName UserDomainField = "name" UserDomainFieldBio UserDomainField = "bio" UserDomainFieldStatus UserDomainField = "status" UserDomainFieldCreatedAt UserDomainField = "created_at" UserDomainFieldUsername UserDomainField = "username" UserDomainFieldScore UserDomainField = "score" UserDomainFieldExternalID UserDomainField = "external_id" UserDomainFieldUpdatedAt UserDomainField = "updated_at" UserDomainFieldSettings UserDomainField = "settings" UserDomainFieldLabels UserDomainField = "labels" UserDomainFieldTagNames UserDomainField = "tag_names" UserDomainFieldMetadata UserDomainField = "metadata" UserDomainFieldPostIDs UserDomainField = "post_ids" UserDomainFieldPinnedPostID UserDomainField = "pinned_post_id" UserDomainFieldTagIDs UserDomainField = "tag_ids" )
type UserDomainTransformer ¶
type UserDomainTransformer struct {
GetFullName func(e *User) string
SetFullNameOnCreate func(ctx context.Context, c *UserCreate, d *domain.User, val string) error
SetFullNameOnUpdate func(ctx context.Context, u *UserUpdateOne, d *domain.User, val string) error
GetIsPremium func(e *User) bool
SetIsPremiumOnCreate func(ctx context.Context, c *UserCreate, d *domain.User, val bool) error
SetIsPremiumOnUpdate func(ctx context.Context, u *UserUpdateOne, d *domain.User, val bool) error
GetExpiresAt func(e *User) time.Time
SetExpiresAtOnCreate func(ctx context.Context, c *UserCreate, d *domain.User, val time.Time) error
SetExpiresAtOnUpdate func(ctx context.Context, u *UserUpdateOne, d *domain.User, val time.Time) error
GetSubscriptionDuration func(e *User) time.Duration
SetSubscriptionDurationOnCreate func(ctx context.Context, c *UserCreate, d *domain.User, val time.Duration) error
SetSubscriptionDurationOnUpdate func(ctx context.Context, u *UserUpdateOne, d *domain.User, val time.Duration) error
}
UserDomainTransformer holds optional transformer functions for User → domain mapping.
Get* functions are pure synchronous projections invoked by ToDomain. Set*OnCreate / Set*OnUpdate are invoked during ApplyDomain and may perform I/O (e.g. KMS-backed field encryption); they receive ctx + the full domain struct so they can access sibling fields and propagate cancellation.
var UserTransformer *UserDomainTransformer
UserTransformer is the package-level transformer for User (nil by default).
type UserEdges ¶
type UserEdges struct {
// Posts holds the value of the posts edge.
Posts []*Post `json:"posts,omitempty"`
// PinnedPost holds the value of the pinned_post edge.
PinnedPost *Post `json:"pinned_post,omitempty"`
// Tags holds the value of the tags edge.
Tags []*Tag `json:"tags,omitempty"`
// contains filtered or unexported fields
}
UserEdges holds the relations/edges for other nodes in the graph.
func (UserEdges) PinnedPostOrErr ¶
PinnedPostOrErr returns the PinnedPost value or an error if the edge was not loaded in eager-loading, or loaded but was not found.
func (UserEdges) PostsOrErr ¶
PostsOrErr returns the Posts value or an error if the edge was not loaded in eager-loading.
type UserGroupBy ¶
type UserGroupBy struct {
// contains filtered or unexported fields
}
UserGroupBy is the group-by builder for User entities.
func (*UserGroupBy) Aggregate ¶
func (_g *UserGroupBy) Aggregate(fns ...AggregateFunc) *UserGroupBy
Aggregate adds the given aggregation functions to the group-by query.
func (*UserGroupBy) Bool ¶
Bool returns a single bool from a selector. It is only allowed when selecting one field.
func (*UserGroupBy) Bools ¶
Bools returns list of bools from a selector. It is only allowed when selecting one field.
func (*UserGroupBy) Float64 ¶
Float64 returns a single float64 from a selector. It is only allowed when selecting one field.
func (*UserGroupBy) Float64s ¶
Float64s returns list of float64s from a selector. It is only allowed when selecting one field.
func (*UserGroupBy) Int ¶
Int returns a single int from a selector. It is only allowed when selecting one field.
func (*UserGroupBy) Ints ¶
Ints returns list of ints from a selector. It is only allowed when selecting one field.
func (*UserGroupBy) Scan ¶
func (_g *UserGroupBy) Scan(ctx context.Context, v any) error
Scan applies the selector query and scans the result into the given value.
func (*UserGroupBy) String ¶
String returns a single string from a selector. It is only allowed when selecting one field.
type UserMutation ¶
type UserMutation struct {
// contains filtered or unexported fields
}
UserMutation represents an operation that mutates the User nodes in the graph.
func (*UserMutation) AddField ¶
func (m *UserMutation) 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 (*UserMutation) AddPostIDs ¶
func (m *UserMutation) AddPostIDs(ids ...int)
AddPostIDs adds the "posts" edge to the Post entity by ids.
func (*UserMutation) AddScore ¶
func (m *UserMutation) AddScore(i int)
AddScore adds i to the "score" field.
func (*UserMutation) AddTagIDs ¶
func (m *UserMutation) AddTagIDs(ids ...int)
AddTagIDs adds the "tags" edge to the Tag entity by ids.
func (*UserMutation) AddedEdges ¶
func (m *UserMutation) AddedEdges() []string
AddedEdges returns all edge names that were set/added in this mutation.
func (*UserMutation) AddedField ¶
func (m *UserMutation) 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 (*UserMutation) AddedFields ¶
func (m *UserMutation) AddedFields() []string
AddedFields returns all numeric fields that were incremented/decremented during this mutation.
func (*UserMutation) AddedIDs ¶
func (m *UserMutation) AddedIDs(name string) []ent.Value
AddedIDs returns all IDs (to other nodes) that were added for the given edge name in this mutation.
func (*UserMutation) AddedScore ¶
func (m *UserMutation) AddedScore() (r int, exists bool)
AddedScore returns the value that was added to the "score" field in this mutation.
func (*UserMutation) AppendTagNames ¶
func (m *UserMutation) AppendTagNames(s []string)
AppendTagNames adds s to the "tag_names" field.
func (*UserMutation) AppendedTagNames ¶
func (m *UserMutation) AppendedTagNames() ([]string, bool)
AppendedTagNames returns the list of values that were appended to the "tag_names" field in this mutation.
func (*UserMutation) Bio ¶
func (m *UserMutation) Bio() (r string, exists bool)
Bio returns the value of the "bio" field in the mutation.
func (*UserMutation) BioCleared ¶
func (m *UserMutation) BioCleared() bool
BioCleared returns if the "bio" field was cleared in this mutation.
func (*UserMutation) ClearBio ¶
func (m *UserMutation) ClearBio()
ClearBio clears the value of the "bio" field.
func (*UserMutation) ClearEdge ¶
func (m *UserMutation) 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 (*UserMutation) ClearField ¶
func (m *UserMutation) 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 (*UserMutation) ClearPinnedPost ¶
func (m *UserMutation) ClearPinnedPost()
ClearPinnedPost clears the "pinned_post" edge to the Post entity.
func (*UserMutation) ClearPosts ¶
func (m *UserMutation) ClearPosts()
ClearPosts clears the "posts" edge to the Post entity.
func (*UserMutation) ClearScore ¶
func (m *UserMutation) ClearScore()
ClearScore clears the value of the "score" field.
func (*UserMutation) ClearSettings ¶
func (m *UserMutation) ClearSettings()
ClearSettings clears the value of the "settings" field.
func (*UserMutation) ClearTags ¶
func (m *UserMutation) ClearTags()
ClearTags clears the "tags" edge to the Tag entity.
func (*UserMutation) ClearUpdatedAt ¶
func (m *UserMutation) ClearUpdatedAt()
ClearUpdatedAt clears the value of the "updated_at" field.
func (*UserMutation) ClearedEdges ¶
func (m *UserMutation) ClearedEdges() []string
ClearedEdges returns all edge names that were cleared in this mutation.
func (*UserMutation) ClearedFields ¶
func (m *UserMutation) ClearedFields() []string
ClearedFields returns all nullable fields that were cleared during this mutation.
func (UserMutation) Client ¶
func (m UserMutation) 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 (*UserMutation) CreatedAt ¶
func (m *UserMutation) CreatedAt() (r time.Time, exists bool)
CreatedAt returns the value of the "created_at" field in the mutation.
func (*UserMutation) EdgeCleared ¶
func (m *UserMutation) EdgeCleared(name string) bool
EdgeCleared returns a boolean which indicates if the edge with the given name was cleared in this mutation.
func (*UserMutation) ExternalID ¶
func (m *UserMutation) ExternalID() (r uuid.UUID, exists bool)
ExternalID returns the value of the "external_id" field in the mutation.
func (*UserMutation) Field ¶
func (m *UserMutation) 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 (*UserMutation) FieldCleared ¶
func (m *UserMutation) FieldCleared(name string) bool
FieldCleared returns a boolean indicating if a field with the given name was cleared in this mutation.
func (*UserMutation) Fields ¶
func (m *UserMutation) 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 (*UserMutation) ID ¶
func (m *UserMutation) 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 (*UserMutation) IDs ¶
func (m *UserMutation) 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 (*UserMutation) Labels ¶
func (m *UserMutation) Labels() (r map[string]interface{}, exists bool)
Labels returns the value of the "labels" field in the mutation.
func (*UserMutation) Metadata ¶
func (m *UserMutation) Metadata() (r domain.UserMetadata, exists bool)
Metadata returns the value of the "metadata" field in the mutation.
func (*UserMutation) Name ¶
func (m *UserMutation) Name() (r string, exists bool)
Name returns the value of the "name" field in the mutation.
func (*UserMutation) OldBio ¶
func (m *UserMutation) OldBio(ctx context.Context) (v string, err error)
OldBio returns the old "bio" field's value of the User entity. If the User 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 (*UserMutation) OldCreatedAt ¶
OldCreatedAt returns the old "created_at" field's value of the User entity. If the User 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 (*UserMutation) OldExternalID ¶
OldExternalID returns the old "external_id" field's value of the User entity. If the User 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 (*UserMutation) 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 (*UserMutation) OldLabels ¶
func (m *UserMutation) OldLabels(ctx context.Context) (v map[string]interface{}, err error)
OldLabels returns the old "labels" field's value of the User entity. If the User 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 (*UserMutation) OldMetadata ¶
func (m *UserMutation) OldMetadata(ctx context.Context) (v domain.UserMetadata, err error)
OldMetadata returns the old "metadata" field's value of the User entity. If the User 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 (*UserMutation) OldName ¶
func (m *UserMutation) OldName(ctx context.Context) (v string, err error)
OldName returns the old "name" field's value of the User entity. If the User 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 (*UserMutation) OldScore ¶
func (m *UserMutation) OldScore(ctx context.Context) (v int, err error)
OldScore returns the old "score" field's value of the User entity. If the User 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 (*UserMutation) OldSettings ¶
func (m *UserMutation) OldSettings(ctx context.Context) (v map[string]interface{}, err error)
OldSettings returns the old "settings" field's value of the User entity. If the User 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 (*UserMutation) OldStatus ¶
OldStatus returns the old "status" field's value of the User entity. If the User 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 (*UserMutation) OldTagNames ¶
func (m *UserMutation) OldTagNames(ctx context.Context) (v []string, err error)
OldTagNames returns the old "tag_names" field's value of the User entity. If the User 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 (*UserMutation) OldUpdatedAt ¶
OldUpdatedAt returns the old "updated_at" field's value of the User entity. If the User 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 (*UserMutation) OldUsername ¶
func (m *UserMutation) OldUsername(ctx context.Context) (v string, err error)
OldUsername returns the old "username" field's value of the User entity. If the User 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 (*UserMutation) PinnedPostCleared ¶
func (m *UserMutation) PinnedPostCleared() bool
PinnedPostCleared reports if the "pinned_post" edge to the Post entity was cleared.
func (*UserMutation) PinnedPostID ¶
func (m *UserMutation) PinnedPostID() (id int, exists bool)
PinnedPostID returns the "pinned_post" edge ID in the mutation.
func (*UserMutation) PinnedPostIDs ¶
func (m *UserMutation) PinnedPostIDs() (ids []int)
PinnedPostIDs returns the "pinned_post" edge IDs in the mutation. Note that IDs always returns len(IDs) <= 1 for unique edges, and you should use PinnedPostID instead. It exists only for internal usage by the builders.
func (*UserMutation) PostsCleared ¶
func (m *UserMutation) PostsCleared() bool
PostsCleared reports if the "posts" edge to the Post entity was cleared.
func (*UserMutation) PostsIDs ¶
func (m *UserMutation) PostsIDs() (ids []int)
PostsIDs returns the "posts" edge IDs in the mutation.
func (*UserMutation) RemovePostIDs ¶
func (m *UserMutation) RemovePostIDs(ids ...int)
RemovePostIDs removes the "posts" edge to the Post entity by IDs.
func (*UserMutation) RemoveTagIDs ¶
func (m *UserMutation) RemoveTagIDs(ids ...int)
RemoveTagIDs removes the "tags" edge to the Tag entity by IDs.
func (*UserMutation) RemovedEdges ¶
func (m *UserMutation) RemovedEdges() []string
RemovedEdges returns all edge names that were removed in this mutation.
func (*UserMutation) RemovedIDs ¶
func (m *UserMutation) 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 (*UserMutation) RemovedPostsIDs ¶
func (m *UserMutation) RemovedPostsIDs() (ids []int)
RemovedPosts returns the removed IDs of the "posts" edge to the Post entity.
func (*UserMutation) RemovedTagsIDs ¶
func (m *UserMutation) RemovedTagsIDs() (ids []int)
RemovedTags returns the removed IDs of the "tags" edge to the Tag entity.
func (*UserMutation) ResetBio ¶
func (m *UserMutation) ResetBio()
ResetBio resets all changes to the "bio" field.
func (*UserMutation) ResetCreatedAt ¶
func (m *UserMutation) ResetCreatedAt()
ResetCreatedAt resets all changes to the "created_at" field.
func (*UserMutation) ResetEdge ¶
func (m *UserMutation) 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 (*UserMutation) ResetExternalID ¶
func (m *UserMutation) ResetExternalID()
ResetExternalID resets all changes to the "external_id" field.
func (*UserMutation) ResetField ¶
func (m *UserMutation) 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 (*UserMutation) ResetLabels ¶
func (m *UserMutation) ResetLabels()
ResetLabels resets all changes to the "labels" field.
func (*UserMutation) ResetMetadata ¶
func (m *UserMutation) ResetMetadata()
ResetMetadata resets all changes to the "metadata" field.
func (*UserMutation) ResetName ¶
func (m *UserMutation) ResetName()
ResetName resets all changes to the "name" field.
func (*UserMutation) ResetPinnedPost ¶
func (m *UserMutation) ResetPinnedPost()
ResetPinnedPost resets all changes to the "pinned_post" edge.
func (*UserMutation) ResetPosts ¶
func (m *UserMutation) ResetPosts()
ResetPosts resets all changes to the "posts" edge.
func (*UserMutation) ResetScore ¶
func (m *UserMutation) ResetScore()
ResetScore resets all changes to the "score" field.
func (*UserMutation) ResetSettings ¶
func (m *UserMutation) ResetSettings()
ResetSettings resets all changes to the "settings" field.
func (*UserMutation) ResetStatus ¶
func (m *UserMutation) ResetStatus()
ResetStatus resets all changes to the "status" field.
func (*UserMutation) ResetTagNames ¶
func (m *UserMutation) ResetTagNames()
ResetTagNames resets all changes to the "tag_names" field.
func (*UserMutation) ResetTags ¶
func (m *UserMutation) ResetTags()
ResetTags resets all changes to the "tags" edge.
func (*UserMutation) ResetUpdatedAt ¶
func (m *UserMutation) ResetUpdatedAt()
ResetUpdatedAt resets all changes to the "updated_at" field.
func (*UserMutation) ResetUsername ¶
func (m *UserMutation) ResetUsername()
ResetUsername resets all changes to the "username" field.
func (*UserMutation) Score ¶
func (m *UserMutation) Score() (r int, exists bool)
Score returns the value of the "score" field in the mutation.
func (*UserMutation) ScoreCleared ¶
func (m *UserMutation) ScoreCleared() bool
ScoreCleared returns if the "score" field was cleared in this mutation.
func (*UserMutation) SetCreatedAt ¶
func (m *UserMutation) SetCreatedAt(t time.Time)
SetCreatedAt sets the "created_at" field.
func (*UserMutation) SetExternalID ¶
func (m *UserMutation) SetExternalID(u uuid.UUID)
SetExternalID sets the "external_id" field.
func (*UserMutation) SetField ¶
func (m *UserMutation) 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 (*UserMutation) SetLabels ¶
func (m *UserMutation) SetLabels(value map[string]interface{})
SetLabels sets the "labels" field.
func (*UserMutation) SetMetadata ¶
func (m *UserMutation) SetMetadata(dm domain.UserMetadata)
SetMetadata sets the "metadata" field.
func (*UserMutation) SetName ¶
func (m *UserMutation) SetName(s string)
SetName sets the "name" field.
func (*UserMutation) SetOp ¶
func (m *UserMutation) SetOp(op Op)
SetOp allows setting the mutation operation.
func (*UserMutation) SetPinnedPostID ¶
func (m *UserMutation) SetPinnedPostID(id int)
SetPinnedPostID sets the "pinned_post" edge to the Post entity by id.
func (*UserMutation) SetScore ¶
func (m *UserMutation) SetScore(i int)
SetScore sets the "score" field.
func (*UserMutation) SetSettings ¶
func (m *UserMutation) SetSettings(value map[string]interface{})
SetSettings sets the "settings" field.
func (*UserMutation) SetStatus ¶
func (m *UserMutation) SetStatus(u user.Status)
SetStatus sets the "status" field.
func (*UserMutation) SetTagNames ¶
func (m *UserMutation) SetTagNames(s []string)
SetTagNames sets the "tag_names" field.
func (*UserMutation) SetUpdatedAt ¶
func (m *UserMutation) SetUpdatedAt(t time.Time)
SetUpdatedAt sets the "updated_at" field.
func (*UserMutation) SetUsername ¶
func (m *UserMutation) SetUsername(s string)
SetUsername sets the "username" field.
func (*UserMutation) Settings ¶
func (m *UserMutation) Settings() (r map[string]interface{}, exists bool)
Settings returns the value of the "settings" field in the mutation.
func (*UserMutation) SettingsCleared ¶
func (m *UserMutation) SettingsCleared() bool
SettingsCleared returns if the "settings" field was cleared in this mutation.
func (*UserMutation) Status ¶
func (m *UserMutation) Status() (r user.Status, exists bool)
Status returns the value of the "status" field in the mutation.
func (*UserMutation) TagNames ¶
func (m *UserMutation) TagNames() (r []string, exists bool)
TagNames returns the value of the "tag_names" field in the mutation.
func (*UserMutation) TagsCleared ¶
func (m *UserMutation) TagsCleared() bool
TagsCleared reports if the "tags" edge to the Tag entity was cleared.
func (*UserMutation) TagsIDs ¶
func (m *UserMutation) TagsIDs() (ids []int)
TagsIDs returns the "tags" edge IDs in the mutation.
func (UserMutation) Tx ¶
func (m UserMutation) Tx() (*Tx, error)
Tx returns an `ent.Tx` for mutations that were executed in transactions; it returns an error otherwise.
func (*UserMutation) Type ¶
func (m *UserMutation) Type() string
Type returns the node type of this mutation (User).
func (*UserMutation) UpdatedAt ¶
func (m *UserMutation) UpdatedAt() (r time.Time, exists bool)
UpdatedAt returns the value of the "updated_at" field in the mutation.
func (*UserMutation) UpdatedAtCleared ¶
func (m *UserMutation) UpdatedAtCleared() bool
UpdatedAtCleared returns if the "updated_at" field was cleared in this mutation.
func (*UserMutation) Username ¶
func (m *UserMutation) Username() (r string, exists bool)
Username returns the value of the "username" field in the mutation.
func (*UserMutation) Where ¶
func (m *UserMutation) Where(ps ...predicate.User)
Where appends a list predicates to the UserMutation builder.
func (*UserMutation) WhereP ¶
func (m *UserMutation) WhereP(ps ...func(*sql.Selector))
WhereP appends storage-level predicates to the UserMutation builder. Using this method, users can use type-assertion to append predicates that do not depend on any generated package.
type UserQuery ¶
type UserQuery struct {
// contains filtered or unexported fields
}
UserQuery is the builder for querying User entities.
func (*UserQuery) Aggregate ¶
func (_q *UserQuery) Aggregate(fns ...AggregateFunc) *UserSelect
Aggregate returns a UserSelect configured with the given aggregations.
func (*UserQuery) Clone ¶
Clone returns a duplicate of the UserQuery builder, including all associated steps. It can be used to prepare common query builders and use them differently after the clone is made.
func (*UserQuery) First ¶
First returns the first User entity from the query. Returns a *NotFoundError when no User was found.
func (*UserQuery) FirstID ¶
FirstID returns the first User ID from the query. Returns a *NotFoundError when no User ID was found.
func (*UserQuery) GroupBy ¶
func (_q *UserQuery) GroupBy(field string, fields ...string) *UserGroupBy
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.User.Query().
GroupBy(user.FieldName).
Aggregate(ent.Count()).
Scan(ctx, &v)
func (*UserQuery) Only ¶
Only returns a single User entity found by the query, ensuring it only returns one. Returns a *NotSingularError when more than one User entity is found. Returns a *NotFoundError when no User entities are found.
func (*UserQuery) OnlyID ¶
OnlyID is like Only, but returns the only User ID in the query. Returns a *NotSingularError when more than one User ID is found. Returns a *NotFoundError when no entities are found.
func (*UserQuery) Order ¶
func (_q *UserQuery) Order(o ...user.OrderOption) *UserQuery
Order specifies how the records should be ordered.
func (*UserQuery) QueryPinnedPost ¶
QueryPinnedPost chains the current query on the "pinned_post" edge.
func (*UserQuery) QueryPosts ¶
QueryPosts chains the current query on the "posts" edge.
func (*UserQuery) Select ¶
func (_q *UserQuery) Select(fields ...string) *UserSelect
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.User.Query().
Select(user.FieldName).
Scan(ctx, &v)
func (*UserQuery) Unique ¶
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 (*UserQuery) WithPinnedPost ¶
WithPinnedPost tells the query-builder to eager-load the nodes that are connected to the "pinned_post" edge. The optional arguments are used to configure the query builder of the edge.
type UserSelect ¶
type UserSelect struct {
*UserQuery
// contains filtered or unexported fields
}
UserSelect is the builder for selecting fields of User entities.
func (*UserSelect) Aggregate ¶
func (_s *UserSelect) Aggregate(fns ...AggregateFunc) *UserSelect
Aggregate adds the given aggregation functions to the selector query.
func (*UserSelect) Bool ¶
Bool returns a single bool from a selector. It is only allowed when selecting one field.
func (*UserSelect) Bools ¶
Bools returns list of bools from a selector. It is only allowed when selecting one field.
func (*UserSelect) Float64 ¶
Float64 returns a single float64 from a selector. It is only allowed when selecting one field.
func (*UserSelect) Float64s ¶
Float64s returns list of float64s from a selector. It is only allowed when selecting one field.
func (*UserSelect) Int ¶
Int returns a single int from a selector. It is only allowed when selecting one field.
func (*UserSelect) Ints ¶
Ints returns list of ints from a selector. It is only allowed when selecting one field.
func (*UserSelect) Scan ¶
func (_s *UserSelect) Scan(ctx context.Context, v any) error
Scan applies the selector query and scans the result into the given value.
func (*UserSelect) String ¶
String returns a single string from a selector. It is only allowed when selecting one field.
type UserUpdate ¶
type UserUpdate struct {
// contains filtered or unexported fields
}
UserUpdate is the builder for updating User entities.
func (*UserUpdate) AddPostIDs ¶
func (_u *UserUpdate) AddPostIDs(ids ...int) *UserUpdate
AddPostIDs adds the "posts" edge to the Post entity by IDs.
func (*UserUpdate) AddPosts ¶
func (_u *UserUpdate) AddPosts(v ...*Post) *UserUpdate
AddPosts adds the "posts" edges to the Post entity.
func (*UserUpdate) AddScore ¶
func (_u *UserUpdate) AddScore(v int) *UserUpdate
AddScore adds value to the "score" field.
func (*UserUpdate) AddTagIDs ¶
func (_u *UserUpdate) AddTagIDs(ids ...int) *UserUpdate
AddTagIDs adds the "tags" edge to the Tag entity by IDs.
func (*UserUpdate) AddTags ¶
func (_u *UserUpdate) AddTags(v ...*Tag) *UserUpdate
AddTags adds the "tags" edges to the Tag entity.
func (*UserUpdate) AppendTagNames ¶
func (_u *UserUpdate) AppendTagNames(v []string) *UserUpdate
AppendTagNames appends value to the "tag_names" field.
func (*UserUpdate) ApplyDomain ¶
func (u *UserUpdate) ApplyDomain(ctx context.Context, d *domain.User, opts ...entdomain.ApplyOption) (*UserUpdate, error)
ApplyDomain applies domain.User fields to the UserUpdate builder. Chain .Where(...) conditions to target specific records.
Note: ctx is accepted for API symmetry with ApplyDomainCreate/UpdateOne and to allow future ctx-aware field transformers. Currently no transformer hooks fire here — the error return is always nil.
func (*UserUpdate) ApplyDomainX ¶
func (u *UserUpdate) ApplyDomainX(ctx context.Context, d *domain.User, opts ...entdomain.ApplyOption) *UserUpdate
ApplyDomainX is the panicking variant of ApplyDomain. See *UserCreate.ApplyDomainX.
func (*UserUpdate) ClearBio ¶
func (_u *UserUpdate) ClearBio() *UserUpdate
ClearBio clears the value of the "bio" field.
func (*UserUpdate) ClearPinnedPost ¶
func (_u *UserUpdate) ClearPinnedPost() *UserUpdate
ClearPinnedPost clears the "pinned_post" edge to the Post entity.
func (*UserUpdate) ClearPosts ¶
func (_u *UserUpdate) ClearPosts() *UserUpdate
ClearPosts clears all "posts" edges to the Post entity.
func (*UserUpdate) ClearScore ¶
func (_u *UserUpdate) ClearScore() *UserUpdate
ClearScore clears the value of the "score" field.
func (*UserUpdate) ClearSettings ¶
func (_u *UserUpdate) ClearSettings() *UserUpdate
ClearSettings clears the value of the "settings" field.
func (*UserUpdate) ClearTags ¶
func (_u *UserUpdate) ClearTags() *UserUpdate
ClearTags clears all "tags" edges to the Tag entity.
func (*UserUpdate) ClearUpdatedAt ¶
func (_u *UserUpdate) ClearUpdatedAt() *UserUpdate
ClearUpdatedAt clears the value of the "updated_at" field.
func (*UserUpdate) Exec ¶
func (_u *UserUpdate) Exec(ctx context.Context) error
Exec executes the query.
func (*UserUpdate) ExecX ¶
func (_u *UserUpdate) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*UserUpdate) Mutation ¶
func (_u *UserUpdate) Mutation() *UserMutation
Mutation returns the UserMutation object of the builder.
func (*UserUpdate) RemovePostIDs ¶
func (_u *UserUpdate) RemovePostIDs(ids ...int) *UserUpdate
RemovePostIDs removes the "posts" edge to Post entities by IDs.
func (*UserUpdate) RemovePosts ¶
func (_u *UserUpdate) RemovePosts(v ...*Post) *UserUpdate
RemovePosts removes "posts" edges to Post entities.
func (*UserUpdate) RemoveTagIDs ¶
func (_u *UserUpdate) RemoveTagIDs(ids ...int) *UserUpdate
RemoveTagIDs removes the "tags" edge to Tag entities by IDs.
func (*UserUpdate) RemoveTags ¶
func (_u *UserUpdate) RemoveTags(v ...*Tag) *UserUpdate
RemoveTags removes "tags" edges to Tag entities.
func (*UserUpdate) Save ¶
func (_u *UserUpdate) Save(ctx context.Context) (int, error)
Save executes the query and returns the number of nodes affected by the update operation.
func (*UserUpdate) SaveX ¶
func (_u *UserUpdate) SaveX(ctx context.Context) int
SaveX is like Save, but panics if an error occurs.
func (*UserUpdate) SetBio ¶
func (_u *UserUpdate) SetBio(v string) *UserUpdate
SetBio sets the "bio" field.
func (*UserUpdate) SetExternalID ¶
func (_u *UserUpdate) SetExternalID(v uuid.UUID) *UserUpdate
SetExternalID sets the "external_id" field.
func (*UserUpdate) SetLabels ¶
func (_u *UserUpdate) SetLabels(v map[string]interface{}) *UserUpdate
SetLabels sets the "labels" field.
func (*UserUpdate) SetMetadata ¶
func (_u *UserUpdate) SetMetadata(v domain.UserMetadata) *UserUpdate
SetMetadata sets the "metadata" field.
func (*UserUpdate) SetName ¶
func (_u *UserUpdate) SetName(v string) *UserUpdate
SetName sets the "name" field.
func (*UserUpdate) SetNillableBio ¶
func (_u *UserUpdate) SetNillableBio(v *string) *UserUpdate
SetNillableBio sets the "bio" field if the given value is not nil.
func (*UserUpdate) SetNillableExternalID ¶
func (_u *UserUpdate) SetNillableExternalID(v *uuid.UUID) *UserUpdate
SetNillableExternalID sets the "external_id" field if the given value is not nil.
func (*UserUpdate) SetNillableMetadata ¶
func (_u *UserUpdate) SetNillableMetadata(v *domain.UserMetadata) *UserUpdate
SetNillableMetadata sets the "metadata" field if the given value is not nil.
func (*UserUpdate) SetNillableName ¶
func (_u *UserUpdate) SetNillableName(v *string) *UserUpdate
SetNillableName sets the "name" field if the given value is not nil.
func (*UserUpdate) SetNillablePinnedPostID ¶
func (_u *UserUpdate) SetNillablePinnedPostID(id *int) *UserUpdate
SetNillablePinnedPostID sets the "pinned_post" edge to the Post entity by ID if the given value is not nil.
func (*UserUpdate) SetNillableScore ¶
func (_u *UserUpdate) SetNillableScore(v *int) *UserUpdate
SetNillableScore sets the "score" field if the given value is not nil.
func (*UserUpdate) SetNillableStatus ¶
func (_u *UserUpdate) SetNillableStatus(v *user.Status) *UserUpdate
SetNillableStatus sets the "status" field if the given value is not nil.
func (*UserUpdate) SetNillableUpdatedAt ¶
func (_u *UserUpdate) SetNillableUpdatedAt(v *time.Time) *UserUpdate
SetNillableUpdatedAt sets the "updated_at" field if the given value is not nil.
func (*UserUpdate) SetPinnedPost ¶
func (_u *UserUpdate) SetPinnedPost(v *Post) *UserUpdate
SetPinnedPost sets the "pinned_post" edge to the Post entity.
func (*UserUpdate) SetPinnedPostID ¶
func (_u *UserUpdate) SetPinnedPostID(id int) *UserUpdate
SetPinnedPostID sets the "pinned_post" edge to the Post entity by ID.
func (*UserUpdate) SetScore ¶
func (_u *UserUpdate) SetScore(v int) *UserUpdate
SetScore sets the "score" field.
func (*UserUpdate) SetSettings ¶
func (_u *UserUpdate) SetSettings(v map[string]interface{}) *UserUpdate
SetSettings sets the "settings" field.
func (*UserUpdate) SetStatus ¶
func (_u *UserUpdate) SetStatus(v user.Status) *UserUpdate
SetStatus sets the "status" field.
func (*UserUpdate) SetTagNames ¶
func (_u *UserUpdate) SetTagNames(v []string) *UserUpdate
SetTagNames sets the "tag_names" field.
func (*UserUpdate) SetUpdatedAt ¶
func (_u *UserUpdate) SetUpdatedAt(v time.Time) *UserUpdate
SetUpdatedAt sets the "updated_at" field.
func (*UserUpdate) Where ¶
func (_u *UserUpdate) Where(ps ...predicate.User) *UserUpdate
Where appends a list predicates to the UserUpdate builder.
type UserUpdateOne ¶
type UserUpdateOne struct {
// contains filtered or unexported fields
}
UserUpdateOne is the builder for updating a single User entity.
func (*UserUpdateOne) AddPostIDs ¶
func (_u *UserUpdateOne) AddPostIDs(ids ...int) *UserUpdateOne
AddPostIDs adds the "posts" edge to the Post entity by IDs.
func (*UserUpdateOne) AddPosts ¶
func (_u *UserUpdateOne) AddPosts(v ...*Post) *UserUpdateOne
AddPosts adds the "posts" edges to the Post entity.
func (*UserUpdateOne) AddScore ¶
func (_u *UserUpdateOne) AddScore(v int) *UserUpdateOne
AddScore adds value to the "score" field.
func (*UserUpdateOne) AddTagIDs ¶
func (_u *UserUpdateOne) AddTagIDs(ids ...int) *UserUpdateOne
AddTagIDs adds the "tags" edge to the Tag entity by IDs.
func (*UserUpdateOne) AddTags ¶
func (_u *UserUpdateOne) AddTags(v ...*Tag) *UserUpdateOne
AddTags adds the "tags" edges to the Tag entity.
func (*UserUpdateOne) AppendTagNames ¶
func (_u *UserUpdateOne) AppendTagNames(v []string) *UserUpdateOne
AppendTagNames appends value to the "tag_names" field.
func (*UserUpdateOne) ApplyDomain ¶
func (u *UserUpdateOne) ApplyDomain(ctx context.Context, d *domain.User, opts ...entdomain.ApplyOption) (*UserUpdateOne, error)
ApplyDomain applies domain.User fields to the UserUpdateOne builder.
func (*UserUpdateOne) ApplyDomainX ¶
func (u *UserUpdateOne) ApplyDomainX(ctx context.Context, d *domain.User, opts ...entdomain.ApplyOption) *UserUpdateOne
ApplyDomainX is the panicking variant of ApplyDomain. See *UserCreate.ApplyDomainX.
func (*UserUpdateOne) ClearBio ¶
func (_u *UserUpdateOne) ClearBio() *UserUpdateOne
ClearBio clears the value of the "bio" field.
func (*UserUpdateOne) ClearPinnedPost ¶
func (_u *UserUpdateOne) ClearPinnedPost() *UserUpdateOne
ClearPinnedPost clears the "pinned_post" edge to the Post entity.
func (*UserUpdateOne) ClearPosts ¶
func (_u *UserUpdateOne) ClearPosts() *UserUpdateOne
ClearPosts clears all "posts" edges to the Post entity.
func (*UserUpdateOne) ClearScore ¶
func (_u *UserUpdateOne) ClearScore() *UserUpdateOne
ClearScore clears the value of the "score" field.
func (*UserUpdateOne) ClearSettings ¶
func (_u *UserUpdateOne) ClearSettings() *UserUpdateOne
ClearSettings clears the value of the "settings" field.
func (*UserUpdateOne) ClearTags ¶
func (_u *UserUpdateOne) ClearTags() *UserUpdateOne
ClearTags clears all "tags" edges to the Tag entity.
func (*UserUpdateOne) ClearUpdatedAt ¶
func (_u *UserUpdateOne) ClearUpdatedAt() *UserUpdateOne
ClearUpdatedAt clears the value of the "updated_at" field.
func (*UserUpdateOne) Exec ¶
func (_u *UserUpdateOne) Exec(ctx context.Context) error
Exec executes the query on the entity.
func (*UserUpdateOne) ExecX ¶
func (_u *UserUpdateOne) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*UserUpdateOne) Mutation ¶
func (_u *UserUpdateOne) Mutation() *UserMutation
Mutation returns the UserMutation object of the builder.
func (*UserUpdateOne) RemovePostIDs ¶
func (_u *UserUpdateOne) RemovePostIDs(ids ...int) *UserUpdateOne
RemovePostIDs removes the "posts" edge to Post entities by IDs.
func (*UserUpdateOne) RemovePosts ¶
func (_u *UserUpdateOne) RemovePosts(v ...*Post) *UserUpdateOne
RemovePosts removes "posts" edges to Post entities.
func (*UserUpdateOne) RemoveTagIDs ¶
func (_u *UserUpdateOne) RemoveTagIDs(ids ...int) *UserUpdateOne
RemoveTagIDs removes the "tags" edge to Tag entities by IDs.
func (*UserUpdateOne) RemoveTags ¶
func (_u *UserUpdateOne) RemoveTags(v ...*Tag) *UserUpdateOne
RemoveTags removes "tags" edges to Tag entities.
func (*UserUpdateOne) Save ¶
func (_u *UserUpdateOne) Save(ctx context.Context) (*User, error)
Save executes the query and returns the updated User entity.
func (*UserUpdateOne) SaveX ¶
func (_u *UserUpdateOne) SaveX(ctx context.Context) *User
SaveX is like Save, but panics if an error occurs.
func (*UserUpdateOne) Select ¶
func (_u *UserUpdateOne) Select(field string, fields ...string) *UserUpdateOne
Select allows selecting one or more fields (columns) of the returned entity. The default is selecting all fields defined in the entity schema.
func (*UserUpdateOne) SetBio ¶
func (_u *UserUpdateOne) SetBio(v string) *UserUpdateOne
SetBio sets the "bio" field.
func (*UserUpdateOne) SetExternalID ¶
func (_u *UserUpdateOne) SetExternalID(v uuid.UUID) *UserUpdateOne
SetExternalID sets the "external_id" field.
func (*UserUpdateOne) SetLabels ¶
func (_u *UserUpdateOne) SetLabels(v map[string]interface{}) *UserUpdateOne
SetLabels sets the "labels" field.
func (*UserUpdateOne) SetMetadata ¶
func (_u *UserUpdateOne) SetMetadata(v domain.UserMetadata) *UserUpdateOne
SetMetadata sets the "metadata" field.
func (*UserUpdateOne) SetName ¶
func (_u *UserUpdateOne) SetName(v string) *UserUpdateOne
SetName sets the "name" field.
func (*UserUpdateOne) SetNillableBio ¶
func (_u *UserUpdateOne) SetNillableBio(v *string) *UserUpdateOne
SetNillableBio sets the "bio" field if the given value is not nil.
func (*UserUpdateOne) SetNillableExternalID ¶
func (_u *UserUpdateOne) SetNillableExternalID(v *uuid.UUID) *UserUpdateOne
SetNillableExternalID sets the "external_id" field if the given value is not nil.
func (*UserUpdateOne) SetNillableMetadata ¶
func (_u *UserUpdateOne) SetNillableMetadata(v *domain.UserMetadata) *UserUpdateOne
SetNillableMetadata sets the "metadata" field if the given value is not nil.
func (*UserUpdateOne) SetNillableName ¶
func (_u *UserUpdateOne) SetNillableName(v *string) *UserUpdateOne
SetNillableName sets the "name" field if the given value is not nil.
func (*UserUpdateOne) SetNillablePinnedPostID ¶
func (_u *UserUpdateOne) SetNillablePinnedPostID(id *int) *UserUpdateOne
SetNillablePinnedPostID sets the "pinned_post" edge to the Post entity by ID if the given value is not nil.
func (*UserUpdateOne) SetNillableScore ¶
func (_u *UserUpdateOne) SetNillableScore(v *int) *UserUpdateOne
SetNillableScore sets the "score" field if the given value is not nil.
func (*UserUpdateOne) SetNillableStatus ¶
func (_u *UserUpdateOne) SetNillableStatus(v *user.Status) *UserUpdateOne
SetNillableStatus sets the "status" field if the given value is not nil.
func (*UserUpdateOne) SetNillableUpdatedAt ¶
func (_u *UserUpdateOne) SetNillableUpdatedAt(v *time.Time) *UserUpdateOne
SetNillableUpdatedAt sets the "updated_at" field if the given value is not nil.
func (*UserUpdateOne) SetPinnedPost ¶
func (_u *UserUpdateOne) SetPinnedPost(v *Post) *UserUpdateOne
SetPinnedPost sets the "pinned_post" edge to the Post entity.
func (*UserUpdateOne) SetPinnedPostID ¶
func (_u *UserUpdateOne) SetPinnedPostID(id int) *UserUpdateOne
SetPinnedPostID sets the "pinned_post" edge to the Post entity by ID.
func (*UserUpdateOne) SetScore ¶
func (_u *UserUpdateOne) SetScore(v int) *UserUpdateOne
SetScore sets the "score" field.
func (*UserUpdateOne) SetSettings ¶
func (_u *UserUpdateOne) SetSettings(v map[string]interface{}) *UserUpdateOne
SetSettings sets the "settings" field.
func (*UserUpdateOne) SetStatus ¶
func (_u *UserUpdateOne) SetStatus(v user.Status) *UserUpdateOne
SetStatus sets the "status" field.
func (*UserUpdateOne) SetTagNames ¶
func (_u *UserUpdateOne) SetTagNames(v []string) *UserUpdateOne
SetTagNames sets the "tag_names" field.
func (*UserUpdateOne) SetUpdatedAt ¶
func (_u *UserUpdateOne) SetUpdatedAt(v time.Time) *UserUpdateOne
SetUpdatedAt sets the "updated_at" field.
func (*UserUpdateOne) Where ¶
func (_u *UserUpdateOne) Where(ps ...predicate.User) *UserUpdateOne
Where appends a list predicates to the UserUpdate builder.
type UserUpdateOneBulk ¶
type UserUpdateOneBulk struct {
// contains filtered or unexported fields
}
UserUpdateOneBulk holds a set of UserUpdateOne builders.
func (*UserUpdateOneBulk) Exec ¶
func (b *UserUpdateOneBulk) Exec(ctx context.Context) error
Exec executes all builders without returning the updated entities.
func (*UserUpdateOneBulk) ExecX ¶
func (b *UserUpdateOneBulk) ExecX(ctx context.Context)
ExecX is like Exec but panics on error.
type UserUpsert ¶
UserUpsert is the "OnConflict" setter.
func (*UserUpsert) AddScore ¶
func (u *UserUpsert) AddScore(v int) *UserUpsert
AddScore adds v to the "score" field.
func (*UserUpsert) ClearBio ¶
func (u *UserUpsert) ClearBio() *UserUpsert
ClearBio clears the value of the "bio" field.
func (*UserUpsert) ClearScore ¶
func (u *UserUpsert) ClearScore() *UserUpsert
ClearScore clears the value of the "score" field.
func (*UserUpsert) ClearSettings ¶
func (u *UserUpsert) ClearSettings() *UserUpsert
ClearSettings clears the value of the "settings" field.
func (*UserUpsert) ClearUpdatedAt ¶
func (u *UserUpsert) ClearUpdatedAt() *UserUpsert
ClearUpdatedAt clears the value of the "updated_at" field.
func (*UserUpsert) SetBio ¶
func (u *UserUpsert) SetBio(v string) *UserUpsert
SetBio sets the "bio" field.
func (*UserUpsert) SetExternalID ¶
func (u *UserUpsert) SetExternalID(v uuid.UUID) *UserUpsert
SetExternalID sets the "external_id" field.
func (*UserUpsert) SetLabels ¶
func (u *UserUpsert) SetLabels(v map[string]interface{}) *UserUpsert
SetLabels sets the "labels" field.
func (*UserUpsert) SetMetadata ¶
func (u *UserUpsert) SetMetadata(v domain.UserMetadata) *UserUpsert
SetMetadata sets the "metadata" field.
func (*UserUpsert) SetName ¶
func (u *UserUpsert) SetName(v string) *UserUpsert
SetName sets the "name" field.
func (*UserUpsert) SetScore ¶
func (u *UserUpsert) SetScore(v int) *UserUpsert
SetScore sets the "score" field.
func (*UserUpsert) SetSettings ¶
func (u *UserUpsert) SetSettings(v map[string]interface{}) *UserUpsert
SetSettings sets the "settings" field.
func (*UserUpsert) SetStatus ¶
func (u *UserUpsert) SetStatus(v user.Status) *UserUpsert
SetStatus sets the "status" field.
func (*UserUpsert) SetTagNames ¶
func (u *UserUpsert) SetTagNames(v []string) *UserUpsert
SetTagNames sets the "tag_names" field.
func (*UserUpsert) SetUpdatedAt ¶
func (u *UserUpsert) SetUpdatedAt(v time.Time) *UserUpsert
SetUpdatedAt sets the "updated_at" field.
func (*UserUpsert) UpdateBio ¶
func (u *UserUpsert) UpdateBio() *UserUpsert
UpdateBio sets the "bio" field to the value that was provided on create.
func (*UserUpsert) UpdateExternalID ¶
func (u *UserUpsert) UpdateExternalID() *UserUpsert
UpdateExternalID sets the "external_id" field to the value that was provided on create.
func (*UserUpsert) UpdateLabels ¶
func (u *UserUpsert) UpdateLabels() *UserUpsert
UpdateLabels sets the "labels" field to the value that was provided on create.
func (*UserUpsert) UpdateMetadata ¶
func (u *UserUpsert) UpdateMetadata() *UserUpsert
UpdateMetadata sets the "metadata" field to the value that was provided on create.
func (*UserUpsert) UpdateName ¶
func (u *UserUpsert) UpdateName() *UserUpsert
UpdateName sets the "name" field to the value that was provided on create.
func (*UserUpsert) UpdateScore ¶
func (u *UserUpsert) UpdateScore() *UserUpsert
UpdateScore sets the "score" field to the value that was provided on create.
func (*UserUpsert) UpdateSettings ¶
func (u *UserUpsert) UpdateSettings() *UserUpsert
UpdateSettings sets the "settings" field to the value that was provided on create.
func (*UserUpsert) UpdateStatus ¶
func (u *UserUpsert) UpdateStatus() *UserUpsert
UpdateStatus sets the "status" field to the value that was provided on create.
func (*UserUpsert) UpdateTagNames ¶
func (u *UserUpsert) UpdateTagNames() *UserUpsert
UpdateTagNames sets the "tag_names" field to the value that was provided on create.
func (*UserUpsert) UpdateUpdatedAt ¶
func (u *UserUpsert) UpdateUpdatedAt() *UserUpsert
UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create.
type UserUpsertBulk ¶
type UserUpsertBulk struct {
// contains filtered or unexported fields
}
UserUpsertBulk is the builder for "upsert"-ing a bulk of User nodes.
func (*UserUpsertBulk) AddScore ¶
func (u *UserUpsertBulk) AddScore(v int) *UserUpsertBulk
AddScore adds v to the "score" field.
func (*UserUpsertBulk) ApplyDomain ¶
func (u *UserUpsertBulk) ApplyDomain(ctx context.Context, d *domain.User, opts ...entdomain.ApplyOption) (*UserUpsertBulk, error)
ApplyDomain applies domain.User fields to the UserUpsertBulk builder on conflict.
Note: ctx is accepted for API symmetry. Transformer hooks do not fire on upsert conflict paths; the error return is always nil.
func (*UserUpsertBulk) ApplyDomainX ¶
func (u *UserUpsertBulk) ApplyDomainX(ctx context.Context, d *domain.User, opts ...entdomain.ApplyOption) *UserUpsertBulk
ApplyDomainX is the panicking variant of ApplyDomain. See *UserCreate.ApplyDomainX.
func (*UserUpsertBulk) ClearBio ¶
func (u *UserUpsertBulk) ClearBio() *UserUpsertBulk
ClearBio clears the value of the "bio" field.
func (*UserUpsertBulk) ClearScore ¶
func (u *UserUpsertBulk) ClearScore() *UserUpsertBulk
ClearScore clears the value of the "score" field.
func (*UserUpsertBulk) ClearSettings ¶
func (u *UserUpsertBulk) ClearSettings() *UserUpsertBulk
ClearSettings clears the value of the "settings" field.
func (*UserUpsertBulk) ClearUpdatedAt ¶
func (u *UserUpsertBulk) ClearUpdatedAt() *UserUpsertBulk
ClearUpdatedAt clears the value of the "updated_at" field.
func (*UserUpsertBulk) DoNothing ¶
func (u *UserUpsertBulk) DoNothing() *UserUpsertBulk
DoNothing configures the conflict_action to `DO NOTHING`. Supported only by SQLite and PostgreSQL.
func (*UserUpsertBulk) Exec ¶
func (u *UserUpsertBulk) Exec(ctx context.Context) error
Exec executes the query.
func (*UserUpsertBulk) ExecX ¶
func (u *UserUpsertBulk) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*UserUpsertBulk) Ignore ¶
func (u *UserUpsertBulk) Ignore() *UserUpsertBulk
Ignore sets each column to itself in case of conflict. Using this option is equivalent to using:
client.User.Create(). OnConflict(sql.ResolveWithIgnore()). Exec(ctx)
func (*UserUpsertBulk) SetBio ¶
func (u *UserUpsertBulk) SetBio(v string) *UserUpsertBulk
SetBio sets the "bio" field.
func (*UserUpsertBulk) SetExternalID ¶
func (u *UserUpsertBulk) SetExternalID(v uuid.UUID) *UserUpsertBulk
SetExternalID sets the "external_id" field.
func (*UserUpsertBulk) SetLabels ¶
func (u *UserUpsertBulk) SetLabels(v map[string]interface{}) *UserUpsertBulk
SetLabels sets the "labels" field.
func (*UserUpsertBulk) SetMetadata ¶
func (u *UserUpsertBulk) SetMetadata(v domain.UserMetadata) *UserUpsertBulk
SetMetadata sets the "metadata" field.
func (*UserUpsertBulk) SetName ¶
func (u *UserUpsertBulk) SetName(v string) *UserUpsertBulk
SetName sets the "name" field.
func (*UserUpsertBulk) SetScore ¶
func (u *UserUpsertBulk) SetScore(v int) *UserUpsertBulk
SetScore sets the "score" field.
func (*UserUpsertBulk) SetSettings ¶
func (u *UserUpsertBulk) SetSettings(v map[string]interface{}) *UserUpsertBulk
SetSettings sets the "settings" field.
func (*UserUpsertBulk) SetStatus ¶
func (u *UserUpsertBulk) SetStatus(v user.Status) *UserUpsertBulk
SetStatus sets the "status" field.
func (*UserUpsertBulk) SetTagNames ¶
func (u *UserUpsertBulk) SetTagNames(v []string) *UserUpsertBulk
SetTagNames sets the "tag_names" field.
func (*UserUpsertBulk) SetUpdatedAt ¶
func (u *UserUpsertBulk) SetUpdatedAt(v time.Time) *UserUpsertBulk
SetUpdatedAt sets the "updated_at" field.
func (*UserUpsertBulk) Update ¶
func (u *UserUpsertBulk) Update(set func(*UserUpsert)) *UserUpsertBulk
Update allows overriding fields `UPDATE` values. See the UserCreateBulk.OnConflict documentation for more info.
func (*UserUpsertBulk) UpdateBio ¶
func (u *UserUpsertBulk) UpdateBio() *UserUpsertBulk
UpdateBio sets the "bio" field to the value that was provided on create.
func (*UserUpsertBulk) UpdateExternalID ¶
func (u *UserUpsertBulk) UpdateExternalID() *UserUpsertBulk
UpdateExternalID sets the "external_id" field to the value that was provided on create.
func (*UserUpsertBulk) UpdateLabels ¶
func (u *UserUpsertBulk) UpdateLabels() *UserUpsertBulk
UpdateLabels sets the "labels" field to the value that was provided on create.
func (*UserUpsertBulk) UpdateMetadata ¶
func (u *UserUpsertBulk) UpdateMetadata() *UserUpsertBulk
UpdateMetadata sets the "metadata" field to the value that was provided on create.
func (*UserUpsertBulk) UpdateName ¶
func (u *UserUpsertBulk) UpdateName() *UserUpsertBulk
UpdateName sets the "name" field to the value that was provided on create.
func (*UserUpsertBulk) UpdateNewValues ¶
func (u *UserUpsertBulk) UpdateNewValues() *UserUpsertBulk
UpdateNewValues updates the mutable fields using the new values that were set on create. Using this option is equivalent to using:
client.User.Create(). OnConflict( sql.ResolveWithNewValues(), ). Exec(ctx)
func (*UserUpsertBulk) UpdateScore ¶
func (u *UserUpsertBulk) UpdateScore() *UserUpsertBulk
UpdateScore sets the "score" field to the value that was provided on create.
func (*UserUpsertBulk) UpdateSettings ¶
func (u *UserUpsertBulk) UpdateSettings() *UserUpsertBulk
UpdateSettings sets the "settings" field to the value that was provided on create.
func (*UserUpsertBulk) UpdateStatus ¶
func (u *UserUpsertBulk) UpdateStatus() *UserUpsertBulk
UpdateStatus sets the "status" field to the value that was provided on create.
func (*UserUpsertBulk) UpdateTagNames ¶
func (u *UserUpsertBulk) UpdateTagNames() *UserUpsertBulk
UpdateTagNames sets the "tag_names" field to the value that was provided on create.
func (*UserUpsertBulk) UpdateUpdatedAt ¶
func (u *UserUpsertBulk) UpdateUpdatedAt() *UserUpsertBulk
UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create.
type UserUpsertOne ¶
type UserUpsertOne struct {
// contains filtered or unexported fields
}
UserUpsertOne is the builder for "upsert"-ing
one User node.
func (*UserUpsertOne) AddScore ¶
func (u *UserUpsertOne) AddScore(v int) *UserUpsertOne
AddScore adds v to the "score" field.
func (*UserUpsertOne) ApplyDomain ¶
func (u *UserUpsertOne) ApplyDomain(ctx context.Context, d *domain.User, opts ...entdomain.ApplyOption) (*UserUpsertOne, error)
ApplyDomain applies domain.User fields to the UserUpsertOne builder on conflict.
Note: ctx is accepted for API symmetry. Transformer hooks do not fire on upsert conflict paths; the error return is always nil.
func (*UserUpsertOne) ApplyDomainX ¶
func (u *UserUpsertOne) ApplyDomainX(ctx context.Context, d *domain.User, opts ...entdomain.ApplyOption) *UserUpsertOne
ApplyDomainX is the panicking variant of ApplyDomain. See *UserCreate.ApplyDomainX.
func (*UserUpsertOne) ClearBio ¶
func (u *UserUpsertOne) ClearBio() *UserUpsertOne
ClearBio clears the value of the "bio" field.
func (*UserUpsertOne) ClearScore ¶
func (u *UserUpsertOne) ClearScore() *UserUpsertOne
ClearScore clears the value of the "score" field.
func (*UserUpsertOne) ClearSettings ¶
func (u *UserUpsertOne) ClearSettings() *UserUpsertOne
ClearSettings clears the value of the "settings" field.
func (*UserUpsertOne) ClearUpdatedAt ¶
func (u *UserUpsertOne) ClearUpdatedAt() *UserUpsertOne
ClearUpdatedAt clears the value of the "updated_at" field.
func (*UserUpsertOne) DoNothing ¶
func (u *UserUpsertOne) DoNothing() *UserUpsertOne
DoNothing configures the conflict_action to `DO NOTHING`. Supported only by SQLite and PostgreSQL.
func (*UserUpsertOne) Exec ¶
func (u *UserUpsertOne) Exec(ctx context.Context) error
Exec executes the query.
func (*UserUpsertOne) ExecX ¶
func (u *UserUpsertOne) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*UserUpsertOne) ID ¶
func (u *UserUpsertOne) ID(ctx context.Context) (id int, err error)
Exec executes the UPSERT query and returns the inserted/updated ID.
func (*UserUpsertOne) IDX ¶
func (u *UserUpsertOne) IDX(ctx context.Context) int
IDX is like ID, but panics if an error occurs.
func (*UserUpsertOne) Ignore ¶
func (u *UserUpsertOne) Ignore() *UserUpsertOne
Ignore sets each column to itself in case of conflict. Using this option is equivalent to using:
client.User.Create().
OnConflict(sql.ResolveWithIgnore()).
Exec(ctx)
func (*UserUpsertOne) SetBio ¶
func (u *UserUpsertOne) SetBio(v string) *UserUpsertOne
SetBio sets the "bio" field.
func (*UserUpsertOne) SetExternalID ¶
func (u *UserUpsertOne) SetExternalID(v uuid.UUID) *UserUpsertOne
SetExternalID sets the "external_id" field.
func (*UserUpsertOne) SetLabels ¶
func (u *UserUpsertOne) SetLabels(v map[string]interface{}) *UserUpsertOne
SetLabels sets the "labels" field.
func (*UserUpsertOne) SetMetadata ¶
func (u *UserUpsertOne) SetMetadata(v domain.UserMetadata) *UserUpsertOne
SetMetadata sets the "metadata" field.
func (*UserUpsertOne) SetName ¶
func (u *UserUpsertOne) SetName(v string) *UserUpsertOne
SetName sets the "name" field.
func (*UserUpsertOne) SetScore ¶
func (u *UserUpsertOne) SetScore(v int) *UserUpsertOne
SetScore sets the "score" field.
func (*UserUpsertOne) SetSettings ¶
func (u *UserUpsertOne) SetSettings(v map[string]interface{}) *UserUpsertOne
SetSettings sets the "settings" field.
func (*UserUpsertOne) SetStatus ¶
func (u *UserUpsertOne) SetStatus(v user.Status) *UserUpsertOne
SetStatus sets the "status" field.
func (*UserUpsertOne) SetTagNames ¶
func (u *UserUpsertOne) SetTagNames(v []string) *UserUpsertOne
SetTagNames sets the "tag_names" field.
func (*UserUpsertOne) SetUpdatedAt ¶
func (u *UserUpsertOne) SetUpdatedAt(v time.Time) *UserUpsertOne
SetUpdatedAt sets the "updated_at" field.
func (*UserUpsertOne) Update ¶
func (u *UserUpsertOne) Update(set func(*UserUpsert)) *UserUpsertOne
Update allows overriding fields `UPDATE` values. See the UserCreate.OnConflict documentation for more info.
func (*UserUpsertOne) UpdateBio ¶
func (u *UserUpsertOne) UpdateBio() *UserUpsertOne
UpdateBio sets the "bio" field to the value that was provided on create.
func (*UserUpsertOne) UpdateExternalID ¶
func (u *UserUpsertOne) UpdateExternalID() *UserUpsertOne
UpdateExternalID sets the "external_id" field to the value that was provided on create.
func (*UserUpsertOne) UpdateLabels ¶
func (u *UserUpsertOne) UpdateLabels() *UserUpsertOne
UpdateLabels sets the "labels" field to the value that was provided on create.
func (*UserUpsertOne) UpdateMetadata ¶
func (u *UserUpsertOne) UpdateMetadata() *UserUpsertOne
UpdateMetadata sets the "metadata" field to the value that was provided on create.
func (*UserUpsertOne) UpdateName ¶
func (u *UserUpsertOne) UpdateName() *UserUpsertOne
UpdateName sets the "name" field to the value that was provided on create.
func (*UserUpsertOne) UpdateNewValues ¶
func (u *UserUpsertOne) UpdateNewValues() *UserUpsertOne
UpdateNewValues updates the mutable fields using the new values that were set on create. Using this option is equivalent to using:
client.User.Create(). OnConflict( sql.ResolveWithNewValues(), ). Exec(ctx)
func (*UserUpsertOne) UpdateScore ¶
func (u *UserUpsertOne) UpdateScore() *UserUpsertOne
UpdateScore sets the "score" field to the value that was provided on create.
func (*UserUpsertOne) UpdateSettings ¶
func (u *UserUpsertOne) UpdateSettings() *UserUpsertOne
UpdateSettings sets the "settings" field to the value that was provided on create.
func (*UserUpsertOne) UpdateStatus ¶
func (u *UserUpsertOne) UpdateStatus() *UserUpsertOne
UpdateStatus sets the "status" field to the value that was provided on create.
func (*UserUpsertOne) UpdateTagNames ¶
func (u *UserUpsertOne) UpdateTagNames() *UserUpsertOne
UpdateTagNames sets the "tag_names" field to the value that was provided on create.
func (*UserUpsertOne) UpdateUpdatedAt ¶
func (u *UserUpsertOne) UpdateUpdatedAt() *UserUpsertOne
UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create.
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.