ent

package
v0.0.0-...-57c7f8a Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2020 License: MIT Imports: 20 Imported by: 2

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.
	TypeChallenge = "Challenge"
	TypeGuild     = "Guild"
	TypeSession   = "Session"
)

Variables

This section is empty.

Functions

func IsConstraintError

func IsConstraintError(err error) bool

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

func IsNotFound

func IsNotFound(err error) bool

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

func IsNotLoaded

func IsNotLoaded(err error) bool

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

func IsNotSingular

func IsNotSingular(err error) bool

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

func IsValidationError

func IsValidationError(err error) bool

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

func MaskNotFound

func MaskNotFound(err error) error

MaskNotFound masks nor found error.

func NewContext

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

NewContext returns a new context with the given Client attached.

func NewTxContext

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

NewTxContext returns a new context with the given Client attached.

Types

type AggregateFunc

type AggregateFunc func(*sql.Selector) string

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

func As

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

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

func Count

func Count() AggregateFunc

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

func Max

func Max(field string) AggregateFunc

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

func Mean

func Mean(field string) AggregateFunc

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

func Min

func Min(field string) AggregateFunc

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

func Sum

func Sum(field string) AggregateFunc

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

type Challenge

type Challenge struct {

	// ID of the ent.
	ID int `json:"id,omitempty"`
	// CreateTime holds the value of the "create_time" field.
	CreateTime time.Time `json:"create_time,omitempty"`
	// UpdateTime holds the value of the "update_time" field.
	UpdateTime time.Time `json:"update_time,omitempty"`
	// ChallengeID holds the value of the "challenge_id" field.
	ChallengeID string `json:"challenge_id,omitempty"`
	// UserID holds the value of the "user_id" field.
	UserID string `json:"user_id,omitempty"`
	// Human holds the value of the "human" field.
	Human string `json:"human,omitempty"`
	// Magic holds the value of the "magic" field.
	Magic string `json:"magic,omitempty"`
	// ExpiresAt holds the value of the "expires_at" field.
	ExpiresAt time.Time `json:"expires_at,omitempty"`
	// contains filtered or unexported fields
}

Challenge is the model entity for the Challenge schema.

func (*Challenge) String

func (c *Challenge) String() string

String implements the fmt.Stringer.

func (*Challenge) Unwrap

func (c *Challenge) Unwrap() *Challenge

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

func (*Challenge) Update

func (c *Challenge) Update() *ChallengeUpdateOne

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

type ChallengeClient

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

ChallengeClient is a client for the Challenge schema.

func NewChallengeClient

func NewChallengeClient(c config) *ChallengeClient

NewChallengeClient returns a client for the Challenge from the given config.

func (*ChallengeClient) Create

func (c *ChallengeClient) Create() *ChallengeCreate

Create returns a create builder for Challenge.

func (*ChallengeClient) CreateBulk

func (c *ChallengeClient) CreateBulk(builders ...*ChallengeCreate) *ChallengeCreateBulk

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

func (*ChallengeClient) Delete

func (c *ChallengeClient) Delete() *ChallengeDelete

Delete returns a delete builder for Challenge.

func (*ChallengeClient) DeleteOne

func (c *ChallengeClient) DeleteOne(ch *Challenge) *ChallengeDeleteOne

DeleteOne returns a delete builder for the given entity.

func (*ChallengeClient) DeleteOneID

func (c *ChallengeClient) DeleteOneID(id int) *ChallengeDeleteOne

DeleteOneID returns a delete builder for the given id.

func (*ChallengeClient) Get

func (c *ChallengeClient) Get(ctx context.Context, id int) (*Challenge, error)

Get returns a Challenge entity by its id.

func (*ChallengeClient) GetX

func (c *ChallengeClient) GetX(ctx context.Context, id int) *Challenge

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

func (*ChallengeClient) Hooks

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

Hooks returns the client hooks.

func (*ChallengeClient) Query

func (c *ChallengeClient) Query() *ChallengeQuery

Query returns a query builder for Challenge.

func (*ChallengeClient) Update

func (c *ChallengeClient) Update() *ChallengeUpdate

Update returns an update builder for Challenge.

func (*ChallengeClient) UpdateOne

func (c *ChallengeClient) UpdateOne(ch *Challenge) *ChallengeUpdateOne

UpdateOne returns an update builder for the given entity.

func (*ChallengeClient) UpdateOneID

func (c *ChallengeClient) UpdateOneID(id int) *ChallengeUpdateOne

UpdateOneID returns an update builder for the given id.

func (*ChallengeClient) Use

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

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

type ChallengeCreate

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

ChallengeCreate is the builder for creating a Challenge entity.

func (*ChallengeCreate) Mutation

func (cc *ChallengeCreate) Mutation() *ChallengeMutation

Mutation returns the ChallengeMutation object of the builder.

func (*ChallengeCreate) Save

func (cc *ChallengeCreate) Save(ctx context.Context) (*Challenge, error)

Save creates the Challenge in the database.

func (*ChallengeCreate) SaveX

func (cc *ChallengeCreate) SaveX(ctx context.Context) *Challenge

SaveX calls Save and panics if Save returns an error.

func (*ChallengeCreate) SetChallengeID

func (cc *ChallengeCreate) SetChallengeID(s string) *ChallengeCreate

SetChallengeID sets the challenge_id field.

func (*ChallengeCreate) SetCreateTime

func (cc *ChallengeCreate) SetCreateTime(t time.Time) *ChallengeCreate

SetCreateTime sets the create_time field.

func (*ChallengeCreate) SetExpiresAt

func (cc *ChallengeCreate) SetExpiresAt(t time.Time) *ChallengeCreate

SetExpiresAt sets the expires_at field.

func (*ChallengeCreate) SetHuman

func (cc *ChallengeCreate) SetHuman(s string) *ChallengeCreate

SetHuman sets the human field.

func (*ChallengeCreate) SetMagic

func (cc *ChallengeCreate) SetMagic(s string) *ChallengeCreate

SetMagic sets the magic field.

func (*ChallengeCreate) SetNillableCreateTime

func (cc *ChallengeCreate) SetNillableCreateTime(t *time.Time) *ChallengeCreate

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

func (*ChallengeCreate) SetNillableExpiresAt

func (cc *ChallengeCreate) SetNillableExpiresAt(t *time.Time) *ChallengeCreate

SetNillableExpiresAt sets the expires_at field if the given value is not nil.

func (*ChallengeCreate) SetNillableUpdateTime

func (cc *ChallengeCreate) SetNillableUpdateTime(t *time.Time) *ChallengeCreate

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

func (*ChallengeCreate) SetUpdateTime

func (cc *ChallengeCreate) SetUpdateTime(t time.Time) *ChallengeCreate

SetUpdateTime sets the update_time field.

func (*ChallengeCreate) SetUserID

func (cc *ChallengeCreate) SetUserID(s string) *ChallengeCreate

SetUserID sets the user_id field.

type ChallengeCreateBulk

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

ChallengeCreateBulk is the builder for creating a bulk of Challenge entities.

func (*ChallengeCreateBulk) Save

func (ccb *ChallengeCreateBulk) Save(ctx context.Context) ([]*Challenge, error)

Save creates the Challenge entities in the database.

func (*ChallengeCreateBulk) SaveX

func (ccb *ChallengeCreateBulk) SaveX(ctx context.Context) []*Challenge

SaveX calls Save and panics if Save returns an error.

type ChallengeDelete

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

ChallengeDelete is the builder for deleting a Challenge entity.

func (*ChallengeDelete) Exec

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

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

func (*ChallengeDelete) ExecX

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

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

func (*ChallengeDelete) Where

Where adds a new predicate to the delete builder.

type ChallengeDeleteOne

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

ChallengeDeleteOne is the builder for deleting a single Challenge entity.

func (*ChallengeDeleteOne) Exec

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

Exec executes the deletion query.

func (*ChallengeDeleteOne) ExecX

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

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

type ChallengeGroupBy

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

ChallengeGroupBy is the builder for group-by Challenge entities.

func (*ChallengeGroupBy) Aggregate

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

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

func (*ChallengeGroupBy) Bool

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

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

func (*ChallengeGroupBy) BoolX

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

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

func (*ChallengeGroupBy) Bools

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

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

func (*ChallengeGroupBy) BoolsX

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

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

func (*ChallengeGroupBy) Float64

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

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

func (*ChallengeGroupBy) Float64X

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

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

func (*ChallengeGroupBy) Float64s

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

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

func (*ChallengeGroupBy) Float64sX

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

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

func (*ChallengeGroupBy) Int

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

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

func (*ChallengeGroupBy) IntX

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

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

func (*ChallengeGroupBy) Ints

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

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

func (*ChallengeGroupBy) IntsX

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

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

func (*ChallengeGroupBy) Scan

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

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

func (*ChallengeGroupBy) ScanX

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

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

func (*ChallengeGroupBy) String

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

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

func (*ChallengeGroupBy) StringX

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

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

func (*ChallengeGroupBy) Strings

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

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

func (*ChallengeGroupBy) StringsX

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

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

type ChallengeMutation

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

ChallengeMutation represents an operation that mutate the Challenges nodes in the graph.

func (*ChallengeMutation) AddField

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

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

func (*ChallengeMutation) AddedEdges

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

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

func (*ChallengeMutation) AddedField

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

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

func (*ChallengeMutation) AddedFields

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

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

func (*ChallengeMutation) AddedIDs

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

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

func (*ChallengeMutation) ChallengeID

func (m *ChallengeMutation) ChallengeID() (r string, exists bool)

ChallengeID returns the challenge_id value in the mutation.

func (*ChallengeMutation) ClearEdge

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

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

func (*ChallengeMutation) ClearField

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

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

func (*ChallengeMutation) ClearedEdges

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

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

func (*ChallengeMutation) ClearedFields

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

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

func (ChallengeMutation) Client

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

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

CreateTime returns the create_time value in the mutation.

func (*ChallengeMutation) EdgeCleared

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

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

func (*ChallengeMutation) ExpiresAt

func (m *ChallengeMutation) ExpiresAt() (r time.Time, exists bool)

ExpiresAt returns the expires_at value in the mutation.

func (*ChallengeMutation) Field

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

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

func (*ChallengeMutation) FieldCleared

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

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

func (*ChallengeMutation) Fields

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

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

func (*ChallengeMutation) Human

func (m *ChallengeMutation) Human() (r string, exists bool)

Human returns the human value in the mutation.

func (*ChallengeMutation) ID

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

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

func (*ChallengeMutation) Magic

func (m *ChallengeMutation) Magic() (r string, exists bool)

Magic returns the magic value in the mutation.

func (*ChallengeMutation) OldChallengeID

func (m *ChallengeMutation) OldChallengeID(ctx context.Context) (v string, err error)

OldChallengeID returns the old challenge_id value of the Challenge. If the Challenge object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or database query fails.

func (*ChallengeMutation) OldCreateTime

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

OldCreateTime returns the old create_time value of the Challenge. If the Challenge object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or database query fails.

func (*ChallengeMutation) OldExpiresAt

func (m *ChallengeMutation) OldExpiresAt(ctx context.Context) (v time.Time, err error)

OldExpiresAt returns the old expires_at value of the Challenge. If the Challenge object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or database query fails.

func (*ChallengeMutation) OldField

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

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

func (*ChallengeMutation) OldHuman

func (m *ChallengeMutation) OldHuman(ctx context.Context) (v string, err error)

OldHuman returns the old human value of the Challenge. If the Challenge object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or database query fails.

func (*ChallengeMutation) OldMagic

func (m *ChallengeMutation) OldMagic(ctx context.Context) (v string, err error)

OldMagic returns the old magic value of the Challenge. If the Challenge object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or database query fails.

func (*ChallengeMutation) OldUpdateTime

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

OldUpdateTime returns the old update_time value of the Challenge. If the Challenge object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or database query fails.

func (*ChallengeMutation) OldUserID

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

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

func (*ChallengeMutation) Op

func (m *ChallengeMutation) Op() Op

Op returns the operation name.

func (*ChallengeMutation) RemovedEdges

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

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

func (*ChallengeMutation) RemovedIDs

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

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

func (*ChallengeMutation) ResetChallengeID

func (m *ChallengeMutation) ResetChallengeID()

ResetChallengeID reset all changes of the "challenge_id" field.

func (*ChallengeMutation) ResetCreateTime

func (m *ChallengeMutation) ResetCreateTime()

ResetCreateTime reset all changes of the "create_time" field.

func (*ChallengeMutation) ResetEdge

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

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

func (*ChallengeMutation) ResetExpiresAt

func (m *ChallengeMutation) ResetExpiresAt()

ResetExpiresAt reset all changes of the "expires_at" field.

func (*ChallengeMutation) ResetField

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

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

func (*ChallengeMutation) ResetHuman

func (m *ChallengeMutation) ResetHuman()

ResetHuman reset all changes of the "human" field.

func (*ChallengeMutation) ResetMagic

func (m *ChallengeMutation) ResetMagic()

ResetMagic reset all changes of the "magic" field.

func (*ChallengeMutation) ResetUpdateTime

func (m *ChallengeMutation) ResetUpdateTime()

ResetUpdateTime reset all changes of the "update_time" field.

func (*ChallengeMutation) ResetUserID

func (m *ChallengeMutation) ResetUserID()

ResetUserID reset all changes of the "user_id" field.

func (*ChallengeMutation) SetChallengeID

func (m *ChallengeMutation) SetChallengeID(s string)

SetChallengeID sets the challenge_id field.

func (*ChallengeMutation) SetCreateTime

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

SetCreateTime sets the create_time field.

func (*ChallengeMutation) SetExpiresAt

func (m *ChallengeMutation) SetExpiresAt(t time.Time)

SetExpiresAt sets the expires_at field.

func (*ChallengeMutation) SetField

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

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

func (*ChallengeMutation) SetHuman

func (m *ChallengeMutation) SetHuman(s string)

SetHuman sets the human field.

func (*ChallengeMutation) SetMagic

func (m *ChallengeMutation) SetMagic(s string)

SetMagic sets the magic field.

func (*ChallengeMutation) SetUpdateTime

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

SetUpdateTime sets the update_time field.

func (*ChallengeMutation) SetUserID

func (m *ChallengeMutation) SetUserID(s string)

SetUserID sets the user_id field.

func (ChallengeMutation) Tx

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

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

func (*ChallengeMutation) Type

func (m *ChallengeMutation) Type() string

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

func (*ChallengeMutation) UpdateTime

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

UpdateTime returns the update_time value in the mutation.

func (*ChallengeMutation) UserID

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

UserID returns the user_id value in the mutation.

type ChallengeQuery

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

ChallengeQuery is the builder for querying Challenge entities.

func (*ChallengeQuery) All

func (cq *ChallengeQuery) All(ctx context.Context) ([]*Challenge, error)

All executes the query and returns a list of Challenges.

func (*ChallengeQuery) AllX

func (cq *ChallengeQuery) AllX(ctx context.Context) []*Challenge

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

func (*ChallengeQuery) Clone

func (cq *ChallengeQuery) Clone() *ChallengeQuery

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

func (*ChallengeQuery) Count

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

Count returns the count of the given query.

func (*ChallengeQuery) CountX

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

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

func (*ChallengeQuery) Exist

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

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

func (*ChallengeQuery) ExistX

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

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

func (*ChallengeQuery) First

func (cq *ChallengeQuery) First(ctx context.Context) (*Challenge, error)

First returns the first Challenge entity in the query. Returns *NotFoundError when no challenge was found.

func (*ChallengeQuery) FirstID

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

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

func (*ChallengeQuery) FirstX

func (cq *ChallengeQuery) FirstX(ctx context.Context) *Challenge

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

func (*ChallengeQuery) FirstXID

func (cq *ChallengeQuery) FirstXID(ctx context.Context) int

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

func (*ChallengeQuery) GroupBy

func (cq *ChallengeQuery) GroupBy(field string, fields ...string) *ChallengeGroupBy

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

Example:

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

client.Challenge.Query().
	GroupBy(challenge.FieldCreateTime).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*ChallengeQuery) IDs

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

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

func (*ChallengeQuery) IDsX

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

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

func (*ChallengeQuery) Limit

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

Limit adds a limit step to the query.

func (*ChallengeQuery) Offset

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

Offset adds an offset step to the query.

func (*ChallengeQuery) Only

func (cq *ChallengeQuery) Only(ctx context.Context) (*Challenge, error)

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

func (*ChallengeQuery) OnlyID

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

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

func (*ChallengeQuery) OnlyIDX

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

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

func (*ChallengeQuery) OnlyX

func (cq *ChallengeQuery) OnlyX(ctx context.Context) *Challenge

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

func (*ChallengeQuery) Order

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

Order adds an order step to the query.

func (*ChallengeQuery) Select

func (cq *ChallengeQuery) Select(field string, fields ...string) *ChallengeSelect

Select one or more fields from the given query.

Example:

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

client.Challenge.Query().
	Select(challenge.FieldCreateTime).
	Scan(ctx, &v)

func (*ChallengeQuery) Where

Where adds a new predicate for the builder.

type ChallengeSelect

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

ChallengeSelect is the builder for select fields of Challenge entities.

func (*ChallengeSelect) Bool

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

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

func (*ChallengeSelect) BoolX

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

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

func (*ChallengeSelect) Bools

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

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

func (*ChallengeSelect) BoolsX

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

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

func (*ChallengeSelect) Float64

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

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

func (*ChallengeSelect) Float64X

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

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

func (*ChallengeSelect) Float64s

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

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

func (*ChallengeSelect) Float64sX

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

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

func (*ChallengeSelect) Int

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

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

func (*ChallengeSelect) IntX

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

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

func (*ChallengeSelect) Ints

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

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

func (*ChallengeSelect) IntsX

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

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

func (*ChallengeSelect) Scan

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

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

func (*ChallengeSelect) ScanX

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

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

func (*ChallengeSelect) String

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

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

func (*ChallengeSelect) StringX

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

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

func (*ChallengeSelect) Strings

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

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

func (*ChallengeSelect) StringsX

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

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

type ChallengeUpdate

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

ChallengeUpdate is the builder for updating Challenge entities.

func (*ChallengeUpdate) Exec

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

Exec executes the query.

func (*ChallengeUpdate) ExecX

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

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

func (*ChallengeUpdate) Mutation

func (cu *ChallengeUpdate) Mutation() *ChallengeMutation

Mutation returns the ChallengeMutation object of the builder.

func (*ChallengeUpdate) Save

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

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

func (*ChallengeUpdate) SaveX

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

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

func (*ChallengeUpdate) Where

Where adds a new predicate for the builder.

type ChallengeUpdateOne

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

ChallengeUpdateOne is the builder for updating a single Challenge entity.

func (*ChallengeUpdateOne) Exec

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

Exec executes the query on the entity.

func (*ChallengeUpdateOne) ExecX

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

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

func (*ChallengeUpdateOne) Mutation

func (cuo *ChallengeUpdateOne) Mutation() *ChallengeMutation

Mutation returns the ChallengeMutation object of the builder.

func (*ChallengeUpdateOne) Save

func (cuo *ChallengeUpdateOne) Save(ctx context.Context) (*Challenge, error)

Save executes the query and returns the updated entity.

func (*ChallengeUpdateOne) SaveX

func (cuo *ChallengeUpdateOne) SaveX(ctx context.Context) *Challenge

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

type Challenges

type Challenges []*Challenge

Challenges is a parsable slice of Challenge.

type Client

type Client struct {

	// Schema is the client for creating, migrating and dropping schema.
	Schema *migrate.Schema
	// Challenge is the client for interacting with the Challenge builders.
	Challenge *ChallengeClient
	// Guild is the client for interacting with the Guild builders.
	Guild *GuildClient
	// Session is the client for interacting with the Session builders.
	Session *SessionClient
	// contains filtered or unexported fields
}

Client is the client that holds all ent builders.

func FromContext

func FromContext(ctx context.Context) *Client

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

func NewClient

func NewClient(opts ...Option) *Client

NewClient creates a new client configured with the given options.

func Open

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

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

func (*Client) BeginTx

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

BeginTx returns a transactional client with options.

func (*Client) Close

func (c *Client) Close() error

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

func (*Client) Debug

func (c *Client) Debug() *Client

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

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

type Guild struct {

	// ID of the ent.
	ID int `json:"id,omitempty"`
	// CreateTime holds the value of the "create_time" field.
	CreateTime time.Time `json:"create_time,omitempty"`
	// UpdateTime holds the value of the "update_time" field.
	UpdateTime time.Time `json:"update_time,omitempty"`
	// Snowflake holds the value of the "snowflake" field.
	Snowflake string `json:"snowflake,omitempty"`
	// Message holds the value of the "message" field.
	Message string `json:"message,omitempty"`
	// Categories holds the value of the "categories" field.
	Categories []schema.Category `json:"categories,omitempty"`
	// Entitlements holds the value of the "entitlements" field.
	Entitlements []string `json:"entitlements,omitempty"`
	// contains filtered or unexported fields
}

Guild is the model entity for the Guild schema.

func (*Guild) String

func (gu *Guild) String() string

String implements the fmt.Stringer.

func (*Guild) Unwrap

func (gu *Guild) Unwrap() *Guild

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

func (*Guild) Update

func (gu *Guild) Update() *GuildUpdateOne

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

type GuildClient

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

GuildClient is a client for the Guild schema.

func NewGuildClient

func NewGuildClient(c config) *GuildClient

NewGuildClient returns a client for the Guild from the given config.

func (*GuildClient) Create

func (c *GuildClient) Create() *GuildCreate

Create returns a create builder for Guild.

func (*GuildClient) CreateBulk

func (c *GuildClient) CreateBulk(builders ...*GuildCreate) *GuildCreateBulk

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

func (*GuildClient) Delete

func (c *GuildClient) Delete() *GuildDelete

Delete returns a delete builder for Guild.

func (*GuildClient) DeleteOne

func (c *GuildClient) DeleteOne(gu *Guild) *GuildDeleteOne

DeleteOne returns a delete builder for the given entity.

func (*GuildClient) DeleteOneID

func (c *GuildClient) DeleteOneID(id int) *GuildDeleteOne

DeleteOneID returns a delete builder for the given id.

func (*GuildClient) Get

func (c *GuildClient) Get(ctx context.Context, id int) (*Guild, error)

Get returns a Guild entity by its id.

func (*GuildClient) GetX

func (c *GuildClient) GetX(ctx context.Context, id int) *Guild

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

func (*GuildClient) Hooks

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

Hooks returns the client hooks.

func (*GuildClient) Query

func (c *GuildClient) Query() *GuildQuery

Query returns a query builder for Guild.

func (*GuildClient) Update

func (c *GuildClient) Update() *GuildUpdate

Update returns an update builder for Guild.

func (*GuildClient) UpdateOne

func (c *GuildClient) UpdateOne(gu *Guild) *GuildUpdateOne

UpdateOne returns an update builder for the given entity.

func (*GuildClient) UpdateOneID

func (c *GuildClient) UpdateOneID(id int) *GuildUpdateOne

UpdateOneID returns an update builder for the given id.

func (*GuildClient) Use

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

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

type GuildCreate

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

GuildCreate is the builder for creating a Guild entity.

func (*GuildCreate) Mutation

func (gc *GuildCreate) Mutation() *GuildMutation

Mutation returns the GuildMutation object of the builder.

func (*GuildCreate) Save

func (gc *GuildCreate) Save(ctx context.Context) (*Guild, error)

Save creates the Guild in the database.

func (*GuildCreate) SaveX

func (gc *GuildCreate) SaveX(ctx context.Context) *Guild

SaveX calls Save and panics if Save returns an error.

func (*GuildCreate) SetCategories

func (gc *GuildCreate) SetCategories(s []schema.Category) *GuildCreate

SetCategories sets the categories field.

func (*GuildCreate) SetCreateTime

func (gc *GuildCreate) SetCreateTime(t time.Time) *GuildCreate

SetCreateTime sets the create_time field.

func (*GuildCreate) SetEntitlements

func (gc *GuildCreate) SetEntitlements(s []string) *GuildCreate

SetEntitlements sets the entitlements field.

func (*GuildCreate) SetMessage

func (gc *GuildCreate) SetMessage(s string) *GuildCreate

SetMessage sets the message field.

func (*GuildCreate) SetNillableCreateTime

func (gc *GuildCreate) SetNillableCreateTime(t *time.Time) *GuildCreate

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

func (*GuildCreate) SetNillableUpdateTime

func (gc *GuildCreate) SetNillableUpdateTime(t *time.Time) *GuildCreate

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

func (*GuildCreate) SetSnowflake

func (gc *GuildCreate) SetSnowflake(s string) *GuildCreate

SetSnowflake sets the snowflake field.

func (*GuildCreate) SetUpdateTime

func (gc *GuildCreate) SetUpdateTime(t time.Time) *GuildCreate

SetUpdateTime sets the update_time field.

type GuildCreateBulk

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

GuildCreateBulk is the builder for creating a bulk of Guild entities.

func (*GuildCreateBulk) Save

func (gcb *GuildCreateBulk) Save(ctx context.Context) ([]*Guild, error)

Save creates the Guild entities in the database.

func (*GuildCreateBulk) SaveX

func (gcb *GuildCreateBulk) SaveX(ctx context.Context) []*Guild

SaveX calls Save and panics if Save returns an error.

type GuildDelete

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

GuildDelete is the builder for deleting a Guild entity.

func (*GuildDelete) Exec

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

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

func (*GuildDelete) ExecX

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

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

func (*GuildDelete) Where

func (gd *GuildDelete) Where(ps ...predicate.Guild) *GuildDelete

Where adds a new predicate to the delete builder.

type GuildDeleteOne

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

GuildDeleteOne is the builder for deleting a single Guild entity.

func (*GuildDeleteOne) Exec

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

Exec executes the deletion query.

func (*GuildDeleteOne) ExecX

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

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

type GuildGroupBy

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

GuildGroupBy is the builder for group-by Guild entities.

func (*GuildGroupBy) Aggregate

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

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

func (*GuildGroupBy) Bool

func (ggb *GuildGroupBy) Bool(ctx context.Context) (_ bool, err error)

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

func (*GuildGroupBy) BoolX

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

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

func (*GuildGroupBy) Bools

func (ggb *GuildGroupBy) Bools(ctx context.Context) ([]bool, error)

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

func (*GuildGroupBy) BoolsX

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

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

func (*GuildGroupBy) Float64

func (ggb *GuildGroupBy) Float64(ctx context.Context) (_ float64, err error)

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

func (*GuildGroupBy) Float64X

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

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

func (*GuildGroupBy) Float64s

func (ggb *GuildGroupBy) Float64s(ctx context.Context) ([]float64, error)

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

func (*GuildGroupBy) Float64sX

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

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

func (*GuildGroupBy) Int

func (ggb *GuildGroupBy) Int(ctx context.Context) (_ int, err error)

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

func (*GuildGroupBy) IntX

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

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

func (*GuildGroupBy) Ints

func (ggb *GuildGroupBy) Ints(ctx context.Context) ([]int, error)

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

func (*GuildGroupBy) IntsX

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

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

func (*GuildGroupBy) Scan

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

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

func (*GuildGroupBy) ScanX

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

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

func (*GuildGroupBy) String

func (ggb *GuildGroupBy) String(ctx context.Context) (_ string, err error)

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

func (*GuildGroupBy) StringX

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

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

func (*GuildGroupBy) Strings

func (ggb *GuildGroupBy) Strings(ctx context.Context) ([]string, error)

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

func (*GuildGroupBy) StringsX

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

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

type GuildMutation

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

GuildMutation represents an operation that mutate the Guilds nodes in the graph.

func (*GuildMutation) AddField

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

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

func (*GuildMutation) AddedEdges

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

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

func (*GuildMutation) AddedField

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

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

func (*GuildMutation) AddedFields

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

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

func (*GuildMutation) AddedIDs

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

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

func (*GuildMutation) Categories

func (m *GuildMutation) Categories() (r []schema.Category, exists bool)

Categories returns the categories value in the mutation.

func (*GuildMutation) ClearEdge

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

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

func (*GuildMutation) ClearField

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

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

func (*GuildMutation) ClearedEdges

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

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

func (*GuildMutation) ClearedFields

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

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

func (GuildMutation) Client

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

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

CreateTime returns the create_time value in the mutation.

func (*GuildMutation) EdgeCleared

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

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

func (*GuildMutation) Entitlements

func (m *GuildMutation) Entitlements() (r []string, exists bool)

Entitlements returns the entitlements value in the mutation.

func (*GuildMutation) Field

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

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

func (*GuildMutation) FieldCleared

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

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

func (*GuildMutation) Fields

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

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

func (*GuildMutation) ID

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

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

func (*GuildMutation) Message

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

Message returns the message value in the mutation.

func (*GuildMutation) OldCategories

func (m *GuildMutation) OldCategories(ctx context.Context) (v []schema.Category, err error)

OldCategories returns the old categories value of the Guild. If the Guild object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or database query fails.

func (*GuildMutation) OldCreateTime

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

OldCreateTime returns the old create_time value of the Guild. If the Guild object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or database query fails.

func (*GuildMutation) OldEntitlements

func (m *GuildMutation) OldEntitlements(ctx context.Context) (v []string, err error)

OldEntitlements returns the old entitlements value of the Guild. If the Guild object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or database query fails.

func (*GuildMutation) OldField

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

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

func (*GuildMutation) OldMessage

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

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

func (*GuildMutation) OldSnowflake

func (m *GuildMutation) OldSnowflake(ctx context.Context) (v string, err error)

OldSnowflake returns the old snowflake value of the Guild. If the Guild object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or database query fails.

func (*GuildMutation) OldUpdateTime

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

OldUpdateTime returns the old update_time value of the Guild. If the Guild object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or database query fails.

func (*GuildMutation) Op

func (m *GuildMutation) Op() Op

Op returns the operation name.

func (*GuildMutation) RemovedEdges

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

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

func (*GuildMutation) RemovedIDs

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

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

func (*GuildMutation) ResetCategories

func (m *GuildMutation) ResetCategories()

ResetCategories reset all changes of the "categories" field.

func (*GuildMutation) ResetCreateTime

func (m *GuildMutation) ResetCreateTime()

ResetCreateTime reset all changes of the "create_time" field.

func (*GuildMutation) ResetEdge

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

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

func (*GuildMutation) ResetEntitlements

func (m *GuildMutation) ResetEntitlements()

ResetEntitlements reset all changes of the "entitlements" field.

func (*GuildMutation) ResetField

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

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

func (*GuildMutation) ResetMessage

func (m *GuildMutation) ResetMessage()

ResetMessage reset all changes of the "message" field.

func (*GuildMutation) ResetSnowflake

func (m *GuildMutation) ResetSnowflake()

ResetSnowflake reset all changes of the "snowflake" field.

func (*GuildMutation) ResetUpdateTime

func (m *GuildMutation) ResetUpdateTime()

ResetUpdateTime reset all changes of the "update_time" field.

func (*GuildMutation) SetCategories

func (m *GuildMutation) SetCategories(s []schema.Category)

SetCategories sets the categories field.

func (*GuildMutation) SetCreateTime

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

SetCreateTime sets the create_time field.

func (*GuildMutation) SetEntitlements

func (m *GuildMutation) SetEntitlements(s []string)

SetEntitlements sets the entitlements field.

func (*GuildMutation) SetField

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

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

func (*GuildMutation) SetMessage

func (m *GuildMutation) SetMessage(s string)

SetMessage sets the message field.

func (*GuildMutation) SetSnowflake

func (m *GuildMutation) SetSnowflake(s string)

SetSnowflake sets the snowflake field.

func (*GuildMutation) SetUpdateTime

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

SetUpdateTime sets the update_time field.

func (*GuildMutation) Snowflake

func (m *GuildMutation) Snowflake() (r string, exists bool)

Snowflake returns the snowflake value in the mutation.

func (GuildMutation) Tx

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

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

func (*GuildMutation) Type

func (m *GuildMutation) Type() string

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

func (*GuildMutation) UpdateTime

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

UpdateTime returns the update_time value in the mutation.

type GuildQuery

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

GuildQuery is the builder for querying Guild entities.

func (*GuildQuery) All

func (gq *GuildQuery) All(ctx context.Context) ([]*Guild, error)

All executes the query and returns a list of Guilds.

func (*GuildQuery) AllX

func (gq *GuildQuery) AllX(ctx context.Context) []*Guild

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

func (*GuildQuery) Clone

func (gq *GuildQuery) Clone() *GuildQuery

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

func (*GuildQuery) Count

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

Count returns the count of the given query.

func (*GuildQuery) CountX

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

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

func (*GuildQuery) Exist

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

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

func (*GuildQuery) ExistX

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

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

func (*GuildQuery) First

func (gq *GuildQuery) First(ctx context.Context) (*Guild, error)

First returns the first Guild entity in the query. Returns *NotFoundError when no guild was found.

func (*GuildQuery) FirstID

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

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

func (*GuildQuery) FirstX

func (gq *GuildQuery) FirstX(ctx context.Context) *Guild

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

func (*GuildQuery) FirstXID

func (gq *GuildQuery) FirstXID(ctx context.Context) int

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

func (*GuildQuery) GroupBy

func (gq *GuildQuery) GroupBy(field string, fields ...string) *GuildGroupBy

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

Example:

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

client.Guild.Query().
	GroupBy(guild.FieldCreateTime).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*GuildQuery) IDs

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

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

func (*GuildQuery) IDsX

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

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

func (*GuildQuery) Limit

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

Limit adds a limit step to the query.

func (*GuildQuery) Offset

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

Offset adds an offset step to the query.

func (*GuildQuery) Only

func (gq *GuildQuery) Only(ctx context.Context) (*Guild, error)

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

func (*GuildQuery) OnlyID

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

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

func (*GuildQuery) OnlyIDX

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

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

func (*GuildQuery) OnlyX

func (gq *GuildQuery) OnlyX(ctx context.Context) *Guild

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

func (*GuildQuery) Order

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

Order adds an order step to the query.

func (*GuildQuery) Select

func (gq *GuildQuery) Select(field string, fields ...string) *GuildSelect

Select one or more fields from the given query.

Example:

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

client.Guild.Query().
	Select(guild.FieldCreateTime).
	Scan(ctx, &v)

func (*GuildQuery) Where

func (gq *GuildQuery) Where(ps ...predicate.Guild) *GuildQuery

Where adds a new predicate for the builder.

type GuildSelect

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

GuildSelect is the builder for select fields of Guild entities.

func (*GuildSelect) Bool

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

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

func (*GuildSelect) BoolX

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

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

func (*GuildSelect) Bools

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

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

func (*GuildSelect) BoolsX

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

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

func (*GuildSelect) Float64

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

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

func (*GuildSelect) Float64X

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

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

func (*GuildSelect) Float64s

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

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

func (*GuildSelect) Float64sX

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

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

func (*GuildSelect) Int

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

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

func (*GuildSelect) IntX

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

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

func (*GuildSelect) Ints

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

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

func (*GuildSelect) IntsX

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

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

func (*GuildSelect) Scan

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

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

func (*GuildSelect) ScanX

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

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

func (*GuildSelect) String

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

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

func (*GuildSelect) StringX

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

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

func (*GuildSelect) Strings

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

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

func (*GuildSelect) StringsX

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

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

type GuildUpdate

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

GuildUpdate is the builder for updating Guild entities.

func (*GuildUpdate) Exec

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

Exec executes the query.

func (*GuildUpdate) ExecX

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

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

func (*GuildUpdate) Mutation

func (gu *GuildUpdate) Mutation() *GuildMutation

Mutation returns the GuildMutation object of the builder.

func (*GuildUpdate) Save

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

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

func (*GuildUpdate) SaveX

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

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

func (*GuildUpdate) SetCategories

func (gu *GuildUpdate) SetCategories(s []schema.Category) *GuildUpdate

SetCategories sets the categories field.

func (*GuildUpdate) SetEntitlements

func (gu *GuildUpdate) SetEntitlements(s []string) *GuildUpdate

SetEntitlements sets the entitlements field.

func (*GuildUpdate) SetMessage

func (gu *GuildUpdate) SetMessage(s string) *GuildUpdate

SetMessage sets the message field.

func (*GuildUpdate) Where

func (gu *GuildUpdate) Where(ps ...predicate.Guild) *GuildUpdate

Where adds a new predicate for the builder.

type GuildUpdateOne

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

GuildUpdateOne is the builder for updating a single Guild entity.

func (*GuildUpdateOne) Exec

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

Exec executes the query on the entity.

func (*GuildUpdateOne) ExecX

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

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

func (*GuildUpdateOne) Mutation

func (guo *GuildUpdateOne) Mutation() *GuildMutation

Mutation returns the GuildMutation object of the builder.

func (*GuildUpdateOne) Save

func (guo *GuildUpdateOne) Save(ctx context.Context) (*Guild, error)

Save executes the query and returns the updated entity.

func (*GuildUpdateOne) SaveX

func (guo *GuildUpdateOne) SaveX(ctx context.Context) *Guild

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

func (*GuildUpdateOne) SetCategories

func (guo *GuildUpdateOne) SetCategories(s []schema.Category) *GuildUpdateOne

SetCategories sets the categories field.

func (*GuildUpdateOne) SetEntitlements

func (guo *GuildUpdateOne) SetEntitlements(s []string) *GuildUpdateOne

SetEntitlements sets the entitlements field.

func (*GuildUpdateOne) SetMessage

func (guo *GuildUpdateOne) SetMessage(s string) *GuildUpdateOne

SetMessage sets the message field.

type Guilds

type Guilds []*Guild

Guilds is a parsable slice of Guild.

type Hook

type Hook = ent.Hook

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

type MutateFunc

type MutateFunc = ent.MutateFunc

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

type Mutation

type Mutation = ent.Mutation

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

type Mutator

type Mutator = ent.Mutator

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

type NotFoundError

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

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

func (*NotFoundError) Error

func (e *NotFoundError) Error() string

Error implements the error interface.

type NotLoadedError

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

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

func (*NotLoadedError) Error

func (e *NotLoadedError) Error() string

Error implements the error interface.

type NotSingularError

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

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

func (*NotSingularError) Error

func (e *NotSingularError) Error() string

Error implements the error interface.

type Op

type Op = ent.Op

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

type Option

type Option func(*config)

Option function to configure the client.

func Debug

func Debug() Option

Debug enables debug logging on the ent.Driver.

func Driver

func Driver(driver dialect.Driver) Option

Driver configures the client driver.

func Log

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

Log sets the logging function for debug mode.

type OrderFunc

type OrderFunc func(*sql.Selector)

OrderFunc applies an ordering on either graph traversal or sql selector.

func Asc

func Asc(fields ...string) OrderFunc

Asc applies the given fields in ASC order.

func Desc

func Desc(fields ...string) OrderFunc

Desc applies the given fields in DESC order.

type Policy

type Policy = ent.Policy

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

type Query

type Query = ent.Query

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

type RollbackFunc

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

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

func (RollbackFunc) Rollback

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

Rollback calls f(ctx, m).

type RollbackHook

type RollbackHook func(Rollbacker) Rollbacker

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

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

type Rollbacker

type Rollbacker interface {
	Rollback(context.Context, *Tx) error
}

Rollbacker is the interface that wraps the Rollbacker method.

type Session

type Session struct {

	// ID of the ent.
	ID int `json:"id,omitempty"`
	// CreateTime holds the value of the "create_time" field.
	CreateTime time.Time `json:"create_time,omitempty"`
	// UpdateTime holds the value of the "update_time" field.
	UpdateTime time.Time `json:"update_time,omitempty"`
	// SessionID holds the value of the "session_id" field.
	SessionID string `json:"session_id,omitempty"`
	// UserID holds the value of the "user_id" field.
	UserID string `json:"user_id,omitempty"`
	// Source holds the value of the "source" field.
	Source session.Source `json:"source,omitempty"`
	// ExpiresAt holds the value of the "expires_at" field.
	ExpiresAt time.Time `json:"expires_at,omitempty"`
	// contains filtered or unexported fields
}

Session is the model entity for the Session schema.

func (*Session) String

func (s *Session) String() string

String implements the fmt.Stringer.

func (*Session) Unwrap

func (s *Session) Unwrap() *Session

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

func (*Session) Update

func (s *Session) Update() *SessionUpdateOne

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

type SessionClient

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

SessionClient is a client for the Session schema.

func NewSessionClient

func NewSessionClient(c config) *SessionClient

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

func (*SessionClient) Create

func (c *SessionClient) Create() *SessionCreate

Create returns a create builder for Session.

func (*SessionClient) CreateBulk

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

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

func (*SessionClient) Delete

func (c *SessionClient) Delete() *SessionDelete

Delete returns a delete builder for Session.

func (*SessionClient) DeleteOne

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

DeleteOne returns a delete builder for the given entity.

func (*SessionClient) DeleteOneID

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

DeleteOneID returns a delete builder for the given id.

func (*SessionClient) Get

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

Get returns a Session entity by its id.

func (*SessionClient) GetX

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

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

func (*SessionClient) Hooks

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

Hooks returns the client hooks.

func (*SessionClient) Query

func (c *SessionClient) Query() *SessionQuery

Query returns a query builder for Session.

func (*SessionClient) Update

func (c *SessionClient) Update() *SessionUpdate

Update returns an update builder for Session.

func (*SessionClient) UpdateOne

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

UpdateOne returns an update builder for the given entity.

func (*SessionClient) UpdateOneID

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

UpdateOneID returns an update builder for the given id.

func (*SessionClient) Use

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

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

type SessionCreate

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

SessionCreate is the builder for creating a Session entity.

func (*SessionCreate) Mutation

func (sc *SessionCreate) Mutation() *SessionMutation

Mutation returns the SessionMutation object of the builder.

func (*SessionCreate) Save

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

Save creates the Session in the database.

func (*SessionCreate) SaveX

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

SaveX calls Save and panics if Save returns an error.

func (*SessionCreate) SetCreateTime

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

SetCreateTime sets the create_time field.

func (*SessionCreate) SetExpiresAt

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

SetExpiresAt sets the expires_at field.

func (*SessionCreate) SetNillableCreateTime

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

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

func (*SessionCreate) SetNillableExpiresAt

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

SetNillableExpiresAt sets the expires_at field if the given value is not nil.

func (*SessionCreate) SetNillableUpdateTime

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

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

func (*SessionCreate) SetSessionID

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

SetSessionID sets the session_id field.

func (*SessionCreate) SetSource

func (sc *SessionCreate) SetSource(s session.Source) *SessionCreate

SetSource sets the source field.

func (*SessionCreate) SetUpdateTime

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

SetUpdateTime sets the update_time field.

func (*SessionCreate) SetUserID

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

SetUserID sets the user_id field.

type SessionCreateBulk

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

SessionCreateBulk is the builder for creating a bulk of Session entities.

func (*SessionCreateBulk) Save

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

Save creates the Session entities in the database.

func (*SessionCreateBulk) SaveX

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

SaveX calls Save and panics if Save returns an error.

type SessionDelete

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

SessionDelete is the builder for deleting a Session entity.

func (*SessionDelete) Exec

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

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

func (*SessionDelete) ExecX

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

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

func (*SessionDelete) Where

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

Where adds a new predicate to the delete builder.

type SessionDeleteOne

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

SessionDeleteOne is the builder for deleting a single Session entity.

func (*SessionDeleteOne) Exec

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

Exec executes the deletion query.

func (*SessionDeleteOne) ExecX

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

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

type SessionGroupBy

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

SessionGroupBy is the builder for group-by Session entities.

func (*SessionGroupBy) Aggregate

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

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

func (*SessionGroupBy) Bool

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

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

func (*SessionGroupBy) BoolX

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

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

func (*SessionGroupBy) Bools

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

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

func (*SessionGroupBy) BoolsX

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

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

func (*SessionGroupBy) Float64

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

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

func (*SessionGroupBy) Float64X

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

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

func (*SessionGroupBy) Float64s

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

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

func (*SessionGroupBy) Float64sX

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

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

func (*SessionGroupBy) Int

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

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

func (*SessionGroupBy) IntX

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

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

func (*SessionGroupBy) Ints

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

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

func (*SessionGroupBy) IntsX

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

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

func (*SessionGroupBy) Scan

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

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

func (*SessionGroupBy) ScanX

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

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

func (*SessionGroupBy) String

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

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

func (*SessionGroupBy) StringX

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

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

func (*SessionGroupBy) Strings

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

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

func (*SessionGroupBy) StringsX

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

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

type SessionMutation

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

SessionMutation represents an operation that mutate the Sessions nodes in the graph.

func (*SessionMutation) AddField

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

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

func (*SessionMutation) AddedEdges

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

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

func (*SessionMutation) AddedField

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

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

func (*SessionMutation) AddedFields

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

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

func (*SessionMutation) AddedIDs

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

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

func (*SessionMutation) ClearEdge

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

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

func (*SessionMutation) ClearField

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

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

func (*SessionMutation) ClearedEdges

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

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

func (*SessionMutation) ClearedFields

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

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

func (SessionMutation) Client

func (m SessionMutation) Client() *Client

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

func (*SessionMutation) CreateTime

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

CreateTime returns the create_time value in the mutation.

func (*SessionMutation) EdgeCleared

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

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

func (*SessionMutation) ExpiresAt

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

ExpiresAt returns the expires_at value in the mutation.

func (*SessionMutation) Field

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

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

func (*SessionMutation) FieldCleared

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

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

func (*SessionMutation) Fields

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

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

func (*SessionMutation) ID

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

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

func (*SessionMutation) OldCreateTime

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

OldCreateTime returns the old create_time value of the Session. If the Session object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or database query fails.

func (*SessionMutation) OldExpiresAt

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

OldExpiresAt returns the old expires_at value of the Session. If the Session object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or database query fails.

func (*SessionMutation) OldField

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

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

func (*SessionMutation) OldSessionID

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

OldSessionID returns the old session_id value of the Session. If the Session object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or database query fails.

func (*SessionMutation) OldSource

func (m *SessionMutation) OldSource(ctx context.Context) (v session.Source, err error)

OldSource returns the old source value of the Session. If the Session object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or database query fails.

func (*SessionMutation) OldUpdateTime

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

OldUpdateTime returns the old update_time value of the Session. If the Session object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or database query fails.

func (*SessionMutation) OldUserID

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

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

func (*SessionMutation) Op

func (m *SessionMutation) Op() Op

Op returns the operation name.

func (*SessionMutation) RemovedEdges

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

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

func (*SessionMutation) RemovedIDs

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

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

func (*SessionMutation) ResetCreateTime

func (m *SessionMutation) ResetCreateTime()

ResetCreateTime reset all changes of the "create_time" field.

func (*SessionMutation) ResetEdge

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

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

func (*SessionMutation) ResetExpiresAt

func (m *SessionMutation) ResetExpiresAt()

ResetExpiresAt reset all changes of the "expires_at" field.

func (*SessionMutation) ResetField

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

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

func (*SessionMutation) ResetSessionID

func (m *SessionMutation) ResetSessionID()

ResetSessionID reset all changes of the "session_id" field.

func (*SessionMutation) ResetSource

func (m *SessionMutation) ResetSource()

ResetSource reset all changes of the "source" field.

func (*SessionMutation) ResetUpdateTime

func (m *SessionMutation) ResetUpdateTime()

ResetUpdateTime reset all changes of the "update_time" field.

func (*SessionMutation) ResetUserID

func (m *SessionMutation) ResetUserID()

ResetUserID reset all changes of the "user_id" field.

func (*SessionMutation) SessionID

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

SessionID returns the session_id value in the mutation.

func (*SessionMutation) SetCreateTime

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

SetCreateTime sets the create_time field.

func (*SessionMutation) SetExpiresAt

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

SetExpiresAt sets the expires_at field.

func (*SessionMutation) SetField

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

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

func (*SessionMutation) SetSessionID

func (m *SessionMutation) SetSessionID(s string)

SetSessionID sets the session_id field.

func (*SessionMutation) SetSource

func (m *SessionMutation) SetSource(s session.Source)

SetSource sets the source field.

func (*SessionMutation) SetUpdateTime

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

SetUpdateTime sets the update_time field.

func (*SessionMutation) SetUserID

func (m *SessionMutation) SetUserID(s string)

SetUserID sets the user_id field.

func (*SessionMutation) Source

func (m *SessionMutation) Source() (r session.Source, exists bool)

Source returns the source value in the mutation.

func (SessionMutation) Tx

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

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

func (*SessionMutation) Type

func (m *SessionMutation) Type() string

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

func (*SessionMutation) UpdateTime

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

UpdateTime returns the update_time value in the mutation.

func (*SessionMutation) UserID

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

UserID returns the user_id value in the mutation.

type SessionQuery

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

SessionQuery is the builder for querying Session entities.

func (*SessionQuery) All

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

All executes the query and returns a list of Sessions.

func (*SessionQuery) AllX

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

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

func (*SessionQuery) Clone

func (sq *SessionQuery) Clone() *SessionQuery

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

func (*SessionQuery) Count

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

Count returns the count of the given query.

func (*SessionQuery) CountX

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

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

func (*SessionQuery) Exist

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

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

func (*SessionQuery) ExistX

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

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

func (*SessionQuery) First

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

First returns the first Session entity in the query. Returns *NotFoundError when no session was found.

func (*SessionQuery) FirstID

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

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

func (*SessionQuery) FirstX

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

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

func (*SessionQuery) FirstXID

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

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

func (*SessionQuery) GroupBy

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

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

Example:

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

client.Session.Query().
	GroupBy(session.FieldCreateTime).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*SessionQuery) IDs

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

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

func (*SessionQuery) IDsX

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

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

func (*SessionQuery) Limit

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

Limit adds a limit step to the query.

func (*SessionQuery) Offset

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

Offset adds an offset step to the query.

func (*SessionQuery) Only

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

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

func (*SessionQuery) OnlyID

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

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

func (*SessionQuery) OnlyIDX

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

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

func (*SessionQuery) OnlyX

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

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

func (*SessionQuery) Order

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

Order adds an order step to the query.

func (*SessionQuery) Select

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

Select one or more fields from the given query.

Example:

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

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

func (*SessionQuery) Where

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

Where adds a new predicate for the builder.

type SessionSelect

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

SessionSelect is the builder for select fields of Session entities.

func (*SessionSelect) Bool

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

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

func (*SessionSelect) BoolX

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

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

func (*SessionSelect) Bools

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

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

func (*SessionSelect) BoolsX

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

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

func (*SessionSelect) Float64

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

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

func (*SessionSelect) Float64X

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

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

func (*SessionSelect) Float64s

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

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

func (*SessionSelect) Float64sX

func (ss *SessionSelect) Float64sX(ctx context.Context) []float64

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

func (*SessionSelect) Int

func (ss *SessionSelect) Int(ctx context.Context) (_ int, err error)

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

func (*SessionSelect) IntX

func (ss *SessionSelect) IntX(ctx context.Context) int

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

func (*SessionSelect) Ints

func (ss *SessionSelect) Ints(ctx context.Context) ([]int, error)

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

func (*SessionSelect) IntsX

func (ss *SessionSelect) IntsX(ctx context.Context) []int

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

func (*SessionSelect) Scan

func (ss *SessionSelect) Scan(ctx context.Context, v interface{}) error

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

func (*SessionSelect) ScanX

func (ss *SessionSelect) ScanX(ctx context.Context, v interface{})

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

func (*SessionSelect) String

func (ss *SessionSelect) String(ctx context.Context) (_ string, err error)

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

func (*SessionSelect) StringX

func (ss *SessionSelect) StringX(ctx context.Context) string

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

func (*SessionSelect) Strings

func (ss *SessionSelect) Strings(ctx context.Context) ([]string, error)

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

func (*SessionSelect) StringsX

func (ss *SessionSelect) StringsX(ctx context.Context) []string

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

type SessionUpdate

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

SessionUpdate is the builder for updating Session entities.

func (*SessionUpdate) Exec

func (su *SessionUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*SessionUpdate) ExecX

func (su *SessionUpdate) ExecX(ctx context.Context)

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

func (*SessionUpdate) Mutation

func (su *SessionUpdate) Mutation() *SessionMutation

Mutation returns the SessionMutation object of the builder.

func (*SessionUpdate) Save

func (su *SessionUpdate) Save(ctx context.Context) (int, error)

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

func (*SessionUpdate) SaveX

func (su *SessionUpdate) SaveX(ctx context.Context) int

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

func (*SessionUpdate) Where

func (su *SessionUpdate) Where(ps ...predicate.Session) *SessionUpdate

Where adds a new predicate for the builder.

type SessionUpdateOne

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

SessionUpdateOne is the builder for updating a single Session entity.

func (*SessionUpdateOne) Exec

func (suo *SessionUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*SessionUpdateOne) ExecX

func (suo *SessionUpdateOne) ExecX(ctx context.Context)

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

func (*SessionUpdateOne) Mutation

func (suo *SessionUpdateOne) Mutation() *SessionMutation

Mutation returns the SessionMutation object of the builder.

func (*SessionUpdateOne) Save

func (suo *SessionUpdateOne) Save(ctx context.Context) (*Session, error)

Save executes the query and returns the updated entity.

func (*SessionUpdateOne) SaveX

func (suo *SessionUpdateOne) SaveX(ctx context.Context) *Session

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

type Sessions

type Sessions []*Session

Sessions is a parsable slice of Session.

type Tx

type Tx struct {

	// Challenge is the client for interacting with the Challenge builders.
	Challenge *ChallengeClient
	// Guild is the client for interacting with the Guild builders.
	Guild *GuildClient
	// Session is the client for interacting with the Session builders.
	Session *SessionClient
	// contains filtered or unexported fields
}

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

func TxFromContext

func TxFromContext(ctx context.Context) *Tx

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

func (*Tx) Client

func (tx *Tx) Client() *Client

Client returns a Client that binds to current transaction.

func (*Tx) Commit

func (tx *Tx) Commit() error

Commit commits the transaction.

func (*Tx) OnCommit

func (tx *Tx) OnCommit(f CommitHook)

OnCommit adds a hook to call on commit.

func (*Tx) OnRollback

func (tx *Tx) OnRollback(f RollbackHook)

OnRollback adds a hook to call on rollback.

func (*Tx) Rollback

func (tx *Tx) Rollback() error

Rollback rollbacks the transaction.

type ValidationError

type ValidationError struct {
	Name string // Field or edge name.
	// contains filtered or unexported fields
}

ValidationError returns when validating a field fails.

func (*ValidationError) Error

func (e *ValidationError) Error() string

Error implements the error interface.

func (*ValidationError) Unwrap

func (e *ValidationError) Unwrap() error

Unwrap implements the errors.Wrapper interface.

type Value

type Value = ent.Value

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL