ent

package
v0.0.0-...-b336c4c Latest Latest
Warning

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

Go to latest
Published: May 5, 2023 License: MIT 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.
	TypeChatConfig  = "ChatConfig"
	TypeChatHistory = "ChatHistory"
	TypeOpenAIToken = "OpenAIToken"
)

Variables

This section is empty.

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 ChatConfig

type ChatConfig struct {

	// ID of the ent.
	ID int `json:"id,omitempty"`
	// ChatID holds the value of the "chat_id" field.
	ChatID int64 `json:"chat_id,omitempty"`
	// JSON holds the value of the "json" field.
	JSON string `json:"json,omitempty"`
	// contains filtered or unexported fields
}

ChatConfig is the model entity for the ChatConfig schema.

func (*ChatConfig) String

func (cc *ChatConfig) String() string

String implements the fmt.Stringer.

func (*ChatConfig) Unwrap

func (cc *ChatConfig) Unwrap() *ChatConfig

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

func (cc *ChatConfig) Update() *ChatConfigUpdateOne

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

func (*ChatConfig) Value

func (cc *ChatConfig) Value(name string) (ent.Value, error)

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

type ChatConfigClient

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

ChatConfigClient is a client for the ChatConfig schema.

func NewChatConfigClient

func NewChatConfigClient(c config) *ChatConfigClient

NewChatConfigClient returns a client for the ChatConfig from the given config.

func (*ChatConfigClient) Create

func (c *ChatConfigClient) Create() *ChatConfigCreate

Create returns a builder for creating a ChatConfig entity.

func (*ChatConfigClient) CreateBulk

func (c *ChatConfigClient) CreateBulk(builders ...*ChatConfigCreate) *ChatConfigCreateBulk

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

func (*ChatConfigClient) Delete

func (c *ChatConfigClient) Delete() *ChatConfigDelete

Delete returns a delete builder for ChatConfig.

func (*ChatConfigClient) DeleteOne

func (c *ChatConfigClient) DeleteOne(cc *ChatConfig) *ChatConfigDeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*ChatConfigClient) DeleteOneID

func (c *ChatConfigClient) DeleteOneID(id int) *ChatConfigDeleteOne

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

func (*ChatConfigClient) Get

func (c *ChatConfigClient) Get(ctx context.Context, id int) (*ChatConfig, error)

Get returns a ChatConfig entity by its id.

func (*ChatConfigClient) GetX

func (c *ChatConfigClient) GetX(ctx context.Context, id int) *ChatConfig

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

func (*ChatConfigClient) Hooks

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

Hooks returns the client hooks.

func (*ChatConfigClient) Intercept

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

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

func (*ChatConfigClient) Interceptors

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

Interceptors returns the client interceptors.

func (*ChatConfigClient) Query

func (c *ChatConfigClient) Query() *ChatConfigQuery

Query returns a query builder for ChatConfig.

func (*ChatConfigClient) Update

func (c *ChatConfigClient) Update() *ChatConfigUpdate

Update returns an update builder for ChatConfig.

func (*ChatConfigClient) UpdateOne

func (c *ChatConfigClient) UpdateOne(cc *ChatConfig) *ChatConfigUpdateOne

UpdateOne returns an update builder for the given entity.

func (*ChatConfigClient) UpdateOneID

func (c *ChatConfigClient) UpdateOneID(id int) *ChatConfigUpdateOne

UpdateOneID returns an update builder for the given id.

func (*ChatConfigClient) Use

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

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

type ChatConfigCreate

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

ChatConfigCreate is the builder for creating a ChatConfig entity.

func (*ChatConfigCreate) Exec

func (ccc *ChatConfigCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*ChatConfigCreate) ExecX

func (ccc *ChatConfigCreate) ExecX(ctx context.Context)

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

func (*ChatConfigCreate) Mutation

func (ccc *ChatConfigCreate) Mutation() *ChatConfigMutation

Mutation returns the ChatConfigMutation object of the builder.

func (*ChatConfigCreate) Save

func (ccc *ChatConfigCreate) Save(ctx context.Context) (*ChatConfig, error)

Save creates the ChatConfig in the database.

func (*ChatConfigCreate) SaveX

func (ccc *ChatConfigCreate) SaveX(ctx context.Context) *ChatConfig

SaveX calls Save and panics if Save returns an error.

func (*ChatConfigCreate) SetChatID

func (ccc *ChatConfigCreate) SetChatID(i int64) *ChatConfigCreate

SetChatID sets the "chat_id" field.

func (*ChatConfigCreate) SetJSON

func (ccc *ChatConfigCreate) SetJSON(s string) *ChatConfigCreate

SetJSON sets the "json" field.

type ChatConfigCreateBulk

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

ChatConfigCreateBulk is the builder for creating many ChatConfig entities in bulk.

func (*ChatConfigCreateBulk) Exec

func (cccb *ChatConfigCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*ChatConfigCreateBulk) ExecX

func (cccb *ChatConfigCreateBulk) ExecX(ctx context.Context)

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

func (*ChatConfigCreateBulk) Save

func (cccb *ChatConfigCreateBulk) Save(ctx context.Context) ([]*ChatConfig, error)

Save creates the ChatConfig entities in the database.

func (*ChatConfigCreateBulk) SaveX

func (cccb *ChatConfigCreateBulk) SaveX(ctx context.Context) []*ChatConfig

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

type ChatConfigDelete

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

ChatConfigDelete is the builder for deleting a ChatConfig entity.

func (*ChatConfigDelete) Exec

func (ccd *ChatConfigDelete) Exec(ctx context.Context) (int, error)

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

func (*ChatConfigDelete) ExecX

func (ccd *ChatConfigDelete) ExecX(ctx context.Context) int

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

func (*ChatConfigDelete) Where

Where appends a list predicates to the ChatConfigDelete builder.

type ChatConfigDeleteOne

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

ChatConfigDeleteOne is the builder for deleting a single ChatConfig entity.

func (*ChatConfigDeleteOne) Exec

func (ccdo *ChatConfigDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*ChatConfigDeleteOne) ExecX

func (ccdo *ChatConfigDeleteOne) ExecX(ctx context.Context)

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

func (*ChatConfigDeleteOne) Where

Where appends a list predicates to the ChatConfigDelete builder.

type ChatConfigGroupBy

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

ChatConfigGroupBy is the group-by builder for ChatConfig entities.

func (*ChatConfigGroupBy) Aggregate

func (ccgb *ChatConfigGroupBy) Aggregate(fns ...AggregateFunc) *ChatConfigGroupBy

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

func (*ChatConfigGroupBy) Bool

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

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

func (*ChatConfigGroupBy) BoolX

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

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

func (*ChatConfigGroupBy) Bools

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

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

func (*ChatConfigGroupBy) BoolsX

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

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

func (*ChatConfigGroupBy) Float64

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

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

func (*ChatConfigGroupBy) Float64X

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

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

func (*ChatConfigGroupBy) Float64s

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

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

func (*ChatConfigGroupBy) Float64sX

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

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

func (*ChatConfigGroupBy) Int

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

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

func (*ChatConfigGroupBy) IntX

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

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

func (*ChatConfigGroupBy) Ints

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

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

func (*ChatConfigGroupBy) IntsX

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

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

func (*ChatConfigGroupBy) Scan

func (ccgb *ChatConfigGroupBy) Scan(ctx context.Context, v any) error

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

func (*ChatConfigGroupBy) ScanX

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

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

func (*ChatConfigGroupBy) String

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

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

func (*ChatConfigGroupBy) StringX

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

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

func (*ChatConfigGroupBy) Strings

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

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

func (*ChatConfigGroupBy) StringsX

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

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

type ChatConfigMutation

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

ChatConfigMutation represents an operation that mutates the ChatConfig nodes in the graph.

func (*ChatConfigMutation) AddChatID

func (m *ChatConfigMutation) AddChatID(i int64)

AddChatID adds i to the "chat_id" field.

func (*ChatConfigMutation) AddField

func (m *ChatConfigMutation) 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 (*ChatConfigMutation) AddedChatID

func (m *ChatConfigMutation) AddedChatID() (r int64, exists bool)

AddedChatID returns the value that was added to the "chat_id" field in this mutation.

func (*ChatConfigMutation) AddedEdges

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

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

func (*ChatConfigMutation) AddedField

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

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

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

func (*ChatConfigMutation) AddedIDs

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

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

func (*ChatConfigMutation) ChatID

func (m *ChatConfigMutation) ChatID() (r int64, exists bool)

ChatID returns the value of the "chat_id" field in the mutation.

func (*ChatConfigMutation) ClearEdge

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

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

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

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

func (*ChatConfigMutation) ClearedFields

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

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

func (ChatConfigMutation) Client

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

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

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

func (*ChatConfigMutation) Field

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

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

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

func (*ChatConfigMutation) Fields

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

func (m *ChatConfigMutation) 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 (*ChatConfigMutation) IDs

func (m *ChatConfigMutation) 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 (*ChatConfigMutation) JSON

func (m *ChatConfigMutation) JSON() (r string, exists bool)

JSON returns the value of the "json" field in the mutation.

func (*ChatConfigMutation) OldChatID

func (m *ChatConfigMutation) OldChatID(ctx context.Context) (v int64, err error)

OldChatID returns the old "chat_id" field's value of the ChatConfig entity. If the ChatConfig 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 (*ChatConfigMutation) OldField

func (m *ChatConfigMutation) 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 (*ChatConfigMutation) OldJSON

func (m *ChatConfigMutation) OldJSON(ctx context.Context) (v string, err error)

OldJSON returns the old "json" field's value of the ChatConfig entity. If the ChatConfig 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 (*ChatConfigMutation) Op

func (m *ChatConfigMutation) Op() Op

Op returns the operation name.

func (*ChatConfigMutation) RemovedEdges

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

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

func (*ChatConfigMutation) RemovedIDs

func (m *ChatConfigMutation) 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 (*ChatConfigMutation) ResetChatID

func (m *ChatConfigMutation) ResetChatID()

ResetChatID resets all changes to the "chat_id" field.

func (*ChatConfigMutation) ResetEdge

func (m *ChatConfigMutation) 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 (*ChatConfigMutation) ResetField

func (m *ChatConfigMutation) 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 (*ChatConfigMutation) ResetJSON

func (m *ChatConfigMutation) ResetJSON()

ResetJSON resets all changes to the "json" field.

func (*ChatConfigMutation) SetChatID

func (m *ChatConfigMutation) SetChatID(i int64)

SetChatID sets the "chat_id" field.

func (*ChatConfigMutation) SetField

func (m *ChatConfigMutation) 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 (*ChatConfigMutation) SetJSON

func (m *ChatConfigMutation) SetJSON(s string)

SetJSON sets the "json" field.

func (*ChatConfigMutation) SetOp

func (m *ChatConfigMutation) SetOp(op Op)

SetOp allows setting the mutation operation.

func (ChatConfigMutation) Tx

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

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

func (*ChatConfigMutation) Type

func (m *ChatConfigMutation) Type() string

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

func (*ChatConfigMutation) Where

func (m *ChatConfigMutation) Where(ps ...predicate.ChatConfig)

Where appends a list predicates to the ChatConfigMutation builder.

func (*ChatConfigMutation) WhereP

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

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

type ChatConfigQuery

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

ChatConfigQuery is the builder for querying ChatConfig entities.

func (*ChatConfigQuery) Aggregate

func (ccq *ChatConfigQuery) Aggregate(fns ...AggregateFunc) *ChatConfigSelect

Aggregate returns a ChatConfigSelect configured with the given aggregations.

func (*ChatConfigQuery) All

func (ccq *ChatConfigQuery) All(ctx context.Context) ([]*ChatConfig, error)

All executes the query and returns a list of ChatConfigs.

func (*ChatConfigQuery) AllX

func (ccq *ChatConfigQuery) AllX(ctx context.Context) []*ChatConfig

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

func (*ChatConfigQuery) Clone

func (ccq *ChatConfigQuery) Clone() *ChatConfigQuery

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

func (*ChatConfigQuery) Count

func (ccq *ChatConfigQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*ChatConfigQuery) CountX

func (ccq *ChatConfigQuery) CountX(ctx context.Context) int

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

func (*ChatConfigQuery) Exist

func (ccq *ChatConfigQuery) Exist(ctx context.Context) (bool, error)

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

func (*ChatConfigQuery) ExistX

func (ccq *ChatConfigQuery) ExistX(ctx context.Context) bool

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

func (*ChatConfigQuery) First

func (ccq *ChatConfigQuery) First(ctx context.Context) (*ChatConfig, error)

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

func (*ChatConfigQuery) FirstID

func (ccq *ChatConfigQuery) FirstID(ctx context.Context) (id int, err error)

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

func (*ChatConfigQuery) FirstIDX

func (ccq *ChatConfigQuery) FirstIDX(ctx context.Context) int

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

func (*ChatConfigQuery) FirstX

func (ccq *ChatConfigQuery) FirstX(ctx context.Context) *ChatConfig

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

func (*ChatConfigQuery) GroupBy

func (ccq *ChatConfigQuery) GroupBy(field string, fields ...string) *ChatConfigGroupBy

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 {
	ChatID int64 `json:"chat_id,omitempty"`
	Count int `json:"count,omitempty"`
}

client.ChatConfig.Query().
	GroupBy(chatconfig.FieldChatID).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*ChatConfigQuery) IDs

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

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

func (*ChatConfigQuery) IDsX

func (ccq *ChatConfigQuery) IDsX(ctx context.Context) []int

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

func (*ChatConfigQuery) Limit

func (ccq *ChatConfigQuery) Limit(limit int) *ChatConfigQuery

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

func (*ChatConfigQuery) Offset

func (ccq *ChatConfigQuery) Offset(offset int) *ChatConfigQuery

Offset to start from.

func (*ChatConfigQuery) Only

func (ccq *ChatConfigQuery) Only(ctx context.Context) (*ChatConfig, error)

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

func (*ChatConfigQuery) OnlyID

func (ccq *ChatConfigQuery) OnlyID(ctx context.Context) (id int, err error)

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

func (*ChatConfigQuery) OnlyIDX

func (ccq *ChatConfigQuery) OnlyIDX(ctx context.Context) int

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

func (*ChatConfigQuery) OnlyX

func (ccq *ChatConfigQuery) OnlyX(ctx context.Context) *ChatConfig

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

func (*ChatConfigQuery) Order

Order specifies how the records should be ordered.

func (*ChatConfigQuery) Select

func (ccq *ChatConfigQuery) Select(fields ...string) *ChatConfigSelect

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 {
	ChatID int64 `json:"chat_id,omitempty"`
}

client.ChatConfig.Query().
	Select(chatconfig.FieldChatID).
	Scan(ctx, &v)

func (*ChatConfigQuery) Unique

func (ccq *ChatConfigQuery) Unique(unique bool) *ChatConfigQuery

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

Where adds a new predicate for the ChatConfigQuery builder.

type ChatConfigSelect

type ChatConfigSelect struct {
	*ChatConfigQuery
	// contains filtered or unexported fields
}

ChatConfigSelect is the builder for selecting fields of ChatConfig entities.

func (*ChatConfigSelect) Aggregate

func (ccs *ChatConfigSelect) Aggregate(fns ...AggregateFunc) *ChatConfigSelect

Aggregate adds the given aggregation functions to the selector query.

func (*ChatConfigSelect) Bool

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

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

func (*ChatConfigSelect) BoolX

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

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

func (*ChatConfigSelect) Bools

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

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

func (*ChatConfigSelect) BoolsX

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

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

func (*ChatConfigSelect) Float64

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

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

func (*ChatConfigSelect) Float64X

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

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

func (*ChatConfigSelect) Float64s

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

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

func (*ChatConfigSelect) Float64sX

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

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

func (*ChatConfigSelect) Int

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

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

func (*ChatConfigSelect) IntX

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

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

func (*ChatConfigSelect) Ints

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

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

func (*ChatConfigSelect) IntsX

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

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

func (*ChatConfigSelect) Scan

func (ccs *ChatConfigSelect) Scan(ctx context.Context, v any) error

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

func (*ChatConfigSelect) ScanX

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

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

func (*ChatConfigSelect) String

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

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

func (*ChatConfigSelect) StringX

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

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

func (*ChatConfigSelect) Strings

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

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

func (*ChatConfigSelect) StringsX

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

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

type ChatConfigUpdate

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

ChatConfigUpdate is the builder for updating ChatConfig entities.

func (*ChatConfigUpdate) AddChatID

func (ccu *ChatConfigUpdate) AddChatID(i int64) *ChatConfigUpdate

AddChatID adds i to the "chat_id" field.

func (*ChatConfigUpdate) Exec

func (ccu *ChatConfigUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*ChatConfigUpdate) ExecX

func (ccu *ChatConfigUpdate) ExecX(ctx context.Context)

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

func (*ChatConfigUpdate) Mutation

func (ccu *ChatConfigUpdate) Mutation() *ChatConfigMutation

Mutation returns the ChatConfigMutation object of the builder.

func (*ChatConfigUpdate) Save

func (ccu *ChatConfigUpdate) Save(ctx context.Context) (int, error)

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

func (*ChatConfigUpdate) SaveX

func (ccu *ChatConfigUpdate) SaveX(ctx context.Context) int

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

func (*ChatConfigUpdate) SetChatID

func (ccu *ChatConfigUpdate) SetChatID(i int64) *ChatConfigUpdate

SetChatID sets the "chat_id" field.

func (*ChatConfigUpdate) SetJSON

func (ccu *ChatConfigUpdate) SetJSON(s string) *ChatConfigUpdate

SetJSON sets the "json" field.

func (*ChatConfigUpdate) Where

Where appends a list predicates to the ChatConfigUpdate builder.

type ChatConfigUpdateOne

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

ChatConfigUpdateOne is the builder for updating a single ChatConfig entity.

func (*ChatConfigUpdateOne) AddChatID

func (ccuo *ChatConfigUpdateOne) AddChatID(i int64) *ChatConfigUpdateOne

AddChatID adds i to the "chat_id" field.

func (*ChatConfigUpdateOne) Exec

func (ccuo *ChatConfigUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*ChatConfigUpdateOne) ExecX

func (ccuo *ChatConfigUpdateOne) ExecX(ctx context.Context)

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

func (*ChatConfigUpdateOne) Mutation

func (ccuo *ChatConfigUpdateOne) Mutation() *ChatConfigMutation

Mutation returns the ChatConfigMutation object of the builder.

func (*ChatConfigUpdateOne) Save

func (ccuo *ChatConfigUpdateOne) Save(ctx context.Context) (*ChatConfig, error)

Save executes the query and returns the updated ChatConfig entity.

func (*ChatConfigUpdateOne) SaveX

func (ccuo *ChatConfigUpdateOne) SaveX(ctx context.Context) *ChatConfig

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

func (*ChatConfigUpdateOne) Select

func (ccuo *ChatConfigUpdateOne) Select(field string, fields ...string) *ChatConfigUpdateOne

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

func (*ChatConfigUpdateOne) SetChatID

func (ccuo *ChatConfigUpdateOne) SetChatID(i int64) *ChatConfigUpdateOne

SetChatID sets the "chat_id" field.

func (*ChatConfigUpdateOne) SetJSON

SetJSON sets the "json" field.

func (*ChatConfigUpdateOne) Where

Where appends a list predicates to the ChatConfigUpdate builder.

type ChatConfigs

type ChatConfigs []*ChatConfig

ChatConfigs is a parsable slice of ChatConfig.

type ChatHistories

type ChatHistories []*ChatHistory

ChatHistories is a parsable slice of ChatHistory.

type ChatHistory

type ChatHistory struct {

	// ID of the ent.
	ID int `json:"id,omitempty"`
	// ChatID holds the value of the "chat_id" field.
	ChatID int64 `json:"chat_id,omitempty"`
	// Content holds the value of the "content" field.
	Content string `json:"content,omitempty"`
	// contains filtered or unexported fields
}

ChatHistory is the model entity for the ChatHistory schema.

func (*ChatHistory) String

func (ch *ChatHistory) String() string

String implements the fmt.Stringer.

func (*ChatHistory) Unwrap

func (ch *ChatHistory) Unwrap() *ChatHistory

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

func (ch *ChatHistory) Update() *ChatHistoryUpdateOne

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

func (*ChatHistory) Value

func (ch *ChatHistory) Value(name string) (ent.Value, error)

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

type ChatHistoryClient

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

ChatHistoryClient is a client for the ChatHistory schema.

func NewChatHistoryClient

func NewChatHistoryClient(c config) *ChatHistoryClient

NewChatHistoryClient returns a client for the ChatHistory from the given config.

func (*ChatHistoryClient) Create

func (c *ChatHistoryClient) Create() *ChatHistoryCreate

Create returns a builder for creating a ChatHistory entity.

func (*ChatHistoryClient) CreateBulk

func (c *ChatHistoryClient) CreateBulk(builders ...*ChatHistoryCreate) *ChatHistoryCreateBulk

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

func (*ChatHistoryClient) Delete

func (c *ChatHistoryClient) Delete() *ChatHistoryDelete

Delete returns a delete builder for ChatHistory.

func (*ChatHistoryClient) DeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*ChatHistoryClient) DeleteOneID

func (c *ChatHistoryClient) DeleteOneID(id int) *ChatHistoryDeleteOne

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

func (*ChatHistoryClient) Get

func (c *ChatHistoryClient) Get(ctx context.Context, id int) (*ChatHistory, error)

Get returns a ChatHistory entity by its id.

func (*ChatHistoryClient) GetX

func (c *ChatHistoryClient) GetX(ctx context.Context, id int) *ChatHistory

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

func (*ChatHistoryClient) Hooks

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

Hooks returns the client hooks.

func (*ChatHistoryClient) Intercept

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

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

func (*ChatHistoryClient) Interceptors

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

Interceptors returns the client interceptors.

func (*ChatHistoryClient) Query

func (c *ChatHistoryClient) Query() *ChatHistoryQuery

Query returns a query builder for ChatHistory.

func (*ChatHistoryClient) Update

func (c *ChatHistoryClient) Update() *ChatHistoryUpdate

Update returns an update builder for ChatHistory.

func (*ChatHistoryClient) UpdateOne

UpdateOne returns an update builder for the given entity.

func (*ChatHistoryClient) UpdateOneID

func (c *ChatHistoryClient) UpdateOneID(id int) *ChatHistoryUpdateOne

UpdateOneID returns an update builder for the given id.

func (*ChatHistoryClient) Use

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

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

type ChatHistoryCreate

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

ChatHistoryCreate is the builder for creating a ChatHistory entity.

func (*ChatHistoryCreate) Exec

func (chc *ChatHistoryCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*ChatHistoryCreate) ExecX

func (chc *ChatHistoryCreate) ExecX(ctx context.Context)

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

func (*ChatHistoryCreate) Mutation

func (chc *ChatHistoryCreate) Mutation() *ChatHistoryMutation

Mutation returns the ChatHistoryMutation object of the builder.

func (*ChatHistoryCreate) Save

func (chc *ChatHistoryCreate) Save(ctx context.Context) (*ChatHistory, error)

Save creates the ChatHistory in the database.

func (*ChatHistoryCreate) SaveX

func (chc *ChatHistoryCreate) SaveX(ctx context.Context) *ChatHistory

SaveX calls Save and panics if Save returns an error.

func (*ChatHistoryCreate) SetChatID

func (chc *ChatHistoryCreate) SetChatID(i int64) *ChatHistoryCreate

SetChatID sets the "chat_id" field.

func (*ChatHistoryCreate) SetContent

func (chc *ChatHistoryCreate) SetContent(s string) *ChatHistoryCreate

SetContent sets the "content" field.

type ChatHistoryCreateBulk

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

ChatHistoryCreateBulk is the builder for creating many ChatHistory entities in bulk.

func (*ChatHistoryCreateBulk) Exec

func (chcb *ChatHistoryCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*ChatHistoryCreateBulk) ExecX

func (chcb *ChatHistoryCreateBulk) ExecX(ctx context.Context)

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

func (*ChatHistoryCreateBulk) Save

func (chcb *ChatHistoryCreateBulk) Save(ctx context.Context) ([]*ChatHistory, error)

Save creates the ChatHistory entities in the database.

func (*ChatHistoryCreateBulk) SaveX

func (chcb *ChatHistoryCreateBulk) SaveX(ctx context.Context) []*ChatHistory

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

type ChatHistoryDelete

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

ChatHistoryDelete is the builder for deleting a ChatHistory entity.

func (*ChatHistoryDelete) Exec

func (chd *ChatHistoryDelete) Exec(ctx context.Context) (int, error)

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

func (*ChatHistoryDelete) ExecX

func (chd *ChatHistoryDelete) ExecX(ctx context.Context) int

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

func (*ChatHistoryDelete) Where

Where appends a list predicates to the ChatHistoryDelete builder.

type ChatHistoryDeleteOne

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

ChatHistoryDeleteOne is the builder for deleting a single ChatHistory entity.

func (*ChatHistoryDeleteOne) Exec

func (chdo *ChatHistoryDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*ChatHistoryDeleteOne) ExecX

func (chdo *ChatHistoryDeleteOne) ExecX(ctx context.Context)

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

func (*ChatHistoryDeleteOne) Where

Where appends a list predicates to the ChatHistoryDelete builder.

type ChatHistoryGroupBy

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

ChatHistoryGroupBy is the group-by builder for ChatHistory entities.

func (*ChatHistoryGroupBy) Aggregate

func (chgb *ChatHistoryGroupBy) Aggregate(fns ...AggregateFunc) *ChatHistoryGroupBy

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

func (*ChatHistoryGroupBy) Bool

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

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

func (*ChatHistoryGroupBy) BoolX

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

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

func (*ChatHistoryGroupBy) Bools

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

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

func (*ChatHistoryGroupBy) BoolsX

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

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

func (*ChatHistoryGroupBy) Float64

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

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

func (*ChatHistoryGroupBy) Float64X

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

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

func (*ChatHistoryGroupBy) Float64s

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

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

func (*ChatHistoryGroupBy) Float64sX

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

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

func (*ChatHistoryGroupBy) Int

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

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

func (*ChatHistoryGroupBy) IntX

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

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

func (*ChatHistoryGroupBy) Ints

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

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

func (*ChatHistoryGroupBy) IntsX

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

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

func (*ChatHistoryGroupBy) Scan

func (chgb *ChatHistoryGroupBy) Scan(ctx context.Context, v any) error

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

func (*ChatHistoryGroupBy) ScanX

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

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

func (*ChatHistoryGroupBy) String

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

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

func (*ChatHistoryGroupBy) StringX

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

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

func (*ChatHistoryGroupBy) Strings

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

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

func (*ChatHistoryGroupBy) StringsX

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

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

type ChatHistoryMutation

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

ChatHistoryMutation represents an operation that mutates the ChatHistory nodes in the graph.

func (*ChatHistoryMutation) AddChatID

func (m *ChatHistoryMutation) AddChatID(i int64)

AddChatID adds i to the "chat_id" field.

func (*ChatHistoryMutation) AddField

func (m *ChatHistoryMutation) 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 (*ChatHistoryMutation) AddedChatID

func (m *ChatHistoryMutation) AddedChatID() (r int64, exists bool)

AddedChatID returns the value that was added to the "chat_id" field in this mutation.

func (*ChatHistoryMutation) AddedEdges

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

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

func (*ChatHistoryMutation) AddedField

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

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

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

func (*ChatHistoryMutation) AddedIDs

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

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

func (*ChatHistoryMutation) ChatID

func (m *ChatHistoryMutation) ChatID() (r int64, exists bool)

ChatID returns the value of the "chat_id" field in the mutation.

func (*ChatHistoryMutation) ClearEdge

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

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

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

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

func (*ChatHistoryMutation) ClearedFields

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

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

func (ChatHistoryMutation) Client

func (m ChatHistoryMutation) 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 (*ChatHistoryMutation) Content

func (m *ChatHistoryMutation) Content() (r string, exists bool)

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

func (*ChatHistoryMutation) EdgeCleared

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

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

func (*ChatHistoryMutation) Field

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

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

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

func (*ChatHistoryMutation) Fields

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

func (m *ChatHistoryMutation) 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 (*ChatHistoryMutation) IDs

func (m *ChatHistoryMutation) 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 (*ChatHistoryMutation) OldChatID

func (m *ChatHistoryMutation) OldChatID(ctx context.Context) (v int64, err error)

OldChatID returns the old "chat_id" field's value of the ChatHistory entity. If the ChatHistory 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 (*ChatHistoryMutation) OldContent

func (m *ChatHistoryMutation) OldContent(ctx context.Context) (v string, err error)

OldContent returns the old "content" field's value of the ChatHistory entity. If the ChatHistory 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 (*ChatHistoryMutation) OldField

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

func (m *ChatHistoryMutation) Op() Op

Op returns the operation name.

func (*ChatHistoryMutation) RemovedEdges

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

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

func (*ChatHistoryMutation) RemovedIDs

func (m *ChatHistoryMutation) 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 (*ChatHistoryMutation) ResetChatID

func (m *ChatHistoryMutation) ResetChatID()

ResetChatID resets all changes to the "chat_id" field.

func (*ChatHistoryMutation) ResetContent

func (m *ChatHistoryMutation) ResetContent()

ResetContent resets all changes to the "content" field.

func (*ChatHistoryMutation) ResetEdge

func (m *ChatHistoryMutation) 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 (*ChatHistoryMutation) ResetField

func (m *ChatHistoryMutation) 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 (*ChatHistoryMutation) SetChatID

func (m *ChatHistoryMutation) SetChatID(i int64)

SetChatID sets the "chat_id" field.

func (*ChatHistoryMutation) SetContent

func (m *ChatHistoryMutation) SetContent(s string)

SetContent sets the "content" field.

func (*ChatHistoryMutation) SetField

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

func (m *ChatHistoryMutation) SetOp(op Op)

SetOp allows setting the mutation operation.

func (ChatHistoryMutation) Tx

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

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

func (*ChatHistoryMutation) Type

func (m *ChatHistoryMutation) Type() string

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

func (*ChatHistoryMutation) Where

func (m *ChatHistoryMutation) Where(ps ...predicate.ChatHistory)

Where appends a list predicates to the ChatHistoryMutation builder.

func (*ChatHistoryMutation) WhereP

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

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

type ChatHistoryQuery

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

ChatHistoryQuery is the builder for querying ChatHistory entities.

func (*ChatHistoryQuery) Aggregate

func (chq *ChatHistoryQuery) Aggregate(fns ...AggregateFunc) *ChatHistorySelect

Aggregate returns a ChatHistorySelect configured with the given aggregations.

func (*ChatHistoryQuery) All

func (chq *ChatHistoryQuery) All(ctx context.Context) ([]*ChatHistory, error)

All executes the query and returns a list of ChatHistories.

func (*ChatHistoryQuery) AllX

func (chq *ChatHistoryQuery) AllX(ctx context.Context) []*ChatHistory

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

func (*ChatHistoryQuery) Clone

func (chq *ChatHistoryQuery) Clone() *ChatHistoryQuery

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

func (*ChatHistoryQuery) Count

func (chq *ChatHistoryQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*ChatHistoryQuery) CountX

func (chq *ChatHistoryQuery) CountX(ctx context.Context) int

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

func (*ChatHistoryQuery) Exist

func (chq *ChatHistoryQuery) Exist(ctx context.Context) (bool, error)

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

func (*ChatHistoryQuery) ExistX

func (chq *ChatHistoryQuery) ExistX(ctx context.Context) bool

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

func (*ChatHistoryQuery) First

func (chq *ChatHistoryQuery) First(ctx context.Context) (*ChatHistory, error)

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

func (*ChatHistoryQuery) FirstID

func (chq *ChatHistoryQuery) FirstID(ctx context.Context) (id int, err error)

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

func (*ChatHistoryQuery) FirstIDX

func (chq *ChatHistoryQuery) FirstIDX(ctx context.Context) int

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

func (*ChatHistoryQuery) FirstX

func (chq *ChatHistoryQuery) FirstX(ctx context.Context) *ChatHistory

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

func (*ChatHistoryQuery) GroupBy

func (chq *ChatHistoryQuery) GroupBy(field string, fields ...string) *ChatHistoryGroupBy

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 {
	ChatID int64 `json:"chat_id,omitempty"`
	Count int `json:"count,omitempty"`
}

client.ChatHistory.Query().
	GroupBy(chathistory.FieldChatID).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*ChatHistoryQuery) IDs

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

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

func (*ChatHistoryQuery) IDsX

func (chq *ChatHistoryQuery) IDsX(ctx context.Context) []int

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

func (*ChatHistoryQuery) Limit

func (chq *ChatHistoryQuery) Limit(limit int) *ChatHistoryQuery

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

func (*ChatHistoryQuery) Offset

func (chq *ChatHistoryQuery) Offset(offset int) *ChatHistoryQuery

Offset to start from.

func (*ChatHistoryQuery) Only

func (chq *ChatHistoryQuery) Only(ctx context.Context) (*ChatHistory, error)

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

func (*ChatHistoryQuery) OnlyID

func (chq *ChatHistoryQuery) OnlyID(ctx context.Context) (id int, err error)

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

func (*ChatHistoryQuery) OnlyIDX

func (chq *ChatHistoryQuery) OnlyIDX(ctx context.Context) int

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

func (*ChatHistoryQuery) OnlyX

func (chq *ChatHistoryQuery) OnlyX(ctx context.Context) *ChatHistory

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

func (*ChatHistoryQuery) Order

Order specifies how the records should be ordered.

func (*ChatHistoryQuery) Select

func (chq *ChatHistoryQuery) Select(fields ...string) *ChatHistorySelect

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 {
	ChatID int64 `json:"chat_id,omitempty"`
}

client.ChatHistory.Query().
	Select(chathistory.FieldChatID).
	Scan(ctx, &v)

func (*ChatHistoryQuery) Unique

func (chq *ChatHistoryQuery) Unique(unique bool) *ChatHistoryQuery

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

Where adds a new predicate for the ChatHistoryQuery builder.

type ChatHistorySelect

type ChatHistorySelect struct {
	*ChatHistoryQuery
	// contains filtered or unexported fields
}

ChatHistorySelect is the builder for selecting fields of ChatHistory entities.

func (*ChatHistorySelect) Aggregate

func (chs *ChatHistorySelect) Aggregate(fns ...AggregateFunc) *ChatHistorySelect

Aggregate adds the given aggregation functions to the selector query.

func (*ChatHistorySelect) Bool

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

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

func (*ChatHistorySelect) BoolX

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

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

func (*ChatHistorySelect) Bools

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

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

func (*ChatHistorySelect) BoolsX

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

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

func (*ChatHistorySelect) Float64

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

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

func (*ChatHistorySelect) Float64X

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

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

func (*ChatHistorySelect) Float64s

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

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

func (*ChatHistorySelect) Float64sX

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

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

func (*ChatHistorySelect) Int

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

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

func (*ChatHistorySelect) IntX

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

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

func (*ChatHistorySelect) Ints

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

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

func (*ChatHistorySelect) IntsX

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

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

func (*ChatHistorySelect) Scan

func (chs *ChatHistorySelect) Scan(ctx context.Context, v any) error

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

func (*ChatHistorySelect) ScanX

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

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

func (*ChatHistorySelect) String

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

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

func (*ChatHistorySelect) StringX

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

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

func (*ChatHistorySelect) Strings

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

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

func (*ChatHistorySelect) StringsX

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

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

type ChatHistoryUpdate

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

ChatHistoryUpdate is the builder for updating ChatHistory entities.

func (*ChatHistoryUpdate) AddChatID

func (chu *ChatHistoryUpdate) AddChatID(i int64) *ChatHistoryUpdate

AddChatID adds i to the "chat_id" field.

func (*ChatHistoryUpdate) Exec

func (chu *ChatHistoryUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*ChatHistoryUpdate) ExecX

func (chu *ChatHistoryUpdate) ExecX(ctx context.Context)

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

func (*ChatHistoryUpdate) Mutation

func (chu *ChatHistoryUpdate) Mutation() *ChatHistoryMutation

Mutation returns the ChatHistoryMutation object of the builder.

func (*ChatHistoryUpdate) Save

func (chu *ChatHistoryUpdate) Save(ctx context.Context) (int, error)

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

func (*ChatHistoryUpdate) SaveX

func (chu *ChatHistoryUpdate) SaveX(ctx context.Context) int

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

func (*ChatHistoryUpdate) SetChatID

func (chu *ChatHistoryUpdate) SetChatID(i int64) *ChatHistoryUpdate

SetChatID sets the "chat_id" field.

func (*ChatHistoryUpdate) SetContent

func (chu *ChatHistoryUpdate) SetContent(s string) *ChatHistoryUpdate

SetContent sets the "content" field.

func (*ChatHistoryUpdate) Where

Where appends a list predicates to the ChatHistoryUpdate builder.

type ChatHistoryUpdateOne

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

ChatHistoryUpdateOne is the builder for updating a single ChatHistory entity.

func (*ChatHistoryUpdateOne) AddChatID

func (chuo *ChatHistoryUpdateOne) AddChatID(i int64) *ChatHistoryUpdateOne

AddChatID adds i to the "chat_id" field.

func (*ChatHistoryUpdateOne) Exec

func (chuo *ChatHistoryUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*ChatHistoryUpdateOne) ExecX

func (chuo *ChatHistoryUpdateOne) ExecX(ctx context.Context)

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

func (*ChatHistoryUpdateOne) Mutation

func (chuo *ChatHistoryUpdateOne) Mutation() *ChatHistoryMutation

Mutation returns the ChatHistoryMutation object of the builder.

func (*ChatHistoryUpdateOne) Save

Save executes the query and returns the updated ChatHistory entity.

func (*ChatHistoryUpdateOne) SaveX

func (chuo *ChatHistoryUpdateOne) SaveX(ctx context.Context) *ChatHistory

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

func (*ChatHistoryUpdateOne) Select

func (chuo *ChatHistoryUpdateOne) Select(field string, fields ...string) *ChatHistoryUpdateOne

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

func (*ChatHistoryUpdateOne) SetChatID

func (chuo *ChatHistoryUpdateOne) SetChatID(i int64) *ChatHistoryUpdateOne

SetChatID sets the "chat_id" field.

func (*ChatHistoryUpdateOne) SetContent

func (chuo *ChatHistoryUpdateOne) SetContent(s string) *ChatHistoryUpdateOne

SetContent sets the "content" field.

func (*ChatHistoryUpdateOne) Where

Where appends a list predicates to the ChatHistoryUpdate builder.

type Client

type Client struct {

	// Schema is the client for creating, migrating and dropping schema.
	Schema *migrate.Schema
	// ChatConfig is the client for interacting with the ChatConfig builders.
	ChatConfig *ChatConfigClient
	// ChatHistory is the client for interacting with the ChatHistory builders.
	ChatHistory *ChatHistoryClient
	// OpenAIToken is the client for interacting with the OpenAIToken builders.
	OpenAIToken *OpenAITokenClient
	// 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().
	ChatConfig.
	Query().
	Count(ctx)

func (*Client) Intercept

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

Intercept adds the query interceptors to all the entity clients. In order to add interceptors to a specific client, call: `client.Node.Intercept(...)`.

func (*Client) Mutate

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

Mutate implements the ent.Mutator interface.

func (*Client) Tx

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

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

func (*Client) Use

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

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

type CommitFunc

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

The CommitFunc type is an adapter to allow the use of ordinary function as a Committer. If f is a function with the appropriate signature, CommitFunc(f) is a Committer that calls f.

func (CommitFunc) Commit

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

Commit calls f(ctx, m).

type CommitHook

type CommitHook func(Committer) Committer

CommitHook defines the "commit middleware". A function that gets a Committer and returns a Committer. For example:

hook := func(next ent.Committer) ent.Committer {
	return ent.CommitFunc(func(ctx context.Context, tx *ent.Tx) error {
		// Do some stuff before.
		if err := next.Commit(ctx, tx); err != nil {
			return err
		}
		// Do some stuff after.
		return nil
	})
}

type Committer

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

Committer is the interface that wraps the Commit method.

type ConstraintError

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

ConstraintError returns when trying to create/update one or more entities and one or more of their constraints failed. For example, violation of edge or field uniqueness.

func (ConstraintError) Error

func (e ConstraintError) Error() string

Error implements the error interface.

func (*ConstraintError) Unwrap

func (e *ConstraintError) Unwrap() error

Unwrap implements the errors.Wrapper interface.

type Hook

type Hook = ent.Hook

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

type InterceptFunc

type InterceptFunc = ent.InterceptFunc

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

type Interceptor

type Interceptor = ent.Interceptor

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

type MutateFunc

type MutateFunc = ent.MutateFunc

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

type Mutation

type Mutation = ent.Mutation

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

type Mutator

type Mutator = ent.Mutator

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

type 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 OpenAIToken

type OpenAIToken struct {

	// ID of the ent.
	ID int `json:"id,omitempty"`
	// Token holds the value of the "token" field.
	Token string `json:"token,omitempty"`
	// IsActive holds the value of the "is_active" field.
	IsActive bool `json:"is_active,omitempty"`
	// contains filtered or unexported fields
}

OpenAIToken is the model entity for the OpenAIToken schema.

func (*OpenAIToken) String

func (oat *OpenAIToken) String() string

String implements the fmt.Stringer.

func (*OpenAIToken) Unwrap

func (oat *OpenAIToken) Unwrap() *OpenAIToken

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

func (oat *OpenAIToken) Update() *OpenAITokenUpdateOne

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

func (*OpenAIToken) Value

func (oat *OpenAIToken) Value(name string) (ent.Value, error)

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

type OpenAITokenClient

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

OpenAITokenClient is a client for the OpenAIToken schema.

func NewOpenAITokenClient

func NewOpenAITokenClient(c config) *OpenAITokenClient

NewOpenAITokenClient returns a client for the OpenAIToken from the given config.

func (*OpenAITokenClient) Create

func (c *OpenAITokenClient) Create() *OpenAITokenCreate

Create returns a builder for creating a OpenAIToken entity.

func (*OpenAITokenClient) CreateBulk

func (c *OpenAITokenClient) CreateBulk(builders ...*OpenAITokenCreate) *OpenAITokenCreateBulk

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

func (*OpenAITokenClient) Delete

func (c *OpenAITokenClient) Delete() *OpenAITokenDelete

Delete returns a delete builder for OpenAIToken.

func (*OpenAITokenClient) DeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*OpenAITokenClient) DeleteOneID

func (c *OpenAITokenClient) DeleteOneID(id int) *OpenAITokenDeleteOne

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

func (*OpenAITokenClient) Get

func (c *OpenAITokenClient) Get(ctx context.Context, id int) (*OpenAIToken, error)

Get returns a OpenAIToken entity by its id.

func (*OpenAITokenClient) GetX

func (c *OpenAITokenClient) GetX(ctx context.Context, id int) *OpenAIToken

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

func (*OpenAITokenClient) Hooks

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

Hooks returns the client hooks.

func (*OpenAITokenClient) Intercept

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

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

func (*OpenAITokenClient) Interceptors

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

Interceptors returns the client interceptors.

func (*OpenAITokenClient) Query

func (c *OpenAITokenClient) Query() *OpenAITokenQuery

Query returns a query builder for OpenAIToken.

func (*OpenAITokenClient) Update

func (c *OpenAITokenClient) Update() *OpenAITokenUpdate

Update returns an update builder for OpenAIToken.

func (*OpenAITokenClient) UpdateOne

UpdateOne returns an update builder for the given entity.

func (*OpenAITokenClient) UpdateOneID

func (c *OpenAITokenClient) UpdateOneID(id int) *OpenAITokenUpdateOne

UpdateOneID returns an update builder for the given id.

func (*OpenAITokenClient) Use

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

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

type OpenAITokenCreate

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

OpenAITokenCreate is the builder for creating a OpenAIToken entity.

func (*OpenAITokenCreate) Exec

func (oatc *OpenAITokenCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*OpenAITokenCreate) ExecX

func (oatc *OpenAITokenCreate) ExecX(ctx context.Context)

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

func (*OpenAITokenCreate) Mutation

func (oatc *OpenAITokenCreate) Mutation() *OpenAITokenMutation

Mutation returns the OpenAITokenMutation object of the builder.

func (*OpenAITokenCreate) Save

func (oatc *OpenAITokenCreate) Save(ctx context.Context) (*OpenAIToken, error)

Save creates the OpenAIToken in the database.

func (*OpenAITokenCreate) SaveX

func (oatc *OpenAITokenCreate) SaveX(ctx context.Context) *OpenAIToken

SaveX calls Save and panics if Save returns an error.

func (*OpenAITokenCreate) SetIsActive

func (oatc *OpenAITokenCreate) SetIsActive(b bool) *OpenAITokenCreate

SetIsActive sets the "is_active" field.

func (*OpenAITokenCreate) SetNillableIsActive

func (oatc *OpenAITokenCreate) SetNillableIsActive(b *bool) *OpenAITokenCreate

SetNillableIsActive sets the "is_active" field if the given value is not nil.

func (*OpenAITokenCreate) SetToken

func (oatc *OpenAITokenCreate) SetToken(s string) *OpenAITokenCreate

SetToken sets the "token" field.

type OpenAITokenCreateBulk

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

OpenAITokenCreateBulk is the builder for creating many OpenAIToken entities in bulk.

func (*OpenAITokenCreateBulk) Exec

func (oatcb *OpenAITokenCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*OpenAITokenCreateBulk) ExecX

func (oatcb *OpenAITokenCreateBulk) ExecX(ctx context.Context)

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

func (*OpenAITokenCreateBulk) Save

func (oatcb *OpenAITokenCreateBulk) Save(ctx context.Context) ([]*OpenAIToken, error)

Save creates the OpenAIToken entities in the database.

func (*OpenAITokenCreateBulk) SaveX

func (oatcb *OpenAITokenCreateBulk) SaveX(ctx context.Context) []*OpenAIToken

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

type OpenAITokenDelete

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

OpenAITokenDelete is the builder for deleting a OpenAIToken entity.

func (*OpenAITokenDelete) Exec

func (oatd *OpenAITokenDelete) Exec(ctx context.Context) (int, error)

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

func (*OpenAITokenDelete) ExecX

func (oatd *OpenAITokenDelete) ExecX(ctx context.Context) int

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

func (*OpenAITokenDelete) Where

Where appends a list predicates to the OpenAITokenDelete builder.

type OpenAITokenDeleteOne

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

OpenAITokenDeleteOne is the builder for deleting a single OpenAIToken entity.

func (*OpenAITokenDeleteOne) Exec

func (oatdo *OpenAITokenDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*OpenAITokenDeleteOne) ExecX

func (oatdo *OpenAITokenDeleteOne) ExecX(ctx context.Context)

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

func (*OpenAITokenDeleteOne) Where

Where appends a list predicates to the OpenAITokenDelete builder.

type OpenAITokenGroupBy

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

OpenAITokenGroupBy is the group-by builder for OpenAIToken entities.

func (*OpenAITokenGroupBy) Aggregate

func (oatgb *OpenAITokenGroupBy) Aggregate(fns ...AggregateFunc) *OpenAITokenGroupBy

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

func (*OpenAITokenGroupBy) Bool

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

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

func (*OpenAITokenGroupBy) BoolX

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

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

func (*OpenAITokenGroupBy) Bools

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

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

func (*OpenAITokenGroupBy) BoolsX

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

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

func (*OpenAITokenGroupBy) Float64

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

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

func (*OpenAITokenGroupBy) Float64X

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

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

func (*OpenAITokenGroupBy) Float64s

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

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

func (*OpenAITokenGroupBy) Float64sX

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

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

func (*OpenAITokenGroupBy) Int

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

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

func (*OpenAITokenGroupBy) IntX

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

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

func (*OpenAITokenGroupBy) Ints

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

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

func (*OpenAITokenGroupBy) IntsX

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

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

func (*OpenAITokenGroupBy) Scan

func (oatgb *OpenAITokenGroupBy) Scan(ctx context.Context, v any) error

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

func (*OpenAITokenGroupBy) ScanX

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

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

func (*OpenAITokenGroupBy) String

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

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

func (*OpenAITokenGroupBy) StringX

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

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

func (*OpenAITokenGroupBy) Strings

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

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

func (*OpenAITokenGroupBy) StringsX

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

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

type OpenAITokenMutation

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

OpenAITokenMutation represents an operation that mutates the OpenAIToken nodes in the graph.

func (*OpenAITokenMutation) AddField

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

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

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

func (*OpenAITokenMutation) AddedField

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

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

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

func (*OpenAITokenMutation) AddedIDs

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

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

func (*OpenAITokenMutation) ClearEdge

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

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

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

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

func (*OpenAITokenMutation) ClearedFields

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

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

func (OpenAITokenMutation) Client

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

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

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

func (*OpenAITokenMutation) Field

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

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

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

func (*OpenAITokenMutation) Fields

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

func (m *OpenAITokenMutation) 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 (*OpenAITokenMutation) IDs

func (m *OpenAITokenMutation) 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 (*OpenAITokenMutation) IsActive

func (m *OpenAITokenMutation) IsActive() (r bool, exists bool)

IsActive returns the value of the "is_active" field in the mutation.

func (*OpenAITokenMutation) OldField

func (m *OpenAITokenMutation) 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 (*OpenAITokenMutation) OldIsActive

func (m *OpenAITokenMutation) OldIsActive(ctx context.Context) (v bool, err error)

OldIsActive returns the old "is_active" field's value of the OpenAIToken entity. If the OpenAIToken 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 (*OpenAITokenMutation) OldToken

func (m *OpenAITokenMutation) OldToken(ctx context.Context) (v string, err error)

OldToken returns the old "token" field's value of the OpenAIToken entity. If the OpenAIToken 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 (*OpenAITokenMutation) Op

func (m *OpenAITokenMutation) Op() Op

Op returns the operation name.

func (*OpenAITokenMutation) RemovedEdges

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

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

func (*OpenAITokenMutation) RemovedIDs

func (m *OpenAITokenMutation) 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 (*OpenAITokenMutation) ResetEdge

func (m *OpenAITokenMutation) 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 (*OpenAITokenMutation) ResetField

func (m *OpenAITokenMutation) 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 (*OpenAITokenMutation) ResetIsActive

func (m *OpenAITokenMutation) ResetIsActive()

ResetIsActive resets all changes to the "is_active" field.

func (*OpenAITokenMutation) ResetToken

func (m *OpenAITokenMutation) ResetToken()

ResetToken resets all changes to the "token" field.

func (*OpenAITokenMutation) SetField

func (m *OpenAITokenMutation) 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 (*OpenAITokenMutation) SetIsActive

func (m *OpenAITokenMutation) SetIsActive(b bool)

SetIsActive sets the "is_active" field.

func (*OpenAITokenMutation) SetOp

func (m *OpenAITokenMutation) SetOp(op Op)

SetOp allows setting the mutation operation.

func (*OpenAITokenMutation) SetToken

func (m *OpenAITokenMutation) SetToken(s string)

SetToken sets the "token" field.

func (*OpenAITokenMutation) Token

func (m *OpenAITokenMutation) Token() (r string, exists bool)

Token returns the value of the "token" field in the mutation.

func (OpenAITokenMutation) Tx

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

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

func (*OpenAITokenMutation) Type

func (m *OpenAITokenMutation) Type() string

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

func (*OpenAITokenMutation) Where

func (m *OpenAITokenMutation) Where(ps ...predicate.OpenAIToken)

Where appends a list predicates to the OpenAITokenMutation builder.

func (*OpenAITokenMutation) WhereP

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

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

type OpenAITokenQuery

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

OpenAITokenQuery is the builder for querying OpenAIToken entities.

func (*OpenAITokenQuery) Aggregate

func (oatq *OpenAITokenQuery) Aggregate(fns ...AggregateFunc) *OpenAITokenSelect

Aggregate returns a OpenAITokenSelect configured with the given aggregations.

func (*OpenAITokenQuery) All

func (oatq *OpenAITokenQuery) All(ctx context.Context) ([]*OpenAIToken, error)

All executes the query and returns a list of OpenAITokens.

func (*OpenAITokenQuery) AllX

func (oatq *OpenAITokenQuery) AllX(ctx context.Context) []*OpenAIToken

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

func (*OpenAITokenQuery) Clone

func (oatq *OpenAITokenQuery) Clone() *OpenAITokenQuery

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

func (*OpenAITokenQuery) Count

func (oatq *OpenAITokenQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*OpenAITokenQuery) CountX

func (oatq *OpenAITokenQuery) CountX(ctx context.Context) int

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

func (*OpenAITokenQuery) Exist

func (oatq *OpenAITokenQuery) Exist(ctx context.Context) (bool, error)

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

func (*OpenAITokenQuery) ExistX

func (oatq *OpenAITokenQuery) ExistX(ctx context.Context) bool

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

func (*OpenAITokenQuery) First

func (oatq *OpenAITokenQuery) First(ctx context.Context) (*OpenAIToken, error)

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

func (*OpenAITokenQuery) FirstID

func (oatq *OpenAITokenQuery) FirstID(ctx context.Context) (id int, err error)

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

func (*OpenAITokenQuery) FirstIDX

func (oatq *OpenAITokenQuery) FirstIDX(ctx context.Context) int

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

func (*OpenAITokenQuery) FirstX

func (oatq *OpenAITokenQuery) FirstX(ctx context.Context) *OpenAIToken

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

func (*OpenAITokenQuery) GroupBy

func (oatq *OpenAITokenQuery) GroupBy(field string, fields ...string) *OpenAITokenGroupBy

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

client.OpenAIToken.Query().
	GroupBy(openaitoken.FieldToken).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*OpenAITokenQuery) IDs

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

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

func (*OpenAITokenQuery) IDsX

func (oatq *OpenAITokenQuery) IDsX(ctx context.Context) []int

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

func (*OpenAITokenQuery) Limit

func (oatq *OpenAITokenQuery) Limit(limit int) *OpenAITokenQuery

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

func (*OpenAITokenQuery) Offset

func (oatq *OpenAITokenQuery) Offset(offset int) *OpenAITokenQuery

Offset to start from.

func (*OpenAITokenQuery) Only

func (oatq *OpenAITokenQuery) Only(ctx context.Context) (*OpenAIToken, error)

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

func (*OpenAITokenQuery) OnlyID

func (oatq *OpenAITokenQuery) OnlyID(ctx context.Context) (id int, err error)

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

func (*OpenAITokenQuery) OnlyIDX

func (oatq *OpenAITokenQuery) OnlyIDX(ctx context.Context) int

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

func (*OpenAITokenQuery) OnlyX

func (oatq *OpenAITokenQuery) OnlyX(ctx context.Context) *OpenAIToken

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

func (*OpenAITokenQuery) Order

Order specifies how the records should be ordered.

func (*OpenAITokenQuery) Select

func (oatq *OpenAITokenQuery) Select(fields ...string) *OpenAITokenSelect

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

client.OpenAIToken.Query().
	Select(openaitoken.FieldToken).
	Scan(ctx, &v)

func (*OpenAITokenQuery) Unique

func (oatq *OpenAITokenQuery) Unique(unique bool) *OpenAITokenQuery

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

Where adds a new predicate for the OpenAITokenQuery builder.

type OpenAITokenSelect

type OpenAITokenSelect struct {
	*OpenAITokenQuery
	// contains filtered or unexported fields
}

OpenAITokenSelect is the builder for selecting fields of OpenAIToken entities.

func (*OpenAITokenSelect) Aggregate

func (oats *OpenAITokenSelect) Aggregate(fns ...AggregateFunc) *OpenAITokenSelect

Aggregate adds the given aggregation functions to the selector query.

func (*OpenAITokenSelect) Bool

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

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

func (*OpenAITokenSelect) BoolX

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

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

func (*OpenAITokenSelect) Bools

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

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

func (*OpenAITokenSelect) BoolsX

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

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

func (*OpenAITokenSelect) Float64

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

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

func (*OpenAITokenSelect) Float64X

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

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

func (*OpenAITokenSelect) Float64s

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

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

func (*OpenAITokenSelect) Float64sX

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

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

func (*OpenAITokenSelect) Int

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

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

func (*OpenAITokenSelect) IntX

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

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

func (*OpenAITokenSelect) Ints

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

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

func (*OpenAITokenSelect) IntsX

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

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

func (*OpenAITokenSelect) Scan

func (oats *OpenAITokenSelect) Scan(ctx context.Context, v any) error

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

func (*OpenAITokenSelect) ScanX

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

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

func (*OpenAITokenSelect) String

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

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

func (*OpenAITokenSelect) StringX

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

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

func (*OpenAITokenSelect) Strings

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

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

func (*OpenAITokenSelect) StringsX

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

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

type OpenAITokenUpdate

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

OpenAITokenUpdate is the builder for updating OpenAIToken entities.

func (*OpenAITokenUpdate) Exec

func (oatu *OpenAITokenUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*OpenAITokenUpdate) ExecX

func (oatu *OpenAITokenUpdate) ExecX(ctx context.Context)

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

func (*OpenAITokenUpdate) Mutation

func (oatu *OpenAITokenUpdate) Mutation() *OpenAITokenMutation

Mutation returns the OpenAITokenMutation object of the builder.

func (*OpenAITokenUpdate) Save

func (oatu *OpenAITokenUpdate) Save(ctx context.Context) (int, error)

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

func (*OpenAITokenUpdate) SaveX

func (oatu *OpenAITokenUpdate) SaveX(ctx context.Context) int

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

func (*OpenAITokenUpdate) SetIsActive

func (oatu *OpenAITokenUpdate) SetIsActive(b bool) *OpenAITokenUpdate

SetIsActive sets the "is_active" field.

func (*OpenAITokenUpdate) SetNillableIsActive

func (oatu *OpenAITokenUpdate) SetNillableIsActive(b *bool) *OpenAITokenUpdate

SetNillableIsActive sets the "is_active" field if the given value is not nil.

func (*OpenAITokenUpdate) SetToken

func (oatu *OpenAITokenUpdate) SetToken(s string) *OpenAITokenUpdate

SetToken sets the "token" field.

func (*OpenAITokenUpdate) Where

Where appends a list predicates to the OpenAITokenUpdate builder.

type OpenAITokenUpdateOne

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

OpenAITokenUpdateOne is the builder for updating a single OpenAIToken entity.

func (*OpenAITokenUpdateOne) Exec

func (oatuo *OpenAITokenUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*OpenAITokenUpdateOne) ExecX

func (oatuo *OpenAITokenUpdateOne) ExecX(ctx context.Context)

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

func (*OpenAITokenUpdateOne) Mutation

func (oatuo *OpenAITokenUpdateOne) Mutation() *OpenAITokenMutation

Mutation returns the OpenAITokenMutation object of the builder.

func (*OpenAITokenUpdateOne) Save

func (oatuo *OpenAITokenUpdateOne) Save(ctx context.Context) (*OpenAIToken, error)

Save executes the query and returns the updated OpenAIToken entity.

func (*OpenAITokenUpdateOne) SaveX

func (oatuo *OpenAITokenUpdateOne) SaveX(ctx context.Context) *OpenAIToken

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

func (*OpenAITokenUpdateOne) Select

func (oatuo *OpenAITokenUpdateOne) Select(field string, fields ...string) *OpenAITokenUpdateOne

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

func (*OpenAITokenUpdateOne) SetIsActive

func (oatuo *OpenAITokenUpdateOne) SetIsActive(b bool) *OpenAITokenUpdateOne

SetIsActive sets the "is_active" field.

func (*OpenAITokenUpdateOne) SetNillableIsActive

func (oatuo *OpenAITokenUpdateOne) SetNillableIsActive(b *bool) *OpenAITokenUpdateOne

SetNillableIsActive sets the "is_active" field if the given value is not nil.

func (*OpenAITokenUpdateOne) SetToken

func (oatuo *OpenAITokenUpdateOne) SetToken(s string) *OpenAITokenUpdateOne

SetToken sets the "token" field.

func (*OpenAITokenUpdateOne) Where

Where appends a list predicates to the OpenAITokenUpdate builder.

type OpenAITokens

type OpenAITokens []*OpenAIToken

OpenAITokens is a parsable slice of OpenAIToken.

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 {

	// ChatConfig is the client for interacting with the ChatConfig builders.
	ChatConfig *ChatConfigClient
	// ChatHistory is the client for interacting with the ChatHistory builders.
	ChatHistory *ChatHistoryClient
	// OpenAIToken is the client for interacting with the OpenAIToken builders.
	OpenAIToken *OpenAITokenClient
	// 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