ent

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 28, 2026 License: MIT Imports: 20 Imported by: 0

Documentation

Overview

Package ent provides the generated Ent ORM code.

Index

Constants

View Source
const (
	// Operation types.
	OpCreate    = ent.OpCreate
	OpDelete    = ent.OpDelete
	OpDeleteOne = ent.OpDeleteOne
	OpUpdate    = ent.OpUpdate
	OpUpdateOne = ent.OpUpdateOne

	// Node types.
	TypeMemory = "Memory"
)

Variables

View Source
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 Asc

func Asc(fields ...string) func(*sql.Selector)

Asc applies the given fields in ASC order.

func Desc

func Desc(fields ...string) func(*sql.Selector)

Desc applies the given fields in DESC order.

func IsConstraintError

func IsConstraintError(err error) bool

IsConstraintError returns a boolean indicating whether the error is a constraint failure.

func IsNotFound

func IsNotFound(err error) bool

IsNotFound returns a boolean indicating whether the error is a not found error.

func IsNotLoaded

func IsNotLoaded(err error) bool

IsNotLoaded returns a boolean indicating whether the error is a not loaded error.

func IsNotSingular

func IsNotSingular(err error) bool

IsNotSingular returns a boolean indicating whether the error is a not singular error.

func IsValidationError

func IsValidationError(err error) bool

IsValidationError returns a boolean indicating whether the error is a validation error.

func MaskNotFound

func MaskNotFound(err error) error

MaskNotFound masks not found error.

func NewContext

func NewContext(parent context.Context, c *Client) context.Context

NewContext returns a new context with the given Client attached.

func NewTxContext

func NewTxContext(parent context.Context, tx *Tx) context.Context

NewTxContext returns a new context with the given Tx attached.

Types

type AggregateFunc

type AggregateFunc func(*sql.Selector) string

AggregateFunc applies an aggregation step on the group-by traversal/selector.

func As

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

func FromContext(ctx context.Context) *Client

FromContext returns a Client stored inside a context, or nil if there isn't one.

func NewClient

func NewClient(opts ...Option) *Client

NewClient creates a new client configured with the given options.

func Open

func Open(driverName, dataSourceName string, options ...Option) (*Client, error)

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) BeginTx

func (c *Client) BeginTx(ctx context.Context, opts *sql.TxOptions) (*Tx, error)

BeginTx returns a transactional client with specified options.

func (*Client) Close

func (c *Client) Close() error

Close closes the database connection and prevents new queries from starting.

func (*Client) Debug

func (c *Client) Debug() *Client

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(...)`.

func (*Client) Mutate

func (c *Client) Mutate(ctx context.Context, m Mutation) (Value, error)

Mutate implements the ent.Mutator interface.

func (*Client) Tx

func (c *Client) Tx(ctx context.Context) (*Tx, error)

Tx returns a new transactional client. The provided context is used until the transaction is committed or rolled back.

func (*Client) Use

func (c *Client) Use(hooks ...Hook)

Use adds the mutation hooks to all the entity clients. In order to add hooks to a specific client, call: `client.Node.Use(...)`.

type CommitFunc

type CommitFunc func(context.Context, *Tx) error

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.

func (CommitFunc) Commit

func (f CommitFunc) Commit(ctx context.Context, tx *Tx) error

Commit calls f(ctx, m).

type CommitHook

type CommitHook func(Committer) Committer

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 Committer

type Committer interface {
	Commit(context.Context, *Tx) error
}

Committer is the interface that wraps the Commit method.

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 Hook

type Hook = ent.Hook

ent aliases to avoid import conflicts in user's code.

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 Memories

type Memories []*Memory

Memories is a parsable slice of Memory.

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) String

func (_m *Memory) String() string

String implements the fmt.Stringer.

func (*Memory) Unwrap

func (_m *Memory) Unwrap() *Memory

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.

func (*Memory) Value

func (_m *Memory) Value(name string) (ent.Value, error)

Value returns the ent.Value that was dynamically selected and assigned to the Memory. This includes values selected through modifiers, order, etc.

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) Get

func (c *MemoryClient) Get(ctx context.Context, id string) (*Memory, error)

Get returns a Memory 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) Hooks

func (c *MemoryClient) Hooks() []Hook

Hooks returns the client hooks.

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.

func (*MemoryCreateBulk) Save

func (_c *MemoryCreateBulk) Save(ctx context.Context) ([]*Memory, error)

Save creates the Memory entities in the database.

func (*MemoryCreateBulk) SaveX

func (_c *MemoryCreateBulk) SaveX(ctx context.Context) []*Memory

SaveX is like Save, 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

func (s *MemoryGroupBy) Bool(ctx context.Context) (_ bool, err error)

Bool returns a single bool from a selector. It is only allowed when selecting one field.

func (*MemoryGroupBy) BoolX

func (s *MemoryGroupBy) BoolX(ctx context.Context) bool

BoolX is like Bool, but panics if an error occurs.

func (*MemoryGroupBy) Bools

func (s *MemoryGroupBy) Bools(ctx context.Context) ([]bool, error)

Bools returns list of bools from a selector. It is only allowed when selecting one field.

func (*MemoryGroupBy) BoolsX

func (s *MemoryGroupBy) BoolsX(ctx context.Context) []bool

BoolsX is like Bools, but panics if an error occurs.

func (*MemoryGroupBy) Float64

func (s *MemoryGroupBy) Float64(ctx context.Context) (_ float64, err error)

Float64 returns a single float64 from a selector. It is only allowed when selecting one field.

func (*MemoryGroupBy) Float64X

func (s *MemoryGroupBy) Float64X(ctx context.Context) float64

Float64X is like Float64, but panics if an error occurs.

func (*MemoryGroupBy) Float64s

func (s *MemoryGroupBy) Float64s(ctx context.Context) ([]float64, error)

Float64s returns list of float64s from a selector. It is only allowed when selecting one field.

func (*MemoryGroupBy) Float64sX

func (s *MemoryGroupBy) Float64sX(ctx context.Context) []float64

Float64sX is like Float64s, but panics if an error occurs.

func (*MemoryGroupBy) Int

func (s *MemoryGroupBy) Int(ctx context.Context) (_ int, err error)

Int returns a single int from a selector. It is only allowed when selecting one field.

func (*MemoryGroupBy) IntX

func (s *MemoryGroupBy) IntX(ctx context.Context) int

IntX is like Int, but panics if an error occurs.

func (*MemoryGroupBy) Ints

func (s *MemoryGroupBy) Ints(ctx context.Context) ([]int, error)

Ints returns list of ints from a selector. It is only allowed when selecting one field.

func (*MemoryGroupBy) IntsX

func (s *MemoryGroupBy) IntsX(ctx context.Context) []int

IntsX is like Ints, but panics if an error occurs.

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) ScanX

func (s *MemoryGroupBy) ScanX(ctx context.Context, v any)

ScanX is like Scan, but panics if an error occurs.

func (*MemoryGroupBy) String

func (s *MemoryGroupBy) String(ctx context.Context) (_ string, err error)

String returns a single string from a selector. It is only allowed when selecting one field.

func (*MemoryGroupBy) StringX

func (s *MemoryGroupBy) StringX(ctx context.Context) string

StringX is like String, but panics if an error occurs.

func (*MemoryGroupBy) Strings

func (s *MemoryGroupBy) Strings(ctx context.Context) ([]string, error)

Strings returns list of strings from a selector. It is only allowed when selecting one field.

func (*MemoryGroupBy) StringsX

func (s *MemoryGroupBy) StringsX(ctx context.Context) []string

StringsX is like Strings, but panics if an error occurs.

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

func (m *MemoryMutation) OldCreatedAt(ctx context.Context) (v time.Time, err error)

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

func (m *MemoryMutation) OldExpiresAt(ctx context.Context) (v *time.Time, err error)

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

func (m *MemoryMutation) OldField(ctx context.Context, name string) (ent.Value, error)

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

func (m *MemoryMutation) OldUpdatedAt(ctx context.Context) (v time.Time, err error)

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) Op

func (m *MemoryMutation) Op() Op

Op returns the operation name.

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

func (s *MemorySelect) Bool(ctx context.Context) (_ bool, err error)

Bool returns a single bool from a selector. It is only allowed when selecting one field.

func (*MemorySelect) BoolX

func (s *MemorySelect) BoolX(ctx context.Context) bool

BoolX is like Bool, but panics if an error occurs.

func (*MemorySelect) Bools

func (s *MemorySelect) Bools(ctx context.Context) ([]bool, error)

Bools returns list of bools from a selector. It is only allowed when selecting one field.

func (*MemorySelect) BoolsX

func (s *MemorySelect) BoolsX(ctx context.Context) []bool

BoolsX is like Bools, but panics if an error occurs.

func (*MemorySelect) Float64

func (s *MemorySelect) Float64(ctx context.Context) (_ float64, err error)

Float64 returns a single float64 from a selector. It is only allowed when selecting one field.

func (*MemorySelect) Float64X

func (s *MemorySelect) Float64X(ctx context.Context) float64

Float64X is like Float64, but panics if an error occurs.

func (*MemorySelect) Float64s

func (s *MemorySelect) Float64s(ctx context.Context) ([]float64, error)

Float64s returns list of float64s from a selector. It is only allowed when selecting one field.

func (*MemorySelect) Float64sX

func (s *MemorySelect) Float64sX(ctx context.Context) []float64

Float64sX is like Float64s, but panics if an error occurs.

func (*MemorySelect) Int

func (s *MemorySelect) Int(ctx context.Context) (_ int, err error)

Int returns a single int from a selector. It is only allowed when selecting one field.

func (*MemorySelect) IntX

func (s *MemorySelect) IntX(ctx context.Context) int

IntX is like Int, but panics if an error occurs.

func (*MemorySelect) Ints

func (s *MemorySelect) Ints(ctx context.Context) ([]int, error)

Ints returns list of ints from a selector. It is only allowed when selecting one field.

func (*MemorySelect) IntsX

func (s *MemorySelect) IntsX(ctx context.Context) []int

IntsX is like Ints, but panics if an error occurs.

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) ScanX

func (s *MemorySelect) ScanX(ctx context.Context, v any)

ScanX is like Scan, but panics if an error occurs.

func (*MemorySelect) String

func (s *MemorySelect) String(ctx context.Context) (_ string, err error)

String returns a single string from a selector. It is only allowed when selecting one field.

func (*MemorySelect) StringX

func (s *MemorySelect) StringX(ctx context.Context) string

StringX is like String, but panics if an error occurs.

func (*MemorySelect) Strings

func (s *MemorySelect) Strings(ctx context.Context) ([]string, error)

Strings returns list of strings from a selector. It is only allowed when selecting one field.

func (*MemorySelect) StringsX

func (s *MemorySelect) StringsX(ctx context.Context) []string

StringsX is like Strings, but panics if an error occurs.

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 Mutation

type Mutation = ent.Mutation

ent aliases to avoid import conflicts in user's code.

type Mutator

type Mutator = ent.Mutator

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 Op

type Op = ent.Op

ent aliases to avoid import conflicts in user's code.

type Option

type Option func(*config)

Option function to configure the client.

func Debug

func Debug() Option

Debug enables debug logging on the ent.Driver.

func Driver

func Driver(driver dialect.Driver) Option

Driver configures the client driver.

func Log

func Log(fn func(...any)) Option

Log sets the logging function for debug mode.

type OrderFunc

type OrderFunc func(*sql.Selector)

OrderFunc applies an ordering on the sql selector. Deprecated: Use Asc/Desc functions or the package builders instead.

type Policy

type Policy = ent.Policy

ent aliases to avoid import conflicts in user's code.

type Querier

type Querier = ent.Querier

ent aliases to avoid import conflicts in user's code.

type QuerierFunc

type QuerierFunc = ent.QuerierFunc

ent aliases to avoid import conflicts in user's code.

type Query

type Query = ent.Query

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

type RollbackFunc func(context.Context, *Tx) error

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.

func (RollbackFunc) Rollback

func (f RollbackFunc) Rollback(ctx context.Context, tx *Tx) error

Rollback calls f(ctx, m).

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

type Rollbacker interface {
	Rollback(context.Context, *Tx) error
}

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 Traverser

type Traverser = ent.Traverser

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

func TxFromContext(ctx context.Context) *Tx

TxFromContext returns a Tx stored inside a context, or nil if there isn't one.

func (*Tx) Client

func (tx *Tx) Client() *Client

Client returns a Client that binds to current transaction.

func (*Tx) Commit

func (tx *Tx) Commit() error

Commit commits the transaction.

func (*Tx) OnCommit

func (tx *Tx) OnCommit(f CommitHook)

OnCommit adds a hook to call on commit.

func (*Tx) OnRollback

func (tx *Tx) OnRollback(f RollbackHook)

OnRollback adds a hook to call on rollback.

func (*Tx) Rollback

func (tx *Tx) Rollback() error

Rollback rollbacks the transaction.

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.

type Value

type Value = ent.Value

ent aliases to avoid import conflicts in user's code.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL