Documentation
¶
Overview ¶
Package ent provides the generated Ent ORM code.
Index ¶
- Constants
- Variables
- func Asc(fields ...string) func(*sql.Selector)
- func Desc(fields ...string) func(*sql.Selector)
- func IsConstraintError(err error) bool
- func IsNotFound(err error) bool
- func IsNotLoaded(err error) bool
- func IsNotSingular(err error) bool
- func IsValidationError(err error) bool
- func MaskNotFound(err error) error
- func NewContext(parent context.Context, c *Client) context.Context
- func NewTxContext(parent context.Context, tx *Tx) context.Context
- type AggregateFunc
- type Client
- func (c *Client) BeginTx(ctx context.Context, opts *sql.TxOptions) (*Tx, error)
- func (c *Client) Close() error
- func (c *Client) Debug() *Client
- func (c *Client) Intercept(interceptors ...Interceptor)
- func (c *Client) Mutate(ctx context.Context, m Mutation) (Value, error)
- func (c *Client) Tx(ctx context.Context) (*Tx, error)
- func (c *Client) Use(hooks ...Hook)
- type CommitFunc
- type CommitHook
- type Committer
- type ConstraintError
- type Hook
- type InterceptFunc
- type Interceptor
- type Memories
- type Memory
- type MemoryClient
- func (c *MemoryClient) Create() *MemoryCreate
- func (c *MemoryClient) CreateBulk(builders ...*MemoryCreate) *MemoryCreateBulk
- func (c *MemoryClient) Delete() *MemoryDelete
- func (c *MemoryClient) DeleteOne(_m *Memory) *MemoryDeleteOne
- func (c *MemoryClient) DeleteOneID(id string) *MemoryDeleteOne
- func (c *MemoryClient) Get(ctx context.Context, id string) (*Memory, error)
- func (c *MemoryClient) GetX(ctx context.Context, id string) *Memory
- func (c *MemoryClient) Hooks() []Hook
- func (c *MemoryClient) Intercept(interceptors ...Interceptor)
- func (c *MemoryClient) Interceptors() []Interceptor
- func (c *MemoryClient) MapCreateBulk(slice any, setFunc func(*MemoryCreate, int)) *MemoryCreateBulk
- func (c *MemoryClient) Query() *MemoryQuery
- func (c *MemoryClient) Update() *MemoryUpdate
- func (c *MemoryClient) UpdateOne(_m *Memory) *MemoryUpdateOne
- func (c *MemoryClient) UpdateOneID(id string) *MemoryUpdateOne
- func (c *MemoryClient) Use(hooks ...Hook)
- type MemoryCreate
- func (_c *MemoryCreate) Exec(ctx context.Context) error
- func (_c *MemoryCreate) ExecX(ctx context.Context)
- func (_c *MemoryCreate) Mutation() *MemoryMutation
- func (_c *MemoryCreate) Save(ctx context.Context) (*Memory, error)
- func (_c *MemoryCreate) SaveX(ctx context.Context) *Memory
- func (_c *MemoryCreate) SetAgentID(v string) *MemoryCreate
- func (_c *MemoryCreate) SetContent(v string) *MemoryCreate
- func (_c *MemoryCreate) SetCreatedAt(v time.Time) *MemoryCreate
- func (_c *MemoryCreate) SetEmbedding(v []float32) *MemoryCreate
- func (_c *MemoryCreate) SetExpiresAt(v time.Time) *MemoryCreate
- func (_c *MemoryCreate) SetID(v string) *MemoryCreate
- func (_c *MemoryCreate) SetMetadata(v map[string]interface{}) *MemoryCreate
- func (_c *MemoryCreate) SetNillableAgentID(v *string) *MemoryCreate
- func (_c *MemoryCreate) SetNillableCreatedAt(v *time.Time) *MemoryCreate
- func (_c *MemoryCreate) SetNillableExpiresAt(v *time.Time) *MemoryCreate
- func (_c *MemoryCreate) SetNillableSessionID(v *string) *MemoryCreate
- func (_c *MemoryCreate) SetNillableUpdatedAt(v *time.Time) *MemoryCreate
- func (_c *MemoryCreate) SetScope(v string) *MemoryCreate
- func (_c *MemoryCreate) SetSessionID(v string) *MemoryCreate
- func (_c *MemoryCreate) SetSubjectID(v string) *MemoryCreate
- func (_c *MemoryCreate) SetTenantID(v string) *MemoryCreate
- func (_c *MemoryCreate) SetType(v string) *MemoryCreate
- func (_c *MemoryCreate) SetUpdatedAt(v time.Time) *MemoryCreate
- type MemoryCreateBulk
- type MemoryDelete
- type MemoryDeleteOne
- type MemoryGroupBy
- func (_g *MemoryGroupBy) Aggregate(fns ...AggregateFunc) *MemoryGroupBy
- func (s *MemoryGroupBy) Bool(ctx context.Context) (_ bool, err error)
- func (s *MemoryGroupBy) BoolX(ctx context.Context) bool
- func (s *MemoryGroupBy) Bools(ctx context.Context) ([]bool, error)
- func (s *MemoryGroupBy) BoolsX(ctx context.Context) []bool
- func (s *MemoryGroupBy) Float64(ctx context.Context) (_ float64, err error)
- func (s *MemoryGroupBy) Float64X(ctx context.Context) float64
- func (s *MemoryGroupBy) Float64s(ctx context.Context) ([]float64, error)
- func (s *MemoryGroupBy) Float64sX(ctx context.Context) []float64
- func (s *MemoryGroupBy) Int(ctx context.Context) (_ int, err error)
- func (s *MemoryGroupBy) IntX(ctx context.Context) int
- func (s *MemoryGroupBy) Ints(ctx context.Context) ([]int, error)
- func (s *MemoryGroupBy) IntsX(ctx context.Context) []int
- func (_g *MemoryGroupBy) Scan(ctx context.Context, v any) error
- func (s *MemoryGroupBy) ScanX(ctx context.Context, v any)
- func (s *MemoryGroupBy) String(ctx context.Context) (_ string, err error)
- func (s *MemoryGroupBy) StringX(ctx context.Context) string
- func (s *MemoryGroupBy) Strings(ctx context.Context) ([]string, error)
- func (s *MemoryGroupBy) StringsX(ctx context.Context) []string
- type MemoryMutation
- func (m *MemoryMutation) AddField(name string, value ent.Value) error
- func (m *MemoryMutation) AddedEdges() []string
- func (m *MemoryMutation) AddedField(name string) (ent.Value, bool)
- func (m *MemoryMutation) AddedFields() []string
- func (m *MemoryMutation) AddedIDs(name string) []ent.Value
- func (m *MemoryMutation) AgentID() (r string, exists bool)
- func (m *MemoryMutation) AgentIDCleared() bool
- func (m *MemoryMutation) AppendEmbedding(f []float32)
- func (m *MemoryMutation) AppendedEmbedding() ([]float32, bool)
- func (m *MemoryMutation) ClearAgentID()
- func (m *MemoryMutation) ClearEdge(name string) error
- func (m *MemoryMutation) ClearEmbedding()
- func (m *MemoryMutation) ClearExpiresAt()
- func (m *MemoryMutation) ClearField(name string) error
- func (m *MemoryMutation) ClearMetadata()
- func (m *MemoryMutation) ClearSessionID()
- func (m *MemoryMutation) ClearedEdges() []string
- func (m *MemoryMutation) ClearedFields() []string
- func (m MemoryMutation) Client() *Client
- func (m *MemoryMutation) Content() (r string, exists bool)
- func (m *MemoryMutation) CreatedAt() (r time.Time, exists bool)
- func (m *MemoryMutation) EdgeCleared(name string) bool
- func (m *MemoryMutation) Embedding() (r []float32, exists bool)
- func (m *MemoryMutation) EmbeddingCleared() bool
- func (m *MemoryMutation) ExpiresAt() (r time.Time, exists bool)
- func (m *MemoryMutation) ExpiresAtCleared() bool
- func (m *MemoryMutation) Field(name string) (ent.Value, bool)
- func (m *MemoryMutation) FieldCleared(name string) bool
- func (m *MemoryMutation) Fields() []string
- func (m *MemoryMutation) GetType() (r string, exists bool)
- func (m *MemoryMutation) ID() (id string, exists bool)
- func (m *MemoryMutation) IDs(ctx context.Context) ([]string, error)
- func (m *MemoryMutation) Metadata() (r map[string]interface{}, exists bool)
- func (m *MemoryMutation) MetadataCleared() bool
- func (m *MemoryMutation) OldAgentID(ctx context.Context) (v string, err error)
- func (m *MemoryMutation) OldContent(ctx context.Context) (v string, err error)
- func (m *MemoryMutation) OldCreatedAt(ctx context.Context) (v time.Time, err error)
- func (m *MemoryMutation) OldEmbedding(ctx context.Context) (v []float32, err error)
- func (m *MemoryMutation) OldExpiresAt(ctx context.Context) (v *time.Time, err error)
- func (m *MemoryMutation) OldField(ctx context.Context, name string) (ent.Value, error)
- func (m *MemoryMutation) OldMetadata(ctx context.Context) (v map[string]interface{}, err error)
- func (m *MemoryMutation) OldScope(ctx context.Context) (v string, err error)
- func (m *MemoryMutation) OldSessionID(ctx context.Context) (v string, err error)
- func (m *MemoryMutation) OldSubjectID(ctx context.Context) (v string, err error)
- func (m *MemoryMutation) OldTenantID(ctx context.Context) (v string, err error)
- func (m *MemoryMutation) OldType(ctx context.Context) (v string, err error)
- func (m *MemoryMutation) OldUpdatedAt(ctx context.Context) (v time.Time, err error)
- func (m *MemoryMutation) Op() Op
- func (m *MemoryMutation) RemovedEdges() []string
- func (m *MemoryMutation) RemovedIDs(name string) []ent.Value
- func (m *MemoryMutation) ResetAgentID()
- func (m *MemoryMutation) ResetContent()
- func (m *MemoryMutation) ResetCreatedAt()
- func (m *MemoryMutation) ResetEdge(name string) error
- func (m *MemoryMutation) ResetEmbedding()
- func (m *MemoryMutation) ResetExpiresAt()
- func (m *MemoryMutation) ResetField(name string) error
- func (m *MemoryMutation) ResetMetadata()
- func (m *MemoryMutation) ResetScope()
- func (m *MemoryMutation) ResetSessionID()
- func (m *MemoryMutation) ResetSubjectID()
- func (m *MemoryMutation) ResetTenantID()
- func (m *MemoryMutation) ResetType()
- func (m *MemoryMutation) ResetUpdatedAt()
- func (m *MemoryMutation) Scope() (r string, exists bool)
- func (m *MemoryMutation) SessionID() (r string, exists bool)
- func (m *MemoryMutation) SessionIDCleared() bool
- func (m *MemoryMutation) SetAgentID(s string)
- func (m *MemoryMutation) SetContent(s string)
- func (m *MemoryMutation) SetCreatedAt(t time.Time)
- func (m *MemoryMutation) SetEmbedding(f []float32)
- func (m *MemoryMutation) SetExpiresAt(t time.Time)
- func (m *MemoryMutation) SetField(name string, value ent.Value) error
- func (m *MemoryMutation) SetID(id string)
- func (m *MemoryMutation) SetMetadata(value map[string]interface{})
- func (m *MemoryMutation) SetOp(op Op)
- func (m *MemoryMutation) SetScope(s string)
- func (m *MemoryMutation) SetSessionID(s string)
- func (m *MemoryMutation) SetSubjectID(s string)
- func (m *MemoryMutation) SetTenantID(s string)
- func (m *MemoryMutation) SetType(s string)
- func (m *MemoryMutation) SetUpdatedAt(t time.Time)
- func (m *MemoryMutation) SubjectID() (r string, exists bool)
- func (m *MemoryMutation) TenantID() (r string, exists bool)
- func (m MemoryMutation) Tx() (*Tx, error)
- func (m *MemoryMutation) Type() string
- func (m *MemoryMutation) UpdatedAt() (r time.Time, exists bool)
- func (m *MemoryMutation) Where(ps ...predicate.Memory)
- func (m *MemoryMutation) WhereP(ps ...func(*sql.Selector))
- type MemoryQuery
- func (_q *MemoryQuery) Aggregate(fns ...AggregateFunc) *MemorySelect
- func (_q *MemoryQuery) All(ctx context.Context) ([]*Memory, error)
- func (_q *MemoryQuery) AllX(ctx context.Context) []*Memory
- func (_q *MemoryQuery) Clone() *MemoryQuery
- func (_q *MemoryQuery) Count(ctx context.Context) (int, error)
- func (_q *MemoryQuery) CountX(ctx context.Context) int
- func (_q *MemoryQuery) Exist(ctx context.Context) (bool, error)
- func (_q *MemoryQuery) ExistX(ctx context.Context) bool
- func (_q *MemoryQuery) First(ctx context.Context) (*Memory, error)
- func (_q *MemoryQuery) FirstID(ctx context.Context) (id string, err error)
- func (_q *MemoryQuery) FirstIDX(ctx context.Context) string
- func (_q *MemoryQuery) FirstX(ctx context.Context) *Memory
- func (_q *MemoryQuery) GroupBy(field string, fields ...string) *MemoryGroupBy
- func (_q *MemoryQuery) IDs(ctx context.Context) (ids []string, err error)
- func (_q *MemoryQuery) IDsX(ctx context.Context) []string
- func (_q *MemoryQuery) Limit(limit int) *MemoryQuery
- func (_q *MemoryQuery) Offset(offset int) *MemoryQuery
- func (_q *MemoryQuery) Only(ctx context.Context) (*Memory, error)
- func (_q *MemoryQuery) OnlyID(ctx context.Context) (id string, err error)
- func (_q *MemoryQuery) OnlyIDX(ctx context.Context) string
- func (_q *MemoryQuery) OnlyX(ctx context.Context) *Memory
- func (_q *MemoryQuery) Order(o ...memory.OrderOption) *MemoryQuery
- func (_q *MemoryQuery) Select(fields ...string) *MemorySelect
- func (_q *MemoryQuery) Unique(unique bool) *MemoryQuery
- func (_q *MemoryQuery) Where(ps ...predicate.Memory) *MemoryQuery
- type MemorySelect
- func (_s *MemorySelect) Aggregate(fns ...AggregateFunc) *MemorySelect
- func (s *MemorySelect) Bool(ctx context.Context) (_ bool, err error)
- func (s *MemorySelect) BoolX(ctx context.Context) bool
- func (s *MemorySelect) Bools(ctx context.Context) ([]bool, error)
- func (s *MemorySelect) BoolsX(ctx context.Context) []bool
- func (s *MemorySelect) Float64(ctx context.Context) (_ float64, err error)
- func (s *MemorySelect) Float64X(ctx context.Context) float64
- func (s *MemorySelect) Float64s(ctx context.Context) ([]float64, error)
- func (s *MemorySelect) Float64sX(ctx context.Context) []float64
- func (s *MemorySelect) Int(ctx context.Context) (_ int, err error)
- func (s *MemorySelect) IntX(ctx context.Context) int
- func (s *MemorySelect) Ints(ctx context.Context) ([]int, error)
- func (s *MemorySelect) IntsX(ctx context.Context) []int
- func (_s *MemorySelect) Scan(ctx context.Context, v any) error
- func (s *MemorySelect) ScanX(ctx context.Context, v any)
- func (s *MemorySelect) String(ctx context.Context) (_ string, err error)
- func (s *MemorySelect) StringX(ctx context.Context) string
- func (s *MemorySelect) Strings(ctx context.Context) ([]string, error)
- func (s *MemorySelect) StringsX(ctx context.Context) []string
- type MemoryUpdate
- func (_u *MemoryUpdate) AppendEmbedding(v []float32) *MemoryUpdate
- func (_u *MemoryUpdate) ClearAgentID() *MemoryUpdate
- func (_u *MemoryUpdate) ClearEmbedding() *MemoryUpdate
- func (_u *MemoryUpdate) ClearExpiresAt() *MemoryUpdate
- func (_u *MemoryUpdate) ClearMetadata() *MemoryUpdate
- func (_u *MemoryUpdate) ClearSessionID() *MemoryUpdate
- func (_u *MemoryUpdate) Exec(ctx context.Context) error
- func (_u *MemoryUpdate) ExecX(ctx context.Context)
- func (_u *MemoryUpdate) Mutation() *MemoryMutation
- func (_u *MemoryUpdate) Save(ctx context.Context) (int, error)
- func (_u *MemoryUpdate) SaveX(ctx context.Context) int
- func (_u *MemoryUpdate) SetAgentID(v string) *MemoryUpdate
- func (_u *MemoryUpdate) SetContent(v string) *MemoryUpdate
- func (_u *MemoryUpdate) SetEmbedding(v []float32) *MemoryUpdate
- func (_u *MemoryUpdate) SetExpiresAt(v time.Time) *MemoryUpdate
- func (_u *MemoryUpdate) SetMetadata(v map[string]interface{}) *MemoryUpdate
- func (_u *MemoryUpdate) SetNillableAgentID(v *string) *MemoryUpdate
- func (_u *MemoryUpdate) SetNillableContent(v *string) *MemoryUpdate
- func (_u *MemoryUpdate) SetNillableExpiresAt(v *time.Time) *MemoryUpdate
- func (_u *MemoryUpdate) SetNillableScope(v *string) *MemoryUpdate
- func (_u *MemoryUpdate) SetNillableSessionID(v *string) *MemoryUpdate
- func (_u *MemoryUpdate) SetNillableSubjectID(v *string) *MemoryUpdate
- func (_u *MemoryUpdate) SetNillableTenantID(v *string) *MemoryUpdate
- func (_u *MemoryUpdate) SetNillableType(v *string) *MemoryUpdate
- func (_u *MemoryUpdate) SetScope(v string) *MemoryUpdate
- func (_u *MemoryUpdate) SetSessionID(v string) *MemoryUpdate
- func (_u *MemoryUpdate) SetSubjectID(v string) *MemoryUpdate
- func (_u *MemoryUpdate) SetTenantID(v string) *MemoryUpdate
- func (_u *MemoryUpdate) SetType(v string) *MemoryUpdate
- func (_u *MemoryUpdate) SetUpdatedAt(v time.Time) *MemoryUpdate
- func (_u *MemoryUpdate) Where(ps ...predicate.Memory) *MemoryUpdate
- type MemoryUpdateOne
- func (_u *MemoryUpdateOne) AppendEmbedding(v []float32) *MemoryUpdateOne
- func (_u *MemoryUpdateOne) ClearAgentID() *MemoryUpdateOne
- func (_u *MemoryUpdateOne) ClearEmbedding() *MemoryUpdateOne
- func (_u *MemoryUpdateOne) ClearExpiresAt() *MemoryUpdateOne
- func (_u *MemoryUpdateOne) ClearMetadata() *MemoryUpdateOne
- func (_u *MemoryUpdateOne) ClearSessionID() *MemoryUpdateOne
- func (_u *MemoryUpdateOne) Exec(ctx context.Context) error
- func (_u *MemoryUpdateOne) ExecX(ctx context.Context)
- func (_u *MemoryUpdateOne) Mutation() *MemoryMutation
- func (_u *MemoryUpdateOne) Save(ctx context.Context) (*Memory, error)
- func (_u *MemoryUpdateOne) SaveX(ctx context.Context) *Memory
- func (_u *MemoryUpdateOne) Select(field string, fields ...string) *MemoryUpdateOne
- func (_u *MemoryUpdateOne) SetAgentID(v string) *MemoryUpdateOne
- func (_u *MemoryUpdateOne) SetContent(v string) *MemoryUpdateOne
- func (_u *MemoryUpdateOne) SetEmbedding(v []float32) *MemoryUpdateOne
- func (_u *MemoryUpdateOne) SetExpiresAt(v time.Time) *MemoryUpdateOne
- func (_u *MemoryUpdateOne) SetMetadata(v map[string]interface{}) *MemoryUpdateOne
- func (_u *MemoryUpdateOne) SetNillableAgentID(v *string) *MemoryUpdateOne
- func (_u *MemoryUpdateOne) SetNillableContent(v *string) *MemoryUpdateOne
- func (_u *MemoryUpdateOne) SetNillableExpiresAt(v *time.Time) *MemoryUpdateOne
- func (_u *MemoryUpdateOne) SetNillableScope(v *string) *MemoryUpdateOne
- func (_u *MemoryUpdateOne) SetNillableSessionID(v *string) *MemoryUpdateOne
- func (_u *MemoryUpdateOne) SetNillableSubjectID(v *string) *MemoryUpdateOne
- func (_u *MemoryUpdateOne) SetNillableTenantID(v *string) *MemoryUpdateOne
- func (_u *MemoryUpdateOne) SetNillableType(v *string) *MemoryUpdateOne
- func (_u *MemoryUpdateOne) SetScope(v string) *MemoryUpdateOne
- func (_u *MemoryUpdateOne) SetSessionID(v string) *MemoryUpdateOne
- func (_u *MemoryUpdateOne) SetSubjectID(v string) *MemoryUpdateOne
- func (_u *MemoryUpdateOne) SetTenantID(v string) *MemoryUpdateOne
- func (_u *MemoryUpdateOne) SetType(v string) *MemoryUpdateOne
- func (_u *MemoryUpdateOne) SetUpdatedAt(v time.Time) *MemoryUpdateOne
- func (_u *MemoryUpdateOne) Where(ps ...predicate.Memory) *MemoryUpdateOne
- 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. TypeMemory = "Memory" )
Variables ¶
var ErrTxStarted = errors.New("ent: cannot start a transaction within a transaction")
ErrTxStarted is returned when trying to start a new transaction from a transactional client.
Functions ¶
func IsConstraintError ¶
IsConstraintError returns a boolean indicating whether the error is a constraint failure.
func IsNotFound ¶
IsNotFound returns a boolean indicating whether the error is a not found error.
func IsNotLoaded ¶
IsNotLoaded returns a boolean indicating whether the error is a not loaded error.
func IsNotSingular ¶
IsNotSingular returns a boolean indicating whether the error is a not singular error.
func IsValidationError ¶
IsValidationError returns a boolean indicating whether the error is a validation error.
func NewContext ¶
NewContext returns a new context with the given Client attached.
Types ¶
type AggregateFunc ¶
AggregateFunc applies an aggregation step on the group-by traversal/selector.
func As ¶
func As(fn AggregateFunc, end string) AggregateFunc
As is a pseudo aggregation function for renaming another other functions with custom names. For example:
GroupBy(field1, field2). Aggregate(ent.As(ent.Sum(field1), "sum_field1"), (ent.As(ent.Sum(field2), "sum_field2")). Scan(ctx, &v)
func Count ¶
func Count() AggregateFunc
Count applies the "count" aggregation function on each group.
func Max ¶
func Max(field string) AggregateFunc
Max applies the "max" aggregation function on the given field of each group.
func Mean ¶
func Mean(field string) AggregateFunc
Mean applies the "mean" aggregation function on the given field of each group.
func Min ¶
func Min(field string) AggregateFunc
Min applies the "min" aggregation function on the given field of each group.
func Sum ¶
func Sum(field string) AggregateFunc
Sum applies the "sum" aggregation function on the given field of each group.
type Client ¶
type Client struct {
// Schema is the client for creating, migrating and dropping schema.
Schema *migrate.Schema
// Memory is the client for interacting with the Memory builders.
Memory *MemoryClient
// 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(). Memory. Query(). Count(ctx)
func (*Client) Intercept ¶
func (c *Client) Intercept(interceptors ...Interceptor)
Intercept adds the query interceptors to all the entity clients. In order to add interceptors to a specific client, call: `client.Node.Intercept(...)`.
type CommitFunc ¶
The CommitFunc type is an adapter to allow the use of ordinary function as a Committer. If f is a function with the appropriate signature, CommitFunc(f) is a Committer that calls f.
type CommitHook ¶
CommitHook defines the "commit middleware". A function that gets a Committer and returns a Committer. For example:
hook := func(next ent.Committer) ent.Committer {
return ent.CommitFunc(func(ctx context.Context, tx *ent.Tx) error {
// Do some stuff before.
if err := next.Commit(ctx, tx); err != nil {
return err
}
// Do some stuff after.
return nil
})
}
type ConstraintError ¶
type ConstraintError struct {
// contains filtered or unexported fields
}
ConstraintError returns when trying to create/update one or more entities and one or more of their constraints failed. For example, violation of edge or field uniqueness.
func (ConstraintError) Error ¶
func (e ConstraintError) Error() string
Error implements the error interface.
func (*ConstraintError) Unwrap ¶
func (e *ConstraintError) Unwrap() error
Unwrap implements the errors.Wrapper interface.
type InterceptFunc ¶
type InterceptFunc = ent.InterceptFunc
ent aliases to avoid import conflicts in user's code.
type Interceptor ¶
type Interceptor = ent.Interceptor
ent aliases to avoid import conflicts in user's code.
type Memory ¶
type Memory struct {
// ID of the ent.
// Unique identifier for the memory
ID string `json:"id,omitempty"`
// Tenant ID for multi-tenancy
TenantID string `json:"tenant_id,omitempty"`
// Who this memory is about
SubjectID string `json:"subject_id,omitempty"`
// Agent that created or owns this memory
AgentID string `json:"agent_id,omitempty"`
// Session that created this memory
SessionID string `json:"session_id,omitempty"`
// Memory scope: user, agent, tenant, team, session, domain
Scope string `json:"scope,omitempty"`
// Memory type: observation, fact, preference, summary, trait, relationship
Type string `json:"type,omitempty"`
// The memory content
Content string `json:"content,omitempty"`
// Vector embedding for semantic search
Embedding []float32 `json:"embedding,omitempty"`
// Additional metadata
Metadata map[string]interface{} `json:"metadata,omitempty"`
// When the memory was created
CreatedAt time.Time `json:"created_at,omitempty"`
// When the memory was last updated
UpdatedAt time.Time `json:"updated_at,omitempty"`
// When the memory expires (nil = never)
ExpiresAt *time.Time `json:"expires_at,omitempty"`
// contains filtered or unexported fields
}
Memory is the model entity for the Memory schema.
func (*Memory) Unwrap ¶
Unwrap unwraps the Memory 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 (*Memory) Update ¶
func (_m *Memory) Update() *MemoryUpdateOne
Update returns a builder for updating this Memory. Note that you need to call Memory.Unwrap() before calling this method if this Memory was returned from a transaction, and the transaction was committed or rolled back.
type MemoryClient ¶
type MemoryClient struct {
// contains filtered or unexported fields
}
MemoryClient is a client for the Memory schema.
func NewMemoryClient ¶
func NewMemoryClient(c config) *MemoryClient
NewMemoryClient returns a client for the Memory from the given config.
func (*MemoryClient) Create ¶
func (c *MemoryClient) Create() *MemoryCreate
Create returns a builder for creating a Memory entity.
func (*MemoryClient) CreateBulk ¶
func (c *MemoryClient) CreateBulk(builders ...*MemoryCreate) *MemoryCreateBulk
CreateBulk returns a builder for creating a bulk of Memory entities.
func (*MemoryClient) Delete ¶
func (c *MemoryClient) Delete() *MemoryDelete
Delete returns a delete builder for Memory.
func (*MemoryClient) DeleteOne ¶
func (c *MemoryClient) DeleteOne(_m *Memory) *MemoryDeleteOne
DeleteOne returns a builder for deleting the given entity.
func (*MemoryClient) DeleteOneID ¶
func (c *MemoryClient) DeleteOneID(id string) *MemoryDeleteOne
DeleteOneID returns a builder for deleting the given entity by its id.
func (*MemoryClient) GetX ¶
func (c *MemoryClient) GetX(ctx context.Context, id string) *Memory
GetX is like Get, but panics if an error occurs.
func (*MemoryClient) Intercept ¶
func (c *MemoryClient) Intercept(interceptors ...Interceptor)
Intercept adds a list of query interceptors to the interceptors stack. A call to `Intercept(f, g, h)` equals to `memory.Intercept(f(g(h())))`.
func (*MemoryClient) Interceptors ¶
func (c *MemoryClient) Interceptors() []Interceptor
Interceptors returns the client interceptors.
func (*MemoryClient) MapCreateBulk ¶
func (c *MemoryClient) MapCreateBulk(slice any, setFunc func(*MemoryCreate, int)) *MemoryCreateBulk
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 (*MemoryClient) Query ¶
func (c *MemoryClient) Query() *MemoryQuery
Query returns a query builder for Memory.
func (*MemoryClient) Update ¶
func (c *MemoryClient) Update() *MemoryUpdate
Update returns an update builder for Memory.
func (*MemoryClient) UpdateOne ¶
func (c *MemoryClient) UpdateOne(_m *Memory) *MemoryUpdateOne
UpdateOne returns an update builder for the given entity.
func (*MemoryClient) UpdateOneID ¶
func (c *MemoryClient) UpdateOneID(id string) *MemoryUpdateOne
UpdateOneID returns an update builder for the given id.
func (*MemoryClient) Use ¶
func (c *MemoryClient) Use(hooks ...Hook)
Use adds a list of mutation hooks to the hooks stack. A call to `Use(f, g, h)` equals to `memory.Hooks(f(g(h())))`.
type MemoryCreate ¶
type MemoryCreate struct {
// contains filtered or unexported fields
}
MemoryCreate is the builder for creating a Memory entity.
func (*MemoryCreate) Exec ¶
func (_c *MemoryCreate) Exec(ctx context.Context) error
Exec executes the query.
func (*MemoryCreate) ExecX ¶
func (_c *MemoryCreate) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*MemoryCreate) Mutation ¶
func (_c *MemoryCreate) Mutation() *MemoryMutation
Mutation returns the MemoryMutation object of the builder.
func (*MemoryCreate) Save ¶
func (_c *MemoryCreate) Save(ctx context.Context) (*Memory, error)
Save creates the Memory in the database.
func (*MemoryCreate) SaveX ¶
func (_c *MemoryCreate) SaveX(ctx context.Context) *Memory
SaveX calls Save and panics if Save returns an error.
func (*MemoryCreate) SetAgentID ¶
func (_c *MemoryCreate) SetAgentID(v string) *MemoryCreate
SetAgentID sets the "agent_id" field.
func (*MemoryCreate) SetContent ¶
func (_c *MemoryCreate) SetContent(v string) *MemoryCreate
SetContent sets the "content" field.
func (*MemoryCreate) SetCreatedAt ¶
func (_c *MemoryCreate) SetCreatedAt(v time.Time) *MemoryCreate
SetCreatedAt sets the "created_at" field.
func (*MemoryCreate) SetEmbedding ¶
func (_c *MemoryCreate) SetEmbedding(v []float32) *MemoryCreate
SetEmbedding sets the "embedding" field.
func (*MemoryCreate) SetExpiresAt ¶
func (_c *MemoryCreate) SetExpiresAt(v time.Time) *MemoryCreate
SetExpiresAt sets the "expires_at" field.
func (*MemoryCreate) SetID ¶
func (_c *MemoryCreate) SetID(v string) *MemoryCreate
SetID sets the "id" field.
func (*MemoryCreate) SetMetadata ¶
func (_c *MemoryCreate) SetMetadata(v map[string]interface{}) *MemoryCreate
SetMetadata sets the "metadata" field.
func (*MemoryCreate) SetNillableAgentID ¶
func (_c *MemoryCreate) SetNillableAgentID(v *string) *MemoryCreate
SetNillableAgentID sets the "agent_id" field if the given value is not nil.
func (*MemoryCreate) SetNillableCreatedAt ¶
func (_c *MemoryCreate) SetNillableCreatedAt(v *time.Time) *MemoryCreate
SetNillableCreatedAt sets the "created_at" field if the given value is not nil.
func (*MemoryCreate) SetNillableExpiresAt ¶
func (_c *MemoryCreate) SetNillableExpiresAt(v *time.Time) *MemoryCreate
SetNillableExpiresAt sets the "expires_at" field if the given value is not nil.
func (*MemoryCreate) SetNillableSessionID ¶
func (_c *MemoryCreate) SetNillableSessionID(v *string) *MemoryCreate
SetNillableSessionID sets the "session_id" field if the given value is not nil.
func (*MemoryCreate) SetNillableUpdatedAt ¶
func (_c *MemoryCreate) SetNillableUpdatedAt(v *time.Time) *MemoryCreate
SetNillableUpdatedAt sets the "updated_at" field if the given value is not nil.
func (*MemoryCreate) SetScope ¶
func (_c *MemoryCreate) SetScope(v string) *MemoryCreate
SetScope sets the "scope" field.
func (*MemoryCreate) SetSessionID ¶
func (_c *MemoryCreate) SetSessionID(v string) *MemoryCreate
SetSessionID sets the "session_id" field.
func (*MemoryCreate) SetSubjectID ¶
func (_c *MemoryCreate) SetSubjectID(v string) *MemoryCreate
SetSubjectID sets the "subject_id" field.
func (*MemoryCreate) SetTenantID ¶
func (_c *MemoryCreate) SetTenantID(v string) *MemoryCreate
SetTenantID sets the "tenant_id" field.
func (*MemoryCreate) SetType ¶
func (_c *MemoryCreate) SetType(v string) *MemoryCreate
SetType sets the "type" field.
func (*MemoryCreate) SetUpdatedAt ¶
func (_c *MemoryCreate) SetUpdatedAt(v time.Time) *MemoryCreate
SetUpdatedAt sets the "updated_at" field.
type MemoryCreateBulk ¶
type MemoryCreateBulk struct {
// contains filtered or unexported fields
}
MemoryCreateBulk is the builder for creating many Memory entities in bulk.
func (*MemoryCreateBulk) Exec ¶
func (_c *MemoryCreateBulk) Exec(ctx context.Context) error
Exec executes the query.
func (*MemoryCreateBulk) ExecX ¶
func (_c *MemoryCreateBulk) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
type MemoryDelete ¶
type MemoryDelete struct {
// contains filtered or unexported fields
}
MemoryDelete is the builder for deleting a Memory entity.
func (*MemoryDelete) Exec ¶
func (_d *MemoryDelete) Exec(ctx context.Context) (int, error)
Exec executes the deletion query and returns how many vertices were deleted.
func (*MemoryDelete) ExecX ¶
func (_d *MemoryDelete) ExecX(ctx context.Context) int
ExecX is like Exec, but panics if an error occurs.
func (*MemoryDelete) Where ¶
func (_d *MemoryDelete) Where(ps ...predicate.Memory) *MemoryDelete
Where appends a list predicates to the MemoryDelete builder.
type MemoryDeleteOne ¶
type MemoryDeleteOne struct {
// contains filtered or unexported fields
}
MemoryDeleteOne is the builder for deleting a single Memory entity.
func (*MemoryDeleteOne) Exec ¶
func (_d *MemoryDeleteOne) Exec(ctx context.Context) error
Exec executes the deletion query.
func (*MemoryDeleteOne) ExecX ¶
func (_d *MemoryDeleteOne) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*MemoryDeleteOne) Where ¶
func (_d *MemoryDeleteOne) Where(ps ...predicate.Memory) *MemoryDeleteOne
Where appends a list predicates to the MemoryDelete builder.
type MemoryGroupBy ¶
type MemoryGroupBy struct {
// contains filtered or unexported fields
}
MemoryGroupBy is the group-by builder for Memory entities.
func (*MemoryGroupBy) Aggregate ¶
func (_g *MemoryGroupBy) Aggregate(fns ...AggregateFunc) *MemoryGroupBy
Aggregate adds the given aggregation functions to the group-by query.
func (*MemoryGroupBy) Bool ¶
Bool returns a single bool from a selector. It is only allowed when selecting one field.
func (*MemoryGroupBy) Bools ¶
Bools returns list of bools from a selector. It is only allowed when selecting one field.
func (*MemoryGroupBy) Float64 ¶
Float64 returns a single float64 from a selector. It is only allowed when selecting one field.
func (*MemoryGroupBy) Float64s ¶
Float64s returns list of float64s from a selector. It is only allowed when selecting one field.
func (*MemoryGroupBy) Int ¶
Int returns a single int from a selector. It is only allowed when selecting one field.
func (*MemoryGroupBy) Ints ¶
Ints returns list of ints from a selector. It is only allowed when selecting one field.
func (*MemoryGroupBy) Scan ¶
func (_g *MemoryGroupBy) Scan(ctx context.Context, v any) error
Scan applies the selector query and scans the result into the given value.
func (*MemoryGroupBy) String ¶
String returns a single string from a selector. It is only allowed when selecting one field.
type MemoryMutation ¶
type MemoryMutation struct {
// contains filtered or unexported fields
}
MemoryMutation represents an operation that mutates the Memory nodes in the graph.
func (*MemoryMutation) AddField ¶
func (m *MemoryMutation) 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 (*MemoryMutation) AddedEdges ¶
func (m *MemoryMutation) AddedEdges() []string
AddedEdges returns all edge names that were set/added in this mutation.
func (*MemoryMutation) AddedField ¶
func (m *MemoryMutation) 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 (*MemoryMutation) AddedFields ¶
func (m *MemoryMutation) AddedFields() []string
AddedFields returns all numeric fields that were incremented/decremented during this mutation.
func (*MemoryMutation) AddedIDs ¶
func (m *MemoryMutation) AddedIDs(name string) []ent.Value
AddedIDs returns all IDs (to other nodes) that were added for the given edge name in this mutation.
func (*MemoryMutation) AgentID ¶
func (m *MemoryMutation) AgentID() (r string, exists bool)
AgentID returns the value of the "agent_id" field in the mutation.
func (*MemoryMutation) AgentIDCleared ¶
func (m *MemoryMutation) AgentIDCleared() bool
AgentIDCleared returns if the "agent_id" field was cleared in this mutation.
func (*MemoryMutation) AppendEmbedding ¶
func (m *MemoryMutation) AppendEmbedding(f []float32)
AppendEmbedding adds f to the "embedding" field.
func (*MemoryMutation) AppendedEmbedding ¶
func (m *MemoryMutation) AppendedEmbedding() ([]float32, bool)
AppendedEmbedding returns the list of values that were appended to the "embedding" field in this mutation.
func (*MemoryMutation) ClearAgentID ¶
func (m *MemoryMutation) ClearAgentID()
ClearAgentID clears the value of the "agent_id" field.
func (*MemoryMutation) ClearEdge ¶
func (m *MemoryMutation) 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 (*MemoryMutation) ClearEmbedding ¶
func (m *MemoryMutation) ClearEmbedding()
ClearEmbedding clears the value of the "embedding" field.
func (*MemoryMutation) ClearExpiresAt ¶
func (m *MemoryMutation) ClearExpiresAt()
ClearExpiresAt clears the value of the "expires_at" field.
func (*MemoryMutation) ClearField ¶
func (m *MemoryMutation) 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 (*MemoryMutation) ClearMetadata ¶
func (m *MemoryMutation) ClearMetadata()
ClearMetadata clears the value of the "metadata" field.
func (*MemoryMutation) ClearSessionID ¶
func (m *MemoryMutation) ClearSessionID()
ClearSessionID clears the value of the "session_id" field.
func (*MemoryMutation) ClearedEdges ¶
func (m *MemoryMutation) ClearedEdges() []string
ClearedEdges returns all edge names that were cleared in this mutation.
func (*MemoryMutation) ClearedFields ¶
func (m *MemoryMutation) ClearedFields() []string
ClearedFields returns all nullable fields that were cleared during this mutation.
func (MemoryMutation) Client ¶
func (m MemoryMutation) 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 (*MemoryMutation) Content ¶
func (m *MemoryMutation) Content() (r string, exists bool)
Content returns the value of the "content" field in the mutation.
func (*MemoryMutation) CreatedAt ¶
func (m *MemoryMutation) CreatedAt() (r time.Time, exists bool)
CreatedAt returns the value of the "created_at" field in the mutation.
func (*MemoryMutation) EdgeCleared ¶
func (m *MemoryMutation) EdgeCleared(name string) bool
EdgeCleared returns a boolean which indicates if the edge with the given name was cleared in this mutation.
func (*MemoryMutation) Embedding ¶
func (m *MemoryMutation) Embedding() (r []float32, exists bool)
Embedding returns the value of the "embedding" field in the mutation.
func (*MemoryMutation) EmbeddingCleared ¶
func (m *MemoryMutation) EmbeddingCleared() bool
EmbeddingCleared returns if the "embedding" field was cleared in this mutation.
func (*MemoryMutation) ExpiresAt ¶
func (m *MemoryMutation) ExpiresAt() (r time.Time, exists bool)
ExpiresAt returns the value of the "expires_at" field in the mutation.
func (*MemoryMutation) ExpiresAtCleared ¶
func (m *MemoryMutation) ExpiresAtCleared() bool
ExpiresAtCleared returns if the "expires_at" field was cleared in this mutation.
func (*MemoryMutation) Field ¶
func (m *MemoryMutation) 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 (*MemoryMutation) FieldCleared ¶
func (m *MemoryMutation) FieldCleared(name string) bool
FieldCleared returns a boolean indicating if a field with the given name was cleared in this mutation.
func (*MemoryMutation) Fields ¶
func (m *MemoryMutation) 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 (*MemoryMutation) GetType ¶
func (m *MemoryMutation) GetType() (r string, exists bool)
GetType returns the value of the "type" field in the mutation.
func (*MemoryMutation) ID ¶
func (m *MemoryMutation) 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 (*MemoryMutation) IDs ¶
func (m *MemoryMutation) 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 (*MemoryMutation) Metadata ¶
func (m *MemoryMutation) Metadata() (r map[string]interface{}, exists bool)
Metadata returns the value of the "metadata" field in the mutation.
func (*MemoryMutation) MetadataCleared ¶
func (m *MemoryMutation) MetadataCleared() bool
MetadataCleared returns if the "metadata" field was cleared in this mutation.
func (*MemoryMutation) OldAgentID ¶
func (m *MemoryMutation) OldAgentID(ctx context.Context) (v string, err error)
OldAgentID returns the old "agent_id" field's value of the Memory entity. If the Memory 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 (*MemoryMutation) OldContent ¶
func (m *MemoryMutation) OldContent(ctx context.Context) (v string, err error)
OldContent returns the old "content" field's value of the Memory entity. If the Memory 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 (*MemoryMutation) OldCreatedAt ¶
OldCreatedAt returns the old "created_at" field's value of the Memory entity. If the Memory 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 (*MemoryMutation) OldEmbedding ¶
func (m *MemoryMutation) OldEmbedding(ctx context.Context) (v []float32, err error)
OldEmbedding returns the old "embedding" field's value of the Memory entity. If the Memory 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 (*MemoryMutation) OldExpiresAt ¶
OldExpiresAt returns the old "expires_at" field's value of the Memory entity. If the Memory 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 (*MemoryMutation) 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 (*MemoryMutation) OldMetadata ¶
func (m *MemoryMutation) OldMetadata(ctx context.Context) (v map[string]interface{}, err error)
OldMetadata returns the old "metadata" field's value of the Memory entity. If the Memory 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 (*MemoryMutation) OldScope ¶
func (m *MemoryMutation) OldScope(ctx context.Context) (v string, err error)
OldScope returns the old "scope" field's value of the Memory entity. If the Memory 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 (*MemoryMutation) OldSessionID ¶
func (m *MemoryMutation) OldSessionID(ctx context.Context) (v string, err error)
OldSessionID returns the old "session_id" field's value of the Memory entity. If the Memory 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 (*MemoryMutation) OldSubjectID ¶
func (m *MemoryMutation) OldSubjectID(ctx context.Context) (v string, err error)
OldSubjectID returns the old "subject_id" field's value of the Memory entity. If the Memory 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 (*MemoryMutation) OldTenantID ¶
func (m *MemoryMutation) OldTenantID(ctx context.Context) (v string, err error)
OldTenantID returns the old "tenant_id" field's value of the Memory entity. If the Memory 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 (*MemoryMutation) OldType ¶
func (m *MemoryMutation) OldType(ctx context.Context) (v string, err error)
OldType returns the old "type" field's value of the Memory entity. If the Memory 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 (*MemoryMutation) OldUpdatedAt ¶
OldUpdatedAt returns the old "updated_at" field's value of the Memory entity. If the Memory 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 (*MemoryMutation) RemovedEdges ¶
func (m *MemoryMutation) RemovedEdges() []string
RemovedEdges returns all edge names that were removed in this mutation.
func (*MemoryMutation) RemovedIDs ¶
func (m *MemoryMutation) 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 (*MemoryMutation) ResetAgentID ¶
func (m *MemoryMutation) ResetAgentID()
ResetAgentID resets all changes to the "agent_id" field.
func (*MemoryMutation) ResetContent ¶
func (m *MemoryMutation) ResetContent()
ResetContent resets all changes to the "content" field.
func (*MemoryMutation) ResetCreatedAt ¶
func (m *MemoryMutation) ResetCreatedAt()
ResetCreatedAt resets all changes to the "created_at" field.
func (*MemoryMutation) ResetEdge ¶
func (m *MemoryMutation) 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 (*MemoryMutation) ResetEmbedding ¶
func (m *MemoryMutation) ResetEmbedding()
ResetEmbedding resets all changes to the "embedding" field.
func (*MemoryMutation) ResetExpiresAt ¶
func (m *MemoryMutation) ResetExpiresAt()
ResetExpiresAt resets all changes to the "expires_at" field.
func (*MemoryMutation) ResetField ¶
func (m *MemoryMutation) 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 (*MemoryMutation) ResetMetadata ¶
func (m *MemoryMutation) ResetMetadata()
ResetMetadata resets all changes to the "metadata" field.
func (*MemoryMutation) ResetScope ¶
func (m *MemoryMutation) ResetScope()
ResetScope resets all changes to the "scope" field.
func (*MemoryMutation) ResetSessionID ¶
func (m *MemoryMutation) ResetSessionID()
ResetSessionID resets all changes to the "session_id" field.
func (*MemoryMutation) ResetSubjectID ¶
func (m *MemoryMutation) ResetSubjectID()
ResetSubjectID resets all changes to the "subject_id" field.
func (*MemoryMutation) ResetTenantID ¶
func (m *MemoryMutation) ResetTenantID()
ResetTenantID resets all changes to the "tenant_id" field.
func (*MemoryMutation) ResetType ¶
func (m *MemoryMutation) ResetType()
ResetType resets all changes to the "type" field.
func (*MemoryMutation) ResetUpdatedAt ¶
func (m *MemoryMutation) ResetUpdatedAt()
ResetUpdatedAt resets all changes to the "updated_at" field.
func (*MemoryMutation) Scope ¶
func (m *MemoryMutation) Scope() (r string, exists bool)
Scope returns the value of the "scope" field in the mutation.
func (*MemoryMutation) SessionID ¶
func (m *MemoryMutation) SessionID() (r string, exists bool)
SessionID returns the value of the "session_id" field in the mutation.
func (*MemoryMutation) SessionIDCleared ¶
func (m *MemoryMutation) SessionIDCleared() bool
SessionIDCleared returns if the "session_id" field was cleared in this mutation.
func (*MemoryMutation) SetAgentID ¶
func (m *MemoryMutation) SetAgentID(s string)
SetAgentID sets the "agent_id" field.
func (*MemoryMutation) SetContent ¶
func (m *MemoryMutation) SetContent(s string)
SetContent sets the "content" field.
func (*MemoryMutation) SetCreatedAt ¶
func (m *MemoryMutation) SetCreatedAt(t time.Time)
SetCreatedAt sets the "created_at" field.
func (*MemoryMutation) SetEmbedding ¶
func (m *MemoryMutation) SetEmbedding(f []float32)
SetEmbedding sets the "embedding" field.
func (*MemoryMutation) SetExpiresAt ¶
func (m *MemoryMutation) SetExpiresAt(t time.Time)
SetExpiresAt sets the "expires_at" field.
func (*MemoryMutation) SetField ¶
func (m *MemoryMutation) 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 (*MemoryMutation) SetID ¶
func (m *MemoryMutation) SetID(id string)
SetID sets the value of the id field. Note that this operation is only accepted on creation of Memory entities.
func (*MemoryMutation) SetMetadata ¶
func (m *MemoryMutation) SetMetadata(value map[string]interface{})
SetMetadata sets the "metadata" field.
func (*MemoryMutation) SetOp ¶
func (m *MemoryMutation) SetOp(op Op)
SetOp allows setting the mutation operation.
func (*MemoryMutation) SetScope ¶
func (m *MemoryMutation) SetScope(s string)
SetScope sets the "scope" field.
func (*MemoryMutation) SetSessionID ¶
func (m *MemoryMutation) SetSessionID(s string)
SetSessionID sets the "session_id" field.
func (*MemoryMutation) SetSubjectID ¶
func (m *MemoryMutation) SetSubjectID(s string)
SetSubjectID sets the "subject_id" field.
func (*MemoryMutation) SetTenantID ¶
func (m *MemoryMutation) SetTenantID(s string)
SetTenantID sets the "tenant_id" field.
func (*MemoryMutation) SetType ¶
func (m *MemoryMutation) SetType(s string)
SetType sets the "type" field.
func (*MemoryMutation) SetUpdatedAt ¶
func (m *MemoryMutation) SetUpdatedAt(t time.Time)
SetUpdatedAt sets the "updated_at" field.
func (*MemoryMutation) SubjectID ¶
func (m *MemoryMutation) SubjectID() (r string, exists bool)
SubjectID returns the value of the "subject_id" field in the mutation.
func (*MemoryMutation) TenantID ¶
func (m *MemoryMutation) TenantID() (r string, exists bool)
TenantID returns the value of the "tenant_id" field in the mutation.
func (MemoryMutation) Tx ¶
func (m MemoryMutation) Tx() (*Tx, error)
Tx returns an `ent.Tx` for mutations that were executed in transactions; it returns an error otherwise.
func (*MemoryMutation) Type ¶
func (m *MemoryMutation) Type() string
Type returns the node type of this mutation (Memory).
func (*MemoryMutation) UpdatedAt ¶
func (m *MemoryMutation) UpdatedAt() (r time.Time, exists bool)
UpdatedAt returns the value of the "updated_at" field in the mutation.
func (*MemoryMutation) Where ¶
func (m *MemoryMutation) Where(ps ...predicate.Memory)
Where appends a list predicates to the MemoryMutation builder.
func (*MemoryMutation) WhereP ¶
func (m *MemoryMutation) WhereP(ps ...func(*sql.Selector))
WhereP appends storage-level predicates to the MemoryMutation builder. Using this method, users can use type-assertion to append predicates that do not depend on any generated package.
type MemoryQuery ¶
type MemoryQuery struct {
// contains filtered or unexported fields
}
MemoryQuery is the builder for querying Memory entities.
func (*MemoryQuery) Aggregate ¶
func (_q *MemoryQuery) Aggregate(fns ...AggregateFunc) *MemorySelect
Aggregate returns a MemorySelect configured with the given aggregations.
func (*MemoryQuery) All ¶
func (_q *MemoryQuery) All(ctx context.Context) ([]*Memory, error)
All executes the query and returns a list of Memories.
func (*MemoryQuery) AllX ¶
func (_q *MemoryQuery) AllX(ctx context.Context) []*Memory
AllX is like All, but panics if an error occurs.
func (*MemoryQuery) Clone ¶
func (_q *MemoryQuery) Clone() *MemoryQuery
Clone returns a duplicate of the MemoryQuery builder, including all associated steps. It can be used to prepare common query builders and use them differently after the clone is made.
func (*MemoryQuery) Count ¶
func (_q *MemoryQuery) Count(ctx context.Context) (int, error)
Count returns the count of the given query.
func (*MemoryQuery) CountX ¶
func (_q *MemoryQuery) CountX(ctx context.Context) int
CountX is like Count, but panics if an error occurs.
func (*MemoryQuery) Exist ¶
func (_q *MemoryQuery) Exist(ctx context.Context) (bool, error)
Exist returns true if the query has elements in the graph.
func (*MemoryQuery) ExistX ¶
func (_q *MemoryQuery) ExistX(ctx context.Context) bool
ExistX is like Exist, but panics if an error occurs.
func (*MemoryQuery) First ¶
func (_q *MemoryQuery) First(ctx context.Context) (*Memory, error)
First returns the first Memory entity from the query. Returns a *NotFoundError when no Memory was found.
func (*MemoryQuery) FirstID ¶
func (_q *MemoryQuery) FirstID(ctx context.Context) (id string, err error)
FirstID returns the first Memory ID from the query. Returns a *NotFoundError when no Memory ID was found.
func (*MemoryQuery) FirstIDX ¶
func (_q *MemoryQuery) FirstIDX(ctx context.Context) string
FirstIDX is like FirstID, but panics if an error occurs.
func (*MemoryQuery) FirstX ¶
func (_q *MemoryQuery) FirstX(ctx context.Context) *Memory
FirstX is like First, but panics if an error occurs.
func (*MemoryQuery) GroupBy ¶
func (_q *MemoryQuery) GroupBy(field string, fields ...string) *MemoryGroupBy
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.Memory.Query().
GroupBy(memory.FieldTenantID).
Aggregate(ent.Count()).
Scan(ctx, &v)
func (*MemoryQuery) IDs ¶
func (_q *MemoryQuery) IDs(ctx context.Context) (ids []string, err error)
IDs executes the query and returns a list of Memory IDs.
func (*MemoryQuery) IDsX ¶
func (_q *MemoryQuery) IDsX(ctx context.Context) []string
IDsX is like IDs, but panics if an error occurs.
func (*MemoryQuery) Limit ¶
func (_q *MemoryQuery) Limit(limit int) *MemoryQuery
Limit the number of records to be returned by this query.
func (*MemoryQuery) Offset ¶
func (_q *MemoryQuery) Offset(offset int) *MemoryQuery
Offset to start from.
func (*MemoryQuery) Only ¶
func (_q *MemoryQuery) Only(ctx context.Context) (*Memory, error)
Only returns a single Memory entity found by the query, ensuring it only returns one. Returns a *NotSingularError when more than one Memory entity is found. Returns a *NotFoundError when no Memory entities are found.
func (*MemoryQuery) OnlyID ¶
func (_q *MemoryQuery) OnlyID(ctx context.Context) (id string, err error)
OnlyID is like Only, but returns the only Memory ID in the query. Returns a *NotSingularError when more than one Memory ID is found. Returns a *NotFoundError when no entities are found.
func (*MemoryQuery) OnlyIDX ¶
func (_q *MemoryQuery) OnlyIDX(ctx context.Context) string
OnlyIDX is like OnlyID, but panics if an error occurs.
func (*MemoryQuery) OnlyX ¶
func (_q *MemoryQuery) OnlyX(ctx context.Context) *Memory
OnlyX is like Only, but panics if an error occurs.
func (*MemoryQuery) Order ¶
func (_q *MemoryQuery) Order(o ...memory.OrderOption) *MemoryQuery
Order specifies how the records should be ordered.
func (*MemoryQuery) Select ¶
func (_q *MemoryQuery) Select(fields ...string) *MemorySelect
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.Memory.Query().
Select(memory.FieldTenantID).
Scan(ctx, &v)
func (*MemoryQuery) Unique ¶
func (_q *MemoryQuery) Unique(unique bool) *MemoryQuery
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 (*MemoryQuery) Where ¶
func (_q *MemoryQuery) Where(ps ...predicate.Memory) *MemoryQuery
Where adds a new predicate for the MemoryQuery builder.
type MemorySelect ¶
type MemorySelect struct {
*MemoryQuery
// contains filtered or unexported fields
}
MemorySelect is the builder for selecting fields of Memory entities.
func (*MemorySelect) Aggregate ¶
func (_s *MemorySelect) Aggregate(fns ...AggregateFunc) *MemorySelect
Aggregate adds the given aggregation functions to the selector query.
func (*MemorySelect) Bool ¶
Bool returns a single bool from a selector. It is only allowed when selecting one field.
func (*MemorySelect) Bools ¶
Bools returns list of bools from a selector. It is only allowed when selecting one field.
func (*MemorySelect) Float64 ¶
Float64 returns a single float64 from a selector. It is only allowed when selecting one field.
func (*MemorySelect) Float64s ¶
Float64s returns list of float64s from a selector. It is only allowed when selecting one field.
func (*MemorySelect) Int ¶
Int returns a single int from a selector. It is only allowed when selecting one field.
func (*MemorySelect) Ints ¶
Ints returns list of ints from a selector. It is only allowed when selecting one field.
func (*MemorySelect) Scan ¶
func (_s *MemorySelect) Scan(ctx context.Context, v any) error
Scan applies the selector query and scans the result into the given value.
func (*MemorySelect) String ¶
String returns a single string from a selector. It is only allowed when selecting one field.
type MemoryUpdate ¶
type MemoryUpdate struct {
// contains filtered or unexported fields
}
MemoryUpdate is the builder for updating Memory entities.
func (*MemoryUpdate) AppendEmbedding ¶
func (_u *MemoryUpdate) AppendEmbedding(v []float32) *MemoryUpdate
AppendEmbedding appends value to the "embedding" field.
func (*MemoryUpdate) ClearAgentID ¶
func (_u *MemoryUpdate) ClearAgentID() *MemoryUpdate
ClearAgentID clears the value of the "agent_id" field.
func (*MemoryUpdate) ClearEmbedding ¶
func (_u *MemoryUpdate) ClearEmbedding() *MemoryUpdate
ClearEmbedding clears the value of the "embedding" field.
func (*MemoryUpdate) ClearExpiresAt ¶
func (_u *MemoryUpdate) ClearExpiresAt() *MemoryUpdate
ClearExpiresAt clears the value of the "expires_at" field.
func (*MemoryUpdate) ClearMetadata ¶
func (_u *MemoryUpdate) ClearMetadata() *MemoryUpdate
ClearMetadata clears the value of the "metadata" field.
func (*MemoryUpdate) ClearSessionID ¶
func (_u *MemoryUpdate) ClearSessionID() *MemoryUpdate
ClearSessionID clears the value of the "session_id" field.
func (*MemoryUpdate) Exec ¶
func (_u *MemoryUpdate) Exec(ctx context.Context) error
Exec executes the query.
func (*MemoryUpdate) ExecX ¶
func (_u *MemoryUpdate) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*MemoryUpdate) Mutation ¶
func (_u *MemoryUpdate) Mutation() *MemoryMutation
Mutation returns the MemoryMutation object of the builder.
func (*MemoryUpdate) Save ¶
func (_u *MemoryUpdate) Save(ctx context.Context) (int, error)
Save executes the query and returns the number of nodes affected by the update operation.
func (*MemoryUpdate) SaveX ¶
func (_u *MemoryUpdate) SaveX(ctx context.Context) int
SaveX is like Save, but panics if an error occurs.
func (*MemoryUpdate) SetAgentID ¶
func (_u *MemoryUpdate) SetAgentID(v string) *MemoryUpdate
SetAgentID sets the "agent_id" field.
func (*MemoryUpdate) SetContent ¶
func (_u *MemoryUpdate) SetContent(v string) *MemoryUpdate
SetContent sets the "content" field.
func (*MemoryUpdate) SetEmbedding ¶
func (_u *MemoryUpdate) SetEmbedding(v []float32) *MemoryUpdate
SetEmbedding sets the "embedding" field.
func (*MemoryUpdate) SetExpiresAt ¶
func (_u *MemoryUpdate) SetExpiresAt(v time.Time) *MemoryUpdate
SetExpiresAt sets the "expires_at" field.
func (*MemoryUpdate) SetMetadata ¶
func (_u *MemoryUpdate) SetMetadata(v map[string]interface{}) *MemoryUpdate
SetMetadata sets the "metadata" field.
func (*MemoryUpdate) SetNillableAgentID ¶
func (_u *MemoryUpdate) SetNillableAgentID(v *string) *MemoryUpdate
SetNillableAgentID sets the "agent_id" field if the given value is not nil.
func (*MemoryUpdate) SetNillableContent ¶
func (_u *MemoryUpdate) SetNillableContent(v *string) *MemoryUpdate
SetNillableContent sets the "content" field if the given value is not nil.
func (*MemoryUpdate) SetNillableExpiresAt ¶
func (_u *MemoryUpdate) SetNillableExpiresAt(v *time.Time) *MemoryUpdate
SetNillableExpiresAt sets the "expires_at" field if the given value is not nil.
func (*MemoryUpdate) SetNillableScope ¶
func (_u *MemoryUpdate) SetNillableScope(v *string) *MemoryUpdate
SetNillableScope sets the "scope" field if the given value is not nil.
func (*MemoryUpdate) SetNillableSessionID ¶
func (_u *MemoryUpdate) SetNillableSessionID(v *string) *MemoryUpdate
SetNillableSessionID sets the "session_id" field if the given value is not nil.
func (*MemoryUpdate) SetNillableSubjectID ¶
func (_u *MemoryUpdate) SetNillableSubjectID(v *string) *MemoryUpdate
SetNillableSubjectID sets the "subject_id" field if the given value is not nil.
func (*MemoryUpdate) SetNillableTenantID ¶
func (_u *MemoryUpdate) SetNillableTenantID(v *string) *MemoryUpdate
SetNillableTenantID sets the "tenant_id" field if the given value is not nil.
func (*MemoryUpdate) SetNillableType ¶
func (_u *MemoryUpdate) SetNillableType(v *string) *MemoryUpdate
SetNillableType sets the "type" field if the given value is not nil.
func (*MemoryUpdate) SetScope ¶
func (_u *MemoryUpdate) SetScope(v string) *MemoryUpdate
SetScope sets the "scope" field.
func (*MemoryUpdate) SetSessionID ¶
func (_u *MemoryUpdate) SetSessionID(v string) *MemoryUpdate
SetSessionID sets the "session_id" field.
func (*MemoryUpdate) SetSubjectID ¶
func (_u *MemoryUpdate) SetSubjectID(v string) *MemoryUpdate
SetSubjectID sets the "subject_id" field.
func (*MemoryUpdate) SetTenantID ¶
func (_u *MemoryUpdate) SetTenantID(v string) *MemoryUpdate
SetTenantID sets the "tenant_id" field.
func (*MemoryUpdate) SetType ¶
func (_u *MemoryUpdate) SetType(v string) *MemoryUpdate
SetType sets the "type" field.
func (*MemoryUpdate) SetUpdatedAt ¶
func (_u *MemoryUpdate) SetUpdatedAt(v time.Time) *MemoryUpdate
SetUpdatedAt sets the "updated_at" field.
func (*MemoryUpdate) Where ¶
func (_u *MemoryUpdate) Where(ps ...predicate.Memory) *MemoryUpdate
Where appends a list predicates to the MemoryUpdate builder.
type MemoryUpdateOne ¶
type MemoryUpdateOne struct {
// contains filtered or unexported fields
}
MemoryUpdateOne is the builder for updating a single Memory entity.
func (*MemoryUpdateOne) AppendEmbedding ¶
func (_u *MemoryUpdateOne) AppendEmbedding(v []float32) *MemoryUpdateOne
AppendEmbedding appends value to the "embedding" field.
func (*MemoryUpdateOne) ClearAgentID ¶
func (_u *MemoryUpdateOne) ClearAgentID() *MemoryUpdateOne
ClearAgentID clears the value of the "agent_id" field.
func (*MemoryUpdateOne) ClearEmbedding ¶
func (_u *MemoryUpdateOne) ClearEmbedding() *MemoryUpdateOne
ClearEmbedding clears the value of the "embedding" field.
func (*MemoryUpdateOne) ClearExpiresAt ¶
func (_u *MemoryUpdateOne) ClearExpiresAt() *MemoryUpdateOne
ClearExpiresAt clears the value of the "expires_at" field.
func (*MemoryUpdateOne) ClearMetadata ¶
func (_u *MemoryUpdateOne) ClearMetadata() *MemoryUpdateOne
ClearMetadata clears the value of the "metadata" field.
func (*MemoryUpdateOne) ClearSessionID ¶
func (_u *MemoryUpdateOne) ClearSessionID() *MemoryUpdateOne
ClearSessionID clears the value of the "session_id" field.
func (*MemoryUpdateOne) Exec ¶
func (_u *MemoryUpdateOne) Exec(ctx context.Context) error
Exec executes the query on the entity.
func (*MemoryUpdateOne) ExecX ¶
func (_u *MemoryUpdateOne) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*MemoryUpdateOne) Mutation ¶
func (_u *MemoryUpdateOne) Mutation() *MemoryMutation
Mutation returns the MemoryMutation object of the builder.
func (*MemoryUpdateOne) Save ¶
func (_u *MemoryUpdateOne) Save(ctx context.Context) (*Memory, error)
Save executes the query and returns the updated Memory entity.
func (*MemoryUpdateOne) SaveX ¶
func (_u *MemoryUpdateOne) SaveX(ctx context.Context) *Memory
SaveX is like Save, but panics if an error occurs.
func (*MemoryUpdateOne) Select ¶
func (_u *MemoryUpdateOne) Select(field string, fields ...string) *MemoryUpdateOne
Select allows selecting one or more fields (columns) of the returned entity. The default is selecting all fields defined in the entity schema.
func (*MemoryUpdateOne) SetAgentID ¶
func (_u *MemoryUpdateOne) SetAgentID(v string) *MemoryUpdateOne
SetAgentID sets the "agent_id" field.
func (*MemoryUpdateOne) SetContent ¶
func (_u *MemoryUpdateOne) SetContent(v string) *MemoryUpdateOne
SetContent sets the "content" field.
func (*MemoryUpdateOne) SetEmbedding ¶
func (_u *MemoryUpdateOne) SetEmbedding(v []float32) *MemoryUpdateOne
SetEmbedding sets the "embedding" field.
func (*MemoryUpdateOne) SetExpiresAt ¶
func (_u *MemoryUpdateOne) SetExpiresAt(v time.Time) *MemoryUpdateOne
SetExpiresAt sets the "expires_at" field.
func (*MemoryUpdateOne) SetMetadata ¶
func (_u *MemoryUpdateOne) SetMetadata(v map[string]interface{}) *MemoryUpdateOne
SetMetadata sets the "metadata" field.
func (*MemoryUpdateOne) SetNillableAgentID ¶
func (_u *MemoryUpdateOne) SetNillableAgentID(v *string) *MemoryUpdateOne
SetNillableAgentID sets the "agent_id" field if the given value is not nil.
func (*MemoryUpdateOne) SetNillableContent ¶
func (_u *MemoryUpdateOne) SetNillableContent(v *string) *MemoryUpdateOne
SetNillableContent sets the "content" field if the given value is not nil.
func (*MemoryUpdateOne) SetNillableExpiresAt ¶
func (_u *MemoryUpdateOne) SetNillableExpiresAt(v *time.Time) *MemoryUpdateOne
SetNillableExpiresAt sets the "expires_at" field if the given value is not nil.
func (*MemoryUpdateOne) SetNillableScope ¶
func (_u *MemoryUpdateOne) SetNillableScope(v *string) *MemoryUpdateOne
SetNillableScope sets the "scope" field if the given value is not nil.
func (*MemoryUpdateOne) SetNillableSessionID ¶
func (_u *MemoryUpdateOne) SetNillableSessionID(v *string) *MemoryUpdateOne
SetNillableSessionID sets the "session_id" field if the given value is not nil.
func (*MemoryUpdateOne) SetNillableSubjectID ¶
func (_u *MemoryUpdateOne) SetNillableSubjectID(v *string) *MemoryUpdateOne
SetNillableSubjectID sets the "subject_id" field if the given value is not nil.
func (*MemoryUpdateOne) SetNillableTenantID ¶
func (_u *MemoryUpdateOne) SetNillableTenantID(v *string) *MemoryUpdateOne
SetNillableTenantID sets the "tenant_id" field if the given value is not nil.
func (*MemoryUpdateOne) SetNillableType ¶
func (_u *MemoryUpdateOne) SetNillableType(v *string) *MemoryUpdateOne
SetNillableType sets the "type" field if the given value is not nil.
func (*MemoryUpdateOne) SetScope ¶
func (_u *MemoryUpdateOne) SetScope(v string) *MemoryUpdateOne
SetScope sets the "scope" field.
func (*MemoryUpdateOne) SetSessionID ¶
func (_u *MemoryUpdateOne) SetSessionID(v string) *MemoryUpdateOne
SetSessionID sets the "session_id" field.
func (*MemoryUpdateOne) SetSubjectID ¶
func (_u *MemoryUpdateOne) SetSubjectID(v string) *MemoryUpdateOne
SetSubjectID sets the "subject_id" field.
func (*MemoryUpdateOne) SetTenantID ¶
func (_u *MemoryUpdateOne) SetTenantID(v string) *MemoryUpdateOne
SetTenantID sets the "tenant_id" field.
func (*MemoryUpdateOne) SetType ¶
func (_u *MemoryUpdateOne) SetType(v string) *MemoryUpdateOne
SetType sets the "type" field.
func (*MemoryUpdateOne) SetUpdatedAt ¶
func (_u *MemoryUpdateOne) SetUpdatedAt(v time.Time) *MemoryUpdateOne
SetUpdatedAt sets the "updated_at" field.
func (*MemoryUpdateOne) Where ¶
func (_u *MemoryUpdateOne) Where(ps ...predicate.Memory) *MemoryUpdateOne
Where appends a list predicates to the MemoryUpdate builder.
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 {
// Memory is the client for interacting with the Memory builders.
Memory *MemoryClient
// 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.