ent

package
v0.0.0-...-b1f70f1 Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2025 License: Apache-2.0 Imports: 19 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.
	TypeChunk     = "Chunk"
	TypeEmbedding = "Embedding"
)

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 Chunk

type Chunk struct {

	// ID of the ent.
	ID int `json:"id,omitempty"`
	// Path holds the value of the "path" field.
	Path string `json:"path,omitempty"`
	// Nchunk holds the value of the "nchunk" field.
	Nchunk int `json:"nchunk,omitempty"`
	// Data holds the value of the "data" field.
	Data string `json:"data,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the ChunkQuery when eager-loading is set.
	Edges ChunkEdges `json:"edges"`
	// contains filtered or unexported fields
}

Chunk is the model entity for the Chunk schema.

func (*Chunk) QueryEmbedding

func (c *Chunk) QueryEmbedding() *EmbeddingQuery

QueryEmbedding queries the "embedding" edge of the Chunk entity.

func (*Chunk) String

func (c *Chunk) String() string

String implements the fmt.Stringer.

func (*Chunk) Unwrap

func (c *Chunk) Unwrap() *Chunk

Unwrap unwraps the Chunk 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 (*Chunk) Update

func (c *Chunk) Update() *ChunkUpdateOne

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

func (*Chunk) Value

func (c *Chunk) Value(name string) (ent.Value, error)

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

type ChunkClient

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

ChunkClient is a client for the Chunk schema.

func NewChunkClient

func NewChunkClient(c config) *ChunkClient

NewChunkClient returns a client for the Chunk from the given config.

func (*ChunkClient) Create

func (c *ChunkClient) Create() *ChunkCreate

Create returns a builder for creating a Chunk entity.

func (*ChunkClient) CreateBulk

func (c *ChunkClient) CreateBulk(builders ...*ChunkCreate) *ChunkCreateBulk

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

func (*ChunkClient) Delete

func (c *ChunkClient) Delete() *ChunkDelete

Delete returns a delete builder for Chunk.

func (*ChunkClient) DeleteOne

func (c *ChunkClient) DeleteOne(ch *Chunk) *ChunkDeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*ChunkClient) DeleteOneID

func (c *ChunkClient) DeleteOneID(id int) *ChunkDeleteOne

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

func (*ChunkClient) Get

func (c *ChunkClient) Get(ctx context.Context, id int) (*Chunk, error)

Get returns a Chunk entity by its id.

func (*ChunkClient) GetX

func (c *ChunkClient) GetX(ctx context.Context, id int) *Chunk

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

func (*ChunkClient) Hooks

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

Hooks returns the client hooks.

func (*ChunkClient) Intercept

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

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

func (*ChunkClient) Interceptors

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

Interceptors returns the client interceptors.

func (*ChunkClient) MapCreateBulk

func (c *ChunkClient) MapCreateBulk(slice any, setFunc func(*ChunkCreate, int)) *ChunkCreateBulk

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

func (c *ChunkClient) Query() *ChunkQuery

Query returns a query builder for Chunk.

func (*ChunkClient) QueryEmbedding

func (c *ChunkClient) QueryEmbedding(ch *Chunk) *EmbeddingQuery

QueryEmbedding queries the embedding edge of a Chunk.

func (*ChunkClient) Update

func (c *ChunkClient) Update() *ChunkUpdate

Update returns an update builder for Chunk.

func (*ChunkClient) UpdateOne

func (c *ChunkClient) UpdateOne(ch *Chunk) *ChunkUpdateOne

UpdateOne returns an update builder for the given entity.

func (*ChunkClient) UpdateOneID

func (c *ChunkClient) UpdateOneID(id int) *ChunkUpdateOne

UpdateOneID returns an update builder for the given id.

func (*ChunkClient) Use

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

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

type ChunkCreate

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

ChunkCreate is the builder for creating a Chunk entity.

func (*ChunkCreate) Exec

func (cc *ChunkCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*ChunkCreate) ExecX

func (cc *ChunkCreate) ExecX(ctx context.Context)

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

func (*ChunkCreate) Mutation

func (cc *ChunkCreate) Mutation() *ChunkMutation

Mutation returns the ChunkMutation object of the builder.

func (*ChunkCreate) Save

func (cc *ChunkCreate) Save(ctx context.Context) (*Chunk, error)

Save creates the Chunk in the database.

func (*ChunkCreate) SaveX

func (cc *ChunkCreate) SaveX(ctx context.Context) *Chunk

SaveX calls Save and panics if Save returns an error.

func (*ChunkCreate) SetData

func (cc *ChunkCreate) SetData(s string) *ChunkCreate

SetData sets the "data" field.

func (*ChunkCreate) SetEmbedding

func (cc *ChunkCreate) SetEmbedding(e *Embedding) *ChunkCreate

SetEmbedding sets the "embedding" edge to the Embedding entity.

func (*ChunkCreate) SetEmbeddingID

func (cc *ChunkCreate) SetEmbeddingID(id int) *ChunkCreate

SetEmbeddingID sets the "embedding" edge to the Embedding entity by ID.

func (*ChunkCreate) SetNchunk

func (cc *ChunkCreate) SetNchunk(i int) *ChunkCreate

SetNchunk sets the "nchunk" field.

func (*ChunkCreate) SetNillableEmbeddingID

func (cc *ChunkCreate) SetNillableEmbeddingID(id *int) *ChunkCreate

SetNillableEmbeddingID sets the "embedding" edge to the Embedding entity by ID if the given value is not nil.

func (*ChunkCreate) SetPath

func (cc *ChunkCreate) SetPath(s string) *ChunkCreate

SetPath sets the "path" field.

type ChunkCreateBulk

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

ChunkCreateBulk is the builder for creating many Chunk entities in bulk.

func (*ChunkCreateBulk) Exec

func (ccb *ChunkCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*ChunkCreateBulk) ExecX

func (ccb *ChunkCreateBulk) ExecX(ctx context.Context)

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

func (*ChunkCreateBulk) Save

func (ccb *ChunkCreateBulk) Save(ctx context.Context) ([]*Chunk, error)

Save creates the Chunk entities in the database.

func (*ChunkCreateBulk) SaveX

func (ccb *ChunkCreateBulk) SaveX(ctx context.Context) []*Chunk

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

type ChunkDelete

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

ChunkDelete is the builder for deleting a Chunk entity.

func (*ChunkDelete) Exec

func (cd *ChunkDelete) Exec(ctx context.Context) (int, error)

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

func (*ChunkDelete) ExecX

func (cd *ChunkDelete) ExecX(ctx context.Context) int

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

func (*ChunkDelete) Where

func (cd *ChunkDelete) Where(ps ...predicate.Chunk) *ChunkDelete

Where appends a list predicates to the ChunkDelete builder.

type ChunkDeleteOne

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

ChunkDeleteOne is the builder for deleting a single Chunk entity.

func (*ChunkDeleteOne) Exec

func (cdo *ChunkDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*ChunkDeleteOne) ExecX

func (cdo *ChunkDeleteOne) ExecX(ctx context.Context)

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

func (*ChunkDeleteOne) Where

func (cdo *ChunkDeleteOne) Where(ps ...predicate.Chunk) *ChunkDeleteOne

Where appends a list predicates to the ChunkDelete builder.

type ChunkEdges

type ChunkEdges struct {
	// Embedding holds the value of the embedding edge.
	Embedding *Embedding `json:"embedding,omitempty"`
	// contains filtered or unexported fields
}

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

func (ChunkEdges) EmbeddingOrErr

func (e ChunkEdges) EmbeddingOrErr() (*Embedding, error)

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

type ChunkGroupBy

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

ChunkGroupBy is the group-by builder for Chunk entities.

func (*ChunkGroupBy) Aggregate

func (cgb *ChunkGroupBy) Aggregate(fns ...AggregateFunc) *ChunkGroupBy

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

func (*ChunkGroupBy) Bool

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

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

func (*ChunkGroupBy) BoolX

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

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

func (*ChunkGroupBy) Bools

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

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

func (*ChunkGroupBy) BoolsX

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

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

func (*ChunkGroupBy) Float64

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

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

func (*ChunkGroupBy) Float64X

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

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

func (*ChunkGroupBy) Float64s

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

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

func (*ChunkGroupBy) Float64sX

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

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

func (*ChunkGroupBy) Int

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

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

func (*ChunkGroupBy) IntX

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

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

func (*ChunkGroupBy) Ints

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

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

func (*ChunkGroupBy) IntsX

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

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

func (*ChunkGroupBy) Scan

func (cgb *ChunkGroupBy) Scan(ctx context.Context, v any) error

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

func (*ChunkGroupBy) ScanX

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

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

func (*ChunkGroupBy) String

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

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

func (*ChunkGroupBy) StringX

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

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

func (*ChunkGroupBy) Strings

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

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

func (*ChunkGroupBy) StringsX

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

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

type ChunkMutation

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

ChunkMutation represents an operation that mutates the Chunk nodes in the graph.

func (*ChunkMutation) AddField

func (m *ChunkMutation) 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 (*ChunkMutation) AddNchunk

func (m *ChunkMutation) AddNchunk(i int)

AddNchunk adds i to the "nchunk" field.

func (*ChunkMutation) AddedEdges

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

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

func (*ChunkMutation) AddedField

func (m *ChunkMutation) 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 (*ChunkMutation) AddedFields

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

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

func (*ChunkMutation) AddedIDs

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

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

func (*ChunkMutation) AddedNchunk

func (m *ChunkMutation) AddedNchunk() (r int, exists bool)

AddedNchunk returns the value that was added to the "nchunk" field in this mutation.

func (*ChunkMutation) ClearEdge

func (m *ChunkMutation) 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 (*ChunkMutation) ClearEmbedding

func (m *ChunkMutation) ClearEmbedding()

ClearEmbedding clears the "embedding" edge to the Embedding entity.

func (*ChunkMutation) ClearField

func (m *ChunkMutation) 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 (*ChunkMutation) ClearedEdges

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

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

func (*ChunkMutation) ClearedFields

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

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

func (ChunkMutation) Client

func (m ChunkMutation) 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 (*ChunkMutation) Data

func (m *ChunkMutation) Data() (r string, exists bool)

Data returns the value of the "data" field in the mutation.

func (*ChunkMutation) EdgeCleared

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

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

func (*ChunkMutation) EmbeddingCleared

func (m *ChunkMutation) EmbeddingCleared() bool

EmbeddingCleared reports if the "embedding" edge to the Embedding entity was cleared.

func (*ChunkMutation) EmbeddingID

func (m *ChunkMutation) EmbeddingID() (id int, exists bool)

EmbeddingID returns the "embedding" edge ID in the mutation.

func (*ChunkMutation) EmbeddingIDs

func (m *ChunkMutation) EmbeddingIDs() (ids []int)

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

func (*ChunkMutation) Field

func (m *ChunkMutation) 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 (*ChunkMutation) FieldCleared

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

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

func (*ChunkMutation) Fields

func (m *ChunkMutation) 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 (*ChunkMutation) ID

func (m *ChunkMutation) ID() (id int, exists bool)

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

func (*ChunkMutation) IDs

func (m *ChunkMutation) IDs(ctx context.Context) ([]int, error)

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

func (*ChunkMutation) Nchunk

func (m *ChunkMutation) Nchunk() (r int, exists bool)

Nchunk returns the value of the "nchunk" field in the mutation.

func (*ChunkMutation) OldData

func (m *ChunkMutation) OldData(ctx context.Context) (v string, err error)

OldData returns the old "data" field's value of the Chunk entity. If the Chunk 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 (*ChunkMutation) OldField

func (m *ChunkMutation) 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 (*ChunkMutation) OldNchunk

func (m *ChunkMutation) OldNchunk(ctx context.Context) (v int, err error)

OldNchunk returns the old "nchunk" field's value of the Chunk entity. If the Chunk 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 (*ChunkMutation) OldPath

func (m *ChunkMutation) OldPath(ctx context.Context) (v string, err error)

OldPath returns the old "path" field's value of the Chunk entity. If the Chunk 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 (*ChunkMutation) Op

func (m *ChunkMutation) Op() Op

Op returns the operation name.

func (*ChunkMutation) Path

func (m *ChunkMutation) Path() (r string, exists bool)

Path returns the value of the "path" field in the mutation.

func (*ChunkMutation) RemovedEdges

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

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

func (*ChunkMutation) RemovedIDs

func (m *ChunkMutation) 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 (*ChunkMutation) ResetData

func (m *ChunkMutation) ResetData()

ResetData resets all changes to the "data" field.

func (*ChunkMutation) ResetEdge

func (m *ChunkMutation) 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 (*ChunkMutation) ResetEmbedding

func (m *ChunkMutation) ResetEmbedding()

ResetEmbedding resets all changes to the "embedding" edge.

func (*ChunkMutation) ResetField

func (m *ChunkMutation) 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 (*ChunkMutation) ResetNchunk

func (m *ChunkMutation) ResetNchunk()

ResetNchunk resets all changes to the "nchunk" field.

func (*ChunkMutation) ResetPath

func (m *ChunkMutation) ResetPath()

ResetPath resets all changes to the "path" field.

func (*ChunkMutation) SetData

func (m *ChunkMutation) SetData(s string)

SetData sets the "data" field.

func (*ChunkMutation) SetEmbeddingID

func (m *ChunkMutation) SetEmbeddingID(id int)

SetEmbeddingID sets the "embedding" edge to the Embedding entity by id.

func (*ChunkMutation) SetField

func (m *ChunkMutation) 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 (*ChunkMutation) SetNchunk

func (m *ChunkMutation) SetNchunk(i int)

SetNchunk sets the "nchunk" field.

func (*ChunkMutation) SetOp

func (m *ChunkMutation) SetOp(op Op)

SetOp allows setting the mutation operation.

func (*ChunkMutation) SetPath

func (m *ChunkMutation) SetPath(s string)

SetPath sets the "path" field.

func (ChunkMutation) Tx

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

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

func (*ChunkMutation) Type

func (m *ChunkMutation) Type() string

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

func (*ChunkMutation) Where

func (m *ChunkMutation) Where(ps ...predicate.Chunk)

Where appends a list predicates to the ChunkMutation builder.

func (*ChunkMutation) WhereP

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

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

type ChunkQuery

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

ChunkQuery is the builder for querying Chunk entities.

func (*ChunkQuery) Aggregate

func (cq *ChunkQuery) Aggregate(fns ...AggregateFunc) *ChunkSelect

Aggregate returns a ChunkSelect configured with the given aggregations.

func (*ChunkQuery) All

func (cq *ChunkQuery) All(ctx context.Context) ([]*Chunk, error)

All executes the query and returns a list of Chunks.

func (*ChunkQuery) AllX

func (cq *ChunkQuery) AllX(ctx context.Context) []*Chunk

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

func (*ChunkQuery) Clone

func (cq *ChunkQuery) Clone() *ChunkQuery

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

func (*ChunkQuery) Count

func (cq *ChunkQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*ChunkQuery) CountX

func (cq *ChunkQuery) CountX(ctx context.Context) int

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

func (*ChunkQuery) Exist

func (cq *ChunkQuery) Exist(ctx context.Context) (bool, error)

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

func (*ChunkQuery) ExistX

func (cq *ChunkQuery) ExistX(ctx context.Context) bool

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

func (*ChunkQuery) First

func (cq *ChunkQuery) First(ctx context.Context) (*Chunk, error)

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

func (*ChunkQuery) FirstID

func (cq *ChunkQuery) FirstID(ctx context.Context) (id int, err error)

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

func (*ChunkQuery) FirstIDX

func (cq *ChunkQuery) FirstIDX(ctx context.Context) int

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

func (*ChunkQuery) FirstX

func (cq *ChunkQuery) FirstX(ctx context.Context) *Chunk

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

func (*ChunkQuery) GroupBy

func (cq *ChunkQuery) GroupBy(field string, fields ...string) *ChunkGroupBy

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 {
	Path string `json:"path,omitempty"`
	Count int `json:"count,omitempty"`
}

client.Chunk.Query().
	GroupBy(chunk.FieldPath).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*ChunkQuery) IDs

func (cq *ChunkQuery) IDs(ctx context.Context) (ids []int, err error)

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

func (*ChunkQuery) IDsX

func (cq *ChunkQuery) IDsX(ctx context.Context) []int

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

func (*ChunkQuery) Limit

func (cq *ChunkQuery) Limit(limit int) *ChunkQuery

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

func (*ChunkQuery) Offset

func (cq *ChunkQuery) Offset(offset int) *ChunkQuery

Offset to start from.

func (*ChunkQuery) Only

func (cq *ChunkQuery) Only(ctx context.Context) (*Chunk, error)

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

func (*ChunkQuery) OnlyID

func (cq *ChunkQuery) OnlyID(ctx context.Context) (id int, err error)

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

func (*ChunkQuery) OnlyIDX

func (cq *ChunkQuery) OnlyIDX(ctx context.Context) int

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

func (*ChunkQuery) OnlyX

func (cq *ChunkQuery) OnlyX(ctx context.Context) *Chunk

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

func (*ChunkQuery) Order

func (cq *ChunkQuery) Order(o ...chunk.OrderOption) *ChunkQuery

Order specifies how the records should be ordered.

func (*ChunkQuery) QueryEmbedding

func (cq *ChunkQuery) QueryEmbedding() *EmbeddingQuery

QueryEmbedding chains the current query on the "embedding" edge.

func (*ChunkQuery) Select

func (cq *ChunkQuery) Select(fields ...string) *ChunkSelect

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 {
	Path string `json:"path,omitempty"`
}

client.Chunk.Query().
	Select(chunk.FieldPath).
	Scan(ctx, &v)

func (*ChunkQuery) Unique

func (cq *ChunkQuery) Unique(unique bool) *ChunkQuery

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

func (cq *ChunkQuery) Where(ps ...predicate.Chunk) *ChunkQuery

Where adds a new predicate for the ChunkQuery builder.

func (*ChunkQuery) WithEmbedding

func (cq *ChunkQuery) WithEmbedding(opts ...func(*EmbeddingQuery)) *ChunkQuery

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

type ChunkSelect

type ChunkSelect struct {
	*ChunkQuery
	// contains filtered or unexported fields
}

ChunkSelect is the builder for selecting fields of Chunk entities.

func (*ChunkSelect) Aggregate

func (cs *ChunkSelect) Aggregate(fns ...AggregateFunc) *ChunkSelect

Aggregate adds the given aggregation functions to the selector query.

func (*ChunkSelect) Bool

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

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

func (*ChunkSelect) BoolX

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

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

func (*ChunkSelect) Bools

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

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

func (*ChunkSelect) BoolsX

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

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

func (*ChunkSelect) Float64

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

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

func (*ChunkSelect) Float64X

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

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

func (*ChunkSelect) Float64s

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

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

func (*ChunkSelect) Float64sX

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

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

func (*ChunkSelect) Int

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

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

func (*ChunkSelect) IntX

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

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

func (*ChunkSelect) Ints

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

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

func (*ChunkSelect) IntsX

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

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

func (*ChunkSelect) Scan

func (cs *ChunkSelect) Scan(ctx context.Context, v any) error

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

func (*ChunkSelect) ScanX

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

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

func (*ChunkSelect) String

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

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

func (*ChunkSelect) StringX

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

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

func (*ChunkSelect) Strings

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

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

func (*ChunkSelect) StringsX

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

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

type ChunkUpdate

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

ChunkUpdate is the builder for updating Chunk entities.

func (*ChunkUpdate) AddNchunk

func (cu *ChunkUpdate) AddNchunk(i int) *ChunkUpdate

AddNchunk adds i to the "nchunk" field.

func (*ChunkUpdate) ClearEmbedding

func (cu *ChunkUpdate) ClearEmbedding() *ChunkUpdate

ClearEmbedding clears the "embedding" edge to the Embedding entity.

func (*ChunkUpdate) Exec

func (cu *ChunkUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*ChunkUpdate) ExecX

func (cu *ChunkUpdate) ExecX(ctx context.Context)

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

func (*ChunkUpdate) Mutation

func (cu *ChunkUpdate) Mutation() *ChunkMutation

Mutation returns the ChunkMutation object of the builder.

func (*ChunkUpdate) Save

func (cu *ChunkUpdate) Save(ctx context.Context) (int, error)

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

func (*ChunkUpdate) SaveX

func (cu *ChunkUpdate) SaveX(ctx context.Context) int

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

func (*ChunkUpdate) SetData

func (cu *ChunkUpdate) SetData(s string) *ChunkUpdate

SetData sets the "data" field.

func (*ChunkUpdate) SetEmbedding

func (cu *ChunkUpdate) SetEmbedding(e *Embedding) *ChunkUpdate

SetEmbedding sets the "embedding" edge to the Embedding entity.

func (*ChunkUpdate) SetEmbeddingID

func (cu *ChunkUpdate) SetEmbeddingID(id int) *ChunkUpdate

SetEmbeddingID sets the "embedding" edge to the Embedding entity by ID.

func (*ChunkUpdate) SetNchunk

func (cu *ChunkUpdate) SetNchunk(i int) *ChunkUpdate

SetNchunk sets the "nchunk" field.

func (*ChunkUpdate) SetNillableData

func (cu *ChunkUpdate) SetNillableData(s *string) *ChunkUpdate

SetNillableData sets the "data" field if the given value is not nil.

func (*ChunkUpdate) SetNillableEmbeddingID

func (cu *ChunkUpdate) SetNillableEmbeddingID(id *int) *ChunkUpdate

SetNillableEmbeddingID sets the "embedding" edge to the Embedding entity by ID if the given value is not nil.

func (*ChunkUpdate) SetNillableNchunk

func (cu *ChunkUpdate) SetNillableNchunk(i *int) *ChunkUpdate

SetNillableNchunk sets the "nchunk" field if the given value is not nil.

func (*ChunkUpdate) SetNillablePath

func (cu *ChunkUpdate) SetNillablePath(s *string) *ChunkUpdate

SetNillablePath sets the "path" field if the given value is not nil.

func (*ChunkUpdate) SetPath

func (cu *ChunkUpdate) SetPath(s string) *ChunkUpdate

SetPath sets the "path" field.

func (*ChunkUpdate) Where

func (cu *ChunkUpdate) Where(ps ...predicate.Chunk) *ChunkUpdate

Where appends a list predicates to the ChunkUpdate builder.

type ChunkUpdateOne

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

ChunkUpdateOne is the builder for updating a single Chunk entity.

func (*ChunkUpdateOne) AddNchunk

func (cuo *ChunkUpdateOne) AddNchunk(i int) *ChunkUpdateOne

AddNchunk adds i to the "nchunk" field.

func (*ChunkUpdateOne) ClearEmbedding

func (cuo *ChunkUpdateOne) ClearEmbedding() *ChunkUpdateOne

ClearEmbedding clears the "embedding" edge to the Embedding entity.

func (*ChunkUpdateOne) Exec

func (cuo *ChunkUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*ChunkUpdateOne) ExecX

func (cuo *ChunkUpdateOne) ExecX(ctx context.Context)

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

func (*ChunkUpdateOne) Mutation

func (cuo *ChunkUpdateOne) Mutation() *ChunkMutation

Mutation returns the ChunkMutation object of the builder.

func (*ChunkUpdateOne) Save

func (cuo *ChunkUpdateOne) Save(ctx context.Context) (*Chunk, error)

Save executes the query and returns the updated Chunk entity.

func (*ChunkUpdateOne) SaveX

func (cuo *ChunkUpdateOne) SaveX(ctx context.Context) *Chunk

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

func (*ChunkUpdateOne) Select

func (cuo *ChunkUpdateOne) Select(field string, fields ...string) *ChunkUpdateOne

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

func (*ChunkUpdateOne) SetData

func (cuo *ChunkUpdateOne) SetData(s string) *ChunkUpdateOne

SetData sets the "data" field.

func (*ChunkUpdateOne) SetEmbedding

func (cuo *ChunkUpdateOne) SetEmbedding(e *Embedding) *ChunkUpdateOne

SetEmbedding sets the "embedding" edge to the Embedding entity.

func (*ChunkUpdateOne) SetEmbeddingID

func (cuo *ChunkUpdateOne) SetEmbeddingID(id int) *ChunkUpdateOne

SetEmbeddingID sets the "embedding" edge to the Embedding entity by ID.

func (*ChunkUpdateOne) SetNchunk

func (cuo *ChunkUpdateOne) SetNchunk(i int) *ChunkUpdateOne

SetNchunk sets the "nchunk" field.

func (*ChunkUpdateOne) SetNillableData

func (cuo *ChunkUpdateOne) SetNillableData(s *string) *ChunkUpdateOne

SetNillableData sets the "data" field if the given value is not nil.

func (*ChunkUpdateOne) SetNillableEmbeddingID

func (cuo *ChunkUpdateOne) SetNillableEmbeddingID(id *int) *ChunkUpdateOne

SetNillableEmbeddingID sets the "embedding" edge to the Embedding entity by ID if the given value is not nil.

func (*ChunkUpdateOne) SetNillableNchunk

func (cuo *ChunkUpdateOne) SetNillableNchunk(i *int) *ChunkUpdateOne

SetNillableNchunk sets the "nchunk" field if the given value is not nil.

func (*ChunkUpdateOne) SetNillablePath

func (cuo *ChunkUpdateOne) SetNillablePath(s *string) *ChunkUpdateOne

SetNillablePath sets the "path" field if the given value is not nil.

func (*ChunkUpdateOne) SetPath

func (cuo *ChunkUpdateOne) SetPath(s string) *ChunkUpdateOne

SetPath sets the "path" field.

func (*ChunkUpdateOne) Where

func (cuo *ChunkUpdateOne) Where(ps ...predicate.Chunk) *ChunkUpdateOne

Where appends a list predicates to the ChunkUpdate builder.

type Chunks

type Chunks []*Chunk

Chunks is a parsable slice of Chunk.

type Client

type Client struct {

	// Schema is the client for creating, migrating and dropping schema.
	Schema *migrate.Schema
	// Chunk is the client for interacting with the Chunk builders.
	Chunk *ChunkClient
	// Embedding is the client for interacting with the Embedding builders.
	Embedding *EmbeddingClient
	// 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().
	Chunk.
	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 Embedding

type Embedding struct {

	// ID of the ent.
	ID int `json:"id,omitempty"`
	// Embedding holds the value of the "embedding" field.
	Embedding pgvector.Vector `json:"embedding,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the EmbeddingQuery when eager-loading is set.
	Edges EmbeddingEdges `json:"edges"`
	// contains filtered or unexported fields
}

Embedding is the model entity for the Embedding schema.

func (*Embedding) QueryChunk

func (e *Embedding) QueryChunk() *ChunkQuery

QueryChunk queries the "chunk" edge of the Embedding entity.

func (*Embedding) String

func (e *Embedding) String() string

String implements the fmt.Stringer.

func (*Embedding) Unwrap

func (e *Embedding) Unwrap() *Embedding

Unwrap unwraps the Embedding 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 (*Embedding) Update

func (e *Embedding) Update() *EmbeddingUpdateOne

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

func (*Embedding) Value

func (e *Embedding) Value(name string) (ent.Value, error)

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

type EmbeddingClient

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

EmbeddingClient is a client for the Embedding schema.

func NewEmbeddingClient

func NewEmbeddingClient(c config) *EmbeddingClient

NewEmbeddingClient returns a client for the Embedding from the given config.

func (*EmbeddingClient) Create

func (c *EmbeddingClient) Create() *EmbeddingCreate

Create returns a builder for creating a Embedding entity.

func (*EmbeddingClient) CreateBulk

func (c *EmbeddingClient) CreateBulk(builders ...*EmbeddingCreate) *EmbeddingCreateBulk

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

func (*EmbeddingClient) Delete

func (c *EmbeddingClient) Delete() *EmbeddingDelete

Delete returns a delete builder for Embedding.

func (*EmbeddingClient) DeleteOne

func (c *EmbeddingClient) DeleteOne(e *Embedding) *EmbeddingDeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*EmbeddingClient) DeleteOneID

func (c *EmbeddingClient) DeleteOneID(id int) *EmbeddingDeleteOne

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

func (*EmbeddingClient) Get

func (c *EmbeddingClient) Get(ctx context.Context, id int) (*Embedding, error)

Get returns a Embedding entity by its id.

func (*EmbeddingClient) GetX

func (c *EmbeddingClient) GetX(ctx context.Context, id int) *Embedding

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

func (*EmbeddingClient) Hooks

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

Hooks returns the client hooks.

func (*EmbeddingClient) Intercept

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

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

func (*EmbeddingClient) Interceptors

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

Interceptors returns the client interceptors.

func (*EmbeddingClient) MapCreateBulk

func (c *EmbeddingClient) MapCreateBulk(slice any, setFunc func(*EmbeddingCreate, int)) *EmbeddingCreateBulk

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

func (c *EmbeddingClient) Query() *EmbeddingQuery

Query returns a query builder for Embedding.

func (*EmbeddingClient) QueryChunk

func (c *EmbeddingClient) QueryChunk(e *Embedding) *ChunkQuery

QueryChunk queries the chunk edge of a Embedding.

func (*EmbeddingClient) Update

func (c *EmbeddingClient) Update() *EmbeddingUpdate

Update returns an update builder for Embedding.

func (*EmbeddingClient) UpdateOne

func (c *EmbeddingClient) UpdateOne(e *Embedding) *EmbeddingUpdateOne

UpdateOne returns an update builder for the given entity.

func (*EmbeddingClient) UpdateOneID

func (c *EmbeddingClient) UpdateOneID(id int) *EmbeddingUpdateOne

UpdateOneID returns an update builder for the given id.

func (*EmbeddingClient) Use

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

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

type EmbeddingCreate

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

EmbeddingCreate is the builder for creating a Embedding entity.

func (*EmbeddingCreate) Exec

func (ec *EmbeddingCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*EmbeddingCreate) ExecX

func (ec *EmbeddingCreate) ExecX(ctx context.Context)

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

func (*EmbeddingCreate) Mutation

func (ec *EmbeddingCreate) Mutation() *EmbeddingMutation

Mutation returns the EmbeddingMutation object of the builder.

func (*EmbeddingCreate) Save

func (ec *EmbeddingCreate) Save(ctx context.Context) (*Embedding, error)

Save creates the Embedding in the database.

func (*EmbeddingCreate) SaveX

func (ec *EmbeddingCreate) SaveX(ctx context.Context) *Embedding

SaveX calls Save and panics if Save returns an error.

func (*EmbeddingCreate) SetChunk

func (ec *EmbeddingCreate) SetChunk(c *Chunk) *EmbeddingCreate

SetChunk sets the "chunk" edge to the Chunk entity.

func (*EmbeddingCreate) SetChunkID

func (ec *EmbeddingCreate) SetChunkID(id int) *EmbeddingCreate

SetChunkID sets the "chunk" edge to the Chunk entity by ID.

func (*EmbeddingCreate) SetEmbedding

func (ec *EmbeddingCreate) SetEmbedding(pg pgvector.Vector) *EmbeddingCreate

SetEmbedding sets the "embedding" field.

type EmbeddingCreateBulk

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

EmbeddingCreateBulk is the builder for creating many Embedding entities in bulk.

func (*EmbeddingCreateBulk) Exec

func (ecb *EmbeddingCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*EmbeddingCreateBulk) ExecX

func (ecb *EmbeddingCreateBulk) ExecX(ctx context.Context)

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

func (*EmbeddingCreateBulk) Save

func (ecb *EmbeddingCreateBulk) Save(ctx context.Context) ([]*Embedding, error)

Save creates the Embedding entities in the database.

func (*EmbeddingCreateBulk) SaveX

func (ecb *EmbeddingCreateBulk) SaveX(ctx context.Context) []*Embedding

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

type EmbeddingDelete

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

EmbeddingDelete is the builder for deleting a Embedding entity.

func (*EmbeddingDelete) Exec

func (ed *EmbeddingDelete) Exec(ctx context.Context) (int, error)

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

func (*EmbeddingDelete) ExecX

func (ed *EmbeddingDelete) ExecX(ctx context.Context) int

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

func (*EmbeddingDelete) Where

Where appends a list predicates to the EmbeddingDelete builder.

type EmbeddingDeleteOne

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

EmbeddingDeleteOne is the builder for deleting a single Embedding entity.

func (*EmbeddingDeleteOne) Exec

func (edo *EmbeddingDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*EmbeddingDeleteOne) ExecX

func (edo *EmbeddingDeleteOne) ExecX(ctx context.Context)

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

func (*EmbeddingDeleteOne) Where

Where appends a list predicates to the EmbeddingDelete builder.

type EmbeddingEdges

type EmbeddingEdges struct {
	// Chunk holds the value of the chunk edge.
	Chunk *Chunk `json:"chunk,omitempty"`
	// contains filtered or unexported fields
}

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

func (EmbeddingEdges) ChunkOrErr

func (e EmbeddingEdges) ChunkOrErr() (*Chunk, error)

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

type EmbeddingGroupBy

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

EmbeddingGroupBy is the group-by builder for Embedding entities.

func (*EmbeddingGroupBy) Aggregate

func (egb *EmbeddingGroupBy) Aggregate(fns ...AggregateFunc) *EmbeddingGroupBy

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

func (*EmbeddingGroupBy) Bool

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

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

func (*EmbeddingGroupBy) BoolX

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

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

func (*EmbeddingGroupBy) Bools

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

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

func (*EmbeddingGroupBy) BoolsX

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

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

func (*EmbeddingGroupBy) Float64

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

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

func (*EmbeddingGroupBy) Float64X

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

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

func (*EmbeddingGroupBy) Float64s

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

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

func (*EmbeddingGroupBy) Float64sX

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

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

func (*EmbeddingGroupBy) Int

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

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

func (*EmbeddingGroupBy) IntX

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

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

func (*EmbeddingGroupBy) Ints

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

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

func (*EmbeddingGroupBy) IntsX

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

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

func (*EmbeddingGroupBy) Scan

func (egb *EmbeddingGroupBy) Scan(ctx context.Context, v any) error

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

func (*EmbeddingGroupBy) ScanX

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

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

func (*EmbeddingGroupBy) String

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

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

func (*EmbeddingGroupBy) StringX

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

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

func (*EmbeddingGroupBy) Strings

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

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

func (*EmbeddingGroupBy) StringsX

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

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

type EmbeddingMutation

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

EmbeddingMutation represents an operation that mutates the Embedding nodes in the graph.

func (*EmbeddingMutation) AddField

func (m *EmbeddingMutation) 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 (*EmbeddingMutation) AddedEdges

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

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

func (*EmbeddingMutation) AddedField

func (m *EmbeddingMutation) 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 (*EmbeddingMutation) AddedFields

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

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

func (*EmbeddingMutation) AddedIDs

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

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

func (*EmbeddingMutation) ChunkCleared

func (m *EmbeddingMutation) ChunkCleared() bool

ChunkCleared reports if the "chunk" edge to the Chunk entity was cleared.

func (*EmbeddingMutation) ChunkID

func (m *EmbeddingMutation) ChunkID() (id int, exists bool)

ChunkID returns the "chunk" edge ID in the mutation.

func (*EmbeddingMutation) ChunkIDs

func (m *EmbeddingMutation) ChunkIDs() (ids []int)

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

func (*EmbeddingMutation) ClearChunk

func (m *EmbeddingMutation) ClearChunk()

ClearChunk clears the "chunk" edge to the Chunk entity.

func (*EmbeddingMutation) ClearEdge

func (m *EmbeddingMutation) 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 (*EmbeddingMutation) ClearField

func (m *EmbeddingMutation) 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 (*EmbeddingMutation) ClearedEdges

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

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

func (*EmbeddingMutation) ClearedFields

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

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

func (EmbeddingMutation) Client

func (m EmbeddingMutation) 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 (*EmbeddingMutation) EdgeCleared

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

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

func (*EmbeddingMutation) Embedding

func (m *EmbeddingMutation) Embedding() (r pgvector.Vector, exists bool)

Embedding returns the value of the "embedding" field in the mutation.

func (*EmbeddingMutation) Field

func (m *EmbeddingMutation) 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 (*EmbeddingMutation) FieldCleared

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

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

func (*EmbeddingMutation) Fields

func (m *EmbeddingMutation) 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 (*EmbeddingMutation) ID

func (m *EmbeddingMutation) ID() (id int, exists bool)

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

func (*EmbeddingMutation) IDs

func (m *EmbeddingMutation) IDs(ctx context.Context) ([]int, error)

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

func (*EmbeddingMutation) OldEmbedding

func (m *EmbeddingMutation) OldEmbedding(ctx context.Context) (v pgvector.Vector, err error)

OldEmbedding returns the old "embedding" field's value of the Embedding entity. If the Embedding 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 (*EmbeddingMutation) OldField

func (m *EmbeddingMutation) 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 (*EmbeddingMutation) Op

func (m *EmbeddingMutation) Op() Op

Op returns the operation name.

func (*EmbeddingMutation) RemovedEdges

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

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

func (*EmbeddingMutation) RemovedIDs

func (m *EmbeddingMutation) 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 (*EmbeddingMutation) ResetChunk

func (m *EmbeddingMutation) ResetChunk()

ResetChunk resets all changes to the "chunk" edge.

func (*EmbeddingMutation) ResetEdge

func (m *EmbeddingMutation) 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 (*EmbeddingMutation) ResetEmbedding

func (m *EmbeddingMutation) ResetEmbedding()

ResetEmbedding resets all changes to the "embedding" field.

func (*EmbeddingMutation) ResetField

func (m *EmbeddingMutation) 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 (*EmbeddingMutation) SetChunkID

func (m *EmbeddingMutation) SetChunkID(id int)

SetChunkID sets the "chunk" edge to the Chunk entity by id.

func (*EmbeddingMutation) SetEmbedding

func (m *EmbeddingMutation) SetEmbedding(pg pgvector.Vector)

SetEmbedding sets the "embedding" field.

func (*EmbeddingMutation) SetField

func (m *EmbeddingMutation) 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 (*EmbeddingMutation) SetOp

func (m *EmbeddingMutation) SetOp(op Op)

SetOp allows setting the mutation operation.

func (EmbeddingMutation) Tx

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

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

func (*EmbeddingMutation) Type

func (m *EmbeddingMutation) Type() string

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

func (*EmbeddingMutation) Where

func (m *EmbeddingMutation) Where(ps ...predicate.Embedding)

Where appends a list predicates to the EmbeddingMutation builder.

func (*EmbeddingMutation) WhereP

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

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

type EmbeddingQuery

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

EmbeddingQuery is the builder for querying Embedding entities.

func (*EmbeddingQuery) Aggregate

func (eq *EmbeddingQuery) Aggregate(fns ...AggregateFunc) *EmbeddingSelect

Aggregate returns a EmbeddingSelect configured with the given aggregations.

func (*EmbeddingQuery) All

func (eq *EmbeddingQuery) All(ctx context.Context) ([]*Embedding, error)

All executes the query and returns a list of Embeddings.

func (*EmbeddingQuery) AllX

func (eq *EmbeddingQuery) AllX(ctx context.Context) []*Embedding

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

func (*EmbeddingQuery) Clone

func (eq *EmbeddingQuery) Clone() *EmbeddingQuery

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

func (*EmbeddingQuery) Count

func (eq *EmbeddingQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*EmbeddingQuery) CountX

func (eq *EmbeddingQuery) CountX(ctx context.Context) int

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

func (*EmbeddingQuery) Exist

func (eq *EmbeddingQuery) Exist(ctx context.Context) (bool, error)

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

func (*EmbeddingQuery) ExistX

func (eq *EmbeddingQuery) ExistX(ctx context.Context) bool

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

func (*EmbeddingQuery) First

func (eq *EmbeddingQuery) First(ctx context.Context) (*Embedding, error)

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

func (*EmbeddingQuery) FirstID

func (eq *EmbeddingQuery) FirstID(ctx context.Context) (id int, err error)

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

func (*EmbeddingQuery) FirstIDX

func (eq *EmbeddingQuery) FirstIDX(ctx context.Context) int

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

func (*EmbeddingQuery) FirstX

func (eq *EmbeddingQuery) FirstX(ctx context.Context) *Embedding

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

func (*EmbeddingQuery) GroupBy

func (eq *EmbeddingQuery) GroupBy(field string, fields ...string) *EmbeddingGroupBy

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 {
	Embedding pgvector.Vector `json:"embedding,omitempty"`
	Count int `json:"count,omitempty"`
}

client.Embedding.Query().
	GroupBy(embedding.FieldEmbedding).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*EmbeddingQuery) IDs

func (eq *EmbeddingQuery) IDs(ctx context.Context) (ids []int, err error)

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

func (*EmbeddingQuery) IDsX

func (eq *EmbeddingQuery) IDsX(ctx context.Context) []int

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

func (*EmbeddingQuery) Limit

func (eq *EmbeddingQuery) Limit(limit int) *EmbeddingQuery

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

func (*EmbeddingQuery) Offset

func (eq *EmbeddingQuery) Offset(offset int) *EmbeddingQuery

Offset to start from.

func (*EmbeddingQuery) Only

func (eq *EmbeddingQuery) Only(ctx context.Context) (*Embedding, error)

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

func (*EmbeddingQuery) OnlyID

func (eq *EmbeddingQuery) OnlyID(ctx context.Context) (id int, err error)

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

func (*EmbeddingQuery) OnlyIDX

func (eq *EmbeddingQuery) OnlyIDX(ctx context.Context) int

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

func (*EmbeddingQuery) OnlyX

func (eq *EmbeddingQuery) OnlyX(ctx context.Context) *Embedding

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

func (*EmbeddingQuery) Order

Order specifies how the records should be ordered.

func (*EmbeddingQuery) QueryChunk

func (eq *EmbeddingQuery) QueryChunk() *ChunkQuery

QueryChunk chains the current query on the "chunk" edge.

func (*EmbeddingQuery) Select

func (eq *EmbeddingQuery) Select(fields ...string) *EmbeddingSelect

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 {
	Embedding pgvector.Vector `json:"embedding,omitempty"`
}

client.Embedding.Query().
	Select(embedding.FieldEmbedding).
	Scan(ctx, &v)

func (*EmbeddingQuery) Unique

func (eq *EmbeddingQuery) Unique(unique bool) *EmbeddingQuery

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

Where adds a new predicate for the EmbeddingQuery builder.

func (*EmbeddingQuery) WithChunk

func (eq *EmbeddingQuery) WithChunk(opts ...func(*ChunkQuery)) *EmbeddingQuery

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

type EmbeddingSelect

type EmbeddingSelect struct {
	*EmbeddingQuery
	// contains filtered or unexported fields
}

EmbeddingSelect is the builder for selecting fields of Embedding entities.

func (*EmbeddingSelect) Aggregate

func (es *EmbeddingSelect) Aggregate(fns ...AggregateFunc) *EmbeddingSelect

Aggregate adds the given aggregation functions to the selector query.

func (*EmbeddingSelect) Bool

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

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

func (*EmbeddingSelect) BoolX

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

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

func (*EmbeddingSelect) Bools

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

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

func (*EmbeddingSelect) BoolsX

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

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

func (*EmbeddingSelect) Float64

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

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

func (*EmbeddingSelect) Float64X

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

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

func (*EmbeddingSelect) Float64s

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

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

func (*EmbeddingSelect) Float64sX

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

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

func (*EmbeddingSelect) Int

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

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

func (*EmbeddingSelect) IntX

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

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

func (*EmbeddingSelect) Ints

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

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

func (*EmbeddingSelect) IntsX

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

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

func (*EmbeddingSelect) Scan

func (es *EmbeddingSelect) Scan(ctx context.Context, v any) error

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

func (*EmbeddingSelect) ScanX

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

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

func (*EmbeddingSelect) String

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

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

func (*EmbeddingSelect) StringX

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

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

func (*EmbeddingSelect) Strings

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

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

func (*EmbeddingSelect) StringsX

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

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

type EmbeddingUpdate

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

EmbeddingUpdate is the builder for updating Embedding entities.

func (*EmbeddingUpdate) ClearChunk

func (eu *EmbeddingUpdate) ClearChunk() *EmbeddingUpdate

ClearChunk clears the "chunk" edge to the Chunk entity.

func (*EmbeddingUpdate) Exec

func (eu *EmbeddingUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*EmbeddingUpdate) ExecX

func (eu *EmbeddingUpdate) ExecX(ctx context.Context)

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

func (*EmbeddingUpdate) Mutation

func (eu *EmbeddingUpdate) Mutation() *EmbeddingMutation

Mutation returns the EmbeddingMutation object of the builder.

func (*EmbeddingUpdate) Save

func (eu *EmbeddingUpdate) Save(ctx context.Context) (int, error)

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

func (*EmbeddingUpdate) SaveX

func (eu *EmbeddingUpdate) SaveX(ctx context.Context) int

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

func (*EmbeddingUpdate) SetChunk

func (eu *EmbeddingUpdate) SetChunk(c *Chunk) *EmbeddingUpdate

SetChunk sets the "chunk" edge to the Chunk entity.

func (*EmbeddingUpdate) SetChunkID

func (eu *EmbeddingUpdate) SetChunkID(id int) *EmbeddingUpdate

SetChunkID sets the "chunk" edge to the Chunk entity by ID.

func (*EmbeddingUpdate) SetEmbedding

func (eu *EmbeddingUpdate) SetEmbedding(pg pgvector.Vector) *EmbeddingUpdate

SetEmbedding sets the "embedding" field.

func (*EmbeddingUpdate) SetNillableEmbedding

func (eu *EmbeddingUpdate) SetNillableEmbedding(pg *pgvector.Vector) *EmbeddingUpdate

SetNillableEmbedding sets the "embedding" field if the given value is not nil.

func (*EmbeddingUpdate) Where

Where appends a list predicates to the EmbeddingUpdate builder.

type EmbeddingUpdateOne

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

EmbeddingUpdateOne is the builder for updating a single Embedding entity.

func (*EmbeddingUpdateOne) ClearChunk

func (euo *EmbeddingUpdateOne) ClearChunk() *EmbeddingUpdateOne

ClearChunk clears the "chunk" edge to the Chunk entity.

func (*EmbeddingUpdateOne) Exec

func (euo *EmbeddingUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*EmbeddingUpdateOne) ExecX

func (euo *EmbeddingUpdateOne) ExecX(ctx context.Context)

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

func (*EmbeddingUpdateOne) Mutation

func (euo *EmbeddingUpdateOne) Mutation() *EmbeddingMutation

Mutation returns the EmbeddingMutation object of the builder.

func (*EmbeddingUpdateOne) Save

func (euo *EmbeddingUpdateOne) Save(ctx context.Context) (*Embedding, error)

Save executes the query and returns the updated Embedding entity.

func (*EmbeddingUpdateOne) SaveX

func (euo *EmbeddingUpdateOne) SaveX(ctx context.Context) *Embedding

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

func (*EmbeddingUpdateOne) Select

func (euo *EmbeddingUpdateOne) Select(field string, fields ...string) *EmbeddingUpdateOne

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

func (*EmbeddingUpdateOne) SetChunk

func (euo *EmbeddingUpdateOne) SetChunk(c *Chunk) *EmbeddingUpdateOne

SetChunk sets the "chunk" edge to the Chunk entity.

func (*EmbeddingUpdateOne) SetChunkID

func (euo *EmbeddingUpdateOne) SetChunkID(id int) *EmbeddingUpdateOne

SetChunkID sets the "chunk" edge to the Chunk entity by ID.

func (*EmbeddingUpdateOne) SetEmbedding

func (euo *EmbeddingUpdateOne) SetEmbedding(pg pgvector.Vector) *EmbeddingUpdateOne

SetEmbedding sets the "embedding" field.

func (*EmbeddingUpdateOne) SetNillableEmbedding

func (euo *EmbeddingUpdateOne) SetNillableEmbedding(pg *pgvector.Vector) *EmbeddingUpdateOne

SetNillableEmbedding sets the "embedding" field if the given value is not nil.

func (*EmbeddingUpdateOne) Where

Where appends a list predicates to the EmbeddingUpdate builder.

type Embeddings

type Embeddings []*Embedding

Embeddings is a parsable slice of Embedding.

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 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 {

	// Chunk is the client for interacting with the Chunk builders.
	Chunk *ChunkClient
	// Embedding is the client for interacting with the Embedding builders.
	Embedding *EmbeddingClient
	// contains filtered or unexported fields
}

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

func TxFromContext

func TxFromContext(ctx context.Context) *Tx

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

func (*Tx) Client

func (tx *Tx) Client() *Client

Client returns a Client that binds to current transaction.

func (*Tx) Commit

func (tx *Tx) Commit() error

Commit commits the transaction.

func (*Tx) OnCommit

func (tx *Tx) OnCommit(f CommitHook)

OnCommit adds a hook to call on commit.

func (*Tx) OnRollback

func (tx *Tx) OnRollback(f RollbackHook)

OnRollback adds a hook to call on rollback.

func (*Tx) Rollback

func (tx *Tx) Rollback() error

Rollback rollbacks the transaction.

type ValidationError

type ValidationError struct {
	Name string // Field or edge name.
	// contains filtered or unexported fields
}

ValidationError returns when validating a field or edge fails.

func (*ValidationError) Error

func (e *ValidationError) Error() string

Error implements the error interface.

func (*ValidationError) Unwrap

func (e *ValidationError) Unwrap() error

Unwrap implements the errors.Wrapper interface.

type Value

type Value = ent.Value

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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