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 Attachment
- type AttachmentClient
- func (c *AttachmentClient) Create() *AttachmentCreate
- func (c *AttachmentClient) CreateBulk(builders ...*AttachmentCreate) *AttachmentCreateBulk
- func (c *AttachmentClient) Delete() *AttachmentDelete
- func (c *AttachmentClient) DeleteOne(a *Attachment) *AttachmentDeleteOne
- func (c *AttachmentClient) DeleteOneID(id string) *AttachmentDeleteOne
- func (c *AttachmentClient) Get(ctx context.Context, id string) (*Attachment, error)
- func (c *AttachmentClient) GetX(ctx context.Context, id string) *Attachment
- func (c *AttachmentClient) Hooks() []Hook
- func (c *AttachmentClient) Intercept(interceptors ...Interceptor)
- func (c *AttachmentClient) Interceptors() []Interceptor
- func (c *AttachmentClient) MapCreateBulk(slice any, setFunc func(*AttachmentCreate, int)) *AttachmentCreateBulk
- func (c *AttachmentClient) Query() *AttachmentQuery
- func (c *AttachmentClient) Update() *AttachmentUpdate
- func (c *AttachmentClient) UpdateOne(a *Attachment) *AttachmentUpdateOne
- func (c *AttachmentClient) UpdateOneID(id string) *AttachmentUpdateOne
- func (c *AttachmentClient) Use(hooks ...Hook)
- type AttachmentCreate
- func (ac *AttachmentCreate) Exec(ctx context.Context) error
- func (ac *AttachmentCreate) ExecX(ctx context.Context)
- func (ac *AttachmentCreate) Mutation() *AttachmentMutation
- func (ac *AttachmentCreate) Save(ctx context.Context) (*Attachment, error)
- func (ac *AttachmentCreate) SaveX(ctx context.Context) *Attachment
- func (ac *AttachmentCreate) SetContents(s string) *AttachmentCreate
- func (ac *AttachmentCreate) SetID(s string) *AttachmentCreate
- type AttachmentCreateBulk
- type AttachmentDelete
- type AttachmentDeleteOne
- type AttachmentGroupBy
- func (agb *AttachmentGroupBy) Aggregate(fns ...AggregateFunc) *AttachmentGroupBy
- func (s *AttachmentGroupBy) Bool(ctx context.Context) (_ bool, err error)
- func (s *AttachmentGroupBy) BoolX(ctx context.Context) bool
- func (s *AttachmentGroupBy) Bools(ctx context.Context) ([]bool, error)
- func (s *AttachmentGroupBy) BoolsX(ctx context.Context) []bool
- func (s *AttachmentGroupBy) Float64(ctx context.Context) (_ float64, err error)
- func (s *AttachmentGroupBy) Float64X(ctx context.Context) float64
- func (s *AttachmentGroupBy) Float64s(ctx context.Context) ([]float64, error)
- func (s *AttachmentGroupBy) Float64sX(ctx context.Context) []float64
- func (s *AttachmentGroupBy) Int(ctx context.Context) (_ int, err error)
- func (s *AttachmentGroupBy) IntX(ctx context.Context) int
- func (s *AttachmentGroupBy) Ints(ctx context.Context) ([]int, error)
- func (s *AttachmentGroupBy) IntsX(ctx context.Context) []int
- func (agb *AttachmentGroupBy) Scan(ctx context.Context, v any) error
- func (s *AttachmentGroupBy) ScanX(ctx context.Context, v any)
- func (s *AttachmentGroupBy) String(ctx context.Context) (_ string, err error)
- func (s *AttachmentGroupBy) StringX(ctx context.Context) string
- func (s *AttachmentGroupBy) Strings(ctx context.Context) ([]string, error)
- func (s *AttachmentGroupBy) StringsX(ctx context.Context) []string
- type AttachmentMutation
- func (m *AttachmentMutation) AddField(name string, value ent.Value) error
- func (m *AttachmentMutation) AddedEdges() []string
- func (m *AttachmentMutation) AddedField(name string) (ent.Value, bool)
- func (m *AttachmentMutation) AddedFields() []string
- func (m *AttachmentMutation) AddedIDs(name string) []ent.Value
- func (m *AttachmentMutation) ClearEdge(name string) error
- func (m *AttachmentMutation) ClearField(name string) error
- func (m *AttachmentMutation) ClearedEdges() []string
- func (m *AttachmentMutation) ClearedFields() []string
- func (m AttachmentMutation) Client() *Client
- func (m *AttachmentMutation) Contents() (r string, exists bool)
- func (m *AttachmentMutation) EdgeCleared(name string) bool
- func (m *AttachmentMutation) Field(name string) (ent.Value, bool)
- func (m *AttachmentMutation) FieldCleared(name string) bool
- func (m *AttachmentMutation) Fields() []string
- func (m *AttachmentMutation) ID() (id string, exists bool)
- func (m *AttachmentMutation) IDs(ctx context.Context) ([]string, error)
- func (m *AttachmentMutation) OldContents(ctx context.Context) (v string, err error)
- func (m *AttachmentMutation) OldField(ctx context.Context, name string) (ent.Value, error)
- func (m *AttachmentMutation) Op() Op
- func (m *AttachmentMutation) RemovedEdges() []string
- func (m *AttachmentMutation) RemovedIDs(name string) []ent.Value
- func (m *AttachmentMutation) ResetContents()
- func (m *AttachmentMutation) ResetEdge(name string) error
- func (m *AttachmentMutation) ResetField(name string) error
- func (m *AttachmentMutation) SetContents(s string)
- func (m *AttachmentMutation) SetField(name string, value ent.Value) error
- func (m *AttachmentMutation) SetID(id string)
- func (m *AttachmentMutation) SetOp(op Op)
- func (m AttachmentMutation) Tx() (*Tx, error)
- func (m *AttachmentMutation) Type() string
- func (m *AttachmentMutation) Where(ps ...predicate.Attachment)
- func (m *AttachmentMutation) WhereP(ps ...func(*sql.Selector))
- type AttachmentQuery
- func (aq *AttachmentQuery) Aggregate(fns ...AggregateFunc) *AttachmentSelect
- func (aq *AttachmentQuery) All(ctx context.Context) ([]*Attachment, error)
- func (aq *AttachmentQuery) AllX(ctx context.Context) []*Attachment
- func (aq *AttachmentQuery) Clone() *AttachmentQuery
- func (aq *AttachmentQuery) Count(ctx context.Context) (int, error)
- func (aq *AttachmentQuery) CountX(ctx context.Context) int
- func (aq *AttachmentQuery) Exist(ctx context.Context) (bool, error)
- func (aq *AttachmentQuery) ExistX(ctx context.Context) bool
- func (aq *AttachmentQuery) First(ctx context.Context) (*Attachment, error)
- func (aq *AttachmentQuery) FirstID(ctx context.Context) (id string, err error)
- func (aq *AttachmentQuery) FirstIDX(ctx context.Context) string
- func (aq *AttachmentQuery) FirstX(ctx context.Context) *Attachment
- func (aq *AttachmentQuery) GroupBy(field string, fields ...string) *AttachmentGroupBy
- func (aq *AttachmentQuery) IDs(ctx context.Context) (ids []string, err error)
- func (aq *AttachmentQuery) IDsX(ctx context.Context) []string
- func (aq *AttachmentQuery) Limit(limit int) *AttachmentQuery
- func (aq *AttachmentQuery) Offset(offset int) *AttachmentQuery
- func (aq *AttachmentQuery) Only(ctx context.Context) (*Attachment, error)
- func (aq *AttachmentQuery) OnlyID(ctx context.Context) (id string, err error)
- func (aq *AttachmentQuery) OnlyIDX(ctx context.Context) string
- func (aq *AttachmentQuery) OnlyX(ctx context.Context) *Attachment
- func (aq *AttachmentQuery) Order(o ...attachment.OrderOption) *AttachmentQuery
- func (aq *AttachmentQuery) Select(fields ...string) *AttachmentSelect
- func (aq *AttachmentQuery) Unique(unique bool) *AttachmentQuery
- func (aq *AttachmentQuery) Where(ps ...predicate.Attachment) *AttachmentQuery
- type AttachmentSelect
- func (as *AttachmentSelect) Aggregate(fns ...AggregateFunc) *AttachmentSelect
- func (s *AttachmentSelect) Bool(ctx context.Context) (_ bool, err error)
- func (s *AttachmentSelect) BoolX(ctx context.Context) bool
- func (s *AttachmentSelect) Bools(ctx context.Context) ([]bool, error)
- func (s *AttachmentSelect) BoolsX(ctx context.Context) []bool
- func (s *AttachmentSelect) Float64(ctx context.Context) (_ float64, err error)
- func (s *AttachmentSelect) Float64X(ctx context.Context) float64
- func (s *AttachmentSelect) Float64s(ctx context.Context) ([]float64, error)
- func (s *AttachmentSelect) Float64sX(ctx context.Context) []float64
- func (s *AttachmentSelect) Int(ctx context.Context) (_ int, err error)
- func (s *AttachmentSelect) IntX(ctx context.Context) int
- func (s *AttachmentSelect) Ints(ctx context.Context) ([]int, error)
- func (s *AttachmentSelect) IntsX(ctx context.Context) []int
- func (as *AttachmentSelect) Scan(ctx context.Context, v any) error
- func (s *AttachmentSelect) ScanX(ctx context.Context, v any)
- func (s *AttachmentSelect) String(ctx context.Context) (_ string, err error)
- func (s *AttachmentSelect) StringX(ctx context.Context) string
- func (s *AttachmentSelect) Strings(ctx context.Context) ([]string, error)
- func (s *AttachmentSelect) StringsX(ctx context.Context) []string
- type AttachmentUpdate
- func (au *AttachmentUpdate) Exec(ctx context.Context) error
- func (au *AttachmentUpdate) ExecX(ctx context.Context)
- func (au *AttachmentUpdate) Mutation() *AttachmentMutation
- func (au *AttachmentUpdate) Save(ctx context.Context) (int, error)
- func (au *AttachmentUpdate) SaveX(ctx context.Context) int
- func (au *AttachmentUpdate) SetContents(s string) *AttachmentUpdate
- func (au *AttachmentUpdate) SetNillableContents(s *string) *AttachmentUpdate
- func (au *AttachmentUpdate) Where(ps ...predicate.Attachment) *AttachmentUpdate
- type AttachmentUpdateOne
- func (auo *AttachmentUpdateOne) Exec(ctx context.Context) error
- func (auo *AttachmentUpdateOne) ExecX(ctx context.Context)
- func (auo *AttachmentUpdateOne) Mutation() *AttachmentMutation
- func (auo *AttachmentUpdateOne) Save(ctx context.Context) (*Attachment, error)
- func (auo *AttachmentUpdateOne) SaveX(ctx context.Context) *Attachment
- func (auo *AttachmentUpdateOne) Select(field string, fields ...string) *AttachmentUpdateOne
- func (auo *AttachmentUpdateOne) SetContents(s string) *AttachmentUpdateOne
- func (auo *AttachmentUpdateOne) SetNillableContents(s *string) *AttachmentUpdateOne
- func (auo *AttachmentUpdateOne) Where(ps ...predicate.Attachment) *AttachmentUpdateOne
- type Attachments
- 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 File
- type FileClient
- func (c *FileClient) Create() *FileCreate
- func (c *FileClient) CreateBulk(builders ...*FileCreate) *FileCreateBulk
- func (c *FileClient) Delete() *FileDelete
- func (c *FileClient) DeleteOne(f *File) *FileDeleteOne
- func (c *FileClient) DeleteOneID(id string) *FileDeleteOne
- func (c *FileClient) Get(ctx context.Context, id string) (*File, error)
- func (c *FileClient) GetX(ctx context.Context, id string) *File
- func (c *FileClient) Hooks() []Hook
- func (c *FileClient) Intercept(interceptors ...Interceptor)
- func (c *FileClient) Interceptors() []Interceptor
- func (c *FileClient) MapCreateBulk(slice any, setFunc func(*FileCreate, int)) *FileCreateBulk
- func (c *FileClient) Query() *FileQuery
- func (c *FileClient) Update() *FileUpdate
- func (c *FileClient) UpdateOne(f *File) *FileUpdateOne
- func (c *FileClient) UpdateOneID(id string) *FileUpdateOne
- func (c *FileClient) Use(hooks ...Hook)
- type FileCreate
- func (fc *FileCreate) Exec(ctx context.Context) error
- func (fc *FileCreate) ExecX(ctx context.Context)
- func (fc *FileCreate) Mutation() *FileMutation
- func (fc *FileCreate) Save(ctx context.Context) (*File, error)
- func (fc *FileCreate) SaveX(ctx context.Context) *File
- func (fc *FileCreate) SetContents(s string) *FileCreate
- func (fc *FileCreate) SetID(s string) *FileCreate
- type FileCreateBulk
- type FileDelete
- type FileDeleteOne
- type FileGroupBy
- func (fgb *FileGroupBy) Aggregate(fns ...AggregateFunc) *FileGroupBy
- func (s *FileGroupBy) Bool(ctx context.Context) (_ bool, err error)
- func (s *FileGroupBy) BoolX(ctx context.Context) bool
- func (s *FileGroupBy) Bools(ctx context.Context) ([]bool, error)
- func (s *FileGroupBy) BoolsX(ctx context.Context) []bool
- func (s *FileGroupBy) Float64(ctx context.Context) (_ float64, err error)
- func (s *FileGroupBy) Float64X(ctx context.Context) float64
- func (s *FileGroupBy) Float64s(ctx context.Context) ([]float64, error)
- func (s *FileGroupBy) Float64sX(ctx context.Context) []float64
- func (s *FileGroupBy) Int(ctx context.Context) (_ int, err error)
- func (s *FileGroupBy) IntX(ctx context.Context) int
- func (s *FileGroupBy) Ints(ctx context.Context) ([]int, error)
- func (s *FileGroupBy) IntsX(ctx context.Context) []int
- func (fgb *FileGroupBy) Scan(ctx context.Context, v any) error
- func (s *FileGroupBy) ScanX(ctx context.Context, v any)
- func (s *FileGroupBy) String(ctx context.Context) (_ string, err error)
- func (s *FileGroupBy) StringX(ctx context.Context) string
- func (s *FileGroupBy) Strings(ctx context.Context) ([]string, error)
- func (s *FileGroupBy) StringsX(ctx context.Context) []string
- type FileMutation
- func (m *FileMutation) AddField(name string, value ent.Value) error
- func (m *FileMutation) AddedEdges() []string
- func (m *FileMutation) AddedField(name string) (ent.Value, bool)
- func (m *FileMutation) AddedFields() []string
- func (m *FileMutation) AddedIDs(name string) []ent.Value
- func (m *FileMutation) ClearEdge(name string) error
- func (m *FileMutation) ClearField(name string) error
- func (m *FileMutation) ClearedEdges() []string
- func (m *FileMutation) ClearedFields() []string
- func (m FileMutation) Client() *Client
- func (m *FileMutation) Contents() (r string, exists bool)
- func (m *FileMutation) EdgeCleared(name string) bool
- func (m *FileMutation) Field(name string) (ent.Value, bool)
- func (m *FileMutation) FieldCleared(name string) bool
- func (m *FileMutation) Fields() []string
- func (m *FileMutation) ID() (id string, exists bool)
- func (m *FileMutation) IDs(ctx context.Context) ([]string, error)
- func (m *FileMutation) OldContents(ctx context.Context) (v string, err error)
- func (m *FileMutation) OldField(ctx context.Context, name string) (ent.Value, error)
- func (m *FileMutation) Op() Op
- func (m *FileMutation) RemovedEdges() []string
- func (m *FileMutation) RemovedIDs(name string) []ent.Value
- func (m *FileMutation) ResetContents()
- func (m *FileMutation) ResetEdge(name string) error
- func (m *FileMutation) ResetField(name string) error
- func (m *FileMutation) SetContents(s string)
- func (m *FileMutation) SetField(name string, value ent.Value) error
- func (m *FileMutation) SetID(id string)
- func (m *FileMutation) SetOp(op Op)
- func (m FileMutation) Tx() (*Tx, error)
- func (m *FileMutation) Type() string
- func (m *FileMutation) Where(ps ...predicate.File)
- func (m *FileMutation) WhereP(ps ...func(*sql.Selector))
- type FileQuery
- func (fq *FileQuery) Aggregate(fns ...AggregateFunc) *FileSelect
- func (fq *FileQuery) All(ctx context.Context) ([]*File, error)
- func (fq *FileQuery) AllX(ctx context.Context) []*File
- func (fq *FileQuery) Clone() *FileQuery
- func (fq *FileQuery) Count(ctx context.Context) (int, error)
- func (fq *FileQuery) CountX(ctx context.Context) int
- func (fq *FileQuery) Exist(ctx context.Context) (bool, error)
- func (fq *FileQuery) ExistX(ctx context.Context) bool
- func (fq *FileQuery) First(ctx context.Context) (*File, error)
- func (fq *FileQuery) FirstID(ctx context.Context) (id string, err error)
- func (fq *FileQuery) FirstIDX(ctx context.Context) string
- func (fq *FileQuery) FirstX(ctx context.Context) *File
- func (fq *FileQuery) GroupBy(field string, fields ...string) *FileGroupBy
- func (fq *FileQuery) IDs(ctx context.Context) (ids []string, err error)
- func (fq *FileQuery) IDsX(ctx context.Context) []string
- func (fq *FileQuery) Limit(limit int) *FileQuery
- func (fq *FileQuery) Offset(offset int) *FileQuery
- func (fq *FileQuery) Only(ctx context.Context) (*File, error)
- func (fq *FileQuery) OnlyID(ctx context.Context) (id string, err error)
- func (fq *FileQuery) OnlyIDX(ctx context.Context) string
- func (fq *FileQuery) OnlyX(ctx context.Context) *File
- func (fq *FileQuery) Order(o ...file.OrderOption) *FileQuery
- func (fq *FileQuery) Select(fields ...string) *FileSelect
- func (fq *FileQuery) Unique(unique bool) *FileQuery
- func (fq *FileQuery) Where(ps ...predicate.File) *FileQuery
- type FileSelect
- func (fs *FileSelect) Aggregate(fns ...AggregateFunc) *FileSelect
- func (s *FileSelect) Bool(ctx context.Context) (_ bool, err error)
- func (s *FileSelect) BoolX(ctx context.Context) bool
- func (s *FileSelect) Bools(ctx context.Context) ([]bool, error)
- func (s *FileSelect) BoolsX(ctx context.Context) []bool
- func (s *FileSelect) Float64(ctx context.Context) (_ float64, err error)
- func (s *FileSelect) Float64X(ctx context.Context) float64
- func (s *FileSelect) Float64s(ctx context.Context) ([]float64, error)
- func (s *FileSelect) Float64sX(ctx context.Context) []float64
- func (s *FileSelect) Int(ctx context.Context) (_ int, err error)
- func (s *FileSelect) IntX(ctx context.Context) int
- func (s *FileSelect) Ints(ctx context.Context) ([]int, error)
- func (s *FileSelect) IntsX(ctx context.Context) []int
- func (fs *FileSelect) Scan(ctx context.Context, v any) error
- func (s *FileSelect) ScanX(ctx context.Context, v any)
- func (s *FileSelect) String(ctx context.Context) (_ string, err error)
- func (s *FileSelect) StringX(ctx context.Context) string
- func (s *FileSelect) Strings(ctx context.Context) ([]string, error)
- func (s *FileSelect) StringsX(ctx context.Context) []string
- type FileUpdate
- func (fu *FileUpdate) Exec(ctx context.Context) error
- func (fu *FileUpdate) ExecX(ctx context.Context)
- func (fu *FileUpdate) Mutation() *FileMutation
- func (fu *FileUpdate) Save(ctx context.Context) (int, error)
- func (fu *FileUpdate) SaveX(ctx context.Context) int
- func (fu *FileUpdate) SetContents(s string) *FileUpdate
- func (fu *FileUpdate) SetNillableContents(s *string) *FileUpdate
- func (fu *FileUpdate) Where(ps ...predicate.File) *FileUpdate
- type FileUpdateOne
- func (fuo *FileUpdateOne) Exec(ctx context.Context) error
- func (fuo *FileUpdateOne) ExecX(ctx context.Context)
- func (fuo *FileUpdateOne) Mutation() *FileMutation
- func (fuo *FileUpdateOne) Save(ctx context.Context) (*File, error)
- func (fuo *FileUpdateOne) SaveX(ctx context.Context) *File
- func (fuo *FileUpdateOne) Select(field string, fields ...string) *FileUpdateOne
- func (fuo *FileUpdateOne) SetContents(s string) *FileUpdateOne
- func (fuo *FileUpdateOne) SetNillableContents(s *string) *FileUpdateOne
- func (fuo *FileUpdateOne) Where(ps ...predicate.File) *FileUpdateOne
- type Files
- type Hook
- type InterceptFunc
- type Interceptor
- type MutateFunc
- type Mutation
- type Mutator
- type NotFoundError
- type NotLoadedError
- type NotSingularError
- type Op
- type Option
- type OrderFunc
- type Policy
- type Querier
- type QuerierFunc
- type Query
- type QueryContext
- type RollbackFunc
- type RollbackHook
- type Rollbacker
- type Task
- type TaskClient
- func (c *TaskClient) Create() *TaskCreate
- func (c *TaskClient) CreateBulk(builders ...*TaskCreate) *TaskCreateBulk
- func (c *TaskClient) Delete() *TaskDelete
- func (c *TaskClient) DeleteOne(t *Task) *TaskDeleteOne
- func (c *TaskClient) DeleteOneID(id int) *TaskDeleteOne
- func (c *TaskClient) Get(ctx context.Context, id int) (*Task, error)
- func (c *TaskClient) GetX(ctx context.Context, id int) *Task
- func (c *TaskClient) Hooks() []Hook
- func (c *TaskClient) Intercept(interceptors ...Interceptor)
- func (c *TaskClient) Interceptors() []Interceptor
- func (c *TaskClient) MapCreateBulk(slice any, setFunc func(*TaskCreate, int)) *TaskCreateBulk
- func (c *TaskClient) Query() *TaskQuery
- func (c *TaskClient) Update() *TaskUpdate
- func (c *TaskClient) UpdateOne(t *Task) *TaskUpdateOne
- func (c *TaskClient) UpdateOneID(id int) *TaskUpdateOne
- func (c *TaskClient) Use(hooks ...Hook)
- type TaskCreate
- func (tc *TaskCreate) Exec(ctx context.Context) error
- func (tc *TaskCreate) ExecX(ctx context.Context)
- func (tc *TaskCreate) Mutation() *TaskMutation
- func (tc *TaskCreate) Save(ctx context.Context) (*Task, error)
- func (tc *TaskCreate) SaveX(ctx context.Context) *Task
- func (tc *TaskCreate) SetComplete(b bool) *TaskCreate
- func (tc *TaskCreate) SetDescription(s string) *TaskCreate
- func (tc *TaskCreate) SetNillableTitle(s *string) *TaskCreate
- func (tc *TaskCreate) SetSignature(s string) *TaskCreate
- func (tc *TaskCreate) SetTitle(s string) *TaskCreate
- type TaskCreateBulk
- type TaskDelete
- type TaskDeleteOne
- type TaskGroupBy
- func (tgb *TaskGroupBy) Aggregate(fns ...AggregateFunc) *TaskGroupBy
- func (s *TaskGroupBy) Bool(ctx context.Context) (_ bool, err error)
- func (s *TaskGroupBy) BoolX(ctx context.Context) bool
- func (s *TaskGroupBy) Bools(ctx context.Context) ([]bool, error)
- func (s *TaskGroupBy) BoolsX(ctx context.Context) []bool
- func (s *TaskGroupBy) Float64(ctx context.Context) (_ float64, err error)
- func (s *TaskGroupBy) Float64X(ctx context.Context) float64
- func (s *TaskGroupBy) Float64s(ctx context.Context) ([]float64, error)
- func (s *TaskGroupBy) Float64sX(ctx context.Context) []float64
- func (s *TaskGroupBy) Int(ctx context.Context) (_ int, err error)
- func (s *TaskGroupBy) IntX(ctx context.Context) int
- func (s *TaskGroupBy) Ints(ctx context.Context) ([]int, error)
- func (s *TaskGroupBy) IntsX(ctx context.Context) []int
- func (tgb *TaskGroupBy) Scan(ctx context.Context, v any) error
- func (s *TaskGroupBy) ScanX(ctx context.Context, v any)
- func (s *TaskGroupBy) String(ctx context.Context) (_ string, err error)
- func (s *TaskGroupBy) StringX(ctx context.Context) string
- func (s *TaskGroupBy) Strings(ctx context.Context) ([]string, error)
- func (s *TaskGroupBy) StringsX(ctx context.Context) []string
- type TaskMutation
- func (m *TaskMutation) AddField(name string, value ent.Value) error
- func (m *TaskMutation) AddedEdges() []string
- func (m *TaskMutation) AddedField(name string) (ent.Value, bool)
- func (m *TaskMutation) AddedFields() []string
- func (m *TaskMutation) AddedIDs(name string) []ent.Value
- func (m *TaskMutation) ClearEdge(name string) error
- func (m *TaskMutation) ClearField(name string) error
- func (m *TaskMutation) ClearTitle()
- func (m *TaskMutation) ClearedEdges() []string
- func (m *TaskMutation) ClearedFields() []string
- func (m TaskMutation) Client() *Client
- func (m *TaskMutation) Complete() (r bool, exists bool)
- func (m *TaskMutation) Description() (r string, exists bool)
- func (m *TaskMutation) EdgeCleared(name string) bool
- func (m *TaskMutation) Field(name string) (ent.Value, bool)
- func (m *TaskMutation) FieldCleared(name string) bool
- func (m *TaskMutation) Fields() []string
- func (m *TaskMutation) ID() (id int, exists bool)
- func (m *TaskMutation) IDs(ctx context.Context) ([]int, error)
- func (m *TaskMutation) OldComplete(ctx context.Context) (v bool, err error)
- func (m *TaskMutation) OldDescription(ctx context.Context) (v string, err error)
- func (m *TaskMutation) OldField(ctx context.Context, name string) (ent.Value, error)
- func (m *TaskMutation) OldSignature(ctx context.Context) (v string, err error)
- func (m *TaskMutation) OldTitle(ctx context.Context) (v string, err error)
- func (m *TaskMutation) Op() Op
- func (m *TaskMutation) RemovedEdges() []string
- func (m *TaskMutation) RemovedIDs(name string) []ent.Value
- func (m *TaskMutation) ResetComplete()
- func (m *TaskMutation) ResetDescription()
- func (m *TaskMutation) ResetEdge(name string) error
- func (m *TaskMutation) ResetField(name string) error
- func (m *TaskMutation) ResetSignature()
- func (m *TaskMutation) ResetTitle()
- func (m *TaskMutation) SetComplete(b bool)
- func (m *TaskMutation) SetDescription(s string)
- func (m *TaskMutation) SetField(name string, value ent.Value) error
- func (m *TaskMutation) SetOp(op Op)
- func (m *TaskMutation) SetSignature(s string)
- func (m *TaskMutation) SetTitle(s string)
- func (m *TaskMutation) Signature() (r string, exists bool)
- func (m *TaskMutation) Title() (r string, exists bool)
- func (m *TaskMutation) TitleCleared() bool
- func (m TaskMutation) Tx() (*Tx, error)
- func (m *TaskMutation) Type() string
- func (m *TaskMutation) Where(ps ...predicate.Task)
- func (m *TaskMutation) WhereP(ps ...func(*sql.Selector))
- type TaskQuery
- func (tq *TaskQuery) Aggregate(fns ...AggregateFunc) *TaskSelect
- func (tq *TaskQuery) All(ctx context.Context) ([]*Task, error)
- func (tq *TaskQuery) AllX(ctx context.Context) []*Task
- func (tq *TaskQuery) Clone() *TaskQuery
- func (tq *TaskQuery) Count(ctx context.Context) (int, error)
- func (tq *TaskQuery) CountX(ctx context.Context) int
- func (tq *TaskQuery) Exist(ctx context.Context) (bool, error)
- func (tq *TaskQuery) ExistX(ctx context.Context) bool
- func (tq *TaskQuery) First(ctx context.Context) (*Task, error)
- func (tq *TaskQuery) FirstID(ctx context.Context) (id int, err error)
- func (tq *TaskQuery) FirstIDX(ctx context.Context) int
- func (tq *TaskQuery) FirstX(ctx context.Context) *Task
- func (tq *TaskQuery) GroupBy(field string, fields ...string) *TaskGroupBy
- func (tq *TaskQuery) IDs(ctx context.Context) (ids []int, err error)
- func (tq *TaskQuery) IDsX(ctx context.Context) []int
- func (tq *TaskQuery) Limit(limit int) *TaskQuery
- func (tq *TaskQuery) Offset(offset int) *TaskQuery
- func (tq *TaskQuery) Only(ctx context.Context) (*Task, error)
- func (tq *TaskQuery) OnlyID(ctx context.Context) (id int, err error)
- func (tq *TaskQuery) OnlyIDX(ctx context.Context) int
- func (tq *TaskQuery) OnlyX(ctx context.Context) *Task
- func (tq *TaskQuery) Order(o ...task.OrderOption) *TaskQuery
- func (tq *TaskQuery) Select(fields ...string) *TaskSelect
- func (tq *TaskQuery) Unique(unique bool) *TaskQuery
- func (tq *TaskQuery) Where(ps ...predicate.Task) *TaskQuery
- type TaskSelect
- func (ts *TaskSelect) Aggregate(fns ...AggregateFunc) *TaskSelect
- func (s *TaskSelect) Bool(ctx context.Context) (_ bool, err error)
- func (s *TaskSelect) BoolX(ctx context.Context) bool
- func (s *TaskSelect) Bools(ctx context.Context) ([]bool, error)
- func (s *TaskSelect) BoolsX(ctx context.Context) []bool
- func (s *TaskSelect) Float64(ctx context.Context) (_ float64, err error)
- func (s *TaskSelect) Float64X(ctx context.Context) float64
- func (s *TaskSelect) Float64s(ctx context.Context) ([]float64, error)
- func (s *TaskSelect) Float64sX(ctx context.Context) []float64
- func (s *TaskSelect) Int(ctx context.Context) (_ int, err error)
- func (s *TaskSelect) IntX(ctx context.Context) int
- func (s *TaskSelect) Ints(ctx context.Context) ([]int, error)
- func (s *TaskSelect) IntsX(ctx context.Context) []int
- func (ts *TaskSelect) Scan(ctx context.Context, v any) error
- func (s *TaskSelect) ScanX(ctx context.Context, v any)
- func (s *TaskSelect) String(ctx context.Context) (_ string, err error)
- func (s *TaskSelect) StringX(ctx context.Context) string
- func (s *TaskSelect) Strings(ctx context.Context) ([]string, error)
- func (s *TaskSelect) StringsX(ctx context.Context) []string
- type TaskUpdate
- func (tu *TaskUpdate) ClearTitle() *TaskUpdate
- func (tu *TaskUpdate) Exec(ctx context.Context) error
- func (tu *TaskUpdate) ExecX(ctx context.Context)
- func (tu *TaskUpdate) Mutation() *TaskMutation
- func (tu *TaskUpdate) Save(ctx context.Context) (int, error)
- func (tu *TaskUpdate) SaveX(ctx context.Context) int
- func (tu *TaskUpdate) SetComplete(b bool) *TaskUpdate
- func (tu *TaskUpdate) SetNillableComplete(b *bool) *TaskUpdate
- func (tu *TaskUpdate) SetNillableSignature(s *string) *TaskUpdate
- func (tu *TaskUpdate) SetNillableTitle(s *string) *TaskUpdate
- func (tu *TaskUpdate) SetSignature(s string) *TaskUpdate
- func (tu *TaskUpdate) SetTitle(s string) *TaskUpdate
- func (tu *TaskUpdate) Where(ps ...predicate.Task) *TaskUpdate
- type TaskUpdateOne
- func (tuo *TaskUpdateOne) ClearTitle() *TaskUpdateOne
- func (tuo *TaskUpdateOne) Exec(ctx context.Context) error
- func (tuo *TaskUpdateOne) ExecX(ctx context.Context)
- func (tuo *TaskUpdateOne) Mutation() *TaskMutation
- func (tuo *TaskUpdateOne) Save(ctx context.Context) (*Task, error)
- func (tuo *TaskUpdateOne) SaveX(ctx context.Context) *Task
- func (tuo *TaskUpdateOne) Select(field string, fields ...string) *TaskUpdateOne
- func (tuo *TaskUpdateOne) SetComplete(b bool) *TaskUpdateOne
- func (tuo *TaskUpdateOne) SetNillableComplete(b *bool) *TaskUpdateOne
- func (tuo *TaskUpdateOne) SetNillableSignature(s *string) *TaskUpdateOne
- func (tuo *TaskUpdateOne) SetNillableTitle(s *string) *TaskUpdateOne
- func (tuo *TaskUpdateOne) SetSignature(s string) *TaskUpdateOne
- func (tuo *TaskUpdateOne) SetTitle(s string) *TaskUpdateOne
- func (tuo *TaskUpdateOne) Where(ps ...predicate.Task) *TaskUpdateOne
- type Tasks
- 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) 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) 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) SetName(s string) *UserCreate
- type UserCreateBulk
- type UserDelete
- type UserDeleteOne
- 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) AddField(name string, value ent.Value) error
- 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) ClearEdge(name string) error
- func (m *UserMutation) ClearField(name string) error
- func (m *UserMutation) ClearedEdges() []string
- func (m *UserMutation) ClearedFields() []string
- func (m UserMutation) Client() *Client
- func (m *UserMutation) EdgeCleared(name string) 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) Name() (r string, exists bool)
- func (m *UserMutation) OldField(ctx context.Context, name string) (ent.Value, error)
- func (m *UserMutation) OldName(ctx context.Context) (v string, err error)
- func (m *UserMutation) Op() Op
- func (m *UserMutation) RemovedEdges() []string
- func (m *UserMutation) RemovedIDs(name string) []ent.Value
- func (m *UserMutation) ResetEdge(name string) error
- func (m *UserMutation) ResetField(name string) error
- func (m *UserMutation) ResetName()
- func (m *UserMutation) SetField(name string, value ent.Value) error
- func (m *UserMutation) SetName(s string)
- func (m *UserMutation) SetOp(op Op)
- func (m UserMutation) Tx() (*Tx, error)
- func (m *UserMutation) Type() string
- 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) Select(fields ...string) *UserSelect
- func (uq *UserQuery) Unique(unique bool) *UserQuery
- func (uq *UserQuery) Where(ps ...predicate.User) *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) Exec(ctx context.Context) error
- func (uu *UserUpdate) ExecX(ctx context.Context)
- func (uu *UserUpdate) Mutation() *UserMutation
- func (uu *UserUpdate) Save(ctx context.Context) (int, error)
- func (uu *UserUpdate) SaveX(ctx context.Context) int
- func (uu *UserUpdate) SetName(s string) *UserUpdate
- func (uu *UserUpdate) SetNillableName(s *string) *UserUpdate
- func (uu *UserUpdate) Where(ps ...predicate.User) *UserUpdate
- type UserUpdateOne
- func (uuo *UserUpdateOne) Exec(ctx context.Context) error
- func (uuo *UserUpdateOne) ExecX(ctx context.Context)
- func (uuo *UserUpdateOne) Mutation() *UserMutation
- 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) SetName(s string) *UserUpdateOne
- func (uuo *UserUpdateOne) SetNillableName(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. TypeAttachment = "Attachment" TypeFile = "File" TypeTask = "Task" 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 Attachment ¶
type Attachment struct { // ID of the ent. ID string `json:"id,omitempty"` // Contents holds the value of the "contents" field. Contents string `json:"contents,omitempty"` // contains filtered or unexported fields }
Attachment is the model entity for the Attachment schema.
func (*Attachment) String ¶
func (a *Attachment) String() string
String implements the fmt.Stringer.
func (*Attachment) Unwrap ¶
func (a *Attachment) Unwrap() *Attachment
Unwrap unwraps the Attachment 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 (*Attachment) Update ¶
func (a *Attachment) Update() *AttachmentUpdateOne
Update returns a builder for updating this Attachment. Note that you need to call Attachment.Unwrap() before calling this method if this Attachment was returned from a transaction, and the transaction was committed or rolled back.
type AttachmentClient ¶
type AttachmentClient struct {
// contains filtered or unexported fields
}
AttachmentClient is a client for the Attachment schema.
func NewAttachmentClient ¶
func NewAttachmentClient(c config) *AttachmentClient
NewAttachmentClient returns a client for the Attachment from the given config.
func (*AttachmentClient) Create ¶
func (c *AttachmentClient) Create() *AttachmentCreate
Create returns a builder for creating a Attachment entity.
func (*AttachmentClient) CreateBulk ¶
func (c *AttachmentClient) CreateBulk(builders ...*AttachmentCreate) *AttachmentCreateBulk
CreateBulk returns a builder for creating a bulk of Attachment entities.
func (*AttachmentClient) Delete ¶
func (c *AttachmentClient) Delete() *AttachmentDelete
Delete returns a delete builder for Attachment.
func (*AttachmentClient) DeleteOne ¶
func (c *AttachmentClient) DeleteOne(a *Attachment) *AttachmentDeleteOne
DeleteOne returns a builder for deleting the given entity.
func (*AttachmentClient) DeleteOneID ¶
func (c *AttachmentClient) DeleteOneID(id string) *AttachmentDeleteOne
DeleteOneID returns a builder for deleting the given entity by its id.
func (*AttachmentClient) Get ¶
func (c *AttachmentClient) Get(ctx context.Context, id string) (*Attachment, error)
Get returns a Attachment entity by its id.
func (*AttachmentClient) GetX ¶
func (c *AttachmentClient) GetX(ctx context.Context, id string) *Attachment
GetX is like Get, but panics if an error occurs.
func (*AttachmentClient) Hooks ¶
func (c *AttachmentClient) Hooks() []Hook
Hooks returns the client hooks.
func (*AttachmentClient) Intercept ¶ added in v0.3.5
func (c *AttachmentClient) Intercept(interceptors ...Interceptor)
Intercept adds a list of query interceptors to the interceptors stack. A call to `Intercept(f, g, h)` equals to `attachment.Intercept(f(g(h())))`.
func (*AttachmentClient) Interceptors ¶ added in v0.3.5
func (c *AttachmentClient) Interceptors() []Interceptor
Interceptors returns the client interceptors.
func (*AttachmentClient) MapCreateBulk ¶ added in v0.5.0
func (c *AttachmentClient) MapCreateBulk(slice any, setFunc func(*AttachmentCreate, int)) *AttachmentCreateBulk
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 (*AttachmentClient) Query ¶
func (c *AttachmentClient) Query() *AttachmentQuery
Query returns a query builder for Attachment.
func (*AttachmentClient) Update ¶
func (c *AttachmentClient) Update() *AttachmentUpdate
Update returns an update builder for Attachment.
func (*AttachmentClient) UpdateOne ¶
func (c *AttachmentClient) UpdateOne(a *Attachment) *AttachmentUpdateOne
UpdateOne returns an update builder for the given entity.
func (*AttachmentClient) UpdateOneID ¶
func (c *AttachmentClient) UpdateOneID(id string) *AttachmentUpdateOne
UpdateOneID returns an update builder for the given id.
func (*AttachmentClient) Use ¶
func (c *AttachmentClient) Use(hooks ...Hook)
Use adds a list of mutation hooks to the hooks stack. A call to `Use(f, g, h)` equals to `attachment.Hooks(f(g(h())))`.
type AttachmentCreate ¶
type AttachmentCreate struct {
// contains filtered or unexported fields
}
AttachmentCreate is the builder for creating a Attachment entity.
func (*AttachmentCreate) Exec ¶ added in v0.2.0
func (ac *AttachmentCreate) Exec(ctx context.Context) error
Exec executes the query.
func (*AttachmentCreate) ExecX ¶ added in v0.2.0
func (ac *AttachmentCreate) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*AttachmentCreate) Mutation ¶
func (ac *AttachmentCreate) Mutation() *AttachmentMutation
Mutation returns the AttachmentMutation object of the builder.
func (*AttachmentCreate) Save ¶
func (ac *AttachmentCreate) Save(ctx context.Context) (*Attachment, error)
Save creates the Attachment in the database.
func (*AttachmentCreate) SaveX ¶
func (ac *AttachmentCreate) SaveX(ctx context.Context) *Attachment
SaveX calls Save and panics if Save returns an error.
func (*AttachmentCreate) SetContents ¶
func (ac *AttachmentCreate) SetContents(s string) *AttachmentCreate
SetContents sets the "contents" field.
func (*AttachmentCreate) SetID ¶
func (ac *AttachmentCreate) SetID(s string) *AttachmentCreate
SetID sets the "id" field.
type AttachmentCreateBulk ¶
type AttachmentCreateBulk struct {
// contains filtered or unexported fields
}
AttachmentCreateBulk is the builder for creating many Attachment entities in bulk.
func (*AttachmentCreateBulk) Exec ¶ added in v0.2.0
func (acb *AttachmentCreateBulk) Exec(ctx context.Context) error
Exec executes the query.
func (*AttachmentCreateBulk) ExecX ¶ added in v0.2.0
func (acb *AttachmentCreateBulk) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*AttachmentCreateBulk) Save ¶
func (acb *AttachmentCreateBulk) Save(ctx context.Context) ([]*Attachment, error)
Save creates the Attachment entities in the database.
func (*AttachmentCreateBulk) SaveX ¶
func (acb *AttachmentCreateBulk) SaveX(ctx context.Context) []*Attachment
SaveX is like Save, but panics if an error occurs.
type AttachmentDelete ¶
type AttachmentDelete struct {
// contains filtered or unexported fields
}
AttachmentDelete is the builder for deleting a Attachment entity.
func (*AttachmentDelete) Exec ¶
func (ad *AttachmentDelete) Exec(ctx context.Context) (int, error)
Exec executes the deletion query and returns how many vertices were deleted.
func (*AttachmentDelete) ExecX ¶
func (ad *AttachmentDelete) ExecX(ctx context.Context) int
ExecX is like Exec, but panics if an error occurs.
func (*AttachmentDelete) Where ¶
func (ad *AttachmentDelete) Where(ps ...predicate.Attachment) *AttachmentDelete
Where appends a list predicates to the AttachmentDelete builder.
type AttachmentDeleteOne ¶
type AttachmentDeleteOne struct {
// contains filtered or unexported fields
}
AttachmentDeleteOne is the builder for deleting a single Attachment entity.
func (*AttachmentDeleteOne) Exec ¶
func (ado *AttachmentDeleteOne) Exec(ctx context.Context) error
Exec executes the deletion query.
func (*AttachmentDeleteOne) ExecX ¶
func (ado *AttachmentDeleteOne) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*AttachmentDeleteOne) Where ¶ added in v0.4.0
func (ado *AttachmentDeleteOne) Where(ps ...predicate.Attachment) *AttachmentDeleteOne
Where appends a list predicates to the AttachmentDelete builder.
type AttachmentGroupBy ¶
type AttachmentGroupBy struct {
// contains filtered or unexported fields
}
AttachmentGroupBy is the group-by builder for Attachment entities.
func (*AttachmentGroupBy) Aggregate ¶
func (agb *AttachmentGroupBy) Aggregate(fns ...AggregateFunc) *AttachmentGroupBy
Aggregate adds the given aggregation functions to the group-by query.
func (*AttachmentGroupBy) Bool ¶
Bool returns a single bool from a selector. It is only allowed when selecting one field.
func (*AttachmentGroupBy) Bools ¶
Bools returns list of bools from a selector. It is only allowed when selecting one field.
func (*AttachmentGroupBy) Float64 ¶
Float64 returns a single float64 from a selector. It is only allowed when selecting one field.
func (*AttachmentGroupBy) Float64s ¶
Float64s returns list of float64s from a selector. It is only allowed when selecting one field.
func (*AttachmentGroupBy) Int ¶
Int returns a single int from a selector. It is only allowed when selecting one field.
func (*AttachmentGroupBy) Ints ¶
Ints returns list of ints from a selector. It is only allowed when selecting one field.
func (*AttachmentGroupBy) Scan ¶
func (agb *AttachmentGroupBy) Scan(ctx context.Context, v any) error
Scan applies the selector query and scans the result into the given value.
func (*AttachmentGroupBy) String ¶
String returns a single string from a selector. It is only allowed when selecting one field.
type AttachmentMutation ¶
type AttachmentMutation struct {
// contains filtered or unexported fields
}
AttachmentMutation represents an operation that mutates the Attachment nodes in the graph.
func (*AttachmentMutation) AddField ¶
func (m *AttachmentMutation) 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 (*AttachmentMutation) AddedEdges ¶
func (m *AttachmentMutation) AddedEdges() []string
AddedEdges returns all edge names that were set/added in this mutation.
func (*AttachmentMutation) AddedField ¶
func (m *AttachmentMutation) 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 (*AttachmentMutation) AddedFields ¶
func (m *AttachmentMutation) AddedFields() []string
AddedFields returns all numeric fields that were incremented/decremented during this mutation.
func (*AttachmentMutation) AddedIDs ¶
func (m *AttachmentMutation) AddedIDs(name string) []ent.Value
AddedIDs returns all IDs (to other nodes) that were added for the given edge name in this mutation.
func (*AttachmentMutation) ClearEdge ¶
func (m *AttachmentMutation) 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 (*AttachmentMutation) ClearField ¶
func (m *AttachmentMutation) 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 (*AttachmentMutation) ClearedEdges ¶
func (m *AttachmentMutation) ClearedEdges() []string
ClearedEdges returns all edge names that were cleared in this mutation.
func (*AttachmentMutation) ClearedFields ¶
func (m *AttachmentMutation) ClearedFields() []string
ClearedFields returns all nullable fields that were cleared during this mutation.
func (AttachmentMutation) Client ¶
func (m AttachmentMutation) 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 (*AttachmentMutation) Contents ¶
func (m *AttachmentMutation) Contents() (r string, exists bool)
Contents returns the value of the "contents" field in the mutation.
func (*AttachmentMutation) EdgeCleared ¶
func (m *AttachmentMutation) EdgeCleared(name string) bool
EdgeCleared returns a boolean which indicates if the edge with the given name was cleared in this mutation.
func (*AttachmentMutation) Field ¶
func (m *AttachmentMutation) 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 (*AttachmentMutation) FieldCleared ¶
func (m *AttachmentMutation) FieldCleared(name string) bool
FieldCleared returns a boolean indicating if a field with the given name was cleared in this mutation.
func (*AttachmentMutation) Fields ¶
func (m *AttachmentMutation) 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 (*AttachmentMutation) ID ¶
func (m *AttachmentMutation) ID() (id string, 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 (*AttachmentMutation) IDs ¶ added in v0.3.0
func (m *AttachmentMutation) IDs(ctx context.Context) ([]string, 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 (*AttachmentMutation) OldContents ¶
func (m *AttachmentMutation) OldContents(ctx context.Context) (v string, err error)
OldContents returns the old "contents" field's value of the Attachment entity. If the Attachment 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 (*AttachmentMutation) 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 (*AttachmentMutation) RemovedEdges ¶
func (m *AttachmentMutation) RemovedEdges() []string
RemovedEdges returns all edge names that were removed in this mutation.
func (*AttachmentMutation) RemovedIDs ¶
func (m *AttachmentMutation) 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 (*AttachmentMutation) ResetContents ¶
func (m *AttachmentMutation) ResetContents()
ResetContents resets all changes to the "contents" field.
func (*AttachmentMutation) ResetEdge ¶
func (m *AttachmentMutation) 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 (*AttachmentMutation) ResetField ¶
func (m *AttachmentMutation) 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 (*AttachmentMutation) SetContents ¶
func (m *AttachmentMutation) SetContents(s string)
SetContents sets the "contents" field.
func (*AttachmentMutation) SetField ¶
func (m *AttachmentMutation) 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 (*AttachmentMutation) SetID ¶
func (m *AttachmentMutation) SetID(id string)
SetID sets the value of the id field. Note that this operation is only accepted on creation of Attachment entities.
func (*AttachmentMutation) SetOp ¶ added in v0.3.5
func (m *AttachmentMutation) SetOp(op Op)
SetOp allows setting the mutation operation.
func (AttachmentMutation) Tx ¶
func (m AttachmentMutation) Tx() (*Tx, error)
Tx returns an `ent.Tx` for mutations that were executed in transactions; it returns an error otherwise.
func (*AttachmentMutation) Type ¶
func (m *AttachmentMutation) Type() string
Type returns the node type of this mutation (Attachment).
func (*AttachmentMutation) Where ¶ added in v0.2.0
func (m *AttachmentMutation) Where(ps ...predicate.Attachment)
Where appends a list predicates to the AttachmentMutation builder.
func (*AttachmentMutation) WhereP ¶ added in v0.3.5
func (m *AttachmentMutation) WhereP(ps ...func(*sql.Selector))
WhereP appends storage-level predicates to the AttachmentMutation builder. Using this method, users can use type-assertion to append predicates that do not depend on any generated package.
type AttachmentQuery ¶
type AttachmentQuery struct {
// contains filtered or unexported fields
}
AttachmentQuery is the builder for querying Attachment entities.
func (*AttachmentQuery) Aggregate ¶ added in v0.3.4
func (aq *AttachmentQuery) Aggregate(fns ...AggregateFunc) *AttachmentSelect
Aggregate returns a AttachmentSelect configured with the given aggregations.
func (*AttachmentQuery) All ¶
func (aq *AttachmentQuery) All(ctx context.Context) ([]*Attachment, error)
All executes the query and returns a list of Attachments.
func (*AttachmentQuery) AllX ¶
func (aq *AttachmentQuery) AllX(ctx context.Context) []*Attachment
AllX is like All, but panics if an error occurs.
func (*AttachmentQuery) Clone ¶
func (aq *AttachmentQuery) Clone() *AttachmentQuery
Clone returns a duplicate of the AttachmentQuery builder, including all associated steps. It can be used to prepare common query builders and use them differently after the clone is made.
func (*AttachmentQuery) Count ¶
func (aq *AttachmentQuery) Count(ctx context.Context) (int, error)
Count returns the count of the given query.
func (*AttachmentQuery) CountX ¶
func (aq *AttachmentQuery) CountX(ctx context.Context) int
CountX is like Count, but panics if an error occurs.
func (*AttachmentQuery) Exist ¶
func (aq *AttachmentQuery) Exist(ctx context.Context) (bool, error)
Exist returns true if the query has elements in the graph.
func (*AttachmentQuery) ExistX ¶
func (aq *AttachmentQuery) ExistX(ctx context.Context) bool
ExistX is like Exist, but panics if an error occurs.
func (*AttachmentQuery) First ¶
func (aq *AttachmentQuery) First(ctx context.Context) (*Attachment, error)
First returns the first Attachment entity from the query. Returns a *NotFoundError when no Attachment was found.
func (*AttachmentQuery) FirstID ¶
func (aq *AttachmentQuery) FirstID(ctx context.Context) (id string, err error)
FirstID returns the first Attachment ID from the query. Returns a *NotFoundError when no Attachment ID was found.
func (*AttachmentQuery) FirstIDX ¶
func (aq *AttachmentQuery) FirstIDX(ctx context.Context) string
FirstIDX is like FirstID, but panics if an error occurs.
func (*AttachmentQuery) FirstX ¶
func (aq *AttachmentQuery) FirstX(ctx context.Context) *Attachment
FirstX is like First, but panics if an error occurs.
func (*AttachmentQuery) GroupBy ¶
func (aq *AttachmentQuery) GroupBy(field string, fields ...string) *AttachmentGroupBy
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 { Contents string `json:"contents,omitempty"` Count int `json:"count,omitempty"` } client.Attachment.Query(). GroupBy(attachment.FieldContents). Aggregate(ent.Count()). Scan(ctx, &v)
func (*AttachmentQuery) IDs ¶
func (aq *AttachmentQuery) IDs(ctx context.Context) (ids []string, err error)
IDs executes the query and returns a list of Attachment IDs.
func (*AttachmentQuery) IDsX ¶
func (aq *AttachmentQuery) IDsX(ctx context.Context) []string
IDsX is like IDs, but panics if an error occurs.
func (*AttachmentQuery) Limit ¶
func (aq *AttachmentQuery) Limit(limit int) *AttachmentQuery
Limit the number of records to be returned by this query.
func (*AttachmentQuery) Offset ¶
func (aq *AttachmentQuery) Offset(offset int) *AttachmentQuery
Offset to start from.
func (*AttachmentQuery) Only ¶
func (aq *AttachmentQuery) Only(ctx context.Context) (*Attachment, error)
Only returns a single Attachment entity found by the query, ensuring it only returns one. Returns a *NotSingularError when more than one Attachment entity is found. Returns a *NotFoundError when no Attachment entities are found.
func (*AttachmentQuery) OnlyID ¶
func (aq *AttachmentQuery) OnlyID(ctx context.Context) (id string, err error)
OnlyID is like Only, but returns the only Attachment ID in the query. Returns a *NotSingularError when more than one Attachment ID is found. Returns a *NotFoundError when no entities are found.
func (*AttachmentQuery) OnlyIDX ¶
func (aq *AttachmentQuery) OnlyIDX(ctx context.Context) string
OnlyIDX is like OnlyID, but panics if an error occurs.
func (*AttachmentQuery) OnlyX ¶
func (aq *AttachmentQuery) OnlyX(ctx context.Context) *Attachment
OnlyX is like Only, but panics if an error occurs.
func (*AttachmentQuery) Order ¶
func (aq *AttachmentQuery) Order(o ...attachment.OrderOption) *AttachmentQuery
Order specifies how the records should be ordered.
func (*AttachmentQuery) Select ¶
func (aq *AttachmentQuery) Select(fields ...string) *AttachmentSelect
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 { Contents string `json:"contents,omitempty"` } client.Attachment.Query(). Select(attachment.FieldContents). Scan(ctx, &v)
func (*AttachmentQuery) Unique ¶
func (aq *AttachmentQuery) Unique(unique bool) *AttachmentQuery
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 (*AttachmentQuery) Where ¶
func (aq *AttachmentQuery) Where(ps ...predicate.Attachment) *AttachmentQuery
Where adds a new predicate for the AttachmentQuery builder.
type AttachmentSelect ¶
type AttachmentSelect struct { *AttachmentQuery // contains filtered or unexported fields }
AttachmentSelect is the builder for selecting fields of Attachment entities.
func (*AttachmentSelect) Aggregate ¶ added in v0.3.4
func (as *AttachmentSelect) Aggregate(fns ...AggregateFunc) *AttachmentSelect
Aggregate adds the given aggregation functions to the selector query.
func (*AttachmentSelect) Bool ¶
Bool returns a single bool from a selector. It is only allowed when selecting one field.
func (*AttachmentSelect) Bools ¶
Bools returns list of bools from a selector. It is only allowed when selecting one field.
func (*AttachmentSelect) Float64 ¶
Float64 returns a single float64 from a selector. It is only allowed when selecting one field.
func (*AttachmentSelect) Float64s ¶
Float64s returns list of float64s from a selector. It is only allowed when selecting one field.
func (*AttachmentSelect) Int ¶
Int returns a single int from a selector. It is only allowed when selecting one field.
func (*AttachmentSelect) Ints ¶
Ints returns list of ints from a selector. It is only allowed when selecting one field.
func (*AttachmentSelect) Scan ¶
func (as *AttachmentSelect) Scan(ctx context.Context, v any) error
Scan applies the selector query and scans the result into the given value.
func (*AttachmentSelect) String ¶
String returns a single string from a selector. It is only allowed when selecting one field.
type AttachmentUpdate ¶
type AttachmentUpdate struct {
// contains filtered or unexported fields
}
AttachmentUpdate is the builder for updating Attachment entities.
func (*AttachmentUpdate) Exec ¶
func (au *AttachmentUpdate) Exec(ctx context.Context) error
Exec executes the query.
func (*AttachmentUpdate) ExecX ¶
func (au *AttachmentUpdate) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*AttachmentUpdate) Mutation ¶
func (au *AttachmentUpdate) Mutation() *AttachmentMutation
Mutation returns the AttachmentMutation object of the builder.
func (*AttachmentUpdate) Save ¶
func (au *AttachmentUpdate) Save(ctx context.Context) (int, error)
Save executes the query and returns the number of nodes affected by the update operation.
func (*AttachmentUpdate) SaveX ¶
func (au *AttachmentUpdate) SaveX(ctx context.Context) int
SaveX is like Save, but panics if an error occurs.
func (*AttachmentUpdate) SetContents ¶
func (au *AttachmentUpdate) SetContents(s string) *AttachmentUpdate
SetContents sets the "contents" field.
func (*AttachmentUpdate) SetNillableContents ¶ added in v0.5.0
func (au *AttachmentUpdate) SetNillableContents(s *string) *AttachmentUpdate
SetNillableContents sets the "contents" field if the given value is not nil.
func (*AttachmentUpdate) Where ¶
func (au *AttachmentUpdate) Where(ps ...predicate.Attachment) *AttachmentUpdate
Where appends a list predicates to the AttachmentUpdate builder.
type AttachmentUpdateOne ¶
type AttachmentUpdateOne struct {
// contains filtered or unexported fields
}
AttachmentUpdateOne is the builder for updating a single Attachment entity.
func (*AttachmentUpdateOne) Exec ¶
func (auo *AttachmentUpdateOne) Exec(ctx context.Context) error
Exec executes the query on the entity.
func (*AttachmentUpdateOne) ExecX ¶
func (auo *AttachmentUpdateOne) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*AttachmentUpdateOne) Mutation ¶
func (auo *AttachmentUpdateOne) Mutation() *AttachmentMutation
Mutation returns the AttachmentMutation object of the builder.
func (*AttachmentUpdateOne) Save ¶
func (auo *AttachmentUpdateOne) Save(ctx context.Context) (*Attachment, error)
Save executes the query and returns the updated Attachment entity.
func (*AttachmentUpdateOne) SaveX ¶
func (auo *AttachmentUpdateOne) SaveX(ctx context.Context) *Attachment
SaveX is like Save, but panics if an error occurs.
func (*AttachmentUpdateOne) Select ¶
func (auo *AttachmentUpdateOne) Select(field string, fields ...string) *AttachmentUpdateOne
Select allows selecting one or more fields (columns) of the returned entity. The default is selecting all fields defined in the entity schema.
func (*AttachmentUpdateOne) SetContents ¶
func (auo *AttachmentUpdateOne) SetContents(s string) *AttachmentUpdateOne
SetContents sets the "contents" field.
func (*AttachmentUpdateOne) SetNillableContents ¶ added in v0.5.0
func (auo *AttachmentUpdateOne) SetNillableContents(s *string) *AttachmentUpdateOne
SetNillableContents sets the "contents" field if the given value is not nil.
func (*AttachmentUpdateOne) Where ¶ added in v0.4.0
func (auo *AttachmentUpdateOne) Where(ps ...predicate.Attachment) *AttachmentUpdateOne
Where appends a list predicates to the AttachmentUpdate builder.
type Client ¶
type Client struct { // Schema is the client for creating, migrating and dropping schema. Schema *migrate.Schema // Attachment is the client for interacting with the Attachment builders. Attachment *AttachmentClient // File is the client for interacting with the File builders. File *FileClient // Task is the client for interacting with the Task builders. Task *TaskClient // 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(). Attachment. Query(). Count(ctx)
func (*Client) Intercept ¶ added in v0.3.5
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 File ¶
type File struct { // ID of the ent. ID string `json:"id,omitempty"` // Contents holds the value of the "contents" field. Contents string `json:"contents,omitempty"` // contains filtered or unexported fields }
File is the model entity for the File schema.
func (*File) Unwrap ¶
Unwrap unwraps the File 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 (*File) Update ¶
func (f *File) Update() *FileUpdateOne
Update returns a builder for updating this File. Note that you need to call File.Unwrap() before calling this method if this File was returned from a transaction, and the transaction was committed or rolled back.
type FileClient ¶
type FileClient struct {
// contains filtered or unexported fields
}
FileClient is a client for the File schema.
func NewFileClient ¶
func NewFileClient(c config) *FileClient
NewFileClient returns a client for the File from the given config.
func (*FileClient) Create ¶
func (c *FileClient) Create() *FileCreate
Create returns a builder for creating a File entity.
func (*FileClient) CreateBulk ¶
func (c *FileClient) CreateBulk(builders ...*FileCreate) *FileCreateBulk
CreateBulk returns a builder for creating a bulk of File entities.
func (*FileClient) Delete ¶
func (c *FileClient) Delete() *FileDelete
Delete returns a delete builder for File.
func (*FileClient) DeleteOne ¶
func (c *FileClient) DeleteOne(f *File) *FileDeleteOne
DeleteOne returns a builder for deleting the given entity.
func (*FileClient) DeleteOneID ¶
func (c *FileClient) DeleteOneID(id string) *FileDeleteOne
DeleteOneID returns a builder for deleting the given entity by its id.
func (*FileClient) GetX ¶
func (c *FileClient) GetX(ctx context.Context, id string) *File
GetX is like Get, but panics if an error occurs.
func (*FileClient) Intercept ¶ added in v0.3.5
func (c *FileClient) Intercept(interceptors ...Interceptor)
Intercept adds a list of query interceptors to the interceptors stack. A call to `Intercept(f, g, h)` equals to `file.Intercept(f(g(h())))`.
func (*FileClient) Interceptors ¶ added in v0.3.5
func (c *FileClient) Interceptors() []Interceptor
Interceptors returns the client interceptors.
func (*FileClient) MapCreateBulk ¶ added in v0.5.0
func (c *FileClient) MapCreateBulk(slice any, setFunc func(*FileCreate, int)) *FileCreateBulk
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 (*FileClient) Query ¶
func (c *FileClient) Query() *FileQuery
Query returns a query builder for File.
func (*FileClient) Update ¶
func (c *FileClient) Update() *FileUpdate
Update returns an update builder for File.
func (*FileClient) UpdateOne ¶
func (c *FileClient) UpdateOne(f *File) *FileUpdateOne
UpdateOne returns an update builder for the given entity.
func (*FileClient) UpdateOneID ¶
func (c *FileClient) UpdateOneID(id string) *FileUpdateOne
UpdateOneID returns an update builder for the given id.
func (*FileClient) Use ¶
func (c *FileClient) Use(hooks ...Hook)
Use adds a list of mutation hooks to the hooks stack. A call to `Use(f, g, h)` equals to `file.Hooks(f(g(h())))`.
type FileCreate ¶
type FileCreate struct {
// contains filtered or unexported fields
}
FileCreate is the builder for creating a File entity.
func (*FileCreate) Exec ¶ added in v0.2.0
func (fc *FileCreate) Exec(ctx context.Context) error
Exec executes the query.
func (*FileCreate) ExecX ¶ added in v0.2.0
func (fc *FileCreate) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*FileCreate) Mutation ¶
func (fc *FileCreate) Mutation() *FileMutation
Mutation returns the FileMutation object of the builder.
func (*FileCreate) Save ¶
func (fc *FileCreate) Save(ctx context.Context) (*File, error)
Save creates the File in the database.
func (*FileCreate) SaveX ¶
func (fc *FileCreate) SaveX(ctx context.Context) *File
SaveX calls Save and panics if Save returns an error.
func (*FileCreate) SetContents ¶
func (fc *FileCreate) SetContents(s string) *FileCreate
SetContents sets the "contents" field.
func (*FileCreate) SetID ¶
func (fc *FileCreate) SetID(s string) *FileCreate
SetID sets the "id" field.
type FileCreateBulk ¶
type FileCreateBulk struct {
// contains filtered or unexported fields
}
FileCreateBulk is the builder for creating many File entities in bulk.
func (*FileCreateBulk) Exec ¶ added in v0.2.0
func (fcb *FileCreateBulk) Exec(ctx context.Context) error
Exec executes the query.
func (*FileCreateBulk) ExecX ¶ added in v0.2.0
func (fcb *FileCreateBulk) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
type FileDelete ¶
type FileDelete struct {
// contains filtered or unexported fields
}
FileDelete is the builder for deleting a File entity.
func (*FileDelete) Exec ¶
func (fd *FileDelete) Exec(ctx context.Context) (int, error)
Exec executes the deletion query and returns how many vertices were deleted.
func (*FileDelete) ExecX ¶
func (fd *FileDelete) ExecX(ctx context.Context) int
ExecX is like Exec, but panics if an error occurs.
func (*FileDelete) Where ¶
func (fd *FileDelete) Where(ps ...predicate.File) *FileDelete
Where appends a list predicates to the FileDelete builder.
type FileDeleteOne ¶
type FileDeleteOne struct {
// contains filtered or unexported fields
}
FileDeleteOne is the builder for deleting a single File entity.
func (*FileDeleteOne) Exec ¶
func (fdo *FileDeleteOne) Exec(ctx context.Context) error
Exec executes the deletion query.
func (*FileDeleteOne) ExecX ¶
func (fdo *FileDeleteOne) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*FileDeleteOne) Where ¶ added in v0.4.0
func (fdo *FileDeleteOne) Where(ps ...predicate.File) *FileDeleteOne
Where appends a list predicates to the FileDelete builder.
type FileGroupBy ¶
type FileGroupBy struct {
// contains filtered or unexported fields
}
FileGroupBy is the group-by builder for File entities.
func (*FileGroupBy) Aggregate ¶
func (fgb *FileGroupBy) Aggregate(fns ...AggregateFunc) *FileGroupBy
Aggregate adds the given aggregation functions to the group-by query.
func (*FileGroupBy) Bool ¶
Bool returns a single bool from a selector. It is only allowed when selecting one field.
func (*FileGroupBy) Bools ¶
Bools returns list of bools from a selector. It is only allowed when selecting one field.
func (*FileGroupBy) Float64 ¶
Float64 returns a single float64 from a selector. It is only allowed when selecting one field.
func (*FileGroupBy) Float64s ¶
Float64s returns list of float64s from a selector. It is only allowed when selecting one field.
func (*FileGroupBy) Int ¶
Int returns a single int from a selector. It is only allowed when selecting one field.
func (*FileGroupBy) Ints ¶
Ints returns list of ints from a selector. It is only allowed when selecting one field.
func (*FileGroupBy) Scan ¶
func (fgb *FileGroupBy) Scan(ctx context.Context, v any) error
Scan applies the selector query and scans the result into the given value.
func (*FileGroupBy) String ¶
String returns a single string from a selector. It is only allowed when selecting one field.
type FileMutation ¶
type FileMutation struct {
// contains filtered or unexported fields
}
FileMutation represents an operation that mutates the File nodes in the graph.
func (*FileMutation) AddField ¶
func (m *FileMutation) 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 (*FileMutation) AddedEdges ¶
func (m *FileMutation) AddedEdges() []string
AddedEdges returns all edge names that were set/added in this mutation.
func (*FileMutation) AddedField ¶
func (m *FileMutation) 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 (*FileMutation) AddedFields ¶
func (m *FileMutation) AddedFields() []string
AddedFields returns all numeric fields that were incremented/decremented during this mutation.
func (*FileMutation) AddedIDs ¶
func (m *FileMutation) AddedIDs(name string) []ent.Value
AddedIDs returns all IDs (to other nodes) that were added for the given edge name in this mutation.
func (*FileMutation) ClearEdge ¶
func (m *FileMutation) 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 (*FileMutation) ClearField ¶
func (m *FileMutation) 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 (*FileMutation) ClearedEdges ¶
func (m *FileMutation) ClearedEdges() []string
ClearedEdges returns all edge names that were cleared in this mutation.
func (*FileMutation) ClearedFields ¶
func (m *FileMutation) ClearedFields() []string
ClearedFields returns all nullable fields that were cleared during this mutation.
func (FileMutation) Client ¶
func (m FileMutation) 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 (*FileMutation) Contents ¶
func (m *FileMutation) Contents() (r string, exists bool)
Contents returns the value of the "contents" field in the mutation.
func (*FileMutation) EdgeCleared ¶
func (m *FileMutation) EdgeCleared(name string) bool
EdgeCleared returns a boolean which indicates if the edge with the given name was cleared in this mutation.
func (*FileMutation) Field ¶
func (m *FileMutation) 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 (*FileMutation) FieldCleared ¶
func (m *FileMutation) FieldCleared(name string) bool
FieldCleared returns a boolean indicating if a field with the given name was cleared in this mutation.
func (*FileMutation) Fields ¶
func (m *FileMutation) 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 (*FileMutation) ID ¶
func (m *FileMutation) ID() (id string, 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 (*FileMutation) IDs ¶ added in v0.3.0
func (m *FileMutation) IDs(ctx context.Context) ([]string, 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 (*FileMutation) OldContents ¶
func (m *FileMutation) OldContents(ctx context.Context) (v string, err error)
OldContents returns the old "contents" field's value of the File entity. If the File 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 (*FileMutation) 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 (*FileMutation) RemovedEdges ¶
func (m *FileMutation) RemovedEdges() []string
RemovedEdges returns all edge names that were removed in this mutation.
func (*FileMutation) RemovedIDs ¶
func (m *FileMutation) 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 (*FileMutation) ResetContents ¶
func (m *FileMutation) ResetContents()
ResetContents resets all changes to the "contents" field.
func (*FileMutation) ResetEdge ¶
func (m *FileMutation) 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 (*FileMutation) ResetField ¶
func (m *FileMutation) 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 (*FileMutation) SetContents ¶
func (m *FileMutation) SetContents(s string)
SetContents sets the "contents" field.
func (*FileMutation) SetField ¶
func (m *FileMutation) 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 (*FileMutation) SetID ¶
func (m *FileMutation) SetID(id string)
SetID sets the value of the id field. Note that this operation is only accepted on creation of File entities.
func (*FileMutation) SetOp ¶ added in v0.3.5
func (m *FileMutation) SetOp(op Op)
SetOp allows setting the mutation operation.
func (FileMutation) Tx ¶
func (m FileMutation) Tx() (*Tx, error)
Tx returns an `ent.Tx` for mutations that were executed in transactions; it returns an error otherwise.
func (*FileMutation) Type ¶
func (m *FileMutation) Type() string
Type returns the node type of this mutation (File).
func (*FileMutation) Where ¶ added in v0.2.0
func (m *FileMutation) Where(ps ...predicate.File)
Where appends a list predicates to the FileMutation builder.
func (*FileMutation) WhereP ¶ added in v0.3.5
func (m *FileMutation) WhereP(ps ...func(*sql.Selector))
WhereP appends storage-level predicates to the FileMutation builder. Using this method, users can use type-assertion to append predicates that do not depend on any generated package.
type FileQuery ¶
type FileQuery struct {
// contains filtered or unexported fields
}
FileQuery is the builder for querying File entities.
func (*FileQuery) Aggregate ¶ added in v0.3.4
func (fq *FileQuery) Aggregate(fns ...AggregateFunc) *FileSelect
Aggregate returns a FileSelect configured with the given aggregations.
func (*FileQuery) Clone ¶
Clone returns a duplicate of the FileQuery builder, including all associated steps. It can be used to prepare common query builders and use them differently after the clone is made.
func (*FileQuery) First ¶
First returns the first File entity from the query. Returns a *NotFoundError when no File was found.
func (*FileQuery) FirstID ¶
FirstID returns the first File ID from the query. Returns a *NotFoundError when no File ID was found.
func (*FileQuery) GroupBy ¶
func (fq *FileQuery) GroupBy(field string, fields ...string) *FileGroupBy
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 { Contents string `json:"contents,omitempty"` Count int `json:"count,omitempty"` } client.File.Query(). GroupBy(file.FieldContents). Aggregate(ent.Count()). Scan(ctx, &v)
func (*FileQuery) Only ¶
Only returns a single File entity found by the query, ensuring it only returns one. Returns a *NotSingularError when more than one File entity is found. Returns a *NotFoundError when no File entities are found.
func (*FileQuery) OnlyID ¶
OnlyID is like Only, but returns the only File ID in the query. Returns a *NotSingularError when more than one File ID is found. Returns a *NotFoundError when no entities are found.
func (*FileQuery) Order ¶
func (fq *FileQuery) Order(o ...file.OrderOption) *FileQuery
Order specifies how the records should be ordered.
func (*FileQuery) Select ¶
func (fq *FileQuery) Select(fields ...string) *FileSelect
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 { Contents string `json:"contents,omitempty"` } client.File.Query(). Select(file.FieldContents). Scan(ctx, &v)
type FileSelect ¶
type FileSelect struct { *FileQuery // contains filtered or unexported fields }
FileSelect is the builder for selecting fields of File entities.
func (*FileSelect) Aggregate ¶ added in v0.3.4
func (fs *FileSelect) Aggregate(fns ...AggregateFunc) *FileSelect
Aggregate adds the given aggregation functions to the selector query.
func (*FileSelect) Bool ¶
Bool returns a single bool from a selector. It is only allowed when selecting one field.
func (*FileSelect) Bools ¶
Bools returns list of bools from a selector. It is only allowed when selecting one field.
func (*FileSelect) Float64 ¶
Float64 returns a single float64 from a selector. It is only allowed when selecting one field.
func (*FileSelect) Float64s ¶
Float64s returns list of float64s from a selector. It is only allowed when selecting one field.
func (*FileSelect) Int ¶
Int returns a single int from a selector. It is only allowed when selecting one field.
func (*FileSelect) Ints ¶
Ints returns list of ints from a selector. It is only allowed when selecting one field.
func (*FileSelect) Scan ¶
func (fs *FileSelect) Scan(ctx context.Context, v any) error
Scan applies the selector query and scans the result into the given value.
func (*FileSelect) String ¶
String returns a single string from a selector. It is only allowed when selecting one field.
type FileUpdate ¶
type FileUpdate struct {
// contains filtered or unexported fields
}
FileUpdate is the builder for updating File entities.
func (*FileUpdate) Exec ¶
func (fu *FileUpdate) Exec(ctx context.Context) error
Exec executes the query.
func (*FileUpdate) ExecX ¶
func (fu *FileUpdate) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*FileUpdate) Mutation ¶
func (fu *FileUpdate) Mutation() *FileMutation
Mutation returns the FileMutation object of the builder.
func (*FileUpdate) Save ¶
func (fu *FileUpdate) Save(ctx context.Context) (int, error)
Save executes the query and returns the number of nodes affected by the update operation.
func (*FileUpdate) SaveX ¶
func (fu *FileUpdate) SaveX(ctx context.Context) int
SaveX is like Save, but panics if an error occurs.
func (*FileUpdate) SetContents ¶
func (fu *FileUpdate) SetContents(s string) *FileUpdate
SetContents sets the "contents" field.
func (*FileUpdate) SetNillableContents ¶ added in v0.5.0
func (fu *FileUpdate) SetNillableContents(s *string) *FileUpdate
SetNillableContents sets the "contents" field if the given value is not nil.
func (*FileUpdate) Where ¶
func (fu *FileUpdate) Where(ps ...predicate.File) *FileUpdate
Where appends a list predicates to the FileUpdate builder.
type FileUpdateOne ¶
type FileUpdateOne struct {
// contains filtered or unexported fields
}
FileUpdateOne is the builder for updating a single File entity.
func (*FileUpdateOne) Exec ¶
func (fuo *FileUpdateOne) Exec(ctx context.Context) error
Exec executes the query on the entity.
func (*FileUpdateOne) ExecX ¶
func (fuo *FileUpdateOne) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*FileUpdateOne) Mutation ¶
func (fuo *FileUpdateOne) Mutation() *FileMutation
Mutation returns the FileMutation object of the builder.
func (*FileUpdateOne) Save ¶
func (fuo *FileUpdateOne) Save(ctx context.Context) (*File, error)
Save executes the query and returns the updated File entity.
func (*FileUpdateOne) SaveX ¶
func (fuo *FileUpdateOne) SaveX(ctx context.Context) *File
SaveX is like Save, but panics if an error occurs.
func (*FileUpdateOne) Select ¶
func (fuo *FileUpdateOne) Select(field string, fields ...string) *FileUpdateOne
Select allows selecting one or more fields (columns) of the returned entity. The default is selecting all fields defined in the entity schema.
func (*FileUpdateOne) SetContents ¶
func (fuo *FileUpdateOne) SetContents(s string) *FileUpdateOne
SetContents sets the "contents" field.
func (*FileUpdateOne) SetNillableContents ¶ added in v0.5.0
func (fuo *FileUpdateOne) SetNillableContents(s *string) *FileUpdateOne
SetNillableContents sets the "contents" field if the given value is not nil.
func (*FileUpdateOne) Where ¶ added in v0.4.0
func (fuo *FileUpdateOne) Where(ps ...predicate.File) *FileUpdateOne
Where appends a list predicates to the FileUpdate builder.
type InterceptFunc ¶ added in v0.3.5
type InterceptFunc = ent.InterceptFunc
ent aliases to avoid import conflicts in user's code.
type Interceptor ¶ added in v0.3.5
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 ¶ added in v0.3.5
type QuerierFunc = ent.QuerierFunc
ent aliases to avoid import conflicts in user's code.
type QueryContext ¶ added in v0.3.5
type QueryContext = ent.QueryContext
ent aliases to avoid import conflicts in user's code.
type RollbackFunc ¶
The RollbackFunc type is an adapter to allow the use of ordinary function as a Rollbacker. If f is a function with the appropriate signature, RollbackFunc(f) is a Rollbacker that calls f.
type RollbackHook ¶
type RollbackHook func(Rollbacker) Rollbacker
RollbackHook defines the "rollback middleware". A function that gets a Rollbacker and returns a Rollbacker. For example:
hook := func(next ent.Rollbacker) ent.Rollbacker { return ent.RollbackFunc(func(ctx context.Context, tx *ent.Tx) error { // Do some stuff before. if err := next.Rollback(ctx, tx); err != nil { return err } // Do some stuff after. return nil }) }
type Rollbacker ¶
Rollbacker is the interface that wraps the Rollback method.
type Task ¶
type Task struct { // ID of the ent. ID int `json:"id,omitempty"` // comment Title string `json:"title,omitempty"` // Description holds the value of the "description" field. Description string `json:"description,omitempty"` // Complete holds the value of the "complete" field. Complete bool `json:"complete,omitempty"` // Signature holds the value of the "signature" field. Signature string `json:"signature,omitempty"` // contains filtered or unexported fields }
Task is the model entity for the Task schema.
func (*Task) Unwrap ¶
Unwrap unwraps the Task 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 (*Task) Update ¶
func (t *Task) Update() *TaskUpdateOne
Update returns a builder for updating this Task. Note that you need to call Task.Unwrap() before calling this method if this Task was returned from a transaction, and the transaction was committed or rolled back.
type TaskClient ¶
type TaskClient struct {
// contains filtered or unexported fields
}
TaskClient is a client for the Task schema.
func NewTaskClient ¶
func NewTaskClient(c config) *TaskClient
NewTaskClient returns a client for the Task from the given config.
func (*TaskClient) Create ¶
func (c *TaskClient) Create() *TaskCreate
Create returns a builder for creating a Task entity.
func (*TaskClient) CreateBulk ¶
func (c *TaskClient) CreateBulk(builders ...*TaskCreate) *TaskCreateBulk
CreateBulk returns a builder for creating a bulk of Task entities.
func (*TaskClient) Delete ¶
func (c *TaskClient) Delete() *TaskDelete
Delete returns a delete builder for Task.
func (*TaskClient) DeleteOne ¶
func (c *TaskClient) DeleteOne(t *Task) *TaskDeleteOne
DeleteOne returns a builder for deleting the given entity.
func (*TaskClient) DeleteOneID ¶
func (c *TaskClient) DeleteOneID(id int) *TaskDeleteOne
DeleteOneID returns a builder for deleting the given entity by its id.
func (*TaskClient) GetX ¶
func (c *TaskClient) GetX(ctx context.Context, id int) *Task
GetX is like Get, but panics if an error occurs.
func (*TaskClient) Intercept ¶ added in v0.3.5
func (c *TaskClient) Intercept(interceptors ...Interceptor)
Intercept adds a list of query interceptors to the interceptors stack. A call to `Intercept(f, g, h)` equals to `task.Intercept(f(g(h())))`.
func (*TaskClient) Interceptors ¶ added in v0.3.5
func (c *TaskClient) Interceptors() []Interceptor
Interceptors returns the client interceptors.
func (*TaskClient) MapCreateBulk ¶ added in v0.5.0
func (c *TaskClient) MapCreateBulk(slice any, setFunc func(*TaskCreate, int)) *TaskCreateBulk
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 (*TaskClient) Query ¶
func (c *TaskClient) Query() *TaskQuery
Query returns a query builder for Task.
func (*TaskClient) Update ¶
func (c *TaskClient) Update() *TaskUpdate
Update returns an update builder for Task.
func (*TaskClient) UpdateOne ¶
func (c *TaskClient) UpdateOne(t *Task) *TaskUpdateOne
UpdateOne returns an update builder for the given entity.
func (*TaskClient) UpdateOneID ¶
func (c *TaskClient) UpdateOneID(id int) *TaskUpdateOne
UpdateOneID returns an update builder for the given id.
func (*TaskClient) Use ¶
func (c *TaskClient) Use(hooks ...Hook)
Use adds a list of mutation hooks to the hooks stack. A call to `Use(f, g, h)` equals to `task.Hooks(f(g(h())))`.
type TaskCreate ¶
type TaskCreate struct {
// contains filtered or unexported fields
}
TaskCreate is the builder for creating a Task entity.
func (*TaskCreate) Exec ¶ added in v0.2.0
func (tc *TaskCreate) Exec(ctx context.Context) error
Exec executes the query.
func (*TaskCreate) ExecX ¶ added in v0.2.0
func (tc *TaskCreate) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*TaskCreate) Mutation ¶
func (tc *TaskCreate) Mutation() *TaskMutation
Mutation returns the TaskMutation object of the builder.
func (*TaskCreate) Save ¶
func (tc *TaskCreate) Save(ctx context.Context) (*Task, error)
Save creates the Task in the database.
func (*TaskCreate) SaveX ¶
func (tc *TaskCreate) SaveX(ctx context.Context) *Task
SaveX calls Save and panics if Save returns an error.
func (*TaskCreate) SetComplete ¶
func (tc *TaskCreate) SetComplete(b bool) *TaskCreate
SetComplete sets the "complete" field.
func (*TaskCreate) SetDescription ¶
func (tc *TaskCreate) SetDescription(s string) *TaskCreate
SetDescription sets the "description" field.
func (*TaskCreate) SetNillableTitle ¶
func (tc *TaskCreate) SetNillableTitle(s *string) *TaskCreate
SetNillableTitle sets the "title" field if the given value is not nil.
func (*TaskCreate) SetSignature ¶
func (tc *TaskCreate) SetSignature(s string) *TaskCreate
SetSignature sets the "signature" field.
func (*TaskCreate) SetTitle ¶
func (tc *TaskCreate) SetTitle(s string) *TaskCreate
SetTitle sets the "title" field.
type TaskCreateBulk ¶
type TaskCreateBulk struct {
// contains filtered or unexported fields
}
TaskCreateBulk is the builder for creating many Task entities in bulk.
func (*TaskCreateBulk) Exec ¶ added in v0.2.0
func (tcb *TaskCreateBulk) Exec(ctx context.Context) error
Exec executes the query.
func (*TaskCreateBulk) ExecX ¶ added in v0.2.0
func (tcb *TaskCreateBulk) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
type TaskDelete ¶
type TaskDelete struct {
// contains filtered or unexported fields
}
TaskDelete is the builder for deleting a Task entity.
func (*TaskDelete) Exec ¶
func (td *TaskDelete) Exec(ctx context.Context) (int, error)
Exec executes the deletion query and returns how many vertices were deleted.
func (*TaskDelete) ExecX ¶
func (td *TaskDelete) ExecX(ctx context.Context) int
ExecX is like Exec, but panics if an error occurs.
func (*TaskDelete) Where ¶
func (td *TaskDelete) Where(ps ...predicate.Task) *TaskDelete
Where appends a list predicates to the TaskDelete builder.
type TaskDeleteOne ¶
type TaskDeleteOne struct {
// contains filtered or unexported fields
}
TaskDeleteOne is the builder for deleting a single Task entity.
func (*TaskDeleteOne) Exec ¶
func (tdo *TaskDeleteOne) Exec(ctx context.Context) error
Exec executes the deletion query.
func (*TaskDeleteOne) ExecX ¶
func (tdo *TaskDeleteOne) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*TaskDeleteOne) Where ¶ added in v0.4.0
func (tdo *TaskDeleteOne) Where(ps ...predicate.Task) *TaskDeleteOne
Where appends a list predicates to the TaskDelete builder.
type TaskGroupBy ¶
type TaskGroupBy struct {
// contains filtered or unexported fields
}
TaskGroupBy is the group-by builder for Task entities.
func (*TaskGroupBy) Aggregate ¶
func (tgb *TaskGroupBy) Aggregate(fns ...AggregateFunc) *TaskGroupBy
Aggregate adds the given aggregation functions to the group-by query.
func (*TaskGroupBy) Bool ¶
Bool returns a single bool from a selector. It is only allowed when selecting one field.
func (*TaskGroupBy) Bools ¶
Bools returns list of bools from a selector. It is only allowed when selecting one field.
func (*TaskGroupBy) Float64 ¶
Float64 returns a single float64 from a selector. It is only allowed when selecting one field.
func (*TaskGroupBy) Float64s ¶
Float64s returns list of float64s from a selector. It is only allowed when selecting one field.
func (*TaskGroupBy) Int ¶
Int returns a single int from a selector. It is only allowed when selecting one field.
func (*TaskGroupBy) Ints ¶
Ints returns list of ints from a selector. It is only allowed when selecting one field.
func (*TaskGroupBy) Scan ¶
func (tgb *TaskGroupBy) Scan(ctx context.Context, v any) error
Scan applies the selector query and scans the result into the given value.
func (*TaskGroupBy) String ¶
String returns a single string from a selector. It is only allowed when selecting one field.
type TaskMutation ¶
type TaskMutation struct {
// contains filtered or unexported fields
}
TaskMutation represents an operation that mutates the Task nodes in the graph.
func (*TaskMutation) AddField ¶
func (m *TaskMutation) 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 (*TaskMutation) AddedEdges ¶
func (m *TaskMutation) AddedEdges() []string
AddedEdges returns all edge names that were set/added in this mutation.
func (*TaskMutation) AddedField ¶
func (m *TaskMutation) 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 (*TaskMutation) AddedFields ¶
func (m *TaskMutation) AddedFields() []string
AddedFields returns all numeric fields that were incremented/decremented during this mutation.
func (*TaskMutation) AddedIDs ¶
func (m *TaskMutation) AddedIDs(name string) []ent.Value
AddedIDs returns all IDs (to other nodes) that were added for the given edge name in this mutation.
func (*TaskMutation) ClearEdge ¶
func (m *TaskMutation) 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 (*TaskMutation) ClearField ¶
func (m *TaskMutation) 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 (*TaskMutation) ClearTitle ¶
func (m *TaskMutation) ClearTitle()
ClearTitle clears the value of the "title" field.
func (*TaskMutation) ClearedEdges ¶
func (m *TaskMutation) ClearedEdges() []string
ClearedEdges returns all edge names that were cleared in this mutation.
func (*TaskMutation) ClearedFields ¶
func (m *TaskMutation) ClearedFields() []string
ClearedFields returns all nullable fields that were cleared during this mutation.
func (TaskMutation) Client ¶
func (m TaskMutation) 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 (*TaskMutation) Complete ¶
func (m *TaskMutation) Complete() (r bool, exists bool)
Complete returns the value of the "complete" field in the mutation.
func (*TaskMutation) Description ¶
func (m *TaskMutation) Description() (r string, exists bool)
Description returns the value of the "description" field in the mutation.
func (*TaskMutation) EdgeCleared ¶
func (m *TaskMutation) EdgeCleared(name string) bool
EdgeCleared returns a boolean which indicates if the edge with the given name was cleared in this mutation.
func (*TaskMutation) Field ¶
func (m *TaskMutation) 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 (*TaskMutation) FieldCleared ¶
func (m *TaskMutation) FieldCleared(name string) bool
FieldCleared returns a boolean indicating if a field with the given name was cleared in this mutation.
func (*TaskMutation) Fields ¶
func (m *TaskMutation) 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 (*TaskMutation) ID ¶
func (m *TaskMutation) 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 (*TaskMutation) IDs ¶ added in v0.3.0
func (m *TaskMutation) 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 (*TaskMutation) OldComplete ¶
func (m *TaskMutation) OldComplete(ctx context.Context) (v bool, err error)
OldComplete returns the old "complete" field's value of the Task entity. If the Task 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 (*TaskMutation) OldDescription ¶
func (m *TaskMutation) OldDescription(ctx context.Context) (v string, err error)
OldDescription returns the old "description" field's value of the Task entity. If the Task 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 (*TaskMutation) 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 (*TaskMutation) OldSignature ¶
func (m *TaskMutation) OldSignature(ctx context.Context) (v string, err error)
OldSignature returns the old "signature" field's value of the Task entity. If the Task 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 (*TaskMutation) OldTitle ¶
func (m *TaskMutation) OldTitle(ctx context.Context) (v string, err error)
OldTitle returns the old "title" field's value of the Task entity. If the Task 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 (*TaskMutation) RemovedEdges ¶
func (m *TaskMutation) RemovedEdges() []string
RemovedEdges returns all edge names that were removed in this mutation.
func (*TaskMutation) RemovedIDs ¶
func (m *TaskMutation) 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 (*TaskMutation) ResetComplete ¶
func (m *TaskMutation) ResetComplete()
ResetComplete resets all changes to the "complete" field.
func (*TaskMutation) ResetDescription ¶
func (m *TaskMutation) ResetDescription()
ResetDescription resets all changes to the "description" field.
func (*TaskMutation) ResetEdge ¶
func (m *TaskMutation) 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 (*TaskMutation) ResetField ¶
func (m *TaskMutation) 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 (*TaskMutation) ResetSignature ¶
func (m *TaskMutation) ResetSignature()
ResetSignature resets all changes to the "signature" field.
func (*TaskMutation) ResetTitle ¶
func (m *TaskMutation) ResetTitle()
ResetTitle resets all changes to the "title" field.
func (*TaskMutation) SetComplete ¶
func (m *TaskMutation) SetComplete(b bool)
SetComplete sets the "complete" field.
func (*TaskMutation) SetDescription ¶
func (m *TaskMutation) SetDescription(s string)
SetDescription sets the "description" field.
func (*TaskMutation) SetField ¶
func (m *TaskMutation) 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 (*TaskMutation) SetOp ¶ added in v0.3.5
func (m *TaskMutation) SetOp(op Op)
SetOp allows setting the mutation operation.
func (*TaskMutation) SetSignature ¶
func (m *TaskMutation) SetSignature(s string)
SetSignature sets the "signature" field.
func (*TaskMutation) SetTitle ¶
func (m *TaskMutation) SetTitle(s string)
SetTitle sets the "title" field.
func (*TaskMutation) Signature ¶
func (m *TaskMutation) Signature() (r string, exists bool)
Signature returns the value of the "signature" field in the mutation.
func (*TaskMutation) Title ¶
func (m *TaskMutation) Title() (r string, exists bool)
Title returns the value of the "title" field in the mutation.
func (*TaskMutation) TitleCleared ¶
func (m *TaskMutation) TitleCleared() bool
TitleCleared returns if the "title" field was cleared in this mutation.
func (TaskMutation) Tx ¶
func (m TaskMutation) Tx() (*Tx, error)
Tx returns an `ent.Tx` for mutations that were executed in transactions; it returns an error otherwise.
func (*TaskMutation) Type ¶
func (m *TaskMutation) Type() string
Type returns the node type of this mutation (Task).
func (*TaskMutation) Where ¶ added in v0.2.0
func (m *TaskMutation) Where(ps ...predicate.Task)
Where appends a list predicates to the TaskMutation builder.
func (*TaskMutation) WhereP ¶ added in v0.3.5
func (m *TaskMutation) WhereP(ps ...func(*sql.Selector))
WhereP appends storage-level predicates to the TaskMutation builder. Using this method, users can use type-assertion to append predicates that do not depend on any generated package.
type TaskQuery ¶
type TaskQuery struct {
// contains filtered or unexported fields
}
TaskQuery is the builder for querying Task entities.
func (*TaskQuery) Aggregate ¶ added in v0.3.4
func (tq *TaskQuery) Aggregate(fns ...AggregateFunc) *TaskSelect
Aggregate returns a TaskSelect configured with the given aggregations.
func (*TaskQuery) Clone ¶
Clone returns a duplicate of the TaskQuery builder, including all associated steps. It can be used to prepare common query builders and use them differently after the clone is made.
func (*TaskQuery) First ¶
First returns the first Task entity from the query. Returns a *NotFoundError when no Task was found.
func (*TaskQuery) FirstID ¶
FirstID returns the first Task ID from the query. Returns a *NotFoundError when no Task ID was found.
func (*TaskQuery) GroupBy ¶
func (tq *TaskQuery) GroupBy(field string, fields ...string) *TaskGroupBy
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.Task.Query(). GroupBy(task.FieldTitle). Aggregate(ent.Count()). Scan(ctx, &v)
func (*TaskQuery) Only ¶
Only returns a single Task entity found by the query, ensuring it only returns one. Returns a *NotSingularError when more than one Task entity is found. Returns a *NotFoundError when no Task entities are found.
func (*TaskQuery) OnlyID ¶
OnlyID is like Only, but returns the only Task ID in the query. Returns a *NotSingularError when more than one Task ID is found. Returns a *NotFoundError when no entities are found.
func (*TaskQuery) Order ¶
func (tq *TaskQuery) Order(o ...task.OrderOption) *TaskQuery
Order specifies how the records should be ordered.
func (*TaskQuery) Select ¶
func (tq *TaskQuery) Select(fields ...string) *TaskSelect
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.Task.Query(). Select(task.FieldTitle). Scan(ctx, &v)
type TaskSelect ¶
type TaskSelect struct { *TaskQuery // contains filtered or unexported fields }
TaskSelect is the builder for selecting fields of Task entities.
func (*TaskSelect) Aggregate ¶ added in v0.3.4
func (ts *TaskSelect) Aggregate(fns ...AggregateFunc) *TaskSelect
Aggregate adds the given aggregation functions to the selector query.
func (*TaskSelect) Bool ¶
Bool returns a single bool from a selector. It is only allowed when selecting one field.
func (*TaskSelect) Bools ¶
Bools returns list of bools from a selector. It is only allowed when selecting one field.
func (*TaskSelect) Float64 ¶
Float64 returns a single float64 from a selector. It is only allowed when selecting one field.
func (*TaskSelect) Float64s ¶
Float64s returns list of float64s from a selector. It is only allowed when selecting one field.
func (*TaskSelect) Int ¶
Int returns a single int from a selector. It is only allowed when selecting one field.
func (*TaskSelect) Ints ¶
Ints returns list of ints from a selector. It is only allowed when selecting one field.
func (*TaskSelect) Scan ¶
func (ts *TaskSelect) Scan(ctx context.Context, v any) error
Scan applies the selector query and scans the result into the given value.
func (*TaskSelect) String ¶
String returns a single string from a selector. It is only allowed when selecting one field.
type TaskUpdate ¶
type TaskUpdate struct {
// contains filtered or unexported fields
}
TaskUpdate is the builder for updating Task entities.
func (*TaskUpdate) ClearTitle ¶
func (tu *TaskUpdate) ClearTitle() *TaskUpdate
ClearTitle clears the value of the "title" field.
func (*TaskUpdate) Exec ¶
func (tu *TaskUpdate) Exec(ctx context.Context) error
Exec executes the query.
func (*TaskUpdate) ExecX ¶
func (tu *TaskUpdate) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*TaskUpdate) Mutation ¶
func (tu *TaskUpdate) Mutation() *TaskMutation
Mutation returns the TaskMutation object of the builder.
func (*TaskUpdate) Save ¶
func (tu *TaskUpdate) Save(ctx context.Context) (int, error)
Save executes the query and returns the number of nodes affected by the update operation.
func (*TaskUpdate) SaveX ¶
func (tu *TaskUpdate) SaveX(ctx context.Context) int
SaveX is like Save, but panics if an error occurs.
func (*TaskUpdate) SetComplete ¶
func (tu *TaskUpdate) SetComplete(b bool) *TaskUpdate
SetComplete sets the "complete" field.
func (*TaskUpdate) SetNillableComplete ¶ added in v0.5.0
func (tu *TaskUpdate) SetNillableComplete(b *bool) *TaskUpdate
SetNillableComplete sets the "complete" field if the given value is not nil.
func (*TaskUpdate) SetNillableSignature ¶ added in v0.5.0
func (tu *TaskUpdate) SetNillableSignature(s *string) *TaskUpdate
SetNillableSignature sets the "signature" field if the given value is not nil.
func (*TaskUpdate) SetNillableTitle ¶
func (tu *TaskUpdate) SetNillableTitle(s *string) *TaskUpdate
SetNillableTitle sets the "title" field if the given value is not nil.
func (*TaskUpdate) SetSignature ¶
func (tu *TaskUpdate) SetSignature(s string) *TaskUpdate
SetSignature sets the "signature" field.
func (*TaskUpdate) SetTitle ¶
func (tu *TaskUpdate) SetTitle(s string) *TaskUpdate
SetTitle sets the "title" field.
func (*TaskUpdate) Where ¶
func (tu *TaskUpdate) Where(ps ...predicate.Task) *TaskUpdate
Where appends a list predicates to the TaskUpdate builder.
type TaskUpdateOne ¶
type TaskUpdateOne struct {
// contains filtered or unexported fields
}
TaskUpdateOne is the builder for updating a single Task entity.
func (*TaskUpdateOne) ClearTitle ¶
func (tuo *TaskUpdateOne) ClearTitle() *TaskUpdateOne
ClearTitle clears the value of the "title" field.
func (*TaskUpdateOne) Exec ¶
func (tuo *TaskUpdateOne) Exec(ctx context.Context) error
Exec executes the query on the entity.
func (*TaskUpdateOne) ExecX ¶
func (tuo *TaskUpdateOne) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*TaskUpdateOne) Mutation ¶
func (tuo *TaskUpdateOne) Mutation() *TaskMutation
Mutation returns the TaskMutation object of the builder.
func (*TaskUpdateOne) Save ¶
func (tuo *TaskUpdateOne) Save(ctx context.Context) (*Task, error)
Save executes the query and returns the updated Task entity.
func (*TaskUpdateOne) SaveX ¶
func (tuo *TaskUpdateOne) SaveX(ctx context.Context) *Task
SaveX is like Save, but panics if an error occurs.
func (*TaskUpdateOne) Select ¶
func (tuo *TaskUpdateOne) Select(field string, fields ...string) *TaskUpdateOne
Select allows selecting one or more fields (columns) of the returned entity. The default is selecting all fields defined in the entity schema.
func (*TaskUpdateOne) SetComplete ¶
func (tuo *TaskUpdateOne) SetComplete(b bool) *TaskUpdateOne
SetComplete sets the "complete" field.
func (*TaskUpdateOne) SetNillableComplete ¶ added in v0.5.0
func (tuo *TaskUpdateOne) SetNillableComplete(b *bool) *TaskUpdateOne
SetNillableComplete sets the "complete" field if the given value is not nil.
func (*TaskUpdateOne) SetNillableSignature ¶ added in v0.5.0
func (tuo *TaskUpdateOne) SetNillableSignature(s *string) *TaskUpdateOne
SetNillableSignature sets the "signature" field if the given value is not nil.
func (*TaskUpdateOne) SetNillableTitle ¶
func (tuo *TaskUpdateOne) SetNillableTitle(s *string) *TaskUpdateOne
SetNillableTitle sets the "title" field if the given value is not nil.
func (*TaskUpdateOne) SetSignature ¶
func (tuo *TaskUpdateOne) SetSignature(s string) *TaskUpdateOne
SetSignature sets the "signature" field.
func (*TaskUpdateOne) SetTitle ¶
func (tuo *TaskUpdateOne) SetTitle(s string) *TaskUpdateOne
SetTitle sets the "title" field.
func (*TaskUpdateOne) Where ¶ added in v0.4.0
func (tuo *TaskUpdateOne) Where(ps ...predicate.Task) *TaskUpdateOne
Where appends a list predicates to the TaskUpdate builder.
type TraverseFunc ¶ added in v0.3.5
type TraverseFunc = ent.TraverseFunc
ent aliases to avoid import conflicts in user's code.
type Tx ¶
type Tx struct { // Attachment is the client for interacting with the Attachment builders. Attachment *AttachmentClient // File is the client for interacting with the File builders. File *FileClient // Task is the client for interacting with the Task builders. Task *TaskClient // 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"` // the user name Name string `json:"name,omitempty"` // contains filtered or unexported fields }
User is the model entity for the User schema.
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 ¶ added in v0.3.5
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 ¶ added in v0.3.5
func (c *UserClient) Interceptors() []Interceptor
Interceptors returns the client interceptors.
func (*UserClient) MapCreateBulk ¶ added in v0.5.0
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) 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) Exec ¶ added in v0.2.0
func (uc *UserCreate) Exec(ctx context.Context) error
Exec executes the query.
func (*UserCreate) ExecX ¶ added in v0.2.0
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) SetName ¶
func (uc *UserCreate) SetName(s string) *UserCreate
SetName sets the "name" 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 ¶ added in v0.2.0
func (ucb *UserCreateBulk) Exec(ctx context.Context) error
Exec executes the query.
func (*UserCreateBulk) ExecX ¶ added in v0.2.0
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 ¶ added in v0.4.0
func (udo *UserDeleteOne) Where(ps ...predicate.User) *UserDeleteOne
Where appends a list predicates to the UserDelete builder.
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) 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) 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) 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) 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) 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) 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 ¶ added in v0.3.0
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) Name ¶
func (m *UserMutation) Name() (r string, exists bool)
Name returns the value of the "name" field in the mutation.
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) OldName ¶
func (m *UserMutation) OldName(ctx context.Context) (v string, err error)
OldName returns the old "name" field's value of the User entity. If the User object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (*UserMutation) 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) 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) 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) ResetName ¶
func (m *UserMutation) ResetName()
ResetName resets all changes to the "name" 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) SetName ¶
func (m *UserMutation) SetName(s string)
SetName sets the "name" field.
func (*UserMutation) SetOp ¶ added in v0.3.5
func (m *UserMutation) SetOp(op Op)
SetOp allows setting the mutation operation.
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) Where ¶ added in v0.2.0
func (m *UserMutation) Where(ps ...predicate.User)
Where appends a list predicates to the UserMutation builder.
func (*UserMutation) WhereP ¶ added in v0.3.5
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 ¶ added in v0.3.4
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 { Name string `json:"name,omitempty"` Count int `json:"count,omitempty"` } client.User.Query(). GroupBy(user.FieldName). Aggregate(ent.Count()). Scan(ctx, &v)
func (*UserQuery) Only ¶
Only returns a single User entity found by the query, ensuring it only returns one. Returns a *NotSingularError when more than one User entity is found. Returns a *NotFoundError when no User entities are found.
func (*UserQuery) OnlyID ¶
OnlyID is like Only, but returns the only User ID in the query. Returns a *NotSingularError when more than one User ID is found. Returns a *NotFoundError when no entities are found.
func (*UserQuery) Order ¶
func (uq *UserQuery) Order(o ...user.OrderOption) *UserQuery
Order specifies how the records should be ordered.
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 { Name string `json:"name,omitempty"` } client.User.Query(). Select(user.FieldName). Scan(ctx, &v)
type UserSelect ¶
type UserSelect struct { *UserQuery // contains filtered or unexported fields }
UserSelect is the builder for selecting fields of User entities.
func (*UserSelect) Aggregate ¶ added in v0.3.4
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) 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) 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) SetName ¶
func (uu *UserUpdate) SetName(s string) *UserUpdate
SetName sets the "name" field.
func (*UserUpdate) SetNillableName ¶ added in v0.5.0
func (uu *UserUpdate) SetNillableName(s *string) *UserUpdate
SetNillableName sets the "name" field if the given value is not nil.
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) 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) 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) SetName ¶
func (uuo *UserUpdateOne) SetName(s string) *UserUpdateOne
SetName sets the "name" field.
func (*UserUpdateOne) SetNillableName ¶ added in v0.5.0
func (uuo *UserUpdateOne) SetNillableName(s *string) *UserUpdateOne
SetNillableName sets the "name" field if the given value is not nil.
func (*UserUpdateOne) Where ¶ added in v0.4.0
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 ¶
- attachment.go
- attachment_create.go
- attachment_delete.go
- attachment_query.go
- attachment_update.go
- client.go
- ent.go
- file.go
- file_create.go
- file_delete.go
- file_query.go
- file_update.go
- generate.go
- mutation.go
- runtime.go
- task.go
- task_create.go
- task_delete.go
- task_query.go
- task_update.go
- tx.go
- user.go
- user_create.go
- user_delete.go
- user_query.go
- user_update.go