Documentation ¶
Index ¶
- Constants
- Variables
- func Asc(fields ...string) func(*sql.Selector)
- func Desc(fields ...string) func(*sql.Selector)
- func IsConstraintError(err error) bool
- func IsNotFound(err error) bool
- func IsNotLoaded(err error) bool
- func IsNotSingular(err error) bool
- func IsValidationError(err error) bool
- func MaskNotFound(err error) error
- func NewContext(parent context.Context, c *Client) context.Context
- func NewTxContext(parent context.Context, tx *Tx) context.Context
- type AggregateFunc
- type Answer
- type AnswerClient
- func (c *AnswerClient) Create() *AnswerCreate
- func (c *AnswerClient) CreateBulk(builders ...*AnswerCreate) *AnswerCreateBulk
- func (c *AnswerClient) Delete() *AnswerDelete
- func (c *AnswerClient) DeleteOne(a *Answer) *AnswerDeleteOne
- func (c *AnswerClient) DeleteOneID(id int) *AnswerDeleteOne
- func (c *AnswerClient) Get(ctx context.Context, id int) (*Answer, error)
- func (c *AnswerClient) GetX(ctx context.Context, id int) *Answer
- func (c *AnswerClient) Hooks() []Hook
- func (c *AnswerClient) Intercept(interceptors ...Interceptor)
- func (c *AnswerClient) Interceptors() []Interceptor
- func (c *AnswerClient) MapCreateBulk(slice any, setFunc func(*AnswerCreate, int)) *AnswerCreateBulk
- func (c *AnswerClient) Query() *AnswerQuery
- func (c *AnswerClient) QueryAuthor(a *Answer) *UserQuery
- func (c *AnswerClient) QueryQuestion(a *Answer) *QuestionQuery
- func (c *AnswerClient) Update() *AnswerUpdate
- func (c *AnswerClient) UpdateOne(a *Answer) *AnswerUpdateOne
- func (c *AnswerClient) UpdateOneID(id int) *AnswerUpdateOne
- func (c *AnswerClient) Use(hooks ...Hook)
- type AnswerCreate
- func (ac *AnswerCreate) Exec(ctx context.Context) error
- func (ac *AnswerCreate) ExecX(ctx context.Context)
- func (ac *AnswerCreate) Mutation() *AnswerMutation
- func (ac *AnswerCreate) Save(ctx context.Context) (*Answer, error)
- func (ac *AnswerCreate) SaveX(ctx context.Context) *Answer
- func (ac *AnswerCreate) SetAuthor(u *User) *AnswerCreate
- func (ac *AnswerCreate) SetAuthorID(id int) *AnswerCreate
- func (ac *AnswerCreate) SetContent(s string) *AnswerCreate
- func (ac *AnswerCreate) SetCreatedAt(t time.Time) *AnswerCreate
- func (ac *AnswerCreate) SetNillableAuthorID(id *int) *AnswerCreate
- func (ac *AnswerCreate) SetNillableCreatedAt(t *time.Time) *AnswerCreate
- func (ac *AnswerCreate) SetNillableQuestionID(id *int) *AnswerCreate
- func (ac *AnswerCreate) SetQuestion(q *Question) *AnswerCreate
- func (ac *AnswerCreate) SetQuestionID(id int) *AnswerCreate
- type AnswerCreateBulk
- type AnswerDelete
- type AnswerDeleteOne
- type AnswerEdges
- type AnswerGroupBy
- func (agb *AnswerGroupBy) Aggregate(fns ...AggregateFunc) *AnswerGroupBy
- func (s *AnswerGroupBy) Bool(ctx context.Context) (_ bool, err error)
- func (s *AnswerGroupBy) BoolX(ctx context.Context) bool
- func (s *AnswerGroupBy) Bools(ctx context.Context) ([]bool, error)
- func (s *AnswerGroupBy) BoolsX(ctx context.Context) []bool
- func (s *AnswerGroupBy) Float64(ctx context.Context) (_ float64, err error)
- func (s *AnswerGroupBy) Float64X(ctx context.Context) float64
- func (s *AnswerGroupBy) Float64s(ctx context.Context) ([]float64, error)
- func (s *AnswerGroupBy) Float64sX(ctx context.Context) []float64
- func (s *AnswerGroupBy) Int(ctx context.Context) (_ int, err error)
- func (s *AnswerGroupBy) IntX(ctx context.Context) int
- func (s *AnswerGroupBy) Ints(ctx context.Context) ([]int, error)
- func (s *AnswerGroupBy) IntsX(ctx context.Context) []int
- func (agb *AnswerGroupBy) Scan(ctx context.Context, v any) error
- func (s *AnswerGroupBy) ScanX(ctx context.Context, v any)
- func (s *AnswerGroupBy) String(ctx context.Context) (_ string, err error)
- func (s *AnswerGroupBy) StringX(ctx context.Context) string
- func (s *AnswerGroupBy) Strings(ctx context.Context) ([]string, error)
- func (s *AnswerGroupBy) StringsX(ctx context.Context) []string
- type AnswerMutation
- func (m *AnswerMutation) AddField(name string, value ent.Value) error
- func (m *AnswerMutation) AddedEdges() []string
- func (m *AnswerMutation) AddedField(name string) (ent.Value, bool)
- func (m *AnswerMutation) AddedFields() []string
- func (m *AnswerMutation) AddedIDs(name string) []ent.Value
- func (m *AnswerMutation) AuthorCleared() bool
- func (m *AnswerMutation) AuthorID() (id int, exists bool)
- func (m *AnswerMutation) AuthorIDs() (ids []int)
- func (m *AnswerMutation) ClearAuthor()
- func (m *AnswerMutation) ClearEdge(name string) error
- func (m *AnswerMutation) ClearField(name string) error
- func (m *AnswerMutation) ClearQuestion()
- func (m *AnswerMutation) ClearedEdges() []string
- func (m *AnswerMutation) ClearedFields() []string
- func (m AnswerMutation) Client() *Client
- func (m *AnswerMutation) Content() (r string, exists bool)
- func (m *AnswerMutation) CreatedAt() (r time.Time, exists bool)
- func (m *AnswerMutation) EdgeCleared(name string) bool
- func (m *AnswerMutation) Field(name string) (ent.Value, bool)
- func (m *AnswerMutation) FieldCleared(name string) bool
- func (m *AnswerMutation) Fields() []string
- func (m *AnswerMutation) ID() (id int, exists bool)
- func (m *AnswerMutation) IDs(ctx context.Context) ([]int, error)
- func (m *AnswerMutation) OldContent(ctx context.Context) (v string, err error)
- func (m *AnswerMutation) OldCreatedAt(ctx context.Context) (v time.Time, err error)
- func (m *AnswerMutation) OldField(ctx context.Context, name string) (ent.Value, error)
- func (m *AnswerMutation) Op() Op
- func (m *AnswerMutation) QuestionCleared() bool
- func (m *AnswerMutation) QuestionID() (id int, exists bool)
- func (m *AnswerMutation) QuestionIDs() (ids []int)
- func (m *AnswerMutation) RemovedEdges() []string
- func (m *AnswerMutation) RemovedIDs(name string) []ent.Value
- func (m *AnswerMutation) ResetAuthor()
- func (m *AnswerMutation) ResetContent()
- func (m *AnswerMutation) ResetCreatedAt()
- func (m *AnswerMutation) ResetEdge(name string) error
- func (m *AnswerMutation) ResetField(name string) error
- func (m *AnswerMutation) ResetQuestion()
- func (m *AnswerMutation) SetAuthorID(id int)
- func (m *AnswerMutation) SetContent(s string)
- func (m *AnswerMutation) SetCreatedAt(t time.Time)
- func (m *AnswerMutation) SetField(name string, value ent.Value) error
- func (m *AnswerMutation) SetOp(op Op)
- func (m *AnswerMutation) SetQuestionID(id int)
- func (m AnswerMutation) Tx() (*Tx, error)
- func (m *AnswerMutation) Type() string
- func (m *AnswerMutation) Where(ps ...predicate.Answer)
- func (m *AnswerMutation) WhereP(ps ...func(*sql.Selector))
- type AnswerQuery
- func (aq *AnswerQuery) Aggregate(fns ...AggregateFunc) *AnswerSelect
- func (aq *AnswerQuery) All(ctx context.Context) ([]*Answer, error)
- func (aq *AnswerQuery) AllX(ctx context.Context) []*Answer
- func (aq *AnswerQuery) Clone() *AnswerQuery
- func (aq *AnswerQuery) Count(ctx context.Context) (int, error)
- func (aq *AnswerQuery) CountX(ctx context.Context) int
- func (aq *AnswerQuery) Exist(ctx context.Context) (bool, error)
- func (aq *AnswerQuery) ExistX(ctx context.Context) bool
- func (aq *AnswerQuery) First(ctx context.Context) (*Answer, error)
- func (aq *AnswerQuery) FirstID(ctx context.Context) (id int, err error)
- func (aq *AnswerQuery) FirstIDX(ctx context.Context) int
- func (aq *AnswerQuery) FirstX(ctx context.Context) *Answer
- func (aq *AnswerQuery) GroupBy(field string, fields ...string) *AnswerGroupBy
- func (aq *AnswerQuery) IDs(ctx context.Context) (ids []int, err error)
- func (aq *AnswerQuery) IDsX(ctx context.Context) []int
- func (aq *AnswerQuery) Limit(limit int) *AnswerQuery
- func (aq *AnswerQuery) Offset(offset int) *AnswerQuery
- func (aq *AnswerQuery) Only(ctx context.Context) (*Answer, error)
- func (aq *AnswerQuery) OnlyID(ctx context.Context) (id int, err error)
- func (aq *AnswerQuery) OnlyIDX(ctx context.Context) int
- func (aq *AnswerQuery) OnlyX(ctx context.Context) *Answer
- func (aq *AnswerQuery) Order(o ...answer.OrderOption) *AnswerQuery
- func (aq *AnswerQuery) QueryAuthor() *UserQuery
- func (aq *AnswerQuery) QueryQuestion() *QuestionQuery
- func (aq *AnswerQuery) Select(fields ...string) *AnswerSelect
- func (aq *AnswerQuery) Unique(unique bool) *AnswerQuery
- func (aq *AnswerQuery) Where(ps ...predicate.Answer) *AnswerQuery
- func (aq *AnswerQuery) WithAuthor(opts ...func(*UserQuery)) *AnswerQuery
- func (aq *AnswerQuery) WithQuestion(opts ...func(*QuestionQuery)) *AnswerQuery
- type AnswerSelect
- func (as *AnswerSelect) Aggregate(fns ...AggregateFunc) *AnswerSelect
- func (s *AnswerSelect) Bool(ctx context.Context) (_ bool, err error)
- func (s *AnswerSelect) BoolX(ctx context.Context) bool
- func (s *AnswerSelect) Bools(ctx context.Context) ([]bool, error)
- func (s *AnswerSelect) BoolsX(ctx context.Context) []bool
- func (s *AnswerSelect) Float64(ctx context.Context) (_ float64, err error)
- func (s *AnswerSelect) Float64X(ctx context.Context) float64
- func (s *AnswerSelect) Float64s(ctx context.Context) ([]float64, error)
- func (s *AnswerSelect) Float64sX(ctx context.Context) []float64
- func (s *AnswerSelect) Int(ctx context.Context) (_ int, err error)
- func (s *AnswerSelect) IntX(ctx context.Context) int
- func (s *AnswerSelect) Ints(ctx context.Context) ([]int, error)
- func (s *AnswerSelect) IntsX(ctx context.Context) []int
- func (as *AnswerSelect) Scan(ctx context.Context, v any) error
- func (s *AnswerSelect) ScanX(ctx context.Context, v any)
- func (s *AnswerSelect) String(ctx context.Context) (_ string, err error)
- func (s *AnswerSelect) StringX(ctx context.Context) string
- func (s *AnswerSelect) Strings(ctx context.Context) ([]string, error)
- func (s *AnswerSelect) StringsX(ctx context.Context) []string
- type AnswerUpdate
- func (au *AnswerUpdate) ClearAuthor() *AnswerUpdate
- func (au *AnswerUpdate) ClearQuestion() *AnswerUpdate
- func (au *AnswerUpdate) Exec(ctx context.Context) error
- func (au *AnswerUpdate) ExecX(ctx context.Context)
- func (au *AnswerUpdate) Mutation() *AnswerMutation
- func (au *AnswerUpdate) Save(ctx context.Context) (int, error)
- func (au *AnswerUpdate) SaveX(ctx context.Context) int
- func (au *AnswerUpdate) SetAuthor(u *User) *AnswerUpdate
- func (au *AnswerUpdate) SetAuthorID(id int) *AnswerUpdate
- func (au *AnswerUpdate) SetContent(s string) *AnswerUpdate
- func (au *AnswerUpdate) SetNillableAuthorID(id *int) *AnswerUpdate
- func (au *AnswerUpdate) SetNillableQuestionID(id *int) *AnswerUpdate
- func (au *AnswerUpdate) SetQuestion(q *Question) *AnswerUpdate
- func (au *AnswerUpdate) SetQuestionID(id int) *AnswerUpdate
- func (au *AnswerUpdate) Where(ps ...predicate.Answer) *AnswerUpdate
- type AnswerUpdateOne
- func (auo *AnswerUpdateOne) ClearAuthor() *AnswerUpdateOne
- func (auo *AnswerUpdateOne) ClearQuestion() *AnswerUpdateOne
- func (auo *AnswerUpdateOne) Exec(ctx context.Context) error
- func (auo *AnswerUpdateOne) ExecX(ctx context.Context)
- func (auo *AnswerUpdateOne) Mutation() *AnswerMutation
- func (auo *AnswerUpdateOne) Save(ctx context.Context) (*Answer, error)
- func (auo *AnswerUpdateOne) SaveX(ctx context.Context) *Answer
- func (auo *AnswerUpdateOne) Select(field string, fields ...string) *AnswerUpdateOne
- func (auo *AnswerUpdateOne) SetAuthor(u *User) *AnswerUpdateOne
- func (auo *AnswerUpdateOne) SetAuthorID(id int) *AnswerUpdateOne
- func (auo *AnswerUpdateOne) SetContent(s string) *AnswerUpdateOne
- func (auo *AnswerUpdateOne) SetNillableAuthorID(id *int) *AnswerUpdateOne
- func (auo *AnswerUpdateOne) SetNillableQuestionID(id *int) *AnswerUpdateOne
- func (auo *AnswerUpdateOne) SetQuestion(q *Question) *AnswerUpdateOne
- func (auo *AnswerUpdateOne) SetQuestionID(id int) *AnswerUpdateOne
- func (auo *AnswerUpdateOne) Where(ps ...predicate.Answer) *AnswerUpdateOne
- type Answers
- type Client
- func (c *Client) BeginTx(ctx context.Context, opts *sql.TxOptions) (*Tx, error)
- func (c *Client) Close() error
- func (c *Client) Debug() *Client
- func (c *Client) Intercept(interceptors ...Interceptor)
- func (c *Client) Mutate(ctx context.Context, m Mutation) (Value, error)
- func (c *Client) Tx(ctx context.Context) (*Tx, error)
- func (c *Client) Use(hooks ...Hook)
- type CommitFunc
- type CommitHook
- type Committer
- type ConstraintError
- type Hook
- type InterceptFunc
- type Interceptor
- type MutateFunc
- type Mutation
- type Mutator
- type NotFoundError
- type NotLoadedError
- type NotSingularError
- type Op
- type Option
- type OrderFunc
- type Policy
- type Querier
- type QuerierFunc
- type Query
- type QueryContext
- type Question
- func (q *Question) QueryAnswers() *AnswerQuery
- func (q *Question) QueryAuthor() *UserQuery
- func (q *Question) QueryTags() *TagQuery
- func (q *Question) String() string
- func (q *Question) Unwrap() *Question
- func (q *Question) Update() *QuestionUpdateOne
- func (q *Question) Value(name string) (ent.Value, error)
- type QuestionClient
- func (c *QuestionClient) Create() *QuestionCreate
- func (c *QuestionClient) CreateBulk(builders ...*QuestionCreate) *QuestionCreateBulk
- func (c *QuestionClient) Delete() *QuestionDelete
- func (c *QuestionClient) DeleteOne(q *Question) *QuestionDeleteOne
- func (c *QuestionClient) DeleteOneID(id int) *QuestionDeleteOne
- func (c *QuestionClient) Get(ctx context.Context, id int) (*Question, error)
- func (c *QuestionClient) GetX(ctx context.Context, id int) *Question
- func (c *QuestionClient) Hooks() []Hook
- func (c *QuestionClient) Intercept(interceptors ...Interceptor)
- func (c *QuestionClient) Interceptors() []Interceptor
- func (c *QuestionClient) MapCreateBulk(slice any, setFunc func(*QuestionCreate, int)) *QuestionCreateBulk
- func (c *QuestionClient) Query() *QuestionQuery
- func (c *QuestionClient) QueryAnswers(q *Question) *AnswerQuery
- func (c *QuestionClient) QueryAuthor(q *Question) *UserQuery
- func (c *QuestionClient) QueryTags(q *Question) *TagQuery
- func (c *QuestionClient) Update() *QuestionUpdate
- func (c *QuestionClient) UpdateOne(q *Question) *QuestionUpdateOne
- func (c *QuestionClient) UpdateOneID(id int) *QuestionUpdateOne
- func (c *QuestionClient) Use(hooks ...Hook)
- type QuestionCreate
- func (qc *QuestionCreate) AddAnswerIDs(ids ...int) *QuestionCreate
- func (qc *QuestionCreate) AddAnswers(a ...*Answer) *QuestionCreate
- func (qc *QuestionCreate) AddTagIDs(ids ...int) *QuestionCreate
- func (qc *QuestionCreate) AddTags(t ...*Tag) *QuestionCreate
- func (qc *QuestionCreate) Exec(ctx context.Context) error
- func (qc *QuestionCreate) ExecX(ctx context.Context)
- func (qc *QuestionCreate) Mutation() *QuestionMutation
- func (qc *QuestionCreate) Save(ctx context.Context) (*Question, error)
- func (qc *QuestionCreate) SaveX(ctx context.Context) *Question
- func (qc *QuestionCreate) SetAuthor(u *User) *QuestionCreate
- func (qc *QuestionCreate) SetAuthorID(id int) *QuestionCreate
- func (qc *QuestionCreate) SetContent(s string) *QuestionCreate
- func (qc *QuestionCreate) SetCreatedAt(t time.Time) *QuestionCreate
- func (qc *QuestionCreate) SetNillableAuthorID(id *int) *QuestionCreate
- func (qc *QuestionCreate) SetNillableCreatedAt(t *time.Time) *QuestionCreate
- func (qc *QuestionCreate) SetTitle(s string) *QuestionCreate
- type QuestionCreateBulk
- type QuestionDelete
- type QuestionDeleteOne
- type QuestionEdges
- type QuestionGroupBy
- func (qgb *QuestionGroupBy) Aggregate(fns ...AggregateFunc) *QuestionGroupBy
- func (s *QuestionGroupBy) Bool(ctx context.Context) (_ bool, err error)
- func (s *QuestionGroupBy) BoolX(ctx context.Context) bool
- func (s *QuestionGroupBy) Bools(ctx context.Context) ([]bool, error)
- func (s *QuestionGroupBy) BoolsX(ctx context.Context) []bool
- func (s *QuestionGroupBy) Float64(ctx context.Context) (_ float64, err error)
- func (s *QuestionGroupBy) Float64X(ctx context.Context) float64
- func (s *QuestionGroupBy) Float64s(ctx context.Context) ([]float64, error)
- func (s *QuestionGroupBy) Float64sX(ctx context.Context) []float64
- func (s *QuestionGroupBy) Int(ctx context.Context) (_ int, err error)
- func (s *QuestionGroupBy) IntX(ctx context.Context) int
- func (s *QuestionGroupBy) Ints(ctx context.Context) ([]int, error)
- func (s *QuestionGroupBy) IntsX(ctx context.Context) []int
- func (qgb *QuestionGroupBy) Scan(ctx context.Context, v any) error
- func (s *QuestionGroupBy) ScanX(ctx context.Context, v any)
- func (s *QuestionGroupBy) String(ctx context.Context) (_ string, err error)
- func (s *QuestionGroupBy) StringX(ctx context.Context) string
- func (s *QuestionGroupBy) Strings(ctx context.Context) ([]string, error)
- func (s *QuestionGroupBy) StringsX(ctx context.Context) []string
- type QuestionMutation
- func (m *QuestionMutation) AddAnswerIDs(ids ...int)
- func (m *QuestionMutation) AddField(name string, value ent.Value) error
- func (m *QuestionMutation) AddTagIDs(ids ...int)
- func (m *QuestionMutation) AddedEdges() []string
- func (m *QuestionMutation) AddedField(name string) (ent.Value, bool)
- func (m *QuestionMutation) AddedFields() []string
- func (m *QuestionMutation) AddedIDs(name string) []ent.Value
- func (m *QuestionMutation) AnswersCleared() bool
- func (m *QuestionMutation) AnswersIDs() (ids []int)
- func (m *QuestionMutation) AuthorCleared() bool
- func (m *QuestionMutation) AuthorID() (id int, exists bool)
- func (m *QuestionMutation) AuthorIDs() (ids []int)
- func (m *QuestionMutation) ClearAnswers()
- func (m *QuestionMutation) ClearAuthor()
- func (m *QuestionMutation) ClearEdge(name string) error
- func (m *QuestionMutation) ClearField(name string) error
- func (m *QuestionMutation) ClearTags()
- func (m *QuestionMutation) ClearedEdges() []string
- func (m *QuestionMutation) ClearedFields() []string
- func (m QuestionMutation) Client() *Client
- func (m *QuestionMutation) Content() (r string, exists bool)
- func (m *QuestionMutation) CreatedAt() (r time.Time, exists bool)
- func (m *QuestionMutation) EdgeCleared(name string) bool
- func (m *QuestionMutation) Field(name string) (ent.Value, bool)
- func (m *QuestionMutation) FieldCleared(name string) bool
- func (m *QuestionMutation) Fields() []string
- func (m *QuestionMutation) ID() (id int, exists bool)
- func (m *QuestionMutation) IDs(ctx context.Context) ([]int, error)
- func (m *QuestionMutation) OldContent(ctx context.Context) (v string, err error)
- func (m *QuestionMutation) OldCreatedAt(ctx context.Context) (v time.Time, err error)
- func (m *QuestionMutation) OldField(ctx context.Context, name string) (ent.Value, error)
- func (m *QuestionMutation) OldTitle(ctx context.Context) (v string, err error)
- func (m *QuestionMutation) Op() Op
- func (m *QuestionMutation) RemoveAnswerIDs(ids ...int)
- func (m *QuestionMutation) RemoveTagIDs(ids ...int)
- func (m *QuestionMutation) RemovedAnswersIDs() (ids []int)
- func (m *QuestionMutation) RemovedEdges() []string
- func (m *QuestionMutation) RemovedIDs(name string) []ent.Value
- func (m *QuestionMutation) RemovedTagsIDs() (ids []int)
- func (m *QuestionMutation) ResetAnswers()
- func (m *QuestionMutation) ResetAuthor()
- func (m *QuestionMutation) ResetContent()
- func (m *QuestionMutation) ResetCreatedAt()
- func (m *QuestionMutation) ResetEdge(name string) error
- func (m *QuestionMutation) ResetField(name string) error
- func (m *QuestionMutation) ResetTags()
- func (m *QuestionMutation) ResetTitle()
- func (m *QuestionMutation) SetAuthorID(id int)
- func (m *QuestionMutation) SetContent(s string)
- func (m *QuestionMutation) SetCreatedAt(t time.Time)
- func (m *QuestionMutation) SetField(name string, value ent.Value) error
- func (m *QuestionMutation) SetOp(op Op)
- func (m *QuestionMutation) SetTitle(s string)
- func (m *QuestionMutation) TagsCleared() bool
- func (m *QuestionMutation) TagsIDs() (ids []int)
- func (m *QuestionMutation) Title() (r string, exists bool)
- func (m QuestionMutation) Tx() (*Tx, error)
- func (m *QuestionMutation) Type() string
- func (m *QuestionMutation) Where(ps ...predicate.Question)
- func (m *QuestionMutation) WhereP(ps ...func(*sql.Selector))
- type QuestionQuery
- func (qq *QuestionQuery) Aggregate(fns ...AggregateFunc) *QuestionSelect
- func (qq *QuestionQuery) All(ctx context.Context) ([]*Question, error)
- func (qq *QuestionQuery) AllX(ctx context.Context) []*Question
- func (qq *QuestionQuery) Clone() *QuestionQuery
- func (qq *QuestionQuery) Count(ctx context.Context) (int, error)
- func (qq *QuestionQuery) CountX(ctx context.Context) int
- func (qq *QuestionQuery) Exist(ctx context.Context) (bool, error)
- func (qq *QuestionQuery) ExistX(ctx context.Context) bool
- func (qq *QuestionQuery) First(ctx context.Context) (*Question, error)
- func (qq *QuestionQuery) FirstID(ctx context.Context) (id int, err error)
- func (qq *QuestionQuery) FirstIDX(ctx context.Context) int
- func (qq *QuestionQuery) FirstX(ctx context.Context) *Question
- func (qq *QuestionQuery) GroupBy(field string, fields ...string) *QuestionGroupBy
- func (qq *QuestionQuery) IDs(ctx context.Context) (ids []int, err error)
- func (qq *QuestionQuery) IDsX(ctx context.Context) []int
- func (qq *QuestionQuery) Limit(limit int) *QuestionQuery
- func (qq *QuestionQuery) Offset(offset int) *QuestionQuery
- func (qq *QuestionQuery) Only(ctx context.Context) (*Question, error)
- func (qq *QuestionQuery) OnlyID(ctx context.Context) (id int, err error)
- func (qq *QuestionQuery) OnlyIDX(ctx context.Context) int
- func (qq *QuestionQuery) OnlyX(ctx context.Context) *Question
- func (qq *QuestionQuery) Order(o ...question.OrderOption) *QuestionQuery
- func (qq *QuestionQuery) QueryAnswers() *AnswerQuery
- func (qq *QuestionQuery) QueryAuthor() *UserQuery
- func (qq *QuestionQuery) QueryTags() *TagQuery
- func (qq *QuestionQuery) Select(fields ...string) *QuestionSelect
- func (qq *QuestionQuery) Unique(unique bool) *QuestionQuery
- func (qq *QuestionQuery) Where(ps ...predicate.Question) *QuestionQuery
- func (qq *QuestionQuery) WithAnswers(opts ...func(*AnswerQuery)) *QuestionQuery
- func (qq *QuestionQuery) WithAuthor(opts ...func(*UserQuery)) *QuestionQuery
- func (qq *QuestionQuery) WithTags(opts ...func(*TagQuery)) *QuestionQuery
- type QuestionSelect
- func (qs *QuestionSelect) Aggregate(fns ...AggregateFunc) *QuestionSelect
- func (s *QuestionSelect) Bool(ctx context.Context) (_ bool, err error)
- func (s *QuestionSelect) BoolX(ctx context.Context) bool
- func (s *QuestionSelect) Bools(ctx context.Context) ([]bool, error)
- func (s *QuestionSelect) BoolsX(ctx context.Context) []bool
- func (s *QuestionSelect) Float64(ctx context.Context) (_ float64, err error)
- func (s *QuestionSelect) Float64X(ctx context.Context) float64
- func (s *QuestionSelect) Float64s(ctx context.Context) ([]float64, error)
- func (s *QuestionSelect) Float64sX(ctx context.Context) []float64
- func (s *QuestionSelect) Int(ctx context.Context) (_ int, err error)
- func (s *QuestionSelect) IntX(ctx context.Context) int
- func (s *QuestionSelect) Ints(ctx context.Context) ([]int, error)
- func (s *QuestionSelect) IntsX(ctx context.Context) []int
- func (qs *QuestionSelect) Scan(ctx context.Context, v any) error
- func (s *QuestionSelect) ScanX(ctx context.Context, v any)
- func (s *QuestionSelect) String(ctx context.Context) (_ string, err error)
- func (s *QuestionSelect) StringX(ctx context.Context) string
- func (s *QuestionSelect) Strings(ctx context.Context) ([]string, error)
- func (s *QuestionSelect) StringsX(ctx context.Context) []string
- type QuestionUpdate
- func (qu *QuestionUpdate) AddAnswerIDs(ids ...int) *QuestionUpdate
- func (qu *QuestionUpdate) AddAnswers(a ...*Answer) *QuestionUpdate
- func (qu *QuestionUpdate) AddTagIDs(ids ...int) *QuestionUpdate
- func (qu *QuestionUpdate) AddTags(t ...*Tag) *QuestionUpdate
- func (qu *QuestionUpdate) ClearAnswers() *QuestionUpdate
- func (qu *QuestionUpdate) ClearAuthor() *QuestionUpdate
- func (qu *QuestionUpdate) ClearTags() *QuestionUpdate
- func (qu *QuestionUpdate) Exec(ctx context.Context) error
- func (qu *QuestionUpdate) ExecX(ctx context.Context)
- func (qu *QuestionUpdate) Mutation() *QuestionMutation
- func (qu *QuestionUpdate) RemoveAnswerIDs(ids ...int) *QuestionUpdate
- func (qu *QuestionUpdate) RemoveAnswers(a ...*Answer) *QuestionUpdate
- func (qu *QuestionUpdate) RemoveTagIDs(ids ...int) *QuestionUpdate
- func (qu *QuestionUpdate) RemoveTags(t ...*Tag) *QuestionUpdate
- func (qu *QuestionUpdate) Save(ctx context.Context) (int, error)
- func (qu *QuestionUpdate) SaveX(ctx context.Context) int
- func (qu *QuestionUpdate) SetAuthor(u *User) *QuestionUpdate
- func (qu *QuestionUpdate) SetAuthorID(id int) *QuestionUpdate
- func (qu *QuestionUpdate) SetContent(s string) *QuestionUpdate
- func (qu *QuestionUpdate) SetNillableAuthorID(id *int) *QuestionUpdate
- func (qu *QuestionUpdate) SetTitle(s string) *QuestionUpdate
- func (qu *QuestionUpdate) Where(ps ...predicate.Question) *QuestionUpdate
- type QuestionUpdateOne
- func (quo *QuestionUpdateOne) AddAnswerIDs(ids ...int) *QuestionUpdateOne
- func (quo *QuestionUpdateOne) AddAnswers(a ...*Answer) *QuestionUpdateOne
- func (quo *QuestionUpdateOne) AddTagIDs(ids ...int) *QuestionUpdateOne
- func (quo *QuestionUpdateOne) AddTags(t ...*Tag) *QuestionUpdateOne
- func (quo *QuestionUpdateOne) ClearAnswers() *QuestionUpdateOne
- func (quo *QuestionUpdateOne) ClearAuthor() *QuestionUpdateOne
- func (quo *QuestionUpdateOne) ClearTags() *QuestionUpdateOne
- func (quo *QuestionUpdateOne) Exec(ctx context.Context) error
- func (quo *QuestionUpdateOne) ExecX(ctx context.Context)
- func (quo *QuestionUpdateOne) Mutation() *QuestionMutation
- func (quo *QuestionUpdateOne) RemoveAnswerIDs(ids ...int) *QuestionUpdateOne
- func (quo *QuestionUpdateOne) RemoveAnswers(a ...*Answer) *QuestionUpdateOne
- func (quo *QuestionUpdateOne) RemoveTagIDs(ids ...int) *QuestionUpdateOne
- func (quo *QuestionUpdateOne) RemoveTags(t ...*Tag) *QuestionUpdateOne
- func (quo *QuestionUpdateOne) Save(ctx context.Context) (*Question, error)
- func (quo *QuestionUpdateOne) SaveX(ctx context.Context) *Question
- func (quo *QuestionUpdateOne) Select(field string, fields ...string) *QuestionUpdateOne
- func (quo *QuestionUpdateOne) SetAuthor(u *User) *QuestionUpdateOne
- func (quo *QuestionUpdateOne) SetAuthorID(id int) *QuestionUpdateOne
- func (quo *QuestionUpdateOne) SetContent(s string) *QuestionUpdateOne
- func (quo *QuestionUpdateOne) SetNillableAuthorID(id *int) *QuestionUpdateOne
- func (quo *QuestionUpdateOne) SetTitle(s string) *QuestionUpdateOne
- func (quo *QuestionUpdateOne) Where(ps ...predicate.Question) *QuestionUpdateOne
- type Questions
- 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 int) *TagDeleteOne
- func (c *TagClient) Get(ctx context.Context, id int) (*Tag, error)
- func (c *TagClient) GetX(ctx context.Context, id int) *Tag
- func (c *TagClient) Hooks() []Hook
- func (c *TagClient) Intercept(interceptors ...Interceptor)
- func (c *TagClient) Interceptors() []Interceptor
- func (c *TagClient) MapCreateBulk(slice any, setFunc func(*TagCreate, int)) *TagCreateBulk
- func (c *TagClient) Query() *TagQuery
- func (c *TagClient) QueryQuestions(t *Tag) *QuestionQuery
- func (c *TagClient) Update() *TagUpdate
- func (c *TagClient) UpdateOne(t *Tag) *TagUpdateOne
- func (c *TagClient) UpdateOneID(id int) *TagUpdateOne
- func (c *TagClient) Use(hooks ...Hook)
- type TagCreate
- func (tc *TagCreate) AddQuestionIDs(ids ...int) *TagCreate
- func (tc *TagCreate) AddQuestions(q ...*Question) *TagCreate
- func (tc *TagCreate) Exec(ctx context.Context) error
- func (tc *TagCreate) ExecX(ctx context.Context)
- func (tc *TagCreate) Mutation() *TagMutation
- func (tc *TagCreate) Save(ctx context.Context) (*Tag, error)
- func (tc *TagCreate) SaveX(ctx context.Context) *Tag
- func (tc *TagCreate) SetName(s string) *TagCreate
- type TagCreateBulk
- type TagDelete
- type TagDeleteOne
- type TagEdges
- type TagGroupBy
- func (tgb *TagGroupBy) Aggregate(fns ...AggregateFunc) *TagGroupBy
- func (s *TagGroupBy) Bool(ctx context.Context) (_ bool, err error)
- func (s *TagGroupBy) BoolX(ctx context.Context) bool
- func (s *TagGroupBy) Bools(ctx context.Context) ([]bool, error)
- func (s *TagGroupBy) BoolsX(ctx context.Context) []bool
- func (s *TagGroupBy) Float64(ctx context.Context) (_ float64, err error)
- func (s *TagGroupBy) Float64X(ctx context.Context) float64
- func (s *TagGroupBy) Float64s(ctx context.Context) ([]float64, error)
- func (s *TagGroupBy) Float64sX(ctx context.Context) []float64
- func (s *TagGroupBy) Int(ctx context.Context) (_ int, err error)
- func (s *TagGroupBy) IntX(ctx context.Context) int
- func (s *TagGroupBy) Ints(ctx context.Context) ([]int, error)
- func (s *TagGroupBy) IntsX(ctx context.Context) []int
- func (tgb *TagGroupBy) Scan(ctx context.Context, v any) error
- func (s *TagGroupBy) ScanX(ctx context.Context, v any)
- func (s *TagGroupBy) String(ctx context.Context) (_ string, err error)
- func (s *TagGroupBy) StringX(ctx context.Context) string
- func (s *TagGroupBy) Strings(ctx context.Context) ([]string, error)
- func (s *TagGroupBy) StringsX(ctx context.Context) []string
- type TagMutation
- func (m *TagMutation) AddField(name string, value ent.Value) error
- func (m *TagMutation) AddQuestionIDs(ids ...int)
- func (m *TagMutation) AddedEdges() []string
- func (m *TagMutation) AddedField(name string) (ent.Value, bool)
- func (m *TagMutation) AddedFields() []string
- func (m *TagMutation) AddedIDs(name string) []ent.Value
- func (m *TagMutation) ClearEdge(name string) error
- func (m *TagMutation) ClearField(name string) error
- func (m *TagMutation) ClearQuestions()
- func (m *TagMutation) ClearedEdges() []string
- func (m *TagMutation) ClearedFields() []string
- func (m TagMutation) Client() *Client
- func (m *TagMutation) EdgeCleared(name string) bool
- func (m *TagMutation) Field(name string) (ent.Value, bool)
- func (m *TagMutation) FieldCleared(name string) bool
- func (m *TagMutation) Fields() []string
- func (m *TagMutation) ID() (id int, exists bool)
- func (m *TagMutation) IDs(ctx context.Context) ([]int, error)
- func (m *TagMutation) Name() (r string, exists bool)
- func (m *TagMutation) OldField(ctx context.Context, name string) (ent.Value, error)
- func (m *TagMutation) OldName(ctx context.Context) (v string, err error)
- func (m *TagMutation) Op() Op
- func (m *TagMutation) QuestionsCleared() bool
- func (m *TagMutation) QuestionsIDs() (ids []int)
- func (m *TagMutation) RemoveQuestionIDs(ids ...int)
- func (m *TagMutation) RemovedEdges() []string
- func (m *TagMutation) RemovedIDs(name string) []ent.Value
- func (m *TagMutation) RemovedQuestionsIDs() (ids []int)
- func (m *TagMutation) ResetEdge(name string) error
- func (m *TagMutation) ResetField(name string) error
- func (m *TagMutation) ResetName()
- func (m *TagMutation) ResetQuestions()
- func (m *TagMutation) SetField(name string, value ent.Value) error
- func (m *TagMutation) SetName(s string)
- func (m *TagMutation) SetOp(op Op)
- func (m TagMutation) Tx() (*Tx, error)
- func (m *TagMutation) Type() string
- func (m *TagMutation) Where(ps ...predicate.Tag)
- func (m *TagMutation) WhereP(ps ...func(*sql.Selector))
- type TagQuery
- func (tq *TagQuery) Aggregate(fns ...AggregateFunc) *TagSelect
- func (tq *TagQuery) All(ctx context.Context) ([]*Tag, error)
- func (tq *TagQuery) AllX(ctx context.Context) []*Tag
- func (tq *TagQuery) Clone() *TagQuery
- func (tq *TagQuery) Count(ctx context.Context) (int, error)
- func (tq *TagQuery) CountX(ctx context.Context) int
- func (tq *TagQuery) Exist(ctx context.Context) (bool, error)
- func (tq *TagQuery) ExistX(ctx context.Context) bool
- func (tq *TagQuery) First(ctx context.Context) (*Tag, error)
- func (tq *TagQuery) FirstID(ctx context.Context) (id int, err error)
- func (tq *TagQuery) FirstIDX(ctx context.Context) int
- func (tq *TagQuery) FirstX(ctx context.Context) *Tag
- func (tq *TagQuery) GroupBy(field string, fields ...string) *TagGroupBy
- func (tq *TagQuery) IDs(ctx context.Context) (ids []int, err error)
- func (tq *TagQuery) IDsX(ctx context.Context) []int
- 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 int, err error)
- func (tq *TagQuery) OnlyIDX(ctx context.Context) int
- func (tq *TagQuery) OnlyX(ctx context.Context) *Tag
- func (tq *TagQuery) Order(o ...tag.OrderOption) *TagQuery
- func (tq *TagQuery) QueryQuestions() *QuestionQuery
- func (tq *TagQuery) Select(fields ...string) *TagSelect
- func (tq *TagQuery) Unique(unique bool) *TagQuery
- func (tq *TagQuery) Where(ps ...predicate.Tag) *TagQuery
- func (tq *TagQuery) WithQuestions(opts ...func(*QuestionQuery)) *TagQuery
- type TagSelect
- func (ts *TagSelect) Aggregate(fns ...AggregateFunc) *TagSelect
- func (s *TagSelect) Bool(ctx context.Context) (_ bool, err error)
- func (s *TagSelect) BoolX(ctx context.Context) bool
- func (s *TagSelect) Bools(ctx context.Context) ([]bool, error)
- func (s *TagSelect) BoolsX(ctx context.Context) []bool
- func (s *TagSelect) Float64(ctx context.Context) (_ float64, err error)
- func (s *TagSelect) Float64X(ctx context.Context) float64
- func (s *TagSelect) Float64s(ctx context.Context) ([]float64, error)
- func (s *TagSelect) Float64sX(ctx context.Context) []float64
- func (s *TagSelect) Int(ctx context.Context) (_ int, err error)
- func (s *TagSelect) IntX(ctx context.Context) int
- func (s *TagSelect) Ints(ctx context.Context) ([]int, error)
- func (s *TagSelect) IntsX(ctx context.Context) []int
- func (ts *TagSelect) Scan(ctx context.Context, v any) error
- func (s *TagSelect) ScanX(ctx context.Context, v any)
- func (s *TagSelect) String(ctx context.Context) (_ string, err error)
- func (s *TagSelect) StringX(ctx context.Context) string
- func (s *TagSelect) Strings(ctx context.Context) ([]string, error)
- func (s *TagSelect) StringsX(ctx context.Context) []string
- type TagUpdate
- func (tu *TagUpdate) AddQuestionIDs(ids ...int) *TagUpdate
- func (tu *TagUpdate) AddQuestions(q ...*Question) *TagUpdate
- func (tu *TagUpdate) ClearQuestions() *TagUpdate
- func (tu *TagUpdate) Exec(ctx context.Context) error
- func (tu *TagUpdate) ExecX(ctx context.Context)
- func (tu *TagUpdate) Mutation() *TagMutation
- func (tu *TagUpdate) RemoveQuestionIDs(ids ...int) *TagUpdate
- func (tu *TagUpdate) RemoveQuestions(q ...*Question) *TagUpdate
- func (tu *TagUpdate) Save(ctx context.Context) (int, error)
- func (tu *TagUpdate) SaveX(ctx context.Context) int
- func (tu *TagUpdate) SetName(s string) *TagUpdate
- func (tu *TagUpdate) Where(ps ...predicate.Tag) *TagUpdate
- type TagUpdateOne
- func (tuo *TagUpdateOne) AddQuestionIDs(ids ...int) *TagUpdateOne
- func (tuo *TagUpdateOne) AddQuestions(q ...*Question) *TagUpdateOne
- func (tuo *TagUpdateOne) ClearQuestions() *TagUpdateOne
- func (tuo *TagUpdateOne) Exec(ctx context.Context) error
- func (tuo *TagUpdateOne) ExecX(ctx context.Context)
- func (tuo *TagUpdateOne) Mutation() *TagMutation
- func (tuo *TagUpdateOne) RemoveQuestionIDs(ids ...int) *TagUpdateOne
- func (tuo *TagUpdateOne) RemoveQuestions(q ...*Question) *TagUpdateOne
- func (tuo *TagUpdateOne) Save(ctx context.Context) (*Tag, error)
- func (tuo *TagUpdateOne) SaveX(ctx context.Context) *Tag
- func (tuo *TagUpdateOne) Select(field string, fields ...string) *TagUpdateOne
- func (tuo *TagUpdateOne) SetName(s string) *TagUpdateOne
- func (tuo *TagUpdateOne) Where(ps ...predicate.Tag) *TagUpdateOne
- type Tags
- type TraverseFunc
- type Traverser
- type Tx
- type User
- type UserClient
- func (c *UserClient) Create() *UserCreate
- func (c *UserClient) CreateBulk(builders ...*UserCreate) *UserCreateBulk
- func (c *UserClient) Delete() *UserDelete
- func (c *UserClient) DeleteOne(u *User) *UserDeleteOne
- func (c *UserClient) DeleteOneID(id int) *UserDeleteOne
- func (c *UserClient) Get(ctx context.Context, id int) (*User, error)
- func (c *UserClient) GetX(ctx context.Context, id int) *User
- func (c *UserClient) Hooks() []Hook
- func (c *UserClient) Intercept(interceptors ...Interceptor)
- func (c *UserClient) Interceptors() []Interceptor
- func (c *UserClient) MapCreateBulk(slice any, setFunc func(*UserCreate, int)) *UserCreateBulk
- func (c *UserClient) Query() *UserQuery
- func (c *UserClient) QueryAnswers(u *User) *AnswerQuery
- func (c *UserClient) QueryQuestions(u *User) *QuestionQuery
- func (c *UserClient) QueryTags(u *User) *TagQuery
- func (c *UserClient) Update() *UserUpdate
- func (c *UserClient) UpdateOne(u *User) *UserUpdateOne
- func (c *UserClient) UpdateOneID(id int) *UserUpdateOne
- func (c *UserClient) Use(hooks ...Hook)
- type UserCreate
- func (uc *UserCreate) AddAnswerIDs(ids ...int) *UserCreate
- func (uc *UserCreate) AddAnswers(a ...*Answer) *UserCreate
- func (uc *UserCreate) AddQuestionIDs(ids ...int) *UserCreate
- func (uc *UserCreate) AddQuestions(q ...*Question) *UserCreate
- func (uc *UserCreate) AddTagIDs(ids ...int) *UserCreate
- func (uc *UserCreate) AddTags(t ...*Tag) *UserCreate
- func (uc *UserCreate) Exec(ctx context.Context) error
- func (uc *UserCreate) ExecX(ctx context.Context)
- func (uc *UserCreate) Mutation() *UserMutation
- func (uc *UserCreate) Save(ctx context.Context) (*User, error)
- func (uc *UserCreate) SaveX(ctx context.Context) *User
- func (uc *UserCreate) SetCreatedAt(t time.Time) *UserCreate
- func (uc *UserCreate) SetEmail(s string) *UserCreate
- func (uc *UserCreate) SetNillableCreatedAt(t *time.Time) *UserCreate
- func (uc *UserCreate) SetNillableSuperuser(b *bool) *UserCreate
- func (uc *UserCreate) SetPassword(s string) *UserCreate
- func (uc *UserCreate) SetSuperuser(b bool) *UserCreate
- func (uc *UserCreate) SetUsername(s string) *UserCreate
- type UserCreateBulk
- type UserDelete
- type UserDeleteOne
- type UserEdges
- type UserGroupBy
- func (ugb *UserGroupBy) Aggregate(fns ...AggregateFunc) *UserGroupBy
- func (s *UserGroupBy) Bool(ctx context.Context) (_ bool, err error)
- func (s *UserGroupBy) BoolX(ctx context.Context) bool
- func (s *UserGroupBy) Bools(ctx context.Context) ([]bool, error)
- func (s *UserGroupBy) BoolsX(ctx context.Context) []bool
- func (s *UserGroupBy) Float64(ctx context.Context) (_ float64, err error)
- func (s *UserGroupBy) Float64X(ctx context.Context) float64
- func (s *UserGroupBy) Float64s(ctx context.Context) ([]float64, error)
- func (s *UserGroupBy) Float64sX(ctx context.Context) []float64
- func (s *UserGroupBy) Int(ctx context.Context) (_ int, err error)
- func (s *UserGroupBy) IntX(ctx context.Context) int
- func (s *UserGroupBy) Ints(ctx context.Context) ([]int, error)
- func (s *UserGroupBy) IntsX(ctx context.Context) []int
- func (ugb *UserGroupBy) Scan(ctx context.Context, v any) error
- func (s *UserGroupBy) ScanX(ctx context.Context, v any)
- func (s *UserGroupBy) String(ctx context.Context) (_ string, err error)
- func (s *UserGroupBy) StringX(ctx context.Context) string
- func (s *UserGroupBy) Strings(ctx context.Context) ([]string, error)
- func (s *UserGroupBy) StringsX(ctx context.Context) []string
- type UserMutation
- func (m *UserMutation) AddAnswerIDs(ids ...int)
- func (m *UserMutation) AddField(name string, value ent.Value) error
- func (m *UserMutation) AddQuestionIDs(ids ...int)
- func (m *UserMutation) AddTagIDs(ids ...int)
- func (m *UserMutation) AddedEdges() []string
- func (m *UserMutation) AddedField(name string) (ent.Value, bool)
- func (m *UserMutation) AddedFields() []string
- func (m *UserMutation) AddedIDs(name string) []ent.Value
- func (m *UserMutation) AnswersCleared() bool
- func (m *UserMutation) AnswersIDs() (ids []int)
- func (m *UserMutation) ClearAnswers()
- func (m *UserMutation) ClearEdge(name string) error
- func (m *UserMutation) ClearField(name string) error
- func (m *UserMutation) ClearQuestions()
- func (m *UserMutation) ClearTags()
- func (m *UserMutation) ClearedEdges() []string
- func (m *UserMutation) ClearedFields() []string
- func (m UserMutation) Client() *Client
- func (m *UserMutation) CreatedAt() (r time.Time, exists bool)
- func (m *UserMutation) EdgeCleared(name string) bool
- func (m *UserMutation) Email() (r string, exists bool)
- func (m *UserMutation) Field(name string) (ent.Value, bool)
- func (m *UserMutation) FieldCleared(name string) bool
- func (m *UserMutation) Fields() []string
- func (m *UserMutation) ID() (id int, exists bool)
- func (m *UserMutation) IDs(ctx context.Context) ([]int, error)
- func (m *UserMutation) OldCreatedAt(ctx context.Context) (v time.Time, err error)
- func (m *UserMutation) OldEmail(ctx context.Context) (v string, err error)
- func (m *UserMutation) OldField(ctx context.Context, name string) (ent.Value, error)
- func (m *UserMutation) OldPassword(ctx context.Context) (v string, err error)
- func (m *UserMutation) OldSuperuser(ctx context.Context) (v bool, err error)
- func (m *UserMutation) OldUsername(ctx context.Context) (v string, err error)
- func (m *UserMutation) Op() Op
- func (m *UserMutation) Password() (r string, exists bool)
- func (m *UserMutation) QuestionsCleared() bool
- func (m *UserMutation) QuestionsIDs() (ids []int)
- func (m *UserMutation) RemoveAnswerIDs(ids ...int)
- func (m *UserMutation) RemoveQuestionIDs(ids ...int)
- func (m *UserMutation) RemoveTagIDs(ids ...int)
- func (m *UserMutation) RemovedAnswersIDs() (ids []int)
- func (m *UserMutation) RemovedEdges() []string
- func (m *UserMutation) RemovedIDs(name string) []ent.Value
- func (m *UserMutation) RemovedQuestionsIDs() (ids []int)
- func (m *UserMutation) RemovedTagsIDs() (ids []int)
- func (m *UserMutation) ResetAnswers()
- func (m *UserMutation) ResetCreatedAt()
- func (m *UserMutation) ResetEdge(name string) error
- func (m *UserMutation) ResetEmail()
- func (m *UserMutation) ResetField(name string) error
- func (m *UserMutation) ResetPassword()
- func (m *UserMutation) ResetQuestions()
- func (m *UserMutation) ResetSuperuser()
- func (m *UserMutation) ResetTags()
- func (m *UserMutation) ResetUsername()
- func (m *UserMutation) SetCreatedAt(t time.Time)
- func (m *UserMutation) SetEmail(s string)
- func (m *UserMutation) SetField(name string, value ent.Value) error
- func (m *UserMutation) SetOp(op Op)
- func (m *UserMutation) SetPassword(s string)
- func (m *UserMutation) SetSuperuser(b bool)
- func (m *UserMutation) SetUsername(s string)
- func (m *UserMutation) Superuser() (r bool, exists bool)
- func (m *UserMutation) TagsCleared() bool
- func (m *UserMutation) TagsIDs() (ids []int)
- func (m UserMutation) Tx() (*Tx, error)
- func (m *UserMutation) Type() string
- func (m *UserMutation) Username() (r string, exists bool)
- func (m *UserMutation) Where(ps ...predicate.User)
- func (m *UserMutation) WhereP(ps ...func(*sql.Selector))
- type UserQuery
- func (uq *UserQuery) Aggregate(fns ...AggregateFunc) *UserSelect
- func (uq *UserQuery) All(ctx context.Context) ([]*User, error)
- func (uq *UserQuery) AllX(ctx context.Context) []*User
- func (uq *UserQuery) Clone() *UserQuery
- func (uq *UserQuery) Count(ctx context.Context) (int, error)
- func (uq *UserQuery) CountX(ctx context.Context) int
- func (uq *UserQuery) Exist(ctx context.Context) (bool, error)
- func (uq *UserQuery) ExistX(ctx context.Context) bool
- func (uq *UserQuery) First(ctx context.Context) (*User, error)
- func (uq *UserQuery) FirstID(ctx context.Context) (id int, err error)
- func (uq *UserQuery) FirstIDX(ctx context.Context) int
- func (uq *UserQuery) FirstX(ctx context.Context) *User
- func (uq *UserQuery) GroupBy(field string, fields ...string) *UserGroupBy
- func (uq *UserQuery) IDs(ctx context.Context) (ids []int, err error)
- func (uq *UserQuery) IDsX(ctx context.Context) []int
- func (uq *UserQuery) Limit(limit int) *UserQuery
- func (uq *UserQuery) Offset(offset int) *UserQuery
- func (uq *UserQuery) Only(ctx context.Context) (*User, error)
- func (uq *UserQuery) OnlyID(ctx context.Context) (id int, err error)
- func (uq *UserQuery) OnlyIDX(ctx context.Context) int
- func (uq *UserQuery) OnlyX(ctx context.Context) *User
- func (uq *UserQuery) Order(o ...user.OrderOption) *UserQuery
- func (uq *UserQuery) QueryAnswers() *AnswerQuery
- func (uq *UserQuery) QueryQuestions() *QuestionQuery
- func (uq *UserQuery) QueryTags() *TagQuery
- func (uq *UserQuery) Select(fields ...string) *UserSelect
- func (uq *UserQuery) Unique(unique bool) *UserQuery
- func (uq *UserQuery) Where(ps ...predicate.User) *UserQuery
- func (uq *UserQuery) WithAnswers(opts ...func(*AnswerQuery)) *UserQuery
- func (uq *UserQuery) WithQuestions(opts ...func(*QuestionQuery)) *UserQuery
- func (uq *UserQuery) WithTags(opts ...func(*TagQuery)) *UserQuery
- type UserSelect
- func (us *UserSelect) Aggregate(fns ...AggregateFunc) *UserSelect
- func (s *UserSelect) Bool(ctx context.Context) (_ bool, err error)
- func (s *UserSelect) BoolX(ctx context.Context) bool
- func (s *UserSelect) Bools(ctx context.Context) ([]bool, error)
- func (s *UserSelect) BoolsX(ctx context.Context) []bool
- func (s *UserSelect) Float64(ctx context.Context) (_ float64, err error)
- func (s *UserSelect) Float64X(ctx context.Context) float64
- func (s *UserSelect) Float64s(ctx context.Context) ([]float64, error)
- func (s *UserSelect) Float64sX(ctx context.Context) []float64
- func (s *UserSelect) Int(ctx context.Context) (_ int, err error)
- func (s *UserSelect) IntX(ctx context.Context) int
- func (s *UserSelect) Ints(ctx context.Context) ([]int, error)
- func (s *UserSelect) IntsX(ctx context.Context) []int
- func (us *UserSelect) Scan(ctx context.Context, v any) error
- func (s *UserSelect) ScanX(ctx context.Context, v any)
- func (s *UserSelect) String(ctx context.Context) (_ string, err error)
- func (s *UserSelect) StringX(ctx context.Context) string
- func (s *UserSelect) Strings(ctx context.Context) ([]string, error)
- func (s *UserSelect) StringsX(ctx context.Context) []string
- type UserUpdate
- func (uu *UserUpdate) AddAnswerIDs(ids ...int) *UserUpdate
- func (uu *UserUpdate) AddAnswers(a ...*Answer) *UserUpdate
- func (uu *UserUpdate) AddQuestionIDs(ids ...int) *UserUpdate
- func (uu *UserUpdate) AddQuestions(q ...*Question) *UserUpdate
- func (uu *UserUpdate) AddTagIDs(ids ...int) *UserUpdate
- func (uu *UserUpdate) AddTags(t ...*Tag) *UserUpdate
- func (uu *UserUpdate) ClearAnswers() *UserUpdate
- func (uu *UserUpdate) ClearQuestions() *UserUpdate
- func (uu *UserUpdate) ClearTags() *UserUpdate
- func (uu *UserUpdate) Exec(ctx context.Context) error
- func (uu *UserUpdate) ExecX(ctx context.Context)
- func (uu *UserUpdate) Mutation() *UserMutation
- func (uu *UserUpdate) RemoveAnswerIDs(ids ...int) *UserUpdate
- func (uu *UserUpdate) RemoveAnswers(a ...*Answer) *UserUpdate
- func (uu *UserUpdate) RemoveQuestionIDs(ids ...int) *UserUpdate
- func (uu *UserUpdate) RemoveQuestions(q ...*Question) *UserUpdate
- func (uu *UserUpdate) RemoveTagIDs(ids ...int) *UserUpdate
- func (uu *UserUpdate) RemoveTags(t ...*Tag) *UserUpdate
- func (uu *UserUpdate) Save(ctx context.Context) (int, error)
- func (uu *UserUpdate) SaveX(ctx context.Context) int
- func (uu *UserUpdate) SetEmail(s string) *UserUpdate
- func (uu *UserUpdate) SetNillableSuperuser(b *bool) *UserUpdate
- func (uu *UserUpdate) SetPassword(s string) *UserUpdate
- func (uu *UserUpdate) SetSuperuser(b bool) *UserUpdate
- func (uu *UserUpdate) SetUsername(s string) *UserUpdate
- func (uu *UserUpdate) Where(ps ...predicate.User) *UserUpdate
- type UserUpdateOne
- func (uuo *UserUpdateOne) AddAnswerIDs(ids ...int) *UserUpdateOne
- func (uuo *UserUpdateOne) AddAnswers(a ...*Answer) *UserUpdateOne
- func (uuo *UserUpdateOne) AddQuestionIDs(ids ...int) *UserUpdateOne
- func (uuo *UserUpdateOne) AddQuestions(q ...*Question) *UserUpdateOne
- func (uuo *UserUpdateOne) AddTagIDs(ids ...int) *UserUpdateOne
- func (uuo *UserUpdateOne) AddTags(t ...*Tag) *UserUpdateOne
- func (uuo *UserUpdateOne) ClearAnswers() *UserUpdateOne
- func (uuo *UserUpdateOne) ClearQuestions() *UserUpdateOne
- func (uuo *UserUpdateOne) ClearTags() *UserUpdateOne
- func (uuo *UserUpdateOne) Exec(ctx context.Context) error
- func (uuo *UserUpdateOne) ExecX(ctx context.Context)
- func (uuo *UserUpdateOne) Mutation() *UserMutation
- func (uuo *UserUpdateOne) RemoveAnswerIDs(ids ...int) *UserUpdateOne
- func (uuo *UserUpdateOne) RemoveAnswers(a ...*Answer) *UserUpdateOne
- func (uuo *UserUpdateOne) RemoveQuestionIDs(ids ...int) *UserUpdateOne
- func (uuo *UserUpdateOne) RemoveQuestions(q ...*Question) *UserUpdateOne
- func (uuo *UserUpdateOne) RemoveTagIDs(ids ...int) *UserUpdateOne
- func (uuo *UserUpdateOne) RemoveTags(t ...*Tag) *UserUpdateOne
- func (uuo *UserUpdateOne) Save(ctx context.Context) (*User, error)
- func (uuo *UserUpdateOne) SaveX(ctx context.Context) *User
- func (uuo *UserUpdateOne) Select(field string, fields ...string) *UserUpdateOne
- func (uuo *UserUpdateOne) SetEmail(s string) *UserUpdateOne
- func (uuo *UserUpdateOne) SetNillableSuperuser(b *bool) *UserUpdateOne
- func (uuo *UserUpdateOne) SetPassword(s string) *UserUpdateOne
- func (uuo *UserUpdateOne) SetSuperuser(b bool) *UserUpdateOne
- func (uuo *UserUpdateOne) SetUsername(s string) *UserUpdateOne
- func (uuo *UserUpdateOne) Where(ps ...predicate.User) *UserUpdateOne
- type Users
- type ValidationError
- type Value
Constants ¶
const ( // Operation types. OpCreate = ent.OpCreate OpDelete = ent.OpDelete OpDeleteOne = ent.OpDeleteOne OpUpdate = ent.OpUpdate OpUpdateOne = ent.OpUpdateOne // Node types. TypeAnswer = "Answer" TypeQuestion = "Question" TypeTag = "Tag" TypeUser = "User" )
Variables ¶
var ErrTxStarted = errors.New("ent: cannot start a transaction within a transaction")
ErrTxStarted is returned when trying to start a new transaction from a transactional client.
Functions ¶
func IsConstraintError ¶
IsConstraintError returns a boolean indicating whether the error is a constraint failure.
func IsNotFound ¶
IsNotFound returns a boolean indicating whether the error is a not found error.
func IsNotLoaded ¶
IsNotLoaded returns a boolean indicating whether the error is a not loaded error.
func IsNotSingular ¶
IsNotSingular returns a boolean indicating whether the error is a not singular error.
func IsValidationError ¶
IsValidationError returns a boolean indicating whether the error is a validation error.
func NewContext ¶
NewContext returns a new context with the given Client attached.
Types ¶
type AggregateFunc ¶
AggregateFunc applies an aggregation step on the group-by traversal/selector.
func As ¶
func As(fn AggregateFunc, end string) AggregateFunc
As is a pseudo aggregation function for renaming another other functions with custom names. For example:
GroupBy(field1, field2). Aggregate(ent.As(ent.Sum(field1), "sum_field1"), (ent.As(ent.Sum(field2), "sum_field2")). Scan(ctx, &v)
func Count ¶
func Count() AggregateFunc
Count applies the "count" aggregation function on each group.
func Max ¶
func Max(field string) AggregateFunc
Max applies the "max" aggregation function on the given field of each group.
func Mean ¶
func Mean(field string) AggregateFunc
Mean applies the "mean" aggregation function on the given field of each group.
func Min ¶
func Min(field string) AggregateFunc
Min applies the "min" aggregation function on the given field of each group.
func Sum ¶
func Sum(field string) AggregateFunc
Sum applies the "sum" aggregation function on the given field of each group.
type Answer ¶
type Answer struct { // ID of the ent. ID int `json:"id,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"` // Edges holds the relations/edges for other nodes in the graph. // The values are being populated by the AnswerQuery when eager-loading is set. Edges AnswerEdges `json:"edges"` // contains filtered or unexported fields }
Answer is the model entity for the Answer schema.
func (*Answer) QueryAuthor ¶
QueryAuthor queries the "author" edge of the Answer entity.
func (*Answer) QueryQuestion ¶
func (a *Answer) QueryQuestion() *QuestionQuery
QueryQuestion queries the "question" edge of the Answer entity.
func (*Answer) Unwrap ¶
Unwrap unwraps the Answer 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 (*Answer) Update ¶
func (a *Answer) Update() *AnswerUpdateOne
Update returns a builder for updating this Answer. Note that you need to call Answer.Unwrap() before calling this method if this Answer was returned from a transaction, and the transaction was committed or rolled back.
type AnswerClient ¶
type AnswerClient struct {
// contains filtered or unexported fields
}
AnswerClient is a client for the Answer schema.
func NewAnswerClient ¶
func NewAnswerClient(c config) *AnswerClient
NewAnswerClient returns a client for the Answer from the given config.
func (*AnswerClient) Create ¶
func (c *AnswerClient) Create() *AnswerCreate
Create returns a builder for creating a Answer entity.
func (*AnswerClient) CreateBulk ¶
func (c *AnswerClient) CreateBulk(builders ...*AnswerCreate) *AnswerCreateBulk
CreateBulk returns a builder for creating a bulk of Answer entities.
func (*AnswerClient) Delete ¶
func (c *AnswerClient) Delete() *AnswerDelete
Delete returns a delete builder for Answer.
func (*AnswerClient) DeleteOne ¶
func (c *AnswerClient) DeleteOne(a *Answer) *AnswerDeleteOne
DeleteOne returns a builder for deleting the given entity.
func (*AnswerClient) DeleteOneID ¶
func (c *AnswerClient) DeleteOneID(id int) *AnswerDeleteOne
DeleteOneID returns a builder for deleting the given entity by its id.
func (*AnswerClient) GetX ¶
func (c *AnswerClient) GetX(ctx context.Context, id int) *Answer
GetX is like Get, but panics if an error occurs.
func (*AnswerClient) Intercept ¶
func (c *AnswerClient) Intercept(interceptors ...Interceptor)
Intercept adds a list of query interceptors to the interceptors stack. A call to `Intercept(f, g, h)` equals to `answer.Intercept(f(g(h())))`.
func (*AnswerClient) Interceptors ¶
func (c *AnswerClient) Interceptors() []Interceptor
Interceptors returns the client interceptors.
func (*AnswerClient) MapCreateBulk ¶
func (c *AnswerClient) MapCreateBulk(slice any, setFunc func(*AnswerCreate, int)) *AnswerCreateBulk
MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates a builder and applies setFunc on it.
func (*AnswerClient) Query ¶
func (c *AnswerClient) Query() *AnswerQuery
Query returns a query builder for Answer.
func (*AnswerClient) QueryAuthor ¶
func (c *AnswerClient) QueryAuthor(a *Answer) *UserQuery
QueryAuthor queries the author edge of a Answer.
func (*AnswerClient) QueryQuestion ¶
func (c *AnswerClient) QueryQuestion(a *Answer) *QuestionQuery
QueryQuestion queries the question edge of a Answer.
func (*AnswerClient) Update ¶
func (c *AnswerClient) Update() *AnswerUpdate
Update returns an update builder for Answer.
func (*AnswerClient) UpdateOne ¶
func (c *AnswerClient) UpdateOne(a *Answer) *AnswerUpdateOne
UpdateOne returns an update builder for the given entity.
func (*AnswerClient) UpdateOneID ¶
func (c *AnswerClient) UpdateOneID(id int) *AnswerUpdateOne
UpdateOneID returns an update builder for the given id.
func (*AnswerClient) Use ¶
func (c *AnswerClient) Use(hooks ...Hook)
Use adds a list of mutation hooks to the hooks stack. A call to `Use(f, g, h)` equals to `answer.Hooks(f(g(h())))`.
type AnswerCreate ¶
type AnswerCreate struct {
// contains filtered or unexported fields
}
AnswerCreate is the builder for creating a Answer entity.
func (*AnswerCreate) Exec ¶
func (ac *AnswerCreate) Exec(ctx context.Context) error
Exec executes the query.
func (*AnswerCreate) ExecX ¶
func (ac *AnswerCreate) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*AnswerCreate) Mutation ¶
func (ac *AnswerCreate) Mutation() *AnswerMutation
Mutation returns the AnswerMutation object of the builder.
func (*AnswerCreate) Save ¶
func (ac *AnswerCreate) Save(ctx context.Context) (*Answer, error)
Save creates the Answer in the database.
func (*AnswerCreate) SaveX ¶
func (ac *AnswerCreate) SaveX(ctx context.Context) *Answer
SaveX calls Save and panics if Save returns an error.
func (*AnswerCreate) SetAuthor ¶
func (ac *AnswerCreate) SetAuthor(u *User) *AnswerCreate
SetAuthor sets the "author" edge to the User entity.
func (*AnswerCreate) SetAuthorID ¶
func (ac *AnswerCreate) SetAuthorID(id int) *AnswerCreate
SetAuthorID sets the "author" edge to the User entity by ID.
func (*AnswerCreate) SetContent ¶
func (ac *AnswerCreate) SetContent(s string) *AnswerCreate
SetContent sets the "content" field.
func (*AnswerCreate) SetCreatedAt ¶
func (ac *AnswerCreate) SetCreatedAt(t time.Time) *AnswerCreate
SetCreatedAt sets the "created_at" field.
func (*AnswerCreate) SetNillableAuthorID ¶
func (ac *AnswerCreate) SetNillableAuthorID(id *int) *AnswerCreate
SetNillableAuthorID sets the "author" edge to the User entity by ID if the given value is not nil.
func (*AnswerCreate) SetNillableCreatedAt ¶
func (ac *AnswerCreate) SetNillableCreatedAt(t *time.Time) *AnswerCreate
SetNillableCreatedAt sets the "created_at" field if the given value is not nil.
func (*AnswerCreate) SetNillableQuestionID ¶
func (ac *AnswerCreate) SetNillableQuestionID(id *int) *AnswerCreate
SetNillableQuestionID sets the "question" edge to the Question entity by ID if the given value is not nil.
func (*AnswerCreate) SetQuestion ¶
func (ac *AnswerCreate) SetQuestion(q *Question) *AnswerCreate
SetQuestion sets the "question" edge to the Question entity.
func (*AnswerCreate) SetQuestionID ¶
func (ac *AnswerCreate) SetQuestionID(id int) *AnswerCreate
SetQuestionID sets the "question" edge to the Question entity by ID.
type AnswerCreateBulk ¶
type AnswerCreateBulk struct {
// contains filtered or unexported fields
}
AnswerCreateBulk is the builder for creating many Answer entities in bulk.
func (*AnswerCreateBulk) Exec ¶
func (acb *AnswerCreateBulk) Exec(ctx context.Context) error
Exec executes the query.
func (*AnswerCreateBulk) ExecX ¶
func (acb *AnswerCreateBulk) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
type AnswerDelete ¶
type AnswerDelete struct {
// contains filtered or unexported fields
}
AnswerDelete is the builder for deleting a Answer entity.
func (*AnswerDelete) Exec ¶
func (ad *AnswerDelete) Exec(ctx context.Context) (int, error)
Exec executes the deletion query and returns how many vertices were deleted.
func (*AnswerDelete) ExecX ¶
func (ad *AnswerDelete) ExecX(ctx context.Context) int
ExecX is like Exec, but panics if an error occurs.
func (*AnswerDelete) Where ¶
func (ad *AnswerDelete) Where(ps ...predicate.Answer) *AnswerDelete
Where appends a list predicates to the AnswerDelete builder.
type AnswerDeleteOne ¶
type AnswerDeleteOne struct {
// contains filtered or unexported fields
}
AnswerDeleteOne is the builder for deleting a single Answer entity.
func (*AnswerDeleteOne) Exec ¶
func (ado *AnswerDeleteOne) Exec(ctx context.Context) error
Exec executes the deletion query.
func (*AnswerDeleteOne) ExecX ¶
func (ado *AnswerDeleteOne) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*AnswerDeleteOne) Where ¶
func (ado *AnswerDeleteOne) Where(ps ...predicate.Answer) *AnswerDeleteOne
Where appends a list predicates to the AnswerDelete builder.
type AnswerEdges ¶
type AnswerEdges struct { // Question holds the value of the question edge. Question *Question `json:"question,omitempty"` // Author holds the value of the author edge. Author *User `json:"author,omitempty"` // contains filtered or unexported fields }
AnswerEdges holds the relations/edges for other nodes in the graph.
func (AnswerEdges) AuthorOrErr ¶
func (e AnswerEdges) AuthorOrErr() (*User, error)
AuthorOrErr returns the Author value or an error if the edge was not loaded in eager-loading, or loaded but was not found.
func (AnswerEdges) QuestionOrErr ¶
func (e AnswerEdges) QuestionOrErr() (*Question, error)
QuestionOrErr returns the Question value or an error if the edge was not loaded in eager-loading, or loaded but was not found.
type AnswerGroupBy ¶
type AnswerGroupBy struct {
// contains filtered or unexported fields
}
AnswerGroupBy is the group-by builder for Answer entities.
func (*AnswerGroupBy) Aggregate ¶
func (agb *AnswerGroupBy) Aggregate(fns ...AggregateFunc) *AnswerGroupBy
Aggregate adds the given aggregation functions to the group-by query.
func (*AnswerGroupBy) Bool ¶
Bool returns a single bool from a selector. It is only allowed when selecting one field.
func (*AnswerGroupBy) Bools ¶
Bools returns list of bools from a selector. It is only allowed when selecting one field.
func (*AnswerGroupBy) Float64 ¶
Float64 returns a single float64 from a selector. It is only allowed when selecting one field.
func (*AnswerGroupBy) Float64s ¶
Float64s returns list of float64s from a selector. It is only allowed when selecting one field.
func (*AnswerGroupBy) Int ¶
Int returns a single int from a selector. It is only allowed when selecting one field.
func (*AnswerGroupBy) Ints ¶
Ints returns list of ints from a selector. It is only allowed when selecting one field.
func (*AnswerGroupBy) Scan ¶
func (agb *AnswerGroupBy) Scan(ctx context.Context, v any) error
Scan applies the selector query and scans the result into the given value.
func (*AnswerGroupBy) String ¶
String returns a single string from a selector. It is only allowed when selecting one field.
type AnswerMutation ¶
type AnswerMutation struct {
// contains filtered or unexported fields
}
AnswerMutation represents an operation that mutates the Answer nodes in the graph.
func (*AnswerMutation) AddField ¶
func (m *AnswerMutation) 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 (*AnswerMutation) AddedEdges ¶
func (m *AnswerMutation) AddedEdges() []string
AddedEdges returns all edge names that were set/added in this mutation.
func (*AnswerMutation) AddedField ¶
func (m *AnswerMutation) 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 (*AnswerMutation) AddedFields ¶
func (m *AnswerMutation) AddedFields() []string
AddedFields returns all numeric fields that were incremented/decremented during this mutation.
func (*AnswerMutation) AddedIDs ¶
func (m *AnswerMutation) AddedIDs(name string) []ent.Value
AddedIDs returns all IDs (to other nodes) that were added for the given edge name in this mutation.
func (*AnswerMutation) AuthorCleared ¶
func (m *AnswerMutation) AuthorCleared() bool
AuthorCleared reports if the "author" edge to the User entity was cleared.
func (*AnswerMutation) AuthorID ¶
func (m *AnswerMutation) AuthorID() (id int, exists bool)
AuthorID returns the "author" edge ID in the mutation.
func (*AnswerMutation) AuthorIDs ¶
func (m *AnswerMutation) AuthorIDs() (ids []int)
AuthorIDs returns the "author" edge IDs in the mutation. Note that IDs always returns len(IDs) <= 1 for unique edges, and you should use AuthorID instead. It exists only for internal usage by the builders.
func (*AnswerMutation) ClearAuthor ¶
func (m *AnswerMutation) ClearAuthor()
ClearAuthor clears the "author" edge to the User entity.
func (*AnswerMutation) ClearEdge ¶
func (m *AnswerMutation) 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 (*AnswerMutation) ClearField ¶
func (m *AnswerMutation) 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 (*AnswerMutation) ClearQuestion ¶
func (m *AnswerMutation) ClearQuestion()
ClearQuestion clears the "question" edge to the Question entity.
func (*AnswerMutation) ClearedEdges ¶
func (m *AnswerMutation) ClearedEdges() []string
ClearedEdges returns all edge names that were cleared in this mutation.
func (*AnswerMutation) ClearedFields ¶
func (m *AnswerMutation) ClearedFields() []string
ClearedFields returns all nullable fields that were cleared during this mutation.
func (AnswerMutation) Client ¶
func (m AnswerMutation) 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 (*AnswerMutation) Content ¶
func (m *AnswerMutation) Content() (r string, exists bool)
Content returns the value of the "content" field in the mutation.
func (*AnswerMutation) CreatedAt ¶
func (m *AnswerMutation) CreatedAt() (r time.Time, exists bool)
CreatedAt returns the value of the "created_at" field in the mutation.
func (*AnswerMutation) EdgeCleared ¶
func (m *AnswerMutation) EdgeCleared(name string) bool
EdgeCleared returns a boolean which indicates if the edge with the given name was cleared in this mutation.
func (*AnswerMutation) Field ¶
func (m *AnswerMutation) 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 (*AnswerMutation) FieldCleared ¶
func (m *AnswerMutation) FieldCleared(name string) bool
FieldCleared returns a boolean indicating if a field with the given name was cleared in this mutation.
func (*AnswerMutation) Fields ¶
func (m *AnswerMutation) 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 (*AnswerMutation) ID ¶
func (m *AnswerMutation) ID() (id int, exists bool)
ID returns the ID value in the mutation. Note that the ID is only available if it was provided to the builder or after it was returned from the database.
func (*AnswerMutation) IDs ¶
func (m *AnswerMutation) IDs(ctx context.Context) ([]int, error)
IDs queries the database and returns the entity ids that match the mutation's predicate. That means, if the mutation is applied within a transaction with an isolation level such as sql.LevelSerializable, the returned ids match the ids of the rows that will be updated or updated by the mutation.
func (*AnswerMutation) OldContent ¶
func (m *AnswerMutation) OldContent(ctx context.Context) (v string, err error)
OldContent returns the old "content" field's value of the Answer entity. If the Answer 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 (*AnswerMutation) OldCreatedAt ¶
OldCreatedAt returns the old "created_at" field's value of the Answer entity. If the Answer 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 (*AnswerMutation) 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 (*AnswerMutation) QuestionCleared ¶
func (m *AnswerMutation) QuestionCleared() bool
QuestionCleared reports if the "question" edge to the Question entity was cleared.
func (*AnswerMutation) QuestionID ¶
func (m *AnswerMutation) QuestionID() (id int, exists bool)
QuestionID returns the "question" edge ID in the mutation.
func (*AnswerMutation) QuestionIDs ¶
func (m *AnswerMutation) QuestionIDs() (ids []int)
QuestionIDs returns the "question" edge IDs in the mutation. Note that IDs always returns len(IDs) <= 1 for unique edges, and you should use QuestionID instead. It exists only for internal usage by the builders.
func (*AnswerMutation) RemovedEdges ¶
func (m *AnswerMutation) RemovedEdges() []string
RemovedEdges returns all edge names that were removed in this mutation.
func (*AnswerMutation) RemovedIDs ¶
func (m *AnswerMutation) 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 (*AnswerMutation) ResetAuthor ¶
func (m *AnswerMutation) ResetAuthor()
ResetAuthor resets all changes to the "author" edge.
func (*AnswerMutation) ResetContent ¶
func (m *AnswerMutation) ResetContent()
ResetContent resets all changes to the "content" field.
func (*AnswerMutation) ResetCreatedAt ¶
func (m *AnswerMutation) ResetCreatedAt()
ResetCreatedAt resets all changes to the "created_at" field.
func (*AnswerMutation) ResetEdge ¶
func (m *AnswerMutation) 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 (*AnswerMutation) ResetField ¶
func (m *AnswerMutation) 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 (*AnswerMutation) ResetQuestion ¶
func (m *AnswerMutation) ResetQuestion()
ResetQuestion resets all changes to the "question" edge.
func (*AnswerMutation) SetAuthorID ¶
func (m *AnswerMutation) SetAuthorID(id int)
SetAuthorID sets the "author" edge to the User entity by id.
func (*AnswerMutation) SetContent ¶
func (m *AnswerMutation) SetContent(s string)
SetContent sets the "content" field.
func (*AnswerMutation) SetCreatedAt ¶
func (m *AnswerMutation) SetCreatedAt(t time.Time)
SetCreatedAt sets the "created_at" field.
func (*AnswerMutation) SetField ¶
func (m *AnswerMutation) 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 (*AnswerMutation) SetOp ¶
func (m *AnswerMutation) SetOp(op Op)
SetOp allows setting the mutation operation.
func (*AnswerMutation) SetQuestionID ¶
func (m *AnswerMutation) SetQuestionID(id int)
SetQuestionID sets the "question" edge to the Question entity by id.
func (AnswerMutation) Tx ¶
func (m AnswerMutation) Tx() (*Tx, error)
Tx returns an `ent.Tx` for mutations that were executed in transactions; it returns an error otherwise.
func (*AnswerMutation) Type ¶
func (m *AnswerMutation) Type() string
Type returns the node type of this mutation (Answer).
func (*AnswerMutation) Where ¶
func (m *AnswerMutation) Where(ps ...predicate.Answer)
Where appends a list predicates to the AnswerMutation builder.
func (*AnswerMutation) WhereP ¶
func (m *AnswerMutation) WhereP(ps ...func(*sql.Selector))
WhereP appends storage-level predicates to the AnswerMutation builder. Using this method, users can use type-assertion to append predicates that do not depend on any generated package.
type AnswerQuery ¶
type AnswerQuery struct {
// contains filtered or unexported fields
}
AnswerQuery is the builder for querying Answer entities.
func (*AnswerQuery) Aggregate ¶
func (aq *AnswerQuery) Aggregate(fns ...AggregateFunc) *AnswerSelect
Aggregate returns a AnswerSelect configured with the given aggregations.
func (*AnswerQuery) All ¶
func (aq *AnswerQuery) All(ctx context.Context) ([]*Answer, error)
All executes the query and returns a list of Answers.
func (*AnswerQuery) AllX ¶
func (aq *AnswerQuery) AllX(ctx context.Context) []*Answer
AllX is like All, but panics if an error occurs.
func (*AnswerQuery) Clone ¶
func (aq *AnswerQuery) Clone() *AnswerQuery
Clone returns a duplicate of the AnswerQuery builder, including all associated steps. It can be used to prepare common query builders and use them differently after the clone is made.
func (*AnswerQuery) Count ¶
func (aq *AnswerQuery) Count(ctx context.Context) (int, error)
Count returns the count of the given query.
func (*AnswerQuery) CountX ¶
func (aq *AnswerQuery) CountX(ctx context.Context) int
CountX is like Count, but panics if an error occurs.
func (*AnswerQuery) Exist ¶
func (aq *AnswerQuery) Exist(ctx context.Context) (bool, error)
Exist returns true if the query has elements in the graph.
func (*AnswerQuery) ExistX ¶
func (aq *AnswerQuery) ExistX(ctx context.Context) bool
ExistX is like Exist, but panics if an error occurs.
func (*AnswerQuery) First ¶
func (aq *AnswerQuery) First(ctx context.Context) (*Answer, error)
First returns the first Answer entity from the query. Returns a *NotFoundError when no Answer was found.
func (*AnswerQuery) FirstID ¶
func (aq *AnswerQuery) FirstID(ctx context.Context) (id int, err error)
FirstID returns the first Answer ID from the query. Returns a *NotFoundError when no Answer ID was found.
func (*AnswerQuery) FirstIDX ¶
func (aq *AnswerQuery) FirstIDX(ctx context.Context) int
FirstIDX is like FirstID, but panics if an error occurs.
func (*AnswerQuery) FirstX ¶
func (aq *AnswerQuery) FirstX(ctx context.Context) *Answer
FirstX is like First, but panics if an error occurs.
func (*AnswerQuery) GroupBy ¶
func (aq *AnswerQuery) GroupBy(field string, fields ...string) *AnswerGroupBy
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 { Content string `json:"content,omitempty"` Count int `json:"count,omitempty"` } client.Answer.Query(). GroupBy(answer.FieldContent). Aggregate(ent.Count()). Scan(ctx, &v)
func (*AnswerQuery) IDs ¶
func (aq *AnswerQuery) IDs(ctx context.Context) (ids []int, err error)
IDs executes the query and returns a list of Answer IDs.
func (*AnswerQuery) IDsX ¶
func (aq *AnswerQuery) IDsX(ctx context.Context) []int
IDsX is like IDs, but panics if an error occurs.
func (*AnswerQuery) Limit ¶
func (aq *AnswerQuery) Limit(limit int) *AnswerQuery
Limit the number of records to be returned by this query.
func (*AnswerQuery) Offset ¶
func (aq *AnswerQuery) Offset(offset int) *AnswerQuery
Offset to start from.
func (*AnswerQuery) Only ¶
func (aq *AnswerQuery) Only(ctx context.Context) (*Answer, error)
Only returns a single Answer entity found by the query, ensuring it only returns one. Returns a *NotSingularError when more than one Answer entity is found. Returns a *NotFoundError when no Answer entities are found.
func (*AnswerQuery) OnlyID ¶
func (aq *AnswerQuery) OnlyID(ctx context.Context) (id int, err error)
OnlyID is like Only, but returns the only Answer ID in the query. Returns a *NotSingularError when more than one Answer ID is found. Returns a *NotFoundError when no entities are found.
func (*AnswerQuery) OnlyIDX ¶
func (aq *AnswerQuery) OnlyIDX(ctx context.Context) int
OnlyIDX is like OnlyID, but panics if an error occurs.
func (*AnswerQuery) OnlyX ¶
func (aq *AnswerQuery) OnlyX(ctx context.Context) *Answer
OnlyX is like Only, but panics if an error occurs.
func (*AnswerQuery) Order ¶
func (aq *AnswerQuery) Order(o ...answer.OrderOption) *AnswerQuery
Order specifies how the records should be ordered.
func (*AnswerQuery) QueryAuthor ¶
func (aq *AnswerQuery) QueryAuthor() *UserQuery
QueryAuthor chains the current query on the "author" edge.
func (*AnswerQuery) QueryQuestion ¶
func (aq *AnswerQuery) QueryQuestion() *QuestionQuery
QueryQuestion chains the current query on the "question" edge.
func (*AnswerQuery) Select ¶
func (aq *AnswerQuery) Select(fields ...string) *AnswerSelect
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 { Content string `json:"content,omitempty"` } client.Answer.Query(). Select(answer.FieldContent). Scan(ctx, &v)
func (*AnswerQuery) Unique ¶
func (aq *AnswerQuery) Unique(unique bool) *AnswerQuery
Unique configures the query builder to filter duplicate records on query. By default, unique is set to true, and can be disabled using this method.
func (*AnswerQuery) Where ¶
func (aq *AnswerQuery) Where(ps ...predicate.Answer) *AnswerQuery
Where adds a new predicate for the AnswerQuery builder.
func (*AnswerQuery) WithAuthor ¶
func (aq *AnswerQuery) WithAuthor(opts ...func(*UserQuery)) *AnswerQuery
WithAuthor tells the query-builder to eager-load the nodes that are connected to the "author" edge. The optional arguments are used to configure the query builder of the edge.
func (*AnswerQuery) WithQuestion ¶
func (aq *AnswerQuery) WithQuestion(opts ...func(*QuestionQuery)) *AnswerQuery
WithQuestion tells the query-builder to eager-load the nodes that are connected to the "question" edge. The optional arguments are used to configure the query builder of the edge.
type AnswerSelect ¶
type AnswerSelect struct { *AnswerQuery // contains filtered or unexported fields }
AnswerSelect is the builder for selecting fields of Answer entities.
func (*AnswerSelect) Aggregate ¶
func (as *AnswerSelect) Aggregate(fns ...AggregateFunc) *AnswerSelect
Aggregate adds the given aggregation functions to the selector query.
func (*AnswerSelect) Bool ¶
Bool returns a single bool from a selector. It is only allowed when selecting one field.
func (*AnswerSelect) Bools ¶
Bools returns list of bools from a selector. It is only allowed when selecting one field.
func (*AnswerSelect) Float64 ¶
Float64 returns a single float64 from a selector. It is only allowed when selecting one field.
func (*AnswerSelect) Float64s ¶
Float64s returns list of float64s from a selector. It is only allowed when selecting one field.
func (*AnswerSelect) Int ¶
Int returns a single int from a selector. It is only allowed when selecting one field.
func (*AnswerSelect) Ints ¶
Ints returns list of ints from a selector. It is only allowed when selecting one field.
func (*AnswerSelect) Scan ¶
func (as *AnswerSelect) Scan(ctx context.Context, v any) error
Scan applies the selector query and scans the result into the given value.
func (*AnswerSelect) String ¶
String returns a single string from a selector. It is only allowed when selecting one field.
type AnswerUpdate ¶
type AnswerUpdate struct {
// contains filtered or unexported fields
}
AnswerUpdate is the builder for updating Answer entities.
func (*AnswerUpdate) ClearAuthor ¶
func (au *AnswerUpdate) ClearAuthor() *AnswerUpdate
ClearAuthor clears the "author" edge to the User entity.
func (*AnswerUpdate) ClearQuestion ¶
func (au *AnswerUpdate) ClearQuestion() *AnswerUpdate
ClearQuestion clears the "question" edge to the Question entity.
func (*AnswerUpdate) Exec ¶
func (au *AnswerUpdate) Exec(ctx context.Context) error
Exec executes the query.
func (*AnswerUpdate) ExecX ¶
func (au *AnswerUpdate) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*AnswerUpdate) Mutation ¶
func (au *AnswerUpdate) Mutation() *AnswerMutation
Mutation returns the AnswerMutation object of the builder.
func (*AnswerUpdate) Save ¶
func (au *AnswerUpdate) Save(ctx context.Context) (int, error)
Save executes the query and returns the number of nodes affected by the update operation.
func (*AnswerUpdate) SaveX ¶
func (au *AnswerUpdate) SaveX(ctx context.Context) int
SaveX is like Save, but panics if an error occurs.
func (*AnswerUpdate) SetAuthor ¶
func (au *AnswerUpdate) SetAuthor(u *User) *AnswerUpdate
SetAuthor sets the "author" edge to the User entity.
func (*AnswerUpdate) SetAuthorID ¶
func (au *AnswerUpdate) SetAuthorID(id int) *AnswerUpdate
SetAuthorID sets the "author" edge to the User entity by ID.
func (*AnswerUpdate) SetContent ¶
func (au *AnswerUpdate) SetContent(s string) *AnswerUpdate
SetContent sets the "content" field.
func (*AnswerUpdate) SetNillableAuthorID ¶
func (au *AnswerUpdate) SetNillableAuthorID(id *int) *AnswerUpdate
SetNillableAuthorID sets the "author" edge to the User entity by ID if the given value is not nil.
func (*AnswerUpdate) SetNillableQuestionID ¶
func (au *AnswerUpdate) SetNillableQuestionID(id *int) *AnswerUpdate
SetNillableQuestionID sets the "question" edge to the Question entity by ID if the given value is not nil.
func (*AnswerUpdate) SetQuestion ¶
func (au *AnswerUpdate) SetQuestion(q *Question) *AnswerUpdate
SetQuestion sets the "question" edge to the Question entity.
func (*AnswerUpdate) SetQuestionID ¶
func (au *AnswerUpdate) SetQuestionID(id int) *AnswerUpdate
SetQuestionID sets the "question" edge to the Question entity by ID.
func (*AnswerUpdate) Where ¶
func (au *AnswerUpdate) Where(ps ...predicate.Answer) *AnswerUpdate
Where appends a list predicates to the AnswerUpdate builder.
type AnswerUpdateOne ¶
type AnswerUpdateOne struct {
// contains filtered or unexported fields
}
AnswerUpdateOne is the builder for updating a single Answer entity.
func (*AnswerUpdateOne) ClearAuthor ¶
func (auo *AnswerUpdateOne) ClearAuthor() *AnswerUpdateOne
ClearAuthor clears the "author" edge to the User entity.
func (*AnswerUpdateOne) ClearQuestion ¶
func (auo *AnswerUpdateOne) ClearQuestion() *AnswerUpdateOne
ClearQuestion clears the "question" edge to the Question entity.
func (*AnswerUpdateOne) Exec ¶
func (auo *AnswerUpdateOne) Exec(ctx context.Context) error
Exec executes the query on the entity.
func (*AnswerUpdateOne) ExecX ¶
func (auo *AnswerUpdateOne) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*AnswerUpdateOne) Mutation ¶
func (auo *AnswerUpdateOne) Mutation() *AnswerMutation
Mutation returns the AnswerMutation object of the builder.
func (*AnswerUpdateOne) Save ¶
func (auo *AnswerUpdateOne) Save(ctx context.Context) (*Answer, error)
Save executes the query and returns the updated Answer entity.
func (*AnswerUpdateOne) SaveX ¶
func (auo *AnswerUpdateOne) SaveX(ctx context.Context) *Answer
SaveX is like Save, but panics if an error occurs.
func (*AnswerUpdateOne) Select ¶
func (auo *AnswerUpdateOne) Select(field string, fields ...string) *AnswerUpdateOne
Select allows selecting one or more fields (columns) of the returned entity. The default is selecting all fields defined in the entity schema.
func (*AnswerUpdateOne) SetAuthor ¶
func (auo *AnswerUpdateOne) SetAuthor(u *User) *AnswerUpdateOne
SetAuthor sets the "author" edge to the User entity.
func (*AnswerUpdateOne) SetAuthorID ¶
func (auo *AnswerUpdateOne) SetAuthorID(id int) *AnswerUpdateOne
SetAuthorID sets the "author" edge to the User entity by ID.
func (*AnswerUpdateOne) SetContent ¶
func (auo *AnswerUpdateOne) SetContent(s string) *AnswerUpdateOne
SetContent sets the "content" field.
func (*AnswerUpdateOne) SetNillableAuthorID ¶
func (auo *AnswerUpdateOne) SetNillableAuthorID(id *int) *AnswerUpdateOne
SetNillableAuthorID sets the "author" edge to the User entity by ID if the given value is not nil.
func (*AnswerUpdateOne) SetNillableQuestionID ¶
func (auo *AnswerUpdateOne) SetNillableQuestionID(id *int) *AnswerUpdateOne
SetNillableQuestionID sets the "question" edge to the Question entity by ID if the given value is not nil.
func (*AnswerUpdateOne) SetQuestion ¶
func (auo *AnswerUpdateOne) SetQuestion(q *Question) *AnswerUpdateOne
SetQuestion sets the "question" edge to the Question entity.
func (*AnswerUpdateOne) SetQuestionID ¶
func (auo *AnswerUpdateOne) SetQuestionID(id int) *AnswerUpdateOne
SetQuestionID sets the "question" edge to the Question entity by ID.
func (*AnswerUpdateOne) Where ¶
func (auo *AnswerUpdateOne) Where(ps ...predicate.Answer) *AnswerUpdateOne
Where appends a list predicates to the AnswerUpdate builder.
type Client ¶
type Client struct { // Schema is the client for creating, migrating and dropping schema. Schema *migrate.Schema // Answer is the client for interacting with the Answer builders. Answer *AnswerClient // Question is the client for interacting with the Question builders. Question *QuestionClient // Tag is the client for interacting with the Tag builders. Tag *TagClient // User is the client for interacting with the User builders. User *UserClient // contains filtered or unexported fields }
Client is the client that holds all ent builders.
func FromContext ¶
FromContext returns a Client stored inside a context, or nil if there isn't one.
func Open ¶
Open opens a database/sql.DB specified by the driver name and the data source name, and returns a new client attached to it. Optional parameters can be added for configuring the client.
func (*Client) Debug ¶
Debug returns a new debug-client. It's used to get verbose logging on specific operations.
client.Debug(). Answer. Query(). Count(ctx)
func (*Client) Intercept ¶
func (c *Client) Intercept(interceptors ...Interceptor)
Intercept adds the query interceptors to all the entity clients. In order to add interceptors to a specific client, call: `client.Node.Intercept(...)`.
type CommitFunc ¶
The CommitFunc type is an adapter to allow the use of ordinary function as a Committer. If f is a function with the appropriate signature, CommitFunc(f) is a Committer that calls f.
type CommitHook ¶
CommitHook defines the "commit middleware". A function that gets a Committer and returns a Committer. For example:
hook := func(next ent.Committer) ent.Committer { return ent.CommitFunc(func(ctx context.Context, tx *ent.Tx) error { // Do some stuff before. if err := next.Commit(ctx, tx); err != nil { return err } // Do some stuff after. return nil }) }
type ConstraintError ¶
type ConstraintError struct {
// contains filtered or unexported fields
}
ConstraintError returns when trying to create/update one or more entities and one or more of their constraints failed. For example, violation of edge or field uniqueness.
func (ConstraintError) Error ¶
func (e ConstraintError) Error() string
Error implements the error interface.
func (*ConstraintError) Unwrap ¶
func (e *ConstraintError) Unwrap() error
Unwrap implements the errors.Wrapper interface.
type InterceptFunc ¶
type InterceptFunc = ent.InterceptFunc
ent aliases to avoid import conflicts in user's code.
type Interceptor ¶
type Interceptor = ent.Interceptor
ent aliases to avoid import conflicts in user's code.
type MutateFunc ¶
type MutateFunc = ent.MutateFunc
ent aliases to avoid import conflicts in user's code.
type NotFoundError ¶
type NotFoundError struct {
// contains filtered or unexported fields
}
NotFoundError returns when trying to fetch a specific entity and it was not found in the database.
func (*NotFoundError) Error ¶
func (e *NotFoundError) Error() string
Error implements the error interface.
type NotLoadedError ¶
type NotLoadedError struct {
// contains filtered or unexported fields
}
NotLoadedError returns when trying to get a node that was not loaded by the query.
func (*NotLoadedError) Error ¶
func (e *NotLoadedError) Error() string
Error implements the error interface.
type NotSingularError ¶
type NotSingularError struct {
// contains filtered or unexported fields
}
NotSingularError returns when trying to fetch a singular entity and more then one was found in the database.
func (*NotSingularError) Error ¶
func (e *NotSingularError) Error() string
Error implements the error interface.
type OrderFunc ¶
OrderFunc applies an ordering on the sql selector. Deprecated: Use Asc/Desc functions or the package builders instead.
type QuerierFunc ¶
type QuerierFunc = ent.QuerierFunc
ent aliases to avoid import conflicts in user's code.
type QueryContext ¶
type QueryContext = ent.QueryContext
ent aliases to avoid import conflicts in user's code.
type Question ¶
type Question struct { // ID of the ent. ID int `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"` // Edges holds the relations/edges for other nodes in the graph. // The values are being populated by the QuestionQuery when eager-loading is set. Edges QuestionEdges `json:"edges"` // contains filtered or unexported fields }
Question is the model entity for the Question schema.
func (*Question) QueryAnswers ¶
func (q *Question) QueryAnswers() *AnswerQuery
QueryAnswers queries the "answers" edge of the Question entity.
func (*Question) QueryAuthor ¶
QueryAuthor queries the "author" edge of the Question entity.
func (*Question) Unwrap ¶
Unwrap unwraps the Question 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 (*Question) Update ¶
func (q *Question) Update() *QuestionUpdateOne
Update returns a builder for updating this Question. Note that you need to call Question.Unwrap() before calling this method if this Question was returned from a transaction, and the transaction was committed or rolled back.
type QuestionClient ¶
type QuestionClient struct {
// contains filtered or unexported fields
}
QuestionClient is a client for the Question schema.
func NewQuestionClient ¶
func NewQuestionClient(c config) *QuestionClient
NewQuestionClient returns a client for the Question from the given config.
func (*QuestionClient) Create ¶
func (c *QuestionClient) Create() *QuestionCreate
Create returns a builder for creating a Question entity.
func (*QuestionClient) CreateBulk ¶
func (c *QuestionClient) CreateBulk(builders ...*QuestionCreate) *QuestionCreateBulk
CreateBulk returns a builder for creating a bulk of Question entities.
func (*QuestionClient) Delete ¶
func (c *QuestionClient) Delete() *QuestionDelete
Delete returns a delete builder for Question.
func (*QuestionClient) DeleteOne ¶
func (c *QuestionClient) DeleteOne(q *Question) *QuestionDeleteOne
DeleteOne returns a builder for deleting the given entity.
func (*QuestionClient) DeleteOneID ¶
func (c *QuestionClient) DeleteOneID(id int) *QuestionDeleteOne
DeleteOneID returns a builder for deleting the given entity by its id.
func (*QuestionClient) GetX ¶
func (c *QuestionClient) GetX(ctx context.Context, id int) *Question
GetX is like Get, but panics if an error occurs.
func (*QuestionClient) Hooks ¶
func (c *QuestionClient) Hooks() []Hook
Hooks returns the client hooks.
func (*QuestionClient) Intercept ¶
func (c *QuestionClient) Intercept(interceptors ...Interceptor)
Intercept adds a list of query interceptors to the interceptors stack. A call to `Intercept(f, g, h)` equals to `question.Intercept(f(g(h())))`.
func (*QuestionClient) Interceptors ¶
func (c *QuestionClient) Interceptors() []Interceptor
Interceptors returns the client interceptors.
func (*QuestionClient) MapCreateBulk ¶
func (c *QuestionClient) MapCreateBulk(slice any, setFunc func(*QuestionCreate, int)) *QuestionCreateBulk
MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates a builder and applies setFunc on it.
func (*QuestionClient) Query ¶
func (c *QuestionClient) Query() *QuestionQuery
Query returns a query builder for Question.
func (*QuestionClient) QueryAnswers ¶
func (c *QuestionClient) QueryAnswers(q *Question) *AnswerQuery
QueryAnswers queries the answers edge of a Question.
func (*QuestionClient) QueryAuthor ¶
func (c *QuestionClient) QueryAuthor(q *Question) *UserQuery
QueryAuthor queries the author edge of a Question.
func (*QuestionClient) QueryTags ¶
func (c *QuestionClient) QueryTags(q *Question) *TagQuery
QueryTags queries the tags edge of a Question.
func (*QuestionClient) Update ¶
func (c *QuestionClient) Update() *QuestionUpdate
Update returns an update builder for Question.
func (*QuestionClient) UpdateOne ¶
func (c *QuestionClient) UpdateOne(q *Question) *QuestionUpdateOne
UpdateOne returns an update builder for the given entity.
func (*QuestionClient) UpdateOneID ¶
func (c *QuestionClient) UpdateOneID(id int) *QuestionUpdateOne
UpdateOneID returns an update builder for the given id.
func (*QuestionClient) Use ¶
func (c *QuestionClient) Use(hooks ...Hook)
Use adds a list of mutation hooks to the hooks stack. A call to `Use(f, g, h)` equals to `question.Hooks(f(g(h())))`.
type QuestionCreate ¶
type QuestionCreate struct {
// contains filtered or unexported fields
}
QuestionCreate is the builder for creating a Question entity.
func (*QuestionCreate) AddAnswerIDs ¶
func (qc *QuestionCreate) AddAnswerIDs(ids ...int) *QuestionCreate
AddAnswerIDs adds the "answers" edge to the Answer entity by IDs.
func (*QuestionCreate) AddAnswers ¶
func (qc *QuestionCreate) AddAnswers(a ...*Answer) *QuestionCreate
AddAnswers adds the "answers" edges to the Answer entity.
func (*QuestionCreate) AddTagIDs ¶
func (qc *QuestionCreate) AddTagIDs(ids ...int) *QuestionCreate
AddTagIDs adds the "tags" edge to the Tag entity by IDs.
func (*QuestionCreate) AddTags ¶
func (qc *QuestionCreate) AddTags(t ...*Tag) *QuestionCreate
AddTags adds the "tags" edges to the Tag entity.
func (*QuestionCreate) Exec ¶
func (qc *QuestionCreate) Exec(ctx context.Context) error
Exec executes the query.
func (*QuestionCreate) ExecX ¶
func (qc *QuestionCreate) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*QuestionCreate) Mutation ¶
func (qc *QuestionCreate) Mutation() *QuestionMutation
Mutation returns the QuestionMutation object of the builder.
func (*QuestionCreate) Save ¶
func (qc *QuestionCreate) Save(ctx context.Context) (*Question, error)
Save creates the Question in the database.
func (*QuestionCreate) SaveX ¶
func (qc *QuestionCreate) SaveX(ctx context.Context) *Question
SaveX calls Save and panics if Save returns an error.
func (*QuestionCreate) SetAuthor ¶
func (qc *QuestionCreate) SetAuthor(u *User) *QuestionCreate
SetAuthor sets the "author" edge to the User entity.
func (*QuestionCreate) SetAuthorID ¶
func (qc *QuestionCreate) SetAuthorID(id int) *QuestionCreate
SetAuthorID sets the "author" edge to the User entity by ID.
func (*QuestionCreate) SetContent ¶
func (qc *QuestionCreate) SetContent(s string) *QuestionCreate
SetContent sets the "content" field.
func (*QuestionCreate) SetCreatedAt ¶
func (qc *QuestionCreate) SetCreatedAt(t time.Time) *QuestionCreate
SetCreatedAt sets the "created_at" field.
func (*QuestionCreate) SetNillableAuthorID ¶
func (qc *QuestionCreate) SetNillableAuthorID(id *int) *QuestionCreate
SetNillableAuthorID sets the "author" edge to the User entity by ID if the given value is not nil.
func (*QuestionCreate) SetNillableCreatedAt ¶
func (qc *QuestionCreate) SetNillableCreatedAt(t *time.Time) *QuestionCreate
SetNillableCreatedAt sets the "created_at" field if the given value is not nil.
func (*QuestionCreate) SetTitle ¶
func (qc *QuestionCreate) SetTitle(s string) *QuestionCreate
SetTitle sets the "title" field.
type QuestionCreateBulk ¶
type QuestionCreateBulk struct {
// contains filtered or unexported fields
}
QuestionCreateBulk is the builder for creating many Question entities in bulk.
func (*QuestionCreateBulk) Exec ¶
func (qcb *QuestionCreateBulk) Exec(ctx context.Context) error
Exec executes the query.
func (*QuestionCreateBulk) ExecX ¶
func (qcb *QuestionCreateBulk) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
type QuestionDelete ¶
type QuestionDelete struct {
// contains filtered or unexported fields
}
QuestionDelete is the builder for deleting a Question entity.
func (*QuestionDelete) Exec ¶
func (qd *QuestionDelete) Exec(ctx context.Context) (int, error)
Exec executes the deletion query and returns how many vertices were deleted.
func (*QuestionDelete) ExecX ¶
func (qd *QuestionDelete) ExecX(ctx context.Context) int
ExecX is like Exec, but panics if an error occurs.
func (*QuestionDelete) Where ¶
func (qd *QuestionDelete) Where(ps ...predicate.Question) *QuestionDelete
Where appends a list predicates to the QuestionDelete builder.
type QuestionDeleteOne ¶
type QuestionDeleteOne struct {
// contains filtered or unexported fields
}
QuestionDeleteOne is the builder for deleting a single Question entity.
func (*QuestionDeleteOne) Exec ¶
func (qdo *QuestionDeleteOne) Exec(ctx context.Context) error
Exec executes the deletion query.
func (*QuestionDeleteOne) ExecX ¶
func (qdo *QuestionDeleteOne) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*QuestionDeleteOne) Where ¶
func (qdo *QuestionDeleteOne) Where(ps ...predicate.Question) *QuestionDeleteOne
Where appends a list predicates to the QuestionDelete builder.
type QuestionEdges ¶
type QuestionEdges struct { // Answers holds the value of the answers edge. Answers []*Answer `json:"answers,omitempty"` // Author holds the value of the author edge. Author *User `json:"author,omitempty"` // Tags holds the value of the tags edge. Tags []*Tag `json:"tags,omitempty"` // contains filtered or unexported fields }
QuestionEdges holds the relations/edges for other nodes in the graph.
func (QuestionEdges) AnswersOrErr ¶
func (e QuestionEdges) AnswersOrErr() ([]*Answer, error)
AnswersOrErr returns the Answers value or an error if the edge was not loaded in eager-loading.
func (QuestionEdges) AuthorOrErr ¶
func (e QuestionEdges) AuthorOrErr() (*User, error)
AuthorOrErr returns the Author value or an error if the edge was not loaded in eager-loading, or loaded but was not found.
func (QuestionEdges) TagsOrErr ¶
func (e QuestionEdges) TagsOrErr() ([]*Tag, error)
TagsOrErr returns the Tags value or an error if the edge was not loaded in eager-loading.
type QuestionGroupBy ¶
type QuestionGroupBy struct {
// contains filtered or unexported fields
}
QuestionGroupBy is the group-by builder for Question entities.
func (*QuestionGroupBy) Aggregate ¶
func (qgb *QuestionGroupBy) Aggregate(fns ...AggregateFunc) *QuestionGroupBy
Aggregate adds the given aggregation functions to the group-by query.
func (*QuestionGroupBy) Bool ¶
Bool returns a single bool from a selector. It is only allowed when selecting one field.
func (*QuestionGroupBy) Bools ¶
Bools returns list of bools from a selector. It is only allowed when selecting one field.
func (*QuestionGroupBy) Float64 ¶
Float64 returns a single float64 from a selector. It is only allowed when selecting one field.
func (*QuestionGroupBy) Float64s ¶
Float64s returns list of float64s from a selector. It is only allowed when selecting one field.
func (*QuestionGroupBy) Int ¶
Int returns a single int from a selector. It is only allowed when selecting one field.
func (*QuestionGroupBy) Ints ¶
Ints returns list of ints from a selector. It is only allowed when selecting one field.
func (*QuestionGroupBy) Scan ¶
func (qgb *QuestionGroupBy) Scan(ctx context.Context, v any) error
Scan applies the selector query and scans the result into the given value.
func (*QuestionGroupBy) String ¶
String returns a single string from a selector. It is only allowed when selecting one field.
type QuestionMutation ¶
type QuestionMutation struct {
// contains filtered or unexported fields
}
QuestionMutation represents an operation that mutates the Question nodes in the graph.
func (*QuestionMutation) AddAnswerIDs ¶
func (m *QuestionMutation) AddAnswerIDs(ids ...int)
AddAnswerIDs adds the "answers" edge to the Answer entity by ids.
func (*QuestionMutation) AddField ¶
func (m *QuestionMutation) 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 (*QuestionMutation) AddTagIDs ¶
func (m *QuestionMutation) AddTagIDs(ids ...int)
AddTagIDs adds the "tags" edge to the Tag entity by ids.
func (*QuestionMutation) AddedEdges ¶
func (m *QuestionMutation) AddedEdges() []string
AddedEdges returns all edge names that were set/added in this mutation.
func (*QuestionMutation) AddedField ¶
func (m *QuestionMutation) 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 (*QuestionMutation) AddedFields ¶
func (m *QuestionMutation) AddedFields() []string
AddedFields returns all numeric fields that were incremented/decremented during this mutation.
func (*QuestionMutation) AddedIDs ¶
func (m *QuestionMutation) AddedIDs(name string) []ent.Value
AddedIDs returns all IDs (to other nodes) that were added for the given edge name in this mutation.
func (*QuestionMutation) AnswersCleared ¶
func (m *QuestionMutation) AnswersCleared() bool
AnswersCleared reports if the "answers" edge to the Answer entity was cleared.
func (*QuestionMutation) AnswersIDs ¶
func (m *QuestionMutation) AnswersIDs() (ids []int)
AnswersIDs returns the "answers" edge IDs in the mutation.
func (*QuestionMutation) AuthorCleared ¶
func (m *QuestionMutation) AuthorCleared() bool
AuthorCleared reports if the "author" edge to the User entity was cleared.
func (*QuestionMutation) AuthorID ¶
func (m *QuestionMutation) AuthorID() (id int, exists bool)
AuthorID returns the "author" edge ID in the mutation.
func (*QuestionMutation) AuthorIDs ¶
func (m *QuestionMutation) AuthorIDs() (ids []int)
AuthorIDs returns the "author" edge IDs in the mutation. Note that IDs always returns len(IDs) <= 1 for unique edges, and you should use AuthorID instead. It exists only for internal usage by the builders.
func (*QuestionMutation) ClearAnswers ¶
func (m *QuestionMutation) ClearAnswers()
ClearAnswers clears the "answers" edge to the Answer entity.
func (*QuestionMutation) ClearAuthor ¶
func (m *QuestionMutation) ClearAuthor()
ClearAuthor clears the "author" edge to the User entity.
func (*QuestionMutation) ClearEdge ¶
func (m *QuestionMutation) 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 (*QuestionMutation) ClearField ¶
func (m *QuestionMutation) 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 (*QuestionMutation) ClearTags ¶
func (m *QuestionMutation) ClearTags()
ClearTags clears the "tags" edge to the Tag entity.
func (*QuestionMutation) ClearedEdges ¶
func (m *QuestionMutation) ClearedEdges() []string
ClearedEdges returns all edge names that were cleared in this mutation.
func (*QuestionMutation) ClearedFields ¶
func (m *QuestionMutation) ClearedFields() []string
ClearedFields returns all nullable fields that were cleared during this mutation.
func (QuestionMutation) Client ¶
func (m QuestionMutation) 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 (*QuestionMutation) Content ¶
func (m *QuestionMutation) Content() (r string, exists bool)
Content returns the value of the "content" field in the mutation.
func (*QuestionMutation) CreatedAt ¶
func (m *QuestionMutation) CreatedAt() (r time.Time, exists bool)
CreatedAt returns the value of the "created_at" field in the mutation.
func (*QuestionMutation) EdgeCleared ¶
func (m *QuestionMutation) EdgeCleared(name string) bool
EdgeCleared returns a boolean which indicates if the edge with the given name was cleared in this mutation.
func (*QuestionMutation) Field ¶
func (m *QuestionMutation) 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 (*QuestionMutation) FieldCleared ¶
func (m *QuestionMutation) FieldCleared(name string) bool
FieldCleared returns a boolean indicating if a field with the given name was cleared in this mutation.
func (*QuestionMutation) Fields ¶
func (m *QuestionMutation) 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 (*QuestionMutation) ID ¶
func (m *QuestionMutation) ID() (id int, exists bool)
ID returns the ID value in the mutation. Note that the ID is only available if it was provided to the builder or after it was returned from the database.
func (*QuestionMutation) IDs ¶
func (m *QuestionMutation) IDs(ctx context.Context) ([]int, error)
IDs queries the database and returns the entity ids that match the mutation's predicate. That means, if the mutation is applied within a transaction with an isolation level such as sql.LevelSerializable, the returned ids match the ids of the rows that will be updated or updated by the mutation.
func (*QuestionMutation) OldContent ¶
func (m *QuestionMutation) OldContent(ctx context.Context) (v string, err error)
OldContent returns the old "content" field's value of the Question entity. If the Question 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 (*QuestionMutation) OldCreatedAt ¶
OldCreatedAt returns the old "created_at" field's value of the Question entity. If the Question 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 (*QuestionMutation) 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 (*QuestionMutation) OldTitle ¶
func (m *QuestionMutation) OldTitle(ctx context.Context) (v string, err error)
OldTitle returns the old "title" field's value of the Question entity. If the Question 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 (*QuestionMutation) RemoveAnswerIDs ¶
func (m *QuestionMutation) RemoveAnswerIDs(ids ...int)
RemoveAnswerIDs removes the "answers" edge to the Answer entity by IDs.
func (*QuestionMutation) RemoveTagIDs ¶
func (m *QuestionMutation) RemoveTagIDs(ids ...int)
RemoveTagIDs removes the "tags" edge to the Tag entity by IDs.
func (*QuestionMutation) RemovedAnswersIDs ¶
func (m *QuestionMutation) RemovedAnswersIDs() (ids []int)
RemovedAnswers returns the removed IDs of the "answers" edge to the Answer entity.
func (*QuestionMutation) RemovedEdges ¶
func (m *QuestionMutation) RemovedEdges() []string
RemovedEdges returns all edge names that were removed in this mutation.
func (*QuestionMutation) RemovedIDs ¶
func (m *QuestionMutation) 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 (*QuestionMutation) RemovedTagsIDs ¶
func (m *QuestionMutation) RemovedTagsIDs() (ids []int)
RemovedTags returns the removed IDs of the "tags" edge to the Tag entity.
func (*QuestionMutation) ResetAnswers ¶
func (m *QuestionMutation) ResetAnswers()
ResetAnswers resets all changes to the "answers" edge.
func (*QuestionMutation) ResetAuthor ¶
func (m *QuestionMutation) ResetAuthor()
ResetAuthor resets all changes to the "author" edge.
func (*QuestionMutation) ResetContent ¶
func (m *QuestionMutation) ResetContent()
ResetContent resets all changes to the "content" field.
func (*QuestionMutation) ResetCreatedAt ¶
func (m *QuestionMutation) ResetCreatedAt()
ResetCreatedAt resets all changes to the "created_at" field.
func (*QuestionMutation) ResetEdge ¶
func (m *QuestionMutation) 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 (*QuestionMutation) ResetField ¶
func (m *QuestionMutation) 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 (*QuestionMutation) ResetTags ¶
func (m *QuestionMutation) ResetTags()
ResetTags resets all changes to the "tags" edge.
func (*QuestionMutation) ResetTitle ¶
func (m *QuestionMutation) ResetTitle()
ResetTitle resets all changes to the "title" field.
func (*QuestionMutation) SetAuthorID ¶
func (m *QuestionMutation) SetAuthorID(id int)
SetAuthorID sets the "author" edge to the User entity by id.
func (*QuestionMutation) SetContent ¶
func (m *QuestionMutation) SetContent(s string)
SetContent sets the "content" field.
func (*QuestionMutation) SetCreatedAt ¶
func (m *QuestionMutation) SetCreatedAt(t time.Time)
SetCreatedAt sets the "created_at" field.
func (*QuestionMutation) SetField ¶
func (m *QuestionMutation) 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 (*QuestionMutation) SetOp ¶
func (m *QuestionMutation) SetOp(op Op)
SetOp allows setting the mutation operation.
func (*QuestionMutation) SetTitle ¶
func (m *QuestionMutation) SetTitle(s string)
SetTitle sets the "title" field.
func (*QuestionMutation) TagsCleared ¶
func (m *QuestionMutation) TagsCleared() bool
TagsCleared reports if the "tags" edge to the Tag entity was cleared.
func (*QuestionMutation) TagsIDs ¶
func (m *QuestionMutation) TagsIDs() (ids []int)
TagsIDs returns the "tags" edge IDs in the mutation.
func (*QuestionMutation) Title ¶
func (m *QuestionMutation) Title() (r string, exists bool)
Title returns the value of the "title" field in the mutation.
func (QuestionMutation) Tx ¶
func (m QuestionMutation) Tx() (*Tx, error)
Tx returns an `ent.Tx` for mutations that were executed in transactions; it returns an error otherwise.
func (*QuestionMutation) Type ¶
func (m *QuestionMutation) Type() string
Type returns the node type of this mutation (Question).
func (*QuestionMutation) Where ¶
func (m *QuestionMutation) Where(ps ...predicate.Question)
Where appends a list predicates to the QuestionMutation builder.
func (*QuestionMutation) WhereP ¶
func (m *QuestionMutation) WhereP(ps ...func(*sql.Selector))
WhereP appends storage-level predicates to the QuestionMutation builder. Using this method, users can use type-assertion to append predicates that do not depend on any generated package.
type QuestionQuery ¶
type QuestionQuery struct {
// contains filtered or unexported fields
}
QuestionQuery is the builder for querying Question entities.
func (*QuestionQuery) Aggregate ¶
func (qq *QuestionQuery) Aggregate(fns ...AggregateFunc) *QuestionSelect
Aggregate returns a QuestionSelect configured with the given aggregations.
func (*QuestionQuery) All ¶
func (qq *QuestionQuery) All(ctx context.Context) ([]*Question, error)
All executes the query and returns a list of Questions.
func (*QuestionQuery) AllX ¶
func (qq *QuestionQuery) AllX(ctx context.Context) []*Question
AllX is like All, but panics if an error occurs.
func (*QuestionQuery) Clone ¶
func (qq *QuestionQuery) Clone() *QuestionQuery
Clone returns a duplicate of the QuestionQuery builder, including all associated steps. It can be used to prepare common query builders and use them differently after the clone is made.
func (*QuestionQuery) Count ¶
func (qq *QuestionQuery) Count(ctx context.Context) (int, error)
Count returns the count of the given query.
func (*QuestionQuery) CountX ¶
func (qq *QuestionQuery) CountX(ctx context.Context) int
CountX is like Count, but panics if an error occurs.
func (*QuestionQuery) Exist ¶
func (qq *QuestionQuery) Exist(ctx context.Context) (bool, error)
Exist returns true if the query has elements in the graph.
func (*QuestionQuery) ExistX ¶
func (qq *QuestionQuery) ExistX(ctx context.Context) bool
ExistX is like Exist, but panics if an error occurs.
func (*QuestionQuery) First ¶
func (qq *QuestionQuery) First(ctx context.Context) (*Question, error)
First returns the first Question entity from the query. Returns a *NotFoundError when no Question was found.
func (*QuestionQuery) FirstID ¶
func (qq *QuestionQuery) FirstID(ctx context.Context) (id int, err error)
FirstID returns the first Question ID from the query. Returns a *NotFoundError when no Question ID was found.
func (*QuestionQuery) FirstIDX ¶
func (qq *QuestionQuery) FirstIDX(ctx context.Context) int
FirstIDX is like FirstID, but panics if an error occurs.
func (*QuestionQuery) FirstX ¶
func (qq *QuestionQuery) FirstX(ctx context.Context) *Question
FirstX is like First, but panics if an error occurs.
func (*QuestionQuery) GroupBy ¶
func (qq *QuestionQuery) GroupBy(field string, fields ...string) *QuestionGroupBy
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.Question.Query(). GroupBy(question.FieldTitle). Aggregate(ent.Count()). Scan(ctx, &v)
func (*QuestionQuery) IDs ¶
func (qq *QuestionQuery) IDs(ctx context.Context) (ids []int, err error)
IDs executes the query and returns a list of Question IDs.
func (*QuestionQuery) IDsX ¶
func (qq *QuestionQuery) IDsX(ctx context.Context) []int
IDsX is like IDs, but panics if an error occurs.
func (*QuestionQuery) Limit ¶
func (qq *QuestionQuery) Limit(limit int) *QuestionQuery
Limit the number of records to be returned by this query.
func (*QuestionQuery) Offset ¶
func (qq *QuestionQuery) Offset(offset int) *QuestionQuery
Offset to start from.
func (*QuestionQuery) Only ¶
func (qq *QuestionQuery) Only(ctx context.Context) (*Question, error)
Only returns a single Question entity found by the query, ensuring it only returns one. Returns a *NotSingularError when more than one Question entity is found. Returns a *NotFoundError when no Question entities are found.
func (*QuestionQuery) OnlyID ¶
func (qq *QuestionQuery) OnlyID(ctx context.Context) (id int, err error)
OnlyID is like Only, but returns the only Question ID in the query. Returns a *NotSingularError when more than one Question ID is found. Returns a *NotFoundError when no entities are found.
func (*QuestionQuery) OnlyIDX ¶
func (qq *QuestionQuery) OnlyIDX(ctx context.Context) int
OnlyIDX is like OnlyID, but panics if an error occurs.
func (*QuestionQuery) OnlyX ¶
func (qq *QuestionQuery) OnlyX(ctx context.Context) *Question
OnlyX is like Only, but panics if an error occurs.
func (*QuestionQuery) Order ¶
func (qq *QuestionQuery) Order(o ...question.OrderOption) *QuestionQuery
Order specifies how the records should be ordered.
func (*QuestionQuery) QueryAnswers ¶
func (qq *QuestionQuery) QueryAnswers() *AnswerQuery
QueryAnswers chains the current query on the "answers" edge.
func (*QuestionQuery) QueryAuthor ¶
func (qq *QuestionQuery) QueryAuthor() *UserQuery
QueryAuthor chains the current query on the "author" edge.
func (*QuestionQuery) QueryTags ¶
func (qq *QuestionQuery) QueryTags() *TagQuery
QueryTags chains the current query on the "tags" edge.
func (*QuestionQuery) Select ¶
func (qq *QuestionQuery) Select(fields ...string) *QuestionSelect
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.Question.Query(). Select(question.FieldTitle). Scan(ctx, &v)
func (*QuestionQuery) Unique ¶
func (qq *QuestionQuery) Unique(unique bool) *QuestionQuery
Unique configures the query builder to filter duplicate records on query. By default, unique is set to true, and can be disabled using this method.
func (*QuestionQuery) Where ¶
func (qq *QuestionQuery) Where(ps ...predicate.Question) *QuestionQuery
Where adds a new predicate for the QuestionQuery builder.
func (*QuestionQuery) WithAnswers ¶
func (qq *QuestionQuery) WithAnswers(opts ...func(*AnswerQuery)) *QuestionQuery
WithAnswers tells the query-builder to eager-load the nodes that are connected to the "answers" edge. The optional arguments are used to configure the query builder of the edge.
func (*QuestionQuery) WithAuthor ¶
func (qq *QuestionQuery) WithAuthor(opts ...func(*UserQuery)) *QuestionQuery
WithAuthor tells the query-builder to eager-load the nodes that are connected to the "author" edge. The optional arguments are used to configure the query builder of the edge.
func (*QuestionQuery) WithTags ¶
func (qq *QuestionQuery) WithTags(opts ...func(*TagQuery)) *QuestionQuery
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 QuestionSelect ¶
type QuestionSelect struct { *QuestionQuery // contains filtered or unexported fields }
QuestionSelect is the builder for selecting fields of Question entities.
func (*QuestionSelect) Aggregate ¶
func (qs *QuestionSelect) Aggregate(fns ...AggregateFunc) *QuestionSelect
Aggregate adds the given aggregation functions to the selector query.
func (*QuestionSelect) Bool ¶
Bool returns a single bool from a selector. It is only allowed when selecting one field.
func (*QuestionSelect) Bools ¶
Bools returns list of bools from a selector. It is only allowed when selecting one field.
func (*QuestionSelect) Float64 ¶
Float64 returns a single float64 from a selector. It is only allowed when selecting one field.
func (*QuestionSelect) Float64s ¶
Float64s returns list of float64s from a selector. It is only allowed when selecting one field.
func (*QuestionSelect) Int ¶
Int returns a single int from a selector. It is only allowed when selecting one field.
func (*QuestionSelect) Ints ¶
Ints returns list of ints from a selector. It is only allowed when selecting one field.
func (*QuestionSelect) Scan ¶
func (qs *QuestionSelect) Scan(ctx context.Context, v any) error
Scan applies the selector query and scans the result into the given value.
func (*QuestionSelect) String ¶
String returns a single string from a selector. It is only allowed when selecting one field.
type QuestionUpdate ¶
type QuestionUpdate struct {
// contains filtered or unexported fields
}
QuestionUpdate is the builder for updating Question entities.
func (*QuestionUpdate) AddAnswerIDs ¶
func (qu *QuestionUpdate) AddAnswerIDs(ids ...int) *QuestionUpdate
AddAnswerIDs adds the "answers" edge to the Answer entity by IDs.
func (*QuestionUpdate) AddAnswers ¶
func (qu *QuestionUpdate) AddAnswers(a ...*Answer) *QuestionUpdate
AddAnswers adds the "answers" edges to the Answer entity.
func (*QuestionUpdate) AddTagIDs ¶
func (qu *QuestionUpdate) AddTagIDs(ids ...int) *QuestionUpdate
AddTagIDs adds the "tags" edge to the Tag entity by IDs.
func (*QuestionUpdate) AddTags ¶
func (qu *QuestionUpdate) AddTags(t ...*Tag) *QuestionUpdate
AddTags adds the "tags" edges to the Tag entity.
func (*QuestionUpdate) ClearAnswers ¶
func (qu *QuestionUpdate) ClearAnswers() *QuestionUpdate
ClearAnswers clears all "answers" edges to the Answer entity.
func (*QuestionUpdate) ClearAuthor ¶
func (qu *QuestionUpdate) ClearAuthor() *QuestionUpdate
ClearAuthor clears the "author" edge to the User entity.
func (*QuestionUpdate) ClearTags ¶
func (qu *QuestionUpdate) ClearTags() *QuestionUpdate
ClearTags clears all "tags" edges to the Tag entity.
func (*QuestionUpdate) Exec ¶
func (qu *QuestionUpdate) Exec(ctx context.Context) error
Exec executes the query.
func (*QuestionUpdate) ExecX ¶
func (qu *QuestionUpdate) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*QuestionUpdate) Mutation ¶
func (qu *QuestionUpdate) Mutation() *QuestionMutation
Mutation returns the QuestionMutation object of the builder.
func (*QuestionUpdate) RemoveAnswerIDs ¶
func (qu *QuestionUpdate) RemoveAnswerIDs(ids ...int) *QuestionUpdate
RemoveAnswerIDs removes the "answers" edge to Answer entities by IDs.
func (*QuestionUpdate) RemoveAnswers ¶
func (qu *QuestionUpdate) RemoveAnswers(a ...*Answer) *QuestionUpdate
RemoveAnswers removes "answers" edges to Answer entities.
func (*QuestionUpdate) RemoveTagIDs ¶
func (qu *QuestionUpdate) RemoveTagIDs(ids ...int) *QuestionUpdate
RemoveTagIDs removes the "tags" edge to Tag entities by IDs.
func (*QuestionUpdate) RemoveTags ¶
func (qu *QuestionUpdate) RemoveTags(t ...*Tag) *QuestionUpdate
RemoveTags removes "tags" edges to Tag entities.
func (*QuestionUpdate) Save ¶
func (qu *QuestionUpdate) Save(ctx context.Context) (int, error)
Save executes the query and returns the number of nodes affected by the update operation.
func (*QuestionUpdate) SaveX ¶
func (qu *QuestionUpdate) SaveX(ctx context.Context) int
SaveX is like Save, but panics if an error occurs.
func (*QuestionUpdate) SetAuthor ¶
func (qu *QuestionUpdate) SetAuthor(u *User) *QuestionUpdate
SetAuthor sets the "author" edge to the User entity.
func (*QuestionUpdate) SetAuthorID ¶
func (qu *QuestionUpdate) SetAuthorID(id int) *QuestionUpdate
SetAuthorID sets the "author" edge to the User entity by ID.
func (*QuestionUpdate) SetContent ¶
func (qu *QuestionUpdate) SetContent(s string) *QuestionUpdate
SetContent sets the "content" field.
func (*QuestionUpdate) SetNillableAuthorID ¶
func (qu *QuestionUpdate) SetNillableAuthorID(id *int) *QuestionUpdate
SetNillableAuthorID sets the "author" edge to the User entity by ID if the given value is not nil.
func (*QuestionUpdate) SetTitle ¶
func (qu *QuestionUpdate) SetTitle(s string) *QuestionUpdate
SetTitle sets the "title" field.
func (*QuestionUpdate) Where ¶
func (qu *QuestionUpdate) Where(ps ...predicate.Question) *QuestionUpdate
Where appends a list predicates to the QuestionUpdate builder.
type QuestionUpdateOne ¶
type QuestionUpdateOne struct {
// contains filtered or unexported fields
}
QuestionUpdateOne is the builder for updating a single Question entity.
func (*QuestionUpdateOne) AddAnswerIDs ¶
func (quo *QuestionUpdateOne) AddAnswerIDs(ids ...int) *QuestionUpdateOne
AddAnswerIDs adds the "answers" edge to the Answer entity by IDs.
func (*QuestionUpdateOne) AddAnswers ¶
func (quo *QuestionUpdateOne) AddAnswers(a ...*Answer) *QuestionUpdateOne
AddAnswers adds the "answers" edges to the Answer entity.
func (*QuestionUpdateOne) AddTagIDs ¶
func (quo *QuestionUpdateOne) AddTagIDs(ids ...int) *QuestionUpdateOne
AddTagIDs adds the "tags" edge to the Tag entity by IDs.
func (*QuestionUpdateOne) AddTags ¶
func (quo *QuestionUpdateOne) AddTags(t ...*Tag) *QuestionUpdateOne
AddTags adds the "tags" edges to the Tag entity.
func (*QuestionUpdateOne) ClearAnswers ¶
func (quo *QuestionUpdateOne) ClearAnswers() *QuestionUpdateOne
ClearAnswers clears all "answers" edges to the Answer entity.
func (*QuestionUpdateOne) ClearAuthor ¶
func (quo *QuestionUpdateOne) ClearAuthor() *QuestionUpdateOne
ClearAuthor clears the "author" edge to the User entity.
func (*QuestionUpdateOne) ClearTags ¶
func (quo *QuestionUpdateOne) ClearTags() *QuestionUpdateOne
ClearTags clears all "tags" edges to the Tag entity.
func (*QuestionUpdateOne) Exec ¶
func (quo *QuestionUpdateOne) Exec(ctx context.Context) error
Exec executes the query on the entity.
func (*QuestionUpdateOne) ExecX ¶
func (quo *QuestionUpdateOne) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*QuestionUpdateOne) Mutation ¶
func (quo *QuestionUpdateOne) Mutation() *QuestionMutation
Mutation returns the QuestionMutation object of the builder.
func (*QuestionUpdateOne) RemoveAnswerIDs ¶
func (quo *QuestionUpdateOne) RemoveAnswerIDs(ids ...int) *QuestionUpdateOne
RemoveAnswerIDs removes the "answers" edge to Answer entities by IDs.
func (*QuestionUpdateOne) RemoveAnswers ¶
func (quo *QuestionUpdateOne) RemoveAnswers(a ...*Answer) *QuestionUpdateOne
RemoveAnswers removes "answers" edges to Answer entities.
func (*QuestionUpdateOne) RemoveTagIDs ¶
func (quo *QuestionUpdateOne) RemoveTagIDs(ids ...int) *QuestionUpdateOne
RemoveTagIDs removes the "tags" edge to Tag entities by IDs.
func (*QuestionUpdateOne) RemoveTags ¶
func (quo *QuestionUpdateOne) RemoveTags(t ...*Tag) *QuestionUpdateOne
RemoveTags removes "tags" edges to Tag entities.
func (*QuestionUpdateOne) Save ¶
func (quo *QuestionUpdateOne) Save(ctx context.Context) (*Question, error)
Save executes the query and returns the updated Question entity.
func (*QuestionUpdateOne) SaveX ¶
func (quo *QuestionUpdateOne) SaveX(ctx context.Context) *Question
SaveX is like Save, but panics if an error occurs.
func (*QuestionUpdateOne) Select ¶
func (quo *QuestionUpdateOne) Select(field string, fields ...string) *QuestionUpdateOne
Select allows selecting one or more fields (columns) of the returned entity. The default is selecting all fields defined in the entity schema.
func (*QuestionUpdateOne) SetAuthor ¶
func (quo *QuestionUpdateOne) SetAuthor(u *User) *QuestionUpdateOne
SetAuthor sets the "author" edge to the User entity.
func (*QuestionUpdateOne) SetAuthorID ¶
func (quo *QuestionUpdateOne) SetAuthorID(id int) *QuestionUpdateOne
SetAuthorID sets the "author" edge to the User entity by ID.
func (*QuestionUpdateOne) SetContent ¶
func (quo *QuestionUpdateOne) SetContent(s string) *QuestionUpdateOne
SetContent sets the "content" field.
func (*QuestionUpdateOne) SetNillableAuthorID ¶
func (quo *QuestionUpdateOne) SetNillableAuthorID(id *int) *QuestionUpdateOne
SetNillableAuthorID sets the "author" edge to the User entity by ID if the given value is not nil.
func (*QuestionUpdateOne) SetTitle ¶
func (quo *QuestionUpdateOne) SetTitle(s string) *QuestionUpdateOne
SetTitle sets the "title" field.
func (*QuestionUpdateOne) Where ¶
func (quo *QuestionUpdateOne) Where(ps ...predicate.Question) *QuestionUpdateOne
Where appends a list predicates to the QuestionUpdate builder.
type RollbackFunc ¶
The RollbackFunc type is an adapter to allow the use of ordinary function as a Rollbacker. If f is a function with the appropriate signature, RollbackFunc(f) is a Rollbacker that calls f.
type RollbackHook ¶
type RollbackHook func(Rollbacker) Rollbacker
RollbackHook defines the "rollback middleware". A function that gets a Rollbacker and returns a Rollbacker. For example:
hook := func(next ent.Rollbacker) ent.Rollbacker { return ent.RollbackFunc(func(ctx context.Context, tx *ent.Tx) error { // Do some stuff before. if err := next.Rollback(ctx, tx); err != nil { return err } // Do some stuff after. return nil }) }
type Rollbacker ¶
Rollbacker is the interface that wraps the Rollback method.
type Tag ¶
type Tag struct { // ID of the ent. ID int `json:"id,omitempty"` // Name holds the value of the "name" field. Name string `json:"name,omitempty"` // Edges holds the relations/edges for other nodes in the graph. // The values are being populated by the TagQuery when eager-loading is set. Edges TagEdges `json:"edges"` // contains filtered or unexported fields }
Tag is the model entity for the Tag schema.
func (*Tag) QueryQuestions ¶
func (t *Tag) QueryQuestions() *QuestionQuery
QueryQuestions queries the "questions" edge of the Tag entity.
func (*Tag) Unwrap ¶
Unwrap unwraps the Tag entity that was returned from a transaction after it was closed, so that all future queries will be executed through the driver which created the transaction.
func (*Tag) Update ¶
func (t *Tag) Update() *TagUpdateOne
Update returns a builder for updating this Tag. Note that you need to call Tag.Unwrap() before calling this method if this Tag was returned from a transaction, and the transaction was committed or rolled back.
type TagClient ¶
type TagClient struct {
// contains filtered or unexported fields
}
TagClient is a client for the Tag schema.
func NewTagClient ¶
func NewTagClient(c config) *TagClient
NewTagClient returns a client for the Tag from the given config.
func (*TagClient) CreateBulk ¶
func (c *TagClient) CreateBulk(builders ...*TagCreate) *TagCreateBulk
CreateBulk returns a builder for creating a bulk of Tag entities.
func (*TagClient) DeleteOne ¶
func (c *TagClient) DeleteOne(t *Tag) *TagDeleteOne
DeleteOne returns a builder for deleting the given entity.
func (*TagClient) DeleteOneID ¶
func (c *TagClient) DeleteOneID(id int) *TagDeleteOne
DeleteOneID returns a builder for deleting the given entity by its id.
func (*TagClient) Intercept ¶
func (c *TagClient) Intercept(interceptors ...Interceptor)
Intercept adds a list of query interceptors to the interceptors stack. A call to `Intercept(f, g, h)` equals to `tag.Intercept(f(g(h())))`.
func (*TagClient) Interceptors ¶
func (c *TagClient) Interceptors() []Interceptor
Interceptors returns the client interceptors.
func (*TagClient) MapCreateBulk ¶
func (c *TagClient) MapCreateBulk(slice any, setFunc func(*TagCreate, int)) *TagCreateBulk
MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates a builder and applies setFunc on it.
func (*TagClient) QueryQuestions ¶
func (c *TagClient) QueryQuestions(t *Tag) *QuestionQuery
QueryQuestions queries the questions 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 int) *TagUpdateOne
UpdateOneID returns an update builder for the given id.
type TagCreate ¶
type TagCreate struct {
// contains filtered or unexported fields
}
TagCreate is the builder for creating a Tag entity.
func (*TagCreate) AddQuestionIDs ¶
AddQuestionIDs adds the "questions" edge to the Question entity by IDs.
func (*TagCreate) AddQuestions ¶
AddQuestions adds the "questions" edges to the Question entity.
func (*TagCreate) Mutation ¶
func (tc *TagCreate) Mutation() *TagMutation
Mutation returns the TagMutation object of the builder.
type TagCreateBulk ¶
type TagCreateBulk struct {
// contains filtered or unexported fields
}
TagCreateBulk is the builder for creating many Tag entities in bulk.
func (*TagCreateBulk) Exec ¶
func (tcb *TagCreateBulk) Exec(ctx context.Context) error
Exec executes the query.
func (*TagCreateBulk) ExecX ¶
func (tcb *TagCreateBulk) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
type TagDelete ¶
type TagDelete struct {
// contains filtered or unexported fields
}
TagDelete is the builder for deleting a Tag entity.
func (*TagDelete) Exec ¶
Exec executes the deletion query and returns how many vertices were deleted.
type TagDeleteOne ¶
type TagDeleteOne struct {
// contains filtered or unexported fields
}
TagDeleteOne is the builder for deleting a single Tag entity.
func (*TagDeleteOne) Exec ¶
func (tdo *TagDeleteOne) Exec(ctx context.Context) error
Exec executes the deletion query.
func (*TagDeleteOne) ExecX ¶
func (tdo *TagDeleteOne) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*TagDeleteOne) Where ¶
func (tdo *TagDeleteOne) Where(ps ...predicate.Tag) *TagDeleteOne
Where appends a list predicates to the TagDelete builder.
type TagEdges ¶
type TagEdges struct { // Questions holds the value of the questions edge. Questions []*Question `json:"questions,omitempty"` // contains filtered or unexported fields }
TagEdges holds the relations/edges for other nodes in the graph.
func (TagEdges) QuestionsOrErr ¶
QuestionsOrErr returns the Questions value or an error if the edge was not loaded in eager-loading.
type TagGroupBy ¶
type TagGroupBy struct {
// contains filtered or unexported fields
}
TagGroupBy is the group-by builder for Tag entities.
func (*TagGroupBy) Aggregate ¶
func (tgb *TagGroupBy) Aggregate(fns ...AggregateFunc) *TagGroupBy
Aggregate adds the given aggregation functions to the group-by query.
func (*TagGroupBy) Bool ¶
Bool returns a single bool from a selector. It is only allowed when selecting one field.
func (*TagGroupBy) Bools ¶
Bools returns list of bools from a selector. It is only allowed when selecting one field.
func (*TagGroupBy) Float64 ¶
Float64 returns a single float64 from a selector. It is only allowed when selecting one field.
func (*TagGroupBy) Float64s ¶
Float64s returns list of float64s from a selector. It is only allowed when selecting one field.
func (*TagGroupBy) Int ¶
Int returns a single int from a selector. It is only allowed when selecting one field.
func (*TagGroupBy) Ints ¶
Ints returns list of ints from a selector. It is only allowed when selecting one field.
func (*TagGroupBy) Scan ¶
func (tgb *TagGroupBy) Scan(ctx context.Context, v any) error
Scan applies the selector query and scans the result into the given value.
func (*TagGroupBy) String ¶
String returns a single string from a selector. It is only allowed when selecting one field.
type TagMutation ¶
type TagMutation struct {
// contains filtered or unexported fields
}
TagMutation represents an operation that mutates the Tag nodes in the graph.
func (*TagMutation) AddField ¶
func (m *TagMutation) AddField(name string, value ent.Value) error
AddField adds the value to the field with the given name. It returns an error if the field is not defined in the schema, or if the type mismatched the field type.
func (*TagMutation) AddQuestionIDs ¶
func (m *TagMutation) AddQuestionIDs(ids ...int)
AddQuestionIDs adds the "questions" edge to the Question 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) ClearQuestions ¶
func (m *TagMutation) ClearQuestions()
ClearQuestions clears the "questions" edge to the Question entity.
func (*TagMutation) ClearedEdges ¶
func (m *TagMutation) ClearedEdges() []string
ClearedEdges returns all edge names that were cleared in this mutation.
func (*TagMutation) ClearedFields ¶
func (m *TagMutation) ClearedFields() []string
ClearedFields returns all nullable fields that were cleared during this mutation.
func (TagMutation) Client ¶
func (m TagMutation) Client() *Client
Client returns a new `ent.Client` from the mutation. If the mutation was executed in a transaction (ent.Tx), a transactional client is returned.
func (*TagMutation) EdgeCleared ¶
func (m *TagMutation) EdgeCleared(name string) bool
EdgeCleared returns a boolean which indicates if the edge with the given name was cleared in this mutation.
func (*TagMutation) Field ¶
func (m *TagMutation) Field(name string) (ent.Value, bool)
Field returns the value of a field with the given name. The second boolean return value indicates that this field was not set, or was not defined in the schema.
func (*TagMutation) FieldCleared ¶
func (m *TagMutation) FieldCleared(name string) bool
FieldCleared returns a boolean indicating if a field with the given name was cleared in this mutation.
func (*TagMutation) Fields ¶
func (m *TagMutation) Fields() []string
Fields returns all fields that were changed during this mutation. Note that in order to get all numeric fields that were incremented/decremented, call AddedFields().
func (*TagMutation) ID ¶
func (m *TagMutation) ID() (id int, exists bool)
ID returns the ID value in the mutation. Note that the ID is only available if it was provided to the builder or after it was returned from the database.
func (*TagMutation) IDs ¶
func (m *TagMutation) IDs(ctx context.Context) ([]int, error)
IDs queries the database and returns the entity ids that match the mutation's predicate. That means, if the mutation is applied within a transaction with an isolation level such as sql.LevelSerializable, the returned ids match the ids of the rows that will be updated or updated by the mutation.
func (*TagMutation) Name ¶
func (m *TagMutation) Name() (r string, exists bool)
Name returns the value of the "name" field in the mutation.
func (*TagMutation) OldField ¶
OldField returns the old value of the field from the database. An error is returned if the mutation operation is not UpdateOne, or the query to the database failed.
func (*TagMutation) OldName ¶
func (m *TagMutation) OldName(ctx context.Context) (v string, err error)
OldName returns the old "name" field's value of the Tag entity. If the Tag object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (*TagMutation) QuestionsCleared ¶
func (m *TagMutation) QuestionsCleared() bool
QuestionsCleared reports if the "questions" edge to the Question entity was cleared.
func (*TagMutation) QuestionsIDs ¶
func (m *TagMutation) QuestionsIDs() (ids []int)
QuestionsIDs returns the "questions" edge IDs in the mutation.
func (*TagMutation) RemoveQuestionIDs ¶
func (m *TagMutation) RemoveQuestionIDs(ids ...int)
RemoveQuestionIDs removes the "questions" edge to the Question 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) RemovedQuestionsIDs ¶
func (m *TagMutation) RemovedQuestionsIDs() (ids []int)
RemovedQuestions returns the removed IDs of the "questions" edge to the Question entity.
func (*TagMutation) ResetEdge ¶
func (m *TagMutation) ResetEdge(name string) error
ResetEdge resets all changes to the edge with the given name in this mutation. It returns an error if the edge is not defined in the schema.
func (*TagMutation) ResetField ¶
func (m *TagMutation) ResetField(name string) error
ResetField resets all changes in the mutation for the field with the given name. It returns an error if the field is not defined in the schema.
func (*TagMutation) ResetName ¶
func (m *TagMutation) ResetName()
ResetName resets all changes to the "name" field.
func (*TagMutation) ResetQuestions ¶
func (m *TagMutation) ResetQuestions()
ResetQuestions resets all changes to the "questions" edge.
func (*TagMutation) SetField ¶
func (m *TagMutation) SetField(name string, value ent.Value) error
SetField sets the value of a field with the given name. It returns an error if the field is not defined in the schema, or if the type mismatched the field type.
func (*TagMutation) SetName ¶
func (m *TagMutation) SetName(s string)
SetName sets the "name" field.
func (*TagMutation) SetOp ¶
func (m *TagMutation) SetOp(op Op)
SetOp allows setting the mutation operation.
func (TagMutation) Tx ¶
func (m TagMutation) Tx() (*Tx, error)
Tx returns an `ent.Tx` for mutations that were executed in transactions; it returns an error otherwise.
func (*TagMutation) Type ¶
func (m *TagMutation) Type() string
Type returns the node type of this mutation (Tag).
func (*TagMutation) Where ¶
func (m *TagMutation) Where(ps ...predicate.Tag)
Where appends a list predicates to the TagMutation builder.
func (*TagMutation) WhereP ¶
func (m *TagMutation) WhereP(ps ...func(*sql.Selector))
WhereP appends storage-level predicates to the TagMutation builder. Using this method, users can use type-assertion to append predicates that do not depend on any generated package.
type TagQuery ¶
type TagQuery struct {
// contains filtered or unexported fields
}
TagQuery is the builder for querying Tag entities.
func (*TagQuery) Aggregate ¶
func (tq *TagQuery) Aggregate(fns ...AggregateFunc) *TagSelect
Aggregate returns a TagSelect configured with the given aggregations.
func (*TagQuery) Clone ¶
Clone returns a duplicate of the TagQuery builder, including all associated steps. It can be used to prepare common query builders and use them differently after the clone is made.
func (*TagQuery) First ¶
First returns the first Tag entity from the query. Returns a *NotFoundError when no Tag was found.
func (*TagQuery) FirstID ¶
FirstID returns the first Tag ID from the query. Returns a *NotFoundError when no Tag ID was found.
func (*TagQuery) GroupBy ¶
func (tq *TagQuery) GroupBy(field string, fields ...string) *TagGroupBy
GroupBy is used to group vertices by one or more fields/columns. It is often used with aggregate functions, like: count, max, mean, min, sum.
Example:
var v []struct { Name string `json:"name,omitempty"` Count int `json:"count,omitempty"` } client.Tag.Query(). GroupBy(tag.FieldName). Aggregate(ent.Count()). Scan(ctx, &v)
func (*TagQuery) Only ¶
Only returns a single Tag entity found by the query, ensuring it only returns one. Returns a *NotSingularError when more than one Tag entity is found. Returns a *NotFoundError when no Tag entities are found.
func (*TagQuery) OnlyID ¶
OnlyID is like Only, but returns the only Tag ID in the query. Returns a *NotSingularError when more than one Tag ID is found. Returns a *NotFoundError when no entities are found.
func (*TagQuery) Order ¶
func (tq *TagQuery) Order(o ...tag.OrderOption) *TagQuery
Order specifies how the records should be ordered.
func (*TagQuery) QueryQuestions ¶
func (tq *TagQuery) QueryQuestions() *QuestionQuery
QueryQuestions chains the current query on the "questions" edge.
func (*TagQuery) Select ¶
Select allows the selection one or more fields/columns for the given query, instead of selecting all fields in the entity.
Example:
var v []struct { Name string `json:"name,omitempty"` } client.Tag.Query(). Select(tag.FieldName). Scan(ctx, &v)
func (*TagQuery) Unique ¶
Unique configures the query builder to filter duplicate records on query. By default, unique is set to true, and can be disabled using this method.
func (*TagQuery) WithQuestions ¶
func (tq *TagQuery) WithQuestions(opts ...func(*QuestionQuery)) *TagQuery
WithQuestions tells the query-builder to eager-load the nodes that are connected to the "questions" edge. The optional arguments are used to configure the query builder of the edge.
type TagSelect ¶
type TagSelect struct { *TagQuery // contains filtered or unexported fields }
TagSelect is the builder for selecting fields of Tag entities.
func (*TagSelect) Aggregate ¶
func (ts *TagSelect) Aggregate(fns ...AggregateFunc) *TagSelect
Aggregate adds the given aggregation functions to the selector query.
func (*TagSelect) Bool ¶
Bool returns a single bool from a selector. It is only allowed when selecting one field.
func (*TagSelect) Bools ¶
Bools returns list of bools from a selector. It is only allowed when selecting one field.
func (*TagSelect) Float64 ¶
Float64 returns a single float64 from a selector. It is only allowed when selecting one field.
func (*TagSelect) Float64s ¶
Float64s returns list of float64s from a selector. It is only allowed when selecting one field.
func (*TagSelect) Int ¶
Int returns a single int from a selector. It is only allowed when selecting one field.
func (*TagSelect) Ints ¶
Ints returns list of ints from a selector. It is only allowed when selecting one field.
func (*TagSelect) String ¶
String returns a single string from a selector. It is only allowed when selecting one field.
type TagUpdate ¶
type TagUpdate struct {
// contains filtered or unexported fields
}
TagUpdate is the builder for updating Tag entities.
func (*TagUpdate) AddQuestionIDs ¶
AddQuestionIDs adds the "questions" edge to the Question entity by IDs.
func (*TagUpdate) AddQuestions ¶
AddQuestions adds the "questions" edges to the Question entity.
func (*TagUpdate) ClearQuestions ¶
ClearQuestions clears all "questions" edges to the Question entity.
func (*TagUpdate) Mutation ¶
func (tu *TagUpdate) Mutation() *TagMutation
Mutation returns the TagMutation object of the builder.
func (*TagUpdate) RemoveQuestionIDs ¶
RemoveQuestionIDs removes the "questions" edge to Question entities by IDs.
func (*TagUpdate) RemoveQuestions ¶
RemoveQuestions removes "questions" edges to Question entities.
func (*TagUpdate) Save ¶
Save executes the query and returns the number of nodes affected by the update operation.
type TagUpdateOne ¶
type TagUpdateOne struct {
// contains filtered or unexported fields
}
TagUpdateOne is the builder for updating a single Tag entity.
func (*TagUpdateOne) AddQuestionIDs ¶
func (tuo *TagUpdateOne) AddQuestionIDs(ids ...int) *TagUpdateOne
AddQuestionIDs adds the "questions" edge to the Question entity by IDs.
func (*TagUpdateOne) AddQuestions ¶
func (tuo *TagUpdateOne) AddQuestions(q ...*Question) *TagUpdateOne
AddQuestions adds the "questions" edges to the Question entity.
func (*TagUpdateOne) ClearQuestions ¶
func (tuo *TagUpdateOne) ClearQuestions() *TagUpdateOne
ClearQuestions clears all "questions" edges to the Question 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) RemoveQuestionIDs ¶
func (tuo *TagUpdateOne) RemoveQuestionIDs(ids ...int) *TagUpdateOne
RemoveQuestionIDs removes the "questions" edge to Question entities by IDs.
func (*TagUpdateOne) RemoveQuestions ¶
func (tuo *TagUpdateOne) RemoveQuestions(q ...*Question) *TagUpdateOne
RemoveQuestions removes "questions" edges to Question entities.
func (*TagUpdateOne) Save ¶
func (tuo *TagUpdateOne) Save(ctx context.Context) (*Tag, error)
Save executes the query and returns the updated Tag entity.
func (*TagUpdateOne) SaveX ¶
func (tuo *TagUpdateOne) SaveX(ctx context.Context) *Tag
SaveX is like Save, but panics if an error occurs.
func (*TagUpdateOne) Select ¶
func (tuo *TagUpdateOne) Select(field string, fields ...string) *TagUpdateOne
Select allows selecting one or more fields (columns) of the returned entity. The default is selecting all fields defined in the entity schema.
func (*TagUpdateOne) SetName ¶
func (tuo *TagUpdateOne) SetName(s string) *TagUpdateOne
SetName sets the "name" field.
func (*TagUpdateOne) Where ¶
func (tuo *TagUpdateOne) Where(ps ...predicate.Tag) *TagUpdateOne
Where appends a list predicates to the TagUpdate builder.
type TraverseFunc ¶
type TraverseFunc = ent.TraverseFunc
ent aliases to avoid import conflicts in user's code.
type Tx ¶
type Tx struct { // Answer is the client for interacting with the Answer builders. Answer *AnswerClient // Question is the client for interacting with the Question builders. Question *QuestionClient // Tag is the client for interacting with the Tag builders. Tag *TagClient // User is the client for interacting with the User builders. User *UserClient // contains filtered or unexported fields }
Tx is a transactional client that is created by calling Client.Tx().
func TxFromContext ¶
TxFromContext returns a Tx stored inside a context, or nil if there isn't one.
func (*Tx) OnRollback ¶
func (tx *Tx) OnRollback(f RollbackHook)
OnRollback adds a hook to call on rollback.
type User ¶
type User struct { // ID of the ent. ID int `json:"id,omitempty"` // Username holds the value of the "username" field. Username string `json:"username,omitempty"` // Email holds the value of the "email" field. Email string `json:"email,omitempty"` // Password holds the value of the "password" field. Password string `json:"-"` // CreatedAt holds the value of the "created_at" field. CreatedAt time.Time `json:"created_at,omitempty"` // Superuser holds the value of the "superuser" field. Superuser bool `json:"superuser,omitempty"` // Edges holds the relations/edges for other nodes in the graph. // The values are being populated by the UserQuery when eager-loading is set. Edges UserEdges `json:"edges"` // contains filtered or unexported fields }
User is the model entity for the User schema.
func (*User) QueryAnswers ¶
func (u *User) QueryAnswers() *AnswerQuery
QueryAnswers queries the "answers" edge of the User entity.
func (*User) QueryQuestions ¶
func (u *User) QueryQuestions() *QuestionQuery
QueryQuestions queries the "questions" edge of the User entity.
func (*User) Unwrap ¶
Unwrap unwraps the User entity that was returned from a transaction after it was closed, so that all future queries will be executed through the driver which created the transaction.
func (*User) Update ¶
func (u *User) Update() *UserUpdateOne
Update returns a builder for updating this User. Note that you need to call User.Unwrap() before calling this method if this User was returned from a transaction, and the transaction was committed or rolled back.
type UserClient ¶
type UserClient struct {
// contains filtered or unexported fields
}
UserClient is a client for the User schema.
func NewUserClient ¶
func NewUserClient(c config) *UserClient
NewUserClient returns a client for the User from the given config.
func (*UserClient) Create ¶
func (c *UserClient) Create() *UserCreate
Create returns a builder for creating a User entity.
func (*UserClient) CreateBulk ¶
func (c *UserClient) CreateBulk(builders ...*UserCreate) *UserCreateBulk
CreateBulk returns a builder for creating a bulk of User entities.
func (*UserClient) Delete ¶
func (c *UserClient) Delete() *UserDelete
Delete returns a delete builder for User.
func (*UserClient) DeleteOne ¶
func (c *UserClient) DeleteOne(u *User) *UserDeleteOne
DeleteOne returns a builder for deleting the given entity.
func (*UserClient) DeleteOneID ¶
func (c *UserClient) DeleteOneID(id int) *UserDeleteOne
DeleteOneID returns a builder for deleting the given entity by its id.
func (*UserClient) GetX ¶
func (c *UserClient) GetX(ctx context.Context, id int) *User
GetX is like Get, but panics if an error occurs.
func (*UserClient) Intercept ¶
func (c *UserClient) Intercept(interceptors ...Interceptor)
Intercept adds a list of query interceptors to the interceptors stack. A call to `Intercept(f, g, h)` equals to `user.Intercept(f(g(h())))`.
func (*UserClient) Interceptors ¶
func (c *UserClient) Interceptors() []Interceptor
Interceptors returns the client interceptors.
func (*UserClient) MapCreateBulk ¶
func (c *UserClient) MapCreateBulk(slice any, setFunc func(*UserCreate, int)) *UserCreateBulk
MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates a builder and applies setFunc on it.
func (*UserClient) Query ¶
func (c *UserClient) Query() *UserQuery
Query returns a query builder for User.
func (*UserClient) QueryAnswers ¶
func (c *UserClient) QueryAnswers(u *User) *AnswerQuery
QueryAnswers queries the answers edge of a User.
func (*UserClient) QueryQuestions ¶
func (c *UserClient) QueryQuestions(u *User) *QuestionQuery
QueryQuestions queries the questions edge of a User.
func (*UserClient) QueryTags ¶
func (c *UserClient) QueryTags(u *User) *TagQuery
QueryTags queries the tags edge of a User.
func (*UserClient) Update ¶
func (c *UserClient) Update() *UserUpdate
Update returns an update builder for User.
func (*UserClient) UpdateOne ¶
func (c *UserClient) UpdateOne(u *User) *UserUpdateOne
UpdateOne returns an update builder for the given entity.
func (*UserClient) UpdateOneID ¶
func (c *UserClient) UpdateOneID(id int) *UserUpdateOne
UpdateOneID returns an update builder for the given id.
func (*UserClient) Use ¶
func (c *UserClient) Use(hooks ...Hook)
Use adds a list of mutation hooks to the hooks stack. A call to `Use(f, g, h)` equals to `user.Hooks(f(g(h())))`.
type UserCreate ¶
type UserCreate struct {
// contains filtered or unexported fields
}
UserCreate is the builder for creating a User entity.
func (*UserCreate) AddAnswerIDs ¶
func (uc *UserCreate) AddAnswerIDs(ids ...int) *UserCreate
AddAnswerIDs adds the "answers" edge to the Answer entity by IDs.
func (*UserCreate) AddAnswers ¶
func (uc *UserCreate) AddAnswers(a ...*Answer) *UserCreate
AddAnswers adds the "answers" edges to the Answer entity.
func (*UserCreate) AddQuestionIDs ¶
func (uc *UserCreate) AddQuestionIDs(ids ...int) *UserCreate
AddQuestionIDs adds the "questions" edge to the Question entity by IDs.
func (*UserCreate) AddQuestions ¶
func (uc *UserCreate) AddQuestions(q ...*Question) *UserCreate
AddQuestions adds the "questions" edges to the Question entity.
func (*UserCreate) AddTagIDs ¶
func (uc *UserCreate) AddTagIDs(ids ...int) *UserCreate
AddTagIDs adds the "tags" edge to the Tag entity by IDs.
func (*UserCreate) AddTags ¶
func (uc *UserCreate) AddTags(t ...*Tag) *UserCreate
AddTags adds the "tags" edges to the Tag entity.
func (*UserCreate) Exec ¶
func (uc *UserCreate) Exec(ctx context.Context) error
Exec executes the query.
func (*UserCreate) ExecX ¶
func (uc *UserCreate) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*UserCreate) Mutation ¶
func (uc *UserCreate) Mutation() *UserMutation
Mutation returns the UserMutation object of the builder.
func (*UserCreate) Save ¶
func (uc *UserCreate) Save(ctx context.Context) (*User, error)
Save creates the User in the database.
func (*UserCreate) SaveX ¶
func (uc *UserCreate) SaveX(ctx context.Context) *User
SaveX calls Save and panics if Save returns an error.
func (*UserCreate) SetCreatedAt ¶
func (uc *UserCreate) SetCreatedAt(t time.Time) *UserCreate
SetCreatedAt sets the "created_at" field.
func (*UserCreate) SetEmail ¶
func (uc *UserCreate) SetEmail(s string) *UserCreate
SetEmail sets the "email" field.
func (*UserCreate) SetNillableCreatedAt ¶
func (uc *UserCreate) SetNillableCreatedAt(t *time.Time) *UserCreate
SetNillableCreatedAt sets the "created_at" field if the given value is not nil.
func (*UserCreate) SetNillableSuperuser ¶
func (uc *UserCreate) SetNillableSuperuser(b *bool) *UserCreate
SetNillableSuperuser sets the "superuser" field if the given value is not nil.
func (*UserCreate) SetPassword ¶
func (uc *UserCreate) SetPassword(s string) *UserCreate
SetPassword sets the "password" field.
func (*UserCreate) SetSuperuser ¶
func (uc *UserCreate) SetSuperuser(b bool) *UserCreate
SetSuperuser sets the "superuser" field.
func (*UserCreate) SetUsername ¶
func (uc *UserCreate) SetUsername(s string) *UserCreate
SetUsername sets the "username" field.
type UserCreateBulk ¶
type UserCreateBulk struct {
// contains filtered or unexported fields
}
UserCreateBulk is the builder for creating many User entities in bulk.
func (*UserCreateBulk) Exec ¶
func (ucb *UserCreateBulk) Exec(ctx context.Context) error
Exec executes the query.
func (*UserCreateBulk) ExecX ¶
func (ucb *UserCreateBulk) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
type UserDelete ¶
type UserDelete struct {
// contains filtered or unexported fields
}
UserDelete is the builder for deleting a User entity.
func (*UserDelete) Exec ¶
func (ud *UserDelete) Exec(ctx context.Context) (int, error)
Exec executes the deletion query and returns how many vertices were deleted.
func (*UserDelete) ExecX ¶
func (ud *UserDelete) ExecX(ctx context.Context) int
ExecX is like Exec, but panics if an error occurs.
func (*UserDelete) Where ¶
func (ud *UserDelete) Where(ps ...predicate.User) *UserDelete
Where appends a list predicates to the UserDelete builder.
type UserDeleteOne ¶
type UserDeleteOne struct {
// contains filtered or unexported fields
}
UserDeleteOne is the builder for deleting a single User entity.
func (*UserDeleteOne) Exec ¶
func (udo *UserDeleteOne) Exec(ctx context.Context) error
Exec executes the deletion query.
func (*UserDeleteOne) ExecX ¶
func (udo *UserDeleteOne) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*UserDeleteOne) Where ¶
func (udo *UserDeleteOne) Where(ps ...predicate.User) *UserDeleteOne
Where appends a list predicates to the UserDelete builder.
type UserEdges ¶
type UserEdges struct { // Questions holds the value of the questions edge. Questions []*Question `json:"questions,omitempty"` // Answers holds the value of the answers edge. Answers []*Answer `json:"answers,omitempty"` // Tags holds the value of the tags edge. Tags []*Tag `json:"tags,omitempty"` // contains filtered or unexported fields }
UserEdges holds the relations/edges for other nodes in the graph.
func (UserEdges) AnswersOrErr ¶
AnswersOrErr returns the Answers value or an error if the edge was not loaded in eager-loading.
func (UserEdges) QuestionsOrErr ¶
QuestionsOrErr returns the Questions value or an error if the edge was not loaded in eager-loading.
type UserGroupBy ¶
type UserGroupBy struct {
// contains filtered or unexported fields
}
UserGroupBy is the group-by builder for User entities.
func (*UserGroupBy) Aggregate ¶
func (ugb *UserGroupBy) Aggregate(fns ...AggregateFunc) *UserGroupBy
Aggregate adds the given aggregation functions to the group-by query.
func (*UserGroupBy) Bool ¶
Bool returns a single bool from a selector. It is only allowed when selecting one field.
func (*UserGroupBy) Bools ¶
Bools returns list of bools from a selector. It is only allowed when selecting one field.
func (*UserGroupBy) Float64 ¶
Float64 returns a single float64 from a selector. It is only allowed when selecting one field.
func (*UserGroupBy) Float64s ¶
Float64s returns list of float64s from a selector. It is only allowed when selecting one field.
func (*UserGroupBy) Int ¶
Int returns a single int from a selector. It is only allowed when selecting one field.
func (*UserGroupBy) Ints ¶
Ints returns list of ints from a selector. It is only allowed when selecting one field.
func (*UserGroupBy) Scan ¶
func (ugb *UserGroupBy) Scan(ctx context.Context, v any) error
Scan applies the selector query and scans the result into the given value.
func (*UserGroupBy) String ¶
String returns a single string from a selector. It is only allowed when selecting one field.
type UserMutation ¶
type UserMutation struct {
// contains filtered or unexported fields
}
UserMutation represents an operation that mutates the User nodes in the graph.
func (*UserMutation) AddAnswerIDs ¶
func (m *UserMutation) AddAnswerIDs(ids ...int)
AddAnswerIDs adds the "answers" edge to the Answer entity by ids.
func (*UserMutation) AddField ¶
func (m *UserMutation) AddField(name string, value ent.Value) error
AddField adds the value to the field with the given name. It returns an error if the field is not defined in the schema, or if the type mismatched the field type.
func (*UserMutation) AddQuestionIDs ¶
func (m *UserMutation) AddQuestionIDs(ids ...int)
AddQuestionIDs adds the "questions" edge to the Question entity by ids.
func (*UserMutation) AddTagIDs ¶
func (m *UserMutation) AddTagIDs(ids ...int)
AddTagIDs adds the "tags" edge to the Tag entity by ids.
func (*UserMutation) AddedEdges ¶
func (m *UserMutation) AddedEdges() []string
AddedEdges returns all edge names that were set/added in this mutation.
func (*UserMutation) AddedField ¶
func (m *UserMutation) AddedField(name string) (ent.Value, bool)
AddedField returns the numeric value that was incremented/decremented on a field with the given name. The second boolean return value indicates that this field was not set, or was not defined in the schema.
func (*UserMutation) AddedFields ¶
func (m *UserMutation) AddedFields() []string
AddedFields returns all numeric fields that were incremented/decremented during this mutation.
func (*UserMutation) AddedIDs ¶
func (m *UserMutation) AddedIDs(name string) []ent.Value
AddedIDs returns all IDs (to other nodes) that were added for the given edge name in this mutation.
func (*UserMutation) AnswersCleared ¶
func (m *UserMutation) AnswersCleared() bool
AnswersCleared reports if the "answers" edge to the Answer entity was cleared.
func (*UserMutation) AnswersIDs ¶
func (m *UserMutation) AnswersIDs() (ids []int)
AnswersIDs returns the "answers" edge IDs in the mutation.
func (*UserMutation) ClearAnswers ¶
func (m *UserMutation) ClearAnswers()
ClearAnswers clears the "answers" edge to the Answer entity.
func (*UserMutation) ClearEdge ¶
func (m *UserMutation) ClearEdge(name string) error
ClearEdge clears the value of the edge with the given name. It returns an error if that edge is not defined in the schema.
func (*UserMutation) ClearField ¶
func (m *UserMutation) ClearField(name string) error
ClearField clears the value of the field with the given name. It returns an error if the field is not defined in the schema.
func (*UserMutation) ClearQuestions ¶
func (m *UserMutation) ClearQuestions()
ClearQuestions clears the "questions" edge to the Question entity.
func (*UserMutation) ClearTags ¶
func (m *UserMutation) ClearTags()
ClearTags clears the "tags" edge to the Tag entity.
func (*UserMutation) ClearedEdges ¶
func (m *UserMutation) ClearedEdges() []string
ClearedEdges returns all edge names that were cleared in this mutation.
func (*UserMutation) ClearedFields ¶
func (m *UserMutation) ClearedFields() []string
ClearedFields returns all nullable fields that were cleared during this mutation.
func (UserMutation) Client ¶
func (m UserMutation) Client() *Client
Client returns a new `ent.Client` from the mutation. If the mutation was executed in a transaction (ent.Tx), a transactional client is returned.
func (*UserMutation) CreatedAt ¶
func (m *UserMutation) CreatedAt() (r time.Time, exists bool)
CreatedAt returns the value of the "created_at" field in the mutation.
func (*UserMutation) EdgeCleared ¶
func (m *UserMutation) EdgeCleared(name string) bool
EdgeCleared returns a boolean which indicates if the edge with the given name was cleared in this mutation.
func (*UserMutation) Email ¶
func (m *UserMutation) Email() (r string, exists bool)
Email returns the value of the "email" field in the mutation.
func (*UserMutation) Field ¶
func (m *UserMutation) Field(name string) (ent.Value, bool)
Field returns the value of a field with the given name. The second boolean return value indicates that this field was not set, or was not defined in the schema.
func (*UserMutation) FieldCleared ¶
func (m *UserMutation) FieldCleared(name string) bool
FieldCleared returns a boolean indicating if a field with the given name was cleared in this mutation.
func (*UserMutation) Fields ¶
func (m *UserMutation) Fields() []string
Fields returns all fields that were changed during this mutation. Note that in order to get all numeric fields that were incremented/decremented, call AddedFields().
func (*UserMutation) ID ¶
func (m *UserMutation) ID() (id int, exists bool)
ID returns the ID value in the mutation. Note that the ID is only available if it was provided to the builder or after it was returned from the database.
func (*UserMutation) IDs ¶
func (m *UserMutation) IDs(ctx context.Context) ([]int, error)
IDs queries the database and returns the entity ids that match the mutation's predicate. That means, if the mutation is applied within a transaction with an isolation level such as sql.LevelSerializable, the returned ids match the ids of the rows that will be updated or updated by the mutation.
func (*UserMutation) OldCreatedAt ¶
OldCreatedAt returns the old "created_at" field's value of the User entity. If the User object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (*UserMutation) OldEmail ¶
func (m *UserMutation) OldEmail(ctx context.Context) (v string, err error)
OldEmail returns the old "email" field's value of the User entity. If the User object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (*UserMutation) OldField ¶
OldField returns the old value of the field from the database. An error is returned if the mutation operation is not UpdateOne, or the query to the database failed.
func (*UserMutation) OldPassword ¶
func (m *UserMutation) OldPassword(ctx context.Context) (v string, err error)
OldPassword returns the old "password" field's value of the User entity. If the User object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (*UserMutation) OldSuperuser ¶
func (m *UserMutation) OldSuperuser(ctx context.Context) (v bool, err error)
OldSuperuser returns the old "superuser" field's value of the User entity. If the User object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (*UserMutation) OldUsername ¶
func (m *UserMutation) OldUsername(ctx context.Context) (v string, err error)
OldUsername returns the old "username" field's value of the User entity. If the User object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (*UserMutation) Password ¶
func (m *UserMutation) Password() (r string, exists bool)
Password returns the value of the "password" field in the mutation.
func (*UserMutation) QuestionsCleared ¶
func (m *UserMutation) QuestionsCleared() bool
QuestionsCleared reports if the "questions" edge to the Question entity was cleared.
func (*UserMutation) QuestionsIDs ¶
func (m *UserMutation) QuestionsIDs() (ids []int)
QuestionsIDs returns the "questions" edge IDs in the mutation.
func (*UserMutation) RemoveAnswerIDs ¶
func (m *UserMutation) RemoveAnswerIDs(ids ...int)
RemoveAnswerIDs removes the "answers" edge to the Answer entity by IDs.
func (*UserMutation) RemoveQuestionIDs ¶
func (m *UserMutation) RemoveQuestionIDs(ids ...int)
RemoveQuestionIDs removes the "questions" edge to the Question entity by IDs.
func (*UserMutation) RemoveTagIDs ¶
func (m *UserMutation) RemoveTagIDs(ids ...int)
RemoveTagIDs removes the "tags" edge to the Tag entity by IDs.
func (*UserMutation) RemovedAnswersIDs ¶
func (m *UserMutation) RemovedAnswersIDs() (ids []int)
RemovedAnswers returns the removed IDs of the "answers" edge to the Answer entity.
func (*UserMutation) RemovedEdges ¶
func (m *UserMutation) RemovedEdges() []string
RemovedEdges returns all edge names that were removed in this mutation.
func (*UserMutation) RemovedIDs ¶
func (m *UserMutation) RemovedIDs(name string) []ent.Value
RemovedIDs returns all IDs (to other nodes) that were removed for the edge with the given name in this mutation.
func (*UserMutation) RemovedQuestionsIDs ¶
func (m *UserMutation) RemovedQuestionsIDs() (ids []int)
RemovedQuestions returns the removed IDs of the "questions" edge to the Question entity.
func (*UserMutation) RemovedTagsIDs ¶
func (m *UserMutation) RemovedTagsIDs() (ids []int)
RemovedTags returns the removed IDs of the "tags" edge to the Tag entity.
func (*UserMutation) ResetAnswers ¶
func (m *UserMutation) ResetAnswers()
ResetAnswers resets all changes to the "answers" edge.
func (*UserMutation) ResetCreatedAt ¶
func (m *UserMutation) ResetCreatedAt()
ResetCreatedAt resets all changes to the "created_at" field.
func (*UserMutation) ResetEdge ¶
func (m *UserMutation) ResetEdge(name string) error
ResetEdge resets all changes to the edge with the given name in this mutation. It returns an error if the edge is not defined in the schema.
func (*UserMutation) ResetEmail ¶
func (m *UserMutation) ResetEmail()
ResetEmail resets all changes to the "email" field.
func (*UserMutation) ResetField ¶
func (m *UserMutation) ResetField(name string) error
ResetField resets all changes in the mutation for the field with the given name. It returns an error if the field is not defined in the schema.
func (*UserMutation) ResetPassword ¶
func (m *UserMutation) ResetPassword()
ResetPassword resets all changes to the "password" field.
func (*UserMutation) ResetQuestions ¶
func (m *UserMutation) ResetQuestions()
ResetQuestions resets all changes to the "questions" edge.
func (*UserMutation) ResetSuperuser ¶
func (m *UserMutation) ResetSuperuser()
ResetSuperuser resets all changes to the "superuser" field.
func (*UserMutation) ResetTags ¶
func (m *UserMutation) ResetTags()
ResetTags resets all changes to the "tags" edge.
func (*UserMutation) ResetUsername ¶
func (m *UserMutation) ResetUsername()
ResetUsername resets all changes to the "username" field.
func (*UserMutation) SetCreatedAt ¶
func (m *UserMutation) SetCreatedAt(t time.Time)
SetCreatedAt sets the "created_at" field.
func (*UserMutation) SetEmail ¶
func (m *UserMutation) SetEmail(s string)
SetEmail sets the "email" field.
func (*UserMutation) SetField ¶
func (m *UserMutation) SetField(name string, value ent.Value) error
SetField sets the value of a field with the given name. It returns an error if the field is not defined in the schema, or if the type mismatched the field type.
func (*UserMutation) SetOp ¶
func (m *UserMutation) SetOp(op Op)
SetOp allows setting the mutation operation.
func (*UserMutation) SetPassword ¶
func (m *UserMutation) SetPassword(s string)
SetPassword sets the "password" field.
func (*UserMutation) SetSuperuser ¶
func (m *UserMutation) SetSuperuser(b bool)
SetSuperuser sets the "superuser" field.
func (*UserMutation) SetUsername ¶
func (m *UserMutation) SetUsername(s string)
SetUsername sets the "username" field.
func (*UserMutation) Superuser ¶
func (m *UserMutation) Superuser() (r bool, exists bool)
Superuser returns the value of the "superuser" field in the mutation.
func (*UserMutation) TagsCleared ¶
func (m *UserMutation) TagsCleared() bool
TagsCleared reports if the "tags" edge to the Tag entity was cleared.
func (*UserMutation) TagsIDs ¶
func (m *UserMutation) TagsIDs() (ids []int)
TagsIDs returns the "tags" edge IDs in the mutation.
func (UserMutation) Tx ¶
func (m UserMutation) Tx() (*Tx, error)
Tx returns an `ent.Tx` for mutations that were executed in transactions; it returns an error otherwise.
func (*UserMutation) Type ¶
func (m *UserMutation) Type() string
Type returns the node type of this mutation (User).
func (*UserMutation) Username ¶
func (m *UserMutation) Username() (r string, exists bool)
Username returns the value of the "username" field in the mutation.
func (*UserMutation) Where ¶
func (m *UserMutation) Where(ps ...predicate.User)
Where appends a list predicates to the UserMutation builder.
func (*UserMutation) WhereP ¶
func (m *UserMutation) WhereP(ps ...func(*sql.Selector))
WhereP appends storage-level predicates to the UserMutation builder. Using this method, users can use type-assertion to append predicates that do not depend on any generated package.
type UserQuery ¶
type UserQuery struct {
// contains filtered or unexported fields
}
UserQuery is the builder for querying User entities.
func (*UserQuery) Aggregate ¶
func (uq *UserQuery) Aggregate(fns ...AggregateFunc) *UserSelect
Aggregate returns a UserSelect configured with the given aggregations.
func (*UserQuery) Clone ¶
Clone returns a duplicate of the UserQuery builder, including all associated steps. It can be used to prepare common query builders and use them differently after the clone is made.
func (*UserQuery) First ¶
First returns the first User entity from the query. Returns a *NotFoundError when no User was found.
func (*UserQuery) FirstID ¶
FirstID returns the first User ID from the query. Returns a *NotFoundError when no User ID was found.
func (*UserQuery) GroupBy ¶
func (uq *UserQuery) GroupBy(field string, fields ...string) *UserGroupBy
GroupBy is used to group vertices by one or more fields/columns. It is often used with aggregate functions, like: count, max, mean, min, sum.
Example:
var v []struct { Username string `json:"username,omitempty"` Count int `json:"count,omitempty"` } client.User.Query(). GroupBy(user.FieldUsername). Aggregate(ent.Count()). Scan(ctx, &v)
func (*UserQuery) Only ¶
Only returns a single User entity found by the query, ensuring it only returns one. Returns a *NotSingularError when more than one User entity is found. Returns a *NotFoundError when no User entities are found.
func (*UserQuery) OnlyID ¶
OnlyID is like Only, but returns the only User ID in the query. Returns a *NotSingularError when more than one User ID is found. Returns a *NotFoundError when no entities are found.
func (*UserQuery) Order ¶
func (uq *UserQuery) Order(o ...user.OrderOption) *UserQuery
Order specifies how the records should be ordered.
func (*UserQuery) QueryAnswers ¶
func (uq *UserQuery) QueryAnswers() *AnswerQuery
QueryAnswers chains the current query on the "answers" edge.
func (*UserQuery) QueryQuestions ¶
func (uq *UserQuery) QueryQuestions() *QuestionQuery
QueryQuestions chains the current query on the "questions" edge.
func (*UserQuery) Select ¶
func (uq *UserQuery) Select(fields ...string) *UserSelect
Select allows the selection one or more fields/columns for the given query, instead of selecting all fields in the entity.
Example:
var v []struct { Username string `json:"username,omitempty"` } client.User.Query(). Select(user.FieldUsername). Scan(ctx, &v)
func (*UserQuery) Unique ¶
Unique configures the query builder to filter duplicate records on query. By default, unique is set to true, and can be disabled using this method.
func (*UserQuery) WithAnswers ¶
func (uq *UserQuery) WithAnswers(opts ...func(*AnswerQuery)) *UserQuery
WithAnswers tells the query-builder to eager-load the nodes that are connected to the "answers" edge. The optional arguments are used to configure the query builder of the edge.
func (*UserQuery) WithQuestions ¶
func (uq *UserQuery) WithQuestions(opts ...func(*QuestionQuery)) *UserQuery
WithQuestions tells the query-builder to eager-load the nodes that are connected to the "questions" edge. The optional arguments are used to configure the query builder of the edge.
type UserSelect ¶
type UserSelect struct { *UserQuery // contains filtered or unexported fields }
UserSelect is the builder for selecting fields of User entities.
func (*UserSelect) Aggregate ¶
func (us *UserSelect) Aggregate(fns ...AggregateFunc) *UserSelect
Aggregate adds the given aggregation functions to the selector query.
func (*UserSelect) Bool ¶
Bool returns a single bool from a selector. It is only allowed when selecting one field.
func (*UserSelect) Bools ¶
Bools returns list of bools from a selector. It is only allowed when selecting one field.
func (*UserSelect) Float64 ¶
Float64 returns a single float64 from a selector. It is only allowed when selecting one field.
func (*UserSelect) Float64s ¶
Float64s returns list of float64s from a selector. It is only allowed when selecting one field.
func (*UserSelect) Int ¶
Int returns a single int from a selector. It is only allowed when selecting one field.
func (*UserSelect) Ints ¶
Ints returns list of ints from a selector. It is only allowed when selecting one field.
func (*UserSelect) Scan ¶
func (us *UserSelect) Scan(ctx context.Context, v any) error
Scan applies the selector query and scans the result into the given value.
func (*UserSelect) String ¶
String returns a single string from a selector. It is only allowed when selecting one field.
type UserUpdate ¶
type UserUpdate struct {
// contains filtered or unexported fields
}
UserUpdate is the builder for updating User entities.
func (*UserUpdate) AddAnswerIDs ¶
func (uu *UserUpdate) AddAnswerIDs(ids ...int) *UserUpdate
AddAnswerIDs adds the "answers" edge to the Answer entity by IDs.
func (*UserUpdate) AddAnswers ¶
func (uu *UserUpdate) AddAnswers(a ...*Answer) *UserUpdate
AddAnswers adds the "answers" edges to the Answer entity.
func (*UserUpdate) AddQuestionIDs ¶
func (uu *UserUpdate) AddQuestionIDs(ids ...int) *UserUpdate
AddQuestionIDs adds the "questions" edge to the Question entity by IDs.
func (*UserUpdate) AddQuestions ¶
func (uu *UserUpdate) AddQuestions(q ...*Question) *UserUpdate
AddQuestions adds the "questions" edges to the Question entity.
func (*UserUpdate) AddTagIDs ¶
func (uu *UserUpdate) AddTagIDs(ids ...int) *UserUpdate
AddTagIDs adds the "tags" edge to the Tag entity by IDs.
func (*UserUpdate) AddTags ¶
func (uu *UserUpdate) AddTags(t ...*Tag) *UserUpdate
AddTags adds the "tags" edges to the Tag entity.
func (*UserUpdate) ClearAnswers ¶
func (uu *UserUpdate) ClearAnswers() *UserUpdate
ClearAnswers clears all "answers" edges to the Answer entity.
func (*UserUpdate) ClearQuestions ¶
func (uu *UserUpdate) ClearQuestions() *UserUpdate
ClearQuestions clears all "questions" edges to the Question entity.
func (*UserUpdate) ClearTags ¶
func (uu *UserUpdate) ClearTags() *UserUpdate
ClearTags clears all "tags" edges to the Tag entity.
func (*UserUpdate) Exec ¶
func (uu *UserUpdate) Exec(ctx context.Context) error
Exec executes the query.
func (*UserUpdate) ExecX ¶
func (uu *UserUpdate) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*UserUpdate) Mutation ¶
func (uu *UserUpdate) Mutation() *UserMutation
Mutation returns the UserMutation object of the builder.
func (*UserUpdate) RemoveAnswerIDs ¶
func (uu *UserUpdate) RemoveAnswerIDs(ids ...int) *UserUpdate
RemoveAnswerIDs removes the "answers" edge to Answer entities by IDs.
func (*UserUpdate) RemoveAnswers ¶
func (uu *UserUpdate) RemoveAnswers(a ...*Answer) *UserUpdate
RemoveAnswers removes "answers" edges to Answer entities.
func (*UserUpdate) RemoveQuestionIDs ¶
func (uu *UserUpdate) RemoveQuestionIDs(ids ...int) *UserUpdate
RemoveQuestionIDs removes the "questions" edge to Question entities by IDs.
func (*UserUpdate) RemoveQuestions ¶
func (uu *UserUpdate) RemoveQuestions(q ...*Question) *UserUpdate
RemoveQuestions removes "questions" edges to Question entities.
func (*UserUpdate) RemoveTagIDs ¶
func (uu *UserUpdate) RemoveTagIDs(ids ...int) *UserUpdate
RemoveTagIDs removes the "tags" edge to Tag entities by IDs.
func (*UserUpdate) RemoveTags ¶
func (uu *UserUpdate) RemoveTags(t ...*Tag) *UserUpdate
RemoveTags removes "tags" edges to Tag entities.
func (*UserUpdate) Save ¶
func (uu *UserUpdate) Save(ctx context.Context) (int, error)
Save executes the query and returns the number of nodes affected by the update operation.
func (*UserUpdate) SaveX ¶
func (uu *UserUpdate) SaveX(ctx context.Context) int
SaveX is like Save, but panics if an error occurs.
func (*UserUpdate) SetEmail ¶
func (uu *UserUpdate) SetEmail(s string) *UserUpdate
SetEmail sets the "email" field.
func (*UserUpdate) SetNillableSuperuser ¶
func (uu *UserUpdate) SetNillableSuperuser(b *bool) *UserUpdate
SetNillableSuperuser sets the "superuser" field if the given value is not nil.
func (*UserUpdate) SetPassword ¶
func (uu *UserUpdate) SetPassword(s string) *UserUpdate
SetPassword sets the "password" field.
func (*UserUpdate) SetSuperuser ¶
func (uu *UserUpdate) SetSuperuser(b bool) *UserUpdate
SetSuperuser sets the "superuser" field.
func (*UserUpdate) SetUsername ¶
func (uu *UserUpdate) SetUsername(s string) *UserUpdate
SetUsername sets the "username" field.
func (*UserUpdate) Where ¶
func (uu *UserUpdate) Where(ps ...predicate.User) *UserUpdate
Where appends a list predicates to the UserUpdate builder.
type UserUpdateOne ¶
type UserUpdateOne struct {
// contains filtered or unexported fields
}
UserUpdateOne is the builder for updating a single User entity.
func (*UserUpdateOne) AddAnswerIDs ¶
func (uuo *UserUpdateOne) AddAnswerIDs(ids ...int) *UserUpdateOne
AddAnswerIDs adds the "answers" edge to the Answer entity by IDs.
func (*UserUpdateOne) AddAnswers ¶
func (uuo *UserUpdateOne) AddAnswers(a ...*Answer) *UserUpdateOne
AddAnswers adds the "answers" edges to the Answer entity.
func (*UserUpdateOne) AddQuestionIDs ¶
func (uuo *UserUpdateOne) AddQuestionIDs(ids ...int) *UserUpdateOne
AddQuestionIDs adds the "questions" edge to the Question entity by IDs.
func (*UserUpdateOne) AddQuestions ¶
func (uuo *UserUpdateOne) AddQuestions(q ...*Question) *UserUpdateOne
AddQuestions adds the "questions" edges to the Question entity.
func (*UserUpdateOne) AddTagIDs ¶
func (uuo *UserUpdateOne) AddTagIDs(ids ...int) *UserUpdateOne
AddTagIDs adds the "tags" edge to the Tag entity by IDs.
func (*UserUpdateOne) AddTags ¶
func (uuo *UserUpdateOne) AddTags(t ...*Tag) *UserUpdateOne
AddTags adds the "tags" edges to the Tag entity.
func (*UserUpdateOne) ClearAnswers ¶
func (uuo *UserUpdateOne) ClearAnswers() *UserUpdateOne
ClearAnswers clears all "answers" edges to the Answer entity.
func (*UserUpdateOne) ClearQuestions ¶
func (uuo *UserUpdateOne) ClearQuestions() *UserUpdateOne
ClearQuestions clears all "questions" edges to the Question entity.
func (*UserUpdateOne) ClearTags ¶
func (uuo *UserUpdateOne) ClearTags() *UserUpdateOne
ClearTags clears all "tags" edges to the Tag entity.
func (*UserUpdateOne) Exec ¶
func (uuo *UserUpdateOne) Exec(ctx context.Context) error
Exec executes the query on the entity.
func (*UserUpdateOne) ExecX ¶
func (uuo *UserUpdateOne) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*UserUpdateOne) Mutation ¶
func (uuo *UserUpdateOne) Mutation() *UserMutation
Mutation returns the UserMutation object of the builder.
func (*UserUpdateOne) RemoveAnswerIDs ¶
func (uuo *UserUpdateOne) RemoveAnswerIDs(ids ...int) *UserUpdateOne
RemoveAnswerIDs removes the "answers" edge to Answer entities by IDs.
func (*UserUpdateOne) RemoveAnswers ¶
func (uuo *UserUpdateOne) RemoveAnswers(a ...*Answer) *UserUpdateOne
RemoveAnswers removes "answers" edges to Answer entities.
func (*UserUpdateOne) RemoveQuestionIDs ¶
func (uuo *UserUpdateOne) RemoveQuestionIDs(ids ...int) *UserUpdateOne
RemoveQuestionIDs removes the "questions" edge to Question entities by IDs.
func (*UserUpdateOne) RemoveQuestions ¶
func (uuo *UserUpdateOne) RemoveQuestions(q ...*Question) *UserUpdateOne
RemoveQuestions removes "questions" edges to Question entities.
func (*UserUpdateOne) RemoveTagIDs ¶
func (uuo *UserUpdateOne) RemoveTagIDs(ids ...int) *UserUpdateOne
RemoveTagIDs removes the "tags" edge to Tag entities by IDs.
func (*UserUpdateOne) RemoveTags ¶
func (uuo *UserUpdateOne) RemoveTags(t ...*Tag) *UserUpdateOne
RemoveTags removes "tags" edges to Tag entities.
func (*UserUpdateOne) Save ¶
func (uuo *UserUpdateOne) Save(ctx context.Context) (*User, error)
Save executes the query and returns the updated User entity.
func (*UserUpdateOne) SaveX ¶
func (uuo *UserUpdateOne) SaveX(ctx context.Context) *User
SaveX is like Save, but panics if an error occurs.
func (*UserUpdateOne) Select ¶
func (uuo *UserUpdateOne) Select(field string, fields ...string) *UserUpdateOne
Select allows selecting one or more fields (columns) of the returned entity. The default is selecting all fields defined in the entity schema.
func (*UserUpdateOne) SetEmail ¶
func (uuo *UserUpdateOne) SetEmail(s string) *UserUpdateOne
SetEmail sets the "email" field.
func (*UserUpdateOne) SetNillableSuperuser ¶
func (uuo *UserUpdateOne) SetNillableSuperuser(b *bool) *UserUpdateOne
SetNillableSuperuser sets the "superuser" field if the given value is not nil.
func (*UserUpdateOne) SetPassword ¶
func (uuo *UserUpdateOne) SetPassword(s string) *UserUpdateOne
SetPassword sets the "password" field.
func (*UserUpdateOne) SetSuperuser ¶
func (uuo *UserUpdateOne) SetSuperuser(b bool) *UserUpdateOne
SetSuperuser sets the "superuser" field.
func (*UserUpdateOne) SetUsername ¶
func (uuo *UserUpdateOne) SetUsername(s string) *UserUpdateOne
SetUsername sets the "username" field.
func (*UserUpdateOne) Where ¶
func (uuo *UserUpdateOne) Where(ps ...predicate.User) *UserUpdateOne
Where appends a list predicates to the UserUpdate builder.
type ValidationError ¶
type ValidationError struct { Name string // Field or edge name. // contains filtered or unexported fields }
ValidationError returns when validating a field or edge fails.
func (*ValidationError) Error ¶
func (e *ValidationError) Error() string
Error implements the error interface.
func (*ValidationError) Unwrap ¶
func (e *ValidationError) Unwrap() error
Unwrap implements the errors.Wrapper interface.
Source Files ¶
- answer.go
- answer_create.go
- answer_delete.go
- answer_query.go
- answer_update.go
- client.go
- ent.go
- generate.go
- mutation.go
- question.go
- question_create.go
- question_delete.go
- question_query.go
- question_update.go
- runtime.go
- tag.go
- tag_create.go
- tag_delete.go
- tag_query.go
- tag_update.go
- tx.go
- user.go
- user_create.go
- user_delete.go
- user_query.go
- user_update.go