Documentation ¶
Index ¶
- Constants
- Variables
- func Asc(fields ...string) func(*sql.Selector)
- func Desc(fields ...string) func(*sql.Selector)
- func IsConstraintError(err error) bool
- func IsNotFound(err error) bool
- func IsNotLoaded(err error) bool
- func IsNotSingular(err error) bool
- func IsValidationError(err error) bool
- func MaskNotFound(err error) error
- func NewContext(parent context.Context, c *Client) context.Context
- func NewTxContext(parent context.Context, tx *Tx) context.Context
- type AggregateFunc
- type Chat
- type ChatClient
- func (c *ChatClient) Create() *ChatCreate
- func (c *ChatClient) CreateBulk(builders ...*ChatCreate) *ChatCreateBulk
- func (c *ChatClient) Delete() *ChatDelete
- func (c *ChatClient) DeleteOne(ch *Chat) *ChatDeleteOne
- func (c *ChatClient) DeleteOneID(id uuid.UUID) *ChatDeleteOne
- func (c *ChatClient) Get(ctx context.Context, id uuid.UUID) (*Chat, error)
- func (c *ChatClient) GetX(ctx context.Context, id uuid.UUID) *Chat
- func (c *ChatClient) Hooks() []Hook
- func (c *ChatClient) Intercept(interceptors ...Interceptor)
- func (c *ChatClient) Interceptors() []Interceptor
- func (c *ChatClient) MapCreateBulk(slice any, setFunc func(*ChatCreate, int)) *ChatCreateBulk
- func (c *ChatClient) Query() *ChatQuery
- func (c *ChatClient) Update() *ChatUpdate
- func (c *ChatClient) UpdateOne(ch *Chat) *ChatUpdateOne
- func (c *ChatClient) UpdateOneID(id uuid.UUID) *ChatUpdateOne
- func (c *ChatClient) Use(hooks ...Hook)
- type ChatCreate
- func (cc *ChatCreate) Exec(ctx context.Context) error
- func (cc *ChatCreate) ExecX(ctx context.Context)
- func (cc *ChatCreate) Mutation() *ChatMutation
- func (cc *ChatCreate) OnConflict(opts ...sql.ConflictOption) *ChatUpsertOne
- func (cc *ChatCreate) OnConflictColumns(columns ...string) *ChatUpsertOne
- func (cc *ChatCreate) Save(ctx context.Context) (*Chat, error)
- func (cc *ChatCreate) SaveX(ctx context.Context) *Chat
- func (cc *ChatCreate) SetCreatedAt(t time.Time) *ChatCreate
- func (cc *ChatCreate) SetHistory(v v1.History) *ChatCreate
- func (cc *ChatCreate) SetID(u uuid.UUID) *ChatCreate
- func (cc *ChatCreate) SetMessages(v []v1.Message) *ChatCreate
- func (cc *ChatCreate) SetModels(s []string) *ChatCreate
- func (cc *ChatCreate) SetNillableCreatedAt(t *time.Time) *ChatCreate
- func (cc *ChatCreate) SetNillableID(u *uuid.UUID) *ChatCreate
- func (cc *ChatCreate) SetTags(s []string) *ChatCreate
- func (cc *ChatCreate) SetTitle(s string) *ChatCreate
- func (cc *ChatCreate) SetUserId(u uuid.UUID) *ChatCreate
- type ChatCreateBulk
- func (ccb *ChatCreateBulk) Exec(ctx context.Context) error
- func (ccb *ChatCreateBulk) ExecX(ctx context.Context)
- func (ccb *ChatCreateBulk) OnConflict(opts ...sql.ConflictOption) *ChatUpsertBulk
- func (ccb *ChatCreateBulk) OnConflictColumns(columns ...string) *ChatUpsertBulk
- func (ccb *ChatCreateBulk) Save(ctx context.Context) ([]*Chat, error)
- func (ccb *ChatCreateBulk) SaveX(ctx context.Context) []*Chat
- type ChatDelete
- type ChatDeleteOne
- type ChatGroupBy
- func (cgb *ChatGroupBy) Aggregate(fns ...AggregateFunc) *ChatGroupBy
- func (s *ChatGroupBy) Bool(ctx context.Context) (_ bool, err error)
- func (s *ChatGroupBy) BoolX(ctx context.Context) bool
- func (s *ChatGroupBy) Bools(ctx context.Context) ([]bool, error)
- func (s *ChatGroupBy) BoolsX(ctx context.Context) []bool
- func (s *ChatGroupBy) Float64(ctx context.Context) (_ float64, err error)
- func (s *ChatGroupBy) Float64X(ctx context.Context) float64
- func (s *ChatGroupBy) Float64s(ctx context.Context) ([]float64, error)
- func (s *ChatGroupBy) Float64sX(ctx context.Context) []float64
- func (s *ChatGroupBy) Int(ctx context.Context) (_ int, err error)
- func (s *ChatGroupBy) IntX(ctx context.Context) int
- func (s *ChatGroupBy) Ints(ctx context.Context) ([]int, error)
- func (s *ChatGroupBy) IntsX(ctx context.Context) []int
- func (cgb *ChatGroupBy) Scan(ctx context.Context, v any) error
- func (s *ChatGroupBy) ScanX(ctx context.Context, v any)
- func (s *ChatGroupBy) String(ctx context.Context) (_ string, err error)
- func (s *ChatGroupBy) StringX(ctx context.Context) string
- func (s *ChatGroupBy) Strings(ctx context.Context) ([]string, error)
- func (s *ChatGroupBy) StringsX(ctx context.Context) []string
- type ChatMutation
- func (m *ChatMutation) AddField(name string, value ent.Value) error
- func (m *ChatMutation) AddedEdges() []string
- func (m *ChatMutation) AddedField(name string) (ent.Value, bool)
- func (m *ChatMutation) AddedFields() []string
- func (m *ChatMutation) AddedIDs(name string) []ent.Value
- func (m *ChatMutation) AppendMessages(v []v1.Message)
- func (m *ChatMutation) AppendModels(s []string)
- func (m *ChatMutation) AppendTags(s []string)
- func (m *ChatMutation) AppendedMessages() ([]v1.Message, bool)
- func (m *ChatMutation) AppendedModels() ([]string, bool)
- func (m *ChatMutation) AppendedTags() ([]string, bool)
- func (m *ChatMutation) ClearEdge(name string) error
- func (m *ChatMutation) ClearField(name string) error
- func (m *ChatMutation) ClearedEdges() []string
- func (m *ChatMutation) ClearedFields() []string
- func (m ChatMutation) Client() *Client
- func (m *ChatMutation) CreatedAt() (r time.Time, exists bool)
- func (m *ChatMutation) EdgeCleared(name string) bool
- func (m *ChatMutation) Field(name string) (ent.Value, bool)
- func (m *ChatMutation) FieldCleared(name string) bool
- func (m *ChatMutation) Fields() []string
- func (m *ChatMutation) History() (r v1.History, exists bool)
- func (m *ChatMutation) ID() (id uuid.UUID, exists bool)
- func (m *ChatMutation) IDs(ctx context.Context) ([]uuid.UUID, error)
- func (m *ChatMutation) Messages() (r []v1.Message, exists bool)
- func (m *ChatMutation) Models() (r []string, exists bool)
- func (m *ChatMutation) OldCreatedAt(ctx context.Context) (v time.Time, err error)
- func (m *ChatMutation) OldField(ctx context.Context, name string) (ent.Value, error)
- func (m *ChatMutation) OldHistory(ctx context.Context) (v v1.History, err error)
- func (m *ChatMutation) OldMessages(ctx context.Context) (v []v1.Message, err error)
- func (m *ChatMutation) OldModels(ctx context.Context) (v []string, err error)
- func (m *ChatMutation) OldTags(ctx context.Context) (v []string, err error)
- func (m *ChatMutation) OldTitle(ctx context.Context) (v string, err error)
- func (m *ChatMutation) OldUserId(ctx context.Context) (v uuid.UUID, err error)
- func (m *ChatMutation) Op() Op
- func (m *ChatMutation) RemovedEdges() []string
- func (m *ChatMutation) RemovedIDs(name string) []ent.Value
- func (m *ChatMutation) ResetCreatedAt()
- func (m *ChatMutation) ResetEdge(name string) error
- func (m *ChatMutation) ResetField(name string) error
- func (m *ChatMutation) ResetHistory()
- func (m *ChatMutation) ResetMessages()
- func (m *ChatMutation) ResetModels()
- func (m *ChatMutation) ResetTags()
- func (m *ChatMutation) ResetTitle()
- func (m *ChatMutation) ResetUserId()
- func (m *ChatMutation) SetCreatedAt(t time.Time)
- func (m *ChatMutation) SetField(name string, value ent.Value) error
- func (m *ChatMutation) SetHistory(v v1.History)
- func (m *ChatMutation) SetID(id uuid.UUID)
- func (m *ChatMutation) SetMessages(v []v1.Message)
- func (m *ChatMutation) SetModels(s []string)
- func (m *ChatMutation) SetOp(op Op)
- func (m *ChatMutation) SetTags(s []string)
- func (m *ChatMutation) SetTitle(s string)
- func (m *ChatMutation) SetUserId(u uuid.UUID)
- func (m *ChatMutation) Tags() (r []string, exists bool)
- func (m *ChatMutation) Title() (r string, exists bool)
- func (m ChatMutation) Tx() (*Tx, error)
- func (m *ChatMutation) Type() string
- func (m *ChatMutation) UserId() (r uuid.UUID, exists bool)
- func (m *ChatMutation) Where(ps ...predicate.Chat)
- func (m *ChatMutation) WhereP(ps ...func(*sql.Selector))
- type ChatQuery
- func (cq *ChatQuery) Aggregate(fns ...AggregateFunc) *ChatSelect
- func (cq *ChatQuery) All(ctx context.Context) ([]*Chat, error)
- func (cq *ChatQuery) AllX(ctx context.Context) []*Chat
- func (cq *ChatQuery) Clone() *ChatQuery
- func (cq *ChatQuery) Count(ctx context.Context) (int, error)
- func (cq *ChatQuery) CountX(ctx context.Context) int
- func (cq *ChatQuery) Exist(ctx context.Context) (bool, error)
- func (cq *ChatQuery) ExistX(ctx context.Context) bool
- func (cq *ChatQuery) First(ctx context.Context) (*Chat, error)
- func (cq *ChatQuery) FirstID(ctx context.Context) (id uuid.UUID, err error)
- func (cq *ChatQuery) FirstIDX(ctx context.Context) uuid.UUID
- func (cq *ChatQuery) FirstX(ctx context.Context) *Chat
- func (cq *ChatQuery) GroupBy(field string, fields ...string) *ChatGroupBy
- func (cq *ChatQuery) IDs(ctx context.Context) (ids []uuid.UUID, err error)
- func (cq *ChatQuery) IDsX(ctx context.Context) []uuid.UUID
- func (cq *ChatQuery) Limit(limit int) *ChatQuery
- func (cq *ChatQuery) Offset(offset int) *ChatQuery
- func (cq *ChatQuery) Only(ctx context.Context) (*Chat, error)
- func (cq *ChatQuery) OnlyID(ctx context.Context) (id uuid.UUID, err error)
- func (cq *ChatQuery) OnlyIDX(ctx context.Context) uuid.UUID
- func (cq *ChatQuery) OnlyX(ctx context.Context) *Chat
- func (cq *ChatQuery) Order(o ...chat.OrderOption) *ChatQuery
- func (cq *ChatQuery) Select(fields ...string) *ChatSelect
- func (cq *ChatQuery) Unique(unique bool) *ChatQuery
- func (cq *ChatQuery) Where(ps ...predicate.Chat) *ChatQuery
- type ChatSelect
- func (cs *ChatSelect) Aggregate(fns ...AggregateFunc) *ChatSelect
- func (s *ChatSelect) Bool(ctx context.Context) (_ bool, err error)
- func (s *ChatSelect) BoolX(ctx context.Context) bool
- func (s *ChatSelect) Bools(ctx context.Context) ([]bool, error)
- func (s *ChatSelect) BoolsX(ctx context.Context) []bool
- func (s *ChatSelect) Float64(ctx context.Context) (_ float64, err error)
- func (s *ChatSelect) Float64X(ctx context.Context) float64
- func (s *ChatSelect) Float64s(ctx context.Context) ([]float64, error)
- func (s *ChatSelect) Float64sX(ctx context.Context) []float64
- func (s *ChatSelect) Int(ctx context.Context) (_ int, err error)
- func (s *ChatSelect) IntX(ctx context.Context) int
- func (s *ChatSelect) Ints(ctx context.Context) ([]int, error)
- func (s *ChatSelect) IntsX(ctx context.Context) []int
- func (cs *ChatSelect) Scan(ctx context.Context, v any) error
- func (s *ChatSelect) ScanX(ctx context.Context, v any)
- func (s *ChatSelect) String(ctx context.Context) (_ string, err error)
- func (s *ChatSelect) StringX(ctx context.Context) string
- func (s *ChatSelect) Strings(ctx context.Context) ([]string, error)
- func (s *ChatSelect) StringsX(ctx context.Context) []string
- type ChatUpdate
- func (cu *ChatUpdate) AppendMessages(v []v1.Message) *ChatUpdate
- func (cu *ChatUpdate) AppendModels(s []string) *ChatUpdate
- func (cu *ChatUpdate) AppendTags(s []string) *ChatUpdate
- func (cu *ChatUpdate) Exec(ctx context.Context) error
- func (cu *ChatUpdate) ExecX(ctx context.Context)
- func (cu *ChatUpdate) Mutation() *ChatMutation
- func (cu *ChatUpdate) Save(ctx context.Context) (int, error)
- func (cu *ChatUpdate) SaveX(ctx context.Context) int
- func (cu *ChatUpdate) SetHistory(v v1.History) *ChatUpdate
- func (cu *ChatUpdate) SetMessages(v []v1.Message) *ChatUpdate
- func (cu *ChatUpdate) SetModels(s []string) *ChatUpdate
- func (cu *ChatUpdate) SetNillableHistory(v *v1.History) *ChatUpdate
- func (cu *ChatUpdate) SetNillableTitle(s *string) *ChatUpdate
- func (cu *ChatUpdate) SetNillableUserId(u *uuid.UUID) *ChatUpdate
- func (cu *ChatUpdate) SetTags(s []string) *ChatUpdate
- func (cu *ChatUpdate) SetTitle(s string) *ChatUpdate
- func (cu *ChatUpdate) SetUserId(u uuid.UUID) *ChatUpdate
- func (cu *ChatUpdate) Where(ps ...predicate.Chat) *ChatUpdate
- type ChatUpdateOne
- func (cuo *ChatUpdateOne) AppendMessages(v []v1.Message) *ChatUpdateOne
- func (cuo *ChatUpdateOne) AppendModels(s []string) *ChatUpdateOne
- func (cuo *ChatUpdateOne) AppendTags(s []string) *ChatUpdateOne
- func (cuo *ChatUpdateOne) Exec(ctx context.Context) error
- func (cuo *ChatUpdateOne) ExecX(ctx context.Context)
- func (cuo *ChatUpdateOne) Mutation() *ChatMutation
- func (cuo *ChatUpdateOne) Save(ctx context.Context) (*Chat, error)
- func (cuo *ChatUpdateOne) SaveX(ctx context.Context) *Chat
- func (cuo *ChatUpdateOne) Select(field string, fields ...string) *ChatUpdateOne
- func (cuo *ChatUpdateOne) SetHistory(v v1.History) *ChatUpdateOne
- func (cuo *ChatUpdateOne) SetMessages(v []v1.Message) *ChatUpdateOne
- func (cuo *ChatUpdateOne) SetModels(s []string) *ChatUpdateOne
- func (cuo *ChatUpdateOne) SetNillableHistory(v *v1.History) *ChatUpdateOne
- func (cuo *ChatUpdateOne) SetNillableTitle(s *string) *ChatUpdateOne
- func (cuo *ChatUpdateOne) SetNillableUserId(u *uuid.UUID) *ChatUpdateOne
- func (cuo *ChatUpdateOne) SetTags(s []string) *ChatUpdateOne
- func (cuo *ChatUpdateOne) SetTitle(s string) *ChatUpdateOne
- func (cuo *ChatUpdateOne) SetUserId(u uuid.UUID) *ChatUpdateOne
- func (cuo *ChatUpdateOne) Where(ps ...predicate.Chat) *ChatUpdateOne
- type ChatUpsert
- func (u *ChatUpsert) SetHistory(v v1.History) *ChatUpsert
- func (u *ChatUpsert) SetMessages(v []v1.Message) *ChatUpsert
- func (u *ChatUpsert) SetModels(v []string) *ChatUpsert
- func (u *ChatUpsert) SetTags(v []string) *ChatUpsert
- func (u *ChatUpsert) SetTitle(v string) *ChatUpsert
- func (u *ChatUpsert) SetUserId(v uuid.UUID) *ChatUpsert
- func (u *ChatUpsert) UpdateHistory() *ChatUpsert
- func (u *ChatUpsert) UpdateMessages() *ChatUpsert
- func (u *ChatUpsert) UpdateModels() *ChatUpsert
- func (u *ChatUpsert) UpdateTags() *ChatUpsert
- func (u *ChatUpsert) UpdateTitle() *ChatUpsert
- func (u *ChatUpsert) UpdateUserId() *ChatUpsert
- type ChatUpsertBulk
- func (u *ChatUpsertBulk) DoNothing() *ChatUpsertBulk
- func (u *ChatUpsertBulk) Exec(ctx context.Context) error
- func (u *ChatUpsertBulk) ExecX(ctx context.Context)
- func (u *ChatUpsertBulk) Ignore() *ChatUpsertBulk
- func (u *ChatUpsertBulk) SetHistory(v v1.History) *ChatUpsertBulk
- func (u *ChatUpsertBulk) SetMessages(v []v1.Message) *ChatUpsertBulk
- func (u *ChatUpsertBulk) SetModels(v []string) *ChatUpsertBulk
- func (u *ChatUpsertBulk) SetTags(v []string) *ChatUpsertBulk
- func (u *ChatUpsertBulk) SetTitle(v string) *ChatUpsertBulk
- func (u *ChatUpsertBulk) SetUserId(v uuid.UUID) *ChatUpsertBulk
- func (u *ChatUpsertBulk) Update(set func(*ChatUpsert)) *ChatUpsertBulk
- func (u *ChatUpsertBulk) UpdateHistory() *ChatUpsertBulk
- func (u *ChatUpsertBulk) UpdateMessages() *ChatUpsertBulk
- func (u *ChatUpsertBulk) UpdateModels() *ChatUpsertBulk
- func (u *ChatUpsertBulk) UpdateNewValues() *ChatUpsertBulk
- func (u *ChatUpsertBulk) UpdateTags() *ChatUpsertBulk
- func (u *ChatUpsertBulk) UpdateTitle() *ChatUpsertBulk
- func (u *ChatUpsertBulk) UpdateUserId() *ChatUpsertBulk
- type ChatUpsertOne
- func (u *ChatUpsertOne) DoNothing() *ChatUpsertOne
- func (u *ChatUpsertOne) Exec(ctx context.Context) error
- func (u *ChatUpsertOne) ExecX(ctx context.Context)
- func (u *ChatUpsertOne) ID(ctx context.Context) (id uuid.UUID, err error)
- func (u *ChatUpsertOne) IDX(ctx context.Context) uuid.UUID
- func (u *ChatUpsertOne) Ignore() *ChatUpsertOne
- func (u *ChatUpsertOne) SetHistory(v v1.History) *ChatUpsertOne
- func (u *ChatUpsertOne) SetMessages(v []v1.Message) *ChatUpsertOne
- func (u *ChatUpsertOne) SetModels(v []string) *ChatUpsertOne
- func (u *ChatUpsertOne) SetTags(v []string) *ChatUpsertOne
- func (u *ChatUpsertOne) SetTitle(v string) *ChatUpsertOne
- func (u *ChatUpsertOne) SetUserId(v uuid.UUID) *ChatUpsertOne
- func (u *ChatUpsertOne) Update(set func(*ChatUpsert)) *ChatUpsertOne
- func (u *ChatUpsertOne) UpdateHistory() *ChatUpsertOne
- func (u *ChatUpsertOne) UpdateMessages() *ChatUpsertOne
- func (u *ChatUpsertOne) UpdateModels() *ChatUpsertOne
- func (u *ChatUpsertOne) UpdateNewValues() *ChatUpsertOne
- func (u *ChatUpsertOne) UpdateTags() *ChatUpsertOne
- func (u *ChatUpsertOne) UpdateTitle() *ChatUpsertOne
- func (u *ChatUpsertOne) UpdateUserId() *ChatUpsertOne
- type Chats
- type Client
- func (c *Client) BeginTx(ctx context.Context, opts *sql.TxOptions) (*Tx, error)
- func (c *Client) Close() error
- func (c *Client) Debug() *Client
- func (c *Client) Intercept(interceptors ...Interceptor)
- func (c *Client) Mutate(ctx context.Context, m Mutation) (Value, error)
- func (c *Client) Tx(ctx context.Context) (*Tx, error)
- func (c *Client) Use(hooks ...Hook)
- type CommitFunc
- type CommitHook
- type Committer
- type ConstraintError
- type Hook
- type InterceptFunc
- type Interceptor
- type MutateFunc
- type Mutation
- type Mutator
- type NotFoundError
- type NotLoadedError
- type NotSingularError
- type Op
- type Option
- type OrderFunc
- type Policy
- type Querier
- type QuerierFunc
- type Query
- type QueryContext
- type RollbackFunc
- type RollbackHook
- type Rollbacker
- type TraverseFunc
- type Traverser
- type Tx
- type ValidationError
- type Value
Constants ¶
const ( // Operation types. OpCreate = ent.OpCreate OpDelete = ent.OpDelete OpDeleteOne = ent.OpDeleteOne OpUpdate = ent.OpUpdate OpUpdateOne = ent.OpUpdateOne // Node types. TypeChat = "Chat" )
Variables ¶
var ErrTxStarted = errors.New("ent: cannot start a transaction within a transaction")
ErrTxStarted is returned when trying to start a new transaction from a transactional client.
Functions ¶
func IsConstraintError ¶
IsConstraintError returns a boolean indicating whether the error is a constraint failure.
func IsNotFound ¶
IsNotFound returns a boolean indicating whether the error is a not found error.
func IsNotLoaded ¶
IsNotLoaded returns a boolean indicating whether the error is a not loaded error.
func IsNotSingular ¶
IsNotSingular returns a boolean indicating whether the error is a not singular error.
func IsValidationError ¶
IsValidationError returns a boolean indicating whether the error is a validation error.
func NewContext ¶
NewContext returns a new context with the given Client attached.
Types ¶
type AggregateFunc ¶
AggregateFunc applies an aggregation step on the group-by traversal/selector.
func As ¶
func As(fn AggregateFunc, end string) AggregateFunc
As is a pseudo aggregation function for renaming another other functions with custom names. For example:
GroupBy(field1, field2). Aggregate(ent.As(ent.Sum(field1), "sum_field1"), (ent.As(ent.Sum(field2), "sum_field2")). Scan(ctx, &v)
func Count ¶
func Count() AggregateFunc
Count applies the "count" aggregation function on each group.
func Max ¶
func Max(field string) AggregateFunc
Max applies the "max" aggregation function on the given field of each group.
func Mean ¶
func Mean(field string) AggregateFunc
Mean applies the "mean" aggregation function on the given field of each group.
func Min ¶
func Min(field string) AggregateFunc
Min applies the "min" aggregation function on the given field of each group.
func Sum ¶
func Sum(field string) AggregateFunc
Sum applies the "sum" aggregation function on the given field of each group.
type Chat ¶
type Chat struct { // ID of the ent. ID uuid.UUID `json:"id,omitempty"` // Title holds the value of the "title" field. Title string `json:"title,omitempty"` // UserId holds the value of the "userId" field. UserId uuid.UUID `json:"userId,omitempty"` // Models holds the value of the "models" field. Models []string `json:"models,omitempty"` // Tags holds the value of the "tags" field. Tags []string `json:"tags,omitempty"` // History holds the value of the "history" field. History v1.History `json:"history,omitempty"` // Messages holds the value of the "messages" field. Messages []v1.Message `json:"messages,omitempty"` // CreatedAt holds the value of the "createdAt" field. CreatedAt time.Time `json:"createdAt,omitempty"` // contains filtered or unexported fields }
Chat is the model entity for the Chat schema.
func (*Chat) Unwrap ¶
Unwrap unwraps the Chat 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 (*Chat) Update ¶
func (c *Chat) Update() *ChatUpdateOne
Update returns a builder for updating this Chat. Note that you need to call Chat.Unwrap() before calling this method if this Chat was returned from a transaction, and the transaction was committed or rolled back.
type ChatClient ¶
type ChatClient struct {
// contains filtered or unexported fields
}
ChatClient is a client for the Chat schema.
func NewChatClient ¶
func NewChatClient(c config) *ChatClient
NewChatClient returns a client for the Chat from the given config.
func (*ChatClient) Create ¶
func (c *ChatClient) Create() *ChatCreate
Create returns a builder for creating a Chat entity.
func (*ChatClient) CreateBulk ¶
func (c *ChatClient) CreateBulk(builders ...*ChatCreate) *ChatCreateBulk
CreateBulk returns a builder for creating a bulk of Chat entities.
func (*ChatClient) Delete ¶
func (c *ChatClient) Delete() *ChatDelete
Delete returns a delete builder for Chat.
func (*ChatClient) DeleteOne ¶
func (c *ChatClient) DeleteOne(ch *Chat) *ChatDeleteOne
DeleteOne returns a builder for deleting the given entity.
func (*ChatClient) DeleteOneID ¶
func (c *ChatClient) DeleteOneID(id uuid.UUID) *ChatDeleteOne
DeleteOneID returns a builder for deleting the given entity by its id.
func (*ChatClient) Intercept ¶
func (c *ChatClient) Intercept(interceptors ...Interceptor)
Intercept adds a list of query interceptors to the interceptors stack. A call to `Intercept(f, g, h)` equals to `chat.Intercept(f(g(h())))`.
func (*ChatClient) Interceptors ¶
func (c *ChatClient) Interceptors() []Interceptor
Interceptors returns the client interceptors.
func (*ChatClient) MapCreateBulk ¶
func (c *ChatClient) MapCreateBulk(slice any, setFunc func(*ChatCreate, int)) *ChatCreateBulk
MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates a builder and applies setFunc on it.
func (*ChatClient) Query ¶
func (c *ChatClient) Query() *ChatQuery
Query returns a query builder for Chat.
func (*ChatClient) Update ¶
func (c *ChatClient) Update() *ChatUpdate
Update returns an update builder for Chat.
func (*ChatClient) UpdateOne ¶
func (c *ChatClient) UpdateOne(ch *Chat) *ChatUpdateOne
UpdateOne returns an update builder for the given entity.
func (*ChatClient) UpdateOneID ¶
func (c *ChatClient) UpdateOneID(id uuid.UUID) *ChatUpdateOne
UpdateOneID returns an update builder for the given id.
func (*ChatClient) Use ¶
func (c *ChatClient) Use(hooks ...Hook)
Use adds a list of mutation hooks to the hooks stack. A call to `Use(f, g, h)` equals to `chat.Hooks(f(g(h())))`.
type ChatCreate ¶
type ChatCreate struct {
// contains filtered or unexported fields
}
ChatCreate is the builder for creating a Chat entity.
func (*ChatCreate) Exec ¶
func (cc *ChatCreate) Exec(ctx context.Context) error
Exec executes the query.
func (*ChatCreate) ExecX ¶
func (cc *ChatCreate) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*ChatCreate) Mutation ¶
func (cc *ChatCreate) Mutation() *ChatMutation
Mutation returns the ChatMutation object of the builder.
func (*ChatCreate) OnConflict ¶
func (cc *ChatCreate) OnConflict(opts ...sql.ConflictOption) *ChatUpsertOne
OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause of the `INSERT` statement. For example:
client.Chat.Create(). SetTitle(v). OnConflict( // Update the row with the new values // the was proposed for insertion. sql.ResolveWithNewValues(), ). // Override some of the fields with custom // update values. Update(func(u *ent.ChatUpsert) { SetTitle(v+v). }). Exec(ctx)
func (*ChatCreate) OnConflictColumns ¶
func (cc *ChatCreate) OnConflictColumns(columns ...string) *ChatUpsertOne
OnConflictColumns calls `OnConflict` and configures the columns as conflict target. Using this option is equivalent to using:
client.Chat.Create(). OnConflict(sql.ConflictColumns(columns...)). Exec(ctx)
func (*ChatCreate) Save ¶
func (cc *ChatCreate) Save(ctx context.Context) (*Chat, error)
Save creates the Chat in the database.
func (*ChatCreate) SaveX ¶
func (cc *ChatCreate) SaveX(ctx context.Context) *Chat
SaveX calls Save and panics if Save returns an error.
func (*ChatCreate) SetCreatedAt ¶
func (cc *ChatCreate) SetCreatedAt(t time.Time) *ChatCreate
SetCreatedAt sets the "createdAt" field.
func (*ChatCreate) SetHistory ¶
func (cc *ChatCreate) SetHistory(v v1.History) *ChatCreate
SetHistory sets the "history" field.
func (*ChatCreate) SetID ¶
func (cc *ChatCreate) SetID(u uuid.UUID) *ChatCreate
SetID sets the "id" field.
func (*ChatCreate) SetMessages ¶
func (cc *ChatCreate) SetMessages(v []v1.Message) *ChatCreate
SetMessages sets the "messages" field.
func (*ChatCreate) SetModels ¶
func (cc *ChatCreate) SetModels(s []string) *ChatCreate
SetModels sets the "models" field.
func (*ChatCreate) SetNillableCreatedAt ¶
func (cc *ChatCreate) SetNillableCreatedAt(t *time.Time) *ChatCreate
SetNillableCreatedAt sets the "createdAt" field if the given value is not nil.
func (*ChatCreate) SetNillableID ¶
func (cc *ChatCreate) SetNillableID(u *uuid.UUID) *ChatCreate
SetNillableID sets the "id" field if the given value is not nil.
func (*ChatCreate) SetTags ¶
func (cc *ChatCreate) SetTags(s []string) *ChatCreate
SetTags sets the "tags" field.
func (*ChatCreate) SetTitle ¶
func (cc *ChatCreate) SetTitle(s string) *ChatCreate
SetTitle sets the "title" field.
func (*ChatCreate) SetUserId ¶
func (cc *ChatCreate) SetUserId(u uuid.UUID) *ChatCreate
SetUserId sets the "userId" field.
type ChatCreateBulk ¶
type ChatCreateBulk struct {
// contains filtered or unexported fields
}
ChatCreateBulk is the builder for creating many Chat entities in bulk.
func (*ChatCreateBulk) Exec ¶
func (ccb *ChatCreateBulk) Exec(ctx context.Context) error
Exec executes the query.
func (*ChatCreateBulk) ExecX ¶
func (ccb *ChatCreateBulk) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*ChatCreateBulk) OnConflict ¶
func (ccb *ChatCreateBulk) OnConflict(opts ...sql.ConflictOption) *ChatUpsertBulk
OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause of the `INSERT` statement. For example:
client.Chat.CreateBulk(builders...). OnConflict( // Update the row with the new values // the was proposed for insertion. sql.ResolveWithNewValues(), ). // Override some of the fields with custom // update values. Update(func(u *ent.ChatUpsert) { SetTitle(v+v). }). Exec(ctx)
func (*ChatCreateBulk) OnConflictColumns ¶
func (ccb *ChatCreateBulk) OnConflictColumns(columns ...string) *ChatUpsertBulk
OnConflictColumns calls `OnConflict` and configures the columns as conflict target. Using this option is equivalent to using:
client.Chat.Create(). OnConflict(sql.ConflictColumns(columns...)). Exec(ctx)
type ChatDelete ¶
type ChatDelete struct {
// contains filtered or unexported fields
}
ChatDelete is the builder for deleting a Chat entity.
func (*ChatDelete) Exec ¶
func (cd *ChatDelete) Exec(ctx context.Context) (int, error)
Exec executes the deletion query and returns how many vertices were deleted.
func (*ChatDelete) ExecX ¶
func (cd *ChatDelete) ExecX(ctx context.Context) int
ExecX is like Exec, but panics if an error occurs.
func (*ChatDelete) Where ¶
func (cd *ChatDelete) Where(ps ...predicate.Chat) *ChatDelete
Where appends a list predicates to the ChatDelete builder.
type ChatDeleteOne ¶
type ChatDeleteOne struct {
// contains filtered or unexported fields
}
ChatDeleteOne is the builder for deleting a single Chat entity.
func (*ChatDeleteOne) Exec ¶
func (cdo *ChatDeleteOne) Exec(ctx context.Context) error
Exec executes the deletion query.
func (*ChatDeleteOne) ExecX ¶
func (cdo *ChatDeleteOne) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*ChatDeleteOne) Where ¶
func (cdo *ChatDeleteOne) Where(ps ...predicate.Chat) *ChatDeleteOne
Where appends a list predicates to the ChatDelete builder.
type ChatGroupBy ¶
type ChatGroupBy struct {
// contains filtered or unexported fields
}
ChatGroupBy is the group-by builder for Chat entities.
func (*ChatGroupBy) Aggregate ¶
func (cgb *ChatGroupBy) Aggregate(fns ...AggregateFunc) *ChatGroupBy
Aggregate adds the given aggregation functions to the group-by query.
func (*ChatGroupBy) Bool ¶
Bool returns a single bool from a selector. It is only allowed when selecting one field.
func (*ChatGroupBy) Bools ¶
Bools returns list of bools from a selector. It is only allowed when selecting one field.
func (*ChatGroupBy) Float64 ¶
Float64 returns a single float64 from a selector. It is only allowed when selecting one field.
func (*ChatGroupBy) Float64s ¶
Float64s returns list of float64s from a selector. It is only allowed when selecting one field.
func (*ChatGroupBy) Int ¶
Int returns a single int from a selector. It is only allowed when selecting one field.
func (*ChatGroupBy) Ints ¶
Ints returns list of ints from a selector. It is only allowed when selecting one field.
func (*ChatGroupBy) Scan ¶
func (cgb *ChatGroupBy) Scan(ctx context.Context, v any) error
Scan applies the selector query and scans the result into the given value.
func (*ChatGroupBy) String ¶
String returns a single string from a selector. It is only allowed when selecting one field.
type ChatMutation ¶
type ChatMutation struct {
// contains filtered or unexported fields
}
ChatMutation represents an operation that mutates the Chat nodes in the graph.
func (*ChatMutation) AddField ¶
func (m *ChatMutation) 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 (*ChatMutation) AddedEdges ¶
func (m *ChatMutation) AddedEdges() []string
AddedEdges returns all edge names that were set/added in this mutation.
func (*ChatMutation) AddedField ¶
func (m *ChatMutation) 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 (*ChatMutation) AddedFields ¶
func (m *ChatMutation) AddedFields() []string
AddedFields returns all numeric fields that were incremented/decremented during this mutation.
func (*ChatMutation) AddedIDs ¶
func (m *ChatMutation) AddedIDs(name string) []ent.Value
AddedIDs returns all IDs (to other nodes) that were added for the given edge name in this mutation.
func (*ChatMutation) AppendMessages ¶
func (m *ChatMutation) AppendMessages(v []v1.Message)
AppendMessages adds v to the "messages" field.
func (*ChatMutation) AppendModels ¶
func (m *ChatMutation) AppendModels(s []string)
AppendModels adds s to the "models" field.
func (*ChatMutation) AppendTags ¶
func (m *ChatMutation) AppendTags(s []string)
AppendTags adds s to the "tags" field.
func (*ChatMutation) AppendedMessages ¶
func (m *ChatMutation) AppendedMessages() ([]v1.Message, bool)
AppendedMessages returns the list of values that were appended to the "messages" field in this mutation.
func (*ChatMutation) AppendedModels ¶
func (m *ChatMutation) AppendedModels() ([]string, bool)
AppendedModels returns the list of values that were appended to the "models" field in this mutation.
func (*ChatMutation) AppendedTags ¶
func (m *ChatMutation) AppendedTags() ([]string, bool)
AppendedTags returns the list of values that were appended to the "tags" field in this mutation.
func (*ChatMutation) ClearEdge ¶
func (m *ChatMutation) 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 (*ChatMutation) ClearField ¶
func (m *ChatMutation) 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 (*ChatMutation) ClearedEdges ¶
func (m *ChatMutation) ClearedEdges() []string
ClearedEdges returns all edge names that were cleared in this mutation.
func (*ChatMutation) ClearedFields ¶
func (m *ChatMutation) ClearedFields() []string
ClearedFields returns all nullable fields that were cleared during this mutation.
func (ChatMutation) Client ¶
func (m ChatMutation) 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 (*ChatMutation) CreatedAt ¶
func (m *ChatMutation) CreatedAt() (r time.Time, exists bool)
CreatedAt returns the value of the "createdAt" field in the mutation.
func (*ChatMutation) EdgeCleared ¶
func (m *ChatMutation) EdgeCleared(name string) bool
EdgeCleared returns a boolean which indicates if the edge with the given name was cleared in this mutation.
func (*ChatMutation) Field ¶
func (m *ChatMutation) 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 (*ChatMutation) FieldCleared ¶
func (m *ChatMutation) FieldCleared(name string) bool
FieldCleared returns a boolean indicating if a field with the given name was cleared in this mutation.
func (*ChatMutation) Fields ¶
func (m *ChatMutation) 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 (*ChatMutation) History ¶
func (m *ChatMutation) History() (r v1.History, exists bool)
History returns the value of the "history" field in the mutation.
func (*ChatMutation) ID ¶
func (m *ChatMutation) ID() (id uuid.UUID, 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 (*ChatMutation) IDs ¶
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 (*ChatMutation) Messages ¶
func (m *ChatMutation) Messages() (r []v1.Message, exists bool)
Messages returns the value of the "messages" field in the mutation.
func (*ChatMutation) Models ¶
func (m *ChatMutation) Models() (r []string, exists bool)
Models returns the value of the "models" field in the mutation.
func (*ChatMutation) OldCreatedAt ¶
OldCreatedAt returns the old "createdAt" field's value of the Chat entity. If the Chat 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 (*ChatMutation) OldField ¶
OldField returns the old value of the field from the database. An error is returned if the mutation operation is not UpdateOne, or the query to the database failed.
func (*ChatMutation) OldHistory ¶
OldHistory returns the old "history" field's value of the Chat entity. If the Chat 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 (*ChatMutation) OldMessages ¶
OldMessages returns the old "messages" field's value of the Chat entity. If the Chat 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 (*ChatMutation) OldModels ¶
func (m *ChatMutation) OldModels(ctx context.Context) (v []string, err error)
OldModels returns the old "models" field's value of the Chat entity. If the Chat 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 (*ChatMutation) OldTags ¶
func (m *ChatMutation) OldTags(ctx context.Context) (v []string, err error)
OldTags returns the old "tags" field's value of the Chat entity. If the Chat 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 (*ChatMutation) OldTitle ¶
func (m *ChatMutation) OldTitle(ctx context.Context) (v string, err error)
OldTitle returns the old "title" field's value of the Chat entity. If the Chat 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 (*ChatMutation) OldUserId ¶
OldUserId returns the old "userId" field's value of the Chat entity. If the Chat 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 (*ChatMutation) RemovedEdges ¶
func (m *ChatMutation) RemovedEdges() []string
RemovedEdges returns all edge names that were removed in this mutation.
func (*ChatMutation) RemovedIDs ¶
func (m *ChatMutation) 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 (*ChatMutation) ResetCreatedAt ¶
func (m *ChatMutation) ResetCreatedAt()
ResetCreatedAt resets all changes to the "createdAt" field.
func (*ChatMutation) ResetEdge ¶
func (m *ChatMutation) 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 (*ChatMutation) ResetField ¶
func (m *ChatMutation) 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 (*ChatMutation) ResetHistory ¶
func (m *ChatMutation) ResetHistory()
ResetHistory resets all changes to the "history" field.
func (*ChatMutation) ResetMessages ¶
func (m *ChatMutation) ResetMessages()
ResetMessages resets all changes to the "messages" field.
func (*ChatMutation) ResetModels ¶
func (m *ChatMutation) ResetModels()
ResetModels resets all changes to the "models" field.
func (*ChatMutation) ResetTags ¶
func (m *ChatMutation) ResetTags()
ResetTags resets all changes to the "tags" field.
func (*ChatMutation) ResetTitle ¶
func (m *ChatMutation) ResetTitle()
ResetTitle resets all changes to the "title" field.
func (*ChatMutation) ResetUserId ¶
func (m *ChatMutation) ResetUserId()
ResetUserId resets all changes to the "userId" field.
func (*ChatMutation) SetCreatedAt ¶
func (m *ChatMutation) SetCreatedAt(t time.Time)
SetCreatedAt sets the "createdAt" field.
func (*ChatMutation) SetField ¶
func (m *ChatMutation) 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 (*ChatMutation) SetHistory ¶
func (m *ChatMutation) SetHistory(v v1.History)
SetHistory sets the "history" field.
func (*ChatMutation) SetID ¶
func (m *ChatMutation) SetID(id uuid.UUID)
SetID sets the value of the id field. Note that this operation is only accepted on creation of Chat entities.
func (*ChatMutation) SetMessages ¶
func (m *ChatMutation) SetMessages(v []v1.Message)
SetMessages sets the "messages" field.
func (*ChatMutation) SetModels ¶
func (m *ChatMutation) SetModels(s []string)
SetModels sets the "models" field.
func (*ChatMutation) SetOp ¶
func (m *ChatMutation) SetOp(op Op)
SetOp allows setting the mutation operation.
func (*ChatMutation) SetTags ¶
func (m *ChatMutation) SetTags(s []string)
SetTags sets the "tags" field.
func (*ChatMutation) SetTitle ¶
func (m *ChatMutation) SetTitle(s string)
SetTitle sets the "title" field.
func (*ChatMutation) SetUserId ¶
func (m *ChatMutation) SetUserId(u uuid.UUID)
SetUserId sets the "userId" field.
func (*ChatMutation) Tags ¶
func (m *ChatMutation) Tags() (r []string, exists bool)
Tags returns the value of the "tags" field in the mutation.
func (*ChatMutation) Title ¶
func (m *ChatMutation) Title() (r string, exists bool)
Title returns the value of the "title" field in the mutation.
func (ChatMutation) Tx ¶
func (m ChatMutation) Tx() (*Tx, error)
Tx returns an `ent.Tx` for mutations that were executed in transactions; it returns an error otherwise.
func (*ChatMutation) Type ¶
func (m *ChatMutation) Type() string
Type returns the node type of this mutation (Chat).
func (*ChatMutation) UserId ¶
func (m *ChatMutation) UserId() (r uuid.UUID, exists bool)
UserId returns the value of the "userId" field in the mutation.
func (*ChatMutation) Where ¶
func (m *ChatMutation) Where(ps ...predicate.Chat)
Where appends a list predicates to the ChatMutation builder.
func (*ChatMutation) WhereP ¶
func (m *ChatMutation) WhereP(ps ...func(*sql.Selector))
WhereP appends storage-level predicates to the ChatMutation builder. Using this method, users can use type-assertion to append predicates that do not depend on any generated package.
type ChatQuery ¶
type ChatQuery struct {
// contains filtered or unexported fields
}
ChatQuery is the builder for querying Chat entities.
func (*ChatQuery) Aggregate ¶
func (cq *ChatQuery) Aggregate(fns ...AggregateFunc) *ChatSelect
Aggregate returns a ChatSelect configured with the given aggregations.
func (*ChatQuery) Clone ¶
Clone returns a duplicate of the ChatQuery builder, including all associated steps. It can be used to prepare common query builders and use them differently after the clone is made.
func (*ChatQuery) First ¶
First returns the first Chat entity from the query. Returns a *NotFoundError when no Chat was found.
func (*ChatQuery) FirstID ¶
FirstID returns the first Chat ID from the query. Returns a *NotFoundError when no Chat ID was found.
func (*ChatQuery) GroupBy ¶
func (cq *ChatQuery) GroupBy(field string, fields ...string) *ChatGroupBy
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 { Title string `json:"title,omitempty"` Count int `json:"count,omitempty"` } client.Chat.Query(). GroupBy(chat.FieldTitle). Aggregate(ent.Count()). Scan(ctx, &v)
func (*ChatQuery) Only ¶
Only returns a single Chat entity found by the query, ensuring it only returns one. Returns a *NotSingularError when more than one Chat entity is found. Returns a *NotFoundError when no Chat entities are found.
func (*ChatQuery) OnlyID ¶
OnlyID is like Only, but returns the only Chat ID in the query. Returns a *NotSingularError when more than one Chat ID is found. Returns a *NotFoundError when no entities are found.
func (*ChatQuery) Order ¶
func (cq *ChatQuery) Order(o ...chat.OrderOption) *ChatQuery
Order specifies how the records should be ordered.
func (*ChatQuery) Select ¶
func (cq *ChatQuery) Select(fields ...string) *ChatSelect
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 { Title string `json:"title,omitempty"` } client.Chat.Query(). Select(chat.FieldTitle). Scan(ctx, &v)
type ChatSelect ¶
type ChatSelect struct { *ChatQuery // contains filtered or unexported fields }
ChatSelect is the builder for selecting fields of Chat entities.
func (*ChatSelect) Aggregate ¶
func (cs *ChatSelect) Aggregate(fns ...AggregateFunc) *ChatSelect
Aggregate adds the given aggregation functions to the selector query.
func (*ChatSelect) Bool ¶
Bool returns a single bool from a selector. It is only allowed when selecting one field.
func (*ChatSelect) Bools ¶
Bools returns list of bools from a selector. It is only allowed when selecting one field.
func (*ChatSelect) Float64 ¶
Float64 returns a single float64 from a selector. It is only allowed when selecting one field.
func (*ChatSelect) Float64s ¶
Float64s returns list of float64s from a selector. It is only allowed when selecting one field.
func (*ChatSelect) Int ¶
Int returns a single int from a selector. It is only allowed when selecting one field.
func (*ChatSelect) Ints ¶
Ints returns list of ints from a selector. It is only allowed when selecting one field.
func (*ChatSelect) Scan ¶
func (cs *ChatSelect) Scan(ctx context.Context, v any) error
Scan applies the selector query and scans the result into the given value.
func (*ChatSelect) String ¶
String returns a single string from a selector. It is only allowed when selecting one field.
type ChatUpdate ¶
type ChatUpdate struct {
// contains filtered or unexported fields
}
ChatUpdate is the builder for updating Chat entities.
func (*ChatUpdate) AppendMessages ¶
func (cu *ChatUpdate) AppendMessages(v []v1.Message) *ChatUpdate
AppendMessages appends v to the "messages" field.
func (*ChatUpdate) AppendModels ¶
func (cu *ChatUpdate) AppendModels(s []string) *ChatUpdate
AppendModels appends s to the "models" field.
func (*ChatUpdate) AppendTags ¶
func (cu *ChatUpdate) AppendTags(s []string) *ChatUpdate
AppendTags appends s to the "tags" field.
func (*ChatUpdate) Exec ¶
func (cu *ChatUpdate) Exec(ctx context.Context) error
Exec executes the query.
func (*ChatUpdate) ExecX ¶
func (cu *ChatUpdate) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*ChatUpdate) Mutation ¶
func (cu *ChatUpdate) Mutation() *ChatMutation
Mutation returns the ChatMutation object of the builder.
func (*ChatUpdate) Save ¶
func (cu *ChatUpdate) Save(ctx context.Context) (int, error)
Save executes the query and returns the number of nodes affected by the update operation.
func (*ChatUpdate) SaveX ¶
func (cu *ChatUpdate) SaveX(ctx context.Context) int
SaveX is like Save, but panics if an error occurs.
func (*ChatUpdate) SetHistory ¶
func (cu *ChatUpdate) SetHistory(v v1.History) *ChatUpdate
SetHistory sets the "history" field.
func (*ChatUpdate) SetMessages ¶
func (cu *ChatUpdate) SetMessages(v []v1.Message) *ChatUpdate
SetMessages sets the "messages" field.
func (*ChatUpdate) SetModels ¶
func (cu *ChatUpdate) SetModels(s []string) *ChatUpdate
SetModels sets the "models" field.
func (*ChatUpdate) SetNillableHistory ¶
func (cu *ChatUpdate) SetNillableHistory(v *v1.History) *ChatUpdate
SetNillableHistory sets the "history" field if the given value is not nil.
func (*ChatUpdate) SetNillableTitle ¶
func (cu *ChatUpdate) SetNillableTitle(s *string) *ChatUpdate
SetNillableTitle sets the "title" field if the given value is not nil.
func (*ChatUpdate) SetNillableUserId ¶
func (cu *ChatUpdate) SetNillableUserId(u *uuid.UUID) *ChatUpdate
SetNillableUserId sets the "userId" field if the given value is not nil.
func (*ChatUpdate) SetTags ¶
func (cu *ChatUpdate) SetTags(s []string) *ChatUpdate
SetTags sets the "tags" field.
func (*ChatUpdate) SetTitle ¶
func (cu *ChatUpdate) SetTitle(s string) *ChatUpdate
SetTitle sets the "title" field.
func (*ChatUpdate) SetUserId ¶
func (cu *ChatUpdate) SetUserId(u uuid.UUID) *ChatUpdate
SetUserId sets the "userId" field.
func (*ChatUpdate) Where ¶
func (cu *ChatUpdate) Where(ps ...predicate.Chat) *ChatUpdate
Where appends a list predicates to the ChatUpdate builder.
type ChatUpdateOne ¶
type ChatUpdateOne struct {
// contains filtered or unexported fields
}
ChatUpdateOne is the builder for updating a single Chat entity.
func (*ChatUpdateOne) AppendMessages ¶
func (cuo *ChatUpdateOne) AppendMessages(v []v1.Message) *ChatUpdateOne
AppendMessages appends v to the "messages" field.
func (*ChatUpdateOne) AppendModels ¶
func (cuo *ChatUpdateOne) AppendModels(s []string) *ChatUpdateOne
AppendModels appends s to the "models" field.
func (*ChatUpdateOne) AppendTags ¶
func (cuo *ChatUpdateOne) AppendTags(s []string) *ChatUpdateOne
AppendTags appends s to the "tags" field.
func (*ChatUpdateOne) Exec ¶
func (cuo *ChatUpdateOne) Exec(ctx context.Context) error
Exec executes the query on the entity.
func (*ChatUpdateOne) ExecX ¶
func (cuo *ChatUpdateOne) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*ChatUpdateOne) Mutation ¶
func (cuo *ChatUpdateOne) Mutation() *ChatMutation
Mutation returns the ChatMutation object of the builder.
func (*ChatUpdateOne) Save ¶
func (cuo *ChatUpdateOne) Save(ctx context.Context) (*Chat, error)
Save executes the query and returns the updated Chat entity.
func (*ChatUpdateOne) SaveX ¶
func (cuo *ChatUpdateOne) SaveX(ctx context.Context) *Chat
SaveX is like Save, but panics if an error occurs.
func (*ChatUpdateOne) Select ¶
func (cuo *ChatUpdateOne) Select(field string, fields ...string) *ChatUpdateOne
Select allows selecting one or more fields (columns) of the returned entity. The default is selecting all fields defined in the entity schema.
func (*ChatUpdateOne) SetHistory ¶
func (cuo *ChatUpdateOne) SetHistory(v v1.History) *ChatUpdateOne
SetHistory sets the "history" field.
func (*ChatUpdateOne) SetMessages ¶
func (cuo *ChatUpdateOne) SetMessages(v []v1.Message) *ChatUpdateOne
SetMessages sets the "messages" field.
func (*ChatUpdateOne) SetModels ¶
func (cuo *ChatUpdateOne) SetModels(s []string) *ChatUpdateOne
SetModels sets the "models" field.
func (*ChatUpdateOne) SetNillableHistory ¶
func (cuo *ChatUpdateOne) SetNillableHistory(v *v1.History) *ChatUpdateOne
SetNillableHistory sets the "history" field if the given value is not nil.
func (*ChatUpdateOne) SetNillableTitle ¶
func (cuo *ChatUpdateOne) SetNillableTitle(s *string) *ChatUpdateOne
SetNillableTitle sets the "title" field if the given value is not nil.
func (*ChatUpdateOne) SetNillableUserId ¶
func (cuo *ChatUpdateOne) SetNillableUserId(u *uuid.UUID) *ChatUpdateOne
SetNillableUserId sets the "userId" field if the given value is not nil.
func (*ChatUpdateOne) SetTags ¶
func (cuo *ChatUpdateOne) SetTags(s []string) *ChatUpdateOne
SetTags sets the "tags" field.
func (*ChatUpdateOne) SetTitle ¶
func (cuo *ChatUpdateOne) SetTitle(s string) *ChatUpdateOne
SetTitle sets the "title" field.
func (*ChatUpdateOne) SetUserId ¶
func (cuo *ChatUpdateOne) SetUserId(u uuid.UUID) *ChatUpdateOne
SetUserId sets the "userId" field.
func (*ChatUpdateOne) Where ¶
func (cuo *ChatUpdateOne) Where(ps ...predicate.Chat) *ChatUpdateOne
Where appends a list predicates to the ChatUpdate builder.
type ChatUpsert ¶
ChatUpsert is the "OnConflict" setter.
func (*ChatUpsert) SetHistory ¶
func (u *ChatUpsert) SetHistory(v v1.History) *ChatUpsert
SetHistory sets the "history" field.
func (*ChatUpsert) SetMessages ¶
func (u *ChatUpsert) SetMessages(v []v1.Message) *ChatUpsert
SetMessages sets the "messages" field.
func (*ChatUpsert) SetModels ¶
func (u *ChatUpsert) SetModels(v []string) *ChatUpsert
SetModels sets the "models" field.
func (*ChatUpsert) SetTags ¶
func (u *ChatUpsert) SetTags(v []string) *ChatUpsert
SetTags sets the "tags" field.
func (*ChatUpsert) SetTitle ¶
func (u *ChatUpsert) SetTitle(v string) *ChatUpsert
SetTitle sets the "title" field.
func (*ChatUpsert) SetUserId ¶
func (u *ChatUpsert) SetUserId(v uuid.UUID) *ChatUpsert
SetUserId sets the "userId" field.
func (*ChatUpsert) UpdateHistory ¶
func (u *ChatUpsert) UpdateHistory() *ChatUpsert
UpdateHistory sets the "history" field to the value that was provided on create.
func (*ChatUpsert) UpdateMessages ¶
func (u *ChatUpsert) UpdateMessages() *ChatUpsert
UpdateMessages sets the "messages" field to the value that was provided on create.
func (*ChatUpsert) UpdateModels ¶
func (u *ChatUpsert) UpdateModels() *ChatUpsert
UpdateModels sets the "models" field to the value that was provided on create.
func (*ChatUpsert) UpdateTags ¶
func (u *ChatUpsert) UpdateTags() *ChatUpsert
UpdateTags sets the "tags" field to the value that was provided on create.
func (*ChatUpsert) UpdateTitle ¶
func (u *ChatUpsert) UpdateTitle() *ChatUpsert
UpdateTitle sets the "title" field to the value that was provided on create.
func (*ChatUpsert) UpdateUserId ¶
func (u *ChatUpsert) UpdateUserId() *ChatUpsert
UpdateUserId sets the "userId" field to the value that was provided on create.
type ChatUpsertBulk ¶
type ChatUpsertBulk struct {
// contains filtered or unexported fields
}
ChatUpsertBulk is the builder for "upsert"-ing a bulk of Chat nodes.
func (*ChatUpsertBulk) DoNothing ¶
func (u *ChatUpsertBulk) DoNothing() *ChatUpsertBulk
DoNothing configures the conflict_action to `DO NOTHING`. Supported only by SQLite and PostgreSQL.
func (*ChatUpsertBulk) Exec ¶
func (u *ChatUpsertBulk) Exec(ctx context.Context) error
Exec executes the query.
func (*ChatUpsertBulk) ExecX ¶
func (u *ChatUpsertBulk) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*ChatUpsertBulk) Ignore ¶
func (u *ChatUpsertBulk) Ignore() *ChatUpsertBulk
Ignore sets each column to itself in case of conflict. Using this option is equivalent to using:
client.Chat.Create(). OnConflict(sql.ResolveWithIgnore()). Exec(ctx)
func (*ChatUpsertBulk) SetHistory ¶
func (u *ChatUpsertBulk) SetHistory(v v1.History) *ChatUpsertBulk
SetHistory sets the "history" field.
func (*ChatUpsertBulk) SetMessages ¶
func (u *ChatUpsertBulk) SetMessages(v []v1.Message) *ChatUpsertBulk
SetMessages sets the "messages" field.
func (*ChatUpsertBulk) SetModels ¶
func (u *ChatUpsertBulk) SetModels(v []string) *ChatUpsertBulk
SetModels sets the "models" field.
func (*ChatUpsertBulk) SetTags ¶
func (u *ChatUpsertBulk) SetTags(v []string) *ChatUpsertBulk
SetTags sets the "tags" field.
func (*ChatUpsertBulk) SetTitle ¶
func (u *ChatUpsertBulk) SetTitle(v string) *ChatUpsertBulk
SetTitle sets the "title" field.
func (*ChatUpsertBulk) SetUserId ¶
func (u *ChatUpsertBulk) SetUserId(v uuid.UUID) *ChatUpsertBulk
SetUserId sets the "userId" field.
func (*ChatUpsertBulk) Update ¶
func (u *ChatUpsertBulk) Update(set func(*ChatUpsert)) *ChatUpsertBulk
Update allows overriding fields `UPDATE` values. See the ChatCreateBulk.OnConflict documentation for more info.
func (*ChatUpsertBulk) UpdateHistory ¶
func (u *ChatUpsertBulk) UpdateHistory() *ChatUpsertBulk
UpdateHistory sets the "history" field to the value that was provided on create.
func (*ChatUpsertBulk) UpdateMessages ¶
func (u *ChatUpsertBulk) UpdateMessages() *ChatUpsertBulk
UpdateMessages sets the "messages" field to the value that was provided on create.
func (*ChatUpsertBulk) UpdateModels ¶
func (u *ChatUpsertBulk) UpdateModels() *ChatUpsertBulk
UpdateModels sets the "models" field to the value that was provided on create.
func (*ChatUpsertBulk) UpdateNewValues ¶
func (u *ChatUpsertBulk) UpdateNewValues() *ChatUpsertBulk
UpdateNewValues updates the mutable fields using the new values that were set on create. Using this option is equivalent to using:
client.Chat.Create(). OnConflict( sql.ResolveWithNewValues(), sql.ResolveWith(func(u *sql.UpdateSet) { u.SetIgnore(chat.FieldID) }), ). Exec(ctx)
func (*ChatUpsertBulk) UpdateTags ¶
func (u *ChatUpsertBulk) UpdateTags() *ChatUpsertBulk
UpdateTags sets the "tags" field to the value that was provided on create.
func (*ChatUpsertBulk) UpdateTitle ¶
func (u *ChatUpsertBulk) UpdateTitle() *ChatUpsertBulk
UpdateTitle sets the "title" field to the value that was provided on create.
func (*ChatUpsertBulk) UpdateUserId ¶
func (u *ChatUpsertBulk) UpdateUserId() *ChatUpsertBulk
UpdateUserId sets the "userId" field to the value that was provided on create.
type ChatUpsertOne ¶
type ChatUpsertOne struct {
// contains filtered or unexported fields
}
ChatUpsertOne is the builder for "upsert"-ing
one Chat node.
func (*ChatUpsertOne) DoNothing ¶
func (u *ChatUpsertOne) DoNothing() *ChatUpsertOne
DoNothing configures the conflict_action to `DO NOTHING`. Supported only by SQLite and PostgreSQL.
func (*ChatUpsertOne) Exec ¶
func (u *ChatUpsertOne) Exec(ctx context.Context) error
Exec executes the query.
func (*ChatUpsertOne) ExecX ¶
func (u *ChatUpsertOne) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*ChatUpsertOne) IDX ¶
func (u *ChatUpsertOne) IDX(ctx context.Context) uuid.UUID
IDX is like ID, but panics if an error occurs.
func (*ChatUpsertOne) Ignore ¶
func (u *ChatUpsertOne) Ignore() *ChatUpsertOne
Ignore sets each column to itself in case of conflict. Using this option is equivalent to using:
client.Chat.Create(). OnConflict(sql.ResolveWithIgnore()). Exec(ctx)
func (*ChatUpsertOne) SetHistory ¶
func (u *ChatUpsertOne) SetHistory(v v1.History) *ChatUpsertOne
SetHistory sets the "history" field.
func (*ChatUpsertOne) SetMessages ¶
func (u *ChatUpsertOne) SetMessages(v []v1.Message) *ChatUpsertOne
SetMessages sets the "messages" field.
func (*ChatUpsertOne) SetModels ¶
func (u *ChatUpsertOne) SetModels(v []string) *ChatUpsertOne
SetModels sets the "models" field.
func (*ChatUpsertOne) SetTags ¶
func (u *ChatUpsertOne) SetTags(v []string) *ChatUpsertOne
SetTags sets the "tags" field.
func (*ChatUpsertOne) SetTitle ¶
func (u *ChatUpsertOne) SetTitle(v string) *ChatUpsertOne
SetTitle sets the "title" field.
func (*ChatUpsertOne) SetUserId ¶
func (u *ChatUpsertOne) SetUserId(v uuid.UUID) *ChatUpsertOne
SetUserId sets the "userId" field.
func (*ChatUpsertOne) Update ¶
func (u *ChatUpsertOne) Update(set func(*ChatUpsert)) *ChatUpsertOne
Update allows overriding fields `UPDATE` values. See the ChatCreate.OnConflict documentation for more info.
func (*ChatUpsertOne) UpdateHistory ¶
func (u *ChatUpsertOne) UpdateHistory() *ChatUpsertOne
UpdateHistory sets the "history" field to the value that was provided on create.
func (*ChatUpsertOne) UpdateMessages ¶
func (u *ChatUpsertOne) UpdateMessages() *ChatUpsertOne
UpdateMessages sets the "messages" field to the value that was provided on create.
func (*ChatUpsertOne) UpdateModels ¶
func (u *ChatUpsertOne) UpdateModels() *ChatUpsertOne
UpdateModels sets the "models" field to the value that was provided on create.
func (*ChatUpsertOne) UpdateNewValues ¶
func (u *ChatUpsertOne) UpdateNewValues() *ChatUpsertOne
UpdateNewValues updates the mutable fields using the new values that were set on create except the ID field. Using this option is equivalent to using:
client.Chat.Create(). OnConflict( sql.ResolveWithNewValues(), sql.ResolveWith(func(u *sql.UpdateSet) { u.SetIgnore(chat.FieldID) }), ). Exec(ctx)
func (*ChatUpsertOne) UpdateTags ¶
func (u *ChatUpsertOne) UpdateTags() *ChatUpsertOne
UpdateTags sets the "tags" field to the value that was provided on create.
func (*ChatUpsertOne) UpdateTitle ¶
func (u *ChatUpsertOne) UpdateTitle() *ChatUpsertOne
UpdateTitle sets the "title" field to the value that was provided on create.
func (*ChatUpsertOne) UpdateUserId ¶
func (u *ChatUpsertOne) UpdateUserId() *ChatUpsertOne
UpdateUserId sets the "userId" field to the value that was provided on create.
type Client ¶
type Client struct { // Schema is the client for creating, migrating and dropping schema. Schema *migrate.Schema // Chat is the client for interacting with the Chat builders. Chat *ChatClient // contains filtered or unexported fields }
Client is the client that holds all ent builders.
func FromContext ¶
FromContext returns a Client stored inside a context, or nil if there isn't one.
func Open ¶
Open opens a database/sql.DB specified by the driver name and the data source name, and returns a new client attached to it. Optional parameters can be added for configuring the client.
func (*Client) Debug ¶
Debug returns a new debug-client. It's used to get verbose logging on specific operations.
client.Debug(). Chat. Query(). Count(ctx)
func (*Client) Intercept ¶
func (c *Client) Intercept(interceptors ...Interceptor)
Intercept adds the query interceptors to all the entity clients. In order to add interceptors to a specific client, call: `client.Node.Intercept(...)`.
type CommitFunc ¶
The CommitFunc type is an adapter to allow the use of ordinary function as a Committer. If f is a function with the appropriate signature, CommitFunc(f) is a Committer that calls f.
type CommitHook ¶
CommitHook defines the "commit middleware". A function that gets a Committer and returns a Committer. For example:
hook := func(next ent.Committer) ent.Committer { return ent.CommitFunc(func(ctx context.Context, tx *ent.Tx) error { // Do some stuff before. if err := next.Commit(ctx, tx); err != nil { return err } // Do some stuff after. return nil }) }
type ConstraintError ¶
type ConstraintError struct {
// contains filtered or unexported fields
}
ConstraintError returns when trying to create/update one or more entities and one or more of their constraints failed. For example, violation of edge or field uniqueness.
func (ConstraintError) Error ¶
func (e ConstraintError) Error() string
Error implements the error interface.
func (*ConstraintError) Unwrap ¶
func (e *ConstraintError) Unwrap() error
Unwrap implements the errors.Wrapper interface.
type InterceptFunc ¶
type InterceptFunc = ent.InterceptFunc
ent aliases to avoid import conflicts in user's code.
type Interceptor ¶
type Interceptor = ent.Interceptor
ent aliases to avoid import conflicts in user's code.
type MutateFunc ¶
type MutateFunc = ent.MutateFunc
ent aliases to avoid import conflicts in user's code.
type NotFoundError ¶
type NotFoundError struct {
// contains filtered or unexported fields
}
NotFoundError returns when trying to fetch a specific entity and it was not found in the database.
func (*NotFoundError) Error ¶
func (e *NotFoundError) Error() string
Error implements the error interface.
type NotLoadedError ¶
type NotLoadedError struct {
// contains filtered or unexported fields
}
NotLoadedError returns when trying to get a node that was not loaded by the query.
func (*NotLoadedError) Error ¶
func (e *NotLoadedError) Error() string
Error implements the error interface.
type NotSingularError ¶
type NotSingularError struct {
// contains filtered or unexported fields
}
NotSingularError returns when trying to fetch a singular entity and more then one was found in the database.
func (*NotSingularError) Error ¶
func (e *NotSingularError) Error() string
Error implements the error interface.
type OrderFunc ¶
OrderFunc applies an ordering on the sql selector. Deprecated: Use Asc/Desc functions or the package builders instead.
type QuerierFunc ¶
type QuerierFunc = ent.QuerierFunc
ent aliases to avoid import conflicts in user's code.
type QueryContext ¶
type QueryContext = ent.QueryContext
ent aliases to avoid import conflicts in user's code.
type RollbackFunc ¶
The RollbackFunc type is an adapter to allow the use of ordinary function as a Rollbacker. If f is a function with the appropriate signature, RollbackFunc(f) is a Rollbacker that calls f.
type RollbackHook ¶
type RollbackHook func(Rollbacker) Rollbacker
RollbackHook defines the "rollback middleware". A function that gets a Rollbacker and returns a Rollbacker. For example:
hook := func(next ent.Rollbacker) ent.Rollbacker { return ent.RollbackFunc(func(ctx context.Context, tx *ent.Tx) error { // Do some stuff before. if err := next.Rollback(ctx, tx); err != nil { return err } // Do some stuff after. return nil }) }
type Rollbacker ¶
Rollbacker is the interface that wraps the Rollback method.
type TraverseFunc ¶
type TraverseFunc = ent.TraverseFunc
ent aliases to avoid import conflicts in user's code.
type Tx ¶
type Tx struct { // Chat is the client for interacting with the Chat builders. Chat *ChatClient // contains filtered or unexported fields }
Tx is a transactional client that is created by calling Client.Tx().
func TxFromContext ¶
TxFromContext returns a Tx stored inside a context, or nil if there isn't one.
func (*Tx) OnRollback ¶
func (tx *Tx) OnRollback(f RollbackHook)
OnRollback adds a hook to call on rollback.
type ValidationError ¶
type ValidationError struct { Name string // Field or edge name. // contains filtered or unexported fields }
ValidationError returns when validating a field or edge fails.
func (*ValidationError) Error ¶
func (e *ValidationError) Error() string
Error implements the error interface.
func (*ValidationError) Unwrap ¶
func (e *ValidationError) Unwrap() error
Unwrap implements the errors.Wrapper interface.