ent

package
v0.0.0-...-dba37e9 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2021 License: Apache-2.0 Imports: 21 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.
	TypeGroupBandwidth = "GroupBandwidth"
	TypeGroups         = "Groups"
	TypeOnlineSession  = "OnlineSession"
	TypeUsers          = "Users"
)

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
	// GroupBandwidth is the client for interacting with the GroupBandwidth builders.
	GroupBandwidth *GroupBandwidthClient
	// Groups is the client for interacting with the Groups builders.
	Groups *GroupsClient
	// OnlineSession is the client for interacting with the OnlineSession builders.
	OnlineSession *OnlineSessionClient
	// Users is the client for interacting with the Users builders.
	Users *UsersClient
	// 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().
	GroupBandwidth.
	Query().
	Count(ctx)

func (*Client) Tx

func (c *Client) Tx(ctx context.Context) (*Tx, error)

Tx returns a new transactional client. The provided context is used until the transaction is committed or rolled back.

func (*Client) Use

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

Use adds the mutation hooks to all the entity clients. In order to add hooks to a specific client, call: `client.Node.Use(...)`.

type CommitFunc

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

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

func (CommitFunc) Commit

func (f CommitFunc) Commit(ctx context.Context, tx *Tx) error

Commit calls f(ctx, m).

type CommitHook

type CommitHook func(Committer) Committer

CommitHook defines the "commit middleware". A function that gets a Committer and returns a Committer. For example:

hook := func(next ent.Committer) ent.Committer {
	return ent.CommitFunc(func(context.Context, tx *ent.Tx) error {
		// Do some stuff before.
		if err := next.Commit(ctx, tx); err != nil {
			return err
		}
		// Do some stuff after.
		return nil
	})
}

type Committer

type Committer interface {
	Commit(context.Context, *Tx) error
}

Committer is the interface that wraps the Committer method.

type ConstraintError

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

ConstraintError returns when trying to create/update one or more entities and one or more of their constraints failed. For example, violation of edge or field uniqueness.

func (ConstraintError) Error

func (e ConstraintError) Error() string

Error implements the error interface.

func (*ConstraintError) Unwrap

func (e *ConstraintError) Unwrap() error

Unwrap implements the errors.Wrapper interface.

type GroupBandwidth

type GroupBandwidth struct {

	// ID of the ent.
	ID int `json:"id,omitempty"`
	// GbwDownloadSpeed holds the value of the "gbw_download_speed" field.
	GbwDownloadSpeed int `json:"gbw_download_speed,omitempty"`
	// GbwUploadSpeed holds the value of the "gbw_upload_speed" field.
	GbwUploadSpeed int `json:"gbw_upload_speed,omitempty"`
	// GbwCreatedAt holds the value of the "gbw_created_at" field.
	GbwCreatedAt time.Time `json:"gbw_created_at,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the GroupBandwidthQuery when eager-loading is set.
	Edges GroupBandwidthEdges `json:"edges"`
	// contains filtered or unexported fields
}

GroupBandwidth is the model entity for the GroupBandwidth schema.

func (*GroupBandwidth) QueryGroups

func (gb *GroupBandwidth) QueryGroups() *GroupsQuery

QueryGroups queries the "groups" edge of the GroupBandwidth entity.

func (*GroupBandwidth) String

func (gb *GroupBandwidth) String() string

String implements the fmt.Stringer.

func (*GroupBandwidth) Unwrap

func (gb *GroupBandwidth) Unwrap() *GroupBandwidth

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

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

type GroupBandwidthClient

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

GroupBandwidthClient is a client for the GroupBandwidth schema.

func NewGroupBandwidthClient

func NewGroupBandwidthClient(c config) *GroupBandwidthClient

NewGroupBandwidthClient returns a client for the GroupBandwidth from the given config.

func (*GroupBandwidthClient) Create

Create returns a create builder for GroupBandwidth.

func (*GroupBandwidthClient) CreateBulk

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

func (*GroupBandwidthClient) Delete

Delete returns a delete builder for GroupBandwidth.

func (*GroupBandwidthClient) DeleteOne

DeleteOne returns a delete builder for the given entity.

func (*GroupBandwidthClient) DeleteOneID

func (c *GroupBandwidthClient) DeleteOneID(id int) *GroupBandwidthDeleteOne

DeleteOneID returns a delete builder for the given id.

func (*GroupBandwidthClient) Get

Get returns a GroupBandwidth entity by its id.

func (*GroupBandwidthClient) GetX

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

func (*GroupBandwidthClient) Hooks

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

Hooks returns the client hooks.

func (*GroupBandwidthClient) Query

Query returns a query builder for GroupBandwidth.

func (*GroupBandwidthClient) QueryGroups

func (c *GroupBandwidthClient) QueryGroups(gb *GroupBandwidth) *GroupsQuery

QueryGroups queries the groups edge of a GroupBandwidth.

func (*GroupBandwidthClient) Update

Update returns an update builder for GroupBandwidth.

func (*GroupBandwidthClient) UpdateOne

UpdateOne returns an update builder for the given entity.

func (*GroupBandwidthClient) UpdateOneID

func (c *GroupBandwidthClient) UpdateOneID(id int) *GroupBandwidthUpdateOne

UpdateOneID returns an update builder for the given id.

func (*GroupBandwidthClient) Use

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

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

type GroupBandwidthCreate

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

GroupBandwidthCreate is the builder for creating a GroupBandwidth entity.

func (*GroupBandwidthCreate) AddGroupIDs

func (gbc *GroupBandwidthCreate) AddGroupIDs(ids ...int) *GroupBandwidthCreate

AddGroupIDs adds the "groups" edge to the Groups entity by IDs.

func (*GroupBandwidthCreate) AddGroups

func (gbc *GroupBandwidthCreate) AddGroups(g ...*Groups) *GroupBandwidthCreate

AddGroups adds the "groups" edges to the Groups entity.

func (*GroupBandwidthCreate) Exec

func (gbc *GroupBandwidthCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*GroupBandwidthCreate) ExecX

func (gbc *GroupBandwidthCreate) ExecX(ctx context.Context)

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

func (*GroupBandwidthCreate) Mutation

Mutation returns the GroupBandwidthMutation object of the builder.

func (*GroupBandwidthCreate) Save

Save creates the GroupBandwidth in the database.

func (*GroupBandwidthCreate) SaveX

SaveX calls Save and panics if Save returns an error.

func (*GroupBandwidthCreate) SetGbwCreatedAt

func (gbc *GroupBandwidthCreate) SetGbwCreatedAt(t time.Time) *GroupBandwidthCreate

SetGbwCreatedAt sets the "gbw_created_at" field.

func (*GroupBandwidthCreate) SetGbwDownloadSpeed

func (gbc *GroupBandwidthCreate) SetGbwDownloadSpeed(i int) *GroupBandwidthCreate

SetGbwDownloadSpeed sets the "gbw_download_speed" field.

func (*GroupBandwidthCreate) SetGbwUploadSpeed

func (gbc *GroupBandwidthCreate) SetGbwUploadSpeed(i int) *GroupBandwidthCreate

SetGbwUploadSpeed sets the "gbw_upload_speed" field.

func (*GroupBandwidthCreate) SetNillableGbwCreatedAt

func (gbc *GroupBandwidthCreate) SetNillableGbwCreatedAt(t *time.Time) *GroupBandwidthCreate

SetNillableGbwCreatedAt sets the "gbw_created_at" field if the given value is not nil.

type GroupBandwidthCreateBulk

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

GroupBandwidthCreateBulk is the builder for creating many GroupBandwidth entities in bulk.

func (*GroupBandwidthCreateBulk) Exec

Exec executes the query.

func (*GroupBandwidthCreateBulk) ExecX

func (gbcb *GroupBandwidthCreateBulk) ExecX(ctx context.Context)

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

func (*GroupBandwidthCreateBulk) Save

Save creates the GroupBandwidth entities in the database.

func (*GroupBandwidthCreateBulk) SaveX

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

type GroupBandwidthDelete

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

GroupBandwidthDelete is the builder for deleting a GroupBandwidth entity.

func (*GroupBandwidthDelete) Exec

func (gbd *GroupBandwidthDelete) Exec(ctx context.Context) (int, error)

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

func (*GroupBandwidthDelete) ExecX

func (gbd *GroupBandwidthDelete) ExecX(ctx context.Context) int

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

func (*GroupBandwidthDelete) Where

Where appends a list predicates to the GroupBandwidthDelete builder.

type GroupBandwidthDeleteOne

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

GroupBandwidthDeleteOne is the builder for deleting a single GroupBandwidth entity.

func (*GroupBandwidthDeleteOne) Exec

func (gbdo *GroupBandwidthDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*GroupBandwidthDeleteOne) ExecX

func (gbdo *GroupBandwidthDeleteOne) ExecX(ctx context.Context)

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

type GroupBandwidthEdges

type GroupBandwidthEdges struct {
	// Groups holds the value of the groups edge.
	Groups []*Groups `json:"groups,omitempty"`
	// contains filtered or unexported fields
}

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

func (GroupBandwidthEdges) GroupsOrErr

func (e GroupBandwidthEdges) GroupsOrErr() ([]*Groups, error)

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

type GroupBandwidthGroupBy

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

GroupBandwidthGroupBy is the group-by builder for GroupBandwidth entities.

func (*GroupBandwidthGroupBy) Aggregate

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

func (*GroupBandwidthGroupBy) Bool

func (gbgb *GroupBandwidthGroupBy) 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 (*GroupBandwidthGroupBy) BoolX

func (gbgb *GroupBandwidthGroupBy) BoolX(ctx context.Context) bool

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

func (*GroupBandwidthGroupBy) Bools

func (gbgb *GroupBandwidthGroupBy) 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 (*GroupBandwidthGroupBy) BoolsX

func (gbgb *GroupBandwidthGroupBy) BoolsX(ctx context.Context) []bool

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

func (*GroupBandwidthGroupBy) Float64

func (gbgb *GroupBandwidthGroupBy) 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 (*GroupBandwidthGroupBy) Float64X

func (gbgb *GroupBandwidthGroupBy) Float64X(ctx context.Context) float64

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

func (*GroupBandwidthGroupBy) Float64s

func (gbgb *GroupBandwidthGroupBy) 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 (*GroupBandwidthGroupBy) Float64sX

func (gbgb *GroupBandwidthGroupBy) Float64sX(ctx context.Context) []float64

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

func (*GroupBandwidthGroupBy) Int

func (gbgb *GroupBandwidthGroupBy) 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 (*GroupBandwidthGroupBy) IntX

func (gbgb *GroupBandwidthGroupBy) IntX(ctx context.Context) int

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

func (*GroupBandwidthGroupBy) Ints

func (gbgb *GroupBandwidthGroupBy) 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 (*GroupBandwidthGroupBy) IntsX

func (gbgb *GroupBandwidthGroupBy) IntsX(ctx context.Context) []int

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

func (*GroupBandwidthGroupBy) Scan

func (gbgb *GroupBandwidthGroupBy) Scan(ctx context.Context, v interface{}) error

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

func (*GroupBandwidthGroupBy) ScanX

func (gbgb *GroupBandwidthGroupBy) ScanX(ctx context.Context, v interface{})

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

func (*GroupBandwidthGroupBy) String

func (gbgb *GroupBandwidthGroupBy) 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 (*GroupBandwidthGroupBy) StringX

func (gbgb *GroupBandwidthGroupBy) StringX(ctx context.Context) string

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

func (*GroupBandwidthGroupBy) Strings

func (gbgb *GroupBandwidthGroupBy) 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 (*GroupBandwidthGroupBy) StringsX

func (gbgb *GroupBandwidthGroupBy) StringsX(ctx context.Context) []string

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

type GroupBandwidthMutation

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

GroupBandwidthMutation represents an operation that mutates the GroupBandwidth nodes in the graph.

func (*GroupBandwidthMutation) AddField

func (m *GroupBandwidthMutation) 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 (*GroupBandwidthMutation) AddGbwDownloadSpeed

func (m *GroupBandwidthMutation) AddGbwDownloadSpeed(i int)

AddGbwDownloadSpeed adds i to the "gbw_download_speed" field.

func (*GroupBandwidthMutation) AddGbwUploadSpeed

func (m *GroupBandwidthMutation) AddGbwUploadSpeed(i int)

AddGbwUploadSpeed adds i to the "gbw_upload_speed" field.

func (*GroupBandwidthMutation) AddGroupIDs

func (m *GroupBandwidthMutation) AddGroupIDs(ids ...int)

AddGroupIDs adds the "groups" edge to the Groups entity by ids.

func (*GroupBandwidthMutation) AddedEdges

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

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

func (*GroupBandwidthMutation) AddedField

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

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

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

func (*GroupBandwidthMutation) AddedGbwDownloadSpeed

func (m *GroupBandwidthMutation) AddedGbwDownloadSpeed() (r int, exists bool)

AddedGbwDownloadSpeed returns the value that was added to the "gbw_download_speed" field in this mutation.

func (*GroupBandwidthMutation) AddedGbwUploadSpeed

func (m *GroupBandwidthMutation) AddedGbwUploadSpeed() (r int, exists bool)

AddedGbwUploadSpeed returns the value that was added to the "gbw_upload_speed" field in this mutation.

func (*GroupBandwidthMutation) AddedIDs

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

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

func (*GroupBandwidthMutation) ClearEdge

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

func (m *GroupBandwidthMutation) 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 (*GroupBandwidthMutation) ClearGbwCreatedAt

func (m *GroupBandwidthMutation) ClearGbwCreatedAt()

ClearGbwCreatedAt clears the value of the "gbw_created_at" field.

func (*GroupBandwidthMutation) ClearGroups

func (m *GroupBandwidthMutation) ClearGroups()

ClearGroups clears the "groups" edge to the Groups entity.

func (*GroupBandwidthMutation) ClearedEdges

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

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

func (*GroupBandwidthMutation) ClearedFields

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

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

func (GroupBandwidthMutation) Client

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

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

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

func (*GroupBandwidthMutation) Field

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

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

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

func (*GroupBandwidthMutation) Fields

func (m *GroupBandwidthMutation) 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 (*GroupBandwidthMutation) GbwCreatedAt

func (m *GroupBandwidthMutation) GbwCreatedAt() (r time.Time, exists bool)

GbwCreatedAt returns the value of the "gbw_created_at" field in the mutation.

func (*GroupBandwidthMutation) GbwCreatedAtCleared

func (m *GroupBandwidthMutation) GbwCreatedAtCleared() bool

GbwCreatedAtCleared returns if the "gbw_created_at" field was cleared in this mutation.

func (*GroupBandwidthMutation) GbwDownloadSpeed

func (m *GroupBandwidthMutation) GbwDownloadSpeed() (r int, exists bool)

GbwDownloadSpeed returns the value of the "gbw_download_speed" field in the mutation.

func (*GroupBandwidthMutation) GbwUploadSpeed

func (m *GroupBandwidthMutation) GbwUploadSpeed() (r int, exists bool)

GbwUploadSpeed returns the value of the "gbw_upload_speed" field in the mutation.

func (*GroupBandwidthMutation) GroupsCleared

func (m *GroupBandwidthMutation) GroupsCleared() bool

GroupsCleared reports if the "groups" edge to the Groups entity was cleared.

func (*GroupBandwidthMutation) GroupsIDs

func (m *GroupBandwidthMutation) GroupsIDs() (ids []int)

GroupsIDs returns the "groups" edge IDs in the mutation.

func (*GroupBandwidthMutation) ID

func (m *GroupBandwidthMutation) 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 (*GroupBandwidthMutation) OldField

func (m *GroupBandwidthMutation) 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 (*GroupBandwidthMutation) OldGbwCreatedAt

func (m *GroupBandwidthMutation) OldGbwCreatedAt(ctx context.Context) (v time.Time, err error)

OldGbwCreatedAt returns the old "gbw_created_at" field's value of the GroupBandwidth entity. If the GroupBandwidth 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 (*GroupBandwidthMutation) OldGbwDownloadSpeed

func (m *GroupBandwidthMutation) OldGbwDownloadSpeed(ctx context.Context) (v int, err error)

OldGbwDownloadSpeed returns the old "gbw_download_speed" field's value of the GroupBandwidth entity. If the GroupBandwidth 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 (*GroupBandwidthMutation) OldGbwUploadSpeed

func (m *GroupBandwidthMutation) OldGbwUploadSpeed(ctx context.Context) (v int, err error)

OldGbwUploadSpeed returns the old "gbw_upload_speed" field's value of the GroupBandwidth entity. If the GroupBandwidth 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 (*GroupBandwidthMutation) Op

func (m *GroupBandwidthMutation) Op() Op

Op returns the operation name.

func (*GroupBandwidthMutation) RemoveGroupIDs

func (m *GroupBandwidthMutation) RemoveGroupIDs(ids ...int)

RemoveGroupIDs removes the "groups" edge to the Groups entity by IDs.

func (*GroupBandwidthMutation) RemovedEdges

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

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

func (*GroupBandwidthMutation) RemovedGroupsIDs

func (m *GroupBandwidthMutation) RemovedGroupsIDs() (ids []int)

RemovedGroups returns the removed IDs of the "groups" edge to the Groups entity.

func (*GroupBandwidthMutation) RemovedIDs

func (m *GroupBandwidthMutation) 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 (*GroupBandwidthMutation) ResetEdge

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

func (m *GroupBandwidthMutation) 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 (*GroupBandwidthMutation) ResetGbwCreatedAt

func (m *GroupBandwidthMutation) ResetGbwCreatedAt()

ResetGbwCreatedAt resets all changes to the "gbw_created_at" field.

func (*GroupBandwidthMutation) ResetGbwDownloadSpeed

func (m *GroupBandwidthMutation) ResetGbwDownloadSpeed()

ResetGbwDownloadSpeed resets all changes to the "gbw_download_speed" field.

func (*GroupBandwidthMutation) ResetGbwUploadSpeed

func (m *GroupBandwidthMutation) ResetGbwUploadSpeed()

ResetGbwUploadSpeed resets all changes to the "gbw_upload_speed" field.

func (*GroupBandwidthMutation) ResetGroups

func (m *GroupBandwidthMutation) ResetGroups()

ResetGroups resets all changes to the "groups" edge.

func (*GroupBandwidthMutation) SetField

func (m *GroupBandwidthMutation) 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 (*GroupBandwidthMutation) SetGbwCreatedAt

func (m *GroupBandwidthMutation) SetGbwCreatedAt(t time.Time)

SetGbwCreatedAt sets the "gbw_created_at" field.

func (*GroupBandwidthMutation) SetGbwDownloadSpeed

func (m *GroupBandwidthMutation) SetGbwDownloadSpeed(i int)

SetGbwDownloadSpeed sets the "gbw_download_speed" field.

func (*GroupBandwidthMutation) SetGbwUploadSpeed

func (m *GroupBandwidthMutation) SetGbwUploadSpeed(i int)

SetGbwUploadSpeed sets the "gbw_upload_speed" field.

func (GroupBandwidthMutation) Tx

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

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

func (*GroupBandwidthMutation) Type

func (m *GroupBandwidthMutation) Type() string

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

func (*GroupBandwidthMutation) Where

Where appends a list predicates to the GroupBandwidthMutation builder.

type GroupBandwidthQuery

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

GroupBandwidthQuery is the builder for querying GroupBandwidth entities.

func (*GroupBandwidthQuery) All

All executes the query and returns a list of GroupBandwidths.

func (*GroupBandwidthQuery) AllX

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

func (*GroupBandwidthQuery) Clone

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

func (*GroupBandwidthQuery) Count

func (gbq *GroupBandwidthQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*GroupBandwidthQuery) CountX

func (gbq *GroupBandwidthQuery) CountX(ctx context.Context) int

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

func (*GroupBandwidthQuery) Exist

func (gbq *GroupBandwidthQuery) Exist(ctx context.Context) (bool, error)

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

func (*GroupBandwidthQuery) ExistX

func (gbq *GroupBandwidthQuery) ExistX(ctx context.Context) bool

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

func (*GroupBandwidthQuery) First

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

func (*GroupBandwidthQuery) FirstID

func (gbq *GroupBandwidthQuery) FirstID(ctx context.Context) (id int, err error)

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

func (*GroupBandwidthQuery) FirstIDX

func (gbq *GroupBandwidthQuery) FirstIDX(ctx context.Context) int

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

func (*GroupBandwidthQuery) FirstX

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

func (*GroupBandwidthQuery) GroupBy

func (gbq *GroupBandwidthQuery) GroupBy(field string, fields ...string) *GroupBandwidthGroupBy

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

client.GroupBandwidth.Query().
	GroupBy(groupbandwidth.FieldGbwDownloadSpeed).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*GroupBandwidthQuery) IDs

func (gbq *GroupBandwidthQuery) IDs(ctx context.Context) ([]int, error)

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

func (*GroupBandwidthQuery) IDsX

func (gbq *GroupBandwidthQuery) IDsX(ctx context.Context) []int

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

func (*GroupBandwidthQuery) Limit

func (gbq *GroupBandwidthQuery) Limit(limit int) *GroupBandwidthQuery

Limit adds a limit step to the query.

func (*GroupBandwidthQuery) Offset

func (gbq *GroupBandwidthQuery) Offset(offset int) *GroupBandwidthQuery

Offset adds an offset step to the query.

func (*GroupBandwidthQuery) Only

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

func (*GroupBandwidthQuery) OnlyID

func (gbq *GroupBandwidthQuery) OnlyID(ctx context.Context) (id int, err error)

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

func (*GroupBandwidthQuery) OnlyIDX

func (gbq *GroupBandwidthQuery) OnlyIDX(ctx context.Context) int

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

func (*GroupBandwidthQuery) OnlyX

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

func (*GroupBandwidthQuery) Order

Order adds an order step to the query.

func (*GroupBandwidthQuery) QueryGroups

func (gbq *GroupBandwidthQuery) QueryGroups() *GroupsQuery

QueryGroups chains the current query on the "groups" edge.

func (*GroupBandwidthQuery) Select

func (gbq *GroupBandwidthQuery) Select(fields ...string) *GroupBandwidthSelect

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

client.GroupBandwidth.Query().
	Select(groupbandwidth.FieldGbwDownloadSpeed).
	Scan(ctx, &v)

func (*GroupBandwidthQuery) Unique

func (gbq *GroupBandwidthQuery) Unique(unique bool) *GroupBandwidthQuery

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

Where adds a new predicate for the GroupBandwidthQuery builder.

func (*GroupBandwidthQuery) WithGroups

func (gbq *GroupBandwidthQuery) WithGroups(opts ...func(*GroupsQuery)) *GroupBandwidthQuery

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

type GroupBandwidthSelect

type GroupBandwidthSelect struct {
	*GroupBandwidthQuery
	// contains filtered or unexported fields
}

GroupBandwidthSelect is the builder for selecting fields of GroupBandwidth entities.

func (*GroupBandwidthSelect) Bool

func (gbs *GroupBandwidthSelect) Bool(ctx context.Context) (_ bool, err error)

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

func (*GroupBandwidthSelect) BoolX

func (gbs *GroupBandwidthSelect) BoolX(ctx context.Context) bool

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

func (*GroupBandwidthSelect) Bools

func (gbs *GroupBandwidthSelect) Bools(ctx context.Context) ([]bool, error)

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

func (*GroupBandwidthSelect) BoolsX

func (gbs *GroupBandwidthSelect) BoolsX(ctx context.Context) []bool

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

func (*GroupBandwidthSelect) Float64

func (gbs *GroupBandwidthSelect) Float64(ctx context.Context) (_ float64, err error)

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

func (*GroupBandwidthSelect) Float64X

func (gbs *GroupBandwidthSelect) Float64X(ctx context.Context) float64

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

func (*GroupBandwidthSelect) Float64s

func (gbs *GroupBandwidthSelect) Float64s(ctx context.Context) ([]float64, error)

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

func (*GroupBandwidthSelect) Float64sX

func (gbs *GroupBandwidthSelect) Float64sX(ctx context.Context) []float64

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

func (*GroupBandwidthSelect) Int

func (gbs *GroupBandwidthSelect) Int(ctx context.Context) (_ int, err error)

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

func (*GroupBandwidthSelect) IntX

func (gbs *GroupBandwidthSelect) IntX(ctx context.Context) int

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

func (*GroupBandwidthSelect) Ints

func (gbs *GroupBandwidthSelect) Ints(ctx context.Context) ([]int, error)

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

func (*GroupBandwidthSelect) IntsX

func (gbs *GroupBandwidthSelect) IntsX(ctx context.Context) []int

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

func (*GroupBandwidthSelect) Scan

func (gbs *GroupBandwidthSelect) Scan(ctx context.Context, v interface{}) error

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

func (*GroupBandwidthSelect) ScanX

func (gbs *GroupBandwidthSelect) ScanX(ctx context.Context, v interface{})

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

func (*GroupBandwidthSelect) String

func (gbs *GroupBandwidthSelect) String(ctx context.Context) (_ string, err error)

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

func (*GroupBandwidthSelect) StringX

func (gbs *GroupBandwidthSelect) StringX(ctx context.Context) string

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

func (*GroupBandwidthSelect) Strings

func (gbs *GroupBandwidthSelect) Strings(ctx context.Context) ([]string, error)

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

func (*GroupBandwidthSelect) StringsX

func (gbs *GroupBandwidthSelect) StringsX(ctx context.Context) []string

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

type GroupBandwidthUpdate

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

GroupBandwidthUpdate is the builder for updating GroupBandwidth entities.

func (*GroupBandwidthUpdate) AddGbwDownloadSpeed

func (gbu *GroupBandwidthUpdate) AddGbwDownloadSpeed(i int) *GroupBandwidthUpdate

AddGbwDownloadSpeed adds i to the "gbw_download_speed" field.

func (*GroupBandwidthUpdate) AddGbwUploadSpeed

func (gbu *GroupBandwidthUpdate) AddGbwUploadSpeed(i int) *GroupBandwidthUpdate

AddGbwUploadSpeed adds i to the "gbw_upload_speed" field.

func (*GroupBandwidthUpdate) AddGroupIDs

func (gbu *GroupBandwidthUpdate) AddGroupIDs(ids ...int) *GroupBandwidthUpdate

AddGroupIDs adds the "groups" edge to the Groups entity by IDs.

func (*GroupBandwidthUpdate) AddGroups

func (gbu *GroupBandwidthUpdate) AddGroups(g ...*Groups) *GroupBandwidthUpdate

AddGroups adds the "groups" edges to the Groups entity.

func (*GroupBandwidthUpdate) ClearGbwCreatedAt

func (gbu *GroupBandwidthUpdate) ClearGbwCreatedAt() *GroupBandwidthUpdate

ClearGbwCreatedAt clears the value of the "gbw_created_at" field.

func (*GroupBandwidthUpdate) ClearGroups

func (gbu *GroupBandwidthUpdate) ClearGroups() *GroupBandwidthUpdate

ClearGroups clears all "groups" edges to the Groups entity.

func (*GroupBandwidthUpdate) Exec

func (gbu *GroupBandwidthUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*GroupBandwidthUpdate) ExecX

func (gbu *GroupBandwidthUpdate) ExecX(ctx context.Context)

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

func (*GroupBandwidthUpdate) Mutation

Mutation returns the GroupBandwidthMutation object of the builder.

func (*GroupBandwidthUpdate) RemoveGroupIDs

func (gbu *GroupBandwidthUpdate) RemoveGroupIDs(ids ...int) *GroupBandwidthUpdate

RemoveGroupIDs removes the "groups" edge to Groups entities by IDs.

func (*GroupBandwidthUpdate) RemoveGroups

func (gbu *GroupBandwidthUpdate) RemoveGroups(g ...*Groups) *GroupBandwidthUpdate

RemoveGroups removes "groups" edges to Groups entities.

func (*GroupBandwidthUpdate) Save

func (gbu *GroupBandwidthUpdate) Save(ctx context.Context) (int, error)

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

func (*GroupBandwidthUpdate) SaveX

func (gbu *GroupBandwidthUpdate) SaveX(ctx context.Context) int

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

func (*GroupBandwidthUpdate) SetGbwCreatedAt

func (gbu *GroupBandwidthUpdate) SetGbwCreatedAt(t time.Time) *GroupBandwidthUpdate

SetGbwCreatedAt sets the "gbw_created_at" field.

func (*GroupBandwidthUpdate) SetGbwDownloadSpeed

func (gbu *GroupBandwidthUpdate) SetGbwDownloadSpeed(i int) *GroupBandwidthUpdate

SetGbwDownloadSpeed sets the "gbw_download_speed" field.

func (*GroupBandwidthUpdate) SetGbwUploadSpeed

func (gbu *GroupBandwidthUpdate) SetGbwUploadSpeed(i int) *GroupBandwidthUpdate

SetGbwUploadSpeed sets the "gbw_upload_speed" field.

func (*GroupBandwidthUpdate) SetNillableGbwCreatedAt

func (gbu *GroupBandwidthUpdate) SetNillableGbwCreatedAt(t *time.Time) *GroupBandwidthUpdate

SetNillableGbwCreatedAt sets the "gbw_created_at" field if the given value is not nil.

func (*GroupBandwidthUpdate) Where

Where appends a list predicates to the GroupBandwidthUpdate builder.

type GroupBandwidthUpdateOne

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

GroupBandwidthUpdateOne is the builder for updating a single GroupBandwidth entity.

func (*GroupBandwidthUpdateOne) AddGbwDownloadSpeed

func (gbuo *GroupBandwidthUpdateOne) AddGbwDownloadSpeed(i int) *GroupBandwidthUpdateOne

AddGbwDownloadSpeed adds i to the "gbw_download_speed" field.

func (*GroupBandwidthUpdateOne) AddGbwUploadSpeed

func (gbuo *GroupBandwidthUpdateOne) AddGbwUploadSpeed(i int) *GroupBandwidthUpdateOne

AddGbwUploadSpeed adds i to the "gbw_upload_speed" field.

func (*GroupBandwidthUpdateOne) AddGroupIDs

func (gbuo *GroupBandwidthUpdateOne) AddGroupIDs(ids ...int) *GroupBandwidthUpdateOne

AddGroupIDs adds the "groups" edge to the Groups entity by IDs.

func (*GroupBandwidthUpdateOne) AddGroups

func (gbuo *GroupBandwidthUpdateOne) AddGroups(g ...*Groups) *GroupBandwidthUpdateOne

AddGroups adds the "groups" edges to the Groups entity.

func (*GroupBandwidthUpdateOne) ClearGbwCreatedAt

func (gbuo *GroupBandwidthUpdateOne) ClearGbwCreatedAt() *GroupBandwidthUpdateOne

ClearGbwCreatedAt clears the value of the "gbw_created_at" field.

func (*GroupBandwidthUpdateOne) ClearGroups

func (gbuo *GroupBandwidthUpdateOne) ClearGroups() *GroupBandwidthUpdateOne

ClearGroups clears all "groups" edges to the Groups entity.

func (*GroupBandwidthUpdateOne) Exec

func (gbuo *GroupBandwidthUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*GroupBandwidthUpdateOne) ExecX

func (gbuo *GroupBandwidthUpdateOne) ExecX(ctx context.Context)

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

func (*GroupBandwidthUpdateOne) Mutation

Mutation returns the GroupBandwidthMutation object of the builder.

func (*GroupBandwidthUpdateOne) RemoveGroupIDs

func (gbuo *GroupBandwidthUpdateOne) RemoveGroupIDs(ids ...int) *GroupBandwidthUpdateOne

RemoveGroupIDs removes the "groups" edge to Groups entities by IDs.

func (*GroupBandwidthUpdateOne) RemoveGroups

func (gbuo *GroupBandwidthUpdateOne) RemoveGroups(g ...*Groups) *GroupBandwidthUpdateOne

RemoveGroups removes "groups" edges to Groups entities.

func (*GroupBandwidthUpdateOne) Save

Save executes the query and returns the updated GroupBandwidth entity.

func (*GroupBandwidthUpdateOne) SaveX

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

func (*GroupBandwidthUpdateOne) Select

func (gbuo *GroupBandwidthUpdateOne) Select(field string, fields ...string) *GroupBandwidthUpdateOne

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

func (*GroupBandwidthUpdateOne) SetGbwCreatedAt

func (gbuo *GroupBandwidthUpdateOne) SetGbwCreatedAt(t time.Time) *GroupBandwidthUpdateOne

SetGbwCreatedAt sets the "gbw_created_at" field.

func (*GroupBandwidthUpdateOne) SetGbwDownloadSpeed

func (gbuo *GroupBandwidthUpdateOne) SetGbwDownloadSpeed(i int) *GroupBandwidthUpdateOne

SetGbwDownloadSpeed sets the "gbw_download_speed" field.

func (*GroupBandwidthUpdateOne) SetGbwUploadSpeed

func (gbuo *GroupBandwidthUpdateOne) SetGbwUploadSpeed(i int) *GroupBandwidthUpdateOne

SetGbwUploadSpeed sets the "gbw_upload_speed" field.

func (*GroupBandwidthUpdateOne) SetNillableGbwCreatedAt

func (gbuo *GroupBandwidthUpdateOne) SetNillableGbwCreatedAt(t *time.Time) *GroupBandwidthUpdateOne

SetNillableGbwCreatedAt sets the "gbw_created_at" field if the given value is not nil.

type GroupBandwidths

type GroupBandwidths []*GroupBandwidth

GroupBandwidths is a parsable slice of GroupBandwidth.

type Groups

type Groups struct {

	// ID of the ent.
	ID int `json:"id,omitempty"`
	// GName holds the value of the "g_name" field.
	GName string `json:"g_name,omitempty"`
	// GIsIntOrg holds the value of the "g_is_int_org" field.
	GIsIntOrg bool `json:"g_is_int_org,omitempty"`
	// GIsSuperAdmin holds the value of the "g_is_super_admin" field.
	GIsSuperAdmin bool `json:"g_is_super_admin,omitempty"`
	// GCreatedAt holds the value of the "g_created_at" field.
	GCreatedAt time.Time `json:"g_created_at,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the GroupsQuery when eager-loading is set.
	Edges GroupsEdges `json:"edges"`
	// contains filtered or unexported fields
}

Groups is the model entity for the Groups schema.

func (*Groups) QueryUseBandwidth

func (gr *Groups) QueryUseBandwidth() *GroupBandwidthQuery

QueryUseBandwidth queries the "use_bandwidth" edge of the Groups entity.

func (*Groups) QueryUsers

func (gr *Groups) QueryUsers() *UsersQuery

QueryUsers queries the "users" edge of the Groups entity.

func (*Groups) String

func (gr *Groups) String() string

String implements the fmt.Stringer.

func (*Groups) Unwrap

func (gr *Groups) Unwrap() *Groups

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

func (gr *Groups) Update() *GroupsUpdateOne

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

type GroupsClient

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

GroupsClient is a client for the Groups schema.

func NewGroupsClient

func NewGroupsClient(c config) *GroupsClient

NewGroupsClient returns a client for the Groups from the given config.

func (*GroupsClient) Create

func (c *GroupsClient) Create() *GroupsCreate

Create returns a create builder for Groups.

func (*GroupsClient) CreateBulk

func (c *GroupsClient) CreateBulk(builders ...*GroupsCreate) *GroupsCreateBulk

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

func (*GroupsClient) Delete

func (c *GroupsClient) Delete() *GroupsDelete

Delete returns a delete builder for Groups.

func (*GroupsClient) DeleteOne

func (c *GroupsClient) DeleteOne(gr *Groups) *GroupsDeleteOne

DeleteOne returns a delete builder for the given entity.

func (*GroupsClient) DeleteOneID

func (c *GroupsClient) DeleteOneID(id int) *GroupsDeleteOne

DeleteOneID returns a delete builder for the given id.

func (*GroupsClient) Get

func (c *GroupsClient) Get(ctx context.Context, id int) (*Groups, error)

Get returns a Groups entity by its id.

func (*GroupsClient) GetX

func (c *GroupsClient) GetX(ctx context.Context, id int) *Groups

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

func (*GroupsClient) Hooks

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

Hooks returns the client hooks.

func (*GroupsClient) Query

func (c *GroupsClient) Query() *GroupsQuery

Query returns a query builder for Groups.

func (*GroupsClient) QueryUseBandwidth

func (c *GroupsClient) QueryUseBandwidth(gr *Groups) *GroupBandwidthQuery

QueryUseBandwidth queries the use_bandwidth edge of a Groups.

func (*GroupsClient) QueryUsers

func (c *GroupsClient) QueryUsers(gr *Groups) *UsersQuery

QueryUsers queries the users edge of a Groups.

func (*GroupsClient) Update

func (c *GroupsClient) Update() *GroupsUpdate

Update returns an update builder for Groups.

func (*GroupsClient) UpdateOne

func (c *GroupsClient) UpdateOne(gr *Groups) *GroupsUpdateOne

UpdateOne returns an update builder for the given entity.

func (*GroupsClient) UpdateOneID

func (c *GroupsClient) UpdateOneID(id int) *GroupsUpdateOne

UpdateOneID returns an update builder for the given id.

func (*GroupsClient) Use

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

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

type GroupsCreate

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

GroupsCreate is the builder for creating a Groups entity.

func (*GroupsCreate) AddUserIDs

func (gc *GroupsCreate) AddUserIDs(ids ...int) *GroupsCreate

AddUserIDs adds the "users" edge to the Users entity by IDs.

func (*GroupsCreate) AddUsers

func (gc *GroupsCreate) AddUsers(u ...*Users) *GroupsCreate

AddUsers adds the "users" edges to the Users entity.

func (*GroupsCreate) Exec

func (gc *GroupsCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*GroupsCreate) ExecX

func (gc *GroupsCreate) ExecX(ctx context.Context)

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

func (*GroupsCreate) Mutation

func (gc *GroupsCreate) Mutation() *GroupsMutation

Mutation returns the GroupsMutation object of the builder.

func (*GroupsCreate) Save

func (gc *GroupsCreate) Save(ctx context.Context) (*Groups, error)

Save creates the Groups in the database.

func (*GroupsCreate) SaveX

func (gc *GroupsCreate) SaveX(ctx context.Context) *Groups

SaveX calls Save and panics if Save returns an error.

func (*GroupsCreate) SetGCreatedAt

func (gc *GroupsCreate) SetGCreatedAt(t time.Time) *GroupsCreate

SetGCreatedAt sets the "g_created_at" field.

func (*GroupsCreate) SetGIsIntOrg

func (gc *GroupsCreate) SetGIsIntOrg(b bool) *GroupsCreate

SetGIsIntOrg sets the "g_is_int_org" field.

func (*GroupsCreate) SetGIsSuperAdmin

func (gc *GroupsCreate) SetGIsSuperAdmin(b bool) *GroupsCreate

SetGIsSuperAdmin sets the "g_is_super_admin" field.

func (*GroupsCreate) SetGName

func (gc *GroupsCreate) SetGName(s string) *GroupsCreate

SetGName sets the "g_name" field.

func (*GroupsCreate) SetNillableGCreatedAt

func (gc *GroupsCreate) SetNillableGCreatedAt(t *time.Time) *GroupsCreate

SetNillableGCreatedAt sets the "g_created_at" field if the given value is not nil.

func (*GroupsCreate) SetNillableGIsIntOrg

func (gc *GroupsCreate) SetNillableGIsIntOrg(b *bool) *GroupsCreate

SetNillableGIsIntOrg sets the "g_is_int_org" field if the given value is not nil.

func (*GroupsCreate) SetNillableGIsSuperAdmin

func (gc *GroupsCreate) SetNillableGIsSuperAdmin(b *bool) *GroupsCreate

SetNillableGIsSuperAdmin sets the "g_is_super_admin" field if the given value is not nil.

func (*GroupsCreate) SetNillableUseBandwidthID

func (gc *GroupsCreate) SetNillableUseBandwidthID(id *int) *GroupsCreate

SetNillableUseBandwidthID sets the "use_bandwidth" edge to the GroupBandwidth entity by ID if the given value is not nil.

func (*GroupsCreate) SetUseBandwidth

func (gc *GroupsCreate) SetUseBandwidth(g *GroupBandwidth) *GroupsCreate

SetUseBandwidth sets the "use_bandwidth" edge to the GroupBandwidth entity.

func (*GroupsCreate) SetUseBandwidthID

func (gc *GroupsCreate) SetUseBandwidthID(id int) *GroupsCreate

SetUseBandwidthID sets the "use_bandwidth" edge to the GroupBandwidth entity by ID.

type GroupsCreateBulk

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

GroupsCreateBulk is the builder for creating many Groups entities in bulk.

func (*GroupsCreateBulk) Exec

func (gcb *GroupsCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*GroupsCreateBulk) ExecX

func (gcb *GroupsCreateBulk) ExecX(ctx context.Context)

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

func (*GroupsCreateBulk) Save

func (gcb *GroupsCreateBulk) Save(ctx context.Context) ([]*Groups, error)

Save creates the Groups entities in the database.

func (*GroupsCreateBulk) SaveX

func (gcb *GroupsCreateBulk) SaveX(ctx context.Context) []*Groups

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

type GroupsDelete

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

GroupsDelete is the builder for deleting a Groups entity.

func (*GroupsDelete) Exec

func (gd *GroupsDelete) Exec(ctx context.Context) (int, error)

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

func (*GroupsDelete) ExecX

func (gd *GroupsDelete) ExecX(ctx context.Context) int

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

func (*GroupsDelete) Where

func (gd *GroupsDelete) Where(ps ...predicate.Groups) *GroupsDelete

Where appends a list predicates to the GroupsDelete builder.

type GroupsDeleteOne

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

GroupsDeleteOne is the builder for deleting a single Groups entity.

func (*GroupsDeleteOne) Exec

func (gdo *GroupsDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*GroupsDeleteOne) ExecX

func (gdo *GroupsDeleteOne) ExecX(ctx context.Context)

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

type GroupsEdges

type GroupsEdges struct {
	// UseBandwidth holds the value of the use_bandwidth edge.
	UseBandwidth *GroupBandwidth `json:"use_bandwidth,omitempty"`
	// Users holds the value of the users edge.
	Users []*Users `json:"users,omitempty"`
	// contains filtered or unexported fields
}

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

func (GroupsEdges) UseBandwidthOrErr

func (e GroupsEdges) UseBandwidthOrErr() (*GroupBandwidth, error)

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

func (GroupsEdges) UsersOrErr

func (e GroupsEdges) UsersOrErr() ([]*Users, error)

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

type GroupsGroupBy

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

GroupsGroupBy is the group-by builder for Groups entities.

func (*GroupsGroupBy) Aggregate

func (ggb *GroupsGroupBy) Aggregate(fns ...AggregateFunc) *GroupsGroupBy

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

func (*GroupsGroupBy) Bool

func (ggb *GroupsGroupBy) 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 (*GroupsGroupBy) BoolX

func (ggb *GroupsGroupBy) BoolX(ctx context.Context) bool

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

func (*GroupsGroupBy) Bools

func (ggb *GroupsGroupBy) 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 (*GroupsGroupBy) BoolsX

func (ggb *GroupsGroupBy) BoolsX(ctx context.Context) []bool

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

func (*GroupsGroupBy) Float64

func (ggb *GroupsGroupBy) 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 (*GroupsGroupBy) Float64X

func (ggb *GroupsGroupBy) Float64X(ctx context.Context) float64

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

func (*GroupsGroupBy) Float64s

func (ggb *GroupsGroupBy) 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 (*GroupsGroupBy) Float64sX

func (ggb *GroupsGroupBy) Float64sX(ctx context.Context) []float64

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

func (*GroupsGroupBy) Int

func (ggb *GroupsGroupBy) 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 (*GroupsGroupBy) IntX

func (ggb *GroupsGroupBy) IntX(ctx context.Context) int

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

func (*GroupsGroupBy) Ints

func (ggb *GroupsGroupBy) 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 (*GroupsGroupBy) IntsX

func (ggb *GroupsGroupBy) IntsX(ctx context.Context) []int

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

func (*GroupsGroupBy) Scan

func (ggb *GroupsGroupBy) Scan(ctx context.Context, v interface{}) error

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

func (*GroupsGroupBy) ScanX

func (ggb *GroupsGroupBy) ScanX(ctx context.Context, v interface{})

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

func (*GroupsGroupBy) String

func (ggb *GroupsGroupBy) 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 (*GroupsGroupBy) StringX

func (ggb *GroupsGroupBy) StringX(ctx context.Context) string

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

func (*GroupsGroupBy) Strings

func (ggb *GroupsGroupBy) 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 (*GroupsGroupBy) StringsX

func (ggb *GroupsGroupBy) StringsX(ctx context.Context) []string

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

type GroupsMutation

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

GroupsMutation represents an operation that mutates the Groups nodes in the graph.

func (*GroupsMutation) AddField

func (m *GroupsMutation) 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 (*GroupsMutation) AddUserIDs

func (m *GroupsMutation) AddUserIDs(ids ...int)

AddUserIDs adds the "users" edge to the Users entity by ids.

func (*GroupsMutation) AddedEdges

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

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

func (*GroupsMutation) AddedField

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

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

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

func (*GroupsMutation) AddedIDs

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

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

func (*GroupsMutation) ClearEdge

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

func (m *GroupsMutation) 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 (*GroupsMutation) ClearGCreatedAt

func (m *GroupsMutation) ClearGCreatedAt()

ClearGCreatedAt clears the value of the "g_created_at" field.

func (*GroupsMutation) ClearUseBandwidth

func (m *GroupsMutation) ClearUseBandwidth()

ClearUseBandwidth clears the "use_bandwidth" edge to the GroupBandwidth entity.

func (*GroupsMutation) ClearUsers

func (m *GroupsMutation) ClearUsers()

ClearUsers clears the "users" edge to the Users entity.

func (*GroupsMutation) ClearedEdges

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

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

func (*GroupsMutation) ClearedFields

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

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

func (GroupsMutation) Client

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

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

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

func (*GroupsMutation) Field

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

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

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

func (*GroupsMutation) Fields

func (m *GroupsMutation) 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 (*GroupsMutation) GCreatedAt

func (m *GroupsMutation) GCreatedAt() (r time.Time, exists bool)

GCreatedAt returns the value of the "g_created_at" field in the mutation.

func (*GroupsMutation) GCreatedAtCleared

func (m *GroupsMutation) GCreatedAtCleared() bool

GCreatedAtCleared returns if the "g_created_at" field was cleared in this mutation.

func (*GroupsMutation) GIsIntOrg

func (m *GroupsMutation) GIsIntOrg() (r bool, exists bool)

GIsIntOrg returns the value of the "g_is_int_org" field in the mutation.

func (*GroupsMutation) GIsSuperAdmin

func (m *GroupsMutation) GIsSuperAdmin() (r bool, exists bool)

GIsSuperAdmin returns the value of the "g_is_super_admin" field in the mutation.

func (*GroupsMutation) GName

func (m *GroupsMutation) GName() (r string, exists bool)

GName returns the value of the "g_name" field in the mutation.

func (*GroupsMutation) ID

func (m *GroupsMutation) 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 (*GroupsMutation) OldField

func (m *GroupsMutation) 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 (*GroupsMutation) OldGCreatedAt

func (m *GroupsMutation) OldGCreatedAt(ctx context.Context) (v time.Time, err error)

OldGCreatedAt returns the old "g_created_at" field's value of the Groups entity. If the Groups 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 (*GroupsMutation) OldGIsIntOrg

func (m *GroupsMutation) OldGIsIntOrg(ctx context.Context) (v bool, err error)

OldGIsIntOrg returns the old "g_is_int_org" field's value of the Groups entity. If the Groups 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 (*GroupsMutation) OldGIsSuperAdmin

func (m *GroupsMutation) OldGIsSuperAdmin(ctx context.Context) (v bool, err error)

OldGIsSuperAdmin returns the old "g_is_super_admin" field's value of the Groups entity. If the Groups 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 (*GroupsMutation) OldGName

func (m *GroupsMutation) OldGName(ctx context.Context) (v string, err error)

OldGName returns the old "g_name" field's value of the Groups entity. If the Groups 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 (*GroupsMutation) Op

func (m *GroupsMutation) Op() Op

Op returns the operation name.

func (*GroupsMutation) RemoveUserIDs

func (m *GroupsMutation) RemoveUserIDs(ids ...int)

RemoveUserIDs removes the "users" edge to the Users entity by IDs.

func (*GroupsMutation) RemovedEdges

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

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

func (*GroupsMutation) RemovedIDs

func (m *GroupsMutation) 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 (*GroupsMutation) RemovedUsersIDs

func (m *GroupsMutation) RemovedUsersIDs() (ids []int)

RemovedUsers returns the removed IDs of the "users" edge to the Users entity.

func (*GroupsMutation) ResetEdge

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

func (m *GroupsMutation) 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 (*GroupsMutation) ResetGCreatedAt

func (m *GroupsMutation) ResetGCreatedAt()

ResetGCreatedAt resets all changes to the "g_created_at" field.

func (*GroupsMutation) ResetGIsIntOrg

func (m *GroupsMutation) ResetGIsIntOrg()

ResetGIsIntOrg resets all changes to the "g_is_int_org" field.

func (*GroupsMutation) ResetGIsSuperAdmin

func (m *GroupsMutation) ResetGIsSuperAdmin()

ResetGIsSuperAdmin resets all changes to the "g_is_super_admin" field.

func (*GroupsMutation) ResetGName

func (m *GroupsMutation) ResetGName()

ResetGName resets all changes to the "g_name" field.

func (*GroupsMutation) ResetUseBandwidth

func (m *GroupsMutation) ResetUseBandwidth()

ResetUseBandwidth resets all changes to the "use_bandwidth" edge.

func (*GroupsMutation) ResetUsers

func (m *GroupsMutation) ResetUsers()

ResetUsers resets all changes to the "users" edge.

func (*GroupsMutation) SetField

func (m *GroupsMutation) 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 (*GroupsMutation) SetGCreatedAt

func (m *GroupsMutation) SetGCreatedAt(t time.Time)

SetGCreatedAt sets the "g_created_at" field.

func (*GroupsMutation) SetGIsIntOrg

func (m *GroupsMutation) SetGIsIntOrg(b bool)

SetGIsIntOrg sets the "g_is_int_org" field.

func (*GroupsMutation) SetGIsSuperAdmin

func (m *GroupsMutation) SetGIsSuperAdmin(b bool)

SetGIsSuperAdmin sets the "g_is_super_admin" field.

func (*GroupsMutation) SetGName

func (m *GroupsMutation) SetGName(s string)

SetGName sets the "g_name" field.

func (*GroupsMutation) SetUseBandwidthID

func (m *GroupsMutation) SetUseBandwidthID(id int)

SetUseBandwidthID sets the "use_bandwidth" edge to the GroupBandwidth entity by id.

func (GroupsMutation) Tx

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

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

func (*GroupsMutation) Type

func (m *GroupsMutation) Type() string

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

func (*GroupsMutation) UseBandwidthCleared

func (m *GroupsMutation) UseBandwidthCleared() bool

UseBandwidthCleared reports if the "use_bandwidth" edge to the GroupBandwidth entity was cleared.

func (*GroupsMutation) UseBandwidthID

func (m *GroupsMutation) UseBandwidthID() (id int, exists bool)

UseBandwidthID returns the "use_bandwidth" edge ID in the mutation.

func (*GroupsMutation) UseBandwidthIDs

func (m *GroupsMutation) UseBandwidthIDs() (ids []int)

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

func (*GroupsMutation) UsersCleared

func (m *GroupsMutation) UsersCleared() bool

UsersCleared reports if the "users" edge to the Users entity was cleared.

func (*GroupsMutation) UsersIDs

func (m *GroupsMutation) UsersIDs() (ids []int)

UsersIDs returns the "users" edge IDs in the mutation.

func (*GroupsMutation) Where

func (m *GroupsMutation) Where(ps ...predicate.Groups)

Where appends a list predicates to the GroupsMutation builder.

type GroupsQuery

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

GroupsQuery is the builder for querying Groups entities.

func (*GroupsQuery) All

func (gq *GroupsQuery) All(ctx context.Context) ([]*Groups, error)

All executes the query and returns a list of GroupsSlice.

func (*GroupsQuery) AllX

func (gq *GroupsQuery) AllX(ctx context.Context) []*Groups

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

func (*GroupsQuery) Clone

func (gq *GroupsQuery) Clone() *GroupsQuery

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

func (*GroupsQuery) Count

func (gq *GroupsQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*GroupsQuery) CountX

func (gq *GroupsQuery) CountX(ctx context.Context) int

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

func (*GroupsQuery) Exist

func (gq *GroupsQuery) Exist(ctx context.Context) (bool, error)

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

func (*GroupsQuery) ExistX

func (gq *GroupsQuery) ExistX(ctx context.Context) bool

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

func (*GroupsQuery) First

func (gq *GroupsQuery) First(ctx context.Context) (*Groups, error)

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

func (*GroupsQuery) FirstID

func (gq *GroupsQuery) FirstID(ctx context.Context) (id int, err error)

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

func (*GroupsQuery) FirstIDX

func (gq *GroupsQuery) FirstIDX(ctx context.Context) int

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

func (*GroupsQuery) FirstX

func (gq *GroupsQuery) FirstX(ctx context.Context) *Groups

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

func (*GroupsQuery) GroupBy

func (gq *GroupsQuery) GroupBy(field string, fields ...string) *GroupsGroupBy

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

client.Groups.Query().
	GroupBy(groups.FieldGName).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*GroupsQuery) IDs

func (gq *GroupsQuery) IDs(ctx context.Context) ([]int, error)

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

func (*GroupsQuery) IDsX

func (gq *GroupsQuery) IDsX(ctx context.Context) []int

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

func (*GroupsQuery) Limit

func (gq *GroupsQuery) Limit(limit int) *GroupsQuery

Limit adds a limit step to the query.

func (*GroupsQuery) Offset

func (gq *GroupsQuery) Offset(offset int) *GroupsQuery

Offset adds an offset step to the query.

func (*GroupsQuery) Only

func (gq *GroupsQuery) Only(ctx context.Context) (*Groups, error)

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

func (*GroupsQuery) OnlyID

func (gq *GroupsQuery) OnlyID(ctx context.Context) (id int, err error)

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

func (*GroupsQuery) OnlyIDX

func (gq *GroupsQuery) OnlyIDX(ctx context.Context) int

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

func (*GroupsQuery) OnlyX

func (gq *GroupsQuery) OnlyX(ctx context.Context) *Groups

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

func (*GroupsQuery) Order

func (gq *GroupsQuery) Order(o ...OrderFunc) *GroupsQuery

Order adds an order step to the query.

func (*GroupsQuery) QueryUseBandwidth

func (gq *GroupsQuery) QueryUseBandwidth() *GroupBandwidthQuery

QueryUseBandwidth chains the current query on the "use_bandwidth" edge.

func (*GroupsQuery) QueryUsers

func (gq *GroupsQuery) QueryUsers() *UsersQuery

QueryUsers chains the current query on the "users" edge.

func (*GroupsQuery) Select

func (gq *GroupsQuery) Select(fields ...string) *GroupsSelect

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

client.Groups.Query().
	Select(groups.FieldGName).
	Scan(ctx, &v)

func (*GroupsQuery) Unique

func (gq *GroupsQuery) Unique(unique bool) *GroupsQuery

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

func (gq *GroupsQuery) Where(ps ...predicate.Groups) *GroupsQuery

Where adds a new predicate for the GroupsQuery builder.

func (*GroupsQuery) WithUseBandwidth

func (gq *GroupsQuery) WithUseBandwidth(opts ...func(*GroupBandwidthQuery)) *GroupsQuery

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

func (*GroupsQuery) WithUsers

func (gq *GroupsQuery) WithUsers(opts ...func(*UsersQuery)) *GroupsQuery

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

type GroupsSelect

type GroupsSelect struct {
	*GroupsQuery
	// contains filtered or unexported fields
}

GroupsSelect is the builder for selecting fields of Groups entities.

func (*GroupsSelect) Bool

func (gs *GroupsSelect) Bool(ctx context.Context) (_ bool, err error)

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

func (*GroupsSelect) BoolX

func (gs *GroupsSelect) BoolX(ctx context.Context) bool

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

func (*GroupsSelect) Bools

func (gs *GroupsSelect) Bools(ctx context.Context) ([]bool, error)

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

func (*GroupsSelect) BoolsX

func (gs *GroupsSelect) BoolsX(ctx context.Context) []bool

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

func (*GroupsSelect) Float64

func (gs *GroupsSelect) Float64(ctx context.Context) (_ float64, err error)

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

func (*GroupsSelect) Float64X

func (gs *GroupsSelect) Float64X(ctx context.Context) float64

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

func (*GroupsSelect) Float64s

func (gs *GroupsSelect) Float64s(ctx context.Context) ([]float64, error)

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

func (*GroupsSelect) Float64sX

func (gs *GroupsSelect) Float64sX(ctx context.Context) []float64

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

func (*GroupsSelect) Int

func (gs *GroupsSelect) Int(ctx context.Context) (_ int, err error)

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

func (*GroupsSelect) IntX

func (gs *GroupsSelect) IntX(ctx context.Context) int

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

func (*GroupsSelect) Ints

func (gs *GroupsSelect) Ints(ctx context.Context) ([]int, error)

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

func (*GroupsSelect) IntsX

func (gs *GroupsSelect) IntsX(ctx context.Context) []int

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

func (*GroupsSelect) Scan

func (gs *GroupsSelect) Scan(ctx context.Context, v interface{}) error

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

func (*GroupsSelect) ScanX

func (gs *GroupsSelect) ScanX(ctx context.Context, v interface{})

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

func (*GroupsSelect) String

func (gs *GroupsSelect) String(ctx context.Context) (_ string, err error)

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

func (*GroupsSelect) StringX

func (gs *GroupsSelect) StringX(ctx context.Context) string

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

func (*GroupsSelect) Strings

func (gs *GroupsSelect) Strings(ctx context.Context) ([]string, error)

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

func (*GroupsSelect) StringsX

func (gs *GroupsSelect) StringsX(ctx context.Context) []string

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

type GroupsSlice

type GroupsSlice []*Groups

GroupsSlice is a parsable slice of Groups.

type GroupsUpdate

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

GroupsUpdate is the builder for updating Groups entities.

func (*GroupsUpdate) AddUserIDs

func (gu *GroupsUpdate) AddUserIDs(ids ...int) *GroupsUpdate

AddUserIDs adds the "users" edge to the Users entity by IDs.

func (*GroupsUpdate) AddUsers

func (gu *GroupsUpdate) AddUsers(u ...*Users) *GroupsUpdate

AddUsers adds the "users" edges to the Users entity.

func (*GroupsUpdate) ClearGCreatedAt

func (gu *GroupsUpdate) ClearGCreatedAt() *GroupsUpdate

ClearGCreatedAt clears the value of the "g_created_at" field.

func (*GroupsUpdate) ClearUseBandwidth

func (gu *GroupsUpdate) ClearUseBandwidth() *GroupsUpdate

ClearUseBandwidth clears the "use_bandwidth" edge to the GroupBandwidth entity.

func (*GroupsUpdate) ClearUsers

func (gu *GroupsUpdate) ClearUsers() *GroupsUpdate

ClearUsers clears all "users" edges to the Users entity.

func (*GroupsUpdate) Exec

func (gu *GroupsUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*GroupsUpdate) ExecX

func (gu *GroupsUpdate) ExecX(ctx context.Context)

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

func (*GroupsUpdate) Mutation

func (gu *GroupsUpdate) Mutation() *GroupsMutation

Mutation returns the GroupsMutation object of the builder.

func (*GroupsUpdate) RemoveUserIDs

func (gu *GroupsUpdate) RemoveUserIDs(ids ...int) *GroupsUpdate

RemoveUserIDs removes the "users" edge to Users entities by IDs.

func (*GroupsUpdate) RemoveUsers

func (gu *GroupsUpdate) RemoveUsers(u ...*Users) *GroupsUpdate

RemoveUsers removes "users" edges to Users entities.

func (*GroupsUpdate) Save

func (gu *GroupsUpdate) Save(ctx context.Context) (int, error)

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

func (*GroupsUpdate) SaveX

func (gu *GroupsUpdate) SaveX(ctx context.Context) int

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

func (*GroupsUpdate) SetGCreatedAt

func (gu *GroupsUpdate) SetGCreatedAt(t time.Time) *GroupsUpdate

SetGCreatedAt sets the "g_created_at" field.

func (*GroupsUpdate) SetGIsIntOrg

func (gu *GroupsUpdate) SetGIsIntOrg(b bool) *GroupsUpdate

SetGIsIntOrg sets the "g_is_int_org" field.

func (*GroupsUpdate) SetGIsSuperAdmin

func (gu *GroupsUpdate) SetGIsSuperAdmin(b bool) *GroupsUpdate

SetGIsSuperAdmin sets the "g_is_super_admin" field.

func (*GroupsUpdate) SetGName

func (gu *GroupsUpdate) SetGName(s string) *GroupsUpdate

SetGName sets the "g_name" field.

func (*GroupsUpdate) SetNillableGCreatedAt

func (gu *GroupsUpdate) SetNillableGCreatedAt(t *time.Time) *GroupsUpdate

SetNillableGCreatedAt sets the "g_created_at" field if the given value is not nil.

func (*GroupsUpdate) SetNillableGIsIntOrg

func (gu *GroupsUpdate) SetNillableGIsIntOrg(b *bool) *GroupsUpdate

SetNillableGIsIntOrg sets the "g_is_int_org" field if the given value is not nil.

func (*GroupsUpdate) SetNillableGIsSuperAdmin

func (gu *GroupsUpdate) SetNillableGIsSuperAdmin(b *bool) *GroupsUpdate

SetNillableGIsSuperAdmin sets the "g_is_super_admin" field if the given value is not nil.

func (*GroupsUpdate) SetNillableUseBandwidthID

func (gu *GroupsUpdate) SetNillableUseBandwidthID(id *int) *GroupsUpdate

SetNillableUseBandwidthID sets the "use_bandwidth" edge to the GroupBandwidth entity by ID if the given value is not nil.

func (*GroupsUpdate) SetUseBandwidth

func (gu *GroupsUpdate) SetUseBandwidth(g *GroupBandwidth) *GroupsUpdate

SetUseBandwidth sets the "use_bandwidth" edge to the GroupBandwidth entity.

func (*GroupsUpdate) SetUseBandwidthID

func (gu *GroupsUpdate) SetUseBandwidthID(id int) *GroupsUpdate

SetUseBandwidthID sets the "use_bandwidth" edge to the GroupBandwidth entity by ID.

func (*GroupsUpdate) Where

func (gu *GroupsUpdate) Where(ps ...predicate.Groups) *GroupsUpdate

Where appends a list predicates to the GroupsUpdate builder.

type GroupsUpdateOne

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

GroupsUpdateOne is the builder for updating a single Groups entity.

func (*GroupsUpdateOne) AddUserIDs

func (guo *GroupsUpdateOne) AddUserIDs(ids ...int) *GroupsUpdateOne

AddUserIDs adds the "users" edge to the Users entity by IDs.

func (*GroupsUpdateOne) AddUsers

func (guo *GroupsUpdateOne) AddUsers(u ...*Users) *GroupsUpdateOne

AddUsers adds the "users" edges to the Users entity.

func (*GroupsUpdateOne) ClearGCreatedAt

func (guo *GroupsUpdateOne) ClearGCreatedAt() *GroupsUpdateOne

ClearGCreatedAt clears the value of the "g_created_at" field.

func (*GroupsUpdateOne) ClearUseBandwidth

func (guo *GroupsUpdateOne) ClearUseBandwidth() *GroupsUpdateOne

ClearUseBandwidth clears the "use_bandwidth" edge to the GroupBandwidth entity.

func (*GroupsUpdateOne) ClearUsers

func (guo *GroupsUpdateOne) ClearUsers() *GroupsUpdateOne

ClearUsers clears all "users" edges to the Users entity.

func (*GroupsUpdateOne) Exec

func (guo *GroupsUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*GroupsUpdateOne) ExecX

func (guo *GroupsUpdateOne) ExecX(ctx context.Context)

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

func (*GroupsUpdateOne) Mutation

func (guo *GroupsUpdateOne) Mutation() *GroupsMutation

Mutation returns the GroupsMutation object of the builder.

func (*GroupsUpdateOne) RemoveUserIDs

func (guo *GroupsUpdateOne) RemoveUserIDs(ids ...int) *GroupsUpdateOne

RemoveUserIDs removes the "users" edge to Users entities by IDs.

func (*GroupsUpdateOne) RemoveUsers

func (guo *GroupsUpdateOne) RemoveUsers(u ...*Users) *GroupsUpdateOne

RemoveUsers removes "users" edges to Users entities.

func (*GroupsUpdateOne) Save

func (guo *GroupsUpdateOne) Save(ctx context.Context) (*Groups, error)

Save executes the query and returns the updated Groups entity.

func (*GroupsUpdateOne) SaveX

func (guo *GroupsUpdateOne) SaveX(ctx context.Context) *Groups

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

func (*GroupsUpdateOne) Select

func (guo *GroupsUpdateOne) Select(field string, fields ...string) *GroupsUpdateOne

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

func (*GroupsUpdateOne) SetGCreatedAt

func (guo *GroupsUpdateOne) SetGCreatedAt(t time.Time) *GroupsUpdateOne

SetGCreatedAt sets the "g_created_at" field.

func (*GroupsUpdateOne) SetGIsIntOrg

func (guo *GroupsUpdateOne) SetGIsIntOrg(b bool) *GroupsUpdateOne

SetGIsIntOrg sets the "g_is_int_org" field.

func (*GroupsUpdateOne) SetGIsSuperAdmin

func (guo *GroupsUpdateOne) SetGIsSuperAdmin(b bool) *GroupsUpdateOne

SetGIsSuperAdmin sets the "g_is_super_admin" field.

func (*GroupsUpdateOne) SetGName

func (guo *GroupsUpdateOne) SetGName(s string) *GroupsUpdateOne

SetGName sets the "g_name" field.

func (*GroupsUpdateOne) SetNillableGCreatedAt

func (guo *GroupsUpdateOne) SetNillableGCreatedAt(t *time.Time) *GroupsUpdateOne

SetNillableGCreatedAt sets the "g_created_at" field if the given value is not nil.

func (*GroupsUpdateOne) SetNillableGIsIntOrg

func (guo *GroupsUpdateOne) SetNillableGIsIntOrg(b *bool) *GroupsUpdateOne

SetNillableGIsIntOrg sets the "g_is_int_org" field if the given value is not nil.

func (*GroupsUpdateOne) SetNillableGIsSuperAdmin

func (guo *GroupsUpdateOne) SetNillableGIsSuperAdmin(b *bool) *GroupsUpdateOne

SetNillableGIsSuperAdmin sets the "g_is_super_admin" field if the given value is not nil.

func (*GroupsUpdateOne) SetNillableUseBandwidthID

func (guo *GroupsUpdateOne) SetNillableUseBandwidthID(id *int) *GroupsUpdateOne

SetNillableUseBandwidthID sets the "use_bandwidth" edge to the GroupBandwidth entity by ID if the given value is not nil.

func (*GroupsUpdateOne) SetUseBandwidth

func (guo *GroupsUpdateOne) SetUseBandwidth(g *GroupBandwidth) *GroupsUpdateOne

SetUseBandwidth sets the "use_bandwidth" edge to the GroupBandwidth entity.

func (*GroupsUpdateOne) SetUseBandwidthID

func (guo *GroupsUpdateOne) SetUseBandwidthID(id int) *GroupsUpdateOne

SetUseBandwidthID sets the "use_bandwidth" edge to the GroupBandwidth entity by ID.

type Hook

type Hook = ent.Hook

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

type MutateFunc

type MutateFunc = ent.MutateFunc

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

type 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 OnlineSession

type OnlineSession struct {

	// ID of the ent.
	ID int `json:"id,omitempty"`
	// IPAddress holds the value of the "ip_address" field.
	IPAddress string `json:"ip_address,omitempty"`
	// UPid holds the value of the "u_pid" field.
	UPid string `json:"u_pid,omitempty"`
	// contains filtered or unexported fields
}

OnlineSession is the model entity for the OnlineSession schema.

func (*OnlineSession) String

func (os *OnlineSession) String() string

String implements the fmt.Stringer.

func (*OnlineSession) Unwrap

func (os *OnlineSession) Unwrap() *OnlineSession

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

func (os *OnlineSession) Update() *OnlineSessionUpdateOne

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

type OnlineSessionClient

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

OnlineSessionClient is a client for the OnlineSession schema.

func NewOnlineSessionClient

func NewOnlineSessionClient(c config) *OnlineSessionClient

NewOnlineSessionClient returns a client for the OnlineSession from the given config.

func (*OnlineSessionClient) Create

Create returns a create builder for OnlineSession.

func (*OnlineSessionClient) CreateBulk

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

func (*OnlineSessionClient) Delete

Delete returns a delete builder for OnlineSession.

func (*OnlineSessionClient) DeleteOne

DeleteOne returns a delete builder for the given entity.

func (*OnlineSessionClient) DeleteOneID

func (c *OnlineSessionClient) DeleteOneID(id int) *OnlineSessionDeleteOne

DeleteOneID returns a delete builder for the given id.

func (*OnlineSessionClient) Get

Get returns a OnlineSession entity by its id.

func (*OnlineSessionClient) GetX

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

func (*OnlineSessionClient) Hooks

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

Hooks returns the client hooks.

func (*OnlineSessionClient) Query

Query returns a query builder for OnlineSession.

func (*OnlineSessionClient) Update

Update returns an update builder for OnlineSession.

func (*OnlineSessionClient) UpdateOne

UpdateOne returns an update builder for the given entity.

func (*OnlineSessionClient) UpdateOneID

func (c *OnlineSessionClient) UpdateOneID(id int) *OnlineSessionUpdateOne

UpdateOneID returns an update builder for the given id.

func (*OnlineSessionClient) Use

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

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

type OnlineSessionCreate

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

OnlineSessionCreate is the builder for creating a OnlineSession entity.

func (*OnlineSessionCreate) Exec

func (osc *OnlineSessionCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*OnlineSessionCreate) ExecX

func (osc *OnlineSessionCreate) ExecX(ctx context.Context)

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

func (*OnlineSessionCreate) Mutation

func (osc *OnlineSessionCreate) Mutation() *OnlineSessionMutation

Mutation returns the OnlineSessionMutation object of the builder.

func (*OnlineSessionCreate) Save

Save creates the OnlineSession in the database.

func (*OnlineSessionCreate) SaveX

SaveX calls Save and panics if Save returns an error.

func (*OnlineSessionCreate) SetIPAddress

func (osc *OnlineSessionCreate) SetIPAddress(s string) *OnlineSessionCreate

SetIPAddress sets the "ip_address" field.

func (*OnlineSessionCreate) SetUPid

SetUPid sets the "u_pid" field.

type OnlineSessionCreateBulk

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

OnlineSessionCreateBulk is the builder for creating many OnlineSession entities in bulk.

func (*OnlineSessionCreateBulk) Exec

func (oscb *OnlineSessionCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*OnlineSessionCreateBulk) ExecX

func (oscb *OnlineSessionCreateBulk) ExecX(ctx context.Context)

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

func (*OnlineSessionCreateBulk) Save

Save creates the OnlineSession entities in the database.

func (*OnlineSessionCreateBulk) SaveX

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

type OnlineSessionDelete

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

OnlineSessionDelete is the builder for deleting a OnlineSession entity.

func (*OnlineSessionDelete) Exec

func (osd *OnlineSessionDelete) Exec(ctx context.Context) (int, error)

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

func (*OnlineSessionDelete) ExecX

func (osd *OnlineSessionDelete) ExecX(ctx context.Context) int

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

func (*OnlineSessionDelete) Where

Where appends a list predicates to the OnlineSessionDelete builder.

type OnlineSessionDeleteOne

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

OnlineSessionDeleteOne is the builder for deleting a single OnlineSession entity.

func (*OnlineSessionDeleteOne) Exec

func (osdo *OnlineSessionDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*OnlineSessionDeleteOne) ExecX

func (osdo *OnlineSessionDeleteOne) ExecX(ctx context.Context)

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

type OnlineSessionGroupBy

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

OnlineSessionGroupBy is the group-by builder for OnlineSession entities.

func (*OnlineSessionGroupBy) Aggregate

func (osgb *OnlineSessionGroupBy) Aggregate(fns ...AggregateFunc) *OnlineSessionGroupBy

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

func (*OnlineSessionGroupBy) Bool

func (osgb *OnlineSessionGroupBy) 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 (*OnlineSessionGroupBy) BoolX

func (osgb *OnlineSessionGroupBy) BoolX(ctx context.Context) bool

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

func (*OnlineSessionGroupBy) Bools

func (osgb *OnlineSessionGroupBy) 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 (*OnlineSessionGroupBy) BoolsX

func (osgb *OnlineSessionGroupBy) BoolsX(ctx context.Context) []bool

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

func (*OnlineSessionGroupBy) Float64

func (osgb *OnlineSessionGroupBy) 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 (*OnlineSessionGroupBy) Float64X

func (osgb *OnlineSessionGroupBy) Float64X(ctx context.Context) float64

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

func (*OnlineSessionGroupBy) Float64s

func (osgb *OnlineSessionGroupBy) 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 (*OnlineSessionGroupBy) Float64sX

func (osgb *OnlineSessionGroupBy) Float64sX(ctx context.Context) []float64

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

func (*OnlineSessionGroupBy) Int

func (osgb *OnlineSessionGroupBy) 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 (*OnlineSessionGroupBy) IntX

func (osgb *OnlineSessionGroupBy) IntX(ctx context.Context) int

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

func (*OnlineSessionGroupBy) Ints

func (osgb *OnlineSessionGroupBy) 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 (*OnlineSessionGroupBy) IntsX

func (osgb *OnlineSessionGroupBy) IntsX(ctx context.Context) []int

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

func (*OnlineSessionGroupBy) Scan

func (osgb *OnlineSessionGroupBy) Scan(ctx context.Context, v interface{}) error

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

func (*OnlineSessionGroupBy) ScanX

func (osgb *OnlineSessionGroupBy) ScanX(ctx context.Context, v interface{})

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

func (*OnlineSessionGroupBy) String

func (osgb *OnlineSessionGroupBy) 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 (*OnlineSessionGroupBy) StringX

func (osgb *OnlineSessionGroupBy) StringX(ctx context.Context) string

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

func (*OnlineSessionGroupBy) Strings

func (osgb *OnlineSessionGroupBy) 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 (*OnlineSessionGroupBy) StringsX

func (osgb *OnlineSessionGroupBy) StringsX(ctx context.Context) []string

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

type OnlineSessionMutation

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

OnlineSessionMutation represents an operation that mutates the OnlineSession nodes in the graph.

func (*OnlineSessionMutation) AddField

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

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

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

func (*OnlineSessionMutation) AddedField

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

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

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

func (*OnlineSessionMutation) AddedIDs

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

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

func (*OnlineSessionMutation) ClearEdge

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

func (m *OnlineSessionMutation) 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 (*OnlineSessionMutation) ClearedEdges

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

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

func (*OnlineSessionMutation) ClearedFields

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

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

func (OnlineSessionMutation) Client

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

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

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

func (*OnlineSessionMutation) Field

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

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

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

func (*OnlineSessionMutation) Fields

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

func (m *OnlineSessionMutation) 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 (*OnlineSessionMutation) IPAddress

func (m *OnlineSessionMutation) IPAddress() (r string, exists bool)

IPAddress returns the value of the "ip_address" field in the mutation.

func (*OnlineSessionMutation) OldField

func (m *OnlineSessionMutation) 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 (*OnlineSessionMutation) OldIPAddress

func (m *OnlineSessionMutation) OldIPAddress(ctx context.Context) (v string, err error)

OldIPAddress returns the old "ip_address" field's value of the OnlineSession entity. If the OnlineSession 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 (*OnlineSessionMutation) OldUPid

func (m *OnlineSessionMutation) OldUPid(ctx context.Context) (v string, err error)

OldUPid returns the old "u_pid" field's value of the OnlineSession entity. If the OnlineSession 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 (*OnlineSessionMutation) Op

func (m *OnlineSessionMutation) Op() Op

Op returns the operation name.

func (*OnlineSessionMutation) RemovedEdges

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

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

func (*OnlineSessionMutation) RemovedIDs

func (m *OnlineSessionMutation) 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 (*OnlineSessionMutation) ResetEdge

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

func (m *OnlineSessionMutation) 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 (*OnlineSessionMutation) ResetIPAddress

func (m *OnlineSessionMutation) ResetIPAddress()

ResetIPAddress resets all changes to the "ip_address" field.

func (*OnlineSessionMutation) ResetUPid

func (m *OnlineSessionMutation) ResetUPid()

ResetUPid resets all changes to the "u_pid" field.

func (*OnlineSessionMutation) SetField

func (m *OnlineSessionMutation) 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 (*OnlineSessionMutation) SetIPAddress

func (m *OnlineSessionMutation) SetIPAddress(s string)

SetIPAddress sets the "ip_address" field.

func (*OnlineSessionMutation) SetUPid

func (m *OnlineSessionMutation) SetUPid(s string)

SetUPid sets the "u_pid" field.

func (OnlineSessionMutation) Tx

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

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

func (*OnlineSessionMutation) Type

func (m *OnlineSessionMutation) Type() string

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

func (*OnlineSessionMutation) UPid

func (m *OnlineSessionMutation) UPid() (r string, exists bool)

UPid returns the value of the "u_pid" field in the mutation.

func (*OnlineSessionMutation) Where

Where appends a list predicates to the OnlineSessionMutation builder.

type OnlineSessionQuery

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

OnlineSessionQuery is the builder for querying OnlineSession entities.

func (*OnlineSessionQuery) All

All executes the query and returns a list of OnlineSessions.

func (*OnlineSessionQuery) AllX

func (osq *OnlineSessionQuery) AllX(ctx context.Context) []*OnlineSession

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

func (*OnlineSessionQuery) Clone

func (osq *OnlineSessionQuery) Clone() *OnlineSessionQuery

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

func (*OnlineSessionQuery) Count

func (osq *OnlineSessionQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*OnlineSessionQuery) CountX

func (osq *OnlineSessionQuery) CountX(ctx context.Context) int

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

func (*OnlineSessionQuery) Exist

func (osq *OnlineSessionQuery) Exist(ctx context.Context) (bool, error)

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

func (*OnlineSessionQuery) ExistX

func (osq *OnlineSessionQuery) ExistX(ctx context.Context) bool

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

func (*OnlineSessionQuery) First

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

func (*OnlineSessionQuery) FirstID

func (osq *OnlineSessionQuery) FirstID(ctx context.Context) (id int, err error)

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

func (*OnlineSessionQuery) FirstIDX

func (osq *OnlineSessionQuery) FirstIDX(ctx context.Context) int

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

func (*OnlineSessionQuery) FirstX

func (osq *OnlineSessionQuery) FirstX(ctx context.Context) *OnlineSession

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

func (*OnlineSessionQuery) GroupBy

func (osq *OnlineSessionQuery) GroupBy(field string, fields ...string) *OnlineSessionGroupBy

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

client.OnlineSession.Query().
	GroupBy(onlinesession.FieldIPAddress).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*OnlineSessionQuery) IDs

func (osq *OnlineSessionQuery) IDs(ctx context.Context) ([]int, error)

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

func (*OnlineSessionQuery) IDsX

func (osq *OnlineSessionQuery) IDsX(ctx context.Context) []int

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

func (*OnlineSessionQuery) Limit

func (osq *OnlineSessionQuery) Limit(limit int) *OnlineSessionQuery

Limit adds a limit step to the query.

func (*OnlineSessionQuery) Offset

func (osq *OnlineSessionQuery) Offset(offset int) *OnlineSessionQuery

Offset adds an offset step to the query.

func (*OnlineSessionQuery) Only

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

func (*OnlineSessionQuery) OnlyID

func (osq *OnlineSessionQuery) OnlyID(ctx context.Context) (id int, err error)

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

func (*OnlineSessionQuery) OnlyIDX

func (osq *OnlineSessionQuery) OnlyIDX(ctx context.Context) int

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

func (*OnlineSessionQuery) OnlyX

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

func (*OnlineSessionQuery) Order

Order adds an order step to the query.

func (*OnlineSessionQuery) Select

func (osq *OnlineSessionQuery) Select(fields ...string) *OnlineSessionSelect

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

client.OnlineSession.Query().
	Select(onlinesession.FieldIPAddress).
	Scan(ctx, &v)

func (*OnlineSessionQuery) Unique

func (osq *OnlineSessionQuery) Unique(unique bool) *OnlineSessionQuery

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

Where adds a new predicate for the OnlineSessionQuery builder.

type OnlineSessionSelect

type OnlineSessionSelect struct {
	*OnlineSessionQuery
	// contains filtered or unexported fields
}

OnlineSessionSelect is the builder for selecting fields of OnlineSession entities.

func (*OnlineSessionSelect) Bool

func (oss *OnlineSessionSelect) Bool(ctx context.Context) (_ bool, err error)

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

func (*OnlineSessionSelect) BoolX

func (oss *OnlineSessionSelect) BoolX(ctx context.Context) bool

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

func (*OnlineSessionSelect) Bools

func (oss *OnlineSessionSelect) Bools(ctx context.Context) ([]bool, error)

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

func (*OnlineSessionSelect) BoolsX

func (oss *OnlineSessionSelect) BoolsX(ctx context.Context) []bool

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

func (*OnlineSessionSelect) Float64

func (oss *OnlineSessionSelect) Float64(ctx context.Context) (_ float64, err error)

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

func (*OnlineSessionSelect) Float64X

func (oss *OnlineSessionSelect) Float64X(ctx context.Context) float64

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

func (*OnlineSessionSelect) Float64s

func (oss *OnlineSessionSelect) Float64s(ctx context.Context) ([]float64, error)

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

func (*OnlineSessionSelect) Float64sX

func (oss *OnlineSessionSelect) Float64sX(ctx context.Context) []float64

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

func (*OnlineSessionSelect) Int

func (oss *OnlineSessionSelect) Int(ctx context.Context) (_ int, err error)

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

func (*OnlineSessionSelect) IntX

func (oss *OnlineSessionSelect) IntX(ctx context.Context) int

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

func (*OnlineSessionSelect) Ints

func (oss *OnlineSessionSelect) Ints(ctx context.Context) ([]int, error)

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

func (*OnlineSessionSelect) IntsX

func (oss *OnlineSessionSelect) IntsX(ctx context.Context) []int

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

func (*OnlineSessionSelect) Scan

func (oss *OnlineSessionSelect) Scan(ctx context.Context, v interface{}) error

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

func (*OnlineSessionSelect) ScanX

func (oss *OnlineSessionSelect) ScanX(ctx context.Context, v interface{})

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

func (*OnlineSessionSelect) String

func (oss *OnlineSessionSelect) String(ctx context.Context) (_ string, err error)

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

func (*OnlineSessionSelect) StringX

func (oss *OnlineSessionSelect) StringX(ctx context.Context) string

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

func (*OnlineSessionSelect) Strings

func (oss *OnlineSessionSelect) Strings(ctx context.Context) ([]string, error)

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

func (*OnlineSessionSelect) StringsX

func (oss *OnlineSessionSelect) StringsX(ctx context.Context) []string

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

type OnlineSessionUpdate

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

OnlineSessionUpdate is the builder for updating OnlineSession entities.

func (*OnlineSessionUpdate) Exec

func (osu *OnlineSessionUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*OnlineSessionUpdate) ExecX

func (osu *OnlineSessionUpdate) ExecX(ctx context.Context)

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

func (*OnlineSessionUpdate) Mutation

func (osu *OnlineSessionUpdate) Mutation() *OnlineSessionMutation

Mutation returns the OnlineSessionMutation object of the builder.

func (*OnlineSessionUpdate) Save

func (osu *OnlineSessionUpdate) Save(ctx context.Context) (int, error)

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

func (*OnlineSessionUpdate) SaveX

func (osu *OnlineSessionUpdate) SaveX(ctx context.Context) int

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

func (*OnlineSessionUpdate) SetIPAddress

func (osu *OnlineSessionUpdate) SetIPAddress(s string) *OnlineSessionUpdate

SetIPAddress sets the "ip_address" field.

func (*OnlineSessionUpdate) SetUPid

SetUPid sets the "u_pid" field.

func (*OnlineSessionUpdate) Where

Where appends a list predicates to the OnlineSessionUpdate builder.

type OnlineSessionUpdateOne

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

OnlineSessionUpdateOne is the builder for updating a single OnlineSession entity.

func (*OnlineSessionUpdateOne) Exec

func (osuo *OnlineSessionUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*OnlineSessionUpdateOne) ExecX

func (osuo *OnlineSessionUpdateOne) ExecX(ctx context.Context)

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

func (*OnlineSessionUpdateOne) Mutation

Mutation returns the OnlineSessionMutation object of the builder.

func (*OnlineSessionUpdateOne) Save

Save executes the query and returns the updated OnlineSession entity.

func (*OnlineSessionUpdateOne) SaveX

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

func (*OnlineSessionUpdateOne) Select

func (osuo *OnlineSessionUpdateOne) Select(field string, fields ...string) *OnlineSessionUpdateOne

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

func (*OnlineSessionUpdateOne) SetIPAddress

func (osuo *OnlineSessionUpdateOne) SetIPAddress(s string) *OnlineSessionUpdateOne

SetIPAddress sets the "ip_address" field.

func (*OnlineSessionUpdateOne) SetUPid

SetUPid sets the "u_pid" field.

type OnlineSessions

type OnlineSessions []*OnlineSession

OnlineSessions is a parsable slice of OnlineSession.

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 Tx

type Tx struct {

	// GroupBandwidth is the client for interacting with the GroupBandwidth builders.
	GroupBandwidth *GroupBandwidthClient
	// Groups is the client for interacting with the Groups builders.
	Groups *GroupsClient
	// OnlineSession is the client for interacting with the OnlineSession builders.
	OnlineSession *OnlineSessionClient
	// Users is the client for interacting with the Users builders.
	Users *UsersClient
	// 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 Users

type Users struct {

	// ID of the ent.
	ID int `json:"id,omitempty"`
	// UPid holds the value of the "u_pid" field.
	UPid string `json:"u_pid,omitempty"`
	// UOrgid holds the value of the "u_orgid" field.
	UOrgid string `json:"u_orgid,omitempty"`
	// UFirstName holds the value of the "u_first_name" field.
	UFirstName string `json:"u_first_name,omitempty"`
	// ULastName holds the value of the "u_last_name" field.
	ULastName string `json:"u_last_name,omitempty"`
	// UIsActive holds the value of the "u_is_active" field.
	UIsActive bool `json:"u_is_active,omitempty"`
	// UCreatedAt holds the value of the "u_created_at" field.
	UCreatedAt time.Time `json:"u_created_at,omitempty"`
	// UPasswordUpdatedAt holds the value of the "u_password_updated_at" field.
	UPasswordUpdatedAt time.Time `json:"u_password_updated_at,omitempty"`
	// UExpiredAt holds the value of the "u_expired_at" field.
	UExpiredAt time.Time `json:"u_expired_at,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the UsersQuery when eager-loading is set.
	Edges UsersEdges `json:"edges"`
	// contains filtered or unexported fields
}

Users is the model entity for the Users schema.

func (*Users) QueryInGroup

func (u *Users) QueryInGroup() *GroupsQuery

QueryInGroup queries the "in_group" edge of the Users entity.

func (*Users) String

func (u *Users) String() string

String implements the fmt.Stringer.

func (*Users) Unwrap

func (u *Users) Unwrap() *Users

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

func (u *Users) Update() *UsersUpdateOne

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

type UsersClient

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

UsersClient is a client for the Users schema.

func NewUsersClient

func NewUsersClient(c config) *UsersClient

NewUsersClient returns a client for the Users from the given config.

func (*UsersClient) Create

func (c *UsersClient) Create() *UsersCreate

Create returns a create builder for Users.

func (*UsersClient) CreateBulk

func (c *UsersClient) CreateBulk(builders ...*UsersCreate) *UsersCreateBulk

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

func (*UsersClient) Delete

func (c *UsersClient) Delete() *UsersDelete

Delete returns a delete builder for Users.

func (*UsersClient) DeleteOne

func (c *UsersClient) DeleteOne(u *Users) *UsersDeleteOne

DeleteOne returns a delete builder for the given entity.

func (*UsersClient) DeleteOneID

func (c *UsersClient) DeleteOneID(id int) *UsersDeleteOne

DeleteOneID returns a delete builder for the given id.

func (*UsersClient) Get

func (c *UsersClient) Get(ctx context.Context, id int) (*Users, error)

Get returns a Users entity by its id.

func (*UsersClient) GetX

func (c *UsersClient) GetX(ctx context.Context, id int) *Users

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

func (*UsersClient) Hooks

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

Hooks returns the client hooks.

func (*UsersClient) Query

func (c *UsersClient) Query() *UsersQuery

Query returns a query builder for Users.

func (*UsersClient) QueryInGroup

func (c *UsersClient) QueryInGroup(u *Users) *GroupsQuery

QueryInGroup queries the in_group edge of a Users.

func (*UsersClient) Update

func (c *UsersClient) Update() *UsersUpdate

Update returns an update builder for Users.

func (*UsersClient) UpdateOne

func (c *UsersClient) UpdateOne(u *Users) *UsersUpdateOne

UpdateOne returns an update builder for the given entity.

func (*UsersClient) UpdateOneID

func (c *UsersClient) UpdateOneID(id int) *UsersUpdateOne

UpdateOneID returns an update builder for the given id.

func (*UsersClient) Use

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

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

type UsersCreate

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

UsersCreate is the builder for creating a Users entity.

func (*UsersCreate) Exec

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

Exec executes the query.

func (*UsersCreate) ExecX

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

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

func (*UsersCreate) Mutation

func (uc *UsersCreate) Mutation() *UsersMutation

Mutation returns the UsersMutation object of the builder.

func (*UsersCreate) Save

func (uc *UsersCreate) Save(ctx context.Context) (*Users, error)

Save creates the Users in the database.

func (*UsersCreate) SaveX

func (uc *UsersCreate) SaveX(ctx context.Context) *Users

SaveX calls Save and panics if Save returns an error.

func (*UsersCreate) SetInGroup

func (uc *UsersCreate) SetInGroup(g *Groups) *UsersCreate

SetInGroup sets the "in_group" edge to the Groups entity.

func (*UsersCreate) SetInGroupID

func (uc *UsersCreate) SetInGroupID(id int) *UsersCreate

SetInGroupID sets the "in_group" edge to the Groups entity by ID.

func (*UsersCreate) SetNillableInGroupID

func (uc *UsersCreate) SetNillableInGroupID(id *int) *UsersCreate

SetNillableInGroupID sets the "in_group" edge to the Groups entity by ID if the given value is not nil.

func (*UsersCreate) SetNillableUCreatedAt

func (uc *UsersCreate) SetNillableUCreatedAt(t *time.Time) *UsersCreate

SetNillableUCreatedAt sets the "u_created_at" field if the given value is not nil.

func (*UsersCreate) SetNillableUExpiredAt

func (uc *UsersCreate) SetNillableUExpiredAt(t *time.Time) *UsersCreate

SetNillableUExpiredAt sets the "u_expired_at" field if the given value is not nil.

func (*UsersCreate) SetNillableUIsActive

func (uc *UsersCreate) SetNillableUIsActive(b *bool) *UsersCreate

SetNillableUIsActive sets the "u_is_active" field if the given value is not nil.

func (*UsersCreate) SetNillableUPasswordUpdatedAt

func (uc *UsersCreate) SetNillableUPasswordUpdatedAt(t *time.Time) *UsersCreate

SetNillableUPasswordUpdatedAt sets the "u_password_updated_at" field if the given value is not nil.

func (*UsersCreate) SetUCreatedAt

func (uc *UsersCreate) SetUCreatedAt(t time.Time) *UsersCreate

SetUCreatedAt sets the "u_created_at" field.

func (*UsersCreate) SetUExpiredAt

func (uc *UsersCreate) SetUExpiredAt(t time.Time) *UsersCreate

SetUExpiredAt sets the "u_expired_at" field.

func (*UsersCreate) SetUFirstName

func (uc *UsersCreate) SetUFirstName(s string) *UsersCreate

SetUFirstName sets the "u_first_name" field.

func (*UsersCreate) SetUIsActive

func (uc *UsersCreate) SetUIsActive(b bool) *UsersCreate

SetUIsActive sets the "u_is_active" field.

func (*UsersCreate) SetULastName

func (uc *UsersCreate) SetULastName(s string) *UsersCreate

SetULastName sets the "u_last_name" field.

func (*UsersCreate) SetUOrgid

func (uc *UsersCreate) SetUOrgid(s string) *UsersCreate

SetUOrgid sets the "u_orgid" field.

func (*UsersCreate) SetUPasswordUpdatedAt

func (uc *UsersCreate) SetUPasswordUpdatedAt(t time.Time) *UsersCreate

SetUPasswordUpdatedAt sets the "u_password_updated_at" field.

func (*UsersCreate) SetUPid

func (uc *UsersCreate) SetUPid(s string) *UsersCreate

SetUPid sets the "u_pid" field.

type UsersCreateBulk

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

UsersCreateBulk is the builder for creating many Users entities in bulk.

func (*UsersCreateBulk) Exec

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

Exec executes the query.

func (*UsersCreateBulk) ExecX

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

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

func (*UsersCreateBulk) Save

func (ucb *UsersCreateBulk) Save(ctx context.Context) ([]*Users, error)

Save creates the Users entities in the database.

func (*UsersCreateBulk) SaveX

func (ucb *UsersCreateBulk) SaveX(ctx context.Context) []*Users

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

type UsersDelete

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

UsersDelete is the builder for deleting a Users entity.

func (*UsersDelete) Exec

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

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

func (*UsersDelete) ExecX

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

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

func (*UsersDelete) Where

func (ud *UsersDelete) Where(ps ...predicate.Users) *UsersDelete

Where appends a list predicates to the UsersDelete builder.

type UsersDeleteOne

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

UsersDeleteOne is the builder for deleting a single Users entity.

func (*UsersDeleteOne) Exec

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

Exec executes the deletion query.

func (*UsersDeleteOne) ExecX

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

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

type UsersEdges

type UsersEdges struct {
	// InGroup holds the value of the in_group edge.
	InGroup *Groups `json:"in_group,omitempty"`
	// contains filtered or unexported fields
}

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

func (UsersEdges) InGroupOrErr

func (e UsersEdges) InGroupOrErr() (*Groups, error)

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

type UsersGroupBy

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

UsersGroupBy is the group-by builder for Users entities.

func (*UsersGroupBy) Aggregate

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

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

func (*UsersGroupBy) Bool

func (ugb *UsersGroupBy) 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 (*UsersGroupBy) BoolX

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

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

func (*UsersGroupBy) Bools

func (ugb *UsersGroupBy) 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 (*UsersGroupBy) BoolsX

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

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

func (*UsersGroupBy) Float64

func (ugb *UsersGroupBy) 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 (*UsersGroupBy) Float64X

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

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

func (*UsersGroupBy) Float64s

func (ugb *UsersGroupBy) 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 (*UsersGroupBy) Float64sX

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

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

func (*UsersGroupBy) Int

func (ugb *UsersGroupBy) 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 (*UsersGroupBy) IntX

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

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

func (*UsersGroupBy) Ints

func (ugb *UsersGroupBy) 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 (*UsersGroupBy) IntsX

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

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

func (*UsersGroupBy) Scan

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

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

func (*UsersGroupBy) ScanX

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

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

func (*UsersGroupBy) String

func (ugb *UsersGroupBy) 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 (*UsersGroupBy) StringX

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

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

func (*UsersGroupBy) Strings

func (ugb *UsersGroupBy) 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 (*UsersGroupBy) StringsX

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

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

type UsersMutation

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

UsersMutation represents an operation that mutates the Users nodes in the graph.

func (*UsersMutation) AddField

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

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

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

func (*UsersMutation) AddedField

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

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

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

func (*UsersMutation) AddedIDs

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

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

func (*UsersMutation) ClearEdge

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

func (m *UsersMutation) 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 (*UsersMutation) ClearInGroup

func (m *UsersMutation) ClearInGroup()

ClearInGroup clears the "in_group" edge to the Groups entity.

func (*UsersMutation) ClearUCreatedAt

func (m *UsersMutation) ClearUCreatedAt()

ClearUCreatedAt clears the value of the "u_created_at" field.

func (*UsersMutation) ClearUExpiredAt

func (m *UsersMutation) ClearUExpiredAt()

ClearUExpiredAt clears the value of the "u_expired_at" field.

func (*UsersMutation) ClearUPasswordUpdatedAt

func (m *UsersMutation) ClearUPasswordUpdatedAt()

ClearUPasswordUpdatedAt clears the value of the "u_password_updated_at" field.

func (*UsersMutation) ClearedEdges

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

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

func (*UsersMutation) ClearedFields

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

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

func (UsersMutation) Client

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

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

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

func (*UsersMutation) Field

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

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

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

func (*UsersMutation) Fields

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

func (m *UsersMutation) 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 (*UsersMutation) InGroupCleared

func (m *UsersMutation) InGroupCleared() bool

InGroupCleared reports if the "in_group" edge to the Groups entity was cleared.

func (*UsersMutation) InGroupID

func (m *UsersMutation) InGroupID() (id int, exists bool)

InGroupID returns the "in_group" edge ID in the mutation.

func (*UsersMutation) InGroupIDs

func (m *UsersMutation) InGroupIDs() (ids []int)

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

func (*UsersMutation) OldField

func (m *UsersMutation) 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 (*UsersMutation) OldUCreatedAt

func (m *UsersMutation) OldUCreatedAt(ctx context.Context) (v time.Time, err error)

OldUCreatedAt returns the old "u_created_at" field's value of the Users entity. If the Users 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 (*UsersMutation) OldUExpiredAt

func (m *UsersMutation) OldUExpiredAt(ctx context.Context) (v time.Time, err error)

OldUExpiredAt returns the old "u_expired_at" field's value of the Users entity. If the Users 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 (*UsersMutation) OldUFirstName

func (m *UsersMutation) OldUFirstName(ctx context.Context) (v string, err error)

OldUFirstName returns the old "u_first_name" field's value of the Users entity. If the Users 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 (*UsersMutation) OldUIsActive

func (m *UsersMutation) OldUIsActive(ctx context.Context) (v bool, err error)

OldUIsActive returns the old "u_is_active" field's value of the Users entity. If the Users 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 (*UsersMutation) OldULastName

func (m *UsersMutation) OldULastName(ctx context.Context) (v string, err error)

OldULastName returns the old "u_last_name" field's value of the Users entity. If the Users 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 (*UsersMutation) OldUOrgid

func (m *UsersMutation) OldUOrgid(ctx context.Context) (v string, err error)

OldUOrgid returns the old "u_orgid" field's value of the Users entity. If the Users 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 (*UsersMutation) OldUPasswordUpdatedAt

func (m *UsersMutation) OldUPasswordUpdatedAt(ctx context.Context) (v time.Time, err error)

OldUPasswordUpdatedAt returns the old "u_password_updated_at" field's value of the Users entity. If the Users 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 (*UsersMutation) OldUPid

func (m *UsersMutation) OldUPid(ctx context.Context) (v string, err error)

OldUPid returns the old "u_pid" field's value of the Users entity. If the Users 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 (*UsersMutation) Op

func (m *UsersMutation) Op() Op

Op returns the operation name.

func (*UsersMutation) RemovedEdges

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

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

func (*UsersMutation) RemovedIDs

func (m *UsersMutation) 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 (*UsersMutation) ResetEdge

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

func (m *UsersMutation) 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 (*UsersMutation) ResetInGroup

func (m *UsersMutation) ResetInGroup()

ResetInGroup resets all changes to the "in_group" edge.

func (*UsersMutation) ResetUCreatedAt

func (m *UsersMutation) ResetUCreatedAt()

ResetUCreatedAt resets all changes to the "u_created_at" field.

func (*UsersMutation) ResetUExpiredAt

func (m *UsersMutation) ResetUExpiredAt()

ResetUExpiredAt resets all changes to the "u_expired_at" field.

func (*UsersMutation) ResetUFirstName

func (m *UsersMutation) ResetUFirstName()

ResetUFirstName resets all changes to the "u_first_name" field.

func (*UsersMutation) ResetUIsActive

func (m *UsersMutation) ResetUIsActive()

ResetUIsActive resets all changes to the "u_is_active" field.

func (*UsersMutation) ResetULastName

func (m *UsersMutation) ResetULastName()

ResetULastName resets all changes to the "u_last_name" field.

func (*UsersMutation) ResetUOrgid

func (m *UsersMutation) ResetUOrgid()

ResetUOrgid resets all changes to the "u_orgid" field.

func (*UsersMutation) ResetUPasswordUpdatedAt

func (m *UsersMutation) ResetUPasswordUpdatedAt()

ResetUPasswordUpdatedAt resets all changes to the "u_password_updated_at" field.

func (*UsersMutation) ResetUPid

func (m *UsersMutation) ResetUPid()

ResetUPid resets all changes to the "u_pid" field.

func (*UsersMutation) SetField

func (m *UsersMutation) 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 (*UsersMutation) SetInGroupID

func (m *UsersMutation) SetInGroupID(id int)

SetInGroupID sets the "in_group" edge to the Groups entity by id.

func (*UsersMutation) SetUCreatedAt

func (m *UsersMutation) SetUCreatedAt(t time.Time)

SetUCreatedAt sets the "u_created_at" field.

func (*UsersMutation) SetUExpiredAt

func (m *UsersMutation) SetUExpiredAt(t time.Time)

SetUExpiredAt sets the "u_expired_at" field.

func (*UsersMutation) SetUFirstName

func (m *UsersMutation) SetUFirstName(s string)

SetUFirstName sets the "u_first_name" field.

func (*UsersMutation) SetUIsActive

func (m *UsersMutation) SetUIsActive(b bool)

SetUIsActive sets the "u_is_active" field.

func (*UsersMutation) SetULastName

func (m *UsersMutation) SetULastName(s string)

SetULastName sets the "u_last_name" field.

func (*UsersMutation) SetUOrgid

func (m *UsersMutation) SetUOrgid(s string)

SetUOrgid sets the "u_orgid" field.

func (*UsersMutation) SetUPasswordUpdatedAt

func (m *UsersMutation) SetUPasswordUpdatedAt(t time.Time)

SetUPasswordUpdatedAt sets the "u_password_updated_at" field.

func (*UsersMutation) SetUPid

func (m *UsersMutation) SetUPid(s string)

SetUPid sets the "u_pid" field.

func (UsersMutation) Tx

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

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

func (*UsersMutation) Type

func (m *UsersMutation) Type() string

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

func (*UsersMutation) UCreatedAt

func (m *UsersMutation) UCreatedAt() (r time.Time, exists bool)

UCreatedAt returns the value of the "u_created_at" field in the mutation.

func (*UsersMutation) UCreatedAtCleared

func (m *UsersMutation) UCreatedAtCleared() bool

UCreatedAtCleared returns if the "u_created_at" field was cleared in this mutation.

func (*UsersMutation) UExpiredAt

func (m *UsersMutation) UExpiredAt() (r time.Time, exists bool)

UExpiredAt returns the value of the "u_expired_at" field in the mutation.

func (*UsersMutation) UExpiredAtCleared

func (m *UsersMutation) UExpiredAtCleared() bool

UExpiredAtCleared returns if the "u_expired_at" field was cleared in this mutation.

func (*UsersMutation) UFirstName

func (m *UsersMutation) UFirstName() (r string, exists bool)

UFirstName returns the value of the "u_first_name" field in the mutation.

func (*UsersMutation) UIsActive

func (m *UsersMutation) UIsActive() (r bool, exists bool)

UIsActive returns the value of the "u_is_active" field in the mutation.

func (*UsersMutation) ULastName

func (m *UsersMutation) ULastName() (r string, exists bool)

ULastName returns the value of the "u_last_name" field in the mutation.

func (*UsersMutation) UOrgid

func (m *UsersMutation) UOrgid() (r string, exists bool)

UOrgid returns the value of the "u_orgid" field in the mutation.

func (*UsersMutation) UPasswordUpdatedAt

func (m *UsersMutation) UPasswordUpdatedAt() (r time.Time, exists bool)

UPasswordUpdatedAt returns the value of the "u_password_updated_at" field in the mutation.

func (*UsersMutation) UPasswordUpdatedAtCleared

func (m *UsersMutation) UPasswordUpdatedAtCleared() bool

UPasswordUpdatedAtCleared returns if the "u_password_updated_at" field was cleared in this mutation.

func (*UsersMutation) UPid

func (m *UsersMutation) UPid() (r string, exists bool)

UPid returns the value of the "u_pid" field in the mutation.

func (*UsersMutation) Where

func (m *UsersMutation) Where(ps ...predicate.Users)

Where appends a list predicates to the UsersMutation builder.

type UsersQuery

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

UsersQuery is the builder for querying Users entities.

func (*UsersQuery) All

func (uq *UsersQuery) All(ctx context.Context) ([]*Users, error)

All executes the query and returns a list of UsersSlice.

func (*UsersQuery) AllX

func (uq *UsersQuery) AllX(ctx context.Context) []*Users

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

func (*UsersQuery) Clone

func (uq *UsersQuery) Clone() *UsersQuery

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

func (*UsersQuery) Count

func (uq *UsersQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*UsersQuery) CountX

func (uq *UsersQuery) CountX(ctx context.Context) int

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

func (*UsersQuery) Exist

func (uq *UsersQuery) Exist(ctx context.Context) (bool, error)

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

func (*UsersQuery) ExistX

func (uq *UsersQuery) ExistX(ctx context.Context) bool

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

func (*UsersQuery) First

func (uq *UsersQuery) First(ctx context.Context) (*Users, error)

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

func (*UsersQuery) FirstID

func (uq *UsersQuery) FirstID(ctx context.Context) (id int, err error)

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

func (*UsersQuery) FirstIDX

func (uq *UsersQuery) FirstIDX(ctx context.Context) int

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

func (*UsersQuery) FirstX

func (uq *UsersQuery) FirstX(ctx context.Context) *Users

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

func (*UsersQuery) GroupBy

func (uq *UsersQuery) GroupBy(field string, fields ...string) *UsersGroupBy

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

client.Users.Query().
	GroupBy(users.FieldUPid).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*UsersQuery) IDs

func (uq *UsersQuery) IDs(ctx context.Context) ([]int, error)

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

func (*UsersQuery) IDsX

func (uq *UsersQuery) IDsX(ctx context.Context) []int

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

func (*UsersQuery) Limit

func (uq *UsersQuery) Limit(limit int) *UsersQuery

Limit adds a limit step to the query.

func (*UsersQuery) Offset

func (uq *UsersQuery) Offset(offset int) *UsersQuery

Offset adds an offset step to the query.

func (*UsersQuery) Only

func (uq *UsersQuery) Only(ctx context.Context) (*Users, error)

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

func (*UsersQuery) OnlyID

func (uq *UsersQuery) OnlyID(ctx context.Context) (id int, err error)

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

func (*UsersQuery) OnlyIDX

func (uq *UsersQuery) OnlyIDX(ctx context.Context) int

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

func (*UsersQuery) OnlyX

func (uq *UsersQuery) OnlyX(ctx context.Context) *Users

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

func (*UsersQuery) Order

func (uq *UsersQuery) Order(o ...OrderFunc) *UsersQuery

Order adds an order step to the query.

func (*UsersQuery) QueryInGroup

func (uq *UsersQuery) QueryInGroup() *GroupsQuery

QueryInGroup chains the current query on the "in_group" edge.

func (*UsersQuery) Select

func (uq *UsersQuery) Select(fields ...string) *UsersSelect

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

client.Users.Query().
	Select(users.FieldUPid).
	Scan(ctx, &v)

func (*UsersQuery) Unique

func (uq *UsersQuery) Unique(unique bool) *UsersQuery

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

func (uq *UsersQuery) Where(ps ...predicate.Users) *UsersQuery

Where adds a new predicate for the UsersQuery builder.

func (*UsersQuery) WithInGroup

func (uq *UsersQuery) WithInGroup(opts ...func(*GroupsQuery)) *UsersQuery

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

type UsersSelect

type UsersSelect struct {
	*UsersQuery
	// contains filtered or unexported fields
}

UsersSelect is the builder for selecting fields of Users entities.

func (*UsersSelect) Bool

func (us *UsersSelect) Bool(ctx context.Context) (_ bool, err error)

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

func (*UsersSelect) BoolX

func (us *UsersSelect) BoolX(ctx context.Context) bool

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

func (*UsersSelect) Bools

func (us *UsersSelect) Bools(ctx context.Context) ([]bool, error)

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

func (*UsersSelect) BoolsX

func (us *UsersSelect) BoolsX(ctx context.Context) []bool

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

func (*UsersSelect) Float64

func (us *UsersSelect) Float64(ctx context.Context) (_ float64, err error)

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

func (*UsersSelect) Float64X

func (us *UsersSelect) Float64X(ctx context.Context) float64

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

func (*UsersSelect) Float64s

func (us *UsersSelect) Float64s(ctx context.Context) ([]float64, error)

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

func (*UsersSelect) Float64sX

func (us *UsersSelect) Float64sX(ctx context.Context) []float64

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

func (*UsersSelect) Int

func (us *UsersSelect) Int(ctx context.Context) (_ int, err error)

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

func (*UsersSelect) IntX

func (us *UsersSelect) IntX(ctx context.Context) int

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

func (*UsersSelect) Ints

func (us *UsersSelect) Ints(ctx context.Context) ([]int, error)

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

func (*UsersSelect) IntsX

func (us *UsersSelect) IntsX(ctx context.Context) []int

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

func (*UsersSelect) Scan

func (us *UsersSelect) Scan(ctx context.Context, v interface{}) error

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

func (*UsersSelect) ScanX

func (us *UsersSelect) ScanX(ctx context.Context, v interface{})

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

func (*UsersSelect) String

func (us *UsersSelect) String(ctx context.Context) (_ string, err error)

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

func (*UsersSelect) StringX

func (us *UsersSelect) StringX(ctx context.Context) string

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

func (*UsersSelect) Strings

func (us *UsersSelect) Strings(ctx context.Context) ([]string, error)

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

func (*UsersSelect) StringsX

func (us *UsersSelect) StringsX(ctx context.Context) []string

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

type UsersSlice

type UsersSlice []*Users

UsersSlice is a parsable slice of Users.

type UsersUpdate

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

UsersUpdate is the builder for updating Users entities.

func (*UsersUpdate) ClearInGroup

func (uu *UsersUpdate) ClearInGroup() *UsersUpdate

ClearInGroup clears the "in_group" edge to the Groups entity.

func (*UsersUpdate) ClearUExpiredAt

func (uu *UsersUpdate) ClearUExpiredAt() *UsersUpdate

ClearUExpiredAt clears the value of the "u_expired_at" field.

func (*UsersUpdate) ClearUPasswordUpdatedAt

func (uu *UsersUpdate) ClearUPasswordUpdatedAt() *UsersUpdate

ClearUPasswordUpdatedAt clears the value of the "u_password_updated_at" field.

func (*UsersUpdate) Exec

func (uu *UsersUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*UsersUpdate) ExecX

func (uu *UsersUpdate) ExecX(ctx context.Context)

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

func (*UsersUpdate) Mutation

func (uu *UsersUpdate) Mutation() *UsersMutation

Mutation returns the UsersMutation object of the builder.

func (*UsersUpdate) Save

func (uu *UsersUpdate) Save(ctx context.Context) (int, error)

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

func (*UsersUpdate) SaveX

func (uu *UsersUpdate) SaveX(ctx context.Context) int

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

func (*UsersUpdate) SetInGroup

func (uu *UsersUpdate) SetInGroup(g *Groups) *UsersUpdate

SetInGroup sets the "in_group" edge to the Groups entity.

func (*UsersUpdate) SetInGroupID

func (uu *UsersUpdate) SetInGroupID(id int) *UsersUpdate

SetInGroupID sets the "in_group" edge to the Groups entity by ID.

func (*UsersUpdate) SetNillableInGroupID

func (uu *UsersUpdate) SetNillableInGroupID(id *int) *UsersUpdate

SetNillableInGroupID sets the "in_group" edge to the Groups entity by ID if the given value is not nil.

func (*UsersUpdate) SetNillableUExpiredAt

func (uu *UsersUpdate) SetNillableUExpiredAt(t *time.Time) *UsersUpdate

SetNillableUExpiredAt sets the "u_expired_at" field if the given value is not nil.

func (*UsersUpdate) SetNillableUIsActive

func (uu *UsersUpdate) SetNillableUIsActive(b *bool) *UsersUpdate

SetNillableUIsActive sets the "u_is_active" field if the given value is not nil.

func (*UsersUpdate) SetNillableUPasswordUpdatedAt

func (uu *UsersUpdate) SetNillableUPasswordUpdatedAt(t *time.Time) *UsersUpdate

SetNillableUPasswordUpdatedAt sets the "u_password_updated_at" field if the given value is not nil.

func (*UsersUpdate) SetUExpiredAt

func (uu *UsersUpdate) SetUExpiredAt(t time.Time) *UsersUpdate

SetUExpiredAt sets the "u_expired_at" field.

func (*UsersUpdate) SetUFirstName

func (uu *UsersUpdate) SetUFirstName(s string) *UsersUpdate

SetUFirstName sets the "u_first_name" field.

func (*UsersUpdate) SetUIsActive

func (uu *UsersUpdate) SetUIsActive(b bool) *UsersUpdate

SetUIsActive sets the "u_is_active" field.

func (*UsersUpdate) SetULastName

func (uu *UsersUpdate) SetULastName(s string) *UsersUpdate

SetULastName sets the "u_last_name" field.

func (*UsersUpdate) SetUOrgid

func (uu *UsersUpdate) SetUOrgid(s string) *UsersUpdate

SetUOrgid sets the "u_orgid" field.

func (*UsersUpdate) SetUPasswordUpdatedAt

func (uu *UsersUpdate) SetUPasswordUpdatedAt(t time.Time) *UsersUpdate

SetUPasswordUpdatedAt sets the "u_password_updated_at" field.

func (*UsersUpdate) SetUPid

func (uu *UsersUpdate) SetUPid(s string) *UsersUpdate

SetUPid sets the "u_pid" field.

func (*UsersUpdate) Where

func (uu *UsersUpdate) Where(ps ...predicate.Users) *UsersUpdate

Where appends a list predicates to the UsersUpdate builder.

type UsersUpdateOne

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

UsersUpdateOne is the builder for updating a single Users entity.

func (*UsersUpdateOne) ClearInGroup

func (uuo *UsersUpdateOne) ClearInGroup() *UsersUpdateOne

ClearInGroup clears the "in_group" edge to the Groups entity.

func (*UsersUpdateOne) ClearUExpiredAt

func (uuo *UsersUpdateOne) ClearUExpiredAt() *UsersUpdateOne

ClearUExpiredAt clears the value of the "u_expired_at" field.

func (*UsersUpdateOne) ClearUPasswordUpdatedAt

func (uuo *UsersUpdateOne) ClearUPasswordUpdatedAt() *UsersUpdateOne

ClearUPasswordUpdatedAt clears the value of the "u_password_updated_at" field.

func (*UsersUpdateOne) Exec

func (uuo *UsersUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*UsersUpdateOne) ExecX

func (uuo *UsersUpdateOne) ExecX(ctx context.Context)

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

func (*UsersUpdateOne) Mutation

func (uuo *UsersUpdateOne) Mutation() *UsersMutation

Mutation returns the UsersMutation object of the builder.

func (*UsersUpdateOne) Save

func (uuo *UsersUpdateOne) Save(ctx context.Context) (*Users, error)

Save executes the query and returns the updated Users entity.

func (*UsersUpdateOne) SaveX

func (uuo *UsersUpdateOne) SaveX(ctx context.Context) *Users

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

func (*UsersUpdateOne) Select

func (uuo *UsersUpdateOne) Select(field string, fields ...string) *UsersUpdateOne

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

func (*UsersUpdateOne) SetInGroup

func (uuo *UsersUpdateOne) SetInGroup(g *Groups) *UsersUpdateOne

SetInGroup sets the "in_group" edge to the Groups entity.

func (*UsersUpdateOne) SetInGroupID

func (uuo *UsersUpdateOne) SetInGroupID(id int) *UsersUpdateOne

SetInGroupID sets the "in_group" edge to the Groups entity by ID.

func (*UsersUpdateOne) SetNillableInGroupID

func (uuo *UsersUpdateOne) SetNillableInGroupID(id *int) *UsersUpdateOne

SetNillableInGroupID sets the "in_group" edge to the Groups entity by ID if the given value is not nil.

func (*UsersUpdateOne) SetNillableUExpiredAt

func (uuo *UsersUpdateOne) SetNillableUExpiredAt(t *time.Time) *UsersUpdateOne

SetNillableUExpiredAt sets the "u_expired_at" field if the given value is not nil.

func (*UsersUpdateOne) SetNillableUIsActive

func (uuo *UsersUpdateOne) SetNillableUIsActive(b *bool) *UsersUpdateOne

SetNillableUIsActive sets the "u_is_active" field if the given value is not nil.

func (*UsersUpdateOne) SetNillableUPasswordUpdatedAt

func (uuo *UsersUpdateOne) SetNillableUPasswordUpdatedAt(t *time.Time) *UsersUpdateOne

SetNillableUPasswordUpdatedAt sets the "u_password_updated_at" field if the given value is not nil.

func (*UsersUpdateOne) SetUExpiredAt

func (uuo *UsersUpdateOne) SetUExpiredAt(t time.Time) *UsersUpdateOne

SetUExpiredAt sets the "u_expired_at" field.

func (*UsersUpdateOne) SetUFirstName

func (uuo *UsersUpdateOne) SetUFirstName(s string) *UsersUpdateOne

SetUFirstName sets the "u_first_name" field.

func (*UsersUpdateOne) SetUIsActive

func (uuo *UsersUpdateOne) SetUIsActive(b bool) *UsersUpdateOne

SetUIsActive sets the "u_is_active" field.

func (*UsersUpdateOne) SetULastName

func (uuo *UsersUpdateOne) SetULastName(s string) *UsersUpdateOne

SetULastName sets the "u_last_name" field.

func (*UsersUpdateOne) SetUOrgid

func (uuo *UsersUpdateOne) SetUOrgid(s string) *UsersUpdateOne

SetUOrgid sets the "u_orgid" field.

func (*UsersUpdateOne) SetUPasswordUpdatedAt

func (uuo *UsersUpdateOne) SetUPasswordUpdatedAt(t time.Time) *UsersUpdateOne

SetUPasswordUpdatedAt sets the "u_password_updated_at" field.

func (*UsersUpdateOne) SetUPid

func (uuo *UsersUpdateOne) SetUPid(s string) *UsersUpdateOne

SetUPid sets the "u_pid" field.

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