ent

package
v0.0.0-...-2de19fb Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2021 License: MIT Imports: 23 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.
	TypeDialog  = "Dialog"
	TypeMessage = "Message"
	TypeProject = "Project"
	TypeUser    = "User"
)

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 validaton error.

func MaskNotFound

func MaskNotFound(err error) error

MaskNotFound masks nor 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 Client 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 Client

type Client struct {

	// Schema is the client for creating, migrating and dropping schema.
	Schema *migrate.Schema
	// Dialog is the client for interacting with the Dialog builders.
	Dialog *DialogClient
	// Message is the client for interacting with the Message builders.
	Message *MessageClient
	// Project is the client for interacting with the Project builders.
	Project *ProjectClient
	// User is the client for interacting with the User builders.
	User *UserClient
	// contains filtered or unexported fields
}

Client is the client that holds all ent builders.

func FromContext

func FromContext(ctx context.Context) *Client

FromContext returns the Client stored in 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 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().
	Dialog.
	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(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 Committer 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 Dialog

type Dialog struct {

	// ID of the ent.
	ID int `json:"id,omitempty"`
	// CreateTime holds the value of the "create_time" field.
	CreateTime time.Time `json:"create_time,omitempty"`
	// UpdateTime holds the value of the "update_time" field.
	UpdateTime time.Time `json:"update_time,omitempty"`
	// Meta holds the value of the "meta" field.
	Meta domain.DialogMeta `json:"meta,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the DialogQuery when eager-loading is set.
	Edges DialogEdges `json:"edges"`
	// contains filtered or unexported fields
}

Dialog is the model entity for the Dialog schema.

func (*Dialog) QueryMessage

func (d *Dialog) QueryMessage() *MessageQuery

QueryMessage queries the message edge of the Dialog.

func (*Dialog) QueryUser

func (d *Dialog) QueryUser() *UserQuery

QueryUser queries the user edge of the Dialog.

func (*Dialog) String

func (d *Dialog) String() string

String implements the fmt.Stringer.

func (*Dialog) Unwrap

func (d *Dialog) Unwrap() *Dialog

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

func (*Dialog) Update

func (d *Dialog) Update() *DialogUpdateOne

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

type DialogClient

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

DialogClient is a client for the Dialog schema.

func NewDialogClient

func NewDialogClient(c config) *DialogClient

NewDialogClient returns a client for the Dialog from the given config.

func (*DialogClient) Create

func (c *DialogClient) Create() *DialogCreate

Create returns a create builder for Dialog.

func (*DialogClient) CreateBulk

func (c *DialogClient) CreateBulk(builders ...*DialogCreate) *DialogCreateBulk

BulkCreate returns a builder for creating a bulk of Dialog entities.

func (*DialogClient) Delete

func (c *DialogClient) Delete() *DialogDelete

Delete returns a delete builder for Dialog.

func (*DialogClient) DeleteOne

func (c *DialogClient) DeleteOne(d *Dialog) *DialogDeleteOne

DeleteOne returns a delete builder for the given entity.

func (*DialogClient) DeleteOneID

func (c *DialogClient) DeleteOneID(id int) *DialogDeleteOne

DeleteOneID returns a delete builder for the given id.

func (*DialogClient) Get

func (c *DialogClient) Get(ctx context.Context, id int) (*Dialog, error)

Get returns a Dialog entity by its id.

func (*DialogClient) GetX

func (c *DialogClient) GetX(ctx context.Context, id int) *Dialog

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

func (*DialogClient) Hooks

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

Hooks returns the client hooks.

func (*DialogClient) Query

func (c *DialogClient) Query() *DialogQuery

Query returns a query builder for Dialog.

func (*DialogClient) QueryMessage

func (c *DialogClient) QueryMessage(d *Dialog) *MessageQuery

QueryMessage queries the message edge of a Dialog.

func (*DialogClient) QueryUser

func (c *DialogClient) QueryUser(d *Dialog) *UserQuery

QueryUser queries the user edge of a Dialog.

func (*DialogClient) Update

func (c *DialogClient) Update() *DialogUpdate

Update returns an update builder for Dialog.

func (*DialogClient) UpdateOne

func (c *DialogClient) UpdateOne(d *Dialog) *DialogUpdateOne

UpdateOne returns an update builder for the given entity.

func (*DialogClient) UpdateOneID

func (c *DialogClient) UpdateOneID(id int) *DialogUpdateOne

UpdateOneID returns an update builder for the given id.

func (*DialogClient) Use

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

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

type DialogCreate

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

DialogCreate is the builder for creating a Dialog entity.

func (*DialogCreate) AddMessage

func (dc *DialogCreate) AddMessage(m ...*Message) *DialogCreate

AddMessage adds the message edges to Message.

func (*DialogCreate) AddMessageIDs

func (dc *DialogCreate) AddMessageIDs(ids ...int) *DialogCreate

AddMessageIDs adds the message edge to Message by ids.

func (*DialogCreate) Mutation

func (dc *DialogCreate) Mutation() *DialogMutation

Mutation returns the DialogMutation object of the builder.

func (*DialogCreate) Save

func (dc *DialogCreate) Save(ctx context.Context) (*Dialog, error)

Save creates the Dialog in the database.

func (*DialogCreate) SaveX

func (dc *DialogCreate) SaveX(ctx context.Context) *Dialog

SaveX calls Save and panics if Save returns an error.

func (*DialogCreate) SetCreateTime

func (dc *DialogCreate) SetCreateTime(t time.Time) *DialogCreate

SetCreateTime sets the create_time field.

func (*DialogCreate) SetMeta

func (dc *DialogCreate) SetMeta(dm domain.DialogMeta) *DialogCreate

SetMeta sets the meta field.

func (*DialogCreate) SetNillableCreateTime

func (dc *DialogCreate) SetNillableCreateTime(t *time.Time) *DialogCreate

SetNillableCreateTime sets the create_time field if the given value is not nil.

func (*DialogCreate) SetNillableMeta

func (dc *DialogCreate) SetNillableMeta(dm *domain.DialogMeta) *DialogCreate

SetNillableMeta sets the meta field if the given value is not nil.

func (*DialogCreate) SetNillableUpdateTime

func (dc *DialogCreate) SetNillableUpdateTime(t *time.Time) *DialogCreate

SetNillableUpdateTime sets the update_time field if the given value is not nil.

func (*DialogCreate) SetUpdateTime

func (dc *DialogCreate) SetUpdateTime(t time.Time) *DialogCreate

SetUpdateTime sets the update_time field.

func (*DialogCreate) SetUser

func (dc *DialogCreate) SetUser(u *User) *DialogCreate

SetUser sets the user edge to User.

func (*DialogCreate) SetUserID

func (dc *DialogCreate) SetUserID(id int) *DialogCreate

SetUserID sets the user edge to User by id.

type DialogCreateBulk

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

DialogCreateBulk is the builder for creating a bulk of Dialog entities.

func (*DialogCreateBulk) Save

func (dcb *DialogCreateBulk) Save(ctx context.Context) ([]*Dialog, error)

Save creates the Dialog entities in the database.

func (*DialogCreateBulk) SaveX

func (dcb *DialogCreateBulk) SaveX(ctx context.Context) []*Dialog

SaveX calls Save and panics if Save returns an error.

type DialogDelete

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

DialogDelete is the builder for deleting a Dialog entity.

func (*DialogDelete) Exec

func (dd *DialogDelete) Exec(ctx context.Context) (int, error)

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

func (*DialogDelete) ExecX

func (dd *DialogDelete) ExecX(ctx context.Context) int

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

func (*DialogDelete) Where

func (dd *DialogDelete) Where(ps ...predicate.Dialog) *DialogDelete

Where adds a new predicate to the delete builder.

type DialogDeleteOne

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

DialogDeleteOne is the builder for deleting a single Dialog entity.

func (*DialogDeleteOne) Exec

func (ddo *DialogDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*DialogDeleteOne) ExecX

func (ddo *DialogDeleteOne) ExecX(ctx context.Context)

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

type DialogEdges

type DialogEdges struct {
	// Message holds the value of the message edge.
	Message []*Message
	// User holds the value of the user edge.
	User *User
	// contains filtered or unexported fields
}

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

func (DialogEdges) MessageOrErr

func (e DialogEdges) MessageOrErr() ([]*Message, error)

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

func (DialogEdges) UserOrErr

func (e DialogEdges) 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 DialogGroupBy

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

DialogGroupBy is the builder for group-by Dialog entities.

func (*DialogGroupBy) Aggregate

func (dgb *DialogGroupBy) Aggregate(fns ...AggregateFunc) *DialogGroupBy

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

func (*DialogGroupBy) Bool

func (dgb *DialogGroupBy) Bool(ctx context.Context) (_ bool, err error)

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

func (*DialogGroupBy) BoolX

func (dgb *DialogGroupBy) BoolX(ctx context.Context) bool

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

func (*DialogGroupBy) Bools

func (dgb *DialogGroupBy) Bools(ctx context.Context) ([]bool, error)

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

func (*DialogGroupBy) BoolsX

func (dgb *DialogGroupBy) BoolsX(ctx context.Context) []bool

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

func (*DialogGroupBy) Float64

func (dgb *DialogGroupBy) Float64(ctx context.Context) (_ float64, err error)

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

func (*DialogGroupBy) Float64X

func (dgb *DialogGroupBy) Float64X(ctx context.Context) float64

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

func (*DialogGroupBy) Float64s

func (dgb *DialogGroupBy) Float64s(ctx context.Context) ([]float64, error)

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

func (*DialogGroupBy) Float64sX

func (dgb *DialogGroupBy) Float64sX(ctx context.Context) []float64

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

func (*DialogGroupBy) Int

func (dgb *DialogGroupBy) Int(ctx context.Context) (_ int, err error)

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

func (*DialogGroupBy) IntX

func (dgb *DialogGroupBy) IntX(ctx context.Context) int

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

func (*DialogGroupBy) Ints

func (dgb *DialogGroupBy) Ints(ctx context.Context) ([]int, error)

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

func (*DialogGroupBy) IntsX

func (dgb *DialogGroupBy) IntsX(ctx context.Context) []int

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

func (*DialogGroupBy) Scan

func (dgb *DialogGroupBy) Scan(ctx context.Context, v interface{}) error

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

func (*DialogGroupBy) ScanX

func (dgb *DialogGroupBy) ScanX(ctx context.Context, v interface{})

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

func (*DialogGroupBy) String

func (dgb *DialogGroupBy) String(ctx context.Context) (_ string, err error)

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

func (*DialogGroupBy) StringX

func (dgb *DialogGroupBy) StringX(ctx context.Context) string

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

func (*DialogGroupBy) Strings

func (dgb *DialogGroupBy) Strings(ctx context.Context) ([]string, error)

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

func (*DialogGroupBy) StringsX

func (dgb *DialogGroupBy) StringsX(ctx context.Context) []string

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

type DialogMutation

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

DialogMutation represents an operation that mutate the Dialogs nodes in the graph.

func (*DialogMutation) AddField

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

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

func (*DialogMutation) AddMessageIDs

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

AddMessageIDs adds the message edge to Message by ids.

func (*DialogMutation) AddedEdges

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

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

func (*DialogMutation) AddedField

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

AddedField returns the numeric value that was in/decremented from a field with the given name. The second value indicates that this field was not set, or was not define in the schema.

func (*DialogMutation) AddedFields

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

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

func (*DialogMutation) AddedIDs

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

AddedIDs returns all ids (to other nodes) that were added for the given edge name.

func (*DialogMutation) ClearEdge

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

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

func (*DialogMutation) ClearField

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

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

func (*DialogMutation) ClearMeta

func (m *DialogMutation) ClearMeta()

ClearMeta clears the value of meta.

func (*DialogMutation) ClearUser

func (m *DialogMutation) ClearUser()

ClearUser clears the user edge to User.

func (*DialogMutation) ClearedEdges

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

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

func (*DialogMutation) ClearedFields

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

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

func (DialogMutation) Client

func (m DialogMutation) 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 (*DialogMutation) CreateTime

func (m *DialogMutation) CreateTime() (r time.Time, exists bool)

CreateTime returns the create_time value in the mutation.

func (*DialogMutation) EdgeCleared

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

EdgeCleared returns a boolean indicates if this edge was cleared in this mutation.

func (*DialogMutation) Field

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

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

func (*DialogMutation) FieldCleared

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

FieldCleared returns a boolean indicates if this field was cleared in this mutation.

func (*DialogMutation) Fields

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

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

func (*DialogMutation) ID

func (m *DialogMutation) ID() (id int, exists bool)

ID returns the id value in the mutation. Note that, the id is available only if it was provided to the builder.

func (*DialogMutation) MessageIDs

func (m *DialogMutation) MessageIDs() (ids []int)

MessageIDs returns the message ids in the mutation.

func (*DialogMutation) Meta

func (m *DialogMutation) Meta() (r domain.DialogMeta, exists bool)

Meta returns the meta value in the mutation.

func (*DialogMutation) MetaCleared

func (m *DialogMutation) MetaCleared() bool

MetaCleared returns if the field meta was cleared in this mutation.

func (*DialogMutation) OldCreateTime

func (m *DialogMutation) OldCreateTime(ctx context.Context) (v time.Time, err error)

OldCreateTime returns the old create_time value of the Dialog. If the Dialog 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 database query fails.

func (*DialogMutation) OldField

func (m *DialogMutation) 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 was failed.

func (*DialogMutation) OldMeta

func (m *DialogMutation) OldMeta(ctx context.Context) (v domain.DialogMeta, err error)

OldMeta returns the old meta value of the Dialog. If the Dialog 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 database query fails.

func (*DialogMutation) OldUpdateTime

func (m *DialogMutation) OldUpdateTime(ctx context.Context) (v time.Time, err error)

OldUpdateTime returns the old update_time value of the Dialog. If the Dialog 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 database query fails.

func (*DialogMutation) Op

func (m *DialogMutation) Op() Op

Op returns the operation name.

func (*DialogMutation) RemoveMessageIDs

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

RemoveMessageIDs removes the message edge to Message by ids.

func (*DialogMutation) RemovedEdges

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

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

func (*DialogMutation) RemovedIDs

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

RemovedIDs returns all ids (to other nodes) that were removed for the given edge name.

func (*DialogMutation) RemovedMessageIDs

func (m *DialogMutation) RemovedMessageIDs() (ids []int)

RemovedMessage returns the removed ids of message.

func (*DialogMutation) ResetCreateTime

func (m *DialogMutation) ResetCreateTime()

ResetCreateTime reset all changes of the "create_time" field.

func (*DialogMutation) ResetEdge

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

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

func (*DialogMutation) ResetField

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

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

func (*DialogMutation) ResetMessage

func (m *DialogMutation) ResetMessage()

ResetMessage reset all changes of the "message" edge.

func (*DialogMutation) ResetMeta

func (m *DialogMutation) ResetMeta()

ResetMeta reset all changes of the "meta" field.

func (*DialogMutation) ResetUpdateTime

func (m *DialogMutation) ResetUpdateTime()

ResetUpdateTime reset all changes of the "update_time" field.

func (*DialogMutation) ResetUser

func (m *DialogMutation) ResetUser()

ResetUser reset all changes of the "user" edge.

func (*DialogMutation) SetCreateTime

func (m *DialogMutation) SetCreateTime(t time.Time)

SetCreateTime sets the create_time field.

func (*DialogMutation) SetField

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

SetField sets the value for the given name. It returns an error if the field is not defined in the schema, or if the type mismatch the field type.

func (*DialogMutation) SetMeta

func (m *DialogMutation) SetMeta(dm domain.DialogMeta)

SetMeta sets the meta field.

func (*DialogMutation) SetUpdateTime

func (m *DialogMutation) SetUpdateTime(t time.Time)

SetUpdateTime sets the update_time field.

func (*DialogMutation) SetUserID

func (m *DialogMutation) SetUserID(id int)

SetUserID sets the user edge to User by id.

func (DialogMutation) Tx

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

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

func (*DialogMutation) Type

func (m *DialogMutation) Type() string

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

func (*DialogMutation) UpdateTime

func (m *DialogMutation) UpdateTime() (r time.Time, exists bool)

UpdateTime returns the update_time value in the mutation.

func (*DialogMutation) UserCleared

func (m *DialogMutation) UserCleared() bool

UserCleared returns if the edge user was cleared.

func (*DialogMutation) UserID

func (m *DialogMutation) UserID() (id int, exists bool)

UserID returns the user id in the mutation.

func (*DialogMutation) UserIDs

func (m *DialogMutation) UserIDs() (ids []int)

UserIDs returns the user 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.

type DialogQuery

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

DialogQuery is the builder for querying Dialog entities.

func (*DialogQuery) All

func (dq *DialogQuery) All(ctx context.Context) ([]*Dialog, error)

All executes the query and returns a list of Dialogs.

func (*DialogQuery) AllX

func (dq *DialogQuery) AllX(ctx context.Context) []*Dialog

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

func (*DialogQuery) Clone

func (dq *DialogQuery) Clone() *DialogQuery

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

func (*DialogQuery) Count

func (dq *DialogQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*DialogQuery) CountX

func (dq *DialogQuery) CountX(ctx context.Context) int

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

func (*DialogQuery) Exist

func (dq *DialogQuery) Exist(ctx context.Context) (bool, error)

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

func (*DialogQuery) ExistX

func (dq *DialogQuery) ExistX(ctx context.Context) bool

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

func (*DialogQuery) First

func (dq *DialogQuery) First(ctx context.Context) (*Dialog, error)

First returns the first Dialog entity in the query. Returns *NotFoundError when no dialog was found.

func (*DialogQuery) FirstID

func (dq *DialogQuery) FirstID(ctx context.Context) (id int, err error)

FirstID returns the first Dialog id in the query. Returns *NotFoundError when no id was found.

func (*DialogQuery) FirstX

func (dq *DialogQuery) FirstX(ctx context.Context) *Dialog

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

func (*DialogQuery) FirstXID

func (dq *DialogQuery) FirstXID(ctx context.Context) int

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

func (*DialogQuery) GroupBy

func (dq *DialogQuery) GroupBy(field string, fields ...string) *DialogGroupBy

GroupBy 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 {
	CreateTime time.Time `json:"create_time,omitempty"`
	Count int `json:"count,omitempty"`
}

client.Dialog.Query().
	GroupBy(dialog.FieldCreateTime).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*DialogQuery) IDs

func (dq *DialogQuery) IDs(ctx context.Context) ([]int, error)

IDs executes the query and returns a list of Dialog ids.

func (*DialogQuery) IDsX

func (dq *DialogQuery) IDsX(ctx context.Context) []int

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

func (*DialogQuery) Limit

func (dq *DialogQuery) Limit(limit int) *DialogQuery

Limit adds a limit step to the query.

func (*DialogQuery) Offset

func (dq *DialogQuery) Offset(offset int) *DialogQuery

Offset adds an offset step to the query.

func (*DialogQuery) Only

func (dq *DialogQuery) Only(ctx context.Context) (*Dialog, error)

Only returns the only Dialog entity in the query, returns an error if not exactly one entity was returned.

func (*DialogQuery) OnlyID

func (dq *DialogQuery) OnlyID(ctx context.Context) (id int, err error)

OnlyID returns the only Dialog id in the query, returns an error if not exactly one id was returned.

func (*DialogQuery) OnlyIDX

func (dq *DialogQuery) OnlyIDX(ctx context.Context) int

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

func (*DialogQuery) OnlyX

func (dq *DialogQuery) OnlyX(ctx context.Context) *Dialog

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

func (*DialogQuery) Order

func (dq *DialogQuery) Order(o ...OrderFunc) *DialogQuery

Order adds an order step to the query.

func (*DialogQuery) QueryMessage

func (dq *DialogQuery) QueryMessage() *MessageQuery

QueryMessage chains the current query on the message edge.

func (*DialogQuery) QueryUser

func (dq *DialogQuery) QueryUser() *UserQuery

QueryUser chains the current query on the user edge.

func (*DialogQuery) Select

func (dq *DialogQuery) Select(field string, fields ...string) *DialogSelect

Select one or more fields from the given query.

Example:

var v []struct {
	CreateTime time.Time `json:"create_time,omitempty"`
}

client.Dialog.Query().
	Select(dialog.FieldCreateTime).
	Scan(ctx, &v)

func (*DialogQuery) Where

func (dq *DialogQuery) Where(ps ...predicate.Dialog) *DialogQuery

Where adds a new predicate for the builder.

func (*DialogQuery) WithMessage

func (dq *DialogQuery) WithMessage(opts ...func(*MessageQuery)) *DialogQuery
WithMessage tells the query-builder to eager-loads the nodes that are connected to

the "message" edge. The optional arguments used to configure the query builder of the edge.

func (*DialogQuery) WithUser

func (dq *DialogQuery) WithUser(opts ...func(*UserQuery)) *DialogQuery
WithUser tells the query-builder to eager-loads the nodes that are connected to

the "user" edge. The optional arguments used to configure the query builder of the edge.

type DialogSelect

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

DialogSelect is the builder for select fields of Dialog entities.

func (*DialogSelect) Bool

func (ds *DialogSelect) Bool(ctx context.Context) (_ bool, err error)

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

func (*DialogSelect) BoolX

func (ds *DialogSelect) BoolX(ctx context.Context) bool

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

func (*DialogSelect) Bools

func (ds *DialogSelect) Bools(ctx context.Context) ([]bool, error)

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

func (*DialogSelect) BoolsX

func (ds *DialogSelect) BoolsX(ctx context.Context) []bool

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

func (*DialogSelect) Float64

func (ds *DialogSelect) Float64(ctx context.Context) (_ float64, err error)

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

func (*DialogSelect) Float64X

func (ds *DialogSelect) Float64X(ctx context.Context) float64

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

func (*DialogSelect) Float64s

func (ds *DialogSelect) Float64s(ctx context.Context) ([]float64, error)

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

func (*DialogSelect) Float64sX

func (ds *DialogSelect) Float64sX(ctx context.Context) []float64

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

func (*DialogSelect) Int

func (ds *DialogSelect) Int(ctx context.Context) (_ int, err error)

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

func (*DialogSelect) IntX

func (ds *DialogSelect) IntX(ctx context.Context) int

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

func (*DialogSelect) Ints

func (ds *DialogSelect) Ints(ctx context.Context) ([]int, error)

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

func (*DialogSelect) IntsX

func (ds *DialogSelect) IntsX(ctx context.Context) []int

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

func (*DialogSelect) Scan

func (ds *DialogSelect) Scan(ctx context.Context, v interface{}) error

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

func (*DialogSelect) ScanX

func (ds *DialogSelect) ScanX(ctx context.Context, v interface{})

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

func (*DialogSelect) String

func (ds *DialogSelect) String(ctx context.Context) (_ string, err error)

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

func (*DialogSelect) StringX

func (ds *DialogSelect) StringX(ctx context.Context) string

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

func (*DialogSelect) Strings

func (ds *DialogSelect) Strings(ctx context.Context) ([]string, error)

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

func (*DialogSelect) StringsX

func (ds *DialogSelect) StringsX(ctx context.Context) []string

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

type DialogUpdate

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

DialogUpdate is the builder for updating Dialog entities.

func (*DialogUpdate) AddMessage

func (du *DialogUpdate) AddMessage(m ...*Message) *DialogUpdate

AddMessage adds the message edges to Message.

func (*DialogUpdate) AddMessageIDs

func (du *DialogUpdate) AddMessageIDs(ids ...int) *DialogUpdate

AddMessageIDs adds the message edge to Message by ids.

func (*DialogUpdate) ClearMeta

func (du *DialogUpdate) ClearMeta() *DialogUpdate

ClearMeta clears the value of meta.

func (*DialogUpdate) ClearUser

func (du *DialogUpdate) ClearUser() *DialogUpdate

ClearUser clears the user edge to User.

func (*DialogUpdate) Exec

func (du *DialogUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*DialogUpdate) ExecX

func (du *DialogUpdate) ExecX(ctx context.Context)

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

func (*DialogUpdate) Mutation

func (du *DialogUpdate) Mutation() *DialogMutation

Mutation returns the DialogMutation object of the builder.

func (*DialogUpdate) RemoveMessage

func (du *DialogUpdate) RemoveMessage(m ...*Message) *DialogUpdate

RemoveMessage removes message edges to Message.

func (*DialogUpdate) RemoveMessageIDs

func (du *DialogUpdate) RemoveMessageIDs(ids ...int) *DialogUpdate

RemoveMessageIDs removes the message edge to Message by ids.

func (*DialogUpdate) Save

func (du *DialogUpdate) Save(ctx context.Context) (int, error)

Save executes the query and returns the number of rows/vertices matched by this operation.

func (*DialogUpdate) SaveX

func (du *DialogUpdate) SaveX(ctx context.Context) int

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

func (*DialogUpdate) SetMeta

func (du *DialogUpdate) SetMeta(dm domain.DialogMeta) *DialogUpdate

SetMeta sets the meta field.

func (*DialogUpdate) SetNillableMeta

func (du *DialogUpdate) SetNillableMeta(dm *domain.DialogMeta) *DialogUpdate

SetNillableMeta sets the meta field if the given value is not nil.

func (*DialogUpdate) SetUser

func (du *DialogUpdate) SetUser(u *User) *DialogUpdate

SetUser sets the user edge to User.

func (*DialogUpdate) SetUserID

func (du *DialogUpdate) SetUserID(id int) *DialogUpdate

SetUserID sets the user edge to User by id.

func (*DialogUpdate) Where

func (du *DialogUpdate) Where(ps ...predicate.Dialog) *DialogUpdate

Where adds a new predicate for the builder.

type DialogUpdateOne

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

DialogUpdateOne is the builder for updating a single Dialog entity.

func (*DialogUpdateOne) AddMessage

func (duo *DialogUpdateOne) AddMessage(m ...*Message) *DialogUpdateOne

AddMessage adds the message edges to Message.

func (*DialogUpdateOne) AddMessageIDs

func (duo *DialogUpdateOne) AddMessageIDs(ids ...int) *DialogUpdateOne

AddMessageIDs adds the message edge to Message by ids.

func (*DialogUpdateOne) ClearMeta

func (duo *DialogUpdateOne) ClearMeta() *DialogUpdateOne

ClearMeta clears the value of meta.

func (*DialogUpdateOne) ClearUser

func (duo *DialogUpdateOne) ClearUser() *DialogUpdateOne

ClearUser clears the user edge to User.

func (*DialogUpdateOne) Exec

func (duo *DialogUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*DialogUpdateOne) ExecX

func (duo *DialogUpdateOne) ExecX(ctx context.Context)

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

func (*DialogUpdateOne) Mutation

func (duo *DialogUpdateOne) Mutation() *DialogMutation

Mutation returns the DialogMutation object of the builder.

func (*DialogUpdateOne) RemoveMessage

func (duo *DialogUpdateOne) RemoveMessage(m ...*Message) *DialogUpdateOne

RemoveMessage removes message edges to Message.

func (*DialogUpdateOne) RemoveMessageIDs

func (duo *DialogUpdateOne) RemoveMessageIDs(ids ...int) *DialogUpdateOne

RemoveMessageIDs removes the message edge to Message by ids.

func (*DialogUpdateOne) Save

func (duo *DialogUpdateOne) Save(ctx context.Context) (*Dialog, error)

Save executes the query and returns the updated entity.

func (*DialogUpdateOne) SaveX

func (duo *DialogUpdateOne) SaveX(ctx context.Context) *Dialog

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

func (*DialogUpdateOne) SetMeta

SetMeta sets the meta field.

func (*DialogUpdateOne) SetNillableMeta

func (duo *DialogUpdateOne) SetNillableMeta(dm *domain.DialogMeta) *DialogUpdateOne

SetNillableMeta sets the meta field if the given value is not nil.

func (*DialogUpdateOne) SetUser

func (duo *DialogUpdateOne) SetUser(u *User) *DialogUpdateOne

SetUser sets the user edge to User.

func (*DialogUpdateOne) SetUserID

func (duo *DialogUpdateOne) SetUserID(id int) *DialogUpdateOne

SetUserID sets the user edge to User by id.

type Dialogs

type Dialogs []*Dialog

Dialogs is a parsable slice of Dialog.

type Hook

type Hook = ent.Hook

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

type Message

type Message struct {

	// ID of the ent.
	ID int `json:"id,omitempty"`
	// CreateTime holds the value of the "create_time" field.
	CreateTime time.Time `json:"create_time,omitempty"`
	// UpdateTime holds the value of the "update_time" field.
	UpdateTime time.Time `json:"update_time,omitempty"`
	// Text holds the value of the "text" field.
	Text string `json:"text,omitempty"`
	// Attachment holds the value of the "attachment" field.
	Attachment string `json:"attachment,omitempty"`
	// PayloadType holds the value of the "payload_type" field.
	PayloadType string `json:"payload_type,omitempty"`
	// PayloadValue holds the value of the "payload_value" field.
	PayloadValue string `json:"payload_value,omitempty"`
	// System holds the value of the "system" field.
	System string `json:"system,omitempty"`
	// Direction holds the value of the "direction" field.
	Direction string `json:"direction,omitempty"`
	// Proactive holds the value of the "proactive" field.
	Proactive bool `json:"proactive,omitempty"`
	// Error holds the value of the "error" field.
	Error *string `json:"error,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) QueryDialog

func (m *Message) QueryDialog() *DialogQuery

QueryDialog queries the dialog edge of the Message.

func (*Message) String

func (m *Message) String() string

String implements the fmt.Stringer.

func (*Message) Unwrap

func (m *Message) Unwrap() *Message

Unwrap unwraps the entity that was returned from a transaction after it was closed, so that all next 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

BulkCreate 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 int) *MessageDeleteOne

DeleteOneID returns a delete builder for the given id.

func (*MessageClient) Get

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

Get returns a Message entity by its id.

func (*MessageClient) GetX

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

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

func (*MessageClient) Hooks

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

Hooks returns the client hooks.

func (*MessageClient) Query

func (c *MessageClient) Query() *MessageQuery

Query returns a query builder for Message.

func (*MessageClient) QueryDialog

func (c *MessageClient) QueryDialog(m *Message) *DialogQuery

QueryDialog queries the dialog edge of a Message.

func (*MessageClient) Update

func (c *MessageClient) Update() *MessageUpdate

Update returns an update builder for Message.

func (*MessageClient) UpdateOne

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

UpdateOne returns an update builder for the given entity.

func (*MessageClient) UpdateOneID

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

UpdateOneID returns an update builder for the given id.

func (*MessageClient) Use

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

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

type MessageCreate

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

MessageCreate is the builder for creating a Message entity.

func (*MessageCreate) 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) SetAttachment

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

SetAttachment sets the attachment field.

func (*MessageCreate) SetCreateTime

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

SetCreateTime sets the create_time field.

func (*MessageCreate) SetDialog

func (mc *MessageCreate) SetDialog(d *Dialog) *MessageCreate

SetDialog sets the dialog edge to Dialog.

func (*MessageCreate) SetDialogID

func (mc *MessageCreate) SetDialogID(id int) *MessageCreate

SetDialogID sets the dialog edge to Dialog by id.

func (*MessageCreate) SetDirection

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

SetDirection sets the direction field.

func (*MessageCreate) SetError

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

SetError sets the error field.

func (*MessageCreate) SetNillableAttachment

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

SetNillableAttachment sets the attachment field if the given value is not nil.

func (*MessageCreate) SetNillableCreateTime

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

SetNillableCreateTime sets the create_time field if the given value is not nil.

func (*MessageCreate) SetNillableError

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

SetNillableError sets the error field if the given value is not nil.

func (*MessageCreate) SetNillablePayloadType

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

SetNillablePayloadType sets the payload_type field if the given value is not nil.

func (*MessageCreate) SetNillablePayloadValue

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

SetNillablePayloadValue sets the payload_value field if the given value is not nil.

func (*MessageCreate) SetNillableText

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

SetNillableText sets the text field if the given value is not nil.

func (*MessageCreate) SetNillableUpdateTime

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

SetNillableUpdateTime sets the update_time field if the given value is not nil.

func (*MessageCreate) SetPayloadType

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

SetPayloadType sets the payload_type field.

func (*MessageCreate) SetPayloadValue

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

SetPayloadValue sets the payload_value field.

func (*MessageCreate) SetProactive

func (mc *MessageCreate) SetProactive(b bool) *MessageCreate

SetProactive sets the proactive field.

func (*MessageCreate) SetSystem

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

SetSystem sets the system field.

func (*MessageCreate) SetText

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

SetText sets the text field.

func (*MessageCreate) SetUpdateTime

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

SetUpdateTime sets the update_time field.

type MessageCreateBulk

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

MessageCreateBulk is the builder for creating a bulk of Message entities.

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 calls Save and panics if Save returns an error.

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 adds a new predicate to the delete 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 {
	// Dialog holds the value of the dialog edge.
	Dialog *Dialog
	// contains filtered or unexported fields
}

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

func (MessageEdges) DialogOrErr

func (e MessageEdges) DialogOrErr() (*Dialog, error)

DialogOrErr returns the Dialog 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 builder for group-by 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 group-by. It is only allowed when querying group-by 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 querying group-by 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 group-by. It is only allowed when querying group-by 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 querying group-by 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 group-by. It is only allowed when querying group-by 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 querying group-by 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 scan 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 group-by. It is only allowed when querying group-by 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 querying group-by 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 mutate the Messages nodes in the graph.

func (*MessageMutation) AddField

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

AddField adds the value for the given name. It returns an error if the field is not defined in the schema, or if the type mismatch 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 in/decremented from a field with the given name. The second value indicates that this field was not set, or was not define in the schema.

func (*MessageMutation) AddedFields

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

AddedFields returns all numeric fields that were incremented or 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.

func (*MessageMutation) Attachment

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

Attachment returns the attachment value in the mutation.

func (*MessageMutation) AttachmentCleared

func (m *MessageMutation) AttachmentCleared() bool

AttachmentCleared returns if the field attachment was cleared in this mutation.

func (*MessageMutation) ClearAttachment

func (m *MessageMutation) ClearAttachment()

ClearAttachment clears the value of attachment.

func (*MessageMutation) ClearDialog

func (m *MessageMutation) ClearDialog()

ClearDialog clears the dialog edge to Dialog.

func (*MessageMutation) ClearEdge

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

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

func (*MessageMutation) ClearError

func (m *MessageMutation) ClearError()

ClearError clears the value of error.

func (*MessageMutation) ClearField

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

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

func (*MessageMutation) ClearPayloadType

func (m *MessageMutation) ClearPayloadType()

ClearPayloadType clears the value of payload_type.

func (*MessageMutation) ClearPayloadValue

func (m *MessageMutation) ClearPayloadValue()

ClearPayloadValue clears the value of payload_value.

func (*MessageMutation) ClearText

func (m *MessageMutation) ClearText()

ClearText clears the value of text.

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

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

CreateTime returns the create_time value in the mutation.

func (*MessageMutation) DialogCleared

func (m *MessageMutation) DialogCleared() bool

DialogCleared returns if the edge dialog was cleared.

func (*MessageMutation) DialogID

func (m *MessageMutation) DialogID() (id int, exists bool)

DialogID returns the dialog id in the mutation.

func (*MessageMutation) DialogIDs

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

DialogIDs returns the dialog ids in the mutation. Note that ids always returns len(ids) <= 1 for unique edges, and you should use DialogID instead. It exists only for internal usage by the builders.

func (*MessageMutation) Direction

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

Direction returns the direction value in the mutation.

func (*MessageMutation) EdgeCleared

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

EdgeCleared returns a boolean indicates if this edge was cleared in this mutation.

func (*MessageMutation) Error

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

Error returns the error value in the mutation.

func (*MessageMutation) ErrorCleared

func (m *MessageMutation) ErrorCleared() bool

ErrorCleared returns if the field error 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 value indicates that this field was not set, or was not define in the schema.

func (*MessageMutation) FieldCleared

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

FieldCleared returns a boolean indicates if this field 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 in/decremented, call AddedFields().

func (*MessageMutation) ID

func (m *MessageMutation) ID() (id int, exists bool)

ID returns the id value in the mutation. Note that, the id is available only if it was provided to the builder.

func (*MessageMutation) OldAttachment

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

OldAttachment returns the old attachment value of the Message. 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 database query fails.

func (*MessageMutation) OldCreateTime

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

OldCreateTime returns the old create_time value of the Message. 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 database query fails.

func (*MessageMutation) OldDirection

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

OldDirection returns the old direction value of the Message. 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 database query fails.

func (*MessageMutation) OldError

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

OldError returns the old error value of the Message. 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 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 was failed.

func (*MessageMutation) OldPayloadType

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

OldPayloadType returns the old payload_type value of the Message. 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 database query fails.

func (*MessageMutation) OldPayloadValue

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

OldPayloadValue returns the old payload_value value of the Message. 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 database query fails.

func (*MessageMutation) OldProactive

func (m *MessageMutation) OldProactive(ctx context.Context) (v bool, err error)

OldProactive returns the old proactive value of the Message. 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 database query fails.

func (*MessageMutation) OldSystem

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

OldSystem returns the old system value of the Message. 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 database query fails.

func (*MessageMutation) OldText

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

OldText returns the old text value of the Message. 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 database query fails.

func (*MessageMutation) OldUpdateTime

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

OldUpdateTime returns the old update_time value of the Message. 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 database query fails.

func (*MessageMutation) Op

func (m *MessageMutation) Op() Op

Op returns the operation name.

func (*MessageMutation) PayloadType

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

PayloadType returns the payload_type value in the mutation.

func (*MessageMutation) PayloadTypeCleared

func (m *MessageMutation) PayloadTypeCleared() bool

PayloadTypeCleared returns if the field payload_type was cleared in this mutation.

func (*MessageMutation) PayloadValue

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

PayloadValue returns the payload_value value in the mutation.

func (*MessageMutation) PayloadValueCleared

func (m *MessageMutation) PayloadValueCleared() bool

PayloadValueCleared returns if the field payload_value was cleared in this mutation.

func (*MessageMutation) Proactive

func (m *MessageMutation) Proactive() (r bool, exists bool)

Proactive returns the proactive value in the mutation.

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 given edge name.

func (*MessageMutation) ResetAttachment

func (m *MessageMutation) ResetAttachment()

ResetAttachment reset all changes of the "attachment" field.

func (*MessageMutation) ResetCreateTime

func (m *MessageMutation) ResetCreateTime()

ResetCreateTime reset all changes of the "create_time" field.

func (*MessageMutation) ResetDialog

func (m *MessageMutation) ResetDialog()

ResetDialog reset all changes of the "dialog" edge.

func (*MessageMutation) ResetDirection

func (m *MessageMutation) ResetDirection()

ResetDirection reset all changes of the "direction" field.

func (*MessageMutation) ResetEdge

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

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

func (*MessageMutation) ResetError

func (m *MessageMutation) ResetError()

ResetError reset all changes of the "error" field.

func (*MessageMutation) ResetField

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

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

func (*MessageMutation) ResetPayloadType

func (m *MessageMutation) ResetPayloadType()

ResetPayloadType reset all changes of the "payload_type" field.

func (*MessageMutation) ResetPayloadValue

func (m *MessageMutation) ResetPayloadValue()

ResetPayloadValue reset all changes of the "payload_value" field.

func (*MessageMutation) ResetProactive

func (m *MessageMutation) ResetProactive()

ResetProactive reset all changes of the "proactive" field.

func (*MessageMutation) ResetSystem

func (m *MessageMutation) ResetSystem()

ResetSystem reset all changes of the "system" field.

func (*MessageMutation) ResetText

func (m *MessageMutation) ResetText()

ResetText reset all changes of the "text" field.

func (*MessageMutation) ResetUpdateTime

func (m *MessageMutation) ResetUpdateTime()

ResetUpdateTime reset all changes of the "update_time" field.

func (*MessageMutation) SetAttachment

func (m *MessageMutation) SetAttachment(s string)

SetAttachment sets the attachment field.

func (*MessageMutation) SetCreateTime

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

SetCreateTime sets the create_time field.

func (*MessageMutation) SetDialogID

func (m *MessageMutation) SetDialogID(id int)

SetDialogID sets the dialog edge to Dialog by id.

func (*MessageMutation) SetDirection

func (m *MessageMutation) SetDirection(s string)

SetDirection sets the direction field.

func (*MessageMutation) SetError

func (m *MessageMutation) SetError(s string)

SetError sets the error field.

func (*MessageMutation) SetField

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

SetField sets the value for the given name. It returns an error if the field is not defined in the schema, or if the type mismatch the field type.

func (*MessageMutation) SetPayloadType

func (m *MessageMutation) SetPayloadType(s string)

SetPayloadType sets the payload_type field.

func (*MessageMutation) SetPayloadValue

func (m *MessageMutation) SetPayloadValue(s string)

SetPayloadValue sets the payload_value field.

func (*MessageMutation) SetProactive

func (m *MessageMutation) SetProactive(b bool)

SetProactive sets the proactive field.

func (*MessageMutation) SetSystem

func (m *MessageMutation) SetSystem(s string)

SetSystem sets the system field.

func (*MessageMutation) SetText

func (m *MessageMutation) SetText(s string)

SetText sets the text field.

func (*MessageMutation) SetUpdateTime

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

SetUpdateTime sets the update_time field.

func (*MessageMutation) System

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

System returns the system value in the mutation.

func (*MessageMutation) Text

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

Text returns the text value in the mutation.

func (*MessageMutation) TextCleared

func (m *MessageMutation) TextCleared() bool

TextCleared returns if the field text was cleared in this 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) UpdateTime

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

UpdateTime returns the update_time value in the mutation.

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 query 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 in the query. Returns *NotFoundError when no message was found.

func (*MessageQuery) FirstID

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

FirstID returns the first Message id in the query. Returns *NotFoundError when no id was found.

func (*MessageQuery) FirstX

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

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

func (*MessageQuery) FirstXID

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

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

func (*MessageQuery) GroupBy

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

GroupBy 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 {
	CreateTime time.Time `json:"create_time,omitempty"`
	Count int `json:"count,omitempty"`
}

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

func (*MessageQuery) IDs

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

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

func (*MessageQuery) IDsX

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

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

func (*MessageQuery) Limit

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

Limit 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 the only Message entity in the query, returns an error if not exactly one entity was returned.

func (*MessageQuery) OnlyID

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

OnlyID returns the only Message id in the query, returns an error if not exactly one id was returned.

func (*MessageQuery) OnlyIDX

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

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

func (*MessageQuery) OnlyX

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

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

func (*MessageQuery) Order

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

Order adds an order step to the query.

func (*MessageQuery) QueryDialog

func (mq *MessageQuery) QueryDialog() *DialogQuery

QueryDialog chains the current query on the dialog edge.

func (*MessageQuery) Select

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

Select one or more fields from the given query.

Example:

var v []struct {
	CreateTime time.Time `json:"create_time,omitempty"`
}

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

func (*MessageQuery) Where

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

Where adds a new predicate for the builder.

func (*MessageQuery) WithDialog

func (mq *MessageQuery) WithDialog(opts ...func(*DialogQuery)) *MessageQuery
WithDialog tells the query-builder to eager-loads the nodes that are connected to

the "dialog" edge. The optional arguments used to configure the query builder of the edge.

type MessageSelect

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

MessageSelect is the builder for select fields of Message entities.

func (*MessageSelect) Bool

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

Bool returns a single bool from 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 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 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 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 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 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 scan 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 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 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) ClearAttachment

func (mu *MessageUpdate) ClearAttachment() *MessageUpdate

ClearAttachment clears the value of attachment.

func (*MessageUpdate) ClearDialog

func (mu *MessageUpdate) ClearDialog() *MessageUpdate

ClearDialog clears the dialog edge to Dialog.

func (*MessageUpdate) ClearError

func (mu *MessageUpdate) ClearError() *MessageUpdate

ClearError clears the value of error.

func (*MessageUpdate) ClearPayloadType

func (mu *MessageUpdate) ClearPayloadType() *MessageUpdate

ClearPayloadType clears the value of payload_type.

func (*MessageUpdate) ClearPayloadValue

func (mu *MessageUpdate) ClearPayloadValue() *MessageUpdate

ClearPayloadValue clears the value of payload_value.

func (*MessageUpdate) ClearText

func (mu *MessageUpdate) ClearText() *MessageUpdate

ClearText clears the value of text.

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 rows/vertices matched by this operation.

func (*MessageUpdate) SaveX

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

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

func (*MessageUpdate) SetAttachment

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

SetAttachment sets the attachment field.

func (*MessageUpdate) SetDialog

func (mu *MessageUpdate) SetDialog(d *Dialog) *MessageUpdate

SetDialog sets the dialog edge to Dialog.

func (*MessageUpdate) SetDialogID

func (mu *MessageUpdate) SetDialogID(id int) *MessageUpdate

SetDialogID sets the dialog edge to Dialog by id.

func (*MessageUpdate) SetDirection

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

SetDirection sets the direction field.

func (*MessageUpdate) SetError

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

SetError sets the error field.

func (*MessageUpdate) SetNillableAttachment

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

SetNillableAttachment sets the attachment field if the given value is not nil.

func (*MessageUpdate) SetNillableError

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

SetNillableError sets the error field if the given value is not nil.

func (*MessageUpdate) SetNillablePayloadType

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

SetNillablePayloadType sets the payload_type field if the given value is not nil.

func (*MessageUpdate) SetNillablePayloadValue

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

SetNillablePayloadValue sets the payload_value field if the given value is not nil.

func (*MessageUpdate) SetNillableText

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

SetNillableText sets the text field if the given value is not nil.

func (*MessageUpdate) SetPayloadType

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

SetPayloadType sets the payload_type field.

func (*MessageUpdate) SetPayloadValue

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

SetPayloadValue sets the payload_value field.

func (*MessageUpdate) SetProactive

func (mu *MessageUpdate) SetProactive(b bool) *MessageUpdate

SetProactive sets the proactive field.

func (*MessageUpdate) SetSystem

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

SetSystem sets the system field.

func (*MessageUpdate) SetText

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

SetText sets the text field.

func (*MessageUpdate) Where

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

Where adds a new predicate for the builder.

type MessageUpdateOne

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

MessageUpdateOne is the builder for updating a single Message entity.

func (*MessageUpdateOne) ClearAttachment

func (muo *MessageUpdateOne) ClearAttachment() *MessageUpdateOne

ClearAttachment clears the value of attachment.

func (*MessageUpdateOne) ClearDialog

func (muo *MessageUpdateOne) ClearDialog() *MessageUpdateOne

ClearDialog clears the dialog edge to Dialog.

func (*MessageUpdateOne) ClearError

func (muo *MessageUpdateOne) ClearError() *MessageUpdateOne

ClearError clears the value of error.

func (*MessageUpdateOne) ClearPayloadType

func (muo *MessageUpdateOne) ClearPayloadType() *MessageUpdateOne

ClearPayloadType clears the value of payload_type.

func (*MessageUpdateOne) ClearPayloadValue

func (muo *MessageUpdateOne) ClearPayloadValue() *MessageUpdateOne

ClearPayloadValue clears the value of payload_value.

func (*MessageUpdateOne) ClearText

func (muo *MessageUpdateOne) ClearText() *MessageUpdateOne

ClearText clears the value of text.

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 entity.

func (*MessageUpdateOne) SaveX

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

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

func (*MessageUpdateOne) SetAttachment

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

SetAttachment sets the attachment field.

func (*MessageUpdateOne) SetDialog

func (muo *MessageUpdateOne) SetDialog(d *Dialog) *MessageUpdateOne

SetDialog sets the dialog edge to Dialog.

func (*MessageUpdateOne) SetDialogID

func (muo *MessageUpdateOne) SetDialogID(id int) *MessageUpdateOne

SetDialogID sets the dialog edge to Dialog by id.

func (*MessageUpdateOne) SetDirection

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

SetDirection sets the direction field.

func (*MessageUpdateOne) SetError

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

SetError sets the error field.

func (*MessageUpdateOne) SetNillableAttachment

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

SetNillableAttachment sets the attachment field if the given value is not nil.

func (*MessageUpdateOne) SetNillableError

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

SetNillableError sets the error field if the given value is not nil.

func (*MessageUpdateOne) SetNillablePayloadType

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

SetNillablePayloadType sets the payload_type field if the given value is not nil.

func (*MessageUpdateOne) SetNillablePayloadValue

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

SetNillablePayloadValue sets the payload_value field if the given value is not nil.

func (*MessageUpdateOne) SetNillableText

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

SetNillableText sets the text field if the given value is not nil.

func (*MessageUpdateOne) SetPayloadType

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

SetPayloadType sets the payload_type field.

func (*MessageUpdateOne) SetPayloadValue

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

SetPayloadValue sets the payload_value field.

func (*MessageUpdateOne) SetProactive

func (muo *MessageUpdateOne) SetProactive(b bool) *MessageUpdateOne

SetProactive sets the proactive field.

func (*MessageUpdateOne) SetSystem

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

SetSystem sets the system field.

func (*MessageUpdateOne) SetText

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

SetText sets the text field.

type Messages

type Messages []*Message

Messages is a parsable slice of Message.

type MutateFunc

type MutateFunc = ent.MutateFunc

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

type Mutation

type Mutation = ent.Mutation

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

type Mutator

type Mutator = ent.Mutator

ent aliases to avoid import conflict 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 conflict 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 either graph traversal or 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 conflict in user's code.

type Project

type Project struct {

	// ID of the ent.
	ID int `json:"id,omitempty"`
	// CreateTime holds the value of the "create_time" field.
	CreateTime time.Time `json:"create_time,omitempty"`
	// UpdateTime holds the value of the "update_time" field.
	UpdateTime time.Time `json:"update_time,omitempty"`
	// Title holds the value of the "title" field.
	Title string `json:"title,omitempty"`
	// DueDate holds the value of the "due_date" field.
	DueDate time.Time `json:"due_date,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the ProjectQuery when eager-loading is set.
	Edges ProjectEdges `json:"edges"`
	// contains filtered or unexported fields
}

Project is the model entity for the Project schema.

func (*Project) QueryUser

func (pr *Project) QueryUser() *UserQuery

QueryUser queries the user edge of the Project.

func (*Project) String

func (pr *Project) String() string

String implements the fmt.Stringer.

func (*Project) Unwrap

func (pr *Project) Unwrap() *Project

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

func (*Project) Update

func (pr *Project) Update() *ProjectUpdateOne

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

type ProjectClient

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

ProjectClient is a client for the Project schema.

func NewProjectClient

func NewProjectClient(c config) *ProjectClient

NewProjectClient returns a client for the Project from the given config.

func (*ProjectClient) Create

func (c *ProjectClient) Create() *ProjectCreate

Create returns a create builder for Project.

func (*ProjectClient) CreateBulk

func (c *ProjectClient) CreateBulk(builders ...*ProjectCreate) *ProjectCreateBulk

BulkCreate returns a builder for creating a bulk of Project entities.

func (*ProjectClient) Delete

func (c *ProjectClient) Delete() *ProjectDelete

Delete returns a delete builder for Project.

func (*ProjectClient) DeleteOne

func (c *ProjectClient) DeleteOne(pr *Project) *ProjectDeleteOne

DeleteOne returns a delete builder for the given entity.

func (*ProjectClient) DeleteOneID

func (c *ProjectClient) DeleteOneID(id int) *ProjectDeleteOne

DeleteOneID returns a delete builder for the given id.

func (*ProjectClient) Get

func (c *ProjectClient) Get(ctx context.Context, id int) (*Project, error)

Get returns a Project entity by its id.

func (*ProjectClient) GetX

func (c *ProjectClient) GetX(ctx context.Context, id int) *Project

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

func (*ProjectClient) Hooks

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

Hooks returns the client hooks.

func (*ProjectClient) Query

func (c *ProjectClient) Query() *ProjectQuery

Query returns a query builder for Project.

func (*ProjectClient) QueryUser

func (c *ProjectClient) QueryUser(pr *Project) *UserQuery

QueryUser queries the user edge of a Project.

func (*ProjectClient) Update

func (c *ProjectClient) Update() *ProjectUpdate

Update returns an update builder for Project.

func (*ProjectClient) UpdateOne

func (c *ProjectClient) UpdateOne(pr *Project) *ProjectUpdateOne

UpdateOne returns an update builder for the given entity.

func (*ProjectClient) UpdateOneID

func (c *ProjectClient) UpdateOneID(id int) *ProjectUpdateOne

UpdateOneID returns an update builder for the given id.

func (*ProjectClient) Use

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

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

type ProjectCreate

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

ProjectCreate is the builder for creating a Project entity.

func (*ProjectCreate) Mutation

func (pc *ProjectCreate) Mutation() *ProjectMutation

Mutation returns the ProjectMutation object of the builder.

func (*ProjectCreate) Save

func (pc *ProjectCreate) Save(ctx context.Context) (*Project, error)

Save creates the Project in the database.

func (*ProjectCreate) SaveX

func (pc *ProjectCreate) SaveX(ctx context.Context) *Project

SaveX calls Save and panics if Save returns an error.

func (*ProjectCreate) SetCreateTime

func (pc *ProjectCreate) SetCreateTime(t time.Time) *ProjectCreate

SetCreateTime sets the create_time field.

func (*ProjectCreate) SetDueDate

func (pc *ProjectCreate) SetDueDate(t time.Time) *ProjectCreate

SetDueDate sets the due_date field.

func (*ProjectCreate) SetNillableCreateTime

func (pc *ProjectCreate) SetNillableCreateTime(t *time.Time) *ProjectCreate

SetNillableCreateTime sets the create_time field if the given value is not nil.

func (*ProjectCreate) SetNillableUpdateTime

func (pc *ProjectCreate) SetNillableUpdateTime(t *time.Time) *ProjectCreate

SetNillableUpdateTime sets the update_time field if the given value is not nil.

func (*ProjectCreate) SetTitle

func (pc *ProjectCreate) SetTitle(s string) *ProjectCreate

SetTitle sets the title field.

func (*ProjectCreate) SetUpdateTime

func (pc *ProjectCreate) SetUpdateTime(t time.Time) *ProjectCreate

SetUpdateTime sets the update_time field.

func (*ProjectCreate) SetUser

func (pc *ProjectCreate) SetUser(u *User) *ProjectCreate

SetUser sets the user edge to User.

func (*ProjectCreate) SetUserID

func (pc *ProjectCreate) SetUserID(id int) *ProjectCreate

SetUserID sets the user edge to User by id.

type ProjectCreateBulk

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

ProjectCreateBulk is the builder for creating a bulk of Project entities.

func (*ProjectCreateBulk) Save

func (pcb *ProjectCreateBulk) Save(ctx context.Context) ([]*Project, error)

Save creates the Project entities in the database.

func (*ProjectCreateBulk) SaveX

func (pcb *ProjectCreateBulk) SaveX(ctx context.Context) []*Project

SaveX calls Save and panics if Save returns an error.

type ProjectDelete

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

ProjectDelete is the builder for deleting a Project entity.

func (*ProjectDelete) Exec

func (pd *ProjectDelete) Exec(ctx context.Context) (int, error)

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

func (*ProjectDelete) ExecX

func (pd *ProjectDelete) ExecX(ctx context.Context) int

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

func (*ProjectDelete) Where

func (pd *ProjectDelete) Where(ps ...predicate.Project) *ProjectDelete

Where adds a new predicate to the delete builder.

type ProjectDeleteOne

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

ProjectDeleteOne is the builder for deleting a single Project entity.

func (*ProjectDeleteOne) Exec

func (pdo *ProjectDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*ProjectDeleteOne) ExecX

func (pdo *ProjectDeleteOne) ExecX(ctx context.Context)

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

type ProjectEdges

type ProjectEdges struct {
	// User holds the value of the user edge.
	User *User
	// contains filtered or unexported fields
}

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

func (ProjectEdges) UserOrErr

func (e ProjectEdges) 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 ProjectGroupBy

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

ProjectGroupBy is the builder for group-by Project entities.

func (*ProjectGroupBy) Aggregate

func (pgb *ProjectGroupBy) Aggregate(fns ...AggregateFunc) *ProjectGroupBy

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

func (*ProjectGroupBy) Bool

func (pgb *ProjectGroupBy) Bool(ctx context.Context) (_ bool, err error)

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

func (*ProjectGroupBy) BoolX

func (pgb *ProjectGroupBy) BoolX(ctx context.Context) bool

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

func (*ProjectGroupBy) Bools

func (pgb *ProjectGroupBy) Bools(ctx context.Context) ([]bool, error)

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

func (*ProjectGroupBy) BoolsX

func (pgb *ProjectGroupBy) BoolsX(ctx context.Context) []bool

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

func (*ProjectGroupBy) Float64

func (pgb *ProjectGroupBy) Float64(ctx context.Context) (_ float64, err error)

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

func (*ProjectGroupBy) Float64X

func (pgb *ProjectGroupBy) Float64X(ctx context.Context) float64

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

func (*ProjectGroupBy) Float64s

func (pgb *ProjectGroupBy) Float64s(ctx context.Context) ([]float64, error)

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

func (*ProjectGroupBy) Float64sX

func (pgb *ProjectGroupBy) Float64sX(ctx context.Context) []float64

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

func (*ProjectGroupBy) Int

func (pgb *ProjectGroupBy) Int(ctx context.Context) (_ int, err error)

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

func (*ProjectGroupBy) IntX

func (pgb *ProjectGroupBy) IntX(ctx context.Context) int

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

func (*ProjectGroupBy) Ints

func (pgb *ProjectGroupBy) Ints(ctx context.Context) ([]int, error)

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

func (*ProjectGroupBy) IntsX

func (pgb *ProjectGroupBy) IntsX(ctx context.Context) []int

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

func (*ProjectGroupBy) Scan

func (pgb *ProjectGroupBy) Scan(ctx context.Context, v interface{}) error

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

func (*ProjectGroupBy) ScanX

func (pgb *ProjectGroupBy) ScanX(ctx context.Context, v interface{})

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

func (*ProjectGroupBy) String

func (pgb *ProjectGroupBy) String(ctx context.Context) (_ string, err error)

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

func (*ProjectGroupBy) StringX

func (pgb *ProjectGroupBy) StringX(ctx context.Context) string

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

func (*ProjectGroupBy) Strings

func (pgb *ProjectGroupBy) Strings(ctx context.Context) ([]string, error)

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

func (*ProjectGroupBy) StringsX

func (pgb *ProjectGroupBy) StringsX(ctx context.Context) []string

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

type ProjectMutation

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

ProjectMutation represents an operation that mutate the Projects nodes in the graph.

func (*ProjectMutation) AddField

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

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

func (*ProjectMutation) AddedEdges

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

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

func (*ProjectMutation) AddedField

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

AddedField returns the numeric value that was in/decremented from a field with the given name. The second value indicates that this field was not set, or was not define in the schema.

func (*ProjectMutation) AddedFields

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

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

func (*ProjectMutation) AddedIDs

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

AddedIDs returns all ids (to other nodes) that were added for the given edge name.

func (*ProjectMutation) ClearEdge

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

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

func (*ProjectMutation) ClearField

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

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

func (*ProjectMutation) ClearUser

func (m *ProjectMutation) ClearUser()

ClearUser clears the user edge to User.

func (*ProjectMutation) ClearedEdges

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

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

func (*ProjectMutation) ClearedFields

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

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

func (ProjectMutation) Client

func (m ProjectMutation) 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 (*ProjectMutation) CreateTime

func (m *ProjectMutation) CreateTime() (r time.Time, exists bool)

CreateTime returns the create_time value in the mutation.

func (*ProjectMutation) DueDate

func (m *ProjectMutation) DueDate() (r time.Time, exists bool)

DueDate returns the due_date value in the mutation.

func (*ProjectMutation) EdgeCleared

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

EdgeCleared returns a boolean indicates if this edge was cleared in this mutation.

func (*ProjectMutation) Field

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

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

func (*ProjectMutation) FieldCleared

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

FieldCleared returns a boolean indicates if this field was cleared in this mutation.

func (*ProjectMutation) Fields

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

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

func (*ProjectMutation) ID

func (m *ProjectMutation) ID() (id int, exists bool)

ID returns the id value in the mutation. Note that, the id is available only if it was provided to the builder.

func (*ProjectMutation) OldCreateTime

func (m *ProjectMutation) OldCreateTime(ctx context.Context) (v time.Time, err error)

OldCreateTime returns the old create_time value of the Project. If the Project 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 database query fails.

func (*ProjectMutation) OldDueDate

func (m *ProjectMutation) OldDueDate(ctx context.Context) (v time.Time, err error)

OldDueDate returns the old due_date value of the Project. If the Project 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 database query fails.

func (*ProjectMutation) OldField

func (m *ProjectMutation) 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 was failed.

func (*ProjectMutation) OldTitle

func (m *ProjectMutation) OldTitle(ctx context.Context) (v string, err error)

OldTitle returns the old title value of the Project. If the Project 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 database query fails.

func (*ProjectMutation) OldUpdateTime

func (m *ProjectMutation) OldUpdateTime(ctx context.Context) (v time.Time, err error)

OldUpdateTime returns the old update_time value of the Project. If the Project 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 database query fails.

func (*ProjectMutation) Op

func (m *ProjectMutation) Op() Op

Op returns the operation name.

func (*ProjectMutation) RemovedEdges

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

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

func (*ProjectMutation) RemovedIDs

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

RemovedIDs returns all ids (to other nodes) that were removed for the given edge name.

func (*ProjectMutation) ResetCreateTime

func (m *ProjectMutation) ResetCreateTime()

ResetCreateTime reset all changes of the "create_time" field.

func (*ProjectMutation) ResetDueDate

func (m *ProjectMutation) ResetDueDate()

ResetDueDate reset all changes of the "due_date" field.

func (*ProjectMutation) ResetEdge

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

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

func (*ProjectMutation) ResetField

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

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

func (*ProjectMutation) ResetTitle

func (m *ProjectMutation) ResetTitle()

ResetTitle reset all changes of the "title" field.

func (*ProjectMutation) ResetUpdateTime

func (m *ProjectMutation) ResetUpdateTime()

ResetUpdateTime reset all changes of the "update_time" field.

func (*ProjectMutation) ResetUser

func (m *ProjectMutation) ResetUser()

ResetUser reset all changes of the "user" edge.

func (*ProjectMutation) SetCreateTime

func (m *ProjectMutation) SetCreateTime(t time.Time)

SetCreateTime sets the create_time field.

func (*ProjectMutation) SetDueDate

func (m *ProjectMutation) SetDueDate(t time.Time)

SetDueDate sets the due_date field.

func (*ProjectMutation) SetField

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

SetField sets the value for the given name. It returns an error if the field is not defined in the schema, or if the type mismatch the field type.

func (*ProjectMutation) SetTitle

func (m *ProjectMutation) SetTitle(s string)

SetTitle sets the title field.

func (*ProjectMutation) SetUpdateTime

func (m *ProjectMutation) SetUpdateTime(t time.Time)

SetUpdateTime sets the update_time field.

func (*ProjectMutation) SetUserID

func (m *ProjectMutation) SetUserID(id int)

SetUserID sets the user edge to User by id.

func (*ProjectMutation) Title

func (m *ProjectMutation) Title() (r string, exists bool)

Title returns the title value in the mutation.

func (ProjectMutation) Tx

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

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

func (*ProjectMutation) Type

func (m *ProjectMutation) Type() string

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

func (*ProjectMutation) UpdateTime

func (m *ProjectMutation) UpdateTime() (r time.Time, exists bool)

UpdateTime returns the update_time value in the mutation.

func (*ProjectMutation) UserCleared

func (m *ProjectMutation) UserCleared() bool

UserCleared returns if the edge user was cleared.

func (*ProjectMutation) UserID

func (m *ProjectMutation) UserID() (id int, exists bool)

UserID returns the user id in the mutation.

func (*ProjectMutation) UserIDs

func (m *ProjectMutation) UserIDs() (ids []int)

UserIDs returns the user 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.

type ProjectQuery

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

ProjectQuery is the builder for querying Project entities.

func (*ProjectQuery) All

func (pq *ProjectQuery) All(ctx context.Context) ([]*Project, error)

All executes the query and returns a list of Projects.

func (*ProjectQuery) AllX

func (pq *ProjectQuery) AllX(ctx context.Context) []*Project

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

func (*ProjectQuery) Clone

func (pq *ProjectQuery) Clone() *ProjectQuery

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

func (*ProjectQuery) Count

func (pq *ProjectQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*ProjectQuery) CountX

func (pq *ProjectQuery) CountX(ctx context.Context) int

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

func (*ProjectQuery) Exist

func (pq *ProjectQuery) Exist(ctx context.Context) (bool, error)

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

func (*ProjectQuery) ExistX

func (pq *ProjectQuery) ExistX(ctx context.Context) bool

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

func (*ProjectQuery) First

func (pq *ProjectQuery) First(ctx context.Context) (*Project, error)

First returns the first Project entity in the query. Returns *NotFoundError when no project was found.

func (*ProjectQuery) FirstID

func (pq *ProjectQuery) FirstID(ctx context.Context) (id int, err error)

FirstID returns the first Project id in the query. Returns *NotFoundError when no id was found.

func (*ProjectQuery) FirstX

func (pq *ProjectQuery) FirstX(ctx context.Context) *Project

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

func (*ProjectQuery) FirstXID

func (pq *ProjectQuery) FirstXID(ctx context.Context) int

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

func (*ProjectQuery) GroupBy

func (pq *ProjectQuery) GroupBy(field string, fields ...string) *ProjectGroupBy

GroupBy 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 {
	CreateTime time.Time `json:"create_time,omitempty"`
	Count int `json:"count,omitempty"`
}

client.Project.Query().
	GroupBy(project.FieldCreateTime).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*ProjectQuery) IDs

func (pq *ProjectQuery) IDs(ctx context.Context) ([]int, error)

IDs executes the query and returns a list of Project ids.

func (*ProjectQuery) IDsX

func (pq *ProjectQuery) IDsX(ctx context.Context) []int

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

func (*ProjectQuery) Limit

func (pq *ProjectQuery) Limit(limit int) *ProjectQuery

Limit adds a limit step to the query.

func (*ProjectQuery) Offset

func (pq *ProjectQuery) Offset(offset int) *ProjectQuery

Offset adds an offset step to the query.

func (*ProjectQuery) Only

func (pq *ProjectQuery) Only(ctx context.Context) (*Project, error)

Only returns the only Project entity in the query, returns an error if not exactly one entity was returned.

func (*ProjectQuery) OnlyID

func (pq *ProjectQuery) OnlyID(ctx context.Context) (id int, err error)

OnlyID returns the only Project id in the query, returns an error if not exactly one id was returned.

func (*ProjectQuery) OnlyIDX

func (pq *ProjectQuery) OnlyIDX(ctx context.Context) int

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

func (*ProjectQuery) OnlyX

func (pq *ProjectQuery) OnlyX(ctx context.Context) *Project

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

func (*ProjectQuery) Order

func (pq *ProjectQuery) Order(o ...OrderFunc) *ProjectQuery

Order adds an order step to the query.

func (*ProjectQuery) QueryUser

func (pq *ProjectQuery) QueryUser() *UserQuery

QueryUser chains the current query on the user edge.

func (*ProjectQuery) Select

func (pq *ProjectQuery) Select(field string, fields ...string) *ProjectSelect

Select one or more fields from the given query.

Example:

var v []struct {
	CreateTime time.Time `json:"create_time,omitempty"`
}

client.Project.Query().
	Select(project.FieldCreateTime).
	Scan(ctx, &v)

func (*ProjectQuery) Where

func (pq *ProjectQuery) Where(ps ...predicate.Project) *ProjectQuery

Where adds a new predicate for the builder.

func (*ProjectQuery) WithUser

func (pq *ProjectQuery) WithUser(opts ...func(*UserQuery)) *ProjectQuery
WithUser tells the query-builder to eager-loads the nodes that are connected to

the "user" edge. The optional arguments used to configure the query builder of the edge.

type ProjectSelect

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

ProjectSelect is the builder for select fields of Project entities.

func (*ProjectSelect) Bool

func (ps *ProjectSelect) Bool(ctx context.Context) (_ bool, err error)

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

func (*ProjectSelect) BoolX

func (ps *ProjectSelect) BoolX(ctx context.Context) bool

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

func (*ProjectSelect) Bools

func (ps *ProjectSelect) Bools(ctx context.Context) ([]bool, error)

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

func (*ProjectSelect) BoolsX

func (ps *ProjectSelect) BoolsX(ctx context.Context) []bool

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

func (*ProjectSelect) Float64

func (ps *ProjectSelect) Float64(ctx context.Context) (_ float64, err error)

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

func (*ProjectSelect) Float64X

func (ps *ProjectSelect) Float64X(ctx context.Context) float64

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

func (*ProjectSelect) Float64s

func (ps *ProjectSelect) Float64s(ctx context.Context) ([]float64, error)

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

func (*ProjectSelect) Float64sX

func (ps *ProjectSelect) Float64sX(ctx context.Context) []float64

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

func (*ProjectSelect) Int

func (ps *ProjectSelect) Int(ctx context.Context) (_ int, err error)

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

func (*ProjectSelect) IntX

func (ps *ProjectSelect) IntX(ctx context.Context) int

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

func (*ProjectSelect) Ints

func (ps *ProjectSelect) Ints(ctx context.Context) ([]int, error)

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

func (*ProjectSelect) IntsX

func (ps *ProjectSelect) IntsX(ctx context.Context) []int

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

func (*ProjectSelect) Scan

func (ps *ProjectSelect) Scan(ctx context.Context, v interface{}) error

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

func (*ProjectSelect) ScanX

func (ps *ProjectSelect) ScanX(ctx context.Context, v interface{})

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

func (*ProjectSelect) String

func (ps *ProjectSelect) String(ctx context.Context) (_ string, err error)

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

func (*ProjectSelect) StringX

func (ps *ProjectSelect) StringX(ctx context.Context) string

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

func (*ProjectSelect) Strings

func (ps *ProjectSelect) Strings(ctx context.Context) ([]string, error)

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

func (*ProjectSelect) StringsX

func (ps *ProjectSelect) StringsX(ctx context.Context) []string

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

type ProjectUpdate

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

ProjectUpdate is the builder for updating Project entities.

func (*ProjectUpdate) ClearUser

func (pu *ProjectUpdate) ClearUser() *ProjectUpdate

ClearUser clears the user edge to User.

func (*ProjectUpdate) Exec

func (pu *ProjectUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*ProjectUpdate) ExecX

func (pu *ProjectUpdate) ExecX(ctx context.Context)

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

func (*ProjectUpdate) Mutation

func (pu *ProjectUpdate) Mutation() *ProjectMutation

Mutation returns the ProjectMutation object of the builder.

func (*ProjectUpdate) Save

func (pu *ProjectUpdate) Save(ctx context.Context) (int, error)

Save executes the query and returns the number of rows/vertices matched by this operation.

func (*ProjectUpdate) SaveX

func (pu *ProjectUpdate) SaveX(ctx context.Context) int

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

func (*ProjectUpdate) SetDueDate

func (pu *ProjectUpdate) SetDueDate(t time.Time) *ProjectUpdate

SetDueDate sets the due_date field.

func (*ProjectUpdate) SetTitle

func (pu *ProjectUpdate) SetTitle(s string) *ProjectUpdate

SetTitle sets the title field.

func (*ProjectUpdate) SetUser

func (pu *ProjectUpdate) SetUser(u *User) *ProjectUpdate

SetUser sets the user edge to User.

func (*ProjectUpdate) SetUserID

func (pu *ProjectUpdate) SetUserID(id int) *ProjectUpdate

SetUserID sets the user edge to User by id.

func (*ProjectUpdate) Where

func (pu *ProjectUpdate) Where(ps ...predicate.Project) *ProjectUpdate

Where adds a new predicate for the builder.

type ProjectUpdateOne

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

ProjectUpdateOne is the builder for updating a single Project entity.

func (*ProjectUpdateOne) ClearUser

func (puo *ProjectUpdateOne) ClearUser() *ProjectUpdateOne

ClearUser clears the user edge to User.

func (*ProjectUpdateOne) Exec

func (puo *ProjectUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*ProjectUpdateOne) ExecX

func (puo *ProjectUpdateOne) ExecX(ctx context.Context)

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

func (*ProjectUpdateOne) Mutation

func (puo *ProjectUpdateOne) Mutation() *ProjectMutation

Mutation returns the ProjectMutation object of the builder.

func (*ProjectUpdateOne) Save

func (puo *ProjectUpdateOne) Save(ctx context.Context) (*Project, error)

Save executes the query and returns the updated entity.

func (*ProjectUpdateOne) SaveX

func (puo *ProjectUpdateOne) SaveX(ctx context.Context) *Project

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

func (*ProjectUpdateOne) SetDueDate

func (puo *ProjectUpdateOne) SetDueDate(t time.Time) *ProjectUpdateOne

SetDueDate sets the due_date field.

func (*ProjectUpdateOne) SetTitle

func (puo *ProjectUpdateOne) SetTitle(s string) *ProjectUpdateOne

SetTitle sets the title field.

func (*ProjectUpdateOne) SetUser

func (puo *ProjectUpdateOne) SetUser(u *User) *ProjectUpdateOne

SetUser sets the user edge to User.

func (*ProjectUpdateOne) SetUserID

func (puo *ProjectUpdateOne) SetUserID(id int) *ProjectUpdateOne

SetUserID sets the user edge to User by id.

type Projects

type Projects []*Project

Projects is a parsable slice of Project.

type Query

type Query = ent.Query

ent aliases to avoid import conflict 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(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 Rollbacker method.

type Tx

type Tx struct {

	// Dialog is the client for interacting with the Dialog builders.
	Dialog *DialogClient
	// Message is the client for interacting with the Message builders.
	Message *MessageClient
	// Project is the client for interacting with the Project builders.
	Project *ProjectClient
	// User is the client for interacting with the User builders.
	User *UserClient
	// 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 the Tx stored in 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 int `json:"id,omitempty"`
	// CreateTime holds the value of the "create_time" field.
	CreateTime time.Time `json:"create_time,omitempty"`
	// UpdateTime holds the value of the "update_time" field.
	UpdateTime time.Time `json:"update_time,omitempty"`
	// Username holds the value of the "username" field.
	Username string `json:"username,omitempty"`
	// DisplayName holds the value of the "display_name" field.
	DisplayName string `json:"display_name,omitempty"`
	// Email holds the value of the "email" field.
	Email *string `json:"email,omitempty"`
	// PasswordHash holds the value of the "password_hash" field.
	PasswordHash string `json:"password_hash,omitempty"`
	// Service holds the value of the "service" field.
	Service bool `json:"service,omitempty"`
	// TeamsID holds the value of the "teams_id" field.
	TeamsID *string `json:"teams_id,omitempty"`
	// TelegramID holds the value of the "telegram_id" field.
	TelegramID *string `json:"telegram_id,omitempty"`
	// SlackID holds the value of the "slack_id" field.
	SlackID *string `json:"slack_id,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) QueryDialog

func (u *User) QueryDialog() *DialogQuery

QueryDialog queries the dialog edge of the User.

func (*User) QueryProjects

func (u *User) QueryProjects() *ProjectQuery

QueryProjects queries the projects edge of the User.

func (*User) String

func (u *User) String() string

String implements the fmt.Stringer.

func (*User) Unwrap

func (u *User) Unwrap() *User

Unwrap unwraps the entity that was returned from a transaction after it was closed, so that all next 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

BulkCreate 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 int) *UserDeleteOne

DeleteOneID returns a delete builder for the given id.

func (*UserClient) Get

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

Get returns a User entity by its id.

func (*UserClient) GetX

func (c *UserClient) GetX(ctx context.Context, id int) *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) QueryDialog

func (c *UserClient) QueryDialog(u *User) *DialogQuery

QueryDialog queries the dialog edge of a User.

func (*UserClient) QueryProjects

func (c *UserClient) QueryProjects(u *User) *ProjectQuery

QueryProjects queries the projects 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 int) *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) AddProjectIDs

func (uc *UserCreate) AddProjectIDs(ids ...int) *UserCreate

AddProjectIDs adds the projects edge to Project by ids.

func (*UserCreate) AddProjects

func (uc *UserCreate) AddProjects(p ...*Project) *UserCreate

AddProjects adds the projects edges to Project.

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

func (uc *UserCreate) SetCreateTime(t time.Time) *UserCreate

SetCreateTime sets the create_time field.

func (*UserCreate) SetDialog

func (uc *UserCreate) SetDialog(d *Dialog) *UserCreate

SetDialog sets the dialog edge to Dialog.

func (*UserCreate) SetDialogID

func (uc *UserCreate) SetDialogID(id int) *UserCreate

SetDialogID sets the dialog edge to Dialog by id.

func (*UserCreate) SetDisplayName

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

SetDisplayName sets the display_name field.

func (*UserCreate) SetEmail

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

SetEmail sets the email field.

func (*UserCreate) SetNillableCreateTime

func (uc *UserCreate) SetNillableCreateTime(t *time.Time) *UserCreate

SetNillableCreateTime sets the create_time field if the given value is not nil.

func (*UserCreate) SetNillableDialogID

func (uc *UserCreate) SetNillableDialogID(id *int) *UserCreate

SetNillableDialogID sets the dialog edge to Dialog by id if the given value is not nil.

func (*UserCreate) SetNillableDisplayName

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

SetNillableDisplayName sets the display_name field if the given value is not nil.

func (*UserCreate) SetNillableEmail

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

SetNillableEmail sets the email field if the given value is not nil.

func (*UserCreate) SetNillableService

func (uc *UserCreate) SetNillableService(b *bool) *UserCreate

SetNillableService sets the service field if the given value is not nil.

func (*UserCreate) SetNillableSlackID

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

SetNillableSlackID sets the slack_id field if the given value is not nil.

func (*UserCreate) SetNillableTeamsID

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

SetNillableTeamsID sets the teams_id field if the given value is not nil.

func (*UserCreate) SetNillableTelegramID

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

SetNillableTelegramID sets the telegram_id field if the given value is not nil.

func (*UserCreate) SetNillableUpdateTime

func (uc *UserCreate) SetNillableUpdateTime(t *time.Time) *UserCreate

SetNillableUpdateTime sets the update_time field if the given value is not nil.

func (*UserCreate) SetPasswordHash

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

SetPasswordHash sets the password_hash field.

func (*UserCreate) SetService

func (uc *UserCreate) SetService(b bool) *UserCreate

SetService sets the service field.

func (*UserCreate) SetSlackID

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

SetSlackID sets the slack_id field.

func (*UserCreate) SetTeamsID

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

SetTeamsID sets the teams_id field.

func (*UserCreate) SetTelegramID

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

SetTelegramID sets the telegram_id field.

func (*UserCreate) SetUpdateTime

func (uc *UserCreate) SetUpdateTime(t time.Time) *UserCreate

SetUpdateTime sets the update_time field.

func (*UserCreate) SetUsername

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

SetUsername sets the username field.

type UserCreateBulk

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

UserCreateBulk is the builder for creating a bulk of User entities.

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 calls Save and panics if Save returns an error.

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 adds a new predicate to the delete 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 {
	// Dialog holds the value of the dialog edge.
	Dialog *Dialog
	// Projects holds the value of the projects edge.
	Projects []*Project
	// contains filtered or unexported fields
}

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

func (UserEdges) DialogOrErr

func (e UserEdges) DialogOrErr() (*Dialog, error)

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

func (UserEdges) ProjectsOrErr

func (e UserEdges) ProjectsOrErr() ([]*Project, error)

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

type UserGroupBy

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

UserGroupBy is the builder for group-by 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 group-by. It is only allowed when querying group-by 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 querying group-by 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 group-by. It is only allowed when querying group-by 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 querying group-by 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 group-by. It is only allowed when querying group-by 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 querying group-by 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 scan 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 group-by. It is only allowed when querying group-by 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 querying group-by 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 UserMutation

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

UserMutation represents an operation that mutate the Users nodes in the graph.

func (*UserMutation) AddField

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

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

func (*UserMutation) AddProjectIDs

func (m *UserMutation) AddProjectIDs(ids ...int)

AddProjectIDs adds the projects edge to Project 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 in/decremented from a field with the given name. The second value indicates that this field was not set, or was not define in the schema.

func (*UserMutation) AddedFields

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

AddedFields returns all numeric fields that were incremented or 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.

func (*UserMutation) ClearDialog

func (m *UserMutation) ClearDialog()

ClearDialog clears the dialog edge to Dialog.

func (*UserMutation) ClearDisplayName

func (m *UserMutation) ClearDisplayName()

ClearDisplayName clears the value of display_name.

func (*UserMutation) ClearEdge

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

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

func (*UserMutation) ClearEmail

func (m *UserMutation) ClearEmail()

ClearEmail clears the value of email.

func (*UserMutation) ClearField

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

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

func (*UserMutation) ClearSlackID

func (m *UserMutation) ClearSlackID()

ClearSlackID clears the value of slack_id.

func (*UserMutation) ClearTeamsID

func (m *UserMutation) ClearTeamsID()

ClearTeamsID clears the value of teams_id.

func (*UserMutation) ClearTelegramID

func (m *UserMutation) ClearTelegramID()

ClearTelegramID clears the value of telegram_id.

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

func (m *UserMutation) CreateTime() (r time.Time, exists bool)

CreateTime returns the create_time value in the mutation.

func (*UserMutation) DialogCleared

func (m *UserMutation) DialogCleared() bool

DialogCleared returns if the edge dialog was cleared.

func (*UserMutation) DialogID

func (m *UserMutation) DialogID() (id int, exists bool)

DialogID returns the dialog id in the mutation.

func (*UserMutation) DialogIDs

func (m *UserMutation) DialogIDs() (ids []int)

DialogIDs returns the dialog ids in the mutation. Note that ids always returns len(ids) <= 1 for unique edges, and you should use DialogID instead. It exists only for internal usage by the builders.

func (*UserMutation) DisplayName

func (m *UserMutation) DisplayName() (r string, exists bool)

DisplayName returns the display_name value in the mutation.

func (*UserMutation) DisplayNameCleared

func (m *UserMutation) DisplayNameCleared() bool

DisplayNameCleared returns if the field display_name was cleared in this mutation.

func (*UserMutation) EdgeCleared

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

EdgeCleared returns a boolean indicates if this edge was cleared in this mutation.

func (*UserMutation) Email

func (m *UserMutation) Email() (r string, exists bool)

Email returns the email value in the mutation.

func (*UserMutation) EmailCleared

func (m *UserMutation) EmailCleared() bool

EmailCleared returns if the field email was cleared in this 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 value indicates that this field was not set, or was not define in the schema.

func (*UserMutation) FieldCleared

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

FieldCleared returns a boolean indicates if this field 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 in/decremented, call AddedFields().

func (*UserMutation) ID

func (m *UserMutation) ID() (id int, exists bool)

ID returns the id value in the mutation. Note that, the id is available only if it was provided to the builder.

func (*UserMutation) OldCreateTime

func (m *UserMutation) OldCreateTime(ctx context.Context) (v time.Time, err error)

OldCreateTime returns the old create_time value of the User. 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 database query fails.

func (*UserMutation) OldDisplayName

func (m *UserMutation) OldDisplayName(ctx context.Context) (v string, err error)

OldDisplayName returns the old display_name value of the User. 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 database query fails.

func (*UserMutation) OldEmail

func (m *UserMutation) OldEmail(ctx context.Context) (v *string, err error)

OldEmail returns the old email value of the User. 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 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 was failed.

func (*UserMutation) OldPasswordHash

func (m *UserMutation) OldPasswordHash(ctx context.Context) (v string, err error)

OldPasswordHash returns the old password_hash value of the User. 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 database query fails.

func (*UserMutation) OldService

func (m *UserMutation) OldService(ctx context.Context) (v bool, err error)

OldService returns the old service value of the User. 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 database query fails.

func (*UserMutation) OldSlackID

func (m *UserMutation) OldSlackID(ctx context.Context) (v *string, err error)

OldSlackID returns the old slack_id value of the User. 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 database query fails.

func (*UserMutation) OldTeamsID

func (m *UserMutation) OldTeamsID(ctx context.Context) (v *string, err error)

OldTeamsID returns the old teams_id value of the User. 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 database query fails.

func (*UserMutation) OldTelegramID

func (m *UserMutation) OldTelegramID(ctx context.Context) (v *string, err error)

OldTelegramID returns the old telegram_id value of the User. 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 database query fails.

func (*UserMutation) OldUpdateTime

func (m *UserMutation) OldUpdateTime(ctx context.Context) (v time.Time, err error)

OldUpdateTime returns the old update_time value of the User. 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 database query fails.

func (*UserMutation) OldUsername

func (m *UserMutation) OldUsername(ctx context.Context) (v string, err error)

OldUsername returns the old username value of the User. 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 database query fails.

func (*UserMutation) Op

func (m *UserMutation) Op() Op

Op returns the operation name.

func (*UserMutation) PasswordHash

func (m *UserMutation) PasswordHash() (r string, exists bool)

PasswordHash returns the password_hash value in the mutation.

func (*UserMutation) ProjectsIDs

func (m *UserMutation) ProjectsIDs() (ids []int)

ProjectsIDs returns the projects ids in the mutation.

func (*UserMutation) RemoveProjectIDs

func (m *UserMutation) RemoveProjectIDs(ids ...int)

RemoveProjectIDs removes the projects edge to Project 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 given edge name.

func (*UserMutation) RemovedProjectsIDs

func (m *UserMutation) RemovedProjectsIDs() (ids []int)

RemovedProjects returns the removed ids of projects.

func (*UserMutation) ResetCreateTime

func (m *UserMutation) ResetCreateTime()

ResetCreateTime reset all changes of the "create_time" field.

func (*UserMutation) ResetDialog

func (m *UserMutation) ResetDialog()

ResetDialog reset all changes of the "dialog" edge.

func (*UserMutation) ResetDisplayName

func (m *UserMutation) ResetDisplayName()

ResetDisplayName reset all changes of the "display_name" field.

func (*UserMutation) ResetEdge

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

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

func (*UserMutation) ResetEmail

func (m *UserMutation) ResetEmail()

ResetEmail reset all changes of the "email" field.

func (*UserMutation) ResetField

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

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

func (*UserMutation) ResetPasswordHash

func (m *UserMutation) ResetPasswordHash()

ResetPasswordHash reset all changes of the "password_hash" field.

func (*UserMutation) ResetProjects

func (m *UserMutation) ResetProjects()

ResetProjects reset all changes of the "projects" edge.

func (*UserMutation) ResetService

func (m *UserMutation) ResetService()

ResetService reset all changes of the "service" field.

func (*UserMutation) ResetSlackID

func (m *UserMutation) ResetSlackID()

ResetSlackID reset all changes of the "slack_id" field.

func (*UserMutation) ResetTeamsID

func (m *UserMutation) ResetTeamsID()

ResetTeamsID reset all changes of the "teams_id" field.

func (*UserMutation) ResetTelegramID

func (m *UserMutation) ResetTelegramID()

ResetTelegramID reset all changes of the "telegram_id" field.

func (*UserMutation) ResetUpdateTime

func (m *UserMutation) ResetUpdateTime()

ResetUpdateTime reset all changes of the "update_time" field.

func (*UserMutation) ResetUsername

func (m *UserMutation) ResetUsername()

ResetUsername reset all changes of the "username" field.

func (*UserMutation) Service

func (m *UserMutation) Service() (r bool, exists bool)

Service returns the service value in the mutation.

func (*UserMutation) SetCreateTime

func (m *UserMutation) SetCreateTime(t time.Time)

SetCreateTime sets the create_time field.

func (*UserMutation) SetDialogID

func (m *UserMutation) SetDialogID(id int)

SetDialogID sets the dialog edge to Dialog by id.

func (*UserMutation) SetDisplayName

func (m *UserMutation) SetDisplayName(s string)

SetDisplayName sets the display_name field.

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 for the given name. It returns an error if the field is not defined in the schema, or if the type mismatch the field type.

func (*UserMutation) SetPasswordHash

func (m *UserMutation) SetPasswordHash(s string)

SetPasswordHash sets the password_hash field.

func (*UserMutation) SetService

func (m *UserMutation) SetService(b bool)

SetService sets the service field.

func (*UserMutation) SetSlackID

func (m *UserMutation) SetSlackID(s string)

SetSlackID sets the slack_id field.

func (*UserMutation) SetTeamsID

func (m *UserMutation) SetTeamsID(s string)

SetTeamsID sets the teams_id field.

func (*UserMutation) SetTelegramID

func (m *UserMutation) SetTelegramID(s string)

SetTelegramID sets the telegram_id field.

func (*UserMutation) SetUpdateTime

func (m *UserMutation) SetUpdateTime(t time.Time)

SetUpdateTime sets the update_time field.

func (*UserMutation) SetUsername

func (m *UserMutation) SetUsername(s string)

SetUsername sets the username field.

func (*UserMutation) SlackID

func (m *UserMutation) SlackID() (r string, exists bool)

SlackID returns the slack_id value in the mutation.

func (*UserMutation) SlackIDCleared

func (m *UserMutation) SlackIDCleared() bool

SlackIDCleared returns if the field slack_id was cleared in this mutation.

func (*UserMutation) TeamsID

func (m *UserMutation) TeamsID() (r string, exists bool)

TeamsID returns the teams_id value in the mutation.

func (*UserMutation) TeamsIDCleared

func (m *UserMutation) TeamsIDCleared() bool

TeamsIDCleared returns if the field teams_id was cleared in this mutation.

func (*UserMutation) TelegramID

func (m *UserMutation) TelegramID() (r string, exists bool)

TelegramID returns the telegram_id value in the mutation.

func (*UserMutation) TelegramIDCleared

func (m *UserMutation) TelegramIDCleared() bool

TelegramIDCleared returns if the field telegram_id was cleared in this mutation.

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

func (m *UserMutation) UpdateTime() (r time.Time, exists bool)

UpdateTime returns the update_time value in the mutation.

func (*UserMutation) Username

func (m *UserMutation) Username() (r string, exists bool)

Username returns the username value in the mutation.

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 query 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 in the query. Returns *NotFoundError when no user was found.

func (*UserQuery) FirstID

func (uq *UserQuery) FirstID(ctx context.Context) (id int, err error)

FirstID returns the first User id in the query. Returns *NotFoundError when no id was found.

func (*UserQuery) FirstX

func (uq *UserQuery) FirstX(ctx context.Context) *User

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

func (*UserQuery) FirstXID

func (uq *UserQuery) FirstXID(ctx context.Context) int

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

func (*UserQuery) GroupBy

func (uq *UserQuery) GroupBy(field string, fields ...string) *UserGroupBy

GroupBy 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 {
	CreateTime time.Time `json:"create_time,omitempty"`
	Count int `json:"count,omitempty"`
}

client.User.Query().
	GroupBy(user.FieldCreateTime).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*UserQuery) IDs

func (uq *UserQuery) IDs(ctx context.Context) ([]int, error)

IDs executes the query and returns a list of User ids.

func (*UserQuery) IDsX

func (uq *UserQuery) IDsX(ctx context.Context) []int

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 the only User entity in the query, returns an error if not exactly one entity was returned.

func (*UserQuery) OnlyID

func (uq *UserQuery) OnlyID(ctx context.Context) (id int, err error)

OnlyID returns the only User id in the query, returns an error if not exactly one id was returned.

func (*UserQuery) OnlyIDX

func (uq *UserQuery) OnlyIDX(ctx context.Context) int

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

func (uq *UserQuery) QueryDialog() *DialogQuery

QueryDialog chains the current query on the dialog edge.

func (*UserQuery) QueryProjects

func (uq *UserQuery) QueryProjects() *ProjectQuery

QueryProjects chains the current query on the projects edge.

func (*UserQuery) Select

func (uq *UserQuery) Select(field string, fields ...string) *UserSelect

Select one or more fields from the given query.

Example:

var v []struct {
	CreateTime time.Time `json:"create_time,omitempty"`
}

client.User.Query().
	Select(user.FieldCreateTime).
	Scan(ctx, &v)

func (*UserQuery) Where

func (uq *UserQuery) Where(ps ...predicate.User) *UserQuery

Where adds a new predicate for the builder.

func (*UserQuery) WithDialog

func (uq *UserQuery) WithDialog(opts ...func(*DialogQuery)) *UserQuery
WithDialog tells the query-builder to eager-loads the nodes that are connected to

the "dialog" edge. The optional arguments used to configure the query builder of the edge.

func (*UserQuery) WithProjects

func (uq *UserQuery) WithProjects(opts ...func(*ProjectQuery)) *UserQuery
WithProjects tells the query-builder to eager-loads the nodes that are connected to

the "projects" edge. The optional arguments used to configure the query builder of the edge.

type UserSelect

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

UserSelect is the builder for select fields of User entities.

func (*UserSelect) Bool

func (us *UserSelect) Bool(ctx context.Context) (_ bool, err error)

Bool returns a single bool from 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 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 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 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 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 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 scan 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 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 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) AddProjectIDs

func (uu *UserUpdate) AddProjectIDs(ids ...int) *UserUpdate

AddProjectIDs adds the projects edge to Project by ids.

func (*UserUpdate) AddProjects

func (uu *UserUpdate) AddProjects(p ...*Project) *UserUpdate

AddProjects adds the projects edges to Project.

func (*UserUpdate) ClearDialog

func (uu *UserUpdate) ClearDialog() *UserUpdate

ClearDialog clears the dialog edge to Dialog.

func (*UserUpdate) ClearDisplayName

func (uu *UserUpdate) ClearDisplayName() *UserUpdate

ClearDisplayName clears the value of display_name.

func (*UserUpdate) ClearEmail

func (uu *UserUpdate) ClearEmail() *UserUpdate

ClearEmail clears the value of email.

func (*UserUpdate) ClearSlackID

func (uu *UserUpdate) ClearSlackID() *UserUpdate

ClearSlackID clears the value of slack_id.

func (*UserUpdate) ClearTeamsID

func (uu *UserUpdate) ClearTeamsID() *UserUpdate

ClearTeamsID clears the value of teams_id.

func (*UserUpdate) ClearTelegramID

func (uu *UserUpdate) ClearTelegramID() *UserUpdate

ClearTelegramID clears the value of telegram_id.

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

func (uu *UserUpdate) RemoveProjectIDs(ids ...int) *UserUpdate

RemoveProjectIDs removes the projects edge to Project by ids.

func (*UserUpdate) RemoveProjects

func (uu *UserUpdate) RemoveProjects(p ...*Project) *UserUpdate

RemoveProjects removes projects edges to Project.

func (*UserUpdate) Save

func (uu *UserUpdate) Save(ctx context.Context) (int, error)

Save executes the query and returns the number of rows/vertices matched by this operation.

func (*UserUpdate) SaveX

func (uu *UserUpdate) SaveX(ctx context.Context) int

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

func (*UserUpdate) SetDialog

func (uu *UserUpdate) SetDialog(d *Dialog) *UserUpdate

SetDialog sets the dialog edge to Dialog.

func (*UserUpdate) SetDialogID

func (uu *UserUpdate) SetDialogID(id int) *UserUpdate

SetDialogID sets the dialog edge to Dialog by id.

func (*UserUpdate) SetDisplayName

func (uu *UserUpdate) SetDisplayName(s string) *UserUpdate

SetDisplayName sets the display_name field.

func (*UserUpdate) SetEmail

func (uu *UserUpdate) SetEmail(s string) *UserUpdate

SetEmail sets the email field.

func (*UserUpdate) SetNillableDialogID

func (uu *UserUpdate) SetNillableDialogID(id *int) *UserUpdate

SetNillableDialogID sets the dialog edge to Dialog by id if the given value is not nil.

func (*UserUpdate) SetNillableDisplayName

func (uu *UserUpdate) SetNillableDisplayName(s *string) *UserUpdate

SetNillableDisplayName sets the display_name field if the given value is not nil.

func (*UserUpdate) SetNillableEmail

func (uu *UserUpdate) SetNillableEmail(s *string) *UserUpdate

SetNillableEmail sets the email field if the given value is not nil.

func (*UserUpdate) SetNillableService

func (uu *UserUpdate) SetNillableService(b *bool) *UserUpdate

SetNillableService sets the service field if the given value is not nil.

func (*UserUpdate) SetNillableSlackID

func (uu *UserUpdate) SetNillableSlackID(s *string) *UserUpdate

SetNillableSlackID sets the slack_id field if the given value is not nil.

func (*UserUpdate) SetNillableTeamsID

func (uu *UserUpdate) SetNillableTeamsID(s *string) *UserUpdate

SetNillableTeamsID sets the teams_id field if the given value is not nil.

func (*UserUpdate) SetNillableTelegramID

func (uu *UserUpdate) SetNillableTelegramID(s *string) *UserUpdate

SetNillableTelegramID sets the telegram_id field if the given value is not nil.

func (*UserUpdate) SetPasswordHash

func (uu *UserUpdate) SetPasswordHash(s string) *UserUpdate

SetPasswordHash sets the password_hash field.

func (*UserUpdate) SetService

func (uu *UserUpdate) SetService(b bool) *UserUpdate

SetService sets the service field.

func (*UserUpdate) SetSlackID

func (uu *UserUpdate) SetSlackID(s string) *UserUpdate

SetSlackID sets the slack_id field.

func (*UserUpdate) SetTeamsID

func (uu *UserUpdate) SetTeamsID(s string) *UserUpdate

SetTeamsID sets the teams_id field.

func (*UserUpdate) SetTelegramID

func (uu *UserUpdate) SetTelegramID(s string) *UserUpdate

SetTelegramID sets the telegram_id field.

func (*UserUpdate) SetUsername

func (uu *UserUpdate) SetUsername(s string) *UserUpdate

SetUsername sets the username field.

func (*UserUpdate) Where

func (uu *UserUpdate) Where(ps ...predicate.User) *UserUpdate

Where adds a new predicate for the builder.

type UserUpdateOne

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

UserUpdateOne is the builder for updating a single User entity.

func (*UserUpdateOne) AddProjectIDs

func (uuo *UserUpdateOne) AddProjectIDs(ids ...int) *UserUpdateOne

AddProjectIDs adds the projects edge to Project by ids.

func (*UserUpdateOne) AddProjects

func (uuo *UserUpdateOne) AddProjects(p ...*Project) *UserUpdateOne

AddProjects adds the projects edges to Project.

func (*UserUpdateOne) ClearDialog

func (uuo *UserUpdateOne) ClearDialog() *UserUpdateOne

ClearDialog clears the dialog edge to Dialog.

func (*UserUpdateOne) ClearDisplayName

func (uuo *UserUpdateOne) ClearDisplayName() *UserUpdateOne

ClearDisplayName clears the value of display_name.

func (*UserUpdateOne) ClearEmail

func (uuo *UserUpdateOne) ClearEmail() *UserUpdateOne

ClearEmail clears the value of email.

func (*UserUpdateOne) ClearSlackID

func (uuo *UserUpdateOne) ClearSlackID() *UserUpdateOne

ClearSlackID clears the value of slack_id.

func (*UserUpdateOne) ClearTeamsID

func (uuo *UserUpdateOne) ClearTeamsID() *UserUpdateOne

ClearTeamsID clears the value of teams_id.

func (*UserUpdateOne) ClearTelegramID

func (uuo *UserUpdateOne) ClearTelegramID() *UserUpdateOne

ClearTelegramID clears the value of telegram_id.

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

func (uuo *UserUpdateOne) RemoveProjectIDs(ids ...int) *UserUpdateOne

RemoveProjectIDs removes the projects edge to Project by ids.

func (*UserUpdateOne) RemoveProjects

func (uuo *UserUpdateOne) RemoveProjects(p ...*Project) *UserUpdateOne

RemoveProjects removes projects edges to Project.

func (*UserUpdateOne) Save

func (uuo *UserUpdateOne) Save(ctx context.Context) (*User, error)

Save executes the query and returns the updated entity.

func (*UserUpdateOne) SaveX

func (uuo *UserUpdateOne) SaveX(ctx context.Context) *User

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

func (*UserUpdateOne) SetDialog

func (uuo *UserUpdateOne) SetDialog(d *Dialog) *UserUpdateOne

SetDialog sets the dialog edge to Dialog.

func (*UserUpdateOne) SetDialogID

func (uuo *UserUpdateOne) SetDialogID(id int) *UserUpdateOne

SetDialogID sets the dialog edge to Dialog by id.

func (*UserUpdateOne) SetDisplayName

func (uuo *UserUpdateOne) SetDisplayName(s string) *UserUpdateOne

SetDisplayName sets the display_name field.

func (*UserUpdateOne) SetEmail

func (uuo *UserUpdateOne) SetEmail(s string) *UserUpdateOne

SetEmail sets the email field.

func (*UserUpdateOne) SetNillableDialogID

func (uuo *UserUpdateOne) SetNillableDialogID(id *int) *UserUpdateOne

SetNillableDialogID sets the dialog edge to Dialog by id if the given value is not nil.

func (*UserUpdateOne) SetNillableDisplayName

func (uuo *UserUpdateOne) SetNillableDisplayName(s *string) *UserUpdateOne

SetNillableDisplayName sets the display_name field if the given value is not nil.

func (*UserUpdateOne) SetNillableEmail

func (uuo *UserUpdateOne) SetNillableEmail(s *string) *UserUpdateOne

SetNillableEmail sets the email field if the given value is not nil.

func (*UserUpdateOne) SetNillableService

func (uuo *UserUpdateOne) SetNillableService(b *bool) *UserUpdateOne

SetNillableService sets the service field if the given value is not nil.

func (*UserUpdateOne) SetNillableSlackID

func (uuo *UserUpdateOne) SetNillableSlackID(s *string) *UserUpdateOne

SetNillableSlackID sets the slack_id field if the given value is not nil.

func (*UserUpdateOne) SetNillableTeamsID

func (uuo *UserUpdateOne) SetNillableTeamsID(s *string) *UserUpdateOne

SetNillableTeamsID sets the teams_id field if the given value is not nil.

func (*UserUpdateOne) SetNillableTelegramID

func (uuo *UserUpdateOne) SetNillableTelegramID(s *string) *UserUpdateOne

SetNillableTelegramID sets the telegram_id field if the given value is not nil.

func (*UserUpdateOne) SetPasswordHash

func (uuo *UserUpdateOne) SetPasswordHash(s string) *UserUpdateOne

SetPasswordHash sets the password_hash field.

func (*UserUpdateOne) SetService

func (uuo *UserUpdateOne) SetService(b bool) *UserUpdateOne

SetService sets the service field.

func (*UserUpdateOne) SetSlackID

func (uuo *UserUpdateOne) SetSlackID(s string) *UserUpdateOne

SetSlackID sets the slack_id field.

func (*UserUpdateOne) SetTeamsID

func (uuo *UserUpdateOne) SetTeamsID(s string) *UserUpdateOne

SetTeamsID sets the teams_id field.

func (*UserUpdateOne) SetTelegramID

func (uuo *UserUpdateOne) SetTelegramID(s string) *UserUpdateOne

SetTelegramID sets the telegram_id field.

func (*UserUpdateOne) SetUsername

func (uuo *UserUpdateOne) SetUsername(s string) *UserUpdateOne

SetUsername sets the username 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 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 conflict 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