ent

package
v0.0.0-...-a9b63ba Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2021 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Operation types.
	OpCreate    = ent.OpCreate
	OpDelete    = ent.OpDelete
	OpDeleteOne = ent.OpDeleteOne
	OpUpdate    = ent.OpUpdate
	OpUpdateOne = ent.OpUpdateOne

	// Node types.
	TypeCommand   = "Command"
	TypeMessage   = "Message"
	TypeStatistic = "Statistic"
)

Variables

This section is empty.

Functions

func IsConstraintError

func IsConstraintError(err error) bool

IsConstraintError returns a boolean indicating whether the error is a constraint failure.

func IsNotFound

func IsNotFound(err error) bool

IsNotFound returns a boolean indicating whether the error is a not found error.

func IsNotLoaded

func IsNotLoaded(err error) bool

IsNotLoaded returns a boolean indicating whether the error is a not loaded error.

func IsNotSingular

func IsNotSingular(err error) bool

IsNotSingular returns a boolean indicating whether the error is a not singular error.

func IsValidationError

func IsValidationError(err error) bool

IsValidationError returns a boolean indicating whether the error is a validation error.

func MaskNotFound

func MaskNotFound(err error) error

MaskNotFound masks not found error.

func NewContext

func NewContext(parent context.Context, c *Client) context.Context

NewContext returns a new context with the given Client attached.

func NewTxContext

func NewTxContext(parent context.Context, tx *Tx) context.Context

NewTxContext returns a new context with the given Tx attached.

Types

type AggregateFunc

type AggregateFunc func(*sql.Selector) string

AggregateFunc applies an aggregation step on the group-by traversal/selector.

func As

As is a pseudo aggregation function for renaming another other functions with custom names. For example:

GroupBy(field1, field2).
Aggregate(ent.As(ent.Sum(field1), "sum_field1"), (ent.As(ent.Sum(field2), "sum_field2")).
Scan(ctx, &v)

func Count

func Count() AggregateFunc

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

func Max

func Max(field string) AggregateFunc

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

func Mean

func Mean(field string) AggregateFunc

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

func Min

func Min(field string) AggregateFunc

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

func Sum

func Sum(field string) AggregateFunc

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

type Client

type Client struct {

	// Schema is the client for creating, migrating and dropping schema.
	Schema *migrate.Schema
	// Command is the client for interacting with the Command builders.
	Command *CommandClient
	// Message is the client for interacting with the Message builders.
	Message *MessageClient
	// Statistic is the client for interacting with the Statistic builders.
	Statistic *StatisticClient
	// contains filtered or unexported fields
}

Client is the client that holds all ent builders.

func FromContext

func FromContext(ctx context.Context) *Client

FromContext returns a Client stored inside a context, or nil if there isn't one.

func NewClient

func NewClient(opts ...Option) *Client

NewClient creates a new client configured with the given options.

func Open

func Open(driverName, dataSourceName string, options ...Option) (*Client, error)

Open opens a database/sql.DB specified by the driver name and the data source name, and returns a new client attached to it. Optional parameters can be added for configuring the client.

func (*Client) BeginTx

func (c *Client) BeginTx(ctx context.Context, opts *sql.TxOptions) (*Tx, error)

BeginTx returns a transactional client with specified options.

func (*Client) Close

func (c *Client) Close() error

Close closes the database connection and prevents new queries from starting.

func (*Client) Debug

func (c *Client) Debug() *Client

Debug returns a new debug-client. It's used to get verbose logging on specific operations.

client.Debug().
	Command.
	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 Command

type Command struct {

	// ID of the ent.
	ID int `json:"id,omitempty"`
	// contains filtered or unexported fields
}

Command is the model entity for the Command schema.

func (*Command) String

func (c *Command) String() string

String implements the fmt.Stringer.

func (*Command) Unwrap

func (c *Command) Unwrap() *Command

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

func (*Command) Update

func (c *Command) Update() *CommandUpdateOne

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

type CommandClient

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

CommandClient is a client for the Command schema.

func NewCommandClient

func NewCommandClient(c config) *CommandClient

NewCommandClient returns a client for the Command from the given config.

func (*CommandClient) Create

func (c *CommandClient) Create() *CommandCreate

Create returns a create builder for Command.

func (*CommandClient) CreateBulk

func (c *CommandClient) CreateBulk(builders ...*CommandCreate) *CommandCreateBulk

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

func (*CommandClient) Delete

func (c *CommandClient) Delete() *CommandDelete

Delete returns a delete builder for Command.

func (*CommandClient) DeleteOne

func (c *CommandClient) DeleteOne(co *Command) *CommandDeleteOne

DeleteOne returns a delete builder for the given entity.

func (*CommandClient) DeleteOneID

func (c *CommandClient) DeleteOneID(id int) *CommandDeleteOne

DeleteOneID returns a delete builder for the given id.

func (*CommandClient) Get

func (c *CommandClient) Get(ctx context.Context, id int) (*Command, error)

Get returns a Command entity by its id.

func (*CommandClient) GetX

func (c *CommandClient) GetX(ctx context.Context, id int) *Command

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

func (*CommandClient) Hooks

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

Hooks returns the client hooks.

func (*CommandClient) Query

func (c *CommandClient) Query() *CommandQuery

Query returns a query builder for Command.

func (*CommandClient) Update

func (c *CommandClient) Update() *CommandUpdate

Update returns an update builder for Command.

func (*CommandClient) UpdateOne

func (c *CommandClient) UpdateOne(co *Command) *CommandUpdateOne

UpdateOne returns an update builder for the given entity.

func (*CommandClient) UpdateOneID

func (c *CommandClient) UpdateOneID(id int) *CommandUpdateOne

UpdateOneID returns an update builder for the given id.

func (*CommandClient) Use

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

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

type CommandCreate

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

CommandCreate is the builder for creating a Command entity.

func (*CommandCreate) Exec

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

Exec executes the query.

func (*CommandCreate) ExecX

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

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

func (*CommandCreate) Mutation

func (cc *CommandCreate) Mutation() *CommandMutation

Mutation returns the CommandMutation object of the builder.

func (*CommandCreate) Save

func (cc *CommandCreate) Save(ctx context.Context) (*Command, error)

Save creates the Command in the database.

func (*CommandCreate) SaveX

func (cc *CommandCreate) SaveX(ctx context.Context) *Command

SaveX calls Save and panics if Save returns an error.

type CommandCreateBulk

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

CommandCreateBulk is the builder for creating many Command entities in bulk.

func (*CommandCreateBulk) Exec

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

Exec executes the query.

func (*CommandCreateBulk) ExecX

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

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

func (*CommandCreateBulk) Save

func (ccb *CommandCreateBulk) Save(ctx context.Context) ([]*Command, error)

Save creates the Command entities in the database.

func (*CommandCreateBulk) SaveX

func (ccb *CommandCreateBulk) SaveX(ctx context.Context) []*Command

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

type CommandDelete

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

CommandDelete is the builder for deleting a Command entity.

func (*CommandDelete) Exec

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

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

func (*CommandDelete) ExecX

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

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

func (*CommandDelete) Where

func (cd *CommandDelete) Where(ps ...predicate.Command) *CommandDelete

Where appends a list predicates to the CommandDelete builder.

type CommandDeleteOne

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

CommandDeleteOne is the builder for deleting a single Command entity.

func (*CommandDeleteOne) Exec

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

Exec executes the deletion query.

func (*CommandDeleteOne) ExecX

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

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

type CommandGroupBy

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

CommandGroupBy is the group-by builder for Command entities.

func (*CommandGroupBy) Aggregate

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

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

func (*CommandGroupBy) Bool

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

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

func (*CommandGroupBy) BoolX

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

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

func (*CommandGroupBy) Bools

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

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

func (*CommandGroupBy) BoolsX

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

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

func (*CommandGroupBy) Float64

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

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

func (*CommandGroupBy) Float64X

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

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

func (*CommandGroupBy) Float64s

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

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

func (*CommandGroupBy) Float64sX

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

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

func (*CommandGroupBy) Int

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

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

func (*CommandGroupBy) IntX

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

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

func (*CommandGroupBy) Ints

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

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

func (*CommandGroupBy) IntsX

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

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

func (*CommandGroupBy) Scan

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

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

func (*CommandGroupBy) ScanX

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

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

func (*CommandGroupBy) String

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

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

func (*CommandGroupBy) StringX

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

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

func (*CommandGroupBy) Strings

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

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

func (*CommandGroupBy) StringsX

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

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

type CommandMutation

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

CommandMutation represents an operation that mutates the Command nodes in the graph.

func (*CommandMutation) AddField

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

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

func (*CommandMutation) AddedEdges

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

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

func (*CommandMutation) AddedField

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

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

func (*CommandMutation) AddedFields

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

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

func (*CommandMutation) AddedIDs

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

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

func (*CommandMutation) ClearEdge

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

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

func (*CommandMutation) ClearField

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

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

func (*CommandMutation) ClearedEdges

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

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

func (*CommandMutation) ClearedFields

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

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

func (CommandMutation) Client

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

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

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

func (*CommandMutation) Field

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

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

func (*CommandMutation) FieldCleared

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

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

func (*CommandMutation) Fields

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

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

func (*CommandMutation) ID

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

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

func (*CommandMutation) OldField

func (m *CommandMutation) OldField(ctx context.Context, name string) (ent.Value, error)

OldField returns the old value of the field from the database. An error is returned if the mutation operation is not UpdateOne, or the query to the database failed.

func (*CommandMutation) Op

func (m *CommandMutation) Op() Op

Op returns the operation name.

func (*CommandMutation) RemovedEdges

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

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

func (*CommandMutation) RemovedIDs

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

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

func (*CommandMutation) ResetEdge

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

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

func (*CommandMutation) ResetField

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

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

func (*CommandMutation) SetField

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

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

func (CommandMutation) Tx

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

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

func (*CommandMutation) Type

func (m *CommandMutation) Type() string

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

func (*CommandMutation) Where

func (m *CommandMutation) Where(ps ...predicate.Command)

Where appends a list predicates to the CommandMutation builder.

type CommandQuery

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

CommandQuery is the builder for querying Command entities.

func (*CommandQuery) All

func (cq *CommandQuery) All(ctx context.Context) ([]*Command, error)

All executes the query and returns a list of Commands.

func (*CommandQuery) AllX

func (cq *CommandQuery) AllX(ctx context.Context) []*Command

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

func (*CommandQuery) Clone

func (cq *CommandQuery) Clone() *CommandQuery

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

func (*CommandQuery) Count

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

Count returns the count of the given query.

func (*CommandQuery) CountX

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

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

func (*CommandQuery) Exist

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

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

func (*CommandQuery) ExistX

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

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

func (*CommandQuery) First

func (cq *CommandQuery) First(ctx context.Context) (*Command, error)

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

func (*CommandQuery) FirstID

func (cq *CommandQuery) FirstID(ctx context.Context) (id int, err error)

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

func (*CommandQuery) FirstIDX

func (cq *CommandQuery) FirstIDX(ctx context.Context) int

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

func (*CommandQuery) FirstX

func (cq *CommandQuery) FirstX(ctx context.Context) *Command

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

func (*CommandQuery) GroupBy

func (cq *CommandQuery) GroupBy(field string, fields ...string) *CommandGroupBy

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

func (*CommandQuery) IDs

func (cq *CommandQuery) IDs(ctx context.Context) ([]int, error)

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

func (*CommandQuery) IDsX

func (cq *CommandQuery) IDsX(ctx context.Context) []int

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

func (*CommandQuery) Limit

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

Limit adds a limit step to the query.

func (*CommandQuery) Offset

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

Offset adds an offset step to the query.

func (*CommandQuery) Only

func (cq *CommandQuery) Only(ctx context.Context) (*Command, error)

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

func (*CommandQuery) OnlyID

func (cq *CommandQuery) OnlyID(ctx context.Context) (id int, err error)

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

func (*CommandQuery) OnlyIDX

func (cq *CommandQuery) OnlyIDX(ctx context.Context) int

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

func (*CommandQuery) OnlyX

func (cq *CommandQuery) OnlyX(ctx context.Context) *Command

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

func (*CommandQuery) Order

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

Order adds an order step to the query.

func (*CommandQuery) Select

func (cq *CommandQuery) Select(fields ...string) *CommandSelect

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

func (*CommandQuery) Unique

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

Unique configures the query builder to filter duplicate records on query. By default, unique is set to true, and can be disabled using this method.

func (*CommandQuery) Where

func (cq *CommandQuery) Where(ps ...predicate.Command) *CommandQuery

Where adds a new predicate for the CommandQuery builder.

type CommandSelect

type CommandSelect struct {
	*CommandQuery
	// contains filtered or unexported fields
}

CommandSelect is the builder for selecting fields of Command entities.

func (*CommandSelect) Bool

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

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

func (*CommandSelect) BoolX

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

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

func (*CommandSelect) Bools

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

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

func (*CommandSelect) BoolsX

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

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

func (*CommandSelect) Float64

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

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

func (*CommandSelect) Float64X

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

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

func (*CommandSelect) Float64s

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

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

func (*CommandSelect) Float64sX

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

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

func (*CommandSelect) Int

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

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

func (*CommandSelect) IntX

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

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

func (*CommandSelect) Ints

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

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

func (*CommandSelect) IntsX

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

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

func (*CommandSelect) Scan

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

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

func (*CommandSelect) ScanX

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

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

func (*CommandSelect) String

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

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

func (*CommandSelect) StringX

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

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

func (*CommandSelect) Strings

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

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

func (*CommandSelect) StringsX

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

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

type CommandUpdate

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

CommandUpdate is the builder for updating Command entities.

func (*CommandUpdate) Exec

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

Exec executes the query.

func (*CommandUpdate) ExecX

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

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

func (*CommandUpdate) Mutation

func (cu *CommandUpdate) Mutation() *CommandMutation

Mutation returns the CommandMutation object of the builder.

func (*CommandUpdate) Save

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

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

func (*CommandUpdate) SaveX

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

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

func (*CommandUpdate) Where

func (cu *CommandUpdate) Where(ps ...predicate.Command) *CommandUpdate

Where appends a list predicates to the CommandUpdate builder.

type CommandUpdateOne

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

CommandUpdateOne is the builder for updating a single Command entity.

func (*CommandUpdateOne) Exec

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

Exec executes the query on the entity.

func (*CommandUpdateOne) ExecX

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

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

func (*CommandUpdateOne) Mutation

func (cuo *CommandUpdateOne) Mutation() *CommandMutation

Mutation returns the CommandMutation object of the builder.

func (*CommandUpdateOne) Save

func (cuo *CommandUpdateOne) Save(ctx context.Context) (*Command, error)

Save executes the query and returns the updated Command entity.

func (*CommandUpdateOne) SaveX

func (cuo *CommandUpdateOne) SaveX(ctx context.Context) *Command

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

func (*CommandUpdateOne) Select

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

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

type Commands

type Commands []*Command

Commands is a parsable slice of Command.

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 Hook

type Hook = ent.Hook

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

type Message

type Message struct {

	// ID of the ent.
	ID int `json:"id,omitempty"`
	// Type holds the value of the "type" field.
	Type int `json:"type,omitempty"`
	// Action holds the value of the "action" field.
	Action message.Action `json:"action,omitempty"`
	// Message holds the value of the "message" field.
	Message string `json:"message,omitempty"`
	// AutoRemove holds the value of the "auto_remove" field.
	AutoRemove bool `json:"auto_remove,omitempty"`
	// AutoRemoveTime holds the value of the "auto_remove_time" field.
	AutoRemoveTime int `json:"auto_remove_time,omitempty"`
	// Enable holds the value of the "enable" field.
	Enable bool `json:"enable,omitempty"`
	// contains filtered or unexported fields
}

Message is the model entity for the Message schema.

func (*Message) String

func (m *Message) String() string

String implements the fmt.Stringer.

func (*Message) Unwrap

func (m *Message) Unwrap() *Message

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

func (*Message) Update

func (m *Message) Update() *MessageUpdateOne

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

type MessageClient

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

MessageClient is a client for the Message schema.

func NewMessageClient

func NewMessageClient(c config) *MessageClient

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

func (*MessageClient) Create

func (c *MessageClient) Create() *MessageCreate

Create returns a create builder for Message.

func (*MessageClient) CreateBulk

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

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

func (*MessageClient) Delete

func (c *MessageClient) Delete() *MessageDelete

Delete returns a delete builder for Message.

func (*MessageClient) DeleteOne

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

DeleteOne returns a delete builder for the given entity.

func (*MessageClient) DeleteOneID

func (c *MessageClient) DeleteOneID(id 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) Update

func (c *MessageClient) Update() *MessageUpdate

Update returns an update builder for Message.

func (*MessageClient) UpdateOne

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

UpdateOne returns an update builder for the given entity.

func (*MessageClient) UpdateOneID

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

UpdateOneID returns an update builder for the given id.

func (*MessageClient) Use

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

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

type MessageCreate

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

MessageCreate is the builder for creating a Message entity.

func (*MessageCreate) Exec

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

Exec executes the query.

func (*MessageCreate) ExecX

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

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

func (*MessageCreate) Mutation

func (mc *MessageCreate) Mutation() *MessageMutation

Mutation returns the MessageMutation object of the builder.

func (*MessageCreate) Save

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

Save creates the Message in the database.

func (*MessageCreate) SaveX

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

SaveX calls Save and panics if Save returns an error.

func (*MessageCreate) SetAction

func (mc *MessageCreate) SetAction(m message.Action) *MessageCreate

SetAction sets the "action" field.

func (*MessageCreate) SetAutoRemove

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

SetAutoRemove sets the "auto_remove" field.

func (*MessageCreate) SetAutoRemoveTime

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

SetAutoRemoveTime sets the "auto_remove_time" field.

func (*MessageCreate) SetEnable

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

SetEnable sets the "enable" field.

func (*MessageCreate) SetMessage

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

SetMessage sets the "message" field.

func (*MessageCreate) SetNillableAutoRemove

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

SetNillableAutoRemove sets the "auto_remove" field if the given value is not nil.

func (*MessageCreate) SetNillableAutoRemoveTime

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

SetNillableAutoRemoveTime sets the "auto_remove_time" field if the given value is not nil.

func (*MessageCreate) SetNillableEnable

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

SetNillableEnable sets the "enable" field if the given value is not nil.

func (*MessageCreate) SetNillableMessage

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

SetNillableMessage sets the "message" field if the given value is not nil.

func (*MessageCreate) SetNillableType

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

SetNillableType sets the "type" field if the given value is not nil.

func (*MessageCreate) SetType

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

SetType sets the "type" field.

type MessageCreateBulk

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

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

func (*MessageCreateBulk) Exec

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

Exec executes the query.

func (*MessageCreateBulk) ExecX

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

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

func (*MessageCreateBulk) Save

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

Save creates the Message entities in the database.

func (*MessageCreateBulk) SaveX

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

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

type MessageDelete

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

MessageDelete is the builder for deleting a Message entity.

func (*MessageDelete) Exec

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

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

func (*MessageDelete) ExecX

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

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

func (*MessageDelete) Where

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

Where appends a list predicates to the MessageDelete builder.

type MessageDeleteOne

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

MessageDeleteOne is the builder for deleting a single Message entity.

func (*MessageDeleteOne) Exec

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

Exec executes the deletion query.

func (*MessageDeleteOne) ExecX

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

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

type MessageGroupBy

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

MessageGroupBy is the group-by builder for Message entities.

func (*MessageGroupBy) Aggregate

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

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

func (*MessageGroupBy) Bool

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

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

func (*MessageGroupBy) BoolX

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

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

func (*MessageGroupBy) Bools

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

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

func (*MessageGroupBy) BoolsX

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

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

func (*MessageGroupBy) Float64

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

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

func (*MessageGroupBy) Float64X

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

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

func (*MessageGroupBy) Float64s

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

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

func (*MessageGroupBy) Float64sX

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

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

func (*MessageGroupBy) Int

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

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

func (*MessageGroupBy) IntX

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

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

func (*MessageGroupBy) Ints

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

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

func (*MessageGroupBy) IntsX

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

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

func (*MessageGroupBy) Scan

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

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

func (*MessageGroupBy) ScanX

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

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

func (*MessageGroupBy) String

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

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

func (*MessageGroupBy) StringX

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

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

func (*MessageGroupBy) Strings

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

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

func (*MessageGroupBy) StringsX

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

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

type MessageMutation

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

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

func (*MessageMutation) Action

func (m *MessageMutation) Action() (r message.Action, exists bool)

Action returns the value of the "action" field in the mutation.

func (*MessageMutation) AddAutoRemoveTime

func (m *MessageMutation) AddAutoRemoveTime(i int)

AddAutoRemoveTime adds i to the "auto_remove_time" field.

func (*MessageMutation) AddField

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

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

func (*MessageMutation) AddType

func (m *MessageMutation) AddType(i int)

AddType adds i to the "type" field.

func (*MessageMutation) AddedAutoRemoveTime

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

AddedAutoRemoveTime returns the value that was added to the "auto_remove_time" field in this mutation.

func (*MessageMutation) AddedEdges

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

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

func (*MessageMutation) AddedField

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

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

func (*MessageMutation) AddedFields

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

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

func (*MessageMutation) AddedIDs

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

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

func (*MessageMutation) AddedType

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

AddedType returns the value that was added to the "type" field in this mutation.

func (*MessageMutation) AutoRemove

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

AutoRemove returns the value of the "auto_remove" field in the mutation.

func (*MessageMutation) AutoRemoveTime

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

AutoRemoveTime returns the value of the "auto_remove_time" field in the mutation.

func (*MessageMutation) ClearEdge

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

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

func (*MessageMutation) ClearField

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

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

func (*MessageMutation) ClearedEdges

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

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

func (*MessageMutation) ClearedFields

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

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

func (MessageMutation) Client

func (m MessageMutation) Client() *Client

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

func (*MessageMutation) EdgeCleared

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

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

func (*MessageMutation) Enable

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

Enable returns the value of the "enable" field in the mutation.

func (*MessageMutation) Field

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

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

func (*MessageMutation) FieldCleared

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

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

func (*MessageMutation) Fields

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

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

func (*MessageMutation) GetType

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

GetType returns the value of the "type" field in the mutation.

func (*MessageMutation) ID

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

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

func (*MessageMutation) Message

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

Message returns the value of the "message" field in the mutation.

func (*MessageMutation) OldAction

func (m *MessageMutation) OldAction(ctx context.Context) (v message.Action, err error)

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

func (*MessageMutation) OldAutoRemove

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

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

func (*MessageMutation) OldAutoRemoveTime

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

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

func (*MessageMutation) OldEnable

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

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

func (*MessageMutation) OldField

func (m *MessageMutation) OldField(ctx context.Context, name string) (ent.Value, error)

OldField returns the old value of the field from the database. An error is returned if the mutation operation is not UpdateOne, or the query to the database failed.

func (*MessageMutation) OldMessage

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

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

func (*MessageMutation) OldType

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

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

func (*MessageMutation) Op

func (m *MessageMutation) Op() Op

Op returns the operation name.

func (*MessageMutation) RemovedEdges

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

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

func (*MessageMutation) RemovedIDs

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

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

func (*MessageMutation) ResetAction

func (m *MessageMutation) ResetAction()

ResetAction resets all changes to the "action" field.

func (*MessageMutation) ResetAutoRemove

func (m *MessageMutation) ResetAutoRemove()

ResetAutoRemove resets all changes to the "auto_remove" field.

func (*MessageMutation) ResetAutoRemoveTime

func (m *MessageMutation) ResetAutoRemoveTime()

ResetAutoRemoveTime resets all changes to the "auto_remove_time" field.

func (*MessageMutation) ResetEdge

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

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

func (*MessageMutation) ResetEnable

func (m *MessageMutation) ResetEnable()

ResetEnable resets all changes to the "enable" field.

func (*MessageMutation) ResetField

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

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

func (*MessageMutation) ResetMessage

func (m *MessageMutation) ResetMessage()

ResetMessage resets all changes to the "message" field.

func (*MessageMutation) ResetType

func (m *MessageMutation) ResetType()

ResetType resets all changes to the "type" field.

func (*MessageMutation) SetAction

func (m *MessageMutation) SetAction(value message.Action)

SetAction sets the "action" field.

func (*MessageMutation) SetAutoRemove

func (m *MessageMutation) SetAutoRemove(b bool)

SetAutoRemove sets the "auto_remove" field.

func (*MessageMutation) SetAutoRemoveTime

func (m *MessageMutation) SetAutoRemoveTime(i int)

SetAutoRemoveTime sets the "auto_remove_time" field.

func (*MessageMutation) SetEnable

func (m *MessageMutation) SetEnable(b bool)

SetEnable sets the "enable" field.

func (*MessageMutation) SetField

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

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

func (*MessageMutation) SetMessage

func (m *MessageMutation) SetMessage(s string)

SetMessage sets the "message" field.

func (*MessageMutation) SetType

func (m *MessageMutation) SetType(i int)

SetType sets the "type" field.

func (MessageMutation) Tx

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

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

func (*MessageMutation) Type

func (m *MessageMutation) Type() string

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

func (*MessageMutation) Where

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

Where appends a list predicates to the MessageMutation builder.

type MessageQuery

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

MessageQuery is the builder for querying Message entities.

func (*MessageQuery) All

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

All executes the query and returns a list of Messages.

func (*MessageQuery) AllX

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

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

func (*MessageQuery) Clone

func (mq *MessageQuery) Clone() *MessageQuery

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

func (*MessageQuery) Count

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

Count returns the count of the given query.

func (*MessageQuery) CountX

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

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

func (*MessageQuery) Exist

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

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

func (*MessageQuery) ExistX

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

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

func (*MessageQuery) First

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

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

func (*MessageQuery) FirstID

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

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

func (*MessageQuery) FirstIDX

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

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

func (*MessageQuery) FirstX

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

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

func (*MessageQuery) GroupBy

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

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

Example:

var v []struct {
	Type int `json:"type,omitempty"`
	Count int `json:"count,omitempty"`
}

client.Message.Query().
	GroupBy(message.FieldType).
	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 a single Message entity found by the query, ensuring it only returns one. Returns a *NotSingularError when exactly one Message entity is not found. Returns a *NotFoundError when no Message entities are found.

func (*MessageQuery) OnlyID

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

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

func (*MessageQuery) OnlyIDX

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

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

func (*MessageQuery) OnlyX

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

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

func (*MessageQuery) Order

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

Order adds an order step to the query.

func (*MessageQuery) Select

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

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

Example:

var v []struct {
	Type int `json:"type,omitempty"`
}

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

func (*MessageQuery) Unique

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

Unique configures the query builder to filter duplicate records on query. By default, unique is set to true, and can be disabled using this method.

func (*MessageQuery) Where

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

Where adds a new predicate for the MessageQuery builder.

type MessageSelect

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

MessageSelect is the builder for selecting fields of Message entities.

func (*MessageSelect) Bool

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

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

func (*MessageSelect) BoolX

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

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

func (*MessageSelect) Bools

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

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

func (*MessageSelect) BoolsX

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

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

func (*MessageSelect) Float64

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

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

func (*MessageSelect) Float64X

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

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

func (*MessageSelect) Float64s

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

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

func (*MessageSelect) Float64sX

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

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

func (*MessageSelect) Int

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

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

func (*MessageSelect) IntX

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

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

func (*MessageSelect) Ints

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

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

func (*MessageSelect) IntsX

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

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

func (*MessageSelect) Scan

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

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

func (*MessageSelect) ScanX

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

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

func (*MessageSelect) String

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

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

func (*MessageSelect) StringX

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

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

func (*MessageSelect) Strings

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

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

func (*MessageSelect) StringsX

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

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

type MessageUpdate

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

MessageUpdate is the builder for updating Message entities.

func (*MessageUpdate) AddAutoRemoveTime

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

AddAutoRemoveTime adds i to the "auto_remove_time" field.

func (*MessageUpdate) AddType

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

AddType adds i to the "type" field.

func (*MessageUpdate) Exec

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

Exec executes the query.

func (*MessageUpdate) ExecX

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

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

func (*MessageUpdate) Mutation

func (mu *MessageUpdate) Mutation() *MessageMutation

Mutation returns the MessageMutation object of the builder.

func (*MessageUpdate) Save

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

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

func (*MessageUpdate) SaveX

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

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

func (*MessageUpdate) SetAction

func (mu *MessageUpdate) SetAction(m message.Action) *MessageUpdate

SetAction sets the "action" field.

func (*MessageUpdate) SetAutoRemove

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

SetAutoRemove sets the "auto_remove" field.

func (*MessageUpdate) SetAutoRemoveTime

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

SetAutoRemoveTime sets the "auto_remove_time" field.

func (*MessageUpdate) SetEnable

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

SetEnable sets the "enable" field.

func (*MessageUpdate) SetMessage

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

SetMessage sets the "message" field.

func (*MessageUpdate) SetNillableAutoRemove

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

SetNillableAutoRemove sets the "auto_remove" field if the given value is not nil.

func (*MessageUpdate) SetNillableAutoRemoveTime

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

SetNillableAutoRemoveTime sets the "auto_remove_time" field if the given value is not nil.

func (*MessageUpdate) SetNillableEnable

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

SetNillableEnable sets the "enable" field if the given value is not nil.

func (*MessageUpdate) SetNillableMessage

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

SetNillableMessage sets the "message" field if the given value is not nil.

func (*MessageUpdate) SetNillableType

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

SetNillableType sets the "type" field if the given value is not nil.

func (*MessageUpdate) SetType

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

SetType sets the "type" field.

func (*MessageUpdate) Where

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

Where appends a list predicates to the MessageUpdate builder.

type MessageUpdateOne

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

MessageUpdateOne is the builder for updating a single Message entity.

func (*MessageUpdateOne) AddAutoRemoveTime

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

AddAutoRemoveTime adds i to the "auto_remove_time" field.

func (*MessageUpdateOne) AddType

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

AddType adds i to the "type" field.

func (*MessageUpdateOne) Exec

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

Exec executes the query on the entity.

func (*MessageUpdateOne) ExecX

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

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

func (*MessageUpdateOne) Mutation

func (muo *MessageUpdateOne) Mutation() *MessageMutation

Mutation returns the MessageMutation object of the builder.

func (*MessageUpdateOne) Save

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

Save executes the query and returns the updated Message entity.

func (*MessageUpdateOne) SaveX

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

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

func (*MessageUpdateOne) Select

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

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

func (*MessageUpdateOne) SetAction

func (muo *MessageUpdateOne) SetAction(m message.Action) *MessageUpdateOne

SetAction sets the "action" field.

func (*MessageUpdateOne) SetAutoRemove

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

SetAutoRemove sets the "auto_remove" field.

func (*MessageUpdateOne) SetAutoRemoveTime

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

SetAutoRemoveTime sets the "auto_remove_time" field.

func (*MessageUpdateOne) SetEnable

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

SetEnable sets the "enable" field.

func (*MessageUpdateOne) SetMessage

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

SetMessage sets the "message" field.

func (*MessageUpdateOne) SetNillableAutoRemove

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

SetNillableAutoRemove sets the "auto_remove" field if the given value is not nil.

func (*MessageUpdateOne) SetNillableAutoRemoveTime

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

SetNillableAutoRemoveTime sets the "auto_remove_time" field if the given value is not nil.

func (*MessageUpdateOne) SetNillableEnable

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

SetNillableEnable sets the "enable" field if the given value is not nil.

func (*MessageUpdateOne) SetNillableMessage

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

SetNillableMessage sets the "message" field if the given value is not nil.

func (*MessageUpdateOne) SetNillableType

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

SetNillableType sets the "type" field if the given value is not nil.

func (*MessageUpdateOne) SetType

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

SetType sets the "type" field.

type Messages

type Messages []*Message

Messages is a parsable slice of Message.

type MutateFunc

type MutateFunc = ent.MutateFunc

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

type Mutation

type Mutation = ent.Mutation

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

type Mutator

type Mutator = ent.Mutator

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

type NotFoundError

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

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

func (*NotFoundError) Error

func (e *NotFoundError) Error() string

Error implements the error interface.

type NotLoadedError

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

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

func (*NotLoadedError) Error

func (e *NotLoadedError) Error() string

Error implements the error interface.

type NotSingularError

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

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

func (*NotSingularError) Error

func (e *NotSingularError) Error() string

Error implements the error interface.

type Op

type Op = ent.Op

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

type Option

type Option func(*config)

Option function to configure the client.

func Debug

func Debug() Option

Debug enables debug logging on the ent.Driver.

func Driver

func Driver(driver dialect.Driver) Option

Driver configures the client driver.

func Log

func Log(fn func(...interface{})) Option

Log sets the logging function for debug mode.

type OrderFunc

type OrderFunc func(*sql.Selector)

OrderFunc applies an ordering on the sql selector.

func Asc

func Asc(fields ...string) OrderFunc

Asc applies the given fields in ASC order.

func Desc

func Desc(fields ...string) OrderFunc

Desc applies the given fields in DESC order.

type Policy

type Policy = ent.Policy

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

type Query

type Query = ent.Query

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

type RollbackFunc

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

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

func (RollbackFunc) Rollback

func (f RollbackFunc) Rollback(ctx context.Context, tx *Tx) error

Rollback calls f(ctx, m).

type RollbackHook

type RollbackHook func(Rollbacker) Rollbacker

RollbackHook defines the "rollback middleware". A function that gets a Rollbacker and returns a Rollbacker. For example:

hook := func(next ent.Rollbacker) ent.Rollbacker {
	return ent.RollbackFunc(func(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 Statistic

type Statistic struct {

	// ID of the ent.
	ID int `json:"id,omitempty"`
	// FirstName holds the value of the "first_name" field.
	FirstName string `json:"first_name,omitempty"`
	// LatName holds the value of the "lat_name" field.
	LatName string `json:"lat_name,omitempty"`
	// UserName holds the value of the "user_name" field.
	UserName string `json:"user_name,omitempty"`
	// FromUser holds the value of the "from_user" field.
	FromUser int `json:"from_user,omitempty"`
	// ChannelID holds the value of the "channel_id" field.
	ChannelID int64 `json:"channel_id,omitempty"`
	// UserID holds the value of the "user_id" field.
	UserID int `json:"user_id,omitempty"`
	// JoinTime holds the value of the "join_time" field.
	JoinTime time.Time `json:"join_time,omitempty"`
	// Invited holds the value of the "invited" field.
	Invited int64 `json:"invited,omitempty"`
	// Message holds the value of the "message" field.
	Message int64 `json:"message,omitempty"`
	// LastMessage holds the value of the "last_message" field.
	LastMessage time.Time `json:"last_message,omitempty"`
	// contains filtered or unexported fields
}

Statistic is the model entity for the Statistic schema.

func (*Statistic) String

func (s *Statistic) String() string

String implements the fmt.Stringer.

func (*Statistic) Unwrap

func (s *Statistic) Unwrap() *Statistic

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

func (*Statistic) Update

func (s *Statistic) Update() *StatisticUpdateOne

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

type StatisticClient

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

StatisticClient is a client for the Statistic schema.

func NewStatisticClient

func NewStatisticClient(c config) *StatisticClient

NewStatisticClient returns a client for the Statistic from the given config.

func (*StatisticClient) Create

func (c *StatisticClient) Create() *StatisticCreate

Create returns a create builder for Statistic.

func (*StatisticClient) CreateBulk

func (c *StatisticClient) CreateBulk(builders ...*StatisticCreate) *StatisticCreateBulk

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

func (*StatisticClient) Delete

func (c *StatisticClient) Delete() *StatisticDelete

Delete returns a delete builder for Statistic.

func (*StatisticClient) DeleteOne

func (c *StatisticClient) DeleteOne(s *Statistic) *StatisticDeleteOne

DeleteOne returns a delete builder for the given entity.

func (*StatisticClient) DeleteOneID

func (c *StatisticClient) DeleteOneID(id int) *StatisticDeleteOne

DeleteOneID returns a delete builder for the given id.

func (*StatisticClient) Get

func (c *StatisticClient) Get(ctx context.Context, id int) (*Statistic, error)

Get returns a Statistic entity by its id.

func (*StatisticClient) GetX

func (c *StatisticClient) GetX(ctx context.Context, id int) *Statistic

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

func (*StatisticClient) Hooks

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

Hooks returns the client hooks.

func (*StatisticClient) Query

func (c *StatisticClient) Query() *StatisticQuery

Query returns a query builder for Statistic.

func (*StatisticClient) Update

func (c *StatisticClient) Update() *StatisticUpdate

Update returns an update builder for Statistic.

func (*StatisticClient) UpdateOne

func (c *StatisticClient) UpdateOne(s *Statistic) *StatisticUpdateOne

UpdateOne returns an update builder for the given entity.

func (*StatisticClient) UpdateOneID

func (c *StatisticClient) UpdateOneID(id int) *StatisticUpdateOne

UpdateOneID returns an update builder for the given id.

func (*StatisticClient) Use

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

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

type StatisticCreate

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

StatisticCreate is the builder for creating a Statistic entity.

func (*StatisticCreate) Exec

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

Exec executes the query.

func (*StatisticCreate) ExecX

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

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

func (*StatisticCreate) Mutation

func (sc *StatisticCreate) Mutation() *StatisticMutation

Mutation returns the StatisticMutation object of the builder.

func (*StatisticCreate) Save

func (sc *StatisticCreate) Save(ctx context.Context) (*Statistic, error)

Save creates the Statistic in the database.

func (*StatisticCreate) SaveX

func (sc *StatisticCreate) SaveX(ctx context.Context) *Statistic

SaveX calls Save and panics if Save returns an error.

func (*StatisticCreate) SetChannelID

func (sc *StatisticCreate) SetChannelID(i int64) *StatisticCreate

SetChannelID sets the "channel_id" field.

func (*StatisticCreate) SetFirstName

func (sc *StatisticCreate) SetFirstName(s string) *StatisticCreate

SetFirstName sets the "first_name" field.

func (*StatisticCreate) SetFromUser

func (sc *StatisticCreate) SetFromUser(i int) *StatisticCreate

SetFromUser sets the "from_user" field.

func (*StatisticCreate) SetInvited

func (sc *StatisticCreate) SetInvited(i int64) *StatisticCreate

SetInvited sets the "invited" field.

func (*StatisticCreate) SetJoinTime

func (sc *StatisticCreate) SetJoinTime(t time.Time) *StatisticCreate

SetJoinTime sets the "join_time" field.

func (*StatisticCreate) SetLastMessage

func (sc *StatisticCreate) SetLastMessage(t time.Time) *StatisticCreate

SetLastMessage sets the "last_message" field.

func (*StatisticCreate) SetLatName

func (sc *StatisticCreate) SetLatName(s string) *StatisticCreate

SetLatName sets the "lat_name" field.

func (*StatisticCreate) SetMessage

func (sc *StatisticCreate) SetMessage(i int64) *StatisticCreate

SetMessage sets the "message" field.

func (*StatisticCreate) SetNillableChannelID

func (sc *StatisticCreate) SetNillableChannelID(i *int64) *StatisticCreate

SetNillableChannelID sets the "channel_id" field if the given value is not nil.

func (*StatisticCreate) SetNillableFirstName

func (sc *StatisticCreate) SetNillableFirstName(s *string) *StatisticCreate

SetNillableFirstName sets the "first_name" field if the given value is not nil.

func (*StatisticCreate) SetNillableFromUser

func (sc *StatisticCreate) SetNillableFromUser(i *int) *StatisticCreate

SetNillableFromUser sets the "from_user" field if the given value is not nil.

func (*StatisticCreate) SetNillableInvited

func (sc *StatisticCreate) SetNillableInvited(i *int64) *StatisticCreate

SetNillableInvited sets the "invited" field if the given value is not nil.

func (*StatisticCreate) SetNillableJoinTime

func (sc *StatisticCreate) SetNillableJoinTime(t *time.Time) *StatisticCreate

SetNillableJoinTime sets the "join_time" field if the given value is not nil.

func (*StatisticCreate) SetNillableLastMessage

func (sc *StatisticCreate) SetNillableLastMessage(t *time.Time) *StatisticCreate

SetNillableLastMessage sets the "last_message" field if the given value is not nil.

func (*StatisticCreate) SetNillableLatName

func (sc *StatisticCreate) SetNillableLatName(s *string) *StatisticCreate

SetNillableLatName sets the "lat_name" field if the given value is not nil.

func (*StatisticCreate) SetNillableMessage

func (sc *StatisticCreate) SetNillableMessage(i *int64) *StatisticCreate

SetNillableMessage sets the "message" field if the given value is not nil.

func (*StatisticCreate) SetNillableUserID

func (sc *StatisticCreate) SetNillableUserID(i *int) *StatisticCreate

SetNillableUserID sets the "user_id" field if the given value is not nil.

func (*StatisticCreate) SetNillableUserName

func (sc *StatisticCreate) SetNillableUserName(s *string) *StatisticCreate

SetNillableUserName sets the "user_name" field if the given value is not nil.

func (*StatisticCreate) SetUserID

func (sc *StatisticCreate) SetUserID(i int) *StatisticCreate

SetUserID sets the "user_id" field.

func (*StatisticCreate) SetUserName

func (sc *StatisticCreate) SetUserName(s string) *StatisticCreate

SetUserName sets the "user_name" field.

type StatisticCreateBulk

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

StatisticCreateBulk is the builder for creating many Statistic entities in bulk.

func (*StatisticCreateBulk) Exec

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

Exec executes the query.

func (*StatisticCreateBulk) ExecX

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

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

func (*StatisticCreateBulk) Save

func (scb *StatisticCreateBulk) Save(ctx context.Context) ([]*Statistic, error)

Save creates the Statistic entities in the database.

func (*StatisticCreateBulk) SaveX

func (scb *StatisticCreateBulk) SaveX(ctx context.Context) []*Statistic

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

type StatisticDelete

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

StatisticDelete is the builder for deleting a Statistic entity.

func (*StatisticDelete) Exec

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

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

func (*StatisticDelete) ExecX

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

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

func (*StatisticDelete) Where

Where appends a list predicates to the StatisticDelete builder.

type StatisticDeleteOne

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

StatisticDeleteOne is the builder for deleting a single Statistic entity.

func (*StatisticDeleteOne) Exec

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

Exec executes the deletion query.

func (*StatisticDeleteOne) ExecX

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

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

type StatisticGroupBy

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

StatisticGroupBy is the group-by builder for Statistic entities.

func (*StatisticGroupBy) Aggregate

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

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

func (*StatisticGroupBy) Bool

func (sgb *StatisticGroupBy) Bool(ctx context.Context) (_ bool, err error)

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

func (*StatisticGroupBy) BoolX

func (sgb *StatisticGroupBy) BoolX(ctx context.Context) bool

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

func (*StatisticGroupBy) Bools

func (sgb *StatisticGroupBy) Bools(ctx context.Context) ([]bool, error)

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

func (*StatisticGroupBy) BoolsX

func (sgb *StatisticGroupBy) BoolsX(ctx context.Context) []bool

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

func (*StatisticGroupBy) Float64

func (sgb *StatisticGroupBy) Float64(ctx context.Context) (_ float64, err error)

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

func (*StatisticGroupBy) Float64X

func (sgb *StatisticGroupBy) Float64X(ctx context.Context) float64

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

func (*StatisticGroupBy) Float64s

func (sgb *StatisticGroupBy) Float64s(ctx context.Context) ([]float64, error)

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

func (*StatisticGroupBy) Float64sX

func (sgb *StatisticGroupBy) Float64sX(ctx context.Context) []float64

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

func (*StatisticGroupBy) Int

func (sgb *StatisticGroupBy) Int(ctx context.Context) (_ int, err error)

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

func (*StatisticGroupBy) IntX

func (sgb *StatisticGroupBy) IntX(ctx context.Context) int

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

func (*StatisticGroupBy) Ints

func (sgb *StatisticGroupBy) Ints(ctx context.Context) ([]int, error)

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

func (*StatisticGroupBy) IntsX

func (sgb *StatisticGroupBy) IntsX(ctx context.Context) []int

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

func (*StatisticGroupBy) Scan

func (sgb *StatisticGroupBy) Scan(ctx context.Context, v interface{}) error

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

func (*StatisticGroupBy) ScanX

func (sgb *StatisticGroupBy) ScanX(ctx context.Context, v interface{})

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

func (*StatisticGroupBy) String

func (sgb *StatisticGroupBy) String(ctx context.Context) (_ string, err error)

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

func (*StatisticGroupBy) StringX

func (sgb *StatisticGroupBy) StringX(ctx context.Context) string

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

func (*StatisticGroupBy) Strings

func (sgb *StatisticGroupBy) Strings(ctx context.Context) ([]string, error)

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

func (*StatisticGroupBy) StringsX

func (sgb *StatisticGroupBy) StringsX(ctx context.Context) []string

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

type StatisticMutation

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

StatisticMutation represents an operation that mutates the Statistic nodes in the graph.

func (*StatisticMutation) AddChannelID

func (m *StatisticMutation) AddChannelID(i int64)

AddChannelID adds i to the "channel_id" field.

func (*StatisticMutation) AddField

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

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

func (*StatisticMutation) AddFromUser

func (m *StatisticMutation) AddFromUser(i int)

AddFromUser adds i to the "from_user" field.

func (*StatisticMutation) AddInvited

func (m *StatisticMutation) AddInvited(i int64)

AddInvited adds i to the "invited" field.

func (*StatisticMutation) AddMessage

func (m *StatisticMutation) AddMessage(i int64)

AddMessage adds i to the "message" field.

func (*StatisticMutation) AddUserID

func (m *StatisticMutation) AddUserID(i int)

AddUserID adds i to the "user_id" field.

func (*StatisticMutation) AddedChannelID

func (m *StatisticMutation) AddedChannelID() (r int64, exists bool)

AddedChannelID returns the value that was added to the "channel_id" field in this mutation.

func (*StatisticMutation) AddedEdges

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

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

func (*StatisticMutation) AddedField

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

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

func (*StatisticMutation) AddedFields

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

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

func (*StatisticMutation) AddedFromUser

func (m *StatisticMutation) AddedFromUser() (r int, exists bool)

AddedFromUser returns the value that was added to the "from_user" field in this mutation.

func (*StatisticMutation) AddedIDs

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

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

func (*StatisticMutation) AddedInvited

func (m *StatisticMutation) AddedInvited() (r int64, exists bool)

AddedInvited returns the value that was added to the "invited" field in this mutation.

func (*StatisticMutation) AddedMessage

func (m *StatisticMutation) AddedMessage() (r int64, exists bool)

AddedMessage returns the value that was added to the "message" field in this mutation.

func (*StatisticMutation) AddedUserID

func (m *StatisticMutation) AddedUserID() (r int, exists bool)

AddedUserID returns the value that was added to the "user_id" field in this mutation.

func (*StatisticMutation) ChannelID

func (m *StatisticMutation) ChannelID() (r int64, exists bool)

ChannelID returns the value of the "channel_id" field in the mutation.

func (*StatisticMutation) ClearEdge

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

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

func (*StatisticMutation) ClearField

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

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

func (*StatisticMutation) ClearedEdges

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

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

func (*StatisticMutation) ClearedFields

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

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

func (StatisticMutation) Client

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

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

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

func (*StatisticMutation) Field

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

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

func (*StatisticMutation) FieldCleared

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

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

func (*StatisticMutation) Fields

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

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

func (*StatisticMutation) FirstName

func (m *StatisticMutation) FirstName() (r string, exists bool)

FirstName returns the value of the "first_name" field in the mutation.

func (*StatisticMutation) FromUser

func (m *StatisticMutation) FromUser() (r int, exists bool)

FromUser returns the value of the "from_user" field in the mutation.

func (*StatisticMutation) ID

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

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

func (*StatisticMutation) Invited

func (m *StatisticMutation) Invited() (r int64, exists bool)

Invited returns the value of the "invited" field in the mutation.

func (*StatisticMutation) JoinTime

func (m *StatisticMutation) JoinTime() (r time.Time, exists bool)

JoinTime returns the value of the "join_time" field in the mutation.

func (*StatisticMutation) LastMessage

func (m *StatisticMutation) LastMessage() (r time.Time, exists bool)

LastMessage returns the value of the "last_message" field in the mutation.

func (*StatisticMutation) LatName

func (m *StatisticMutation) LatName() (r string, exists bool)

LatName returns the value of the "lat_name" field in the mutation.

func (*StatisticMutation) Message

func (m *StatisticMutation) Message() (r int64, exists bool)

Message returns the value of the "message" field in the mutation.

func (*StatisticMutation) OldChannelID

func (m *StatisticMutation) OldChannelID(ctx context.Context) (v int64, err error)

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

func (*StatisticMutation) OldField

func (m *StatisticMutation) OldField(ctx context.Context, name string) (ent.Value, error)

OldField returns the old value of the field from the database. An error is returned if the mutation operation is not UpdateOne, or the query to the database failed.

func (*StatisticMutation) OldFirstName

func (m *StatisticMutation) OldFirstName(ctx context.Context) (v string, err error)

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

func (*StatisticMutation) OldFromUser

func (m *StatisticMutation) OldFromUser(ctx context.Context) (v int, err error)

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

func (*StatisticMutation) OldInvited

func (m *StatisticMutation) OldInvited(ctx context.Context) (v int64, err error)

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

func (*StatisticMutation) OldJoinTime

func (m *StatisticMutation) OldJoinTime(ctx context.Context) (v time.Time, err error)

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

func (*StatisticMutation) OldLastMessage

func (m *StatisticMutation) OldLastMessage(ctx context.Context) (v time.Time, err error)

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

func (*StatisticMutation) OldLatName

func (m *StatisticMutation) OldLatName(ctx context.Context) (v string, err error)

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

func (*StatisticMutation) OldMessage

func (m *StatisticMutation) OldMessage(ctx context.Context) (v int64, err error)

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

func (*StatisticMutation) OldUserID

func (m *StatisticMutation) OldUserID(ctx context.Context) (v int, err error)

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

func (*StatisticMutation) OldUserName

func (m *StatisticMutation) OldUserName(ctx context.Context) (v string, err error)

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

func (*StatisticMutation) Op

func (m *StatisticMutation) Op() Op

Op returns the operation name.

func (*StatisticMutation) RemovedEdges

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

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

func (*StatisticMutation) RemovedIDs

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

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

func (*StatisticMutation) ResetChannelID

func (m *StatisticMutation) ResetChannelID()

ResetChannelID resets all changes to the "channel_id" field.

func (*StatisticMutation) ResetEdge

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

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

func (*StatisticMutation) ResetField

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

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

func (*StatisticMutation) ResetFirstName

func (m *StatisticMutation) ResetFirstName()

ResetFirstName resets all changes to the "first_name" field.

func (*StatisticMutation) ResetFromUser

func (m *StatisticMutation) ResetFromUser()

ResetFromUser resets all changes to the "from_user" field.

func (*StatisticMutation) ResetInvited

func (m *StatisticMutation) ResetInvited()

ResetInvited resets all changes to the "invited" field.

func (*StatisticMutation) ResetJoinTime

func (m *StatisticMutation) ResetJoinTime()

ResetJoinTime resets all changes to the "join_time" field.

func (*StatisticMutation) ResetLastMessage

func (m *StatisticMutation) ResetLastMessage()

ResetLastMessage resets all changes to the "last_message" field.

func (*StatisticMutation) ResetLatName

func (m *StatisticMutation) ResetLatName()

ResetLatName resets all changes to the "lat_name" field.

func (*StatisticMutation) ResetMessage

func (m *StatisticMutation) ResetMessage()

ResetMessage resets all changes to the "message" field.

func (*StatisticMutation) ResetUserID

func (m *StatisticMutation) ResetUserID()

ResetUserID resets all changes to the "user_id" field.

func (*StatisticMutation) ResetUserName

func (m *StatisticMutation) ResetUserName()

ResetUserName resets all changes to the "user_name" field.

func (*StatisticMutation) SetChannelID

func (m *StatisticMutation) SetChannelID(i int64)

SetChannelID sets the "channel_id" field.

func (*StatisticMutation) SetField

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

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

func (*StatisticMutation) SetFirstName

func (m *StatisticMutation) SetFirstName(s string)

SetFirstName sets the "first_name" field.

func (*StatisticMutation) SetFromUser

func (m *StatisticMutation) SetFromUser(i int)

SetFromUser sets the "from_user" field.

func (*StatisticMutation) SetInvited

func (m *StatisticMutation) SetInvited(i int64)

SetInvited sets the "invited" field.

func (*StatisticMutation) SetJoinTime

func (m *StatisticMutation) SetJoinTime(t time.Time)

SetJoinTime sets the "join_time" field.

func (*StatisticMutation) SetLastMessage

func (m *StatisticMutation) SetLastMessage(t time.Time)

SetLastMessage sets the "last_message" field.

func (*StatisticMutation) SetLatName

func (m *StatisticMutation) SetLatName(s string)

SetLatName sets the "lat_name" field.

func (*StatisticMutation) SetMessage

func (m *StatisticMutation) SetMessage(i int64)

SetMessage sets the "message" field.

func (*StatisticMutation) SetUserID

func (m *StatisticMutation) SetUserID(i int)

SetUserID sets the "user_id" field.

func (*StatisticMutation) SetUserName

func (m *StatisticMutation) SetUserName(s string)

SetUserName sets the "user_name" field.

func (StatisticMutation) Tx

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

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

func (*StatisticMutation) Type

func (m *StatisticMutation) Type() string

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

func (*StatisticMutation) UserID

func (m *StatisticMutation) UserID() (r int, exists bool)

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

func (*StatisticMutation) UserName

func (m *StatisticMutation) UserName() (r string, exists bool)

UserName returns the value of the "user_name" field in the mutation.

func (*StatisticMutation) Where

func (m *StatisticMutation) Where(ps ...predicate.Statistic)

Where appends a list predicates to the StatisticMutation builder.

type StatisticQuery

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

StatisticQuery is the builder for querying Statistic entities.

func (*StatisticQuery) All

func (sq *StatisticQuery) All(ctx context.Context) ([]*Statistic, error)

All executes the query and returns a list of Statistics.

func (*StatisticQuery) AllX

func (sq *StatisticQuery) AllX(ctx context.Context) []*Statistic

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

func (*StatisticQuery) Clone

func (sq *StatisticQuery) Clone() *StatisticQuery

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

func (*StatisticQuery) Count

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

Count returns the count of the given query.

func (*StatisticQuery) CountX

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

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

func (*StatisticQuery) Exist

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

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

func (*StatisticQuery) ExistX

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

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

func (*StatisticQuery) First

func (sq *StatisticQuery) First(ctx context.Context) (*Statistic, error)

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

func (*StatisticQuery) FirstID

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

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

func (*StatisticQuery) FirstIDX

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

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

func (*StatisticQuery) FirstX

func (sq *StatisticQuery) FirstX(ctx context.Context) *Statistic

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

func (*StatisticQuery) GroupBy

func (sq *StatisticQuery) GroupBy(field string, fields ...string) *StatisticGroupBy

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

Example:

var v []struct {
	FirstName string `json:"first_name,omitempty"`
	Count int `json:"count,omitempty"`
}

client.Statistic.Query().
	GroupBy(statistic.FieldFirstName).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*StatisticQuery) IDs

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

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

func (*StatisticQuery) IDsX

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

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

func (*StatisticQuery) Limit

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

Limit adds a limit step to the query.

func (*StatisticQuery) Offset

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

Offset adds an offset step to the query.

func (*StatisticQuery) Only

func (sq *StatisticQuery) Only(ctx context.Context) (*Statistic, error)

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

func (*StatisticQuery) OnlyID

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

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

func (*StatisticQuery) OnlyIDX

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

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

func (*StatisticQuery) OnlyX

func (sq *StatisticQuery) OnlyX(ctx context.Context) *Statistic

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

func (*StatisticQuery) Order

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

Order adds an order step to the query.

func (*StatisticQuery) Select

func (sq *StatisticQuery) Select(fields ...string) *StatisticSelect

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

Example:

var v []struct {
	FirstName string `json:"first_name,omitempty"`
}

client.Statistic.Query().
	Select(statistic.FieldFirstName).
	Scan(ctx, &v)

func (*StatisticQuery) Unique

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

Unique configures the query builder to filter duplicate records on query. By default, unique is set to true, and can be disabled using this method.

func (*StatisticQuery) Where

Where adds a new predicate for the StatisticQuery builder.

type StatisticSelect

type StatisticSelect struct {
	*StatisticQuery
	// contains filtered or unexported fields
}

StatisticSelect is the builder for selecting fields of Statistic entities.

func (*StatisticSelect) Bool

func (ss *StatisticSelect) Bool(ctx context.Context) (_ bool, err error)

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

func (*StatisticSelect) BoolX

func (ss *StatisticSelect) BoolX(ctx context.Context) bool

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

func (*StatisticSelect) Bools

func (ss *StatisticSelect) Bools(ctx context.Context) ([]bool, error)

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

func (*StatisticSelect) BoolsX

func (ss *StatisticSelect) BoolsX(ctx context.Context) []bool

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

func (*StatisticSelect) Float64

func (ss *StatisticSelect) Float64(ctx context.Context) (_ float64, err error)

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

func (*StatisticSelect) Float64X

func (ss *StatisticSelect) Float64X(ctx context.Context) float64

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

func (*StatisticSelect) Float64s

func (ss *StatisticSelect) Float64s(ctx context.Context) ([]float64, error)

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

func (*StatisticSelect) Float64sX

func (ss *StatisticSelect) Float64sX(ctx context.Context) []float64

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

func (*StatisticSelect) Int

func (ss *StatisticSelect) Int(ctx context.Context) (_ int, err error)

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

func (*StatisticSelect) IntX

func (ss *StatisticSelect) IntX(ctx context.Context) int

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

func (*StatisticSelect) Ints

func (ss *StatisticSelect) Ints(ctx context.Context) ([]int, error)

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

func (*StatisticSelect) IntsX

func (ss *StatisticSelect) IntsX(ctx context.Context) []int

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

func (*StatisticSelect) Scan

func (ss *StatisticSelect) Scan(ctx context.Context, v interface{}) error

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

func (*StatisticSelect) ScanX

func (ss *StatisticSelect) ScanX(ctx context.Context, v interface{})

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

func (*StatisticSelect) String

func (ss *StatisticSelect) String(ctx context.Context) (_ string, err error)

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

func (*StatisticSelect) StringX

func (ss *StatisticSelect) StringX(ctx context.Context) string

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

func (*StatisticSelect) Strings

func (ss *StatisticSelect) Strings(ctx context.Context) ([]string, error)

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

func (*StatisticSelect) StringsX

func (ss *StatisticSelect) StringsX(ctx context.Context) []string

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

type StatisticUpdate

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

StatisticUpdate is the builder for updating Statistic entities.

func (*StatisticUpdate) AddChannelID

func (su *StatisticUpdate) AddChannelID(i int64) *StatisticUpdate

AddChannelID adds i to the "channel_id" field.

func (*StatisticUpdate) AddFromUser

func (su *StatisticUpdate) AddFromUser(i int) *StatisticUpdate

AddFromUser adds i to the "from_user" field.

func (*StatisticUpdate) AddInvited

func (su *StatisticUpdate) AddInvited(i int64) *StatisticUpdate

AddInvited adds i to the "invited" field.

func (*StatisticUpdate) AddMessage

func (su *StatisticUpdate) AddMessage(i int64) *StatisticUpdate

AddMessage adds i to the "message" field.

func (*StatisticUpdate) AddUserID

func (su *StatisticUpdate) AddUserID(i int) *StatisticUpdate

AddUserID adds i to the "user_id" field.

func (*StatisticUpdate) Exec

func (su *StatisticUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*StatisticUpdate) ExecX

func (su *StatisticUpdate) ExecX(ctx context.Context)

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

func (*StatisticUpdate) Mutation

func (su *StatisticUpdate) Mutation() *StatisticMutation

Mutation returns the StatisticMutation object of the builder.

func (*StatisticUpdate) Save

func (su *StatisticUpdate) Save(ctx context.Context) (int, error)

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

func (*StatisticUpdate) SaveX

func (su *StatisticUpdate) SaveX(ctx context.Context) int

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

func (*StatisticUpdate) SetChannelID

func (su *StatisticUpdate) SetChannelID(i int64) *StatisticUpdate

SetChannelID sets the "channel_id" field.

func (*StatisticUpdate) SetFirstName

func (su *StatisticUpdate) SetFirstName(s string) *StatisticUpdate

SetFirstName sets the "first_name" field.

func (*StatisticUpdate) SetFromUser

func (su *StatisticUpdate) SetFromUser(i int) *StatisticUpdate

SetFromUser sets the "from_user" field.

func (*StatisticUpdate) SetInvited

func (su *StatisticUpdate) SetInvited(i int64) *StatisticUpdate

SetInvited sets the "invited" field.

func (*StatisticUpdate) SetJoinTime

func (su *StatisticUpdate) SetJoinTime(t time.Time) *StatisticUpdate

SetJoinTime sets the "join_time" field.

func (*StatisticUpdate) SetLastMessage

func (su *StatisticUpdate) SetLastMessage(t time.Time) *StatisticUpdate

SetLastMessage sets the "last_message" field.

func (*StatisticUpdate) SetLatName

func (su *StatisticUpdate) SetLatName(s string) *StatisticUpdate

SetLatName sets the "lat_name" field.

func (*StatisticUpdate) SetMessage

func (su *StatisticUpdate) SetMessage(i int64) *StatisticUpdate

SetMessage sets the "message" field.

func (*StatisticUpdate) SetNillableChannelID

func (su *StatisticUpdate) SetNillableChannelID(i *int64) *StatisticUpdate

SetNillableChannelID sets the "channel_id" field if the given value is not nil.

func (*StatisticUpdate) SetNillableFirstName

func (su *StatisticUpdate) SetNillableFirstName(s *string) *StatisticUpdate

SetNillableFirstName sets the "first_name" field if the given value is not nil.

func (*StatisticUpdate) SetNillableFromUser

func (su *StatisticUpdate) SetNillableFromUser(i *int) *StatisticUpdate

SetNillableFromUser sets the "from_user" field if the given value is not nil.

func (*StatisticUpdate) SetNillableInvited

func (su *StatisticUpdate) SetNillableInvited(i *int64) *StatisticUpdate

SetNillableInvited sets the "invited" field if the given value is not nil.

func (*StatisticUpdate) SetNillableJoinTime

func (su *StatisticUpdate) SetNillableJoinTime(t *time.Time) *StatisticUpdate

SetNillableJoinTime sets the "join_time" field if the given value is not nil.

func (*StatisticUpdate) SetNillableLastMessage

func (su *StatisticUpdate) SetNillableLastMessage(t *time.Time) *StatisticUpdate

SetNillableLastMessage sets the "last_message" field if the given value is not nil.

func (*StatisticUpdate) SetNillableLatName

func (su *StatisticUpdate) SetNillableLatName(s *string) *StatisticUpdate

SetNillableLatName sets the "lat_name" field if the given value is not nil.

func (*StatisticUpdate) SetNillableMessage

func (su *StatisticUpdate) SetNillableMessage(i *int64) *StatisticUpdate

SetNillableMessage sets the "message" field if the given value is not nil.

func (*StatisticUpdate) SetNillableUserID

func (su *StatisticUpdate) SetNillableUserID(i *int) *StatisticUpdate

SetNillableUserID sets the "user_id" field if the given value is not nil.

func (*StatisticUpdate) SetNillableUserName

func (su *StatisticUpdate) SetNillableUserName(s *string) *StatisticUpdate

SetNillableUserName sets the "user_name" field if the given value is not nil.

func (*StatisticUpdate) SetUserID

func (su *StatisticUpdate) SetUserID(i int) *StatisticUpdate

SetUserID sets the "user_id" field.

func (*StatisticUpdate) SetUserName

func (su *StatisticUpdate) SetUserName(s string) *StatisticUpdate

SetUserName sets the "user_name" field.

func (*StatisticUpdate) Where

Where appends a list predicates to the StatisticUpdate builder.

type StatisticUpdateOne

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

StatisticUpdateOne is the builder for updating a single Statistic entity.

func (*StatisticUpdateOne) AddChannelID

func (suo *StatisticUpdateOne) AddChannelID(i int64) *StatisticUpdateOne

AddChannelID adds i to the "channel_id" field.

func (*StatisticUpdateOne) AddFromUser

func (suo *StatisticUpdateOne) AddFromUser(i int) *StatisticUpdateOne

AddFromUser adds i to the "from_user" field.

func (*StatisticUpdateOne) AddInvited

func (suo *StatisticUpdateOne) AddInvited(i int64) *StatisticUpdateOne

AddInvited adds i to the "invited" field.

func (*StatisticUpdateOne) AddMessage

func (suo *StatisticUpdateOne) AddMessage(i int64) *StatisticUpdateOne

AddMessage adds i to the "message" field.

func (*StatisticUpdateOne) AddUserID

func (suo *StatisticUpdateOne) AddUserID(i int) *StatisticUpdateOne

AddUserID adds i to the "user_id" field.

func (*StatisticUpdateOne) Exec

func (suo *StatisticUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*StatisticUpdateOne) ExecX

func (suo *StatisticUpdateOne) ExecX(ctx context.Context)

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

func (*StatisticUpdateOne) Mutation

func (suo *StatisticUpdateOne) Mutation() *StatisticMutation

Mutation returns the StatisticMutation object of the builder.

func (*StatisticUpdateOne) Save

func (suo *StatisticUpdateOne) Save(ctx context.Context) (*Statistic, error)

Save executes the query and returns the updated Statistic entity.

func (*StatisticUpdateOne) SaveX

func (suo *StatisticUpdateOne) SaveX(ctx context.Context) *Statistic

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

func (*StatisticUpdateOne) Select

func (suo *StatisticUpdateOne) Select(field string, fields ...string) *StatisticUpdateOne

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

func (*StatisticUpdateOne) SetChannelID

func (suo *StatisticUpdateOne) SetChannelID(i int64) *StatisticUpdateOne

SetChannelID sets the "channel_id" field.

func (*StatisticUpdateOne) SetFirstName

func (suo *StatisticUpdateOne) SetFirstName(s string) *StatisticUpdateOne

SetFirstName sets the "first_name" field.

func (*StatisticUpdateOne) SetFromUser

func (suo *StatisticUpdateOne) SetFromUser(i int) *StatisticUpdateOne

SetFromUser sets the "from_user" field.

func (*StatisticUpdateOne) SetInvited

func (suo *StatisticUpdateOne) SetInvited(i int64) *StatisticUpdateOne

SetInvited sets the "invited" field.

func (*StatisticUpdateOne) SetJoinTime

func (suo *StatisticUpdateOne) SetJoinTime(t time.Time) *StatisticUpdateOne

SetJoinTime sets the "join_time" field.

func (*StatisticUpdateOne) SetLastMessage

func (suo *StatisticUpdateOne) SetLastMessage(t time.Time) *StatisticUpdateOne

SetLastMessage sets the "last_message" field.

func (*StatisticUpdateOne) SetLatName

func (suo *StatisticUpdateOne) SetLatName(s string) *StatisticUpdateOne

SetLatName sets the "lat_name" field.

func (*StatisticUpdateOne) SetMessage

func (suo *StatisticUpdateOne) SetMessage(i int64) *StatisticUpdateOne

SetMessage sets the "message" field.

func (*StatisticUpdateOne) SetNillableChannelID

func (suo *StatisticUpdateOne) SetNillableChannelID(i *int64) *StatisticUpdateOne

SetNillableChannelID sets the "channel_id" field if the given value is not nil.

func (*StatisticUpdateOne) SetNillableFirstName

func (suo *StatisticUpdateOne) SetNillableFirstName(s *string) *StatisticUpdateOne

SetNillableFirstName sets the "first_name" field if the given value is not nil.

func (*StatisticUpdateOne) SetNillableFromUser

func (suo *StatisticUpdateOne) SetNillableFromUser(i *int) *StatisticUpdateOne

SetNillableFromUser sets the "from_user" field if the given value is not nil.

func (*StatisticUpdateOne) SetNillableInvited

func (suo *StatisticUpdateOne) SetNillableInvited(i *int64) *StatisticUpdateOne

SetNillableInvited sets the "invited" field if the given value is not nil.

func (*StatisticUpdateOne) SetNillableJoinTime

func (suo *StatisticUpdateOne) SetNillableJoinTime(t *time.Time) *StatisticUpdateOne

SetNillableJoinTime sets the "join_time" field if the given value is not nil.

func (*StatisticUpdateOne) SetNillableLastMessage

func (suo *StatisticUpdateOne) SetNillableLastMessage(t *time.Time) *StatisticUpdateOne

SetNillableLastMessage sets the "last_message" field if the given value is not nil.

func (*StatisticUpdateOne) SetNillableLatName

func (suo *StatisticUpdateOne) SetNillableLatName(s *string) *StatisticUpdateOne

SetNillableLatName sets the "lat_name" field if the given value is not nil.

func (*StatisticUpdateOne) SetNillableMessage

func (suo *StatisticUpdateOne) SetNillableMessage(i *int64) *StatisticUpdateOne

SetNillableMessage sets the "message" field if the given value is not nil.

func (*StatisticUpdateOne) SetNillableUserID

func (suo *StatisticUpdateOne) SetNillableUserID(i *int) *StatisticUpdateOne

SetNillableUserID sets the "user_id" field if the given value is not nil.

func (*StatisticUpdateOne) SetNillableUserName

func (suo *StatisticUpdateOne) SetNillableUserName(s *string) *StatisticUpdateOne

SetNillableUserName sets the "user_name" field if the given value is not nil.

func (*StatisticUpdateOne) SetUserID

func (suo *StatisticUpdateOne) SetUserID(i int) *StatisticUpdateOne

SetUserID sets the "user_id" field.

func (*StatisticUpdateOne) SetUserName

func (suo *StatisticUpdateOne) SetUserName(s string) *StatisticUpdateOne

SetUserName sets the "user_name" field.

type Statistics

type Statistics []*Statistic

Statistics is a parsable slice of Statistic.

type Tx

type Tx struct {

	// Command is the client for interacting with the Command builders.
	Command *CommandClient
	// Message is the client for interacting with the Message builders.
	Message *MessageClient
	// Statistic is the client for interacting with the Statistic builders.
	Statistic *StatisticClient
	// contains filtered or unexported fields
}

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

func TxFromContext

func TxFromContext(ctx context.Context) *Tx

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

func (*Tx) Client

func (tx *Tx) Client() *Client

Client returns a Client that binds to current transaction.

func (*Tx) Commit

func (tx *Tx) Commit() error

Commit commits the transaction.

func (*Tx) OnCommit

func (tx *Tx) OnCommit(f CommitHook)

OnCommit adds a hook to call on commit.

func (*Tx) OnRollback

func (tx *Tx) OnRollback(f RollbackHook)

OnRollback adds a hook to call on rollback.

func (*Tx) Rollback

func (tx *Tx) Rollback() error

Rollback rollbacks the transaction.

type ValidationError

type ValidationError struct {
	Name string // Field or edge name.
	// contains filtered or unexported fields
}

ValidationError returns when validating a field fails.

func (*ValidationError) Error

func (e *ValidationError) Error() string

Error implements the error interface.

func (*ValidationError) Unwrap

func (e *ValidationError) Unwrap() error

Unwrap implements the errors.Wrapper interface.

type Value

type Value = ent.Value

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL