Documentation
¶
Index ¶
- Constants
- 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) 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) 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 (agb *ArticleGroupBy) Bool(ctx context.Context) (_ bool, err error)
- func (agb *ArticleGroupBy) BoolX(ctx context.Context) bool
- func (agb *ArticleGroupBy) Bools(ctx context.Context) ([]bool, error)
- func (agb *ArticleGroupBy) BoolsX(ctx context.Context) []bool
- func (agb *ArticleGroupBy) Float64(ctx context.Context) (_ float64, err error)
- func (agb *ArticleGroupBy) Float64X(ctx context.Context) float64
- func (agb *ArticleGroupBy) Float64s(ctx context.Context) ([]float64, error)
- func (agb *ArticleGroupBy) Float64sX(ctx context.Context) []float64
- func (agb *ArticleGroupBy) Int(ctx context.Context) (_ int, err error)
- func (agb *ArticleGroupBy) IntX(ctx context.Context) int
- func (agb *ArticleGroupBy) Ints(ctx context.Context) ([]int, error)
- func (agb *ArticleGroupBy) IntsX(ctx context.Context) []int
- func (agb *ArticleGroupBy) Scan(ctx context.Context, v interface{}) error
- func (agb *ArticleGroupBy) ScanX(ctx context.Context, v interface{})
- func (agb *ArticleGroupBy) String(ctx context.Context) (_ string, err error)
- func (agb *ArticleGroupBy) StringX(ctx context.Context) string
- func (agb *ArticleGroupBy) Strings(ctx context.Context) ([]string, error)
- func (agb *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) 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) 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)
- type ArticleQuery
- 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) ([]int64, 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 ...OrderFunc) *ArticleQuery
- func (aq *ArticleQuery) QueryComments() *CommentQuery
- func (aq *ArticleQuery) QueryTags() *TagQuery
- func (aq *ArticleQuery) Select(field string, fields ...string) *ArticleSelect
- 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) Bool(ctx context.Context) (_ bool, err error)
- func (as *ArticleSelect) BoolX(ctx context.Context) bool
- func (as *ArticleSelect) Bools(ctx context.Context) ([]bool, error)
- func (as *ArticleSelect) BoolsX(ctx context.Context) []bool
- func (as *ArticleSelect) Float64(ctx context.Context) (_ float64, err error)
- func (as *ArticleSelect) Float64X(ctx context.Context) float64
- func (as *ArticleSelect) Float64s(ctx context.Context) ([]float64, error)
- func (as *ArticleSelect) Float64sX(ctx context.Context) []float64
- func (as *ArticleSelect) Int(ctx context.Context) (_ int, err error)
- func (as *ArticleSelect) IntX(ctx context.Context) int
- func (as *ArticleSelect) Ints(ctx context.Context) ([]int, error)
- func (as *ArticleSelect) IntsX(ctx context.Context) []int
- func (as *ArticleSelect) Scan(ctx context.Context, v interface{}) error
- func (as *ArticleSelect) ScanX(ctx context.Context, v interface{})
- func (as *ArticleSelect) String(ctx context.Context) (_ string, err error)
- func (as *ArticleSelect) StringX(ctx context.Context) string
- func (as *ArticleSelect) Strings(ctx context.Context) ([]string, error)
- func (as *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) SetNillableCreatedAt(t *time.Time) *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) SetContent(s string) *ArticleUpdateOne
- func (auo *ArticleUpdateOne) SetCreatedAt(t time.Time) *ArticleUpdateOne
- func (auo *ArticleUpdateOne) SetNillableCreatedAt(t *time.Time) *ArticleUpdateOne
- func (auo *ArticleUpdateOne) SetNillableUpdatedAt(t *time.Time) *ArticleUpdateOne
- func (auo *ArticleUpdateOne) SetTitle(s string) *ArticleUpdateOne
- func (auo *ArticleUpdateOne) SetUpdatedAt(t time.Time) *ArticleUpdateOne
- type Articles
- type Client
- 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) 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) 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 (cgb *CommentGroupBy) Bool(ctx context.Context) (_ bool, err error)
- func (cgb *CommentGroupBy) BoolX(ctx context.Context) bool
- func (cgb *CommentGroupBy) Bools(ctx context.Context) ([]bool, error)
- func (cgb *CommentGroupBy) BoolsX(ctx context.Context) []bool
- func (cgb *CommentGroupBy) Float64(ctx context.Context) (_ float64, err error)
- func (cgb *CommentGroupBy) Float64X(ctx context.Context) float64
- func (cgb *CommentGroupBy) Float64s(ctx context.Context) ([]float64, error)
- func (cgb *CommentGroupBy) Float64sX(ctx context.Context) []float64
- func (cgb *CommentGroupBy) Int(ctx context.Context) (_ int, err error)
- func (cgb *CommentGroupBy) IntX(ctx context.Context) int
- func (cgb *CommentGroupBy) Ints(ctx context.Context) ([]int, error)
- func (cgb *CommentGroupBy) IntsX(ctx context.Context) []int
- func (cgb *CommentGroupBy) Scan(ctx context.Context, v interface{}) error
- func (cgb *CommentGroupBy) ScanX(ctx context.Context, v interface{})
- func (cgb *CommentGroupBy) String(ctx context.Context) (_ string, err error)
- func (cgb *CommentGroupBy) StringX(ctx context.Context) string
- func (cgb *CommentGroupBy) Strings(ctx context.Context) ([]string, error)
- func (cgb *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) 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) 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)
- type CommentQuery
- 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) ([]int64, 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 ...OrderFunc) *CommentQuery
- func (cq *CommentQuery) QueryPost() *ArticleQuery
- func (cq *CommentQuery) Select(field string, fields ...string) *CommentSelect
- func (cq *CommentQuery) Where(ps ...predicate.Comment) *CommentQuery
- func (cq *CommentQuery) WithPost(opts ...func(*ArticleQuery)) *CommentQuery
- type CommentSelect
- func (cs *CommentSelect) Bool(ctx context.Context) (_ bool, err error)
- func (cs *CommentSelect) BoolX(ctx context.Context) bool
- func (cs *CommentSelect) Bools(ctx context.Context) ([]bool, error)
- func (cs *CommentSelect) BoolsX(ctx context.Context) []bool
- func (cs *CommentSelect) Float64(ctx context.Context) (_ float64, err error)
- func (cs *CommentSelect) Float64X(ctx context.Context) float64
- func (cs *CommentSelect) Float64s(ctx context.Context) ([]float64, error)
- func (cs *CommentSelect) Float64sX(ctx context.Context) []float64
- func (cs *CommentSelect) Int(ctx context.Context) (_ int, err error)
- func (cs *CommentSelect) IntX(ctx context.Context) int
- func (cs *CommentSelect) Ints(ctx context.Context) ([]int, error)
- func (cs *CommentSelect) IntsX(ctx context.Context) []int
- func (cs *CommentSelect) Scan(ctx context.Context, v interface{}) error
- func (cs *CommentSelect) ScanX(ctx context.Context, v interface{})
- func (cs *CommentSelect) String(ctx context.Context) (_ string, err error)
- func (cs *CommentSelect) StringX(ctx context.Context) string
- func (cs *CommentSelect) Strings(ctx context.Context) ([]string, error)
- func (cs *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) SetNillableCreatedAt(t *time.Time) *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) SetContent(s string) *CommentUpdateOne
- func (cuo *CommentUpdateOne) SetCreatedAt(t time.Time) *CommentUpdateOne
- func (cuo *CommentUpdateOne) SetName(s string) *CommentUpdateOne
- func (cuo *CommentUpdateOne) SetNillableCreatedAt(t *time.Time) *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
- type Comments
- type CommitFunc
- type CommitHook
- type Committer
- type ConstraintError
- type Hook
- type MutateFunc
- type Mutation
- type Mutator
- type NotFoundError
- type NotLoadedError
- type NotSingularError
- type Op
- type Option
- type OrderFunc
- type Policy
- type Query
- 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) 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) 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 (tgb *TagGroupBy) Bool(ctx context.Context) (_ bool, err error)
- func (tgb *TagGroupBy) BoolX(ctx context.Context) bool
- func (tgb *TagGroupBy) Bools(ctx context.Context) ([]bool, error)
- func (tgb *TagGroupBy) BoolsX(ctx context.Context) []bool
- func (tgb *TagGroupBy) Float64(ctx context.Context) (_ float64, err error)
- func (tgb *TagGroupBy) Float64X(ctx context.Context) float64
- func (tgb *TagGroupBy) Float64s(ctx context.Context) ([]float64, error)
- func (tgb *TagGroupBy) Float64sX(ctx context.Context) []float64
- func (tgb *TagGroupBy) Int(ctx context.Context) (_ int, err error)
- func (tgb *TagGroupBy) IntX(ctx context.Context) int
- func (tgb *TagGroupBy) Ints(ctx context.Context) ([]int, error)
- func (tgb *TagGroupBy) IntsX(ctx context.Context) []int
- func (tgb *TagGroupBy) Scan(ctx context.Context, v interface{}) error
- func (tgb *TagGroupBy) ScanX(ctx context.Context, v interface{})
- func (tgb *TagGroupBy) String(ctx context.Context) (_ string, err error)
- func (tgb *TagGroupBy) StringX(ctx context.Context) string
- func (tgb *TagGroupBy) Strings(ctx context.Context) ([]string, error)
- func (tgb *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) 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) 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)
- type TagQuery
- 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) ([]int64, 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 ...OrderFunc) *TagQuery
- func (tq *TagQuery) QueryPosts() *ArticleQuery
- func (tq *TagQuery) Select(field string, fields ...string) *TagSelect
- func (tq *TagQuery) Where(ps ...predicate.Tag) *TagQuery
- func (tq *TagQuery) WithPosts(opts ...func(*ArticleQuery)) *TagQuery
- type TagSelect
- func (ts *TagSelect) Bool(ctx context.Context) (_ bool, err error)
- func (ts *TagSelect) BoolX(ctx context.Context) bool
- func (ts *TagSelect) Bools(ctx context.Context) ([]bool, error)
- func (ts *TagSelect) BoolsX(ctx context.Context) []bool
- func (ts *TagSelect) Float64(ctx context.Context) (_ float64, err error)
- func (ts *TagSelect) Float64X(ctx context.Context) float64
- func (ts *TagSelect) Float64s(ctx context.Context) ([]float64, error)
- func (ts *TagSelect) Float64sX(ctx context.Context) []float64
- func (ts *TagSelect) Int(ctx context.Context) (_ int, err error)
- func (ts *TagSelect) IntX(ctx context.Context) int
- func (ts *TagSelect) Ints(ctx context.Context) ([]int, error)
- func (ts *TagSelect) IntsX(ctx context.Context) []int
- func (ts *TagSelect) Scan(ctx context.Context, v interface{}) error
- func (ts *TagSelect) ScanX(ctx context.Context, v interface{})
- func (ts *TagSelect) String(ctx context.Context) (_ string, err error)
- func (ts *TagSelect) StringX(ctx context.Context) string
- func (ts *TagSelect) Strings(ctx context.Context) ([]string, error)
- func (ts *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) 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) SetCreatedAt(t time.Time) *TagUpdateOne
- func (tuo *TagUpdateOne) SetName(s string) *TagUpdateOne
- func (tuo *TagUpdateOne) SetNillableCreatedAt(t *time.Time) *TagUpdateOne
- func (tuo *TagUpdateOne) SetNillableUpdatedAt(t *time.Time) *TagUpdateOne
- func (tuo *TagUpdateOne) SetSlug(s string) *TagUpdateOne
- func (tuo *TagUpdateOne) SetUpdatedAt(t time.Time) *TagUpdateOne
- type Tags
- 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 ¶
This section is empty.
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 validaton 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 create builder for Article.
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 delete builder for the given entity.
func (*ArticleClient) DeleteOneID ¶
func (c *ArticleClient) DeleteOneID(id int64) *ArticleDeleteOne
DeleteOneID returns a delete builder for the given 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) 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) 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.
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 adds a new predicate 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.
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 ¶
func (agb *ArticleGroupBy) Bool(ctx context.Context) (_ bool, err error)
Bool returns a single bool from a group-by query. It is only allowed when executing a group-by query with one field.
func (*ArticleGroupBy) BoolX ¶
func (agb *ArticleGroupBy) BoolX(ctx context.Context) bool
BoolX is like Bool, but panics if an error occurs.
func (*ArticleGroupBy) Bools ¶
func (agb *ArticleGroupBy) Bools(ctx context.Context) ([]bool, error)
Bools returns list of bools from group-by. It is only allowed when executing a group-by query with one field.
func (*ArticleGroupBy) BoolsX ¶
func (agb *ArticleGroupBy) BoolsX(ctx context.Context) []bool
BoolsX is like Bools, but panics if an error occurs.
func (*ArticleGroupBy) Float64 ¶
func (agb *ArticleGroupBy) Float64(ctx context.Context) (_ float64, err error)
Float64 returns a single float64 from a group-by query. It is only allowed when executing a group-by query with one field.
func (*ArticleGroupBy) Float64X ¶
func (agb *ArticleGroupBy) Float64X(ctx context.Context) float64
Float64X is like Float64, but panics if an error occurs.
func (*ArticleGroupBy) Float64s ¶
func (agb *ArticleGroupBy) Float64s(ctx context.Context) ([]float64, error)
Float64s returns list of float64s from group-by. It is only allowed when executing a group-by query with one field.
func (*ArticleGroupBy) Float64sX ¶
func (agb *ArticleGroupBy) Float64sX(ctx context.Context) []float64
Float64sX is like Float64s, but panics if an error occurs.
func (*ArticleGroupBy) Int ¶
func (agb *ArticleGroupBy) Int(ctx context.Context) (_ int, err error)
Int returns a single int from a group-by query. It is only allowed when executing a group-by query with one field.
func (*ArticleGroupBy) IntX ¶
func (agb *ArticleGroupBy) IntX(ctx context.Context) int
IntX is like Int, but panics if an error occurs.
func (*ArticleGroupBy) Ints ¶
func (agb *ArticleGroupBy) Ints(ctx context.Context) ([]int, error)
Ints returns list of ints from group-by. It is only allowed when executing a group-by query with one field.
func (*ArticleGroupBy) IntsX ¶
func (agb *ArticleGroupBy) IntsX(ctx context.Context) []int
IntsX is like Ints, but panics if an error occurs.
func (*ArticleGroupBy) Scan ¶
func (agb *ArticleGroupBy) Scan(ctx context.Context, v interface{}) error
Scan applies the group-by query and scans the result into the given value.
func (*ArticleGroupBy) ScanX ¶
func (agb *ArticleGroupBy) ScanX(ctx context.Context, v interface{})
ScanX is like Scan, but panics if an error occurs.
func (*ArticleGroupBy) String ¶
func (agb *ArticleGroupBy) String(ctx context.Context) (_ string, err error)
String returns a single string from a group-by query. It is only allowed when executing a group-by query with one field.
func (*ArticleGroupBy) StringX ¶
func (agb *ArticleGroupBy) StringX(ctx context.Context) string
StringX is like String, but panics if an error occurs.
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 returns 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.
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) 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 returns 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).
type ArticleQuery ¶
type ArticleQuery struct {
// contains filtered or unexported fields
}
ArticleQuery is the builder for querying Article entities.
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) ([]int64, 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 adds a limit step to the query.
func (*ArticleQuery) Offset ¶
func (aq *ArticleQuery) Offset(offset int) *ArticleQuery
Offset adds an offset step to the query.
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 exactly one Article entity is not 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 exactly one Article ID is not 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 ...OrderFunc) *ArticleQuery
Order adds an order step to the query.
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(field string, 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) 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) Bool ¶
func (as *ArticleSelect) Bool(ctx context.Context) (_ bool, err error)
Bool returns a single bool from a selector. It is only allowed when selecting one field.
func (*ArticleSelect) BoolX ¶
func (as *ArticleSelect) BoolX(ctx context.Context) bool
BoolX is like Bool, but panics if an error occurs.
func (*ArticleSelect) Bools ¶
func (as *ArticleSelect) Bools(ctx context.Context) ([]bool, error)
Bools returns list of bools from a selector. It is only allowed when selecting one field.
func (*ArticleSelect) BoolsX ¶
func (as *ArticleSelect) BoolsX(ctx context.Context) []bool
BoolsX is like Bools, but panics if an error occurs.
func (*ArticleSelect) Float64 ¶
func (as *ArticleSelect) Float64(ctx context.Context) (_ float64, err error)
Float64 returns a single float64 from a selector. It is only allowed when selecting one field.
func (*ArticleSelect) Float64X ¶
func (as *ArticleSelect) Float64X(ctx context.Context) float64
Float64X is like Float64, but panics if an error occurs.
func (*ArticleSelect) Float64s ¶
func (as *ArticleSelect) Float64s(ctx context.Context) ([]float64, error)
Float64s returns list of float64s from a selector. It is only allowed when selecting one field.
func (*ArticleSelect) Float64sX ¶
func (as *ArticleSelect) Float64sX(ctx context.Context) []float64
Float64sX is like Float64s, but panics if an error occurs.
func (*ArticleSelect) Int ¶
func (as *ArticleSelect) Int(ctx context.Context) (_ int, err error)
Int returns a single int from a selector. It is only allowed when selecting one field.
func (*ArticleSelect) IntX ¶
func (as *ArticleSelect) IntX(ctx context.Context) int
IntX is like Int, but panics if an error occurs.
func (*ArticleSelect) Ints ¶
func (as *ArticleSelect) Ints(ctx context.Context) ([]int, error)
Ints returns list of ints from a selector. It is only allowed when selecting one field.
func (*ArticleSelect) IntsX ¶
func (as *ArticleSelect) IntsX(ctx context.Context) []int
IntsX is like Ints, but panics if an error occurs.
func (*ArticleSelect) Scan ¶
func (as *ArticleSelect) Scan(ctx context.Context, v interface{}) error
Scan applies the selector query and scans the result into the given value.
func (*ArticleSelect) ScanX ¶
func (as *ArticleSelect) ScanX(ctx context.Context, v interface{})
ScanX is like Scan, but panics if an error occurs.
func (*ArticleSelect) String ¶
func (as *ArticleSelect) String(ctx context.Context) (_ string, err error)
String returns a single string from a selector. It is only allowed when selecting one field.
func (*ArticleSelect) StringX ¶
func (as *ArticleSelect) StringX(ctx context.Context) string
StringX is like String, but panics if an error occurs.
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) SetNillableCreatedAt ¶
func (au *ArticleUpdate) SetNillableCreatedAt(t *time.Time) *ArticleUpdate
SetNillableCreatedAt sets the "created_at" 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 adds a new predicate for 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) 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) SetNillableCreatedAt ¶
func (auo *ArticleUpdateOne) SetNillableCreatedAt(t *time.Time) *ArticleUpdateOne
SetNillableCreatedAt sets the "created_at" 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.
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)
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 create builder for Comment.
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 delete builder for the given entity.
func (*CommentClient) DeleteOneID ¶
func (c *CommentClient) DeleteOneID(id int64) *CommentDeleteOne
DeleteOneID returns a delete builder for the given 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) 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) 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.
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 adds a new predicate 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.
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 ¶
func (cgb *CommentGroupBy) Bool(ctx context.Context) (_ bool, err error)
Bool returns a single bool from a group-by query. It is only allowed when executing a group-by query with one field.
func (*CommentGroupBy) BoolX ¶
func (cgb *CommentGroupBy) BoolX(ctx context.Context) bool
BoolX is like Bool, but panics if an error occurs.
func (*CommentGroupBy) Bools ¶
func (cgb *CommentGroupBy) Bools(ctx context.Context) ([]bool, error)
Bools returns list of bools from group-by. It is only allowed when executing a group-by query with one field.
func (*CommentGroupBy) BoolsX ¶
func (cgb *CommentGroupBy) BoolsX(ctx context.Context) []bool
BoolsX is like Bools, but panics if an error occurs.
func (*CommentGroupBy) Float64 ¶
func (cgb *CommentGroupBy) Float64(ctx context.Context) (_ float64, err error)
Float64 returns a single float64 from a group-by query. It is only allowed when executing a group-by query with one field.
func (*CommentGroupBy) Float64X ¶
func (cgb *CommentGroupBy) Float64X(ctx context.Context) float64
Float64X is like Float64, but panics if an error occurs.
func (*CommentGroupBy) Float64s ¶
func (cgb *CommentGroupBy) Float64s(ctx context.Context) ([]float64, error)
Float64s returns list of float64s from group-by. It is only allowed when executing a group-by query with one field.
func (*CommentGroupBy) Float64sX ¶
func (cgb *CommentGroupBy) Float64sX(ctx context.Context) []float64
Float64sX is like Float64s, but panics if an error occurs.
func (*CommentGroupBy) Int ¶
func (cgb *CommentGroupBy) Int(ctx context.Context) (_ int, err error)
Int returns a single int from a group-by query. It is only allowed when executing a group-by query with one field.
func (*CommentGroupBy) IntX ¶
func (cgb *CommentGroupBy) IntX(ctx context.Context) int
IntX is like Int, but panics if an error occurs.
func (*CommentGroupBy) Ints ¶
func (cgb *CommentGroupBy) Ints(ctx context.Context) ([]int, error)
Ints returns list of ints from group-by. It is only allowed when executing a group-by query with one field.
func (*CommentGroupBy) IntsX ¶
func (cgb *CommentGroupBy) IntsX(ctx context.Context) []int
IntsX is like Ints, but panics if an error occurs.
func (*CommentGroupBy) Scan ¶
func (cgb *CommentGroupBy) Scan(ctx context.Context, v interface{}) error
Scan applies the group-by query and scans the result into the given value.
func (*CommentGroupBy) ScanX ¶
func (cgb *CommentGroupBy) ScanX(ctx context.Context, v interface{})
ScanX is like Scan, but panics if an error occurs.
func (*CommentGroupBy) String ¶
func (cgb *CommentGroupBy) String(ctx context.Context) (_ string, err error)
String returns a single string from a group-by query. It is only allowed when executing a group-by query with one field.
func (*CommentGroupBy) StringX ¶
func (cgb *CommentGroupBy) StringX(ctx context.Context) string
StringX is like String, but panics if an error occurs.
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.
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 returns 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) 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).
type CommentQuery ¶
type CommentQuery struct {
// contains filtered or unexported fields
}
CommentQuery is the builder for querying Comment entities.
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) ([]int64, 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 adds a limit step to the query.
func (*CommentQuery) Offset ¶
func (cq *CommentQuery) Offset(offset int) *CommentQuery
Offset adds an offset step to the query.
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 exactly one Comment entity is not 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 exactly one Comment ID is not 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 ...OrderFunc) *CommentQuery
Order adds an order step to the query.
func (*CommentQuery) QueryPost ¶
func (cq *CommentQuery) QueryPost() *ArticleQuery
QueryPost chains the current query on the "post" edge.
func (*CommentQuery) Select ¶
func (cq *CommentQuery) Select(field string, 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) 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) Bool ¶
func (cs *CommentSelect) Bool(ctx context.Context) (_ bool, err error)
Bool returns a single bool from a selector. It is only allowed when selecting one field.
func (*CommentSelect) BoolX ¶
func (cs *CommentSelect) BoolX(ctx context.Context) bool
BoolX is like Bool, but panics if an error occurs.
func (*CommentSelect) Bools ¶
func (cs *CommentSelect) Bools(ctx context.Context) ([]bool, error)
Bools returns list of bools from a selector. It is only allowed when selecting one field.
func (*CommentSelect) BoolsX ¶
func (cs *CommentSelect) BoolsX(ctx context.Context) []bool
BoolsX is like Bools, but panics if an error occurs.
func (*CommentSelect) Float64 ¶
func (cs *CommentSelect) Float64(ctx context.Context) (_ float64, err error)
Float64 returns a single float64 from a selector. It is only allowed when selecting one field.
func (*CommentSelect) Float64X ¶
func (cs *CommentSelect) Float64X(ctx context.Context) float64
Float64X is like Float64, but panics if an error occurs.
func (*CommentSelect) Float64s ¶
func (cs *CommentSelect) Float64s(ctx context.Context) ([]float64, error)
Float64s returns list of float64s from a selector. It is only allowed when selecting one field.
func (*CommentSelect) Float64sX ¶
func (cs *CommentSelect) Float64sX(ctx context.Context) []float64
Float64sX is like Float64s, but panics if an error occurs.
func (*CommentSelect) Int ¶
func (cs *CommentSelect) Int(ctx context.Context) (_ int, err error)
Int returns a single int from a selector. It is only allowed when selecting one field.
func (*CommentSelect) IntX ¶
func (cs *CommentSelect) IntX(ctx context.Context) int
IntX is like Int, but panics if an error occurs.
func (*CommentSelect) Ints ¶
func (cs *CommentSelect) Ints(ctx context.Context) ([]int, error)
Ints returns list of ints from a selector. It is only allowed when selecting one field.
func (*CommentSelect) IntsX ¶
func (cs *CommentSelect) IntsX(ctx context.Context) []int
IntsX is like Ints, but panics if an error occurs.
func (*CommentSelect) Scan ¶
func (cs *CommentSelect) Scan(ctx context.Context, v interface{}) error
Scan applies the selector query and scans the result into the given value.
func (*CommentSelect) ScanX ¶
func (cs *CommentSelect) ScanX(ctx context.Context, v interface{})
ScanX is like Scan, but panics if an error occurs.
func (*CommentSelect) String ¶
func (cs *CommentSelect) String(ctx context.Context) (_ string, err error)
String returns a single string from a selector. It is only allowed when selecting one field.
func (*CommentSelect) StringX ¶
func (cs *CommentSelect) StringX(ctx context.Context) string
StringX is like String, but panics if an error occurs.
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) SetNillableCreatedAt ¶
func (cu *CommentUpdate) SetNillableCreatedAt(t *time.Time) *CommentUpdate
SetNillableCreatedAt sets the "created_at" 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 adds a new predicate for 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) 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) SetNillableCreatedAt ¶
func (cuo *CommentUpdateOne) SetNillableCreatedAt(t *time.Time) *CommentUpdateOne
SetNillableCreatedAt sets the "created_at" 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.
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(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 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 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(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 Rollbacker 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 delete builder for the given entity.
func (*TagClient) DeleteOneID ¶
func (c *TagClient) DeleteOneID(id int64) *TagDeleteOne
DeleteOneID returns a delete builder for the given id.
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.
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.
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 ¶
func (tgb *TagGroupBy) Bool(ctx context.Context) (_ bool, err error)
Bool returns a single bool from a group-by query. It is only allowed when executing a group-by query with one field.
func (*TagGroupBy) BoolX ¶
func (tgb *TagGroupBy) BoolX(ctx context.Context) bool
BoolX is like Bool, but panics if an error occurs.
func (*TagGroupBy) Bools ¶
func (tgb *TagGroupBy) Bools(ctx context.Context) ([]bool, error)
Bools returns list of bools from group-by. It is only allowed when executing a group-by query with one field.
func (*TagGroupBy) BoolsX ¶
func (tgb *TagGroupBy) BoolsX(ctx context.Context) []bool
BoolsX is like Bools, but panics if an error occurs.
func (*TagGroupBy) Float64 ¶
func (tgb *TagGroupBy) Float64(ctx context.Context) (_ float64, err error)
Float64 returns a single float64 from a group-by query. It is only allowed when executing a group-by query with one field.
func (*TagGroupBy) Float64X ¶
func (tgb *TagGroupBy) Float64X(ctx context.Context) float64
Float64X is like Float64, but panics if an error occurs.
func (*TagGroupBy) Float64s ¶
func (tgb *TagGroupBy) Float64s(ctx context.Context) ([]float64, error)
Float64s returns list of float64s from group-by. It is only allowed when executing a group-by query with one field.
func (*TagGroupBy) Float64sX ¶
func (tgb *TagGroupBy) Float64sX(ctx context.Context) []float64
Float64sX is like Float64s, but panics if an error occurs.
func (*TagGroupBy) Int ¶
func (tgb *TagGroupBy) Int(ctx context.Context) (_ int, err error)
Int returns a single int from a group-by query. It is only allowed when executing a group-by query with one field.
func (*TagGroupBy) IntX ¶
func (tgb *TagGroupBy) IntX(ctx context.Context) int
IntX is like Int, but panics if an error occurs.
func (*TagGroupBy) Ints ¶
func (tgb *TagGroupBy) Ints(ctx context.Context) ([]int, error)
Ints returns list of ints from group-by. It is only allowed when executing a group-by query with one field.
func (*TagGroupBy) IntsX ¶
func (tgb *TagGroupBy) IntsX(ctx context.Context) []int
IntsX is like Ints, but panics if an error occurs.
func (*TagGroupBy) Scan ¶
func (tgb *TagGroupBy) Scan(ctx context.Context, v interface{}) error
Scan applies the group-by query and scans the result into the given value.
func (*TagGroupBy) ScanX ¶
func (tgb *TagGroupBy) ScanX(ctx context.Context, v interface{})
ScanX is like Scan, but panics if an error occurs.
func (*TagGroupBy) String ¶
func (tgb *TagGroupBy) String(ctx context.Context) (_ string, err error)
String returns a single string from a group-by query. It is only allowed when executing a group-by query with one field.
func (*TagGroupBy) StringX ¶
func (tgb *TagGroupBy) StringX(ctx context.Context) string
StringX is like String, but panics if an error occurs.
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.
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 returns 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) 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).
type TagQuery ¶
type TagQuery struct {
// contains filtered or unexported fields
}
TagQuery is the builder for querying Tag entities.
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 exactly one Tag entity is not 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 exactly one Tag ID is not found. Returns a *NotFoundError when no entities are found.
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) 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) 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) 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) 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) 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.
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 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.