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
- type AggregateFunc
- type Article
- type ArticleClient
- func (c *ArticleClient) Create() *ArticleCreate
- func (c *ArticleClient) CreateBulk(builders ...*ArticleCreate) *ArticleCreateBulk
- func (c *ArticleClient) Delete() *ArticleDelete
- func (c *ArticleClient) DeleteOne(a *Article) *ArticleDeleteOne
- func (c *ArticleClient) DeleteOneID(id int64) *ArticleDeleteOne
- func (c *ArticleClient) Get(ctx context.Context, id int64) (*Article, error)
- func (c *ArticleClient) GetX(ctx context.Context, id int64) *Article
- func (c *ArticleClient) Hooks() []Hook
- func (c *ArticleClient) Intercept(interceptors ...Interceptor)
- func (c *ArticleClient) Interceptors() []Interceptor
- func (c *ArticleClient) MapCreateBulk(slice any, setFunc func(*ArticleCreate, int)) *ArticleCreateBulk
- func (c *ArticleClient) Query() *ArticleQuery
- func (c *ArticleClient) QueryComments(a *Article) *CommentQuery
- func (c *ArticleClient) QueryTags(a *Article) *TagQuery
- func (c *ArticleClient) Update() *ArticleUpdate
- func (c *ArticleClient) UpdateOne(a *Article) *ArticleUpdateOne
- func (c *ArticleClient) UpdateOneID(id int64) *ArticleUpdateOne
- func (c *ArticleClient) Use(hooks ...Hook)
- type ArticleCreate
- func (ac *ArticleCreate) AddCommentIDs(ids ...int64) *ArticleCreate
- func (ac *ArticleCreate) AddComments(c ...*Comment) *ArticleCreate
- func (ac *ArticleCreate) AddTagIDs(ids ...int64) *ArticleCreate
- func (ac *ArticleCreate) AddTags(t ...*Tag) *ArticleCreate
- func (ac *ArticleCreate) Exec(ctx context.Context) error
- func (ac *ArticleCreate) ExecX(ctx context.Context)
- func (ac *ArticleCreate) Mutation() *ArticleMutation
- func (ac *ArticleCreate) Save(ctx context.Context) (*Article, error)
- func (ac *ArticleCreate) SaveX(ctx context.Context) *Article
- func (ac *ArticleCreate) SetContent(s string) *ArticleCreate
- func (ac *ArticleCreate) SetCreatedAt(t time.Time) *ArticleCreate
- func (ac *ArticleCreate) SetID(i int64) *ArticleCreate
- func (ac *ArticleCreate) SetNillableCreatedAt(t *time.Time) *ArticleCreate
- func (ac *ArticleCreate) SetNillableUpdatedAt(t *time.Time) *ArticleCreate
- func (ac *ArticleCreate) SetTitle(s string) *ArticleCreate
- func (ac *ArticleCreate) SetUpdatedAt(t time.Time) *ArticleCreate
- type ArticleCreateBulk
- type ArticleDelete
- type ArticleDeleteOne
- type ArticleEdges
- type ArticleGroupBy
- func (agb *ArticleGroupBy) Aggregate(fns ...AggregateFunc) *ArticleGroupBy
- func (s *ArticleGroupBy) Bool(ctx context.Context) (_ bool, err error)
- func (s *ArticleGroupBy) BoolX(ctx context.Context) bool
- func (s *ArticleGroupBy) Bools(ctx context.Context) ([]bool, error)
- func (s *ArticleGroupBy) BoolsX(ctx context.Context) []bool
- func (s *ArticleGroupBy) Float64(ctx context.Context) (_ float64, err error)
- func (s *ArticleGroupBy) Float64X(ctx context.Context) float64
- func (s *ArticleGroupBy) Float64s(ctx context.Context) ([]float64, error)
- func (s *ArticleGroupBy) Float64sX(ctx context.Context) []float64
- func (s *ArticleGroupBy) Int(ctx context.Context) (_ int, err error)
- func (s *ArticleGroupBy) IntX(ctx context.Context) int
- func (s *ArticleGroupBy) Ints(ctx context.Context) ([]int, error)
- func (s *ArticleGroupBy) IntsX(ctx context.Context) []int
- func (agb *ArticleGroupBy) Scan(ctx context.Context, v any) error
- func (s *ArticleGroupBy) ScanX(ctx context.Context, v any)
- func (s *ArticleGroupBy) String(ctx context.Context) (_ string, err error)
- func (s *ArticleGroupBy) StringX(ctx context.Context) string
- func (s *ArticleGroupBy) Strings(ctx context.Context) ([]string, error)
- func (s *ArticleGroupBy) StringsX(ctx context.Context) []string
- type ArticleMutation
- func (m *ArticleMutation) AddCommentIDs(ids ...int64)
- func (m *ArticleMutation) AddField(name string, value ent.Value) error
- func (m *ArticleMutation) AddTagIDs(ids ...int64)
- func (m *ArticleMutation) AddedEdges() []string
- func (m *ArticleMutation) AddedField(name string) (ent.Value, bool)
- func (m *ArticleMutation) AddedFields() []string
- func (m *ArticleMutation) AddedIDs(name string) []ent.Value
- func (m *ArticleMutation) ClearComments()
- func (m *ArticleMutation) ClearEdge(name string) error
- func (m *ArticleMutation) ClearField(name string) error
- func (m *ArticleMutation) ClearTags()
- func (m *ArticleMutation) ClearedEdges() []string
- func (m *ArticleMutation) ClearedFields() []string
- func (m ArticleMutation) Client() *Client
- func (m *ArticleMutation) CommentsCleared() bool
- func (m *ArticleMutation) CommentsIDs() (ids []int64)
- func (m *ArticleMutation) Content() (r string, exists bool)
- func (m *ArticleMutation) CreatedAt() (r time.Time, exists bool)
- func (m *ArticleMutation) EdgeCleared(name string) bool
- func (m *ArticleMutation) Field(name string) (ent.Value, bool)
- func (m *ArticleMutation) FieldCleared(name string) bool
- func (m *ArticleMutation) Fields() []string
- func (m *ArticleMutation) ID() (id int64, exists bool)
- func (m *ArticleMutation) IDs(ctx context.Context) ([]int64, error)
- func (m *ArticleMutation) OldContent(ctx context.Context) (v string, err error)
- func (m *ArticleMutation) OldCreatedAt(ctx context.Context) (v time.Time, err error)
- func (m *ArticleMutation) OldField(ctx context.Context, name string) (ent.Value, error)
- func (m *ArticleMutation) OldTitle(ctx context.Context) (v string, err error)
- func (m *ArticleMutation) OldUpdatedAt(ctx context.Context) (v time.Time, err error)
- func (m *ArticleMutation) Op() Op
- func (m *ArticleMutation) RemoveCommentIDs(ids ...int64)
- func (m *ArticleMutation) RemoveTagIDs(ids ...int64)
- func (m *ArticleMutation) RemovedCommentsIDs() (ids []int64)
- func (m *ArticleMutation) RemovedEdges() []string
- func (m *ArticleMutation) RemovedIDs(name string) []ent.Value
- func (m *ArticleMutation) RemovedTagsIDs() (ids []int64)
- func (m *ArticleMutation) ResetComments()
- func (m *ArticleMutation) ResetContent()
- func (m *ArticleMutation) ResetCreatedAt()
- func (m *ArticleMutation) ResetEdge(name string) error
- func (m *ArticleMutation) ResetField(name string) error
- func (m *ArticleMutation) ResetTags()
- func (m *ArticleMutation) ResetTitle()
- func (m *ArticleMutation) ResetUpdatedAt()
- func (m *ArticleMutation) SetContent(s string)
- func (m *ArticleMutation) SetCreatedAt(t time.Time)
- func (m *ArticleMutation) SetField(name string, value ent.Value) error
- func (m *ArticleMutation) SetID(id int64)
- func (m *ArticleMutation) SetOp(op Op)
- func (m *ArticleMutation) SetTitle(s string)
- func (m *ArticleMutation) SetUpdatedAt(t time.Time)
- func (m *ArticleMutation) TagsCleared() bool
- func (m *ArticleMutation) TagsIDs() (ids []int64)
- func (m *ArticleMutation) Title() (r string, exists bool)
- func (m ArticleMutation) Tx() (*Tx, error)
- func (m *ArticleMutation) Type() string
- func (m *ArticleMutation) UpdatedAt() (r time.Time, exists bool)
- func (m *ArticleMutation) Where(ps ...predicate.Article)
- func (m *ArticleMutation) WhereP(ps ...func(*sql.Selector))
- type ArticleQuery
- func (aq *ArticleQuery) Aggregate(fns ...AggregateFunc) *ArticleSelect
- func (aq *ArticleQuery) All(ctx context.Context) ([]*Article, error)
- func (aq *ArticleQuery) AllX(ctx context.Context) []*Article
- func (aq *ArticleQuery) Clone() *ArticleQuery
- func (aq *ArticleQuery) Count(ctx context.Context) (int, error)
- func (aq *ArticleQuery) CountX(ctx context.Context) int
- func (aq *ArticleQuery) Exist(ctx context.Context) (bool, error)
- func (aq *ArticleQuery) ExistX(ctx context.Context) bool
- func (aq *ArticleQuery) First(ctx context.Context) (*Article, error)
- func (aq *ArticleQuery) FirstID(ctx context.Context) (id int64, err error)
- func (aq *ArticleQuery) FirstIDX(ctx context.Context) int64
- func (aq *ArticleQuery) FirstX(ctx context.Context) *Article
- func (aq *ArticleQuery) GroupBy(field string, fields ...string) *ArticleGroupBy
- func (aq *ArticleQuery) IDs(ctx context.Context) (ids []int64, err error)
- func (aq *ArticleQuery) IDsX(ctx context.Context) []int64
- func (aq *ArticleQuery) Limit(limit int) *ArticleQuery
- func (aq *ArticleQuery) Offset(offset int) *ArticleQuery
- func (aq *ArticleQuery) Only(ctx context.Context) (*Article, error)
- func (aq *ArticleQuery) OnlyID(ctx context.Context) (id int64, err error)
- func (aq *ArticleQuery) OnlyIDX(ctx context.Context) int64
- func (aq *ArticleQuery) OnlyX(ctx context.Context) *Article
- func (aq *ArticleQuery) Order(o ...article.OrderOption) *ArticleQuery
- func (aq *ArticleQuery) QueryComments() *CommentQuery
- func (aq *ArticleQuery) QueryTags() *TagQuery
- func (aq *ArticleQuery) Select(fields ...string) *ArticleSelect
- func (aq *ArticleQuery) Unique(unique bool) *ArticleQuery
- func (aq *ArticleQuery) Where(ps ...predicate.Article) *ArticleQuery
- func (aq *ArticleQuery) WithComments(opts ...func(*CommentQuery)) *ArticleQuery
- func (aq *ArticleQuery) WithTags(opts ...func(*TagQuery)) *ArticleQuery
- type ArticleSelect
- func (as *ArticleSelect) Aggregate(fns ...AggregateFunc) *ArticleSelect
- func (s *ArticleSelect) Bool(ctx context.Context) (_ bool, err error)
- func (s *ArticleSelect) BoolX(ctx context.Context) bool
- func (s *ArticleSelect) Bools(ctx context.Context) ([]bool, error)
- func (s *ArticleSelect) BoolsX(ctx context.Context) []bool
- func (s *ArticleSelect) Float64(ctx context.Context) (_ float64, err error)
- func (s *ArticleSelect) Float64X(ctx context.Context) float64
- func (s *ArticleSelect) Float64s(ctx context.Context) ([]float64, error)
- func (s *ArticleSelect) Float64sX(ctx context.Context) []float64
- func (s *ArticleSelect) Int(ctx context.Context) (_ int, err error)
- func (s *ArticleSelect) IntX(ctx context.Context) int
- func (s *ArticleSelect) Ints(ctx context.Context) ([]int, error)
- func (s *ArticleSelect) IntsX(ctx context.Context) []int
- func (as *ArticleSelect) Scan(ctx context.Context, v any) error
- func (s *ArticleSelect) ScanX(ctx context.Context, v any)
- func (s *ArticleSelect) String(ctx context.Context) (_ string, err error)
- func (s *ArticleSelect) StringX(ctx context.Context) string
- func (s *ArticleSelect) Strings(ctx context.Context) ([]string, error)
- func (s *ArticleSelect) StringsX(ctx context.Context) []string
- type ArticleUpdate
- func (au *ArticleUpdate) AddCommentIDs(ids ...int64) *ArticleUpdate
- func (au *ArticleUpdate) AddComments(c ...*Comment) *ArticleUpdate
- func (au *ArticleUpdate) AddTagIDs(ids ...int64) *ArticleUpdate
- func (au *ArticleUpdate) AddTags(t ...*Tag) *ArticleUpdate
- func (au *ArticleUpdate) ClearComments() *ArticleUpdate
- func (au *ArticleUpdate) ClearTags() *ArticleUpdate
- func (au *ArticleUpdate) Exec(ctx context.Context) error
- func (au *ArticleUpdate) ExecX(ctx context.Context)
- func (au *ArticleUpdate) Mutation() *ArticleMutation
- func (au *ArticleUpdate) RemoveCommentIDs(ids ...int64) *ArticleUpdate
- func (au *ArticleUpdate) RemoveComments(c ...*Comment) *ArticleUpdate
- func (au *ArticleUpdate) RemoveTagIDs(ids ...int64) *ArticleUpdate
- func (au *ArticleUpdate) RemoveTags(t ...*Tag) *ArticleUpdate
- func (au *ArticleUpdate) Save(ctx context.Context) (int, error)
- func (au *ArticleUpdate) SaveX(ctx context.Context) int
- func (au *ArticleUpdate) SetContent(s string) *ArticleUpdate
- func (au *ArticleUpdate) SetCreatedAt(t time.Time) *ArticleUpdate
- func (au *ArticleUpdate) SetNillableContent(s *string) *ArticleUpdate
- func (au *ArticleUpdate) SetNillableCreatedAt(t *time.Time) *ArticleUpdate
- func (au *ArticleUpdate) SetNillableTitle(s *string) *ArticleUpdate
- func (au *ArticleUpdate) SetNillableUpdatedAt(t *time.Time) *ArticleUpdate
- func (au *ArticleUpdate) SetTitle(s string) *ArticleUpdate
- func (au *ArticleUpdate) SetUpdatedAt(t time.Time) *ArticleUpdate
- func (au *ArticleUpdate) Where(ps ...predicate.Article) *ArticleUpdate
- type ArticleUpdateOne
- func (auo *ArticleUpdateOne) AddCommentIDs(ids ...int64) *ArticleUpdateOne
- func (auo *ArticleUpdateOne) AddComments(c ...*Comment) *ArticleUpdateOne
- func (auo *ArticleUpdateOne) AddTagIDs(ids ...int64) *ArticleUpdateOne
- func (auo *ArticleUpdateOne) AddTags(t ...*Tag) *ArticleUpdateOne
- func (auo *ArticleUpdateOne) ClearComments() *ArticleUpdateOne
- func (auo *ArticleUpdateOne) ClearTags() *ArticleUpdateOne
- func (auo *ArticleUpdateOne) Exec(ctx context.Context) error
- func (auo *ArticleUpdateOne) ExecX(ctx context.Context)
- func (auo *ArticleUpdateOne) Mutation() *ArticleMutation
- func (auo *ArticleUpdateOne) RemoveCommentIDs(ids ...int64) *ArticleUpdateOne
- func (auo *ArticleUpdateOne) RemoveComments(c ...*Comment) *ArticleUpdateOne
- func (auo *ArticleUpdateOne) RemoveTagIDs(ids ...int64) *ArticleUpdateOne
- func (auo *ArticleUpdateOne) RemoveTags(t ...*Tag) *ArticleUpdateOne
- func (auo *ArticleUpdateOne) Save(ctx context.Context) (*Article, error)
- func (auo *ArticleUpdateOne) SaveX(ctx context.Context) *Article
- func (auo *ArticleUpdateOne) Select(field string, fields ...string) *ArticleUpdateOne
- func (auo *ArticleUpdateOne) SetContent(s string) *ArticleUpdateOne
- func (auo *ArticleUpdateOne) SetCreatedAt(t time.Time) *ArticleUpdateOne
- func (auo *ArticleUpdateOne) SetNillableContent(s *string) *ArticleUpdateOne
- func (auo *ArticleUpdateOne) SetNillableCreatedAt(t *time.Time) *ArticleUpdateOne
- func (auo *ArticleUpdateOne) SetNillableTitle(s *string) *ArticleUpdateOne
- func (auo *ArticleUpdateOne) SetNillableUpdatedAt(t *time.Time) *ArticleUpdateOne
- func (auo *ArticleUpdateOne) SetTitle(s string) *ArticleUpdateOne
- func (auo *ArticleUpdateOne) SetUpdatedAt(t time.Time) *ArticleUpdateOne
- func (auo *ArticleUpdateOne) Where(ps ...predicate.Article) *ArticleUpdateOne
- type Articles
- 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 Comment
- type CommentClient
- func (c *CommentClient) Create() *CommentCreate
- func (c *CommentClient) CreateBulk(builders ...*CommentCreate) *CommentCreateBulk
- func (c *CommentClient) Delete() *CommentDelete
- func (c *CommentClient) DeleteOne(co *Comment) *CommentDeleteOne
- func (c *CommentClient) DeleteOneID(id int64) *CommentDeleteOne
- func (c *CommentClient) Get(ctx context.Context, id int64) (*Comment, error)
- func (c *CommentClient) GetX(ctx context.Context, id int64) *Comment
- func (c *CommentClient) Hooks() []Hook
- func (c *CommentClient) Intercept(interceptors ...Interceptor)
- func (c *CommentClient) Interceptors() []Interceptor
- func (c *CommentClient) MapCreateBulk(slice any, setFunc func(*CommentCreate, int)) *CommentCreateBulk
- func (c *CommentClient) Query() *CommentQuery
- func (c *CommentClient) QueryPost(co *Comment) *ArticleQuery
- func (c *CommentClient) Update() *CommentUpdate
- func (c *CommentClient) UpdateOne(co *Comment) *CommentUpdateOne
- func (c *CommentClient) UpdateOneID(id int64) *CommentUpdateOne
- func (c *CommentClient) Use(hooks ...Hook)
- type CommentCreate
- func (cc *CommentCreate) Exec(ctx context.Context) error
- func (cc *CommentCreate) ExecX(ctx context.Context)
- func (cc *CommentCreate) Mutation() *CommentMutation
- func (cc *CommentCreate) Save(ctx context.Context) (*Comment, error)
- func (cc *CommentCreate) SaveX(ctx context.Context) *Comment
- func (cc *CommentCreate) SetContent(s string) *CommentCreate
- func (cc *CommentCreate) SetCreatedAt(t time.Time) *CommentCreate
- func (cc *CommentCreate) SetID(i int64) *CommentCreate
- func (cc *CommentCreate) SetName(s string) *CommentCreate
- func (cc *CommentCreate) SetNillableCreatedAt(t *time.Time) *CommentCreate
- func (cc *CommentCreate) SetNillablePostID(id *int64) *CommentCreate
- func (cc *CommentCreate) SetNillableUpdatedAt(t *time.Time) *CommentCreate
- func (cc *CommentCreate) SetPost(a *Article) *CommentCreate
- func (cc *CommentCreate) SetPostID(id int64) *CommentCreate
- func (cc *CommentCreate) SetUpdatedAt(t time.Time) *CommentCreate
- type CommentCreateBulk
- type CommentDelete
- type CommentDeleteOne
- type CommentEdges
- type CommentGroupBy
- func (cgb *CommentGroupBy) Aggregate(fns ...AggregateFunc) *CommentGroupBy
- func (s *CommentGroupBy) Bool(ctx context.Context) (_ bool, err error)
- func (s *CommentGroupBy) BoolX(ctx context.Context) bool
- func (s *CommentGroupBy) Bools(ctx context.Context) ([]bool, error)
- func (s *CommentGroupBy) BoolsX(ctx context.Context) []bool
- func (s *CommentGroupBy) Float64(ctx context.Context) (_ float64, err error)
- func (s *CommentGroupBy) Float64X(ctx context.Context) float64
- func (s *CommentGroupBy) Float64s(ctx context.Context) ([]float64, error)
- func (s *CommentGroupBy) Float64sX(ctx context.Context) []float64
- func (s *CommentGroupBy) Int(ctx context.Context) (_ int, err error)
- func (s *CommentGroupBy) IntX(ctx context.Context) int
- func (s *CommentGroupBy) Ints(ctx context.Context) ([]int, error)
- func (s *CommentGroupBy) IntsX(ctx context.Context) []int
- func (cgb *CommentGroupBy) Scan(ctx context.Context, v any) error
- func (s *CommentGroupBy) ScanX(ctx context.Context, v any)
- func (s *CommentGroupBy) String(ctx context.Context) (_ string, err error)
- func (s *CommentGroupBy) StringX(ctx context.Context) string
- func (s *CommentGroupBy) Strings(ctx context.Context) ([]string, error)
- func (s *CommentGroupBy) StringsX(ctx context.Context) []string
- type CommentMutation
- func (m *CommentMutation) AddField(name string, value ent.Value) error
- func (m *CommentMutation) AddedEdges() []string
- func (m *CommentMutation) AddedField(name string) (ent.Value, bool)
- func (m *CommentMutation) AddedFields() []string
- func (m *CommentMutation) AddedIDs(name string) []ent.Value
- func (m *CommentMutation) ClearEdge(name string) error
- func (m *CommentMutation) ClearField(name string) error
- func (m *CommentMutation) ClearPost()
- func (m *CommentMutation) ClearedEdges() []string
- func (m *CommentMutation) ClearedFields() []string
- func (m CommentMutation) Client() *Client
- func (m *CommentMutation) Content() (r string, exists bool)
- func (m *CommentMutation) CreatedAt() (r time.Time, exists bool)
- func (m *CommentMutation) EdgeCleared(name string) bool
- func (m *CommentMutation) Field(name string) (ent.Value, bool)
- func (m *CommentMutation) FieldCleared(name string) bool
- func (m *CommentMutation) Fields() []string
- func (m *CommentMutation) ID() (id int64, exists bool)
- func (m *CommentMutation) IDs(ctx context.Context) ([]int64, error)
- func (m *CommentMutation) Name() (r string, exists bool)
- func (m *CommentMutation) OldContent(ctx context.Context) (v string, err error)
- func (m *CommentMutation) OldCreatedAt(ctx context.Context) (v time.Time, err error)
- func (m *CommentMutation) OldField(ctx context.Context, name string) (ent.Value, error)
- func (m *CommentMutation) OldName(ctx context.Context) (v string, err error)
- func (m *CommentMutation) OldUpdatedAt(ctx context.Context) (v time.Time, err error)
- func (m *CommentMutation) Op() Op
- func (m *CommentMutation) PostCleared() bool
- func (m *CommentMutation) PostID() (id int64, exists bool)
- func (m *CommentMutation) PostIDs() (ids []int64)
- func (m *CommentMutation) RemovedEdges() []string
- func (m *CommentMutation) RemovedIDs(name string) []ent.Value
- func (m *CommentMutation) ResetContent()
- func (m *CommentMutation) ResetCreatedAt()
- func (m *CommentMutation) ResetEdge(name string) error
- func (m *CommentMutation) ResetField(name string) error
- func (m *CommentMutation) ResetName()
- func (m *CommentMutation) ResetPost()
- func (m *CommentMutation) ResetUpdatedAt()
- func (m *CommentMutation) SetContent(s string)
- func (m *CommentMutation) SetCreatedAt(t time.Time)
- func (m *CommentMutation) SetField(name string, value ent.Value) error
- func (m *CommentMutation) SetID(id int64)
- func (m *CommentMutation) SetName(s string)
- func (m *CommentMutation) SetOp(op Op)
- func (m *CommentMutation) SetPostID(id int64)
- func (m *CommentMutation) SetUpdatedAt(t time.Time)
- func (m CommentMutation) Tx() (*Tx, error)
- func (m *CommentMutation) Type() string
- func (m *CommentMutation) UpdatedAt() (r time.Time, exists bool)
- func (m *CommentMutation) Where(ps ...predicate.Comment)
- func (m *CommentMutation) WhereP(ps ...func(*sql.Selector))
- type CommentQuery
- func (cq *CommentQuery) Aggregate(fns ...AggregateFunc) *CommentSelect
- func (cq *CommentQuery) All(ctx context.Context) ([]*Comment, error)
- func (cq *CommentQuery) AllX(ctx context.Context) []*Comment
- func (cq *CommentQuery) Clone() *CommentQuery
- func (cq *CommentQuery) Count(ctx context.Context) (int, error)
- func (cq *CommentQuery) CountX(ctx context.Context) int
- func (cq *CommentQuery) Exist(ctx context.Context) (bool, error)
- func (cq *CommentQuery) ExistX(ctx context.Context) bool
- func (cq *CommentQuery) First(ctx context.Context) (*Comment, error)
- func (cq *CommentQuery) FirstID(ctx context.Context) (id int64, err error)
- func (cq *CommentQuery) FirstIDX(ctx context.Context) int64
- func (cq *CommentQuery) FirstX(ctx context.Context) *Comment
- func (cq *CommentQuery) GroupBy(field string, fields ...string) *CommentGroupBy
- func (cq *CommentQuery) IDs(ctx context.Context) (ids []int64, err error)
- func (cq *CommentQuery) IDsX(ctx context.Context) []int64
- func (cq *CommentQuery) Limit(limit int) *CommentQuery
- func (cq *CommentQuery) Offset(offset int) *CommentQuery
- func (cq *CommentQuery) Only(ctx context.Context) (*Comment, error)
- func (cq *CommentQuery) OnlyID(ctx context.Context) (id int64, err error)
- func (cq *CommentQuery) OnlyIDX(ctx context.Context) int64
- func (cq *CommentQuery) OnlyX(ctx context.Context) *Comment
- func (cq *CommentQuery) Order(o ...comment.OrderOption) *CommentQuery
- func (cq *CommentQuery) QueryPost() *ArticleQuery
- func (cq *CommentQuery) Select(fields ...string) *CommentSelect
- func (cq *CommentQuery) Unique(unique bool) *CommentQuery
- func (cq *CommentQuery) Where(ps ...predicate.Comment) *CommentQuery
- func (cq *CommentQuery) WithPost(opts ...func(*ArticleQuery)) *CommentQuery
- type CommentSelect
- func (cs *CommentSelect) Aggregate(fns ...AggregateFunc) *CommentSelect
- func (s *CommentSelect) Bool(ctx context.Context) (_ bool, err error)
- func (s *CommentSelect) BoolX(ctx context.Context) bool
- func (s *CommentSelect) Bools(ctx context.Context) ([]bool, error)
- func (s *CommentSelect) BoolsX(ctx context.Context) []bool
- func (s *CommentSelect) Float64(ctx context.Context) (_ float64, err error)
- func (s *CommentSelect) Float64X(ctx context.Context) float64
- func (s *CommentSelect) Float64s(ctx context.Context) ([]float64, error)
- func (s *CommentSelect) Float64sX(ctx context.Context) []float64
- func (s *CommentSelect) Int(ctx context.Context) (_ int, err error)
- func (s *CommentSelect) IntX(ctx context.Context) int
- func (s *CommentSelect) Ints(ctx context.Context) ([]int, error)
- func (s *CommentSelect) IntsX(ctx context.Context) []int
- func (cs *CommentSelect) Scan(ctx context.Context, v any) error
- func (s *CommentSelect) ScanX(ctx context.Context, v any)
- func (s *CommentSelect) String(ctx context.Context) (_ string, err error)
- func (s *CommentSelect) StringX(ctx context.Context) string
- func (s *CommentSelect) Strings(ctx context.Context) ([]string, error)
- func (s *CommentSelect) StringsX(ctx context.Context) []string
- type CommentUpdate
- func (cu *CommentUpdate) ClearPost() *CommentUpdate
- func (cu *CommentUpdate) Exec(ctx context.Context) error
- func (cu *CommentUpdate) ExecX(ctx context.Context)
- func (cu *CommentUpdate) Mutation() *CommentMutation
- func (cu *CommentUpdate) Save(ctx context.Context) (int, error)
- func (cu *CommentUpdate) SaveX(ctx context.Context) int
- func (cu *CommentUpdate) SetContent(s string) *CommentUpdate
- func (cu *CommentUpdate) SetCreatedAt(t time.Time) *CommentUpdate
- func (cu *CommentUpdate) SetName(s string) *CommentUpdate
- func (cu *CommentUpdate) SetNillableContent(s *string) *CommentUpdate
- func (cu *CommentUpdate) SetNillableCreatedAt(t *time.Time) *CommentUpdate
- func (cu *CommentUpdate) SetNillableName(s *string) *CommentUpdate
- func (cu *CommentUpdate) SetNillablePostID(id *int64) *CommentUpdate
- func (cu *CommentUpdate) SetNillableUpdatedAt(t *time.Time) *CommentUpdate
- func (cu *CommentUpdate) SetPost(a *Article) *CommentUpdate
- func (cu *CommentUpdate) SetPostID(id int64) *CommentUpdate
- func (cu *CommentUpdate) SetUpdatedAt(t time.Time) *CommentUpdate
- func (cu *CommentUpdate) Where(ps ...predicate.Comment) *CommentUpdate
- type CommentUpdateOne
- func (cuo *CommentUpdateOne) ClearPost() *CommentUpdateOne
- func (cuo *CommentUpdateOne) Exec(ctx context.Context) error
- func (cuo *CommentUpdateOne) ExecX(ctx context.Context)
- func (cuo *CommentUpdateOne) Mutation() *CommentMutation
- func (cuo *CommentUpdateOne) Save(ctx context.Context) (*Comment, error)
- func (cuo *CommentUpdateOne) SaveX(ctx context.Context) *Comment
- func (cuo *CommentUpdateOne) Select(field string, fields ...string) *CommentUpdateOne
- func (cuo *CommentUpdateOne) SetContent(s string) *CommentUpdateOne
- func (cuo *CommentUpdateOne) SetCreatedAt(t time.Time) *CommentUpdateOne
- func (cuo *CommentUpdateOne) SetName(s string) *CommentUpdateOne
- func (cuo *CommentUpdateOne) SetNillableContent(s *string) *CommentUpdateOne
- func (cuo *CommentUpdateOne) SetNillableCreatedAt(t *time.Time) *CommentUpdateOne
- func (cuo *CommentUpdateOne) SetNillableName(s *string) *CommentUpdateOne
- func (cuo *CommentUpdateOne) SetNillablePostID(id *int64) *CommentUpdateOne
- func (cuo *CommentUpdateOne) SetNillableUpdatedAt(t *time.Time) *CommentUpdateOne
- func (cuo *CommentUpdateOne) SetPost(a *Article) *CommentUpdateOne
- func (cuo *CommentUpdateOne) SetPostID(id int64) *CommentUpdateOne
- func (cuo *CommentUpdateOne) SetUpdatedAt(t time.Time) *CommentUpdateOne
- func (cuo *CommentUpdateOne) Where(ps ...predicate.Comment) *CommentUpdateOne
- type Comments
- 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 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) Delete() *TagDelete
- func (c *TagClient) DeleteOne(t *Tag) *TagDeleteOne
- func (c *TagClient) DeleteOneID(id int64) *TagDeleteOne
- func (c *TagClient) Get(ctx context.Context, id int64) (*Tag, error)
- func (c *TagClient) GetX(ctx context.Context, id int64) *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) QueryPosts(t *Tag) *ArticleQuery
- func (c *TagClient) Update() *TagUpdate
- func (c *TagClient) UpdateOne(t *Tag) *TagUpdateOne
- func (c *TagClient) UpdateOneID(id int64) *TagUpdateOne
- func (c *TagClient) Use(hooks ...Hook)
- type TagCreate
- func (tc *TagCreate) AddPostIDs(ids ...int64) *TagCreate
- func (tc *TagCreate) AddPosts(a ...*Article) *TagCreate
- func (tc *TagCreate) Exec(ctx context.Context) error
- func (tc *TagCreate) ExecX(ctx context.Context)
- func (tc *TagCreate) Mutation() *TagMutation
- func (tc *TagCreate) Save(ctx context.Context) (*Tag, error)
- func (tc *TagCreate) SaveX(ctx context.Context) *Tag
- func (tc *TagCreate) SetCreatedAt(t time.Time) *TagCreate
- func (tc *TagCreate) SetID(i int64) *TagCreate
- func (tc *TagCreate) SetName(s string) *TagCreate
- func (tc *TagCreate) SetNillableCreatedAt(t *time.Time) *TagCreate
- func (tc *TagCreate) SetNillableUpdatedAt(t *time.Time) *TagCreate
- func (tc *TagCreate) SetSlug(s string) *TagCreate
- func (tc *TagCreate) SetUpdatedAt(t time.Time) *TagCreate
- type TagCreateBulk
- type TagDelete
- type TagDeleteOne
- type TagEdges
- type TagGroupBy
- func (tgb *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 (tgb *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) AddPostIDs(ids ...int64)
- 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) ClearPosts()
- func (m *TagMutation) ClearedEdges() []string
- func (m *TagMutation) ClearedFields() []string
- func (m TagMutation) Client() *Client
- func (m *TagMutation) CreatedAt() (r time.Time, exists bool)
- 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 int64, exists bool)
- func (m *TagMutation) IDs(ctx context.Context) ([]int64, error)
- func (m *TagMutation) Name() (r string, exists bool)
- func (m *TagMutation) OldCreatedAt(ctx context.Context) (v time.Time, err error)
- 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) OldSlug(ctx context.Context) (v string, err error)
- func (m *TagMutation) OldUpdatedAt(ctx context.Context) (v time.Time, err error)
- func (m *TagMutation) Op() Op
- func (m *TagMutation) PostsCleared() bool
- func (m *TagMutation) PostsIDs() (ids []int64)
- func (m *TagMutation) RemovePostIDs(ids ...int64)
- func (m *TagMutation) RemovedEdges() []string
- func (m *TagMutation) RemovedIDs(name string) []ent.Value
- func (m *TagMutation) RemovedPostsIDs() (ids []int64)
- func (m *TagMutation) ResetCreatedAt()
- func (m *TagMutation) ResetEdge(name string) error
- func (m *TagMutation) ResetField(name string) error
- func (m *TagMutation) ResetName()
- func (m *TagMutation) ResetPosts()
- func (m *TagMutation) ResetSlug()
- func (m *TagMutation) ResetUpdatedAt()
- func (m *TagMutation) SetCreatedAt(t time.Time)
- func (m *TagMutation) SetField(name string, value ent.Value) error
- func (m *TagMutation) SetID(id int64)
- func (m *TagMutation) SetName(s string)
- func (m *TagMutation) SetOp(op Op)
- func (m *TagMutation) SetSlug(s string)
- func (m *TagMutation) SetUpdatedAt(t time.Time)
- func (m *TagMutation) Slug() (r string, exists bool)
- func (m TagMutation) Tx() (*Tx, error)
- func (m *TagMutation) Type() string
- func (m *TagMutation) UpdatedAt() (r time.Time, exists bool)
- func (m *TagMutation) Where(ps ...predicate.Tag)
- func (m *TagMutation) WhereP(ps ...func(*sql.Selector))
- type TagQuery
- func (tq *TagQuery) Aggregate(fns ...AggregateFunc) *TagSelect
- func (tq *TagQuery) All(ctx context.Context) ([]*Tag, error)
- func (tq *TagQuery) AllX(ctx context.Context) []*Tag
- func (tq *TagQuery) Clone() *TagQuery
- func (tq *TagQuery) Count(ctx context.Context) (int, error)
- func (tq *TagQuery) CountX(ctx context.Context) int
- func (tq *TagQuery) Exist(ctx context.Context) (bool, error)
- func (tq *TagQuery) ExistX(ctx context.Context) bool
- func (tq *TagQuery) First(ctx context.Context) (*Tag, error)
- func (tq *TagQuery) FirstID(ctx context.Context) (id int64, err error)
- func (tq *TagQuery) FirstIDX(ctx context.Context) int64
- func (tq *TagQuery) FirstX(ctx context.Context) *Tag
- func (tq *TagQuery) GroupBy(field string, fields ...string) *TagGroupBy
- func (tq *TagQuery) IDs(ctx context.Context) (ids []int64, err error)
- func (tq *TagQuery) IDsX(ctx context.Context) []int64
- func (tq *TagQuery) Limit(limit int) *TagQuery
- func (tq *TagQuery) Offset(offset int) *TagQuery
- func (tq *TagQuery) Only(ctx context.Context) (*Tag, error)
- func (tq *TagQuery) OnlyID(ctx context.Context) (id int64, err error)
- func (tq *TagQuery) OnlyIDX(ctx context.Context) int64
- func (tq *TagQuery) OnlyX(ctx context.Context) *Tag
- func (tq *TagQuery) Order(o ...tag.OrderOption) *TagQuery
- func (tq *TagQuery) QueryPosts() *ArticleQuery
- func (tq *TagQuery) Select(fields ...string) *TagSelect
- func (tq *TagQuery) Unique(unique bool) *TagQuery
- func (tq *TagQuery) Where(ps ...predicate.Tag) *TagQuery
- func (tq *TagQuery) WithPosts(opts ...func(*ArticleQuery)) *TagQuery
- type TagSelect
- func (ts *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 (ts *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 (tu *TagUpdate) AddPostIDs(ids ...int64) *TagUpdate
- func (tu *TagUpdate) AddPosts(a ...*Article) *TagUpdate
- func (tu *TagUpdate) ClearPosts() *TagUpdate
- func (tu *TagUpdate) Exec(ctx context.Context) error
- func (tu *TagUpdate) ExecX(ctx context.Context)
- func (tu *TagUpdate) Mutation() *TagMutation
- func (tu *TagUpdate) RemovePostIDs(ids ...int64) *TagUpdate
- func (tu *TagUpdate) RemovePosts(a ...*Article) *TagUpdate
- func (tu *TagUpdate) Save(ctx context.Context) (int, error)
- func (tu *TagUpdate) SaveX(ctx context.Context) int
- func (tu *TagUpdate) SetCreatedAt(t time.Time) *TagUpdate
- func (tu *TagUpdate) SetName(s string) *TagUpdate
- func (tu *TagUpdate) SetNillableCreatedAt(t *time.Time) *TagUpdate
- func (tu *TagUpdate) SetNillableName(s *string) *TagUpdate
- func (tu *TagUpdate) SetNillableSlug(s *string) *TagUpdate
- func (tu *TagUpdate) SetNillableUpdatedAt(t *time.Time) *TagUpdate
- func (tu *TagUpdate) SetSlug(s string) *TagUpdate
- func (tu *TagUpdate) SetUpdatedAt(t time.Time) *TagUpdate
- func (tu *TagUpdate) Where(ps ...predicate.Tag) *TagUpdate
- type TagUpdateOne
- func (tuo *TagUpdateOne) AddPostIDs(ids ...int64) *TagUpdateOne
- func (tuo *TagUpdateOne) AddPosts(a ...*Article) *TagUpdateOne
- func (tuo *TagUpdateOne) ClearPosts() *TagUpdateOne
- func (tuo *TagUpdateOne) Exec(ctx context.Context) error
- func (tuo *TagUpdateOne) ExecX(ctx context.Context)
- func (tuo *TagUpdateOne) Mutation() *TagMutation
- func (tuo *TagUpdateOne) RemovePostIDs(ids ...int64) *TagUpdateOne
- func (tuo *TagUpdateOne) RemovePosts(a ...*Article) *TagUpdateOne
- func (tuo *TagUpdateOne) Save(ctx context.Context) (*Tag, error)
- func (tuo *TagUpdateOne) SaveX(ctx context.Context) *Tag
- func (tuo *TagUpdateOne) Select(field string, fields ...string) *TagUpdateOne
- func (tuo *TagUpdateOne) SetCreatedAt(t time.Time) *TagUpdateOne
- func (tuo *TagUpdateOne) SetName(s string) *TagUpdateOne
- func (tuo *TagUpdateOne) SetNillableCreatedAt(t *time.Time) *TagUpdateOne
- func (tuo *TagUpdateOne) SetNillableName(s *string) *TagUpdateOne
- func (tuo *TagUpdateOne) SetNillableSlug(s *string) *TagUpdateOne
- func (tuo *TagUpdateOne) SetNillableUpdatedAt(t *time.Time) *TagUpdateOne
- func (tuo *TagUpdateOne) SetSlug(s string) *TagUpdateOne
- func (tuo *TagUpdateOne) SetUpdatedAt(t time.Time) *TagUpdateOne
- func (tuo *TagUpdateOne) Where(ps ...predicate.Tag) *TagUpdateOne
- type Tags
- type TraverseFunc
- type Traverser
- type Tx
- type ValidationError
- type Value
Constants ¶
const ( // Operation types. OpCreate = ent.OpCreate OpDelete = ent.OpDelete OpDeleteOne = ent.OpDeleteOne OpUpdate = ent.OpUpdate OpUpdateOne = ent.OpUpdateOne // Node types. TypeArticle = "Article" TypeComment = "Comment" TypeTag = "Tag" )
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.
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.
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 Article ¶
type Article struct { // ID of the ent. ID int64 `json:"id,omitempty"` // Title holds the value of the "title" field. Title string `json:"title,omitempty"` // Content holds the value of the "content" field. Content string `json:"content,omitempty"` // CreatedAt holds the value of the "created_at" field. CreatedAt time.Time `json:"created_at,omitempty"` // UpdatedAt holds the value of the "updated_at" field. UpdatedAt time.Time `json:"updated_at,omitempty"` // Edges holds the relations/edges for other nodes in the graph. // The values are being populated by the ArticleQuery when eager-loading is set. Edges ArticleEdges `json:"edges"` // contains filtered or unexported fields }
Article is the model entity for the Article schema.
func (*Article) QueryComments ¶
func (a *Article) QueryComments() *CommentQuery
QueryComments queries the "comments" edge of the Article entity.
func (*Article) Unwrap ¶
Unwrap unwraps the Article 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 (*Article) Update ¶
func (a *Article) Update() *ArticleUpdateOne
Update returns a builder for updating this Article. Note that you need to call Article.Unwrap() before calling this method if this Article was returned from a transaction, and the transaction was committed or rolled back.
type ArticleClient ¶
type ArticleClient struct {
// contains filtered or unexported fields
}
ArticleClient is a client for the Article schema.
func NewArticleClient ¶
func NewArticleClient(c config) *ArticleClient
NewArticleClient returns a client for the Article from the given config.
func (*ArticleClient) Create ¶
func (c *ArticleClient) Create() *ArticleCreate
Create returns a builder for creating a Article entity.
func (*ArticleClient) CreateBulk ¶
func (c *ArticleClient) CreateBulk(builders ...*ArticleCreate) *ArticleCreateBulk
CreateBulk returns a builder for creating a bulk of Article entities.
func (*ArticleClient) Delete ¶
func (c *ArticleClient) Delete() *ArticleDelete
Delete returns a delete builder for Article.
func (*ArticleClient) DeleteOne ¶
func (c *ArticleClient) DeleteOne(a *Article) *ArticleDeleteOne
DeleteOne returns a builder for deleting the given entity.
func (*ArticleClient) DeleteOneID ¶
func (c *ArticleClient) DeleteOneID(id int64) *ArticleDeleteOne
DeleteOneID returns a builder for deleting the given entity by its id.
func (*ArticleClient) GetX ¶
func (c *ArticleClient) GetX(ctx context.Context, id int64) *Article
GetX is like Get, but panics if an error occurs.
func (*ArticleClient) Hooks ¶
func (c *ArticleClient) Hooks() []Hook
Hooks returns the client hooks.
func (*ArticleClient) Intercept ¶
func (c *ArticleClient) Intercept(interceptors ...Interceptor)
Intercept adds a list of query interceptors to the interceptors stack. A call to `Intercept(f, g, h)` equals to `article.Intercept(f(g(h())))`.
func (*ArticleClient) Interceptors ¶
func (c *ArticleClient) Interceptors() []Interceptor
Interceptors returns the client interceptors.
func (*ArticleClient) MapCreateBulk ¶
func (c *ArticleClient) MapCreateBulk(slice any, setFunc func(*ArticleCreate, int)) *ArticleCreateBulk
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 (*ArticleClient) Query ¶
func (c *ArticleClient) Query() *ArticleQuery
Query returns a query builder for Article.
func (*ArticleClient) QueryComments ¶
func (c *ArticleClient) QueryComments(a *Article) *CommentQuery
QueryComments queries the comments edge of a Article.
func (*ArticleClient) QueryTags ¶
func (c *ArticleClient) QueryTags(a *Article) *TagQuery
QueryTags queries the tags edge of a Article.
func (*ArticleClient) Update ¶
func (c *ArticleClient) Update() *ArticleUpdate
Update returns an update builder for Article.
func (*ArticleClient) UpdateOne ¶
func (c *ArticleClient) UpdateOne(a *Article) *ArticleUpdateOne
UpdateOne returns an update builder for the given entity.
func (*ArticleClient) UpdateOneID ¶
func (c *ArticleClient) UpdateOneID(id int64) *ArticleUpdateOne
UpdateOneID returns an update builder for the given id.
func (*ArticleClient) Use ¶
func (c *ArticleClient) Use(hooks ...Hook)
Use adds a list of mutation hooks to the hooks stack. A call to `Use(f, g, h)` equals to `article.Hooks(f(g(h())))`.
type ArticleCreate ¶
type ArticleCreate struct {
// contains filtered or unexported fields
}
ArticleCreate is the builder for creating a Article entity.
func (*ArticleCreate) AddCommentIDs ¶
func (ac *ArticleCreate) AddCommentIDs(ids ...int64) *ArticleCreate
AddCommentIDs adds the "comments" edge to the Comment entity by IDs.
func (*ArticleCreate) AddComments ¶
func (ac *ArticleCreate) AddComments(c ...*Comment) *ArticleCreate
AddComments adds the "comments" edges to the Comment entity.
func (*ArticleCreate) AddTagIDs ¶
func (ac *ArticleCreate) AddTagIDs(ids ...int64) *ArticleCreate
AddTagIDs adds the "tags" edge to the Tag entity by IDs.
func (*ArticleCreate) AddTags ¶
func (ac *ArticleCreate) AddTags(t ...*Tag) *ArticleCreate
AddTags adds the "tags" edges to the Tag entity.
func (*ArticleCreate) Exec ¶
func (ac *ArticleCreate) Exec(ctx context.Context) error
Exec executes the query.
func (*ArticleCreate) ExecX ¶
func (ac *ArticleCreate) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*ArticleCreate) Mutation ¶
func (ac *ArticleCreate) Mutation() *ArticleMutation
Mutation returns the ArticleMutation object of the builder.
func (*ArticleCreate) Save ¶
func (ac *ArticleCreate) Save(ctx context.Context) (*Article, error)
Save creates the Article in the database.
func (*ArticleCreate) SaveX ¶
func (ac *ArticleCreate) SaveX(ctx context.Context) *Article
SaveX calls Save and panics if Save returns an error.
func (*ArticleCreate) SetContent ¶
func (ac *ArticleCreate) SetContent(s string) *ArticleCreate
SetContent sets the "content" field.
func (*ArticleCreate) SetCreatedAt ¶
func (ac *ArticleCreate) SetCreatedAt(t time.Time) *ArticleCreate
SetCreatedAt sets the "created_at" field.
func (*ArticleCreate) SetID ¶
func (ac *ArticleCreate) SetID(i int64) *ArticleCreate
SetID sets the "id" field.
func (*ArticleCreate) SetNillableCreatedAt ¶
func (ac *ArticleCreate) SetNillableCreatedAt(t *time.Time) *ArticleCreate
SetNillableCreatedAt sets the "created_at" field if the given value is not nil.
func (*ArticleCreate) SetNillableUpdatedAt ¶
func (ac *ArticleCreate) SetNillableUpdatedAt(t *time.Time) *ArticleCreate
SetNillableUpdatedAt sets the "updated_at" field if the given value is not nil.
func (*ArticleCreate) SetTitle ¶
func (ac *ArticleCreate) SetTitle(s string) *ArticleCreate
SetTitle sets the "title" field.
func (*ArticleCreate) SetUpdatedAt ¶
func (ac *ArticleCreate) SetUpdatedAt(t time.Time) *ArticleCreate
SetUpdatedAt sets the "updated_at" field.
type ArticleCreateBulk ¶
type ArticleCreateBulk struct {
// contains filtered or unexported fields
}
ArticleCreateBulk is the builder for creating many Article entities in bulk.
func (*ArticleCreateBulk) Exec ¶
func (acb *ArticleCreateBulk) Exec(ctx context.Context) error
Exec executes the query.
func (*ArticleCreateBulk) ExecX ¶
func (acb *ArticleCreateBulk) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
type ArticleDelete ¶
type ArticleDelete struct {
// contains filtered or unexported fields
}
ArticleDelete is the builder for deleting a Article entity.
func (*ArticleDelete) Exec ¶
func (ad *ArticleDelete) Exec(ctx context.Context) (int, error)
Exec executes the deletion query and returns how many vertices were deleted.
func (*ArticleDelete) ExecX ¶
func (ad *ArticleDelete) ExecX(ctx context.Context) int
ExecX is like Exec, but panics if an error occurs.
func (*ArticleDelete) Where ¶
func (ad *ArticleDelete) Where(ps ...predicate.Article) *ArticleDelete
Where appends a list predicates to the ArticleDelete builder.
type ArticleDeleteOne ¶
type ArticleDeleteOne struct {
// contains filtered or unexported fields
}
ArticleDeleteOne is the builder for deleting a single Article entity.
func (*ArticleDeleteOne) Exec ¶
func (ado *ArticleDeleteOne) Exec(ctx context.Context) error
Exec executes the deletion query.
func (*ArticleDeleteOne) ExecX ¶
func (ado *ArticleDeleteOne) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*ArticleDeleteOne) Where ¶
func (ado *ArticleDeleteOne) Where(ps ...predicate.Article) *ArticleDeleteOne
Where appends a list predicates to the ArticleDelete builder.
type ArticleEdges ¶
type ArticleEdges struct { // Comments holds the value of the comments edge. Comments []*Comment `json:"comments,omitempty"` // Tags holds the value of the tags edge. Tags []*Tag `json:"tags,omitempty"` // contains filtered or unexported fields }
ArticleEdges holds the relations/edges for other nodes in the graph.
func (ArticleEdges) CommentsOrErr ¶
func (e ArticleEdges) CommentsOrErr() ([]*Comment, error)
CommentsOrErr returns the Comments value or an error if the edge was not loaded in eager-loading.
func (ArticleEdges) TagsOrErr ¶
func (e ArticleEdges) TagsOrErr() ([]*Tag, error)
TagsOrErr returns the Tags value or an error if the edge was not loaded in eager-loading.
type ArticleGroupBy ¶
type ArticleGroupBy struct {
// contains filtered or unexported fields
}
ArticleGroupBy is the group-by builder for Article entities.
func (*ArticleGroupBy) Aggregate ¶
func (agb *ArticleGroupBy) Aggregate(fns ...AggregateFunc) *ArticleGroupBy
Aggregate adds the given aggregation functions to the group-by query.
func (*ArticleGroupBy) Bool ¶
Bool returns a single bool from a selector. It is only allowed when selecting one field.
func (*ArticleGroupBy) Bools ¶
Bools returns list of bools from a selector. It is only allowed when selecting one field.
func (*ArticleGroupBy) Float64 ¶
Float64 returns a single float64 from a selector. It is only allowed when selecting one field.
func (*ArticleGroupBy) Float64s ¶
Float64s returns list of float64s from a selector. It is only allowed when selecting one field.
func (*ArticleGroupBy) Int ¶
Int returns a single int from a selector. It is only allowed when selecting one field.
func (*ArticleGroupBy) Ints ¶
Ints returns list of ints from a selector. It is only allowed when selecting one field.
func (*ArticleGroupBy) Scan ¶
func (agb *ArticleGroupBy) Scan(ctx context.Context, v any) error
Scan applies the selector query and scans the result into the given value.
func (*ArticleGroupBy) String ¶
String returns a single string from a selector. It is only allowed when selecting one field.
type ArticleMutation ¶
type ArticleMutation struct {
// contains filtered or unexported fields
}
ArticleMutation represents an operation that mutates the Article nodes in the graph.
func (*ArticleMutation) AddCommentIDs ¶
func (m *ArticleMutation) AddCommentIDs(ids ...int64)
AddCommentIDs adds the "comments" edge to the Comment entity by ids.
func (*ArticleMutation) AddField ¶
func (m *ArticleMutation) 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 (*ArticleMutation) AddTagIDs ¶
func (m *ArticleMutation) AddTagIDs(ids ...int64)
AddTagIDs adds the "tags" edge to the Tag entity by ids.
func (*ArticleMutation) AddedEdges ¶
func (m *ArticleMutation) AddedEdges() []string
AddedEdges returns all edge names that were set/added in this mutation.
func (*ArticleMutation) AddedField ¶
func (m *ArticleMutation) 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 (*ArticleMutation) AddedFields ¶
func (m *ArticleMutation) AddedFields() []string
AddedFields returns all numeric fields that were incremented/decremented during this mutation.
func (*ArticleMutation) AddedIDs ¶
func (m *ArticleMutation) AddedIDs(name string) []ent.Value
AddedIDs returns all IDs (to other nodes) that were added for the given edge name in this mutation.
func (*ArticleMutation) ClearComments ¶
func (m *ArticleMutation) ClearComments()
ClearComments clears the "comments" edge to the Comment entity.
func (*ArticleMutation) ClearEdge ¶
func (m *ArticleMutation) 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 (*ArticleMutation) ClearField ¶
func (m *ArticleMutation) 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 (*ArticleMutation) ClearTags ¶
func (m *ArticleMutation) ClearTags()
ClearTags clears the "tags" edge to the Tag entity.
func (*ArticleMutation) ClearedEdges ¶
func (m *ArticleMutation) ClearedEdges() []string
ClearedEdges returns all edge names that were cleared in this mutation.
func (*ArticleMutation) ClearedFields ¶
func (m *ArticleMutation) ClearedFields() []string
ClearedFields returns all nullable fields that were cleared during this mutation.
func (ArticleMutation) Client ¶
func (m ArticleMutation) 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 (*ArticleMutation) CommentsCleared ¶
func (m *ArticleMutation) CommentsCleared() bool
CommentsCleared reports if the "comments" edge to the Comment entity was cleared.
func (*ArticleMutation) CommentsIDs ¶
func (m *ArticleMutation) CommentsIDs() (ids []int64)
CommentsIDs returns the "comments" edge IDs in the mutation.
func (*ArticleMutation) Content ¶
func (m *ArticleMutation) Content() (r string, exists bool)
Content returns the value of the "content" field in the mutation.
func (*ArticleMutation) CreatedAt ¶
func (m *ArticleMutation) CreatedAt() (r time.Time, exists bool)
CreatedAt returns the value of the "created_at" field in the mutation.
func (*ArticleMutation) EdgeCleared ¶
func (m *ArticleMutation) EdgeCleared(name string) bool
EdgeCleared returns a boolean which indicates if the edge with the given name was cleared in this mutation.
func (*ArticleMutation) Field ¶
func (m *ArticleMutation) 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 (*ArticleMutation) FieldCleared ¶
func (m *ArticleMutation) FieldCleared(name string) bool
FieldCleared returns a boolean indicating if a field with the given name was cleared in this mutation.
func (*ArticleMutation) Fields ¶
func (m *ArticleMutation) 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 (*ArticleMutation) ID ¶
func (m *ArticleMutation) ID() (id int64, 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 (*ArticleMutation) IDs ¶
func (m *ArticleMutation) IDs(ctx context.Context) ([]int64, 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 (*ArticleMutation) OldContent ¶
func (m *ArticleMutation) OldContent(ctx context.Context) (v string, err error)
OldContent returns the old "content" field's value of the Article entity. If the Article 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 (*ArticleMutation) OldCreatedAt ¶
OldCreatedAt returns the old "created_at" field's value of the Article entity. If the Article 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 (*ArticleMutation) 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 (*ArticleMutation) OldTitle ¶
func (m *ArticleMutation) OldTitle(ctx context.Context) (v string, err error)
OldTitle returns the old "title" field's value of the Article entity. If the Article 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 (*ArticleMutation) OldUpdatedAt ¶
OldUpdatedAt returns the old "updated_at" field's value of the Article entity. If the Article 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 (*ArticleMutation) RemoveCommentIDs ¶
func (m *ArticleMutation) RemoveCommentIDs(ids ...int64)
RemoveCommentIDs removes the "comments" edge to the Comment entity by IDs.
func (*ArticleMutation) RemoveTagIDs ¶
func (m *ArticleMutation) RemoveTagIDs(ids ...int64)
RemoveTagIDs removes the "tags" edge to the Tag entity by IDs.
func (*ArticleMutation) RemovedCommentsIDs ¶
func (m *ArticleMutation) RemovedCommentsIDs() (ids []int64)
RemovedComments returns the removed IDs of the "comments" edge to the Comment entity.
func (*ArticleMutation) RemovedEdges ¶
func (m *ArticleMutation) RemovedEdges() []string
RemovedEdges returns all edge names that were removed in this mutation.
func (*ArticleMutation) RemovedIDs ¶
func (m *ArticleMutation) 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 (*ArticleMutation) RemovedTagsIDs ¶
func (m *ArticleMutation) RemovedTagsIDs() (ids []int64)
RemovedTags returns the removed IDs of the "tags" edge to the Tag entity.
func (*ArticleMutation) ResetComments ¶
func (m *ArticleMutation) ResetComments()
ResetComments resets all changes to the "comments" edge.
func (*ArticleMutation) ResetContent ¶
func (m *ArticleMutation) ResetContent()
ResetContent resets all changes to the "content" field.
func (*ArticleMutation) ResetCreatedAt ¶
func (m *ArticleMutation) ResetCreatedAt()
ResetCreatedAt resets all changes to the "created_at" field.
func (*ArticleMutation) ResetEdge ¶
func (m *ArticleMutation) 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 (*ArticleMutation) ResetField ¶
func (m *ArticleMutation) 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 (*ArticleMutation) ResetTags ¶
func (m *ArticleMutation) ResetTags()
ResetTags resets all changes to the "tags" edge.
func (*ArticleMutation) ResetTitle ¶
func (m *ArticleMutation) ResetTitle()
ResetTitle resets all changes to the "title" field.
func (*ArticleMutation) ResetUpdatedAt ¶
func (m *ArticleMutation) ResetUpdatedAt()
ResetUpdatedAt resets all changes to the "updated_at" field.
func (*ArticleMutation) SetContent ¶
func (m *ArticleMutation) SetContent(s string)
SetContent sets the "content" field.
func (*ArticleMutation) SetCreatedAt ¶
func (m *ArticleMutation) SetCreatedAt(t time.Time)
SetCreatedAt sets the "created_at" field.
func (*ArticleMutation) SetField ¶
func (m *ArticleMutation) 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 (*ArticleMutation) SetID ¶
func (m *ArticleMutation) SetID(id int64)
SetID sets the value of the id field. Note that this operation is only accepted on creation of Article entities.
func (*ArticleMutation) SetOp ¶
func (m *ArticleMutation) SetOp(op Op)
SetOp allows setting the mutation operation.
func (*ArticleMutation) SetTitle ¶
func (m *ArticleMutation) SetTitle(s string)
SetTitle sets the "title" field.
func (*ArticleMutation) SetUpdatedAt ¶
func (m *ArticleMutation) SetUpdatedAt(t time.Time)
SetUpdatedAt sets the "updated_at" field.
func (*ArticleMutation) TagsCleared ¶
func (m *ArticleMutation) TagsCleared() bool
TagsCleared reports if the "tags" edge to the Tag entity was cleared.
func (*ArticleMutation) TagsIDs ¶
func (m *ArticleMutation) TagsIDs() (ids []int64)
TagsIDs returns the "tags" edge IDs in the mutation.
func (*ArticleMutation) Title ¶
func (m *ArticleMutation) Title() (r string, exists bool)
Title returns the value of the "title" field in the mutation.
func (ArticleMutation) Tx ¶
func (m ArticleMutation) Tx() (*Tx, error)
Tx returns an `ent.Tx` for mutations that were executed in transactions; it returns an error otherwise.
func (*ArticleMutation) Type ¶
func (m *ArticleMutation) Type() string
Type returns the node type of this mutation (Article).
func (*ArticleMutation) UpdatedAt ¶
func (m *ArticleMutation) UpdatedAt() (r time.Time, exists bool)
UpdatedAt returns the value of the "updated_at" field in the mutation.
func (*ArticleMutation) Where ¶
func (m *ArticleMutation) Where(ps ...predicate.Article)
Where appends a list predicates to the ArticleMutation builder.
func (*ArticleMutation) WhereP ¶
func (m *ArticleMutation) WhereP(ps ...func(*sql.Selector))
WhereP appends storage-level predicates to the ArticleMutation builder. Using this method, users can use type-assertion to append predicates that do not depend on any generated package.
type ArticleQuery ¶
type ArticleQuery struct {
// contains filtered or unexported fields
}
ArticleQuery is the builder for querying Article entities.
func (*ArticleQuery) Aggregate ¶
func (aq *ArticleQuery) Aggregate(fns ...AggregateFunc) *ArticleSelect
Aggregate returns a ArticleSelect configured with the given aggregations.
func (*ArticleQuery) All ¶
func (aq *ArticleQuery) All(ctx context.Context) ([]*Article, error)
All executes the query and returns a list of Articles.
func (*ArticleQuery) AllX ¶
func (aq *ArticleQuery) AllX(ctx context.Context) []*Article
AllX is like All, but panics if an error occurs.
func (*ArticleQuery) Clone ¶
func (aq *ArticleQuery) Clone() *ArticleQuery
Clone returns a duplicate of the ArticleQuery builder, including all associated steps. It can be used to prepare common query builders and use them differently after the clone is made.
func (*ArticleQuery) Count ¶
func (aq *ArticleQuery) Count(ctx context.Context) (int, error)
Count returns the count of the given query.
func (*ArticleQuery) CountX ¶
func (aq *ArticleQuery) CountX(ctx context.Context) int
CountX is like Count, but panics if an error occurs.
func (*ArticleQuery) Exist ¶
func (aq *ArticleQuery) Exist(ctx context.Context) (bool, error)
Exist returns true if the query has elements in the graph.
func (*ArticleQuery) ExistX ¶
func (aq *ArticleQuery) ExistX(ctx context.Context) bool
ExistX is like Exist, but panics if an error occurs.
func (*ArticleQuery) First ¶
func (aq *ArticleQuery) First(ctx context.Context) (*Article, error)
First returns the first Article entity from the query. Returns a *NotFoundError when no Article was found.
func (*ArticleQuery) FirstID ¶
func (aq *ArticleQuery) FirstID(ctx context.Context) (id int64, err error)
FirstID returns the first Article ID from the query. Returns a *NotFoundError when no Article ID was found.
func (*ArticleQuery) FirstIDX ¶
func (aq *ArticleQuery) FirstIDX(ctx context.Context) int64
FirstIDX is like FirstID, but panics if an error occurs.
func (*ArticleQuery) FirstX ¶
func (aq *ArticleQuery) FirstX(ctx context.Context) *Article
FirstX is like First, but panics if an error occurs.
func (*ArticleQuery) GroupBy ¶
func (aq *ArticleQuery) GroupBy(field string, fields ...string) *ArticleGroupBy
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.Article.Query(). GroupBy(article.FieldTitle). Aggregate(ent.Count()). Scan(ctx, &v)
func (*ArticleQuery) IDs ¶
func (aq *ArticleQuery) IDs(ctx context.Context) (ids []int64, err error)
IDs executes the query and returns a list of Article IDs.
func (*ArticleQuery) IDsX ¶
func (aq *ArticleQuery) IDsX(ctx context.Context) []int64
IDsX is like IDs, but panics if an error occurs.
func (*ArticleQuery) Limit ¶
func (aq *ArticleQuery) Limit(limit int) *ArticleQuery
Limit the number of records to be returned by this query.
func (*ArticleQuery) Offset ¶
func (aq *ArticleQuery) Offset(offset int) *ArticleQuery
Offset to start from.
func (*ArticleQuery) Only ¶
func (aq *ArticleQuery) Only(ctx context.Context) (*Article, error)
Only returns a single Article entity found by the query, ensuring it only returns one. Returns a *NotSingularError when more than one Article entity is found. Returns a *NotFoundError when no Article entities are found.
func (*ArticleQuery) OnlyID ¶
func (aq *ArticleQuery) OnlyID(ctx context.Context) (id int64, err error)
OnlyID is like Only, but returns the only Article ID in the query. Returns a *NotSingularError when more than one Article ID is found. Returns a *NotFoundError when no entities are found.
func (*ArticleQuery) OnlyIDX ¶
func (aq *ArticleQuery) OnlyIDX(ctx context.Context) int64
OnlyIDX is like OnlyID, but panics if an error occurs.
func (*ArticleQuery) OnlyX ¶
func (aq *ArticleQuery) OnlyX(ctx context.Context) *Article
OnlyX is like Only, but panics if an error occurs.
func (*ArticleQuery) Order ¶
func (aq *ArticleQuery) Order(o ...article.OrderOption) *ArticleQuery
Order specifies how the records should be ordered.
func (*ArticleQuery) QueryComments ¶
func (aq *ArticleQuery) QueryComments() *CommentQuery
QueryComments chains the current query on the "comments" edge.
func (*ArticleQuery) QueryTags ¶
func (aq *ArticleQuery) QueryTags() *TagQuery
QueryTags chains the current query on the "tags" edge.
func (*ArticleQuery) Select ¶
func (aq *ArticleQuery) Select(fields ...string) *ArticleSelect
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.Article.Query(). Select(article.FieldTitle). Scan(ctx, &v)
func (*ArticleQuery) Unique ¶
func (aq *ArticleQuery) Unique(unique bool) *ArticleQuery
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 (*ArticleQuery) Where ¶
func (aq *ArticleQuery) Where(ps ...predicate.Article) *ArticleQuery
Where adds a new predicate for the ArticleQuery builder.
func (*ArticleQuery) WithComments ¶
func (aq *ArticleQuery) WithComments(opts ...func(*CommentQuery)) *ArticleQuery
WithComments tells the query-builder to eager-load the nodes that are connected to the "comments" edge. The optional arguments are used to configure the query builder of the edge.
func (*ArticleQuery) WithTags ¶
func (aq *ArticleQuery) WithTags(opts ...func(*TagQuery)) *ArticleQuery
WithTags tells the query-builder to eager-load the nodes that are connected to the "tags" edge. The optional arguments are used to configure the query builder of the edge.
type ArticleSelect ¶
type ArticleSelect struct { *ArticleQuery // contains filtered or unexported fields }
ArticleSelect is the builder for selecting fields of Article entities.
func (*ArticleSelect) Aggregate ¶
func (as *ArticleSelect) Aggregate(fns ...AggregateFunc) *ArticleSelect
Aggregate adds the given aggregation functions to the selector query.
func (*ArticleSelect) Bool ¶
Bool returns a single bool from a selector. It is only allowed when selecting one field.
func (*ArticleSelect) Bools ¶
Bools returns list of bools from a selector. It is only allowed when selecting one field.
func (*ArticleSelect) Float64 ¶
Float64 returns a single float64 from a selector. It is only allowed when selecting one field.
func (*ArticleSelect) Float64s ¶
Float64s returns list of float64s from a selector. It is only allowed when selecting one field.
func (*ArticleSelect) Int ¶
Int returns a single int from a selector. It is only allowed when selecting one field.
func (*ArticleSelect) Ints ¶
Ints returns list of ints from a selector. It is only allowed when selecting one field.
func (*ArticleSelect) Scan ¶
func (as *ArticleSelect) Scan(ctx context.Context, v any) error
Scan applies the selector query and scans the result into the given value.
func (*ArticleSelect) String ¶
String returns a single string from a selector. It is only allowed when selecting one field.
type ArticleUpdate ¶
type ArticleUpdate struct {
// contains filtered or unexported fields
}
ArticleUpdate is the builder for updating Article entities.
func (*ArticleUpdate) AddCommentIDs ¶
func (au *ArticleUpdate) AddCommentIDs(ids ...int64) *ArticleUpdate
AddCommentIDs adds the "comments" edge to the Comment entity by IDs.
func (*ArticleUpdate) AddComments ¶
func (au *ArticleUpdate) AddComments(c ...*Comment) *ArticleUpdate
AddComments adds the "comments" edges to the Comment entity.
func (*ArticleUpdate) AddTagIDs ¶
func (au *ArticleUpdate) AddTagIDs(ids ...int64) *ArticleUpdate
AddTagIDs adds the "tags" edge to the Tag entity by IDs.
func (*ArticleUpdate) AddTags ¶
func (au *ArticleUpdate) AddTags(t ...*Tag) *ArticleUpdate
AddTags adds the "tags" edges to the Tag entity.
func (*ArticleUpdate) ClearComments ¶
func (au *ArticleUpdate) ClearComments() *ArticleUpdate
ClearComments clears all "comments" edges to the Comment entity.
func (*ArticleUpdate) ClearTags ¶
func (au *ArticleUpdate) ClearTags() *ArticleUpdate
ClearTags clears all "tags" edges to the Tag entity.
func (*ArticleUpdate) Exec ¶
func (au *ArticleUpdate) Exec(ctx context.Context) error
Exec executes the query.
func (*ArticleUpdate) ExecX ¶
func (au *ArticleUpdate) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*ArticleUpdate) Mutation ¶
func (au *ArticleUpdate) Mutation() *ArticleMutation
Mutation returns the ArticleMutation object of the builder.
func (*ArticleUpdate) RemoveCommentIDs ¶
func (au *ArticleUpdate) RemoveCommentIDs(ids ...int64) *ArticleUpdate
RemoveCommentIDs removes the "comments" edge to Comment entities by IDs.
func (*ArticleUpdate) RemoveComments ¶
func (au *ArticleUpdate) RemoveComments(c ...*Comment) *ArticleUpdate
RemoveComments removes "comments" edges to Comment entities.
func (*ArticleUpdate) RemoveTagIDs ¶
func (au *ArticleUpdate) RemoveTagIDs(ids ...int64) *ArticleUpdate
RemoveTagIDs removes the "tags" edge to Tag entities by IDs.
func (*ArticleUpdate) RemoveTags ¶
func (au *ArticleUpdate) RemoveTags(t ...*Tag) *ArticleUpdate
RemoveTags removes "tags" edges to Tag entities.
func (*ArticleUpdate) Save ¶
func (au *ArticleUpdate) Save(ctx context.Context) (int, error)
Save executes the query and returns the number of nodes affected by the update operation.
func (*ArticleUpdate) SaveX ¶
func (au *ArticleUpdate) SaveX(ctx context.Context) int
SaveX is like Save, but panics if an error occurs.
func (*ArticleUpdate) SetContent ¶
func (au *ArticleUpdate) SetContent(s string) *ArticleUpdate
SetContent sets the "content" field.
func (*ArticleUpdate) SetCreatedAt ¶
func (au *ArticleUpdate) SetCreatedAt(t time.Time) *ArticleUpdate
SetCreatedAt sets the "created_at" field.
func (*ArticleUpdate) SetNillableContent ¶
func (au *ArticleUpdate) SetNillableContent(s *string) *ArticleUpdate
SetNillableContent sets the "content" field if the given value is not nil.
func (*ArticleUpdate) SetNillableCreatedAt ¶
func (au *ArticleUpdate) SetNillableCreatedAt(t *time.Time) *ArticleUpdate
SetNillableCreatedAt sets the "created_at" field if the given value is not nil.
func (*ArticleUpdate) SetNillableTitle ¶
func (au *ArticleUpdate) SetNillableTitle(s *string) *ArticleUpdate
SetNillableTitle sets the "title" field if the given value is not nil.
func (*ArticleUpdate) SetNillableUpdatedAt ¶
func (au *ArticleUpdate) SetNillableUpdatedAt(t *time.Time) *ArticleUpdate
SetNillableUpdatedAt sets the "updated_at" field if the given value is not nil.
func (*ArticleUpdate) SetTitle ¶
func (au *ArticleUpdate) SetTitle(s string) *ArticleUpdate
SetTitle sets the "title" field.
func (*ArticleUpdate) SetUpdatedAt ¶
func (au *ArticleUpdate) SetUpdatedAt(t time.Time) *ArticleUpdate
SetUpdatedAt sets the "updated_at" field.
func (*ArticleUpdate) Where ¶
func (au *ArticleUpdate) Where(ps ...predicate.Article) *ArticleUpdate
Where appends a list predicates to the ArticleUpdate builder.
type ArticleUpdateOne ¶
type ArticleUpdateOne struct {
// contains filtered or unexported fields
}
ArticleUpdateOne is the builder for updating a single Article entity.
func (*ArticleUpdateOne) AddCommentIDs ¶
func (auo *ArticleUpdateOne) AddCommentIDs(ids ...int64) *ArticleUpdateOne
AddCommentIDs adds the "comments" edge to the Comment entity by IDs.
func (*ArticleUpdateOne) AddComments ¶
func (auo *ArticleUpdateOne) AddComments(c ...*Comment) *ArticleUpdateOne
AddComments adds the "comments" edges to the Comment entity.
func (*ArticleUpdateOne) AddTagIDs ¶
func (auo *ArticleUpdateOne) AddTagIDs(ids ...int64) *ArticleUpdateOne
AddTagIDs adds the "tags" edge to the Tag entity by IDs.
func (*ArticleUpdateOne) AddTags ¶
func (auo *ArticleUpdateOne) AddTags(t ...*Tag) *ArticleUpdateOne
AddTags adds the "tags" edges to the Tag entity.
func (*ArticleUpdateOne) ClearComments ¶
func (auo *ArticleUpdateOne) ClearComments() *ArticleUpdateOne
ClearComments clears all "comments" edges to the Comment entity.
func (*ArticleUpdateOne) ClearTags ¶
func (auo *ArticleUpdateOne) ClearTags() *ArticleUpdateOne
ClearTags clears all "tags" edges to the Tag entity.
func (*ArticleUpdateOne) Exec ¶
func (auo *ArticleUpdateOne) Exec(ctx context.Context) error
Exec executes the query on the entity.
func (*ArticleUpdateOne) ExecX ¶
func (auo *ArticleUpdateOne) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*ArticleUpdateOne) Mutation ¶
func (auo *ArticleUpdateOne) Mutation() *ArticleMutation
Mutation returns the ArticleMutation object of the builder.
func (*ArticleUpdateOne) RemoveCommentIDs ¶
func (auo *ArticleUpdateOne) RemoveCommentIDs(ids ...int64) *ArticleUpdateOne
RemoveCommentIDs removes the "comments" edge to Comment entities by IDs.
func (*ArticleUpdateOne) RemoveComments ¶
func (auo *ArticleUpdateOne) RemoveComments(c ...*Comment) *ArticleUpdateOne
RemoveComments removes "comments" edges to Comment entities.
func (*ArticleUpdateOne) RemoveTagIDs ¶
func (auo *ArticleUpdateOne) RemoveTagIDs(ids ...int64) *ArticleUpdateOne
RemoveTagIDs removes the "tags" edge to Tag entities by IDs.
func (*ArticleUpdateOne) RemoveTags ¶
func (auo *ArticleUpdateOne) RemoveTags(t ...*Tag) *ArticleUpdateOne
RemoveTags removes "tags" edges to Tag entities.
func (*ArticleUpdateOne) Save ¶
func (auo *ArticleUpdateOne) Save(ctx context.Context) (*Article, error)
Save executes the query and returns the updated Article entity.
func (*ArticleUpdateOne) SaveX ¶
func (auo *ArticleUpdateOne) SaveX(ctx context.Context) *Article
SaveX is like Save, but panics if an error occurs.
func (*ArticleUpdateOne) Select ¶
func (auo *ArticleUpdateOne) Select(field string, fields ...string) *ArticleUpdateOne
Select allows selecting one or more fields (columns) of the returned entity. The default is selecting all fields defined in the entity schema.
func (*ArticleUpdateOne) SetContent ¶
func (auo *ArticleUpdateOne) SetContent(s string) *ArticleUpdateOne
SetContent sets the "content" field.
func (*ArticleUpdateOne) SetCreatedAt ¶
func (auo *ArticleUpdateOne) SetCreatedAt(t time.Time) *ArticleUpdateOne
SetCreatedAt sets the "created_at" field.
func (*ArticleUpdateOne) SetNillableContent ¶
func (auo *ArticleUpdateOne) SetNillableContent(s *string) *ArticleUpdateOne
SetNillableContent sets the "content" field if the given value is not nil.
func (*ArticleUpdateOne) SetNillableCreatedAt ¶
func (auo *ArticleUpdateOne) SetNillableCreatedAt(t *time.Time) *ArticleUpdateOne
SetNillableCreatedAt sets the "created_at" field if the given value is not nil.
func (*ArticleUpdateOne) SetNillableTitle ¶
func (auo *ArticleUpdateOne) SetNillableTitle(s *string) *ArticleUpdateOne
SetNillableTitle sets the "title" field if the given value is not nil.
func (*ArticleUpdateOne) SetNillableUpdatedAt ¶
func (auo *ArticleUpdateOne) SetNillableUpdatedAt(t *time.Time) *ArticleUpdateOne
SetNillableUpdatedAt sets the "updated_at" field if the given value is not nil.
func (*ArticleUpdateOne) SetTitle ¶
func (auo *ArticleUpdateOne) SetTitle(s string) *ArticleUpdateOne
SetTitle sets the "title" field.
func (*ArticleUpdateOne) SetUpdatedAt ¶
func (auo *ArticleUpdateOne) SetUpdatedAt(t time.Time) *ArticleUpdateOne
SetUpdatedAt sets the "updated_at" field.
func (*ArticleUpdateOne) Where ¶
func (auo *ArticleUpdateOne) Where(ps ...predicate.Article) *ArticleUpdateOne
Where appends a list predicates to the ArticleUpdate builder.
type Client ¶
type Client struct { // Schema is the client for creating, migrating and dropping schema. Schema *migrate.Schema // Article is the client for interacting with the Article builders. Article *ArticleClient // Comment is the client for interacting with the Comment builders. Comment *CommentClient // Tag is the client for interacting with the Tag builders. Tag *TagClient // 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(). Article. 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 Comment ¶
type Comment struct { // ID of the ent. ID int64 `json:"id,omitempty"` // Name holds the value of the "name" field. Name string `json:"name,omitempty"` // Content holds the value of the "content" field. Content string `json:"content,omitempty"` // CreatedAt holds the value of the "created_at" field. CreatedAt time.Time `json:"created_at,omitempty"` // UpdatedAt holds the value of the "updated_at" field. UpdatedAt time.Time `json:"updated_at,omitempty"` // Edges holds the relations/edges for other nodes in the graph. // The values are being populated by the CommentQuery when eager-loading is set. Edges CommentEdges `json:"edges"` // contains filtered or unexported fields }
Comment is the model entity for the Comment schema.
func (*Comment) QueryPost ¶
func (c *Comment) QueryPost() *ArticleQuery
QueryPost queries the "post" edge of the Comment entity.
func (*Comment) Unwrap ¶
Unwrap unwraps the Comment 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 (*Comment) Update ¶
func (c *Comment) Update() *CommentUpdateOne
Update returns a builder for updating this Comment. Note that you need to call Comment.Unwrap() before calling this method if this Comment was returned from a transaction, and the transaction was committed or rolled back.
type CommentClient ¶
type CommentClient struct {
// contains filtered or unexported fields
}
CommentClient is a client for the Comment schema.
func NewCommentClient ¶
func NewCommentClient(c config) *CommentClient
NewCommentClient returns a client for the Comment from the given config.
func (*CommentClient) Create ¶
func (c *CommentClient) Create() *CommentCreate
Create returns a builder for creating a Comment entity.
func (*CommentClient) CreateBulk ¶
func (c *CommentClient) CreateBulk(builders ...*CommentCreate) *CommentCreateBulk
CreateBulk returns a builder for creating a bulk of Comment entities.
func (*CommentClient) Delete ¶
func (c *CommentClient) Delete() *CommentDelete
Delete returns a delete builder for Comment.
func (*CommentClient) DeleteOne ¶
func (c *CommentClient) DeleteOne(co *Comment) *CommentDeleteOne
DeleteOne returns a builder for deleting the given entity.
func (*CommentClient) DeleteOneID ¶
func (c *CommentClient) DeleteOneID(id int64) *CommentDeleteOne
DeleteOneID returns a builder for deleting the given entity by its id.
func (*CommentClient) GetX ¶
func (c *CommentClient) GetX(ctx context.Context, id int64) *Comment
GetX is like Get, but panics if an error occurs.
func (*CommentClient) Hooks ¶
func (c *CommentClient) Hooks() []Hook
Hooks returns the client hooks.
func (*CommentClient) Intercept ¶
func (c *CommentClient) Intercept(interceptors ...Interceptor)
Intercept adds a list of query interceptors to the interceptors stack. A call to `Intercept(f, g, h)` equals to `comment.Intercept(f(g(h())))`.
func (*CommentClient) Interceptors ¶
func (c *CommentClient) Interceptors() []Interceptor
Interceptors returns the client interceptors.
func (*CommentClient) MapCreateBulk ¶
func (c *CommentClient) MapCreateBulk(slice any, setFunc func(*CommentCreate, int)) *CommentCreateBulk
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 (*CommentClient) Query ¶
func (c *CommentClient) Query() *CommentQuery
Query returns a query builder for Comment.
func (*CommentClient) QueryPost ¶
func (c *CommentClient) QueryPost(co *Comment) *ArticleQuery
QueryPost queries the post edge of a Comment.
func (*CommentClient) Update ¶
func (c *CommentClient) Update() *CommentUpdate
Update returns an update builder for Comment.
func (*CommentClient) UpdateOne ¶
func (c *CommentClient) UpdateOne(co *Comment) *CommentUpdateOne
UpdateOne returns an update builder for the given entity.
func (*CommentClient) UpdateOneID ¶
func (c *CommentClient) UpdateOneID(id int64) *CommentUpdateOne
UpdateOneID returns an update builder for the given id.
func (*CommentClient) Use ¶
func (c *CommentClient) Use(hooks ...Hook)
Use adds a list of mutation hooks to the hooks stack. A call to `Use(f, g, h)` equals to `comment.Hooks(f(g(h())))`.
type CommentCreate ¶
type CommentCreate struct {
// contains filtered or unexported fields
}
CommentCreate is the builder for creating a Comment entity.
func (*CommentCreate) Exec ¶
func (cc *CommentCreate) Exec(ctx context.Context) error
Exec executes the query.
func (*CommentCreate) ExecX ¶
func (cc *CommentCreate) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*CommentCreate) Mutation ¶
func (cc *CommentCreate) Mutation() *CommentMutation
Mutation returns the CommentMutation object of the builder.
func (*CommentCreate) Save ¶
func (cc *CommentCreate) Save(ctx context.Context) (*Comment, error)
Save creates the Comment in the database.
func (*CommentCreate) SaveX ¶
func (cc *CommentCreate) SaveX(ctx context.Context) *Comment
SaveX calls Save and panics if Save returns an error.
func (*CommentCreate) SetContent ¶
func (cc *CommentCreate) SetContent(s string) *CommentCreate
SetContent sets the "content" field.
func (*CommentCreate) SetCreatedAt ¶
func (cc *CommentCreate) SetCreatedAt(t time.Time) *CommentCreate
SetCreatedAt sets the "created_at" field.
func (*CommentCreate) SetID ¶
func (cc *CommentCreate) SetID(i int64) *CommentCreate
SetID sets the "id" field.
func (*CommentCreate) SetName ¶
func (cc *CommentCreate) SetName(s string) *CommentCreate
SetName sets the "name" field.
func (*CommentCreate) SetNillableCreatedAt ¶
func (cc *CommentCreate) SetNillableCreatedAt(t *time.Time) *CommentCreate
SetNillableCreatedAt sets the "created_at" field if the given value is not nil.
func (*CommentCreate) SetNillablePostID ¶
func (cc *CommentCreate) SetNillablePostID(id *int64) *CommentCreate
SetNillablePostID sets the "post" edge to the Article entity by ID if the given value is not nil.
func (*CommentCreate) SetNillableUpdatedAt ¶
func (cc *CommentCreate) SetNillableUpdatedAt(t *time.Time) *CommentCreate
SetNillableUpdatedAt sets the "updated_at" field if the given value is not nil.
func (*CommentCreate) SetPost ¶
func (cc *CommentCreate) SetPost(a *Article) *CommentCreate
SetPost sets the "post" edge to the Article entity.
func (*CommentCreate) SetPostID ¶
func (cc *CommentCreate) SetPostID(id int64) *CommentCreate
SetPostID sets the "post" edge to the Article entity by ID.
func (*CommentCreate) SetUpdatedAt ¶
func (cc *CommentCreate) SetUpdatedAt(t time.Time) *CommentCreate
SetUpdatedAt sets the "updated_at" field.
type CommentCreateBulk ¶
type CommentCreateBulk struct {
// contains filtered or unexported fields
}
CommentCreateBulk is the builder for creating many Comment entities in bulk.
func (*CommentCreateBulk) Exec ¶
func (ccb *CommentCreateBulk) Exec(ctx context.Context) error
Exec executes the query.
func (*CommentCreateBulk) ExecX ¶
func (ccb *CommentCreateBulk) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
type CommentDelete ¶
type CommentDelete struct {
// contains filtered or unexported fields
}
CommentDelete is the builder for deleting a Comment entity.
func (*CommentDelete) Exec ¶
func (cd *CommentDelete) Exec(ctx context.Context) (int, error)
Exec executes the deletion query and returns how many vertices were deleted.
func (*CommentDelete) ExecX ¶
func (cd *CommentDelete) ExecX(ctx context.Context) int
ExecX is like Exec, but panics if an error occurs.
func (*CommentDelete) Where ¶
func (cd *CommentDelete) Where(ps ...predicate.Comment) *CommentDelete
Where appends a list predicates to the CommentDelete builder.
type CommentDeleteOne ¶
type CommentDeleteOne struct {
// contains filtered or unexported fields
}
CommentDeleteOne is the builder for deleting a single Comment entity.
func (*CommentDeleteOne) Exec ¶
func (cdo *CommentDeleteOne) Exec(ctx context.Context) error
Exec executes the deletion query.
func (*CommentDeleteOne) ExecX ¶
func (cdo *CommentDeleteOne) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*CommentDeleteOne) Where ¶
func (cdo *CommentDeleteOne) Where(ps ...predicate.Comment) *CommentDeleteOne
Where appends a list predicates to the CommentDelete builder.
type CommentEdges ¶
type CommentEdges struct { // Post holds the value of the post edge. Post *Article `json:"post,omitempty"` // contains filtered or unexported fields }
CommentEdges holds the relations/edges for other nodes in the graph.
func (CommentEdges) PostOrErr ¶
func (e CommentEdges) PostOrErr() (*Article, error)
PostOrErr returns the Post value or an error if the edge was not loaded in eager-loading, or loaded but was not found.
type CommentGroupBy ¶
type CommentGroupBy struct {
// contains filtered or unexported fields
}
CommentGroupBy is the group-by builder for Comment entities.
func (*CommentGroupBy) Aggregate ¶
func (cgb *CommentGroupBy) Aggregate(fns ...AggregateFunc) *CommentGroupBy
Aggregate adds the given aggregation functions to the group-by query.
func (*CommentGroupBy) Bool ¶
Bool returns a single bool from a selector. It is only allowed when selecting one field.
func (*CommentGroupBy) Bools ¶
Bools returns list of bools from a selector. It is only allowed when selecting one field.
func (*CommentGroupBy) Float64 ¶
Float64 returns a single float64 from a selector. It is only allowed when selecting one field.
func (*CommentGroupBy) Float64s ¶
Float64s returns list of float64s from a selector. It is only allowed when selecting one field.
func (*CommentGroupBy) Int ¶
Int returns a single int from a selector. It is only allowed when selecting one field.
func (*CommentGroupBy) Ints ¶
Ints returns list of ints from a selector. It is only allowed when selecting one field.
func (*CommentGroupBy) Scan ¶
func (cgb *CommentGroupBy) Scan(ctx context.Context, v any) error
Scan applies the selector query and scans the result into the given value.
func (*CommentGroupBy) String ¶
String returns a single string from a selector. It is only allowed when selecting one field.
type CommentMutation ¶
type CommentMutation struct {
// contains filtered or unexported fields
}
CommentMutation represents an operation that mutates the Comment nodes in the graph.
func (*CommentMutation) AddField ¶
func (m *CommentMutation) 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 (*CommentMutation) AddedEdges ¶
func (m *CommentMutation) AddedEdges() []string
AddedEdges returns all edge names that were set/added in this mutation.
func (*CommentMutation) AddedField ¶
func (m *CommentMutation) 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 (*CommentMutation) AddedFields ¶
func (m *CommentMutation) AddedFields() []string
AddedFields returns all numeric fields that were incremented/decremented during this mutation.
func (*CommentMutation) AddedIDs ¶
func (m *CommentMutation) AddedIDs(name string) []ent.Value
AddedIDs returns all IDs (to other nodes) that were added for the given edge name in this mutation.
func (*CommentMutation) ClearEdge ¶
func (m *CommentMutation) 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 (*CommentMutation) ClearField ¶
func (m *CommentMutation) 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 (*CommentMutation) ClearPost ¶
func (m *CommentMutation) ClearPost()
ClearPost clears the "post" edge to the Article entity.
func (*CommentMutation) ClearedEdges ¶
func (m *CommentMutation) ClearedEdges() []string
ClearedEdges returns all edge names that were cleared in this mutation.
func (*CommentMutation) ClearedFields ¶
func (m *CommentMutation) ClearedFields() []string
ClearedFields returns all nullable fields that were cleared during this mutation.
func (CommentMutation) Client ¶
func (m CommentMutation) 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 (*CommentMutation) Content ¶
func (m *CommentMutation) Content() (r string, exists bool)
Content returns the value of the "content" field in the mutation.
func (*CommentMutation) CreatedAt ¶
func (m *CommentMutation) CreatedAt() (r time.Time, exists bool)
CreatedAt returns the value of the "created_at" field in the mutation.
func (*CommentMutation) EdgeCleared ¶
func (m *CommentMutation) EdgeCleared(name string) bool
EdgeCleared returns a boolean which indicates if the edge with the given name was cleared in this mutation.
func (*CommentMutation) Field ¶
func (m *CommentMutation) 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 (*CommentMutation) FieldCleared ¶
func (m *CommentMutation) FieldCleared(name string) bool
FieldCleared returns a boolean indicating if a field with the given name was cleared in this mutation.
func (*CommentMutation) Fields ¶
func (m *CommentMutation) 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 (*CommentMutation) ID ¶
func (m *CommentMutation) ID() (id int64, 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 (*CommentMutation) IDs ¶
func (m *CommentMutation) IDs(ctx context.Context) ([]int64, 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 (*CommentMutation) Name ¶
func (m *CommentMutation) Name() (r string, exists bool)
Name returns the value of the "name" field in the mutation.
func (*CommentMutation) OldContent ¶
func (m *CommentMutation) OldContent(ctx context.Context) (v string, err error)
OldContent returns the old "content" field's value of the Comment entity. If the Comment 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 (*CommentMutation) OldCreatedAt ¶
OldCreatedAt returns the old "created_at" field's value of the Comment entity. If the Comment 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 (*CommentMutation) 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 (*CommentMutation) OldName ¶
func (m *CommentMutation) OldName(ctx context.Context) (v string, err error)
OldName returns the old "name" field's value of the Comment entity. If the Comment 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 (*CommentMutation) OldUpdatedAt ¶
OldUpdatedAt returns the old "updated_at" field's value of the Comment entity. If the Comment 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 (*CommentMutation) PostCleared ¶
func (m *CommentMutation) PostCleared() bool
PostCleared reports if the "post" edge to the Article entity was cleared.
func (*CommentMutation) PostID ¶
func (m *CommentMutation) PostID() (id int64, exists bool)
PostID returns the "post" edge ID in the mutation.
func (*CommentMutation) PostIDs ¶
func (m *CommentMutation) PostIDs() (ids []int64)
PostIDs returns the "post" edge IDs in the mutation. Note that IDs always returns len(IDs) <= 1 for unique edges, and you should use PostID instead. It exists only for internal usage by the builders.
func (*CommentMutation) RemovedEdges ¶
func (m *CommentMutation) RemovedEdges() []string
RemovedEdges returns all edge names that were removed in this mutation.
func (*CommentMutation) RemovedIDs ¶
func (m *CommentMutation) 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 (*CommentMutation) ResetContent ¶
func (m *CommentMutation) ResetContent()
ResetContent resets all changes to the "content" field.
func (*CommentMutation) ResetCreatedAt ¶
func (m *CommentMutation) ResetCreatedAt()
ResetCreatedAt resets all changes to the "created_at" field.
func (*CommentMutation) ResetEdge ¶
func (m *CommentMutation) 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 (*CommentMutation) ResetField ¶
func (m *CommentMutation) 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 (*CommentMutation) ResetName ¶
func (m *CommentMutation) ResetName()
ResetName resets all changes to the "name" field.
func (*CommentMutation) ResetPost ¶
func (m *CommentMutation) ResetPost()
ResetPost resets all changes to the "post" edge.
func (*CommentMutation) ResetUpdatedAt ¶
func (m *CommentMutation) ResetUpdatedAt()
ResetUpdatedAt resets all changes to the "updated_at" field.
func (*CommentMutation) SetContent ¶
func (m *CommentMutation) SetContent(s string)
SetContent sets the "content" field.
func (*CommentMutation) SetCreatedAt ¶
func (m *CommentMutation) SetCreatedAt(t time.Time)
SetCreatedAt sets the "created_at" field.
func (*CommentMutation) SetField ¶
func (m *CommentMutation) 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 (*CommentMutation) SetID ¶
func (m *CommentMutation) SetID(id int64)
SetID sets the value of the id field. Note that this operation is only accepted on creation of Comment entities.
func (*CommentMutation) SetName ¶
func (m *CommentMutation) SetName(s string)
SetName sets the "name" field.
func (*CommentMutation) SetOp ¶
func (m *CommentMutation) SetOp(op Op)
SetOp allows setting the mutation operation.
func (*CommentMutation) SetPostID ¶
func (m *CommentMutation) SetPostID(id int64)
SetPostID sets the "post" edge to the Article entity by id.
func (*CommentMutation) SetUpdatedAt ¶
func (m *CommentMutation) SetUpdatedAt(t time.Time)
SetUpdatedAt sets the "updated_at" field.
func (CommentMutation) Tx ¶
func (m CommentMutation) Tx() (*Tx, error)
Tx returns an `ent.Tx` for mutations that were executed in transactions; it returns an error otherwise.
func (*CommentMutation) Type ¶
func (m *CommentMutation) Type() string
Type returns the node type of this mutation (Comment).
func (*CommentMutation) UpdatedAt ¶
func (m *CommentMutation) UpdatedAt() (r time.Time, exists bool)
UpdatedAt returns the value of the "updated_at" field in the mutation.
func (*CommentMutation) Where ¶
func (m *CommentMutation) Where(ps ...predicate.Comment)
Where appends a list predicates to the CommentMutation builder.
func (*CommentMutation) WhereP ¶
func (m *CommentMutation) WhereP(ps ...func(*sql.Selector))
WhereP appends storage-level predicates to the CommentMutation builder. Using this method, users can use type-assertion to append predicates that do not depend on any generated package.
type CommentQuery ¶
type CommentQuery struct {
// contains filtered or unexported fields
}
CommentQuery is the builder for querying Comment entities.
func (*CommentQuery) Aggregate ¶
func (cq *CommentQuery) Aggregate(fns ...AggregateFunc) *CommentSelect
Aggregate returns a CommentSelect configured with the given aggregations.
func (*CommentQuery) All ¶
func (cq *CommentQuery) All(ctx context.Context) ([]*Comment, error)
All executes the query and returns a list of Comments.
func (*CommentQuery) AllX ¶
func (cq *CommentQuery) AllX(ctx context.Context) []*Comment
AllX is like All, but panics if an error occurs.
func (*CommentQuery) Clone ¶
func (cq *CommentQuery) Clone() *CommentQuery
Clone returns a duplicate of the CommentQuery builder, including all associated steps. It can be used to prepare common query builders and use them differently after the clone is made.
func (*CommentQuery) Count ¶
func (cq *CommentQuery) Count(ctx context.Context) (int, error)
Count returns the count of the given query.
func (*CommentQuery) CountX ¶
func (cq *CommentQuery) CountX(ctx context.Context) int
CountX is like Count, but panics if an error occurs.
func (*CommentQuery) Exist ¶
func (cq *CommentQuery) Exist(ctx context.Context) (bool, error)
Exist returns true if the query has elements in the graph.
func (*CommentQuery) ExistX ¶
func (cq *CommentQuery) ExistX(ctx context.Context) bool
ExistX is like Exist, but panics if an error occurs.
func (*CommentQuery) First ¶
func (cq *CommentQuery) First(ctx context.Context) (*Comment, error)
First returns the first Comment entity from the query. Returns a *NotFoundError when no Comment was found.
func (*CommentQuery) FirstID ¶
func (cq *CommentQuery) FirstID(ctx context.Context) (id int64, err error)
FirstID returns the first Comment ID from the query. Returns a *NotFoundError when no Comment ID was found.
func (*CommentQuery) FirstIDX ¶
func (cq *CommentQuery) FirstIDX(ctx context.Context) int64
FirstIDX is like FirstID, but panics if an error occurs.
func (*CommentQuery) FirstX ¶
func (cq *CommentQuery) FirstX(ctx context.Context) *Comment
FirstX is like First, but panics if an error occurs.
func (*CommentQuery) GroupBy ¶
func (cq *CommentQuery) GroupBy(field string, fields ...string) *CommentGroupBy
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.Comment.Query(). GroupBy(comment.FieldName). Aggregate(ent.Count()). Scan(ctx, &v)
func (*CommentQuery) IDs ¶
func (cq *CommentQuery) IDs(ctx context.Context) (ids []int64, err error)
IDs executes the query and returns a list of Comment IDs.
func (*CommentQuery) IDsX ¶
func (cq *CommentQuery) IDsX(ctx context.Context) []int64
IDsX is like IDs, but panics if an error occurs.
func (*CommentQuery) Limit ¶
func (cq *CommentQuery) Limit(limit int) *CommentQuery
Limit the number of records to be returned by this query.
func (*CommentQuery) Offset ¶
func (cq *CommentQuery) Offset(offset int) *CommentQuery
Offset to start from.
func (*CommentQuery) Only ¶
func (cq *CommentQuery) Only(ctx context.Context) (*Comment, error)
Only returns a single Comment entity found by the query, ensuring it only returns one. Returns a *NotSingularError when more than one Comment entity is found. Returns a *NotFoundError when no Comment entities are found.
func (*CommentQuery) OnlyID ¶
func (cq *CommentQuery) OnlyID(ctx context.Context) (id int64, err error)
OnlyID is like Only, but returns the only Comment ID in the query. Returns a *NotSingularError when more than one Comment ID is found. Returns a *NotFoundError when no entities are found.
func (*CommentQuery) OnlyIDX ¶
func (cq *CommentQuery) OnlyIDX(ctx context.Context) int64
OnlyIDX is like OnlyID, but panics if an error occurs.
func (*CommentQuery) OnlyX ¶
func (cq *CommentQuery) OnlyX(ctx context.Context) *Comment
OnlyX is like Only, but panics if an error occurs.
func (*CommentQuery) Order ¶
func (cq *CommentQuery) Order(o ...comment.OrderOption) *CommentQuery
Order specifies how the records should be ordered.
func (*CommentQuery) QueryPost ¶
func (cq *CommentQuery) QueryPost() *ArticleQuery
QueryPost chains the current query on the "post" edge.
func (*CommentQuery) Select ¶
func (cq *CommentQuery) Select(fields ...string) *CommentSelect
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.Comment.Query(). Select(comment.FieldName). Scan(ctx, &v)
func (*CommentQuery) Unique ¶
func (cq *CommentQuery) Unique(unique bool) *CommentQuery
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 (*CommentQuery) Where ¶
func (cq *CommentQuery) Where(ps ...predicate.Comment) *CommentQuery
Where adds a new predicate for the CommentQuery builder.
func (*CommentQuery) WithPost ¶
func (cq *CommentQuery) WithPost(opts ...func(*ArticleQuery)) *CommentQuery
WithPost tells the query-builder to eager-load the nodes that are connected to the "post" edge. The optional arguments are used to configure the query builder of the edge.
type CommentSelect ¶
type CommentSelect struct { *CommentQuery // contains filtered or unexported fields }
CommentSelect is the builder for selecting fields of Comment entities.
func (*CommentSelect) Aggregate ¶
func (cs *CommentSelect) Aggregate(fns ...AggregateFunc) *CommentSelect
Aggregate adds the given aggregation functions to the selector query.
func (*CommentSelect) Bool ¶
Bool returns a single bool from a selector. It is only allowed when selecting one field.
func (*CommentSelect) Bools ¶
Bools returns list of bools from a selector. It is only allowed when selecting one field.
func (*CommentSelect) Float64 ¶
Float64 returns a single float64 from a selector. It is only allowed when selecting one field.
func (*CommentSelect) Float64s ¶
Float64s returns list of float64s from a selector. It is only allowed when selecting one field.
func (*CommentSelect) Int ¶
Int returns a single int from a selector. It is only allowed when selecting one field.
func (*CommentSelect) Ints ¶
Ints returns list of ints from a selector. It is only allowed when selecting one field.
func (*CommentSelect) Scan ¶
func (cs *CommentSelect) Scan(ctx context.Context, v any) error
Scan applies the selector query and scans the result into the given value.
func (*CommentSelect) String ¶
String returns a single string from a selector. It is only allowed when selecting one field.
type CommentUpdate ¶
type CommentUpdate struct {
// contains filtered or unexported fields
}
CommentUpdate is the builder for updating Comment entities.
func (*CommentUpdate) ClearPost ¶
func (cu *CommentUpdate) ClearPost() *CommentUpdate
ClearPost clears the "post" edge to the Article entity.
func (*CommentUpdate) Exec ¶
func (cu *CommentUpdate) Exec(ctx context.Context) error
Exec executes the query.
func (*CommentUpdate) ExecX ¶
func (cu *CommentUpdate) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*CommentUpdate) Mutation ¶
func (cu *CommentUpdate) Mutation() *CommentMutation
Mutation returns the CommentMutation object of the builder.
func (*CommentUpdate) Save ¶
func (cu *CommentUpdate) Save(ctx context.Context) (int, error)
Save executes the query and returns the number of nodes affected by the update operation.
func (*CommentUpdate) SaveX ¶
func (cu *CommentUpdate) SaveX(ctx context.Context) int
SaveX is like Save, but panics if an error occurs.
func (*CommentUpdate) SetContent ¶
func (cu *CommentUpdate) SetContent(s string) *CommentUpdate
SetContent sets the "content" field.
func (*CommentUpdate) SetCreatedAt ¶
func (cu *CommentUpdate) SetCreatedAt(t time.Time) *CommentUpdate
SetCreatedAt sets the "created_at" field.
func (*CommentUpdate) SetName ¶
func (cu *CommentUpdate) SetName(s string) *CommentUpdate
SetName sets the "name" field.
func (*CommentUpdate) SetNillableContent ¶
func (cu *CommentUpdate) SetNillableContent(s *string) *CommentUpdate
SetNillableContent sets the "content" field if the given value is not nil.
func (*CommentUpdate) SetNillableCreatedAt ¶
func (cu *CommentUpdate) SetNillableCreatedAt(t *time.Time) *CommentUpdate
SetNillableCreatedAt sets the "created_at" field if the given value is not nil.
func (*CommentUpdate) SetNillableName ¶
func (cu *CommentUpdate) SetNillableName(s *string) *CommentUpdate
SetNillableName sets the "name" field if the given value is not nil.
func (*CommentUpdate) SetNillablePostID ¶
func (cu *CommentUpdate) SetNillablePostID(id *int64) *CommentUpdate
SetNillablePostID sets the "post" edge to the Article entity by ID if the given value is not nil.
func (*CommentUpdate) SetNillableUpdatedAt ¶
func (cu *CommentUpdate) SetNillableUpdatedAt(t *time.Time) *CommentUpdate
SetNillableUpdatedAt sets the "updated_at" field if the given value is not nil.
func (*CommentUpdate) SetPost ¶
func (cu *CommentUpdate) SetPost(a *Article) *CommentUpdate
SetPost sets the "post" edge to the Article entity.
func (*CommentUpdate) SetPostID ¶
func (cu *CommentUpdate) SetPostID(id int64) *CommentUpdate
SetPostID sets the "post" edge to the Article entity by ID.
func (*CommentUpdate) SetUpdatedAt ¶
func (cu *CommentUpdate) SetUpdatedAt(t time.Time) *CommentUpdate
SetUpdatedAt sets the "updated_at" field.
func (*CommentUpdate) Where ¶
func (cu *CommentUpdate) Where(ps ...predicate.Comment) *CommentUpdate
Where appends a list predicates to the CommentUpdate builder.
type CommentUpdateOne ¶
type CommentUpdateOne struct {
// contains filtered or unexported fields
}
CommentUpdateOne is the builder for updating a single Comment entity.
func (*CommentUpdateOne) ClearPost ¶
func (cuo *CommentUpdateOne) ClearPost() *CommentUpdateOne
ClearPost clears the "post" edge to the Article entity.
func (*CommentUpdateOne) Exec ¶
func (cuo *CommentUpdateOne) Exec(ctx context.Context) error
Exec executes the query on the entity.
func (*CommentUpdateOne) ExecX ¶
func (cuo *CommentUpdateOne) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*CommentUpdateOne) Mutation ¶
func (cuo *CommentUpdateOne) Mutation() *CommentMutation
Mutation returns the CommentMutation object of the builder.
func (*CommentUpdateOne) Save ¶
func (cuo *CommentUpdateOne) Save(ctx context.Context) (*Comment, error)
Save executes the query and returns the updated Comment entity.
func (*CommentUpdateOne) SaveX ¶
func (cuo *CommentUpdateOne) SaveX(ctx context.Context) *Comment
SaveX is like Save, but panics if an error occurs.
func (*CommentUpdateOne) Select ¶
func (cuo *CommentUpdateOne) Select(field string, fields ...string) *CommentUpdateOne
Select allows selecting one or more fields (columns) of the returned entity. The default is selecting all fields defined in the entity schema.
func (*CommentUpdateOne) SetContent ¶
func (cuo *CommentUpdateOne) SetContent(s string) *CommentUpdateOne
SetContent sets the "content" field.
func (*CommentUpdateOne) SetCreatedAt ¶
func (cuo *CommentUpdateOne) SetCreatedAt(t time.Time) *CommentUpdateOne
SetCreatedAt sets the "created_at" field.
func (*CommentUpdateOne) SetName ¶
func (cuo *CommentUpdateOne) SetName(s string) *CommentUpdateOne
SetName sets the "name" field.
func (*CommentUpdateOne) SetNillableContent ¶
func (cuo *CommentUpdateOne) SetNillableContent(s *string) *CommentUpdateOne
SetNillableContent sets the "content" field if the given value is not nil.
func (*CommentUpdateOne) SetNillableCreatedAt ¶
func (cuo *CommentUpdateOne) SetNillableCreatedAt(t *time.Time) *CommentUpdateOne
SetNillableCreatedAt sets the "created_at" field if the given value is not nil.
func (*CommentUpdateOne) SetNillableName ¶
func (cuo *CommentUpdateOne) SetNillableName(s *string) *CommentUpdateOne
SetNillableName sets the "name" field if the given value is not nil.
func (*CommentUpdateOne) SetNillablePostID ¶
func (cuo *CommentUpdateOne) SetNillablePostID(id *int64) *CommentUpdateOne
SetNillablePostID sets the "post" edge to the Article entity by ID if the given value is not nil.
func (*CommentUpdateOne) SetNillableUpdatedAt ¶
func (cuo *CommentUpdateOne) SetNillableUpdatedAt(t *time.Time) *CommentUpdateOne
SetNillableUpdatedAt sets the "updated_at" field if the given value is not nil.
func (*CommentUpdateOne) SetPost ¶
func (cuo *CommentUpdateOne) SetPost(a *Article) *CommentUpdateOne
SetPost sets the "post" edge to the Article entity.
func (*CommentUpdateOne) SetPostID ¶
func (cuo *CommentUpdateOne) SetPostID(id int64) *CommentUpdateOne
SetPostID sets the "post" edge to the Article entity by ID.
func (*CommentUpdateOne) SetUpdatedAt ¶
func (cuo *CommentUpdateOne) SetUpdatedAt(t time.Time) *CommentUpdateOne
SetUpdatedAt sets the "updated_at" field.
func (*CommentUpdateOne) Where ¶
func (cuo *CommentUpdateOne) Where(ps ...predicate.Comment) *CommentUpdateOne
Where appends a list predicates to the CommentUpdate builder.
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 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 int64 `json:"id,omitempty"` // Slug holds the value of the "slug" field. Slug string `json:"slug,omitempty"` // Name holds the value of the "name" field. Name string `json:"name,omitempty"` // CreatedAt holds the value of the "created_at" field. CreatedAt time.Time `json:"created_at,omitempty"` // UpdatedAt holds the value of the "updated_at" field. UpdatedAt time.Time `json:"updated_at,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) QueryPosts ¶
func (t *Tag) QueryPosts() *ArticleQuery
QueryPosts queries the "posts" 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 (t *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) DeleteOne ¶
func (c *TagClient) DeleteOne(t *Tag) *TagDeleteOne
DeleteOne returns a builder for deleting the given entity.
func (*TagClient) DeleteOneID ¶
func (c *TagClient) DeleteOneID(id int64) *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) QueryPosts ¶
func (c *TagClient) QueryPosts(t *Tag) *ArticleQuery
QueryPosts queries the posts edge of a Tag.
func (*TagClient) UpdateOne ¶
func (c *TagClient) UpdateOne(t *Tag) *TagUpdateOne
UpdateOne returns an update builder for the given entity.
func (*TagClient) UpdateOneID ¶
func (c *TagClient) UpdateOneID(id int64) *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) AddPostIDs ¶
AddPostIDs adds the "posts" edge to the Article entity by IDs.
func (*TagCreate) Mutation ¶
func (tc *TagCreate) Mutation() *TagMutation
Mutation returns the TagMutation object of the builder.
func (*TagCreate) SetCreatedAt ¶
SetCreatedAt sets the "created_at" field.
func (*TagCreate) SetNillableCreatedAt ¶
SetNillableCreatedAt sets the "created_at" field if the given value is not nil.
func (*TagCreate) SetNillableUpdatedAt ¶
SetNillableUpdatedAt sets the "updated_at" field if the given value is not nil.
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 (tcb *TagCreateBulk) Exec(ctx context.Context) error
Exec executes the query.
func (*TagCreateBulk) ExecX ¶
func (tcb *TagCreateBulk) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
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 (tdo *TagDeleteOne) Exec(ctx context.Context) error
Exec executes the deletion query.
func (*TagDeleteOne) ExecX ¶
func (tdo *TagDeleteOne) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*TagDeleteOne) Where ¶
func (tdo *TagDeleteOne) Where(ps ...predicate.Tag) *TagDeleteOne
Where appends a list predicates to the TagDelete builder.
type TagEdges ¶
type TagEdges struct { // Posts holds the value of the posts edge. Posts []*Article `json:"posts,omitempty"` // contains filtered or unexported fields }
TagEdges holds the relations/edges for other nodes in the graph.
func (TagEdges) PostsOrErr ¶
PostsOrErr returns the Posts 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 (tgb *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 (tgb *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) AddPostIDs ¶
func (m *TagMutation) AddPostIDs(ids ...int64)
AddPostIDs adds the "posts" edge to the Article 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) ClearPosts ¶
func (m *TagMutation) ClearPosts()
ClearPosts clears the "posts" edge to the Article 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) CreatedAt ¶
func (m *TagMutation) CreatedAt() (r time.Time, exists bool)
CreatedAt returns the value of the "created_at" field in the mutation.
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 int64, 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) ([]int64, 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) OldCreatedAt ¶
OldCreatedAt returns the old "created_at" 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) 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) OldSlug ¶
func (m *TagMutation) OldSlug(ctx context.Context) (v string, err error)
OldSlug returns the old "slug" 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) OldUpdatedAt ¶
OldUpdatedAt returns the old "updated_at" 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) PostsCleared ¶
func (m *TagMutation) PostsCleared() bool
PostsCleared reports if the "posts" edge to the Article entity was cleared.
func (*TagMutation) PostsIDs ¶
func (m *TagMutation) PostsIDs() (ids []int64)
PostsIDs returns the "posts" edge IDs in the mutation.
func (*TagMutation) RemovePostIDs ¶
func (m *TagMutation) RemovePostIDs(ids ...int64)
RemovePostIDs removes the "posts" edge to the Article 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) RemovedPostsIDs ¶
func (m *TagMutation) RemovedPostsIDs() (ids []int64)
RemovedPosts returns the removed IDs of the "posts" edge to the Article entity.
func (*TagMutation) ResetCreatedAt ¶
func (m *TagMutation) ResetCreatedAt()
ResetCreatedAt resets all changes to the "created_at" field.
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) ResetPosts ¶
func (m *TagMutation) ResetPosts()
ResetPosts resets all changes to the "posts" edge.
func (*TagMutation) ResetSlug ¶
func (m *TagMutation) ResetSlug()
ResetSlug resets all changes to the "slug" field.
func (*TagMutation) ResetUpdatedAt ¶
func (m *TagMutation) ResetUpdatedAt()
ResetUpdatedAt resets all changes to the "updated_at" field.
func (*TagMutation) SetCreatedAt ¶
func (m *TagMutation) SetCreatedAt(t time.Time)
SetCreatedAt sets the "created_at" field.
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) SetID ¶
func (m *TagMutation) SetID(id int64)
SetID sets the value of the id field. Note that this operation is only accepted on creation of Tag entities.
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) SetSlug ¶
func (m *TagMutation) SetSlug(s string)
SetSlug sets the "slug" field.
func (*TagMutation) SetUpdatedAt ¶
func (m *TagMutation) SetUpdatedAt(t time.Time)
SetUpdatedAt sets the "updated_at" field.
func (*TagMutation) Slug ¶
func (m *TagMutation) Slug() (r string, exists bool)
Slug returns the value of the "slug" field in the mutation.
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) UpdatedAt ¶
func (m *TagMutation) UpdatedAt() (r time.Time, exists bool)
UpdatedAt returns the value of the "updated_at" field 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 (tq *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 (tq *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 { Slug string `json:"slug,omitempty"` Count int `json:"count,omitempty"` } client.Tag.Query(). GroupBy(tag.FieldSlug). 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 (tq *TagQuery) Order(o ...tag.OrderOption) *TagQuery
Order specifies how the records should be ordered.
func (*TagQuery) QueryPosts ¶
func (tq *TagQuery) QueryPosts() *ArticleQuery
QueryPosts chains the current query on the "posts" 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 { Slug string `json:"slug,omitempty"` } client.Tag.Query(). Select(tag.FieldSlug). 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.
func (*TagQuery) WithPosts ¶
func (tq *TagQuery) WithPosts(opts ...func(*ArticleQuery)) *TagQuery
WithPosts tells the query-builder to eager-load the nodes that are connected to the "posts" edge. The optional arguments are used to configure the query builder of the edge.
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 (ts *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) AddPostIDs ¶
AddPostIDs adds the "posts" edge to the Article entity by IDs.
func (*TagUpdate) ClearPosts ¶
ClearPosts clears all "posts" edges to the Article entity.
func (*TagUpdate) Mutation ¶
func (tu *TagUpdate) Mutation() *TagMutation
Mutation returns the TagMutation object of the builder.
func (*TagUpdate) RemovePostIDs ¶
RemovePostIDs removes the "posts" edge to Article entities by IDs.
func (*TagUpdate) RemovePosts ¶
RemovePosts removes "posts" edges to Article entities.
func (*TagUpdate) Save ¶
Save executes the query and returns the number of nodes affected by the update operation.
func (*TagUpdate) SetCreatedAt ¶
SetCreatedAt sets the "created_at" field.
func (*TagUpdate) SetNillableCreatedAt ¶
SetNillableCreatedAt sets the "created_at" field if the given value is not nil.
func (*TagUpdate) SetNillableName ¶
SetNillableName sets the "name" field if the given value is not nil.
func (*TagUpdate) SetNillableSlug ¶
SetNillableSlug sets the "slug" field if the given value is not nil.
func (*TagUpdate) SetNillableUpdatedAt ¶
SetNillableUpdatedAt sets the "updated_at" field if the given value is not nil.
func (*TagUpdate) SetUpdatedAt ¶
SetUpdatedAt sets the "updated_at" field.
type TagUpdateOne ¶
type TagUpdateOne struct {
// contains filtered or unexported fields
}
TagUpdateOne is the builder for updating a single Tag entity.
func (*TagUpdateOne) AddPostIDs ¶
func (tuo *TagUpdateOne) AddPostIDs(ids ...int64) *TagUpdateOne
AddPostIDs adds the "posts" edge to the Article entity by IDs.
func (*TagUpdateOne) AddPosts ¶
func (tuo *TagUpdateOne) AddPosts(a ...*Article) *TagUpdateOne
AddPosts adds the "posts" edges to the Article entity.
func (*TagUpdateOne) ClearPosts ¶
func (tuo *TagUpdateOne) ClearPosts() *TagUpdateOne
ClearPosts clears all "posts" edges to the Article entity.
func (*TagUpdateOne) Exec ¶
func (tuo *TagUpdateOne) Exec(ctx context.Context) error
Exec executes the query on the entity.
func (*TagUpdateOne) ExecX ¶
func (tuo *TagUpdateOne) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*TagUpdateOne) Mutation ¶
func (tuo *TagUpdateOne) Mutation() *TagMutation
Mutation returns the TagMutation object of the builder.
func (*TagUpdateOne) RemovePostIDs ¶
func (tuo *TagUpdateOne) RemovePostIDs(ids ...int64) *TagUpdateOne
RemovePostIDs removes the "posts" edge to Article entities by IDs.
func (*TagUpdateOne) RemovePosts ¶
func (tuo *TagUpdateOne) RemovePosts(a ...*Article) *TagUpdateOne
RemovePosts removes "posts" edges to Article entities.
func (*TagUpdateOne) Save ¶
func (tuo *TagUpdateOne) Save(ctx context.Context) (*Tag, error)
Save executes the query and returns the updated Tag entity.
func (*TagUpdateOne) SaveX ¶
func (tuo *TagUpdateOne) SaveX(ctx context.Context) *Tag
SaveX is like Save, but panics if an error occurs.
func (*TagUpdateOne) Select ¶
func (tuo *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) SetCreatedAt ¶
func (tuo *TagUpdateOne) SetCreatedAt(t time.Time) *TagUpdateOne
SetCreatedAt sets the "created_at" field.
func (*TagUpdateOne) SetName ¶
func (tuo *TagUpdateOne) SetName(s string) *TagUpdateOne
SetName sets the "name" field.
func (*TagUpdateOne) SetNillableCreatedAt ¶
func (tuo *TagUpdateOne) SetNillableCreatedAt(t *time.Time) *TagUpdateOne
SetNillableCreatedAt sets the "created_at" field if the given value is not nil.
func (*TagUpdateOne) SetNillableName ¶
func (tuo *TagUpdateOne) SetNillableName(s *string) *TagUpdateOne
SetNillableName sets the "name" field if the given value is not nil.
func (*TagUpdateOne) SetNillableSlug ¶
func (tuo *TagUpdateOne) SetNillableSlug(s *string) *TagUpdateOne
SetNillableSlug sets the "slug" field if the given value is not nil.
func (*TagUpdateOne) SetNillableUpdatedAt ¶
func (tuo *TagUpdateOne) SetNillableUpdatedAt(t *time.Time) *TagUpdateOne
SetNillableUpdatedAt sets the "updated_at" field if the given value is not nil.
func (*TagUpdateOne) SetSlug ¶
func (tuo *TagUpdateOne) SetSlug(s string) *TagUpdateOne
SetSlug sets the "slug" field.
func (*TagUpdateOne) SetUpdatedAt ¶
func (tuo *TagUpdateOne) SetUpdatedAt(t time.Time) *TagUpdateOne
SetUpdatedAt sets the "updated_at" field.
func (*TagUpdateOne) Where ¶
func (tuo *TagUpdateOne) Where(ps ...predicate.Tag) *TagUpdateOne
Where appends a list predicates to the TagUpdate builder.
type TraverseFunc ¶
type TraverseFunc = ent.TraverseFunc
ent aliases to avoid import conflicts in user's code.
type Tx ¶
type Tx struct { // Article is the client for interacting with the Article builders. Article *ArticleClient // Comment is the client for interacting with the Comment builders. Comment *CommentClient // Tag is the client for interacting with the Tag builders. Tag *TagClient // contains filtered or unexported fields }
Tx is a transactional client that is created by calling Client.Tx().
func TxFromContext ¶
TxFromContext returns a Tx stored inside a context, or nil if there isn't one.
func (*Tx) OnRollback ¶
func (tx *Tx) OnRollback(f RollbackHook)
OnRollback adds a hook to call on rollback.
type ValidationError ¶
type ValidationError struct { Name string // Field or edge name. // contains filtered or unexported fields }
ValidationError returns when validating a field or edge fails.
func (*ValidationError) Error ¶
func (e *ValidationError) Error() string
Error implements the error interface.
func (*ValidationError) Unwrap ¶
func (e *ValidationError) Unwrap() error
Unwrap implements the errors.Wrapper interface.