ent

package
v0.0.0-...-4c0fd1a Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2022 License: MIT Imports: 20 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.
	TypeChat         = "Chat"
	TypeMessage      = "Message"
	TypeUser         = "User"
	TypeUserMetadata = "UserMetadata"
)

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

func Count

func Count() AggregateFunc

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

func Max

func Max(field string) AggregateFunc

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

func Mean

func Mean(field string) AggregateFunc

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

func Min

func Min(field string) AggregateFunc

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

func Sum

func Sum(field string) AggregateFunc

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

type Chat

type Chat struct {

	// ID of the ent.
	ID int64 `json:"id,omitempty"`
	// OwnerID holds the value of the "ownerID" field.
	OwnerID int64 `json:"ownerID,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the ChatQuery when eager-loading is set.
	Edges ChatEdges `json:"edges"`
	// contains filtered or unexported fields
}

Chat is the model entity for the Chat schema.

func (*Chat) QueryMessages

func (c *Chat) QueryMessages() *MessageQuery

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

func (*Chat) QueryOwner

func (c *Chat) QueryOwner() *UserQuery

QueryOwner queries the "owner" edge of the Chat entity.

func (*Chat) String

func (c *Chat) String() string

String implements the fmt.Stringer.

func (*Chat) Unwrap

func (c *Chat) Unwrap() *Chat

Unwrap unwraps the Chat entity that was returned from a transaction after it was closed, so that all future queries will be executed through the driver which created the transaction.

func (*Chat) Update

func (c *Chat) Update() *ChatUpdateOne

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

type ChatClient

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

ChatClient is a client for the Chat schema.

func NewChatClient

func NewChatClient(c config) *ChatClient

NewChatClient returns a client for the Chat from the given config.

func (*ChatClient) Create

func (c *ChatClient) Create() *ChatCreate

Create returns a create builder for Chat.

func (*ChatClient) CreateBulk

func (c *ChatClient) CreateBulk(builders ...*ChatCreate) *ChatCreateBulk

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

func (*ChatClient) Delete

func (c *ChatClient) Delete() *ChatDelete

Delete returns a delete builder for Chat.

func (*ChatClient) DeleteOne

func (c *ChatClient) DeleteOne(ch *Chat) *ChatDeleteOne

DeleteOne returns a delete builder for the given entity.

func (*ChatClient) DeleteOneID

func (c *ChatClient) DeleteOneID(id int64) *ChatDeleteOne

DeleteOneID returns a delete builder for the given id.

func (*ChatClient) Get

func (c *ChatClient) Get(ctx context.Context, id int64) (*Chat, error)

Get returns a Chat entity by its id.

func (*ChatClient) GetX

func (c *ChatClient) GetX(ctx context.Context, id int64) *Chat

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

func (*ChatClient) Hooks

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

Hooks returns the client hooks.

func (*ChatClient) Query

func (c *ChatClient) Query() *ChatQuery

Query returns a query builder for Chat.

func (*ChatClient) QueryMessages

func (c *ChatClient) QueryMessages(ch *Chat) *MessageQuery

QueryMessages queries the messages edge of a Chat.

func (*ChatClient) QueryOwner

func (c *ChatClient) QueryOwner(ch *Chat) *UserQuery

QueryOwner queries the owner edge of a Chat.

func (*ChatClient) Update

func (c *ChatClient) Update() *ChatUpdate

Update returns an update builder for Chat.

func (*ChatClient) UpdateOne

func (c *ChatClient) UpdateOne(ch *Chat) *ChatUpdateOne

UpdateOne returns an update builder for the given entity.

func (*ChatClient) UpdateOneID

func (c *ChatClient) UpdateOneID(id int64) *ChatUpdateOne

UpdateOneID returns an update builder for the given id.

func (*ChatClient) Use

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

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

type ChatCreate

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

ChatCreate is the builder for creating a Chat entity.

func (*ChatCreate) AddMessageIDs

func (cc *ChatCreate) AddMessageIDs(ids ...int64) *ChatCreate

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

func (*ChatCreate) AddMessages

func (cc *ChatCreate) AddMessages(m ...*Message) *ChatCreate

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

func (*ChatCreate) Exec

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

Exec executes the query.

func (*ChatCreate) ExecX

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

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

func (*ChatCreate) Mutation

func (cc *ChatCreate) Mutation() *ChatMutation

Mutation returns the ChatMutation object of the builder.

func (*ChatCreate) Save

func (cc *ChatCreate) Save(ctx context.Context) (*Chat, error)

Save creates the Chat in the database.

func (*ChatCreate) SaveX

func (cc *ChatCreate) SaveX(ctx context.Context) *Chat

SaveX calls Save and panics if Save returns an error.

func (*ChatCreate) SetID

func (cc *ChatCreate) SetID(i int64) *ChatCreate

SetID sets the "id" field.

func (*ChatCreate) SetOwner

func (cc *ChatCreate) SetOwner(u *User) *ChatCreate

SetOwner sets the "owner" edge to the User entity.

func (*ChatCreate) SetOwnerID

func (cc *ChatCreate) SetOwnerID(i int64) *ChatCreate

SetOwnerID sets the "ownerID" field.

type ChatCreateBulk

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

ChatCreateBulk is the builder for creating many Chat entities in bulk.

func (*ChatCreateBulk) Exec

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

Exec executes the query.

func (*ChatCreateBulk) ExecX

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

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

func (*ChatCreateBulk) Save

func (ccb *ChatCreateBulk) Save(ctx context.Context) ([]*Chat, error)

Save creates the Chat entities in the database.

func (*ChatCreateBulk) SaveX

func (ccb *ChatCreateBulk) SaveX(ctx context.Context) []*Chat

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

type ChatDelete

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

ChatDelete is the builder for deleting a Chat entity.

func (*ChatDelete) Exec

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

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

func (*ChatDelete) ExecX

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

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

func (*ChatDelete) Where

func (cd *ChatDelete) Where(ps ...predicate.Chat) *ChatDelete

Where appends a list predicates to the ChatDelete builder.

type ChatDeleteOne

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

ChatDeleteOne is the builder for deleting a single Chat entity.

func (*ChatDeleteOne) Exec

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

Exec executes the deletion query.

func (*ChatDeleteOne) ExecX

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

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

type ChatEdges

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

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

func (ChatEdges) MessagesOrErr

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

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

func (ChatEdges) OwnerOrErr

func (e ChatEdges) OwnerOrErr() (*User, error)

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

type ChatGroupBy

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

ChatGroupBy is the group-by builder for Chat entities.

func (*ChatGroupBy) Aggregate

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

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

func (*ChatGroupBy) Bool

func (cgb *ChatGroupBy) Bool(ctx context.Context) (_ bool, err error)

Bool returns a single bool from a group-by query. It is only allowed when executing a group-by query with one field.

func (*ChatGroupBy) BoolX

func (cgb *ChatGroupBy) BoolX(ctx context.Context) bool

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

func (*ChatGroupBy) Bools

func (cgb *ChatGroupBy) Bools(ctx context.Context) ([]bool, error)

Bools returns list of bools from group-by. It is only allowed when executing a group-by query with one field.

func (*ChatGroupBy) BoolsX

func (cgb *ChatGroupBy) BoolsX(ctx context.Context) []bool

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

func (*ChatGroupBy) Float64

func (cgb *ChatGroupBy) Float64(ctx context.Context) (_ float64, err error)

Float64 returns a single float64 from a group-by query. It is only allowed when executing a group-by query with one field.

func (*ChatGroupBy) Float64X

func (cgb *ChatGroupBy) Float64X(ctx context.Context) float64

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

func (*ChatGroupBy) Float64s

func (cgb *ChatGroupBy) Float64s(ctx context.Context) ([]float64, error)

Float64s returns list of float64s from group-by. It is only allowed when executing a group-by query with one field.

func (*ChatGroupBy) Float64sX

func (cgb *ChatGroupBy) Float64sX(ctx context.Context) []float64

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

func (*ChatGroupBy) Int

func (cgb *ChatGroupBy) Int(ctx context.Context) (_ int, err error)

Int returns a single int from a group-by query. It is only allowed when executing a group-by query with one field.

func (*ChatGroupBy) IntX

func (cgb *ChatGroupBy) IntX(ctx context.Context) int

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

func (*ChatGroupBy) Ints

func (cgb *ChatGroupBy) Ints(ctx context.Context) ([]int, error)

Ints returns list of ints from group-by. It is only allowed when executing a group-by query with one field.

func (*ChatGroupBy) IntsX

func (cgb *ChatGroupBy) IntsX(ctx context.Context) []int

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

func (*ChatGroupBy) Scan

func (cgb *ChatGroupBy) Scan(ctx context.Context, v interface{}) error

Scan applies the group-by query and scans the result into the given value.

func (*ChatGroupBy) ScanX

func (cgb *ChatGroupBy) ScanX(ctx context.Context, v interface{})

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

func (*ChatGroupBy) String

func (cgb *ChatGroupBy) String(ctx context.Context) (_ string, err error)

String returns a single string from a group-by query. It is only allowed when executing a group-by query with one field.

func (*ChatGroupBy) StringX

func (cgb *ChatGroupBy) StringX(ctx context.Context) string

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

func (*ChatGroupBy) Strings

func (cgb *ChatGroupBy) Strings(ctx context.Context) ([]string, error)

Strings returns list of strings from group-by. It is only allowed when executing a group-by query with one field.

func (*ChatGroupBy) StringsX

func (cgb *ChatGroupBy) StringsX(ctx context.Context) []string

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

type ChatMutation

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

ChatMutation represents an operation that mutates the Chat nodes in the graph.

func (*ChatMutation) AddField

func (m *ChatMutation) AddField(name string, value ent.Value) error

AddField adds the value to the field with the given name. It returns an error if the field is not defined in the schema, or if the type mismatched the field type.

func (*ChatMutation) AddMessageIDs

func (m *ChatMutation) AddMessageIDs(ids ...int64)

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

func (*ChatMutation) AddedEdges

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

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

func (*ChatMutation) AddedField

func (m *ChatMutation) AddedField(name string) (ent.Value, bool)

AddedField returns the numeric value that was incremented/decremented on a field with the given name. The second boolean return value indicates that this field was not set, or was not defined in the schema.

func (*ChatMutation) AddedFields

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

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

func (*ChatMutation) AddedIDs

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

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

func (*ChatMutation) ClearEdge

func (m *ChatMutation) ClearEdge(name string) error

ClearEdge clears the value of the edge with the given name. It returns an error if that edge is not defined in the schema.

func (*ChatMutation) ClearField

func (m *ChatMutation) ClearField(name string) error

ClearField clears the value of the field with the given name. It returns an error if the field is not defined in the schema.

func (*ChatMutation) ClearMessages

func (m *ChatMutation) ClearMessages()

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

func (*ChatMutation) ClearOwner

func (m *ChatMutation) ClearOwner()

ClearOwner clears the "owner" edge to the User entity.

func (*ChatMutation) ClearedEdges

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

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

func (*ChatMutation) ClearedFields

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

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

func (ChatMutation) Client

func (m ChatMutation) Client() *Client

Client returns a new `ent.Client` from the mutation. If the mutation was executed in a transaction (ent.Tx), a transactional client is returned.

func (*ChatMutation) EdgeCleared

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

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

func (*ChatMutation) Field

func (m *ChatMutation) Field(name string) (ent.Value, bool)

Field returns the value of a field with the given name. The second boolean return value indicates that this field was not set, or was not defined in the schema.

func (*ChatMutation) FieldCleared

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

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

func (*ChatMutation) Fields

func (m *ChatMutation) Fields() []string

Fields returns all fields that were changed during this mutation. Note that in order to get all numeric fields that were incremented/decremented, call AddedFields().

func (*ChatMutation) ID

func (m *ChatMutation) ID() (id int64, exists bool)

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

func (*ChatMutation) IDs

func (m *ChatMutation) IDs(ctx context.Context) ([]int64, 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 (*ChatMutation) MessagesCleared

func (m *ChatMutation) MessagesCleared() bool

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

func (*ChatMutation) MessagesIDs

func (m *ChatMutation) MessagesIDs() (ids []int64)

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

func (*ChatMutation) OldField

func (m *ChatMutation) 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 (*ChatMutation) OldOwnerID

func (m *ChatMutation) OldOwnerID(ctx context.Context) (v int64, err error)

OldOwnerID returns the old "ownerID" field's value of the Chat entity. If the Chat object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.

func (*ChatMutation) Op

func (m *ChatMutation) Op() Op

Op returns the operation name.

func (*ChatMutation) OwnerCleared

func (m *ChatMutation) OwnerCleared() bool

OwnerCleared reports if the "owner" edge to the User entity was cleared.

func (*ChatMutation) OwnerID

func (m *ChatMutation) OwnerID() (r int64, exists bool)

OwnerID returns the value of the "ownerID" field in the mutation.

func (*ChatMutation) OwnerIDs

func (m *ChatMutation) OwnerIDs() (ids []int64)

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

func (*ChatMutation) RemoveMessageIDs

func (m *ChatMutation) RemoveMessageIDs(ids ...int64)

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

func (*ChatMutation) RemovedEdges

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

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

func (*ChatMutation) RemovedIDs

func (m *ChatMutation) RemovedIDs(name string) []ent.Value

RemovedIDs returns all IDs (to other nodes) that were removed for the edge with the given name in this mutation.

func (*ChatMutation) RemovedMessagesIDs

func (m *ChatMutation) RemovedMessagesIDs() (ids []int64)

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

func (*ChatMutation) ResetEdge

func (m *ChatMutation) ResetEdge(name string) error

ResetEdge resets all changes to the edge with the given name in this mutation. It returns an error if the edge is not defined in the schema.

func (*ChatMutation) ResetField

func (m *ChatMutation) ResetField(name string) error

ResetField resets all changes in the mutation for the field with the given name. It returns an error if the field is not defined in the schema.

func (*ChatMutation) ResetMessages

func (m *ChatMutation) ResetMessages()

ResetMessages resets all changes to the "messages" edge.

func (*ChatMutation) ResetOwner

func (m *ChatMutation) ResetOwner()

ResetOwner resets all changes to the "owner" edge.

func (*ChatMutation) ResetOwnerID

func (m *ChatMutation) ResetOwnerID()

ResetOwnerID resets all changes to the "ownerID" field.

func (*ChatMutation) SetField

func (m *ChatMutation) SetField(name string, value ent.Value) error

SetField sets the value of a field with the given name. It returns an error if the field is not defined in the schema, or if the type mismatched the field type.

func (*ChatMutation) SetID

func (m *ChatMutation) SetID(id int64)

SetID sets the value of the id field. Note that this operation is only accepted on creation of Chat entities.

func (*ChatMutation) SetOwnerID

func (m *ChatMutation) SetOwnerID(i int64)

SetOwnerID sets the "ownerID" field.

func (ChatMutation) Tx

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

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

func (*ChatMutation) Type

func (m *ChatMutation) Type() string

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

func (*ChatMutation) Where

func (m *ChatMutation) Where(ps ...predicate.Chat)

Where appends a list predicates to the ChatMutation builder.

type ChatQuery

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

ChatQuery is the builder for querying Chat entities.

func (*ChatQuery) All

func (cq *ChatQuery) All(ctx context.Context) ([]*Chat, error)

All executes the query and returns a list of Chats.

func (*ChatQuery) AllX

func (cq *ChatQuery) AllX(ctx context.Context) []*Chat

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

func (*ChatQuery) Clone

func (cq *ChatQuery) Clone() *ChatQuery

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

func (*ChatQuery) Count

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

Count returns the count of the given query.

func (*ChatQuery) CountX

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

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

func (*ChatQuery) Exist

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

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

func (*ChatQuery) ExistX

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

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

func (*ChatQuery) First

func (cq *ChatQuery) First(ctx context.Context) (*Chat, error)

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

func (*ChatQuery) FirstID

func (cq *ChatQuery) FirstID(ctx context.Context) (id int64, err error)

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

func (*ChatQuery) FirstIDX

func (cq *ChatQuery) FirstIDX(ctx context.Context) int64

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

func (*ChatQuery) FirstX

func (cq *ChatQuery) FirstX(ctx context.Context) *Chat

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

func (*ChatQuery) GroupBy

func (cq *ChatQuery) GroupBy(field string, fields ...string) *ChatGroupBy

GroupBy is used to group vertices by one or more fields/columns. It is often used with aggregate functions, like: count, max, mean, min, sum.

Example:

var v []struct {
	OwnerID int64 `json:"ownerID,omitempty"`
	Count int `json:"count,omitempty"`
}

client.Chat.Query().
	GroupBy(chat.FieldOwnerID).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*ChatQuery) IDs

func (cq *ChatQuery) IDs(ctx context.Context) ([]int64, error)

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

func (*ChatQuery) IDsX

func (cq *ChatQuery) IDsX(ctx context.Context) []int64

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

func (*ChatQuery) Limit

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

Limit adds a limit step to the query.

func (*ChatQuery) Offset

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

Offset adds an offset step to the query.

func (*ChatQuery) Only

func (cq *ChatQuery) Only(ctx context.Context) (*Chat, error)

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

func (*ChatQuery) OnlyID

func (cq *ChatQuery) OnlyID(ctx context.Context) (id int64, err error)

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

func (*ChatQuery) OnlyIDX

func (cq *ChatQuery) OnlyIDX(ctx context.Context) int64

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

func (*ChatQuery) OnlyX

func (cq *ChatQuery) OnlyX(ctx context.Context) *Chat

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

func (*ChatQuery) Order

func (cq *ChatQuery) Order(o ...OrderFunc) *ChatQuery

Order adds an order step to the query.

func (*ChatQuery) QueryMessages

func (cq *ChatQuery) QueryMessages() *MessageQuery

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

func (*ChatQuery) QueryOwner

func (cq *ChatQuery) QueryOwner() *UserQuery

QueryOwner chains the current query on the "owner" edge.

func (*ChatQuery) Select

func (cq *ChatQuery) Select(fields ...string) *ChatSelect

Select allows the selection one or more fields/columns for the given query, instead of selecting all fields in the entity.

Example:

var v []struct {
	OwnerID int64 `json:"ownerID,omitempty"`
}

client.Chat.Query().
	Select(chat.FieldOwnerID).
	Scan(ctx, &v)

func (*ChatQuery) Unique

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

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

func (cq *ChatQuery) Where(ps ...predicate.Chat) *ChatQuery

Where adds a new predicate for the ChatQuery builder.

func (*ChatQuery) WithMessages

func (cq *ChatQuery) WithMessages(opts ...func(*MessageQuery)) *ChatQuery

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.

func (*ChatQuery) WithOwner

func (cq *ChatQuery) WithOwner(opts ...func(*UserQuery)) *ChatQuery

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

type ChatSelect

type ChatSelect struct {
	*ChatQuery
	// contains filtered or unexported fields
}

ChatSelect is the builder for selecting fields of Chat entities.

func (*ChatSelect) Bool

func (cs *ChatSelect) Bool(ctx context.Context) (_ bool, err error)

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

func (*ChatSelect) BoolX

func (cs *ChatSelect) BoolX(ctx context.Context) bool

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

func (*ChatSelect) Bools

func (cs *ChatSelect) Bools(ctx context.Context) ([]bool, error)

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

func (*ChatSelect) BoolsX

func (cs *ChatSelect) BoolsX(ctx context.Context) []bool

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

func (*ChatSelect) Float64

func (cs *ChatSelect) Float64(ctx context.Context) (_ float64, err error)

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

func (*ChatSelect) Float64X

func (cs *ChatSelect) Float64X(ctx context.Context) float64

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

func (*ChatSelect) Float64s

func (cs *ChatSelect) Float64s(ctx context.Context) ([]float64, error)

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

func (*ChatSelect) Float64sX

func (cs *ChatSelect) Float64sX(ctx context.Context) []float64

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

func (*ChatSelect) Int

func (cs *ChatSelect) Int(ctx context.Context) (_ int, err error)

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

func (*ChatSelect) IntX

func (cs *ChatSelect) IntX(ctx context.Context) int

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

func (*ChatSelect) Ints

func (cs *ChatSelect) Ints(ctx context.Context) ([]int, error)

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

func (*ChatSelect) IntsX

func (cs *ChatSelect) IntsX(ctx context.Context) []int

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

func (*ChatSelect) Scan

func (cs *ChatSelect) Scan(ctx context.Context, v interface{}) error

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

func (*ChatSelect) ScanX

func (cs *ChatSelect) ScanX(ctx context.Context, v interface{})

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

func (*ChatSelect) String

func (cs *ChatSelect) String(ctx context.Context) (_ string, err error)

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

func (*ChatSelect) StringX

func (cs *ChatSelect) StringX(ctx context.Context) string

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

func (*ChatSelect) Strings

func (cs *ChatSelect) Strings(ctx context.Context) ([]string, error)

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

func (*ChatSelect) StringsX

func (cs *ChatSelect) StringsX(ctx context.Context) []string

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

type ChatUpdate

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

ChatUpdate is the builder for updating Chat entities.

func (*ChatUpdate) AddMessageIDs

func (cu *ChatUpdate) AddMessageIDs(ids ...int64) *ChatUpdate

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

func (*ChatUpdate) AddMessages

func (cu *ChatUpdate) AddMessages(m ...*Message) *ChatUpdate

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

func (*ChatUpdate) ClearMessages

func (cu *ChatUpdate) ClearMessages() *ChatUpdate

ClearMessages clears all "messages" edges to the Message entity.

func (*ChatUpdate) ClearOwner

func (cu *ChatUpdate) ClearOwner() *ChatUpdate

ClearOwner clears the "owner" edge to the User entity.

func (*ChatUpdate) Exec

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

Exec executes the query.

func (*ChatUpdate) ExecX

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

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

func (*ChatUpdate) Mutation

func (cu *ChatUpdate) Mutation() *ChatMutation

Mutation returns the ChatMutation object of the builder.

func (*ChatUpdate) RemoveMessageIDs

func (cu *ChatUpdate) RemoveMessageIDs(ids ...int64) *ChatUpdate

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

func (*ChatUpdate) RemoveMessages

func (cu *ChatUpdate) RemoveMessages(m ...*Message) *ChatUpdate

RemoveMessages removes "messages" edges to Message entities.

func (*ChatUpdate) Save

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

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

func (*ChatUpdate) SaveX

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

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

func (*ChatUpdate) SetOwner

func (cu *ChatUpdate) SetOwner(u *User) *ChatUpdate

SetOwner sets the "owner" edge to the User entity.

func (*ChatUpdate) SetOwnerID

func (cu *ChatUpdate) SetOwnerID(i int64) *ChatUpdate

SetOwnerID sets the "ownerID" field.

func (*ChatUpdate) Where

func (cu *ChatUpdate) Where(ps ...predicate.Chat) *ChatUpdate

Where appends a list predicates to the ChatUpdate builder.

type ChatUpdateOne

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

ChatUpdateOne is the builder for updating a single Chat entity.

func (*ChatUpdateOne) AddMessageIDs

func (cuo *ChatUpdateOne) AddMessageIDs(ids ...int64) *ChatUpdateOne

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

func (*ChatUpdateOne) AddMessages

func (cuo *ChatUpdateOne) AddMessages(m ...*Message) *ChatUpdateOne

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

func (*ChatUpdateOne) ClearMessages

func (cuo *ChatUpdateOne) ClearMessages() *ChatUpdateOne

ClearMessages clears all "messages" edges to the Message entity.

func (*ChatUpdateOne) ClearOwner

func (cuo *ChatUpdateOne) ClearOwner() *ChatUpdateOne

ClearOwner clears the "owner" edge to the User entity.

func (*ChatUpdateOne) Exec

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

Exec executes the query on the entity.

func (*ChatUpdateOne) ExecX

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

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

func (*ChatUpdateOne) Mutation

func (cuo *ChatUpdateOne) Mutation() *ChatMutation

Mutation returns the ChatMutation object of the builder.

func (*ChatUpdateOne) RemoveMessageIDs

func (cuo *ChatUpdateOne) RemoveMessageIDs(ids ...int64) *ChatUpdateOne

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

func (*ChatUpdateOne) RemoveMessages

func (cuo *ChatUpdateOne) RemoveMessages(m ...*Message) *ChatUpdateOne

RemoveMessages removes "messages" edges to Message entities.

func (*ChatUpdateOne) Save

func (cuo *ChatUpdateOne) Save(ctx context.Context) (*Chat, error)

Save executes the query and returns the updated Chat entity.

func (*ChatUpdateOne) SaveX

func (cuo *ChatUpdateOne) SaveX(ctx context.Context) *Chat

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

func (*ChatUpdateOne) Select

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

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

func (*ChatUpdateOne) SetOwner

func (cuo *ChatUpdateOne) SetOwner(u *User) *ChatUpdateOne

SetOwner sets the "owner" edge to the User entity.

func (*ChatUpdateOne) SetOwnerID

func (cuo *ChatUpdateOne) SetOwnerID(i int64) *ChatUpdateOne

SetOwnerID sets the "ownerID" field.

type Chats

type Chats []*Chat

Chats is a parsable slice of Chat.

type Client

type Client struct {

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

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 Message

type Message struct {

	// ID of the ent.
	ID int64 `json:"id,omitempty"`
	// ChatID holds the value of the "chatID" field.
	ChatID int64 `json:"chatID,omitempty"`
	// UserID holds the value of the "userID" field.
	UserID int64 `json:"userID,omitempty"`
	// Text holds the value of the "text" field.
	Text string `json:"text,omitempty"`
	// Timestamp holds the value of the "timestamp" field.
	Timestamp time.Time `json:"timestamp,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) QueryChat

func (m *Message) QueryChat() *ChatQuery

QueryChat queries the "chat" edge of the Message entity.

func (*Message) QueryUser

func (m *Message) QueryUser() *UserQuery

QueryUser queries the "user" 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 create builder for Message.

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 delete builder for the given entity.

func (*MessageClient) DeleteOneID

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

DeleteOneID returns a delete builder for the given id.

func (*MessageClient) Get

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

Get returns a Message entity by its id.

func (*MessageClient) GetX

func (c *MessageClient) GetX(ctx context.Context, id int64) *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) Query

func (c *MessageClient) Query() *MessageQuery

Query returns a query builder for Message.

func (*MessageClient) QueryChat

func (c *MessageClient) QueryChat(m *Message) *ChatQuery

QueryChat queries the chat edge of a Message.

func (*MessageClient) QueryUser

func (c *MessageClient) QueryUser(m *Message) *UserQuery

QueryUser queries the user 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 int64) *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) 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) 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) SetChat

func (mc *MessageCreate) SetChat(c *Chat) *MessageCreate

SetChat sets the "chat" edge to the Chat entity.

func (*MessageCreate) SetChatID

func (mc *MessageCreate) SetChatID(i int64) *MessageCreate

SetChatID sets the "chatID" field.

func (*MessageCreate) SetID

func (mc *MessageCreate) SetID(i int64) *MessageCreate

SetID sets the "id" field.

func (*MessageCreate) SetText

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

SetText sets the "text" field.

func (*MessageCreate) SetTimestamp

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

SetTimestamp sets the "timestamp" field.

func (*MessageCreate) SetUser

func (mc *MessageCreate) SetUser(u *User) *MessageCreate

SetUser sets the "user" edge to the User entity.

func (*MessageCreate) SetUserID

func (mc *MessageCreate) SetUserID(i int64) *MessageCreate

SetUserID sets the "userID" 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) ExecX

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

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

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

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

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

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.

type MessageEdges

type MessageEdges struct {
	// Chat holds the value of the chat edge.
	Chat *Chat `json:"chat,omitempty"`
	// User holds the value of the user edge.
	User *User `json:"user,omitempty"`
	// contains filtered or unexported fields
}

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

func (MessageEdges) ChatOrErr

func (e MessageEdges) ChatOrErr() (*Chat, error)

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

func (MessageEdges) UserOrErr

func (e MessageEdges) UserOrErr() (*User, error)

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

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 (mgb *MessageGroupBy) Bool(ctx context.Context) (_ bool, err error)

Bool returns a single bool from a group-by query. It is only allowed when executing a group-by query with one field.

func (*MessageGroupBy) BoolX

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

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

func (*MessageGroupBy) Bools

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

Bools returns list of bools from group-by. It is only allowed when executing a group-by query with one field.

func (*MessageGroupBy) BoolsX

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

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

func (*MessageGroupBy) Float64

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

Float64 returns a single float64 from a group-by query. It is only allowed when executing a group-by query with one field.

func (*MessageGroupBy) Float64X

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

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

func (*MessageGroupBy) Float64s

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

Float64s returns list of float64s from group-by. It is only allowed when executing a group-by query with one field.

func (*MessageGroupBy) Float64sX

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

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

func (*MessageGroupBy) Int

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

Int returns a single int from a group-by query. It is only allowed when executing a group-by query with one field.

func (*MessageGroupBy) IntX

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

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

func (*MessageGroupBy) Ints

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

Ints returns list of ints from group-by. It is only allowed when executing a group-by query with one field.

func (*MessageGroupBy) IntsX

func (mgb *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 interface{}) error

Scan applies the group-by query and scans the result into the given value.

func (*MessageGroupBy) ScanX

func (mgb *MessageGroupBy) ScanX(ctx context.Context, v interface{})

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

func (*MessageGroupBy) String

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

String returns a single string from a group-by query. It is only allowed when executing a group-by query with one field.

func (*MessageGroupBy) StringX

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

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

func (*MessageGroupBy) Strings

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

Strings returns list of strings from group-by. It is only allowed when executing a group-by query with one field.

func (*MessageGroupBy) StringsX

func (mgb *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) ChatCleared

func (m *MessageMutation) ChatCleared() bool

ChatCleared reports if the "chat" edge to the Chat entity was cleared.

func (*MessageMutation) ChatID

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

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

func (*MessageMutation) ChatIDs

func (m *MessageMutation) ChatIDs() (ids []int64)

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

func (*MessageMutation) ClearChat

func (m *MessageMutation) ClearChat()

ClearChat clears the "chat" edge to the Chat entity.

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

func (m *MessageMutation) ClearUser()

ClearUser clears the "user" edge to the User entity.

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

func (m *MessageMutation) ID() (id int64, 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) ([]int64, 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) OldChatID

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

OldChatID returns the old "chatID" 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) OldText

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

OldText returns the old "text" 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) OldTimestamp

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

OldTimestamp returns the old "timestamp" 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) OldUserID

func (m *MessageMutation) OldUserID(ctx context.Context) (v int64, err error)

OldUserID returns the old "userID" 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) 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) ResetChat

func (m *MessageMutation) ResetChat()

ResetChat resets all changes to the "chat" edge.

func (*MessageMutation) ResetChatID

func (m *MessageMutation) ResetChatID()

ResetChatID resets all changes to the "chatID" 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) ResetText

func (m *MessageMutation) ResetText()

ResetText resets all changes to the "text" field.

func (*MessageMutation) ResetTimestamp

func (m *MessageMutation) ResetTimestamp()

ResetTimestamp resets all changes to the "timestamp" field.

func (*MessageMutation) ResetUser

func (m *MessageMutation) ResetUser()

ResetUser resets all changes to the "user" edge.

func (*MessageMutation) ResetUserID

func (m *MessageMutation) ResetUserID()

ResetUserID resets all changes to the "userID" field.

func (*MessageMutation) SetChatID

func (m *MessageMutation) SetChatID(i int64)

SetChatID sets the "chatID" 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) SetID

func (m *MessageMutation) SetID(id int64)

SetID sets the value of the id field. Note that this operation is only accepted on creation of Message entities.

func (*MessageMutation) SetText

func (m *MessageMutation) SetText(s string)

SetText sets the "text" field.

func (*MessageMutation) SetTimestamp

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

SetTimestamp sets the "timestamp" field.

func (*MessageMutation) SetUserID

func (m *MessageMutation) SetUserID(i int64)

SetUserID sets the "userID" field.

func (*MessageMutation) Text

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

Text returns the value of the "text" field in the mutation.

func (*MessageMutation) Timestamp

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

Timestamp returns the value of the "timestamp" 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) UserCleared

func (m *MessageMutation) UserCleared() bool

UserCleared reports if the "user" edge to the User entity was cleared.

func (*MessageMutation) UserID

func (m *MessageMutation) UserID() (r int64, exists bool)

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

func (*MessageMutation) UserIDs

func (m *MessageMutation) UserIDs() (ids []int64)

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

func (*MessageMutation) Where

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

Where appends a list predicates to the MessageMutation builder.

type MessageQuery

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

MessageQuery is the builder for querying Message entities.

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) 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) 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 int64, 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) int64

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

client.Message.Query().
	GroupBy(message.FieldChatID).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*MessageQuery) IDs

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

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

func (*MessageQuery) IDsX

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

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

func (*MessageQuery) Limit

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

Limit adds a limit step to the query.

func (*MessageQuery) Offset

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

Offset adds an offset step to the query.

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 int64, 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) int64

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 adds an order step to the query.

func (*MessageQuery) QueryChat

func (mq *MessageQuery) QueryChat() *ChatQuery

QueryChat chains the current query on the "chat" edge.

func (*MessageQuery) QueryUser

func (mq *MessageQuery) QueryUser() *UserQuery

QueryUser chains the current query on the "user" 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 {
	ChatID int64 `json:"chatID,omitempty"`
}

client.Message.Query().
	Select(message.FieldChatID).
	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) WithChat

func (mq *MessageQuery) WithChat(opts ...func(*ChatQuery)) *MessageQuery

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

func (*MessageQuery) WithUser

func (mq *MessageQuery) WithUser(opts ...func(*UserQuery)) *MessageQuery

WithUser tells the query-builder to eager-load the nodes that are connected to the "user" 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) Bool

func (ms *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 (ms *MessageSelect) BoolX(ctx context.Context) bool

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

func (*MessageSelect) Bools

func (ms *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 (ms *MessageSelect) BoolsX(ctx context.Context) []bool

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

func (*MessageSelect) Float64

func (ms *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 (ms *MessageSelect) Float64X(ctx context.Context) float64

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

func (*MessageSelect) Float64s

func (ms *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 (ms *MessageSelect) Float64sX(ctx context.Context) []float64

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

func (*MessageSelect) Int

func (ms *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 (ms *MessageSelect) IntX(ctx context.Context) int

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

func (*MessageSelect) Ints

func (ms *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 (ms *MessageSelect) IntsX(ctx context.Context) []int

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

func (*MessageSelect) Scan

func (ms *MessageSelect) Scan(ctx context.Context, v interface{}) error

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

func (*MessageSelect) ScanX

func (ms *MessageSelect) ScanX(ctx context.Context, v interface{})

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

func (*MessageSelect) String

func (ms *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 (ms *MessageSelect) StringX(ctx context.Context) string

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

func (*MessageSelect) Strings

func (ms *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 (ms *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) ClearChat

func (mu *MessageUpdate) ClearChat() *MessageUpdate

ClearChat clears the "chat" edge to the Chat entity.

func (*MessageUpdate) ClearUser

func (mu *MessageUpdate) ClearUser() *MessageUpdate

ClearUser clears the "user" edge to the User entity.

func (*MessageUpdate) Exec

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

Exec executes the query.

func (*MessageUpdate) ExecX

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

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

func (*MessageUpdate) Mutation

func (mu *MessageUpdate) Mutation() *MessageMutation

Mutation returns the MessageMutation object of the builder.

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

func (mu *MessageUpdate) SetChat(c *Chat) *MessageUpdate

SetChat sets the "chat" edge to the Chat entity.

func (*MessageUpdate) SetChatID

func (mu *MessageUpdate) SetChatID(i int64) *MessageUpdate

SetChatID sets the "chatID" field.

func (*MessageUpdate) SetText

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

SetText sets the "text" field.

func (*MessageUpdate) SetUser

func (mu *MessageUpdate) SetUser(u *User) *MessageUpdate

SetUser sets the "user" edge to the User entity.

func (*MessageUpdate) SetUserID

func (mu *MessageUpdate) SetUserID(i int64) *MessageUpdate

SetUserID sets the "userID" 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) ClearChat

func (muo *MessageUpdateOne) ClearChat() *MessageUpdateOne

ClearChat clears the "chat" edge to the Chat entity.

func (*MessageUpdateOne) ClearUser

func (muo *MessageUpdateOne) ClearUser() *MessageUpdateOne

ClearUser clears the "user" edge to the User entity.

func (*MessageUpdateOne) Exec

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

Exec executes the query on the entity.

func (*MessageUpdateOne) ExecX

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

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

func (*MessageUpdateOne) Mutation

func (muo *MessageUpdateOne) Mutation() *MessageMutation

Mutation returns the MessageMutation object of the builder.

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

func (muo *MessageUpdateOne) SetChat(c *Chat) *MessageUpdateOne

SetChat sets the "chat" edge to the Chat entity.

func (*MessageUpdateOne) SetChatID

func (muo *MessageUpdateOne) SetChatID(i int64) *MessageUpdateOne

SetChatID sets the "chatID" field.

func (*MessageUpdateOne) SetText

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

SetText sets the "text" field.

func (*MessageUpdateOne) SetUser

func (muo *MessageUpdateOne) SetUser(u *User) *MessageUpdateOne

SetUser sets the "user" edge to the User entity.

func (*MessageUpdateOne) SetUserID

func (muo *MessageUpdateOne) SetUserID(i int64) *MessageUpdateOne

SetUserID sets the "userID" field.

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(...interface{})) 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 Query

type Query = ent.Query

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 Tx

type Tx struct {

	// Chat is the client for interacting with the Chat builders.
	Chat *ChatClient
	// Message is the client for interacting with the Message builders.
	Message *MessageClient
	// User is the client for interacting with the User builders.
	User *UserClient
	// UserMetadata is the client for interacting with the UserMetadata builders.
	UserMetadata *UserMetadataClient
	// contains filtered or unexported fields
}

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

func TxFromContext

func TxFromContext(ctx context.Context) *Tx

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

func (*Tx) Client

func (tx *Tx) Client() *Client

Client returns a Client that binds to current transaction.

func (*Tx) Commit

func (tx *Tx) Commit() error

Commit commits the transaction.

func (*Tx) OnCommit

func (tx *Tx) OnCommit(f CommitHook)

OnCommit adds a hook to call on commit.

func (*Tx) OnRollback

func (tx *Tx) OnRollback(f RollbackHook)

OnRollback adds a hook to call on rollback.

func (*Tx) Rollback

func (tx *Tx) Rollback() error

Rollback rollbacks the transaction.

type User

type User struct {

	// ID of the ent.
	ID int64 `json:"id,omitempty"`
	// Email holds the value of the "email" field.
	Email string `json:"email,omitempty"`
	// Password holds the value of the "password" field.
	Password string `json:"password,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the UserQuery when eager-loading is set.
	Edges UserEdges `json:"edges"`
	// contains filtered or unexported fields
}

User is the model entity for the User schema.

func (*User) QueryChat

func (u *User) QueryChat() *ChatQuery

QueryChat queries the "chat" edge of the User entity.

func (*User) QueryMessages

func (u *User) QueryMessages() *MessageQuery

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

func (*User) QueryMetadata

func (u *User) QueryMetadata() *UserMetadataQuery

QueryMetadata queries the "metadata" edge of the User entity.

func (*User) String

func (u *User) String() string

String implements the fmt.Stringer.

func (*User) Unwrap

func (u *User) Unwrap() *User

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

func (u *User) Update() *UserUpdateOne

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

type UserClient

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

UserClient is a client for the User schema.

func NewUserClient

func NewUserClient(c config) *UserClient

NewUserClient returns a client for the User from the given config.

func (*UserClient) Create

func (c *UserClient) Create() *UserCreate

Create returns a create builder for User.

func (*UserClient) CreateBulk

func (c *UserClient) CreateBulk(builders ...*UserCreate) *UserCreateBulk

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

func (*UserClient) Delete

func (c *UserClient) Delete() *UserDelete

Delete returns a delete builder for User.

func (*UserClient) DeleteOne

func (c *UserClient) DeleteOne(u *User) *UserDeleteOne

DeleteOne returns a delete builder for the given entity.

func (*UserClient) DeleteOneID

func (c *UserClient) DeleteOneID(id int64) *UserDeleteOne

DeleteOneID returns a delete builder for the given id.

func (*UserClient) Get

func (c *UserClient) Get(ctx context.Context, id int64) (*User, error)

Get returns a User entity by its id.

func (*UserClient) GetX

func (c *UserClient) GetX(ctx context.Context, id int64) *User

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

func (*UserClient) Hooks

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

Hooks returns the client hooks.

func (*UserClient) Query

func (c *UserClient) Query() *UserQuery

Query returns a query builder for User.

func (*UserClient) QueryChat

func (c *UserClient) QueryChat(u *User) *ChatQuery

QueryChat queries the chat edge of a User.

func (*UserClient) QueryMessages

func (c *UserClient) QueryMessages(u *User) *MessageQuery

QueryMessages queries the messages edge of a User.

func (*UserClient) QueryMetadata

func (c *UserClient) QueryMetadata(u *User) *UserMetadataQuery

QueryMetadata queries the metadata edge of a User.

func (*UserClient) Update

func (c *UserClient) Update() *UserUpdate

Update returns an update builder for User.

func (*UserClient) UpdateOne

func (c *UserClient) UpdateOne(u *User) *UserUpdateOne

UpdateOne returns an update builder for the given entity.

func (*UserClient) UpdateOneID

func (c *UserClient) UpdateOneID(id int64) *UserUpdateOne

UpdateOneID returns an update builder for the given id.

func (*UserClient) Use

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

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

type UserCreate

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

UserCreate is the builder for creating a User entity.

func (*UserCreate) AddMessageIDs

func (uc *UserCreate) AddMessageIDs(ids ...int64) *UserCreate

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

func (*UserCreate) AddMessages

func (uc *UserCreate) AddMessages(m ...*Message) *UserCreate

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

func (*UserCreate) Exec

func (uc *UserCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*UserCreate) ExecX

func (uc *UserCreate) ExecX(ctx context.Context)

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

func (*UserCreate) Mutation

func (uc *UserCreate) Mutation() *UserMutation

Mutation returns the UserMutation object of the builder.

func (*UserCreate) Save

func (uc *UserCreate) Save(ctx context.Context) (*User, error)

Save creates the User in the database.

func (*UserCreate) SaveX

func (uc *UserCreate) SaveX(ctx context.Context) *User

SaveX calls Save and panics if Save returns an error.

func (*UserCreate) SetChat

func (uc *UserCreate) SetChat(c *Chat) *UserCreate

SetChat sets the "chat" edge to the Chat entity.

func (*UserCreate) SetChatID

func (uc *UserCreate) SetChatID(id int64) *UserCreate

SetChatID sets the "chat" edge to the Chat entity by ID.

func (*UserCreate) SetEmail

func (uc *UserCreate) SetEmail(s string) *UserCreate

SetEmail sets the "email" field.

func (*UserCreate) SetID

func (uc *UserCreate) SetID(i int64) *UserCreate

SetID sets the "id" field.

func (*UserCreate) SetMetadata

func (uc *UserCreate) SetMetadata(u *UserMetadata) *UserCreate

SetMetadata sets the "metadata" edge to the UserMetadata entity.

func (*UserCreate) SetMetadataID

func (uc *UserCreate) SetMetadataID(id int64) *UserCreate

SetMetadataID sets the "metadata" edge to the UserMetadata entity by ID.

func (*UserCreate) SetNillableChatID

func (uc *UserCreate) SetNillableChatID(id *int64) *UserCreate

SetNillableChatID sets the "chat" edge to the Chat entity by ID if the given value is not nil.

func (*UserCreate) SetNillableMetadataID

func (uc *UserCreate) SetNillableMetadataID(id *int64) *UserCreate

SetNillableMetadataID sets the "metadata" edge to the UserMetadata entity by ID if the given value is not nil.

func (*UserCreate) SetPassword

func (uc *UserCreate) SetPassword(s string) *UserCreate

SetPassword sets the "password" field.

type UserCreateBulk

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

UserCreateBulk is the builder for creating many User entities in bulk.

func (*UserCreateBulk) Exec

func (ucb *UserCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*UserCreateBulk) ExecX

func (ucb *UserCreateBulk) ExecX(ctx context.Context)

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

func (*UserCreateBulk) Save

func (ucb *UserCreateBulk) Save(ctx context.Context) ([]*User, error)

Save creates the User entities in the database.

func (*UserCreateBulk) SaveX

func (ucb *UserCreateBulk) SaveX(ctx context.Context) []*User

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

type UserDelete

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

UserDelete is the builder for deleting a User entity.

func (*UserDelete) Exec

func (ud *UserDelete) Exec(ctx context.Context) (int, error)

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

func (*UserDelete) ExecX

func (ud *UserDelete) ExecX(ctx context.Context) int

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

func (*UserDelete) Where

func (ud *UserDelete) Where(ps ...predicate.User) *UserDelete

Where appends a list predicates to the UserDelete builder.

type UserDeleteOne

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

UserDeleteOne is the builder for deleting a single User entity.

func (*UserDeleteOne) Exec

func (udo *UserDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*UserDeleteOne) ExecX

func (udo *UserDeleteOne) ExecX(ctx context.Context)

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

type UserEdges

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

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

func (UserEdges) ChatOrErr

func (e UserEdges) ChatOrErr() (*Chat, error)

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

func (UserEdges) MessagesOrErr

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

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

func (UserEdges) MetadataOrErr

func (e UserEdges) MetadataOrErr() (*UserMetadata, error)

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

type UserGroupBy

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

UserGroupBy is the group-by builder for User entities.

func (*UserGroupBy) Aggregate

func (ugb *UserGroupBy) Aggregate(fns ...AggregateFunc) *UserGroupBy

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

func (*UserGroupBy) Bool

func (ugb *UserGroupBy) Bool(ctx context.Context) (_ bool, err error)

Bool returns a single bool from a group-by query. It is only allowed when executing a group-by query with one field.

func (*UserGroupBy) BoolX

func (ugb *UserGroupBy) BoolX(ctx context.Context) bool

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

func (*UserGroupBy) Bools

func (ugb *UserGroupBy) Bools(ctx context.Context) ([]bool, error)

Bools returns list of bools from group-by. It is only allowed when executing a group-by query with one field.

func (*UserGroupBy) BoolsX

func (ugb *UserGroupBy) BoolsX(ctx context.Context) []bool

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

func (*UserGroupBy) Float64

func (ugb *UserGroupBy) Float64(ctx context.Context) (_ float64, err error)

Float64 returns a single float64 from a group-by query. It is only allowed when executing a group-by query with one field.

func (*UserGroupBy) Float64X

func (ugb *UserGroupBy) Float64X(ctx context.Context) float64

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

func (*UserGroupBy) Float64s

func (ugb *UserGroupBy) Float64s(ctx context.Context) ([]float64, error)

Float64s returns list of float64s from group-by. It is only allowed when executing a group-by query with one field.

func (*UserGroupBy) Float64sX

func (ugb *UserGroupBy) Float64sX(ctx context.Context) []float64

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

func (*UserGroupBy) Int

func (ugb *UserGroupBy) Int(ctx context.Context) (_ int, err error)

Int returns a single int from a group-by query. It is only allowed when executing a group-by query with one field.

func (*UserGroupBy) IntX

func (ugb *UserGroupBy) IntX(ctx context.Context) int

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

func (*UserGroupBy) Ints

func (ugb *UserGroupBy) Ints(ctx context.Context) ([]int, error)

Ints returns list of ints from group-by. It is only allowed when executing a group-by query with one field.

func (*UserGroupBy) IntsX

func (ugb *UserGroupBy) IntsX(ctx context.Context) []int

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

func (*UserGroupBy) Scan

func (ugb *UserGroupBy) Scan(ctx context.Context, v interface{}) error

Scan applies the group-by query and scans the result into the given value.

func (*UserGroupBy) ScanX

func (ugb *UserGroupBy) ScanX(ctx context.Context, v interface{})

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

func (*UserGroupBy) String

func (ugb *UserGroupBy) String(ctx context.Context) (_ string, err error)

String returns a single string from a group-by query. It is only allowed when executing a group-by query with one field.

func (*UserGroupBy) StringX

func (ugb *UserGroupBy) StringX(ctx context.Context) string

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

func (*UserGroupBy) Strings

func (ugb *UserGroupBy) Strings(ctx context.Context) ([]string, error)

Strings returns list of strings from group-by. It is only allowed when executing a group-by query with one field.

func (*UserGroupBy) StringsX

func (ugb *UserGroupBy) StringsX(ctx context.Context) []string

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

type UserMetadata

type UserMetadata struct {

	// ID of the ent.
	ID int64 `json:"id,omitempty"`
	// UserID holds the value of the "userID" field.
	UserID int64 `json:"userID,omitempty"`
	// Name holds the value of the "name" field.
	Name string `json:"name,omitempty"`
	// Color holds the value of the "color" field.
	Color int32 `json:"color,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the UserMetadataQuery when eager-loading is set.
	Edges UserMetadataEdges `json:"edges"`
	// contains filtered or unexported fields
}

UserMetadata is the model entity for the UserMetadata schema.

func (*UserMetadata) QueryUser

func (um *UserMetadata) QueryUser() *UserQuery

QueryUser queries the "user" edge of the UserMetadata entity.

func (*UserMetadata) String

func (um *UserMetadata) String() string

String implements the fmt.Stringer.

func (*UserMetadata) Unwrap

func (um *UserMetadata) Unwrap() *UserMetadata

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

func (um *UserMetadata) Update() *UserMetadataUpdateOne

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

type UserMetadataClient

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

UserMetadataClient is a client for the UserMetadata schema.

func NewUserMetadataClient

func NewUserMetadataClient(c config) *UserMetadataClient

NewUserMetadataClient returns a client for the UserMetadata from the given config.

func (*UserMetadataClient) Create

Create returns a create builder for UserMetadata.

func (*UserMetadataClient) CreateBulk

func (c *UserMetadataClient) CreateBulk(builders ...*UserMetadataCreate) *UserMetadataCreateBulk

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

func (*UserMetadataClient) Delete

Delete returns a delete builder for UserMetadata.

func (*UserMetadataClient) DeleteOne

DeleteOne returns a delete builder for the given entity.

func (*UserMetadataClient) DeleteOneID

func (c *UserMetadataClient) DeleteOneID(id int64) *UserMetadataDeleteOne

DeleteOneID returns a delete builder for the given id.

func (*UserMetadataClient) Get

Get returns a UserMetadata entity by its id.

func (*UserMetadataClient) GetX

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

func (*UserMetadataClient) Hooks

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

Hooks returns the client hooks.

func (*UserMetadataClient) Query

Query returns a query builder for UserMetadata.

func (*UserMetadataClient) QueryUser

func (c *UserMetadataClient) QueryUser(um *UserMetadata) *UserQuery

QueryUser queries the user edge of a UserMetadata.

func (*UserMetadataClient) Update

Update returns an update builder for UserMetadata.

func (*UserMetadataClient) UpdateOne

UpdateOne returns an update builder for the given entity.

func (*UserMetadataClient) UpdateOneID

func (c *UserMetadataClient) UpdateOneID(id int64) *UserMetadataUpdateOne

UpdateOneID returns an update builder for the given id.

func (*UserMetadataClient) Use

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

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

type UserMetadataCreate

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

UserMetadataCreate is the builder for creating a UserMetadata entity.

func (*UserMetadataCreate) Exec

func (umc *UserMetadataCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*UserMetadataCreate) ExecX

func (umc *UserMetadataCreate) ExecX(ctx context.Context)

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

func (*UserMetadataCreate) Mutation

func (umc *UserMetadataCreate) Mutation() *UserMetadataMutation

Mutation returns the UserMetadataMutation object of the builder.

func (*UserMetadataCreate) Save

Save creates the UserMetadata in the database.

func (*UserMetadataCreate) SaveX

SaveX calls Save and panics if Save returns an error.

func (*UserMetadataCreate) SetColor

func (umc *UserMetadataCreate) SetColor(i int32) *UserMetadataCreate

SetColor sets the "color" field.

func (*UserMetadataCreate) SetID

SetID sets the "id" field.

func (*UserMetadataCreate) SetName

func (umc *UserMetadataCreate) SetName(s string) *UserMetadataCreate

SetName sets the "name" field.

func (*UserMetadataCreate) SetUser

func (umc *UserMetadataCreate) SetUser(u *User) *UserMetadataCreate

SetUser sets the "user" edge to the User entity.

func (*UserMetadataCreate) SetUserID

func (umc *UserMetadataCreate) SetUserID(i int64) *UserMetadataCreate

SetUserID sets the "userID" field.

type UserMetadataCreateBulk

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

UserMetadataCreateBulk is the builder for creating many UserMetadata entities in bulk.

func (*UserMetadataCreateBulk) Exec

func (umcb *UserMetadataCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*UserMetadataCreateBulk) ExecX

func (umcb *UserMetadataCreateBulk) ExecX(ctx context.Context)

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

func (*UserMetadataCreateBulk) Save

Save creates the UserMetadata entities in the database.

func (*UserMetadataCreateBulk) SaveX

func (umcb *UserMetadataCreateBulk) SaveX(ctx context.Context) []*UserMetadata

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

type UserMetadataDelete

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

UserMetadataDelete is the builder for deleting a UserMetadata entity.

func (*UserMetadataDelete) Exec

func (umd *UserMetadataDelete) Exec(ctx context.Context) (int, error)

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

func (*UserMetadataDelete) ExecX

func (umd *UserMetadataDelete) ExecX(ctx context.Context) int

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

func (*UserMetadataDelete) Where

Where appends a list predicates to the UserMetadataDelete builder.

type UserMetadataDeleteOne

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

UserMetadataDeleteOne is the builder for deleting a single UserMetadata entity.

func (*UserMetadataDeleteOne) Exec

func (umdo *UserMetadataDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*UserMetadataDeleteOne) ExecX

func (umdo *UserMetadataDeleteOne) ExecX(ctx context.Context)

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

type UserMetadataEdges

type UserMetadataEdges struct {
	// User holds the value of the user edge.
	User *User `json:"user,omitempty"`
	// contains filtered or unexported fields
}

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

func (UserMetadataEdges) UserOrErr

func (e UserMetadataEdges) UserOrErr() (*User, error)

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

type UserMetadataGroupBy

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

UserMetadataGroupBy is the group-by builder for UserMetadata entities.

func (*UserMetadataGroupBy) Aggregate

func (umgb *UserMetadataGroupBy) Aggregate(fns ...AggregateFunc) *UserMetadataGroupBy

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

func (*UserMetadataGroupBy) Bool

func (umgb *UserMetadataGroupBy) Bool(ctx context.Context) (_ bool, err error)

Bool returns a single bool from a group-by query. It is only allowed when executing a group-by query with one field.

func (*UserMetadataGroupBy) BoolX

func (umgb *UserMetadataGroupBy) BoolX(ctx context.Context) bool

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

func (*UserMetadataGroupBy) Bools

func (umgb *UserMetadataGroupBy) Bools(ctx context.Context) ([]bool, error)

Bools returns list of bools from group-by. It is only allowed when executing a group-by query with one field.

func (*UserMetadataGroupBy) BoolsX

func (umgb *UserMetadataGroupBy) BoolsX(ctx context.Context) []bool

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

func (*UserMetadataGroupBy) Float64

func (umgb *UserMetadataGroupBy) Float64(ctx context.Context) (_ float64, err error)

Float64 returns a single float64 from a group-by query. It is only allowed when executing a group-by query with one field.

func (*UserMetadataGroupBy) Float64X

func (umgb *UserMetadataGroupBy) Float64X(ctx context.Context) float64

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

func (*UserMetadataGroupBy) Float64s

func (umgb *UserMetadataGroupBy) Float64s(ctx context.Context) ([]float64, error)

Float64s returns list of float64s from group-by. It is only allowed when executing a group-by query with one field.

func (*UserMetadataGroupBy) Float64sX

func (umgb *UserMetadataGroupBy) Float64sX(ctx context.Context) []float64

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

func (*UserMetadataGroupBy) Int

func (umgb *UserMetadataGroupBy) Int(ctx context.Context) (_ int, err error)

Int returns a single int from a group-by query. It is only allowed when executing a group-by query with one field.

func (*UserMetadataGroupBy) IntX

func (umgb *UserMetadataGroupBy) IntX(ctx context.Context) int

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

func (*UserMetadataGroupBy) Ints

func (umgb *UserMetadataGroupBy) Ints(ctx context.Context) ([]int, error)

Ints returns list of ints from group-by. It is only allowed when executing a group-by query with one field.

func (*UserMetadataGroupBy) IntsX

func (umgb *UserMetadataGroupBy) IntsX(ctx context.Context) []int

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

func (*UserMetadataGroupBy) Scan

func (umgb *UserMetadataGroupBy) Scan(ctx context.Context, v interface{}) error

Scan applies the group-by query and scans the result into the given value.

func (*UserMetadataGroupBy) ScanX

func (umgb *UserMetadataGroupBy) ScanX(ctx context.Context, v interface{})

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

func (*UserMetadataGroupBy) String

func (umgb *UserMetadataGroupBy) String(ctx context.Context) (_ string, err error)

String returns a single string from a group-by query. It is only allowed when executing a group-by query with one field.

func (*UserMetadataGroupBy) StringX

func (umgb *UserMetadataGroupBy) StringX(ctx context.Context) string

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

func (*UserMetadataGroupBy) Strings

func (umgb *UserMetadataGroupBy) Strings(ctx context.Context) ([]string, error)

Strings returns list of strings from group-by. It is only allowed when executing a group-by query with one field.

func (*UserMetadataGroupBy) StringsX

func (umgb *UserMetadataGroupBy) StringsX(ctx context.Context) []string

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

type UserMetadataMutation

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

UserMetadataMutation represents an operation that mutates the UserMetadata nodes in the graph.

func (*UserMetadataMutation) AddColor

func (m *UserMetadataMutation) AddColor(i int32)

AddColor adds i to the "color" field.

func (*UserMetadataMutation) AddField

func (m *UserMetadataMutation) 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 (*UserMetadataMutation) AddedColor

func (m *UserMetadataMutation) AddedColor() (r int32, exists bool)

AddedColor returns the value that was added to the "color" field in this mutation.

func (*UserMetadataMutation) AddedEdges

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

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

func (*UserMetadataMutation) AddedField

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

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

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

func (*UserMetadataMutation) AddedIDs

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

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

func (*UserMetadataMutation) ClearEdge

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

func (m *UserMetadataMutation) 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 (*UserMetadataMutation) ClearUser

func (m *UserMetadataMutation) ClearUser()

ClearUser clears the "user" edge to the User entity.

func (*UserMetadataMutation) ClearedEdges

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

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

func (*UserMetadataMutation) ClearedFields

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

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

func (UserMetadataMutation) Client

func (m UserMetadataMutation) 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 (*UserMetadataMutation) Color

func (m *UserMetadataMutation) Color() (r int32, exists bool)

Color returns the value of the "color" field in the mutation.

func (*UserMetadataMutation) EdgeCleared

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

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

func (*UserMetadataMutation) Field

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

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

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

func (*UserMetadataMutation) Fields

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

func (m *UserMetadataMutation) ID() (id int64, 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 (*UserMetadataMutation) IDs

func (m *UserMetadataMutation) IDs(ctx context.Context) ([]int64, 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 (*UserMetadataMutation) Name

func (m *UserMetadataMutation) Name() (r string, exists bool)

Name returns the value of the "name" field in the mutation.

func (*UserMetadataMutation) OldColor

func (m *UserMetadataMutation) OldColor(ctx context.Context) (v int32, err error)

OldColor returns the old "color" field's value of the UserMetadata entity. If the UserMetadata 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 (*UserMetadataMutation) OldField

func (m *UserMetadataMutation) 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 (*UserMetadataMutation) OldName

func (m *UserMetadataMutation) OldName(ctx context.Context) (v string, err error)

OldName returns the old "name" field's value of the UserMetadata entity. If the UserMetadata 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 (*UserMetadataMutation) OldUserID

func (m *UserMetadataMutation) OldUserID(ctx context.Context) (v int64, err error)

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

func (m *UserMetadataMutation) Op() Op

Op returns the operation name.

func (*UserMetadataMutation) RemovedEdges

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

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

func (*UserMetadataMutation) RemovedIDs

func (m *UserMetadataMutation) 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 (*UserMetadataMutation) ResetColor

func (m *UserMetadataMutation) ResetColor()

ResetColor resets all changes to the "color" field.

func (*UserMetadataMutation) ResetEdge

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

func (m *UserMetadataMutation) 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 (*UserMetadataMutation) ResetName

func (m *UserMetadataMutation) ResetName()

ResetName resets all changes to the "name" field.

func (*UserMetadataMutation) ResetUser

func (m *UserMetadataMutation) ResetUser()

ResetUser resets all changes to the "user" edge.

func (*UserMetadataMutation) ResetUserID

func (m *UserMetadataMutation) ResetUserID()

ResetUserID resets all changes to the "userID" field.

func (*UserMetadataMutation) SetColor

func (m *UserMetadataMutation) SetColor(i int32)

SetColor sets the "color" field.

func (*UserMetadataMutation) SetField

func (m *UserMetadataMutation) 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 (*UserMetadataMutation) SetID

func (m *UserMetadataMutation) SetID(id int64)

SetID sets the value of the id field. Note that this operation is only accepted on creation of UserMetadata entities.

func (*UserMetadataMutation) SetName

func (m *UserMetadataMutation) SetName(s string)

SetName sets the "name" field.

func (*UserMetadataMutation) SetUserID

func (m *UserMetadataMutation) SetUserID(i int64)

SetUserID sets the "userID" field.

func (UserMetadataMutation) Tx

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

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

func (*UserMetadataMutation) Type

func (m *UserMetadataMutation) Type() string

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

func (*UserMetadataMutation) UserCleared

func (m *UserMetadataMutation) UserCleared() bool

UserCleared reports if the "user" edge to the User entity was cleared.

func (*UserMetadataMutation) UserID

func (m *UserMetadataMutation) UserID() (r int64, exists bool)

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

func (*UserMetadataMutation) UserIDs

func (m *UserMetadataMutation) UserIDs() (ids []int64)

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

func (*UserMetadataMutation) Where

Where appends a list predicates to the UserMetadataMutation builder.

type UserMetadataQuery

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

UserMetadataQuery is the builder for querying UserMetadata entities.

func (*UserMetadataQuery) All

func (umq *UserMetadataQuery) All(ctx context.Context) ([]*UserMetadata, error)

All executes the query and returns a list of UserMetadataSlice.

func (*UserMetadataQuery) AllX

func (umq *UserMetadataQuery) AllX(ctx context.Context) []*UserMetadata

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

func (*UserMetadataQuery) Clone

func (umq *UserMetadataQuery) Clone() *UserMetadataQuery

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

func (*UserMetadataQuery) Count

func (umq *UserMetadataQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*UserMetadataQuery) CountX

func (umq *UserMetadataQuery) CountX(ctx context.Context) int

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

func (*UserMetadataQuery) Exist

func (umq *UserMetadataQuery) Exist(ctx context.Context) (bool, error)

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

func (*UserMetadataQuery) ExistX

func (umq *UserMetadataQuery) ExistX(ctx context.Context) bool

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

func (*UserMetadataQuery) First

func (umq *UserMetadataQuery) First(ctx context.Context) (*UserMetadata, error)

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

func (*UserMetadataQuery) FirstID

func (umq *UserMetadataQuery) FirstID(ctx context.Context) (id int64, err error)

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

func (*UserMetadataQuery) FirstIDX

func (umq *UserMetadataQuery) FirstIDX(ctx context.Context) int64

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

func (*UserMetadataQuery) FirstX

func (umq *UserMetadataQuery) FirstX(ctx context.Context) *UserMetadata

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

func (*UserMetadataQuery) GroupBy

func (umq *UserMetadataQuery) GroupBy(field string, fields ...string) *UserMetadataGroupBy

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

client.UserMetadata.Query().
	GroupBy(usermetadata.FieldUserID).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*UserMetadataQuery) IDs

func (umq *UserMetadataQuery) IDs(ctx context.Context) ([]int64, error)

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

func (*UserMetadataQuery) IDsX

func (umq *UserMetadataQuery) IDsX(ctx context.Context) []int64

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

func (*UserMetadataQuery) Limit

func (umq *UserMetadataQuery) Limit(limit int) *UserMetadataQuery

Limit adds a limit step to the query.

func (*UserMetadataQuery) Offset

func (umq *UserMetadataQuery) Offset(offset int) *UserMetadataQuery

Offset adds an offset step to the query.

func (*UserMetadataQuery) Only

func (umq *UserMetadataQuery) Only(ctx context.Context) (*UserMetadata, error)

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

func (*UserMetadataQuery) OnlyID

func (umq *UserMetadataQuery) OnlyID(ctx context.Context) (id int64, err error)

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

func (*UserMetadataQuery) OnlyIDX

func (umq *UserMetadataQuery) OnlyIDX(ctx context.Context) int64

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

func (*UserMetadataQuery) OnlyX

func (umq *UserMetadataQuery) OnlyX(ctx context.Context) *UserMetadata

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

func (*UserMetadataQuery) Order

func (umq *UserMetadataQuery) Order(o ...OrderFunc) *UserMetadataQuery

Order adds an order step to the query.

func (*UserMetadataQuery) QueryUser

func (umq *UserMetadataQuery) QueryUser() *UserQuery

QueryUser chains the current query on the "user" edge.

func (*UserMetadataQuery) Select

func (umq *UserMetadataQuery) Select(fields ...string) *UserMetadataSelect

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

client.UserMetadata.Query().
	Select(usermetadata.FieldUserID).
	Scan(ctx, &v)

func (*UserMetadataQuery) Unique

func (umq *UserMetadataQuery) Unique(unique bool) *UserMetadataQuery

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

Where adds a new predicate for the UserMetadataQuery builder.

func (*UserMetadataQuery) WithUser

func (umq *UserMetadataQuery) WithUser(opts ...func(*UserQuery)) *UserMetadataQuery

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

type UserMetadataSelect

type UserMetadataSelect struct {
	*UserMetadataQuery
	// contains filtered or unexported fields
}

UserMetadataSelect is the builder for selecting fields of UserMetadata entities.

func (*UserMetadataSelect) Bool

func (ums *UserMetadataSelect) Bool(ctx context.Context) (_ bool, err error)

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

func (*UserMetadataSelect) BoolX

func (ums *UserMetadataSelect) BoolX(ctx context.Context) bool

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

func (*UserMetadataSelect) Bools

func (ums *UserMetadataSelect) Bools(ctx context.Context) ([]bool, error)

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

func (*UserMetadataSelect) BoolsX

func (ums *UserMetadataSelect) BoolsX(ctx context.Context) []bool

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

func (*UserMetadataSelect) Float64

func (ums *UserMetadataSelect) Float64(ctx context.Context) (_ float64, err error)

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

func (*UserMetadataSelect) Float64X

func (ums *UserMetadataSelect) Float64X(ctx context.Context) float64

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

func (*UserMetadataSelect) Float64s

func (ums *UserMetadataSelect) Float64s(ctx context.Context) ([]float64, error)

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

func (*UserMetadataSelect) Float64sX

func (ums *UserMetadataSelect) Float64sX(ctx context.Context) []float64

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

func (*UserMetadataSelect) Int

func (ums *UserMetadataSelect) Int(ctx context.Context) (_ int, err error)

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

func (*UserMetadataSelect) IntX

func (ums *UserMetadataSelect) IntX(ctx context.Context) int

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

func (*UserMetadataSelect) Ints

func (ums *UserMetadataSelect) Ints(ctx context.Context) ([]int, error)

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

func (*UserMetadataSelect) IntsX

func (ums *UserMetadataSelect) IntsX(ctx context.Context) []int

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

func (*UserMetadataSelect) Scan

func (ums *UserMetadataSelect) Scan(ctx context.Context, v interface{}) error

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

func (*UserMetadataSelect) ScanX

func (ums *UserMetadataSelect) ScanX(ctx context.Context, v interface{})

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

func (*UserMetadataSelect) String

func (ums *UserMetadataSelect) String(ctx context.Context) (_ string, err error)

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

func (*UserMetadataSelect) StringX

func (ums *UserMetadataSelect) StringX(ctx context.Context) string

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

func (*UserMetadataSelect) Strings

func (ums *UserMetadataSelect) Strings(ctx context.Context) ([]string, error)

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

func (*UserMetadataSelect) StringsX

func (ums *UserMetadataSelect) StringsX(ctx context.Context) []string

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

type UserMetadataSlice

type UserMetadataSlice []*UserMetadata

UserMetadataSlice is a parsable slice of UserMetadata.

type UserMetadataUpdate

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

UserMetadataUpdate is the builder for updating UserMetadata entities.

func (*UserMetadataUpdate) AddColor

func (umu *UserMetadataUpdate) AddColor(i int32) *UserMetadataUpdate

AddColor adds i to the "color" field.

func (*UserMetadataUpdate) ClearUser

func (umu *UserMetadataUpdate) ClearUser() *UserMetadataUpdate

ClearUser clears the "user" edge to the User entity.

func (*UserMetadataUpdate) Exec

func (umu *UserMetadataUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*UserMetadataUpdate) ExecX

func (umu *UserMetadataUpdate) ExecX(ctx context.Context)

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

func (*UserMetadataUpdate) Mutation

func (umu *UserMetadataUpdate) Mutation() *UserMetadataMutation

Mutation returns the UserMetadataMutation object of the builder.

func (*UserMetadataUpdate) Save

func (umu *UserMetadataUpdate) Save(ctx context.Context) (int, error)

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

func (*UserMetadataUpdate) SaveX

func (umu *UserMetadataUpdate) SaveX(ctx context.Context) int

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

func (*UserMetadataUpdate) SetColor

func (umu *UserMetadataUpdate) SetColor(i int32) *UserMetadataUpdate

SetColor sets the "color" field.

func (*UserMetadataUpdate) SetName

func (umu *UserMetadataUpdate) SetName(s string) *UserMetadataUpdate

SetName sets the "name" field.

func (*UserMetadataUpdate) SetUser

func (umu *UserMetadataUpdate) SetUser(u *User) *UserMetadataUpdate

SetUser sets the "user" edge to the User entity.

func (*UserMetadataUpdate) SetUserID

func (umu *UserMetadataUpdate) SetUserID(i int64) *UserMetadataUpdate

SetUserID sets the "userID" field.

func (*UserMetadataUpdate) Where

Where appends a list predicates to the UserMetadataUpdate builder.

type UserMetadataUpdateOne

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

UserMetadataUpdateOne is the builder for updating a single UserMetadata entity.

func (*UserMetadataUpdateOne) AddColor

AddColor adds i to the "color" field.

func (*UserMetadataUpdateOne) ClearUser

func (umuo *UserMetadataUpdateOne) ClearUser() *UserMetadataUpdateOne

ClearUser clears the "user" edge to the User entity.

func (*UserMetadataUpdateOne) Exec

func (umuo *UserMetadataUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*UserMetadataUpdateOne) ExecX

func (umuo *UserMetadataUpdateOne) ExecX(ctx context.Context)

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

func (*UserMetadataUpdateOne) Mutation

func (umuo *UserMetadataUpdateOne) Mutation() *UserMetadataMutation

Mutation returns the UserMetadataMutation object of the builder.

func (*UserMetadataUpdateOne) Save

Save executes the query and returns the updated UserMetadata entity.

func (*UserMetadataUpdateOne) SaveX

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

func (*UserMetadataUpdateOne) Select

func (umuo *UserMetadataUpdateOne) Select(field string, fields ...string) *UserMetadataUpdateOne

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

func (*UserMetadataUpdateOne) SetColor

SetColor sets the "color" field.

func (*UserMetadataUpdateOne) SetName

SetName sets the "name" field.

func (*UserMetadataUpdateOne) SetUser

SetUser sets the "user" edge to the User entity.

func (*UserMetadataUpdateOne) SetUserID

SetUserID sets the "userID" field.

type UserMutation

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

UserMutation represents an operation that mutates the User nodes in the graph.

func (*UserMutation) AddField

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

func (m *UserMutation) AddMessageIDs(ids ...int64)

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

func (*UserMutation) AddedEdges

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

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

func (*UserMutation) AddedField

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

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

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

func (*UserMutation) AddedIDs

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

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

func (*UserMutation) ChatCleared

func (m *UserMutation) ChatCleared() bool

ChatCleared reports if the "chat" edge to the Chat entity was cleared.

func (*UserMutation) ChatID

func (m *UserMutation) ChatID() (id int64, exists bool)

ChatID returns the "chat" edge ID in the mutation.

func (*UserMutation) ChatIDs

func (m *UserMutation) ChatIDs() (ids []int64)

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

func (*UserMutation) ClearChat

func (m *UserMutation) ClearChat()

ClearChat clears the "chat" edge to the Chat entity.

func (*UserMutation) ClearEdge

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

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

func (m *UserMutation) ClearMessages()

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

func (*UserMutation) ClearMetadata

func (m *UserMutation) ClearMetadata()

ClearMetadata clears the "metadata" edge to the UserMetadata entity.

func (*UserMutation) ClearedEdges

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

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

func (*UserMutation) ClearedFields

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

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

func (UserMutation) Client

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

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

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

func (*UserMutation) Email

func (m *UserMutation) Email() (r string, exists bool)

Email returns the value of the "email" field in the mutation.

func (*UserMutation) Field

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

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

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

func (*UserMutation) Fields

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

func (m *UserMutation) ID() (id int64, 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 (*UserMutation) IDs

func (m *UserMutation) IDs(ctx context.Context) ([]int64, 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 (*UserMutation) MessagesCleared

func (m *UserMutation) MessagesCleared() bool

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

func (*UserMutation) MessagesIDs

func (m *UserMutation) MessagesIDs() (ids []int64)

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

func (*UserMutation) MetadataCleared

func (m *UserMutation) MetadataCleared() bool

MetadataCleared reports if the "metadata" edge to the UserMetadata entity was cleared.

func (*UserMutation) MetadataID

func (m *UserMutation) MetadataID() (id int64, exists bool)

MetadataID returns the "metadata" edge ID in the mutation.

func (*UserMutation) MetadataIDs

func (m *UserMutation) MetadataIDs() (ids []int64)

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

func (*UserMutation) OldEmail

func (m *UserMutation) OldEmail(ctx context.Context) (v string, err error)

OldEmail returns the old "email" field's value of the User entity. If the User 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 (*UserMutation) OldField

func (m *UserMutation) 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 (*UserMutation) OldPassword

func (m *UserMutation) OldPassword(ctx context.Context) (v string, err error)

OldPassword returns the old "password" field's value of the User entity. If the User 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 (*UserMutation) Op

func (m *UserMutation) Op() Op

Op returns the operation name.

func (*UserMutation) Password

func (m *UserMutation) Password() (r string, exists bool)

Password returns the value of the "password" field in the mutation.

func (*UserMutation) RemoveMessageIDs

func (m *UserMutation) RemoveMessageIDs(ids ...int64)

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

func (*UserMutation) RemovedEdges

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

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

func (*UserMutation) RemovedIDs

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

func (m *UserMutation) RemovedMessagesIDs() (ids []int64)

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

func (*UserMutation) ResetChat

func (m *UserMutation) ResetChat()

ResetChat resets all changes to the "chat" edge.

func (*UserMutation) ResetEdge

func (m *UserMutation) 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 (*UserMutation) ResetEmail

func (m *UserMutation) ResetEmail()

ResetEmail resets all changes to the "email" field.

func (*UserMutation) ResetField

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

func (m *UserMutation) ResetMessages()

ResetMessages resets all changes to the "messages" edge.

func (*UserMutation) ResetMetadata

func (m *UserMutation) ResetMetadata()

ResetMetadata resets all changes to the "metadata" edge.

func (*UserMutation) ResetPassword

func (m *UserMutation) ResetPassword()

ResetPassword resets all changes to the "password" field.

func (*UserMutation) SetChatID

func (m *UserMutation) SetChatID(id int64)

SetChatID sets the "chat" edge to the Chat entity by id.

func (*UserMutation) SetEmail

func (m *UserMutation) SetEmail(s string)

SetEmail sets the "email" field.

func (*UserMutation) SetField

func (m *UserMutation) 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 (*UserMutation) SetID

func (m *UserMutation) SetID(id int64)

SetID sets the value of the id field. Note that this operation is only accepted on creation of User entities.

func (*UserMutation) SetMetadataID

func (m *UserMutation) SetMetadataID(id int64)

SetMetadataID sets the "metadata" edge to the UserMetadata entity by id.

func (*UserMutation) SetPassword

func (m *UserMutation) SetPassword(s string)

SetPassword sets the "password" field.

func (UserMutation) Tx

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

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

func (*UserMutation) Type

func (m *UserMutation) Type() string

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

func (*UserMutation) Where

func (m *UserMutation) Where(ps ...predicate.User)

Where appends a list predicates to the UserMutation builder.

type UserQuery

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

UserQuery is the builder for querying User entities.

func (*UserQuery) All

func (uq *UserQuery) All(ctx context.Context) ([]*User, error)

All executes the query and returns a list of Users.

func (*UserQuery) AllX

func (uq *UserQuery) AllX(ctx context.Context) []*User

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

func (*UserQuery) Clone

func (uq *UserQuery) Clone() *UserQuery

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

func (*UserQuery) Count

func (uq *UserQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*UserQuery) CountX

func (uq *UserQuery) CountX(ctx context.Context) int

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

func (*UserQuery) Exist

func (uq *UserQuery) Exist(ctx context.Context) (bool, error)

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

func (*UserQuery) ExistX

func (uq *UserQuery) ExistX(ctx context.Context) bool

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

func (*UserQuery) First

func (uq *UserQuery) First(ctx context.Context) (*User, error)

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

func (*UserQuery) FirstID

func (uq *UserQuery) FirstID(ctx context.Context) (id int64, err error)

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

func (*UserQuery) FirstIDX

func (uq *UserQuery) FirstIDX(ctx context.Context) int64

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

func (*UserQuery) FirstX

func (uq *UserQuery) FirstX(ctx context.Context) *User

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

func (*UserQuery) GroupBy

func (uq *UserQuery) GroupBy(field string, fields ...string) *UserGroupBy

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

client.User.Query().
	GroupBy(user.FieldEmail).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*UserQuery) IDs

func (uq *UserQuery) IDs(ctx context.Context) ([]int64, error)

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

func (*UserQuery) IDsX

func (uq *UserQuery) IDsX(ctx context.Context) []int64

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

func (*UserQuery) Limit

func (uq *UserQuery) Limit(limit int) *UserQuery

Limit adds a limit step to the query.

func (*UserQuery) Offset

func (uq *UserQuery) Offset(offset int) *UserQuery

Offset adds an offset step to the query.

func (*UserQuery) Only

func (uq *UserQuery) Only(ctx context.Context) (*User, error)

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

func (*UserQuery) OnlyID

func (uq *UserQuery) OnlyID(ctx context.Context) (id int64, err error)

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

func (*UserQuery) OnlyIDX

func (uq *UserQuery) OnlyIDX(ctx context.Context) int64

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

func (*UserQuery) OnlyX

func (uq *UserQuery) OnlyX(ctx context.Context) *User

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

func (*UserQuery) Order

func (uq *UserQuery) Order(o ...OrderFunc) *UserQuery

Order adds an order step to the query.

func (*UserQuery) QueryChat

func (uq *UserQuery) QueryChat() *ChatQuery

QueryChat chains the current query on the "chat" edge.

func (*UserQuery) QueryMessages

func (uq *UserQuery) QueryMessages() *MessageQuery

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

func (*UserQuery) QueryMetadata

func (uq *UserQuery) QueryMetadata() *UserMetadataQuery

QueryMetadata chains the current query on the "metadata" edge.

func (*UserQuery) Select

func (uq *UserQuery) Select(fields ...string) *UserSelect

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

client.User.Query().
	Select(user.FieldEmail).
	Scan(ctx, &v)

func (*UserQuery) Unique

func (uq *UserQuery) Unique(unique bool) *UserQuery

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

func (uq *UserQuery) Where(ps ...predicate.User) *UserQuery

Where adds a new predicate for the UserQuery builder.

func (*UserQuery) WithChat

func (uq *UserQuery) WithChat(opts ...func(*ChatQuery)) *UserQuery

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

func (*UserQuery) WithMessages

func (uq *UserQuery) WithMessages(opts ...func(*MessageQuery)) *UserQuery

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.

func (*UserQuery) WithMetadata

func (uq *UserQuery) WithMetadata(opts ...func(*UserMetadataQuery)) *UserQuery

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

type UserSelect

type UserSelect struct {
	*UserQuery
	// contains filtered or unexported fields
}

UserSelect is the builder for selecting fields of User entities.

func (*UserSelect) Bool

func (us *UserSelect) Bool(ctx context.Context) (_ bool, err error)

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

func (*UserSelect) BoolX

func (us *UserSelect) BoolX(ctx context.Context) bool

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

func (*UserSelect) Bools

func (us *UserSelect) Bools(ctx context.Context) ([]bool, error)

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

func (*UserSelect) BoolsX

func (us *UserSelect) BoolsX(ctx context.Context) []bool

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

func (*UserSelect) Float64

func (us *UserSelect) Float64(ctx context.Context) (_ float64, err error)

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

func (*UserSelect) Float64X

func (us *UserSelect) Float64X(ctx context.Context) float64

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

func (*UserSelect) Float64s

func (us *UserSelect) Float64s(ctx context.Context) ([]float64, error)

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

func (*UserSelect) Float64sX

func (us *UserSelect) Float64sX(ctx context.Context) []float64

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

func (*UserSelect) Int

func (us *UserSelect) Int(ctx context.Context) (_ int, err error)

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

func (*UserSelect) IntX

func (us *UserSelect) IntX(ctx context.Context) int

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

func (*UserSelect) Ints

func (us *UserSelect) Ints(ctx context.Context) ([]int, error)

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

func (*UserSelect) IntsX

func (us *UserSelect) IntsX(ctx context.Context) []int

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

func (*UserSelect) Scan

func (us *UserSelect) Scan(ctx context.Context, v interface{}) error

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

func (*UserSelect) ScanX

func (us *UserSelect) ScanX(ctx context.Context, v interface{})

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

func (*UserSelect) String

func (us *UserSelect) String(ctx context.Context) (_ string, err error)

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

func (*UserSelect) StringX

func (us *UserSelect) StringX(ctx context.Context) string

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

func (*UserSelect) Strings

func (us *UserSelect) Strings(ctx context.Context) ([]string, error)

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

func (*UserSelect) StringsX

func (us *UserSelect) StringsX(ctx context.Context) []string

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

type UserUpdate

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

UserUpdate is the builder for updating User entities.

func (*UserUpdate) AddMessageIDs

func (uu *UserUpdate) AddMessageIDs(ids ...int64) *UserUpdate

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

func (*UserUpdate) AddMessages

func (uu *UserUpdate) AddMessages(m ...*Message) *UserUpdate

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

func (*UserUpdate) ClearChat

func (uu *UserUpdate) ClearChat() *UserUpdate

ClearChat clears the "chat" edge to the Chat entity.

func (*UserUpdate) ClearMessages

func (uu *UserUpdate) ClearMessages() *UserUpdate

ClearMessages clears all "messages" edges to the Message entity.

func (*UserUpdate) ClearMetadata

func (uu *UserUpdate) ClearMetadata() *UserUpdate

ClearMetadata clears the "metadata" edge to the UserMetadata entity.

func (*UserUpdate) Exec

func (uu *UserUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*UserUpdate) ExecX

func (uu *UserUpdate) ExecX(ctx context.Context)

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

func (*UserUpdate) Mutation

func (uu *UserUpdate) Mutation() *UserMutation

Mutation returns the UserMutation object of the builder.

func (*UserUpdate) RemoveMessageIDs

func (uu *UserUpdate) RemoveMessageIDs(ids ...int64) *UserUpdate

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

func (*UserUpdate) RemoveMessages

func (uu *UserUpdate) RemoveMessages(m ...*Message) *UserUpdate

RemoveMessages removes "messages" edges to Message entities.

func (*UserUpdate) Save

func (uu *UserUpdate) Save(ctx context.Context) (int, error)

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

func (*UserUpdate) SaveX

func (uu *UserUpdate) SaveX(ctx context.Context) int

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

func (*UserUpdate) SetChat

func (uu *UserUpdate) SetChat(c *Chat) *UserUpdate

SetChat sets the "chat" edge to the Chat entity.

func (*UserUpdate) SetChatID

func (uu *UserUpdate) SetChatID(id int64) *UserUpdate

SetChatID sets the "chat" edge to the Chat entity by ID.

func (*UserUpdate) SetEmail

func (uu *UserUpdate) SetEmail(s string) *UserUpdate

SetEmail sets the "email" field.

func (*UserUpdate) SetMetadata

func (uu *UserUpdate) SetMetadata(u *UserMetadata) *UserUpdate

SetMetadata sets the "metadata" edge to the UserMetadata entity.

func (*UserUpdate) SetMetadataID

func (uu *UserUpdate) SetMetadataID(id int64) *UserUpdate

SetMetadataID sets the "metadata" edge to the UserMetadata entity by ID.

func (*UserUpdate) SetNillableChatID

func (uu *UserUpdate) SetNillableChatID(id *int64) *UserUpdate

SetNillableChatID sets the "chat" edge to the Chat entity by ID if the given value is not nil.

func (*UserUpdate) SetNillableMetadataID

func (uu *UserUpdate) SetNillableMetadataID(id *int64) *UserUpdate

SetNillableMetadataID sets the "metadata" edge to the UserMetadata entity by ID if the given value is not nil.

func (*UserUpdate) SetPassword

func (uu *UserUpdate) SetPassword(s string) *UserUpdate

SetPassword sets the "password" field.

func (*UserUpdate) Where

func (uu *UserUpdate) Where(ps ...predicate.User) *UserUpdate

Where appends a list predicates to the UserUpdate builder.

type UserUpdateOne

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

UserUpdateOne is the builder for updating a single User entity.

func (*UserUpdateOne) AddMessageIDs

func (uuo *UserUpdateOne) AddMessageIDs(ids ...int64) *UserUpdateOne

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

func (*UserUpdateOne) AddMessages

func (uuo *UserUpdateOne) AddMessages(m ...*Message) *UserUpdateOne

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

func (*UserUpdateOne) ClearChat

func (uuo *UserUpdateOne) ClearChat() *UserUpdateOne

ClearChat clears the "chat" edge to the Chat entity.

func (*UserUpdateOne) ClearMessages

func (uuo *UserUpdateOne) ClearMessages() *UserUpdateOne

ClearMessages clears all "messages" edges to the Message entity.

func (*UserUpdateOne) ClearMetadata

func (uuo *UserUpdateOne) ClearMetadata() *UserUpdateOne

ClearMetadata clears the "metadata" edge to the UserMetadata entity.

func (*UserUpdateOne) Exec

func (uuo *UserUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*UserUpdateOne) ExecX

func (uuo *UserUpdateOne) ExecX(ctx context.Context)

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

func (*UserUpdateOne) Mutation

func (uuo *UserUpdateOne) Mutation() *UserMutation

Mutation returns the UserMutation object of the builder.

func (*UserUpdateOne) RemoveMessageIDs

func (uuo *UserUpdateOne) RemoveMessageIDs(ids ...int64) *UserUpdateOne

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

func (*UserUpdateOne) RemoveMessages

func (uuo *UserUpdateOne) RemoveMessages(m ...*Message) *UserUpdateOne

RemoveMessages removes "messages" edges to Message entities.

func (*UserUpdateOne) Save

func (uuo *UserUpdateOne) Save(ctx context.Context) (*User, error)

Save executes the query and returns the updated User entity.

func (*UserUpdateOne) SaveX

func (uuo *UserUpdateOne) SaveX(ctx context.Context) *User

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

func (*UserUpdateOne) Select

func (uuo *UserUpdateOne) Select(field string, fields ...string) *UserUpdateOne

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

func (*UserUpdateOne) SetChat

func (uuo *UserUpdateOne) SetChat(c *Chat) *UserUpdateOne

SetChat sets the "chat" edge to the Chat entity.

func (*UserUpdateOne) SetChatID

func (uuo *UserUpdateOne) SetChatID(id int64) *UserUpdateOne

SetChatID sets the "chat" edge to the Chat entity by ID.

func (*UserUpdateOne) SetEmail

func (uuo *UserUpdateOne) SetEmail(s string) *UserUpdateOne

SetEmail sets the "email" field.

func (*UserUpdateOne) SetMetadata

func (uuo *UserUpdateOne) SetMetadata(u *UserMetadata) *UserUpdateOne

SetMetadata sets the "metadata" edge to the UserMetadata entity.

func (*UserUpdateOne) SetMetadataID

func (uuo *UserUpdateOne) SetMetadataID(id int64) *UserUpdateOne

SetMetadataID sets the "metadata" edge to the UserMetadata entity by ID.

func (*UserUpdateOne) SetNillableChatID

func (uuo *UserUpdateOne) SetNillableChatID(id *int64) *UserUpdateOne

SetNillableChatID sets the "chat" edge to the Chat entity by ID if the given value is not nil.

func (*UserUpdateOne) SetNillableMetadataID

func (uuo *UserUpdateOne) SetNillableMetadataID(id *int64) *UserUpdateOne

SetNillableMetadataID sets the "metadata" edge to the UserMetadata entity by ID if the given value is not nil.

func (*UserUpdateOne) SetPassword

func (uuo *UserUpdateOne) SetPassword(s string) *UserUpdateOne

SetPassword sets the "password" field.

type Users

type Users []*User

Users is a parsable slice of User.

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