Documentation
¶
Index ¶
- Constants
- Variables
- func Asc(fields ...string) func(*sql.Selector)
- func Desc(fields ...string) func(*sql.Selector)
- func IsConstraintError(err error) bool
- func IsNotFound(err error) bool
- func IsNotLoaded(err error) bool
- func IsNotSingular(err error) bool
- func IsValidationError(err error) bool
- func MaskNotFound(err error) error
- func NewContext(parent context.Context, c *Client) context.Context
- func NewTxContext(parent context.Context, tx *Tx) context.Context
- type AggregateFunc
- type Chunk
- type ChunkClient
- func (c *ChunkClient) Create() *ChunkCreate
- func (c *ChunkClient) CreateBulk(builders ...*ChunkCreate) *ChunkCreateBulk
- func (c *ChunkClient) Delete() *ChunkDelete
- func (c *ChunkClient) DeleteOne(ch *Chunk) *ChunkDeleteOne
- func (c *ChunkClient) DeleteOneID(id int) *ChunkDeleteOne
- func (c *ChunkClient) Get(ctx context.Context, id int) (*Chunk, error)
- func (c *ChunkClient) GetX(ctx context.Context, id int) *Chunk
- func (c *ChunkClient) Hooks() []Hook
- func (c *ChunkClient) Intercept(interceptors ...Interceptor)
- func (c *ChunkClient) Interceptors() []Interceptor
- func (c *ChunkClient) MapCreateBulk(slice any, setFunc func(*ChunkCreate, int)) *ChunkCreateBulk
- func (c *ChunkClient) Query() *ChunkQuery
- func (c *ChunkClient) QueryEmbedding(ch *Chunk) *EmbeddingQuery
- func (c *ChunkClient) Update() *ChunkUpdate
- func (c *ChunkClient) UpdateOne(ch *Chunk) *ChunkUpdateOne
- func (c *ChunkClient) UpdateOneID(id int) *ChunkUpdateOne
- func (c *ChunkClient) Use(hooks ...Hook)
- type ChunkCreate
- func (cc *ChunkCreate) Exec(ctx context.Context) error
- func (cc *ChunkCreate) ExecX(ctx context.Context)
- func (cc *ChunkCreate) Mutation() *ChunkMutation
- func (cc *ChunkCreate) Save(ctx context.Context) (*Chunk, error)
- func (cc *ChunkCreate) SaveX(ctx context.Context) *Chunk
- func (cc *ChunkCreate) SetData(s string) *ChunkCreate
- func (cc *ChunkCreate) SetEmbedding(e *Embedding) *ChunkCreate
- func (cc *ChunkCreate) SetEmbeddingID(id int) *ChunkCreate
- func (cc *ChunkCreate) SetNchunk(i int) *ChunkCreate
- func (cc *ChunkCreate) SetNillableEmbeddingID(id *int) *ChunkCreate
- func (cc *ChunkCreate) SetPath(s string) *ChunkCreate
- type ChunkCreateBulk
- type ChunkDelete
- type ChunkDeleteOne
- type ChunkEdges
- type ChunkGroupBy
- func (cgb *ChunkGroupBy) Aggregate(fns ...AggregateFunc) *ChunkGroupBy
- func (s *ChunkGroupBy) Bool(ctx context.Context) (_ bool, err error)
- func (s *ChunkGroupBy) BoolX(ctx context.Context) bool
- func (s *ChunkGroupBy) Bools(ctx context.Context) ([]bool, error)
- func (s *ChunkGroupBy) BoolsX(ctx context.Context) []bool
- func (s *ChunkGroupBy) Float64(ctx context.Context) (_ float64, err error)
- func (s *ChunkGroupBy) Float64X(ctx context.Context) float64
- func (s *ChunkGroupBy) Float64s(ctx context.Context) ([]float64, error)
- func (s *ChunkGroupBy) Float64sX(ctx context.Context) []float64
- func (s *ChunkGroupBy) Int(ctx context.Context) (_ int, err error)
- func (s *ChunkGroupBy) IntX(ctx context.Context) int
- func (s *ChunkGroupBy) Ints(ctx context.Context) ([]int, error)
- func (s *ChunkGroupBy) IntsX(ctx context.Context) []int
- func (cgb *ChunkGroupBy) Scan(ctx context.Context, v any) error
- func (s *ChunkGroupBy) ScanX(ctx context.Context, v any)
- func (s *ChunkGroupBy) String(ctx context.Context) (_ string, err error)
- func (s *ChunkGroupBy) StringX(ctx context.Context) string
- func (s *ChunkGroupBy) Strings(ctx context.Context) ([]string, error)
- func (s *ChunkGroupBy) StringsX(ctx context.Context) []string
- type ChunkMutation
- func (m *ChunkMutation) AddField(name string, value ent.Value) error
- func (m *ChunkMutation) AddNchunk(i int)
- func (m *ChunkMutation) AddedEdges() []string
- func (m *ChunkMutation) AddedField(name string) (ent.Value, bool)
- func (m *ChunkMutation) AddedFields() []string
- func (m *ChunkMutation) AddedIDs(name string) []ent.Value
- func (m *ChunkMutation) AddedNchunk() (r int, exists bool)
- func (m *ChunkMutation) ClearEdge(name string) error
- func (m *ChunkMutation) ClearEmbedding()
- func (m *ChunkMutation) ClearField(name string) error
- func (m *ChunkMutation) ClearedEdges() []string
- func (m *ChunkMutation) ClearedFields() []string
- func (m ChunkMutation) Client() *Client
- func (m *ChunkMutation) Data() (r string, exists bool)
- func (m *ChunkMutation) EdgeCleared(name string) bool
- func (m *ChunkMutation) EmbeddingCleared() bool
- func (m *ChunkMutation) EmbeddingID() (id int, exists bool)
- func (m *ChunkMutation) EmbeddingIDs() (ids []int)
- func (m *ChunkMutation) Field(name string) (ent.Value, bool)
- func (m *ChunkMutation) FieldCleared(name string) bool
- func (m *ChunkMutation) Fields() []string
- func (m *ChunkMutation) ID() (id int, exists bool)
- func (m *ChunkMutation) IDs(ctx context.Context) ([]int, error)
- func (m *ChunkMutation) Nchunk() (r int, exists bool)
- func (m *ChunkMutation) OldData(ctx context.Context) (v string, err error)
- func (m *ChunkMutation) OldField(ctx context.Context, name string) (ent.Value, error)
- func (m *ChunkMutation) OldNchunk(ctx context.Context) (v int, err error)
- func (m *ChunkMutation) OldPath(ctx context.Context) (v string, err error)
- func (m *ChunkMutation) Op() Op
- func (m *ChunkMutation) Path() (r string, exists bool)
- func (m *ChunkMutation) RemovedEdges() []string
- func (m *ChunkMutation) RemovedIDs(name string) []ent.Value
- func (m *ChunkMutation) ResetData()
- func (m *ChunkMutation) ResetEdge(name string) error
- func (m *ChunkMutation) ResetEmbedding()
- func (m *ChunkMutation) ResetField(name string) error
- func (m *ChunkMutation) ResetNchunk()
- func (m *ChunkMutation) ResetPath()
- func (m *ChunkMutation) SetData(s string)
- func (m *ChunkMutation) SetEmbeddingID(id int)
- func (m *ChunkMutation) SetField(name string, value ent.Value) error
- func (m *ChunkMutation) SetNchunk(i int)
- func (m *ChunkMutation) SetOp(op Op)
- func (m *ChunkMutation) SetPath(s string)
- func (m ChunkMutation) Tx() (*Tx, error)
- func (m *ChunkMutation) Type() string
- func (m *ChunkMutation) Where(ps ...predicate.Chunk)
- func (m *ChunkMutation) WhereP(ps ...func(*sql.Selector))
- type ChunkQuery
- func (cq *ChunkQuery) Aggregate(fns ...AggregateFunc) *ChunkSelect
- func (cq *ChunkQuery) All(ctx context.Context) ([]*Chunk, error)
- func (cq *ChunkQuery) AllX(ctx context.Context) []*Chunk
- func (cq *ChunkQuery) Clone() *ChunkQuery
- func (cq *ChunkQuery) Count(ctx context.Context) (int, error)
- func (cq *ChunkQuery) CountX(ctx context.Context) int
- func (cq *ChunkQuery) Exist(ctx context.Context) (bool, error)
- func (cq *ChunkQuery) ExistX(ctx context.Context) bool
- func (cq *ChunkQuery) First(ctx context.Context) (*Chunk, error)
- func (cq *ChunkQuery) FirstID(ctx context.Context) (id int, err error)
- func (cq *ChunkQuery) FirstIDX(ctx context.Context) int
- func (cq *ChunkQuery) FirstX(ctx context.Context) *Chunk
- func (cq *ChunkQuery) GroupBy(field string, fields ...string) *ChunkGroupBy
- func (cq *ChunkQuery) IDs(ctx context.Context) (ids []int, err error)
- func (cq *ChunkQuery) IDsX(ctx context.Context) []int
- func (cq *ChunkQuery) Limit(limit int) *ChunkQuery
- func (cq *ChunkQuery) Offset(offset int) *ChunkQuery
- func (cq *ChunkQuery) Only(ctx context.Context) (*Chunk, error)
- func (cq *ChunkQuery) OnlyID(ctx context.Context) (id int, err error)
- func (cq *ChunkQuery) OnlyIDX(ctx context.Context) int
- func (cq *ChunkQuery) OnlyX(ctx context.Context) *Chunk
- func (cq *ChunkQuery) Order(o ...chunk.OrderOption) *ChunkQuery
- func (cq *ChunkQuery) QueryEmbedding() *EmbeddingQuery
- func (cq *ChunkQuery) Select(fields ...string) *ChunkSelect
- func (cq *ChunkQuery) Unique(unique bool) *ChunkQuery
- func (cq *ChunkQuery) Where(ps ...predicate.Chunk) *ChunkQuery
- func (cq *ChunkQuery) WithEmbedding(opts ...func(*EmbeddingQuery)) *ChunkQuery
- type ChunkSelect
- func (cs *ChunkSelect) Aggregate(fns ...AggregateFunc) *ChunkSelect
- func (s *ChunkSelect) Bool(ctx context.Context) (_ bool, err error)
- func (s *ChunkSelect) BoolX(ctx context.Context) bool
- func (s *ChunkSelect) Bools(ctx context.Context) ([]bool, error)
- func (s *ChunkSelect) BoolsX(ctx context.Context) []bool
- func (s *ChunkSelect) Float64(ctx context.Context) (_ float64, err error)
- func (s *ChunkSelect) Float64X(ctx context.Context) float64
- func (s *ChunkSelect) Float64s(ctx context.Context) ([]float64, error)
- func (s *ChunkSelect) Float64sX(ctx context.Context) []float64
- func (s *ChunkSelect) Int(ctx context.Context) (_ int, err error)
- func (s *ChunkSelect) IntX(ctx context.Context) int
- func (s *ChunkSelect) Ints(ctx context.Context) ([]int, error)
- func (s *ChunkSelect) IntsX(ctx context.Context) []int
- func (cs *ChunkSelect) Scan(ctx context.Context, v any) error
- func (s *ChunkSelect) ScanX(ctx context.Context, v any)
- func (s *ChunkSelect) String(ctx context.Context) (_ string, err error)
- func (s *ChunkSelect) StringX(ctx context.Context) string
- func (s *ChunkSelect) Strings(ctx context.Context) ([]string, error)
- func (s *ChunkSelect) StringsX(ctx context.Context) []string
- type ChunkUpdate
- func (cu *ChunkUpdate) AddNchunk(i int) *ChunkUpdate
- func (cu *ChunkUpdate) ClearEmbedding() *ChunkUpdate
- func (cu *ChunkUpdate) Exec(ctx context.Context) error
- func (cu *ChunkUpdate) ExecX(ctx context.Context)
- func (cu *ChunkUpdate) Mutation() *ChunkMutation
- func (cu *ChunkUpdate) Save(ctx context.Context) (int, error)
- func (cu *ChunkUpdate) SaveX(ctx context.Context) int
- func (cu *ChunkUpdate) SetData(s string) *ChunkUpdate
- func (cu *ChunkUpdate) SetEmbedding(e *Embedding) *ChunkUpdate
- func (cu *ChunkUpdate) SetEmbeddingID(id int) *ChunkUpdate
- func (cu *ChunkUpdate) SetNchunk(i int) *ChunkUpdate
- func (cu *ChunkUpdate) SetNillableData(s *string) *ChunkUpdate
- func (cu *ChunkUpdate) SetNillableEmbeddingID(id *int) *ChunkUpdate
- func (cu *ChunkUpdate) SetNillableNchunk(i *int) *ChunkUpdate
- func (cu *ChunkUpdate) SetNillablePath(s *string) *ChunkUpdate
- func (cu *ChunkUpdate) SetPath(s string) *ChunkUpdate
- func (cu *ChunkUpdate) Where(ps ...predicate.Chunk) *ChunkUpdate
- type ChunkUpdateOne
- func (cuo *ChunkUpdateOne) AddNchunk(i int) *ChunkUpdateOne
- func (cuo *ChunkUpdateOne) ClearEmbedding() *ChunkUpdateOne
- func (cuo *ChunkUpdateOne) Exec(ctx context.Context) error
- func (cuo *ChunkUpdateOne) ExecX(ctx context.Context)
- func (cuo *ChunkUpdateOne) Mutation() *ChunkMutation
- func (cuo *ChunkUpdateOne) Save(ctx context.Context) (*Chunk, error)
- func (cuo *ChunkUpdateOne) SaveX(ctx context.Context) *Chunk
- func (cuo *ChunkUpdateOne) Select(field string, fields ...string) *ChunkUpdateOne
- func (cuo *ChunkUpdateOne) SetData(s string) *ChunkUpdateOne
- func (cuo *ChunkUpdateOne) SetEmbedding(e *Embedding) *ChunkUpdateOne
- func (cuo *ChunkUpdateOne) SetEmbeddingID(id int) *ChunkUpdateOne
- func (cuo *ChunkUpdateOne) SetNchunk(i int) *ChunkUpdateOne
- func (cuo *ChunkUpdateOne) SetNillableData(s *string) *ChunkUpdateOne
- func (cuo *ChunkUpdateOne) SetNillableEmbeddingID(id *int) *ChunkUpdateOne
- func (cuo *ChunkUpdateOne) SetNillableNchunk(i *int) *ChunkUpdateOne
- func (cuo *ChunkUpdateOne) SetNillablePath(s *string) *ChunkUpdateOne
- func (cuo *ChunkUpdateOne) SetPath(s string) *ChunkUpdateOne
- func (cuo *ChunkUpdateOne) Where(ps ...predicate.Chunk) *ChunkUpdateOne
- type Chunks
- type Client
- func (c *Client) BeginTx(ctx context.Context, opts *sql.TxOptions) (*Tx, error)
- func (c *Client) Close() error
- func (c *Client) Debug() *Client
- func (c *Client) Intercept(interceptors ...Interceptor)
- func (c *Client) Mutate(ctx context.Context, m Mutation) (Value, error)
- func (c *Client) Tx(ctx context.Context) (*Tx, error)
- func (c *Client) Use(hooks ...Hook)
- type CommitFunc
- type CommitHook
- type Committer
- type ConstraintError
- type Embedding
- type EmbeddingClient
- func (c *EmbeddingClient) Create() *EmbeddingCreate
- func (c *EmbeddingClient) CreateBulk(builders ...*EmbeddingCreate) *EmbeddingCreateBulk
- func (c *EmbeddingClient) Delete() *EmbeddingDelete
- func (c *EmbeddingClient) DeleteOne(e *Embedding) *EmbeddingDeleteOne
- func (c *EmbeddingClient) DeleteOneID(id int) *EmbeddingDeleteOne
- func (c *EmbeddingClient) Get(ctx context.Context, id int) (*Embedding, error)
- func (c *EmbeddingClient) GetX(ctx context.Context, id int) *Embedding
- func (c *EmbeddingClient) Hooks() []Hook
- func (c *EmbeddingClient) Intercept(interceptors ...Interceptor)
- func (c *EmbeddingClient) Interceptors() []Interceptor
- func (c *EmbeddingClient) MapCreateBulk(slice any, setFunc func(*EmbeddingCreate, int)) *EmbeddingCreateBulk
- func (c *EmbeddingClient) Query() *EmbeddingQuery
- func (c *EmbeddingClient) QueryChunk(e *Embedding) *ChunkQuery
- func (c *EmbeddingClient) Update() *EmbeddingUpdate
- func (c *EmbeddingClient) UpdateOne(e *Embedding) *EmbeddingUpdateOne
- func (c *EmbeddingClient) UpdateOneID(id int) *EmbeddingUpdateOne
- func (c *EmbeddingClient) Use(hooks ...Hook)
- type EmbeddingCreate
- func (ec *EmbeddingCreate) Exec(ctx context.Context) error
- func (ec *EmbeddingCreate) ExecX(ctx context.Context)
- func (ec *EmbeddingCreate) Mutation() *EmbeddingMutation
- func (ec *EmbeddingCreate) Save(ctx context.Context) (*Embedding, error)
- func (ec *EmbeddingCreate) SaveX(ctx context.Context) *Embedding
- func (ec *EmbeddingCreate) SetChunk(c *Chunk) *EmbeddingCreate
- func (ec *EmbeddingCreate) SetChunkID(id int) *EmbeddingCreate
- func (ec *EmbeddingCreate) SetEmbedding(pg pgvector.Vector) *EmbeddingCreate
- type EmbeddingCreateBulk
- type EmbeddingDelete
- type EmbeddingDeleteOne
- type EmbeddingEdges
- type EmbeddingGroupBy
- func (egb *EmbeddingGroupBy) Aggregate(fns ...AggregateFunc) *EmbeddingGroupBy
- func (s *EmbeddingGroupBy) Bool(ctx context.Context) (_ bool, err error)
- func (s *EmbeddingGroupBy) BoolX(ctx context.Context) bool
- func (s *EmbeddingGroupBy) Bools(ctx context.Context) ([]bool, error)
- func (s *EmbeddingGroupBy) BoolsX(ctx context.Context) []bool
- func (s *EmbeddingGroupBy) Float64(ctx context.Context) (_ float64, err error)
- func (s *EmbeddingGroupBy) Float64X(ctx context.Context) float64
- func (s *EmbeddingGroupBy) Float64s(ctx context.Context) ([]float64, error)
- func (s *EmbeddingGroupBy) Float64sX(ctx context.Context) []float64
- func (s *EmbeddingGroupBy) Int(ctx context.Context) (_ int, err error)
- func (s *EmbeddingGroupBy) IntX(ctx context.Context) int
- func (s *EmbeddingGroupBy) Ints(ctx context.Context) ([]int, error)
- func (s *EmbeddingGroupBy) IntsX(ctx context.Context) []int
- func (egb *EmbeddingGroupBy) Scan(ctx context.Context, v any) error
- func (s *EmbeddingGroupBy) ScanX(ctx context.Context, v any)
- func (s *EmbeddingGroupBy) String(ctx context.Context) (_ string, err error)
- func (s *EmbeddingGroupBy) StringX(ctx context.Context) string
- func (s *EmbeddingGroupBy) Strings(ctx context.Context) ([]string, error)
- func (s *EmbeddingGroupBy) StringsX(ctx context.Context) []string
- type EmbeddingMutation
- func (m *EmbeddingMutation) AddField(name string, value ent.Value) error
- func (m *EmbeddingMutation) AddedEdges() []string
- func (m *EmbeddingMutation) AddedField(name string) (ent.Value, bool)
- func (m *EmbeddingMutation) AddedFields() []string
- func (m *EmbeddingMutation) AddedIDs(name string) []ent.Value
- func (m *EmbeddingMutation) ChunkCleared() bool
- func (m *EmbeddingMutation) ChunkID() (id int, exists bool)
- func (m *EmbeddingMutation) ChunkIDs() (ids []int)
- func (m *EmbeddingMutation) ClearChunk()
- func (m *EmbeddingMutation) ClearEdge(name string) error
- func (m *EmbeddingMutation) ClearField(name string) error
- func (m *EmbeddingMutation) ClearedEdges() []string
- func (m *EmbeddingMutation) ClearedFields() []string
- func (m EmbeddingMutation) Client() *Client
- func (m *EmbeddingMutation) EdgeCleared(name string) bool
- func (m *EmbeddingMutation) Embedding() (r pgvector.Vector, exists bool)
- func (m *EmbeddingMutation) Field(name string) (ent.Value, bool)
- func (m *EmbeddingMutation) FieldCleared(name string) bool
- func (m *EmbeddingMutation) Fields() []string
- func (m *EmbeddingMutation) ID() (id int, exists bool)
- func (m *EmbeddingMutation) IDs(ctx context.Context) ([]int, error)
- func (m *EmbeddingMutation) OldEmbedding(ctx context.Context) (v pgvector.Vector, err error)
- func (m *EmbeddingMutation) OldField(ctx context.Context, name string) (ent.Value, error)
- func (m *EmbeddingMutation) Op() Op
- func (m *EmbeddingMutation) RemovedEdges() []string
- func (m *EmbeddingMutation) RemovedIDs(name string) []ent.Value
- func (m *EmbeddingMutation) ResetChunk()
- func (m *EmbeddingMutation) ResetEdge(name string) error
- func (m *EmbeddingMutation) ResetEmbedding()
- func (m *EmbeddingMutation) ResetField(name string) error
- func (m *EmbeddingMutation) SetChunkID(id int)
- func (m *EmbeddingMutation) SetEmbedding(pg pgvector.Vector)
- func (m *EmbeddingMutation) SetField(name string, value ent.Value) error
- func (m *EmbeddingMutation) SetOp(op Op)
- func (m EmbeddingMutation) Tx() (*Tx, error)
- func (m *EmbeddingMutation) Type() string
- func (m *EmbeddingMutation) Where(ps ...predicate.Embedding)
- func (m *EmbeddingMutation) WhereP(ps ...func(*sql.Selector))
- type EmbeddingQuery
- func (eq *EmbeddingQuery) Aggregate(fns ...AggregateFunc) *EmbeddingSelect
- func (eq *EmbeddingQuery) All(ctx context.Context) ([]*Embedding, error)
- func (eq *EmbeddingQuery) AllX(ctx context.Context) []*Embedding
- func (eq *EmbeddingQuery) Clone() *EmbeddingQuery
- func (eq *EmbeddingQuery) Count(ctx context.Context) (int, error)
- func (eq *EmbeddingQuery) CountX(ctx context.Context) int
- func (eq *EmbeddingQuery) Exist(ctx context.Context) (bool, error)
- func (eq *EmbeddingQuery) ExistX(ctx context.Context) bool
- func (eq *EmbeddingQuery) First(ctx context.Context) (*Embedding, error)
- func (eq *EmbeddingQuery) FirstID(ctx context.Context) (id int, err error)
- func (eq *EmbeddingQuery) FirstIDX(ctx context.Context) int
- func (eq *EmbeddingQuery) FirstX(ctx context.Context) *Embedding
- func (eq *EmbeddingQuery) GroupBy(field string, fields ...string) *EmbeddingGroupBy
- func (eq *EmbeddingQuery) IDs(ctx context.Context) (ids []int, err error)
- func (eq *EmbeddingQuery) IDsX(ctx context.Context) []int
- func (eq *EmbeddingQuery) Limit(limit int) *EmbeddingQuery
- func (eq *EmbeddingQuery) Offset(offset int) *EmbeddingQuery
- func (eq *EmbeddingQuery) Only(ctx context.Context) (*Embedding, error)
- func (eq *EmbeddingQuery) OnlyID(ctx context.Context) (id int, err error)
- func (eq *EmbeddingQuery) OnlyIDX(ctx context.Context) int
- func (eq *EmbeddingQuery) OnlyX(ctx context.Context) *Embedding
- func (eq *EmbeddingQuery) Order(o ...embedding.OrderOption) *EmbeddingQuery
- func (eq *EmbeddingQuery) QueryChunk() *ChunkQuery
- func (eq *EmbeddingQuery) Select(fields ...string) *EmbeddingSelect
- func (eq *EmbeddingQuery) Unique(unique bool) *EmbeddingQuery
- func (eq *EmbeddingQuery) Where(ps ...predicate.Embedding) *EmbeddingQuery
- func (eq *EmbeddingQuery) WithChunk(opts ...func(*ChunkQuery)) *EmbeddingQuery
- type EmbeddingSelect
- func (es *EmbeddingSelect) Aggregate(fns ...AggregateFunc) *EmbeddingSelect
- func (s *EmbeddingSelect) Bool(ctx context.Context) (_ bool, err error)
- func (s *EmbeddingSelect) BoolX(ctx context.Context) bool
- func (s *EmbeddingSelect) Bools(ctx context.Context) ([]bool, error)
- func (s *EmbeddingSelect) BoolsX(ctx context.Context) []bool
- func (s *EmbeddingSelect) Float64(ctx context.Context) (_ float64, err error)
- func (s *EmbeddingSelect) Float64X(ctx context.Context) float64
- func (s *EmbeddingSelect) Float64s(ctx context.Context) ([]float64, error)
- func (s *EmbeddingSelect) Float64sX(ctx context.Context) []float64
- func (s *EmbeddingSelect) Int(ctx context.Context) (_ int, err error)
- func (s *EmbeddingSelect) IntX(ctx context.Context) int
- func (s *EmbeddingSelect) Ints(ctx context.Context) ([]int, error)
- func (s *EmbeddingSelect) IntsX(ctx context.Context) []int
- func (es *EmbeddingSelect) Scan(ctx context.Context, v any) error
- func (s *EmbeddingSelect) ScanX(ctx context.Context, v any)
- func (s *EmbeddingSelect) String(ctx context.Context) (_ string, err error)
- func (s *EmbeddingSelect) StringX(ctx context.Context) string
- func (s *EmbeddingSelect) Strings(ctx context.Context) ([]string, error)
- func (s *EmbeddingSelect) StringsX(ctx context.Context) []string
- type EmbeddingUpdate
- func (eu *EmbeddingUpdate) ClearChunk() *EmbeddingUpdate
- func (eu *EmbeddingUpdate) Exec(ctx context.Context) error
- func (eu *EmbeddingUpdate) ExecX(ctx context.Context)
- func (eu *EmbeddingUpdate) Mutation() *EmbeddingMutation
- func (eu *EmbeddingUpdate) Save(ctx context.Context) (int, error)
- func (eu *EmbeddingUpdate) SaveX(ctx context.Context) int
- func (eu *EmbeddingUpdate) SetChunk(c *Chunk) *EmbeddingUpdate
- func (eu *EmbeddingUpdate) SetChunkID(id int) *EmbeddingUpdate
- func (eu *EmbeddingUpdate) SetEmbedding(pg pgvector.Vector) *EmbeddingUpdate
- func (eu *EmbeddingUpdate) SetNillableEmbedding(pg *pgvector.Vector) *EmbeddingUpdate
- func (eu *EmbeddingUpdate) Where(ps ...predicate.Embedding) *EmbeddingUpdate
- type EmbeddingUpdateOne
- func (euo *EmbeddingUpdateOne) ClearChunk() *EmbeddingUpdateOne
- func (euo *EmbeddingUpdateOne) Exec(ctx context.Context) error
- func (euo *EmbeddingUpdateOne) ExecX(ctx context.Context)
- func (euo *EmbeddingUpdateOne) Mutation() *EmbeddingMutation
- func (euo *EmbeddingUpdateOne) Save(ctx context.Context) (*Embedding, error)
- func (euo *EmbeddingUpdateOne) SaveX(ctx context.Context) *Embedding
- func (euo *EmbeddingUpdateOne) Select(field string, fields ...string) *EmbeddingUpdateOne
- func (euo *EmbeddingUpdateOne) SetChunk(c *Chunk) *EmbeddingUpdateOne
- func (euo *EmbeddingUpdateOne) SetChunkID(id int) *EmbeddingUpdateOne
- func (euo *EmbeddingUpdateOne) SetEmbedding(pg pgvector.Vector) *EmbeddingUpdateOne
- func (euo *EmbeddingUpdateOne) SetNillableEmbedding(pg *pgvector.Vector) *EmbeddingUpdateOne
- func (euo *EmbeddingUpdateOne) Where(ps ...predicate.Embedding) *EmbeddingUpdateOne
- type Embeddings
- type Hook
- type InterceptFunc
- type Interceptor
- type MutateFunc
- type Mutation
- type Mutator
- type NotFoundError
- type NotLoadedError
- type NotSingularError
- type Op
- type Option
- type OrderFunc
- type Policy
- type Querier
- type QuerierFunc
- type Query
- type QueryContext
- type RollbackFunc
- type RollbackHook
- type Rollbacker
- type TraverseFunc
- type Traverser
- type Tx
- type ValidationError
- type Value
Constants ¶
const ( // Operation types. OpCreate = ent.OpCreate OpDelete = ent.OpDelete OpDeleteOne = ent.OpDeleteOne OpUpdate = ent.OpUpdate OpUpdateOne = ent.OpUpdateOne // Node types. TypeChunk = "Chunk" TypeEmbedding = "Embedding" )
Variables ¶
var ErrTxStarted = errors.New("ent: cannot start a transaction within a transaction")
ErrTxStarted is returned when trying to start a new transaction from a transactional client.
Functions ¶
func IsConstraintError ¶
IsConstraintError returns a boolean indicating whether the error is a constraint failure.
func IsNotFound ¶
IsNotFound returns a boolean indicating whether the error is a not found error.
func IsNotLoaded ¶
IsNotLoaded returns a boolean indicating whether the error is a not loaded error.
func IsNotSingular ¶
IsNotSingular returns a boolean indicating whether the error is a not singular error.
func IsValidationError ¶
IsValidationError returns a boolean indicating whether the error is a validation error.
func NewContext ¶
NewContext returns a new context with the given Client attached.
Types ¶
type AggregateFunc ¶
AggregateFunc applies an aggregation step on the group-by traversal/selector.
func As ¶
func As(fn AggregateFunc, end string) AggregateFunc
As is a pseudo aggregation function for renaming another other functions with custom names. For example:
GroupBy(field1, field2). Aggregate(ent.As(ent.Sum(field1), "sum_field1"), (ent.As(ent.Sum(field2), "sum_field2")). Scan(ctx, &v)
func Count ¶
func Count() AggregateFunc
Count applies the "count" aggregation function on each group.
func Max ¶
func Max(field string) AggregateFunc
Max applies the "max" aggregation function on the given field of each group.
func Mean ¶
func Mean(field string) AggregateFunc
Mean applies the "mean" aggregation function on the given field of each group.
func Min ¶
func Min(field string) AggregateFunc
Min applies the "min" aggregation function on the given field of each group.
func Sum ¶
func Sum(field string) AggregateFunc
Sum applies the "sum" aggregation function on the given field of each group.
type 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) Unwrap ¶
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.
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) GetX ¶
func (c *ChunkClient) GetX(ctx context.Context, id int) *Chunk
GetX is like Get, but panics if an error occurs.
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.
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 ¶
Bool returns a single bool from a selector. It is only allowed when selecting one field.
func (*ChunkGroupBy) Bools ¶
Bools returns list of bools from a selector. It is only allowed when selecting one field.
func (*ChunkGroupBy) Float64 ¶
Float64 returns a single float64 from a selector. It is only allowed when selecting one field.
func (*ChunkGroupBy) Float64s ¶
Float64s returns list of float64s from a selector. It is only allowed when selecting one field.
func (*ChunkGroupBy) Int ¶
Int returns a single int from a selector. It is only allowed when selecting one field.
func (*ChunkGroupBy) Ints ¶
Ints returns list of ints from a selector. It is only allowed when selecting one field.
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) String ¶
String returns a single string from a selector. It is only allowed when selecting one field.
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 ¶
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) 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 ¶
Bool returns a single bool from a selector. It is only allowed when selecting one field.
func (*ChunkSelect) Bools ¶
Bools returns list of bools from a selector. It is only allowed when selecting one field.
func (*ChunkSelect) Float64 ¶
Float64 returns a single float64 from a selector. It is only allowed when selecting one field.
func (*ChunkSelect) Float64s ¶
Float64s returns list of float64s from a selector. It is only allowed when selecting one field.
func (*ChunkSelect) Int ¶
Int returns a single int from a selector. It is only allowed when selecting one field.
func (*ChunkSelect) Ints ¶
Ints returns list of ints from a selector. It is only allowed when selecting one field.
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) String ¶
String returns a single string from a selector. It is only allowed when selecting one field.
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 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 ¶
FromContext returns a Client stored inside a context, or nil if there isn't one.
func Open ¶
Open opens a database/sql.DB specified by the driver name and the data source name, and returns a new client attached to it. Optional parameters can be added for configuring the client.
func (*Client) Debug ¶
Debug returns a new debug-client. It's used to get verbose logging on specific operations.
client.Debug(). 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(...)`.
type CommitFunc ¶
The CommitFunc type is an adapter to allow the use of ordinary function as a Committer. If f is a function with the appropriate signature, CommitFunc(f) is a Committer that calls f.
type CommitHook ¶
CommitHook defines the "commit middleware". A function that gets a Committer and returns a Committer. For example:
hook := func(next ent.Committer) ent.Committer { return ent.CommitFunc(func(ctx context.Context, tx *ent.Tx) error { // Do some stuff before. if err := next.Commit(ctx, tx); err != nil { return err } // Do some stuff after. return nil }) }
type ConstraintError ¶
type ConstraintError struct {
// contains filtered or unexported fields
}
ConstraintError returns when trying to create/update one or more entities and one or more of their constraints failed. For example, violation of edge or field uniqueness.
func (ConstraintError) Error ¶
func (e ConstraintError) Error() string
Error implements the error interface.
func (*ConstraintError) Unwrap ¶
func (e *ConstraintError) Unwrap() error
Unwrap implements the errors.Wrapper interface.
type 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) Unwrap ¶
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.
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) 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.
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 ¶
func (ed *EmbeddingDelete) Where(ps ...predicate.Embedding) *EmbeddingDelete
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 ¶
func (edo *EmbeddingDeleteOne) Where(ps ...predicate.Embedding) *EmbeddingDeleteOne
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 ¶
Bool returns a single bool from a selector. It is only allowed when selecting one field.
func (*EmbeddingGroupBy) Bools ¶
Bools returns list of bools from a selector. It is only allowed when selecting one field.
func (*EmbeddingGroupBy) Float64 ¶
Float64 returns a single float64 from a selector. It is only allowed when selecting one field.
func (*EmbeddingGroupBy) Float64s ¶
Float64s returns list of float64s from a selector. It is only allowed when selecting one field.
func (*EmbeddingGroupBy) Int ¶
Int returns a single int from a selector. It is only allowed when selecting one field.
func (*EmbeddingGroupBy) Ints ¶
Ints returns list of ints from a selector. It is only allowed when selecting one field.
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) String ¶
String returns a single string from a selector. It is only allowed when selecting one field.
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 ¶
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 ¶
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) 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 ¶
func (eq *EmbeddingQuery) Order(o ...embedding.OrderOption) *EmbeddingQuery
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 ¶
func (eq *EmbeddingQuery) Where(ps ...predicate.Embedding) *EmbeddingQuery
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 ¶
Bool returns a single bool from a selector. It is only allowed when selecting one field.
func (*EmbeddingSelect) Bools ¶
Bools returns list of bools from a selector. It is only allowed when selecting one field.
func (*EmbeddingSelect) Float64 ¶
Float64 returns a single float64 from a selector. It is only allowed when selecting one field.
func (*EmbeddingSelect) Float64s ¶
Float64s returns list of float64s from a selector. It is only allowed when selecting one field.
func (*EmbeddingSelect) Int ¶
Int returns a single int from a selector. It is only allowed when selecting one field.
func (*EmbeddingSelect) Ints ¶
Ints returns list of ints from a selector. It is only allowed when selecting one field.
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) String ¶
String returns a single string from a selector. It is only allowed when selecting one field.
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 ¶
func (eu *EmbeddingUpdate) Where(ps ...predicate.Embedding) *EmbeddingUpdate
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 ¶
func (euo *EmbeddingUpdateOne) Where(ps ...predicate.Embedding) *EmbeddingUpdateOne
Where appends a list predicates to the EmbeddingUpdate builder.
type InterceptFunc ¶
type InterceptFunc = ent.InterceptFunc
ent aliases to avoid import conflicts in user's code.
type Interceptor ¶
type Interceptor = ent.Interceptor
ent aliases to avoid import conflicts in user's code.
type MutateFunc ¶
type MutateFunc = ent.MutateFunc
ent aliases to avoid import conflicts in user's code.
type NotFoundError ¶
type NotFoundError struct {
// contains filtered or unexported fields
}
NotFoundError returns when trying to fetch a specific entity and it was not found in the database.
func (*NotFoundError) Error ¶
func (e *NotFoundError) Error() string
Error implements the error interface.
type NotLoadedError ¶
type NotLoadedError struct {
// contains filtered or unexported fields
}
NotLoadedError returns when trying to get a node that was not loaded by the query.
func (*NotLoadedError) Error ¶
func (e *NotLoadedError) Error() string
Error implements the error interface.
type NotSingularError ¶
type NotSingularError struct {
// contains filtered or unexported fields
}
NotSingularError returns when trying to fetch a singular entity and more then one was found in the database.
func (*NotSingularError) Error ¶
func (e *NotSingularError) Error() string
Error implements the error interface.
type OrderFunc ¶
OrderFunc applies an ordering on the sql selector. Deprecated: Use Asc/Desc functions or the package builders instead.
type QuerierFunc ¶
type QuerierFunc = ent.QuerierFunc
ent aliases to avoid import conflicts in user's code.
type QueryContext ¶
type QueryContext = ent.QueryContext
ent aliases to avoid import conflicts in user's code.
type RollbackFunc ¶
The RollbackFunc type is an adapter to allow the use of ordinary function as a Rollbacker. If f is a function with the appropriate signature, RollbackFunc(f) is a Rollbacker that calls f.
type RollbackHook ¶
type RollbackHook func(Rollbacker) Rollbacker
RollbackHook defines the "rollback middleware". A function that gets a Rollbacker and returns a Rollbacker. For example:
hook := func(next ent.Rollbacker) ent.Rollbacker { return ent.RollbackFunc(func(ctx context.Context, tx *ent.Tx) error { // Do some stuff before. if err := next.Rollback(ctx, tx); err != nil { return err } // Do some stuff after. return nil }) }
type Rollbacker ¶
Rollbacker is the interface that wraps the Rollback method.
type TraverseFunc ¶
type TraverseFunc = ent.TraverseFunc
ent aliases to avoid import conflicts in user's code.
type Tx ¶
type Tx struct { // 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 ¶
TxFromContext returns a Tx stored inside a context, or nil if there isn't one.
func (*Tx) OnRollback ¶
func (tx *Tx) OnRollback(f RollbackHook)
OnRollback adds a hook to call on rollback.
type ValidationError ¶
type ValidationError struct { Name string // Field or edge name. // contains filtered or unexported fields }
ValidationError returns when validating a field or edge fails.
func (*ValidationError) Error ¶
func (e *ValidationError) Error() string
Error implements the error interface.
func (*ValidationError) Unwrap ¶
func (e *ValidationError) Unwrap() error
Unwrap implements the errors.Wrapper interface.