Documentation ¶
Index ¶
- Constants
- func IsConstraintError(err error) bool
- func IsNotFound(err error) bool
- func IsNotLoaded(err error) bool
- func IsNotSingular(err error) bool
- func IsValidationError(err error) bool
- func MaskNotFound(err error) error
- func NewContext(parent context.Context, c *Client) context.Context
- func NewTxContext(parent context.Context, tx *Tx) context.Context
- type AggregateFunc
- type Client
- type CommitFunc
- type CommitHook
- type Committer
- type ConstraintError
- type Hook
- type MutateFunc
- type Mutation
- type Mutator
- type NotFoundError
- type NotLoadedError
- type NotSingularError
- type Op
- type Option
- type OrderFunc
- type Policy
- type Query
- type RollbackFunc
- type RollbackHook
- type Rollbacker
- type Tx
- type ValidationError
- type Value
- type Widget
- type WidgetClient
- func (c *WidgetClient) Create() *WidgetCreate
- func (c *WidgetClient) CreateBulk(builders ...*WidgetCreate) *WidgetCreateBulk
- func (c *WidgetClient) Delete() *WidgetDelete
- func (c *WidgetClient) DeleteOne(w *Widget) *WidgetDeleteOne
- func (c *WidgetClient) DeleteOneID(id int) *WidgetDeleteOne
- func (c *WidgetClient) Get(ctx context.Context, id int) (*Widget, error)
- func (c *WidgetClient) GetX(ctx context.Context, id int) *Widget
- func (c *WidgetClient) Hooks() []Hook
- func (c *WidgetClient) Query() *WidgetQuery
- func (c *WidgetClient) QueryType(w *Widget) *WidgetTypeQuery
- func (c *WidgetClient) Update() *WidgetUpdate
- func (c *WidgetClient) UpdateOne(w *Widget) *WidgetUpdateOne
- func (c *WidgetClient) UpdateOneID(id int) *WidgetUpdateOne
- func (c *WidgetClient) Use(hooks ...Hook)
- type WidgetCreate
- func (wc *WidgetCreate) Exec(ctx context.Context) error
- func (wc *WidgetCreate) ExecX(ctx context.Context)
- func (wc *WidgetCreate) Mutation() *WidgetMutation
- func (wc *WidgetCreate) Save(ctx context.Context) (*Widget, error)
- func (wc *WidgetCreate) SaveX(ctx context.Context) *Widget
- func (wc *WidgetCreate) SetCreatedAt(t time.Time) *WidgetCreate
- func (wc *WidgetCreate) SetNillableCreatedAt(t *time.Time) *WidgetCreate
- func (wc *WidgetCreate) SetNillablePriority(i *int) *WidgetCreate
- func (wc *WidgetCreate) SetNillableStatus(w *widget.Status) *WidgetCreate
- func (wc *WidgetCreate) SetNillableTypeID(id *int) *WidgetCreate
- func (wc *WidgetCreate) SetNote(s string) *WidgetCreate
- func (wc *WidgetCreate) SetPriority(i int) *WidgetCreate
- func (wc *WidgetCreate) SetStatus(w widget.Status) *WidgetCreate
- func (wc *WidgetCreate) SetType(w *WidgetType) *WidgetCreate
- func (wc *WidgetCreate) SetTypeID(id int) *WidgetCreate
- type WidgetCreateBulk
- type WidgetDelete
- type WidgetDeleteOne
- type WidgetEdges
- type WidgetGroupBy
- func (wgb *WidgetGroupBy) Aggregate(fns ...AggregateFunc) *WidgetGroupBy
- func (wgb *WidgetGroupBy) Bool(ctx context.Context) (_ bool, err error)
- func (wgb *WidgetGroupBy) BoolX(ctx context.Context) bool
- func (wgb *WidgetGroupBy) Bools(ctx context.Context) ([]bool, error)
- func (wgb *WidgetGroupBy) BoolsX(ctx context.Context) []bool
- func (wgb *WidgetGroupBy) Float64(ctx context.Context) (_ float64, err error)
- func (wgb *WidgetGroupBy) Float64X(ctx context.Context) float64
- func (wgb *WidgetGroupBy) Float64s(ctx context.Context) ([]float64, error)
- func (wgb *WidgetGroupBy) Float64sX(ctx context.Context) []float64
- func (wgb *WidgetGroupBy) Int(ctx context.Context) (_ int, err error)
- func (wgb *WidgetGroupBy) IntX(ctx context.Context) int
- func (wgb *WidgetGroupBy) Ints(ctx context.Context) ([]int, error)
- func (wgb *WidgetGroupBy) IntsX(ctx context.Context) []int
- func (wgb *WidgetGroupBy) Scan(ctx context.Context, v interface{}) error
- func (wgb *WidgetGroupBy) ScanX(ctx context.Context, v interface{})
- func (wgb *WidgetGroupBy) String(ctx context.Context) (_ string, err error)
- func (wgb *WidgetGroupBy) StringX(ctx context.Context) string
- func (wgb *WidgetGroupBy) Strings(ctx context.Context) ([]string, error)
- func (wgb *WidgetGroupBy) StringsX(ctx context.Context) []string
- type WidgetMutation
- func (m *WidgetMutation) AddField(name string, value ent.Value) error
- func (m *WidgetMutation) AddPriority(i int)
- func (m *WidgetMutation) AddedEdges() []string
- func (m *WidgetMutation) AddedField(name string) (ent.Value, bool)
- func (m *WidgetMutation) AddedFields() []string
- func (m *WidgetMutation) AddedIDs(name string) []ent.Value
- func (m *WidgetMutation) AddedPriority() (r int, exists bool)
- func (m *WidgetMutation) ClearEdge(name string) error
- func (m *WidgetMutation) ClearField(name string) error
- func (m *WidgetMutation) ClearType()
- func (m *WidgetMutation) ClearedEdges() []string
- func (m *WidgetMutation) ClearedFields() []string
- func (m WidgetMutation) Client() *Client
- func (m *WidgetMutation) CreatedAt() (r time.Time, exists bool)
- func (m *WidgetMutation) EdgeCleared(name string) bool
- func (m *WidgetMutation) Field(name string) (ent.Value, bool)
- func (m *WidgetMutation) FieldCleared(name string) bool
- func (m *WidgetMutation) Fields() []string
- func (m *WidgetMutation) ID() (id int, exists bool)
- func (m *WidgetMutation) Note() (r string, exists bool)
- func (m *WidgetMutation) OldCreatedAt(ctx context.Context) (v time.Time, err error)
- func (m *WidgetMutation) OldField(ctx context.Context, name string) (ent.Value, error)
- func (m *WidgetMutation) OldNote(ctx context.Context) (v string, err error)
- func (m *WidgetMutation) OldPriority(ctx context.Context) (v int, err error)
- func (m *WidgetMutation) OldStatus(ctx context.Context) (v widget.Status, err error)
- func (m *WidgetMutation) Op() Op
- func (m *WidgetMutation) Priority() (r int, exists bool)
- func (m *WidgetMutation) RemovedEdges() []string
- func (m *WidgetMutation) RemovedIDs(name string) []ent.Value
- func (m *WidgetMutation) ResetCreatedAt()
- func (m *WidgetMutation) ResetEdge(name string) error
- func (m *WidgetMutation) ResetField(name string) error
- func (m *WidgetMutation) ResetNote()
- func (m *WidgetMutation) ResetPriority()
- func (m *WidgetMutation) ResetStatus()
- func (m *WidgetMutation) ResetType()
- func (m *WidgetMutation) SetCreatedAt(t time.Time)
- func (m *WidgetMutation) SetField(name string, value ent.Value) error
- func (m *WidgetMutation) SetNote(s string)
- func (m *WidgetMutation) SetPriority(i int)
- func (m *WidgetMutation) SetStatus(w widget.Status)
- func (m *WidgetMutation) SetTypeID(id int)
- func (m *WidgetMutation) Status() (r widget.Status, exists bool)
- func (m WidgetMutation) Tx() (*Tx, error)
- func (m *WidgetMutation) Type() string
- func (m *WidgetMutation) TypeCleared() bool
- func (m *WidgetMutation) TypeID() (id int, exists bool)
- func (m *WidgetMutation) TypeIDs() (ids []int)
- func (m *WidgetMutation) Where(ps ...predicate.Widget)
- type WidgetQuery
- func (wq *WidgetQuery) All(ctx context.Context) ([]*Widget, error)
- func (wq *WidgetQuery) AllX(ctx context.Context) []*Widget
- func (wq *WidgetQuery) Clone() *WidgetQuery
- func (wq *WidgetQuery) Count(ctx context.Context) (int, error)
- func (wq *WidgetQuery) CountX(ctx context.Context) int
- func (wq *WidgetQuery) Exist(ctx context.Context) (bool, error)
- func (wq *WidgetQuery) ExistX(ctx context.Context) bool
- func (wq *WidgetQuery) First(ctx context.Context) (*Widget, error)
- func (wq *WidgetQuery) FirstID(ctx context.Context) (id int, err error)
- func (wq *WidgetQuery) FirstIDX(ctx context.Context) int
- func (wq *WidgetQuery) FirstX(ctx context.Context) *Widget
- func (wq *WidgetQuery) GroupBy(field string, fields ...string) *WidgetGroupBy
- func (wq *WidgetQuery) IDs(ctx context.Context) ([]int, error)
- func (wq *WidgetQuery) IDsX(ctx context.Context) []int
- func (wq *WidgetQuery) Limit(limit int) *WidgetQuery
- func (wq *WidgetQuery) Offset(offset int) *WidgetQuery
- func (wq *WidgetQuery) Only(ctx context.Context) (*Widget, error)
- func (wq *WidgetQuery) OnlyID(ctx context.Context) (id int, err error)
- func (wq *WidgetQuery) OnlyIDX(ctx context.Context) int
- func (wq *WidgetQuery) OnlyX(ctx context.Context) *Widget
- func (wq *WidgetQuery) Order(o ...OrderFunc) *WidgetQuery
- func (wq *WidgetQuery) QueryType() *WidgetTypeQuery
- func (wq *WidgetQuery) Select(fields ...string) *WidgetSelect
- func (wq *WidgetQuery) Unique(unique bool) *WidgetQuery
- func (wq *WidgetQuery) Where(ps ...predicate.Widget) *WidgetQuery
- func (wq *WidgetQuery) WithType(opts ...func(*WidgetTypeQuery)) *WidgetQuery
- type WidgetSelect
- func (ws *WidgetSelect) Bool(ctx context.Context) (_ bool, err error)
- func (ws *WidgetSelect) BoolX(ctx context.Context) bool
- func (ws *WidgetSelect) Bools(ctx context.Context) ([]bool, error)
- func (ws *WidgetSelect) BoolsX(ctx context.Context) []bool
- func (ws *WidgetSelect) Float64(ctx context.Context) (_ float64, err error)
- func (ws *WidgetSelect) Float64X(ctx context.Context) float64
- func (ws *WidgetSelect) Float64s(ctx context.Context) ([]float64, error)
- func (ws *WidgetSelect) Float64sX(ctx context.Context) []float64
- func (ws *WidgetSelect) Int(ctx context.Context) (_ int, err error)
- func (ws *WidgetSelect) IntX(ctx context.Context) int
- func (ws *WidgetSelect) Ints(ctx context.Context) ([]int, error)
- func (ws *WidgetSelect) IntsX(ctx context.Context) []int
- func (ws *WidgetSelect) Scan(ctx context.Context, v interface{}) error
- func (ws *WidgetSelect) ScanX(ctx context.Context, v interface{})
- func (ws *WidgetSelect) String(ctx context.Context) (_ string, err error)
- func (ws *WidgetSelect) StringX(ctx context.Context) string
- func (ws *WidgetSelect) Strings(ctx context.Context) ([]string, error)
- func (ws *WidgetSelect) StringsX(ctx context.Context) []string
- type WidgetType
- type WidgetTypeClient
- func (c *WidgetTypeClient) Create() *WidgetTypeCreate
- func (c *WidgetTypeClient) CreateBulk(builders ...*WidgetTypeCreate) *WidgetTypeCreateBulk
- func (c *WidgetTypeClient) Delete() *WidgetTypeDelete
- func (c *WidgetTypeClient) DeleteOne(wt *WidgetType) *WidgetTypeDeleteOne
- func (c *WidgetTypeClient) DeleteOneID(id int) *WidgetTypeDeleteOne
- func (c *WidgetTypeClient) Get(ctx context.Context, id int) (*WidgetType, error)
- func (c *WidgetTypeClient) GetX(ctx context.Context, id int) *WidgetType
- func (c *WidgetTypeClient) Hooks() []Hook
- func (c *WidgetTypeClient) Query() *WidgetTypeQuery
- func (c *WidgetTypeClient) Update() *WidgetTypeUpdate
- func (c *WidgetTypeClient) UpdateOne(wt *WidgetType) *WidgetTypeUpdateOne
- func (c *WidgetTypeClient) UpdateOneID(id int) *WidgetTypeUpdateOne
- func (c *WidgetTypeClient) Use(hooks ...Hook)
- type WidgetTypeCreate
- func (wtc *WidgetTypeCreate) Exec(ctx context.Context) error
- func (wtc *WidgetTypeCreate) ExecX(ctx context.Context)
- func (wtc *WidgetTypeCreate) Mutation() *WidgetTypeMutation
- func (wtc *WidgetTypeCreate) Save(ctx context.Context) (*WidgetType, error)
- func (wtc *WidgetTypeCreate) SaveX(ctx context.Context) *WidgetType
- func (wtc *WidgetTypeCreate) SetName(s string) *WidgetTypeCreate
- type WidgetTypeCreateBulk
- type WidgetTypeDelete
- type WidgetTypeDeleteOne
- type WidgetTypeGroupBy
- func (wtgb *WidgetTypeGroupBy) Aggregate(fns ...AggregateFunc) *WidgetTypeGroupBy
- func (wtgb *WidgetTypeGroupBy) Bool(ctx context.Context) (_ bool, err error)
- func (wtgb *WidgetTypeGroupBy) BoolX(ctx context.Context) bool
- func (wtgb *WidgetTypeGroupBy) Bools(ctx context.Context) ([]bool, error)
- func (wtgb *WidgetTypeGroupBy) BoolsX(ctx context.Context) []bool
- func (wtgb *WidgetTypeGroupBy) Float64(ctx context.Context) (_ float64, err error)
- func (wtgb *WidgetTypeGroupBy) Float64X(ctx context.Context) float64
- func (wtgb *WidgetTypeGroupBy) Float64s(ctx context.Context) ([]float64, error)
- func (wtgb *WidgetTypeGroupBy) Float64sX(ctx context.Context) []float64
- func (wtgb *WidgetTypeGroupBy) Int(ctx context.Context) (_ int, err error)
- func (wtgb *WidgetTypeGroupBy) IntX(ctx context.Context) int
- func (wtgb *WidgetTypeGroupBy) Ints(ctx context.Context) ([]int, error)
- func (wtgb *WidgetTypeGroupBy) IntsX(ctx context.Context) []int
- func (wtgb *WidgetTypeGroupBy) Scan(ctx context.Context, v interface{}) error
- func (wtgb *WidgetTypeGroupBy) ScanX(ctx context.Context, v interface{})
- func (wtgb *WidgetTypeGroupBy) String(ctx context.Context) (_ string, err error)
- func (wtgb *WidgetTypeGroupBy) StringX(ctx context.Context) string
- func (wtgb *WidgetTypeGroupBy) Strings(ctx context.Context) ([]string, error)
- func (wtgb *WidgetTypeGroupBy) StringsX(ctx context.Context) []string
- type WidgetTypeMutation
- func (m *WidgetTypeMutation) AddField(name string, value ent.Value) error
- func (m *WidgetTypeMutation) AddedEdges() []string
- func (m *WidgetTypeMutation) AddedField(name string) (ent.Value, bool)
- func (m *WidgetTypeMutation) AddedFields() []string
- func (m *WidgetTypeMutation) AddedIDs(name string) []ent.Value
- func (m *WidgetTypeMutation) ClearEdge(name string) error
- func (m *WidgetTypeMutation) ClearField(name string) error
- func (m *WidgetTypeMutation) ClearedEdges() []string
- func (m *WidgetTypeMutation) ClearedFields() []string
- func (m WidgetTypeMutation) Client() *Client
- func (m *WidgetTypeMutation) EdgeCleared(name string) bool
- func (m *WidgetTypeMutation) Field(name string) (ent.Value, bool)
- func (m *WidgetTypeMutation) FieldCleared(name string) bool
- func (m *WidgetTypeMutation) Fields() []string
- func (m *WidgetTypeMutation) ID() (id int, exists bool)
- func (m *WidgetTypeMutation) Name() (r string, exists bool)
- func (m *WidgetTypeMutation) OldField(ctx context.Context, name string) (ent.Value, error)
- func (m *WidgetTypeMutation) OldName(ctx context.Context) (v string, err error)
- func (m *WidgetTypeMutation) Op() Op
- func (m *WidgetTypeMutation) RemovedEdges() []string
- func (m *WidgetTypeMutation) RemovedIDs(name string) []ent.Value
- func (m *WidgetTypeMutation) ResetEdge(name string) error
- func (m *WidgetTypeMutation) ResetField(name string) error
- func (m *WidgetTypeMutation) ResetName()
- func (m *WidgetTypeMutation) SetField(name string, value ent.Value) error
- func (m *WidgetTypeMutation) SetName(s string)
- func (m WidgetTypeMutation) Tx() (*Tx, error)
- func (m *WidgetTypeMutation) Type() string
- func (m *WidgetTypeMutation) Where(ps ...predicate.WidgetType)
- type WidgetTypeQuery
- func (wtq *WidgetTypeQuery) All(ctx context.Context) ([]*WidgetType, error)
- func (wtq *WidgetTypeQuery) AllX(ctx context.Context) []*WidgetType
- func (wtq *WidgetTypeQuery) Clone() *WidgetTypeQuery
- func (wtq *WidgetTypeQuery) Count(ctx context.Context) (int, error)
- func (wtq *WidgetTypeQuery) CountX(ctx context.Context) int
- func (wtq *WidgetTypeQuery) Exist(ctx context.Context) (bool, error)
- func (wtq *WidgetTypeQuery) ExistX(ctx context.Context) bool
- func (wtq *WidgetTypeQuery) First(ctx context.Context) (*WidgetType, error)
- func (wtq *WidgetTypeQuery) FirstID(ctx context.Context) (id int, err error)
- func (wtq *WidgetTypeQuery) FirstIDX(ctx context.Context) int
- func (wtq *WidgetTypeQuery) FirstX(ctx context.Context) *WidgetType
- func (wtq *WidgetTypeQuery) GroupBy(field string, fields ...string) *WidgetTypeGroupBy
- func (wtq *WidgetTypeQuery) IDs(ctx context.Context) ([]int, error)
- func (wtq *WidgetTypeQuery) IDsX(ctx context.Context) []int
- func (wtq *WidgetTypeQuery) Limit(limit int) *WidgetTypeQuery
- func (wtq *WidgetTypeQuery) Offset(offset int) *WidgetTypeQuery
- func (wtq *WidgetTypeQuery) Only(ctx context.Context) (*WidgetType, error)
- func (wtq *WidgetTypeQuery) OnlyID(ctx context.Context) (id int, err error)
- func (wtq *WidgetTypeQuery) OnlyIDX(ctx context.Context) int
- func (wtq *WidgetTypeQuery) OnlyX(ctx context.Context) *WidgetType
- func (wtq *WidgetTypeQuery) Order(o ...OrderFunc) *WidgetTypeQuery
- func (wtq *WidgetTypeQuery) Select(fields ...string) *WidgetTypeSelect
- func (wtq *WidgetTypeQuery) Unique(unique bool) *WidgetTypeQuery
- func (wtq *WidgetTypeQuery) Where(ps ...predicate.WidgetType) *WidgetTypeQuery
- type WidgetTypeSelect
- func (wts *WidgetTypeSelect) Bool(ctx context.Context) (_ bool, err error)
- func (wts *WidgetTypeSelect) BoolX(ctx context.Context) bool
- func (wts *WidgetTypeSelect) Bools(ctx context.Context) ([]bool, error)
- func (wts *WidgetTypeSelect) BoolsX(ctx context.Context) []bool
- func (wts *WidgetTypeSelect) Float64(ctx context.Context) (_ float64, err error)
- func (wts *WidgetTypeSelect) Float64X(ctx context.Context) float64
- func (wts *WidgetTypeSelect) Float64s(ctx context.Context) ([]float64, error)
- func (wts *WidgetTypeSelect) Float64sX(ctx context.Context) []float64
- func (wts *WidgetTypeSelect) Int(ctx context.Context) (_ int, err error)
- func (wts *WidgetTypeSelect) IntX(ctx context.Context) int
- func (wts *WidgetTypeSelect) Ints(ctx context.Context) ([]int, error)
- func (wts *WidgetTypeSelect) IntsX(ctx context.Context) []int
- func (wts *WidgetTypeSelect) Scan(ctx context.Context, v interface{}) error
- func (wts *WidgetTypeSelect) ScanX(ctx context.Context, v interface{})
- func (wts *WidgetTypeSelect) String(ctx context.Context) (_ string, err error)
- func (wts *WidgetTypeSelect) StringX(ctx context.Context) string
- func (wts *WidgetTypeSelect) Strings(ctx context.Context) ([]string, error)
- func (wts *WidgetTypeSelect) StringsX(ctx context.Context) []string
- type WidgetTypeUpdate
- func (wtu *WidgetTypeUpdate) Exec(ctx context.Context) error
- func (wtu *WidgetTypeUpdate) ExecX(ctx context.Context)
- func (wtu *WidgetTypeUpdate) Mutation() *WidgetTypeMutation
- func (wtu *WidgetTypeUpdate) Save(ctx context.Context) (int, error)
- func (wtu *WidgetTypeUpdate) SaveX(ctx context.Context) int
- func (wtu *WidgetTypeUpdate) SetName(s string) *WidgetTypeUpdate
- func (wtu *WidgetTypeUpdate) Where(ps ...predicate.WidgetType) *WidgetTypeUpdate
- type WidgetTypeUpdateOne
- func (wtuo *WidgetTypeUpdateOne) Exec(ctx context.Context) error
- func (wtuo *WidgetTypeUpdateOne) ExecX(ctx context.Context)
- func (wtuo *WidgetTypeUpdateOne) Mutation() *WidgetTypeMutation
- func (wtuo *WidgetTypeUpdateOne) Save(ctx context.Context) (*WidgetType, error)
- func (wtuo *WidgetTypeUpdateOne) SaveX(ctx context.Context) *WidgetType
- func (wtuo *WidgetTypeUpdateOne) Select(field string, fields ...string) *WidgetTypeUpdateOne
- func (wtuo *WidgetTypeUpdateOne) SetName(s string) *WidgetTypeUpdateOne
- type WidgetTypes
- type WidgetUpdate
- func (wu *WidgetUpdate) AddPriority(i int) *WidgetUpdate
- func (wu *WidgetUpdate) ClearType() *WidgetUpdate
- func (wu *WidgetUpdate) Exec(ctx context.Context) error
- func (wu *WidgetUpdate) ExecX(ctx context.Context)
- func (wu *WidgetUpdate) Mutation() *WidgetMutation
- func (wu *WidgetUpdate) Save(ctx context.Context) (int, error)
- func (wu *WidgetUpdate) SaveX(ctx context.Context) int
- func (wu *WidgetUpdate) SetNillablePriority(i *int) *WidgetUpdate
- func (wu *WidgetUpdate) SetNillableStatus(w *widget.Status) *WidgetUpdate
- func (wu *WidgetUpdate) SetNillableTypeID(id *int) *WidgetUpdate
- func (wu *WidgetUpdate) SetNote(s string) *WidgetUpdate
- func (wu *WidgetUpdate) SetPriority(i int) *WidgetUpdate
- func (wu *WidgetUpdate) SetStatus(w widget.Status) *WidgetUpdate
- func (wu *WidgetUpdate) SetType(w *WidgetType) *WidgetUpdate
- func (wu *WidgetUpdate) SetTypeID(id int) *WidgetUpdate
- func (wu *WidgetUpdate) Where(ps ...predicate.Widget) *WidgetUpdate
- type WidgetUpdateOne
- func (wuo *WidgetUpdateOne) AddPriority(i int) *WidgetUpdateOne
- func (wuo *WidgetUpdateOne) ClearType() *WidgetUpdateOne
- func (wuo *WidgetUpdateOne) Exec(ctx context.Context) error
- func (wuo *WidgetUpdateOne) ExecX(ctx context.Context)
- func (wuo *WidgetUpdateOne) Mutation() *WidgetMutation
- func (wuo *WidgetUpdateOne) Save(ctx context.Context) (*Widget, error)
- func (wuo *WidgetUpdateOne) SaveX(ctx context.Context) *Widget
- func (wuo *WidgetUpdateOne) Select(field string, fields ...string) *WidgetUpdateOne
- func (wuo *WidgetUpdateOne) SetNillablePriority(i *int) *WidgetUpdateOne
- func (wuo *WidgetUpdateOne) SetNillableStatus(w *widget.Status) *WidgetUpdateOne
- func (wuo *WidgetUpdateOne) SetNillableTypeID(id *int) *WidgetUpdateOne
- func (wuo *WidgetUpdateOne) SetNote(s string) *WidgetUpdateOne
- func (wuo *WidgetUpdateOne) SetPriority(i int) *WidgetUpdateOne
- func (wuo *WidgetUpdateOne) SetStatus(w widget.Status) *WidgetUpdateOne
- func (wuo *WidgetUpdateOne) SetType(w *WidgetType) *WidgetUpdateOne
- func (wuo *WidgetUpdateOne) SetTypeID(id int) *WidgetUpdateOne
- type Widgets
Constants ¶
const ( // Operation types. OpCreate = ent.OpCreate OpDelete = ent.OpDelete OpDeleteOne = ent.OpDeleteOne OpUpdate = ent.OpUpdate OpUpdateOne = ent.OpUpdateOne // Node types. TypeWidget = "Widget" TypeWidgetType = "WidgetType" )
Variables ¶
This section is empty.
Functions ¶
func IsConstraintError ¶
IsConstraintError returns a boolean indicating whether the error is a constraint failure.
func IsNotFound ¶
IsNotFound returns a boolean indicating whether the error is a not found error.
func IsNotLoaded ¶
IsNotLoaded returns a boolean indicating whether the error is a not loaded error.
func IsNotSingular ¶
IsNotSingular returns a boolean indicating whether the error is a not singular error.
func IsValidationError ¶
IsValidationError returns a boolean indicating whether the error is a 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 Client ¶
type Client struct { // Schema is the client for creating, migrating and dropping schema. Schema *migrate.Schema // Widget is the client for interacting with the Widget builders. Widget *WidgetClient // WidgetType is the client for interacting with the WidgetType builders. WidgetType *WidgetTypeClient // 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(). Widget. Query(). Count(ctx)
type CommitFunc ¶
The CommitFunc type is an adapter to allow the use of ordinary function as a Committer. If f is a function with the appropriate signature, CommitFunc(f) is a Committer that calls f.
type CommitHook ¶
CommitHook defines the "commit middleware". A function that gets a Committer and returns a Committer. For example:
hook := func(next ent.Committer) ent.Committer { return ent.CommitFunc(func(context.Context, tx *ent.Tx) error { // Do some stuff before. if err := next.Commit(ctx, tx); err != nil { return err } // Do some stuff after. return nil }) }
type ConstraintError ¶
type ConstraintError struct {
// contains filtered or unexported fields
}
ConstraintError returns when trying to create/update one or more entities and one or more of their constraints failed. For example, violation of edge or field uniqueness.
func (ConstraintError) Error ¶
func (e ConstraintError) Error() string
Error implements the error interface.
func (*ConstraintError) Unwrap ¶
func (e *ConstraintError) Unwrap() error
Unwrap implements the errors.Wrapper interface.
type MutateFunc ¶
type MutateFunc = ent.MutateFunc
ent aliases to avoid import conflicts in user's code.
type NotFoundError ¶
type NotFoundError struct {
// contains filtered or unexported fields
}
NotFoundError returns when trying to fetch a specific entity and it was not found in the database.
func (*NotFoundError) Error ¶
func (e *NotFoundError) Error() string
Error implements the error interface.
type NotLoadedError ¶
type NotLoadedError struct {
// contains filtered or unexported fields
}
NotLoadedError returns when trying to get a node that was not loaded by the query.
func (*NotLoadedError) Error ¶
func (e *NotLoadedError) Error() string
Error implements the error interface.
type NotSingularError ¶
type NotSingularError struct {
// contains filtered or unexported fields
}
NotSingularError returns when trying to fetch a singular entity and more then one was found in the database.
func (*NotSingularError) Error ¶
func (e *NotSingularError) Error() string
Error implements the error interface.
type RollbackFunc ¶
The RollbackFunc type is an adapter to allow the use of ordinary function as a Rollbacker. If f is a function with the appropriate signature, RollbackFunc(f) is a Rollbacker that calls f.
type RollbackHook ¶
type RollbackHook func(Rollbacker) Rollbacker
RollbackHook defines the "rollback middleware". A function that gets a Rollbacker and returns a Rollbacker. For example:
hook := func(next ent.Rollbacker) ent.Rollbacker { return ent.RollbackFunc(func(context.Context, tx *ent.Tx) error { // Do some stuff before. if err := next.Rollback(ctx, tx); err != nil { return err } // Do some stuff after. return nil }) }
type Rollbacker ¶
Rollbacker is the interface that wraps the Rollbacker method.
type Tx ¶
type Tx struct { // Widget is the client for interacting with the Widget builders. Widget *WidgetClient // WidgetType is the client for interacting with the WidgetType builders. WidgetType *WidgetTypeClient // contains filtered or unexported fields }
Tx is a transactional client that is created by calling Client.Tx().
func TxFromContext ¶
TxFromContext returns a Tx stored inside a context, or nil if there isn't one.
func (*Tx) OnRollback ¶
func (tx *Tx) OnRollback(f RollbackHook)
OnRollback adds a hook to call on rollback.
type ValidationError ¶
type ValidationError struct { Name string // Field or edge name. // contains filtered or unexported fields }
ValidationError returns when validating a field fails.
func (*ValidationError) Error ¶
func (e *ValidationError) Error() string
Error implements the error interface.
func (*ValidationError) Unwrap ¶
func (e *ValidationError) Unwrap() error
Unwrap implements the errors.Wrapper interface.
type Widget ¶
type Widget struct { // ID of the ent. ID int `json:"id,omitempty"` // Note holds the value of the "note" field. Note string `json:"note,omitempty"` // CreatedAt holds the value of the "created_at" field. CreatedAt time.Time `json:"created_at,omitempty"` // Status holds the value of the "status" field. Status widget.Status `json:"status,omitempty"` // Priority holds the value of the "priority" field. Priority int `json:"priority,omitempty"` // Edges holds the relations/edges for other nodes in the graph. // The values are being populated by the WidgetQuery when eager-loading is set. Edges WidgetEdges `json:"edges"` // contains filtered or unexported fields }
Widget is the model entity for the Widget schema.
func (*Widget) QueryType ¶
func (w *Widget) QueryType() *WidgetTypeQuery
QueryType queries the "type" edge of the Widget entity.
func (*Widget) Unwrap ¶
Unwrap unwraps the Widget 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 (*Widget) Update ¶
func (w *Widget) Update() *WidgetUpdateOne
Update returns a builder for updating this Widget. Note that you need to call Widget.Unwrap() before calling this method if this Widget was returned from a transaction, and the transaction was committed or rolled back.
type WidgetClient ¶
type WidgetClient struct {
// contains filtered or unexported fields
}
WidgetClient is a client for the Widget schema.
func NewWidgetClient ¶
func NewWidgetClient(c config) *WidgetClient
NewWidgetClient returns a client for the Widget from the given config.
func (*WidgetClient) Create ¶
func (c *WidgetClient) Create() *WidgetCreate
Create returns a create builder for Widget.
func (*WidgetClient) CreateBulk ¶
func (c *WidgetClient) CreateBulk(builders ...*WidgetCreate) *WidgetCreateBulk
CreateBulk returns a builder for creating a bulk of Widget entities.
func (*WidgetClient) Delete ¶
func (c *WidgetClient) Delete() *WidgetDelete
Delete returns a delete builder for Widget.
func (*WidgetClient) DeleteOne ¶
func (c *WidgetClient) DeleteOne(w *Widget) *WidgetDeleteOne
DeleteOne returns a delete builder for the given entity.
func (*WidgetClient) DeleteOneID ¶
func (c *WidgetClient) DeleteOneID(id int) *WidgetDeleteOne
DeleteOneID returns a delete builder for the given id.
func (*WidgetClient) GetX ¶
func (c *WidgetClient) GetX(ctx context.Context, id int) *Widget
GetX is like Get, but panics if an error occurs.
func (*WidgetClient) Query ¶
func (c *WidgetClient) Query() *WidgetQuery
Query returns a query builder for Widget.
func (*WidgetClient) QueryType ¶
func (c *WidgetClient) QueryType(w *Widget) *WidgetTypeQuery
QueryType queries the type edge of a Widget.
func (*WidgetClient) Update ¶
func (c *WidgetClient) Update() *WidgetUpdate
Update returns an update builder for Widget.
func (*WidgetClient) UpdateOne ¶
func (c *WidgetClient) UpdateOne(w *Widget) *WidgetUpdateOne
UpdateOne returns an update builder for the given entity.
func (*WidgetClient) UpdateOneID ¶
func (c *WidgetClient) UpdateOneID(id int) *WidgetUpdateOne
UpdateOneID returns an update builder for the given id.
func (*WidgetClient) Use ¶
func (c *WidgetClient) Use(hooks ...Hook)
Use adds a list of mutation hooks to the hooks stack. A call to `Use(f, g, h)` equals to `widget.Hooks(f(g(h())))`.
type WidgetCreate ¶
type WidgetCreate struct {
// contains filtered or unexported fields
}
WidgetCreate is the builder for creating a Widget entity.
func (*WidgetCreate) Exec ¶
func (wc *WidgetCreate) Exec(ctx context.Context) error
Exec executes the query.
func (*WidgetCreate) ExecX ¶
func (wc *WidgetCreate) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*WidgetCreate) Mutation ¶
func (wc *WidgetCreate) Mutation() *WidgetMutation
Mutation returns the WidgetMutation object of the builder.
func (*WidgetCreate) Save ¶
func (wc *WidgetCreate) Save(ctx context.Context) (*Widget, error)
Save creates the Widget in the database.
func (*WidgetCreate) SaveX ¶
func (wc *WidgetCreate) SaveX(ctx context.Context) *Widget
SaveX calls Save and panics if Save returns an error.
func (*WidgetCreate) SetCreatedAt ¶
func (wc *WidgetCreate) SetCreatedAt(t time.Time) *WidgetCreate
SetCreatedAt sets the "created_at" field.
func (*WidgetCreate) SetNillableCreatedAt ¶
func (wc *WidgetCreate) SetNillableCreatedAt(t *time.Time) *WidgetCreate
SetNillableCreatedAt sets the "created_at" field if the given value is not nil.
func (*WidgetCreate) SetNillablePriority ¶
func (wc *WidgetCreate) SetNillablePriority(i *int) *WidgetCreate
SetNillablePriority sets the "priority" field if the given value is not nil.
func (*WidgetCreate) SetNillableStatus ¶
func (wc *WidgetCreate) SetNillableStatus(w *widget.Status) *WidgetCreate
SetNillableStatus sets the "status" field if the given value is not nil.
func (*WidgetCreate) SetNillableTypeID ¶
func (wc *WidgetCreate) SetNillableTypeID(id *int) *WidgetCreate
SetNillableTypeID sets the "type" edge to the WidgetType entity by ID if the given value is not nil.
func (*WidgetCreate) SetNote ¶
func (wc *WidgetCreate) SetNote(s string) *WidgetCreate
SetNote sets the "note" field.
func (*WidgetCreate) SetPriority ¶
func (wc *WidgetCreate) SetPriority(i int) *WidgetCreate
SetPriority sets the "priority" field.
func (*WidgetCreate) SetStatus ¶
func (wc *WidgetCreate) SetStatus(w widget.Status) *WidgetCreate
SetStatus sets the "status" field.
func (*WidgetCreate) SetType ¶
func (wc *WidgetCreate) SetType(w *WidgetType) *WidgetCreate
SetType sets the "type" edge to the WidgetType entity.
func (*WidgetCreate) SetTypeID ¶
func (wc *WidgetCreate) SetTypeID(id int) *WidgetCreate
SetTypeID sets the "type" edge to the WidgetType entity by ID.
type WidgetCreateBulk ¶
type WidgetCreateBulk struct {
// contains filtered or unexported fields
}
WidgetCreateBulk is the builder for creating many Widget entities in bulk.
func (*WidgetCreateBulk) Exec ¶
func (wcb *WidgetCreateBulk) Exec(ctx context.Context) error
Exec executes the query.
func (*WidgetCreateBulk) ExecX ¶
func (wcb *WidgetCreateBulk) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
type WidgetDelete ¶
type WidgetDelete struct {
// contains filtered or unexported fields
}
WidgetDelete is the builder for deleting a Widget entity.
func (*WidgetDelete) Exec ¶
func (wd *WidgetDelete) Exec(ctx context.Context) (int, error)
Exec executes the deletion query and returns how many vertices were deleted.
func (*WidgetDelete) ExecX ¶
func (wd *WidgetDelete) ExecX(ctx context.Context) int
ExecX is like Exec, but panics if an error occurs.
func (*WidgetDelete) Where ¶
func (wd *WidgetDelete) Where(ps ...predicate.Widget) *WidgetDelete
Where appends a list predicates to the WidgetDelete builder.
type WidgetDeleteOne ¶
type WidgetDeleteOne struct {
// contains filtered or unexported fields
}
WidgetDeleteOne is the builder for deleting a single Widget entity.
func (*WidgetDeleteOne) Exec ¶
func (wdo *WidgetDeleteOne) Exec(ctx context.Context) error
Exec executes the deletion query.
func (*WidgetDeleteOne) ExecX ¶
func (wdo *WidgetDeleteOne) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
type WidgetEdges ¶
type WidgetEdges struct { // Type holds the value of the type edge. Type *WidgetType `json:"type,omitempty"` // contains filtered or unexported fields }
WidgetEdges holds the relations/edges for other nodes in the graph.
func (WidgetEdges) TypeOrErr ¶
func (e WidgetEdges) TypeOrErr() (*WidgetType, error)
TypeOrErr returns the Type value or an error if the edge was not loaded in eager-loading, or loaded but was not found.
type WidgetGroupBy ¶
type WidgetGroupBy struct {
// contains filtered or unexported fields
}
WidgetGroupBy is the group-by builder for Widget entities.
func (*WidgetGroupBy) Aggregate ¶
func (wgb *WidgetGroupBy) Aggregate(fns ...AggregateFunc) *WidgetGroupBy
Aggregate adds the given aggregation functions to the group-by query.
func (*WidgetGroupBy) Bool ¶
func (wgb *WidgetGroupBy) Bool(ctx context.Context) (_ bool, err error)
Bool returns a single bool from a group-by query. It is only allowed when executing a group-by query with one field.
func (*WidgetGroupBy) BoolX ¶
func (wgb *WidgetGroupBy) BoolX(ctx context.Context) bool
BoolX is like Bool, but panics if an error occurs.
func (*WidgetGroupBy) Bools ¶
func (wgb *WidgetGroupBy) Bools(ctx context.Context) ([]bool, error)
Bools returns list of bools from group-by. It is only allowed when executing a group-by query with one field.
func (*WidgetGroupBy) BoolsX ¶
func (wgb *WidgetGroupBy) BoolsX(ctx context.Context) []bool
BoolsX is like Bools, but panics if an error occurs.
func (*WidgetGroupBy) Float64 ¶
func (wgb *WidgetGroupBy) Float64(ctx context.Context) (_ float64, err error)
Float64 returns a single float64 from a group-by query. It is only allowed when executing a group-by query with one field.
func (*WidgetGroupBy) Float64X ¶
func (wgb *WidgetGroupBy) Float64X(ctx context.Context) float64
Float64X is like Float64, but panics if an error occurs.
func (*WidgetGroupBy) Float64s ¶
func (wgb *WidgetGroupBy) Float64s(ctx context.Context) ([]float64, error)
Float64s returns list of float64s from group-by. It is only allowed when executing a group-by query with one field.
func (*WidgetGroupBy) Float64sX ¶
func (wgb *WidgetGroupBy) Float64sX(ctx context.Context) []float64
Float64sX is like Float64s, but panics if an error occurs.
func (*WidgetGroupBy) Int ¶
func (wgb *WidgetGroupBy) Int(ctx context.Context) (_ int, err error)
Int returns a single int from a group-by query. It is only allowed when executing a group-by query with one field.
func (*WidgetGroupBy) IntX ¶
func (wgb *WidgetGroupBy) IntX(ctx context.Context) int
IntX is like Int, but panics if an error occurs.
func (*WidgetGroupBy) Ints ¶
func (wgb *WidgetGroupBy) Ints(ctx context.Context) ([]int, error)
Ints returns list of ints from group-by. It is only allowed when executing a group-by query with one field.
func (*WidgetGroupBy) IntsX ¶
func (wgb *WidgetGroupBy) IntsX(ctx context.Context) []int
IntsX is like Ints, but panics if an error occurs.
func (*WidgetGroupBy) Scan ¶
func (wgb *WidgetGroupBy) Scan(ctx context.Context, v interface{}) error
Scan applies the group-by query and scans the result into the given value.
func (*WidgetGroupBy) ScanX ¶
func (wgb *WidgetGroupBy) ScanX(ctx context.Context, v interface{})
ScanX is like Scan, but panics if an error occurs.
func (*WidgetGroupBy) String ¶
func (wgb *WidgetGroupBy) String(ctx context.Context) (_ string, err error)
String returns a single string from a group-by query. It is only allowed when executing a group-by query with one field.
func (*WidgetGroupBy) StringX ¶
func (wgb *WidgetGroupBy) StringX(ctx context.Context) string
StringX is like String, but panics if an error occurs.
type WidgetMutation ¶
type WidgetMutation struct {
// contains filtered or unexported fields
}
WidgetMutation represents an operation that mutates the Widget nodes in the graph.
func (*WidgetMutation) AddField ¶
func (m *WidgetMutation) 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 (*WidgetMutation) AddPriority ¶
func (m *WidgetMutation) AddPriority(i int)
AddPriority adds i to the "priority" field.
func (*WidgetMutation) AddedEdges ¶
func (m *WidgetMutation) AddedEdges() []string
AddedEdges returns all edge names that were set/added in this mutation.
func (*WidgetMutation) AddedField ¶
func (m *WidgetMutation) 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 (*WidgetMutation) AddedFields ¶
func (m *WidgetMutation) AddedFields() []string
AddedFields returns all numeric fields that were incremented/decremented during this mutation.
func (*WidgetMutation) AddedIDs ¶
func (m *WidgetMutation) AddedIDs(name string) []ent.Value
AddedIDs returns all IDs (to other nodes) that were added for the given edge name in this mutation.
func (*WidgetMutation) AddedPriority ¶
func (m *WidgetMutation) AddedPriority() (r int, exists bool)
AddedPriority returns the value that was added to the "priority" field in this mutation.
func (*WidgetMutation) ClearEdge ¶
func (m *WidgetMutation) 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 (*WidgetMutation) ClearField ¶
func (m *WidgetMutation) 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 (*WidgetMutation) ClearType ¶
func (m *WidgetMutation) ClearType()
ClearType clears the "type" edge to the WidgetType entity.
func (*WidgetMutation) ClearedEdges ¶
func (m *WidgetMutation) ClearedEdges() []string
ClearedEdges returns all edge names that were cleared in this mutation.
func (*WidgetMutation) ClearedFields ¶
func (m *WidgetMutation) ClearedFields() []string
ClearedFields returns all nullable fields that were cleared during this mutation.
func (WidgetMutation) Client ¶
func (m WidgetMutation) 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 (*WidgetMutation) CreatedAt ¶
func (m *WidgetMutation) CreatedAt() (r time.Time, exists bool)
CreatedAt returns the value of the "created_at" field in the mutation.
func (*WidgetMutation) EdgeCleared ¶
func (m *WidgetMutation) EdgeCleared(name string) bool
EdgeCleared returns a boolean which indicates if the edge with the given name was cleared in this mutation.
func (*WidgetMutation) Field ¶
func (m *WidgetMutation) 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 (*WidgetMutation) FieldCleared ¶
func (m *WidgetMutation) FieldCleared(name string) bool
FieldCleared returns a boolean indicating if a field with the given name was cleared in this mutation.
func (*WidgetMutation) Fields ¶
func (m *WidgetMutation) 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 (*WidgetMutation) ID ¶
func (m *WidgetMutation) 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 (*WidgetMutation) Note ¶
func (m *WidgetMutation) Note() (r string, exists bool)
Note returns the value of the "note" field in the mutation.
func (*WidgetMutation) OldCreatedAt ¶
OldCreatedAt returns the old "created_at" field's value of the Widget entity. If the Widget 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 (*WidgetMutation) 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 (*WidgetMutation) OldNote ¶
func (m *WidgetMutation) OldNote(ctx context.Context) (v string, err error)
OldNote returns the old "note" field's value of the Widget entity. If the Widget 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 (*WidgetMutation) OldPriority ¶
func (m *WidgetMutation) OldPriority(ctx context.Context) (v int, err error)
OldPriority returns the old "priority" field's value of the Widget entity. If the Widget 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 (*WidgetMutation) OldStatus ¶
OldStatus returns the old "status" field's value of the Widget entity. If the Widget 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 (*WidgetMutation) Priority ¶
func (m *WidgetMutation) Priority() (r int, exists bool)
Priority returns the value of the "priority" field in the mutation.
func (*WidgetMutation) RemovedEdges ¶
func (m *WidgetMutation) RemovedEdges() []string
RemovedEdges returns all edge names that were removed in this mutation.
func (*WidgetMutation) RemovedIDs ¶
func (m *WidgetMutation) 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 (*WidgetMutation) ResetCreatedAt ¶
func (m *WidgetMutation) ResetCreatedAt()
ResetCreatedAt resets all changes to the "created_at" field.
func (*WidgetMutation) ResetEdge ¶
func (m *WidgetMutation) 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 (*WidgetMutation) ResetField ¶
func (m *WidgetMutation) 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 (*WidgetMutation) ResetNote ¶
func (m *WidgetMutation) ResetNote()
ResetNote resets all changes to the "note" field.
func (*WidgetMutation) ResetPriority ¶
func (m *WidgetMutation) ResetPriority()
ResetPriority resets all changes to the "priority" field.
func (*WidgetMutation) ResetStatus ¶
func (m *WidgetMutation) ResetStatus()
ResetStatus resets all changes to the "status" field.
func (*WidgetMutation) ResetType ¶
func (m *WidgetMutation) ResetType()
ResetType resets all changes to the "type" edge.
func (*WidgetMutation) SetCreatedAt ¶
func (m *WidgetMutation) SetCreatedAt(t time.Time)
SetCreatedAt sets the "created_at" field.
func (*WidgetMutation) SetField ¶
func (m *WidgetMutation) 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 (*WidgetMutation) SetNote ¶
func (m *WidgetMutation) SetNote(s string)
SetNote sets the "note" field.
func (*WidgetMutation) SetPriority ¶
func (m *WidgetMutation) SetPriority(i int)
SetPriority sets the "priority" field.
func (*WidgetMutation) SetStatus ¶
func (m *WidgetMutation) SetStatus(w widget.Status)
SetStatus sets the "status" field.
func (*WidgetMutation) SetTypeID ¶
func (m *WidgetMutation) SetTypeID(id int)
SetTypeID sets the "type" edge to the WidgetType entity by id.
func (*WidgetMutation) Status ¶
func (m *WidgetMutation) Status() (r widget.Status, exists bool)
Status returns the value of the "status" field in the mutation.
func (WidgetMutation) Tx ¶
func (m WidgetMutation) Tx() (*Tx, error)
Tx returns an `ent.Tx` for mutations that were executed in transactions; it returns an error otherwise.
func (*WidgetMutation) Type ¶
func (m *WidgetMutation) Type() string
Type returns the node type of this mutation (Widget).
func (*WidgetMutation) TypeCleared ¶
func (m *WidgetMutation) TypeCleared() bool
TypeCleared reports if the "type" edge to the WidgetType entity was cleared.
func (*WidgetMutation) TypeID ¶
func (m *WidgetMutation) TypeID() (id int, exists bool)
TypeID returns the "type" edge ID in the mutation.
func (*WidgetMutation) TypeIDs ¶
func (m *WidgetMutation) TypeIDs() (ids []int)
TypeIDs returns the "type" edge IDs in the mutation. Note that IDs always returns len(IDs) <= 1 for unique edges, and you should use TypeID instead. It exists only for internal usage by the builders.
func (*WidgetMutation) Where ¶
func (m *WidgetMutation) Where(ps ...predicate.Widget)
Where appends a list predicates to the WidgetMutation builder.
type WidgetQuery ¶
type WidgetQuery struct {
// contains filtered or unexported fields
}
WidgetQuery is the builder for querying Widget entities.
func (*WidgetQuery) All ¶
func (wq *WidgetQuery) All(ctx context.Context) ([]*Widget, error)
All executes the query and returns a list of Widgets.
func (*WidgetQuery) AllX ¶
func (wq *WidgetQuery) AllX(ctx context.Context) []*Widget
AllX is like All, but panics if an error occurs.
func (*WidgetQuery) Clone ¶
func (wq *WidgetQuery) Clone() *WidgetQuery
Clone returns a duplicate of the WidgetQuery builder, including all associated steps. It can be used to prepare common query builders and use them differently after the clone is made.
func (*WidgetQuery) Count ¶
func (wq *WidgetQuery) Count(ctx context.Context) (int, error)
Count returns the count of the given query.
func (*WidgetQuery) CountX ¶
func (wq *WidgetQuery) CountX(ctx context.Context) int
CountX is like Count, but panics if an error occurs.
func (*WidgetQuery) Exist ¶
func (wq *WidgetQuery) Exist(ctx context.Context) (bool, error)
Exist returns true if the query has elements in the graph.
func (*WidgetQuery) ExistX ¶
func (wq *WidgetQuery) ExistX(ctx context.Context) bool
ExistX is like Exist, but panics if an error occurs.
func (*WidgetQuery) First ¶
func (wq *WidgetQuery) First(ctx context.Context) (*Widget, error)
First returns the first Widget entity from the query. Returns a *NotFoundError when no Widget was found.
func (*WidgetQuery) FirstID ¶
func (wq *WidgetQuery) FirstID(ctx context.Context) (id int, err error)
FirstID returns the first Widget ID from the query. Returns a *NotFoundError when no Widget ID was found.
func (*WidgetQuery) FirstIDX ¶
func (wq *WidgetQuery) FirstIDX(ctx context.Context) int
FirstIDX is like FirstID, but panics if an error occurs.
func (*WidgetQuery) FirstX ¶
func (wq *WidgetQuery) FirstX(ctx context.Context) *Widget
FirstX is like First, but panics if an error occurs.
func (*WidgetQuery) GroupBy ¶
func (wq *WidgetQuery) GroupBy(field string, fields ...string) *WidgetGroupBy
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 { Note string `json:"note,omitempty"` Count int `json:"count,omitempty"` } client.Widget.Query(). GroupBy(widget.FieldNote). Aggregate(ent.Count()). Scan(ctx, &v)
func (*WidgetQuery) IDs ¶
func (wq *WidgetQuery) IDs(ctx context.Context) ([]int, error)
IDs executes the query and returns a list of Widget IDs.
func (*WidgetQuery) IDsX ¶
func (wq *WidgetQuery) IDsX(ctx context.Context) []int
IDsX is like IDs, but panics if an error occurs.
func (*WidgetQuery) Limit ¶
func (wq *WidgetQuery) Limit(limit int) *WidgetQuery
Limit adds a limit step to the query.
func (*WidgetQuery) Offset ¶
func (wq *WidgetQuery) Offset(offset int) *WidgetQuery
Offset adds an offset step to the query.
func (*WidgetQuery) Only ¶
func (wq *WidgetQuery) Only(ctx context.Context) (*Widget, error)
Only returns a single Widget entity found by the query, ensuring it only returns one. Returns a *NotSingularError when exactly one Widget entity is not found. Returns a *NotFoundError when no Widget entities are found.
func (*WidgetQuery) OnlyID ¶
func (wq *WidgetQuery) OnlyID(ctx context.Context) (id int, err error)
OnlyID is like Only, but returns the only Widget ID in the query. Returns a *NotSingularError when exactly one Widget ID is not found. Returns a *NotFoundError when no entities are found.
func (*WidgetQuery) OnlyIDX ¶
func (wq *WidgetQuery) OnlyIDX(ctx context.Context) int
OnlyIDX is like OnlyID, but panics if an error occurs.
func (*WidgetQuery) OnlyX ¶
func (wq *WidgetQuery) OnlyX(ctx context.Context) *Widget
OnlyX is like Only, but panics if an error occurs.
func (*WidgetQuery) Order ¶
func (wq *WidgetQuery) Order(o ...OrderFunc) *WidgetQuery
Order adds an order step to the query.
func (*WidgetQuery) QueryType ¶
func (wq *WidgetQuery) QueryType() *WidgetTypeQuery
QueryType chains the current query on the "type" edge.
func (*WidgetQuery) Select ¶
func (wq *WidgetQuery) Select(fields ...string) *WidgetSelect
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 { Note string `json:"note,omitempty"` } client.Widget.Query(). Select(widget.FieldNote). Scan(ctx, &v)
func (*WidgetQuery) Unique ¶
func (wq *WidgetQuery) Unique(unique bool) *WidgetQuery
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 (*WidgetQuery) Where ¶
func (wq *WidgetQuery) Where(ps ...predicate.Widget) *WidgetQuery
Where adds a new predicate for the WidgetQuery builder.
func (*WidgetQuery) WithType ¶
func (wq *WidgetQuery) WithType(opts ...func(*WidgetTypeQuery)) *WidgetQuery
WithType tells the query-builder to eager-load the nodes that are connected to the "type" edge. The optional arguments are used to configure the query builder of the edge.
type WidgetSelect ¶
type WidgetSelect struct { *WidgetQuery // contains filtered or unexported fields }
WidgetSelect is the builder for selecting fields of Widget entities.
func (*WidgetSelect) Bool ¶
func (ws *WidgetSelect) Bool(ctx context.Context) (_ bool, err error)
Bool returns a single bool from a selector. It is only allowed when selecting one field.
func (*WidgetSelect) BoolX ¶
func (ws *WidgetSelect) BoolX(ctx context.Context) bool
BoolX is like Bool, but panics if an error occurs.
func (*WidgetSelect) Bools ¶
func (ws *WidgetSelect) Bools(ctx context.Context) ([]bool, error)
Bools returns list of bools from a selector. It is only allowed when selecting one field.
func (*WidgetSelect) BoolsX ¶
func (ws *WidgetSelect) BoolsX(ctx context.Context) []bool
BoolsX is like Bools, but panics if an error occurs.
func (*WidgetSelect) Float64 ¶
func (ws *WidgetSelect) Float64(ctx context.Context) (_ float64, err error)
Float64 returns a single float64 from a selector. It is only allowed when selecting one field.
func (*WidgetSelect) Float64X ¶
func (ws *WidgetSelect) Float64X(ctx context.Context) float64
Float64X is like Float64, but panics if an error occurs.
func (*WidgetSelect) Float64s ¶
func (ws *WidgetSelect) Float64s(ctx context.Context) ([]float64, error)
Float64s returns list of float64s from a selector. It is only allowed when selecting one field.
func (*WidgetSelect) Float64sX ¶
func (ws *WidgetSelect) Float64sX(ctx context.Context) []float64
Float64sX is like Float64s, but panics if an error occurs.
func (*WidgetSelect) Int ¶
func (ws *WidgetSelect) Int(ctx context.Context) (_ int, err error)
Int returns a single int from a selector. It is only allowed when selecting one field.
func (*WidgetSelect) IntX ¶
func (ws *WidgetSelect) IntX(ctx context.Context) int
IntX is like Int, but panics if an error occurs.
func (*WidgetSelect) Ints ¶
func (ws *WidgetSelect) Ints(ctx context.Context) ([]int, error)
Ints returns list of ints from a selector. It is only allowed when selecting one field.
func (*WidgetSelect) IntsX ¶
func (ws *WidgetSelect) IntsX(ctx context.Context) []int
IntsX is like Ints, but panics if an error occurs.
func (*WidgetSelect) Scan ¶
func (ws *WidgetSelect) Scan(ctx context.Context, v interface{}) error
Scan applies the selector query and scans the result into the given value.
func (*WidgetSelect) ScanX ¶
func (ws *WidgetSelect) ScanX(ctx context.Context, v interface{})
ScanX is like Scan, but panics if an error occurs.
func (*WidgetSelect) String ¶
func (ws *WidgetSelect) String(ctx context.Context) (_ string, err error)
String returns a single string from a selector. It is only allowed when selecting one field.
func (*WidgetSelect) StringX ¶
func (ws *WidgetSelect) StringX(ctx context.Context) string
StringX is like String, but panics if an error occurs.
type WidgetType ¶
type WidgetType struct { // ID of the ent. ID int `json:"id,omitempty"` // Name holds the value of the "name" field. Name string `json:"name,omitempty"` // contains filtered or unexported fields }
WidgetType is the model entity for the WidgetType schema.
func (*WidgetType) String ¶
func (wt *WidgetType) String() string
String implements the fmt.Stringer.
func (*WidgetType) Unwrap ¶
func (wt *WidgetType) Unwrap() *WidgetType
Unwrap unwraps the WidgetType 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 (*WidgetType) Update ¶
func (wt *WidgetType) Update() *WidgetTypeUpdateOne
Update returns a builder for updating this WidgetType. Note that you need to call WidgetType.Unwrap() before calling this method if this WidgetType was returned from a transaction, and the transaction was committed or rolled back.
type WidgetTypeClient ¶
type WidgetTypeClient struct {
// contains filtered or unexported fields
}
WidgetTypeClient is a client for the WidgetType schema.
func NewWidgetTypeClient ¶
func NewWidgetTypeClient(c config) *WidgetTypeClient
NewWidgetTypeClient returns a client for the WidgetType from the given config.
func (*WidgetTypeClient) Create ¶
func (c *WidgetTypeClient) Create() *WidgetTypeCreate
Create returns a create builder for WidgetType.
func (*WidgetTypeClient) CreateBulk ¶
func (c *WidgetTypeClient) CreateBulk(builders ...*WidgetTypeCreate) *WidgetTypeCreateBulk
CreateBulk returns a builder for creating a bulk of WidgetType entities.
func (*WidgetTypeClient) Delete ¶
func (c *WidgetTypeClient) Delete() *WidgetTypeDelete
Delete returns a delete builder for WidgetType.
func (*WidgetTypeClient) DeleteOne ¶
func (c *WidgetTypeClient) DeleteOne(wt *WidgetType) *WidgetTypeDeleteOne
DeleteOne returns a delete builder for the given entity.
func (*WidgetTypeClient) DeleteOneID ¶
func (c *WidgetTypeClient) DeleteOneID(id int) *WidgetTypeDeleteOne
DeleteOneID returns a delete builder for the given id.
func (*WidgetTypeClient) Get ¶
func (c *WidgetTypeClient) Get(ctx context.Context, id int) (*WidgetType, error)
Get returns a WidgetType entity by its id.
func (*WidgetTypeClient) GetX ¶
func (c *WidgetTypeClient) GetX(ctx context.Context, id int) *WidgetType
GetX is like Get, but panics if an error occurs.
func (*WidgetTypeClient) Hooks ¶
func (c *WidgetTypeClient) Hooks() []Hook
Hooks returns the client hooks.
func (*WidgetTypeClient) Query ¶
func (c *WidgetTypeClient) Query() *WidgetTypeQuery
Query returns a query builder for WidgetType.
func (*WidgetTypeClient) Update ¶
func (c *WidgetTypeClient) Update() *WidgetTypeUpdate
Update returns an update builder for WidgetType.
func (*WidgetTypeClient) UpdateOne ¶
func (c *WidgetTypeClient) UpdateOne(wt *WidgetType) *WidgetTypeUpdateOne
UpdateOne returns an update builder for the given entity.
func (*WidgetTypeClient) UpdateOneID ¶
func (c *WidgetTypeClient) UpdateOneID(id int) *WidgetTypeUpdateOne
UpdateOneID returns an update builder for the given id.
func (*WidgetTypeClient) Use ¶
func (c *WidgetTypeClient) Use(hooks ...Hook)
Use adds a list of mutation hooks to the hooks stack. A call to `Use(f, g, h)` equals to `widgettype.Hooks(f(g(h())))`.
type WidgetTypeCreate ¶
type WidgetTypeCreate struct {
// contains filtered or unexported fields
}
WidgetTypeCreate is the builder for creating a WidgetType entity.
func (*WidgetTypeCreate) Exec ¶
func (wtc *WidgetTypeCreate) Exec(ctx context.Context) error
Exec executes the query.
func (*WidgetTypeCreate) ExecX ¶
func (wtc *WidgetTypeCreate) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*WidgetTypeCreate) Mutation ¶
func (wtc *WidgetTypeCreate) Mutation() *WidgetTypeMutation
Mutation returns the WidgetTypeMutation object of the builder.
func (*WidgetTypeCreate) Save ¶
func (wtc *WidgetTypeCreate) Save(ctx context.Context) (*WidgetType, error)
Save creates the WidgetType in the database.
func (*WidgetTypeCreate) SaveX ¶
func (wtc *WidgetTypeCreate) SaveX(ctx context.Context) *WidgetType
SaveX calls Save and panics if Save returns an error.
func (*WidgetTypeCreate) SetName ¶
func (wtc *WidgetTypeCreate) SetName(s string) *WidgetTypeCreate
SetName sets the "name" field.
type WidgetTypeCreateBulk ¶
type WidgetTypeCreateBulk struct {
// contains filtered or unexported fields
}
WidgetTypeCreateBulk is the builder for creating many WidgetType entities in bulk.
func (*WidgetTypeCreateBulk) Exec ¶
func (wtcb *WidgetTypeCreateBulk) Exec(ctx context.Context) error
Exec executes the query.
func (*WidgetTypeCreateBulk) ExecX ¶
func (wtcb *WidgetTypeCreateBulk) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*WidgetTypeCreateBulk) Save ¶
func (wtcb *WidgetTypeCreateBulk) Save(ctx context.Context) ([]*WidgetType, error)
Save creates the WidgetType entities in the database.
func (*WidgetTypeCreateBulk) SaveX ¶
func (wtcb *WidgetTypeCreateBulk) SaveX(ctx context.Context) []*WidgetType
SaveX is like Save, but panics if an error occurs.
type WidgetTypeDelete ¶
type WidgetTypeDelete struct {
// contains filtered or unexported fields
}
WidgetTypeDelete is the builder for deleting a WidgetType entity.
func (*WidgetTypeDelete) Exec ¶
func (wtd *WidgetTypeDelete) Exec(ctx context.Context) (int, error)
Exec executes the deletion query and returns how many vertices were deleted.
func (*WidgetTypeDelete) ExecX ¶
func (wtd *WidgetTypeDelete) ExecX(ctx context.Context) int
ExecX is like Exec, but panics if an error occurs.
func (*WidgetTypeDelete) Where ¶
func (wtd *WidgetTypeDelete) Where(ps ...predicate.WidgetType) *WidgetTypeDelete
Where appends a list predicates to the WidgetTypeDelete builder.
type WidgetTypeDeleteOne ¶
type WidgetTypeDeleteOne struct {
// contains filtered or unexported fields
}
WidgetTypeDeleteOne is the builder for deleting a single WidgetType entity.
func (*WidgetTypeDeleteOne) Exec ¶
func (wtdo *WidgetTypeDeleteOne) Exec(ctx context.Context) error
Exec executes the deletion query.
func (*WidgetTypeDeleteOne) ExecX ¶
func (wtdo *WidgetTypeDeleteOne) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
type WidgetTypeGroupBy ¶
type WidgetTypeGroupBy struct {
// contains filtered or unexported fields
}
WidgetTypeGroupBy is the group-by builder for WidgetType entities.
func (*WidgetTypeGroupBy) Aggregate ¶
func (wtgb *WidgetTypeGroupBy) Aggregate(fns ...AggregateFunc) *WidgetTypeGroupBy
Aggregate adds the given aggregation functions to the group-by query.
func (*WidgetTypeGroupBy) Bool ¶
func (wtgb *WidgetTypeGroupBy) Bool(ctx context.Context) (_ bool, err error)
Bool returns a single bool from a group-by query. It is only allowed when executing a group-by query with one field.
func (*WidgetTypeGroupBy) BoolX ¶
func (wtgb *WidgetTypeGroupBy) BoolX(ctx context.Context) bool
BoolX is like Bool, but panics if an error occurs.
func (*WidgetTypeGroupBy) Bools ¶
func (wtgb *WidgetTypeGroupBy) Bools(ctx context.Context) ([]bool, error)
Bools returns list of bools from group-by. It is only allowed when executing a group-by query with one field.
func (*WidgetTypeGroupBy) BoolsX ¶
func (wtgb *WidgetTypeGroupBy) BoolsX(ctx context.Context) []bool
BoolsX is like Bools, but panics if an error occurs.
func (*WidgetTypeGroupBy) Float64 ¶
func (wtgb *WidgetTypeGroupBy) Float64(ctx context.Context) (_ float64, err error)
Float64 returns a single float64 from a group-by query. It is only allowed when executing a group-by query with one field.
func (*WidgetTypeGroupBy) Float64X ¶
func (wtgb *WidgetTypeGroupBy) Float64X(ctx context.Context) float64
Float64X is like Float64, but panics if an error occurs.
func (*WidgetTypeGroupBy) Float64s ¶
func (wtgb *WidgetTypeGroupBy) Float64s(ctx context.Context) ([]float64, error)
Float64s returns list of float64s from group-by. It is only allowed when executing a group-by query with one field.
func (*WidgetTypeGroupBy) Float64sX ¶
func (wtgb *WidgetTypeGroupBy) Float64sX(ctx context.Context) []float64
Float64sX is like Float64s, but panics if an error occurs.
func (*WidgetTypeGroupBy) Int ¶
func (wtgb *WidgetTypeGroupBy) Int(ctx context.Context) (_ int, err error)
Int returns a single int from a group-by query. It is only allowed when executing a group-by query with one field.
func (*WidgetTypeGroupBy) IntX ¶
func (wtgb *WidgetTypeGroupBy) IntX(ctx context.Context) int
IntX is like Int, but panics if an error occurs.
func (*WidgetTypeGroupBy) Ints ¶
func (wtgb *WidgetTypeGroupBy) Ints(ctx context.Context) ([]int, error)
Ints returns list of ints from group-by. It is only allowed when executing a group-by query with one field.
func (*WidgetTypeGroupBy) IntsX ¶
func (wtgb *WidgetTypeGroupBy) IntsX(ctx context.Context) []int
IntsX is like Ints, but panics if an error occurs.
func (*WidgetTypeGroupBy) Scan ¶
func (wtgb *WidgetTypeGroupBy) Scan(ctx context.Context, v interface{}) error
Scan applies the group-by query and scans the result into the given value.
func (*WidgetTypeGroupBy) ScanX ¶
func (wtgb *WidgetTypeGroupBy) ScanX(ctx context.Context, v interface{})
ScanX is like Scan, but panics if an error occurs.
func (*WidgetTypeGroupBy) String ¶
func (wtgb *WidgetTypeGroupBy) String(ctx context.Context) (_ string, err error)
String returns a single string from a group-by query. It is only allowed when executing a group-by query with one field.
func (*WidgetTypeGroupBy) StringX ¶
func (wtgb *WidgetTypeGroupBy) StringX(ctx context.Context) string
StringX is like String, but panics if an error occurs.
type WidgetTypeMutation ¶
type WidgetTypeMutation struct {
// contains filtered or unexported fields
}
WidgetTypeMutation represents an operation that mutates the WidgetType nodes in the graph.
func (*WidgetTypeMutation) AddField ¶
func (m *WidgetTypeMutation) 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 (*WidgetTypeMutation) AddedEdges ¶
func (m *WidgetTypeMutation) AddedEdges() []string
AddedEdges returns all edge names that were set/added in this mutation.
func (*WidgetTypeMutation) AddedField ¶
func (m *WidgetTypeMutation) 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 (*WidgetTypeMutation) AddedFields ¶
func (m *WidgetTypeMutation) AddedFields() []string
AddedFields returns all numeric fields that were incremented/decremented during this mutation.
func (*WidgetTypeMutation) AddedIDs ¶
func (m *WidgetTypeMutation) AddedIDs(name string) []ent.Value
AddedIDs returns all IDs (to other nodes) that were added for the given edge name in this mutation.
func (*WidgetTypeMutation) ClearEdge ¶
func (m *WidgetTypeMutation) 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 (*WidgetTypeMutation) ClearField ¶
func (m *WidgetTypeMutation) 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 (*WidgetTypeMutation) ClearedEdges ¶
func (m *WidgetTypeMutation) ClearedEdges() []string
ClearedEdges returns all edge names that were cleared in this mutation.
func (*WidgetTypeMutation) ClearedFields ¶
func (m *WidgetTypeMutation) ClearedFields() []string
ClearedFields returns all nullable fields that were cleared during this mutation.
func (WidgetTypeMutation) Client ¶
func (m WidgetTypeMutation) 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 (*WidgetTypeMutation) EdgeCleared ¶
func (m *WidgetTypeMutation) EdgeCleared(name string) bool
EdgeCleared returns a boolean which indicates if the edge with the given name was cleared in this mutation.
func (*WidgetTypeMutation) Field ¶
func (m *WidgetTypeMutation) 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 (*WidgetTypeMutation) FieldCleared ¶
func (m *WidgetTypeMutation) FieldCleared(name string) bool
FieldCleared returns a boolean indicating if a field with the given name was cleared in this mutation.
func (*WidgetTypeMutation) Fields ¶
func (m *WidgetTypeMutation) 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 (*WidgetTypeMutation) ID ¶
func (m *WidgetTypeMutation) 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 (*WidgetTypeMutation) Name ¶
func (m *WidgetTypeMutation) Name() (r string, exists bool)
Name returns the value of the "name" field in the mutation.
func (*WidgetTypeMutation) 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 (*WidgetTypeMutation) OldName ¶
func (m *WidgetTypeMutation) OldName(ctx context.Context) (v string, err error)
OldName returns the old "name" field's value of the WidgetType entity. If the WidgetType 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 (*WidgetTypeMutation) RemovedEdges ¶
func (m *WidgetTypeMutation) RemovedEdges() []string
RemovedEdges returns all edge names that were removed in this mutation.
func (*WidgetTypeMutation) RemovedIDs ¶
func (m *WidgetTypeMutation) 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 (*WidgetTypeMutation) ResetEdge ¶
func (m *WidgetTypeMutation) 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 (*WidgetTypeMutation) ResetField ¶
func (m *WidgetTypeMutation) 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 (*WidgetTypeMutation) ResetName ¶
func (m *WidgetTypeMutation) ResetName()
ResetName resets all changes to the "name" field.
func (*WidgetTypeMutation) SetField ¶
func (m *WidgetTypeMutation) 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 (*WidgetTypeMutation) SetName ¶
func (m *WidgetTypeMutation) SetName(s string)
SetName sets the "name" field.
func (WidgetTypeMutation) Tx ¶
func (m WidgetTypeMutation) Tx() (*Tx, error)
Tx returns an `ent.Tx` for mutations that were executed in transactions; it returns an error otherwise.
func (*WidgetTypeMutation) Type ¶
func (m *WidgetTypeMutation) Type() string
Type returns the node type of this mutation (WidgetType).
func (*WidgetTypeMutation) Where ¶
func (m *WidgetTypeMutation) Where(ps ...predicate.WidgetType)
Where appends a list predicates to the WidgetTypeMutation builder.
type WidgetTypeQuery ¶
type WidgetTypeQuery struct {
// contains filtered or unexported fields
}
WidgetTypeQuery is the builder for querying WidgetType entities.
func (*WidgetTypeQuery) All ¶
func (wtq *WidgetTypeQuery) All(ctx context.Context) ([]*WidgetType, error)
All executes the query and returns a list of WidgetTypes.
func (*WidgetTypeQuery) AllX ¶
func (wtq *WidgetTypeQuery) AllX(ctx context.Context) []*WidgetType
AllX is like All, but panics if an error occurs.
func (*WidgetTypeQuery) Clone ¶
func (wtq *WidgetTypeQuery) Clone() *WidgetTypeQuery
Clone returns a duplicate of the WidgetTypeQuery builder, including all associated steps. It can be used to prepare common query builders and use them differently after the clone is made.
func (*WidgetTypeQuery) Count ¶
func (wtq *WidgetTypeQuery) Count(ctx context.Context) (int, error)
Count returns the count of the given query.
func (*WidgetTypeQuery) CountX ¶
func (wtq *WidgetTypeQuery) CountX(ctx context.Context) int
CountX is like Count, but panics if an error occurs.
func (*WidgetTypeQuery) Exist ¶
func (wtq *WidgetTypeQuery) Exist(ctx context.Context) (bool, error)
Exist returns true if the query has elements in the graph.
func (*WidgetTypeQuery) ExistX ¶
func (wtq *WidgetTypeQuery) ExistX(ctx context.Context) bool
ExistX is like Exist, but panics if an error occurs.
func (*WidgetTypeQuery) First ¶
func (wtq *WidgetTypeQuery) First(ctx context.Context) (*WidgetType, error)
First returns the first WidgetType entity from the query. Returns a *NotFoundError when no WidgetType was found.
func (*WidgetTypeQuery) FirstID ¶
func (wtq *WidgetTypeQuery) FirstID(ctx context.Context) (id int, err error)
FirstID returns the first WidgetType ID from the query. Returns a *NotFoundError when no WidgetType ID was found.
func (*WidgetTypeQuery) FirstIDX ¶
func (wtq *WidgetTypeQuery) FirstIDX(ctx context.Context) int
FirstIDX is like FirstID, but panics if an error occurs.
func (*WidgetTypeQuery) FirstX ¶
func (wtq *WidgetTypeQuery) FirstX(ctx context.Context) *WidgetType
FirstX is like First, but panics if an error occurs.
func (*WidgetTypeQuery) GroupBy ¶
func (wtq *WidgetTypeQuery) GroupBy(field string, fields ...string) *WidgetTypeGroupBy
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.WidgetType.Query(). GroupBy(widgettype.FieldName). Aggregate(ent.Count()). Scan(ctx, &v)
func (*WidgetTypeQuery) IDs ¶
func (wtq *WidgetTypeQuery) IDs(ctx context.Context) ([]int, error)
IDs executes the query and returns a list of WidgetType IDs.
func (*WidgetTypeQuery) IDsX ¶
func (wtq *WidgetTypeQuery) IDsX(ctx context.Context) []int
IDsX is like IDs, but panics if an error occurs.
func (*WidgetTypeQuery) Limit ¶
func (wtq *WidgetTypeQuery) Limit(limit int) *WidgetTypeQuery
Limit adds a limit step to the query.
func (*WidgetTypeQuery) Offset ¶
func (wtq *WidgetTypeQuery) Offset(offset int) *WidgetTypeQuery
Offset adds an offset step to the query.
func (*WidgetTypeQuery) Only ¶
func (wtq *WidgetTypeQuery) Only(ctx context.Context) (*WidgetType, error)
Only returns a single WidgetType entity found by the query, ensuring it only returns one. Returns a *NotSingularError when exactly one WidgetType entity is not found. Returns a *NotFoundError when no WidgetType entities are found.
func (*WidgetTypeQuery) OnlyID ¶
func (wtq *WidgetTypeQuery) OnlyID(ctx context.Context) (id int, err error)
OnlyID is like Only, but returns the only WidgetType ID in the query. Returns a *NotSingularError when exactly one WidgetType ID is not found. Returns a *NotFoundError when no entities are found.
func (*WidgetTypeQuery) OnlyIDX ¶
func (wtq *WidgetTypeQuery) OnlyIDX(ctx context.Context) int
OnlyIDX is like OnlyID, but panics if an error occurs.
func (*WidgetTypeQuery) OnlyX ¶
func (wtq *WidgetTypeQuery) OnlyX(ctx context.Context) *WidgetType
OnlyX is like Only, but panics if an error occurs.
func (*WidgetTypeQuery) Order ¶
func (wtq *WidgetTypeQuery) Order(o ...OrderFunc) *WidgetTypeQuery
Order adds an order step to the query.
func (*WidgetTypeQuery) Select ¶
func (wtq *WidgetTypeQuery) Select(fields ...string) *WidgetTypeSelect
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.WidgetType.Query(). Select(widgettype.FieldName). Scan(ctx, &v)
func (*WidgetTypeQuery) Unique ¶
func (wtq *WidgetTypeQuery) Unique(unique bool) *WidgetTypeQuery
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 (*WidgetTypeQuery) Where ¶
func (wtq *WidgetTypeQuery) Where(ps ...predicate.WidgetType) *WidgetTypeQuery
Where adds a new predicate for the WidgetTypeQuery builder.
type WidgetTypeSelect ¶
type WidgetTypeSelect struct { *WidgetTypeQuery // contains filtered or unexported fields }
WidgetTypeSelect is the builder for selecting fields of WidgetType entities.
func (*WidgetTypeSelect) Bool ¶
func (wts *WidgetTypeSelect) Bool(ctx context.Context) (_ bool, err error)
Bool returns a single bool from a selector. It is only allowed when selecting one field.
func (*WidgetTypeSelect) BoolX ¶
func (wts *WidgetTypeSelect) BoolX(ctx context.Context) bool
BoolX is like Bool, but panics if an error occurs.
func (*WidgetTypeSelect) Bools ¶
func (wts *WidgetTypeSelect) Bools(ctx context.Context) ([]bool, error)
Bools returns list of bools from a selector. It is only allowed when selecting one field.
func (*WidgetTypeSelect) BoolsX ¶
func (wts *WidgetTypeSelect) BoolsX(ctx context.Context) []bool
BoolsX is like Bools, but panics if an error occurs.
func (*WidgetTypeSelect) Float64 ¶
func (wts *WidgetTypeSelect) Float64(ctx context.Context) (_ float64, err error)
Float64 returns a single float64 from a selector. It is only allowed when selecting one field.
func (*WidgetTypeSelect) Float64X ¶
func (wts *WidgetTypeSelect) Float64X(ctx context.Context) float64
Float64X is like Float64, but panics if an error occurs.
func (*WidgetTypeSelect) Float64s ¶
func (wts *WidgetTypeSelect) Float64s(ctx context.Context) ([]float64, error)
Float64s returns list of float64s from a selector. It is only allowed when selecting one field.
func (*WidgetTypeSelect) Float64sX ¶
func (wts *WidgetTypeSelect) Float64sX(ctx context.Context) []float64
Float64sX is like Float64s, but panics if an error occurs.
func (*WidgetTypeSelect) Int ¶
func (wts *WidgetTypeSelect) Int(ctx context.Context) (_ int, err error)
Int returns a single int from a selector. It is only allowed when selecting one field.
func (*WidgetTypeSelect) IntX ¶
func (wts *WidgetTypeSelect) IntX(ctx context.Context) int
IntX is like Int, but panics if an error occurs.
func (*WidgetTypeSelect) Ints ¶
func (wts *WidgetTypeSelect) Ints(ctx context.Context) ([]int, error)
Ints returns list of ints from a selector. It is only allowed when selecting one field.
func (*WidgetTypeSelect) IntsX ¶
func (wts *WidgetTypeSelect) IntsX(ctx context.Context) []int
IntsX is like Ints, but panics if an error occurs.
func (*WidgetTypeSelect) Scan ¶
func (wts *WidgetTypeSelect) Scan(ctx context.Context, v interface{}) error
Scan applies the selector query and scans the result into the given value.
func (*WidgetTypeSelect) ScanX ¶
func (wts *WidgetTypeSelect) ScanX(ctx context.Context, v interface{})
ScanX is like Scan, but panics if an error occurs.
func (*WidgetTypeSelect) String ¶
func (wts *WidgetTypeSelect) String(ctx context.Context) (_ string, err error)
String returns a single string from a selector. It is only allowed when selecting one field.
func (*WidgetTypeSelect) StringX ¶
func (wts *WidgetTypeSelect) StringX(ctx context.Context) string
StringX is like String, but panics if an error occurs.
type WidgetTypeUpdate ¶
type WidgetTypeUpdate struct {
// contains filtered or unexported fields
}
WidgetTypeUpdate is the builder for updating WidgetType entities.
func (*WidgetTypeUpdate) Exec ¶
func (wtu *WidgetTypeUpdate) Exec(ctx context.Context) error
Exec executes the query.
func (*WidgetTypeUpdate) ExecX ¶
func (wtu *WidgetTypeUpdate) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*WidgetTypeUpdate) Mutation ¶
func (wtu *WidgetTypeUpdate) Mutation() *WidgetTypeMutation
Mutation returns the WidgetTypeMutation object of the builder.
func (*WidgetTypeUpdate) Save ¶
func (wtu *WidgetTypeUpdate) Save(ctx context.Context) (int, error)
Save executes the query and returns the number of nodes affected by the update operation.
func (*WidgetTypeUpdate) SaveX ¶
func (wtu *WidgetTypeUpdate) SaveX(ctx context.Context) int
SaveX is like Save, but panics if an error occurs.
func (*WidgetTypeUpdate) SetName ¶
func (wtu *WidgetTypeUpdate) SetName(s string) *WidgetTypeUpdate
SetName sets the "name" field.
func (*WidgetTypeUpdate) Where ¶
func (wtu *WidgetTypeUpdate) Where(ps ...predicate.WidgetType) *WidgetTypeUpdate
Where appends a list predicates to the WidgetTypeUpdate builder.
type WidgetTypeUpdateOne ¶
type WidgetTypeUpdateOne struct {
// contains filtered or unexported fields
}
WidgetTypeUpdateOne is the builder for updating a single WidgetType entity.
func (*WidgetTypeUpdateOne) Exec ¶
func (wtuo *WidgetTypeUpdateOne) Exec(ctx context.Context) error
Exec executes the query on the entity.
func (*WidgetTypeUpdateOne) ExecX ¶
func (wtuo *WidgetTypeUpdateOne) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*WidgetTypeUpdateOne) Mutation ¶
func (wtuo *WidgetTypeUpdateOne) Mutation() *WidgetTypeMutation
Mutation returns the WidgetTypeMutation object of the builder.
func (*WidgetTypeUpdateOne) Save ¶
func (wtuo *WidgetTypeUpdateOne) Save(ctx context.Context) (*WidgetType, error)
Save executes the query and returns the updated WidgetType entity.
func (*WidgetTypeUpdateOne) SaveX ¶
func (wtuo *WidgetTypeUpdateOne) SaveX(ctx context.Context) *WidgetType
SaveX is like Save, but panics if an error occurs.
func (*WidgetTypeUpdateOne) Select ¶
func (wtuo *WidgetTypeUpdateOne) Select(field string, fields ...string) *WidgetTypeUpdateOne
Select allows selecting one or more fields (columns) of the returned entity. The default is selecting all fields defined in the entity schema.
func (*WidgetTypeUpdateOne) SetName ¶
func (wtuo *WidgetTypeUpdateOne) SetName(s string) *WidgetTypeUpdateOne
SetName sets the "name" field.
type WidgetUpdate ¶
type WidgetUpdate struct {
// contains filtered or unexported fields
}
WidgetUpdate is the builder for updating Widget entities.
func (*WidgetUpdate) AddPriority ¶
func (wu *WidgetUpdate) AddPriority(i int) *WidgetUpdate
AddPriority adds i to the "priority" field.
func (*WidgetUpdate) ClearType ¶
func (wu *WidgetUpdate) ClearType() *WidgetUpdate
ClearType clears the "type" edge to the WidgetType entity.
func (*WidgetUpdate) Exec ¶
func (wu *WidgetUpdate) Exec(ctx context.Context) error
Exec executes the query.
func (*WidgetUpdate) ExecX ¶
func (wu *WidgetUpdate) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*WidgetUpdate) Mutation ¶
func (wu *WidgetUpdate) Mutation() *WidgetMutation
Mutation returns the WidgetMutation object of the builder.
func (*WidgetUpdate) Save ¶
func (wu *WidgetUpdate) Save(ctx context.Context) (int, error)
Save executes the query and returns the number of nodes affected by the update operation.
func (*WidgetUpdate) SaveX ¶
func (wu *WidgetUpdate) SaveX(ctx context.Context) int
SaveX is like Save, but panics if an error occurs.
func (*WidgetUpdate) SetNillablePriority ¶
func (wu *WidgetUpdate) SetNillablePriority(i *int) *WidgetUpdate
SetNillablePriority sets the "priority" field if the given value is not nil.
func (*WidgetUpdate) SetNillableStatus ¶
func (wu *WidgetUpdate) SetNillableStatus(w *widget.Status) *WidgetUpdate
SetNillableStatus sets the "status" field if the given value is not nil.
func (*WidgetUpdate) SetNillableTypeID ¶
func (wu *WidgetUpdate) SetNillableTypeID(id *int) *WidgetUpdate
SetNillableTypeID sets the "type" edge to the WidgetType entity by ID if the given value is not nil.
func (*WidgetUpdate) SetNote ¶
func (wu *WidgetUpdate) SetNote(s string) *WidgetUpdate
SetNote sets the "note" field.
func (*WidgetUpdate) SetPriority ¶
func (wu *WidgetUpdate) SetPriority(i int) *WidgetUpdate
SetPriority sets the "priority" field.
func (*WidgetUpdate) SetStatus ¶
func (wu *WidgetUpdate) SetStatus(w widget.Status) *WidgetUpdate
SetStatus sets the "status" field.
func (*WidgetUpdate) SetType ¶
func (wu *WidgetUpdate) SetType(w *WidgetType) *WidgetUpdate
SetType sets the "type" edge to the WidgetType entity.
func (*WidgetUpdate) SetTypeID ¶
func (wu *WidgetUpdate) SetTypeID(id int) *WidgetUpdate
SetTypeID sets the "type" edge to the WidgetType entity by ID.
func (*WidgetUpdate) Where ¶
func (wu *WidgetUpdate) Where(ps ...predicate.Widget) *WidgetUpdate
Where appends a list predicates to the WidgetUpdate builder.
type WidgetUpdateOne ¶
type WidgetUpdateOne struct {
// contains filtered or unexported fields
}
WidgetUpdateOne is the builder for updating a single Widget entity.
func (*WidgetUpdateOne) AddPriority ¶
func (wuo *WidgetUpdateOne) AddPriority(i int) *WidgetUpdateOne
AddPriority adds i to the "priority" field.
func (*WidgetUpdateOne) ClearType ¶
func (wuo *WidgetUpdateOne) ClearType() *WidgetUpdateOne
ClearType clears the "type" edge to the WidgetType entity.
func (*WidgetUpdateOne) Exec ¶
func (wuo *WidgetUpdateOne) Exec(ctx context.Context) error
Exec executes the query on the entity.
func (*WidgetUpdateOne) ExecX ¶
func (wuo *WidgetUpdateOne) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*WidgetUpdateOne) Mutation ¶
func (wuo *WidgetUpdateOne) Mutation() *WidgetMutation
Mutation returns the WidgetMutation object of the builder.
func (*WidgetUpdateOne) Save ¶
func (wuo *WidgetUpdateOne) Save(ctx context.Context) (*Widget, error)
Save executes the query and returns the updated Widget entity.
func (*WidgetUpdateOne) SaveX ¶
func (wuo *WidgetUpdateOne) SaveX(ctx context.Context) *Widget
SaveX is like Save, but panics if an error occurs.
func (*WidgetUpdateOne) Select ¶
func (wuo *WidgetUpdateOne) Select(field string, fields ...string) *WidgetUpdateOne
Select allows selecting one or more fields (columns) of the returned entity. The default is selecting all fields defined in the entity schema.
func (*WidgetUpdateOne) SetNillablePriority ¶
func (wuo *WidgetUpdateOne) SetNillablePriority(i *int) *WidgetUpdateOne
SetNillablePriority sets the "priority" field if the given value is not nil.
func (*WidgetUpdateOne) SetNillableStatus ¶
func (wuo *WidgetUpdateOne) SetNillableStatus(w *widget.Status) *WidgetUpdateOne
SetNillableStatus sets the "status" field if the given value is not nil.
func (*WidgetUpdateOne) SetNillableTypeID ¶
func (wuo *WidgetUpdateOne) SetNillableTypeID(id *int) *WidgetUpdateOne
SetNillableTypeID sets the "type" edge to the WidgetType entity by ID if the given value is not nil.
func (*WidgetUpdateOne) SetNote ¶
func (wuo *WidgetUpdateOne) SetNote(s string) *WidgetUpdateOne
SetNote sets the "note" field.
func (*WidgetUpdateOne) SetPriority ¶
func (wuo *WidgetUpdateOne) SetPriority(i int) *WidgetUpdateOne
SetPriority sets the "priority" field.
func (*WidgetUpdateOne) SetStatus ¶
func (wuo *WidgetUpdateOne) SetStatus(w widget.Status) *WidgetUpdateOne
SetStatus sets the "status" field.
func (*WidgetUpdateOne) SetType ¶
func (wuo *WidgetUpdateOne) SetType(w *WidgetType) *WidgetUpdateOne
SetType sets the "type" edge to the WidgetType entity.
func (*WidgetUpdateOne) SetTypeID ¶
func (wuo *WidgetUpdateOne) SetTypeID(id int) *WidgetUpdateOne
SetTypeID sets the "type" edge to the WidgetType entity by ID.