ent

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2026 License: AGPL-3.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

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

	// Node types.
	TypeNode = "Node"
)

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
	// Node is the client for interacting with the Node builders.
	Node *NodeClient
	// contains filtered or unexported fields
}

Client is the client that holds all ent builders.

func FromContext

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

type Node struct {

	// ID of the ent.
	ID string `json:"id,omitempty"`
	// ParentHash holds the value of the "parent_hash" field.
	ParentHash *string `json:"parent_hash,omitempty"`
	// Bucket holds the value of the "bucket" field.
	Bucket map[string]interface{} `json:"bucket,omitempty"`
	// Type holds the value of the "type" field.
	Type string `json:"type,omitempty"`
	// Role holds the value of the "role" field.
	Role string `json:"role,omitempty"`
	// Content holds the value of the "content" field.
	Content []map[string]interface{} `json:"content,omitempty"`
	// Model holds the value of the "model" field.
	Model string `json:"model,omitempty"`
	// Provider holds the value of the "provider" field.
	Provider string `json:"provider,omitempty"`
	// AgentName holds the value of the "agent_name" field.
	AgentName string `json:"agent_name,omitempty"`
	// StopReason holds the value of the "stop_reason" field.
	StopReason string `json:"stop_reason,omitempty"`
	// PromptTokens holds the value of the "prompt_tokens" field.
	PromptTokens *int `json:"prompt_tokens,omitempty"`
	// CompletionTokens holds the value of the "completion_tokens" field.
	CompletionTokens *int `json:"completion_tokens,omitempty"`
	// TotalTokens holds the value of the "total_tokens" field.
	TotalTokens *int `json:"total_tokens,omitempty"`
	// CacheCreationInputTokens holds the value of the "cache_creation_input_tokens" field.
	CacheCreationInputTokens *int `json:"cache_creation_input_tokens,omitempty"`
	// CacheReadInputTokens holds the value of the "cache_read_input_tokens" field.
	CacheReadInputTokens *int `json:"cache_read_input_tokens,omitempty"`
	// TotalDurationNs holds the value of the "total_duration_ns" field.
	TotalDurationNs *int64 `json:"total_duration_ns,omitempty"`
	// PromptDurationNs holds the value of the "prompt_duration_ns" field.
	PromptDurationNs *int64 `json:"prompt_duration_ns,omitempty"`
	// Project holds the value of the "project" field.
	Project *string `json:"project,omitempty"`
	// CreatedAt holds the value of the "created_at" field.
	CreatedAt time.Time `json:"created_at,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the NodeQuery when eager-loading is set.
	Edges NodeEdges `json:"edges"`
	// contains filtered or unexported fields
}

Node is the model entity for the Node schema.

func (*Node) QueryChildren

func (_m *Node) QueryChildren() *NodeQuery

QueryChildren queries the "children" edge of the Node entity.

func (*Node) QueryParent

func (_m *Node) QueryParent() *NodeQuery

QueryParent queries the "parent" edge of the Node entity.

func (*Node) String

func (_m *Node) String() string

String implements the fmt.Stringer.

func (*Node) Unwrap

func (_m *Node) Unwrap() *Node

Unwrap unwraps the Node entity that was returned from a transaction after it was closed, so that all future queries will be executed through the driver which created the transaction.

func (*Node) Update

func (_m *Node) Update() *NodeUpdateOne

Update returns a builder for updating this Node. Note that you need to call Node.Unwrap() before calling this method if this Node was returned from a transaction, and the transaction was committed or rolled back.

func (*Node) Value

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

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

type NodeClient

type NodeClient struct {
	// contains filtered or unexported fields
}

NodeClient is a client for the Node schema.

func NewNodeClient

func NewNodeClient(c config) *NodeClient

NewNodeClient returns a client for the Node from the given config.

func (*NodeClient) Create

func (c *NodeClient) Create() *NodeCreate

Create returns a builder for creating a Node entity.

func (*NodeClient) CreateBulk

func (c *NodeClient) CreateBulk(builders ...*NodeCreate) *NodeCreateBulk

CreateBulk returns a builder for creating a bulk of Node entities.

func (*NodeClient) Delete

func (c *NodeClient) Delete() *NodeDelete

Delete returns a delete builder for Node.

func (*NodeClient) DeleteOne

func (c *NodeClient) DeleteOne(_m *Node) *NodeDeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*NodeClient) DeleteOneID

func (c *NodeClient) DeleteOneID(id string) *NodeDeleteOne

DeleteOneID returns a builder for deleting the given entity by its id.

func (*NodeClient) Get

func (c *NodeClient) Get(ctx context.Context, id string) (*Node, error)

Get returns a Node entity by its id.

func (*NodeClient) GetX

func (c *NodeClient) GetX(ctx context.Context, id string) *Node

GetX is like Get, but panics if an error occurs.

func (*NodeClient) Hooks

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

Hooks returns the client hooks.

func (*NodeClient) Intercept

func (c *NodeClient) Intercept(interceptors ...Interceptor)

Intercept adds a list of query interceptors to the interceptors stack. A call to `Intercept(f, g, h)` equals to `node.Intercept(f(g(h())))`.

func (*NodeClient) Interceptors

func (c *NodeClient) Interceptors() []Interceptor

Interceptors returns the client interceptors.

func (*NodeClient) MapCreateBulk

func (c *NodeClient) MapCreateBulk(slice any, setFunc func(*NodeCreate, int)) *NodeCreateBulk

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 (*NodeClient) Query

func (c *NodeClient) Query() *NodeQuery

Query returns a query builder for Node.

func (*NodeClient) QueryChildren

func (c *NodeClient) QueryChildren(_m *Node) *NodeQuery

QueryChildren queries the children edge of a Node.

func (*NodeClient) QueryParent

func (c *NodeClient) QueryParent(_m *Node) *NodeQuery

QueryParent queries the parent edge of a Node.

func (*NodeClient) Update

func (c *NodeClient) Update() *NodeUpdate

Update returns an update builder for Node.

func (*NodeClient) UpdateOne

func (c *NodeClient) UpdateOne(_m *Node) *NodeUpdateOne

UpdateOne returns an update builder for the given entity.

func (*NodeClient) UpdateOneID

func (c *NodeClient) UpdateOneID(id string) *NodeUpdateOne

UpdateOneID returns an update builder for the given id.

func (*NodeClient) Use

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

Use adds a list of mutation hooks to the hooks stack. A call to `Use(f, g, h)` equals to `node.Hooks(f(g(h())))`.

type NodeCreate

type NodeCreate struct {
	// contains filtered or unexported fields
}

NodeCreate is the builder for creating a Node entity.

func (*NodeCreate) AddChildIDs

func (_c *NodeCreate) AddChildIDs(ids ...string) *NodeCreate

AddChildIDs adds the "children" edge to the Node entity by IDs.

func (*NodeCreate) AddChildren

func (_c *NodeCreate) AddChildren(v ...*Node) *NodeCreate

AddChildren adds the "children" edges to the Node entity.

func (*NodeCreate) Exec

func (_c *NodeCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*NodeCreate) ExecX

func (_c *NodeCreate) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*NodeCreate) Mutation

func (_c *NodeCreate) Mutation() *NodeMutation

Mutation returns the NodeMutation object of the builder.

func (*NodeCreate) Save

func (_c *NodeCreate) Save(ctx context.Context) (*Node, error)

Save creates the Node in the database.

func (*NodeCreate) SaveX

func (_c *NodeCreate) SaveX(ctx context.Context) *Node

SaveX calls Save and panics if Save returns an error.

func (*NodeCreate) SetAgentName

func (_c *NodeCreate) SetAgentName(v string) *NodeCreate

SetAgentName sets the "agent_name" field.

func (*NodeCreate) SetBucket

func (_c *NodeCreate) SetBucket(v map[string]interface{}) *NodeCreate

SetBucket sets the "bucket" field.

func (*NodeCreate) SetCacheCreationInputTokens

func (_c *NodeCreate) SetCacheCreationInputTokens(v int) *NodeCreate

SetCacheCreationInputTokens sets the "cache_creation_input_tokens" field.

func (*NodeCreate) SetCacheReadInputTokens

func (_c *NodeCreate) SetCacheReadInputTokens(v int) *NodeCreate

SetCacheReadInputTokens sets the "cache_read_input_tokens" field.

func (*NodeCreate) SetCompletionTokens

func (_c *NodeCreate) SetCompletionTokens(v int) *NodeCreate

SetCompletionTokens sets the "completion_tokens" field.

func (*NodeCreate) SetContent

func (_c *NodeCreate) SetContent(v []map[string]interface{}) *NodeCreate

SetContent sets the "content" field.

func (*NodeCreate) SetCreatedAt

func (_c *NodeCreate) SetCreatedAt(v time.Time) *NodeCreate

SetCreatedAt sets the "created_at" field.

func (*NodeCreate) SetID

func (_c *NodeCreate) SetID(v string) *NodeCreate

SetID sets the "id" field.

func (*NodeCreate) SetModel

func (_c *NodeCreate) SetModel(v string) *NodeCreate

SetModel sets the "model" field.

func (*NodeCreate) SetNillableAgentName

func (_c *NodeCreate) SetNillableAgentName(v *string) *NodeCreate

SetNillableAgentName sets the "agent_name" field if the given value is not nil.

func (*NodeCreate) SetNillableCacheCreationInputTokens

func (_c *NodeCreate) SetNillableCacheCreationInputTokens(v *int) *NodeCreate

SetNillableCacheCreationInputTokens sets the "cache_creation_input_tokens" field if the given value is not nil.

func (*NodeCreate) SetNillableCacheReadInputTokens

func (_c *NodeCreate) SetNillableCacheReadInputTokens(v *int) *NodeCreate

SetNillableCacheReadInputTokens sets the "cache_read_input_tokens" field if the given value is not nil.

func (*NodeCreate) SetNillableCompletionTokens

func (_c *NodeCreate) SetNillableCompletionTokens(v *int) *NodeCreate

SetNillableCompletionTokens sets the "completion_tokens" field if the given value is not nil.

func (*NodeCreate) SetNillableCreatedAt

func (_c *NodeCreate) SetNillableCreatedAt(v *time.Time) *NodeCreate

SetNillableCreatedAt sets the "created_at" field if the given value is not nil.

func (*NodeCreate) SetNillableModel

func (_c *NodeCreate) SetNillableModel(v *string) *NodeCreate

SetNillableModel sets the "model" field if the given value is not nil.

func (*NodeCreate) SetNillableParentHash

func (_c *NodeCreate) SetNillableParentHash(v *string) *NodeCreate

SetNillableParentHash sets the "parent_hash" field if the given value is not nil.

func (*NodeCreate) SetNillableParentID

func (_c *NodeCreate) SetNillableParentID(id *string) *NodeCreate

SetNillableParentID sets the "parent" edge to the Node entity by ID if the given value is not nil.

func (*NodeCreate) SetNillableProject

func (_c *NodeCreate) SetNillableProject(v *string) *NodeCreate

SetNillableProject sets the "project" field if the given value is not nil.

func (*NodeCreate) SetNillablePromptDurationNs

func (_c *NodeCreate) SetNillablePromptDurationNs(v *int64) *NodeCreate

SetNillablePromptDurationNs sets the "prompt_duration_ns" field if the given value is not nil.

func (*NodeCreate) SetNillablePromptTokens

func (_c *NodeCreate) SetNillablePromptTokens(v *int) *NodeCreate

SetNillablePromptTokens sets the "prompt_tokens" field if the given value is not nil.

func (*NodeCreate) SetNillableProvider

func (_c *NodeCreate) SetNillableProvider(v *string) *NodeCreate

SetNillableProvider sets the "provider" field if the given value is not nil.

func (*NodeCreate) SetNillableRole

func (_c *NodeCreate) SetNillableRole(v *string) *NodeCreate

SetNillableRole sets the "role" field if the given value is not nil.

func (*NodeCreate) SetNillableStopReason

func (_c *NodeCreate) SetNillableStopReason(v *string) *NodeCreate

SetNillableStopReason sets the "stop_reason" field if the given value is not nil.

func (*NodeCreate) SetNillableTotalDurationNs

func (_c *NodeCreate) SetNillableTotalDurationNs(v *int64) *NodeCreate

SetNillableTotalDurationNs sets the "total_duration_ns" field if the given value is not nil.

func (*NodeCreate) SetNillableTotalTokens

func (_c *NodeCreate) SetNillableTotalTokens(v *int) *NodeCreate

SetNillableTotalTokens sets the "total_tokens" field if the given value is not nil.

func (*NodeCreate) SetNillableType

func (_c *NodeCreate) SetNillableType(v *string) *NodeCreate

SetNillableType sets the "type" field if the given value is not nil.

func (*NodeCreate) SetParent

func (_c *NodeCreate) SetParent(v *Node) *NodeCreate

SetParent sets the "parent" edge to the Node entity.

func (*NodeCreate) SetParentHash

func (_c *NodeCreate) SetParentHash(v string) *NodeCreate

SetParentHash sets the "parent_hash" field.

func (*NodeCreate) SetParentID

func (_c *NodeCreate) SetParentID(id string) *NodeCreate

SetParentID sets the "parent" edge to the Node entity by ID.

func (*NodeCreate) SetProject

func (_c *NodeCreate) SetProject(v string) *NodeCreate

SetProject sets the "project" field.

func (*NodeCreate) SetPromptDurationNs

func (_c *NodeCreate) SetPromptDurationNs(v int64) *NodeCreate

SetPromptDurationNs sets the "prompt_duration_ns" field.

func (*NodeCreate) SetPromptTokens

func (_c *NodeCreate) SetPromptTokens(v int) *NodeCreate

SetPromptTokens sets the "prompt_tokens" field.

func (*NodeCreate) SetProvider

func (_c *NodeCreate) SetProvider(v string) *NodeCreate

SetProvider sets the "provider" field.

func (*NodeCreate) SetRole

func (_c *NodeCreate) SetRole(v string) *NodeCreate

SetRole sets the "role" field.

func (*NodeCreate) SetStopReason

func (_c *NodeCreate) SetStopReason(v string) *NodeCreate

SetStopReason sets the "stop_reason" field.

func (*NodeCreate) SetTotalDurationNs

func (_c *NodeCreate) SetTotalDurationNs(v int64) *NodeCreate

SetTotalDurationNs sets the "total_duration_ns" field.

func (*NodeCreate) SetTotalTokens

func (_c *NodeCreate) SetTotalTokens(v int) *NodeCreate

SetTotalTokens sets the "total_tokens" field.

func (*NodeCreate) SetType

func (_c *NodeCreate) SetType(v string) *NodeCreate

SetType sets the "type" field.

type NodeCreateBulk

type NodeCreateBulk struct {
	// contains filtered or unexported fields
}

NodeCreateBulk is the builder for creating many Node entities in bulk.

func (*NodeCreateBulk) Exec

func (_c *NodeCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*NodeCreateBulk) ExecX

func (_c *NodeCreateBulk) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*NodeCreateBulk) Save

func (_c *NodeCreateBulk) Save(ctx context.Context) ([]*Node, error)

Save creates the Node entities in the database.

func (*NodeCreateBulk) SaveX

func (_c *NodeCreateBulk) SaveX(ctx context.Context) []*Node

SaveX is like Save, but panics if an error occurs.

type NodeDelete

type NodeDelete struct {
	// contains filtered or unexported fields
}

NodeDelete is the builder for deleting a Node entity.

func (*NodeDelete) Exec

func (_d *NodeDelete) Exec(ctx context.Context) (int, error)

Exec executes the deletion query and returns how many vertices were deleted.

func (*NodeDelete) ExecX

func (_d *NodeDelete) ExecX(ctx context.Context) int

ExecX is like Exec, but panics if an error occurs.

func (*NodeDelete) Where

func (_d *NodeDelete) Where(ps ...predicate.Node) *NodeDelete

Where appends a list predicates to the NodeDelete builder.

type NodeDeleteOne

type NodeDeleteOne struct {
	// contains filtered or unexported fields
}

NodeDeleteOne is the builder for deleting a single Node entity.

func (*NodeDeleteOne) Exec

func (_d *NodeDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*NodeDeleteOne) ExecX

func (_d *NodeDeleteOne) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*NodeDeleteOne) Where

func (_d *NodeDeleteOne) Where(ps ...predicate.Node) *NodeDeleteOne

Where appends a list predicates to the NodeDelete builder.

type NodeEdges

type NodeEdges struct {
	// Parent holds the value of the parent edge.
	Parent *Node `json:"parent,omitempty"`
	// Children holds the value of the children edge.
	Children []*Node `json:"children,omitempty"`
	// contains filtered or unexported fields
}

NodeEdges holds the relations/edges for other nodes in the graph.

func (NodeEdges) ChildrenOrErr

func (e NodeEdges) ChildrenOrErr() ([]*Node, error)

ChildrenOrErr returns the Children value or an error if the edge was not loaded in eager-loading.

func (NodeEdges) ParentOrErr

func (e NodeEdges) ParentOrErr() (*Node, error)

ParentOrErr returns the Parent value or an error if the edge was not loaded in eager-loading, or loaded but was not found.

type NodeGroupBy

type NodeGroupBy struct {
	// contains filtered or unexported fields
}

NodeGroupBy is the group-by builder for Node entities.

func (*NodeGroupBy) Aggregate

func (_g *NodeGroupBy) Aggregate(fns ...AggregateFunc) *NodeGroupBy

Aggregate adds the given aggregation functions to the group-by query.

func (*NodeGroupBy) Bool

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

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

func (*NodeGroupBy) BoolX

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

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

func (*NodeGroupBy) Bools

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

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

func (*NodeGroupBy) BoolsX

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

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

func (*NodeGroupBy) Float64

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

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

func (*NodeGroupBy) Float64X

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

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

func (*NodeGroupBy) Float64s

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

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

func (*NodeGroupBy) Float64sX

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

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

func (*NodeGroupBy) Int

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

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

func (*NodeGroupBy) IntX

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

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

func (*NodeGroupBy) Ints

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

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

func (*NodeGroupBy) IntsX

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

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

func (*NodeGroupBy) Scan

func (_g *NodeGroupBy) Scan(ctx context.Context, v any) error

Scan applies the selector query and scans the result into the given value.

func (*NodeGroupBy) ScanX

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

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

func (*NodeGroupBy) String

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

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

func (*NodeGroupBy) StringX

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

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

func (*NodeGroupBy) Strings

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

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

func (*NodeGroupBy) StringsX

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

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

type NodeMutation

type NodeMutation struct {
	// contains filtered or unexported fields
}

NodeMutation represents an operation that mutates the Node nodes in the graph.

func (*NodeMutation) AddCacheCreationInputTokens

func (m *NodeMutation) AddCacheCreationInputTokens(i int)

AddCacheCreationInputTokens adds i to the "cache_creation_input_tokens" field.

func (*NodeMutation) AddCacheReadInputTokens

func (m *NodeMutation) AddCacheReadInputTokens(i int)

AddCacheReadInputTokens adds i to the "cache_read_input_tokens" field.

func (*NodeMutation) AddChildIDs

func (m *NodeMutation) AddChildIDs(ids ...string)

AddChildIDs adds the "children" edge to the Node entity by ids.

func (*NodeMutation) AddCompletionTokens

func (m *NodeMutation) AddCompletionTokens(i int)

AddCompletionTokens adds i to the "completion_tokens" field.

func (*NodeMutation) AddField

func (m *NodeMutation) AddField(name string, value ent.Value) error

AddField adds the value to the field with the given name. It returns an error if the field is not defined in the schema, or if the type mismatched the field type.

func (*NodeMutation) AddPromptDurationNs

func (m *NodeMutation) AddPromptDurationNs(i int64)

AddPromptDurationNs adds i to the "prompt_duration_ns" field.

func (*NodeMutation) AddPromptTokens

func (m *NodeMutation) AddPromptTokens(i int)

AddPromptTokens adds i to the "prompt_tokens" field.

func (*NodeMutation) AddTotalDurationNs

func (m *NodeMutation) AddTotalDurationNs(i int64)

AddTotalDurationNs adds i to the "total_duration_ns" field.

func (*NodeMutation) AddTotalTokens

func (m *NodeMutation) AddTotalTokens(i int)

AddTotalTokens adds i to the "total_tokens" field.

func (*NodeMutation) AddedCacheCreationInputTokens

func (m *NodeMutation) AddedCacheCreationInputTokens() (r int, exists bool)

AddedCacheCreationInputTokens returns the value that was added to the "cache_creation_input_tokens" field in this mutation.

func (*NodeMutation) AddedCacheReadInputTokens

func (m *NodeMutation) AddedCacheReadInputTokens() (r int, exists bool)

AddedCacheReadInputTokens returns the value that was added to the "cache_read_input_tokens" field in this mutation.

func (*NodeMutation) AddedCompletionTokens

func (m *NodeMutation) AddedCompletionTokens() (r int, exists bool)

AddedCompletionTokens returns the value that was added to the "completion_tokens" field in this mutation.

func (*NodeMutation) AddedEdges

func (m *NodeMutation) AddedEdges() []string

AddedEdges returns all edge names that were set/added in this mutation.

func (*NodeMutation) AddedField

func (m *NodeMutation) AddedField(name string) (ent.Value, bool)

AddedField returns the numeric value that was incremented/decremented on a field with the given name. The second boolean return value indicates that this field was not set, or was not defined in the schema.

func (*NodeMutation) AddedFields

func (m *NodeMutation) AddedFields() []string

AddedFields returns all numeric fields that were incremented/decremented during this mutation.

func (*NodeMutation) AddedIDs

func (m *NodeMutation) AddedIDs(name string) []ent.Value

AddedIDs returns all IDs (to other nodes) that were added for the given edge name in this mutation.

func (*NodeMutation) AddedPromptDurationNs

func (m *NodeMutation) AddedPromptDurationNs() (r int64, exists bool)

AddedPromptDurationNs returns the value that was added to the "prompt_duration_ns" field in this mutation.

func (*NodeMutation) AddedPromptTokens

func (m *NodeMutation) AddedPromptTokens() (r int, exists bool)

AddedPromptTokens returns the value that was added to the "prompt_tokens" field in this mutation.

func (*NodeMutation) AddedTotalDurationNs

func (m *NodeMutation) AddedTotalDurationNs() (r int64, exists bool)

AddedTotalDurationNs returns the value that was added to the "total_duration_ns" field in this mutation.

func (*NodeMutation) AddedTotalTokens

func (m *NodeMutation) AddedTotalTokens() (r int, exists bool)

AddedTotalTokens returns the value that was added to the "total_tokens" field in this mutation.

func (*NodeMutation) AgentName

func (m *NodeMutation) AgentName() (r string, exists bool)

AgentName returns the value of the "agent_name" field in the mutation.

func (*NodeMutation) AgentNameCleared

func (m *NodeMutation) AgentNameCleared() bool

AgentNameCleared returns if the "agent_name" field was cleared in this mutation.

func (*NodeMutation) AppendContent

func (m *NodeMutation) AppendContent(value []map[string]interface{})

AppendContent adds value to the "content" field.

func (*NodeMutation) AppendedContent

func (m *NodeMutation) AppendedContent() ([]map[string]interface{}, bool)

AppendedContent returns the list of values that were appended to the "content" field in this mutation.

func (*NodeMutation) Bucket

func (m *NodeMutation) Bucket() (r map[string]interface{}, exists bool)

Bucket returns the value of the "bucket" field in the mutation.

func (*NodeMutation) BucketCleared

func (m *NodeMutation) BucketCleared() bool

BucketCleared returns if the "bucket" field was cleared in this mutation.

func (*NodeMutation) CacheCreationInputTokens

func (m *NodeMutation) CacheCreationInputTokens() (r int, exists bool)

CacheCreationInputTokens returns the value of the "cache_creation_input_tokens" field in the mutation.

func (*NodeMutation) CacheCreationInputTokensCleared

func (m *NodeMutation) CacheCreationInputTokensCleared() bool

CacheCreationInputTokensCleared returns if the "cache_creation_input_tokens" field was cleared in this mutation.

func (*NodeMutation) CacheReadInputTokens

func (m *NodeMutation) CacheReadInputTokens() (r int, exists bool)

CacheReadInputTokens returns the value of the "cache_read_input_tokens" field in the mutation.

func (*NodeMutation) CacheReadInputTokensCleared

func (m *NodeMutation) CacheReadInputTokensCleared() bool

CacheReadInputTokensCleared returns if the "cache_read_input_tokens" field was cleared in this mutation.

func (*NodeMutation) ChildrenCleared

func (m *NodeMutation) ChildrenCleared() bool

ChildrenCleared reports if the "children" edge to the Node entity was cleared.

func (*NodeMutation) ChildrenIDs

func (m *NodeMutation) ChildrenIDs() (ids []string)

ChildrenIDs returns the "children" edge IDs in the mutation.

func (*NodeMutation) ClearAgentName

func (m *NodeMutation) ClearAgentName()

ClearAgentName clears the value of the "agent_name" field.

func (*NodeMutation) ClearBucket

func (m *NodeMutation) ClearBucket()

ClearBucket clears the value of the "bucket" field.

func (*NodeMutation) ClearCacheCreationInputTokens

func (m *NodeMutation) ClearCacheCreationInputTokens()

ClearCacheCreationInputTokens clears the value of the "cache_creation_input_tokens" field.

func (*NodeMutation) ClearCacheReadInputTokens

func (m *NodeMutation) ClearCacheReadInputTokens()

ClearCacheReadInputTokens clears the value of the "cache_read_input_tokens" field.

func (*NodeMutation) ClearChildren

func (m *NodeMutation) ClearChildren()

ClearChildren clears the "children" edge to the Node entity.

func (*NodeMutation) ClearCompletionTokens

func (m *NodeMutation) ClearCompletionTokens()

ClearCompletionTokens clears the value of the "completion_tokens" field.

func (*NodeMutation) ClearContent

func (m *NodeMutation) ClearContent()

ClearContent clears the value of the "content" field.

func (*NodeMutation) ClearEdge

func (m *NodeMutation) ClearEdge(name string) error

ClearEdge clears the value of the edge with the given name. It returns an error if that edge is not defined in the schema.

func (*NodeMutation) ClearField

func (m *NodeMutation) ClearField(name string) error

ClearField clears the value of the field with the given name. It returns an error if the field is not defined in the schema.

func (*NodeMutation) ClearModel

func (m *NodeMutation) ClearModel()

ClearModel clears the value of the "model" field.

func (*NodeMutation) ClearParent

func (m *NodeMutation) ClearParent()

ClearParent clears the "parent" edge to the Node entity.

func (*NodeMutation) ClearParentHash

func (m *NodeMutation) ClearParentHash()

ClearParentHash clears the value of the "parent_hash" field.

func (*NodeMutation) ClearProject

func (m *NodeMutation) ClearProject()

ClearProject clears the value of the "project" field.

func (*NodeMutation) ClearPromptDurationNs

func (m *NodeMutation) ClearPromptDurationNs()

ClearPromptDurationNs clears the value of the "prompt_duration_ns" field.

func (*NodeMutation) ClearPromptTokens

func (m *NodeMutation) ClearPromptTokens()

ClearPromptTokens clears the value of the "prompt_tokens" field.

func (*NodeMutation) ClearProvider

func (m *NodeMutation) ClearProvider()

ClearProvider clears the value of the "provider" field.

func (*NodeMutation) ClearRole

func (m *NodeMutation) ClearRole()

ClearRole clears the value of the "role" field.

func (*NodeMutation) ClearStopReason

func (m *NodeMutation) ClearStopReason()

ClearStopReason clears the value of the "stop_reason" field.

func (*NodeMutation) ClearTotalDurationNs

func (m *NodeMutation) ClearTotalDurationNs()

ClearTotalDurationNs clears the value of the "total_duration_ns" field.

func (*NodeMutation) ClearTotalTokens

func (m *NodeMutation) ClearTotalTokens()

ClearTotalTokens clears the value of the "total_tokens" field.

func (*NodeMutation) ClearType

func (m *NodeMutation) ClearType()

ClearType clears the value of the "type" field.

func (*NodeMutation) ClearedEdges

func (m *NodeMutation) ClearedEdges() []string

ClearedEdges returns all edge names that were cleared in this mutation.

func (*NodeMutation) ClearedFields

func (m *NodeMutation) ClearedFields() []string

ClearedFields returns all nullable fields that were cleared during this mutation.

func (NodeMutation) Client

func (m NodeMutation) Client() *Client

Client returns a new `ent.Client` from the mutation. If the mutation was executed in a transaction (ent.Tx), a transactional client is returned.

func (*NodeMutation) CompletionTokens

func (m *NodeMutation) CompletionTokens() (r int, exists bool)

CompletionTokens returns the value of the "completion_tokens" field in the mutation.

func (*NodeMutation) CompletionTokensCleared

func (m *NodeMutation) CompletionTokensCleared() bool

CompletionTokensCleared returns if the "completion_tokens" field was cleared in this mutation.

func (*NodeMutation) Content

func (m *NodeMutation) Content() (r []map[string]interface{}, exists bool)

Content returns the value of the "content" field in the mutation.

func (*NodeMutation) ContentCleared

func (m *NodeMutation) ContentCleared() bool

ContentCleared returns if the "content" field was cleared in this mutation.

func (*NodeMutation) CreatedAt

func (m *NodeMutation) CreatedAt() (r time.Time, exists bool)

CreatedAt returns the value of the "created_at" field in the mutation.

func (*NodeMutation) EdgeCleared

func (m *NodeMutation) EdgeCleared(name string) bool

EdgeCleared returns a boolean which indicates if the edge with the given name was cleared in this mutation.

func (*NodeMutation) Field

func (m *NodeMutation) Field(name string) (ent.Value, bool)

Field returns the value of a field with the given name. The second boolean return value indicates that this field was not set, or was not defined in the schema.

func (*NodeMutation) FieldCleared

func (m *NodeMutation) FieldCleared(name string) bool

FieldCleared returns a boolean indicating if a field with the given name was cleared in this mutation.

func (*NodeMutation) Fields

func (m *NodeMutation) Fields() []string

Fields returns all fields that were changed during this mutation. Note that in order to get all numeric fields that were incremented/decremented, call AddedFields().

func (*NodeMutation) GetType

func (m *NodeMutation) GetType() (r string, exists bool)

GetType returns the value of the "type" field in the mutation.

func (*NodeMutation) ID

func (m *NodeMutation) ID() (id string, exists bool)

ID returns the ID value in the mutation. Note that the ID is only available if it was provided to the builder or after it was returned from the database.

func (*NodeMutation) IDs

func (m *NodeMutation) IDs(ctx context.Context) ([]string, error)

IDs queries the database and returns the entity ids that match the mutation's predicate. That means, if the mutation is applied within a transaction with an isolation level such as sql.LevelSerializable, the returned ids match the ids of the rows that will be updated or updated by the mutation.

func (*NodeMutation) Model

func (m *NodeMutation) Model() (r string, exists bool)

Model returns the value of the "model" field in the mutation.

func (*NodeMutation) ModelCleared

func (m *NodeMutation) ModelCleared() bool

ModelCleared returns if the "model" field was cleared in this mutation.

func (*NodeMutation) OldAgentName

func (m *NodeMutation) OldAgentName(ctx context.Context) (v string, err error)

OldAgentName returns the old "agent_name" field's value of the Node entity. If the Node object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.

func (*NodeMutation) OldBucket

func (m *NodeMutation) OldBucket(ctx context.Context) (v map[string]interface{}, err error)

OldBucket returns the old "bucket" field's value of the Node entity. If the Node object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.

func (*NodeMutation) OldCacheCreationInputTokens

func (m *NodeMutation) OldCacheCreationInputTokens(ctx context.Context) (v *int, err error)

OldCacheCreationInputTokens returns the old "cache_creation_input_tokens" field's value of the Node entity. If the Node object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.

func (*NodeMutation) OldCacheReadInputTokens

func (m *NodeMutation) OldCacheReadInputTokens(ctx context.Context) (v *int, err error)

OldCacheReadInputTokens returns the old "cache_read_input_tokens" field's value of the Node entity. If the Node object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.

func (*NodeMutation) OldCompletionTokens

func (m *NodeMutation) OldCompletionTokens(ctx context.Context) (v *int, err error)

OldCompletionTokens returns the old "completion_tokens" field's value of the Node entity. If the Node object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.

func (*NodeMutation) OldContent

func (m *NodeMutation) OldContent(ctx context.Context) (v []map[string]interface{}, err error)

OldContent returns the old "content" field's value of the Node entity. If the Node object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.

func (*NodeMutation) OldCreatedAt

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

OldCreatedAt returns the old "created_at" field's value of the Node entity. If the Node object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.

func (*NodeMutation) OldField

func (m *NodeMutation) 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 (*NodeMutation) OldModel

func (m *NodeMutation) OldModel(ctx context.Context) (v string, err error)

OldModel returns the old "model" field's value of the Node entity. If the Node object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.

func (*NodeMutation) OldParentHash

func (m *NodeMutation) OldParentHash(ctx context.Context) (v *string, err error)

OldParentHash returns the old "parent_hash" field's value of the Node entity. If the Node object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.

func (*NodeMutation) OldProject

func (m *NodeMutation) OldProject(ctx context.Context) (v *string, err error)

OldProject returns the old "project" field's value of the Node entity. If the Node object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.

func (*NodeMutation) OldPromptDurationNs

func (m *NodeMutation) OldPromptDurationNs(ctx context.Context) (v *int64, err error)

OldPromptDurationNs returns the old "prompt_duration_ns" field's value of the Node entity. If the Node object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.

func (*NodeMutation) OldPromptTokens

func (m *NodeMutation) OldPromptTokens(ctx context.Context) (v *int, err error)

OldPromptTokens returns the old "prompt_tokens" field's value of the Node entity. If the Node object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.

func (*NodeMutation) OldProvider

func (m *NodeMutation) OldProvider(ctx context.Context) (v string, err error)

OldProvider returns the old "provider" field's value of the Node entity. If the Node object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.

func (*NodeMutation) OldRole

func (m *NodeMutation) OldRole(ctx context.Context) (v string, err error)

OldRole returns the old "role" field's value of the Node entity. If the Node object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.

func (*NodeMutation) OldStopReason

func (m *NodeMutation) OldStopReason(ctx context.Context) (v string, err error)

OldStopReason returns the old "stop_reason" field's value of the Node entity. If the Node object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.

func (*NodeMutation) OldTotalDurationNs

func (m *NodeMutation) OldTotalDurationNs(ctx context.Context) (v *int64, err error)

OldTotalDurationNs returns the old "total_duration_ns" field's value of the Node entity. If the Node object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.

func (*NodeMutation) OldTotalTokens

func (m *NodeMutation) OldTotalTokens(ctx context.Context) (v *int, err error)

OldTotalTokens returns the old "total_tokens" field's value of the Node entity. If the Node object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.

func (*NodeMutation) OldType

func (m *NodeMutation) OldType(ctx context.Context) (v string, err error)

OldType returns the old "type" field's value of the Node entity. If the Node object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.

func (*NodeMutation) Op

func (m *NodeMutation) Op() Op

Op returns the operation name.

func (*NodeMutation) ParentCleared

func (m *NodeMutation) ParentCleared() bool

ParentCleared reports if the "parent" edge to the Node entity was cleared.

func (*NodeMutation) ParentHash

func (m *NodeMutation) ParentHash() (r string, exists bool)

ParentHash returns the value of the "parent_hash" field in the mutation.

func (*NodeMutation) ParentHashCleared

func (m *NodeMutation) ParentHashCleared() bool

ParentHashCleared returns if the "parent_hash" field was cleared in this mutation.

func (*NodeMutation) ParentID

func (m *NodeMutation) ParentID() (id string, exists bool)

ParentID returns the "parent" edge ID in the mutation.

func (*NodeMutation) ParentIDs

func (m *NodeMutation) ParentIDs() (ids []string)

ParentIDs returns the "parent" edge IDs in the mutation. Note that IDs always returns len(IDs) <= 1 for unique edges, and you should use ParentID instead. It exists only for internal usage by the builders.

func (*NodeMutation) Project

func (m *NodeMutation) Project() (r string, exists bool)

Project returns the value of the "project" field in the mutation.

func (*NodeMutation) ProjectCleared

func (m *NodeMutation) ProjectCleared() bool

ProjectCleared returns if the "project" field was cleared in this mutation.

func (*NodeMutation) PromptDurationNs

func (m *NodeMutation) PromptDurationNs() (r int64, exists bool)

PromptDurationNs returns the value of the "prompt_duration_ns" field in the mutation.

func (*NodeMutation) PromptDurationNsCleared

func (m *NodeMutation) PromptDurationNsCleared() bool

PromptDurationNsCleared returns if the "prompt_duration_ns" field was cleared in this mutation.

func (*NodeMutation) PromptTokens

func (m *NodeMutation) PromptTokens() (r int, exists bool)

PromptTokens returns the value of the "prompt_tokens" field in the mutation.

func (*NodeMutation) PromptTokensCleared

func (m *NodeMutation) PromptTokensCleared() bool

PromptTokensCleared returns if the "prompt_tokens" field was cleared in this mutation.

func (*NodeMutation) Provider

func (m *NodeMutation) Provider() (r string, exists bool)

Provider returns the value of the "provider" field in the mutation.

func (*NodeMutation) ProviderCleared

func (m *NodeMutation) ProviderCleared() bool

ProviderCleared returns if the "provider" field was cleared in this mutation.

func (*NodeMutation) RemoveChildIDs

func (m *NodeMutation) RemoveChildIDs(ids ...string)

RemoveChildIDs removes the "children" edge to the Node entity by IDs.

func (*NodeMutation) RemovedChildrenIDs

func (m *NodeMutation) RemovedChildrenIDs() (ids []string)

RemovedChildren returns the removed IDs of the "children" edge to the Node entity.

func (*NodeMutation) RemovedEdges

func (m *NodeMutation) RemovedEdges() []string

RemovedEdges returns all edge names that were removed in this mutation.

func (*NodeMutation) RemovedIDs

func (m *NodeMutation) RemovedIDs(name string) []ent.Value

RemovedIDs returns all IDs (to other nodes) that were removed for the edge with the given name in this mutation.

func (*NodeMutation) ResetAgentName

func (m *NodeMutation) ResetAgentName()

ResetAgentName resets all changes to the "agent_name" field.

func (*NodeMutation) ResetBucket

func (m *NodeMutation) ResetBucket()

ResetBucket resets all changes to the "bucket" field.

func (*NodeMutation) ResetCacheCreationInputTokens

func (m *NodeMutation) ResetCacheCreationInputTokens()

ResetCacheCreationInputTokens resets all changes to the "cache_creation_input_tokens" field.

func (*NodeMutation) ResetCacheReadInputTokens

func (m *NodeMutation) ResetCacheReadInputTokens()

ResetCacheReadInputTokens resets all changes to the "cache_read_input_tokens" field.

func (*NodeMutation) ResetChildren

func (m *NodeMutation) ResetChildren()

ResetChildren resets all changes to the "children" edge.

func (*NodeMutation) ResetCompletionTokens

func (m *NodeMutation) ResetCompletionTokens()

ResetCompletionTokens resets all changes to the "completion_tokens" field.

func (*NodeMutation) ResetContent

func (m *NodeMutation) ResetContent()

ResetContent resets all changes to the "content" field.

func (*NodeMutation) ResetCreatedAt

func (m *NodeMutation) ResetCreatedAt()

ResetCreatedAt resets all changes to the "created_at" field.

func (*NodeMutation) ResetEdge

func (m *NodeMutation) ResetEdge(name string) error

ResetEdge resets all changes to the edge with the given name in this mutation. It returns an error if the edge is not defined in the schema.

func (*NodeMutation) ResetField

func (m *NodeMutation) ResetField(name string) error

ResetField resets all changes in the mutation for the field with the given name. It returns an error if the field is not defined in the schema.

func (*NodeMutation) ResetModel

func (m *NodeMutation) ResetModel()

ResetModel resets all changes to the "model" field.

func (*NodeMutation) ResetParent

func (m *NodeMutation) ResetParent()

ResetParent resets all changes to the "parent" edge.

func (*NodeMutation) ResetParentHash

func (m *NodeMutation) ResetParentHash()

ResetParentHash resets all changes to the "parent_hash" field.

func (*NodeMutation) ResetProject

func (m *NodeMutation) ResetProject()

ResetProject resets all changes to the "project" field.

func (*NodeMutation) ResetPromptDurationNs

func (m *NodeMutation) ResetPromptDurationNs()

ResetPromptDurationNs resets all changes to the "prompt_duration_ns" field.

func (*NodeMutation) ResetPromptTokens

func (m *NodeMutation) ResetPromptTokens()

ResetPromptTokens resets all changes to the "prompt_tokens" field.

func (*NodeMutation) ResetProvider

func (m *NodeMutation) ResetProvider()

ResetProvider resets all changes to the "provider" field.

func (*NodeMutation) ResetRole

func (m *NodeMutation) ResetRole()

ResetRole resets all changes to the "role" field.

func (*NodeMutation) ResetStopReason

func (m *NodeMutation) ResetStopReason()

ResetStopReason resets all changes to the "stop_reason" field.

func (*NodeMutation) ResetTotalDurationNs

func (m *NodeMutation) ResetTotalDurationNs()

ResetTotalDurationNs resets all changes to the "total_duration_ns" field.

func (*NodeMutation) ResetTotalTokens

func (m *NodeMutation) ResetTotalTokens()

ResetTotalTokens resets all changes to the "total_tokens" field.

func (*NodeMutation) ResetType

func (m *NodeMutation) ResetType()

ResetType resets all changes to the "type" field.

func (*NodeMutation) Role

func (m *NodeMutation) Role() (r string, exists bool)

Role returns the value of the "role" field in the mutation.

func (*NodeMutation) RoleCleared

func (m *NodeMutation) RoleCleared() bool

RoleCleared returns if the "role" field was cleared in this mutation.

func (*NodeMutation) SetAgentName

func (m *NodeMutation) SetAgentName(s string)

SetAgentName sets the "agent_name" field.

func (*NodeMutation) SetBucket

func (m *NodeMutation) SetBucket(value map[string]interface{})

SetBucket sets the "bucket" field.

func (*NodeMutation) SetCacheCreationInputTokens

func (m *NodeMutation) SetCacheCreationInputTokens(i int)

SetCacheCreationInputTokens sets the "cache_creation_input_tokens" field.

func (*NodeMutation) SetCacheReadInputTokens

func (m *NodeMutation) SetCacheReadInputTokens(i int)

SetCacheReadInputTokens sets the "cache_read_input_tokens" field.

func (*NodeMutation) SetCompletionTokens

func (m *NodeMutation) SetCompletionTokens(i int)

SetCompletionTokens sets the "completion_tokens" field.

func (*NodeMutation) SetContent

func (m *NodeMutation) SetContent(value []map[string]interface{})

SetContent sets the "content" field.

func (*NodeMutation) SetCreatedAt

func (m *NodeMutation) SetCreatedAt(t time.Time)

SetCreatedAt sets the "created_at" field.

func (*NodeMutation) SetField

func (m *NodeMutation) SetField(name string, value ent.Value) error

SetField sets the value of a field with the given name. It returns an error if the field is not defined in the schema, or if the type mismatched the field type.

func (*NodeMutation) SetID

func (m *NodeMutation) SetID(id string)

SetID sets the value of the id field. Note that this operation is only accepted on creation of Node entities.

func (*NodeMutation) SetModel

func (m *NodeMutation) SetModel(s string)

SetModel sets the "model" field.

func (*NodeMutation) SetOp

func (m *NodeMutation) SetOp(op Op)

SetOp allows setting the mutation operation.

func (*NodeMutation) SetParentHash

func (m *NodeMutation) SetParentHash(s string)

SetParentHash sets the "parent_hash" field.

func (*NodeMutation) SetParentID

func (m *NodeMutation) SetParentID(id string)

SetParentID sets the "parent" edge to the Node entity by id.

func (*NodeMutation) SetProject

func (m *NodeMutation) SetProject(s string)

SetProject sets the "project" field.

func (*NodeMutation) SetPromptDurationNs

func (m *NodeMutation) SetPromptDurationNs(i int64)

SetPromptDurationNs sets the "prompt_duration_ns" field.

func (*NodeMutation) SetPromptTokens

func (m *NodeMutation) SetPromptTokens(i int)

SetPromptTokens sets the "prompt_tokens" field.

func (*NodeMutation) SetProvider

func (m *NodeMutation) SetProvider(s string)

SetProvider sets the "provider" field.

func (*NodeMutation) SetRole

func (m *NodeMutation) SetRole(s string)

SetRole sets the "role" field.

func (*NodeMutation) SetStopReason

func (m *NodeMutation) SetStopReason(s string)

SetStopReason sets the "stop_reason" field.

func (*NodeMutation) SetTotalDurationNs

func (m *NodeMutation) SetTotalDurationNs(i int64)

SetTotalDurationNs sets the "total_duration_ns" field.

func (*NodeMutation) SetTotalTokens

func (m *NodeMutation) SetTotalTokens(i int)

SetTotalTokens sets the "total_tokens" field.

func (*NodeMutation) SetType

func (m *NodeMutation) SetType(s string)

SetType sets the "type" field.

func (*NodeMutation) StopReason

func (m *NodeMutation) StopReason() (r string, exists bool)

StopReason returns the value of the "stop_reason" field in the mutation.

func (*NodeMutation) StopReasonCleared

func (m *NodeMutation) StopReasonCleared() bool

StopReasonCleared returns if the "stop_reason" field was cleared in this mutation.

func (*NodeMutation) TotalDurationNs

func (m *NodeMutation) TotalDurationNs() (r int64, exists bool)

TotalDurationNs returns the value of the "total_duration_ns" field in the mutation.

func (*NodeMutation) TotalDurationNsCleared

func (m *NodeMutation) TotalDurationNsCleared() bool

TotalDurationNsCleared returns if the "total_duration_ns" field was cleared in this mutation.

func (*NodeMutation) TotalTokens

func (m *NodeMutation) TotalTokens() (r int, exists bool)

TotalTokens returns the value of the "total_tokens" field in the mutation.

func (*NodeMutation) TotalTokensCleared

func (m *NodeMutation) TotalTokensCleared() bool

TotalTokensCleared returns if the "total_tokens" field was cleared in this mutation.

func (NodeMutation) Tx

func (m NodeMutation) Tx() (*Tx, error)

Tx returns an `ent.Tx` for mutations that were executed in transactions; it returns an error otherwise.

func (*NodeMutation) Type

func (m *NodeMutation) Type() string

Type returns the node type of this mutation (Node).

func (*NodeMutation) TypeCleared

func (m *NodeMutation) TypeCleared() bool

TypeCleared returns if the "type" field was cleared in this mutation.

func (*NodeMutation) Where

func (m *NodeMutation) Where(ps ...predicate.Node)

Where appends a list predicates to the NodeMutation builder.

func (*NodeMutation) WhereP

func (m *NodeMutation) WhereP(ps ...func(*sql.Selector))

WhereP appends storage-level predicates to the NodeMutation builder. Using this method, users can use type-assertion to append predicates that do not depend on any generated package.

type NodeQuery

type NodeQuery struct {
	// contains filtered or unexported fields
}

NodeQuery is the builder for querying Node entities.

func (*NodeQuery) Aggregate

func (_q *NodeQuery) Aggregate(fns ...AggregateFunc) *NodeSelect

Aggregate returns a NodeSelect configured with the given aggregations.

func (*NodeQuery) All

func (_q *NodeQuery) All(ctx context.Context) ([]*Node, error)

All executes the query and returns a list of Nodes.

func (*NodeQuery) AllX

func (_q *NodeQuery) AllX(ctx context.Context) []*Node

AllX is like All, but panics if an error occurs.

func (*NodeQuery) Clone

func (_q *NodeQuery) Clone() *NodeQuery

Clone returns a duplicate of the NodeQuery builder, including all associated steps. It can be used to prepare common query builders and use them differently after the clone is made.

func (*NodeQuery) Count

func (_q *NodeQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*NodeQuery) CountX

func (_q *NodeQuery) CountX(ctx context.Context) int

CountX is like Count, but panics if an error occurs.

func (*NodeQuery) Exist

func (_q *NodeQuery) Exist(ctx context.Context) (bool, error)

Exist returns true if the query has elements in the graph.

func (*NodeQuery) ExistX

func (_q *NodeQuery) ExistX(ctx context.Context) bool

ExistX is like Exist, but panics if an error occurs.

func (*NodeQuery) First

func (_q *NodeQuery) First(ctx context.Context) (*Node, error)

First returns the first Node entity from the query. Returns a *NotFoundError when no Node was found.

func (*NodeQuery) FirstID

func (_q *NodeQuery) FirstID(ctx context.Context) (id string, err error)

FirstID returns the first Node ID from the query. Returns a *NotFoundError when no Node ID was found.

func (*NodeQuery) FirstIDX

func (_q *NodeQuery) FirstIDX(ctx context.Context) string

FirstIDX is like FirstID, but panics if an error occurs.

func (*NodeQuery) FirstX

func (_q *NodeQuery) FirstX(ctx context.Context) *Node

FirstX is like First, but panics if an error occurs.

func (*NodeQuery) GroupBy

func (_q *NodeQuery) GroupBy(field string, fields ...string) *NodeGroupBy

GroupBy is used to group vertices by one or more fields/columns. It is often used with aggregate functions, like: count, max, mean, min, sum.

Example:

var v []struct {
	ParentHash string `json:"parent_hash,omitempty"`
	Count int `json:"count,omitempty"`
}

client.Node.Query().
	GroupBy(node.FieldParentHash).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*NodeQuery) IDs

func (_q *NodeQuery) IDs(ctx context.Context) (ids []string, err error)

IDs executes the query and returns a list of Node IDs.

func (*NodeQuery) IDsX

func (_q *NodeQuery) IDsX(ctx context.Context) []string

IDsX is like IDs, but panics if an error occurs.

func (*NodeQuery) Limit

func (_q *NodeQuery) Limit(limit int) *NodeQuery

Limit the number of records to be returned by this query.

func (*NodeQuery) Offset

func (_q *NodeQuery) Offset(offset int) *NodeQuery

Offset to start from.

func (*NodeQuery) Only

func (_q *NodeQuery) Only(ctx context.Context) (*Node, error)

Only returns a single Node entity found by the query, ensuring it only returns one. Returns a *NotSingularError when more than one Node entity is found. Returns a *NotFoundError when no Node entities are found.

func (*NodeQuery) OnlyID

func (_q *NodeQuery) OnlyID(ctx context.Context) (id string, err error)

OnlyID is like Only, but returns the only Node ID in the query. Returns a *NotSingularError when more than one Node ID is found. Returns a *NotFoundError when no entities are found.

func (*NodeQuery) OnlyIDX

func (_q *NodeQuery) OnlyIDX(ctx context.Context) string

OnlyIDX is like OnlyID, but panics if an error occurs.

func (*NodeQuery) OnlyX

func (_q *NodeQuery) OnlyX(ctx context.Context) *Node

OnlyX is like Only, but panics if an error occurs.

func (*NodeQuery) Order

func (_q *NodeQuery) Order(o ...node.OrderOption) *NodeQuery

Order specifies how the records should be ordered.

func (*NodeQuery) QueryChildren

func (_q *NodeQuery) QueryChildren() *NodeQuery

QueryChildren chains the current query on the "children" edge.

func (*NodeQuery) QueryParent

func (_q *NodeQuery) QueryParent() *NodeQuery

QueryParent chains the current query on the "parent" edge.

func (*NodeQuery) Select

func (_q *NodeQuery) Select(fields ...string) *NodeSelect

Select allows the selection one or more fields/columns for the given query, instead of selecting all fields in the entity.

Example:

var v []struct {
	ParentHash string `json:"parent_hash,omitempty"`
}

client.Node.Query().
	Select(node.FieldParentHash).
	Scan(ctx, &v)

func (*NodeQuery) Unique

func (_q *NodeQuery) Unique(unique bool) *NodeQuery

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 (*NodeQuery) Where

func (_q *NodeQuery) Where(ps ...predicate.Node) *NodeQuery

Where adds a new predicate for the NodeQuery builder.

func (*NodeQuery) WithChildren

func (_q *NodeQuery) WithChildren(opts ...func(*NodeQuery)) *NodeQuery

WithChildren tells the query-builder to eager-load the nodes that are connected to the "children" edge. The optional arguments are used to configure the query builder of the edge.

func (*NodeQuery) WithParent

func (_q *NodeQuery) WithParent(opts ...func(*NodeQuery)) *NodeQuery

WithParent tells the query-builder to eager-load the nodes that are connected to the "parent" edge. The optional arguments are used to configure the query builder of the edge.

type NodeSelect

type NodeSelect struct {
	*NodeQuery
	// contains filtered or unexported fields
}

NodeSelect is the builder for selecting fields of Node entities.

func (*NodeSelect) Aggregate

func (_s *NodeSelect) Aggregate(fns ...AggregateFunc) *NodeSelect

Aggregate adds the given aggregation functions to the selector query.

func (*NodeSelect) Bool

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

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

func (*NodeSelect) BoolX

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

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

func (*NodeSelect) Bools

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

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

func (*NodeSelect) BoolsX

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

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

func (*NodeSelect) Float64

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

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

func (*NodeSelect) Float64X

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

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

func (*NodeSelect) Float64s

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

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

func (*NodeSelect) Float64sX

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

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

func (*NodeSelect) Int

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

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

func (*NodeSelect) IntX

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

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

func (*NodeSelect) Ints

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

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

func (*NodeSelect) IntsX

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

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

func (*NodeSelect) Scan

func (_s *NodeSelect) Scan(ctx context.Context, v any) error

Scan applies the selector query and scans the result into the given value.

func (*NodeSelect) ScanX

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

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

func (*NodeSelect) String

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

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

func (*NodeSelect) StringX

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

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

func (*NodeSelect) Strings

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

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

func (*NodeSelect) StringsX

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

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

type NodeUpdate

type NodeUpdate struct {
	// contains filtered or unexported fields
}

NodeUpdate is the builder for updating Node entities.

func (*NodeUpdate) AddCacheCreationInputTokens

func (_u *NodeUpdate) AddCacheCreationInputTokens(v int) *NodeUpdate

AddCacheCreationInputTokens adds value to the "cache_creation_input_tokens" field.

func (*NodeUpdate) AddCacheReadInputTokens

func (_u *NodeUpdate) AddCacheReadInputTokens(v int) *NodeUpdate

AddCacheReadInputTokens adds value to the "cache_read_input_tokens" field.

func (*NodeUpdate) AddChildIDs

func (_u *NodeUpdate) AddChildIDs(ids ...string) *NodeUpdate

AddChildIDs adds the "children" edge to the Node entity by IDs.

func (*NodeUpdate) AddChildren

func (_u *NodeUpdate) AddChildren(v ...*Node) *NodeUpdate

AddChildren adds the "children" edges to the Node entity.

func (*NodeUpdate) AddCompletionTokens

func (_u *NodeUpdate) AddCompletionTokens(v int) *NodeUpdate

AddCompletionTokens adds value to the "completion_tokens" field.

func (*NodeUpdate) AddPromptDurationNs

func (_u *NodeUpdate) AddPromptDurationNs(v int64) *NodeUpdate

AddPromptDurationNs adds value to the "prompt_duration_ns" field.

func (*NodeUpdate) AddPromptTokens

func (_u *NodeUpdate) AddPromptTokens(v int) *NodeUpdate

AddPromptTokens adds value to the "prompt_tokens" field.

func (*NodeUpdate) AddTotalDurationNs

func (_u *NodeUpdate) AddTotalDurationNs(v int64) *NodeUpdate

AddTotalDurationNs adds value to the "total_duration_ns" field.

func (*NodeUpdate) AddTotalTokens

func (_u *NodeUpdate) AddTotalTokens(v int) *NodeUpdate

AddTotalTokens adds value to the "total_tokens" field.

func (*NodeUpdate) AppendContent

func (_u *NodeUpdate) AppendContent(v []map[string]interface{}) *NodeUpdate

AppendContent appends value to the "content" field.

func (*NodeUpdate) ClearAgentName

func (_u *NodeUpdate) ClearAgentName() *NodeUpdate

ClearAgentName clears the value of the "agent_name" field.

func (*NodeUpdate) ClearBucket

func (_u *NodeUpdate) ClearBucket() *NodeUpdate

ClearBucket clears the value of the "bucket" field.

func (*NodeUpdate) ClearCacheCreationInputTokens

func (_u *NodeUpdate) ClearCacheCreationInputTokens() *NodeUpdate

ClearCacheCreationInputTokens clears the value of the "cache_creation_input_tokens" field.

func (*NodeUpdate) ClearCacheReadInputTokens

func (_u *NodeUpdate) ClearCacheReadInputTokens() *NodeUpdate

ClearCacheReadInputTokens clears the value of the "cache_read_input_tokens" field.

func (*NodeUpdate) ClearChildren

func (_u *NodeUpdate) ClearChildren() *NodeUpdate

ClearChildren clears all "children" edges to the Node entity.

func (*NodeUpdate) ClearCompletionTokens

func (_u *NodeUpdate) ClearCompletionTokens() *NodeUpdate

ClearCompletionTokens clears the value of the "completion_tokens" field.

func (*NodeUpdate) ClearContent

func (_u *NodeUpdate) ClearContent() *NodeUpdate

ClearContent clears the value of the "content" field.

func (*NodeUpdate) ClearModel

func (_u *NodeUpdate) ClearModel() *NodeUpdate

ClearModel clears the value of the "model" field.

func (*NodeUpdate) ClearParent

func (_u *NodeUpdate) ClearParent() *NodeUpdate

ClearParent clears the "parent" edge to the Node entity.

func (*NodeUpdate) ClearParentHash

func (_u *NodeUpdate) ClearParentHash() *NodeUpdate

ClearParentHash clears the value of the "parent_hash" field.

func (*NodeUpdate) ClearProject

func (_u *NodeUpdate) ClearProject() *NodeUpdate

ClearProject clears the value of the "project" field.

func (*NodeUpdate) ClearPromptDurationNs

func (_u *NodeUpdate) ClearPromptDurationNs() *NodeUpdate

ClearPromptDurationNs clears the value of the "prompt_duration_ns" field.

func (*NodeUpdate) ClearPromptTokens

func (_u *NodeUpdate) ClearPromptTokens() *NodeUpdate

ClearPromptTokens clears the value of the "prompt_tokens" field.

func (*NodeUpdate) ClearProvider

func (_u *NodeUpdate) ClearProvider() *NodeUpdate

ClearProvider clears the value of the "provider" field.

func (*NodeUpdate) ClearRole

func (_u *NodeUpdate) ClearRole() *NodeUpdate

ClearRole clears the value of the "role" field.

func (*NodeUpdate) ClearStopReason

func (_u *NodeUpdate) ClearStopReason() *NodeUpdate

ClearStopReason clears the value of the "stop_reason" field.

func (*NodeUpdate) ClearTotalDurationNs

func (_u *NodeUpdate) ClearTotalDurationNs() *NodeUpdate

ClearTotalDurationNs clears the value of the "total_duration_ns" field.

func (*NodeUpdate) ClearTotalTokens

func (_u *NodeUpdate) ClearTotalTokens() *NodeUpdate

ClearTotalTokens clears the value of the "total_tokens" field.

func (*NodeUpdate) ClearType

func (_u *NodeUpdate) ClearType() *NodeUpdate

ClearType clears the value of the "type" field.

func (*NodeUpdate) Exec

func (_u *NodeUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*NodeUpdate) ExecX

func (_u *NodeUpdate) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*NodeUpdate) Mutation

func (_u *NodeUpdate) Mutation() *NodeMutation

Mutation returns the NodeMutation object of the builder.

func (*NodeUpdate) RemoveChildIDs

func (_u *NodeUpdate) RemoveChildIDs(ids ...string) *NodeUpdate

RemoveChildIDs removes the "children" edge to Node entities by IDs.

func (*NodeUpdate) RemoveChildren

func (_u *NodeUpdate) RemoveChildren(v ...*Node) *NodeUpdate

RemoveChildren removes "children" edges to Node entities.

func (*NodeUpdate) Save

func (_u *NodeUpdate) Save(ctx context.Context) (int, error)

Save executes the query and returns the number of nodes affected by the update operation.

func (*NodeUpdate) SaveX

func (_u *NodeUpdate) SaveX(ctx context.Context) int

SaveX is like Save, but panics if an error occurs.

func (*NodeUpdate) SetAgentName

func (_u *NodeUpdate) SetAgentName(v string) *NodeUpdate

SetAgentName sets the "agent_name" field.

func (*NodeUpdate) SetBucket

func (_u *NodeUpdate) SetBucket(v map[string]interface{}) *NodeUpdate

SetBucket sets the "bucket" field.

func (*NodeUpdate) SetCacheCreationInputTokens

func (_u *NodeUpdate) SetCacheCreationInputTokens(v int) *NodeUpdate

SetCacheCreationInputTokens sets the "cache_creation_input_tokens" field.

func (*NodeUpdate) SetCacheReadInputTokens

func (_u *NodeUpdate) SetCacheReadInputTokens(v int) *NodeUpdate

SetCacheReadInputTokens sets the "cache_read_input_tokens" field.

func (*NodeUpdate) SetCompletionTokens

func (_u *NodeUpdate) SetCompletionTokens(v int) *NodeUpdate

SetCompletionTokens sets the "completion_tokens" field.

func (*NodeUpdate) SetContent

func (_u *NodeUpdate) SetContent(v []map[string]interface{}) *NodeUpdate

SetContent sets the "content" field.

func (*NodeUpdate) SetModel

func (_u *NodeUpdate) SetModel(v string) *NodeUpdate

SetModel sets the "model" field.

func (*NodeUpdate) SetNillableAgentName

func (_u *NodeUpdate) SetNillableAgentName(v *string) *NodeUpdate

SetNillableAgentName sets the "agent_name" field if the given value is not nil.

func (*NodeUpdate) SetNillableCacheCreationInputTokens

func (_u *NodeUpdate) SetNillableCacheCreationInputTokens(v *int) *NodeUpdate

SetNillableCacheCreationInputTokens sets the "cache_creation_input_tokens" field if the given value is not nil.

func (*NodeUpdate) SetNillableCacheReadInputTokens

func (_u *NodeUpdate) SetNillableCacheReadInputTokens(v *int) *NodeUpdate

SetNillableCacheReadInputTokens sets the "cache_read_input_tokens" field if the given value is not nil.

func (*NodeUpdate) SetNillableCompletionTokens

func (_u *NodeUpdate) SetNillableCompletionTokens(v *int) *NodeUpdate

SetNillableCompletionTokens sets the "completion_tokens" field if the given value is not nil.

func (*NodeUpdate) SetNillableModel

func (_u *NodeUpdate) SetNillableModel(v *string) *NodeUpdate

SetNillableModel sets the "model" field if the given value is not nil.

func (*NodeUpdate) SetNillableParentHash

func (_u *NodeUpdate) SetNillableParentHash(v *string) *NodeUpdate

SetNillableParentHash sets the "parent_hash" field if the given value is not nil.

func (*NodeUpdate) SetNillableParentID

func (_u *NodeUpdate) SetNillableParentID(id *string) *NodeUpdate

SetNillableParentID sets the "parent" edge to the Node entity by ID if the given value is not nil.

func (*NodeUpdate) SetNillableProject

func (_u *NodeUpdate) SetNillableProject(v *string) *NodeUpdate

SetNillableProject sets the "project" field if the given value is not nil.

func (*NodeUpdate) SetNillablePromptDurationNs

func (_u *NodeUpdate) SetNillablePromptDurationNs(v *int64) *NodeUpdate

SetNillablePromptDurationNs sets the "prompt_duration_ns" field if the given value is not nil.

func (*NodeUpdate) SetNillablePromptTokens

func (_u *NodeUpdate) SetNillablePromptTokens(v *int) *NodeUpdate

SetNillablePromptTokens sets the "prompt_tokens" field if the given value is not nil.

func (*NodeUpdate) SetNillableProvider

func (_u *NodeUpdate) SetNillableProvider(v *string) *NodeUpdate

SetNillableProvider sets the "provider" field if the given value is not nil.

func (*NodeUpdate) SetNillableRole

func (_u *NodeUpdate) SetNillableRole(v *string) *NodeUpdate

SetNillableRole sets the "role" field if the given value is not nil.

func (*NodeUpdate) SetNillableStopReason

func (_u *NodeUpdate) SetNillableStopReason(v *string) *NodeUpdate

SetNillableStopReason sets the "stop_reason" field if the given value is not nil.

func (*NodeUpdate) SetNillableTotalDurationNs

func (_u *NodeUpdate) SetNillableTotalDurationNs(v *int64) *NodeUpdate

SetNillableTotalDurationNs sets the "total_duration_ns" field if the given value is not nil.

func (*NodeUpdate) SetNillableTotalTokens

func (_u *NodeUpdate) SetNillableTotalTokens(v *int) *NodeUpdate

SetNillableTotalTokens sets the "total_tokens" field if the given value is not nil.

func (*NodeUpdate) SetNillableType

func (_u *NodeUpdate) SetNillableType(v *string) *NodeUpdate

SetNillableType sets the "type" field if the given value is not nil.

func (*NodeUpdate) SetParent

func (_u *NodeUpdate) SetParent(v *Node) *NodeUpdate

SetParent sets the "parent" edge to the Node entity.

func (*NodeUpdate) SetParentHash

func (_u *NodeUpdate) SetParentHash(v string) *NodeUpdate

SetParentHash sets the "parent_hash" field.

func (*NodeUpdate) SetParentID

func (_u *NodeUpdate) SetParentID(id string) *NodeUpdate

SetParentID sets the "parent" edge to the Node entity by ID.

func (*NodeUpdate) SetProject

func (_u *NodeUpdate) SetProject(v string) *NodeUpdate

SetProject sets the "project" field.

func (*NodeUpdate) SetPromptDurationNs

func (_u *NodeUpdate) SetPromptDurationNs(v int64) *NodeUpdate

SetPromptDurationNs sets the "prompt_duration_ns" field.

func (*NodeUpdate) SetPromptTokens

func (_u *NodeUpdate) SetPromptTokens(v int) *NodeUpdate

SetPromptTokens sets the "prompt_tokens" field.

func (*NodeUpdate) SetProvider

func (_u *NodeUpdate) SetProvider(v string) *NodeUpdate

SetProvider sets the "provider" field.

func (*NodeUpdate) SetRole

func (_u *NodeUpdate) SetRole(v string) *NodeUpdate

SetRole sets the "role" field.

func (*NodeUpdate) SetStopReason

func (_u *NodeUpdate) SetStopReason(v string) *NodeUpdate

SetStopReason sets the "stop_reason" field.

func (*NodeUpdate) SetTotalDurationNs

func (_u *NodeUpdate) SetTotalDurationNs(v int64) *NodeUpdate

SetTotalDurationNs sets the "total_duration_ns" field.

func (*NodeUpdate) SetTotalTokens

func (_u *NodeUpdate) SetTotalTokens(v int) *NodeUpdate

SetTotalTokens sets the "total_tokens" field.

func (*NodeUpdate) SetType

func (_u *NodeUpdate) SetType(v string) *NodeUpdate

SetType sets the "type" field.

func (*NodeUpdate) Where

func (_u *NodeUpdate) Where(ps ...predicate.Node) *NodeUpdate

Where appends a list predicates to the NodeUpdate builder.

type NodeUpdateOne

type NodeUpdateOne struct {
	// contains filtered or unexported fields
}

NodeUpdateOne is the builder for updating a single Node entity.

func (*NodeUpdateOne) AddCacheCreationInputTokens

func (_u *NodeUpdateOne) AddCacheCreationInputTokens(v int) *NodeUpdateOne

AddCacheCreationInputTokens adds value to the "cache_creation_input_tokens" field.

func (*NodeUpdateOne) AddCacheReadInputTokens

func (_u *NodeUpdateOne) AddCacheReadInputTokens(v int) *NodeUpdateOne

AddCacheReadInputTokens adds value to the "cache_read_input_tokens" field.

func (*NodeUpdateOne) AddChildIDs

func (_u *NodeUpdateOne) AddChildIDs(ids ...string) *NodeUpdateOne

AddChildIDs adds the "children" edge to the Node entity by IDs.

func (*NodeUpdateOne) AddChildren

func (_u *NodeUpdateOne) AddChildren(v ...*Node) *NodeUpdateOne

AddChildren adds the "children" edges to the Node entity.

func (*NodeUpdateOne) AddCompletionTokens

func (_u *NodeUpdateOne) AddCompletionTokens(v int) *NodeUpdateOne

AddCompletionTokens adds value to the "completion_tokens" field.

func (*NodeUpdateOne) AddPromptDurationNs

func (_u *NodeUpdateOne) AddPromptDurationNs(v int64) *NodeUpdateOne

AddPromptDurationNs adds value to the "prompt_duration_ns" field.

func (*NodeUpdateOne) AddPromptTokens

func (_u *NodeUpdateOne) AddPromptTokens(v int) *NodeUpdateOne

AddPromptTokens adds value to the "prompt_tokens" field.

func (*NodeUpdateOne) AddTotalDurationNs

func (_u *NodeUpdateOne) AddTotalDurationNs(v int64) *NodeUpdateOne

AddTotalDurationNs adds value to the "total_duration_ns" field.

func (*NodeUpdateOne) AddTotalTokens

func (_u *NodeUpdateOne) AddTotalTokens(v int) *NodeUpdateOne

AddTotalTokens adds value to the "total_tokens" field.

func (*NodeUpdateOne) AppendContent

func (_u *NodeUpdateOne) AppendContent(v []map[string]interface{}) *NodeUpdateOne

AppendContent appends value to the "content" field.

func (*NodeUpdateOne) ClearAgentName

func (_u *NodeUpdateOne) ClearAgentName() *NodeUpdateOne

ClearAgentName clears the value of the "agent_name" field.

func (*NodeUpdateOne) ClearBucket

func (_u *NodeUpdateOne) ClearBucket() *NodeUpdateOne

ClearBucket clears the value of the "bucket" field.

func (*NodeUpdateOne) ClearCacheCreationInputTokens

func (_u *NodeUpdateOne) ClearCacheCreationInputTokens() *NodeUpdateOne

ClearCacheCreationInputTokens clears the value of the "cache_creation_input_tokens" field.

func (*NodeUpdateOne) ClearCacheReadInputTokens

func (_u *NodeUpdateOne) ClearCacheReadInputTokens() *NodeUpdateOne

ClearCacheReadInputTokens clears the value of the "cache_read_input_tokens" field.

func (*NodeUpdateOne) ClearChildren

func (_u *NodeUpdateOne) ClearChildren() *NodeUpdateOne

ClearChildren clears all "children" edges to the Node entity.

func (*NodeUpdateOne) ClearCompletionTokens

func (_u *NodeUpdateOne) ClearCompletionTokens() *NodeUpdateOne

ClearCompletionTokens clears the value of the "completion_tokens" field.

func (*NodeUpdateOne) ClearContent

func (_u *NodeUpdateOne) ClearContent() *NodeUpdateOne

ClearContent clears the value of the "content" field.

func (*NodeUpdateOne) ClearModel

func (_u *NodeUpdateOne) ClearModel() *NodeUpdateOne

ClearModel clears the value of the "model" field.

func (*NodeUpdateOne) ClearParent

func (_u *NodeUpdateOne) ClearParent() *NodeUpdateOne

ClearParent clears the "parent" edge to the Node entity.

func (*NodeUpdateOne) ClearParentHash

func (_u *NodeUpdateOne) ClearParentHash() *NodeUpdateOne

ClearParentHash clears the value of the "parent_hash" field.

func (*NodeUpdateOne) ClearProject

func (_u *NodeUpdateOne) ClearProject() *NodeUpdateOne

ClearProject clears the value of the "project" field.

func (*NodeUpdateOne) ClearPromptDurationNs

func (_u *NodeUpdateOne) ClearPromptDurationNs() *NodeUpdateOne

ClearPromptDurationNs clears the value of the "prompt_duration_ns" field.

func (*NodeUpdateOne) ClearPromptTokens

func (_u *NodeUpdateOne) ClearPromptTokens() *NodeUpdateOne

ClearPromptTokens clears the value of the "prompt_tokens" field.

func (*NodeUpdateOne) ClearProvider

func (_u *NodeUpdateOne) ClearProvider() *NodeUpdateOne

ClearProvider clears the value of the "provider" field.

func (*NodeUpdateOne) ClearRole

func (_u *NodeUpdateOne) ClearRole() *NodeUpdateOne

ClearRole clears the value of the "role" field.

func (*NodeUpdateOne) ClearStopReason

func (_u *NodeUpdateOne) ClearStopReason() *NodeUpdateOne

ClearStopReason clears the value of the "stop_reason" field.

func (*NodeUpdateOne) ClearTotalDurationNs

func (_u *NodeUpdateOne) ClearTotalDurationNs() *NodeUpdateOne

ClearTotalDurationNs clears the value of the "total_duration_ns" field.

func (*NodeUpdateOne) ClearTotalTokens

func (_u *NodeUpdateOne) ClearTotalTokens() *NodeUpdateOne

ClearTotalTokens clears the value of the "total_tokens" field.

func (*NodeUpdateOne) ClearType

func (_u *NodeUpdateOne) ClearType() *NodeUpdateOne

ClearType clears the value of the "type" field.

func (*NodeUpdateOne) Exec

func (_u *NodeUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*NodeUpdateOne) ExecX

func (_u *NodeUpdateOne) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*NodeUpdateOne) Mutation

func (_u *NodeUpdateOne) Mutation() *NodeMutation

Mutation returns the NodeMutation object of the builder.

func (*NodeUpdateOne) RemoveChildIDs

func (_u *NodeUpdateOne) RemoveChildIDs(ids ...string) *NodeUpdateOne

RemoveChildIDs removes the "children" edge to Node entities by IDs.

func (*NodeUpdateOne) RemoveChildren

func (_u *NodeUpdateOne) RemoveChildren(v ...*Node) *NodeUpdateOne

RemoveChildren removes "children" edges to Node entities.

func (*NodeUpdateOne) Save

func (_u *NodeUpdateOne) Save(ctx context.Context) (*Node, error)

Save executes the query and returns the updated Node entity.

func (*NodeUpdateOne) SaveX

func (_u *NodeUpdateOne) SaveX(ctx context.Context) *Node

SaveX is like Save, but panics if an error occurs.

func (*NodeUpdateOne) Select

func (_u *NodeUpdateOne) Select(field string, fields ...string) *NodeUpdateOne

Select allows selecting one or more fields (columns) of the returned entity. The default is selecting all fields defined in the entity schema.

func (*NodeUpdateOne) SetAgentName

func (_u *NodeUpdateOne) SetAgentName(v string) *NodeUpdateOne

SetAgentName sets the "agent_name" field.

func (*NodeUpdateOne) SetBucket

func (_u *NodeUpdateOne) SetBucket(v map[string]interface{}) *NodeUpdateOne

SetBucket sets the "bucket" field.

func (*NodeUpdateOne) SetCacheCreationInputTokens

func (_u *NodeUpdateOne) SetCacheCreationInputTokens(v int) *NodeUpdateOne

SetCacheCreationInputTokens sets the "cache_creation_input_tokens" field.

func (*NodeUpdateOne) SetCacheReadInputTokens

func (_u *NodeUpdateOne) SetCacheReadInputTokens(v int) *NodeUpdateOne

SetCacheReadInputTokens sets the "cache_read_input_tokens" field.

func (*NodeUpdateOne) SetCompletionTokens

func (_u *NodeUpdateOne) SetCompletionTokens(v int) *NodeUpdateOne

SetCompletionTokens sets the "completion_tokens" field.

func (*NodeUpdateOne) SetContent

func (_u *NodeUpdateOne) SetContent(v []map[string]interface{}) *NodeUpdateOne

SetContent sets the "content" field.

func (*NodeUpdateOne) SetModel

func (_u *NodeUpdateOne) SetModel(v string) *NodeUpdateOne

SetModel sets the "model" field.

func (*NodeUpdateOne) SetNillableAgentName

func (_u *NodeUpdateOne) SetNillableAgentName(v *string) *NodeUpdateOne

SetNillableAgentName sets the "agent_name" field if the given value is not nil.

func (*NodeUpdateOne) SetNillableCacheCreationInputTokens

func (_u *NodeUpdateOne) SetNillableCacheCreationInputTokens(v *int) *NodeUpdateOne

SetNillableCacheCreationInputTokens sets the "cache_creation_input_tokens" field if the given value is not nil.

func (*NodeUpdateOne) SetNillableCacheReadInputTokens

func (_u *NodeUpdateOne) SetNillableCacheReadInputTokens(v *int) *NodeUpdateOne

SetNillableCacheReadInputTokens sets the "cache_read_input_tokens" field if the given value is not nil.

func (*NodeUpdateOne) SetNillableCompletionTokens

func (_u *NodeUpdateOne) SetNillableCompletionTokens(v *int) *NodeUpdateOne

SetNillableCompletionTokens sets the "completion_tokens" field if the given value is not nil.

func (*NodeUpdateOne) SetNillableModel

func (_u *NodeUpdateOne) SetNillableModel(v *string) *NodeUpdateOne

SetNillableModel sets the "model" field if the given value is not nil.

func (*NodeUpdateOne) SetNillableParentHash

func (_u *NodeUpdateOne) SetNillableParentHash(v *string) *NodeUpdateOne

SetNillableParentHash sets the "parent_hash" field if the given value is not nil.

func (*NodeUpdateOne) SetNillableParentID

func (_u *NodeUpdateOne) SetNillableParentID(id *string) *NodeUpdateOne

SetNillableParentID sets the "parent" edge to the Node entity by ID if the given value is not nil.

func (*NodeUpdateOne) SetNillableProject

func (_u *NodeUpdateOne) SetNillableProject(v *string) *NodeUpdateOne

SetNillableProject sets the "project" field if the given value is not nil.

func (*NodeUpdateOne) SetNillablePromptDurationNs

func (_u *NodeUpdateOne) SetNillablePromptDurationNs(v *int64) *NodeUpdateOne

SetNillablePromptDurationNs sets the "prompt_duration_ns" field if the given value is not nil.

func (*NodeUpdateOne) SetNillablePromptTokens

func (_u *NodeUpdateOne) SetNillablePromptTokens(v *int) *NodeUpdateOne

SetNillablePromptTokens sets the "prompt_tokens" field if the given value is not nil.

func (*NodeUpdateOne) SetNillableProvider

func (_u *NodeUpdateOne) SetNillableProvider(v *string) *NodeUpdateOne

SetNillableProvider sets the "provider" field if the given value is not nil.

func (*NodeUpdateOne) SetNillableRole

func (_u *NodeUpdateOne) SetNillableRole(v *string) *NodeUpdateOne

SetNillableRole sets the "role" field if the given value is not nil.

func (*NodeUpdateOne) SetNillableStopReason

func (_u *NodeUpdateOne) SetNillableStopReason(v *string) *NodeUpdateOne

SetNillableStopReason sets the "stop_reason" field if the given value is not nil.

func (*NodeUpdateOne) SetNillableTotalDurationNs

func (_u *NodeUpdateOne) SetNillableTotalDurationNs(v *int64) *NodeUpdateOne

SetNillableTotalDurationNs sets the "total_duration_ns" field if the given value is not nil.

func (*NodeUpdateOne) SetNillableTotalTokens

func (_u *NodeUpdateOne) SetNillableTotalTokens(v *int) *NodeUpdateOne

SetNillableTotalTokens sets the "total_tokens" field if the given value is not nil.

func (*NodeUpdateOne) SetNillableType

func (_u *NodeUpdateOne) SetNillableType(v *string) *NodeUpdateOne

SetNillableType sets the "type" field if the given value is not nil.

func (*NodeUpdateOne) SetParent

func (_u *NodeUpdateOne) SetParent(v *Node) *NodeUpdateOne

SetParent sets the "parent" edge to the Node entity.

func (*NodeUpdateOne) SetParentHash

func (_u *NodeUpdateOne) SetParentHash(v string) *NodeUpdateOne

SetParentHash sets the "parent_hash" field.

func (*NodeUpdateOne) SetParentID

func (_u *NodeUpdateOne) SetParentID(id string) *NodeUpdateOne

SetParentID sets the "parent" edge to the Node entity by ID.

func (*NodeUpdateOne) SetProject

func (_u *NodeUpdateOne) SetProject(v string) *NodeUpdateOne

SetProject sets the "project" field.

func (*NodeUpdateOne) SetPromptDurationNs

func (_u *NodeUpdateOne) SetPromptDurationNs(v int64) *NodeUpdateOne

SetPromptDurationNs sets the "prompt_duration_ns" field.

func (*NodeUpdateOne) SetPromptTokens

func (_u *NodeUpdateOne) SetPromptTokens(v int) *NodeUpdateOne

SetPromptTokens sets the "prompt_tokens" field.

func (*NodeUpdateOne) SetProvider

func (_u *NodeUpdateOne) SetProvider(v string) *NodeUpdateOne

SetProvider sets the "provider" field.

func (*NodeUpdateOne) SetRole

func (_u *NodeUpdateOne) SetRole(v string) *NodeUpdateOne

SetRole sets the "role" field.

func (*NodeUpdateOne) SetStopReason

func (_u *NodeUpdateOne) SetStopReason(v string) *NodeUpdateOne

SetStopReason sets the "stop_reason" field.

func (*NodeUpdateOne) SetTotalDurationNs

func (_u *NodeUpdateOne) SetTotalDurationNs(v int64) *NodeUpdateOne

SetTotalDurationNs sets the "total_duration_ns" field.

func (*NodeUpdateOne) SetTotalTokens

func (_u *NodeUpdateOne) SetTotalTokens(v int) *NodeUpdateOne

SetTotalTokens sets the "total_tokens" field.

func (*NodeUpdateOne) SetType

func (_u *NodeUpdateOne) SetType(v string) *NodeUpdateOne

SetType sets the "type" field.

func (*NodeUpdateOne) Where

func (_u *NodeUpdateOne) Where(ps ...predicate.Node) *NodeUpdateOne

Where appends a list predicates to the NodeUpdate builder.

type Nodes

type Nodes []*Node

Nodes is a parsable slice of Node.

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 {

	// Node is the client for interacting with the Node builders.
	Node *NodeClient
	// contains filtered or unexported fields
}

Tx is a transactional client that is created by calling Client.Tx().

func TxFromContext

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
Package entdriver
Package entdriver

Jump to

Keyboard shortcuts

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