Documentation ¶
Index ¶
- Constants
- 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 Client
- func (c *Client) BeginTx(ctx context.Context, opts *sql.TxOptions) (*Tx, error)
- func (c *Client) Close() error
- func (c *Client) Debug() *Client
- func (c *Client) Intercept(interceptors ...Interceptor)
- func (c *Client) Mutate(ctx context.Context, m Mutation) (Value, error)
- func (c *Client) Tx(ctx context.Context) (*Tx, error)
- func (c *Client) Use(hooks ...Hook)
- type CommitFunc
- type CommitHook
- type Committer
- type ConstraintError
- type Hook
- type InterceptFunc
- type Interceptor
- type KV
- type KVClient
- func (c *KVClient) Create() *KVCreate
- func (c *KVClient) CreateBulk(builders ...*KVCreate) *KVCreateBulk
- func (c *KVClient) Delete() *KVDelete
- func (c *KVClient) DeleteOne(k *KV) *KVDeleteOne
- func (c *KVClient) DeleteOneID(id int) *KVDeleteOne
- func (c *KVClient) Get(ctx context.Context, id int) (*KV, error)
- func (c *KVClient) GetX(ctx context.Context, id int) *KV
- func (c *KVClient) Hooks() []Hook
- func (c *KVClient) Intercept(interceptors ...Interceptor)
- func (c *KVClient) Interceptors() []Interceptor
- func (c *KVClient) Query() *KVQuery
- func (c *KVClient) Update() *KVUpdate
- func (c *KVClient) UpdateOne(k *KV) *KVUpdateOne
- func (c *KVClient) UpdateOneID(id int) *KVUpdateOne
- func (c *KVClient) Use(hooks ...Hook)
- type KVCreate
- func (kc *KVCreate) Exec(ctx context.Context) error
- func (kc *KVCreate) ExecX(ctx context.Context)
- func (kc *KVCreate) Mutation() *KVMutation
- func (kc *KVCreate) OnConflict(opts ...sql.ConflictOption) *KVUpsertOne
- func (kc *KVCreate) OnConflictColumns(columns ...string) *KVUpsertOne
- func (kc *KVCreate) Save(ctx context.Context) (*KV, error)
- func (kc *KVCreate) SaveX(ctx context.Context) *KV
- func (kc *KVCreate) SetCreatedAt(t time.Time) *KVCreate
- func (kc *KVCreate) SetExpiresAt(t time.Time) *KVCreate
- func (kc *KVCreate) SetKey(s string) *KVCreate
- func (kc *KVCreate) SetNillableCreatedAt(t *time.Time) *KVCreate
- func (kc *KVCreate) SetNillableExpiresAt(t *time.Time) *KVCreate
- func (kc *KVCreate) SetNillableUpdatedAt(t *time.Time) *KVCreate
- func (kc *KVCreate) SetUpdatedAt(t time.Time) *KVCreate
- func (kc *KVCreate) SetValue(s string) *KVCreate
- type KVCreateBulk
- func (kcb *KVCreateBulk) Exec(ctx context.Context) error
- func (kcb *KVCreateBulk) ExecX(ctx context.Context)
- func (kcb *KVCreateBulk) OnConflict(opts ...sql.ConflictOption) *KVUpsertBulk
- func (kcb *KVCreateBulk) OnConflictColumns(columns ...string) *KVUpsertBulk
- func (kcb *KVCreateBulk) Save(ctx context.Context) ([]*KV, error)
- func (kcb *KVCreateBulk) SaveX(ctx context.Context) []*KV
- type KVDelete
- type KVDeleteOne
- type KVGroupBy
- func (kgb *KVGroupBy) Aggregate(fns ...AggregateFunc) *KVGroupBy
- func (s *KVGroupBy) Bool(ctx context.Context) (_ bool, err error)
- func (s *KVGroupBy) BoolX(ctx context.Context) bool
- func (s *KVGroupBy) Bools(ctx context.Context) ([]bool, error)
- func (s *KVGroupBy) BoolsX(ctx context.Context) []bool
- func (s *KVGroupBy) Float64(ctx context.Context) (_ float64, err error)
- func (s *KVGroupBy) Float64X(ctx context.Context) float64
- func (s *KVGroupBy) Float64s(ctx context.Context) ([]float64, error)
- func (s *KVGroupBy) Float64sX(ctx context.Context) []float64
- func (s *KVGroupBy) Int(ctx context.Context) (_ int, err error)
- func (s *KVGroupBy) IntX(ctx context.Context) int
- func (s *KVGroupBy) Ints(ctx context.Context) ([]int, error)
- func (s *KVGroupBy) IntsX(ctx context.Context) []int
- func (kgb *KVGroupBy) Scan(ctx context.Context, v any) error
- func (s *KVGroupBy) ScanX(ctx context.Context, v any)
- func (s *KVGroupBy) String(ctx context.Context) (_ string, err error)
- func (s *KVGroupBy) StringX(ctx context.Context) string
- func (s *KVGroupBy) Strings(ctx context.Context) ([]string, error)
- func (s *KVGroupBy) StringsX(ctx context.Context) []string
- type KVMutation
- func (m *KVMutation) AddField(name string, value ent.Value) error
- func (m *KVMutation) AddedEdges() []string
- func (m *KVMutation) AddedField(name string) (ent.Value, bool)
- func (m *KVMutation) AddedFields() []string
- func (m *KVMutation) AddedIDs(name string) []ent.Value
- func (m *KVMutation) ClearEdge(name string) error
- func (m *KVMutation) ClearExpiresAt()
- func (m *KVMutation) ClearField(name string) error
- func (m *KVMutation) ClearedEdges() []string
- func (m *KVMutation) ClearedFields() []string
- func (m KVMutation) Client() *Client
- func (m *KVMutation) CreatedAt() (r time.Time, exists bool)
- func (m *KVMutation) EdgeCleared(name string) bool
- func (m *KVMutation) ExpiresAt() (r time.Time, exists bool)
- func (m *KVMutation) ExpiresAtCleared() bool
- func (m *KVMutation) Field(name string) (ent.Value, bool)
- func (m *KVMutation) FieldCleared(name string) bool
- func (m *KVMutation) Fields() []string
- func (m *KVMutation) ID() (id int, exists bool)
- func (m *KVMutation) IDs(ctx context.Context) ([]int, error)
- func (m *KVMutation) Key() (r string, exists bool)
- func (m *KVMutation) OldCreatedAt(ctx context.Context) (v time.Time, err error)
- func (m *KVMutation) OldExpiresAt(ctx context.Context) (v time.Time, err error)
- func (m *KVMutation) OldField(ctx context.Context, name string) (ent.Value, error)
- func (m *KVMutation) OldKey(ctx context.Context) (v string, err error)
- func (m *KVMutation) OldUpdatedAt(ctx context.Context) (v time.Time, err error)
- func (m *KVMutation) OldValue(ctx context.Context) (v string, err error)
- func (m *KVMutation) Op() Op
- func (m *KVMutation) RemovedEdges() []string
- func (m *KVMutation) RemovedIDs(name string) []ent.Value
- func (m *KVMutation) ResetCreatedAt()
- func (m *KVMutation) ResetEdge(name string) error
- func (m *KVMutation) ResetExpiresAt()
- func (m *KVMutation) ResetField(name string) error
- func (m *KVMutation) ResetKey()
- func (m *KVMutation) ResetUpdatedAt()
- func (m *KVMutation) ResetValue()
- func (m *KVMutation) SetCreatedAt(t time.Time)
- func (m *KVMutation) SetExpiresAt(t time.Time)
- func (m *KVMutation) SetField(name string, value ent.Value) error
- func (m *KVMutation) SetKey(s string)
- func (m *KVMutation) SetOp(op Op)
- func (m *KVMutation) SetUpdatedAt(t time.Time)
- func (m *KVMutation) SetValue(s string)
- func (m KVMutation) Tx() (*Tx, error)
- func (m *KVMutation) Type() string
- func (m *KVMutation) UpdatedAt() (r time.Time, exists bool)
- func (m *KVMutation) Value() (r string, exists bool)
- func (m *KVMutation) Where(ps ...predicate.KV)
- func (m *KVMutation) WhereP(ps ...func(*sql.Selector))
- type KVQuery
- func (kq *KVQuery) Aggregate(fns ...AggregateFunc) *KVSelect
- func (kq *KVQuery) All(ctx context.Context) ([]*KV, error)
- func (kq *KVQuery) AllX(ctx context.Context) []*KV
- func (kq *KVQuery) Clone() *KVQuery
- func (kq *KVQuery) Count(ctx context.Context) (int, error)
- func (kq *KVQuery) CountX(ctx context.Context) int
- func (kq *KVQuery) Exist(ctx context.Context) (bool, error)
- func (kq *KVQuery) ExistX(ctx context.Context) bool
- func (kq *KVQuery) First(ctx context.Context) (*KV, error)
- func (kq *KVQuery) FirstID(ctx context.Context) (id int, err error)
- func (kq *KVQuery) FirstIDX(ctx context.Context) int
- func (kq *KVQuery) FirstX(ctx context.Context) *KV
- func (kq *KVQuery) GroupBy(field string, fields ...string) *KVGroupBy
- func (kq *KVQuery) IDs(ctx context.Context) (ids []int, err error)
- func (kq *KVQuery) IDsX(ctx context.Context) []int
- func (kq *KVQuery) Limit(limit int) *KVQuery
- func (kq *KVQuery) Modify(modifiers ...func(s *sql.Selector)) *KVSelect
- func (kq *KVQuery) Offset(offset int) *KVQuery
- func (kq *KVQuery) Only(ctx context.Context) (*KV, error)
- func (kq *KVQuery) OnlyID(ctx context.Context) (id int, err error)
- func (kq *KVQuery) OnlyIDX(ctx context.Context) int
- func (kq *KVQuery) OnlyX(ctx context.Context) *KV
- func (kq *KVQuery) Order(o ...kv.OrderOption) *KVQuery
- func (kq *KVQuery) Select(fields ...string) *KVSelect
- func (kq *KVQuery) Unique(unique bool) *KVQuery
- func (kq *KVQuery) Where(ps ...predicate.KV) *KVQuery
- type KVSelect
- func (ks *KVSelect) Aggregate(fns ...AggregateFunc) *KVSelect
- func (s *KVSelect) Bool(ctx context.Context) (_ bool, err error)
- func (s *KVSelect) BoolX(ctx context.Context) bool
- func (s *KVSelect) Bools(ctx context.Context) ([]bool, error)
- func (s *KVSelect) BoolsX(ctx context.Context) []bool
- func (s *KVSelect) Float64(ctx context.Context) (_ float64, err error)
- func (s *KVSelect) Float64X(ctx context.Context) float64
- func (s *KVSelect) Float64s(ctx context.Context) ([]float64, error)
- func (s *KVSelect) Float64sX(ctx context.Context) []float64
- func (s *KVSelect) Int(ctx context.Context) (_ int, err error)
- func (s *KVSelect) IntX(ctx context.Context) int
- func (s *KVSelect) Ints(ctx context.Context) ([]int, error)
- func (s *KVSelect) IntsX(ctx context.Context) []int
- func (ks *KVSelect) Modify(modifiers ...func(s *sql.Selector)) *KVSelect
- func (ks *KVSelect) Scan(ctx context.Context, v any) error
- func (s *KVSelect) ScanX(ctx context.Context, v any)
- func (s *KVSelect) String(ctx context.Context) (_ string, err error)
- func (s *KVSelect) StringX(ctx context.Context) string
- func (s *KVSelect) Strings(ctx context.Context) ([]string, error)
- func (s *KVSelect) StringsX(ctx context.Context) []string
- type KVUpdate
- func (ku *KVUpdate) ClearExpiresAt() *KVUpdate
- func (ku *KVUpdate) Exec(ctx context.Context) error
- func (ku *KVUpdate) ExecX(ctx context.Context)
- func (ku *KVUpdate) Modify(modifiers ...func(u *sql.UpdateBuilder)) *KVUpdate
- func (ku *KVUpdate) Mutation() *KVMutation
- func (ku *KVUpdate) Save(ctx context.Context) (int, error)
- func (ku *KVUpdate) SaveX(ctx context.Context) int
- func (ku *KVUpdate) SetExpiresAt(t time.Time) *KVUpdate
- func (ku *KVUpdate) SetKey(s string) *KVUpdate
- func (ku *KVUpdate) SetNillableExpiresAt(t *time.Time) *KVUpdate
- func (ku *KVUpdate) SetUpdatedAt(t time.Time) *KVUpdate
- func (ku *KVUpdate) SetValue(s string) *KVUpdate
- func (ku *KVUpdate) Where(ps ...predicate.KV) *KVUpdate
- type KVUpdateOne
- func (kuo *KVUpdateOne) ClearExpiresAt() *KVUpdateOne
- func (kuo *KVUpdateOne) Exec(ctx context.Context) error
- func (kuo *KVUpdateOne) ExecX(ctx context.Context)
- func (kuo *KVUpdateOne) Modify(modifiers ...func(u *sql.UpdateBuilder)) *KVUpdateOne
- func (kuo *KVUpdateOne) Mutation() *KVMutation
- func (kuo *KVUpdateOne) Save(ctx context.Context) (*KV, error)
- func (kuo *KVUpdateOne) SaveX(ctx context.Context) *KV
- func (kuo *KVUpdateOne) Select(field string, fields ...string) *KVUpdateOne
- func (kuo *KVUpdateOne) SetExpiresAt(t time.Time) *KVUpdateOne
- func (kuo *KVUpdateOne) SetKey(s string) *KVUpdateOne
- func (kuo *KVUpdateOne) SetNillableExpiresAt(t *time.Time) *KVUpdateOne
- func (kuo *KVUpdateOne) SetUpdatedAt(t time.Time) *KVUpdateOne
- func (kuo *KVUpdateOne) SetValue(s string) *KVUpdateOne
- func (kuo *KVUpdateOne) Where(ps ...predicate.KV) *KVUpdateOne
- type KVUpsert
- func (u *KVUpsert) ClearExpiresAt() *KVUpsert
- func (u *KVUpsert) SetExpiresAt(v time.Time) *KVUpsert
- func (u *KVUpsert) SetKey(v string) *KVUpsert
- func (u *KVUpsert) SetUpdatedAt(v time.Time) *KVUpsert
- func (u *KVUpsert) SetValue(v string) *KVUpsert
- func (u *KVUpsert) UpdateExpiresAt() *KVUpsert
- func (u *KVUpsert) UpdateKey() *KVUpsert
- func (u *KVUpsert) UpdateUpdatedAt() *KVUpsert
- func (u *KVUpsert) UpdateValue() *KVUpsert
- type KVUpsertBulk
- func (u *KVUpsertBulk) ClearExpiresAt() *KVUpsertBulk
- func (u *KVUpsertBulk) DoNothing() *KVUpsertBulk
- func (u *KVUpsertBulk) Exec(ctx context.Context) error
- func (u *KVUpsertBulk) ExecX(ctx context.Context)
- func (u *KVUpsertBulk) Ignore() *KVUpsertBulk
- func (u *KVUpsertBulk) SetExpiresAt(v time.Time) *KVUpsertBulk
- func (u *KVUpsertBulk) SetKey(v string) *KVUpsertBulk
- func (u *KVUpsertBulk) SetUpdatedAt(v time.Time) *KVUpsertBulk
- func (u *KVUpsertBulk) SetValue(v string) *KVUpsertBulk
- func (u *KVUpsertBulk) Update(set func(*KVUpsert)) *KVUpsertBulk
- func (u *KVUpsertBulk) UpdateExpiresAt() *KVUpsertBulk
- func (u *KVUpsertBulk) UpdateKey() *KVUpsertBulk
- func (u *KVUpsertBulk) UpdateNewValues() *KVUpsertBulk
- func (u *KVUpsertBulk) UpdateUpdatedAt() *KVUpsertBulk
- func (u *KVUpsertBulk) UpdateValue() *KVUpsertBulk
- type KVUpsertOne
- func (u *KVUpsertOne) ClearExpiresAt() *KVUpsertOne
- func (u *KVUpsertOne) DoNothing() *KVUpsertOne
- func (u *KVUpsertOne) Exec(ctx context.Context) error
- func (u *KVUpsertOne) ExecX(ctx context.Context)
- func (u *KVUpsertOne) ID(ctx context.Context) (id int, err error)
- func (u *KVUpsertOne) IDX(ctx context.Context) int
- func (u *KVUpsertOne) Ignore() *KVUpsertOne
- func (u *KVUpsertOne) SetExpiresAt(v time.Time) *KVUpsertOne
- func (u *KVUpsertOne) SetKey(v string) *KVUpsertOne
- func (u *KVUpsertOne) SetUpdatedAt(v time.Time) *KVUpsertOne
- func (u *KVUpsertOne) SetValue(v string) *KVUpsertOne
- func (u *KVUpsertOne) Update(set func(*KVUpsert)) *KVUpsertOne
- func (u *KVUpsertOne) UpdateExpiresAt() *KVUpsertOne
- func (u *KVUpsertOne) UpdateKey() *KVUpsertOne
- func (u *KVUpsertOne) UpdateNewValues() *KVUpsertOne
- func (u *KVUpsertOne) UpdateUpdatedAt() *KVUpsertOne
- func (u *KVUpsertOne) UpdateValue() *KVUpsertOne
- type KVs
- type MutateFunc
- type Mutation
- type Mutator
- type Node
- type NodeClient
- func (c *NodeClient) Create() *NodeCreate
- func (c *NodeClient) CreateBulk(builders ...*NodeCreate) *NodeCreateBulk
- func (c *NodeClient) Delete() *NodeDelete
- func (c *NodeClient) DeleteOne(n *Node) *NodeDeleteOne
- func (c *NodeClient) DeleteOneID(id string) *NodeDeleteOne
- func (c *NodeClient) Get(ctx context.Context, id string) (*Node, error)
- func (c *NodeClient) GetX(ctx context.Context, id string) *Node
- func (c *NodeClient) Hooks() []Hook
- func (c *NodeClient) Intercept(interceptors ...Interceptor)
- func (c *NodeClient) Interceptors() []Interceptor
- func (c *NodeClient) Query() *NodeQuery
- func (c *NodeClient) Update() *NodeUpdate
- func (c *NodeClient) UpdateOne(n *Node) *NodeUpdateOne
- func (c *NodeClient) UpdateOneID(id string) *NodeUpdateOne
- func (c *NodeClient) Use(hooks ...Hook)
- type NodeCreate
- func (nc *NodeCreate) Exec(ctx context.Context) error
- func (nc *NodeCreate) ExecX(ctx context.Context)
- func (nc *NodeCreate) Mutation() *NodeMutation
- func (nc *NodeCreate) OnConflict(opts ...sql.ConflictOption) *NodeUpsertOne
- func (nc *NodeCreate) OnConflictColumns(columns ...string) *NodeUpsertOne
- func (nc *NodeCreate) Save(ctx context.Context) (*Node, error)
- func (nc *NodeCreate) SaveX(ctx context.Context) *Node
- func (nc *NodeCreate) SetComment(s string) *NodeCreate
- func (nc *NodeCreate) SetCreatedAt(t time.Time) *NodeCreate
- func (nc *NodeCreate) SetID(s string) *NodeCreate
- func (nc *NodeCreate) SetIP(s string) *NodeCreate
- func (nc *NodeCreate) SetName(s string) *NodeCreate
- func (nc *NodeCreate) SetNillableComment(s *string) *NodeCreate
- func (nc *NodeCreate) SetNillableCreatedAt(t *time.Time) *NodeCreate
- func (nc *NodeCreate) SetNillableID(s *string) *NodeCreate
- func (nc *NodeCreate) SetNillableName(s *string) *NodeCreate
- func (nc *NodeCreate) SetNillablePort(i *int) *NodeCreate
- func (nc *NodeCreate) SetNillableUpdatedAt(t *time.Time) *NodeCreate
- func (nc *NodeCreate) SetPort(i int) *NodeCreate
- func (nc *NodeCreate) SetUpdatedAt(t time.Time) *NodeCreate
- type NodeCreateBulk
- func (ncb *NodeCreateBulk) Exec(ctx context.Context) error
- func (ncb *NodeCreateBulk) ExecX(ctx context.Context)
- func (ncb *NodeCreateBulk) OnConflict(opts ...sql.ConflictOption) *NodeUpsertBulk
- func (ncb *NodeCreateBulk) OnConflictColumns(columns ...string) *NodeUpsertBulk
- func (ncb *NodeCreateBulk) Save(ctx context.Context) ([]*Node, error)
- func (ncb *NodeCreateBulk) SaveX(ctx context.Context) []*Node
- type NodeDelete
- type NodeDeleteOne
- type NodeGroupBy
- func (ngb *NodeGroupBy) Aggregate(fns ...AggregateFunc) *NodeGroupBy
- func (s *NodeGroupBy) Bool(ctx context.Context) (_ bool, err error)
- func (s *NodeGroupBy) BoolX(ctx context.Context) bool
- func (s *NodeGroupBy) Bools(ctx context.Context) ([]bool, error)
- func (s *NodeGroupBy) BoolsX(ctx context.Context) []bool
- func (s *NodeGroupBy) Float64(ctx context.Context) (_ float64, err error)
- func (s *NodeGroupBy) Float64X(ctx context.Context) float64
- func (s *NodeGroupBy) Float64s(ctx context.Context) ([]float64, error)
- func (s *NodeGroupBy) Float64sX(ctx context.Context) []float64
- func (s *NodeGroupBy) Int(ctx context.Context) (_ int, err error)
- func (s *NodeGroupBy) IntX(ctx context.Context) int
- func (s *NodeGroupBy) Ints(ctx context.Context) ([]int, error)
- func (s *NodeGroupBy) IntsX(ctx context.Context) []int
- func (ngb *NodeGroupBy) Scan(ctx context.Context, v any) error
- func (s *NodeGroupBy) ScanX(ctx context.Context, v any)
- func (s *NodeGroupBy) String(ctx context.Context) (_ string, err error)
- func (s *NodeGroupBy) StringX(ctx context.Context) string
- func (s *NodeGroupBy) Strings(ctx context.Context) ([]string, error)
- func (s *NodeGroupBy) StringsX(ctx context.Context) []string
- type NodeMutation
- func (m *NodeMutation) AddField(name string, value ent.Value) error
- func (m *NodeMutation) AddPort(i int)
- func (m *NodeMutation) AddedEdges() []string
- func (m *NodeMutation) AddedField(name string) (ent.Value, bool)
- func (m *NodeMutation) AddedFields() []string
- func (m *NodeMutation) AddedIDs(name string) []ent.Value
- func (m *NodeMutation) AddedPort() (r int, exists bool)
- func (m *NodeMutation) ClearComment()
- func (m *NodeMutation) ClearEdge(name string) error
- func (m *NodeMutation) ClearField(name string) error
- func (m *NodeMutation) ClearName()
- func (m *NodeMutation) ClearedEdges() []string
- func (m *NodeMutation) ClearedFields() []string
- func (m NodeMutation) Client() *Client
- func (m *NodeMutation) Comment() (r string, exists bool)
- func (m *NodeMutation) CommentCleared() bool
- func (m *NodeMutation) CreatedAt() (r time.Time, exists bool)
- func (m *NodeMutation) EdgeCleared(name string) bool
- func (m *NodeMutation) Field(name string) (ent.Value, bool)
- func (m *NodeMutation) FieldCleared(name string) bool
- func (m *NodeMutation) Fields() []string
- func (m *NodeMutation) ID() (id string, exists bool)
- func (m *NodeMutation) IDs(ctx context.Context) ([]string, error)
- func (m *NodeMutation) IP() (r string, exists bool)
- func (m *NodeMutation) Name() (r string, exists bool)
- func (m *NodeMutation) NameCleared() bool
- func (m *NodeMutation) OldComment(ctx context.Context) (v string, err error)
- func (m *NodeMutation) OldCreatedAt(ctx context.Context) (v time.Time, err error)
- func (m *NodeMutation) OldField(ctx context.Context, name string) (ent.Value, error)
- func (m *NodeMutation) OldIP(ctx context.Context) (v string, err error)
- func (m *NodeMutation) OldName(ctx context.Context) (v string, err error)
- func (m *NodeMutation) OldPort(ctx context.Context) (v int, err error)
- func (m *NodeMutation) OldUpdatedAt(ctx context.Context) (v time.Time, err error)
- func (m *NodeMutation) Op() Op
- func (m *NodeMutation) Port() (r int, exists bool)
- func (m *NodeMutation) RemovedEdges() []string
- func (m *NodeMutation) RemovedIDs(name string) []ent.Value
- func (m *NodeMutation) ResetComment()
- func (m *NodeMutation) ResetCreatedAt()
- func (m *NodeMutation) ResetEdge(name string) error
- func (m *NodeMutation) ResetField(name string) error
- func (m *NodeMutation) ResetIP()
- func (m *NodeMutation) ResetName()
- func (m *NodeMutation) ResetPort()
- func (m *NodeMutation) ResetUpdatedAt()
- func (m *NodeMutation) SetComment(s string)
- func (m *NodeMutation) SetCreatedAt(t time.Time)
- func (m *NodeMutation) SetField(name string, value ent.Value) error
- func (m *NodeMutation) SetID(id string)
- func (m *NodeMutation) SetIP(s string)
- func (m *NodeMutation) SetName(s string)
- func (m *NodeMutation) SetOp(op Op)
- func (m *NodeMutation) SetPort(i int)
- func (m *NodeMutation) SetUpdatedAt(t time.Time)
- func (m NodeMutation) Tx() (*Tx, error)
- func (m *NodeMutation) Type() string
- func (m *NodeMutation) UpdatedAt() (r time.Time, exists bool)
- func (m *NodeMutation) Where(ps ...predicate.Node)
- func (m *NodeMutation) WhereP(ps ...func(*sql.Selector))
- type NodeQuery
- func (nq *NodeQuery) Aggregate(fns ...AggregateFunc) *NodeSelect
- func (nq *NodeQuery) All(ctx context.Context) ([]*Node, error)
- func (nq *NodeQuery) AllX(ctx context.Context) []*Node
- func (nq *NodeQuery) Clone() *NodeQuery
- func (nq *NodeQuery) Count(ctx context.Context) (int, error)
- func (nq *NodeQuery) CountX(ctx context.Context) int
- func (nq *NodeQuery) Exist(ctx context.Context) (bool, error)
- func (nq *NodeQuery) ExistX(ctx context.Context) bool
- func (nq *NodeQuery) First(ctx context.Context) (*Node, error)
- func (nq *NodeQuery) FirstID(ctx context.Context) (id string, err error)
- func (nq *NodeQuery) FirstIDX(ctx context.Context) string
- func (nq *NodeQuery) FirstX(ctx context.Context) *Node
- func (nq *NodeQuery) GroupBy(field string, fields ...string) *NodeGroupBy
- func (nq *NodeQuery) IDs(ctx context.Context) (ids []string, err error)
- func (nq *NodeQuery) IDsX(ctx context.Context) []string
- func (nq *NodeQuery) Limit(limit int) *NodeQuery
- func (nq *NodeQuery) Modify(modifiers ...func(s *sql.Selector)) *NodeSelect
- func (nq *NodeQuery) Offset(offset int) *NodeQuery
- func (nq *NodeQuery) Only(ctx context.Context) (*Node, error)
- func (nq *NodeQuery) OnlyID(ctx context.Context) (id string, err error)
- func (nq *NodeQuery) OnlyIDX(ctx context.Context) string
- func (nq *NodeQuery) OnlyX(ctx context.Context) *Node
- func (nq *NodeQuery) Order(o ...node.OrderOption) *NodeQuery
- func (nq *NodeQuery) Select(fields ...string) *NodeSelect
- func (nq *NodeQuery) Unique(unique bool) *NodeQuery
- func (nq *NodeQuery) Where(ps ...predicate.Node) *NodeQuery
- type NodeSelect
- func (ns *NodeSelect) Aggregate(fns ...AggregateFunc) *NodeSelect
- func (s *NodeSelect) Bool(ctx context.Context) (_ bool, err error)
- func (s *NodeSelect) BoolX(ctx context.Context) bool
- func (s *NodeSelect) Bools(ctx context.Context) ([]bool, error)
- func (s *NodeSelect) BoolsX(ctx context.Context) []bool
- func (s *NodeSelect) Float64(ctx context.Context) (_ float64, err error)
- func (s *NodeSelect) Float64X(ctx context.Context) float64
- func (s *NodeSelect) Float64s(ctx context.Context) ([]float64, error)
- func (s *NodeSelect) Float64sX(ctx context.Context) []float64
- func (s *NodeSelect) Int(ctx context.Context) (_ int, err error)
- func (s *NodeSelect) IntX(ctx context.Context) int
- func (s *NodeSelect) Ints(ctx context.Context) ([]int, error)
- func (s *NodeSelect) IntsX(ctx context.Context) []int
- func (ns *NodeSelect) Modify(modifiers ...func(s *sql.Selector)) *NodeSelect
- func (ns *NodeSelect) Scan(ctx context.Context, v any) error
- func (s *NodeSelect) ScanX(ctx context.Context, v any)
- func (s *NodeSelect) String(ctx context.Context) (_ string, err error)
- func (s *NodeSelect) StringX(ctx context.Context) string
- func (s *NodeSelect) Strings(ctx context.Context) ([]string, error)
- func (s *NodeSelect) StringsX(ctx context.Context) []string
- type NodeUpdate
- func (nu *NodeUpdate) AddPort(i int) *NodeUpdate
- func (nu *NodeUpdate) ClearComment() *NodeUpdate
- func (nu *NodeUpdate) ClearName() *NodeUpdate
- func (nu *NodeUpdate) Exec(ctx context.Context) error
- func (nu *NodeUpdate) ExecX(ctx context.Context)
- func (nu *NodeUpdate) Modify(modifiers ...func(u *sql.UpdateBuilder)) *NodeUpdate
- func (nu *NodeUpdate) Mutation() *NodeMutation
- func (nu *NodeUpdate) Save(ctx context.Context) (int, error)
- func (nu *NodeUpdate) SaveX(ctx context.Context) int
- func (nu *NodeUpdate) SetComment(s string) *NodeUpdate
- func (nu *NodeUpdate) SetIP(s string) *NodeUpdate
- func (nu *NodeUpdate) SetName(s string) *NodeUpdate
- func (nu *NodeUpdate) SetNillableComment(s *string) *NodeUpdate
- func (nu *NodeUpdate) SetNillableName(s *string) *NodeUpdate
- func (nu *NodeUpdate) SetNillablePort(i *int) *NodeUpdate
- func (nu *NodeUpdate) SetPort(i int) *NodeUpdate
- func (nu *NodeUpdate) SetUpdatedAt(t time.Time) *NodeUpdate
- func (nu *NodeUpdate) Where(ps ...predicate.Node) *NodeUpdate
- type NodeUpdateOne
- func (nuo *NodeUpdateOne) AddPort(i int) *NodeUpdateOne
- func (nuo *NodeUpdateOne) ClearComment() *NodeUpdateOne
- func (nuo *NodeUpdateOne) ClearName() *NodeUpdateOne
- func (nuo *NodeUpdateOne) Exec(ctx context.Context) error
- func (nuo *NodeUpdateOne) ExecX(ctx context.Context)
- func (nuo *NodeUpdateOne) Modify(modifiers ...func(u *sql.UpdateBuilder)) *NodeUpdateOne
- func (nuo *NodeUpdateOne) Mutation() *NodeMutation
- func (nuo *NodeUpdateOne) Save(ctx context.Context) (*Node, error)
- func (nuo *NodeUpdateOne) SaveX(ctx context.Context) *Node
- func (nuo *NodeUpdateOne) Select(field string, fields ...string) *NodeUpdateOne
- func (nuo *NodeUpdateOne) SetComment(s string) *NodeUpdateOne
- func (nuo *NodeUpdateOne) SetIP(s string) *NodeUpdateOne
- func (nuo *NodeUpdateOne) SetName(s string) *NodeUpdateOne
- func (nuo *NodeUpdateOne) SetNillableComment(s *string) *NodeUpdateOne
- func (nuo *NodeUpdateOne) SetNillableName(s *string) *NodeUpdateOne
- func (nuo *NodeUpdateOne) SetNillablePort(i *int) *NodeUpdateOne
- func (nuo *NodeUpdateOne) SetPort(i int) *NodeUpdateOne
- func (nuo *NodeUpdateOne) SetUpdatedAt(t time.Time) *NodeUpdateOne
- func (nuo *NodeUpdateOne) Where(ps ...predicate.Node) *NodeUpdateOne
- type NodeUpsert
- func (u *NodeUpsert) AddPort(v int) *NodeUpsert
- func (u *NodeUpsert) ClearComment() *NodeUpsert
- func (u *NodeUpsert) ClearName() *NodeUpsert
- func (u *NodeUpsert) SetComment(v string) *NodeUpsert
- func (u *NodeUpsert) SetIP(v string) *NodeUpsert
- func (u *NodeUpsert) SetName(v string) *NodeUpsert
- func (u *NodeUpsert) SetPort(v int) *NodeUpsert
- func (u *NodeUpsert) SetUpdatedAt(v time.Time) *NodeUpsert
- func (u *NodeUpsert) UpdateComment() *NodeUpsert
- func (u *NodeUpsert) UpdateIP() *NodeUpsert
- func (u *NodeUpsert) UpdateName() *NodeUpsert
- func (u *NodeUpsert) UpdatePort() *NodeUpsert
- func (u *NodeUpsert) UpdateUpdatedAt() *NodeUpsert
- type NodeUpsertBulk
- func (u *NodeUpsertBulk) AddPort(v int) *NodeUpsertBulk
- func (u *NodeUpsertBulk) ClearComment() *NodeUpsertBulk
- func (u *NodeUpsertBulk) ClearName() *NodeUpsertBulk
- func (u *NodeUpsertBulk) DoNothing() *NodeUpsertBulk
- func (u *NodeUpsertBulk) Exec(ctx context.Context) error
- func (u *NodeUpsertBulk) ExecX(ctx context.Context)
- func (u *NodeUpsertBulk) Ignore() *NodeUpsertBulk
- func (u *NodeUpsertBulk) SetComment(v string) *NodeUpsertBulk
- func (u *NodeUpsertBulk) SetIP(v string) *NodeUpsertBulk
- func (u *NodeUpsertBulk) SetName(v string) *NodeUpsertBulk
- func (u *NodeUpsertBulk) SetPort(v int) *NodeUpsertBulk
- func (u *NodeUpsertBulk) SetUpdatedAt(v time.Time) *NodeUpsertBulk
- func (u *NodeUpsertBulk) Update(set func(*NodeUpsert)) *NodeUpsertBulk
- func (u *NodeUpsertBulk) UpdateComment() *NodeUpsertBulk
- func (u *NodeUpsertBulk) UpdateIP() *NodeUpsertBulk
- func (u *NodeUpsertBulk) UpdateName() *NodeUpsertBulk
- func (u *NodeUpsertBulk) UpdateNewValues() *NodeUpsertBulk
- func (u *NodeUpsertBulk) UpdatePort() *NodeUpsertBulk
- func (u *NodeUpsertBulk) UpdateUpdatedAt() *NodeUpsertBulk
- type NodeUpsertOne
- func (u *NodeUpsertOne) AddPort(v int) *NodeUpsertOne
- func (u *NodeUpsertOne) ClearComment() *NodeUpsertOne
- func (u *NodeUpsertOne) ClearName() *NodeUpsertOne
- func (u *NodeUpsertOne) DoNothing() *NodeUpsertOne
- func (u *NodeUpsertOne) Exec(ctx context.Context) error
- func (u *NodeUpsertOne) ExecX(ctx context.Context)
- func (u *NodeUpsertOne) ID(ctx context.Context) (id string, err error)
- func (u *NodeUpsertOne) IDX(ctx context.Context) string
- func (u *NodeUpsertOne) Ignore() *NodeUpsertOne
- func (u *NodeUpsertOne) SetComment(v string) *NodeUpsertOne
- func (u *NodeUpsertOne) SetIP(v string) *NodeUpsertOne
- func (u *NodeUpsertOne) SetName(v string) *NodeUpsertOne
- func (u *NodeUpsertOne) SetPort(v int) *NodeUpsertOne
- func (u *NodeUpsertOne) SetUpdatedAt(v time.Time) *NodeUpsertOne
- func (u *NodeUpsertOne) Update(set func(*NodeUpsert)) *NodeUpsertOne
- func (u *NodeUpsertOne) UpdateComment() *NodeUpsertOne
- func (u *NodeUpsertOne) UpdateIP() *NodeUpsertOne
- func (u *NodeUpsertOne) UpdateName() *NodeUpsertOne
- func (u *NodeUpsertOne) UpdateNewValues() *NodeUpsertOne
- func (u *NodeUpsertOne) UpdatePort() *NodeUpsertOne
- func (u *NodeUpsertOne) UpdateUpdatedAt() *NodeUpsertOne
- type Nodes
- 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 TraverseFunc
- type Traverser
- type Tx
- type ValidationError
- type Value
Constants ¶
const ( // Operation types. OpCreate = ent.OpCreate OpDelete = ent.OpDelete OpDeleteOne = ent.OpDeleteOne OpUpdate = ent.OpUpdate OpUpdateOne = ent.OpUpdateOne // Node types. TypeKV = "KV" TypeNode = "Node" )
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(shared.As(shared.Sum(field1), "sum_field1"), (shared.As(shared.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 // KV is the client for interacting with the KV builders. KV *KVClient // Node is the client for interacting with the Node builders. Node *NodeClient // 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(). KV. Query(). Count(ctx)
func (*Client) Intercept ¶
func (c *Client) Intercept(interceptors ...Interceptor)
Intercept adds the query interceptors to all the entity clients. In order to add interceptors to a specific client, call: `client.Node.Intercept(...)`.
type CommitFunc ¶
The CommitFunc type is an adapter to allow the use of ordinary function as a Committer. If f is a function with the appropriate signature, CommitFunc(f) is a Committer that calls f.
type CommitHook ¶
CommitHook defines the "commit middleware". A function that gets a Committer and returns a Committer. For example:
hook := func(next ent.Committer) ent.Committer { return ent.CommitFunc(func(ctx context.Context, tx *ent.Tx) error { // Do some stuff before. if err := next.Commit(ctx, tx); err != nil { return err } // Do some stuff after. return nil }) }
type ConstraintError ¶
type ConstraintError struct {
// contains filtered or unexported fields
}
ConstraintError returns when trying to create/update one or more entities and one or more of their constraints failed. For example, violation of edge or field uniqueness.
func (ConstraintError) Error ¶
func (e ConstraintError) Error() string
Error implements the error interface.
func (*ConstraintError) Unwrap ¶
func (e *ConstraintError) Unwrap() error
Unwrap implements the errors.Wrapper interface.
type InterceptFunc ¶
type InterceptFunc = ent.InterceptFunc
ent aliases to avoid import conflicts in user's code.
type Interceptor ¶
type Interceptor = ent.Interceptor
ent aliases to avoid import conflicts in user's code.
type KV ¶
type KV struct { // ID of the ent. ID int `json:"id,omitempty"` // CreatedAt holds the value of the "created_at" field. CreatedAt time.Time `json:"created_at,omitempty"` // UpdatedAt holds the value of the "updated_at" field. UpdatedAt time.Time `json:"updated_at,omitempty"` // Key holds the value of the "key" field. Key string `json:"key,omitempty"` // Value holds the value of the "value" field. Value string `json:"value,omitempty"` // ExpiresAt holds the value of the "expires_at" field. ExpiresAt time.Time `json:"expires_at,omitempty"` // contains filtered or unexported fields }
KV is the model entity for the KV schema.
func (*KV) GetValue ¶
GetValue returns the ent.Value that was dynamically selected and assigned to the KV. This includes values selected through modifiers, order, etc.
func (*KV) Unwrap ¶
Unwrap unwraps the KV 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 (*KV) Update ¶
func (k *KV) Update() *KVUpdateOne
Update returns a builder for updating this KV. Note that you need to call KV.Unwrap() before calling this method if this KV was returned from a transaction, and the transaction was committed or rolled back.
type KVClient ¶
type KVClient struct {
// contains filtered or unexported fields
}
KVClient is a client for the KV schema.
func NewKVClient ¶
func NewKVClient(c config) *KVClient
NewKVClient returns a client for the KV from the given config.
func (*KVClient) CreateBulk ¶
func (c *KVClient) CreateBulk(builders ...*KVCreate) *KVCreateBulk
CreateBulk returns a builder for creating a bulk of KV entities.
func (*KVClient) DeleteOne ¶
func (c *KVClient) DeleteOne(k *KV) *KVDeleteOne
DeleteOne returns a builder for deleting the given entity.
func (*KVClient) DeleteOneID ¶
func (c *KVClient) DeleteOneID(id int) *KVDeleteOne
DeleteOneID returns a builder for deleting the given entity by its id.
func (*KVClient) Intercept ¶
func (c *KVClient) Intercept(interceptors ...Interceptor)
Intercept adds a list of query interceptors to the interceptors stack. A call to `Intercept(f, g, h)` equals to `kv.Intercept(f(g(h())))`.
func (*KVClient) Interceptors ¶
func (c *KVClient) Interceptors() []Interceptor
Interceptors returns the client interceptors.
func (*KVClient) UpdateOne ¶
func (c *KVClient) UpdateOne(k *KV) *KVUpdateOne
UpdateOne returns an update builder for the given entity.
func (*KVClient) UpdateOneID ¶
func (c *KVClient) UpdateOneID(id int) *KVUpdateOne
UpdateOneID returns an update builder for the given id.
type KVCreate ¶
type KVCreate struct {
// contains filtered or unexported fields
}
KVCreate is the builder for creating a KV entity.
func (*KVCreate) Mutation ¶
func (kc *KVCreate) Mutation() *KVMutation
Mutation returns the KVMutation object of the builder.
func (*KVCreate) OnConflict ¶
func (kc *KVCreate) OnConflict(opts ...sql.ConflictOption) *KVUpsertOne
OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause of the `INSERT` statement. For example:
client.KV.Create(). SetCreatedAt(v). OnConflict( // Update the row with the new values // the was proposed for insertion. sql.ResolveWithNewValues(), ). // Override some of the fields with custom // update values. Update(func(u *ent.KVUpsert) { SetCreatedAt(v+v). }). Exec(ctx)
func (*KVCreate) OnConflictColumns ¶
func (kc *KVCreate) OnConflictColumns(columns ...string) *KVUpsertOne
OnConflictColumns calls `OnConflict` and configures the columns as conflict target. Using this option is equivalent to using:
client.KV.Create(). OnConflict(sql.ConflictColumns(columns...)). Exec(ctx)
func (*KVCreate) SetCreatedAt ¶
SetCreatedAt sets the "created_at" field.
func (*KVCreate) SetExpiresAt ¶
SetExpiresAt sets the "expires_at" field.
func (*KVCreate) SetNillableCreatedAt ¶
SetNillableCreatedAt sets the "created_at" field if the given value is not nil.
func (*KVCreate) SetNillableExpiresAt ¶
SetNillableExpiresAt sets the "expires_at" field if the given value is not nil.
func (*KVCreate) SetNillableUpdatedAt ¶
SetNillableUpdatedAt sets the "updated_at" field if the given value is not nil.
func (*KVCreate) SetUpdatedAt ¶
SetUpdatedAt sets the "updated_at" field.
type KVCreateBulk ¶
type KVCreateBulk struct {
// contains filtered or unexported fields
}
KVCreateBulk is the builder for creating many KV entities in bulk.
func (*KVCreateBulk) Exec ¶
func (kcb *KVCreateBulk) Exec(ctx context.Context) error
Exec executes the query.
func (*KVCreateBulk) ExecX ¶
func (kcb *KVCreateBulk) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*KVCreateBulk) OnConflict ¶
func (kcb *KVCreateBulk) OnConflict(opts ...sql.ConflictOption) *KVUpsertBulk
OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause of the `INSERT` statement. For example:
client.KV.CreateBulk(builders...). OnConflict( // Update the row with the new values // the was proposed for insertion. sql.ResolveWithNewValues(), ). // Override some of the fields with custom // update values. Update(func(u *ent.KVUpsert) { SetCreatedAt(v+v). }). Exec(ctx)
func (*KVCreateBulk) OnConflictColumns ¶
func (kcb *KVCreateBulk) OnConflictColumns(columns ...string) *KVUpsertBulk
OnConflictColumns calls `OnConflict` and configures the columns as conflict target. Using this option is equivalent to using:
client.KV.Create(). OnConflict(sql.ConflictColumns(columns...)). Exec(ctx)
type KVDelete ¶
type KVDelete struct {
// contains filtered or unexported fields
}
KVDelete is the builder for deleting a KV entity.
func (*KVDelete) Exec ¶
Exec executes the deletion query and returns how many vertices were deleted.
type KVDeleteOne ¶
type KVDeleteOne struct {
// contains filtered or unexported fields
}
KVDeleteOne is the builder for deleting a single KV entity.
func (*KVDeleteOne) Exec ¶
func (kdo *KVDeleteOne) Exec(ctx context.Context) error
Exec executes the deletion query.
func (*KVDeleteOne) ExecX ¶
func (kdo *KVDeleteOne) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*KVDeleteOne) Where ¶
func (kdo *KVDeleteOne) Where(ps ...predicate.KV) *KVDeleteOne
Where appends a list predicates to the KVDelete builder.
type KVGroupBy ¶
type KVGroupBy struct {
// contains filtered or unexported fields
}
KVGroupBy is the group-by builder for KV entities.
func (*KVGroupBy) Aggregate ¶
func (kgb *KVGroupBy) Aggregate(fns ...AggregateFunc) *KVGroupBy
Aggregate adds the given aggregation functions to the group-by query.
func (*KVGroupBy) Bool ¶
Bool returns a single bool from a selector. It is only allowed when selecting one field.
func (*KVGroupBy) Bools ¶
Bools returns list of bools from a selector. It is only allowed when selecting one field.
func (*KVGroupBy) Float64 ¶
Float64 returns a single float64 from a selector. It is only allowed when selecting one field.
func (*KVGroupBy) Float64s ¶
Float64s returns list of float64s from a selector. It is only allowed when selecting one field.
func (*KVGroupBy) Int ¶
Int returns a single int from a selector. It is only allowed when selecting one field.
func (*KVGroupBy) Ints ¶
Ints returns list of ints from a selector. It is only allowed when selecting one field.
func (*KVGroupBy) String ¶
String returns a single string from a selector. It is only allowed when selecting one field.
type KVMutation ¶
type KVMutation struct {
// contains filtered or unexported fields
}
KVMutation represents an operation that mutates the KV nodes in the graph.
func (*KVMutation) AddField ¶
func (m *KVMutation) 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 (*KVMutation) AddedEdges ¶
func (m *KVMutation) AddedEdges() []string
AddedEdges returns all edge names that were set/added in this mutation.
func (*KVMutation) AddedField ¶
func (m *KVMutation) 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 (*KVMutation) AddedFields ¶
func (m *KVMutation) AddedFields() []string
AddedFields returns all numeric fields that were incremented/decremented during this mutation.
func (*KVMutation) AddedIDs ¶
func (m *KVMutation) AddedIDs(name string) []ent.Value
AddedIDs returns all IDs (to other nodes) that were added for the given edge name in this mutation.
func (*KVMutation) ClearEdge ¶
func (m *KVMutation) 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 (*KVMutation) ClearExpiresAt ¶
func (m *KVMutation) ClearExpiresAt()
ClearExpiresAt clears the value of the "expires_at" field.
func (*KVMutation) ClearField ¶
func (m *KVMutation) 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 (*KVMutation) ClearedEdges ¶
func (m *KVMutation) ClearedEdges() []string
ClearedEdges returns all edge names that were cleared in this mutation.
func (*KVMutation) ClearedFields ¶
func (m *KVMutation) ClearedFields() []string
ClearedFields returns all nullable fields that were cleared during this mutation.
func (KVMutation) Client ¶
func (m KVMutation) 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 (*KVMutation) CreatedAt ¶
func (m *KVMutation) CreatedAt() (r time.Time, exists bool)
CreatedAt returns the value of the "created_at" field in the mutation.
func (*KVMutation) EdgeCleared ¶
func (m *KVMutation) EdgeCleared(name string) bool
EdgeCleared returns a boolean which indicates if the edge with the given name was cleared in this mutation.
func (*KVMutation) ExpiresAt ¶
func (m *KVMutation) ExpiresAt() (r time.Time, exists bool)
ExpiresAt returns the value of the "expires_at" field in the mutation.
func (*KVMutation) ExpiresAtCleared ¶
func (m *KVMutation) ExpiresAtCleared() bool
ExpiresAtCleared returns if the "expires_at" field was cleared in this mutation.
func (*KVMutation) Field ¶
func (m *KVMutation) 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 (*KVMutation) FieldCleared ¶
func (m *KVMutation) FieldCleared(name string) bool
FieldCleared returns a boolean indicating if a field with the given name was cleared in this mutation.
func (*KVMutation) Fields ¶
func (m *KVMutation) 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 (*KVMutation) ID ¶
func (m *KVMutation) 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 (*KVMutation) IDs ¶
func (m *KVMutation) 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 (*KVMutation) Key ¶
func (m *KVMutation) Key() (r string, exists bool)
Key returns the value of the "key" field in the mutation.
func (*KVMutation) OldCreatedAt ¶
OldCreatedAt returns the old "created_at" field's value of the KV entity. If the KV 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 (*KVMutation) OldExpiresAt ¶
OldExpiresAt returns the old "expires_at" field's value of the KV entity. If the KV 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 (*KVMutation) 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 (*KVMutation) OldKey ¶
func (m *KVMutation) OldKey(ctx context.Context) (v string, err error)
OldKey returns the old "key" field's value of the KV entity. If the KV 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 (*KVMutation) OldUpdatedAt ¶
OldUpdatedAt returns the old "updated_at" field's value of the KV entity. If the KV 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 (*KVMutation) OldValue ¶
func (m *KVMutation) OldValue(ctx context.Context) (v string, err error)
OldValue returns the old "value" field's value of the KV entity. If the KV 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 (*KVMutation) RemovedEdges ¶
func (m *KVMutation) RemovedEdges() []string
RemovedEdges returns all edge names that were removed in this mutation.
func (*KVMutation) RemovedIDs ¶
func (m *KVMutation) 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 (*KVMutation) ResetCreatedAt ¶
func (m *KVMutation) ResetCreatedAt()
ResetCreatedAt resets all changes to the "created_at" field.
func (*KVMutation) ResetEdge ¶
func (m *KVMutation) 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 (*KVMutation) ResetExpiresAt ¶
func (m *KVMutation) ResetExpiresAt()
ResetExpiresAt resets all changes to the "expires_at" field.
func (*KVMutation) ResetField ¶
func (m *KVMutation) 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 (*KVMutation) ResetKey ¶
func (m *KVMutation) ResetKey()
ResetKey resets all changes to the "key" field.
func (*KVMutation) ResetUpdatedAt ¶
func (m *KVMutation) ResetUpdatedAt()
ResetUpdatedAt resets all changes to the "updated_at" field.
func (*KVMutation) ResetValue ¶
func (m *KVMutation) ResetValue()
ResetValue resets all changes to the "value" field.
func (*KVMutation) SetCreatedAt ¶
func (m *KVMutation) SetCreatedAt(t time.Time)
SetCreatedAt sets the "created_at" field.
func (*KVMutation) SetExpiresAt ¶
func (m *KVMutation) SetExpiresAt(t time.Time)
SetExpiresAt sets the "expires_at" field.
func (*KVMutation) SetField ¶
func (m *KVMutation) 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 (*KVMutation) SetOp ¶
func (m *KVMutation) SetOp(op Op)
SetOp allows setting the mutation operation.
func (*KVMutation) SetUpdatedAt ¶
func (m *KVMutation) SetUpdatedAt(t time.Time)
SetUpdatedAt sets the "updated_at" field.
func (*KVMutation) SetValue ¶
func (m *KVMutation) SetValue(s string)
SetValue sets the "value" field.
func (KVMutation) Tx ¶
func (m KVMutation) Tx() (*Tx, error)
Tx returns an `ent.Tx` for mutations that were executed in transactions; it returns an error otherwise.
func (*KVMutation) Type ¶
func (m *KVMutation) Type() string
Type returns the node type of this mutation (KV).
func (*KVMutation) UpdatedAt ¶
func (m *KVMutation) UpdatedAt() (r time.Time, exists bool)
UpdatedAt returns the value of the "updated_at" field in the mutation.
func (*KVMutation) Value ¶
func (m *KVMutation) Value() (r string, exists bool)
Value returns the value of the "value" field in the mutation.
func (*KVMutation) Where ¶
func (m *KVMutation) Where(ps ...predicate.KV)
Where appends a list predicates to the KVMutation builder.
func (*KVMutation) WhereP ¶
func (m *KVMutation) WhereP(ps ...func(*sql.Selector))
WhereP appends storage-level predicates to the KVMutation builder. Using this method, users can use type-assertion to append predicates that do not depend on any generated package.
type KVQuery ¶
type KVQuery struct {
// contains filtered or unexported fields
}
KVQuery is the builder for querying KV entities.
func (*KVQuery) Aggregate ¶
func (kq *KVQuery) Aggregate(fns ...AggregateFunc) *KVSelect
Aggregate returns a KVSelect configured with the given aggregations.
func (*KVQuery) Clone ¶
Clone returns a duplicate of the KVQuery builder, including all associated steps. It can be used to prepare common query builders and use them differently after the clone is made.
func (*KVQuery) First ¶
First returns the first KV entity from the query. Returns a *NotFoundError when no KV was found.
func (*KVQuery) FirstID ¶
FirstID returns the first KV ID from the query. Returns a *NotFoundError when no KV ID was found.
func (*KVQuery) GroupBy ¶
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 { CreatedAt time.Time `json:"created_at,omitempty"` Count int `json:"count,omitempty"` } client.KV.Query(). GroupBy(kv.FieldCreatedAt). Aggregate(shared.Count()). Scan(ctx, &v)
func (*KVQuery) Only ¶
Only returns a single KV entity found by the query, ensuring it only returns one. Returns a *NotSingularError when more than one KV entity is found. Returns a *NotFoundError when no KV entities are found.
func (*KVQuery) OnlyID ¶
OnlyID is like Only, but returns the only KV ID in the query. Returns a *NotSingularError when more than one KV ID is found. Returns a *NotFoundError when no entities are found.
func (*KVQuery) Order ¶
func (kq *KVQuery) Order(o ...kv.OrderOption) *KVQuery
Order specifies how the records should be ordered.
func (*KVQuery) Select ¶
Select allows the selection one or more fields/columns for the given query, instead of selecting all fields in the entity.
Example:
var v []struct { CreatedAt time.Time `json:"created_at,omitempty"` } client.KV.Query(). Select(kv.FieldCreatedAt). Scan(ctx, &v)
type KVSelect ¶
type KVSelect struct { *KVQuery // contains filtered or unexported fields }
KVSelect is the builder for selecting fields of KV entities.
func (*KVSelect) Aggregate ¶
func (ks *KVSelect) Aggregate(fns ...AggregateFunc) *KVSelect
Aggregate adds the given aggregation functions to the selector query.
func (*KVSelect) Bool ¶
Bool returns a single bool from a selector. It is only allowed when selecting one field.
func (*KVSelect) Bools ¶
Bools returns list of bools from a selector. It is only allowed when selecting one field.
func (*KVSelect) Float64 ¶
Float64 returns a single float64 from a selector. It is only allowed when selecting one field.
func (*KVSelect) Float64s ¶
Float64s returns list of float64s from a selector. It is only allowed when selecting one field.
func (*KVSelect) Int ¶
Int returns a single int from a selector. It is only allowed when selecting one field.
func (*KVSelect) Ints ¶
Ints returns list of ints from a selector. It is only allowed when selecting one field.
func (*KVSelect) String ¶
String returns a single string from a selector. It is only allowed when selecting one field.
type KVUpdate ¶
type KVUpdate struct {
// contains filtered or unexported fields
}
KVUpdate is the builder for updating KV entities.
func (*KVUpdate) ClearExpiresAt ¶
ClearExpiresAt clears the value of the "expires_at" field.
func (*KVUpdate) Modify ¶
func (ku *KVUpdate) Modify(modifiers ...func(u *sql.UpdateBuilder)) *KVUpdate
Modify adds a statement modifier for attaching custom logic to the UPDATE statement.
func (*KVUpdate) Mutation ¶
func (ku *KVUpdate) Mutation() *KVMutation
Mutation returns the KVMutation object of the builder.
func (*KVUpdate) Save ¶
Save executes the query and returns the number of nodes affected by the update operation.
func (*KVUpdate) SetExpiresAt ¶
SetExpiresAt sets the "expires_at" field.
func (*KVUpdate) SetNillableExpiresAt ¶
SetNillableExpiresAt sets the "expires_at" field if the given value is not nil.
func (*KVUpdate) SetUpdatedAt ¶
SetUpdatedAt sets the "updated_at" field.
type KVUpdateOne ¶
type KVUpdateOne struct {
// contains filtered or unexported fields
}
KVUpdateOne is the builder for updating a single KV entity.
func (*KVUpdateOne) ClearExpiresAt ¶
func (kuo *KVUpdateOne) ClearExpiresAt() *KVUpdateOne
ClearExpiresAt clears the value of the "expires_at" field.
func (*KVUpdateOne) Exec ¶
func (kuo *KVUpdateOne) Exec(ctx context.Context) error
Exec executes the query on the entity.
func (*KVUpdateOne) ExecX ¶
func (kuo *KVUpdateOne) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*KVUpdateOne) Modify ¶
func (kuo *KVUpdateOne) Modify(modifiers ...func(u *sql.UpdateBuilder)) *KVUpdateOne
Modify adds a statement modifier for attaching custom logic to the UPDATE statement.
func (*KVUpdateOne) Mutation ¶
func (kuo *KVUpdateOne) Mutation() *KVMutation
Mutation returns the KVMutation object of the builder.
func (*KVUpdateOne) Save ¶
func (kuo *KVUpdateOne) Save(ctx context.Context) (*KV, error)
Save executes the query and returns the updated KV entity.
func (*KVUpdateOne) SaveX ¶
func (kuo *KVUpdateOne) SaveX(ctx context.Context) *KV
SaveX is like Save, but panics if an error occurs.
func (*KVUpdateOne) Select ¶
func (kuo *KVUpdateOne) Select(field string, fields ...string) *KVUpdateOne
Select allows selecting one or more fields (columns) of the returned entity. The default is selecting all fields defined in the entity schema.
func (*KVUpdateOne) SetExpiresAt ¶
func (kuo *KVUpdateOne) SetExpiresAt(t time.Time) *KVUpdateOne
SetExpiresAt sets the "expires_at" field.
func (*KVUpdateOne) SetKey ¶
func (kuo *KVUpdateOne) SetKey(s string) *KVUpdateOne
SetKey sets the "key" field.
func (*KVUpdateOne) SetNillableExpiresAt ¶
func (kuo *KVUpdateOne) SetNillableExpiresAt(t *time.Time) *KVUpdateOne
SetNillableExpiresAt sets the "expires_at" field if the given value is not nil.
func (*KVUpdateOne) SetUpdatedAt ¶
func (kuo *KVUpdateOne) SetUpdatedAt(t time.Time) *KVUpdateOne
SetUpdatedAt sets the "updated_at" field.
func (*KVUpdateOne) SetValue ¶
func (kuo *KVUpdateOne) SetValue(s string) *KVUpdateOne
SetValue sets the "value" field.
func (*KVUpdateOne) Where ¶
func (kuo *KVUpdateOne) Where(ps ...predicate.KV) *KVUpdateOne
Where appends a list predicates to the KVUpdate builder.
type KVUpsert ¶
KVUpsert is the "OnConflict" setter.
func (*KVUpsert) ClearExpiresAt ¶
ClearExpiresAt clears the value of the "expires_at" field.
func (*KVUpsert) SetExpiresAt ¶
SetExpiresAt sets the "expires_at" field.
func (*KVUpsert) SetUpdatedAt ¶
SetUpdatedAt sets the "updated_at" field.
func (*KVUpsert) UpdateExpiresAt ¶
UpdateExpiresAt sets the "expires_at" field to the value that was provided on create.
func (*KVUpsert) UpdateKey ¶
UpdateKey sets the "key" field to the value that was provided on create.
func (*KVUpsert) UpdateUpdatedAt ¶
UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create.
func (*KVUpsert) UpdateValue ¶
UpdateValue sets the "value" field to the value that was provided on create.
type KVUpsertBulk ¶
type KVUpsertBulk struct {
// contains filtered or unexported fields
}
KVUpsertBulk is the builder for "upsert"-ing a bulk of KV nodes.
func (*KVUpsertBulk) ClearExpiresAt ¶
func (u *KVUpsertBulk) ClearExpiresAt() *KVUpsertBulk
ClearExpiresAt clears the value of the "expires_at" field.
func (*KVUpsertBulk) DoNothing ¶
func (u *KVUpsertBulk) DoNothing() *KVUpsertBulk
DoNothing configures the conflict_action to `DO NOTHING`. Supported only by SQLite and PostgreSQL.
func (*KVUpsertBulk) Exec ¶
func (u *KVUpsertBulk) Exec(ctx context.Context) error
Exec executes the query.
func (*KVUpsertBulk) ExecX ¶
func (u *KVUpsertBulk) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*KVUpsertBulk) Ignore ¶
func (u *KVUpsertBulk) Ignore() *KVUpsertBulk
Ignore sets each column to itself in case of conflict. Using this option is equivalent to using:
client.KV.Create(). OnConflict(sql.ResolveWithIgnore()). Exec(ctx)
func (*KVUpsertBulk) SetExpiresAt ¶
func (u *KVUpsertBulk) SetExpiresAt(v time.Time) *KVUpsertBulk
SetExpiresAt sets the "expires_at" field.
func (*KVUpsertBulk) SetKey ¶
func (u *KVUpsertBulk) SetKey(v string) *KVUpsertBulk
SetKey sets the "key" field.
func (*KVUpsertBulk) SetUpdatedAt ¶
func (u *KVUpsertBulk) SetUpdatedAt(v time.Time) *KVUpsertBulk
SetUpdatedAt sets the "updated_at" field.
func (*KVUpsertBulk) SetValue ¶
func (u *KVUpsertBulk) SetValue(v string) *KVUpsertBulk
SetValue sets the "value" field.
func (*KVUpsertBulk) Update ¶
func (u *KVUpsertBulk) Update(set func(*KVUpsert)) *KVUpsertBulk
Update allows overriding fields `UPDATE` values. See the KVCreateBulk.OnConflict documentation for more info.
func (*KVUpsertBulk) UpdateExpiresAt ¶
func (u *KVUpsertBulk) UpdateExpiresAt() *KVUpsertBulk
UpdateExpiresAt sets the "expires_at" field to the value that was provided on create.
func (*KVUpsertBulk) UpdateKey ¶
func (u *KVUpsertBulk) UpdateKey() *KVUpsertBulk
UpdateKey sets the "key" field to the value that was provided on create.
func (*KVUpsertBulk) UpdateNewValues ¶
func (u *KVUpsertBulk) UpdateNewValues() *KVUpsertBulk
UpdateNewValues updates the mutable fields using the new values that were set on create. Using this option is equivalent to using:
client.KV.Create(). OnConflict( sql.ResolveWithNewValues(), ). Exec(ctx)
func (*KVUpsertBulk) UpdateUpdatedAt ¶
func (u *KVUpsertBulk) UpdateUpdatedAt() *KVUpsertBulk
UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create.
func (*KVUpsertBulk) UpdateValue ¶
func (u *KVUpsertBulk) UpdateValue() *KVUpsertBulk
UpdateValue sets the "value" field to the value that was provided on create.
type KVUpsertOne ¶
type KVUpsertOne struct {
// contains filtered or unexported fields
}
KVUpsertOne is the builder for "upsert"-ing
one KV node.
func (*KVUpsertOne) ClearExpiresAt ¶
func (u *KVUpsertOne) ClearExpiresAt() *KVUpsertOne
ClearExpiresAt clears the value of the "expires_at" field.
func (*KVUpsertOne) DoNothing ¶
func (u *KVUpsertOne) DoNothing() *KVUpsertOne
DoNothing configures the conflict_action to `DO NOTHING`. Supported only by SQLite and PostgreSQL.
func (*KVUpsertOne) Exec ¶
func (u *KVUpsertOne) Exec(ctx context.Context) error
Exec executes the query.
func (*KVUpsertOne) ExecX ¶
func (u *KVUpsertOne) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*KVUpsertOne) ID ¶
func (u *KVUpsertOne) ID(ctx context.Context) (id int, err error)
Exec executes the UPSERT query and returns the inserted/updated ID.
func (*KVUpsertOne) IDX ¶
func (u *KVUpsertOne) IDX(ctx context.Context) int
IDX is like ID, but panics if an error occurs.
func (*KVUpsertOne) Ignore ¶
func (u *KVUpsertOne) Ignore() *KVUpsertOne
Ignore sets each column to itself in case of conflict. Using this option is equivalent to using:
client.KV.Create(). OnConflict(sql.ResolveWithIgnore()). Exec(ctx)
func (*KVUpsertOne) SetExpiresAt ¶
func (u *KVUpsertOne) SetExpiresAt(v time.Time) *KVUpsertOne
SetExpiresAt sets the "expires_at" field.
func (*KVUpsertOne) SetKey ¶
func (u *KVUpsertOne) SetKey(v string) *KVUpsertOne
SetKey sets the "key" field.
func (*KVUpsertOne) SetUpdatedAt ¶
func (u *KVUpsertOne) SetUpdatedAt(v time.Time) *KVUpsertOne
SetUpdatedAt sets the "updated_at" field.
func (*KVUpsertOne) SetValue ¶
func (u *KVUpsertOne) SetValue(v string) *KVUpsertOne
SetValue sets the "value" field.
func (*KVUpsertOne) Update ¶
func (u *KVUpsertOne) Update(set func(*KVUpsert)) *KVUpsertOne
Update allows overriding fields `UPDATE` values. See the KVCreate.OnConflict documentation for more info.
func (*KVUpsertOne) UpdateExpiresAt ¶
func (u *KVUpsertOne) UpdateExpiresAt() *KVUpsertOne
UpdateExpiresAt sets the "expires_at" field to the value that was provided on create.
func (*KVUpsertOne) UpdateKey ¶
func (u *KVUpsertOne) UpdateKey() *KVUpsertOne
UpdateKey sets the "key" field to the value that was provided on create.
func (*KVUpsertOne) UpdateNewValues ¶
func (u *KVUpsertOne) UpdateNewValues() *KVUpsertOne
UpdateNewValues updates the mutable fields using the new values that were set on create. Using this option is equivalent to using:
client.KV.Create(). OnConflict( sql.ResolveWithNewValues(), ). Exec(ctx)
func (*KVUpsertOne) UpdateUpdatedAt ¶
func (u *KVUpsertOne) UpdateUpdatedAt() *KVUpsertOne
UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create.
func (*KVUpsertOne) UpdateValue ¶
func (u *KVUpsertOne) UpdateValue() *KVUpsertOne
UpdateValue sets the "value" field to the value that was provided on create.
type MutateFunc ¶
type MutateFunc = ent.MutateFunc
ent aliases to avoid import conflicts in user's code.
type Node ¶
type Node struct { // ID of the ent. ID string `json:"id,omitempty"` // CreatedAt holds the value of the "created_at" field. CreatedAt time.Time `json:"created_at,omitempty"` // UpdatedAt holds the value of the "updated_at" field. UpdatedAt time.Time `json:"updated_at,omitempty"` // Name holds the value of the "name" field. Name string `json:"name,omitempty"` // IP holds the value of the "ip" field. IP string `json:"ip,omitempty"` // Port holds the value of the "port" field. Port int `json:"port,omitempty"` // Comment holds the value of the "comment" field. Comment string `json:"comment,omitempty"` // contains filtered or unexported fields }
Node is the model entity for the Node schema.
func (*Node) Unwrap ¶
Unwrap unwraps the Node 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 (*Node) Update ¶
func (n *Node) Update() *NodeUpdateOne
Update returns a builder for updating this Node. Note that you need to call Node.Unwrap() before calling this method if this Node was returned from a transaction, and the transaction was committed or rolled back.
type NodeClient ¶
type NodeClient struct {
// contains filtered or unexported fields
}
NodeClient is a client for the Node schema.
func NewNodeClient ¶
func NewNodeClient(c config) *NodeClient
NewNodeClient returns a client for the Node from the given config.
func (*NodeClient) Create ¶
func (c *NodeClient) Create() *NodeCreate
Create returns a builder for creating a Node entity.
func (*NodeClient) CreateBulk ¶
func (c *NodeClient) CreateBulk(builders ...*NodeCreate) *NodeCreateBulk
CreateBulk returns a builder for creating a bulk of Node entities.
func (*NodeClient) Delete ¶
func (c *NodeClient) Delete() *NodeDelete
Delete returns a delete builder for Node.
func (*NodeClient) DeleteOne ¶
func (c *NodeClient) DeleteOne(n *Node) *NodeDeleteOne
DeleteOne returns a builder for deleting the given entity.
func (*NodeClient) DeleteOneID ¶
func (c *NodeClient) DeleteOneID(id string) *NodeDeleteOne
DeleteOneID returns a builder for deleting the given entity by its id.
func (*NodeClient) GetX ¶
func (c *NodeClient) GetX(ctx context.Context, id string) *Node
GetX is like Get, but panics if an error occurs.
func (*NodeClient) Intercept ¶
func (c *NodeClient) Intercept(interceptors ...Interceptor)
Intercept adds a list of query interceptors to the interceptors stack. A call to `Intercept(f, g, h)` equals to `node.Intercept(f(g(h())))`.
func (*NodeClient) Interceptors ¶
func (c *NodeClient) Interceptors() []Interceptor
Interceptors returns the client interceptors.
func (*NodeClient) Query ¶
func (c *NodeClient) Query() *NodeQuery
Query returns a query builder for Node.
func (*NodeClient) Update ¶
func (c *NodeClient) Update() *NodeUpdate
Update returns an update builder for Node.
func (*NodeClient) UpdateOne ¶
func (c *NodeClient) UpdateOne(n *Node) *NodeUpdateOne
UpdateOne returns an update builder for the given entity.
func (*NodeClient) UpdateOneID ¶
func (c *NodeClient) UpdateOneID(id string) *NodeUpdateOne
UpdateOneID returns an update builder for the given id.
func (*NodeClient) Use ¶
func (c *NodeClient) Use(hooks ...Hook)
Use adds a list of mutation hooks to the hooks stack. A call to `Use(f, g, h)` equals to `node.Hooks(f(g(h())))`.
type NodeCreate ¶
type NodeCreate struct {
// contains filtered or unexported fields
}
NodeCreate is the builder for creating a Node entity.
func (*NodeCreate) Exec ¶
func (nc *NodeCreate) Exec(ctx context.Context) error
Exec executes the query.
func (*NodeCreate) ExecX ¶
func (nc *NodeCreate) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*NodeCreate) Mutation ¶
func (nc *NodeCreate) Mutation() *NodeMutation
Mutation returns the NodeMutation object of the builder.
func (*NodeCreate) OnConflict ¶
func (nc *NodeCreate) OnConflict(opts ...sql.ConflictOption) *NodeUpsertOne
OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause of the `INSERT` statement. For example:
client.Node.Create(). SetCreatedAt(v). OnConflict( // Update the row with the new values // the was proposed for insertion. sql.ResolveWithNewValues(), ). // Override some of the fields with custom // update values. Update(func(u *ent.NodeUpsert) { SetCreatedAt(v+v). }). Exec(ctx)
func (*NodeCreate) OnConflictColumns ¶
func (nc *NodeCreate) OnConflictColumns(columns ...string) *NodeUpsertOne
OnConflictColumns calls `OnConflict` and configures the columns as conflict target. Using this option is equivalent to using:
client.Node.Create(). OnConflict(sql.ConflictColumns(columns...)). Exec(ctx)
func (*NodeCreate) Save ¶
func (nc *NodeCreate) Save(ctx context.Context) (*Node, error)
Save creates the Node in the database.
func (*NodeCreate) SaveX ¶
func (nc *NodeCreate) SaveX(ctx context.Context) *Node
SaveX calls Save and panics if Save returns an error.
func (*NodeCreate) SetComment ¶
func (nc *NodeCreate) SetComment(s string) *NodeCreate
SetComment sets the "comment" field.
func (*NodeCreate) SetCreatedAt ¶
func (nc *NodeCreate) SetCreatedAt(t time.Time) *NodeCreate
SetCreatedAt sets the "created_at" field.
func (*NodeCreate) SetID ¶
func (nc *NodeCreate) SetID(s string) *NodeCreate
SetID sets the "id" field.
func (*NodeCreate) SetIP ¶
func (nc *NodeCreate) SetIP(s string) *NodeCreate
SetIP sets the "ip" field.
func (*NodeCreate) SetName ¶
func (nc *NodeCreate) SetName(s string) *NodeCreate
SetName sets the "name" field.
func (*NodeCreate) SetNillableComment ¶
func (nc *NodeCreate) SetNillableComment(s *string) *NodeCreate
SetNillableComment sets the "comment" field if the given value is not nil.
func (*NodeCreate) SetNillableCreatedAt ¶
func (nc *NodeCreate) SetNillableCreatedAt(t *time.Time) *NodeCreate
SetNillableCreatedAt sets the "created_at" field if the given value is not nil.
func (*NodeCreate) SetNillableID ¶
func (nc *NodeCreate) SetNillableID(s *string) *NodeCreate
SetNillableID sets the "id" field if the given value is not nil.
func (*NodeCreate) SetNillableName ¶
func (nc *NodeCreate) SetNillableName(s *string) *NodeCreate
SetNillableName sets the "name" field if the given value is not nil.
func (*NodeCreate) SetNillablePort ¶
func (nc *NodeCreate) SetNillablePort(i *int) *NodeCreate
SetNillablePort sets the "port" field if the given value is not nil.
func (*NodeCreate) SetNillableUpdatedAt ¶
func (nc *NodeCreate) SetNillableUpdatedAt(t *time.Time) *NodeCreate
SetNillableUpdatedAt sets the "updated_at" field if the given value is not nil.
func (*NodeCreate) SetPort ¶
func (nc *NodeCreate) SetPort(i int) *NodeCreate
SetPort sets the "port" field.
func (*NodeCreate) SetUpdatedAt ¶
func (nc *NodeCreate) SetUpdatedAt(t time.Time) *NodeCreate
SetUpdatedAt sets the "updated_at" field.
type NodeCreateBulk ¶
type NodeCreateBulk struct {
// contains filtered or unexported fields
}
NodeCreateBulk is the builder for creating many Node entities in bulk.
func (*NodeCreateBulk) Exec ¶
func (ncb *NodeCreateBulk) Exec(ctx context.Context) error
Exec executes the query.
func (*NodeCreateBulk) ExecX ¶
func (ncb *NodeCreateBulk) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*NodeCreateBulk) OnConflict ¶
func (ncb *NodeCreateBulk) OnConflict(opts ...sql.ConflictOption) *NodeUpsertBulk
OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause of the `INSERT` statement. For example:
client.Node.CreateBulk(builders...). OnConflict( // Update the row with the new values // the was proposed for insertion. sql.ResolveWithNewValues(), ). // Override some of the fields with custom // update values. Update(func(u *ent.NodeUpsert) { SetCreatedAt(v+v). }). Exec(ctx)
func (*NodeCreateBulk) OnConflictColumns ¶
func (ncb *NodeCreateBulk) OnConflictColumns(columns ...string) *NodeUpsertBulk
OnConflictColumns calls `OnConflict` and configures the columns as conflict target. Using this option is equivalent to using:
client.Node.Create(). OnConflict(sql.ConflictColumns(columns...)). Exec(ctx)
type NodeDelete ¶
type NodeDelete struct {
// contains filtered or unexported fields
}
NodeDelete is the builder for deleting a Node entity.
func (*NodeDelete) Exec ¶
func (nd *NodeDelete) Exec(ctx context.Context) (int, error)
Exec executes the deletion query and returns how many vertices were deleted.
func (*NodeDelete) ExecX ¶
func (nd *NodeDelete) ExecX(ctx context.Context) int
ExecX is like Exec, but panics if an error occurs.
func (*NodeDelete) Where ¶
func (nd *NodeDelete) Where(ps ...predicate.Node) *NodeDelete
Where appends a list predicates to the NodeDelete builder.
type NodeDeleteOne ¶
type NodeDeleteOne struct {
// contains filtered or unexported fields
}
NodeDeleteOne is the builder for deleting a single Node entity.
func (*NodeDeleteOne) Exec ¶
func (ndo *NodeDeleteOne) Exec(ctx context.Context) error
Exec executes the deletion query.
func (*NodeDeleteOne) ExecX ¶
func (ndo *NodeDeleteOne) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*NodeDeleteOne) Where ¶
func (ndo *NodeDeleteOne) Where(ps ...predicate.Node) *NodeDeleteOne
Where appends a list predicates to the NodeDelete builder.
type NodeGroupBy ¶
type NodeGroupBy struct {
// contains filtered or unexported fields
}
NodeGroupBy is the group-by builder for Node entities.
func (*NodeGroupBy) Aggregate ¶
func (ngb *NodeGroupBy) Aggregate(fns ...AggregateFunc) *NodeGroupBy
Aggregate adds the given aggregation functions to the group-by query.
func (*NodeGroupBy) Bool ¶
Bool returns a single bool from a selector. It is only allowed when selecting one field.
func (*NodeGroupBy) Bools ¶
Bools returns list of bools from a selector. It is only allowed when selecting one field.
func (*NodeGroupBy) Float64 ¶
Float64 returns a single float64 from a selector. It is only allowed when selecting one field.
func (*NodeGroupBy) Float64s ¶
Float64s returns list of float64s from a selector. It is only allowed when selecting one field.
func (*NodeGroupBy) Int ¶
Int returns a single int from a selector. It is only allowed when selecting one field.
func (*NodeGroupBy) Ints ¶
Ints returns list of ints from a selector. It is only allowed when selecting one field.
func (*NodeGroupBy) Scan ¶
func (ngb *NodeGroupBy) Scan(ctx context.Context, v any) error
Scan applies the selector query and scans the result into the given value.
func (*NodeGroupBy) String ¶
String returns a single string from a selector. It is only allowed when selecting one field.
type NodeMutation ¶
type NodeMutation struct {
// contains filtered or unexported fields
}
NodeMutation represents an operation that mutates the Node nodes in the graph.
func (*NodeMutation) AddField ¶
func (m *NodeMutation) 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 (*NodeMutation) AddPort ¶
func (m *NodeMutation) AddPort(i int)
AddPort adds i to the "port" field.
func (*NodeMutation) AddedEdges ¶
func (m *NodeMutation) AddedEdges() []string
AddedEdges returns all edge names that were set/added in this mutation.
func (*NodeMutation) AddedField ¶
func (m *NodeMutation) 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 (*NodeMutation) AddedFields ¶
func (m *NodeMutation) AddedFields() []string
AddedFields returns all numeric fields that were incremented/decremented during this mutation.
func (*NodeMutation) AddedIDs ¶
func (m *NodeMutation) AddedIDs(name string) []ent.Value
AddedIDs returns all IDs (to other nodes) that were added for the given edge name in this mutation.
func (*NodeMutation) AddedPort ¶
func (m *NodeMutation) AddedPort() (r int, exists bool)
AddedPort returns the value that was added to the "port" field in this mutation.
func (*NodeMutation) ClearComment ¶
func (m *NodeMutation) ClearComment()
ClearComment clears the value of the "comment" field.
func (*NodeMutation) ClearEdge ¶
func (m *NodeMutation) 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 (*NodeMutation) ClearField ¶
func (m *NodeMutation) 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 (*NodeMutation) ClearName ¶
func (m *NodeMutation) ClearName()
ClearName clears the value of the "name" field.
func (*NodeMutation) ClearedEdges ¶
func (m *NodeMutation) ClearedEdges() []string
ClearedEdges returns all edge names that were cleared in this mutation.
func (*NodeMutation) ClearedFields ¶
func (m *NodeMutation) ClearedFields() []string
ClearedFields returns all nullable fields that were cleared during this mutation.
func (NodeMutation) Client ¶
func (m NodeMutation) 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 (*NodeMutation) Comment ¶
func (m *NodeMutation) Comment() (r string, exists bool)
Comment returns the value of the "comment" field in the mutation.
func (*NodeMutation) CommentCleared ¶
func (m *NodeMutation) CommentCleared() bool
CommentCleared returns if the "comment" field was cleared in this mutation.
func (*NodeMutation) CreatedAt ¶
func (m *NodeMutation) CreatedAt() (r time.Time, exists bool)
CreatedAt returns the value of the "created_at" field in the mutation.
func (*NodeMutation) EdgeCleared ¶
func (m *NodeMutation) EdgeCleared(name string) bool
EdgeCleared returns a boolean which indicates if the edge with the given name was cleared in this mutation.
func (*NodeMutation) Field ¶
func (m *NodeMutation) 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 (*NodeMutation) FieldCleared ¶
func (m *NodeMutation) FieldCleared(name string) bool
FieldCleared returns a boolean indicating if a field with the given name was cleared in this mutation.
func (*NodeMutation) Fields ¶
func (m *NodeMutation) 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 (*NodeMutation) ID ¶
func (m *NodeMutation) 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 (*NodeMutation) IDs ¶
func (m *NodeMutation) 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 (*NodeMutation) IP ¶
func (m *NodeMutation) IP() (r string, exists bool)
IP returns the value of the "ip" field in the mutation.
func (*NodeMutation) Name ¶
func (m *NodeMutation) Name() (r string, exists bool)
Name returns the value of the "name" field in the mutation.
func (*NodeMutation) NameCleared ¶
func (m *NodeMutation) NameCleared() bool
NameCleared returns if the "name" field was cleared in this mutation.
func (*NodeMutation) OldComment ¶
func (m *NodeMutation) OldComment(ctx context.Context) (v string, err error)
OldComment returns the old "comment" field's value of the Node entity. If the Node 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 (*NodeMutation) OldCreatedAt ¶
OldCreatedAt returns the old "created_at" field's value of the Node entity. If the Node 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 (*NodeMutation) 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 (*NodeMutation) OldIP ¶
func (m *NodeMutation) OldIP(ctx context.Context) (v string, err error)
OldIP returns the old "ip" field's value of the Node entity. If the Node 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 (*NodeMutation) OldName ¶
func (m *NodeMutation) OldName(ctx context.Context) (v string, err error)
OldName returns the old "name" field's value of the Node entity. If the Node 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 (*NodeMutation) OldPort ¶
func (m *NodeMutation) OldPort(ctx context.Context) (v int, err error)
OldPort returns the old "port" field's value of the Node entity. If the Node 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 (*NodeMutation) OldUpdatedAt ¶
OldUpdatedAt returns the old "updated_at" field's value of the Node entity. If the Node 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 (*NodeMutation) Port ¶
func (m *NodeMutation) Port() (r int, exists bool)
Port returns the value of the "port" field in the mutation.
func (*NodeMutation) RemovedEdges ¶
func (m *NodeMutation) RemovedEdges() []string
RemovedEdges returns all edge names that were removed in this mutation.
func (*NodeMutation) RemovedIDs ¶
func (m *NodeMutation) 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 (*NodeMutation) ResetComment ¶
func (m *NodeMutation) ResetComment()
ResetComment resets all changes to the "comment" field.
func (*NodeMutation) ResetCreatedAt ¶
func (m *NodeMutation) ResetCreatedAt()
ResetCreatedAt resets all changes to the "created_at" field.
func (*NodeMutation) ResetEdge ¶
func (m *NodeMutation) 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 (*NodeMutation) ResetField ¶
func (m *NodeMutation) 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 (*NodeMutation) ResetIP ¶
func (m *NodeMutation) ResetIP()
ResetIP resets all changes to the "ip" field.
func (*NodeMutation) ResetName ¶
func (m *NodeMutation) ResetName()
ResetName resets all changes to the "name" field.
func (*NodeMutation) ResetPort ¶
func (m *NodeMutation) ResetPort()
ResetPort resets all changes to the "port" field.
func (*NodeMutation) ResetUpdatedAt ¶
func (m *NodeMutation) ResetUpdatedAt()
ResetUpdatedAt resets all changes to the "updated_at" field.
func (*NodeMutation) SetComment ¶
func (m *NodeMutation) SetComment(s string)
SetComment sets the "comment" field.
func (*NodeMutation) SetCreatedAt ¶
func (m *NodeMutation) SetCreatedAt(t time.Time)
SetCreatedAt sets the "created_at" field.
func (*NodeMutation) SetField ¶
func (m *NodeMutation) 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 (*NodeMutation) SetID ¶
func (m *NodeMutation) SetID(id string)
SetID sets the value of the id field. Note that this operation is only accepted on creation of Node entities.
func (*NodeMutation) SetName ¶
func (m *NodeMutation) SetName(s string)
SetName sets the "name" field.
func (*NodeMutation) SetOp ¶
func (m *NodeMutation) SetOp(op Op)
SetOp allows setting the mutation operation.
func (*NodeMutation) SetUpdatedAt ¶
func (m *NodeMutation) SetUpdatedAt(t time.Time)
SetUpdatedAt sets the "updated_at" field.
func (NodeMutation) Tx ¶
func (m NodeMutation) Tx() (*Tx, error)
Tx returns an `ent.Tx` for mutations that were executed in transactions; it returns an error otherwise.
func (*NodeMutation) Type ¶
func (m *NodeMutation) Type() string
Type returns the node type of this mutation (Node).
func (*NodeMutation) UpdatedAt ¶
func (m *NodeMutation) UpdatedAt() (r time.Time, exists bool)
UpdatedAt returns the value of the "updated_at" field in the mutation.
func (*NodeMutation) Where ¶
func (m *NodeMutation) Where(ps ...predicate.Node)
Where appends a list predicates to the NodeMutation builder.
func (*NodeMutation) WhereP ¶
func (m *NodeMutation) WhereP(ps ...func(*sql.Selector))
WhereP appends storage-level predicates to the NodeMutation builder. Using this method, users can use type-assertion to append predicates that do not depend on any generated package.
type NodeQuery ¶
type NodeQuery struct {
// contains filtered or unexported fields
}
NodeQuery is the builder for querying Node entities.
func (*NodeQuery) Aggregate ¶
func (nq *NodeQuery) Aggregate(fns ...AggregateFunc) *NodeSelect
Aggregate returns a NodeSelect configured with the given aggregations.
func (*NodeQuery) Clone ¶
Clone returns a duplicate of the NodeQuery builder, including all associated steps. It can be used to prepare common query builders and use them differently after the clone is made.
func (*NodeQuery) First ¶
First returns the first Node entity from the query. Returns a *NotFoundError when no Node was found.
func (*NodeQuery) FirstID ¶
FirstID returns the first Node ID from the query. Returns a *NotFoundError when no Node ID was found.
func (*NodeQuery) GroupBy ¶
func (nq *NodeQuery) GroupBy(field string, fields ...string) *NodeGroupBy
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 { CreatedAt time.Time `json:"created_at,omitempty"` Count int `json:"count,omitempty"` } client.Node.Query(). GroupBy(node.FieldCreatedAt). Aggregate(shared.Count()). Scan(ctx, &v)
func (*NodeQuery) Modify ¶
func (nq *NodeQuery) Modify(modifiers ...func(s *sql.Selector)) *NodeSelect
Modify adds a query modifier for attaching custom logic to queries.
func (*NodeQuery) Only ¶
Only returns a single Node entity found by the query, ensuring it only returns one. Returns a *NotSingularError when more than one Node entity is found. Returns a *NotFoundError when no Node entities are found.
func (*NodeQuery) OnlyID ¶
OnlyID is like Only, but returns the only Node ID in the query. Returns a *NotSingularError when more than one Node ID is found. Returns a *NotFoundError when no entities are found.
func (*NodeQuery) Order ¶
func (nq *NodeQuery) Order(o ...node.OrderOption) *NodeQuery
Order specifies how the records should be ordered.
func (*NodeQuery) Select ¶
func (nq *NodeQuery) Select(fields ...string) *NodeSelect
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 { CreatedAt time.Time `json:"created_at,omitempty"` } client.Node.Query(). Select(node.FieldCreatedAt). Scan(ctx, &v)
type NodeSelect ¶
type NodeSelect struct { *NodeQuery // contains filtered or unexported fields }
NodeSelect is the builder for selecting fields of Node entities.
func (*NodeSelect) Aggregate ¶
func (ns *NodeSelect) Aggregate(fns ...AggregateFunc) *NodeSelect
Aggregate adds the given aggregation functions to the selector query.
func (*NodeSelect) Bool ¶
Bool returns a single bool from a selector. It is only allowed when selecting one field.
func (*NodeSelect) Bools ¶
Bools returns list of bools from a selector. It is only allowed when selecting one field.
func (*NodeSelect) Float64 ¶
Float64 returns a single float64 from a selector. It is only allowed when selecting one field.
func (*NodeSelect) Float64s ¶
Float64s returns list of float64s from a selector. It is only allowed when selecting one field.
func (*NodeSelect) Int ¶
Int returns a single int from a selector. It is only allowed when selecting one field.
func (*NodeSelect) Ints ¶
Ints returns list of ints from a selector. It is only allowed when selecting one field.
func (*NodeSelect) Modify ¶
func (ns *NodeSelect) Modify(modifiers ...func(s *sql.Selector)) *NodeSelect
Modify adds a query modifier for attaching custom logic to queries.
func (*NodeSelect) Scan ¶
func (ns *NodeSelect) Scan(ctx context.Context, v any) error
Scan applies the selector query and scans the result into the given value.
func (*NodeSelect) String ¶
String returns a single string from a selector. It is only allowed when selecting one field.
type NodeUpdate ¶
type NodeUpdate struct {
// contains filtered or unexported fields
}
NodeUpdate is the builder for updating Node entities.
func (*NodeUpdate) AddPort ¶
func (nu *NodeUpdate) AddPort(i int) *NodeUpdate
AddPort adds i to the "port" field.
func (*NodeUpdate) ClearComment ¶
func (nu *NodeUpdate) ClearComment() *NodeUpdate
ClearComment clears the value of the "comment" field.
func (*NodeUpdate) ClearName ¶
func (nu *NodeUpdate) ClearName() *NodeUpdate
ClearName clears the value of the "name" field.
func (*NodeUpdate) Exec ¶
func (nu *NodeUpdate) Exec(ctx context.Context) error
Exec executes the query.
func (*NodeUpdate) ExecX ¶
func (nu *NodeUpdate) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*NodeUpdate) Modify ¶
func (nu *NodeUpdate) Modify(modifiers ...func(u *sql.UpdateBuilder)) *NodeUpdate
Modify adds a statement modifier for attaching custom logic to the UPDATE statement.
func (*NodeUpdate) Mutation ¶
func (nu *NodeUpdate) Mutation() *NodeMutation
Mutation returns the NodeMutation object of the builder.
func (*NodeUpdate) Save ¶
func (nu *NodeUpdate) Save(ctx context.Context) (int, error)
Save executes the query and returns the number of nodes affected by the update operation.
func (*NodeUpdate) SaveX ¶
func (nu *NodeUpdate) SaveX(ctx context.Context) int
SaveX is like Save, but panics if an error occurs.
func (*NodeUpdate) SetComment ¶
func (nu *NodeUpdate) SetComment(s string) *NodeUpdate
SetComment sets the "comment" field.
func (*NodeUpdate) SetIP ¶
func (nu *NodeUpdate) SetIP(s string) *NodeUpdate
SetIP sets the "ip" field.
func (*NodeUpdate) SetName ¶
func (nu *NodeUpdate) SetName(s string) *NodeUpdate
SetName sets the "name" field.
func (*NodeUpdate) SetNillableComment ¶
func (nu *NodeUpdate) SetNillableComment(s *string) *NodeUpdate
SetNillableComment sets the "comment" field if the given value is not nil.
func (*NodeUpdate) SetNillableName ¶
func (nu *NodeUpdate) SetNillableName(s *string) *NodeUpdate
SetNillableName sets the "name" field if the given value is not nil.
func (*NodeUpdate) SetNillablePort ¶
func (nu *NodeUpdate) SetNillablePort(i *int) *NodeUpdate
SetNillablePort sets the "port" field if the given value is not nil.
func (*NodeUpdate) SetPort ¶
func (nu *NodeUpdate) SetPort(i int) *NodeUpdate
SetPort sets the "port" field.
func (*NodeUpdate) SetUpdatedAt ¶
func (nu *NodeUpdate) SetUpdatedAt(t time.Time) *NodeUpdate
SetUpdatedAt sets the "updated_at" field.
func (*NodeUpdate) Where ¶
func (nu *NodeUpdate) Where(ps ...predicate.Node) *NodeUpdate
Where appends a list predicates to the NodeUpdate builder.
type NodeUpdateOne ¶
type NodeUpdateOne struct {
// contains filtered or unexported fields
}
NodeUpdateOne is the builder for updating a single Node entity.
func (*NodeUpdateOne) AddPort ¶
func (nuo *NodeUpdateOne) AddPort(i int) *NodeUpdateOne
AddPort adds i to the "port" field.
func (*NodeUpdateOne) ClearComment ¶
func (nuo *NodeUpdateOne) ClearComment() *NodeUpdateOne
ClearComment clears the value of the "comment" field.
func (*NodeUpdateOne) ClearName ¶
func (nuo *NodeUpdateOne) ClearName() *NodeUpdateOne
ClearName clears the value of the "name" field.
func (*NodeUpdateOne) Exec ¶
func (nuo *NodeUpdateOne) Exec(ctx context.Context) error
Exec executes the query on the entity.
func (*NodeUpdateOne) ExecX ¶
func (nuo *NodeUpdateOne) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*NodeUpdateOne) Modify ¶
func (nuo *NodeUpdateOne) Modify(modifiers ...func(u *sql.UpdateBuilder)) *NodeUpdateOne
Modify adds a statement modifier for attaching custom logic to the UPDATE statement.
func (*NodeUpdateOne) Mutation ¶
func (nuo *NodeUpdateOne) Mutation() *NodeMutation
Mutation returns the NodeMutation object of the builder.
func (*NodeUpdateOne) Save ¶
func (nuo *NodeUpdateOne) Save(ctx context.Context) (*Node, error)
Save executes the query and returns the updated Node entity.
func (*NodeUpdateOne) SaveX ¶
func (nuo *NodeUpdateOne) SaveX(ctx context.Context) *Node
SaveX is like Save, but panics if an error occurs.
func (*NodeUpdateOne) Select ¶
func (nuo *NodeUpdateOne) Select(field string, fields ...string) *NodeUpdateOne
Select allows selecting one or more fields (columns) of the returned entity. The default is selecting all fields defined in the entity schema.
func (*NodeUpdateOne) SetComment ¶
func (nuo *NodeUpdateOne) SetComment(s string) *NodeUpdateOne
SetComment sets the "comment" field.
func (*NodeUpdateOne) SetIP ¶
func (nuo *NodeUpdateOne) SetIP(s string) *NodeUpdateOne
SetIP sets the "ip" field.
func (*NodeUpdateOne) SetName ¶
func (nuo *NodeUpdateOne) SetName(s string) *NodeUpdateOne
SetName sets the "name" field.
func (*NodeUpdateOne) SetNillableComment ¶
func (nuo *NodeUpdateOne) SetNillableComment(s *string) *NodeUpdateOne
SetNillableComment sets the "comment" field if the given value is not nil.
func (*NodeUpdateOne) SetNillableName ¶
func (nuo *NodeUpdateOne) SetNillableName(s *string) *NodeUpdateOne
SetNillableName sets the "name" field if the given value is not nil.
func (*NodeUpdateOne) SetNillablePort ¶
func (nuo *NodeUpdateOne) SetNillablePort(i *int) *NodeUpdateOne
SetNillablePort sets the "port" field if the given value is not nil.
func (*NodeUpdateOne) SetPort ¶
func (nuo *NodeUpdateOne) SetPort(i int) *NodeUpdateOne
SetPort sets the "port" field.
func (*NodeUpdateOne) SetUpdatedAt ¶
func (nuo *NodeUpdateOne) SetUpdatedAt(t time.Time) *NodeUpdateOne
SetUpdatedAt sets the "updated_at" field.
func (*NodeUpdateOne) Where ¶
func (nuo *NodeUpdateOne) Where(ps ...predicate.Node) *NodeUpdateOne
Where appends a list predicates to the NodeUpdate builder.
type NodeUpsert ¶
NodeUpsert is the "OnConflict" setter.
func (*NodeUpsert) AddPort ¶
func (u *NodeUpsert) AddPort(v int) *NodeUpsert
AddPort adds v to the "port" field.
func (*NodeUpsert) ClearComment ¶
func (u *NodeUpsert) ClearComment() *NodeUpsert
ClearComment clears the value of the "comment" field.
func (*NodeUpsert) ClearName ¶
func (u *NodeUpsert) ClearName() *NodeUpsert
ClearName clears the value of the "name" field.
func (*NodeUpsert) SetComment ¶
func (u *NodeUpsert) SetComment(v string) *NodeUpsert
SetComment sets the "comment" field.
func (*NodeUpsert) SetIP ¶
func (u *NodeUpsert) SetIP(v string) *NodeUpsert
SetIP sets the "ip" field.
func (*NodeUpsert) SetName ¶
func (u *NodeUpsert) SetName(v string) *NodeUpsert
SetName sets the "name" field.
func (*NodeUpsert) SetPort ¶
func (u *NodeUpsert) SetPort(v int) *NodeUpsert
SetPort sets the "port" field.
func (*NodeUpsert) SetUpdatedAt ¶
func (u *NodeUpsert) SetUpdatedAt(v time.Time) *NodeUpsert
SetUpdatedAt sets the "updated_at" field.
func (*NodeUpsert) UpdateComment ¶
func (u *NodeUpsert) UpdateComment() *NodeUpsert
UpdateComment sets the "comment" field to the value that was provided on create.
func (*NodeUpsert) UpdateIP ¶
func (u *NodeUpsert) UpdateIP() *NodeUpsert
UpdateIP sets the "ip" field to the value that was provided on create.
func (*NodeUpsert) UpdateName ¶
func (u *NodeUpsert) UpdateName() *NodeUpsert
UpdateName sets the "name" field to the value that was provided on create.
func (*NodeUpsert) UpdatePort ¶
func (u *NodeUpsert) UpdatePort() *NodeUpsert
UpdatePort sets the "port" field to the value that was provided on create.
func (*NodeUpsert) UpdateUpdatedAt ¶
func (u *NodeUpsert) UpdateUpdatedAt() *NodeUpsert
UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create.
type NodeUpsertBulk ¶
type NodeUpsertBulk struct {
// contains filtered or unexported fields
}
NodeUpsertBulk is the builder for "upsert"-ing a bulk of Node nodes.
func (*NodeUpsertBulk) AddPort ¶
func (u *NodeUpsertBulk) AddPort(v int) *NodeUpsertBulk
AddPort adds v to the "port" field.
func (*NodeUpsertBulk) ClearComment ¶
func (u *NodeUpsertBulk) ClearComment() *NodeUpsertBulk
ClearComment clears the value of the "comment" field.
func (*NodeUpsertBulk) ClearName ¶
func (u *NodeUpsertBulk) ClearName() *NodeUpsertBulk
ClearName clears the value of the "name" field.
func (*NodeUpsertBulk) DoNothing ¶
func (u *NodeUpsertBulk) DoNothing() *NodeUpsertBulk
DoNothing configures the conflict_action to `DO NOTHING`. Supported only by SQLite and PostgreSQL.
func (*NodeUpsertBulk) Exec ¶
func (u *NodeUpsertBulk) Exec(ctx context.Context) error
Exec executes the query.
func (*NodeUpsertBulk) ExecX ¶
func (u *NodeUpsertBulk) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*NodeUpsertBulk) Ignore ¶
func (u *NodeUpsertBulk) Ignore() *NodeUpsertBulk
Ignore sets each column to itself in case of conflict. Using this option is equivalent to using:
client.Node.Create(). OnConflict(sql.ResolveWithIgnore()). Exec(ctx)
func (*NodeUpsertBulk) SetComment ¶
func (u *NodeUpsertBulk) SetComment(v string) *NodeUpsertBulk
SetComment sets the "comment" field.
func (*NodeUpsertBulk) SetIP ¶
func (u *NodeUpsertBulk) SetIP(v string) *NodeUpsertBulk
SetIP sets the "ip" field.
func (*NodeUpsertBulk) SetName ¶
func (u *NodeUpsertBulk) SetName(v string) *NodeUpsertBulk
SetName sets the "name" field.
func (*NodeUpsertBulk) SetPort ¶
func (u *NodeUpsertBulk) SetPort(v int) *NodeUpsertBulk
SetPort sets the "port" field.
func (*NodeUpsertBulk) SetUpdatedAt ¶
func (u *NodeUpsertBulk) SetUpdatedAt(v time.Time) *NodeUpsertBulk
SetUpdatedAt sets the "updated_at" field.
func (*NodeUpsertBulk) Update ¶
func (u *NodeUpsertBulk) Update(set func(*NodeUpsert)) *NodeUpsertBulk
Update allows overriding fields `UPDATE` values. See the NodeCreateBulk.OnConflict documentation for more info.
func (*NodeUpsertBulk) UpdateComment ¶
func (u *NodeUpsertBulk) UpdateComment() *NodeUpsertBulk
UpdateComment sets the "comment" field to the value that was provided on create.
func (*NodeUpsertBulk) UpdateIP ¶
func (u *NodeUpsertBulk) UpdateIP() *NodeUpsertBulk
UpdateIP sets the "ip" field to the value that was provided on create.
func (*NodeUpsertBulk) UpdateName ¶
func (u *NodeUpsertBulk) UpdateName() *NodeUpsertBulk
UpdateName sets the "name" field to the value that was provided on create.
func (*NodeUpsertBulk) UpdateNewValues ¶
func (u *NodeUpsertBulk) UpdateNewValues() *NodeUpsertBulk
UpdateNewValues updates the mutable fields using the new values that were set on create. Using this option is equivalent to using:
client.Node.Create(). OnConflict( sql.ResolveWithNewValues(), sql.ResolveWith(func(u *sql.UpdateSet) { u.SetIgnore(node.FieldID) }), ). Exec(ctx)
func (*NodeUpsertBulk) UpdatePort ¶
func (u *NodeUpsertBulk) UpdatePort() *NodeUpsertBulk
UpdatePort sets the "port" field to the value that was provided on create.
func (*NodeUpsertBulk) UpdateUpdatedAt ¶
func (u *NodeUpsertBulk) UpdateUpdatedAt() *NodeUpsertBulk
UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create.
type NodeUpsertOne ¶
type NodeUpsertOne struct {
// contains filtered or unexported fields
}
NodeUpsertOne is the builder for "upsert"-ing
one Node node.
func (*NodeUpsertOne) AddPort ¶
func (u *NodeUpsertOne) AddPort(v int) *NodeUpsertOne
AddPort adds v to the "port" field.
func (*NodeUpsertOne) ClearComment ¶
func (u *NodeUpsertOne) ClearComment() *NodeUpsertOne
ClearComment clears the value of the "comment" field.
func (*NodeUpsertOne) ClearName ¶
func (u *NodeUpsertOne) ClearName() *NodeUpsertOne
ClearName clears the value of the "name" field.
func (*NodeUpsertOne) DoNothing ¶
func (u *NodeUpsertOne) DoNothing() *NodeUpsertOne
DoNothing configures the conflict_action to `DO NOTHING`. Supported only by SQLite and PostgreSQL.
func (*NodeUpsertOne) Exec ¶
func (u *NodeUpsertOne) Exec(ctx context.Context) error
Exec executes the query.
func (*NodeUpsertOne) ExecX ¶
func (u *NodeUpsertOne) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*NodeUpsertOne) ID ¶
func (u *NodeUpsertOne) ID(ctx context.Context) (id string, err error)
Exec executes the UPSERT query and returns the inserted/updated ID.
func (*NodeUpsertOne) IDX ¶
func (u *NodeUpsertOne) IDX(ctx context.Context) string
IDX is like ID, but panics if an error occurs.
func (*NodeUpsertOne) Ignore ¶
func (u *NodeUpsertOne) Ignore() *NodeUpsertOne
Ignore sets each column to itself in case of conflict. Using this option is equivalent to using:
client.Node.Create(). OnConflict(sql.ResolveWithIgnore()). Exec(ctx)
func (*NodeUpsertOne) SetComment ¶
func (u *NodeUpsertOne) SetComment(v string) *NodeUpsertOne
SetComment sets the "comment" field.
func (*NodeUpsertOne) SetIP ¶
func (u *NodeUpsertOne) SetIP(v string) *NodeUpsertOne
SetIP sets the "ip" field.
func (*NodeUpsertOne) SetName ¶
func (u *NodeUpsertOne) SetName(v string) *NodeUpsertOne
SetName sets the "name" field.
func (*NodeUpsertOne) SetPort ¶
func (u *NodeUpsertOne) SetPort(v int) *NodeUpsertOne
SetPort sets the "port" field.
func (*NodeUpsertOne) SetUpdatedAt ¶
func (u *NodeUpsertOne) SetUpdatedAt(v time.Time) *NodeUpsertOne
SetUpdatedAt sets the "updated_at" field.
func (*NodeUpsertOne) Update ¶
func (u *NodeUpsertOne) Update(set func(*NodeUpsert)) *NodeUpsertOne
Update allows overriding fields `UPDATE` values. See the NodeCreate.OnConflict documentation for more info.
func (*NodeUpsertOne) UpdateComment ¶
func (u *NodeUpsertOne) UpdateComment() *NodeUpsertOne
UpdateComment sets the "comment" field to the value that was provided on create.
func (*NodeUpsertOne) UpdateIP ¶
func (u *NodeUpsertOne) UpdateIP() *NodeUpsertOne
UpdateIP sets the "ip" field to the value that was provided on create.
func (*NodeUpsertOne) UpdateName ¶
func (u *NodeUpsertOne) UpdateName() *NodeUpsertOne
UpdateName sets the "name" field to the value that was provided on create.
func (*NodeUpsertOne) UpdateNewValues ¶
func (u *NodeUpsertOne) UpdateNewValues() *NodeUpsertOne
UpdateNewValues updates the mutable fields using the new values that were set on create except the ID field. Using this option is equivalent to using:
client.Node.Create(). OnConflict( sql.ResolveWithNewValues(), sql.ResolveWith(func(u *sql.UpdateSet) { u.SetIgnore(node.FieldID) }), ). Exec(ctx)
func (*NodeUpsertOne) UpdatePort ¶
func (u *NodeUpsertOne) UpdatePort() *NodeUpsertOne
UpdatePort sets the "port" field to the value that was provided on create.
func (*NodeUpsertOne) UpdateUpdatedAt ¶
func (u *NodeUpsertOne) UpdateUpdatedAt() *NodeUpsertOne
UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create.
type NotFoundError ¶
type NotFoundError struct {
// contains filtered or unexported fields
}
NotFoundError returns when trying to fetch a specific entity and it was not found in the database.
func (*NotFoundError) Error ¶
func (e *NotFoundError) Error() string
Error implements the error interface.
type NotLoadedError ¶
type NotLoadedError struct {
// contains filtered or unexported fields
}
NotLoadedError returns when trying to get a node that was not loaded by the query.
func (*NotLoadedError) Error ¶
func (e *NotLoadedError) Error() string
Error implements the error interface.
type NotSingularError ¶
type NotSingularError struct {
// contains filtered or unexported fields
}
NotSingularError returns when trying to fetch a singular entity and more then one was found in the database.
func (*NotSingularError) Error ¶
func (e *NotSingularError) Error() string
Error implements the error interface.
type OrderFunc ¶
OrderFunc applies an ordering on the sql selector. Deprecated: Use Asc/Desc functions or the package builders instead.
type QuerierFunc ¶
type QuerierFunc = ent.QuerierFunc
ent aliases to avoid import conflicts in user's code.
type QueryContext ¶
type QueryContext = ent.QueryContext
ent aliases to avoid import conflicts in user's code.
type RollbackFunc ¶
The RollbackFunc type is an adapter to allow the use of ordinary function as a Rollbacker. If f is a function with the appropriate signature, RollbackFunc(f) is a Rollbacker that calls f.
type RollbackHook ¶
type RollbackHook func(Rollbacker) Rollbacker
RollbackHook defines the "rollback middleware". A function that gets a Rollbacker and returns a Rollbacker. For example:
hook := func(next ent.Rollbacker) ent.Rollbacker { return ent.RollbackFunc(func(ctx context.Context, tx *ent.Tx) error { // Do some stuff before. if err := next.Rollback(ctx, tx); err != nil { return err } // Do some stuff after. return nil }) }
type Rollbacker ¶
Rollbacker is the interface that wraps the Rollback method.
type TraverseFunc ¶
type TraverseFunc = ent.TraverseFunc
ent aliases to avoid import conflicts in user's code.
type Tx ¶
type Tx struct { // KV is the client for interacting with the KV builders. KV *KVClient // Node is the client for interacting with the Node builders. Node *NodeClient // contains filtered or unexported fields }
Tx is a transactional client that is created by calling Client.Tx().
func TxFromContext ¶
TxFromContext returns a Tx stored inside a context, or nil if there isn't one.
func (*Tx) OnRollback ¶
func (tx *Tx) OnRollback(f RollbackHook)
OnRollback adds a hook to call on rollback.
type ValidationError ¶
type ValidationError struct { Name string // Field or edge name. // contains filtered or unexported fields }
ValidationError returns when validating a field or edge fails.
func (*ValidationError) Error ¶
func (e *ValidationError) Error() string
Error implements the error interface.
func (*ValidationError) Unwrap ¶
func (e *ValidationError) Unwrap() error
Unwrap implements the errors.Wrapper interface.