chatent

package
v0.1.1-0...-0783f25 Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2023 License: MIT Imports: 22 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.
	TypeMessage = "Message"
	TypeSession = "Session"
)

Variables

This section is empty.

Functions

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(chatent.As(chatent.Sum(field1), "sum_field1"), (chatent.As(chatent.Sum(field2), "sum_field2")).
Scan(ctx, &v)

func Count

func Count() AggregateFunc

Count applies the "count" aggregation function on each group.

func Max

func Max(field string) AggregateFunc

Max applies the "max" aggregation function on the given field of each group.

func Mean

func Mean(field string) AggregateFunc

Mean applies the "mean" aggregation function on the given field of each group.

func Min

func Min(field string) AggregateFunc

Min applies the "min" aggregation function on the given field of each group.

func Sum

func Sum(field string) AggregateFunc

Sum applies the "sum" aggregation function on the given field of each group.

type Client

type Client struct {

	// Schema is the client for creating, migrating and dropping schema.
	Schema *migrate.Schema
	// Message is the client for interacting with the Message builders.
	Message *MessageClient
	// Session is the client for interacting with the Session builders.
	Session *SessionClient
	// 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().
	Message.
	Query().
	Count(ctx)

func (*Client) ExecContext

func (c *Client) ExecContext(ctx context.Context, query string, args ...any) (stdsql.Result, error)

ExecContext allows calling the underlying ExecContext method of the driver if it is supported by it. See, database/sql#DB.ExecContext for more information.

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) QueryContext

func (c *Client) QueryContext(ctx context.Context, query string, args ...any) (*stdsql.Rows, error)

QueryContext allows calling the underlying QueryContext method of the driver if it is supported by it. See, database/sql#DB.QueryContext for more information.

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 Message

type Message struct {

	// ID of the ent.
	ID int `json:"id,omitempty"`
	// 会话Id
	SessionID int `json:"session_id,omitempty"`
	// 消息发送者Id
	FromUserID string `json:"from_user_id,omitempty"`
	// 消息接收者Id
	ToUserID string `json:"to_user_id,omitempty"`
	// 消息内容
	Content string `json:"content,omitempty"`
	// SpouseID holds the value of the "spouse_id" field.
	SpouseID int `json:"spouse_id,omitempty"`
	// CreatedAt holds the value of the "created_at" field.
	CreatedAt time.Time `json:"created_at,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the MessageQuery when eager-loading is set.
	Edges MessageEdges `json:"edges"`
	// contains filtered or unexported fields
}

Message is the model entity for the Message schema.

func (*Message) ExecContext

func (c *Message) ExecContext(ctx context.Context, query string, args ...any) (stdsql.Result, error)

ExecContext allows calling the underlying ExecContext method of the driver if it is supported by it. See, database/sql#DB.ExecContext for more information.

func (*Message) QueryContext

func (c *Message) QueryContext(ctx context.Context, query string, args ...any) (*stdsql.Rows, error)

QueryContext allows calling the underlying QueryContext method of the driver if it is supported by it. See, database/sql#DB.QueryContext for more information.

func (*Message) QuerySession

func (m *Message) QuerySession() *SessionQuery

QuerySession queries the "session" edge of the Message entity.

func (*Message) QuerySpouse

func (m *Message) QuerySpouse() *MessageQuery

QuerySpouse queries the "spouse" edge of the Message entity.

func (*Message) String

func (m *Message) String() string

String implements the fmt.Stringer.

func (*Message) Unwrap

func (m *Message) Unwrap() *Message

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

func (m *Message) Update() *MessageUpdateOne

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

type MessageClient

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

MessageClient is a client for the Message schema.

func NewMessageClient

func NewMessageClient(c config) *MessageClient

NewMessageClient returns a client for the Message from the given config.

func (*MessageClient) Create

func (c *MessageClient) Create() *MessageCreate

Create returns a builder for creating a Message entity.

func (*MessageClient) CreateBulk

func (c *MessageClient) CreateBulk(builders ...*MessageCreate) *MessageCreateBulk

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

func (*MessageClient) Delete

func (c *MessageClient) Delete() *MessageDelete

Delete returns a delete builder for Message.

func (*MessageClient) DeleteOne

func (c *MessageClient) DeleteOne(m *Message) *MessageDeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*MessageClient) DeleteOneID

func (c *MessageClient) DeleteOneID(id int) *MessageDeleteOne

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

func (*MessageClient) ExecContext

func (c *MessageClient) ExecContext(ctx context.Context, query string, args ...any) (stdsql.Result, error)

ExecContext allows calling the underlying ExecContext method of the driver if it is supported by it. See, database/sql#DB.ExecContext for more information.

func (*MessageClient) Get

func (c *MessageClient) Get(ctx context.Context, id int) (*Message, error)

Get returns a Message entity by its id.

func (*MessageClient) GetX

func (c *MessageClient) GetX(ctx context.Context, id int) *Message

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

func (*MessageClient) Hooks

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

Hooks returns the client hooks.

func (*MessageClient) Intercept

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

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

func (*MessageClient) Interceptors

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

Interceptors returns the client interceptors.

func (*MessageClient) Query

func (c *MessageClient) Query() *MessageQuery

Query returns a query builder for Message.

func (*MessageClient) QueryContext

func (c *MessageClient) QueryContext(ctx context.Context, query string, args ...any) (*stdsql.Rows, error)

QueryContext allows calling the underlying QueryContext method of the driver if it is supported by it. See, database/sql#DB.QueryContext for more information.

func (*MessageClient) QuerySession

func (c *MessageClient) QuerySession(m *Message) *SessionQuery

QuerySession queries the session edge of a Message.

func (*MessageClient) QuerySpouse

func (c *MessageClient) QuerySpouse(m *Message) *MessageQuery

QuerySpouse queries the spouse edge of a Message.

func (*MessageClient) Update

func (c *MessageClient) Update() *MessageUpdate

Update returns an update builder for Message.

func (*MessageClient) UpdateOne

func (c *MessageClient) UpdateOne(m *Message) *MessageUpdateOne

UpdateOne returns an update builder for the given entity.

func (*MessageClient) UpdateOneID

func (c *MessageClient) UpdateOneID(id int) *MessageUpdateOne

UpdateOneID returns an update builder for the given id.

func (*MessageClient) Use

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

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

type MessageCreate

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

MessageCreate is the builder for creating a Message entity.

func (*MessageCreate) Exec

func (mc *MessageCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*MessageCreate) ExecContext

func (c *MessageCreate) ExecContext(ctx context.Context, query string, args ...any) (stdsql.Result, error)

ExecContext allows calling the underlying ExecContext method of the driver if it is supported by it. See, database/sql#DB.ExecContext for more information.

func (*MessageCreate) ExecX

func (mc *MessageCreate) ExecX(ctx context.Context)

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

func (*MessageCreate) Mutation

func (mc *MessageCreate) Mutation() *MessageMutation

Mutation returns the MessageMutation object of the builder.

func (*MessageCreate) OnConflict

func (mc *MessageCreate) OnConflict(opts ...sql.ConflictOption) *MessageUpsertOne

OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause of the `INSERT` statement. For example:

client.Message.Create().
	SetSessionID(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.MessageUpsert) {
		SetSessionID(v+v).
	}).
	Exec(ctx)

func (*MessageCreate) OnConflictColumns

func (mc *MessageCreate) OnConflictColumns(columns ...string) *MessageUpsertOne

OnConflictColumns calls `OnConflict` and configures the columns as conflict target. Using this option is equivalent to using:

client.Message.Create().
	OnConflict(sql.ConflictColumns(columns...)).
	Exec(ctx)

func (*MessageCreate) QueryContext

func (c *MessageCreate) QueryContext(ctx context.Context, query string, args ...any) (*stdsql.Rows, error)

QueryContext allows calling the underlying QueryContext method of the driver if it is supported by it. See, database/sql#DB.QueryContext for more information.

func (*MessageCreate) Save

func (mc *MessageCreate) Save(ctx context.Context) (*Message, error)

Save creates the Message in the database.

func (*MessageCreate) SaveX

func (mc *MessageCreate) SaveX(ctx context.Context) *Message

SaveX calls Save and panics if Save returns an error.

func (*MessageCreate) SetContent

func (mc *MessageCreate) SetContent(s string) *MessageCreate

SetContent sets the "content" field.

func (*MessageCreate) SetCreatedAt

func (mc *MessageCreate) SetCreatedAt(t time.Time) *MessageCreate

SetCreatedAt sets the "created_at" field.

func (*MessageCreate) SetFromUserID

func (mc *MessageCreate) SetFromUserID(s string) *MessageCreate

SetFromUserID sets the "from_user_id" field.

func (*MessageCreate) SetNillableCreatedAt

func (mc *MessageCreate) SetNillableCreatedAt(t *time.Time) *MessageCreate

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

func (*MessageCreate) SetNillableSessionID

func (mc *MessageCreate) SetNillableSessionID(i *int) *MessageCreate

SetNillableSessionID sets the "session_id" field if the given value is not nil.

func (*MessageCreate) SetNillableSpouseID

func (mc *MessageCreate) SetNillableSpouseID(i *int) *MessageCreate

SetNillableSpouseID sets the "spouse_id" field if the given value is not nil.

func (*MessageCreate) SetSession

func (mc *MessageCreate) SetSession(s *Session) *MessageCreate

SetSession sets the "session" edge to the Session entity.

func (*MessageCreate) SetSessionID

func (mc *MessageCreate) SetSessionID(i int) *MessageCreate

SetSessionID sets the "session_id" field.

func (*MessageCreate) SetSpouse

func (mc *MessageCreate) SetSpouse(m *Message) *MessageCreate

SetSpouse sets the "spouse" edge to the Message entity.

func (*MessageCreate) SetSpouseID

func (mc *MessageCreate) SetSpouseID(i int) *MessageCreate

SetSpouseID sets the "spouse_id" field.

func (*MessageCreate) SetToUserID

func (mc *MessageCreate) SetToUserID(s string) *MessageCreate

SetToUserID sets the "to_user_id" field.

type MessageCreateBulk

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

MessageCreateBulk is the builder for creating many Message entities in bulk.

func (*MessageCreateBulk) Exec

func (mcb *MessageCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*MessageCreateBulk) ExecContext

func (c *MessageCreateBulk) ExecContext(ctx context.Context, query string, args ...any) (stdsql.Result, error)

ExecContext allows calling the underlying ExecContext method of the driver if it is supported by it. See, database/sql#DB.ExecContext for more information.

func (*MessageCreateBulk) ExecX

func (mcb *MessageCreateBulk) ExecX(ctx context.Context)

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

func (*MessageCreateBulk) OnConflict

func (mcb *MessageCreateBulk) OnConflict(opts ...sql.ConflictOption) *MessageUpsertBulk

OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause of the `INSERT` statement. For example:

client.Message.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.MessageUpsert) {
		SetSessionID(v+v).
	}).
	Exec(ctx)

func (*MessageCreateBulk) OnConflictColumns

func (mcb *MessageCreateBulk) OnConflictColumns(columns ...string) *MessageUpsertBulk

OnConflictColumns calls `OnConflict` and configures the columns as conflict target. Using this option is equivalent to using:

client.Message.Create().
	OnConflict(sql.ConflictColumns(columns...)).
	Exec(ctx)

func (*MessageCreateBulk) QueryContext

func (c *MessageCreateBulk) QueryContext(ctx context.Context, query string, args ...any) (*stdsql.Rows, error)

QueryContext allows calling the underlying QueryContext method of the driver if it is supported by it. See, database/sql#DB.QueryContext for more information.

func (*MessageCreateBulk) Save

func (mcb *MessageCreateBulk) Save(ctx context.Context) ([]*Message, error)

Save creates the Message entities in the database.

func (*MessageCreateBulk) SaveX

func (mcb *MessageCreateBulk) SaveX(ctx context.Context) []*Message

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

type MessageDelete

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

MessageDelete is the builder for deleting a Message entity.

func (*MessageDelete) Exec

func (md *MessageDelete) Exec(ctx context.Context) (int, error)

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

func (*MessageDelete) ExecContext

func (c *MessageDelete) ExecContext(ctx context.Context, query string, args ...any) (stdsql.Result, error)

ExecContext allows calling the underlying ExecContext method of the driver if it is supported by it. See, database/sql#DB.ExecContext for more information.

func (*MessageDelete) ExecX

func (md *MessageDelete) ExecX(ctx context.Context) int

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

func (*MessageDelete) QueryContext

func (c *MessageDelete) QueryContext(ctx context.Context, query string, args ...any) (*stdsql.Rows, error)

QueryContext allows calling the underlying QueryContext method of the driver if it is supported by it. See, database/sql#DB.QueryContext for more information.

func (*MessageDelete) Where

func (md *MessageDelete) Where(ps ...predicate.Message) *MessageDelete

Where appends a list predicates to the MessageDelete builder.

type MessageDeleteOne

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

MessageDeleteOne is the builder for deleting a single Message entity.

func (*MessageDeleteOne) Exec

func (mdo *MessageDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*MessageDeleteOne) ExecX

func (mdo *MessageDeleteOne) ExecX(ctx context.Context)

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

func (*MessageDeleteOne) Where

Where appends a list predicates to the MessageDelete builder.

type MessageEdges

type MessageEdges struct {
	// Spouse holds the value of the spouse edge.
	Spouse *Message `json:"spouse,omitempty"`
	// Session holds the value of the session edge.
	Session *Session `json:"session,omitempty"`
	// contains filtered or unexported fields
}

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

func (MessageEdges) SessionOrErr

func (e MessageEdges) SessionOrErr() (*Session, error)

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

func (MessageEdges) SpouseOrErr

func (e MessageEdges) SpouseOrErr() (*Message, error)

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

type MessageFilter

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

MessageFilter provides a generic filtering capability at runtime for MessageQuery.

func (*MessageFilter) ExecContext

func (c *MessageFilter) ExecContext(ctx context.Context, query string, args ...any) (stdsql.Result, error)

ExecContext allows calling the underlying ExecContext method of the driver if it is supported by it. See, database/sql#DB.ExecContext for more information.

func (*MessageFilter) QueryContext

func (c *MessageFilter) QueryContext(ctx context.Context, query string, args ...any) (*stdsql.Rows, error)

QueryContext allows calling the underlying QueryContext method of the driver if it is supported by it. See, database/sql#DB.QueryContext for more information.

func (*MessageFilter) Where

func (f *MessageFilter) Where(p entql.P)

Where applies the entql predicate on the query filter.

func (*MessageFilter) WhereContent

func (f *MessageFilter) WhereContent(p entql.StringP)

WhereContent applies the entql string predicate on the content field.

func (*MessageFilter) WhereCreatedAt

func (f *MessageFilter) WhereCreatedAt(p entql.TimeP)

WhereCreatedAt applies the entql time.Time predicate on the created_at field.

func (*MessageFilter) WhereFromUserID

func (f *MessageFilter) WhereFromUserID(p entql.StringP)

WhereFromUserID applies the entql string predicate on the from_user_id field.

func (*MessageFilter) WhereHasSession

func (f *MessageFilter) WhereHasSession()

WhereHasSession applies a predicate to check if query has an edge session.

func (*MessageFilter) WhereHasSessionWith

func (f *MessageFilter) WhereHasSessionWith(preds ...predicate.Session)

WhereHasSessionWith applies a predicate to check if query has an edge session with a given conditions (other predicates).

func (*MessageFilter) WhereHasSpouse

func (f *MessageFilter) WhereHasSpouse()

WhereHasSpouse applies a predicate to check if query has an edge spouse.

func (*MessageFilter) WhereHasSpouseWith

func (f *MessageFilter) WhereHasSpouseWith(preds ...predicate.Message)

WhereHasSpouseWith applies a predicate to check if query has an edge spouse with a given conditions (other predicates).

func (*MessageFilter) WhereID

func (f *MessageFilter) WhereID(p entql.IntP)

WhereID applies the entql int predicate on the id field.

func (*MessageFilter) WhereSessionID

func (f *MessageFilter) WhereSessionID(p entql.IntP)

WhereSessionID applies the entql int predicate on the session_id field.

func (*MessageFilter) WhereSpouseID

func (f *MessageFilter) WhereSpouseID(p entql.IntP)

WhereSpouseID applies the entql int predicate on the spouse_id field.

func (*MessageFilter) WhereToUserID

func (f *MessageFilter) WhereToUserID(p entql.StringP)

WhereToUserID applies the entql string predicate on the to_user_id field.

type MessageGroupBy

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

MessageGroupBy is the group-by builder for Message entities.

func (*MessageGroupBy) Aggregate

func (mgb *MessageGroupBy) Aggregate(fns ...AggregateFunc) *MessageGroupBy

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

func (*MessageGroupBy) Bool

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

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

func (*MessageGroupBy) BoolX

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

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

func (*MessageGroupBy) Bools

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

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

func (*MessageGroupBy) BoolsX

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

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

func (*MessageGroupBy) Float64

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

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

func (*MessageGroupBy) Float64X

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

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

func (*MessageGroupBy) Float64s

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

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

func (*MessageGroupBy) Float64sX

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

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

func (*MessageGroupBy) Int

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

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

func (*MessageGroupBy) IntX

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

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

func (*MessageGroupBy) Ints

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

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

func (*MessageGroupBy) IntsX

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

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

func (*MessageGroupBy) Scan

func (mgb *MessageGroupBy) Scan(ctx context.Context, v any) error

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

func (*MessageGroupBy) ScanX

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

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

func (*MessageGroupBy) String

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

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

func (*MessageGroupBy) StringX

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

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

func (*MessageGroupBy) Strings

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

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

func (*MessageGroupBy) StringsX

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

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

type MessageMutation

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

MessageMutation represents an operation that mutates the Message nodes in the graph.

func (*MessageMutation) AddField

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

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

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

func (*MessageMutation) AddedField

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

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

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

func (*MessageMutation) AddedIDs

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

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

func (*MessageMutation) ClearEdge

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

func (m *MessageMutation) 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 (*MessageMutation) ClearSession

func (m *MessageMutation) ClearSession()

ClearSession clears the "session" edge to the Session entity.

func (*MessageMutation) ClearSessionID

func (m *MessageMutation) ClearSessionID()

ClearSessionID clears the value of the "session_id" field.

func (*MessageMutation) ClearSpouse

func (m *MessageMutation) ClearSpouse()

ClearSpouse clears the "spouse" edge to the Message entity.

func (*MessageMutation) ClearSpouseID

func (m *MessageMutation) ClearSpouseID()

ClearSpouseID clears the value of the "spouse_id" field.

func (*MessageMutation) ClearedEdges

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

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

func (*MessageMutation) ClearedFields

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

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

func (MessageMutation) Client

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

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

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

func (*MessageMutation) CreatedAt

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

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

func (*MessageMutation) EdgeCleared

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

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

func (*MessageMutation) ExecContext

func (c *MessageMutation) ExecContext(ctx context.Context, query string, args ...any) (stdsql.Result, error)

ExecContext allows calling the underlying ExecContext method of the driver if it is supported by it. See, database/sql#DB.ExecContext for more information.

func (*MessageMutation) Field

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

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

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

func (*MessageMutation) Fields

func (m *MessageMutation) 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 (*MessageMutation) Filter

func (m *MessageMutation) Filter() *MessageFilter

Filter returns an entql.Where implementation to apply filters on the MessageMutation builder.

func (*MessageMutation) FromUserID

func (m *MessageMutation) FromUserID() (r string, exists bool)

FromUserID returns the value of the "from_user_id" field in the mutation.

func (*MessageMutation) ID

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

func (m *MessageMutation) 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 (*MessageMutation) OldContent

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

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

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

OldCreatedAt returns the old "created_at" field's value of the Message entity. If the Message 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 (*MessageMutation) OldField

func (m *MessageMutation) 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 (*MessageMutation) OldFromUserID

func (m *MessageMutation) OldFromUserID(ctx context.Context) (v string, err error)

OldFromUserID returns the old "from_user_id" field's value of the Message entity. If the Message 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 (*MessageMutation) OldSessionID

func (m *MessageMutation) OldSessionID(ctx context.Context) (v int, err error)

OldSessionID returns the old "session_id" field's value of the Message entity. If the Message 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 (*MessageMutation) OldSpouseID

func (m *MessageMutation) OldSpouseID(ctx context.Context) (v int, err error)

OldSpouseID returns the old "spouse_id" field's value of the Message entity. If the Message 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 (*MessageMutation) OldToUserID

func (m *MessageMutation) OldToUserID(ctx context.Context) (v string, err error)

OldToUserID returns the old "to_user_id" field's value of the Message entity. If the Message 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 (*MessageMutation) Op

func (m *MessageMutation) Op() Op

Op returns the operation name.

func (*MessageMutation) QueryContext

func (c *MessageMutation) QueryContext(ctx context.Context, query string, args ...any) (*stdsql.Rows, error)

QueryContext allows calling the underlying QueryContext method of the driver if it is supported by it. See, database/sql#DB.QueryContext for more information.

func (*MessageMutation) RemovedEdges

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

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

func (*MessageMutation) RemovedIDs

func (m *MessageMutation) 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 (*MessageMutation) ResetContent

func (m *MessageMutation) ResetContent()

ResetContent resets all changes to the "content" field.

func (*MessageMutation) ResetCreatedAt

func (m *MessageMutation) ResetCreatedAt()

ResetCreatedAt resets all changes to the "created_at" field.

func (*MessageMutation) ResetEdge

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

func (m *MessageMutation) 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 (*MessageMutation) ResetFromUserID

func (m *MessageMutation) ResetFromUserID()

ResetFromUserID resets all changes to the "from_user_id" field.

func (*MessageMutation) ResetSession

func (m *MessageMutation) ResetSession()

ResetSession resets all changes to the "session" edge.

func (*MessageMutation) ResetSessionID

func (m *MessageMutation) ResetSessionID()

ResetSessionID resets all changes to the "session_id" field.

func (*MessageMutation) ResetSpouse

func (m *MessageMutation) ResetSpouse()

ResetSpouse resets all changes to the "spouse" edge.

func (*MessageMutation) ResetSpouseID

func (m *MessageMutation) ResetSpouseID()

ResetSpouseID resets all changes to the "spouse_id" field.

func (*MessageMutation) ResetToUserID

func (m *MessageMutation) ResetToUserID()

ResetToUserID resets all changes to the "to_user_id" field.

func (*MessageMutation) SessionCleared

func (m *MessageMutation) SessionCleared() bool

SessionCleared reports if the "session" edge to the Session entity was cleared.

func (*MessageMutation) SessionID

func (m *MessageMutation) SessionID() (r int, exists bool)

SessionID returns the value of the "session_id" field in the mutation.

func (*MessageMutation) SessionIDCleared

func (m *MessageMutation) SessionIDCleared() bool

SessionIDCleared returns if the "session_id" field was cleared in this mutation.

func (*MessageMutation) SessionIDs

func (m *MessageMutation) SessionIDs() (ids []int)

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

func (*MessageMutation) SetContent

func (m *MessageMutation) SetContent(s string)

SetContent sets the "content" field.

func (*MessageMutation) SetCreatedAt

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

SetCreatedAt sets the "created_at" field.

func (*MessageMutation) SetField

func (m *MessageMutation) 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 (*MessageMutation) SetFromUserID

func (m *MessageMutation) SetFromUserID(s string)

SetFromUserID sets the "from_user_id" field.

func (*MessageMutation) SetOp

func (m *MessageMutation) SetOp(op Op)

SetOp allows setting the mutation operation.

func (*MessageMutation) SetSessionID

func (m *MessageMutation) SetSessionID(i int)

SetSessionID sets the "session_id" field.

func (*MessageMutation) SetSpouseID

func (m *MessageMutation) SetSpouseID(i int)

SetSpouseID sets the "spouse_id" field.

func (*MessageMutation) SetToUserID

func (m *MessageMutation) SetToUserID(s string)

SetToUserID sets the "to_user_id" field.

func (*MessageMutation) SpouseCleared

func (m *MessageMutation) SpouseCleared() bool

SpouseCleared reports if the "spouse" edge to the Message entity was cleared.

func (*MessageMutation) SpouseID

func (m *MessageMutation) SpouseID() (r int, exists bool)

SpouseID returns the value of the "spouse_id" field in the mutation.

func (*MessageMutation) SpouseIDCleared

func (m *MessageMutation) SpouseIDCleared() bool

SpouseIDCleared returns if the "spouse_id" field was cleared in this mutation.

func (*MessageMutation) SpouseIDs

func (m *MessageMutation) SpouseIDs() (ids []int)

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

func (*MessageMutation) ToUserID

func (m *MessageMutation) ToUserID() (r string, exists bool)

ToUserID returns the value of the "to_user_id" field in the mutation.

func (MessageMutation) Tx

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

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

func (*MessageMutation) Type

func (m *MessageMutation) Type() string

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

func (*MessageMutation) Where

func (m *MessageMutation) Where(ps ...predicate.Message)

Where appends a list predicates to the MessageMutation builder.

func (*MessageMutation) WhereP

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

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

type MessageQuery

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

MessageQuery is the builder for querying Message entities.

func (*MessageQuery) Aggregate

func (mq *MessageQuery) Aggregate(fns ...AggregateFunc) *MessageSelect

Aggregate returns a MessageSelect configured with the given aggregations.

func (*MessageQuery) All

func (mq *MessageQuery) All(ctx context.Context) ([]*Message, error)

All executes the query and returns a list of Messages.

func (*MessageQuery) AllX

func (mq *MessageQuery) AllX(ctx context.Context) []*Message

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

func (*MessageQuery) Clone

func (mq *MessageQuery) Clone() *MessageQuery

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

func (*MessageQuery) Count

func (mq *MessageQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*MessageQuery) CountX

func (mq *MessageQuery) CountX(ctx context.Context) int

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

func (*MessageQuery) ExecContext

func (c *MessageQuery) ExecContext(ctx context.Context, query string, args ...any) (stdsql.Result, error)

ExecContext allows calling the underlying ExecContext method of the driver if it is supported by it. See, database/sql#DB.ExecContext for more information.

func (*MessageQuery) Exist

func (mq *MessageQuery) Exist(ctx context.Context) (bool, error)

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

func (*MessageQuery) ExistX

func (mq *MessageQuery) ExistX(ctx context.Context) bool

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

func (*MessageQuery) Filter

func (mq *MessageQuery) Filter() *MessageFilter

Filter returns a Filter implementation to apply filters on the MessageQuery builder.

func (*MessageQuery) First

func (mq *MessageQuery) First(ctx context.Context) (*Message, error)

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

func (*MessageQuery) FirstID

func (mq *MessageQuery) FirstID(ctx context.Context) (id int, err error)

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

func (*MessageQuery) FirstIDX

func (mq *MessageQuery) FirstIDX(ctx context.Context) int

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

func (*MessageQuery) FirstX

func (mq *MessageQuery) FirstX(ctx context.Context) *Message

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

func (*MessageQuery) ForShare

func (mq *MessageQuery) ForShare(opts ...sql.LockOption) *MessageQuery

ForShare behaves similarly to ForUpdate, except that it acquires a shared mode lock on any rows that are read. Other sessions can read the rows, but cannot modify them until your transaction commits.

func (*MessageQuery) ForUpdate

func (mq *MessageQuery) ForUpdate(opts ...sql.LockOption) *MessageQuery

ForUpdate locks the selected rows against concurrent updates, and prevent them from being updated, deleted or "selected ... for update" by other sessions, until the transaction is either committed or rolled-back.

func (*MessageQuery) GroupBy

func (mq *MessageQuery) GroupBy(field string, fields ...string) *MessageGroupBy

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 {
	SessionID int `json:"session_id,omitempty"`
	Count int `json:"count,omitempty"`
}

client.Message.Query().
	GroupBy(message.FieldSessionID).
	Aggregate(chatent.Count()).
	Scan(ctx, &v)

func (*MessageQuery) IDs

func (mq *MessageQuery) IDs(ctx context.Context) ([]int, error)

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

func (*MessageQuery) IDsX

func (mq *MessageQuery) IDsX(ctx context.Context) []int

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

func (*MessageQuery) Limit

func (mq *MessageQuery) Limit(limit int) *MessageQuery

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

func (*MessageQuery) Modify

func (mq *MessageQuery) Modify(modifiers ...func(s *sql.Selector)) *MessageSelect

Modify adds a query modifier for attaching custom logic to queries.

func (*MessageQuery) Offset

func (mq *MessageQuery) Offset(offset int) *MessageQuery

Offset to start from.

func (*MessageQuery) Only

func (mq *MessageQuery) Only(ctx context.Context) (*Message, error)

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

func (*MessageQuery) OnlyID

func (mq *MessageQuery) OnlyID(ctx context.Context) (id int, err error)

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

func (*MessageQuery) OnlyIDX

func (mq *MessageQuery) OnlyIDX(ctx context.Context) int

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

func (*MessageQuery) OnlyX

func (mq *MessageQuery) OnlyX(ctx context.Context) *Message

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

func (*MessageQuery) Order

func (mq *MessageQuery) Order(o ...OrderFunc) *MessageQuery

Order specifies how the records should be ordered.

func (*MessageQuery) QueryContext

func (c *MessageQuery) QueryContext(ctx context.Context, query string, args ...any) (*stdsql.Rows, error)

QueryContext allows calling the underlying QueryContext method of the driver if it is supported by it. See, database/sql#DB.QueryContext for more information.

func (*MessageQuery) QuerySession

func (mq *MessageQuery) QuerySession() *SessionQuery

QuerySession chains the current query on the "session" edge.

func (*MessageQuery) QuerySpouse

func (mq *MessageQuery) QuerySpouse() *MessageQuery

QuerySpouse chains the current query on the "spouse" edge.

func (*MessageQuery) Select

func (mq *MessageQuery) Select(fields ...string) *MessageSelect

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 {
	SessionID int `json:"session_id,omitempty"`
}

client.Message.Query().
	Select(message.FieldSessionID).
	Scan(ctx, &v)

func (*MessageQuery) Unique

func (mq *MessageQuery) Unique(unique bool) *MessageQuery

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

func (mq *MessageQuery) Where(ps ...predicate.Message) *MessageQuery

Where adds a new predicate for the MessageQuery builder.

func (*MessageQuery) WithSession

func (mq *MessageQuery) WithSession(opts ...func(*SessionQuery)) *MessageQuery

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

func (*MessageQuery) WithSpouse

func (mq *MessageQuery) WithSpouse(opts ...func(*MessageQuery)) *MessageQuery

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

type MessageSelect

type MessageSelect struct {
	*MessageQuery
	// contains filtered or unexported fields
}

MessageSelect is the builder for selecting fields of Message entities.

func (*MessageSelect) Aggregate

func (ms *MessageSelect) Aggregate(fns ...AggregateFunc) *MessageSelect

Aggregate adds the given aggregation functions to the selector query.

func (*MessageSelect) Bool

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

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

func (*MessageSelect) BoolX

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

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

func (*MessageSelect) Bools

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

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

func (*MessageSelect) BoolsX

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

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

func (MessageSelect) ExecContext

func (c MessageSelect) ExecContext(ctx context.Context, query string, args ...any) (stdsql.Result, error)

ExecContext allows calling the underlying ExecContext method of the driver if it is supported by it. See, database/sql#DB.ExecContext for more information.

func (*MessageSelect) Float64

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

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

func (*MessageSelect) Float64X

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

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

func (*MessageSelect) Float64s

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

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

func (*MessageSelect) Float64sX

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

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

func (*MessageSelect) Int

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

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

func (*MessageSelect) IntX

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

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

func (*MessageSelect) Ints

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

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

func (*MessageSelect) IntsX

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

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

func (*MessageSelect) Modify

func (ms *MessageSelect) Modify(modifiers ...func(s *sql.Selector)) *MessageSelect

Modify adds a query modifier for attaching custom logic to queries.

func (MessageSelect) QueryContext

func (c MessageSelect) QueryContext(ctx context.Context, query string, args ...any) (*stdsql.Rows, error)

QueryContext allows calling the underlying QueryContext method of the driver if it is supported by it. See, database/sql#DB.QueryContext for more information.

func (*MessageSelect) Scan

func (ms *MessageSelect) Scan(ctx context.Context, v any) error

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

func (*MessageSelect) ScanX

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

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

func (*MessageSelect) String

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

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

func (*MessageSelect) StringX

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

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

func (*MessageSelect) Strings

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

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

func (*MessageSelect) StringsX

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

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

type MessageUpdate

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

MessageUpdate is the builder for updating Message entities.

func (*MessageUpdate) ClearSession

func (mu *MessageUpdate) ClearSession() *MessageUpdate

ClearSession clears the "session" edge to the Session entity.

func (*MessageUpdate) ClearSessionID

func (mu *MessageUpdate) ClearSessionID() *MessageUpdate

ClearSessionID clears the value of the "session_id" field.

func (*MessageUpdate) ClearSpouse

func (mu *MessageUpdate) ClearSpouse() *MessageUpdate

ClearSpouse clears the "spouse" edge to the Message entity.

func (*MessageUpdate) ClearSpouseID

func (mu *MessageUpdate) ClearSpouseID() *MessageUpdate

ClearSpouseID clears the value of the "spouse_id" field.

func (*MessageUpdate) Exec

func (mu *MessageUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*MessageUpdate) ExecContext

func (c *MessageUpdate) ExecContext(ctx context.Context, query string, args ...any) (stdsql.Result, error)

ExecContext allows calling the underlying ExecContext method of the driver if it is supported by it. See, database/sql#DB.ExecContext for more information.

func (*MessageUpdate) ExecX

func (mu *MessageUpdate) ExecX(ctx context.Context)

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

func (*MessageUpdate) Modify

func (mu *MessageUpdate) Modify(modifiers ...func(u *sql.UpdateBuilder)) *MessageUpdate

Modify adds a statement modifier for attaching custom logic to the UPDATE statement.

func (*MessageUpdate) Mutation

func (mu *MessageUpdate) Mutation() *MessageMutation

Mutation returns the MessageMutation object of the builder.

func (*MessageUpdate) QueryContext

func (c *MessageUpdate) QueryContext(ctx context.Context, query string, args ...any) (*stdsql.Rows, error)

QueryContext allows calling the underlying QueryContext method of the driver if it is supported by it. See, database/sql#DB.QueryContext for more information.

func (*MessageUpdate) Save

func (mu *MessageUpdate) Save(ctx context.Context) (int, error)

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

func (*MessageUpdate) SaveX

func (mu *MessageUpdate) SaveX(ctx context.Context) int

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

func (*MessageUpdate) SetContent

func (mu *MessageUpdate) SetContent(s string) *MessageUpdate

SetContent sets the "content" field.

func (*MessageUpdate) SetFromUserID

func (mu *MessageUpdate) SetFromUserID(s string) *MessageUpdate

SetFromUserID sets the "from_user_id" field.

func (*MessageUpdate) SetNillableSessionID

func (mu *MessageUpdate) SetNillableSessionID(i *int) *MessageUpdate

SetNillableSessionID sets the "session_id" field if the given value is not nil.

func (*MessageUpdate) SetNillableSpouseID

func (mu *MessageUpdate) SetNillableSpouseID(i *int) *MessageUpdate

SetNillableSpouseID sets the "spouse_id" field if the given value is not nil.

func (*MessageUpdate) SetSession

func (mu *MessageUpdate) SetSession(s *Session) *MessageUpdate

SetSession sets the "session" edge to the Session entity.

func (*MessageUpdate) SetSessionID

func (mu *MessageUpdate) SetSessionID(i int) *MessageUpdate

SetSessionID sets the "session_id" field.

func (*MessageUpdate) SetSpouse

func (mu *MessageUpdate) SetSpouse(m *Message) *MessageUpdate

SetSpouse sets the "spouse" edge to the Message entity.

func (*MessageUpdate) SetSpouseID

func (mu *MessageUpdate) SetSpouseID(i int) *MessageUpdate

SetSpouseID sets the "spouse_id" field.

func (*MessageUpdate) SetToUserID

func (mu *MessageUpdate) SetToUserID(s string) *MessageUpdate

SetToUserID sets the "to_user_id" field.

func (*MessageUpdate) Where

func (mu *MessageUpdate) Where(ps ...predicate.Message) *MessageUpdate

Where appends a list predicates to the MessageUpdate builder.

type MessageUpdateOne

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

MessageUpdateOne is the builder for updating a single Message entity.

func (*MessageUpdateOne) ClearSession

func (muo *MessageUpdateOne) ClearSession() *MessageUpdateOne

ClearSession clears the "session" edge to the Session entity.

func (*MessageUpdateOne) ClearSessionID

func (muo *MessageUpdateOne) ClearSessionID() *MessageUpdateOne

ClearSessionID clears the value of the "session_id" field.

func (*MessageUpdateOne) ClearSpouse

func (muo *MessageUpdateOne) ClearSpouse() *MessageUpdateOne

ClearSpouse clears the "spouse" edge to the Message entity.

func (*MessageUpdateOne) ClearSpouseID

func (muo *MessageUpdateOne) ClearSpouseID() *MessageUpdateOne

ClearSpouseID clears the value of the "spouse_id" field.

func (*MessageUpdateOne) Exec

func (muo *MessageUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*MessageUpdateOne) ExecContext

func (c *MessageUpdateOne) ExecContext(ctx context.Context, query string, args ...any) (stdsql.Result, error)

ExecContext allows calling the underlying ExecContext method of the driver if it is supported by it. See, database/sql#DB.ExecContext for more information.

func (*MessageUpdateOne) ExecX

func (muo *MessageUpdateOne) ExecX(ctx context.Context)

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

func (*MessageUpdateOne) Modify

func (muo *MessageUpdateOne) Modify(modifiers ...func(u *sql.UpdateBuilder)) *MessageUpdateOne

Modify adds a statement modifier for attaching custom logic to the UPDATE statement.

func (*MessageUpdateOne) Mutation

func (muo *MessageUpdateOne) Mutation() *MessageMutation

Mutation returns the MessageMutation object of the builder.

func (*MessageUpdateOne) QueryContext

func (c *MessageUpdateOne) QueryContext(ctx context.Context, query string, args ...any) (*stdsql.Rows, error)

QueryContext allows calling the underlying QueryContext method of the driver if it is supported by it. See, database/sql#DB.QueryContext for more information.

func (*MessageUpdateOne) Save

func (muo *MessageUpdateOne) Save(ctx context.Context) (*Message, error)

Save executes the query and returns the updated Message entity.

func (*MessageUpdateOne) SaveX

func (muo *MessageUpdateOne) SaveX(ctx context.Context) *Message

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

func (*MessageUpdateOne) Select

func (muo *MessageUpdateOne) Select(field string, fields ...string) *MessageUpdateOne

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

func (*MessageUpdateOne) SetContent

func (muo *MessageUpdateOne) SetContent(s string) *MessageUpdateOne

SetContent sets the "content" field.

func (*MessageUpdateOne) SetFromUserID

func (muo *MessageUpdateOne) SetFromUserID(s string) *MessageUpdateOne

SetFromUserID sets the "from_user_id" field.

func (*MessageUpdateOne) SetNillableSessionID

func (muo *MessageUpdateOne) SetNillableSessionID(i *int) *MessageUpdateOne

SetNillableSessionID sets the "session_id" field if the given value is not nil.

func (*MessageUpdateOne) SetNillableSpouseID

func (muo *MessageUpdateOne) SetNillableSpouseID(i *int) *MessageUpdateOne

SetNillableSpouseID sets the "spouse_id" field if the given value is not nil.

func (*MessageUpdateOne) SetSession

func (muo *MessageUpdateOne) SetSession(s *Session) *MessageUpdateOne

SetSession sets the "session" edge to the Session entity.

func (*MessageUpdateOne) SetSessionID

func (muo *MessageUpdateOne) SetSessionID(i int) *MessageUpdateOne

SetSessionID sets the "session_id" field.

func (*MessageUpdateOne) SetSpouse

func (muo *MessageUpdateOne) SetSpouse(m *Message) *MessageUpdateOne

SetSpouse sets the "spouse" edge to the Message entity.

func (*MessageUpdateOne) SetSpouseID

func (muo *MessageUpdateOne) SetSpouseID(i int) *MessageUpdateOne

SetSpouseID sets the "spouse_id" field.

func (*MessageUpdateOne) SetToUserID

func (muo *MessageUpdateOne) SetToUserID(s string) *MessageUpdateOne

SetToUserID sets the "to_user_id" field.

type MessageUpsert

type MessageUpsert struct {
	*sql.UpdateSet
}

MessageUpsert is the "OnConflict" setter.

func (*MessageUpsert) ClearSessionID

func (u *MessageUpsert) ClearSessionID() *MessageUpsert

ClearSessionID clears the value of the "session_id" field.

func (*MessageUpsert) ClearSpouseID

func (u *MessageUpsert) ClearSpouseID() *MessageUpsert

ClearSpouseID clears the value of the "spouse_id" field.

func (*MessageUpsert) SetContent

func (u *MessageUpsert) SetContent(v string) *MessageUpsert

SetContent sets the "content" field.

func (*MessageUpsert) SetFromUserID

func (u *MessageUpsert) SetFromUserID(v string) *MessageUpsert

SetFromUserID sets the "from_user_id" field.

func (*MessageUpsert) SetSessionID

func (u *MessageUpsert) SetSessionID(v int) *MessageUpsert

SetSessionID sets the "session_id" field.

func (*MessageUpsert) SetSpouseID

func (u *MessageUpsert) SetSpouseID(v int) *MessageUpsert

SetSpouseID sets the "spouse_id" field.

func (*MessageUpsert) SetToUserID

func (u *MessageUpsert) SetToUserID(v string) *MessageUpsert

SetToUserID sets the "to_user_id" field.

func (*MessageUpsert) UpdateContent

func (u *MessageUpsert) UpdateContent() *MessageUpsert

UpdateContent sets the "content" field to the value that was provided on create.

func (*MessageUpsert) UpdateFromUserID

func (u *MessageUpsert) UpdateFromUserID() *MessageUpsert

UpdateFromUserID sets the "from_user_id" field to the value that was provided on create.

func (*MessageUpsert) UpdateSessionID

func (u *MessageUpsert) UpdateSessionID() *MessageUpsert

UpdateSessionID sets the "session_id" field to the value that was provided on create.

func (*MessageUpsert) UpdateSpouseID

func (u *MessageUpsert) UpdateSpouseID() *MessageUpsert

UpdateSpouseID sets the "spouse_id" field to the value that was provided on create.

func (*MessageUpsert) UpdateToUserID

func (u *MessageUpsert) UpdateToUserID() *MessageUpsert

UpdateToUserID sets the "to_user_id" field to the value that was provided on create.

type MessageUpsertBulk

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

MessageUpsertBulk is the builder for "upsert"-ing a bulk of Message nodes.

func (*MessageUpsertBulk) ClearSessionID

func (u *MessageUpsertBulk) ClearSessionID() *MessageUpsertBulk

ClearSessionID clears the value of the "session_id" field.

func (*MessageUpsertBulk) ClearSpouseID

func (u *MessageUpsertBulk) ClearSpouseID() *MessageUpsertBulk

ClearSpouseID clears the value of the "spouse_id" field.

func (*MessageUpsertBulk) DoNothing

func (u *MessageUpsertBulk) DoNothing() *MessageUpsertBulk

DoNothing configures the conflict_action to `DO NOTHING`. Supported only by SQLite and PostgreSQL.

func (*MessageUpsertBulk) Exec

func (u *MessageUpsertBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*MessageUpsertBulk) ExecX

func (u *MessageUpsertBulk) ExecX(ctx context.Context)

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

func (*MessageUpsertBulk) Ignore

func (u *MessageUpsertBulk) Ignore() *MessageUpsertBulk

Ignore sets each column to itself in case of conflict. Using this option is equivalent to using:

client.Message.Create().
	OnConflict(sql.ResolveWithIgnore()).
	Exec(ctx)

func (*MessageUpsertBulk) SetContent

func (u *MessageUpsertBulk) SetContent(v string) *MessageUpsertBulk

SetContent sets the "content" field.

func (*MessageUpsertBulk) SetFromUserID

func (u *MessageUpsertBulk) SetFromUserID(v string) *MessageUpsertBulk

SetFromUserID sets the "from_user_id" field.

func (*MessageUpsertBulk) SetSessionID

func (u *MessageUpsertBulk) SetSessionID(v int) *MessageUpsertBulk

SetSessionID sets the "session_id" field.

func (*MessageUpsertBulk) SetSpouseID

func (u *MessageUpsertBulk) SetSpouseID(v int) *MessageUpsertBulk

SetSpouseID sets the "spouse_id" field.

func (*MessageUpsertBulk) SetToUserID

func (u *MessageUpsertBulk) SetToUserID(v string) *MessageUpsertBulk

SetToUserID sets the "to_user_id" field.

func (*MessageUpsertBulk) Update

func (u *MessageUpsertBulk) Update(set func(*MessageUpsert)) *MessageUpsertBulk

Update allows overriding fields `UPDATE` values. See the MessageCreateBulk.OnConflict documentation for more info.

func (*MessageUpsertBulk) UpdateContent

func (u *MessageUpsertBulk) UpdateContent() *MessageUpsertBulk

UpdateContent sets the "content" field to the value that was provided on create.

func (*MessageUpsertBulk) UpdateFromUserID

func (u *MessageUpsertBulk) UpdateFromUserID() *MessageUpsertBulk

UpdateFromUserID sets the "from_user_id" field to the value that was provided on create.

func (*MessageUpsertBulk) UpdateNewValues

func (u *MessageUpsertBulk) UpdateNewValues() *MessageUpsertBulk

UpdateNewValues updates the mutable fields using the new values that were set on create. Using this option is equivalent to using:

client.Message.Create().
	OnConflict(
		sql.ResolveWithNewValues(),
	).
	Exec(ctx)

func (*MessageUpsertBulk) UpdateSessionID

func (u *MessageUpsertBulk) UpdateSessionID() *MessageUpsertBulk

UpdateSessionID sets the "session_id" field to the value that was provided on create.

func (*MessageUpsertBulk) UpdateSpouseID

func (u *MessageUpsertBulk) UpdateSpouseID() *MessageUpsertBulk

UpdateSpouseID sets the "spouse_id" field to the value that was provided on create.

func (*MessageUpsertBulk) UpdateToUserID

func (u *MessageUpsertBulk) UpdateToUserID() *MessageUpsertBulk

UpdateToUserID sets the "to_user_id" field to the value that was provided on create.

type MessageUpsertOne

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

MessageUpsertOne is the builder for "upsert"-ing

one Message node.

func (*MessageUpsertOne) ClearSessionID

func (u *MessageUpsertOne) ClearSessionID() *MessageUpsertOne

ClearSessionID clears the value of the "session_id" field.

func (*MessageUpsertOne) ClearSpouseID

func (u *MessageUpsertOne) ClearSpouseID() *MessageUpsertOne

ClearSpouseID clears the value of the "spouse_id" field.

func (*MessageUpsertOne) DoNothing

func (u *MessageUpsertOne) DoNothing() *MessageUpsertOne

DoNothing configures the conflict_action to `DO NOTHING`. Supported only by SQLite and PostgreSQL.

func (*MessageUpsertOne) Exec

func (u *MessageUpsertOne) Exec(ctx context.Context) error

Exec executes the query.

func (*MessageUpsertOne) ExecX

func (u *MessageUpsertOne) ExecX(ctx context.Context)

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

func (*MessageUpsertOne) ID

func (u *MessageUpsertOne) ID(ctx context.Context) (id int, err error)

Exec executes the UPSERT query and returns the inserted/updated ID.

func (*MessageUpsertOne) IDX

func (u *MessageUpsertOne) IDX(ctx context.Context) int

IDX is like ID, but panics if an error occurs.

func (*MessageUpsertOne) Ignore

func (u *MessageUpsertOne) Ignore() *MessageUpsertOne

Ignore sets each column to itself in case of conflict. Using this option is equivalent to using:

client.Message.Create().
    OnConflict(sql.ResolveWithIgnore()).
    Exec(ctx)

func (*MessageUpsertOne) SetContent

func (u *MessageUpsertOne) SetContent(v string) *MessageUpsertOne

SetContent sets the "content" field.

func (*MessageUpsertOne) SetFromUserID

func (u *MessageUpsertOne) SetFromUserID(v string) *MessageUpsertOne

SetFromUserID sets the "from_user_id" field.

func (*MessageUpsertOne) SetSessionID

func (u *MessageUpsertOne) SetSessionID(v int) *MessageUpsertOne

SetSessionID sets the "session_id" field.

func (*MessageUpsertOne) SetSpouseID

func (u *MessageUpsertOne) SetSpouseID(v int) *MessageUpsertOne

SetSpouseID sets the "spouse_id" field.

func (*MessageUpsertOne) SetToUserID

func (u *MessageUpsertOne) SetToUserID(v string) *MessageUpsertOne

SetToUserID sets the "to_user_id" field.

func (*MessageUpsertOne) Update

func (u *MessageUpsertOne) Update(set func(*MessageUpsert)) *MessageUpsertOne

Update allows overriding fields `UPDATE` values. See the MessageCreate.OnConflict documentation for more info.

func (*MessageUpsertOne) UpdateContent

func (u *MessageUpsertOne) UpdateContent() *MessageUpsertOne

UpdateContent sets the "content" field to the value that was provided on create.

func (*MessageUpsertOne) UpdateFromUserID

func (u *MessageUpsertOne) UpdateFromUserID() *MessageUpsertOne

UpdateFromUserID sets the "from_user_id" field to the value that was provided on create.

func (*MessageUpsertOne) UpdateNewValues

func (u *MessageUpsertOne) UpdateNewValues() *MessageUpsertOne

UpdateNewValues updates the mutable fields using the new values that were set on create. Using this option is equivalent to using:

client.Message.Create().
	OnConflict(
		sql.ResolveWithNewValues(),
	).
	Exec(ctx)

func (*MessageUpsertOne) UpdateSessionID

func (u *MessageUpsertOne) UpdateSessionID() *MessageUpsertOne

UpdateSessionID sets the "session_id" field to the value that was provided on create.

func (*MessageUpsertOne) UpdateSpouseID

func (u *MessageUpsertOne) UpdateSpouseID() *MessageUpsertOne

UpdateSpouseID sets the "spouse_id" field to the value that was provided on create.

func (*MessageUpsertOne) UpdateToUserID

func (u *MessageUpsertOne) UpdateToUserID() *MessageUpsertOne

UpdateToUserID sets the "to_user_id" field to the value that was provided on create.

type Messages

type Messages []*Message

Messages is a parsable slice of Message.

type MutateFunc

type MutateFunc = ent.MutateFunc

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

type Mutation

type Mutation = ent.Mutation

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

type Mutator

type Mutator = ent.Mutator

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

type NotFoundError

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

NotFoundError returns when trying to fetch a specific entity and it was not found in the database.

func (*NotFoundError) Error

func (e *NotFoundError) Error() string

Error implements the error interface.

type NotLoadedError

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

NotLoadedError returns when trying to get a node that was not loaded by the query.

func (*NotLoadedError) Error

func (e *NotLoadedError) Error() string

Error implements the error interface.

type NotSingularError

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

NotSingularError returns when trying to fetch a singular entity and more then one was found in the database.

func (*NotSingularError) Error

func (e *NotSingularError) Error() string

Error implements the error interface.

type Op

type Op = ent.Op

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

type Option

type Option func(*config)

Option function to configure the client.

func Debug

func Debug() Option

Debug enables debug logging on the ent.Driver.

func Driver

func Driver(driver dialect.Driver) Option

Driver configures the client driver.

func Log

func Log(fn func(...any)) Option

Log sets the logging function for debug mode.

type OrderFunc

type OrderFunc func(*sql.Selector)

OrderFunc applies an ordering on the sql selector.

func Asc

func Asc(fields ...string) OrderFunc

Asc applies the given fields in ASC order.

func Desc

func Desc(fields ...string) OrderFunc

Desc applies the given fields in DESC order.

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 Session

type Session struct {

	// ID of the ent.
	ID int `json:"id,omitempty"`
	// 用户Id
	UserID string `json:"user_id,omitempty"`
	// 会话是否开启
	Status bool `json:"status,omitempty"`
	// CreatedAt holds the value of the "created_at" field.
	CreatedAt time.Time `json:"created_at,omitempty"`
	// UpdatedAt holds the value of the "updated_at" field.
	UpdatedAt time.Time `json:"updated_at,omitempty"`
	// DeletedAt holds the value of the "deleted_at" field.
	DeletedAt int `json:"deleted_at,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the SessionQuery when eager-loading is set.
	Edges SessionEdges `json:"edges"`
	// contains filtered or unexported fields
}

Session is the model entity for the Session schema.

func (*Session) ExecContext

func (c *Session) ExecContext(ctx context.Context, query string, args ...any) (stdsql.Result, error)

ExecContext allows calling the underlying ExecContext method of the driver if it is supported by it. See, database/sql#DB.ExecContext for more information.

func (*Session) QueryContext

func (c *Session) QueryContext(ctx context.Context, query string, args ...any) (*stdsql.Rows, error)

QueryContext allows calling the underlying QueryContext method of the driver if it is supported by it. See, database/sql#DB.QueryContext for more information.

func (*Session) QueryMessages

func (s *Session) QueryMessages() *MessageQuery

QueryMessages queries the "messages" edge of the Session entity.

func (*Session) String

func (s *Session) String() string

String implements the fmt.Stringer.

func (*Session) Unwrap

func (s *Session) Unwrap() *Session

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

func (s *Session) Update() *SessionUpdateOne

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

type SessionClient

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

SessionClient is a client for the Session schema.

func NewSessionClient

func NewSessionClient(c config) *SessionClient

NewSessionClient returns a client for the Session from the given config.

func (*SessionClient) Create

func (c *SessionClient) Create() *SessionCreate

Create returns a builder for creating a Session entity.

func (*SessionClient) CreateBulk

func (c *SessionClient) CreateBulk(builders ...*SessionCreate) *SessionCreateBulk

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

func (*SessionClient) Delete

func (c *SessionClient) Delete() *SessionDelete

Delete returns a delete builder for Session.

func (*SessionClient) DeleteOne

func (c *SessionClient) DeleteOne(s *Session) *SessionDeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*SessionClient) DeleteOneID

func (c *SessionClient) DeleteOneID(id int) *SessionDeleteOne

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

func (*SessionClient) ExecContext

func (c *SessionClient) ExecContext(ctx context.Context, query string, args ...any) (stdsql.Result, error)

ExecContext allows calling the underlying ExecContext method of the driver if it is supported by it. See, database/sql#DB.ExecContext for more information.

func (*SessionClient) Get

func (c *SessionClient) Get(ctx context.Context, id int) (*Session, error)

Get returns a Session entity by its id.

func (*SessionClient) GetX

func (c *SessionClient) GetX(ctx context.Context, id int) *Session

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

func (*SessionClient) Hooks

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

Hooks returns the client hooks.

func (*SessionClient) Intercept

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

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

func (*SessionClient) Interceptors

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

Interceptors returns the client interceptors.

func (*SessionClient) Query

func (c *SessionClient) Query() *SessionQuery

Query returns a query builder for Session.

func (*SessionClient) QueryContext

func (c *SessionClient) QueryContext(ctx context.Context, query string, args ...any) (*stdsql.Rows, error)

QueryContext allows calling the underlying QueryContext method of the driver if it is supported by it. See, database/sql#DB.QueryContext for more information.

func (*SessionClient) QueryMessages

func (c *SessionClient) QueryMessages(s *Session) *MessageQuery

QueryMessages queries the messages edge of a Session.

func (*SessionClient) Update

func (c *SessionClient) Update() *SessionUpdate

Update returns an update builder for Session.

func (*SessionClient) UpdateOne

func (c *SessionClient) UpdateOne(s *Session) *SessionUpdateOne

UpdateOne returns an update builder for the given entity.

func (*SessionClient) UpdateOneID

func (c *SessionClient) UpdateOneID(id int) *SessionUpdateOne

UpdateOneID returns an update builder for the given id.

func (*SessionClient) Use

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

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

type SessionCreate

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

SessionCreate is the builder for creating a Session entity.

func (*SessionCreate) AddMessageIDs

func (sc *SessionCreate) AddMessageIDs(ids ...int) *SessionCreate

AddMessageIDs adds the "messages" edge to the Message entity by IDs.

func (*SessionCreate) AddMessages

func (sc *SessionCreate) AddMessages(m ...*Message) *SessionCreate

AddMessages adds the "messages" edges to the Message entity.

func (*SessionCreate) Exec

func (sc *SessionCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*SessionCreate) ExecContext

func (c *SessionCreate) ExecContext(ctx context.Context, query string, args ...any) (stdsql.Result, error)

ExecContext allows calling the underlying ExecContext method of the driver if it is supported by it. See, database/sql#DB.ExecContext for more information.

func (*SessionCreate) ExecX

func (sc *SessionCreate) ExecX(ctx context.Context)

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

func (*SessionCreate) Mutation

func (sc *SessionCreate) Mutation() *SessionMutation

Mutation returns the SessionMutation object of the builder.

func (*SessionCreate) OnConflict

func (sc *SessionCreate) OnConflict(opts ...sql.ConflictOption) *SessionUpsertOne

OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause of the `INSERT` statement. For example:

client.Session.Create().
	SetUserID(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.SessionUpsert) {
		SetUserID(v+v).
	}).
	Exec(ctx)

func (*SessionCreate) OnConflictColumns

func (sc *SessionCreate) OnConflictColumns(columns ...string) *SessionUpsertOne

OnConflictColumns calls `OnConflict` and configures the columns as conflict target. Using this option is equivalent to using:

client.Session.Create().
	OnConflict(sql.ConflictColumns(columns...)).
	Exec(ctx)

func (*SessionCreate) QueryContext

func (c *SessionCreate) QueryContext(ctx context.Context, query string, args ...any) (*stdsql.Rows, error)

QueryContext allows calling the underlying QueryContext method of the driver if it is supported by it. See, database/sql#DB.QueryContext for more information.

func (*SessionCreate) Save

func (sc *SessionCreate) Save(ctx context.Context) (*Session, error)

Save creates the Session in the database.

func (*SessionCreate) SaveX

func (sc *SessionCreate) SaveX(ctx context.Context) *Session

SaveX calls Save and panics if Save returns an error.

func (*SessionCreate) SetCreatedAt

func (sc *SessionCreate) SetCreatedAt(t time.Time) *SessionCreate

SetCreatedAt sets the "created_at" field.

func (*SessionCreate) SetDeletedAt

func (sc *SessionCreate) SetDeletedAt(i int) *SessionCreate

SetDeletedAt sets the "deleted_at" field.

func (*SessionCreate) SetNillableCreatedAt

func (sc *SessionCreate) SetNillableCreatedAt(t *time.Time) *SessionCreate

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

func (*SessionCreate) SetNillableDeletedAt

func (sc *SessionCreate) SetNillableDeletedAt(i *int) *SessionCreate

SetNillableDeletedAt sets the "deleted_at" field if the given value is not nil.

func (*SessionCreate) SetNillableStatus

func (sc *SessionCreate) SetNillableStatus(b *bool) *SessionCreate

SetNillableStatus sets the "status" field if the given value is not nil.

func (*SessionCreate) SetNillableUpdatedAt

func (sc *SessionCreate) SetNillableUpdatedAt(t *time.Time) *SessionCreate

SetNillableUpdatedAt sets the "updated_at" field if the given value is not nil.

func (*SessionCreate) SetStatus

func (sc *SessionCreate) SetStatus(b bool) *SessionCreate

SetStatus sets the "status" field.

func (*SessionCreate) SetUpdatedAt

func (sc *SessionCreate) SetUpdatedAt(t time.Time) *SessionCreate

SetUpdatedAt sets the "updated_at" field.

func (*SessionCreate) SetUserID

func (sc *SessionCreate) SetUserID(s string) *SessionCreate

SetUserID sets the "user_id" field.

type SessionCreateBulk

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

SessionCreateBulk is the builder for creating many Session entities in bulk.

func (*SessionCreateBulk) Exec

func (scb *SessionCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*SessionCreateBulk) ExecContext

func (c *SessionCreateBulk) ExecContext(ctx context.Context, query string, args ...any) (stdsql.Result, error)

ExecContext allows calling the underlying ExecContext method of the driver if it is supported by it. See, database/sql#DB.ExecContext for more information.

func (*SessionCreateBulk) ExecX

func (scb *SessionCreateBulk) ExecX(ctx context.Context)

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

func (*SessionCreateBulk) OnConflict

func (scb *SessionCreateBulk) OnConflict(opts ...sql.ConflictOption) *SessionUpsertBulk

OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause of the `INSERT` statement. For example:

client.Session.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.SessionUpsert) {
		SetUserID(v+v).
	}).
	Exec(ctx)

func (*SessionCreateBulk) OnConflictColumns

func (scb *SessionCreateBulk) OnConflictColumns(columns ...string) *SessionUpsertBulk

OnConflictColumns calls `OnConflict` and configures the columns as conflict target. Using this option is equivalent to using:

client.Session.Create().
	OnConflict(sql.ConflictColumns(columns...)).
	Exec(ctx)

func (*SessionCreateBulk) QueryContext

func (c *SessionCreateBulk) QueryContext(ctx context.Context, query string, args ...any) (*stdsql.Rows, error)

QueryContext allows calling the underlying QueryContext method of the driver if it is supported by it. See, database/sql#DB.QueryContext for more information.

func (*SessionCreateBulk) Save

func (scb *SessionCreateBulk) Save(ctx context.Context) ([]*Session, error)

Save creates the Session entities in the database.

func (*SessionCreateBulk) SaveX

func (scb *SessionCreateBulk) SaveX(ctx context.Context) []*Session

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

type SessionDelete

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

SessionDelete is the builder for deleting a Session entity.

func (*SessionDelete) Exec

func (sd *SessionDelete) Exec(ctx context.Context) (int, error)

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

func (*SessionDelete) ExecContext

func (c *SessionDelete) ExecContext(ctx context.Context, query string, args ...any) (stdsql.Result, error)

ExecContext allows calling the underlying ExecContext method of the driver if it is supported by it. See, database/sql#DB.ExecContext for more information.

func (*SessionDelete) ExecX

func (sd *SessionDelete) ExecX(ctx context.Context) int

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

func (*SessionDelete) QueryContext

func (c *SessionDelete) QueryContext(ctx context.Context, query string, args ...any) (*stdsql.Rows, error)

QueryContext allows calling the underlying QueryContext method of the driver if it is supported by it. See, database/sql#DB.QueryContext for more information.

func (*SessionDelete) Where

func (sd *SessionDelete) Where(ps ...predicate.Session) *SessionDelete

Where appends a list predicates to the SessionDelete builder.

type SessionDeleteOne

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

SessionDeleteOne is the builder for deleting a single Session entity.

func (*SessionDeleteOne) Exec

func (sdo *SessionDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*SessionDeleteOne) ExecX

func (sdo *SessionDeleteOne) ExecX(ctx context.Context)

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

func (*SessionDeleteOne) Where

Where appends a list predicates to the SessionDelete builder.

type SessionEdges

type SessionEdges struct {
	// Messages holds the value of the messages edge.
	Messages []*Message `json:"messages,omitempty"`
	// contains filtered or unexported fields
}

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

func (SessionEdges) MessagesOrErr

func (e SessionEdges) MessagesOrErr() ([]*Message, error)

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

type SessionFilter

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

SessionFilter provides a generic filtering capability at runtime for SessionQuery.

func (*SessionFilter) ExecContext

func (c *SessionFilter) ExecContext(ctx context.Context, query string, args ...any) (stdsql.Result, error)

ExecContext allows calling the underlying ExecContext method of the driver if it is supported by it. See, database/sql#DB.ExecContext for more information.

func (*SessionFilter) QueryContext

func (c *SessionFilter) QueryContext(ctx context.Context, query string, args ...any) (*stdsql.Rows, error)

QueryContext allows calling the underlying QueryContext method of the driver if it is supported by it. See, database/sql#DB.QueryContext for more information.

func (*SessionFilter) Where

func (f *SessionFilter) Where(p entql.P)

Where applies the entql predicate on the query filter.

func (*SessionFilter) WhereCreatedAt

func (f *SessionFilter) WhereCreatedAt(p entql.TimeP)

WhereCreatedAt applies the entql time.Time predicate on the created_at field.

func (*SessionFilter) WhereDeletedAt

func (f *SessionFilter) WhereDeletedAt(p entql.IntP)

WhereDeletedAt applies the entql int predicate on the deleted_at field.

func (*SessionFilter) WhereHasMessages

func (f *SessionFilter) WhereHasMessages()

WhereHasMessages applies a predicate to check if query has an edge messages.

func (*SessionFilter) WhereHasMessagesWith

func (f *SessionFilter) WhereHasMessagesWith(preds ...predicate.Message)

WhereHasMessagesWith applies a predicate to check if query has an edge messages with a given conditions (other predicates).

func (*SessionFilter) WhereID

func (f *SessionFilter) WhereID(p entql.IntP)

WhereID applies the entql int predicate on the id field.

func (*SessionFilter) WhereStatus

func (f *SessionFilter) WhereStatus(p entql.BoolP)

WhereStatus applies the entql bool predicate on the status field.

func (*SessionFilter) WhereUpdatedAt

func (f *SessionFilter) WhereUpdatedAt(p entql.TimeP)

WhereUpdatedAt applies the entql time.Time predicate on the updated_at field.

func (*SessionFilter) WhereUserID

func (f *SessionFilter) WhereUserID(p entql.StringP)

WhereUserID applies the entql string predicate on the user_id field.

type SessionGroupBy

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

SessionGroupBy is the group-by builder for Session entities.

func (*SessionGroupBy) Aggregate

func (sgb *SessionGroupBy) Aggregate(fns ...AggregateFunc) *SessionGroupBy

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

func (*SessionGroupBy) Bool

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

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

func (*SessionGroupBy) BoolX

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

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

func (*SessionGroupBy) Bools

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

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

func (*SessionGroupBy) BoolsX

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

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

func (*SessionGroupBy) Float64

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

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

func (*SessionGroupBy) Float64X

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

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

func (*SessionGroupBy) Float64s

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

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

func (*SessionGroupBy) Float64sX

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

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

func (*SessionGroupBy) Int

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

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

func (*SessionGroupBy) IntX

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

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

func (*SessionGroupBy) Ints

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

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

func (*SessionGroupBy) IntsX

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

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

func (*SessionGroupBy) Scan

func (sgb *SessionGroupBy) Scan(ctx context.Context, v any) error

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

func (*SessionGroupBy) ScanX

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

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

func (*SessionGroupBy) String

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

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

func (*SessionGroupBy) StringX

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

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

func (*SessionGroupBy) Strings

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

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

func (*SessionGroupBy) StringsX

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

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

type SessionMutation

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

SessionMutation represents an operation that mutates the Session nodes in the graph.

func (*SessionMutation) AddDeletedAt

func (m *SessionMutation) AddDeletedAt(i int)

AddDeletedAt adds i to the "deleted_at" field.

func (*SessionMutation) AddField

func (m *SessionMutation) 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 (*SessionMutation) AddMessageIDs

func (m *SessionMutation) AddMessageIDs(ids ...int)

AddMessageIDs adds the "messages" edge to the Message entity by ids.

func (*SessionMutation) AddedDeletedAt

func (m *SessionMutation) AddedDeletedAt() (r int, exists bool)

AddedDeletedAt returns the value that was added to the "deleted_at" field in this mutation.

func (*SessionMutation) AddedEdges

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

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

func (*SessionMutation) AddedField

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

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

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

func (*SessionMutation) AddedIDs

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

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

func (*SessionMutation) ClearEdge

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

func (m *SessionMutation) 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 (*SessionMutation) ClearMessages

func (m *SessionMutation) ClearMessages()

ClearMessages clears the "messages" edge to the Message entity.

func (*SessionMutation) ClearedEdges

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

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

func (*SessionMutation) ClearedFields

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

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

func (SessionMutation) Client

func (m SessionMutation) 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 (*SessionMutation) CreatedAt

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

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

func (*SessionMutation) DeletedAt

func (m *SessionMutation) DeletedAt() (r int, exists bool)

DeletedAt returns the value of the "deleted_at" field in the mutation.

func (*SessionMutation) EdgeCleared

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

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

func (*SessionMutation) ExecContext

func (c *SessionMutation) ExecContext(ctx context.Context, query string, args ...any) (stdsql.Result, error)

ExecContext allows calling the underlying ExecContext method of the driver if it is supported by it. See, database/sql#DB.ExecContext for more information.

func (*SessionMutation) Field

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

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

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

func (*SessionMutation) Fields

func (m *SessionMutation) 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 (*SessionMutation) Filter

func (m *SessionMutation) Filter() *SessionFilter

Filter returns an entql.Where implementation to apply filters on the SessionMutation builder.

func (*SessionMutation) ID

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

func (m *SessionMutation) 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 (*SessionMutation) MessagesCleared

func (m *SessionMutation) MessagesCleared() bool

MessagesCleared reports if the "messages" edge to the Message entity was cleared.

func (*SessionMutation) MessagesIDs

func (m *SessionMutation) MessagesIDs() (ids []int)

MessagesIDs returns the "messages" edge IDs in the mutation.

func (*SessionMutation) OldCreatedAt

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

OldCreatedAt returns the old "created_at" field's value of the Session entity. If the Session 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 (*SessionMutation) OldDeletedAt

func (m *SessionMutation) OldDeletedAt(ctx context.Context) (v int, err error)

OldDeletedAt returns the old "deleted_at" field's value of the Session entity. If the Session 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 (*SessionMutation) OldField

func (m *SessionMutation) 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 (*SessionMutation) OldStatus

func (m *SessionMutation) OldStatus(ctx context.Context) (v bool, err error)

OldStatus returns the old "status" field's value of the Session entity. If the Session 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 (*SessionMutation) OldUpdatedAt

func (m *SessionMutation) OldUpdatedAt(ctx context.Context) (v time.Time, err error)

OldUpdatedAt returns the old "updated_at" field's value of the Session entity. If the Session 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 (*SessionMutation) OldUserID

func (m *SessionMutation) OldUserID(ctx context.Context) (v string, err error)

OldUserID returns the old "user_id" field's value of the Session entity. If the Session 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 (*SessionMutation) Op

func (m *SessionMutation) Op() Op

Op returns the operation name.

func (*SessionMutation) QueryContext

func (c *SessionMutation) QueryContext(ctx context.Context, query string, args ...any) (*stdsql.Rows, error)

QueryContext allows calling the underlying QueryContext method of the driver if it is supported by it. See, database/sql#DB.QueryContext for more information.

func (*SessionMutation) RemoveMessageIDs

func (m *SessionMutation) RemoveMessageIDs(ids ...int)

RemoveMessageIDs removes the "messages" edge to the Message entity by IDs.

func (*SessionMutation) RemovedEdges

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

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

func (*SessionMutation) RemovedIDs

func (m *SessionMutation) 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 (*SessionMutation) RemovedMessagesIDs

func (m *SessionMutation) RemovedMessagesIDs() (ids []int)

RemovedMessages returns the removed IDs of the "messages" edge to the Message entity.

func (*SessionMutation) ResetCreatedAt

func (m *SessionMutation) ResetCreatedAt()

ResetCreatedAt resets all changes to the "created_at" field.

func (*SessionMutation) ResetDeletedAt

func (m *SessionMutation) ResetDeletedAt()

ResetDeletedAt resets all changes to the "deleted_at" field.

func (*SessionMutation) ResetEdge

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

func (m *SessionMutation) 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 (*SessionMutation) ResetMessages

func (m *SessionMutation) ResetMessages()

ResetMessages resets all changes to the "messages" edge.

func (*SessionMutation) ResetStatus

func (m *SessionMutation) ResetStatus()

ResetStatus resets all changes to the "status" field.

func (*SessionMutation) ResetUpdatedAt

func (m *SessionMutation) ResetUpdatedAt()

ResetUpdatedAt resets all changes to the "updated_at" field.

func (*SessionMutation) ResetUserID

func (m *SessionMutation) ResetUserID()

ResetUserID resets all changes to the "user_id" field.

func (*SessionMutation) SetCreatedAt

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

SetCreatedAt sets the "created_at" field.

func (*SessionMutation) SetDeletedAt

func (m *SessionMutation) SetDeletedAt(i int)

SetDeletedAt sets the "deleted_at" field.

func (*SessionMutation) SetField

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

func (m *SessionMutation) SetOp(op Op)

SetOp allows setting the mutation operation.

func (*SessionMutation) SetStatus

func (m *SessionMutation) SetStatus(b bool)

SetStatus sets the "status" field.

func (*SessionMutation) SetUpdatedAt

func (m *SessionMutation) SetUpdatedAt(t time.Time)

SetUpdatedAt sets the "updated_at" field.

func (*SessionMutation) SetUserID

func (m *SessionMutation) SetUserID(s string)

SetUserID sets the "user_id" field.

func (*SessionMutation) Status

func (m *SessionMutation) Status() (r bool, exists bool)

Status returns the value of the "status" field in the mutation.

func (SessionMutation) Tx

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

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

func (*SessionMutation) Type

func (m *SessionMutation) Type() string

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

func (*SessionMutation) UpdatedAt

func (m *SessionMutation) UpdatedAt() (r time.Time, exists bool)

UpdatedAt returns the value of the "updated_at" field in the mutation.

func (*SessionMutation) UserID

func (m *SessionMutation) UserID() (r string, exists bool)

UserID returns the value of the "user_id" field in the mutation.

func (*SessionMutation) Where

func (m *SessionMutation) Where(ps ...predicate.Session)

Where appends a list predicates to the SessionMutation builder.

func (*SessionMutation) WhereP

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

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

type SessionQuery

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

SessionQuery is the builder for querying Session entities.

func (*SessionQuery) Aggregate

func (sq *SessionQuery) Aggregate(fns ...AggregateFunc) *SessionSelect

Aggregate returns a SessionSelect configured with the given aggregations.

func (*SessionQuery) All

func (sq *SessionQuery) All(ctx context.Context) ([]*Session, error)

All executes the query and returns a list of Sessions.

func (*SessionQuery) AllX

func (sq *SessionQuery) AllX(ctx context.Context) []*Session

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

func (*SessionQuery) Clone

func (sq *SessionQuery) Clone() *SessionQuery

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

func (*SessionQuery) Count

func (sq *SessionQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*SessionQuery) CountX

func (sq *SessionQuery) CountX(ctx context.Context) int

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

func (*SessionQuery) ExecContext

func (c *SessionQuery) ExecContext(ctx context.Context, query string, args ...any) (stdsql.Result, error)

ExecContext allows calling the underlying ExecContext method of the driver if it is supported by it. See, database/sql#DB.ExecContext for more information.

func (*SessionQuery) Exist

func (sq *SessionQuery) Exist(ctx context.Context) (bool, error)

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

func (*SessionQuery) ExistX

func (sq *SessionQuery) ExistX(ctx context.Context) bool

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

func (*SessionQuery) Filter

func (sq *SessionQuery) Filter() *SessionFilter

Filter returns a Filter implementation to apply filters on the SessionQuery builder.

func (*SessionQuery) First

func (sq *SessionQuery) First(ctx context.Context) (*Session, error)

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

func (*SessionQuery) FirstID

func (sq *SessionQuery) FirstID(ctx context.Context) (id int, err error)

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

func (*SessionQuery) FirstIDX

func (sq *SessionQuery) FirstIDX(ctx context.Context) int

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

func (*SessionQuery) FirstX

func (sq *SessionQuery) FirstX(ctx context.Context) *Session

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

func (*SessionQuery) ForShare

func (sq *SessionQuery) ForShare(opts ...sql.LockOption) *SessionQuery

ForShare behaves similarly to ForUpdate, except that it acquires a shared mode lock on any rows that are read. Other sessions can read the rows, but cannot modify them until your transaction commits.

func (*SessionQuery) ForUpdate

func (sq *SessionQuery) ForUpdate(opts ...sql.LockOption) *SessionQuery

ForUpdate locks the selected rows against concurrent updates, and prevent them from being updated, deleted or "selected ... for update" by other sessions, until the transaction is either committed or rolled-back.

func (*SessionQuery) GroupBy

func (sq *SessionQuery) GroupBy(field string, fields ...string) *SessionGroupBy

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

client.Session.Query().
	GroupBy(session.FieldUserID).
	Aggregate(chatent.Count()).
	Scan(ctx, &v)

func (*SessionQuery) IDs

func (sq *SessionQuery) IDs(ctx context.Context) ([]int, error)

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

func (*SessionQuery) IDsX

func (sq *SessionQuery) IDsX(ctx context.Context) []int

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

func (*SessionQuery) Limit

func (sq *SessionQuery) Limit(limit int) *SessionQuery

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

func (*SessionQuery) Modify

func (sq *SessionQuery) Modify(modifiers ...func(s *sql.Selector)) *SessionSelect

Modify adds a query modifier for attaching custom logic to queries.

func (*SessionQuery) Offset

func (sq *SessionQuery) Offset(offset int) *SessionQuery

Offset to start from.

func (*SessionQuery) Only

func (sq *SessionQuery) Only(ctx context.Context) (*Session, error)

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

func (*SessionQuery) OnlyID

func (sq *SessionQuery) OnlyID(ctx context.Context) (id int, err error)

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

func (*SessionQuery) OnlyIDX

func (sq *SessionQuery) OnlyIDX(ctx context.Context) int

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

func (*SessionQuery) OnlyX

func (sq *SessionQuery) OnlyX(ctx context.Context) *Session

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

func (*SessionQuery) Order

func (sq *SessionQuery) Order(o ...OrderFunc) *SessionQuery

Order specifies how the records should be ordered.

func (*SessionQuery) QueryContext

func (c *SessionQuery) QueryContext(ctx context.Context, query string, args ...any) (*stdsql.Rows, error)

QueryContext allows calling the underlying QueryContext method of the driver if it is supported by it. See, database/sql#DB.QueryContext for more information.

func (*SessionQuery) QueryMessages

func (sq *SessionQuery) QueryMessages() *MessageQuery

QueryMessages chains the current query on the "messages" edge.

func (*SessionQuery) Select

func (sq *SessionQuery) Select(fields ...string) *SessionSelect

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

client.Session.Query().
	Select(session.FieldUserID).
	Scan(ctx, &v)

func (*SessionQuery) Unique

func (sq *SessionQuery) Unique(unique bool) *SessionQuery

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

func (sq *SessionQuery) Where(ps ...predicate.Session) *SessionQuery

Where adds a new predicate for the SessionQuery builder.

func (*SessionQuery) WithMessages

func (sq *SessionQuery) WithMessages(opts ...func(*MessageQuery)) *SessionQuery

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

type SessionSelect

type SessionSelect struct {
	*SessionQuery
	// contains filtered or unexported fields
}

SessionSelect is the builder for selecting fields of Session entities.

func (*SessionSelect) Aggregate

func (ss *SessionSelect) Aggregate(fns ...AggregateFunc) *SessionSelect

Aggregate adds the given aggregation functions to the selector query.

func (*SessionSelect) Bool

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

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

func (*SessionSelect) BoolX

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

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

func (*SessionSelect) Bools

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

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

func (*SessionSelect) BoolsX

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

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

func (SessionSelect) ExecContext

func (c SessionSelect) ExecContext(ctx context.Context, query string, args ...any) (stdsql.Result, error)

ExecContext allows calling the underlying ExecContext method of the driver if it is supported by it. See, database/sql#DB.ExecContext for more information.

func (*SessionSelect) Float64

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

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

func (*SessionSelect) Float64X

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

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

func (*SessionSelect) Float64s

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

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

func (*SessionSelect) Float64sX

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

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

func (*SessionSelect) Int

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

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

func (*SessionSelect) IntX

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

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

func (*SessionSelect) Ints

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

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

func (*SessionSelect) IntsX

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

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

func (*SessionSelect) Modify

func (ss *SessionSelect) Modify(modifiers ...func(s *sql.Selector)) *SessionSelect

Modify adds a query modifier for attaching custom logic to queries.

func (SessionSelect) QueryContext

func (c SessionSelect) QueryContext(ctx context.Context, query string, args ...any) (*stdsql.Rows, error)

QueryContext allows calling the underlying QueryContext method of the driver if it is supported by it. See, database/sql#DB.QueryContext for more information.

func (*SessionSelect) Scan

func (ss *SessionSelect) Scan(ctx context.Context, v any) error

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

func (*SessionSelect) ScanX

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

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

func (*SessionSelect) String

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

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

func (*SessionSelect) StringX

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

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

func (*SessionSelect) Strings

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

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

func (*SessionSelect) StringsX

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

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

type SessionUpdate

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

SessionUpdate is the builder for updating Session entities.

func (*SessionUpdate) AddDeletedAt

func (su *SessionUpdate) AddDeletedAt(i int) *SessionUpdate

AddDeletedAt adds i to the "deleted_at" field.

func (*SessionUpdate) AddMessageIDs

func (su *SessionUpdate) AddMessageIDs(ids ...int) *SessionUpdate

AddMessageIDs adds the "messages" edge to the Message entity by IDs.

func (*SessionUpdate) AddMessages

func (su *SessionUpdate) AddMessages(m ...*Message) *SessionUpdate

AddMessages adds the "messages" edges to the Message entity.

func (*SessionUpdate) ClearMessages

func (su *SessionUpdate) ClearMessages() *SessionUpdate

ClearMessages clears all "messages" edges to the Message entity.

func (*SessionUpdate) Exec

func (su *SessionUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*SessionUpdate) ExecContext

func (c *SessionUpdate) ExecContext(ctx context.Context, query string, args ...any) (stdsql.Result, error)

ExecContext allows calling the underlying ExecContext method of the driver if it is supported by it. See, database/sql#DB.ExecContext for more information.

func (*SessionUpdate) ExecX

func (su *SessionUpdate) ExecX(ctx context.Context)

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

func (*SessionUpdate) Modify

func (su *SessionUpdate) Modify(modifiers ...func(u *sql.UpdateBuilder)) *SessionUpdate

Modify adds a statement modifier for attaching custom logic to the UPDATE statement.

func (*SessionUpdate) Mutation

func (su *SessionUpdate) Mutation() *SessionMutation

Mutation returns the SessionMutation object of the builder.

func (*SessionUpdate) QueryContext

func (c *SessionUpdate) QueryContext(ctx context.Context, query string, args ...any) (*stdsql.Rows, error)

QueryContext allows calling the underlying QueryContext method of the driver if it is supported by it. See, database/sql#DB.QueryContext for more information.

func (*SessionUpdate) RemoveMessageIDs

func (su *SessionUpdate) RemoveMessageIDs(ids ...int) *SessionUpdate

RemoveMessageIDs removes the "messages" edge to Message entities by IDs.

func (*SessionUpdate) RemoveMessages

func (su *SessionUpdate) RemoveMessages(m ...*Message) *SessionUpdate

RemoveMessages removes "messages" edges to Message entities.

func (*SessionUpdate) Save

func (su *SessionUpdate) Save(ctx context.Context) (int, error)

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

func (*SessionUpdate) SaveX

func (su *SessionUpdate) SaveX(ctx context.Context) int

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

func (*SessionUpdate) SetDeletedAt

func (su *SessionUpdate) SetDeletedAt(i int) *SessionUpdate

SetDeletedAt sets the "deleted_at" field.

func (*SessionUpdate) SetNillableDeletedAt

func (su *SessionUpdate) SetNillableDeletedAt(i *int) *SessionUpdate

SetNillableDeletedAt sets the "deleted_at" field if the given value is not nil.

func (*SessionUpdate) SetNillableStatus

func (su *SessionUpdate) SetNillableStatus(b *bool) *SessionUpdate

SetNillableStatus sets the "status" field if the given value is not nil.

func (*SessionUpdate) SetStatus

func (su *SessionUpdate) SetStatus(b bool) *SessionUpdate

SetStatus sets the "status" field.

func (*SessionUpdate) SetUpdatedAt

func (su *SessionUpdate) SetUpdatedAt(t time.Time) *SessionUpdate

SetUpdatedAt sets the "updated_at" field.

func (*SessionUpdate) SetUserID

func (su *SessionUpdate) SetUserID(s string) *SessionUpdate

SetUserID sets the "user_id" field.

func (*SessionUpdate) Where

func (su *SessionUpdate) Where(ps ...predicate.Session) *SessionUpdate

Where appends a list predicates to the SessionUpdate builder.

type SessionUpdateOne

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

SessionUpdateOne is the builder for updating a single Session entity.

func (*SessionUpdateOne) AddDeletedAt

func (suo *SessionUpdateOne) AddDeletedAt(i int) *SessionUpdateOne

AddDeletedAt adds i to the "deleted_at" field.

func (*SessionUpdateOne) AddMessageIDs

func (suo *SessionUpdateOne) AddMessageIDs(ids ...int) *SessionUpdateOne

AddMessageIDs adds the "messages" edge to the Message entity by IDs.

func (*SessionUpdateOne) AddMessages

func (suo *SessionUpdateOne) AddMessages(m ...*Message) *SessionUpdateOne

AddMessages adds the "messages" edges to the Message entity.

func (*SessionUpdateOne) ClearMessages

func (suo *SessionUpdateOne) ClearMessages() *SessionUpdateOne

ClearMessages clears all "messages" edges to the Message entity.

func (*SessionUpdateOne) Exec

func (suo *SessionUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*SessionUpdateOne) ExecContext

func (c *SessionUpdateOne) ExecContext(ctx context.Context, query string, args ...any) (stdsql.Result, error)

ExecContext allows calling the underlying ExecContext method of the driver if it is supported by it. See, database/sql#DB.ExecContext for more information.

func (*SessionUpdateOne) ExecX

func (suo *SessionUpdateOne) ExecX(ctx context.Context)

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

func (*SessionUpdateOne) Modify

func (suo *SessionUpdateOne) Modify(modifiers ...func(u *sql.UpdateBuilder)) *SessionUpdateOne

Modify adds a statement modifier for attaching custom logic to the UPDATE statement.

func (*SessionUpdateOne) Mutation

func (suo *SessionUpdateOne) Mutation() *SessionMutation

Mutation returns the SessionMutation object of the builder.

func (*SessionUpdateOne) QueryContext

func (c *SessionUpdateOne) QueryContext(ctx context.Context, query string, args ...any) (*stdsql.Rows, error)

QueryContext allows calling the underlying QueryContext method of the driver if it is supported by it. See, database/sql#DB.QueryContext for more information.

func (*SessionUpdateOne) RemoveMessageIDs

func (suo *SessionUpdateOne) RemoveMessageIDs(ids ...int) *SessionUpdateOne

RemoveMessageIDs removes the "messages" edge to Message entities by IDs.

func (*SessionUpdateOne) RemoveMessages

func (suo *SessionUpdateOne) RemoveMessages(m ...*Message) *SessionUpdateOne

RemoveMessages removes "messages" edges to Message entities.

func (*SessionUpdateOne) Save

func (suo *SessionUpdateOne) Save(ctx context.Context) (*Session, error)

Save executes the query and returns the updated Session entity.

func (*SessionUpdateOne) SaveX

func (suo *SessionUpdateOne) SaveX(ctx context.Context) *Session

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

func (*SessionUpdateOne) Select

func (suo *SessionUpdateOne) Select(field string, fields ...string) *SessionUpdateOne

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

func (*SessionUpdateOne) SetDeletedAt

func (suo *SessionUpdateOne) SetDeletedAt(i int) *SessionUpdateOne

SetDeletedAt sets the "deleted_at" field.

func (*SessionUpdateOne) SetNillableDeletedAt

func (suo *SessionUpdateOne) SetNillableDeletedAt(i *int) *SessionUpdateOne

SetNillableDeletedAt sets the "deleted_at" field if the given value is not nil.

func (*SessionUpdateOne) SetNillableStatus

func (suo *SessionUpdateOne) SetNillableStatus(b *bool) *SessionUpdateOne

SetNillableStatus sets the "status" field if the given value is not nil.

func (*SessionUpdateOne) SetStatus

func (suo *SessionUpdateOne) SetStatus(b bool) *SessionUpdateOne

SetStatus sets the "status" field.

func (*SessionUpdateOne) SetUpdatedAt

func (suo *SessionUpdateOne) SetUpdatedAt(t time.Time) *SessionUpdateOne

SetUpdatedAt sets the "updated_at" field.

func (*SessionUpdateOne) SetUserID

func (suo *SessionUpdateOne) SetUserID(s string) *SessionUpdateOne

SetUserID sets the "user_id" field.

type SessionUpsert

type SessionUpsert struct {
	*sql.UpdateSet
}

SessionUpsert is the "OnConflict" setter.

func (*SessionUpsert) AddDeletedAt

func (u *SessionUpsert) AddDeletedAt(v int) *SessionUpsert

AddDeletedAt adds v to the "deleted_at" field.

func (*SessionUpsert) SetDeletedAt

func (u *SessionUpsert) SetDeletedAt(v int) *SessionUpsert

SetDeletedAt sets the "deleted_at" field.

func (*SessionUpsert) SetStatus

func (u *SessionUpsert) SetStatus(v bool) *SessionUpsert

SetStatus sets the "status" field.

func (*SessionUpsert) SetUpdatedAt

func (u *SessionUpsert) SetUpdatedAt(v time.Time) *SessionUpsert

SetUpdatedAt sets the "updated_at" field.

func (*SessionUpsert) SetUserID

func (u *SessionUpsert) SetUserID(v string) *SessionUpsert

SetUserID sets the "user_id" field.

func (*SessionUpsert) UpdateDeletedAt

func (u *SessionUpsert) UpdateDeletedAt() *SessionUpsert

UpdateDeletedAt sets the "deleted_at" field to the value that was provided on create.

func (*SessionUpsert) UpdateStatus

func (u *SessionUpsert) UpdateStatus() *SessionUpsert

UpdateStatus sets the "status" field to the value that was provided on create.

func (*SessionUpsert) UpdateUpdatedAt

func (u *SessionUpsert) UpdateUpdatedAt() *SessionUpsert

UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create.

func (*SessionUpsert) UpdateUserID

func (u *SessionUpsert) UpdateUserID() *SessionUpsert

UpdateUserID sets the "user_id" field to the value that was provided on create.

type SessionUpsertBulk

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

SessionUpsertBulk is the builder for "upsert"-ing a bulk of Session nodes.

func (*SessionUpsertBulk) AddDeletedAt

func (u *SessionUpsertBulk) AddDeletedAt(v int) *SessionUpsertBulk

AddDeletedAt adds v to the "deleted_at" field.

func (*SessionUpsertBulk) DoNothing

func (u *SessionUpsertBulk) DoNothing() *SessionUpsertBulk

DoNothing configures the conflict_action to `DO NOTHING`. Supported only by SQLite and PostgreSQL.

func (*SessionUpsertBulk) Exec

func (u *SessionUpsertBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*SessionUpsertBulk) ExecX

func (u *SessionUpsertBulk) ExecX(ctx context.Context)

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

func (*SessionUpsertBulk) Ignore

func (u *SessionUpsertBulk) Ignore() *SessionUpsertBulk

Ignore sets each column to itself in case of conflict. Using this option is equivalent to using:

client.Session.Create().
	OnConflict(sql.ResolveWithIgnore()).
	Exec(ctx)

func (*SessionUpsertBulk) SetDeletedAt

func (u *SessionUpsertBulk) SetDeletedAt(v int) *SessionUpsertBulk

SetDeletedAt sets the "deleted_at" field.

func (*SessionUpsertBulk) SetStatus

func (u *SessionUpsertBulk) SetStatus(v bool) *SessionUpsertBulk

SetStatus sets the "status" field.

func (*SessionUpsertBulk) SetUpdatedAt

func (u *SessionUpsertBulk) SetUpdatedAt(v time.Time) *SessionUpsertBulk

SetUpdatedAt sets the "updated_at" field.

func (*SessionUpsertBulk) SetUserID

func (u *SessionUpsertBulk) SetUserID(v string) *SessionUpsertBulk

SetUserID sets the "user_id" field.

func (*SessionUpsertBulk) Update

func (u *SessionUpsertBulk) Update(set func(*SessionUpsert)) *SessionUpsertBulk

Update allows overriding fields `UPDATE` values. See the SessionCreateBulk.OnConflict documentation for more info.

func (*SessionUpsertBulk) UpdateDeletedAt

func (u *SessionUpsertBulk) UpdateDeletedAt() *SessionUpsertBulk

UpdateDeletedAt sets the "deleted_at" field to the value that was provided on create.

func (*SessionUpsertBulk) UpdateNewValues

func (u *SessionUpsertBulk) UpdateNewValues() *SessionUpsertBulk

UpdateNewValues updates the mutable fields using the new values that were set on create. Using this option is equivalent to using:

client.Session.Create().
	OnConflict(
		sql.ResolveWithNewValues(),
	).
	Exec(ctx)

func (*SessionUpsertBulk) UpdateStatus

func (u *SessionUpsertBulk) UpdateStatus() *SessionUpsertBulk

UpdateStatus sets the "status" field to the value that was provided on create.

func (*SessionUpsertBulk) UpdateUpdatedAt

func (u *SessionUpsertBulk) UpdateUpdatedAt() *SessionUpsertBulk

UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create.

func (*SessionUpsertBulk) UpdateUserID

func (u *SessionUpsertBulk) UpdateUserID() *SessionUpsertBulk

UpdateUserID sets the "user_id" field to the value that was provided on create.

type SessionUpsertOne

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

SessionUpsertOne is the builder for "upsert"-ing

one Session node.

func (*SessionUpsertOne) AddDeletedAt

func (u *SessionUpsertOne) AddDeletedAt(v int) *SessionUpsertOne

AddDeletedAt adds v to the "deleted_at" field.

func (*SessionUpsertOne) DoNothing

func (u *SessionUpsertOne) DoNothing() *SessionUpsertOne

DoNothing configures the conflict_action to `DO NOTHING`. Supported only by SQLite and PostgreSQL.

func (*SessionUpsertOne) Exec

func (u *SessionUpsertOne) Exec(ctx context.Context) error

Exec executes the query.

func (*SessionUpsertOne) ExecX

func (u *SessionUpsertOne) ExecX(ctx context.Context)

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

func (*SessionUpsertOne) ID

func (u *SessionUpsertOne) ID(ctx context.Context) (id int, err error)

Exec executes the UPSERT query and returns the inserted/updated ID.

func (*SessionUpsertOne) IDX

func (u *SessionUpsertOne) IDX(ctx context.Context) int

IDX is like ID, but panics if an error occurs.

func (*SessionUpsertOne) Ignore

func (u *SessionUpsertOne) Ignore() *SessionUpsertOne

Ignore sets each column to itself in case of conflict. Using this option is equivalent to using:

client.Session.Create().
    OnConflict(sql.ResolveWithIgnore()).
    Exec(ctx)

func (*SessionUpsertOne) SetDeletedAt

func (u *SessionUpsertOne) SetDeletedAt(v int) *SessionUpsertOne

SetDeletedAt sets the "deleted_at" field.

func (*SessionUpsertOne) SetStatus

func (u *SessionUpsertOne) SetStatus(v bool) *SessionUpsertOne

SetStatus sets the "status" field.

func (*SessionUpsertOne) SetUpdatedAt

func (u *SessionUpsertOne) SetUpdatedAt(v time.Time) *SessionUpsertOne

SetUpdatedAt sets the "updated_at" field.

func (*SessionUpsertOne) SetUserID

func (u *SessionUpsertOne) SetUserID(v string) *SessionUpsertOne

SetUserID sets the "user_id" field.

func (*SessionUpsertOne) Update

func (u *SessionUpsertOne) Update(set func(*SessionUpsert)) *SessionUpsertOne

Update allows overriding fields `UPDATE` values. See the SessionCreate.OnConflict documentation for more info.

func (*SessionUpsertOne) UpdateDeletedAt

func (u *SessionUpsertOne) UpdateDeletedAt() *SessionUpsertOne

UpdateDeletedAt sets the "deleted_at" field to the value that was provided on create.

func (*SessionUpsertOne) UpdateNewValues

func (u *SessionUpsertOne) UpdateNewValues() *SessionUpsertOne

UpdateNewValues updates the mutable fields using the new values that were set on create. Using this option is equivalent to using:

client.Session.Create().
	OnConflict(
		sql.ResolveWithNewValues(),
	).
	Exec(ctx)

func (*SessionUpsertOne) UpdateStatus

func (u *SessionUpsertOne) UpdateStatus() *SessionUpsertOne

UpdateStatus sets the "status" field to the value that was provided on create.

func (*SessionUpsertOne) UpdateUpdatedAt

func (u *SessionUpsertOne) UpdateUpdatedAt() *SessionUpsertOne

UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create.

func (*SessionUpsertOne) UpdateUserID

func (u *SessionUpsertOne) UpdateUserID() *SessionUpsertOne

UpdateUserID sets the "user_id" field to the value that was provided on create.

type Sessions

type Sessions []*Session

Sessions is a parsable slice of Session.

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 {

	// Message is the client for interacting with the Message builders.
	Message *MessageClient
	// Session is the client for interacting with the Session builders.
	Session *SessionClient
	// 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) ExecContext

func (c *Tx) ExecContext(ctx context.Context, query string, args ...any) (stdsql.Result, error)

ExecContext allows calling the underlying ExecContext method of the driver if it is supported by it. See, database/sql#DB.ExecContext for more information.

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) QueryContext

func (c *Tx) QueryContext(ctx context.Context, query string, args ...any) (*stdsql.Rows, error)

QueryContext allows calling the underlying QueryContext method of the driver if it is supported by it. See, database/sql#DB.QueryContext for more information.

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