Documentation
¶
Overview ¶
Package ent provides the generated Ent client and types.
Index ¶
- Constants
- Variables
- func Asc(fields ...string) func(*sql.Selector)
- func Desc(fields ...string) func(*sql.Selector)
- func IsConstraintError(err error) bool
- func IsNotFound(err error) bool
- func IsNotLoaded(err error) bool
- func IsNotSingular(err error) bool
- func IsValidationError(err error) bool
- func MaskNotFound(err error) error
- func NewContext(parent context.Context, c *Client) context.Context
- func NewTxContext(parent context.Context, tx *Tx) context.Context
- type Agent
- type AgentClient
- func (c *AgentClient) Create() *AgentCreate
- func (c *AgentClient) CreateBulk(builders ...*AgentCreate) *AgentCreateBulk
- func (c *AgentClient) Delete() *AgentDelete
- func (c *AgentClient) DeleteOne(_m *Agent) *AgentDeleteOne
- func (c *AgentClient) DeleteOneID(id string) *AgentDeleteOne
- func (c *AgentClient) Get(ctx context.Context, id string) (*Agent, error)
- func (c *AgentClient) GetX(ctx context.Context, id string) *Agent
- func (c *AgentClient) Hooks() []Hook
- func (c *AgentClient) Intercept(interceptors ...Interceptor)
- func (c *AgentClient) Interceptors() []Interceptor
- func (c *AgentClient) MapCreateBulk(slice any, setFunc func(*AgentCreate, int)) *AgentCreateBulk
- func (c *AgentClient) Query() *AgentQuery
- func (c *AgentClient) Update() *AgentUpdate
- func (c *AgentClient) UpdateOne(_m *Agent) *AgentUpdateOne
- func (c *AgentClient) UpdateOneID(id string) *AgentUpdateOne
- func (c *AgentClient) Use(hooks ...Hook)
- type AgentCreate
- func (_c *AgentCreate) Exec(ctx context.Context) error
- func (_c *AgentCreate) ExecX(ctx context.Context)
- func (_c *AgentCreate) Mutation() *AgentMutation
- func (_c *AgentCreate) Save(ctx context.Context) (*Agent, error)
- func (_c *AgentCreate) SaveX(ctx context.Context) *Agent
- func (_c *AgentCreate) SetChannelID(v string) *AgentCreate
- func (_c *AgentCreate) SetConfig(v map[string]interface{}) *AgentCreate
- func (_c *AgentCreate) SetID(v string) *AgentCreate
- func (_c *AgentCreate) SetNillableStatus(v *agent.Status) *AgentCreate
- func (_c *AgentCreate) SetNillableTenantID(v *string) *AgentCreate
- func (_c *AgentCreate) SetStatus(v agent.Status) *AgentCreate
- func (_c *AgentCreate) SetTenantID(v string) *AgentCreate
- func (_c *AgentCreate) SetType(v agent.Type) *AgentCreate
- type AgentCreateBulk
- type AgentDelete
- type AgentDeleteOne
- type AgentGroupBy
- func (_g *AgentGroupBy) Aggregate(fns ...AggregateFunc) *AgentGroupBy
- func (s *AgentGroupBy) Bool(ctx context.Context) (_ bool, err error)
- func (s *AgentGroupBy) BoolX(ctx context.Context) bool
- func (s *AgentGroupBy) Bools(ctx context.Context) ([]bool, error)
- func (s *AgentGroupBy) BoolsX(ctx context.Context) []bool
- func (s *AgentGroupBy) Float64(ctx context.Context) (_ float64, err error)
- func (s *AgentGroupBy) Float64X(ctx context.Context) float64
- func (s *AgentGroupBy) Float64s(ctx context.Context) ([]float64, error)
- func (s *AgentGroupBy) Float64sX(ctx context.Context) []float64
- func (s *AgentGroupBy) Int(ctx context.Context) (_ int, err error)
- func (s *AgentGroupBy) IntX(ctx context.Context) int
- func (s *AgentGroupBy) Ints(ctx context.Context) ([]int, error)
- func (s *AgentGroupBy) IntsX(ctx context.Context) []int
- func (_g *AgentGroupBy) Scan(ctx context.Context, v any) error
- func (s *AgentGroupBy) ScanX(ctx context.Context, v any)
- func (s *AgentGroupBy) String(ctx context.Context) (_ string, err error)
- func (s *AgentGroupBy) StringX(ctx context.Context) string
- func (s *AgentGroupBy) Strings(ctx context.Context) ([]string, error)
- func (s *AgentGroupBy) StringsX(ctx context.Context) []string
- type AgentMutation
- func (m *AgentMutation) AddField(name string, value ent.Value) error
- func (m *AgentMutation) AddedEdges() []string
- func (m *AgentMutation) AddedField(name string) (ent.Value, bool)
- func (m *AgentMutation) AddedFields() []string
- func (m *AgentMutation) AddedIDs(name string) []ent.Value
- func (m *AgentMutation) ChannelID() (r string, exists bool)
- func (m *AgentMutation) ClearEdge(name string) error
- func (m *AgentMutation) ClearField(name string) error
- func (m *AgentMutation) ClearedEdges() []string
- func (m *AgentMutation) ClearedFields() []string
- func (m AgentMutation) Client() *Client
- func (m *AgentMutation) Config() (r map[string]interface{}, exists bool)
- func (m *AgentMutation) EdgeCleared(name string) bool
- func (m *AgentMutation) Field(name string) (ent.Value, bool)
- func (m *AgentMutation) FieldCleared(name string) bool
- func (m *AgentMutation) Fields() []string
- func (m *AgentMutation) GetType() (r agent.Type, exists bool)
- func (m *AgentMutation) ID() (id string, exists bool)
- func (m *AgentMutation) IDs(ctx context.Context) ([]string, error)
- func (m *AgentMutation) OldChannelID(ctx context.Context) (v string, err error)
- func (m *AgentMutation) OldConfig(ctx context.Context) (v map[string]interface{}, err error)
- func (m *AgentMutation) OldField(ctx context.Context, name string) (ent.Value, error)
- func (m *AgentMutation) OldStatus(ctx context.Context) (v agent.Status, err error)
- func (m *AgentMutation) OldTenantID(ctx context.Context) (v string, err error)
- func (m *AgentMutation) OldType(ctx context.Context) (v agent.Type, err error)
- func (m *AgentMutation) Op() Op
- func (m *AgentMutation) RemovedEdges() []string
- func (m *AgentMutation) RemovedIDs(name string) []ent.Value
- func (m *AgentMutation) ResetChannelID()
- func (m *AgentMutation) ResetConfig()
- func (m *AgentMutation) ResetEdge(name string) error
- func (m *AgentMutation) ResetField(name string) error
- func (m *AgentMutation) ResetStatus()
- func (m *AgentMutation) ResetTenantID()
- func (m *AgentMutation) ResetType()
- func (m *AgentMutation) SetChannelID(s string)
- func (m *AgentMutation) SetConfig(value map[string]interface{})
- func (m *AgentMutation) SetField(name string, value ent.Value) error
- func (m *AgentMutation) SetID(id string)
- func (m *AgentMutation) SetOp(op Op)
- func (m *AgentMutation) SetStatus(a agent.Status)
- func (m *AgentMutation) SetTenantID(s string)
- func (m *AgentMutation) SetType(a agent.Type)
- func (m *AgentMutation) Status() (r agent.Status, exists bool)
- func (m *AgentMutation) TenantID() (r string, exists bool)
- func (m AgentMutation) Tx() (*Tx, error)
- func (m *AgentMutation) Type() string
- func (m *AgentMutation) Where(ps ...predicate.Agent)
- func (m *AgentMutation) WhereP(ps ...func(*sql.Selector))
- type AgentQuery
- func (_q *AgentQuery) Aggregate(fns ...AggregateFunc) *AgentSelect
- func (_q *AgentQuery) All(ctx context.Context) ([]*Agent, error)
- func (_q *AgentQuery) AllX(ctx context.Context) []*Agent
- func (_q *AgentQuery) Clone() *AgentQuery
- func (_q *AgentQuery) Count(ctx context.Context) (int, error)
- func (_q *AgentQuery) CountX(ctx context.Context) int
- func (_q *AgentQuery) Exist(ctx context.Context) (bool, error)
- func (_q *AgentQuery) ExistX(ctx context.Context) bool
- func (_q *AgentQuery) First(ctx context.Context) (*Agent, error)
- func (_q *AgentQuery) FirstID(ctx context.Context) (id string, err error)
- func (_q *AgentQuery) FirstIDX(ctx context.Context) string
- func (_q *AgentQuery) FirstX(ctx context.Context) *Agent
- func (_q *AgentQuery) GroupBy(field string, fields ...string) *AgentGroupBy
- func (_q *AgentQuery) IDs(ctx context.Context) (ids []string, err error)
- func (_q *AgentQuery) IDsX(ctx context.Context) []string
- func (_q *AgentQuery) Limit(limit int) *AgentQuery
- func (_q *AgentQuery) Offset(offset int) *AgentQuery
- func (_q *AgentQuery) Only(ctx context.Context) (*Agent, error)
- func (_q *AgentQuery) OnlyID(ctx context.Context) (id string, err error)
- func (_q *AgentQuery) OnlyIDX(ctx context.Context) string
- func (_q *AgentQuery) OnlyX(ctx context.Context) *Agent
- func (_q *AgentQuery) Order(o ...agent.OrderOption) *AgentQuery
- func (_q *AgentQuery) Select(fields ...string) *AgentSelect
- func (_q *AgentQuery) Unique(unique bool) *AgentQuery
- func (_q *AgentQuery) Where(ps ...predicate.Agent) *AgentQuery
- type AgentSelect
- func (_s *AgentSelect) Aggregate(fns ...AggregateFunc) *AgentSelect
- func (s *AgentSelect) Bool(ctx context.Context) (_ bool, err error)
- func (s *AgentSelect) BoolX(ctx context.Context) bool
- func (s *AgentSelect) Bools(ctx context.Context) ([]bool, error)
- func (s *AgentSelect) BoolsX(ctx context.Context) []bool
- func (s *AgentSelect) Float64(ctx context.Context) (_ float64, err error)
- func (s *AgentSelect) Float64X(ctx context.Context) float64
- func (s *AgentSelect) Float64s(ctx context.Context) ([]float64, error)
- func (s *AgentSelect) Float64sX(ctx context.Context) []float64
- func (s *AgentSelect) Int(ctx context.Context) (_ int, err error)
- func (s *AgentSelect) IntX(ctx context.Context) int
- func (s *AgentSelect) Ints(ctx context.Context) ([]int, error)
- func (s *AgentSelect) IntsX(ctx context.Context) []int
- func (_s *AgentSelect) Scan(ctx context.Context, v any) error
- func (s *AgentSelect) ScanX(ctx context.Context, v any)
- func (s *AgentSelect) String(ctx context.Context) (_ string, err error)
- func (s *AgentSelect) StringX(ctx context.Context) string
- func (s *AgentSelect) Strings(ctx context.Context) ([]string, error)
- func (s *AgentSelect) StringsX(ctx context.Context) []string
- type AgentUpdate
- func (_u *AgentUpdate) Exec(ctx context.Context) error
- func (_u *AgentUpdate) ExecX(ctx context.Context)
- func (_u *AgentUpdate) Mutation() *AgentMutation
- func (_u *AgentUpdate) Save(ctx context.Context) (int, error)
- func (_u *AgentUpdate) SaveX(ctx context.Context) int
- func (_u *AgentUpdate) SetChannelID(v string) *AgentUpdate
- func (_u *AgentUpdate) SetConfig(v map[string]interface{}) *AgentUpdate
- func (_u *AgentUpdate) SetNillableChannelID(v *string) *AgentUpdate
- func (_u *AgentUpdate) SetNillableStatus(v *agent.Status) *AgentUpdate
- func (_u *AgentUpdate) SetNillableTenantID(v *string) *AgentUpdate
- func (_u *AgentUpdate) SetNillableType(v *agent.Type) *AgentUpdate
- func (_u *AgentUpdate) SetStatus(v agent.Status) *AgentUpdate
- func (_u *AgentUpdate) SetTenantID(v string) *AgentUpdate
- func (_u *AgentUpdate) SetType(v agent.Type) *AgentUpdate
- func (_u *AgentUpdate) Where(ps ...predicate.Agent) *AgentUpdate
- type AgentUpdateOne
- func (_u *AgentUpdateOne) Exec(ctx context.Context) error
- func (_u *AgentUpdateOne) ExecX(ctx context.Context)
- func (_u *AgentUpdateOne) Mutation() *AgentMutation
- func (_u *AgentUpdateOne) Save(ctx context.Context) (*Agent, error)
- func (_u *AgentUpdateOne) SaveX(ctx context.Context) *Agent
- func (_u *AgentUpdateOne) Select(field string, fields ...string) *AgentUpdateOne
- func (_u *AgentUpdateOne) SetChannelID(v string) *AgentUpdateOne
- func (_u *AgentUpdateOne) SetConfig(v map[string]interface{}) *AgentUpdateOne
- func (_u *AgentUpdateOne) SetNillableChannelID(v *string) *AgentUpdateOne
- func (_u *AgentUpdateOne) SetNillableStatus(v *agent.Status) *AgentUpdateOne
- func (_u *AgentUpdateOne) SetNillableTenantID(v *string) *AgentUpdateOne
- func (_u *AgentUpdateOne) SetNillableType(v *agent.Type) *AgentUpdateOne
- func (_u *AgentUpdateOne) SetStatus(v agent.Status) *AgentUpdateOne
- func (_u *AgentUpdateOne) SetTenantID(v string) *AgentUpdateOne
- func (_u *AgentUpdateOne) SetType(v agent.Type) *AgentUpdateOne
- func (_u *AgentUpdateOne) Where(ps ...predicate.Agent) *AgentUpdateOne
- type Agents
- 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 Event
- type EventClient
- func (c *EventClient) Create() *EventCreate
- func (c *EventClient) CreateBulk(builders ...*EventCreate) *EventCreateBulk
- func (c *EventClient) Delete() *EventDelete
- func (c *EventClient) DeleteOne(_m *Event) *EventDeleteOne
- func (c *EventClient) DeleteOneID(id string) *EventDeleteOne
- func (c *EventClient) Get(ctx context.Context, id string) (*Event, error)
- func (c *EventClient) GetX(ctx context.Context, id string) *Event
- func (c *EventClient) Hooks() []Hook
- func (c *EventClient) Intercept(interceptors ...Interceptor)
- func (c *EventClient) Interceptors() []Interceptor
- func (c *EventClient) MapCreateBulk(slice any, setFunc func(*EventCreate, int)) *EventCreateBulk
- func (c *EventClient) Query() *EventQuery
- func (c *EventClient) Update() *EventUpdate
- func (c *EventClient) UpdateOne(_m *Event) *EventUpdateOne
- func (c *EventClient) UpdateOneID(id string) *EventUpdateOne
- func (c *EventClient) Use(hooks ...Hook)
- type EventCreate
- func (_c *EventCreate) Exec(ctx context.Context) error
- func (_c *EventCreate) ExecX(ctx context.Context)
- func (_c *EventCreate) Mutation() *EventMutation
- func (_c *EventCreate) Save(ctx context.Context) (*Event, error)
- func (_c *EventCreate) SaveX(ctx context.Context) *Event
- func (_c *EventCreate) SetAgentID(v string) *EventCreate
- func (_c *EventCreate) SetChannelID(v string) *EventCreate
- func (_c *EventCreate) SetID(v string) *EventCreate
- func (_c *EventCreate) SetNillableSourceAgentID(v *string) *EventCreate
- func (_c *EventCreate) SetNillableStatus(v *event.Status) *EventCreate
- func (_c *EventCreate) SetNillableTenantID(v *string) *EventCreate
- func (_c *EventCreate) SetNillableTimestamp(v *time.Time) *EventCreate
- func (_c *EventCreate) SetPayload(v map[string]interface{}) *EventCreate
- func (_c *EventCreate) SetRole(v event.Role) *EventCreate
- func (_c *EventCreate) SetSourceAgentID(v string) *EventCreate
- func (_c *EventCreate) SetStatus(v event.Status) *EventCreate
- func (_c *EventCreate) SetTenantID(v string) *EventCreate
- func (_c *EventCreate) SetTimestamp(v time.Time) *EventCreate
- func (_c *EventCreate) SetType(v event.Type) *EventCreate
- type EventCreateBulk
- type EventDelete
- type EventDeleteOne
- type EventGroupBy
- func (_g *EventGroupBy) Aggregate(fns ...AggregateFunc) *EventGroupBy
- func (s *EventGroupBy) Bool(ctx context.Context) (_ bool, err error)
- func (s *EventGroupBy) BoolX(ctx context.Context) bool
- func (s *EventGroupBy) Bools(ctx context.Context) ([]bool, error)
- func (s *EventGroupBy) BoolsX(ctx context.Context) []bool
- func (s *EventGroupBy) Float64(ctx context.Context) (_ float64, err error)
- func (s *EventGroupBy) Float64X(ctx context.Context) float64
- func (s *EventGroupBy) Float64s(ctx context.Context) ([]float64, error)
- func (s *EventGroupBy) Float64sX(ctx context.Context) []float64
- func (s *EventGroupBy) Int(ctx context.Context) (_ int, err error)
- func (s *EventGroupBy) IntX(ctx context.Context) int
- func (s *EventGroupBy) Ints(ctx context.Context) ([]int, error)
- func (s *EventGroupBy) IntsX(ctx context.Context) []int
- func (_g *EventGroupBy) Scan(ctx context.Context, v any) error
- func (s *EventGroupBy) ScanX(ctx context.Context, v any)
- func (s *EventGroupBy) String(ctx context.Context) (_ string, err error)
- func (s *EventGroupBy) StringX(ctx context.Context) string
- func (s *EventGroupBy) Strings(ctx context.Context) ([]string, error)
- func (s *EventGroupBy) StringsX(ctx context.Context) []string
- type EventMutation
- func (m *EventMutation) AddField(name string, value ent.Value) error
- func (m *EventMutation) AddedEdges() []string
- func (m *EventMutation) AddedField(name string) (ent.Value, bool)
- func (m *EventMutation) AddedFields() []string
- func (m *EventMutation) AddedIDs(name string) []ent.Value
- func (m *EventMutation) AgentID() (r string, exists bool)
- func (m *EventMutation) ChannelID() (r string, exists bool)
- func (m *EventMutation) ClearEdge(name string) error
- func (m *EventMutation) ClearField(name string) error
- func (m *EventMutation) ClearSourceAgentID()
- func (m *EventMutation) ClearedEdges() []string
- func (m *EventMutation) ClearedFields() []string
- func (m EventMutation) Client() *Client
- func (m *EventMutation) EdgeCleared(name string) bool
- func (m *EventMutation) Field(name string) (ent.Value, bool)
- func (m *EventMutation) FieldCleared(name string) bool
- func (m *EventMutation) Fields() []string
- func (m *EventMutation) GetType() (r event.Type, exists bool)
- func (m *EventMutation) ID() (id string, exists bool)
- func (m *EventMutation) IDs(ctx context.Context) ([]string, error)
- func (m *EventMutation) OldAgentID(ctx context.Context) (v string, err error)
- func (m *EventMutation) OldChannelID(ctx context.Context) (v string, err error)
- func (m *EventMutation) OldField(ctx context.Context, name string) (ent.Value, error)
- func (m *EventMutation) OldPayload(ctx context.Context) (v map[string]interface{}, err error)
- func (m *EventMutation) OldRole(ctx context.Context) (v event.Role, err error)
- func (m *EventMutation) OldSourceAgentID(ctx context.Context) (v string, err error)
- func (m *EventMutation) OldStatus(ctx context.Context) (v event.Status, err error)
- func (m *EventMutation) OldTenantID(ctx context.Context) (v string, err error)
- func (m *EventMutation) OldTimestamp(ctx context.Context) (v time.Time, err error)
- func (m *EventMutation) OldType(ctx context.Context) (v event.Type, err error)
- func (m *EventMutation) Op() Op
- func (m *EventMutation) Payload() (r map[string]interface{}, exists bool)
- func (m *EventMutation) RemovedEdges() []string
- func (m *EventMutation) RemovedIDs(name string) []ent.Value
- func (m *EventMutation) ResetAgentID()
- func (m *EventMutation) ResetChannelID()
- func (m *EventMutation) ResetEdge(name string) error
- func (m *EventMutation) ResetField(name string) error
- func (m *EventMutation) ResetPayload()
- func (m *EventMutation) ResetRole()
- func (m *EventMutation) ResetSourceAgentID()
- func (m *EventMutation) ResetStatus()
- func (m *EventMutation) ResetTenantID()
- func (m *EventMutation) ResetTimestamp()
- func (m *EventMutation) ResetType()
- func (m *EventMutation) Role() (r event.Role, exists bool)
- func (m *EventMutation) SetAgentID(s string)
- func (m *EventMutation) SetChannelID(s string)
- func (m *EventMutation) SetField(name string, value ent.Value) error
- func (m *EventMutation) SetID(id string)
- func (m *EventMutation) SetOp(op Op)
- func (m *EventMutation) SetPayload(value map[string]interface{})
- func (m *EventMutation) SetRole(e event.Role)
- func (m *EventMutation) SetSourceAgentID(s string)
- func (m *EventMutation) SetStatus(e event.Status)
- func (m *EventMutation) SetTenantID(s string)
- func (m *EventMutation) SetTimestamp(t time.Time)
- func (m *EventMutation) SetType(e event.Type)
- func (m *EventMutation) SourceAgentID() (r string, exists bool)
- func (m *EventMutation) SourceAgentIDCleared() bool
- func (m *EventMutation) Status() (r event.Status, exists bool)
- func (m *EventMutation) TenantID() (r string, exists bool)
- func (m *EventMutation) Timestamp() (r time.Time, exists bool)
- func (m EventMutation) Tx() (*Tx, error)
- func (m *EventMutation) Type() string
- func (m *EventMutation) Where(ps ...predicate.Event)
- func (m *EventMutation) WhereP(ps ...func(*sql.Selector))
- type EventQuery
- func (_q *EventQuery) Aggregate(fns ...AggregateFunc) *EventSelect
- func (_q *EventQuery) All(ctx context.Context) ([]*Event, error)
- func (_q *EventQuery) AllX(ctx context.Context) []*Event
- func (_q *EventQuery) Clone() *EventQuery
- func (_q *EventQuery) Count(ctx context.Context) (int, error)
- func (_q *EventQuery) CountX(ctx context.Context) int
- func (_q *EventQuery) Exist(ctx context.Context) (bool, error)
- func (_q *EventQuery) ExistX(ctx context.Context) bool
- func (_q *EventQuery) First(ctx context.Context) (*Event, error)
- func (_q *EventQuery) FirstID(ctx context.Context) (id string, err error)
- func (_q *EventQuery) FirstIDX(ctx context.Context) string
- func (_q *EventQuery) FirstX(ctx context.Context) *Event
- func (_q *EventQuery) GroupBy(field string, fields ...string) *EventGroupBy
- func (_q *EventQuery) IDs(ctx context.Context) (ids []string, err error)
- func (_q *EventQuery) IDsX(ctx context.Context) []string
- func (_q *EventQuery) Limit(limit int) *EventQuery
- func (_q *EventQuery) Offset(offset int) *EventQuery
- func (_q *EventQuery) Only(ctx context.Context) (*Event, error)
- func (_q *EventQuery) OnlyID(ctx context.Context) (id string, err error)
- func (_q *EventQuery) OnlyIDX(ctx context.Context) string
- func (_q *EventQuery) OnlyX(ctx context.Context) *Event
- func (_q *EventQuery) Order(o ...event.OrderOption) *EventQuery
- func (_q *EventQuery) Select(fields ...string) *EventSelect
- func (_q *EventQuery) Unique(unique bool) *EventQuery
- func (_q *EventQuery) Where(ps ...predicate.Event) *EventQuery
- type EventSelect
- func (_s *EventSelect) Aggregate(fns ...AggregateFunc) *EventSelect
- func (s *EventSelect) Bool(ctx context.Context) (_ bool, err error)
- func (s *EventSelect) BoolX(ctx context.Context) bool
- func (s *EventSelect) Bools(ctx context.Context) ([]bool, error)
- func (s *EventSelect) BoolsX(ctx context.Context) []bool
- func (s *EventSelect) Float64(ctx context.Context) (_ float64, err error)
- func (s *EventSelect) Float64X(ctx context.Context) float64
- func (s *EventSelect) Float64s(ctx context.Context) ([]float64, error)
- func (s *EventSelect) Float64sX(ctx context.Context) []float64
- func (s *EventSelect) Int(ctx context.Context) (_ int, err error)
- func (s *EventSelect) IntX(ctx context.Context) int
- func (s *EventSelect) Ints(ctx context.Context) ([]int, error)
- func (s *EventSelect) IntsX(ctx context.Context) []int
- func (_s *EventSelect) Scan(ctx context.Context, v any) error
- func (s *EventSelect) ScanX(ctx context.Context, v any)
- func (s *EventSelect) String(ctx context.Context) (_ string, err error)
- func (s *EventSelect) StringX(ctx context.Context) string
- func (s *EventSelect) Strings(ctx context.Context) ([]string, error)
- func (s *EventSelect) StringsX(ctx context.Context) []string
- type EventUpdate
- func (_u *EventUpdate) ClearSourceAgentID() *EventUpdate
- func (_u *EventUpdate) Exec(ctx context.Context) error
- func (_u *EventUpdate) ExecX(ctx context.Context)
- func (_u *EventUpdate) Mutation() *EventMutation
- func (_u *EventUpdate) Save(ctx context.Context) (int, error)
- func (_u *EventUpdate) SaveX(ctx context.Context) int
- func (_u *EventUpdate) SetAgentID(v string) *EventUpdate
- func (_u *EventUpdate) SetChannelID(v string) *EventUpdate
- func (_u *EventUpdate) SetNillableAgentID(v *string) *EventUpdate
- func (_u *EventUpdate) SetNillableChannelID(v *string) *EventUpdate
- func (_u *EventUpdate) SetNillableRole(v *event.Role) *EventUpdate
- func (_u *EventUpdate) SetNillableSourceAgentID(v *string) *EventUpdate
- func (_u *EventUpdate) SetNillableStatus(v *event.Status) *EventUpdate
- func (_u *EventUpdate) SetNillableTenantID(v *string) *EventUpdate
- func (_u *EventUpdate) SetNillableTimestamp(v *time.Time) *EventUpdate
- func (_u *EventUpdate) SetNillableType(v *event.Type) *EventUpdate
- func (_u *EventUpdate) SetPayload(v map[string]interface{}) *EventUpdate
- func (_u *EventUpdate) SetRole(v event.Role) *EventUpdate
- func (_u *EventUpdate) SetSourceAgentID(v string) *EventUpdate
- func (_u *EventUpdate) SetStatus(v event.Status) *EventUpdate
- func (_u *EventUpdate) SetTenantID(v string) *EventUpdate
- func (_u *EventUpdate) SetTimestamp(v time.Time) *EventUpdate
- func (_u *EventUpdate) SetType(v event.Type) *EventUpdate
- func (_u *EventUpdate) Where(ps ...predicate.Event) *EventUpdate
- type EventUpdateOne
- func (_u *EventUpdateOne) ClearSourceAgentID() *EventUpdateOne
- func (_u *EventUpdateOne) Exec(ctx context.Context) error
- func (_u *EventUpdateOne) ExecX(ctx context.Context)
- func (_u *EventUpdateOne) Mutation() *EventMutation
- func (_u *EventUpdateOne) Save(ctx context.Context) (*Event, error)
- func (_u *EventUpdateOne) SaveX(ctx context.Context) *Event
- func (_u *EventUpdateOne) Select(field string, fields ...string) *EventUpdateOne
- func (_u *EventUpdateOne) SetAgentID(v string) *EventUpdateOne
- func (_u *EventUpdateOne) SetChannelID(v string) *EventUpdateOne
- func (_u *EventUpdateOne) SetNillableAgentID(v *string) *EventUpdateOne
- func (_u *EventUpdateOne) SetNillableChannelID(v *string) *EventUpdateOne
- func (_u *EventUpdateOne) SetNillableRole(v *event.Role) *EventUpdateOne
- func (_u *EventUpdateOne) SetNillableSourceAgentID(v *string) *EventUpdateOne
- func (_u *EventUpdateOne) SetNillableStatus(v *event.Status) *EventUpdateOne
- func (_u *EventUpdateOne) SetNillableTenantID(v *string) *EventUpdateOne
- func (_u *EventUpdateOne) SetNillableTimestamp(v *time.Time) *EventUpdateOne
- func (_u *EventUpdateOne) SetNillableType(v *event.Type) *EventUpdateOne
- func (_u *EventUpdateOne) SetPayload(v map[string]interface{}) *EventUpdateOne
- func (_u *EventUpdateOne) SetRole(v event.Role) *EventUpdateOne
- func (_u *EventUpdateOne) SetSourceAgentID(v string) *EventUpdateOne
- func (_u *EventUpdateOne) SetStatus(v event.Status) *EventUpdateOne
- func (_u *EventUpdateOne) SetTenantID(v string) *EventUpdateOne
- func (_u *EventUpdateOne) SetTimestamp(v time.Time) *EventUpdateOne
- func (_u *EventUpdateOne) SetType(v event.Type) *EventUpdateOne
- func (_u *EventUpdateOne) Where(ps ...predicate.Event) *EventUpdateOne
- type Events
- type Hook
- type InterceptFunc
- type Interceptor
- type MutateFunc
- type Mutation
- type Mutator
- type NotFoundError
- type NotLoadedError
- type NotSingularError
- type Op
- type Option
- type OrderFunc
- type Policy
- type Querier
- type QuerierFunc
- type Query
- type QueryContext
- type RollbackFunc
- type RollbackHook
- type Rollbacker
- type 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. TypeAgent = "Agent" TypeEvent = "Event" )
Variables ¶
var ErrTxStarted = errors.New("ent: cannot start a transaction within a transaction")
ErrTxStarted is returned when trying to start a new transaction from a transactional client.
Functions ¶
func IsConstraintError ¶
IsConstraintError returns a boolean indicating whether the error is a constraint failure.
func IsNotFound ¶
IsNotFound returns a boolean indicating whether the error is a not found error.
func IsNotLoaded ¶
IsNotLoaded returns a boolean indicating whether the error is a not loaded error.
func IsNotSingular ¶
IsNotSingular returns a boolean indicating whether the error is a not singular error.
func IsValidationError ¶
IsValidationError returns a boolean indicating whether the error is a validation error.
func NewContext ¶
NewContext returns a new context with the given Client attached.
Types ¶
type Agent ¶
type Agent struct {
// ID of the ent.
// Agent ID (e.g., backend, frontend)
ID string `json:"id,omitempty"`
// Tenant ID for multi-tenancy
TenantID string `json:"tenant_id,omitempty"`
// Agent adapter type
Type agent.Type `json:"type,omitempty"`
// Adapter configuration (session, pane, etc.)
Config map[string]interface{} `json:"config,omitempty"`
// Bound communication channel
ChannelID string `json:"channel_id,omitempty"`
// Agent availability status
Status agent.Status `json:"status,omitempty"`
// contains filtered or unexported fields
}
Agent is the model entity for the Agent schema.
func (*Agent) Unwrap ¶
Unwrap unwraps the Agent 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 (*Agent) Update ¶
func (_m *Agent) Update() *AgentUpdateOne
Update returns a builder for updating this Agent. Note that you need to call Agent.Unwrap() before calling this method if this Agent was returned from a transaction, and the transaction was committed or rolled back.
type AgentClient ¶
type AgentClient struct {
// contains filtered or unexported fields
}
AgentClient is a client for the Agent schema.
func NewAgentClient ¶
func NewAgentClient(c config) *AgentClient
NewAgentClient returns a client for the Agent from the given config.
func (*AgentClient) Create ¶
func (c *AgentClient) Create() *AgentCreate
Create returns a builder for creating a Agent entity.
func (*AgentClient) CreateBulk ¶
func (c *AgentClient) CreateBulk(builders ...*AgentCreate) *AgentCreateBulk
CreateBulk returns a builder for creating a bulk of Agent entities.
func (*AgentClient) Delete ¶
func (c *AgentClient) Delete() *AgentDelete
Delete returns a delete builder for Agent.
func (*AgentClient) DeleteOne ¶
func (c *AgentClient) DeleteOne(_m *Agent) *AgentDeleteOne
DeleteOne returns a builder for deleting the given entity.
func (*AgentClient) DeleteOneID ¶
func (c *AgentClient) DeleteOneID(id string) *AgentDeleteOne
DeleteOneID returns a builder for deleting the given entity by its id.
func (*AgentClient) GetX ¶
func (c *AgentClient) GetX(ctx context.Context, id string) *Agent
GetX is like Get, but panics if an error occurs.
func (*AgentClient) Intercept ¶
func (c *AgentClient) Intercept(interceptors ...Interceptor)
Intercept adds a list of query interceptors to the interceptors stack. A call to `Intercept(f, g, h)` equals to `agent.Intercept(f(g(h())))`.
func (*AgentClient) Interceptors ¶
func (c *AgentClient) Interceptors() []Interceptor
Interceptors returns the client interceptors.
func (*AgentClient) MapCreateBulk ¶
func (c *AgentClient) MapCreateBulk(slice any, setFunc func(*AgentCreate, int)) *AgentCreateBulk
MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates a builder and applies setFunc on it.
func (*AgentClient) Query ¶
func (c *AgentClient) Query() *AgentQuery
Query returns a query builder for Agent.
func (*AgentClient) Update ¶
func (c *AgentClient) Update() *AgentUpdate
Update returns an update builder for Agent.
func (*AgentClient) UpdateOne ¶
func (c *AgentClient) UpdateOne(_m *Agent) *AgentUpdateOne
UpdateOne returns an update builder for the given entity.
func (*AgentClient) UpdateOneID ¶
func (c *AgentClient) UpdateOneID(id string) *AgentUpdateOne
UpdateOneID returns an update builder for the given id.
func (*AgentClient) Use ¶
func (c *AgentClient) Use(hooks ...Hook)
Use adds a list of mutation hooks to the hooks stack. A call to `Use(f, g, h)` equals to `agent.Hooks(f(g(h())))`.
type AgentCreate ¶
type AgentCreate struct {
// contains filtered or unexported fields
}
AgentCreate is the builder for creating a Agent entity.
func (*AgentCreate) Exec ¶
func (_c *AgentCreate) Exec(ctx context.Context) error
Exec executes the query.
func (*AgentCreate) ExecX ¶
func (_c *AgentCreate) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*AgentCreate) Mutation ¶
func (_c *AgentCreate) Mutation() *AgentMutation
Mutation returns the AgentMutation object of the builder.
func (*AgentCreate) Save ¶
func (_c *AgentCreate) Save(ctx context.Context) (*Agent, error)
Save creates the Agent in the database.
func (*AgentCreate) SaveX ¶
func (_c *AgentCreate) SaveX(ctx context.Context) *Agent
SaveX calls Save and panics if Save returns an error.
func (*AgentCreate) SetChannelID ¶
func (_c *AgentCreate) SetChannelID(v string) *AgentCreate
SetChannelID sets the "channel_id" field.
func (*AgentCreate) SetConfig ¶
func (_c *AgentCreate) SetConfig(v map[string]interface{}) *AgentCreate
SetConfig sets the "config" field.
func (*AgentCreate) SetID ¶
func (_c *AgentCreate) SetID(v string) *AgentCreate
SetID sets the "id" field.
func (*AgentCreate) SetNillableStatus ¶
func (_c *AgentCreate) SetNillableStatus(v *agent.Status) *AgentCreate
SetNillableStatus sets the "status" field if the given value is not nil.
func (*AgentCreate) SetNillableTenantID ¶
func (_c *AgentCreate) SetNillableTenantID(v *string) *AgentCreate
SetNillableTenantID sets the "tenant_id" field if the given value is not nil.
func (*AgentCreate) SetStatus ¶
func (_c *AgentCreate) SetStatus(v agent.Status) *AgentCreate
SetStatus sets the "status" field.
func (*AgentCreate) SetTenantID ¶
func (_c *AgentCreate) SetTenantID(v string) *AgentCreate
SetTenantID sets the "tenant_id" field.
func (*AgentCreate) SetType ¶
func (_c *AgentCreate) SetType(v agent.Type) *AgentCreate
SetType sets the "type" field.
type AgentCreateBulk ¶
type AgentCreateBulk struct {
// contains filtered or unexported fields
}
AgentCreateBulk is the builder for creating many Agent entities in bulk.
func (*AgentCreateBulk) Exec ¶
func (_c *AgentCreateBulk) Exec(ctx context.Context) error
Exec executes the query.
func (*AgentCreateBulk) ExecX ¶
func (_c *AgentCreateBulk) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
type AgentDelete ¶
type AgentDelete struct {
// contains filtered or unexported fields
}
AgentDelete is the builder for deleting a Agent entity.
func (*AgentDelete) Exec ¶
func (_d *AgentDelete) Exec(ctx context.Context) (int, error)
Exec executes the deletion query and returns how many vertices were deleted.
func (*AgentDelete) ExecX ¶
func (_d *AgentDelete) ExecX(ctx context.Context) int
ExecX is like Exec, but panics if an error occurs.
func (*AgentDelete) Where ¶
func (_d *AgentDelete) Where(ps ...predicate.Agent) *AgentDelete
Where appends a list predicates to the AgentDelete builder.
type AgentDeleteOne ¶
type AgentDeleteOne struct {
// contains filtered or unexported fields
}
AgentDeleteOne is the builder for deleting a single Agent entity.
func (*AgentDeleteOne) Exec ¶
func (_d *AgentDeleteOne) Exec(ctx context.Context) error
Exec executes the deletion query.
func (*AgentDeleteOne) ExecX ¶
func (_d *AgentDeleteOne) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*AgentDeleteOne) Where ¶
func (_d *AgentDeleteOne) Where(ps ...predicate.Agent) *AgentDeleteOne
Where appends a list predicates to the AgentDelete builder.
type AgentGroupBy ¶
type AgentGroupBy struct {
// contains filtered or unexported fields
}
AgentGroupBy is the group-by builder for Agent entities.
func (*AgentGroupBy) Aggregate ¶
func (_g *AgentGroupBy) Aggregate(fns ...AggregateFunc) *AgentGroupBy
Aggregate adds the given aggregation functions to the group-by query.
func (*AgentGroupBy) Bool ¶
Bool returns a single bool from a selector. It is only allowed when selecting one field.
func (*AgentGroupBy) Bools ¶
Bools returns list of bools from a selector. It is only allowed when selecting one field.
func (*AgentGroupBy) Float64 ¶
Float64 returns a single float64 from a selector. It is only allowed when selecting one field.
func (*AgentGroupBy) Float64s ¶
Float64s returns list of float64s from a selector. It is only allowed when selecting one field.
func (*AgentGroupBy) Int ¶
Int returns a single int from a selector. It is only allowed when selecting one field.
func (*AgentGroupBy) Ints ¶
Ints returns list of ints from a selector. It is only allowed when selecting one field.
func (*AgentGroupBy) Scan ¶
func (_g *AgentGroupBy) Scan(ctx context.Context, v any) error
Scan applies the selector query and scans the result into the given value.
func (*AgentGroupBy) String ¶
String returns a single string from a selector. It is only allowed when selecting one field.
type AgentMutation ¶
type AgentMutation struct {
// contains filtered or unexported fields
}
AgentMutation represents an operation that mutates the Agent nodes in the graph.
func (*AgentMutation) AddField ¶
func (m *AgentMutation) 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 (*AgentMutation) AddedEdges ¶
func (m *AgentMutation) AddedEdges() []string
AddedEdges returns all edge names that were set/added in this mutation.
func (*AgentMutation) AddedField ¶
func (m *AgentMutation) 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 (*AgentMutation) AddedFields ¶
func (m *AgentMutation) AddedFields() []string
AddedFields returns all numeric fields that were incremented/decremented during this mutation.
func (*AgentMutation) AddedIDs ¶
func (m *AgentMutation) AddedIDs(name string) []ent.Value
AddedIDs returns all IDs (to other nodes) that were added for the given edge name in this mutation.
func (*AgentMutation) ChannelID ¶
func (m *AgentMutation) ChannelID() (r string, exists bool)
ChannelID returns the value of the "channel_id" field in the mutation.
func (*AgentMutation) ClearEdge ¶
func (m *AgentMutation) 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 (*AgentMutation) ClearField ¶
func (m *AgentMutation) 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 (*AgentMutation) ClearedEdges ¶
func (m *AgentMutation) ClearedEdges() []string
ClearedEdges returns all edge names that were cleared in this mutation.
func (*AgentMutation) ClearedFields ¶
func (m *AgentMutation) ClearedFields() []string
ClearedFields returns all nullable fields that were cleared during this mutation.
func (AgentMutation) Client ¶
func (m AgentMutation) 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 (*AgentMutation) Config ¶
func (m *AgentMutation) Config() (r map[string]interface{}, exists bool)
Config returns the value of the "config" field in the mutation.
func (*AgentMutation) EdgeCleared ¶
func (m *AgentMutation) EdgeCleared(name string) bool
EdgeCleared returns a boolean which indicates if the edge with the given name was cleared in this mutation.
func (*AgentMutation) Field ¶
func (m *AgentMutation) 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 (*AgentMutation) FieldCleared ¶
func (m *AgentMutation) FieldCleared(name string) bool
FieldCleared returns a boolean indicating if a field with the given name was cleared in this mutation.
func (*AgentMutation) Fields ¶
func (m *AgentMutation) 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 (*AgentMutation) GetType ¶
func (m *AgentMutation) GetType() (r agent.Type, exists bool)
GetType returns the value of the "type" field in the mutation.
func (*AgentMutation) ID ¶
func (m *AgentMutation) 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 (*AgentMutation) IDs ¶
func (m *AgentMutation) 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 (*AgentMutation) OldChannelID ¶
func (m *AgentMutation) OldChannelID(ctx context.Context) (v string, err error)
OldChannelID returns the old "channel_id" field's value of the Agent entity. If the Agent 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 (*AgentMutation) OldConfig ¶
func (m *AgentMutation) OldConfig(ctx context.Context) (v map[string]interface{}, err error)
OldConfig returns the old "config" field's value of the Agent entity. If the Agent 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 (*AgentMutation) 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 (*AgentMutation) OldStatus ¶
OldStatus returns the old "status" field's value of the Agent entity. If the Agent 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 (*AgentMutation) OldTenantID ¶
func (m *AgentMutation) OldTenantID(ctx context.Context) (v string, err error)
OldTenantID returns the old "tenant_id" field's value of the Agent entity. If the Agent 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 (*AgentMutation) OldType ¶
OldType returns the old "type" field's value of the Agent entity. If the Agent 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 (*AgentMutation) RemovedEdges ¶
func (m *AgentMutation) RemovedEdges() []string
RemovedEdges returns all edge names that were removed in this mutation.
func (*AgentMutation) RemovedIDs ¶
func (m *AgentMutation) 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 (*AgentMutation) ResetChannelID ¶
func (m *AgentMutation) ResetChannelID()
ResetChannelID resets all changes to the "channel_id" field.
func (*AgentMutation) ResetConfig ¶
func (m *AgentMutation) ResetConfig()
ResetConfig resets all changes to the "config" field.
func (*AgentMutation) ResetEdge ¶
func (m *AgentMutation) 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 (*AgentMutation) ResetField ¶
func (m *AgentMutation) 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 (*AgentMutation) ResetStatus ¶
func (m *AgentMutation) ResetStatus()
ResetStatus resets all changes to the "status" field.
func (*AgentMutation) ResetTenantID ¶
func (m *AgentMutation) ResetTenantID()
ResetTenantID resets all changes to the "tenant_id" field.
func (*AgentMutation) ResetType ¶
func (m *AgentMutation) ResetType()
ResetType resets all changes to the "type" field.
func (*AgentMutation) SetChannelID ¶
func (m *AgentMutation) SetChannelID(s string)
SetChannelID sets the "channel_id" field.
func (*AgentMutation) SetConfig ¶
func (m *AgentMutation) SetConfig(value map[string]interface{})
SetConfig sets the "config" field.
func (*AgentMutation) SetField ¶
func (m *AgentMutation) 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 (*AgentMutation) SetID ¶
func (m *AgentMutation) SetID(id string)
SetID sets the value of the id field. Note that this operation is only accepted on creation of Agent entities.
func (*AgentMutation) SetOp ¶
func (m *AgentMutation) SetOp(op Op)
SetOp allows setting the mutation operation.
func (*AgentMutation) SetStatus ¶
func (m *AgentMutation) SetStatus(a agent.Status)
SetStatus sets the "status" field.
func (*AgentMutation) SetTenantID ¶
func (m *AgentMutation) SetTenantID(s string)
SetTenantID sets the "tenant_id" field.
func (*AgentMutation) SetType ¶
func (m *AgentMutation) SetType(a agent.Type)
SetType sets the "type" field.
func (*AgentMutation) Status ¶
func (m *AgentMutation) Status() (r agent.Status, exists bool)
Status returns the value of the "status" field in the mutation.
func (*AgentMutation) TenantID ¶
func (m *AgentMutation) TenantID() (r string, exists bool)
TenantID returns the value of the "tenant_id" field in the mutation.
func (AgentMutation) Tx ¶
func (m AgentMutation) Tx() (*Tx, error)
Tx returns an `ent.Tx` for mutations that were executed in transactions; it returns an error otherwise.
func (*AgentMutation) Type ¶
func (m *AgentMutation) Type() string
Type returns the node type of this mutation (Agent).
func (*AgentMutation) Where ¶
func (m *AgentMutation) Where(ps ...predicate.Agent)
Where appends a list predicates to the AgentMutation builder.
func (*AgentMutation) WhereP ¶
func (m *AgentMutation) WhereP(ps ...func(*sql.Selector))
WhereP appends storage-level predicates to the AgentMutation builder. Using this method, users can use type-assertion to append predicates that do not depend on any generated package.
type AgentQuery ¶
type AgentQuery struct {
// contains filtered or unexported fields
}
AgentQuery is the builder for querying Agent entities.
func (*AgentQuery) Aggregate ¶
func (_q *AgentQuery) Aggregate(fns ...AggregateFunc) *AgentSelect
Aggregate returns a AgentSelect configured with the given aggregations.
func (*AgentQuery) All ¶
func (_q *AgentQuery) All(ctx context.Context) ([]*Agent, error)
All executes the query and returns a list of Agents.
func (*AgentQuery) AllX ¶
func (_q *AgentQuery) AllX(ctx context.Context) []*Agent
AllX is like All, but panics if an error occurs.
func (*AgentQuery) Clone ¶
func (_q *AgentQuery) Clone() *AgentQuery
Clone returns a duplicate of the AgentQuery builder, including all associated steps. It can be used to prepare common query builders and use them differently after the clone is made.
func (*AgentQuery) Count ¶
func (_q *AgentQuery) Count(ctx context.Context) (int, error)
Count returns the count of the given query.
func (*AgentQuery) CountX ¶
func (_q *AgentQuery) CountX(ctx context.Context) int
CountX is like Count, but panics if an error occurs.
func (*AgentQuery) Exist ¶
func (_q *AgentQuery) Exist(ctx context.Context) (bool, error)
Exist returns true if the query has elements in the graph.
func (*AgentQuery) ExistX ¶
func (_q *AgentQuery) ExistX(ctx context.Context) bool
ExistX is like Exist, but panics if an error occurs.
func (*AgentQuery) First ¶
func (_q *AgentQuery) First(ctx context.Context) (*Agent, error)
First returns the first Agent entity from the query. Returns a *NotFoundError when no Agent was found.
func (*AgentQuery) FirstID ¶
func (_q *AgentQuery) FirstID(ctx context.Context) (id string, err error)
FirstID returns the first Agent ID from the query. Returns a *NotFoundError when no Agent ID was found.
func (*AgentQuery) FirstIDX ¶
func (_q *AgentQuery) FirstIDX(ctx context.Context) string
FirstIDX is like FirstID, but panics if an error occurs.
func (*AgentQuery) FirstX ¶
func (_q *AgentQuery) FirstX(ctx context.Context) *Agent
FirstX is like First, but panics if an error occurs.
func (*AgentQuery) GroupBy ¶
func (_q *AgentQuery) GroupBy(field string, fields ...string) *AgentGroupBy
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 {
TenantID string `json:"tenant_id,omitempty"`
Count int `json:"count,omitempty"`
}
client.Agent.Query().
GroupBy(agent.FieldTenantID).
Aggregate(ent.Count()).
Scan(ctx, &v)
func (*AgentQuery) IDs ¶
func (_q *AgentQuery) IDs(ctx context.Context) (ids []string, err error)
IDs executes the query and returns a list of Agent IDs.
func (*AgentQuery) IDsX ¶
func (_q *AgentQuery) IDsX(ctx context.Context) []string
IDsX is like IDs, but panics if an error occurs.
func (*AgentQuery) Limit ¶
func (_q *AgentQuery) Limit(limit int) *AgentQuery
Limit the number of records to be returned by this query.
func (*AgentQuery) Offset ¶
func (_q *AgentQuery) Offset(offset int) *AgentQuery
Offset to start from.
func (*AgentQuery) Only ¶
func (_q *AgentQuery) Only(ctx context.Context) (*Agent, error)
Only returns a single Agent entity found by the query, ensuring it only returns one. Returns a *NotSingularError when more than one Agent entity is found. Returns a *NotFoundError when no Agent entities are found.
func (*AgentQuery) OnlyID ¶
func (_q *AgentQuery) OnlyID(ctx context.Context) (id string, err error)
OnlyID is like Only, but returns the only Agent ID in the query. Returns a *NotSingularError when more than one Agent ID is found. Returns a *NotFoundError when no entities are found.
func (*AgentQuery) OnlyIDX ¶
func (_q *AgentQuery) OnlyIDX(ctx context.Context) string
OnlyIDX is like OnlyID, but panics if an error occurs.
func (*AgentQuery) OnlyX ¶
func (_q *AgentQuery) OnlyX(ctx context.Context) *Agent
OnlyX is like Only, but panics if an error occurs.
func (*AgentQuery) Order ¶
func (_q *AgentQuery) Order(o ...agent.OrderOption) *AgentQuery
Order specifies how the records should be ordered.
func (*AgentQuery) Select ¶
func (_q *AgentQuery) Select(fields ...string) *AgentSelect
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 {
TenantID string `json:"tenant_id,omitempty"`
}
client.Agent.Query().
Select(agent.FieldTenantID).
Scan(ctx, &v)
func (*AgentQuery) Unique ¶
func (_q *AgentQuery) Unique(unique bool) *AgentQuery
Unique configures the query builder to filter duplicate records on query. By default, unique is set to true, and can be disabled using this method.
func (*AgentQuery) Where ¶
func (_q *AgentQuery) Where(ps ...predicate.Agent) *AgentQuery
Where adds a new predicate for the AgentQuery builder.
type AgentSelect ¶
type AgentSelect struct {
*AgentQuery
// contains filtered or unexported fields
}
AgentSelect is the builder for selecting fields of Agent entities.
func (*AgentSelect) Aggregate ¶
func (_s *AgentSelect) Aggregate(fns ...AggregateFunc) *AgentSelect
Aggregate adds the given aggregation functions to the selector query.
func (*AgentSelect) Bool ¶
Bool returns a single bool from a selector. It is only allowed when selecting one field.
func (*AgentSelect) Bools ¶
Bools returns list of bools from a selector. It is only allowed when selecting one field.
func (*AgentSelect) Float64 ¶
Float64 returns a single float64 from a selector. It is only allowed when selecting one field.
func (*AgentSelect) Float64s ¶
Float64s returns list of float64s from a selector. It is only allowed when selecting one field.
func (*AgentSelect) Int ¶
Int returns a single int from a selector. It is only allowed when selecting one field.
func (*AgentSelect) Ints ¶
Ints returns list of ints from a selector. It is only allowed when selecting one field.
func (*AgentSelect) Scan ¶
func (_s *AgentSelect) Scan(ctx context.Context, v any) error
Scan applies the selector query and scans the result into the given value.
func (*AgentSelect) String ¶
String returns a single string from a selector. It is only allowed when selecting one field.
type AgentUpdate ¶
type AgentUpdate struct {
// contains filtered or unexported fields
}
AgentUpdate is the builder for updating Agent entities.
func (*AgentUpdate) Exec ¶
func (_u *AgentUpdate) Exec(ctx context.Context) error
Exec executes the query.
func (*AgentUpdate) ExecX ¶
func (_u *AgentUpdate) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*AgentUpdate) Mutation ¶
func (_u *AgentUpdate) Mutation() *AgentMutation
Mutation returns the AgentMutation object of the builder.
func (*AgentUpdate) Save ¶
func (_u *AgentUpdate) Save(ctx context.Context) (int, error)
Save executes the query and returns the number of nodes affected by the update operation.
func (*AgentUpdate) SaveX ¶
func (_u *AgentUpdate) SaveX(ctx context.Context) int
SaveX is like Save, but panics if an error occurs.
func (*AgentUpdate) SetChannelID ¶
func (_u *AgentUpdate) SetChannelID(v string) *AgentUpdate
SetChannelID sets the "channel_id" field.
func (*AgentUpdate) SetConfig ¶
func (_u *AgentUpdate) SetConfig(v map[string]interface{}) *AgentUpdate
SetConfig sets the "config" field.
func (*AgentUpdate) SetNillableChannelID ¶
func (_u *AgentUpdate) SetNillableChannelID(v *string) *AgentUpdate
SetNillableChannelID sets the "channel_id" field if the given value is not nil.
func (*AgentUpdate) SetNillableStatus ¶
func (_u *AgentUpdate) SetNillableStatus(v *agent.Status) *AgentUpdate
SetNillableStatus sets the "status" field if the given value is not nil.
func (*AgentUpdate) SetNillableTenantID ¶
func (_u *AgentUpdate) SetNillableTenantID(v *string) *AgentUpdate
SetNillableTenantID sets the "tenant_id" field if the given value is not nil.
func (*AgentUpdate) SetNillableType ¶
func (_u *AgentUpdate) SetNillableType(v *agent.Type) *AgentUpdate
SetNillableType sets the "type" field if the given value is not nil.
func (*AgentUpdate) SetStatus ¶
func (_u *AgentUpdate) SetStatus(v agent.Status) *AgentUpdate
SetStatus sets the "status" field.
func (*AgentUpdate) SetTenantID ¶
func (_u *AgentUpdate) SetTenantID(v string) *AgentUpdate
SetTenantID sets the "tenant_id" field.
func (*AgentUpdate) SetType ¶
func (_u *AgentUpdate) SetType(v agent.Type) *AgentUpdate
SetType sets the "type" field.
func (*AgentUpdate) Where ¶
func (_u *AgentUpdate) Where(ps ...predicate.Agent) *AgentUpdate
Where appends a list predicates to the AgentUpdate builder.
type AgentUpdateOne ¶
type AgentUpdateOne struct {
// contains filtered or unexported fields
}
AgentUpdateOne is the builder for updating a single Agent entity.
func (*AgentUpdateOne) Exec ¶
func (_u *AgentUpdateOne) Exec(ctx context.Context) error
Exec executes the query on the entity.
func (*AgentUpdateOne) ExecX ¶
func (_u *AgentUpdateOne) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*AgentUpdateOne) Mutation ¶
func (_u *AgentUpdateOne) Mutation() *AgentMutation
Mutation returns the AgentMutation object of the builder.
func (*AgentUpdateOne) Save ¶
func (_u *AgentUpdateOne) Save(ctx context.Context) (*Agent, error)
Save executes the query and returns the updated Agent entity.
func (*AgentUpdateOne) SaveX ¶
func (_u *AgentUpdateOne) SaveX(ctx context.Context) *Agent
SaveX is like Save, but panics if an error occurs.
func (*AgentUpdateOne) Select ¶
func (_u *AgentUpdateOne) Select(field string, fields ...string) *AgentUpdateOne
Select allows selecting one or more fields (columns) of the returned entity. The default is selecting all fields defined in the entity schema.
func (*AgentUpdateOne) SetChannelID ¶
func (_u *AgentUpdateOne) SetChannelID(v string) *AgentUpdateOne
SetChannelID sets the "channel_id" field.
func (*AgentUpdateOne) SetConfig ¶
func (_u *AgentUpdateOne) SetConfig(v map[string]interface{}) *AgentUpdateOne
SetConfig sets the "config" field.
func (*AgentUpdateOne) SetNillableChannelID ¶
func (_u *AgentUpdateOne) SetNillableChannelID(v *string) *AgentUpdateOne
SetNillableChannelID sets the "channel_id" field if the given value is not nil.
func (*AgentUpdateOne) SetNillableStatus ¶
func (_u *AgentUpdateOne) SetNillableStatus(v *agent.Status) *AgentUpdateOne
SetNillableStatus sets the "status" field if the given value is not nil.
func (*AgentUpdateOne) SetNillableTenantID ¶
func (_u *AgentUpdateOne) SetNillableTenantID(v *string) *AgentUpdateOne
SetNillableTenantID sets the "tenant_id" field if the given value is not nil.
func (*AgentUpdateOne) SetNillableType ¶
func (_u *AgentUpdateOne) SetNillableType(v *agent.Type) *AgentUpdateOne
SetNillableType sets the "type" field if the given value is not nil.
func (*AgentUpdateOne) SetStatus ¶
func (_u *AgentUpdateOne) SetStatus(v agent.Status) *AgentUpdateOne
SetStatus sets the "status" field.
func (*AgentUpdateOne) SetTenantID ¶
func (_u *AgentUpdateOne) SetTenantID(v string) *AgentUpdateOne
SetTenantID sets the "tenant_id" field.
func (*AgentUpdateOne) SetType ¶
func (_u *AgentUpdateOne) SetType(v agent.Type) *AgentUpdateOne
SetType sets the "type" field.
func (*AgentUpdateOne) Where ¶
func (_u *AgentUpdateOne) Where(ps ...predicate.Agent) *AgentUpdateOne
Where appends a list predicates to the AgentUpdate builder.
type AggregateFunc ¶
AggregateFunc applies an aggregation step on the group-by traversal/selector.
func As ¶
func As(fn AggregateFunc, end string) AggregateFunc
As is a pseudo aggregation function for renaming another other functions with custom names. For example:
GroupBy(field1, field2). Aggregate(ent.As(ent.Sum(field1), "sum_field1"), (ent.As(ent.Sum(field2), "sum_field2")). Scan(ctx, &v)
func Count ¶
func Count() AggregateFunc
Count applies the "count" aggregation function on each group.
func Max ¶
func Max(field string) AggregateFunc
Max applies the "max" aggregation function on the given field of each group.
func Mean ¶
func Mean(field string) AggregateFunc
Mean applies the "mean" aggregation function on the given field of each group.
func Min ¶
func Min(field string) AggregateFunc
Min applies the "min" aggregation function on the given field of each group.
func Sum ¶
func Sum(field string) AggregateFunc
Sum applies the "sum" aggregation function on the given field of each group.
type Client ¶
type Client struct {
// Schema is the client for creating, migrating and dropping schema.
Schema *migrate.Schema
// Agent is the client for interacting with the Agent builders.
Agent *AgentClient
// Event is the client for interacting with the Event builders.
Event *EventClient
// 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(). Agent. 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 Event ¶
type Event struct {
// ID of the ent.
// Unique event ID (evt_{ulid})
ID string `json:"id,omitempty"`
// Tenant ID for multi-tenancy (local for single-tenant)
TenantID string `json:"tenant_id,omitempty"`
// Target agent ID
AgentID string `json:"agent_id,omitempty"`
// Source channel (e.g., discord:123456)
ChannelID string `json:"channel_id,omitempty"`
// Event type
Type event.Type `json:"type,omitempty"`
// Who initiated the event
Role event.Role `json:"role,omitempty"`
// When the event occurred
Timestamp time.Time `json:"timestamp,omitempty"`
// Event payload (text, metadata, etc.)
Payload map[string]interface{} `json:"payload,omitempty"`
// Delivery status
Status event.Status `json:"status,omitempty"`
// Source agent ID for agent-to-agent messages (empty for human messages)
SourceAgentID string `json:"source_agent_id,omitempty"`
// contains filtered or unexported fields
}
Event is the model entity for the Event schema.
func (*Event) Unwrap ¶
Unwrap unwraps the Event 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 (*Event) Update ¶
func (_m *Event) Update() *EventUpdateOne
Update returns a builder for updating this Event. Note that you need to call Event.Unwrap() before calling this method if this Event was returned from a transaction, and the transaction was committed or rolled back.
type EventClient ¶
type EventClient struct {
// contains filtered or unexported fields
}
EventClient is a client for the Event schema.
func NewEventClient ¶
func NewEventClient(c config) *EventClient
NewEventClient returns a client for the Event from the given config.
func (*EventClient) Create ¶
func (c *EventClient) Create() *EventCreate
Create returns a builder for creating a Event entity.
func (*EventClient) CreateBulk ¶
func (c *EventClient) CreateBulk(builders ...*EventCreate) *EventCreateBulk
CreateBulk returns a builder for creating a bulk of Event entities.
func (*EventClient) Delete ¶
func (c *EventClient) Delete() *EventDelete
Delete returns a delete builder for Event.
func (*EventClient) DeleteOne ¶
func (c *EventClient) DeleteOne(_m *Event) *EventDeleteOne
DeleteOne returns a builder for deleting the given entity.
func (*EventClient) DeleteOneID ¶
func (c *EventClient) DeleteOneID(id string) *EventDeleteOne
DeleteOneID returns a builder for deleting the given entity by its id.
func (*EventClient) GetX ¶
func (c *EventClient) GetX(ctx context.Context, id string) *Event
GetX is like Get, but panics if an error occurs.
func (*EventClient) Intercept ¶
func (c *EventClient) Intercept(interceptors ...Interceptor)
Intercept adds a list of query interceptors to the interceptors stack. A call to `Intercept(f, g, h)` equals to `event.Intercept(f(g(h())))`.
func (*EventClient) Interceptors ¶
func (c *EventClient) Interceptors() []Interceptor
Interceptors returns the client interceptors.
func (*EventClient) MapCreateBulk ¶
func (c *EventClient) MapCreateBulk(slice any, setFunc func(*EventCreate, int)) *EventCreateBulk
MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates a builder and applies setFunc on it.
func (*EventClient) Query ¶
func (c *EventClient) Query() *EventQuery
Query returns a query builder for Event.
func (*EventClient) Update ¶
func (c *EventClient) Update() *EventUpdate
Update returns an update builder for Event.
func (*EventClient) UpdateOne ¶
func (c *EventClient) UpdateOne(_m *Event) *EventUpdateOne
UpdateOne returns an update builder for the given entity.
func (*EventClient) UpdateOneID ¶
func (c *EventClient) UpdateOneID(id string) *EventUpdateOne
UpdateOneID returns an update builder for the given id.
func (*EventClient) Use ¶
func (c *EventClient) Use(hooks ...Hook)
Use adds a list of mutation hooks to the hooks stack. A call to `Use(f, g, h)` equals to `event.Hooks(f(g(h())))`.
type EventCreate ¶
type EventCreate struct {
// contains filtered or unexported fields
}
EventCreate is the builder for creating a Event entity.
func (*EventCreate) Exec ¶
func (_c *EventCreate) Exec(ctx context.Context) error
Exec executes the query.
func (*EventCreate) ExecX ¶
func (_c *EventCreate) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*EventCreate) Mutation ¶
func (_c *EventCreate) Mutation() *EventMutation
Mutation returns the EventMutation object of the builder.
func (*EventCreate) Save ¶
func (_c *EventCreate) Save(ctx context.Context) (*Event, error)
Save creates the Event in the database.
func (*EventCreate) SaveX ¶
func (_c *EventCreate) SaveX(ctx context.Context) *Event
SaveX calls Save and panics if Save returns an error.
func (*EventCreate) SetAgentID ¶
func (_c *EventCreate) SetAgentID(v string) *EventCreate
SetAgentID sets the "agent_id" field.
func (*EventCreate) SetChannelID ¶
func (_c *EventCreate) SetChannelID(v string) *EventCreate
SetChannelID sets the "channel_id" field.
func (*EventCreate) SetID ¶
func (_c *EventCreate) SetID(v string) *EventCreate
SetID sets the "id" field.
func (*EventCreate) SetNillableSourceAgentID ¶
func (_c *EventCreate) SetNillableSourceAgentID(v *string) *EventCreate
SetNillableSourceAgentID sets the "source_agent_id" field if the given value is not nil.
func (*EventCreate) SetNillableStatus ¶
func (_c *EventCreate) SetNillableStatus(v *event.Status) *EventCreate
SetNillableStatus sets the "status" field if the given value is not nil.
func (*EventCreate) SetNillableTenantID ¶
func (_c *EventCreate) SetNillableTenantID(v *string) *EventCreate
SetNillableTenantID sets the "tenant_id" field if the given value is not nil.
func (*EventCreate) SetNillableTimestamp ¶
func (_c *EventCreate) SetNillableTimestamp(v *time.Time) *EventCreate
SetNillableTimestamp sets the "timestamp" field if the given value is not nil.
func (*EventCreate) SetPayload ¶
func (_c *EventCreate) SetPayload(v map[string]interface{}) *EventCreate
SetPayload sets the "payload" field.
func (*EventCreate) SetRole ¶
func (_c *EventCreate) SetRole(v event.Role) *EventCreate
SetRole sets the "role" field.
func (*EventCreate) SetSourceAgentID ¶
func (_c *EventCreate) SetSourceAgentID(v string) *EventCreate
SetSourceAgentID sets the "source_agent_id" field.
func (*EventCreate) SetStatus ¶
func (_c *EventCreate) SetStatus(v event.Status) *EventCreate
SetStatus sets the "status" field.
func (*EventCreate) SetTenantID ¶
func (_c *EventCreate) SetTenantID(v string) *EventCreate
SetTenantID sets the "tenant_id" field.
func (*EventCreate) SetTimestamp ¶
func (_c *EventCreate) SetTimestamp(v time.Time) *EventCreate
SetTimestamp sets the "timestamp" field.
func (*EventCreate) SetType ¶
func (_c *EventCreate) SetType(v event.Type) *EventCreate
SetType sets the "type" field.
type EventCreateBulk ¶
type EventCreateBulk struct {
// contains filtered or unexported fields
}
EventCreateBulk is the builder for creating many Event entities in bulk.
func (*EventCreateBulk) Exec ¶
func (_c *EventCreateBulk) Exec(ctx context.Context) error
Exec executes the query.
func (*EventCreateBulk) ExecX ¶
func (_c *EventCreateBulk) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
type EventDelete ¶
type EventDelete struct {
// contains filtered or unexported fields
}
EventDelete is the builder for deleting a Event entity.
func (*EventDelete) Exec ¶
func (_d *EventDelete) Exec(ctx context.Context) (int, error)
Exec executes the deletion query and returns how many vertices were deleted.
func (*EventDelete) ExecX ¶
func (_d *EventDelete) ExecX(ctx context.Context) int
ExecX is like Exec, but panics if an error occurs.
func (*EventDelete) Where ¶
func (_d *EventDelete) Where(ps ...predicate.Event) *EventDelete
Where appends a list predicates to the EventDelete builder.
type EventDeleteOne ¶
type EventDeleteOne struct {
// contains filtered or unexported fields
}
EventDeleteOne is the builder for deleting a single Event entity.
func (*EventDeleteOne) Exec ¶
func (_d *EventDeleteOne) Exec(ctx context.Context) error
Exec executes the deletion query.
func (*EventDeleteOne) ExecX ¶
func (_d *EventDeleteOne) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*EventDeleteOne) Where ¶
func (_d *EventDeleteOne) Where(ps ...predicate.Event) *EventDeleteOne
Where appends a list predicates to the EventDelete builder.
type EventGroupBy ¶
type EventGroupBy struct {
// contains filtered or unexported fields
}
EventGroupBy is the group-by builder for Event entities.
func (*EventGroupBy) Aggregate ¶
func (_g *EventGroupBy) Aggregate(fns ...AggregateFunc) *EventGroupBy
Aggregate adds the given aggregation functions to the group-by query.
func (*EventGroupBy) Bool ¶
Bool returns a single bool from a selector. It is only allowed when selecting one field.
func (*EventGroupBy) Bools ¶
Bools returns list of bools from a selector. It is only allowed when selecting one field.
func (*EventGroupBy) Float64 ¶
Float64 returns a single float64 from a selector. It is only allowed when selecting one field.
func (*EventGroupBy) Float64s ¶
Float64s returns list of float64s from a selector. It is only allowed when selecting one field.
func (*EventGroupBy) Int ¶
Int returns a single int from a selector. It is only allowed when selecting one field.
func (*EventGroupBy) Ints ¶
Ints returns list of ints from a selector. It is only allowed when selecting one field.
func (*EventGroupBy) Scan ¶
func (_g *EventGroupBy) Scan(ctx context.Context, v any) error
Scan applies the selector query and scans the result into the given value.
func (*EventGroupBy) String ¶
String returns a single string from a selector. It is only allowed when selecting one field.
type EventMutation ¶
type EventMutation struct {
// contains filtered or unexported fields
}
EventMutation represents an operation that mutates the Event nodes in the graph.
func (*EventMutation) AddField ¶
func (m *EventMutation) 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 (*EventMutation) AddedEdges ¶
func (m *EventMutation) AddedEdges() []string
AddedEdges returns all edge names that were set/added in this mutation.
func (*EventMutation) AddedField ¶
func (m *EventMutation) 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 (*EventMutation) AddedFields ¶
func (m *EventMutation) AddedFields() []string
AddedFields returns all numeric fields that were incremented/decremented during this mutation.
func (*EventMutation) AddedIDs ¶
func (m *EventMutation) AddedIDs(name string) []ent.Value
AddedIDs returns all IDs (to other nodes) that were added for the given edge name in this mutation.
func (*EventMutation) AgentID ¶
func (m *EventMutation) AgentID() (r string, exists bool)
AgentID returns the value of the "agent_id" field in the mutation.
func (*EventMutation) ChannelID ¶
func (m *EventMutation) ChannelID() (r string, exists bool)
ChannelID returns the value of the "channel_id" field in the mutation.
func (*EventMutation) ClearEdge ¶
func (m *EventMutation) 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 (*EventMutation) ClearField ¶
func (m *EventMutation) 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 (*EventMutation) ClearSourceAgentID ¶
func (m *EventMutation) ClearSourceAgentID()
ClearSourceAgentID clears the value of the "source_agent_id" field.
func (*EventMutation) ClearedEdges ¶
func (m *EventMutation) ClearedEdges() []string
ClearedEdges returns all edge names that were cleared in this mutation.
func (*EventMutation) ClearedFields ¶
func (m *EventMutation) ClearedFields() []string
ClearedFields returns all nullable fields that were cleared during this mutation.
func (EventMutation) Client ¶
func (m EventMutation) 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 (*EventMutation) EdgeCleared ¶
func (m *EventMutation) EdgeCleared(name string) bool
EdgeCleared returns a boolean which indicates if the edge with the given name was cleared in this mutation.
func (*EventMutation) Field ¶
func (m *EventMutation) 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 (*EventMutation) FieldCleared ¶
func (m *EventMutation) FieldCleared(name string) bool
FieldCleared returns a boolean indicating if a field with the given name was cleared in this mutation.
func (*EventMutation) Fields ¶
func (m *EventMutation) 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 (*EventMutation) GetType ¶
func (m *EventMutation) GetType() (r event.Type, exists bool)
GetType returns the value of the "type" field in the mutation.
func (*EventMutation) ID ¶
func (m *EventMutation) 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 (*EventMutation) IDs ¶
func (m *EventMutation) 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 (*EventMutation) OldAgentID ¶
func (m *EventMutation) OldAgentID(ctx context.Context) (v string, err error)
OldAgentID returns the old "agent_id" field's value of the Event entity. If the Event 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 (*EventMutation) OldChannelID ¶
func (m *EventMutation) OldChannelID(ctx context.Context) (v string, err error)
OldChannelID returns the old "channel_id" field's value of the Event entity. If the Event 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 (*EventMutation) 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 (*EventMutation) OldPayload ¶
func (m *EventMutation) OldPayload(ctx context.Context) (v map[string]interface{}, err error)
OldPayload returns the old "payload" field's value of the Event entity. If the Event 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 (*EventMutation) OldRole ¶
OldRole returns the old "role" field's value of the Event entity. If the Event 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 (*EventMutation) OldSourceAgentID ¶
func (m *EventMutation) OldSourceAgentID(ctx context.Context) (v string, err error)
OldSourceAgentID returns the old "source_agent_id" field's value of the Event entity. If the Event 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 (*EventMutation) OldStatus ¶
OldStatus returns the old "status" field's value of the Event entity. If the Event 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 (*EventMutation) OldTenantID ¶
func (m *EventMutation) OldTenantID(ctx context.Context) (v string, err error)
OldTenantID returns the old "tenant_id" field's value of the Event entity. If the Event 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 (*EventMutation) OldTimestamp ¶
OldTimestamp returns the old "timestamp" field's value of the Event entity. If the Event 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 (*EventMutation) OldType ¶
OldType returns the old "type" field's value of the Event entity. If the Event 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 (*EventMutation) Payload ¶
func (m *EventMutation) Payload() (r map[string]interface{}, exists bool)
Payload returns the value of the "payload" field in the mutation.
func (*EventMutation) RemovedEdges ¶
func (m *EventMutation) RemovedEdges() []string
RemovedEdges returns all edge names that were removed in this mutation.
func (*EventMutation) RemovedIDs ¶
func (m *EventMutation) 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 (*EventMutation) ResetAgentID ¶
func (m *EventMutation) ResetAgentID()
ResetAgentID resets all changes to the "agent_id" field.
func (*EventMutation) ResetChannelID ¶
func (m *EventMutation) ResetChannelID()
ResetChannelID resets all changes to the "channel_id" field.
func (*EventMutation) ResetEdge ¶
func (m *EventMutation) 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 (*EventMutation) ResetField ¶
func (m *EventMutation) 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 (*EventMutation) ResetPayload ¶
func (m *EventMutation) ResetPayload()
ResetPayload resets all changes to the "payload" field.
func (*EventMutation) ResetRole ¶
func (m *EventMutation) ResetRole()
ResetRole resets all changes to the "role" field.
func (*EventMutation) ResetSourceAgentID ¶
func (m *EventMutation) ResetSourceAgentID()
ResetSourceAgentID resets all changes to the "source_agent_id" field.
func (*EventMutation) ResetStatus ¶
func (m *EventMutation) ResetStatus()
ResetStatus resets all changes to the "status" field.
func (*EventMutation) ResetTenantID ¶
func (m *EventMutation) ResetTenantID()
ResetTenantID resets all changes to the "tenant_id" field.
func (*EventMutation) ResetTimestamp ¶
func (m *EventMutation) ResetTimestamp()
ResetTimestamp resets all changes to the "timestamp" field.
func (*EventMutation) ResetType ¶
func (m *EventMutation) ResetType()
ResetType resets all changes to the "type" field.
func (*EventMutation) Role ¶
func (m *EventMutation) Role() (r event.Role, exists bool)
Role returns the value of the "role" field in the mutation.
func (*EventMutation) SetAgentID ¶
func (m *EventMutation) SetAgentID(s string)
SetAgentID sets the "agent_id" field.
func (*EventMutation) SetChannelID ¶
func (m *EventMutation) SetChannelID(s string)
SetChannelID sets the "channel_id" field.
func (*EventMutation) SetField ¶
func (m *EventMutation) 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 (*EventMutation) SetID ¶
func (m *EventMutation) SetID(id string)
SetID sets the value of the id field. Note that this operation is only accepted on creation of Event entities.
func (*EventMutation) SetOp ¶
func (m *EventMutation) SetOp(op Op)
SetOp allows setting the mutation operation.
func (*EventMutation) SetPayload ¶
func (m *EventMutation) SetPayload(value map[string]interface{})
SetPayload sets the "payload" field.
func (*EventMutation) SetRole ¶
func (m *EventMutation) SetRole(e event.Role)
SetRole sets the "role" field.
func (*EventMutation) SetSourceAgentID ¶
func (m *EventMutation) SetSourceAgentID(s string)
SetSourceAgentID sets the "source_agent_id" field.
func (*EventMutation) SetStatus ¶
func (m *EventMutation) SetStatus(e event.Status)
SetStatus sets the "status" field.
func (*EventMutation) SetTenantID ¶
func (m *EventMutation) SetTenantID(s string)
SetTenantID sets the "tenant_id" field.
func (*EventMutation) SetTimestamp ¶
func (m *EventMutation) SetTimestamp(t time.Time)
SetTimestamp sets the "timestamp" field.
func (*EventMutation) SetType ¶
func (m *EventMutation) SetType(e event.Type)
SetType sets the "type" field.
func (*EventMutation) SourceAgentID ¶
func (m *EventMutation) SourceAgentID() (r string, exists bool)
SourceAgentID returns the value of the "source_agent_id" field in the mutation.
func (*EventMutation) SourceAgentIDCleared ¶
func (m *EventMutation) SourceAgentIDCleared() bool
SourceAgentIDCleared returns if the "source_agent_id" field was cleared in this mutation.
func (*EventMutation) Status ¶
func (m *EventMutation) Status() (r event.Status, exists bool)
Status returns the value of the "status" field in the mutation.
func (*EventMutation) TenantID ¶
func (m *EventMutation) TenantID() (r string, exists bool)
TenantID returns the value of the "tenant_id" field in the mutation.
func (*EventMutation) Timestamp ¶
func (m *EventMutation) Timestamp() (r time.Time, exists bool)
Timestamp returns the value of the "timestamp" field in the mutation.
func (EventMutation) Tx ¶
func (m EventMutation) Tx() (*Tx, error)
Tx returns an `ent.Tx` for mutations that were executed in transactions; it returns an error otherwise.
func (*EventMutation) Type ¶
func (m *EventMutation) Type() string
Type returns the node type of this mutation (Event).
func (*EventMutation) Where ¶
func (m *EventMutation) Where(ps ...predicate.Event)
Where appends a list predicates to the EventMutation builder.
func (*EventMutation) WhereP ¶
func (m *EventMutation) WhereP(ps ...func(*sql.Selector))
WhereP appends storage-level predicates to the EventMutation builder. Using this method, users can use type-assertion to append predicates that do not depend on any generated package.
type EventQuery ¶
type EventQuery struct {
// contains filtered or unexported fields
}
EventQuery is the builder for querying Event entities.
func (*EventQuery) Aggregate ¶
func (_q *EventQuery) Aggregate(fns ...AggregateFunc) *EventSelect
Aggregate returns a EventSelect configured with the given aggregations.
func (*EventQuery) All ¶
func (_q *EventQuery) All(ctx context.Context) ([]*Event, error)
All executes the query and returns a list of Events.
func (*EventQuery) AllX ¶
func (_q *EventQuery) AllX(ctx context.Context) []*Event
AllX is like All, but panics if an error occurs.
func (*EventQuery) Clone ¶
func (_q *EventQuery) Clone() *EventQuery
Clone returns a duplicate of the EventQuery builder, including all associated steps. It can be used to prepare common query builders and use them differently after the clone is made.
func (*EventQuery) Count ¶
func (_q *EventQuery) Count(ctx context.Context) (int, error)
Count returns the count of the given query.
func (*EventQuery) CountX ¶
func (_q *EventQuery) CountX(ctx context.Context) int
CountX is like Count, but panics if an error occurs.
func (*EventQuery) Exist ¶
func (_q *EventQuery) Exist(ctx context.Context) (bool, error)
Exist returns true if the query has elements in the graph.
func (*EventQuery) ExistX ¶
func (_q *EventQuery) ExistX(ctx context.Context) bool
ExistX is like Exist, but panics if an error occurs.
func (*EventQuery) First ¶
func (_q *EventQuery) First(ctx context.Context) (*Event, error)
First returns the first Event entity from the query. Returns a *NotFoundError when no Event was found.
func (*EventQuery) FirstID ¶
func (_q *EventQuery) FirstID(ctx context.Context) (id string, err error)
FirstID returns the first Event ID from the query. Returns a *NotFoundError when no Event ID was found.
func (*EventQuery) FirstIDX ¶
func (_q *EventQuery) FirstIDX(ctx context.Context) string
FirstIDX is like FirstID, but panics if an error occurs.
func (*EventQuery) FirstX ¶
func (_q *EventQuery) FirstX(ctx context.Context) *Event
FirstX is like First, but panics if an error occurs.
func (*EventQuery) GroupBy ¶
func (_q *EventQuery) GroupBy(field string, fields ...string) *EventGroupBy
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 {
TenantID string `json:"tenant_id,omitempty"`
Count int `json:"count,omitempty"`
}
client.Event.Query().
GroupBy(event.FieldTenantID).
Aggregate(ent.Count()).
Scan(ctx, &v)
func (*EventQuery) IDs ¶
func (_q *EventQuery) IDs(ctx context.Context) (ids []string, err error)
IDs executes the query and returns a list of Event IDs.
func (*EventQuery) IDsX ¶
func (_q *EventQuery) IDsX(ctx context.Context) []string
IDsX is like IDs, but panics if an error occurs.
func (*EventQuery) Limit ¶
func (_q *EventQuery) Limit(limit int) *EventQuery
Limit the number of records to be returned by this query.
func (*EventQuery) Offset ¶
func (_q *EventQuery) Offset(offset int) *EventQuery
Offset to start from.
func (*EventQuery) Only ¶
func (_q *EventQuery) Only(ctx context.Context) (*Event, error)
Only returns a single Event entity found by the query, ensuring it only returns one. Returns a *NotSingularError when more than one Event entity is found. Returns a *NotFoundError when no Event entities are found.
func (*EventQuery) OnlyID ¶
func (_q *EventQuery) OnlyID(ctx context.Context) (id string, err error)
OnlyID is like Only, but returns the only Event ID in the query. Returns a *NotSingularError when more than one Event ID is found. Returns a *NotFoundError when no entities are found.
func (*EventQuery) OnlyIDX ¶
func (_q *EventQuery) OnlyIDX(ctx context.Context) string
OnlyIDX is like OnlyID, but panics if an error occurs.
func (*EventQuery) OnlyX ¶
func (_q *EventQuery) OnlyX(ctx context.Context) *Event
OnlyX is like Only, but panics if an error occurs.
func (*EventQuery) Order ¶
func (_q *EventQuery) Order(o ...event.OrderOption) *EventQuery
Order specifies how the records should be ordered.
func (*EventQuery) Select ¶
func (_q *EventQuery) Select(fields ...string) *EventSelect
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 {
TenantID string `json:"tenant_id,omitempty"`
}
client.Event.Query().
Select(event.FieldTenantID).
Scan(ctx, &v)
func (*EventQuery) Unique ¶
func (_q *EventQuery) Unique(unique bool) *EventQuery
Unique configures the query builder to filter duplicate records on query. By default, unique is set to true, and can be disabled using this method.
func (*EventQuery) Where ¶
func (_q *EventQuery) Where(ps ...predicate.Event) *EventQuery
Where adds a new predicate for the EventQuery builder.
type EventSelect ¶
type EventSelect struct {
*EventQuery
// contains filtered or unexported fields
}
EventSelect is the builder for selecting fields of Event entities.
func (*EventSelect) Aggregate ¶
func (_s *EventSelect) Aggregate(fns ...AggregateFunc) *EventSelect
Aggregate adds the given aggregation functions to the selector query.
func (*EventSelect) Bool ¶
Bool returns a single bool from a selector. It is only allowed when selecting one field.
func (*EventSelect) Bools ¶
Bools returns list of bools from a selector. It is only allowed when selecting one field.
func (*EventSelect) Float64 ¶
Float64 returns a single float64 from a selector. It is only allowed when selecting one field.
func (*EventSelect) Float64s ¶
Float64s returns list of float64s from a selector. It is only allowed when selecting one field.
func (*EventSelect) Int ¶
Int returns a single int from a selector. It is only allowed when selecting one field.
func (*EventSelect) Ints ¶
Ints returns list of ints from a selector. It is only allowed when selecting one field.
func (*EventSelect) Scan ¶
func (_s *EventSelect) Scan(ctx context.Context, v any) error
Scan applies the selector query and scans the result into the given value.
func (*EventSelect) String ¶
String returns a single string from a selector. It is only allowed when selecting one field.
type EventUpdate ¶
type EventUpdate struct {
// contains filtered or unexported fields
}
EventUpdate is the builder for updating Event entities.
func (*EventUpdate) ClearSourceAgentID ¶
func (_u *EventUpdate) ClearSourceAgentID() *EventUpdate
ClearSourceAgentID clears the value of the "source_agent_id" field.
func (*EventUpdate) Exec ¶
func (_u *EventUpdate) Exec(ctx context.Context) error
Exec executes the query.
func (*EventUpdate) ExecX ¶
func (_u *EventUpdate) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*EventUpdate) Mutation ¶
func (_u *EventUpdate) Mutation() *EventMutation
Mutation returns the EventMutation object of the builder.
func (*EventUpdate) Save ¶
func (_u *EventUpdate) Save(ctx context.Context) (int, error)
Save executes the query and returns the number of nodes affected by the update operation.
func (*EventUpdate) SaveX ¶
func (_u *EventUpdate) SaveX(ctx context.Context) int
SaveX is like Save, but panics if an error occurs.
func (*EventUpdate) SetAgentID ¶
func (_u *EventUpdate) SetAgentID(v string) *EventUpdate
SetAgentID sets the "agent_id" field.
func (*EventUpdate) SetChannelID ¶
func (_u *EventUpdate) SetChannelID(v string) *EventUpdate
SetChannelID sets the "channel_id" field.
func (*EventUpdate) SetNillableAgentID ¶
func (_u *EventUpdate) SetNillableAgentID(v *string) *EventUpdate
SetNillableAgentID sets the "agent_id" field if the given value is not nil.
func (*EventUpdate) SetNillableChannelID ¶
func (_u *EventUpdate) SetNillableChannelID(v *string) *EventUpdate
SetNillableChannelID sets the "channel_id" field if the given value is not nil.
func (*EventUpdate) SetNillableRole ¶
func (_u *EventUpdate) SetNillableRole(v *event.Role) *EventUpdate
SetNillableRole sets the "role" field if the given value is not nil.
func (*EventUpdate) SetNillableSourceAgentID ¶
func (_u *EventUpdate) SetNillableSourceAgentID(v *string) *EventUpdate
SetNillableSourceAgentID sets the "source_agent_id" field if the given value is not nil.
func (*EventUpdate) SetNillableStatus ¶
func (_u *EventUpdate) SetNillableStatus(v *event.Status) *EventUpdate
SetNillableStatus sets the "status" field if the given value is not nil.
func (*EventUpdate) SetNillableTenantID ¶
func (_u *EventUpdate) SetNillableTenantID(v *string) *EventUpdate
SetNillableTenantID sets the "tenant_id" field if the given value is not nil.
func (*EventUpdate) SetNillableTimestamp ¶
func (_u *EventUpdate) SetNillableTimestamp(v *time.Time) *EventUpdate
SetNillableTimestamp sets the "timestamp" field if the given value is not nil.
func (*EventUpdate) SetNillableType ¶
func (_u *EventUpdate) SetNillableType(v *event.Type) *EventUpdate
SetNillableType sets the "type" field if the given value is not nil.
func (*EventUpdate) SetPayload ¶
func (_u *EventUpdate) SetPayload(v map[string]interface{}) *EventUpdate
SetPayload sets the "payload" field.
func (*EventUpdate) SetRole ¶
func (_u *EventUpdate) SetRole(v event.Role) *EventUpdate
SetRole sets the "role" field.
func (*EventUpdate) SetSourceAgentID ¶
func (_u *EventUpdate) SetSourceAgentID(v string) *EventUpdate
SetSourceAgentID sets the "source_agent_id" field.
func (*EventUpdate) SetStatus ¶
func (_u *EventUpdate) SetStatus(v event.Status) *EventUpdate
SetStatus sets the "status" field.
func (*EventUpdate) SetTenantID ¶
func (_u *EventUpdate) SetTenantID(v string) *EventUpdate
SetTenantID sets the "tenant_id" field.
func (*EventUpdate) SetTimestamp ¶
func (_u *EventUpdate) SetTimestamp(v time.Time) *EventUpdate
SetTimestamp sets the "timestamp" field.
func (*EventUpdate) SetType ¶
func (_u *EventUpdate) SetType(v event.Type) *EventUpdate
SetType sets the "type" field.
func (*EventUpdate) Where ¶
func (_u *EventUpdate) Where(ps ...predicate.Event) *EventUpdate
Where appends a list predicates to the EventUpdate builder.
type EventUpdateOne ¶
type EventUpdateOne struct {
// contains filtered or unexported fields
}
EventUpdateOne is the builder for updating a single Event entity.
func (*EventUpdateOne) ClearSourceAgentID ¶
func (_u *EventUpdateOne) ClearSourceAgentID() *EventUpdateOne
ClearSourceAgentID clears the value of the "source_agent_id" field.
func (*EventUpdateOne) Exec ¶
func (_u *EventUpdateOne) Exec(ctx context.Context) error
Exec executes the query on the entity.
func (*EventUpdateOne) ExecX ¶
func (_u *EventUpdateOne) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*EventUpdateOne) Mutation ¶
func (_u *EventUpdateOne) Mutation() *EventMutation
Mutation returns the EventMutation object of the builder.
func (*EventUpdateOne) Save ¶
func (_u *EventUpdateOne) Save(ctx context.Context) (*Event, error)
Save executes the query and returns the updated Event entity.
func (*EventUpdateOne) SaveX ¶
func (_u *EventUpdateOne) SaveX(ctx context.Context) *Event
SaveX is like Save, but panics if an error occurs.
func (*EventUpdateOne) Select ¶
func (_u *EventUpdateOne) Select(field string, fields ...string) *EventUpdateOne
Select allows selecting one or more fields (columns) of the returned entity. The default is selecting all fields defined in the entity schema.
func (*EventUpdateOne) SetAgentID ¶
func (_u *EventUpdateOne) SetAgentID(v string) *EventUpdateOne
SetAgentID sets the "agent_id" field.
func (*EventUpdateOne) SetChannelID ¶
func (_u *EventUpdateOne) SetChannelID(v string) *EventUpdateOne
SetChannelID sets the "channel_id" field.
func (*EventUpdateOne) SetNillableAgentID ¶
func (_u *EventUpdateOne) SetNillableAgentID(v *string) *EventUpdateOne
SetNillableAgentID sets the "agent_id" field if the given value is not nil.
func (*EventUpdateOne) SetNillableChannelID ¶
func (_u *EventUpdateOne) SetNillableChannelID(v *string) *EventUpdateOne
SetNillableChannelID sets the "channel_id" field if the given value is not nil.
func (*EventUpdateOne) SetNillableRole ¶
func (_u *EventUpdateOne) SetNillableRole(v *event.Role) *EventUpdateOne
SetNillableRole sets the "role" field if the given value is not nil.
func (*EventUpdateOne) SetNillableSourceAgentID ¶
func (_u *EventUpdateOne) SetNillableSourceAgentID(v *string) *EventUpdateOne
SetNillableSourceAgentID sets the "source_agent_id" field if the given value is not nil.
func (*EventUpdateOne) SetNillableStatus ¶
func (_u *EventUpdateOne) SetNillableStatus(v *event.Status) *EventUpdateOne
SetNillableStatus sets the "status" field if the given value is not nil.
func (*EventUpdateOne) SetNillableTenantID ¶
func (_u *EventUpdateOne) SetNillableTenantID(v *string) *EventUpdateOne
SetNillableTenantID sets the "tenant_id" field if the given value is not nil.
func (*EventUpdateOne) SetNillableTimestamp ¶
func (_u *EventUpdateOne) SetNillableTimestamp(v *time.Time) *EventUpdateOne
SetNillableTimestamp sets the "timestamp" field if the given value is not nil.
func (*EventUpdateOne) SetNillableType ¶
func (_u *EventUpdateOne) SetNillableType(v *event.Type) *EventUpdateOne
SetNillableType sets the "type" field if the given value is not nil.
func (*EventUpdateOne) SetPayload ¶
func (_u *EventUpdateOne) SetPayload(v map[string]interface{}) *EventUpdateOne
SetPayload sets the "payload" field.
func (*EventUpdateOne) SetRole ¶
func (_u *EventUpdateOne) SetRole(v event.Role) *EventUpdateOne
SetRole sets the "role" field.
func (*EventUpdateOne) SetSourceAgentID ¶
func (_u *EventUpdateOne) SetSourceAgentID(v string) *EventUpdateOne
SetSourceAgentID sets the "source_agent_id" field.
func (*EventUpdateOne) SetStatus ¶
func (_u *EventUpdateOne) SetStatus(v event.Status) *EventUpdateOne
SetStatus sets the "status" field.
func (*EventUpdateOne) SetTenantID ¶
func (_u *EventUpdateOne) SetTenantID(v string) *EventUpdateOne
SetTenantID sets the "tenant_id" field.
func (*EventUpdateOne) SetTimestamp ¶
func (_u *EventUpdateOne) SetTimestamp(v time.Time) *EventUpdateOne
SetTimestamp sets the "timestamp" field.
func (*EventUpdateOne) SetType ¶
func (_u *EventUpdateOne) SetType(v event.Type) *EventUpdateOne
SetType sets the "type" field.
func (*EventUpdateOne) Where ¶
func (_u *EventUpdateOne) Where(ps ...predicate.Event) *EventUpdateOne
Where appends a list predicates to the EventUpdate builder.
type InterceptFunc ¶
type InterceptFunc = ent.InterceptFunc
ent aliases to avoid import conflicts in user's code.
type Interceptor ¶
type Interceptor = ent.Interceptor
ent aliases to avoid import conflicts in user's code.
type MutateFunc ¶
type MutateFunc = ent.MutateFunc
ent aliases to avoid import conflicts in user's code.
type NotFoundError ¶
type NotFoundError struct {
// contains filtered or unexported fields
}
NotFoundError returns when trying to fetch a specific entity and it was not found in the database.
func (*NotFoundError) Error ¶
func (e *NotFoundError) Error() string
Error implements the error interface.
type NotLoadedError ¶
type NotLoadedError struct {
// contains filtered or unexported fields
}
NotLoadedError returns when trying to get a node that was not loaded by the query.
func (*NotLoadedError) Error ¶
func (e *NotLoadedError) Error() string
Error implements the error interface.
type NotSingularError ¶
type NotSingularError struct {
// contains filtered or unexported fields
}
NotSingularError returns when trying to fetch a singular entity and more then one was found in the database.
func (*NotSingularError) Error ¶
func (e *NotSingularError) Error() string
Error implements the error interface.
type OrderFunc ¶
OrderFunc applies an ordering on the sql selector. Deprecated: Use Asc/Desc functions or the package builders instead.
type QuerierFunc ¶
type QuerierFunc = ent.QuerierFunc
ent aliases to avoid import conflicts in user's code.
type QueryContext ¶
type QueryContext = ent.QueryContext
ent aliases to avoid import conflicts in user's code.
type 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 {
// Agent is the client for interacting with the Agent builders.
Agent *AgentClient
// Event is the client for interacting with the Event builders.
Event *EventClient
// 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.