ent

package
v0.1.5 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2022 License: AGPL-3.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

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

	// Node types.
	TypeBadge       = "Badge"
	TypeChallenge   = "Challenge"
	TypePrediction  = "Prediction"
	TypeProof       = "Proof"
	TypeUser        = "User"
	TypeUserSession = "UserSession"
)

Variables

This section is empty.

Functions

func IsConstraintError

func IsConstraintError(err error) bool

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

func IsNotFound

func IsNotFound(err error) bool

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

func IsNotLoaded

func IsNotLoaded(err error) bool

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

func IsNotSingular

func IsNotSingular(err error) bool

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

func IsValidationError

func IsValidationError(err error) bool

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

func MaskNotFound

func MaskNotFound(err error) error

MaskNotFound masks not found error.

func NewContext

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

NewContext returns a new context with the given Client attached.

func NewTxContext

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

NewTxContext returns a new context with the given Tx attached.

Types

type AggregateFunc

type AggregateFunc func(*sql.Selector) string

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

func As

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

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

func Count

func Count() AggregateFunc

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

func Max

func Max(field string) AggregateFunc

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

func Mean

func Mean(field string) AggregateFunc

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

func Min

func Min(field string) AggregateFunc

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

func Sum

func Sum(field string) AggregateFunc

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

type Badge

type Badge 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"`
	// Type holds the value of the "type" field.
	Type string `json:"type,omitempty"`
	// Active holds the value of the "active" field.
	Active bool `json:"active,omitempty"`
	// Meta holds the value of the "meta" field.
	Meta map[string]interface{} `json:"meta,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the BadgeQuery when eager-loading is set.
	Edges BadgeEdges `json:"edges"`
	// contains filtered or unexported fields
}

Badge is the model entity for the Badge schema.

func (*Badge) QueryUsers

func (b *Badge) QueryUsers() *UserQuery

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

func (*Badge) String

func (b *Badge) String() string

String implements the fmt.Stringer.

func (*Badge) Unwrap

func (b *Badge) Unwrap() *Badge

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

func (*Badge) Update

func (b *Badge) Update() *BadgeUpdateOne

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

type BadgeClient

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

BadgeClient is a client for the Badge schema.

func NewBadgeClient

func NewBadgeClient(c config) *BadgeClient

NewBadgeClient returns a client for the Badge from the given config.

func (*BadgeClient) Create

func (c *BadgeClient) Create() *BadgeCreate

Create returns a create builder for Badge.

func (*BadgeClient) CreateBulk

func (c *BadgeClient) CreateBulk(builders ...*BadgeCreate) *BadgeCreateBulk

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

func (*BadgeClient) Delete

func (c *BadgeClient) Delete() *BadgeDelete

Delete returns a delete builder for Badge.

func (*BadgeClient) DeleteOne

func (c *BadgeClient) DeleteOne(b *Badge) *BadgeDeleteOne

DeleteOne returns a delete builder for the given entity.

func (*BadgeClient) DeleteOneID

func (c *BadgeClient) DeleteOneID(id int) *BadgeDeleteOne

DeleteOneID returns a delete builder for the given id.

func (*BadgeClient) Get

func (c *BadgeClient) Get(ctx context.Context, id int) (*Badge, error)

Get returns a Badge entity by its id.

func (*BadgeClient) GetX

func (c *BadgeClient) GetX(ctx context.Context, id int) *Badge

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

func (*BadgeClient) Hooks

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

Hooks returns the client hooks.

func (*BadgeClient) Query

func (c *BadgeClient) Query() *BadgeQuery

Query returns a query builder for Badge.

func (*BadgeClient) QueryUsers

func (c *BadgeClient) QueryUsers(b *Badge) *UserQuery

QueryUsers queries the users edge of a Badge.

func (*BadgeClient) Update

func (c *BadgeClient) Update() *BadgeUpdate

Update returns an update builder for Badge.

func (*BadgeClient) UpdateOne

func (c *BadgeClient) UpdateOne(b *Badge) *BadgeUpdateOne

UpdateOne returns an update builder for the given entity.

func (*BadgeClient) UpdateOneID

func (c *BadgeClient) UpdateOneID(id int) *BadgeUpdateOne

UpdateOneID returns an update builder for the given id.

func (*BadgeClient) Use

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

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

type BadgeCreate

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

BadgeCreate is the builder for creating a Badge entity.

func (*BadgeCreate) AddUserIDs

func (bc *BadgeCreate) AddUserIDs(ids ...uuid.UUID) *BadgeCreate

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

func (*BadgeCreate) AddUsers

func (bc *BadgeCreate) AddUsers(u ...*User) *BadgeCreate

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

func (*BadgeCreate) Exec

func (bc *BadgeCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*BadgeCreate) ExecX

func (bc *BadgeCreate) ExecX(ctx context.Context)

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

func (*BadgeCreate) Mutation

func (bc *BadgeCreate) Mutation() *BadgeMutation

Mutation returns the BadgeMutation object of the builder.

func (*BadgeCreate) Save

func (bc *BadgeCreate) Save(ctx context.Context) (*Badge, error)

Save creates the Badge in the database.

func (*BadgeCreate) SaveX

func (bc *BadgeCreate) SaveX(ctx context.Context) *Badge

SaveX calls Save and panics if Save returns an error.

func (*BadgeCreate) SetActive

func (bc *BadgeCreate) SetActive(b bool) *BadgeCreate

SetActive sets the "active" field.

func (*BadgeCreate) SetCreateTime

func (bc *BadgeCreate) SetCreateTime(t time.Time) *BadgeCreate

SetCreateTime sets the "create_time" field.

func (*BadgeCreate) SetMeta

func (bc *BadgeCreate) SetMeta(m map[string]interface{}) *BadgeCreate

SetMeta sets the "meta" field.

func (*BadgeCreate) SetNillableActive

func (bc *BadgeCreate) SetNillableActive(b *bool) *BadgeCreate

SetNillableActive sets the "active" field if the given value is not nil.

func (*BadgeCreate) SetNillableCreateTime

func (bc *BadgeCreate) SetNillableCreateTime(t *time.Time) *BadgeCreate

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

func (*BadgeCreate) SetNillableUpdateTime

func (bc *BadgeCreate) SetNillableUpdateTime(t *time.Time) *BadgeCreate

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

func (*BadgeCreate) SetType

func (bc *BadgeCreate) SetType(s string) *BadgeCreate

SetType sets the "type" field.

func (*BadgeCreate) SetUpdateTime

func (bc *BadgeCreate) SetUpdateTime(t time.Time) *BadgeCreate

SetUpdateTime sets the "update_time" field.

type BadgeCreateBulk

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

BadgeCreateBulk is the builder for creating many Badge entities in bulk.

func (*BadgeCreateBulk) Exec

func (bcb *BadgeCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*BadgeCreateBulk) ExecX

func (bcb *BadgeCreateBulk) ExecX(ctx context.Context)

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

func (*BadgeCreateBulk) Save

func (bcb *BadgeCreateBulk) Save(ctx context.Context) ([]*Badge, error)

Save creates the Badge entities in the database.

func (*BadgeCreateBulk) SaveX

func (bcb *BadgeCreateBulk) SaveX(ctx context.Context) []*Badge

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

type BadgeDelete

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

BadgeDelete is the builder for deleting a Badge entity.

func (*BadgeDelete) Exec

func (bd *BadgeDelete) Exec(ctx context.Context) (int, error)

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

func (*BadgeDelete) ExecX

func (bd *BadgeDelete) ExecX(ctx context.Context) int

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

func (*BadgeDelete) Where

func (bd *BadgeDelete) Where(ps ...predicate.Badge) *BadgeDelete

Where appends a list predicates to the BadgeDelete builder.

type BadgeDeleteOne

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

BadgeDeleteOne is the builder for deleting a single Badge entity.

func (*BadgeDeleteOne) Exec

func (bdo *BadgeDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*BadgeDeleteOne) ExecX

func (bdo *BadgeDeleteOne) ExecX(ctx context.Context)

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

type BadgeEdges

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

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

func (BadgeEdges) UsersOrErr

func (e BadgeEdges) UsersOrErr() ([]*User, error)

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

type BadgeGroupBy

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

BadgeGroupBy is the group-by builder for Badge entities.

func (*BadgeGroupBy) Aggregate

func (bgb *BadgeGroupBy) Aggregate(fns ...AggregateFunc) *BadgeGroupBy

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

func (*BadgeGroupBy) Bool

func (bgb *BadgeGroupBy) Bool(ctx context.Context) (_ bool, err error)

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

func (*BadgeGroupBy) BoolX

func (bgb *BadgeGroupBy) BoolX(ctx context.Context) bool

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

func (*BadgeGroupBy) Bools

func (bgb *BadgeGroupBy) Bools(ctx context.Context) ([]bool, error)

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

func (*BadgeGroupBy) BoolsX

func (bgb *BadgeGroupBy) BoolsX(ctx context.Context) []bool

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

func (*BadgeGroupBy) Float64

func (bgb *BadgeGroupBy) Float64(ctx context.Context) (_ float64, err error)

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

func (*BadgeGroupBy) Float64X

func (bgb *BadgeGroupBy) Float64X(ctx context.Context) float64

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

func (*BadgeGroupBy) Float64s

func (bgb *BadgeGroupBy) Float64s(ctx context.Context) ([]float64, error)

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

func (*BadgeGroupBy) Float64sX

func (bgb *BadgeGroupBy) Float64sX(ctx context.Context) []float64

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

func (*BadgeGroupBy) Int

func (bgb *BadgeGroupBy) Int(ctx context.Context) (_ int, err error)

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

func (*BadgeGroupBy) IntX

func (bgb *BadgeGroupBy) IntX(ctx context.Context) int

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

func (*BadgeGroupBy) Ints

func (bgb *BadgeGroupBy) Ints(ctx context.Context) ([]int, error)

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

func (*BadgeGroupBy) IntsX

func (bgb *BadgeGroupBy) IntsX(ctx context.Context) []int

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

func (*BadgeGroupBy) Scan

func (bgb *BadgeGroupBy) Scan(ctx context.Context, v interface{}) error

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

func (*BadgeGroupBy) ScanX

func (bgb *BadgeGroupBy) ScanX(ctx context.Context, v interface{})

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

func (*BadgeGroupBy) String

func (bgb *BadgeGroupBy) String(ctx context.Context) (_ string, err error)

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

func (*BadgeGroupBy) StringX

func (bgb *BadgeGroupBy) StringX(ctx context.Context) string

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

func (*BadgeGroupBy) Strings

func (bgb *BadgeGroupBy) Strings(ctx context.Context) ([]string, error)

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

func (*BadgeGroupBy) StringsX

func (bgb *BadgeGroupBy) StringsX(ctx context.Context) []string

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

type BadgeMutation

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

BadgeMutation represents an operation that mutates the Badge nodes in the graph.

func (*BadgeMutation) Active

func (m *BadgeMutation) Active() (r bool, exists bool)

Active returns the value of the "active" field in the mutation.

func (*BadgeMutation) AddField

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

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

func (*BadgeMutation) AddUserIDs

func (m *BadgeMutation) AddUserIDs(ids ...uuid.UUID)

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

func (*BadgeMutation) AddedEdges

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

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

func (*BadgeMutation) AddedField

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

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

func (*BadgeMutation) AddedFields

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

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

func (*BadgeMutation) AddedIDs

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

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

func (*BadgeMutation) ClearEdge

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

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

func (*BadgeMutation) ClearField

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

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

func (*BadgeMutation) ClearMeta

func (m *BadgeMutation) ClearMeta()

ClearMeta clears the value of the "meta" field.

func (*BadgeMutation) ClearUsers

func (m *BadgeMutation) ClearUsers()

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

func (*BadgeMutation) ClearedEdges

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

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

func (*BadgeMutation) ClearedFields

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

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

func (BadgeMutation) Client

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

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

CreateTime returns the value of the "create_time" field in the mutation.

func (*BadgeMutation) EdgeCleared

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

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

func (*BadgeMutation) Field

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

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

func (*BadgeMutation) FieldCleared

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

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

func (*BadgeMutation) Fields

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

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

func (*BadgeMutation) GetType

func (m *BadgeMutation) GetType() (r string, exists bool)

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

func (*BadgeMutation) ID

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

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

func (*BadgeMutation) IDs

func (m *BadgeMutation) IDs(ctx context.Context) ([]int, error)

IDs queries the database and returns the entity ids that match the mutation's predicate. That means, if the mutation is applied within a transaction with an isolation level such as sql.LevelSerializable, the returned ids match the ids of the rows that will be updated or updated by the mutation.

func (*BadgeMutation) Meta

func (m *BadgeMutation) Meta() (r map[string]interface{}, exists bool)

Meta returns the value of the "meta" field in the mutation.

func (*BadgeMutation) MetaCleared

func (m *BadgeMutation) MetaCleared() bool

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

func (*BadgeMutation) OldActive

func (m *BadgeMutation) OldActive(ctx context.Context) (v bool, err error)

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

func (*BadgeMutation) OldCreateTime

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

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

func (*BadgeMutation) OldField

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

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

func (*BadgeMutation) OldMeta

func (m *BadgeMutation) OldMeta(ctx context.Context) (v map[string]interface{}, err error)

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

func (*BadgeMutation) OldType

func (m *BadgeMutation) OldType(ctx context.Context) (v string, err error)

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

func (*BadgeMutation) OldUpdateTime

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

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

func (*BadgeMutation) Op

func (m *BadgeMutation) Op() Op

Op returns the operation name.

func (*BadgeMutation) RemoveUserIDs

func (m *BadgeMutation) RemoveUserIDs(ids ...uuid.UUID)

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

func (*BadgeMutation) RemovedEdges

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

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

func (*BadgeMutation) RemovedIDs

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

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

func (*BadgeMutation) RemovedUsersIDs

func (m *BadgeMutation) RemovedUsersIDs() (ids []uuid.UUID)

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

func (*BadgeMutation) ResetActive

func (m *BadgeMutation) ResetActive()

ResetActive resets all changes to the "active" field.

func (*BadgeMutation) ResetCreateTime

func (m *BadgeMutation) ResetCreateTime()

ResetCreateTime resets all changes to the "create_time" field.

func (*BadgeMutation) ResetEdge

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

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

func (*BadgeMutation) ResetField

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

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

func (*BadgeMutation) ResetMeta

func (m *BadgeMutation) ResetMeta()

ResetMeta resets all changes to the "meta" field.

func (*BadgeMutation) ResetType

func (m *BadgeMutation) ResetType()

ResetType resets all changes to the "type" field.

func (*BadgeMutation) ResetUpdateTime

func (m *BadgeMutation) ResetUpdateTime()

ResetUpdateTime resets all changes to the "update_time" field.

func (*BadgeMutation) ResetUsers

func (m *BadgeMutation) ResetUsers()

ResetUsers resets all changes to the "users" edge.

func (*BadgeMutation) SetActive

func (m *BadgeMutation) SetActive(b bool)

SetActive sets the "active" field.

func (*BadgeMutation) SetCreateTime

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

SetCreateTime sets the "create_time" field.

func (*BadgeMutation) SetField

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

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

func (*BadgeMutation) SetMeta

func (m *BadgeMutation) SetMeta(value map[string]interface{})

SetMeta sets the "meta" field.

func (*BadgeMutation) SetType

func (m *BadgeMutation) SetType(s string)

SetType sets the "type" field.

func (*BadgeMutation) SetUpdateTime

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

SetUpdateTime sets the "update_time" field.

func (BadgeMutation) Tx

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

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

func (*BadgeMutation) Type

func (m *BadgeMutation) Type() string

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

func (*BadgeMutation) UpdateTime

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

UpdateTime returns the value of the "update_time" field in the mutation.

func (*BadgeMutation) UsersCleared

func (m *BadgeMutation) UsersCleared() bool

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

func (*BadgeMutation) UsersIDs

func (m *BadgeMutation) UsersIDs() (ids []uuid.UUID)

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

func (*BadgeMutation) Where

func (m *BadgeMutation) Where(ps ...predicate.Badge)

Where appends a list predicates to the BadgeMutation builder.

type BadgeQuery

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

BadgeQuery is the builder for querying Badge entities.

func (*BadgeQuery) All

func (bq *BadgeQuery) All(ctx context.Context) ([]*Badge, error)

All executes the query and returns a list of Badges.

func (*BadgeQuery) AllX

func (bq *BadgeQuery) AllX(ctx context.Context) []*Badge

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

func (*BadgeQuery) Clone

func (bq *BadgeQuery) Clone() *BadgeQuery

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

func (*BadgeQuery) Count

func (bq *BadgeQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*BadgeQuery) CountX

func (bq *BadgeQuery) CountX(ctx context.Context) int

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

func (*BadgeQuery) Exist

func (bq *BadgeQuery) Exist(ctx context.Context) (bool, error)

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

func (*BadgeQuery) ExistX

func (bq *BadgeQuery) ExistX(ctx context.Context) bool

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

func (*BadgeQuery) First

func (bq *BadgeQuery) First(ctx context.Context) (*Badge, error)

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

func (*BadgeQuery) FirstID

func (bq *BadgeQuery) FirstID(ctx context.Context) (id int, err error)

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

func (*BadgeQuery) FirstIDX

func (bq *BadgeQuery) FirstIDX(ctx context.Context) int

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

func (*BadgeQuery) FirstX

func (bq *BadgeQuery) FirstX(ctx context.Context) *Badge

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

func (*BadgeQuery) GroupBy

func (bq *BadgeQuery) GroupBy(field string, fields ...string) *BadgeGroupBy

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

Example:

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

client.Badge.Query().
	GroupBy(badge.FieldCreateTime).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*BadgeQuery) IDs

func (bq *BadgeQuery) IDs(ctx context.Context) ([]int, error)

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

func (*BadgeQuery) IDsX

func (bq *BadgeQuery) IDsX(ctx context.Context) []int

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

func (*BadgeQuery) Limit

func (bq *BadgeQuery) Limit(limit int) *BadgeQuery

Limit adds a limit step to the query.

func (*BadgeQuery) Offset

func (bq *BadgeQuery) Offset(offset int) *BadgeQuery

Offset adds an offset step to the query.

func (*BadgeQuery) Only

func (bq *BadgeQuery) Only(ctx context.Context) (*Badge, error)

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

func (*BadgeQuery) OnlyID

func (bq *BadgeQuery) OnlyID(ctx context.Context) (id int, err error)

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

func (*BadgeQuery) OnlyIDX

func (bq *BadgeQuery) OnlyIDX(ctx context.Context) int

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

func (*BadgeQuery) OnlyX

func (bq *BadgeQuery) OnlyX(ctx context.Context) *Badge

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

func (*BadgeQuery) Order

func (bq *BadgeQuery) Order(o ...OrderFunc) *BadgeQuery

Order adds an order step to the query.

func (*BadgeQuery) QueryUsers

func (bq *BadgeQuery) QueryUsers() *UserQuery

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

func (*BadgeQuery) Select

func (bq *BadgeQuery) Select(fields ...string) *BadgeSelect

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

Example:

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

client.Badge.Query().
	Select(badge.FieldCreateTime).
	Scan(ctx, &v)

func (*BadgeQuery) Unique

func (bq *BadgeQuery) Unique(unique bool) *BadgeQuery

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

func (*BadgeQuery) Where

func (bq *BadgeQuery) Where(ps ...predicate.Badge) *BadgeQuery

Where adds a new predicate for the BadgeQuery builder.

func (*BadgeQuery) WithUsers

func (bq *BadgeQuery) WithUsers(opts ...func(*UserQuery)) *BadgeQuery

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

type BadgeSelect

type BadgeSelect struct {
	*BadgeQuery
	// contains filtered or unexported fields
}

BadgeSelect is the builder for selecting fields of Badge entities.

func (*BadgeSelect) Bool

func (bs *BadgeSelect) Bool(ctx context.Context) (_ bool, err error)

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

func (*BadgeSelect) BoolX

func (bs *BadgeSelect) BoolX(ctx context.Context) bool

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

func (*BadgeSelect) Bools

func (bs *BadgeSelect) Bools(ctx context.Context) ([]bool, error)

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

func (*BadgeSelect) BoolsX

func (bs *BadgeSelect) BoolsX(ctx context.Context) []bool

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

func (*BadgeSelect) Float64

func (bs *BadgeSelect) Float64(ctx context.Context) (_ float64, err error)

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

func (*BadgeSelect) Float64X

func (bs *BadgeSelect) Float64X(ctx context.Context) float64

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

func (*BadgeSelect) Float64s

func (bs *BadgeSelect) Float64s(ctx context.Context) ([]float64, error)

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

func (*BadgeSelect) Float64sX

func (bs *BadgeSelect) Float64sX(ctx context.Context) []float64

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

func (*BadgeSelect) Int

func (bs *BadgeSelect) Int(ctx context.Context) (_ int, err error)

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

func (*BadgeSelect) IntX

func (bs *BadgeSelect) IntX(ctx context.Context) int

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

func (*BadgeSelect) Ints

func (bs *BadgeSelect) Ints(ctx context.Context) ([]int, error)

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

func (*BadgeSelect) IntsX

func (bs *BadgeSelect) IntsX(ctx context.Context) []int

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

func (*BadgeSelect) Scan

func (bs *BadgeSelect) Scan(ctx context.Context, v interface{}) error

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

func (*BadgeSelect) ScanX

func (bs *BadgeSelect) ScanX(ctx context.Context, v interface{})

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

func (*BadgeSelect) String

func (bs *BadgeSelect) String(ctx context.Context) (_ string, err error)

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

func (*BadgeSelect) StringX

func (bs *BadgeSelect) StringX(ctx context.Context) string

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

func (*BadgeSelect) Strings

func (bs *BadgeSelect) Strings(ctx context.Context) ([]string, error)

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

func (*BadgeSelect) StringsX

func (bs *BadgeSelect) StringsX(ctx context.Context) []string

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

type BadgeUpdate

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

BadgeUpdate is the builder for updating Badge entities.

func (*BadgeUpdate) AddUserIDs

func (bu *BadgeUpdate) AddUserIDs(ids ...uuid.UUID) *BadgeUpdate

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

func (*BadgeUpdate) AddUsers

func (bu *BadgeUpdate) AddUsers(u ...*User) *BadgeUpdate

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

func (*BadgeUpdate) ClearMeta

func (bu *BadgeUpdate) ClearMeta() *BadgeUpdate

ClearMeta clears the value of the "meta" field.

func (*BadgeUpdate) ClearUsers

func (bu *BadgeUpdate) ClearUsers() *BadgeUpdate

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

func (*BadgeUpdate) Exec

func (bu *BadgeUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*BadgeUpdate) ExecX

func (bu *BadgeUpdate) ExecX(ctx context.Context)

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

func (*BadgeUpdate) Mutation

func (bu *BadgeUpdate) Mutation() *BadgeMutation

Mutation returns the BadgeMutation object of the builder.

func (*BadgeUpdate) RemoveUserIDs

func (bu *BadgeUpdate) RemoveUserIDs(ids ...uuid.UUID) *BadgeUpdate

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

func (*BadgeUpdate) RemoveUsers

func (bu *BadgeUpdate) RemoveUsers(u ...*User) *BadgeUpdate

RemoveUsers removes "users" edges to User entities.

func (*BadgeUpdate) Save

func (bu *BadgeUpdate) Save(ctx context.Context) (int, error)

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

func (*BadgeUpdate) SaveX

func (bu *BadgeUpdate) SaveX(ctx context.Context) int

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

func (*BadgeUpdate) SetActive

func (bu *BadgeUpdate) SetActive(b bool) *BadgeUpdate

SetActive sets the "active" field.

func (*BadgeUpdate) SetMeta

func (bu *BadgeUpdate) SetMeta(m map[string]interface{}) *BadgeUpdate

SetMeta sets the "meta" field.

func (*BadgeUpdate) SetNillableActive

func (bu *BadgeUpdate) SetNillableActive(b *bool) *BadgeUpdate

SetNillableActive sets the "active" field if the given value is not nil.

func (*BadgeUpdate) SetUpdateTime

func (bu *BadgeUpdate) SetUpdateTime(t time.Time) *BadgeUpdate

SetUpdateTime sets the "update_time" field.

func (*BadgeUpdate) Where

func (bu *BadgeUpdate) Where(ps ...predicate.Badge) *BadgeUpdate

Where appends a list predicates to the BadgeUpdate builder.

type BadgeUpdateOne

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

BadgeUpdateOne is the builder for updating a single Badge entity.

func (*BadgeUpdateOne) AddUserIDs

func (buo *BadgeUpdateOne) AddUserIDs(ids ...uuid.UUID) *BadgeUpdateOne

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

func (*BadgeUpdateOne) AddUsers

func (buo *BadgeUpdateOne) AddUsers(u ...*User) *BadgeUpdateOne

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

func (*BadgeUpdateOne) ClearMeta

func (buo *BadgeUpdateOne) ClearMeta() *BadgeUpdateOne

ClearMeta clears the value of the "meta" field.

func (*BadgeUpdateOne) ClearUsers

func (buo *BadgeUpdateOne) ClearUsers() *BadgeUpdateOne

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

func (*BadgeUpdateOne) Exec

func (buo *BadgeUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*BadgeUpdateOne) ExecX

func (buo *BadgeUpdateOne) ExecX(ctx context.Context)

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

func (*BadgeUpdateOne) Mutation

func (buo *BadgeUpdateOne) Mutation() *BadgeMutation

Mutation returns the BadgeMutation object of the builder.

func (*BadgeUpdateOne) RemoveUserIDs

func (buo *BadgeUpdateOne) RemoveUserIDs(ids ...uuid.UUID) *BadgeUpdateOne

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

func (*BadgeUpdateOne) RemoveUsers

func (buo *BadgeUpdateOne) RemoveUsers(u ...*User) *BadgeUpdateOne

RemoveUsers removes "users" edges to User entities.

func (*BadgeUpdateOne) Save

func (buo *BadgeUpdateOne) Save(ctx context.Context) (*Badge, error)

Save executes the query and returns the updated Badge entity.

func (*BadgeUpdateOne) SaveX

func (buo *BadgeUpdateOne) SaveX(ctx context.Context) *Badge

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

func (*BadgeUpdateOne) Select

func (buo *BadgeUpdateOne) Select(field string, fields ...string) *BadgeUpdateOne

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

func (*BadgeUpdateOne) SetActive

func (buo *BadgeUpdateOne) SetActive(b bool) *BadgeUpdateOne

SetActive sets the "active" field.

func (*BadgeUpdateOne) SetMeta

func (buo *BadgeUpdateOne) SetMeta(m map[string]interface{}) *BadgeUpdateOne

SetMeta sets the "meta" field.

func (*BadgeUpdateOne) SetNillableActive

func (buo *BadgeUpdateOne) SetNillableActive(b *bool) *BadgeUpdateOne

SetNillableActive sets the "active" field if the given value is not nil.

func (*BadgeUpdateOne) SetUpdateTime

func (buo *BadgeUpdateOne) SetUpdateTime(t time.Time) *BadgeUpdateOne

SetUpdateTime sets the "update_time" field.

type Badges

type Badges []*Badge

Badges is a parsable slice of Badge.

type Challenge

type Challenge struct {

	// ID of the ent.
	ID uuid.UUID `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"`
	// Content holds the value of the "content" field.
	Content string `json:"content,omitempty"`
	// Description holds the value of the "description" field.
	Description string `json:"description,omitempty"`
	// Outcome holds the value of the "outcome" field.
	Outcome *bool `json:"outcome,omitempty"`
	// Published holds the value of the "published" field.
	Published bool `json:"published,omitempty"`
	// StartTime holds the value of the "start_time" field.
	StartTime time.Time `json:"start_time,omitempty"`
	// EndTime holds the value of the "end_time" field.
	EndTime time.Time `json:"end_time,omitempty"`
	// Type holds the value of the "type" field.
	Type challenge.Type `json:"type,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the ChallengeQuery when eager-loading is set.
	Edges ChallengeEdges `json:"edges"`
	// contains filtered or unexported fields
}

Challenge is the model entity for the Challenge schema.

func (*Challenge) QueryAuthor

func (c *Challenge) QueryAuthor() *UserQuery

QueryAuthor queries the "author" edge of the Challenge entity.

func (*Challenge) QueryPredictions

func (c *Challenge) QueryPredictions() *PredictionQuery

QueryPredictions queries the "predictions" edge of the Challenge entity.

func (*Challenge) QueryProofs

func (c *Challenge) QueryProofs() *ProofQuery

QueryProofs queries the "proofs" edge of the Challenge entity.

func (*Challenge) String

func (c *Challenge) String() string

String implements the fmt.Stringer.

func (*Challenge) Unwrap

func (c *Challenge) Unwrap() *Challenge

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

func (*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

CreateBulk 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 uuid.UUID) *ChallengeDeleteOne

DeleteOneID returns a delete builder for the given id.

func (*ChallengeClient) Get

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

Get returns a Challenge entity by its id.

func (*ChallengeClient) GetX

func (c *ChallengeClient) GetX(ctx context.Context, id uuid.UUID) *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) QueryAuthor

func (c *ChallengeClient) QueryAuthor(ch *Challenge) *UserQuery

QueryAuthor queries the author edge of a Challenge.

func (*ChallengeClient) QueryPredictions

func (c *ChallengeClient) QueryPredictions(ch *Challenge) *PredictionQuery

QueryPredictions queries the predictions edge of a Challenge.

func (*ChallengeClient) QueryProofs

func (c *ChallengeClient) QueryProofs(ch *Challenge) *ProofQuery

QueryProofs queries the proofs edge of a 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 uuid.UUID) *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) AddPredictionIDs

func (cc *ChallengeCreate) AddPredictionIDs(ids ...uuid.UUID) *ChallengeCreate

AddPredictionIDs adds the "predictions" edge to the Prediction entity by IDs.

func (*ChallengeCreate) AddPredictions

func (cc *ChallengeCreate) AddPredictions(p ...*Prediction) *ChallengeCreate

AddPredictions adds the "predictions" edges to the Prediction entity.

func (*ChallengeCreate) AddProofIDs

func (cc *ChallengeCreate) AddProofIDs(ids ...uuid.UUID) *ChallengeCreate

AddProofIDs adds the "proofs" edge to the Proof entity by IDs.

func (*ChallengeCreate) AddProofs

func (cc *ChallengeCreate) AddProofs(p ...*Proof) *ChallengeCreate

AddProofs adds the "proofs" edges to the Proof entity.

func (*ChallengeCreate) Exec

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

Exec executes the query.

func (*ChallengeCreate) ExecX

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

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

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

func (cc *ChallengeCreate) SetAuthor(u *User) *ChallengeCreate

SetAuthor sets the "author" edge to the User entity.

func (*ChallengeCreate) SetAuthorID

func (cc *ChallengeCreate) SetAuthorID(id uuid.UUID) *ChallengeCreate

SetAuthorID sets the "author" edge to the User entity by ID.

func (*ChallengeCreate) SetContent

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

SetContent sets the "content" field.

func (*ChallengeCreate) SetCreateTime

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

SetCreateTime sets the "create_time" field.

func (*ChallengeCreate) SetDescription

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

SetDescription sets the "description" field.

func (*ChallengeCreate) SetEndTime

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

SetEndTime sets the "end_time" field.

func (*ChallengeCreate) SetID

func (cc *ChallengeCreate) SetID(u uuid.UUID) *ChallengeCreate

SetID sets the "id" field.

func (*ChallengeCreate) SetNillableAuthorID

func (cc *ChallengeCreate) SetNillableAuthorID(id *uuid.UUID) *ChallengeCreate

SetNillableAuthorID sets the "author" edge to the User entity by ID if the given value is not nil.

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

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

SetNillableDescription sets the "description" field if the given value is not nil.

func (*ChallengeCreate) SetNillableID

func (cc *ChallengeCreate) SetNillableID(u *uuid.UUID) *ChallengeCreate

SetNillableID sets the "id" field if the given value is not nil.

func (*ChallengeCreate) SetNillableOutcome

func (cc *ChallengeCreate) SetNillableOutcome(b *bool) *ChallengeCreate

SetNillableOutcome sets the "outcome" field if the given value is not nil.

func (*ChallengeCreate) SetNillablePublished

func (cc *ChallengeCreate) SetNillablePublished(b *bool) *ChallengeCreate

SetNillablePublished sets the "published" field if the given value is not nil.

func (*ChallengeCreate) SetNillableType

func (cc *ChallengeCreate) SetNillableType(c *challenge.Type) *ChallengeCreate

SetNillableType sets the "type" 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) SetOutcome

func (cc *ChallengeCreate) SetOutcome(b bool) *ChallengeCreate

SetOutcome sets the "outcome" field.

func (*ChallengeCreate) SetPublished

func (cc *ChallengeCreate) SetPublished(b bool) *ChallengeCreate

SetPublished sets the "published" field.

func (*ChallengeCreate) SetStartTime

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

SetStartTime sets the "start_time" field.

func (*ChallengeCreate) SetType

SetType sets the "type" field.

func (*ChallengeCreate) SetUpdateTime

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

SetUpdateTime sets the "update_time" field.

type ChallengeCreateBulk

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

ChallengeCreateBulk is the builder for creating many Challenge entities in bulk.

func (*ChallengeCreateBulk) Exec

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

Exec executes the query.

func (*ChallengeCreateBulk) ExecX

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

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

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 is like Save, but panics if an error occurs.

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 appends a list predicates to the ChallengeDelete 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 ChallengeEdges

type ChallengeEdges struct {
	// Predictions holds the value of the predictions edge.
	Predictions []*Prediction `json:"predictions,omitempty"`
	// Proofs holds the value of the proofs edge.
	Proofs []*Proof `json:"proofs,omitempty"`
	// Author holds the value of the author edge.
	Author *User `json:"author,omitempty"`
	// contains filtered or unexported fields
}

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

func (ChallengeEdges) AuthorOrErr

func (e ChallengeEdges) AuthorOrErr() (*User, error)

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

func (ChallengeEdges) PredictionsOrErr

func (e ChallengeEdges) PredictionsOrErr() ([]*Prediction, error)

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

func (ChallengeEdges) ProofsOrErr

func (e ChallengeEdges) ProofsOrErr() ([]*Proof, error)

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

type ChallengeGroupBy

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

ChallengeGroupBy is the group-by builder for 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 a group-by query. It is only allowed when executing a group-by query 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 executing a group-by query 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 a group-by query. It is only allowed when executing a group-by query 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 executing a group-by query 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 a group-by query. It is only allowed when executing a group-by query 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 executing a group-by query 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 scans 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 a group-by query. It is only allowed when executing a group-by query 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 executing a group-by query 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 mutates the Challenge nodes in the graph.

func (*ChallengeMutation) AddField

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

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

func (*ChallengeMutation) AddPredictionIDs

func (m *ChallengeMutation) AddPredictionIDs(ids ...uuid.UUID)

AddPredictionIDs adds the "predictions" edge to the Prediction entity by ids.

func (*ChallengeMutation) AddProofIDs

func (m *ChallengeMutation) AddProofIDs(ids ...uuid.UUID)

AddProofIDs adds the "proofs" edge to the Proof entity by ids.

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 incremented/decremented on a field with the given name. The second boolean return value indicates that this field was not set, or was not defined in the schema.

func (*ChallengeMutation) AddedFields

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

AddedFields returns all numeric fields that were incremented/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 in this mutation.

func (*ChallengeMutation) AuthorCleared

func (m *ChallengeMutation) AuthorCleared() bool

AuthorCleared reports if the "author" edge to the User entity was cleared.

func (*ChallengeMutation) AuthorID

func (m *ChallengeMutation) AuthorID() (id uuid.UUID, exists bool)

AuthorID returns the "author" edge ID in the mutation.

func (*ChallengeMutation) AuthorIDs

func (m *ChallengeMutation) AuthorIDs() (ids []uuid.UUID)

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

func (*ChallengeMutation) ClearAuthor

func (m *ChallengeMutation) ClearAuthor()

ClearAuthor clears the "author" edge to the User entity.

func (*ChallengeMutation) ClearDescription

func (m *ChallengeMutation) ClearDescription()

ClearDescription clears the value of the "description" field.

func (*ChallengeMutation) ClearEdge

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

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

func (*ChallengeMutation) ClearField

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

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

func (*ChallengeMutation) ClearOutcome

func (m *ChallengeMutation) ClearOutcome()

ClearOutcome clears the value of the "outcome" field.

func (*ChallengeMutation) ClearPredictions

func (m *ChallengeMutation) ClearPredictions()

ClearPredictions clears the "predictions" edge to the Prediction entity.

func (*ChallengeMutation) ClearProofs

func (m *ChallengeMutation) ClearProofs()

ClearProofs clears the "proofs" edge to the Proof entity.

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

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

Content returns the value of the "content" field in the mutation.

func (*ChallengeMutation) CreateTime

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

CreateTime returns the value of the "create_time" field in the mutation.

func (*ChallengeMutation) Description

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

Description returns the value of the "description" field in the mutation.

func (*ChallengeMutation) DescriptionCleared

func (m *ChallengeMutation) DescriptionCleared() bool

DescriptionCleared returns if the "description" field was cleared in this mutation.

func (*ChallengeMutation) EdgeCleared

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

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

func (*ChallengeMutation) EndTime

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

EndTime returns the value of the "end_time" field 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 return value indicates that this field was not set, or was not defined in the schema.

func (*ChallengeMutation) FieldCleared

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

FieldCleared returns a boolean indicating if a field with the given name 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 incremented/decremented, call AddedFields().

func (*ChallengeMutation) GetType

func (m *ChallengeMutation) GetType() (r challenge.Type, exists bool)

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

func (*ChallengeMutation) ID

func (m *ChallengeMutation) ID() (id uuid.UUID, exists bool)

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

func (*ChallengeMutation) IDs

func (m *ChallengeMutation) IDs(ctx context.Context) ([]uuid.UUID, error)

IDs queries the database and returns the entity ids that match the mutation's predicate. That means, if the mutation is applied within a transaction with an isolation level such as sql.LevelSerializable, the returned ids match the ids of the rows that will be updated or updated by the mutation.

func (*ChallengeMutation) OldContent

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

OldContent returns the old "content" field's value of the Challenge entity. 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 the database query fails.

func (*ChallengeMutation) OldCreateTime

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

OldCreateTime returns the old "create_time" field's value of the Challenge entity. 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 the database query fails.

func (*ChallengeMutation) OldDescription

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

OldDescription returns the old "description" field's value of the Challenge entity. 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 the database query fails.

func (*ChallengeMutation) OldEndTime

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

OldEndTime returns the old "end_time" field's value of the Challenge entity. 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 the 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 failed.

func (*ChallengeMutation) OldOutcome

func (m *ChallengeMutation) OldOutcome(ctx context.Context) (v *bool, err error)

OldOutcome returns the old "outcome" field's value of the Challenge entity. 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 the database query fails.

func (*ChallengeMutation) OldPublished

func (m *ChallengeMutation) OldPublished(ctx context.Context) (v bool, err error)

OldPublished returns the old "published" field's value of the Challenge entity. 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 the database query fails.

func (*ChallengeMutation) OldStartTime

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

OldStartTime returns the old "start_time" field's value of the Challenge entity. 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 the database query fails.

func (*ChallengeMutation) OldType

func (m *ChallengeMutation) OldType(ctx context.Context) (v challenge.Type, err error)

OldType returns the old "type" field's value of the Challenge entity. 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 the database query fails.

func (*ChallengeMutation) OldUpdateTime

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

OldUpdateTime returns the old "update_time" field's value of the Challenge entity. 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 the database query fails.

func (*ChallengeMutation) Op

func (m *ChallengeMutation) Op() Op

Op returns the operation name.

func (*ChallengeMutation) Outcome

func (m *ChallengeMutation) Outcome() (r bool, exists bool)

Outcome returns the value of the "outcome" field in the mutation.

func (*ChallengeMutation) OutcomeCleared

func (m *ChallengeMutation) OutcomeCleared() bool

OutcomeCleared returns if the "outcome" field was cleared in this mutation.

func (*ChallengeMutation) PredictionsCleared

func (m *ChallengeMutation) PredictionsCleared() bool

PredictionsCleared reports if the "predictions" edge to the Prediction entity was cleared.

func (*ChallengeMutation) PredictionsIDs

func (m *ChallengeMutation) PredictionsIDs() (ids []uuid.UUID)

PredictionsIDs returns the "predictions" edge IDs in the mutation.

func (*ChallengeMutation) ProofsCleared

func (m *ChallengeMutation) ProofsCleared() bool

ProofsCleared reports if the "proofs" edge to the Proof entity was cleared.

func (*ChallengeMutation) ProofsIDs

func (m *ChallengeMutation) ProofsIDs() (ids []uuid.UUID)

ProofsIDs returns the "proofs" edge IDs in the mutation.

func (*ChallengeMutation) Published

func (m *ChallengeMutation) Published() (r bool, exists bool)

Published returns the value of the "published" field in the mutation.

func (*ChallengeMutation) RemovePredictionIDs

func (m *ChallengeMutation) RemovePredictionIDs(ids ...uuid.UUID)

RemovePredictionIDs removes the "predictions" edge to the Prediction entity by IDs.

func (*ChallengeMutation) RemoveProofIDs

func (m *ChallengeMutation) RemoveProofIDs(ids ...uuid.UUID)

RemoveProofIDs removes the "proofs" edge to the Proof entity by IDs.

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 edge with the given name in this mutation.

func (*ChallengeMutation) RemovedPredictionsIDs

func (m *ChallengeMutation) RemovedPredictionsIDs() (ids []uuid.UUID)

RemovedPredictions returns the removed IDs of the "predictions" edge to the Prediction entity.

func (*ChallengeMutation) RemovedProofsIDs

func (m *ChallengeMutation) RemovedProofsIDs() (ids []uuid.UUID)

RemovedProofs returns the removed IDs of the "proofs" edge to the Proof entity.

func (*ChallengeMutation) ResetAuthor

func (m *ChallengeMutation) ResetAuthor()

ResetAuthor resets all changes to the "author" edge.

func (*ChallengeMutation) ResetContent

func (m *ChallengeMutation) ResetContent()

ResetContent resets all changes to the "content" field.

func (*ChallengeMutation) ResetCreateTime

func (m *ChallengeMutation) ResetCreateTime()

ResetCreateTime resets all changes to the "create_time" field.

func (*ChallengeMutation) ResetDescription

func (m *ChallengeMutation) ResetDescription()

ResetDescription resets all changes to the "description" field.

func (*ChallengeMutation) ResetEdge

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

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

func (*ChallengeMutation) ResetEndTime

func (m *ChallengeMutation) ResetEndTime()

ResetEndTime resets all changes to the "end_time" field.

func (*ChallengeMutation) ResetField

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

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

func (*ChallengeMutation) ResetOutcome

func (m *ChallengeMutation) ResetOutcome()

ResetOutcome resets all changes to the "outcome" field.

func (*ChallengeMutation) ResetPredictions

func (m *ChallengeMutation) ResetPredictions()

ResetPredictions resets all changes to the "predictions" edge.

func (*ChallengeMutation) ResetProofs

func (m *ChallengeMutation) ResetProofs()

ResetProofs resets all changes to the "proofs" edge.

func (*ChallengeMutation) ResetPublished

func (m *ChallengeMutation) ResetPublished()

ResetPublished resets all changes to the "published" field.

func (*ChallengeMutation) ResetStartTime

func (m *ChallengeMutation) ResetStartTime()

ResetStartTime resets all changes to the "start_time" field.

func (*ChallengeMutation) ResetType

func (m *ChallengeMutation) ResetType()

ResetType resets all changes to the "type" field.

func (*ChallengeMutation) ResetUpdateTime

func (m *ChallengeMutation) ResetUpdateTime()

ResetUpdateTime resets all changes to the "update_time" field.

func (*ChallengeMutation) SetAuthorID

func (m *ChallengeMutation) SetAuthorID(id uuid.UUID)

SetAuthorID sets the "author" edge to the User entity by id.

func (*ChallengeMutation) SetContent

func (m *ChallengeMutation) SetContent(s string)

SetContent sets the "content" field.

func (*ChallengeMutation) SetCreateTime

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

SetCreateTime sets the "create_time" field.

func (*ChallengeMutation) SetDescription

func (m *ChallengeMutation) SetDescription(s string)

SetDescription sets the "description" field.

func (*ChallengeMutation) SetEndTime

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

SetEndTime sets the "end_time" field.

func (*ChallengeMutation) SetField

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

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

func (*ChallengeMutation) SetID

func (m *ChallengeMutation) SetID(id uuid.UUID)

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

func (*ChallengeMutation) SetOutcome

func (m *ChallengeMutation) SetOutcome(b bool)

SetOutcome sets the "outcome" field.

func (*ChallengeMutation) SetPublished

func (m *ChallengeMutation) SetPublished(b bool)

SetPublished sets the "published" field.

func (*ChallengeMutation) SetStartTime

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

SetStartTime sets the "start_time" field.

func (*ChallengeMutation) SetType

func (m *ChallengeMutation) SetType(c challenge.Type)

SetType sets the "type" field.

func (*ChallengeMutation) SetUpdateTime

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

SetUpdateTime sets the "update_time" field.

func (*ChallengeMutation) StartTime

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

StartTime returns the value of the "start_time" field in the mutation.

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 value of the "update_time" field in the mutation.

func (*ChallengeMutation) Where

func (m *ChallengeMutation) Where(ps ...predicate.Challenge)

Where appends a list predicates to the ChallengeMutation builder.

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 ChallengeQuery 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 from the query. Returns a *NotFoundError when no Challenge was found.

func (*ChallengeQuery) FirstID

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

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

func (*ChallengeQuery) FirstIDX

func (cq *ChallengeQuery) FirstIDX(ctx context.Context) uuid.UUID

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

func (*ChallengeQuery) FirstX

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

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

func (*ChallengeQuery) GroupBy

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

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

Example:

var v []struct {
	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) ([]uuid.UUID, error)

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

func (*ChallengeQuery) IDsX

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

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 a single Challenge entity found by the query, ensuring it only returns one. Returns a *NotSingularError when more than one Challenge entity is found. Returns a *NotFoundError when no Challenge entities are found.

func (*ChallengeQuery) OnlyID

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

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

func (*ChallengeQuery) OnlyIDX

func (cq *ChallengeQuery) OnlyIDX(ctx context.Context) uuid.UUID

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

func (cq *ChallengeQuery) QueryAuthor() *UserQuery

QueryAuthor chains the current query on the "author" edge.

func (*ChallengeQuery) QueryPredictions

func (cq *ChallengeQuery) QueryPredictions() *PredictionQuery

QueryPredictions chains the current query on the "predictions" edge.

func (*ChallengeQuery) QueryProofs

func (cq *ChallengeQuery) QueryProofs() *ProofQuery

QueryProofs chains the current query on the "proofs" edge.

func (*ChallengeQuery) Select

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

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

Example:

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

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

func (*ChallengeQuery) Unique

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

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

func (*ChallengeQuery) Where

Where adds a new predicate for the ChallengeQuery builder.

func (*ChallengeQuery) WithAuthor

func (cq *ChallengeQuery) WithAuthor(opts ...func(*UserQuery)) *ChallengeQuery

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

func (*ChallengeQuery) WithPredictions

func (cq *ChallengeQuery) WithPredictions(opts ...func(*PredictionQuery)) *ChallengeQuery

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

func (*ChallengeQuery) WithProofs

func (cq *ChallengeQuery) WithProofs(opts ...func(*ProofQuery)) *ChallengeQuery

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

type ChallengeSelect

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

ChallengeSelect is the builder for selecting fields of Challenge entities.

func (*ChallengeSelect) Bool

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

Bool returns a single bool from a 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 a 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 a 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 a 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 a 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 a 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 scans 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 a 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 a 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) AddPredictionIDs

func (cu *ChallengeUpdate) AddPredictionIDs(ids ...uuid.UUID) *ChallengeUpdate

AddPredictionIDs adds the "predictions" edge to the Prediction entity by IDs.

func (*ChallengeUpdate) AddPredictions

func (cu *ChallengeUpdate) AddPredictions(p ...*Prediction) *ChallengeUpdate

AddPredictions adds the "predictions" edges to the Prediction entity.

func (*ChallengeUpdate) AddProofIDs

func (cu *ChallengeUpdate) AddProofIDs(ids ...uuid.UUID) *ChallengeUpdate

AddProofIDs adds the "proofs" edge to the Proof entity by IDs.

func (*ChallengeUpdate) AddProofs

func (cu *ChallengeUpdate) AddProofs(p ...*Proof) *ChallengeUpdate

AddProofs adds the "proofs" edges to the Proof entity.

func (*ChallengeUpdate) ClearAuthor

func (cu *ChallengeUpdate) ClearAuthor() *ChallengeUpdate

ClearAuthor clears the "author" edge to the User entity.

func (*ChallengeUpdate) ClearDescription

func (cu *ChallengeUpdate) ClearDescription() *ChallengeUpdate

ClearDescription clears the value of the "description" field.

func (*ChallengeUpdate) ClearOutcome

func (cu *ChallengeUpdate) ClearOutcome() *ChallengeUpdate

ClearOutcome clears the value of the "outcome" field.

func (*ChallengeUpdate) ClearPredictions

func (cu *ChallengeUpdate) ClearPredictions() *ChallengeUpdate

ClearPredictions clears all "predictions" edges to the Prediction entity.

func (*ChallengeUpdate) ClearProofs

func (cu *ChallengeUpdate) ClearProofs() *ChallengeUpdate

ClearProofs clears all "proofs" edges to the Proof entity.

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

func (cu *ChallengeUpdate) RemovePredictionIDs(ids ...uuid.UUID) *ChallengeUpdate

RemovePredictionIDs removes the "predictions" edge to Prediction entities by IDs.

func (*ChallengeUpdate) RemovePredictions

func (cu *ChallengeUpdate) RemovePredictions(p ...*Prediction) *ChallengeUpdate

RemovePredictions removes "predictions" edges to Prediction entities.

func (*ChallengeUpdate) RemoveProofIDs

func (cu *ChallengeUpdate) RemoveProofIDs(ids ...uuid.UUID) *ChallengeUpdate

RemoveProofIDs removes the "proofs" edge to Proof entities by IDs.

func (*ChallengeUpdate) RemoveProofs

func (cu *ChallengeUpdate) RemoveProofs(p ...*Proof) *ChallengeUpdate

RemoveProofs removes "proofs" edges to Proof entities.

func (*ChallengeUpdate) Save

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

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

func (*ChallengeUpdate) SaveX

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

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

func (*ChallengeUpdate) SetAuthor

func (cu *ChallengeUpdate) SetAuthor(u *User) *ChallengeUpdate

SetAuthor sets the "author" edge to the User entity.

func (*ChallengeUpdate) SetAuthorID

func (cu *ChallengeUpdate) SetAuthorID(id uuid.UUID) *ChallengeUpdate

SetAuthorID sets the "author" edge to the User entity by ID.

func (*ChallengeUpdate) SetContent

func (cu *ChallengeUpdate) SetContent(s string) *ChallengeUpdate

SetContent sets the "content" field.

func (*ChallengeUpdate) SetDescription

func (cu *ChallengeUpdate) SetDescription(s string) *ChallengeUpdate

SetDescription sets the "description" field.

func (*ChallengeUpdate) SetEndTime

func (cu *ChallengeUpdate) SetEndTime(t time.Time) *ChallengeUpdate

SetEndTime sets the "end_time" field.

func (*ChallengeUpdate) SetNillableAuthorID

func (cu *ChallengeUpdate) SetNillableAuthorID(id *uuid.UUID) *ChallengeUpdate

SetNillableAuthorID sets the "author" edge to the User entity by ID if the given value is not nil.

func (*ChallengeUpdate) SetNillableDescription

func (cu *ChallengeUpdate) SetNillableDescription(s *string) *ChallengeUpdate

SetNillableDescription sets the "description" field if the given value is not nil.

func (*ChallengeUpdate) SetNillableOutcome

func (cu *ChallengeUpdate) SetNillableOutcome(b *bool) *ChallengeUpdate

SetNillableOutcome sets the "outcome" field if the given value is not nil.

func (*ChallengeUpdate) SetNillablePublished

func (cu *ChallengeUpdate) SetNillablePublished(b *bool) *ChallengeUpdate

SetNillablePublished sets the "published" field if the given value is not nil.

func (*ChallengeUpdate) SetOutcome

func (cu *ChallengeUpdate) SetOutcome(b bool) *ChallengeUpdate

SetOutcome sets the "outcome" field.

func (*ChallengeUpdate) SetPublished

func (cu *ChallengeUpdate) SetPublished(b bool) *ChallengeUpdate

SetPublished sets the "published" field.

func (*ChallengeUpdate) SetStartTime

func (cu *ChallengeUpdate) SetStartTime(t time.Time) *ChallengeUpdate

SetStartTime sets the "start_time" field.

func (*ChallengeUpdate) SetUpdateTime

func (cu *ChallengeUpdate) SetUpdateTime(t time.Time) *ChallengeUpdate

SetUpdateTime sets the "update_time" field.

func (*ChallengeUpdate) Where

Where appends a list predicates to the ChallengeUpdate builder.

type ChallengeUpdateOne

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

ChallengeUpdateOne is the builder for updating a single Challenge entity.

func (*ChallengeUpdateOne) AddPredictionIDs

func (cuo *ChallengeUpdateOne) AddPredictionIDs(ids ...uuid.UUID) *ChallengeUpdateOne

AddPredictionIDs adds the "predictions" edge to the Prediction entity by IDs.

func (*ChallengeUpdateOne) AddPredictions

func (cuo *ChallengeUpdateOne) AddPredictions(p ...*Prediction) *ChallengeUpdateOne

AddPredictions adds the "predictions" edges to the Prediction entity.

func (*ChallengeUpdateOne) AddProofIDs

func (cuo *ChallengeUpdateOne) AddProofIDs(ids ...uuid.UUID) *ChallengeUpdateOne

AddProofIDs adds the "proofs" edge to the Proof entity by IDs.

func (*ChallengeUpdateOne) AddProofs

func (cuo *ChallengeUpdateOne) AddProofs(p ...*Proof) *ChallengeUpdateOne

AddProofs adds the "proofs" edges to the Proof entity.

func (*ChallengeUpdateOne) ClearAuthor

func (cuo *ChallengeUpdateOne) ClearAuthor() *ChallengeUpdateOne

ClearAuthor clears the "author" edge to the User entity.

func (*ChallengeUpdateOne) ClearDescription

func (cuo *ChallengeUpdateOne) ClearDescription() *ChallengeUpdateOne

ClearDescription clears the value of the "description" field.

func (*ChallengeUpdateOne) ClearOutcome

func (cuo *ChallengeUpdateOne) ClearOutcome() *ChallengeUpdateOne

ClearOutcome clears the value of the "outcome" field.

func (*ChallengeUpdateOne) ClearPredictions

func (cuo *ChallengeUpdateOne) ClearPredictions() *ChallengeUpdateOne

ClearPredictions clears all "predictions" edges to the Prediction entity.

func (*ChallengeUpdateOne) ClearProofs

func (cuo *ChallengeUpdateOne) ClearProofs() *ChallengeUpdateOne

ClearProofs clears all "proofs" edges to the Proof 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) RemovePredictionIDs

func (cuo *ChallengeUpdateOne) RemovePredictionIDs(ids ...uuid.UUID) *ChallengeUpdateOne

RemovePredictionIDs removes the "predictions" edge to Prediction entities by IDs.

func (*ChallengeUpdateOne) RemovePredictions

func (cuo *ChallengeUpdateOne) RemovePredictions(p ...*Prediction) *ChallengeUpdateOne

RemovePredictions removes "predictions" edges to Prediction entities.

func (*ChallengeUpdateOne) RemoveProofIDs

func (cuo *ChallengeUpdateOne) RemoveProofIDs(ids ...uuid.UUID) *ChallengeUpdateOne

RemoveProofIDs removes the "proofs" edge to Proof entities by IDs.

func (*ChallengeUpdateOne) RemoveProofs

func (cuo *ChallengeUpdateOne) RemoveProofs(p ...*Proof) *ChallengeUpdateOne

RemoveProofs removes "proofs" edges to Proof entities.

func (*ChallengeUpdateOne) Save

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

Save executes the query and returns the updated Challenge entity.

func (*ChallengeUpdateOne) SaveX

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

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

func (*ChallengeUpdateOne) Select

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

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

func (*ChallengeUpdateOne) SetAuthor

func (cuo *ChallengeUpdateOne) SetAuthor(u *User) *ChallengeUpdateOne

SetAuthor sets the "author" edge to the User entity.

func (*ChallengeUpdateOne) SetAuthorID

func (cuo *ChallengeUpdateOne) SetAuthorID(id uuid.UUID) *ChallengeUpdateOne

SetAuthorID sets the "author" edge to the User entity by ID.

func (*ChallengeUpdateOne) SetContent

func (cuo *ChallengeUpdateOne) SetContent(s string) *ChallengeUpdateOne

SetContent sets the "content" field.

func (*ChallengeUpdateOne) SetDescription

func (cuo *ChallengeUpdateOne) SetDescription(s string) *ChallengeUpdateOne

SetDescription sets the "description" field.

func (*ChallengeUpdateOne) SetEndTime

func (cuo *ChallengeUpdateOne) SetEndTime(t time.Time) *ChallengeUpdateOne

SetEndTime sets the "end_time" field.

func (*ChallengeUpdateOne) SetNillableAuthorID

func (cuo *ChallengeUpdateOne) SetNillableAuthorID(id *uuid.UUID) *ChallengeUpdateOne

SetNillableAuthorID sets the "author" edge to the User entity by ID if the given value is not nil.

func (*ChallengeUpdateOne) SetNillableDescription

func (cuo *ChallengeUpdateOne) SetNillableDescription(s *string) *ChallengeUpdateOne

SetNillableDescription sets the "description" field if the given value is not nil.

func (*ChallengeUpdateOne) SetNillableOutcome

func (cuo *ChallengeUpdateOne) SetNillableOutcome(b *bool) *ChallengeUpdateOne

SetNillableOutcome sets the "outcome" field if the given value is not nil.

func (*ChallengeUpdateOne) SetNillablePublished

func (cuo *ChallengeUpdateOne) SetNillablePublished(b *bool) *ChallengeUpdateOne

SetNillablePublished sets the "published" field if the given value is not nil.

func (*ChallengeUpdateOne) SetOutcome

func (cuo *ChallengeUpdateOne) SetOutcome(b bool) *ChallengeUpdateOne

SetOutcome sets the "outcome" field.

func (*ChallengeUpdateOne) SetPublished

func (cuo *ChallengeUpdateOne) SetPublished(b bool) *ChallengeUpdateOne

SetPublished sets the "published" field.

func (*ChallengeUpdateOne) SetStartTime

func (cuo *ChallengeUpdateOne) SetStartTime(t time.Time) *ChallengeUpdateOne

SetStartTime sets the "start_time" field.

func (*ChallengeUpdateOne) SetUpdateTime

func (cuo *ChallengeUpdateOne) SetUpdateTime(t time.Time) *ChallengeUpdateOne

SetUpdateTime sets the "update_time" field.

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
	// Badge is the client for interacting with the Badge builders.
	Badge *BadgeClient
	// Challenge is the client for interacting with the Challenge builders.
	Challenge *ChallengeClient
	// Prediction is the client for interacting with the Prediction builders.
	Prediction *PredictionClient
	// Proof is the client for interacting with the Proof builders.
	Proof *ProofClient
	// User is the client for interacting with the User builders.
	User *UserClient
	// UserSession is the client for interacting with the UserSession builders.
	UserSession *UserSessionClient
	// contains filtered or unexported fields
}

Client is the client that holds all ent builders.

func FromContext

func FromContext(ctx context.Context) *Client

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

func NewClient

func NewClient(opts ...Option) *Client

NewClient creates a new client configured with the given options.

func Open

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

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

func (*Client) BeginTx

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

BeginTx returns a transactional client with specified options.

func (*Client) Close

func (c *Client) Close() error

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

func (*Client) Debug

func (c *Client) Debug() *Client

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

client.Debug().
	Badge.
	Query().
	Count(ctx)

func (*Client) Tx

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

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

func (*Client) Use

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

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

type CommitFunc

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

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

func (CommitFunc) Commit

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

Commit calls f(ctx, m).

type CommitHook

type CommitHook func(Committer) Committer

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

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

type Committer

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

Committer is the interface that wraps the Commit method.

type ConstraintError

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

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

func (ConstraintError) Error

func (e ConstraintError) Error() string

Error implements the error interface.

func (*ConstraintError) Unwrap

func (e *ConstraintError) Unwrap() error

Unwrap implements the errors.Wrapper interface.

type Hook

type Hook = ent.Hook

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

type MutateFunc

type MutateFunc = ent.MutateFunc

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

type Mutation

type Mutation = ent.Mutation

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

type Mutator

type Mutator = ent.Mutator

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

type NotFoundError

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

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

func (*NotFoundError) Error

func (e *NotFoundError) Error() string

Error implements the error interface.

type NotLoadedError

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

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

func (*NotLoadedError) Error

func (e *NotLoadedError) Error() string

Error implements the error interface.

type NotSingularError

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

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

func (*NotSingularError) Error

func (e *NotSingularError) Error() string

Error implements the error interface.

type Op

type Op = ent.Op

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

type Option

type Option func(*config)

Option function to configure the client.

func Debug

func Debug() Option

Debug enables debug logging on the ent.Driver.

func Driver

func Driver(driver dialect.Driver) Option

Driver configures the client driver.

func Log

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

Log sets the logging function for debug mode.

type OrderFunc

type OrderFunc func(*sql.Selector)

OrderFunc applies an ordering on the sql selector.

func Asc

func Asc(fields ...string) OrderFunc

Asc applies the given fields in ASC order.

func Desc

func Desc(fields ...string) OrderFunc

Desc applies the given fields in DESC order.

type Policy

type Policy = ent.Policy

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

type Prediction

type Prediction struct {

	// ID of the ent.
	ID uuid.UUID `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"`
	// Prognosis holds the value of the "prognosis" field.
	Prognosis bool `json:"prognosis,omitempty"`
	// Meta holds the value of the "meta" field.
	Meta map[string]interface{} `json:"meta,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the PredictionQuery when eager-loading is set.
	Edges PredictionEdges `json:"edges"`
	// contains filtered or unexported fields
}

Prediction is the model entity for the Prediction schema.

func (*Prediction) QueryChallenge

func (pr *Prediction) QueryChallenge() *ChallengeQuery

QueryChallenge queries the "challenge" edge of the Prediction entity.

func (*Prediction) QueryUser

func (pr *Prediction) QueryUser() *UserQuery

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

func (*Prediction) String

func (pr *Prediction) String() string

String implements the fmt.Stringer.

func (*Prediction) Unwrap

func (pr *Prediction) Unwrap() *Prediction

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

func (*Prediction) Update

func (pr *Prediction) Update() *PredictionUpdateOne

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

type PredictionClient

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

PredictionClient is a client for the Prediction schema.

func NewPredictionClient

func NewPredictionClient(c config) *PredictionClient

NewPredictionClient returns a client for the Prediction from the given config.

func (*PredictionClient) Create

func (c *PredictionClient) Create() *PredictionCreate

Create returns a create builder for Prediction.

func (*PredictionClient) CreateBulk

func (c *PredictionClient) CreateBulk(builders ...*PredictionCreate) *PredictionCreateBulk

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

func (*PredictionClient) Delete

func (c *PredictionClient) Delete() *PredictionDelete

Delete returns a delete builder for Prediction.

func (*PredictionClient) DeleteOne

func (c *PredictionClient) DeleteOne(pr *Prediction) *PredictionDeleteOne

DeleteOne returns a delete builder for the given entity.

func (*PredictionClient) DeleteOneID

func (c *PredictionClient) DeleteOneID(id uuid.UUID) *PredictionDeleteOne

DeleteOneID returns a delete builder for the given id.

func (*PredictionClient) Get

Get returns a Prediction entity by its id.

func (*PredictionClient) GetX

func (c *PredictionClient) GetX(ctx context.Context, id uuid.UUID) *Prediction

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

func (*PredictionClient) Hooks

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

Hooks returns the client hooks.

func (*PredictionClient) Query

func (c *PredictionClient) Query() *PredictionQuery

Query returns a query builder for Prediction.

func (*PredictionClient) QueryChallenge

func (c *PredictionClient) QueryChallenge(pr *Prediction) *ChallengeQuery

QueryChallenge queries the challenge edge of a Prediction.

func (*PredictionClient) QueryUser

func (c *PredictionClient) QueryUser(pr *Prediction) *UserQuery

QueryUser queries the user edge of a Prediction.

func (*PredictionClient) Update

func (c *PredictionClient) Update() *PredictionUpdate

Update returns an update builder for Prediction.

func (*PredictionClient) UpdateOne

func (c *PredictionClient) UpdateOne(pr *Prediction) *PredictionUpdateOne

UpdateOne returns an update builder for the given entity.

func (*PredictionClient) UpdateOneID

func (c *PredictionClient) UpdateOneID(id uuid.UUID) *PredictionUpdateOne

UpdateOneID returns an update builder for the given id.

func (*PredictionClient) Use

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

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

type PredictionCreate

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

PredictionCreate is the builder for creating a Prediction entity.

func (*PredictionCreate) Exec

func (pc *PredictionCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*PredictionCreate) ExecX

func (pc *PredictionCreate) ExecX(ctx context.Context)

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

func (*PredictionCreate) Mutation

func (pc *PredictionCreate) Mutation() *PredictionMutation

Mutation returns the PredictionMutation object of the builder.

func (*PredictionCreate) Save

func (pc *PredictionCreate) Save(ctx context.Context) (*Prediction, error)

Save creates the Prediction in the database.

func (*PredictionCreate) SaveX

func (pc *PredictionCreate) SaveX(ctx context.Context) *Prediction

SaveX calls Save and panics if Save returns an error.

func (*PredictionCreate) SetChallenge

func (pc *PredictionCreate) SetChallenge(c *Challenge) *PredictionCreate

SetChallenge sets the "challenge" edge to the Challenge entity.

func (*PredictionCreate) SetChallengeID

func (pc *PredictionCreate) SetChallengeID(id uuid.UUID) *PredictionCreate

SetChallengeID sets the "challenge" edge to the Challenge entity by ID.

func (*PredictionCreate) SetCreateTime

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

SetCreateTime sets the "create_time" field.

func (*PredictionCreate) SetID

SetID sets the "id" field.

func (*PredictionCreate) SetMeta

func (pc *PredictionCreate) SetMeta(m map[string]interface{}) *PredictionCreate

SetMeta sets the "meta" field.

func (*PredictionCreate) SetNillableCreateTime

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

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

func (*PredictionCreate) SetNillableID

func (pc *PredictionCreate) SetNillableID(u *uuid.UUID) *PredictionCreate

SetNillableID sets the "id" field if the given value is not nil.

func (*PredictionCreate) SetNillableUpdateTime

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

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

func (*PredictionCreate) SetPrognosis

func (pc *PredictionCreate) SetPrognosis(b bool) *PredictionCreate

SetPrognosis sets the "prognosis" field.

func (*PredictionCreate) SetUpdateTime

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

SetUpdateTime sets the "update_time" field.

func (*PredictionCreate) SetUser

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

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

func (*PredictionCreate) SetUserID

func (pc *PredictionCreate) SetUserID(id uuid.UUID) *PredictionCreate

SetUserID sets the "user" edge to the User entity by ID.

type PredictionCreateBulk

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

PredictionCreateBulk is the builder for creating many Prediction entities in bulk.

func (*PredictionCreateBulk) Exec

func (pcb *PredictionCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*PredictionCreateBulk) ExecX

func (pcb *PredictionCreateBulk) ExecX(ctx context.Context)

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

func (*PredictionCreateBulk) Save

func (pcb *PredictionCreateBulk) Save(ctx context.Context) ([]*Prediction, error)

Save creates the Prediction entities in the database.

func (*PredictionCreateBulk) SaveX

func (pcb *PredictionCreateBulk) SaveX(ctx context.Context) []*Prediction

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

type PredictionDelete

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

PredictionDelete is the builder for deleting a Prediction entity.

func (*PredictionDelete) Exec

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

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

func (*PredictionDelete) ExecX

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

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

func (*PredictionDelete) Where

Where appends a list predicates to the PredictionDelete builder.

type PredictionDeleteOne

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

PredictionDeleteOne is the builder for deleting a single Prediction entity.

func (*PredictionDeleteOne) Exec

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

Exec executes the deletion query.

func (*PredictionDeleteOne) ExecX

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

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

type PredictionEdges

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

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

func (PredictionEdges) ChallengeOrErr

func (e PredictionEdges) ChallengeOrErr() (*Challenge, error)

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

func (PredictionEdges) UserOrErr

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

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

type PredictionGroupBy

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

PredictionGroupBy is the group-by builder for Prediction entities.

func (*PredictionGroupBy) Aggregate

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

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

func (*PredictionGroupBy) Bool

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

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

func (*PredictionGroupBy) BoolX

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

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

func (*PredictionGroupBy) Bools

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

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

func (*PredictionGroupBy) BoolsX

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

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

func (*PredictionGroupBy) Float64

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

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

func (*PredictionGroupBy) Float64X

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

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

func (*PredictionGroupBy) Float64s

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

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

func (*PredictionGroupBy) Float64sX

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

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

func (*PredictionGroupBy) Int

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

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

func (*PredictionGroupBy) IntX

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

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

func (*PredictionGroupBy) Ints

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

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

func (*PredictionGroupBy) IntsX

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

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

func (*PredictionGroupBy) Scan

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

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

func (*PredictionGroupBy) ScanX

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

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

func (*PredictionGroupBy) String

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

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

func (*PredictionGroupBy) StringX

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

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

func (*PredictionGroupBy) Strings

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

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

func (*PredictionGroupBy) StringsX

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

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

type PredictionMutation

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

PredictionMutation represents an operation that mutates the Prediction nodes in the graph.

func (*PredictionMutation) AddField

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

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

func (*PredictionMutation) AddedEdges

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

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

func (*PredictionMutation) AddedField

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

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

func (*PredictionMutation) AddedFields

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

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

func (*PredictionMutation) AddedIDs

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

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

func (*PredictionMutation) ChallengeCleared

func (m *PredictionMutation) ChallengeCleared() bool

ChallengeCleared reports if the "challenge" edge to the Challenge entity was cleared.

func (*PredictionMutation) ChallengeID

func (m *PredictionMutation) ChallengeID() (id uuid.UUID, exists bool)

ChallengeID returns the "challenge" edge ID in the mutation.

func (*PredictionMutation) ChallengeIDs

func (m *PredictionMutation) ChallengeIDs() (ids []uuid.UUID)

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

func (*PredictionMutation) ClearChallenge

func (m *PredictionMutation) ClearChallenge()

ClearChallenge clears the "challenge" edge to the Challenge entity.

func (*PredictionMutation) ClearEdge

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

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

func (*PredictionMutation) ClearField

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

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

func (*PredictionMutation) ClearMeta

func (m *PredictionMutation) ClearMeta()

ClearMeta clears the value of the "meta" field.

func (*PredictionMutation) ClearUser

func (m *PredictionMutation) ClearUser()

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

func (*PredictionMutation) ClearedEdges

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

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

func (*PredictionMutation) ClearedFields

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

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

func (PredictionMutation) Client

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

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

CreateTime returns the value of the "create_time" field in the mutation.

func (*PredictionMutation) EdgeCleared

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

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

func (*PredictionMutation) Field

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

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

func (*PredictionMutation) FieldCleared

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

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

func (*PredictionMutation) Fields

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

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

func (*PredictionMutation) ID

func (m *PredictionMutation) ID() (id uuid.UUID, exists bool)

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

func (*PredictionMutation) IDs

func (m *PredictionMutation) IDs(ctx context.Context) ([]uuid.UUID, error)

IDs queries the database and returns the entity ids that match the mutation's predicate. That means, if the mutation is applied within a transaction with an isolation level such as sql.LevelSerializable, the returned ids match the ids of the rows that will be updated or updated by the mutation.

func (*PredictionMutation) Meta

func (m *PredictionMutation) Meta() (r map[string]interface{}, exists bool)

Meta returns the value of the "meta" field in the mutation.

func (*PredictionMutation) MetaCleared

func (m *PredictionMutation) MetaCleared() bool

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

func (*PredictionMutation) OldCreateTime

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

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

func (*PredictionMutation) OldField

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

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

func (*PredictionMutation) OldMeta

func (m *PredictionMutation) OldMeta(ctx context.Context) (v map[string]interface{}, err error)

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

func (*PredictionMutation) OldPrognosis

func (m *PredictionMutation) OldPrognosis(ctx context.Context) (v bool, err error)

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

func (*PredictionMutation) OldUpdateTime

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

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

func (*PredictionMutation) Op

func (m *PredictionMutation) Op() Op

Op returns the operation name.

func (*PredictionMutation) Prognosis

func (m *PredictionMutation) Prognosis() (r bool, exists bool)

Prognosis returns the value of the "prognosis" field in the mutation.

func (*PredictionMutation) RemovedEdges

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

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

func (*PredictionMutation) RemovedIDs

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

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

func (*PredictionMutation) ResetChallenge

func (m *PredictionMutation) ResetChallenge()

ResetChallenge resets all changes to the "challenge" edge.

func (*PredictionMutation) ResetCreateTime

func (m *PredictionMutation) ResetCreateTime()

ResetCreateTime resets all changes to the "create_time" field.

func (*PredictionMutation) ResetEdge

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

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

func (*PredictionMutation) ResetField

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

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

func (*PredictionMutation) ResetMeta

func (m *PredictionMutation) ResetMeta()

ResetMeta resets all changes to the "meta" field.

func (*PredictionMutation) ResetPrognosis

func (m *PredictionMutation) ResetPrognosis()

ResetPrognosis resets all changes to the "prognosis" field.

func (*PredictionMutation) ResetUpdateTime

func (m *PredictionMutation) ResetUpdateTime()

ResetUpdateTime resets all changes to the "update_time" field.

func (*PredictionMutation) ResetUser

func (m *PredictionMutation) ResetUser()

ResetUser resets all changes to the "user" edge.

func (*PredictionMutation) SetChallengeID

func (m *PredictionMutation) SetChallengeID(id uuid.UUID)

SetChallengeID sets the "challenge" edge to the Challenge entity by id.

func (*PredictionMutation) SetCreateTime

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

SetCreateTime sets the "create_time" field.

func (*PredictionMutation) SetField

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

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

func (*PredictionMutation) SetID

func (m *PredictionMutation) SetID(id uuid.UUID)

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

func (*PredictionMutation) SetMeta

func (m *PredictionMutation) SetMeta(value map[string]interface{})

SetMeta sets the "meta" field.

func (*PredictionMutation) SetPrognosis

func (m *PredictionMutation) SetPrognosis(b bool)

SetPrognosis sets the "prognosis" field.

func (*PredictionMutation) SetUpdateTime

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

SetUpdateTime sets the "update_time" field.

func (*PredictionMutation) SetUserID

func (m *PredictionMutation) SetUserID(id uuid.UUID)

SetUserID sets the "user" edge to the User entity by id.

func (PredictionMutation) Tx

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

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

func (*PredictionMutation) Type

func (m *PredictionMutation) Type() string

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

func (*PredictionMutation) UpdateTime

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

UpdateTime returns the value of the "update_time" field in the mutation.

func (*PredictionMutation) UserCleared

func (m *PredictionMutation) UserCleared() bool

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

func (*PredictionMutation) UserID

func (m *PredictionMutation) UserID() (id uuid.UUID, exists bool)

UserID returns the "user" edge ID in the mutation.

func (*PredictionMutation) UserIDs

func (m *PredictionMutation) UserIDs() (ids []uuid.UUID)

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

func (*PredictionMutation) Where

func (m *PredictionMutation) Where(ps ...predicate.Prediction)

Where appends a list predicates to the PredictionMutation builder.

type PredictionQuery

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

PredictionQuery is the builder for querying Prediction entities.

func (*PredictionQuery) All

func (pq *PredictionQuery) All(ctx context.Context) ([]*Prediction, error)

All executes the query and returns a list of Predictions.

func (*PredictionQuery) AllX

func (pq *PredictionQuery) AllX(ctx context.Context) []*Prediction

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

func (*PredictionQuery) Clone

func (pq *PredictionQuery) Clone() *PredictionQuery

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

func (*PredictionQuery) Count

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

Count returns the count of the given query.

func (*PredictionQuery) CountX

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

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

func (*PredictionQuery) Exist

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

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

func (*PredictionQuery) ExistX

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

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

func (*PredictionQuery) First

func (pq *PredictionQuery) First(ctx context.Context) (*Prediction, error)

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

func (*PredictionQuery) FirstID

func (pq *PredictionQuery) FirstID(ctx context.Context) (id uuid.UUID, err error)

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

func (*PredictionQuery) FirstIDX

func (pq *PredictionQuery) FirstIDX(ctx context.Context) uuid.UUID

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

func (*PredictionQuery) FirstX

func (pq *PredictionQuery) FirstX(ctx context.Context) *Prediction

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

func (*PredictionQuery) GroupBy

func (pq *PredictionQuery) GroupBy(field string, fields ...string) *PredictionGroupBy

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

Example:

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

client.Prediction.Query().
	GroupBy(prediction.FieldCreateTime).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*PredictionQuery) IDs

func (pq *PredictionQuery) IDs(ctx context.Context) ([]uuid.UUID, error)

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

func (*PredictionQuery) IDsX

func (pq *PredictionQuery) IDsX(ctx context.Context) []uuid.UUID

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

func (*PredictionQuery) Limit

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

Limit adds a limit step to the query.

func (*PredictionQuery) Offset

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

Offset adds an offset step to the query.

func (*PredictionQuery) Only

func (pq *PredictionQuery) Only(ctx context.Context) (*Prediction, error)

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

func (*PredictionQuery) OnlyID

func (pq *PredictionQuery) OnlyID(ctx context.Context) (id uuid.UUID, err error)

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

func (*PredictionQuery) OnlyIDX

func (pq *PredictionQuery) OnlyIDX(ctx context.Context) uuid.UUID

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

func (*PredictionQuery) OnlyX

func (pq *PredictionQuery) OnlyX(ctx context.Context) *Prediction

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

func (*PredictionQuery) Order

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

Order adds an order step to the query.

func (*PredictionQuery) QueryChallenge

func (pq *PredictionQuery) QueryChallenge() *ChallengeQuery

QueryChallenge chains the current query on the "challenge" edge.

func (*PredictionQuery) QueryUser

func (pq *PredictionQuery) QueryUser() *UserQuery

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

func (*PredictionQuery) Select

func (pq *PredictionQuery) Select(fields ...string) *PredictionSelect

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

Example:

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

client.Prediction.Query().
	Select(prediction.FieldCreateTime).
	Scan(ctx, &v)

func (*PredictionQuery) Unique

func (pq *PredictionQuery) Unique(unique bool) *PredictionQuery

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

func (*PredictionQuery) Where

Where adds a new predicate for the PredictionQuery builder.

func (*PredictionQuery) WithChallenge

func (pq *PredictionQuery) WithChallenge(opts ...func(*ChallengeQuery)) *PredictionQuery

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

func (*PredictionQuery) WithUser

func (pq *PredictionQuery) WithUser(opts ...func(*UserQuery)) *PredictionQuery

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

type PredictionSelect

type PredictionSelect struct {
	*PredictionQuery
	// contains filtered or unexported fields
}

PredictionSelect is the builder for selecting fields of Prediction entities.

func (*PredictionSelect) Bool

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

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

func (*PredictionSelect) BoolX

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

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

func (*PredictionSelect) Bools

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

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

func (*PredictionSelect) BoolsX

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

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

func (*PredictionSelect) Float64

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

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

func (*PredictionSelect) Float64X

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

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

func (*PredictionSelect) Float64s

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

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

func (*PredictionSelect) Float64sX

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

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

func (*PredictionSelect) Int

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

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

func (*PredictionSelect) IntX

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

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

func (*PredictionSelect) Ints

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

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

func (*PredictionSelect) IntsX

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

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

func (*PredictionSelect) Scan

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

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

func (*PredictionSelect) ScanX

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

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

func (*PredictionSelect) String

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

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

func (*PredictionSelect) StringX

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

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

func (*PredictionSelect) Strings

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

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

func (*PredictionSelect) StringsX

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

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

type PredictionUpdate

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

PredictionUpdate is the builder for updating Prediction entities.

func (*PredictionUpdate) ClearChallenge

func (pu *PredictionUpdate) ClearChallenge() *PredictionUpdate

ClearChallenge clears the "challenge" edge to the Challenge entity.

func (*PredictionUpdate) ClearMeta

func (pu *PredictionUpdate) ClearMeta() *PredictionUpdate

ClearMeta clears the value of the "meta" field.

func (*PredictionUpdate) ClearUser

func (pu *PredictionUpdate) ClearUser() *PredictionUpdate

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

func (*PredictionUpdate) Exec

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

Exec executes the query.

func (*PredictionUpdate) ExecX

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

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

func (*PredictionUpdate) Mutation

func (pu *PredictionUpdate) Mutation() *PredictionMutation

Mutation returns the PredictionMutation object of the builder.

func (*PredictionUpdate) Save

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

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

func (*PredictionUpdate) SaveX

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

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

func (*PredictionUpdate) SetChallenge

func (pu *PredictionUpdate) SetChallenge(c *Challenge) *PredictionUpdate

SetChallenge sets the "challenge" edge to the Challenge entity.

func (*PredictionUpdate) SetChallengeID

func (pu *PredictionUpdate) SetChallengeID(id uuid.UUID) *PredictionUpdate

SetChallengeID sets the "challenge" edge to the Challenge entity by ID.

func (*PredictionUpdate) SetMeta

func (pu *PredictionUpdate) SetMeta(m map[string]interface{}) *PredictionUpdate

SetMeta sets the "meta" field.

func (*PredictionUpdate) SetUpdateTime

func (pu *PredictionUpdate) SetUpdateTime(t time.Time) *PredictionUpdate

SetUpdateTime sets the "update_time" field.

func (*PredictionUpdate) SetUser

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

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

func (*PredictionUpdate) SetUserID

func (pu *PredictionUpdate) SetUserID(id uuid.UUID) *PredictionUpdate

SetUserID sets the "user" edge to the User entity by ID.

func (*PredictionUpdate) Where

Where appends a list predicates to the PredictionUpdate builder.

type PredictionUpdateOne

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

PredictionUpdateOne is the builder for updating a single Prediction entity.

func (*PredictionUpdateOne) ClearChallenge

func (puo *PredictionUpdateOne) ClearChallenge() *PredictionUpdateOne

ClearChallenge clears the "challenge" edge to the Challenge entity.

func (*PredictionUpdateOne) ClearMeta

func (puo *PredictionUpdateOne) ClearMeta() *PredictionUpdateOne

ClearMeta clears the value of the "meta" field.

func (*PredictionUpdateOne) ClearUser

func (puo *PredictionUpdateOne) ClearUser() *PredictionUpdateOne

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

func (*PredictionUpdateOne) Exec

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

Exec executes the query on the entity.

func (*PredictionUpdateOne) ExecX

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

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

func (*PredictionUpdateOne) Mutation

func (puo *PredictionUpdateOne) Mutation() *PredictionMutation

Mutation returns the PredictionMutation object of the builder.

func (*PredictionUpdateOne) Save

func (puo *PredictionUpdateOne) Save(ctx context.Context) (*Prediction, error)

Save executes the query and returns the updated Prediction entity.

func (*PredictionUpdateOne) SaveX

func (puo *PredictionUpdateOne) SaveX(ctx context.Context) *Prediction

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

func (*PredictionUpdateOne) Select

func (puo *PredictionUpdateOne) Select(field string, fields ...string) *PredictionUpdateOne

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

func (*PredictionUpdateOne) SetChallenge

func (puo *PredictionUpdateOne) SetChallenge(c *Challenge) *PredictionUpdateOne

SetChallenge sets the "challenge" edge to the Challenge entity.

func (*PredictionUpdateOne) SetChallengeID

func (puo *PredictionUpdateOne) SetChallengeID(id uuid.UUID) *PredictionUpdateOne

SetChallengeID sets the "challenge" edge to the Challenge entity by ID.

func (*PredictionUpdateOne) SetMeta

func (puo *PredictionUpdateOne) SetMeta(m map[string]interface{}) *PredictionUpdateOne

SetMeta sets the "meta" field.

func (*PredictionUpdateOne) SetUpdateTime

func (puo *PredictionUpdateOne) SetUpdateTime(t time.Time) *PredictionUpdateOne

SetUpdateTime sets the "update_time" field.

func (*PredictionUpdateOne) SetUser

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

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

func (*PredictionUpdateOne) SetUserID

func (puo *PredictionUpdateOne) SetUserID(id uuid.UUID) *PredictionUpdateOne

SetUserID sets the "user" edge to the User entity by ID.

type Predictions

type Predictions []*Prediction

Predictions is a parsable slice of Prediction.

type Proof

type Proof struct {

	// ID of the ent.
	ID uuid.UUID `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"`
	// Content holds the value of the "content" field.
	Content string `json:"content,omitempty"`
	// Link holds the value of the "link" field.
	Link string `json:"link,omitempty"`
	// Meta holds the value of the "meta" field.
	Meta map[string]interface{} `json:"meta,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the ProofQuery when eager-loading is set.
	Edges ProofEdges `json:"edges"`
	// contains filtered or unexported fields
}

Proof is the model entity for the Proof schema.

func (*Proof) QueryChallenge

func (pr *Proof) QueryChallenge() *ChallengeQuery

QueryChallenge queries the "challenge" edge of the Proof entity.

func (*Proof) String

func (pr *Proof) String() string

String implements the fmt.Stringer.

func (*Proof) Unwrap

func (pr *Proof) Unwrap() *Proof

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

func (*Proof) Update

func (pr *Proof) Update() *ProofUpdateOne

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

type ProofClient

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

ProofClient is a client for the Proof schema.

func NewProofClient

func NewProofClient(c config) *ProofClient

NewProofClient returns a client for the Proof from the given config.

func (*ProofClient) Create

func (c *ProofClient) Create() *ProofCreate

Create returns a create builder for Proof.

func (*ProofClient) CreateBulk

func (c *ProofClient) CreateBulk(builders ...*ProofCreate) *ProofCreateBulk

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

func (*ProofClient) Delete

func (c *ProofClient) Delete() *ProofDelete

Delete returns a delete builder for Proof.

func (*ProofClient) DeleteOne

func (c *ProofClient) DeleteOne(pr *Proof) *ProofDeleteOne

DeleteOne returns a delete builder for the given entity.

func (*ProofClient) DeleteOneID

func (c *ProofClient) DeleteOneID(id uuid.UUID) *ProofDeleteOne

DeleteOneID returns a delete builder for the given id.

func (*ProofClient) Get

func (c *ProofClient) Get(ctx context.Context, id uuid.UUID) (*Proof, error)

Get returns a Proof entity by its id.

func (*ProofClient) GetX

func (c *ProofClient) GetX(ctx context.Context, id uuid.UUID) *Proof

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

func (*ProofClient) Hooks

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

Hooks returns the client hooks.

func (*ProofClient) Query

func (c *ProofClient) Query() *ProofQuery

Query returns a query builder for Proof.

func (*ProofClient) QueryChallenge

func (c *ProofClient) QueryChallenge(pr *Proof) *ChallengeQuery

QueryChallenge queries the challenge edge of a Proof.

func (*ProofClient) Update

func (c *ProofClient) Update() *ProofUpdate

Update returns an update builder for Proof.

func (*ProofClient) UpdateOne

func (c *ProofClient) UpdateOne(pr *Proof) *ProofUpdateOne

UpdateOne returns an update builder for the given entity.

func (*ProofClient) UpdateOneID

func (c *ProofClient) UpdateOneID(id uuid.UUID) *ProofUpdateOne

UpdateOneID returns an update builder for the given id.

func (*ProofClient) Use

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

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

type ProofCreate

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

ProofCreate is the builder for creating a Proof entity.

func (*ProofCreate) Exec

func (pc *ProofCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*ProofCreate) ExecX

func (pc *ProofCreate) ExecX(ctx context.Context)

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

func (*ProofCreate) Mutation

func (pc *ProofCreate) Mutation() *ProofMutation

Mutation returns the ProofMutation object of the builder.

func (*ProofCreate) Save

func (pc *ProofCreate) Save(ctx context.Context) (*Proof, error)

Save creates the Proof in the database.

func (*ProofCreate) SaveX

func (pc *ProofCreate) SaveX(ctx context.Context) *Proof

SaveX calls Save and panics if Save returns an error.

func (*ProofCreate) SetChallenge

func (pc *ProofCreate) SetChallenge(c *Challenge) *ProofCreate

SetChallenge sets the "challenge" edge to the Challenge entity.

func (*ProofCreate) SetChallengeID

func (pc *ProofCreate) SetChallengeID(id uuid.UUID) *ProofCreate

SetChallengeID sets the "challenge" edge to the Challenge entity by ID.

func (*ProofCreate) SetContent

func (pc *ProofCreate) SetContent(s string) *ProofCreate

SetContent sets the "content" field.

func (*ProofCreate) SetCreateTime

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

SetCreateTime sets the "create_time" field.

func (*ProofCreate) SetID

func (pc *ProofCreate) SetID(u uuid.UUID) *ProofCreate

SetID sets the "id" field.

func (pc *ProofCreate) SetLink(s string) *ProofCreate

SetLink sets the "link" field.

func (*ProofCreate) SetMeta

func (pc *ProofCreate) SetMeta(m map[string]interface{}) *ProofCreate

SetMeta sets the "meta" field.

func (*ProofCreate) SetNillableCreateTime

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

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

func (*ProofCreate) SetNillableID

func (pc *ProofCreate) SetNillableID(u *uuid.UUID) *ProofCreate

SetNillableID sets the "id" field if the given value is not nil.

func (*ProofCreate) SetNillableUpdateTime

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

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

func (*ProofCreate) SetUpdateTime

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

SetUpdateTime sets the "update_time" field.

type ProofCreateBulk

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

ProofCreateBulk is the builder for creating many Proof entities in bulk.

func (*ProofCreateBulk) Exec

func (pcb *ProofCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*ProofCreateBulk) ExecX

func (pcb *ProofCreateBulk) ExecX(ctx context.Context)

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

func (*ProofCreateBulk) Save

func (pcb *ProofCreateBulk) Save(ctx context.Context) ([]*Proof, error)

Save creates the Proof entities in the database.

func (*ProofCreateBulk) SaveX

func (pcb *ProofCreateBulk) SaveX(ctx context.Context) []*Proof

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

type ProofDelete

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

ProofDelete is the builder for deleting a Proof entity.

func (*ProofDelete) Exec

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

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

func (*ProofDelete) ExecX

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

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

func (*ProofDelete) Where

func (pd *ProofDelete) Where(ps ...predicate.Proof) *ProofDelete

Where appends a list predicates to the ProofDelete builder.

type ProofDeleteOne

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

ProofDeleteOne is the builder for deleting a single Proof entity.

func (*ProofDeleteOne) Exec

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

Exec executes the deletion query.

func (*ProofDeleteOne) ExecX

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

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

type ProofEdges

type ProofEdges struct {
	// Challenge holds the value of the challenge edge.
	Challenge *Challenge `json:"challenge,omitempty"`
	// contains filtered or unexported fields
}

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

func (ProofEdges) ChallengeOrErr

func (e ProofEdges) ChallengeOrErr() (*Challenge, error)

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

type ProofGroupBy

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

ProofGroupBy is the group-by builder for Proof entities.

func (*ProofGroupBy) Aggregate

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

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

func (*ProofGroupBy) Bool

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

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

func (*ProofGroupBy) BoolX

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

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

func (*ProofGroupBy) Bools

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

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

func (*ProofGroupBy) BoolsX

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

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

func (*ProofGroupBy) Float64

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

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

func (*ProofGroupBy) Float64X

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

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

func (*ProofGroupBy) Float64s

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

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

func (*ProofGroupBy) Float64sX

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

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

func (*ProofGroupBy) Int

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

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

func (*ProofGroupBy) IntX

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

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

func (*ProofGroupBy) Ints

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

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

func (*ProofGroupBy) IntsX

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

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

func (*ProofGroupBy) Scan

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

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

func (*ProofGroupBy) ScanX

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

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

func (*ProofGroupBy) String

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

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

func (*ProofGroupBy) StringX

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

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

func (*ProofGroupBy) Strings

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

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

func (*ProofGroupBy) StringsX

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

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

type ProofMutation

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

ProofMutation represents an operation that mutates the Proof nodes in the graph.

func (*ProofMutation) AddField

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

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

func (*ProofMutation) AddedEdges

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

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

func (*ProofMutation) AddedField

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

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

func (*ProofMutation) AddedFields

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

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

func (*ProofMutation) AddedIDs

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

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

func (*ProofMutation) ChallengeCleared

func (m *ProofMutation) ChallengeCleared() bool

ChallengeCleared reports if the "challenge" edge to the Challenge entity was cleared.

func (*ProofMutation) ChallengeID

func (m *ProofMutation) ChallengeID() (id uuid.UUID, exists bool)

ChallengeID returns the "challenge" edge ID in the mutation.

func (*ProofMutation) ChallengeIDs

func (m *ProofMutation) ChallengeIDs() (ids []uuid.UUID)

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

func (*ProofMutation) ClearChallenge

func (m *ProofMutation) ClearChallenge()

ClearChallenge clears the "challenge" edge to the Challenge entity.

func (*ProofMutation) ClearEdge

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

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

func (*ProofMutation) ClearField

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

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

func (*ProofMutation) ClearMeta

func (m *ProofMutation) ClearMeta()

ClearMeta clears the value of the "meta" field.

func (*ProofMutation) ClearedEdges

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

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

func (*ProofMutation) ClearedFields

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

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

func (ProofMutation) Client

func (m ProofMutation) 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 (*ProofMutation) Content

func (m *ProofMutation) Content() (r string, exists bool)

Content returns the value of the "content" field in the mutation.

func (*ProofMutation) CreateTime

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

CreateTime returns the value of the "create_time" field in the mutation.

func (*ProofMutation) EdgeCleared

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

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

func (*ProofMutation) Field

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

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

func (*ProofMutation) FieldCleared

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

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

func (*ProofMutation) Fields

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

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

func (*ProofMutation) ID

func (m *ProofMutation) ID() (id uuid.UUID, exists bool)

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

func (*ProofMutation) IDs

func (m *ProofMutation) IDs(ctx context.Context) ([]uuid.UUID, error)

IDs queries the database and returns the entity ids that match the mutation's predicate. That means, if the mutation is applied within a transaction with an isolation level such as sql.LevelSerializable, the returned ids match the ids of the rows that will be updated or updated by the mutation.

func (m *ProofMutation) Link() (r string, exists bool)

Link returns the value of the "link" field in the mutation.

func (*ProofMutation) Meta

func (m *ProofMutation) Meta() (r map[string]interface{}, exists bool)

Meta returns the value of the "meta" field in the mutation.

func (*ProofMutation) MetaCleared

func (m *ProofMutation) MetaCleared() bool

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

func (*ProofMutation) OldContent

func (m *ProofMutation) OldContent(ctx context.Context) (v string, err error)

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

func (*ProofMutation) OldCreateTime

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

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

func (*ProofMutation) OldField

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

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

func (m *ProofMutation) OldLink(ctx context.Context) (v string, err error)

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

func (*ProofMutation) OldMeta

func (m *ProofMutation) OldMeta(ctx context.Context) (v map[string]interface{}, err error)

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

func (*ProofMutation) OldUpdateTime

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

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

func (*ProofMutation) Op

func (m *ProofMutation) Op() Op

Op returns the operation name.

func (*ProofMutation) RemovedEdges

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

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

func (*ProofMutation) RemovedIDs

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

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

func (*ProofMutation) ResetChallenge

func (m *ProofMutation) ResetChallenge()

ResetChallenge resets all changes to the "challenge" edge.

func (*ProofMutation) ResetContent

func (m *ProofMutation) ResetContent()

ResetContent resets all changes to the "content" field.

func (*ProofMutation) ResetCreateTime

func (m *ProofMutation) ResetCreateTime()

ResetCreateTime resets all changes to the "create_time" field.

func (*ProofMutation) ResetEdge

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

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

func (*ProofMutation) ResetField

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

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

func (m *ProofMutation) ResetLink()

ResetLink resets all changes to the "link" field.

func (*ProofMutation) ResetMeta

func (m *ProofMutation) ResetMeta()

ResetMeta resets all changes to the "meta" field.

func (*ProofMutation) ResetUpdateTime

func (m *ProofMutation) ResetUpdateTime()

ResetUpdateTime resets all changes to the "update_time" field.

func (*ProofMutation) SetChallengeID

func (m *ProofMutation) SetChallengeID(id uuid.UUID)

SetChallengeID sets the "challenge" edge to the Challenge entity by id.

func (*ProofMutation) SetContent

func (m *ProofMutation) SetContent(s string)

SetContent sets the "content" field.

func (*ProofMutation) SetCreateTime

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

SetCreateTime sets the "create_time" field.

func (*ProofMutation) SetField

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

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

func (*ProofMutation) SetID

func (m *ProofMutation) SetID(id uuid.UUID)

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

func (m *ProofMutation) SetLink(s string)

SetLink sets the "link" field.

func (*ProofMutation) SetMeta

func (m *ProofMutation) SetMeta(value map[string]interface{})

SetMeta sets the "meta" field.

func (*ProofMutation) SetUpdateTime

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

SetUpdateTime sets the "update_time" field.

func (ProofMutation) Tx

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

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

func (*ProofMutation) Type

func (m *ProofMutation) Type() string

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

func (*ProofMutation) UpdateTime

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

UpdateTime returns the value of the "update_time" field in the mutation.

func (*ProofMutation) Where

func (m *ProofMutation) Where(ps ...predicate.Proof)

Where appends a list predicates to the ProofMutation builder.

type ProofQuery

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

ProofQuery is the builder for querying Proof entities.

func (*ProofQuery) All

func (pq *ProofQuery) All(ctx context.Context) ([]*Proof, error)

All executes the query and returns a list of Proofs.

func (*ProofQuery) AllX

func (pq *ProofQuery) AllX(ctx context.Context) []*Proof

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

func (*ProofQuery) Clone

func (pq *ProofQuery) Clone() *ProofQuery

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

func (*ProofQuery) Count

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

Count returns the count of the given query.

func (*ProofQuery) CountX

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

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

func (*ProofQuery) Exist

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

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

func (*ProofQuery) ExistX

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

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

func (*ProofQuery) First

func (pq *ProofQuery) First(ctx context.Context) (*Proof, error)

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

func (*ProofQuery) FirstID

func (pq *ProofQuery) FirstID(ctx context.Context) (id uuid.UUID, err error)

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

func (*ProofQuery) FirstIDX

func (pq *ProofQuery) FirstIDX(ctx context.Context) uuid.UUID

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

func (*ProofQuery) FirstX

func (pq *ProofQuery) FirstX(ctx context.Context) *Proof

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

func (*ProofQuery) GroupBy

func (pq *ProofQuery) GroupBy(field string, fields ...string) *ProofGroupBy

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

Example:

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

client.Proof.Query().
	GroupBy(proof.FieldCreateTime).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*ProofQuery) IDs

func (pq *ProofQuery) IDs(ctx context.Context) ([]uuid.UUID, error)

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

func (*ProofQuery) IDsX

func (pq *ProofQuery) IDsX(ctx context.Context) []uuid.UUID

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

func (*ProofQuery) Limit

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

Limit adds a limit step to the query.

func (*ProofQuery) Offset

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

Offset adds an offset step to the query.

func (*ProofQuery) Only

func (pq *ProofQuery) Only(ctx context.Context) (*Proof, error)

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

func (*ProofQuery) OnlyID

func (pq *ProofQuery) OnlyID(ctx context.Context) (id uuid.UUID, err error)

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

func (*ProofQuery) OnlyIDX

func (pq *ProofQuery) OnlyIDX(ctx context.Context) uuid.UUID

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

func (*ProofQuery) OnlyX

func (pq *ProofQuery) OnlyX(ctx context.Context) *Proof

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

func (*ProofQuery) Order

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

Order adds an order step to the query.

func (*ProofQuery) QueryChallenge

func (pq *ProofQuery) QueryChallenge() *ChallengeQuery

QueryChallenge chains the current query on the "challenge" edge.

func (*ProofQuery) Select

func (pq *ProofQuery) Select(fields ...string) *ProofSelect

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

Example:

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

client.Proof.Query().
	Select(proof.FieldCreateTime).
	Scan(ctx, &v)

func (*ProofQuery) Unique

func (pq *ProofQuery) Unique(unique bool) *ProofQuery

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

func (*ProofQuery) Where

func (pq *ProofQuery) Where(ps ...predicate.Proof) *ProofQuery

Where adds a new predicate for the ProofQuery builder.

func (*ProofQuery) WithChallenge

func (pq *ProofQuery) WithChallenge(opts ...func(*ChallengeQuery)) *ProofQuery

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

type ProofSelect

type ProofSelect struct {
	*ProofQuery
	// contains filtered or unexported fields
}

ProofSelect is the builder for selecting fields of Proof entities.

func (*ProofSelect) Bool

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

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

func (*ProofSelect) BoolX

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

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

func (*ProofSelect) Bools

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

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

func (*ProofSelect) BoolsX

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

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

func (*ProofSelect) Float64

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

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

func (*ProofSelect) Float64X

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

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

func (*ProofSelect) Float64s

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

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

func (*ProofSelect) Float64sX

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

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

func (*ProofSelect) Int

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

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

func (*ProofSelect) IntX

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

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

func (*ProofSelect) Ints

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

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

func (*ProofSelect) IntsX

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

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

func (*ProofSelect) Scan

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

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

func (*ProofSelect) ScanX

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

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

func (*ProofSelect) String

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

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

func (*ProofSelect) StringX

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

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

func (*ProofSelect) Strings

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

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

func (*ProofSelect) StringsX

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

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

type ProofUpdate

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

ProofUpdate is the builder for updating Proof entities.

func (*ProofUpdate) ClearChallenge

func (pu *ProofUpdate) ClearChallenge() *ProofUpdate

ClearChallenge clears the "challenge" edge to the Challenge entity.

func (*ProofUpdate) ClearMeta

func (pu *ProofUpdate) ClearMeta() *ProofUpdate

ClearMeta clears the value of the "meta" field.

func (*ProofUpdate) Exec

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

Exec executes the query.

func (*ProofUpdate) ExecX

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

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

func (*ProofUpdate) Mutation

func (pu *ProofUpdate) Mutation() *ProofMutation

Mutation returns the ProofMutation object of the builder.

func (*ProofUpdate) Save

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

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

func (*ProofUpdate) SaveX

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

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

func (*ProofUpdate) SetChallenge

func (pu *ProofUpdate) SetChallenge(c *Challenge) *ProofUpdate

SetChallenge sets the "challenge" edge to the Challenge entity.

func (*ProofUpdate) SetChallengeID

func (pu *ProofUpdate) SetChallengeID(id uuid.UUID) *ProofUpdate

SetChallengeID sets the "challenge" edge to the Challenge entity by ID.

func (*ProofUpdate) SetMeta

func (pu *ProofUpdate) SetMeta(m map[string]interface{}) *ProofUpdate

SetMeta sets the "meta" field.

func (*ProofUpdate) SetUpdateTime

func (pu *ProofUpdate) SetUpdateTime(t time.Time) *ProofUpdate

SetUpdateTime sets the "update_time" field.

func (*ProofUpdate) Where

func (pu *ProofUpdate) Where(ps ...predicate.Proof) *ProofUpdate

Where appends a list predicates to the ProofUpdate builder.

type ProofUpdateOne

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

ProofUpdateOne is the builder for updating a single Proof entity.

func (*ProofUpdateOne) ClearChallenge

func (puo *ProofUpdateOne) ClearChallenge() *ProofUpdateOne

ClearChallenge clears the "challenge" edge to the Challenge entity.

func (*ProofUpdateOne) ClearMeta

func (puo *ProofUpdateOne) ClearMeta() *ProofUpdateOne

ClearMeta clears the value of the "meta" field.

func (*ProofUpdateOne) Exec

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

Exec executes the query on the entity.

func (*ProofUpdateOne) ExecX

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

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

func (*ProofUpdateOne) Mutation

func (puo *ProofUpdateOne) Mutation() *ProofMutation

Mutation returns the ProofMutation object of the builder.

func (*ProofUpdateOne) Save

func (puo *ProofUpdateOne) Save(ctx context.Context) (*Proof, error)

Save executes the query and returns the updated Proof entity.

func (*ProofUpdateOne) SaveX

func (puo *ProofUpdateOne) SaveX(ctx context.Context) *Proof

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

func (*ProofUpdateOne) Select

func (puo *ProofUpdateOne) Select(field string, fields ...string) *ProofUpdateOne

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

func (*ProofUpdateOne) SetChallenge

func (puo *ProofUpdateOne) SetChallenge(c *Challenge) *ProofUpdateOne

SetChallenge sets the "challenge" edge to the Challenge entity.

func (*ProofUpdateOne) SetChallengeID

func (puo *ProofUpdateOne) SetChallengeID(id uuid.UUID) *ProofUpdateOne

SetChallengeID sets the "challenge" edge to the Challenge entity by ID.

func (*ProofUpdateOne) SetMeta

func (puo *ProofUpdateOne) SetMeta(m map[string]interface{}) *ProofUpdateOne

SetMeta sets the "meta" field.

func (*ProofUpdateOne) SetUpdateTime

func (puo *ProofUpdateOne) SetUpdateTime(t time.Time) *ProofUpdateOne

SetUpdateTime sets the "update_time" field.

type Proofs

type Proofs []*Proof

Proofs is a parsable slice of Proof.

type Query

type Query = ent.Query

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

type RollbackFunc

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

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

func (RollbackFunc) Rollback

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

Rollback calls f(ctx, m).

type RollbackHook

type RollbackHook func(Rollbacker) Rollbacker

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

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

type Rollbacker

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

Rollbacker is the interface that wraps the Rollback method.

type Tx

type Tx struct {

	// Badge is the client for interacting with the Badge builders.
	Badge *BadgeClient
	// Challenge is the client for interacting with the Challenge builders.
	Challenge *ChallengeClient
	// Prediction is the client for interacting with the Prediction builders.
	Prediction *PredictionClient
	// Proof is the client for interacting with the Proof builders.
	Proof *ProofClient
	// User is the client for interacting with the User builders.
	User *UserClient
	// UserSession is the client for interacting with the UserSession builders.
	UserSession *UserSessionClient
	// contains filtered or unexported fields
}

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

func TxFromContext

func TxFromContext(ctx context.Context) *Tx

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

func (*Tx) Client

func (tx *Tx) Client() *Client

Client returns a Client that binds to current transaction.

func (*Tx) Commit

func (tx *Tx) Commit() error

Commit commits the transaction.

func (*Tx) OnCommit

func (tx *Tx) OnCommit(f CommitHook)

OnCommit adds a hook to call on commit.

func (*Tx) OnRollback

func (tx *Tx) OnRollback(f RollbackHook)

OnRollback adds a hook to call on rollback.

func (*Tx) Rollback

func (tx *Tx) Rollback() error

Rollback rollbacks the transaction.

type User

type User struct {

	// ID of the ent.
	ID uuid.UUID `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"`
	// Name holds the value of the "name" field.
	Name string `json:"name,omitempty"`
	// Email holds the value of the "email" field.
	Email string `json:"email,omitempty"`
	// Picture holds the value of the "picture" field.
	Picture string `json:"picture,omitempty"`
	// Admin holds the value of the "admin" field.
	Admin bool `json:"admin,omitempty"`
	// PasswordHash holds the value of the "password_hash" field.
	PasswordHash string `json:"password_hash,omitempty"`
	// Locale holds the value of the "locale" field.
	Locale user.Locale `json:"locale,omitempty"`
	// Meta holds the value of the "meta" field.
	Meta map[string]interface{} `json:"meta,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the UserQuery when eager-loading is set.
	Edges UserEdges `json:"edges"`
	// contains filtered or unexported fields
}

User is the model entity for the User schema.

func (*User) QueryBadges

func (u *User) QueryBadges() *BadgeQuery

QueryBadges queries the "badges" edge of the User entity.

func (*User) QueryChallenges

func (u *User) QueryChallenges() *ChallengeQuery

QueryChallenges queries the "challenges" edge of the User entity.

func (*User) QueryPredictions

func (u *User) QueryPredictions() *PredictionQuery

QueryPredictions queries the "predictions" edge of the User entity.

func (*User) QuerySessions

func (u *User) QuerySessions() *UserSessionQuery

QuerySessions queries the "sessions" edge of the User entity.

func (*User) String

func (u *User) String() string

String implements the fmt.Stringer.

func (*User) Unwrap

func (u *User) Unwrap() *User

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

func (*User) Update

func (u *User) Update() *UserUpdateOne

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

type UserClient

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

UserClient is a client for the User schema.

func NewUserClient

func NewUserClient(c config) *UserClient

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

func (*UserClient) Create

func (c *UserClient) Create() *UserCreate

Create returns a create builder for User.

func (*UserClient) CreateBulk

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

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

func (*UserClient) Delete

func (c *UserClient) Delete() *UserDelete

Delete returns a delete builder for User.

func (*UserClient) DeleteOne

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

DeleteOne returns a delete builder for the given entity.

func (*UserClient) DeleteOneID

func (c *UserClient) DeleteOneID(id uuid.UUID) *UserDeleteOne

DeleteOneID returns a delete builder for the given id.

func (*UserClient) Get

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

Get returns a User entity by its id.

func (*UserClient) GetX

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

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

func (*UserClient) Hooks

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

Hooks returns the client hooks.

func (*UserClient) Query

func (c *UserClient) Query() *UserQuery

Query returns a query builder for User.

func (*UserClient) QueryBadges

func (c *UserClient) QueryBadges(u *User) *BadgeQuery

QueryBadges queries the badges edge of a User.

func (*UserClient) QueryChallenges

func (c *UserClient) QueryChallenges(u *User) *ChallengeQuery

QueryChallenges queries the challenges edge of a User.

func (*UserClient) QueryPredictions

func (c *UserClient) QueryPredictions(u *User) *PredictionQuery

QueryPredictions queries the predictions edge of a User.

func (*UserClient) QuerySessions

func (c *UserClient) QuerySessions(u *User) *UserSessionQuery

QuerySessions queries the sessions edge of a User.

func (*UserClient) Update

func (c *UserClient) Update() *UserUpdate

Update returns an update builder for User.

func (*UserClient) UpdateOne

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

UpdateOne returns an update builder for the given entity.

func (*UserClient) UpdateOneID

func (c *UserClient) UpdateOneID(id uuid.UUID) *UserUpdateOne

UpdateOneID returns an update builder for the given id.

func (*UserClient) Use

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

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

type UserCreate

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

UserCreate is the builder for creating a User entity.

func (*UserCreate) AddBadgeIDs

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

AddBadgeIDs adds the "badges" edge to the Badge entity by IDs.

func (*UserCreate) AddBadges

func (uc *UserCreate) AddBadges(b ...*Badge) *UserCreate

AddBadges adds the "badges" edges to the Badge entity.

func (*UserCreate) AddChallengeIDs

func (uc *UserCreate) AddChallengeIDs(ids ...uuid.UUID) *UserCreate

AddChallengeIDs adds the "challenges" edge to the Challenge entity by IDs.

func (*UserCreate) AddChallenges

func (uc *UserCreate) AddChallenges(c ...*Challenge) *UserCreate

AddChallenges adds the "challenges" edges to the Challenge entity.

func (*UserCreate) AddPredictionIDs

func (uc *UserCreate) AddPredictionIDs(ids ...uuid.UUID) *UserCreate

AddPredictionIDs adds the "predictions" edge to the Prediction entity by IDs.

func (*UserCreate) AddPredictions

func (uc *UserCreate) AddPredictions(p ...*Prediction) *UserCreate

AddPredictions adds the "predictions" edges to the Prediction entity.

func (*UserCreate) AddSessionIDs

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

AddSessionIDs adds the "sessions" edge to the UserSession entity by IDs.

func (*UserCreate) AddSessions

func (uc *UserCreate) AddSessions(u ...*UserSession) *UserCreate

AddSessions adds the "sessions" edges to the UserSession entity.

func (*UserCreate) Exec

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

Exec executes the query.

func (*UserCreate) ExecX

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

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

func (*UserCreate) Mutation

func (uc *UserCreate) Mutation() *UserMutation

Mutation returns the UserMutation object of the builder.

func (*UserCreate) Save

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

Save creates the User in the database.

func (*UserCreate) SaveX

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

SaveX calls Save and panics if Save returns an error.

func (*UserCreate) SetAdmin

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

SetAdmin sets the "admin" field.

func (*UserCreate) SetCreateTime

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

SetCreateTime sets the "create_time" field.

func (*UserCreate) SetEmail

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

SetEmail sets the "email" field.

func (*UserCreate) SetID

func (uc *UserCreate) SetID(u uuid.UUID) *UserCreate

SetID sets the "id" field.

func (*UserCreate) SetLocale

func (uc *UserCreate) SetLocale(u user.Locale) *UserCreate

SetLocale sets the "locale" field.

func (*UserCreate) SetMeta

func (uc *UserCreate) SetMeta(m map[string]interface{}) *UserCreate

SetMeta sets the "meta" field.

func (*UserCreate) SetName

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

SetName sets the "name" field.

func (*UserCreate) SetNillableAdmin

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

SetNillableAdmin sets the "admin" field if the given value is not nil.

func (*UserCreate) SetNillableCreateTime

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

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

func (*UserCreate) SetNillableID

func (uc *UserCreate) SetNillableID(u *uuid.UUID) *UserCreate

SetNillableID sets the "id" field if the given value is not nil.

func (*UserCreate) SetNillableLocale

func (uc *UserCreate) SetNillableLocale(u *user.Locale) *UserCreate

SetNillableLocale sets the "locale" field if the given value is not nil.

func (*UserCreate) SetNillablePicture

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

SetNillablePicture sets the "picture" field if the given value is not nil.

func (*UserCreate) SetNillableUpdateTime

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

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

func (*UserCreate) SetPasswordHash

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

SetPasswordHash sets the "password_hash" field.

func (*UserCreate) SetPicture

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

SetPicture sets the "picture" field.

func (*UserCreate) SetUpdateTime

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

SetUpdateTime sets the "update_time" field.

type UserCreateBulk

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

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

func (*UserCreateBulk) Exec

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

Exec executes the query.

func (*UserCreateBulk) ExecX

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

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

func (*UserCreateBulk) Save

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

Save creates the User entities in the database.

func (*UserCreateBulk) SaveX

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

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

type UserDelete

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

UserDelete is the builder for deleting a User entity.

func (*UserDelete) Exec

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

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

func (*UserDelete) ExecX

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

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

func (*UserDelete) Where

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

Where appends a list predicates to the UserDelete builder.

type UserDeleteOne

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

UserDeleteOne is the builder for deleting a single User entity.

func (*UserDeleteOne) Exec

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

Exec executes the deletion query.

func (*UserDeleteOne) ExecX

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

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

type UserEdges

type UserEdges struct {
	// Predictions holds the value of the predictions edge.
	Predictions []*Prediction `json:"predictions,omitempty"`
	// Sessions holds the value of the sessions edge.
	Sessions []*UserSession `json:"sessions,omitempty"`
	// Badges holds the value of the badges edge.
	Badges []*Badge `json:"badges,omitempty"`
	// Challenges holds the value of the challenges edge.
	Challenges []*Challenge `json:"challenges,omitempty"`
	// contains filtered or unexported fields
}

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

func (UserEdges) BadgesOrErr

func (e UserEdges) BadgesOrErr() ([]*Badge, error)

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

func (UserEdges) ChallengesOrErr

func (e UserEdges) ChallengesOrErr() ([]*Challenge, error)

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

func (UserEdges) PredictionsOrErr

func (e UserEdges) PredictionsOrErr() ([]*Prediction, error)

PredictionsOrErr returns the Predictions value or an error if the edge was not loaded in eager-loading.

func (UserEdges) SessionsOrErr

func (e UserEdges) SessionsOrErr() ([]*UserSession, error)

SessionsOrErr returns the Sessions value or an error if the edge was not loaded in eager-loading.

type UserGroupBy

type UserGroupBy struct {
	// contains filtered or unexported fields
}

UserGroupBy is the group-by builder for User entities.

func (*UserGroupBy) Aggregate

func (ugb *UserGroupBy) Aggregate(fns ...AggregateFunc) *UserGroupBy

Aggregate adds the given aggregation functions to the group-by query.

func (*UserGroupBy) Bool

func (ugb *UserGroupBy) Bool(ctx context.Context) (_ bool, err error)

Bool returns a single bool from a group-by query. It is only allowed when executing a group-by query with one field.

func (*UserGroupBy) BoolX

func (ugb *UserGroupBy) BoolX(ctx context.Context) bool

BoolX is like Bool, but panics if an error occurs.

func (*UserGroupBy) Bools

func (ugb *UserGroupBy) Bools(ctx context.Context) ([]bool, error)

Bools returns list of bools from group-by. It is only allowed when executing a group-by query with one field.

func (*UserGroupBy) BoolsX

func (ugb *UserGroupBy) BoolsX(ctx context.Context) []bool

BoolsX is like Bools, but panics if an error occurs.

func (*UserGroupBy) Float64

func (ugb *UserGroupBy) Float64(ctx context.Context) (_ float64, err error)

Float64 returns a single float64 from a group-by query. It is only allowed when executing a group-by query with one field.

func (*UserGroupBy) Float64X

func (ugb *UserGroupBy) Float64X(ctx context.Context) float64

Float64X is like Float64, but panics if an error occurs.

func (*UserGroupBy) Float64s

func (ugb *UserGroupBy) Float64s(ctx context.Context) ([]float64, error)

Float64s returns list of float64s from group-by. It is only allowed when executing a group-by query with one field.

func (*UserGroupBy) Float64sX

func (ugb *UserGroupBy) Float64sX(ctx context.Context) []float64

Float64sX is like Float64s, but panics if an error occurs.

func (*UserGroupBy) Int

func (ugb *UserGroupBy) Int(ctx context.Context) (_ int, err error)

Int returns a single int from a group-by query. It is only allowed when executing a group-by query with one field.

func (*UserGroupBy) IntX

func (ugb *UserGroupBy) IntX(ctx context.Context) int

IntX is like Int, but panics if an error occurs.

func (*UserGroupBy) Ints

func (ugb *UserGroupBy) Ints(ctx context.Context) ([]int, error)

Ints returns list of ints from group-by. It is only allowed when executing a group-by query with one field.

func (*UserGroupBy) IntsX

func (ugb *UserGroupBy) IntsX(ctx context.Context) []int

IntsX is like Ints, but panics if an error occurs.

func (*UserGroupBy) Scan

func (ugb *UserGroupBy) Scan(ctx context.Context, v interface{}) error

Scan applies the group-by query and scans the result into the given value.

func (*UserGroupBy) ScanX

func (ugb *UserGroupBy) ScanX(ctx context.Context, v interface{})

ScanX is like Scan, but panics if an error occurs.

func (*UserGroupBy) String

func (ugb *UserGroupBy) String(ctx context.Context) (_ string, err error)

String returns a single string from a group-by query. It is only allowed when executing a group-by query with one field.

func (*UserGroupBy) StringX

func (ugb *UserGroupBy) StringX(ctx context.Context) string

StringX is like String, but panics if an error occurs.

func (*UserGroupBy) Strings

func (ugb *UserGroupBy) Strings(ctx context.Context) ([]string, error)

Strings returns list of strings from group-by. It is only allowed when executing a group-by query with one field.

func (*UserGroupBy) StringsX

func (ugb *UserGroupBy) StringsX(ctx context.Context) []string

StringsX is like Strings, but panics if an error occurs.

type UserMutation

type UserMutation struct {
	// contains filtered or unexported fields
}

UserMutation represents an operation that mutates the User nodes in the graph.

func (*UserMutation) AddBadgeIDs

func (m *UserMutation) AddBadgeIDs(ids ...int)

AddBadgeIDs adds the "badges" edge to the Badge entity by ids.

func (*UserMutation) AddChallengeIDs

func (m *UserMutation) AddChallengeIDs(ids ...uuid.UUID)

AddChallengeIDs adds the "challenges" edge to the Challenge entity by ids.

func (*UserMutation) AddField

func (m *UserMutation) AddField(name string, value ent.Value) error

AddField adds the value to the field with the given name. It returns an error if the field is not defined in the schema, or if the type mismatched the field type.

func (*UserMutation) AddPredictionIDs

func (m *UserMutation) AddPredictionIDs(ids ...uuid.UUID)

AddPredictionIDs adds the "predictions" edge to the Prediction entity by ids.

func (*UserMutation) AddSessionIDs

func (m *UserMutation) AddSessionIDs(ids ...int)

AddSessionIDs adds the "sessions" edge to the UserSession entity by ids.

func (*UserMutation) AddedEdges

func (m *UserMutation) AddedEdges() []string

AddedEdges returns all edge names that were set/added in this mutation.

func (*UserMutation) AddedField

func (m *UserMutation) AddedField(name string) (ent.Value, bool)

AddedField returns the numeric value that was incremented/decremented on a field with the given name. The second boolean return value indicates that this field was not set, or was not defined in the schema.

func (*UserMutation) AddedFields

func (m *UserMutation) AddedFields() []string

AddedFields returns all numeric fields that were incremented/decremented during this mutation.

func (*UserMutation) AddedIDs

func (m *UserMutation) AddedIDs(name string) []ent.Value

AddedIDs returns all IDs (to other nodes) that were added for the given edge name in this mutation.

func (*UserMutation) Admin

func (m *UserMutation) Admin() (r bool, exists bool)

Admin returns the value of the "admin" field in the mutation.

func (*UserMutation) BadgesCleared

func (m *UserMutation) BadgesCleared() bool

BadgesCleared reports if the "badges" edge to the Badge entity was cleared.

func (*UserMutation) BadgesIDs

func (m *UserMutation) BadgesIDs() (ids []int)

BadgesIDs returns the "badges" edge IDs in the mutation.

func (*UserMutation) ChallengesCleared

func (m *UserMutation) ChallengesCleared() bool

ChallengesCleared reports if the "challenges" edge to the Challenge entity was cleared.

func (*UserMutation) ChallengesIDs

func (m *UserMutation) ChallengesIDs() (ids []uuid.UUID)

ChallengesIDs returns the "challenges" edge IDs in the mutation.

func (*UserMutation) ClearBadges

func (m *UserMutation) ClearBadges()

ClearBadges clears the "badges" edge to the Badge entity.

func (*UserMutation) ClearChallenges

func (m *UserMutation) ClearChallenges()

ClearChallenges clears the "challenges" edge to the Challenge entity.

func (*UserMutation) ClearEdge

func (m *UserMutation) ClearEdge(name string) error

ClearEdge clears the value of the edge with the given name. It returns an error if that edge is not defined in the schema.

func (*UserMutation) ClearField

func (m *UserMutation) ClearField(name string) error

ClearField clears the value of the field with the given name. It returns an error if the field is not defined in the schema.

func (*UserMutation) ClearMeta

func (m *UserMutation) ClearMeta()

ClearMeta clears the value of the "meta" field.

func (*UserMutation) ClearPicture

func (m *UserMutation) ClearPicture()

ClearPicture clears the value of the "picture" field.

func (*UserMutation) ClearPredictions

func (m *UserMutation) ClearPredictions()

ClearPredictions clears the "predictions" edge to the Prediction entity.

func (*UserMutation) ClearSessions

func (m *UserMutation) ClearSessions()

ClearSessions clears the "sessions" edge to the UserSession entity.

func (*UserMutation) ClearedEdges

func (m *UserMutation) ClearedEdges() []string

ClearedEdges returns all edge names that were cleared in this mutation.

func (*UserMutation) ClearedFields

func (m *UserMutation) ClearedFields() []string

ClearedFields returns all nullable fields that were cleared during this mutation.

func (UserMutation) Client

func (m UserMutation) Client() *Client

Client returns a new `ent.Client` from the mutation. If the mutation was executed in a transaction (ent.Tx), a transactional client is returned.

func (*UserMutation) CreateTime

func (m *UserMutation) CreateTime() (r time.Time, exists bool)

CreateTime returns the value of the "create_time" field in the mutation.

func (*UserMutation) EdgeCleared

func (m *UserMutation) EdgeCleared(name string) bool

EdgeCleared returns a boolean which indicates if the edge with the given name was cleared in this mutation.

func (*UserMutation) Email

func (m *UserMutation) Email() (r string, exists bool)

Email returns the value of the "email" field in the mutation.

func (*UserMutation) Field

func (m *UserMutation) Field(name string) (ent.Value, bool)

Field returns the value of a field with the given name. The second boolean return value indicates that this field was not set, or was not defined in the schema.

func (*UserMutation) FieldCleared

func (m *UserMutation) FieldCleared(name string) bool

FieldCleared returns a boolean indicating if a field with the given name was cleared in this mutation.

func (*UserMutation) Fields

func (m *UserMutation) Fields() []string

Fields returns all fields that were changed during this mutation. Note that in order to get all numeric fields that were incremented/decremented, call AddedFields().

func (*UserMutation) ID

func (m *UserMutation) ID() (id uuid.UUID, exists bool)

ID returns the ID value in the mutation. Note that the ID is only available if it was provided to the builder or after it was returned from the database.

func (*UserMutation) IDs

func (m *UserMutation) IDs(ctx context.Context) ([]uuid.UUID, error)

IDs queries the database and returns the entity ids that match the mutation's predicate. That means, if the mutation is applied within a transaction with an isolation level such as sql.LevelSerializable, the returned ids match the ids of the rows that will be updated or updated by the mutation.

func (*UserMutation) Locale

func (m *UserMutation) Locale() (r user.Locale, exists bool)

Locale returns the value of the "locale" field in the mutation.

func (*UserMutation) Meta

func (m *UserMutation) Meta() (r map[string]interface{}, exists bool)

Meta returns the value of the "meta" field in the mutation.

func (*UserMutation) MetaCleared

func (m *UserMutation) MetaCleared() bool

MetaCleared returns if the "meta" field was cleared in this mutation.

func (*UserMutation) Name

func (m *UserMutation) Name() (r string, exists bool)

Name returns the value of the "name" field in the mutation.

func (*UserMutation) OldAdmin

func (m *UserMutation) OldAdmin(ctx context.Context) (v bool, err error)

OldAdmin returns the old "admin" field's value of the User entity. If the User object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.

func (*UserMutation) OldCreateTime

func (m *UserMutation) OldCreateTime(ctx context.Context) (v time.Time, err error)

OldCreateTime returns the old "create_time" field's value of the User entity. If the User object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.

func (*UserMutation) OldEmail

func (m *UserMutation) OldEmail(ctx context.Context) (v string, err error)

OldEmail returns the old "email" field's value of the User entity. If the User object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.

func (*UserMutation) OldField

func (m *UserMutation) OldField(ctx context.Context, name string) (ent.Value, error)

OldField returns the old value of the field from the database. An error is returned if the mutation operation is not UpdateOne, or the query to the database failed.

func (*UserMutation) OldLocale

func (m *UserMutation) OldLocale(ctx context.Context) (v user.Locale, err error)

OldLocale returns the old "locale" field's value of the User entity. If the User object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.

func (*UserMutation) OldMeta

func (m *UserMutation) OldMeta(ctx context.Context) (v map[string]interface{}, err error)

OldMeta returns the old "meta" field's value of the User entity. If the User object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.

func (*UserMutation) OldName

func (m *UserMutation) OldName(ctx context.Context) (v string, err error)

OldName returns the old "name" field's value of the User entity. If the User object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.

func (*UserMutation) OldPasswordHash

func (m *UserMutation) OldPasswordHash(ctx context.Context) (v string, err error)

OldPasswordHash returns the old "password_hash" field's value of the User entity. If the User object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.

func (*UserMutation) OldPicture

func (m *UserMutation) OldPicture(ctx context.Context) (v string, err error)

OldPicture returns the old "picture" field's value of the User entity. If the User object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.

func (*UserMutation) OldUpdateTime

func (m *UserMutation) OldUpdateTime(ctx context.Context) (v time.Time, err error)

OldUpdateTime returns the old "update_time" field's value of the User entity. If the User object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.

func (*UserMutation) Op

func (m *UserMutation) Op() Op

Op returns the operation name.

func (*UserMutation) PasswordHash

func (m *UserMutation) PasswordHash() (r string, exists bool)

PasswordHash returns the value of the "password_hash" field in the mutation.

func (*UserMutation) Picture

func (m *UserMutation) Picture() (r string, exists bool)

Picture returns the value of the "picture" field in the mutation.

func (*UserMutation) PictureCleared

func (m *UserMutation) PictureCleared() bool

PictureCleared returns if the "picture" field was cleared in this mutation.

func (*UserMutation) PredictionsCleared

func (m *UserMutation) PredictionsCleared() bool

PredictionsCleared reports if the "predictions" edge to the Prediction entity was cleared.

func (*UserMutation) PredictionsIDs

func (m *UserMutation) PredictionsIDs() (ids []uuid.UUID)

PredictionsIDs returns the "predictions" edge IDs in the mutation.

func (*UserMutation) RemoveBadgeIDs

func (m *UserMutation) RemoveBadgeIDs(ids ...int)

RemoveBadgeIDs removes the "badges" edge to the Badge entity by IDs.

func (*UserMutation) RemoveChallengeIDs

func (m *UserMutation) RemoveChallengeIDs(ids ...uuid.UUID)

RemoveChallengeIDs removes the "challenges" edge to the Challenge entity by IDs.

func (*UserMutation) RemovePredictionIDs

func (m *UserMutation) RemovePredictionIDs(ids ...uuid.UUID)

RemovePredictionIDs removes the "predictions" edge to the Prediction entity by IDs.

func (*UserMutation) RemoveSessionIDs

func (m *UserMutation) RemoveSessionIDs(ids ...int)

RemoveSessionIDs removes the "sessions" edge to the UserSession entity by IDs.

func (*UserMutation) RemovedBadgesIDs

func (m *UserMutation) RemovedBadgesIDs() (ids []int)

RemovedBadges returns the removed IDs of the "badges" edge to the Badge entity.

func (*UserMutation) RemovedChallengesIDs

func (m *UserMutation) RemovedChallengesIDs() (ids []uuid.UUID)

RemovedChallenges returns the removed IDs of the "challenges" edge to the Challenge entity.

func (*UserMutation) RemovedEdges

func (m *UserMutation) RemovedEdges() []string

RemovedEdges returns all edge names that were removed in this mutation.

func (*UserMutation) RemovedIDs

func (m *UserMutation) RemovedIDs(name string) []ent.Value

RemovedIDs returns all IDs (to other nodes) that were removed for the edge with the given name in this mutation.

func (*UserMutation) RemovedPredictionsIDs

func (m *UserMutation) RemovedPredictionsIDs() (ids []uuid.UUID)

RemovedPredictions returns the removed IDs of the "predictions" edge to the Prediction entity.

func (*UserMutation) RemovedSessionsIDs

func (m *UserMutation) RemovedSessionsIDs() (ids []int)

RemovedSessions returns the removed IDs of the "sessions" edge to the UserSession entity.

func (*UserMutation) ResetAdmin

func (m *UserMutation) ResetAdmin()

ResetAdmin resets all changes to the "admin" field.

func (*UserMutation) ResetBadges

func (m *UserMutation) ResetBadges()

ResetBadges resets all changes to the "badges" edge.

func (*UserMutation) ResetChallenges

func (m *UserMutation) ResetChallenges()

ResetChallenges resets all changes to the "challenges" edge.

func (*UserMutation) ResetCreateTime

func (m *UserMutation) ResetCreateTime()

ResetCreateTime resets all changes to the "create_time" field.

func (*UserMutation) ResetEdge

func (m *UserMutation) ResetEdge(name string) error

ResetEdge resets all changes to the edge with the given name in this mutation. It returns an error if the edge is not defined in the schema.

func (*UserMutation) ResetEmail

func (m *UserMutation) ResetEmail()

ResetEmail resets all changes to the "email" field.

func (*UserMutation) ResetField

func (m *UserMutation) ResetField(name string) error

ResetField resets all changes in the mutation for the field with the given name. It returns an error if the field is not defined in the schema.

func (*UserMutation) ResetLocale

func (m *UserMutation) ResetLocale()

ResetLocale resets all changes to the "locale" field.

func (*UserMutation) ResetMeta

func (m *UserMutation) ResetMeta()

ResetMeta resets all changes to the "meta" field.

func (*UserMutation) ResetName

func (m *UserMutation) ResetName()

ResetName resets all changes to the "name" field.

func (*UserMutation) ResetPasswordHash

func (m *UserMutation) ResetPasswordHash()

ResetPasswordHash resets all changes to the "password_hash" field.

func (*UserMutation) ResetPicture

func (m *UserMutation) ResetPicture()

ResetPicture resets all changes to the "picture" field.

func (*UserMutation) ResetPredictions

func (m *UserMutation) ResetPredictions()

ResetPredictions resets all changes to the "predictions" edge.

func (*UserMutation) ResetSessions

func (m *UserMutation) ResetSessions()

ResetSessions resets all changes to the "sessions" edge.

func (*UserMutation) ResetUpdateTime

func (m *UserMutation) ResetUpdateTime()

ResetUpdateTime resets all changes to the "update_time" field.

func (*UserMutation) SessionsCleared

func (m *UserMutation) SessionsCleared() bool

SessionsCleared reports if the "sessions" edge to the UserSession entity was cleared.

func (*UserMutation) SessionsIDs

func (m *UserMutation) SessionsIDs() (ids []int)

SessionsIDs returns the "sessions" edge IDs in the mutation.

func (*UserMutation) SetAdmin

func (m *UserMutation) SetAdmin(b bool)

SetAdmin sets the "admin" field.

func (*UserMutation) SetCreateTime

func (m *UserMutation) SetCreateTime(t time.Time)

SetCreateTime sets the "create_time" field.

func (*UserMutation) SetEmail

func (m *UserMutation) SetEmail(s string)

SetEmail sets the "email" field.

func (*UserMutation) SetField

func (m *UserMutation) SetField(name string, value ent.Value) error

SetField sets the value of a field with the given name. It returns an error if the field is not defined in the schema, or if the type mismatched the field type.

func (*UserMutation) SetID

func (m *UserMutation) SetID(id uuid.UUID)

SetID sets the value of the id field. Note that this operation is only accepted on creation of User entities.

func (*UserMutation) SetLocale

func (m *UserMutation) SetLocale(u user.Locale)

SetLocale sets the "locale" field.

func (*UserMutation) SetMeta

func (m *UserMutation) SetMeta(value map[string]interface{})

SetMeta sets the "meta" field.

func (*UserMutation) SetName

func (m *UserMutation) SetName(s string)

SetName sets the "name" field.

func (*UserMutation) SetPasswordHash

func (m *UserMutation) SetPasswordHash(s string)

SetPasswordHash sets the "password_hash" field.

func (*UserMutation) SetPicture

func (m *UserMutation) SetPicture(s string)

SetPicture sets the "picture" field.

func (*UserMutation) SetUpdateTime

func (m *UserMutation) SetUpdateTime(t time.Time)

SetUpdateTime sets the "update_time" field.

func (UserMutation) Tx

func (m UserMutation) Tx() (*Tx, error)

Tx returns an `ent.Tx` for mutations that were executed in transactions; it returns an error otherwise.

func (*UserMutation) Type

func (m *UserMutation) Type() string

Type returns the node type of this mutation (User).

func (*UserMutation) UpdateTime

func (m *UserMutation) UpdateTime() (r time.Time, exists bool)

UpdateTime returns the value of the "update_time" field in the mutation.

func (*UserMutation) Where

func (m *UserMutation) Where(ps ...predicate.User)

Where appends a list predicates to the UserMutation builder.

type UserQuery

type UserQuery struct {
	// contains filtered or unexported fields
}

UserQuery is the builder for querying User entities.

func (*UserQuery) All

func (uq *UserQuery) All(ctx context.Context) ([]*User, error)

All executes the query and returns a list of Users.

func (*UserQuery) AllX

func (uq *UserQuery) AllX(ctx context.Context) []*User

AllX is like All, but panics if an error occurs.

func (*UserQuery) Clone

func (uq *UserQuery) Clone() *UserQuery

Clone returns a duplicate of the UserQuery builder, including all associated steps. It can be used to prepare common query builders and use them differently after the clone is made.

func (*UserQuery) Count

func (uq *UserQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*UserQuery) CountX

func (uq *UserQuery) CountX(ctx context.Context) int

CountX is like Count, but panics if an error occurs.

func (*UserQuery) Exist

func (uq *UserQuery) Exist(ctx context.Context) (bool, error)

Exist returns true if the query has elements in the graph.

func (*UserQuery) ExistX

func (uq *UserQuery) ExistX(ctx context.Context) bool

ExistX is like Exist, but panics if an error occurs.

func (*UserQuery) First

func (uq *UserQuery) First(ctx context.Context) (*User, error)

First returns the first User entity from the query. Returns a *NotFoundError when no User was found.

func (*UserQuery) FirstID

func (uq *UserQuery) FirstID(ctx context.Context) (id uuid.UUID, err error)

FirstID returns the first User ID from the query. Returns a *NotFoundError when no User ID was found.

func (*UserQuery) FirstIDX

func (uq *UserQuery) FirstIDX(ctx context.Context) uuid.UUID

FirstIDX is like FirstID, but panics if an error occurs.

func (*UserQuery) FirstX

func (uq *UserQuery) FirstX(ctx context.Context) *User

FirstX is like First, but panics if an error occurs.

func (*UserQuery) GroupBy

func (uq *UserQuery) GroupBy(field string, fields ...string) *UserGroupBy

GroupBy is used to group vertices by one or more fields/columns. It is often used with aggregate functions, like: count, max, mean, min, sum.

Example:

var v []struct {
	CreateTime time.Time `json:"create_time,omitempty"`
	Count int `json:"count,omitempty"`
}

client.User.Query().
	GroupBy(user.FieldCreateTime).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*UserQuery) IDs

func (uq *UserQuery) IDs(ctx context.Context) ([]uuid.UUID, error)

IDs executes the query and returns a list of User IDs.

func (*UserQuery) IDsX

func (uq *UserQuery) IDsX(ctx context.Context) []uuid.UUID

IDsX is like IDs, but panics if an error occurs.

func (*UserQuery) Limit

func (uq *UserQuery) Limit(limit int) *UserQuery

Limit adds a limit step to the query.

func (*UserQuery) Offset

func (uq *UserQuery) Offset(offset int) *UserQuery

Offset adds an offset step to the query.

func (*UserQuery) Only

func (uq *UserQuery) Only(ctx context.Context) (*User, error)

Only returns a single User entity found by the query, ensuring it only returns one. Returns a *NotSingularError when more than one User entity is found. Returns a *NotFoundError when no User entities are found.

func (*UserQuery) OnlyID

func (uq *UserQuery) OnlyID(ctx context.Context) (id uuid.UUID, err error)

OnlyID is like Only, but returns the only User ID in the query. Returns a *NotSingularError when more than one User ID is found. Returns a *NotFoundError when no entities are found.

func (*UserQuery) OnlyIDX

func (uq *UserQuery) OnlyIDX(ctx context.Context) uuid.UUID

OnlyIDX is like OnlyID, but panics if an error occurs.

func (*UserQuery) OnlyX

func (uq *UserQuery) OnlyX(ctx context.Context) *User

OnlyX is like Only, but panics if an error occurs.

func (*UserQuery) Order

func (uq *UserQuery) Order(o ...OrderFunc) *UserQuery

Order adds an order step to the query.

func (*UserQuery) QueryBadges

func (uq *UserQuery) QueryBadges() *BadgeQuery

QueryBadges chains the current query on the "badges" edge.

func (*UserQuery) QueryChallenges

func (uq *UserQuery) QueryChallenges() *ChallengeQuery

QueryChallenges chains the current query on the "challenges" edge.

func (*UserQuery) QueryPredictions

func (uq *UserQuery) QueryPredictions() *PredictionQuery

QueryPredictions chains the current query on the "predictions" edge.

func (*UserQuery) QuerySessions

func (uq *UserQuery) QuerySessions() *UserSessionQuery

QuerySessions chains the current query on the "sessions" edge.

func (*UserQuery) Select

func (uq *UserQuery) Select(fields ...string) *UserSelect

Select allows the selection one or more fields/columns for the given query, instead of selecting all fields in the entity.

Example:

var v []struct {
	CreateTime time.Time `json:"create_time,omitempty"`
}

client.User.Query().
	Select(user.FieldCreateTime).
	Scan(ctx, &v)

func (*UserQuery) Unique

func (uq *UserQuery) Unique(unique bool) *UserQuery

Unique configures the query builder to filter duplicate records on query. By default, unique is set to true, and can be disabled using this method.

func (*UserQuery) Where

func (uq *UserQuery) Where(ps ...predicate.User) *UserQuery

Where adds a new predicate for the UserQuery builder.

func (*UserQuery) WithBadges

func (uq *UserQuery) WithBadges(opts ...func(*BadgeQuery)) *UserQuery

WithBadges tells the query-builder to eager-load the nodes that are connected to the "badges" edge. The optional arguments are used to configure the query builder of the edge.

func (*UserQuery) WithChallenges

func (uq *UserQuery) WithChallenges(opts ...func(*ChallengeQuery)) *UserQuery

WithChallenges tells the query-builder to eager-load the nodes that are connected to the "challenges" edge. The optional arguments are used to configure the query builder of the edge.

func (*UserQuery) WithPredictions

func (uq *UserQuery) WithPredictions(opts ...func(*PredictionQuery)) *UserQuery

WithPredictions tells the query-builder to eager-load the nodes that are connected to the "predictions" edge. The optional arguments are used to configure the query builder of the edge.

func (*UserQuery) WithSessions

func (uq *UserQuery) WithSessions(opts ...func(*UserSessionQuery)) *UserQuery

WithSessions tells the query-builder to eager-load the nodes that are connected to the "sessions" edge. The optional arguments are used to configure the query builder of the edge.

type UserSelect

type UserSelect struct {
	*UserQuery
	// contains filtered or unexported fields
}

UserSelect is the builder for selecting fields of User entities.

func (*UserSelect) Bool

func (us *UserSelect) Bool(ctx context.Context) (_ bool, err error)

Bool returns a single bool from a selector. It is only allowed when selecting one field.

func (*UserSelect) BoolX

func (us *UserSelect) BoolX(ctx context.Context) bool

BoolX is like Bool, but panics if an error occurs.

func (*UserSelect) Bools

func (us *UserSelect) Bools(ctx context.Context) ([]bool, error)

Bools returns list of bools from a selector. It is only allowed when selecting one field.

func (*UserSelect) BoolsX

func (us *UserSelect) BoolsX(ctx context.Context) []bool

BoolsX is like Bools, but panics if an error occurs.

func (*UserSelect) Float64

func (us *UserSelect) Float64(ctx context.Context) (_ float64, err error)

Float64 returns a single float64 from a selector. It is only allowed when selecting one field.

func (*UserSelect) Float64X

func (us *UserSelect) Float64X(ctx context.Context) float64

Float64X is like Float64, but panics if an error occurs.

func (*UserSelect) Float64s

func (us *UserSelect) Float64s(ctx context.Context) ([]float64, error)

Float64s returns list of float64s from a selector. It is only allowed when selecting one field.

func (*UserSelect) Float64sX

func (us *UserSelect) Float64sX(ctx context.Context) []float64

Float64sX is like Float64s, but panics if an error occurs.

func (*UserSelect) Int

func (us *UserSelect) Int(ctx context.Context) (_ int, err error)

Int returns a single int from a selector. It is only allowed when selecting one field.

func (*UserSelect) IntX

func (us *UserSelect) IntX(ctx context.Context) int

IntX is like Int, but panics if an error occurs.

func (*UserSelect) Ints

func (us *UserSelect) Ints(ctx context.Context) ([]int, error)

Ints returns list of ints from a selector. It is only allowed when selecting one field.

func (*UserSelect) IntsX

func (us *UserSelect) IntsX(ctx context.Context) []int

IntsX is like Ints, but panics if an error occurs.

func (*UserSelect) Scan

func (us *UserSelect) Scan(ctx context.Context, v interface{}) error

Scan applies the selector query and scans the result into the given value.

func (*UserSelect) ScanX

func (us *UserSelect) ScanX(ctx context.Context, v interface{})

ScanX is like Scan, but panics if an error occurs.

func (*UserSelect) String

func (us *UserSelect) String(ctx context.Context) (_ string, err error)

String returns a single string from a selector. It is only allowed when selecting one field.

func (*UserSelect) StringX

func (us *UserSelect) StringX(ctx context.Context) string

StringX is like String, but panics if an error occurs.

func (*UserSelect) Strings

func (us *UserSelect) Strings(ctx context.Context) ([]string, error)

Strings returns list of strings from a selector. It is only allowed when selecting one field.

func (*UserSelect) StringsX

func (us *UserSelect) StringsX(ctx context.Context) []string

StringsX is like Strings, but panics if an error occurs.

type UserSession

type UserSession 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"`
	// Sid holds the value of the "sid" field.
	Sid string `json:"sid,omitempty"`
	// IP holds the value of the "ip" field.
	IP string `json:"ip,omitempty"`
	// UserAgent holds the value of the "user_agent" field.
	UserAgent string `json:"user_agent,omitempty"`
	// LastActivity holds the value of the "last_activity" field.
	LastActivity time.Time `json:"last_activity,omitempty"`
	// Active holds the value of the "active" field.
	Active bool `json:"active,omitempty"`
	// Meta holds the value of the "meta" field.
	Meta map[string]interface{} `json:"meta,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the UserSessionQuery when eager-loading is set.
	Edges UserSessionEdges `json:"edges"`
	// contains filtered or unexported fields
}

UserSession is the model entity for the UserSession schema.

func (*UserSession) QueryUser

func (us *UserSession) QueryUser() *UserQuery

QueryUser queries the "user" edge of the UserSession entity.

func (*UserSession) String

func (us *UserSession) String() string

String implements the fmt.Stringer.

func (*UserSession) Unwrap

func (us *UserSession) Unwrap() *UserSession

Unwrap unwraps the UserSession entity that was returned from a transaction after it was closed, so that all future queries will be executed through the driver which created the transaction.

func (*UserSession) Update

func (us *UserSession) Update() *UserSessionUpdateOne

Update returns a builder for updating this UserSession. Note that you need to call UserSession.Unwrap() before calling this method if this UserSession was returned from a transaction, and the transaction was committed or rolled back.

type UserSessionClient

type UserSessionClient struct {
	// contains filtered or unexported fields
}

UserSessionClient is a client for the UserSession schema.

func NewUserSessionClient

func NewUserSessionClient(c config) *UserSessionClient

NewUserSessionClient returns a client for the UserSession from the given config.

func (*UserSessionClient) Create

func (c *UserSessionClient) Create() *UserSessionCreate

Create returns a create builder for UserSession.

func (*UserSessionClient) CreateBulk

func (c *UserSessionClient) CreateBulk(builders ...*UserSessionCreate) *UserSessionCreateBulk

CreateBulk returns a builder for creating a bulk of UserSession entities.

func (*UserSessionClient) Delete

func (c *UserSessionClient) Delete() *UserSessionDelete

Delete returns a delete builder for UserSession.

func (*UserSessionClient) DeleteOne

DeleteOne returns a delete builder for the given entity.

func (*UserSessionClient) DeleteOneID

func (c *UserSessionClient) DeleteOneID(id int) *UserSessionDeleteOne

DeleteOneID returns a delete builder for the given id.

func (*UserSessionClient) Get

func (c *UserSessionClient) Get(ctx context.Context, id int) (*UserSession, error)

Get returns a UserSession entity by its id.

func (*UserSessionClient) GetX

func (c *UserSessionClient) GetX(ctx context.Context, id int) *UserSession

GetX is like Get, but panics if an error occurs.

func (*UserSessionClient) Hooks

func (c *UserSessionClient) Hooks() []Hook

Hooks returns the client hooks.

func (*UserSessionClient) Query

func (c *UserSessionClient) Query() *UserSessionQuery

Query returns a query builder for UserSession.

func (*UserSessionClient) QueryUser

func (c *UserSessionClient) QueryUser(us *UserSession) *UserQuery

QueryUser queries the user edge of a UserSession.

func (*UserSessionClient) Update

func (c *UserSessionClient) Update() *UserSessionUpdate

Update returns an update builder for UserSession.

func (*UserSessionClient) UpdateOne

UpdateOne returns an update builder for the given entity.

func (*UserSessionClient) UpdateOneID

func (c *UserSessionClient) UpdateOneID(id int) *UserSessionUpdateOne

UpdateOneID returns an update builder for the given id.

func (*UserSessionClient) Use

func (c *UserSessionClient) Use(hooks ...Hook)

Use adds a list of mutation hooks to the hooks stack. A call to `Use(f, g, h)` equals to `usersession.Hooks(f(g(h())))`.

type UserSessionCreate

type UserSessionCreate struct {
	// contains filtered or unexported fields
}

UserSessionCreate is the builder for creating a UserSession entity.

func (*UserSessionCreate) Exec

func (usc *UserSessionCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*UserSessionCreate) ExecX

func (usc *UserSessionCreate) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*UserSessionCreate) Mutation

func (usc *UserSessionCreate) Mutation() *UserSessionMutation

Mutation returns the UserSessionMutation object of the builder.

func (*UserSessionCreate) Save

func (usc *UserSessionCreate) Save(ctx context.Context) (*UserSession, error)

Save creates the UserSession in the database.

func (*UserSessionCreate) SaveX

func (usc *UserSessionCreate) SaveX(ctx context.Context) *UserSession

SaveX calls Save and panics if Save returns an error.

func (*UserSessionCreate) SetActive

func (usc *UserSessionCreate) SetActive(b bool) *UserSessionCreate

SetActive sets the "active" field.

func (*UserSessionCreate) SetCreateTime

func (usc *UserSessionCreate) SetCreateTime(t time.Time) *UserSessionCreate

SetCreateTime sets the "create_time" field.

func (*UserSessionCreate) SetIP

SetIP sets the "ip" field.

func (*UserSessionCreate) SetLastActivity

func (usc *UserSessionCreate) SetLastActivity(t time.Time) *UserSessionCreate

SetLastActivity sets the "last_activity" field.

func (*UserSessionCreate) SetMeta

func (usc *UserSessionCreate) SetMeta(m map[string]interface{}) *UserSessionCreate

SetMeta sets the "meta" field.

func (*UserSessionCreate) SetNillableActive

func (usc *UserSessionCreate) SetNillableActive(b *bool) *UserSessionCreate

SetNillableActive sets the "active" field if the given value is not nil.

func (*UserSessionCreate) SetNillableCreateTime

func (usc *UserSessionCreate) SetNillableCreateTime(t *time.Time) *UserSessionCreate

SetNillableCreateTime sets the "create_time" field if the given value is not nil.

func (*UserSessionCreate) SetNillableLastActivity

func (usc *UserSessionCreate) SetNillableLastActivity(t *time.Time) *UserSessionCreate

SetNillableLastActivity sets the "last_activity" field if the given value is not nil.

func (*UserSessionCreate) SetNillableUpdateTime

func (usc *UserSessionCreate) SetNillableUpdateTime(t *time.Time) *UserSessionCreate

SetNillableUpdateTime sets the "update_time" field if the given value is not nil.

func (*UserSessionCreate) SetSid

func (usc *UserSessionCreate) SetSid(s string) *UserSessionCreate

SetSid sets the "sid" field.

func (*UserSessionCreate) SetUpdateTime

func (usc *UserSessionCreate) SetUpdateTime(t time.Time) *UserSessionCreate

SetUpdateTime sets the "update_time" field.

func (*UserSessionCreate) SetUser

func (usc *UserSessionCreate) SetUser(u *User) *UserSessionCreate

SetUser sets the "user" edge to the User entity.

func (*UserSessionCreate) SetUserAgent

func (usc *UserSessionCreate) SetUserAgent(s string) *UserSessionCreate

SetUserAgent sets the "user_agent" field.

func (*UserSessionCreate) SetUserID

func (usc *UserSessionCreate) SetUserID(id uuid.UUID) *UserSessionCreate

SetUserID sets the "user" edge to the User entity by ID.

type UserSessionCreateBulk

type UserSessionCreateBulk struct {
	// contains filtered or unexported fields
}

UserSessionCreateBulk is the builder for creating many UserSession entities in bulk.

func (*UserSessionCreateBulk) Exec

func (uscb *UserSessionCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*UserSessionCreateBulk) ExecX

func (uscb *UserSessionCreateBulk) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*UserSessionCreateBulk) Save

func (uscb *UserSessionCreateBulk) Save(ctx context.Context) ([]*UserSession, error)

Save creates the UserSession entities in the database.

func (*UserSessionCreateBulk) SaveX

func (uscb *UserSessionCreateBulk) SaveX(ctx context.Context) []*UserSession

SaveX is like Save, but panics if an error occurs.

type UserSessionDelete

type UserSessionDelete struct {
	// contains filtered or unexported fields
}

UserSessionDelete is the builder for deleting a UserSession entity.

func (*UserSessionDelete) Exec

func (usd *UserSessionDelete) Exec(ctx context.Context) (int, error)

Exec executes the deletion query and returns how many vertices were deleted.

func (*UserSessionDelete) ExecX

func (usd *UserSessionDelete) ExecX(ctx context.Context) int

ExecX is like Exec, but panics if an error occurs.

func (*UserSessionDelete) Where

Where appends a list predicates to the UserSessionDelete builder.

type UserSessionDeleteOne

type UserSessionDeleteOne struct {
	// contains filtered or unexported fields
}

UserSessionDeleteOne is the builder for deleting a single UserSession entity.

func (*UserSessionDeleteOne) Exec

func (usdo *UserSessionDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*UserSessionDeleteOne) ExecX

func (usdo *UserSessionDeleteOne) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

type UserSessionEdges

type UserSessionEdges struct {
	// User holds the value of the user edge.
	User *User `json:"user,omitempty"`
	// contains filtered or unexported fields
}

UserSessionEdges holds the relations/edges for other nodes in the graph.

func (UserSessionEdges) UserOrErr

func (e UserSessionEdges) UserOrErr() (*User, error)

UserOrErr returns the User value or an error if the edge was not loaded in eager-loading, or loaded but was not found.

type UserSessionGroupBy

type UserSessionGroupBy struct {
	// contains filtered or unexported fields
}

UserSessionGroupBy is the group-by builder for UserSession entities.

func (*UserSessionGroupBy) Aggregate

func (usgb *UserSessionGroupBy) Aggregate(fns ...AggregateFunc) *UserSessionGroupBy

Aggregate adds the given aggregation functions to the group-by query.

func (*UserSessionGroupBy) Bool

func (usgb *UserSessionGroupBy) Bool(ctx context.Context) (_ bool, err error)

Bool returns a single bool from a group-by query. It is only allowed when executing a group-by query with one field.

func (*UserSessionGroupBy) BoolX

func (usgb *UserSessionGroupBy) BoolX(ctx context.Context) bool

BoolX is like Bool, but panics if an error occurs.

func (*UserSessionGroupBy) Bools

func (usgb *UserSessionGroupBy) Bools(ctx context.Context) ([]bool, error)

Bools returns list of bools from group-by. It is only allowed when executing a group-by query with one field.

func (*UserSessionGroupBy) BoolsX

func (usgb *UserSessionGroupBy) BoolsX(ctx context.Context) []bool

BoolsX is like Bools, but panics if an error occurs.

func (*UserSessionGroupBy) Float64

func (usgb *UserSessionGroupBy) Float64(ctx context.Context) (_ float64, err error)

Float64 returns a single float64 from a group-by query. It is only allowed when executing a group-by query with one field.

func (*UserSessionGroupBy) Float64X

func (usgb *UserSessionGroupBy) Float64X(ctx context.Context) float64

Float64X is like Float64, but panics if an error occurs.

func (*UserSessionGroupBy) Float64s

func (usgb *UserSessionGroupBy) Float64s(ctx context.Context) ([]float64, error)

Float64s returns list of float64s from group-by. It is only allowed when executing a group-by query with one field.

func (*UserSessionGroupBy) Float64sX

func (usgb *UserSessionGroupBy) Float64sX(ctx context.Context) []float64

Float64sX is like Float64s, but panics if an error occurs.

func (*UserSessionGroupBy) Int

func (usgb *UserSessionGroupBy) Int(ctx context.Context) (_ int, err error)

Int returns a single int from a group-by query. It is only allowed when executing a group-by query with one field.

func (*UserSessionGroupBy) IntX

func (usgb *UserSessionGroupBy) IntX(ctx context.Context) int

IntX is like Int, but panics if an error occurs.

func (*UserSessionGroupBy) Ints

func (usgb *UserSessionGroupBy) Ints(ctx context.Context) ([]int, error)

Ints returns list of ints from group-by. It is only allowed when executing a group-by query with one field.

func (*UserSessionGroupBy) IntsX

func (usgb *UserSessionGroupBy) IntsX(ctx context.Context) []int

IntsX is like Ints, but panics if an error occurs.

func (*UserSessionGroupBy) Scan

func (usgb *UserSessionGroupBy) Scan(ctx context.Context, v interface{}) error

Scan applies the group-by query and scans the result into the given value.

func (*UserSessionGroupBy) ScanX

func (usgb *UserSessionGroupBy) ScanX(ctx context.Context, v interface{})

ScanX is like Scan, but panics if an error occurs.

func (*UserSessionGroupBy) String

func (usgb *UserSessionGroupBy) String(ctx context.Context) (_ string, err error)

String returns a single string from a group-by query. It is only allowed when executing a group-by query with one field.

func (*UserSessionGroupBy) StringX

func (usgb *UserSessionGroupBy) StringX(ctx context.Context) string

StringX is like String, but panics if an error occurs.

func (*UserSessionGroupBy) Strings

func (usgb *UserSessionGroupBy) Strings(ctx context.Context) ([]string, error)

Strings returns list of strings from group-by. It is only allowed when executing a group-by query with one field.

func (*UserSessionGroupBy) StringsX

func (usgb *UserSessionGroupBy) StringsX(ctx context.Context) []string

StringsX is like Strings, but panics if an error occurs.

type UserSessionMutation

type UserSessionMutation struct {
	// contains filtered or unexported fields
}

UserSessionMutation represents an operation that mutates the UserSession nodes in the graph.

func (*UserSessionMutation) Active

func (m *UserSessionMutation) Active() (r bool, exists bool)

Active returns the value of the "active" field in the mutation.

func (*UserSessionMutation) AddField

func (m *UserSessionMutation) AddField(name string, value ent.Value) error

AddField adds the value to the field with the given name. It returns an error if the field is not defined in the schema, or if the type mismatched the field type.

func (*UserSessionMutation) AddedEdges

func (m *UserSessionMutation) AddedEdges() []string

AddedEdges returns all edge names that were set/added in this mutation.

func (*UserSessionMutation) AddedField

func (m *UserSessionMutation) AddedField(name string) (ent.Value, bool)

AddedField returns the numeric value that was incremented/decremented on a field with the given name. The second boolean return value indicates that this field was not set, or was not defined in the schema.

func (*UserSessionMutation) AddedFields

func (m *UserSessionMutation) AddedFields() []string

AddedFields returns all numeric fields that were incremented/decremented during this mutation.

func (*UserSessionMutation) AddedIDs

func (m *UserSessionMutation) AddedIDs(name string) []ent.Value

AddedIDs returns all IDs (to other nodes) that were added for the given edge name in this mutation.

func (*UserSessionMutation) ClearEdge

func (m *UserSessionMutation) ClearEdge(name string) error

ClearEdge clears the value of the edge with the given name. It returns an error if that edge is not defined in the schema.

func (*UserSessionMutation) ClearField

func (m *UserSessionMutation) ClearField(name string) error

ClearField clears the value of the field with the given name. It returns an error if the field is not defined in the schema.

func (*UserSessionMutation) ClearMeta

func (m *UserSessionMutation) ClearMeta()

ClearMeta clears the value of the "meta" field.

func (*UserSessionMutation) ClearUser

func (m *UserSessionMutation) ClearUser()

ClearUser clears the "user" edge to the User entity.

func (*UserSessionMutation) ClearedEdges

func (m *UserSessionMutation) ClearedEdges() []string

ClearedEdges returns all edge names that were cleared in this mutation.

func (*UserSessionMutation) ClearedFields

func (m *UserSessionMutation) ClearedFields() []string

ClearedFields returns all nullable fields that were cleared during this mutation.

func (UserSessionMutation) Client

func (m UserSessionMutation) 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 (*UserSessionMutation) CreateTime

func (m *UserSessionMutation) CreateTime() (r time.Time, exists bool)

CreateTime returns the value of the "create_time" field in the mutation.

func (*UserSessionMutation) EdgeCleared

func (m *UserSessionMutation) EdgeCleared(name string) bool

EdgeCleared returns a boolean which indicates if the edge with the given name was cleared in this mutation.

func (*UserSessionMutation) Field

func (m *UserSessionMutation) Field(name string) (ent.Value, bool)

Field returns the value of a field with the given name. The second boolean return value indicates that this field was not set, or was not defined in the schema.

func (*UserSessionMutation) FieldCleared

func (m *UserSessionMutation) FieldCleared(name string) bool

FieldCleared returns a boolean indicating if a field with the given name was cleared in this mutation.

func (*UserSessionMutation) Fields

func (m *UserSessionMutation) Fields() []string

Fields returns all fields that were changed during this mutation. Note that in order to get all numeric fields that were incremented/decremented, call AddedFields().

func (*UserSessionMutation) ID

func (m *UserSessionMutation) ID() (id int, exists bool)

ID returns the ID value in the mutation. Note that the ID is only available if it was provided to the builder or after it was returned from the database.

func (*UserSessionMutation) IDs

func (m *UserSessionMutation) IDs(ctx context.Context) ([]int, error)

IDs queries the database and returns the entity ids that match the mutation's predicate. That means, if the mutation is applied within a transaction with an isolation level such as sql.LevelSerializable, the returned ids match the ids of the rows that will be updated or updated by the mutation.

func (*UserSessionMutation) IP

func (m *UserSessionMutation) IP() (r string, exists bool)

IP returns the value of the "ip" field in the mutation.

func (*UserSessionMutation) LastActivity

func (m *UserSessionMutation) LastActivity() (r time.Time, exists bool)

LastActivity returns the value of the "last_activity" field in the mutation.

func (*UserSessionMutation) Meta

func (m *UserSessionMutation) Meta() (r map[string]interface{}, exists bool)

Meta returns the value of the "meta" field in the mutation.

func (*UserSessionMutation) MetaCleared

func (m *UserSessionMutation) MetaCleared() bool

MetaCleared returns if the "meta" field was cleared in this mutation.

func (*UserSessionMutation) OldActive

func (m *UserSessionMutation) OldActive(ctx context.Context) (v bool, err error)

OldActive returns the old "active" field's value of the UserSession entity. If the UserSession object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.

func (*UserSessionMutation) OldCreateTime

func (m *UserSessionMutation) OldCreateTime(ctx context.Context) (v time.Time, err error)

OldCreateTime returns the old "create_time" field's value of the UserSession entity. If the UserSession object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.

func (*UserSessionMutation) OldField

func (m *UserSessionMutation) OldField(ctx context.Context, name string) (ent.Value, error)

OldField returns the old value of the field from the database. An error is returned if the mutation operation is not UpdateOne, or the query to the database failed.

func (*UserSessionMutation) OldIP

func (m *UserSessionMutation) OldIP(ctx context.Context) (v string, err error)

OldIP returns the old "ip" field's value of the UserSession entity. If the UserSession object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.

func (*UserSessionMutation) OldLastActivity

func (m *UserSessionMutation) OldLastActivity(ctx context.Context) (v time.Time, err error)

OldLastActivity returns the old "last_activity" field's value of the UserSession entity. If the UserSession object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.

func (*UserSessionMutation) OldMeta

func (m *UserSessionMutation) OldMeta(ctx context.Context) (v map[string]interface{}, err error)

OldMeta returns the old "meta" field's value of the UserSession entity. If the UserSession object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.

func (*UserSessionMutation) OldSid

func (m *UserSessionMutation) OldSid(ctx context.Context) (v string, err error)

OldSid returns the old "sid" field's value of the UserSession entity. If the UserSession object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.

func (*UserSessionMutation) OldUpdateTime

func (m *UserSessionMutation) OldUpdateTime(ctx context.Context) (v time.Time, err error)

OldUpdateTime returns the old "update_time" field's value of the UserSession entity. If the UserSession object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.

func (*UserSessionMutation) OldUserAgent

func (m *UserSessionMutation) OldUserAgent(ctx context.Context) (v string, err error)

OldUserAgent returns the old "user_agent" field's value of the UserSession entity. If the UserSession object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.

func (*UserSessionMutation) Op

func (m *UserSessionMutation) Op() Op

Op returns the operation name.

func (*UserSessionMutation) RemovedEdges

func (m *UserSessionMutation) RemovedEdges() []string

RemovedEdges returns all edge names that were removed in this mutation.

func (*UserSessionMutation) RemovedIDs

func (m *UserSessionMutation) RemovedIDs(name string) []ent.Value

RemovedIDs returns all IDs (to other nodes) that were removed for the edge with the given name in this mutation.

func (*UserSessionMutation) ResetActive

func (m *UserSessionMutation) ResetActive()

ResetActive resets all changes to the "active" field.

func (*UserSessionMutation) ResetCreateTime

func (m *UserSessionMutation) ResetCreateTime()

ResetCreateTime resets all changes to the "create_time" field.

func (*UserSessionMutation) ResetEdge

func (m *UserSessionMutation) ResetEdge(name string) error

ResetEdge resets all changes to the edge with the given name in this mutation. It returns an error if the edge is not defined in the schema.

func (*UserSessionMutation) ResetField

func (m *UserSessionMutation) ResetField(name string) error

ResetField resets all changes in the mutation for the field with the given name. It returns an error if the field is not defined in the schema.

func (*UserSessionMutation) ResetIP

func (m *UserSessionMutation) ResetIP()

ResetIP resets all changes to the "ip" field.

func (*UserSessionMutation) ResetLastActivity

func (m *UserSessionMutation) ResetLastActivity()

ResetLastActivity resets all changes to the "last_activity" field.

func (*UserSessionMutation) ResetMeta

func (m *UserSessionMutation) ResetMeta()

ResetMeta resets all changes to the "meta" field.

func (*UserSessionMutation) ResetSid

func (m *UserSessionMutation) ResetSid()

ResetSid resets all changes to the "sid" field.

func (*UserSessionMutation) ResetUpdateTime

func (m *UserSessionMutation) ResetUpdateTime()

ResetUpdateTime resets all changes to the "update_time" field.

func (*UserSessionMutation) ResetUser

func (m *UserSessionMutation) ResetUser()

ResetUser resets all changes to the "user" edge.

func (*UserSessionMutation) ResetUserAgent

func (m *UserSessionMutation) ResetUserAgent()

ResetUserAgent resets all changes to the "user_agent" field.

func (*UserSessionMutation) SetActive

func (m *UserSessionMutation) SetActive(b bool)

SetActive sets the "active" field.

func (*UserSessionMutation) SetCreateTime

func (m *UserSessionMutation) SetCreateTime(t time.Time)

SetCreateTime sets the "create_time" field.

func (*UserSessionMutation) SetField

func (m *UserSessionMutation) SetField(name string, value ent.Value) error

SetField sets the value of a field with the given name. It returns an error if the field is not defined in the schema, or if the type mismatched the field type.

func (*UserSessionMutation) SetIP

func (m *UserSessionMutation) SetIP(s string)

SetIP sets the "ip" field.

func (*UserSessionMutation) SetLastActivity

func (m *UserSessionMutation) SetLastActivity(t time.Time)

SetLastActivity sets the "last_activity" field.

func (*UserSessionMutation) SetMeta

func (m *UserSessionMutation) SetMeta(value map[string]interface{})

SetMeta sets the "meta" field.

func (*UserSessionMutation) SetSid

func (m *UserSessionMutation) SetSid(s string)

SetSid sets the "sid" field.

func (*UserSessionMutation) SetUpdateTime

func (m *UserSessionMutation) SetUpdateTime(t time.Time)

SetUpdateTime sets the "update_time" field.

func (*UserSessionMutation) SetUserAgent

func (m *UserSessionMutation) SetUserAgent(s string)

SetUserAgent sets the "user_agent" field.

func (*UserSessionMutation) SetUserID

func (m *UserSessionMutation) SetUserID(id uuid.UUID)

SetUserID sets the "user" edge to the User entity by id.

func (*UserSessionMutation) Sid

func (m *UserSessionMutation) Sid() (r string, exists bool)

Sid returns the value of the "sid" field in the mutation.

func (UserSessionMutation) Tx

func (m UserSessionMutation) Tx() (*Tx, error)

Tx returns an `ent.Tx` for mutations that were executed in transactions; it returns an error otherwise.

func (*UserSessionMutation) Type

func (m *UserSessionMutation) Type() string

Type returns the node type of this mutation (UserSession).

func (*UserSessionMutation) UpdateTime

func (m *UserSessionMutation) UpdateTime() (r time.Time, exists bool)

UpdateTime returns the value of the "update_time" field in the mutation.

func (*UserSessionMutation) UserAgent

func (m *UserSessionMutation) UserAgent() (r string, exists bool)

UserAgent returns the value of the "user_agent" field in the mutation.

func (*UserSessionMutation) UserCleared

func (m *UserSessionMutation) UserCleared() bool

UserCleared reports if the "user" edge to the User entity was cleared.

func (*UserSessionMutation) UserID

func (m *UserSessionMutation) UserID() (id uuid.UUID, exists bool)

UserID returns the "user" edge ID in the mutation.

func (*UserSessionMutation) UserIDs

func (m *UserSessionMutation) UserIDs() (ids []uuid.UUID)

UserIDs returns the "user" edge IDs in the mutation. Note that IDs always returns len(IDs) <= 1 for unique edges, and you should use UserID instead. It exists only for internal usage by the builders.

func (*UserSessionMutation) Where

func (m *UserSessionMutation) Where(ps ...predicate.UserSession)

Where appends a list predicates to the UserSessionMutation builder.

type UserSessionQuery

type UserSessionQuery struct {
	// contains filtered or unexported fields
}

UserSessionQuery is the builder for querying UserSession entities.

func (*UserSessionQuery) All

func (usq *UserSessionQuery) All(ctx context.Context) ([]*UserSession, error)

All executes the query and returns a list of UserSessions.

func (*UserSessionQuery) AllX

func (usq *UserSessionQuery) AllX(ctx context.Context) []*UserSession

AllX is like All, but panics if an error occurs.

func (*UserSessionQuery) Clone

func (usq *UserSessionQuery) Clone() *UserSessionQuery

Clone returns a duplicate of the UserSessionQuery builder, including all associated steps. It can be used to prepare common query builders and use them differently after the clone is made.

func (*UserSessionQuery) Count

func (usq *UserSessionQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*UserSessionQuery) CountX

func (usq *UserSessionQuery) CountX(ctx context.Context) int

CountX is like Count, but panics if an error occurs.

func (*UserSessionQuery) Exist

func (usq *UserSessionQuery) Exist(ctx context.Context) (bool, error)

Exist returns true if the query has elements in the graph.

func (*UserSessionQuery) ExistX

func (usq *UserSessionQuery) ExistX(ctx context.Context) bool

ExistX is like Exist, but panics if an error occurs.

func (*UserSessionQuery) First

func (usq *UserSessionQuery) First(ctx context.Context) (*UserSession, error)

First returns the first UserSession entity from the query. Returns a *NotFoundError when no UserSession was found.

func (*UserSessionQuery) FirstID

func (usq *UserSessionQuery) FirstID(ctx context.Context) (id int, err error)

FirstID returns the first UserSession ID from the query. Returns a *NotFoundError when no UserSession ID was found.

func (*UserSessionQuery) FirstIDX

func (usq *UserSessionQuery) FirstIDX(ctx context.Context) int

FirstIDX is like FirstID, but panics if an error occurs.

func (*UserSessionQuery) FirstX

func (usq *UserSessionQuery) FirstX(ctx context.Context) *UserSession

FirstX is like First, but panics if an error occurs.

func (*UserSessionQuery) GroupBy

func (usq *UserSessionQuery) GroupBy(field string, fields ...string) *UserSessionGroupBy

GroupBy is used to group vertices by one or more fields/columns. It is often used with aggregate functions, like: count, max, mean, min, sum.

Example:

var v []struct {
	CreateTime time.Time `json:"create_time,omitempty"`
	Count int `json:"count,omitempty"`
}

client.UserSession.Query().
	GroupBy(usersession.FieldCreateTime).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*UserSessionQuery) IDs

func (usq *UserSessionQuery) IDs(ctx context.Context) ([]int, error)

IDs executes the query and returns a list of UserSession IDs.

func (*UserSessionQuery) IDsX

func (usq *UserSessionQuery) IDsX(ctx context.Context) []int

IDsX is like IDs, but panics if an error occurs.

func (*UserSessionQuery) Limit

func (usq *UserSessionQuery) Limit(limit int) *UserSessionQuery

Limit adds a limit step to the query.

func (*UserSessionQuery) Offset

func (usq *UserSessionQuery) Offset(offset int) *UserSessionQuery

Offset adds an offset step to the query.

func (*UserSessionQuery) Only

func (usq *UserSessionQuery) Only(ctx context.Context) (*UserSession, error)

Only returns a single UserSession entity found by the query, ensuring it only returns one. Returns a *NotSingularError when more than one UserSession entity is found. Returns a *NotFoundError when no UserSession entities are found.

func (*UserSessionQuery) OnlyID

func (usq *UserSessionQuery) OnlyID(ctx context.Context) (id int, err error)

OnlyID is like Only, but returns the only UserSession ID in the query. Returns a *NotSingularError when more than one UserSession ID is found. Returns a *NotFoundError when no entities are found.

func (*UserSessionQuery) OnlyIDX

func (usq *UserSessionQuery) OnlyIDX(ctx context.Context) int

OnlyIDX is like OnlyID, but panics if an error occurs.

func (*UserSessionQuery) OnlyX

func (usq *UserSessionQuery) OnlyX(ctx context.Context) *UserSession

OnlyX is like Only, but panics if an error occurs.

func (*UserSessionQuery) Order

func (usq *UserSessionQuery) Order(o ...OrderFunc) *UserSessionQuery

Order adds an order step to the query.

func (*UserSessionQuery) QueryUser

func (usq *UserSessionQuery) QueryUser() *UserQuery

QueryUser chains the current query on the "user" edge.

func (*UserSessionQuery) Select

func (usq *UserSessionQuery) Select(fields ...string) *UserSessionSelect

Select allows the selection one or more fields/columns for the given query, instead of selecting all fields in the entity.

Example:

var v []struct {
	CreateTime time.Time `json:"create_time,omitempty"`
}

client.UserSession.Query().
	Select(usersession.FieldCreateTime).
	Scan(ctx, &v)

func (*UserSessionQuery) Unique

func (usq *UserSessionQuery) Unique(unique bool) *UserSessionQuery

Unique configures the query builder to filter duplicate records on query. By default, unique is set to true, and can be disabled using this method.

func (*UserSessionQuery) Where

Where adds a new predicate for the UserSessionQuery builder.

func (*UserSessionQuery) WithUser

func (usq *UserSessionQuery) WithUser(opts ...func(*UserQuery)) *UserSessionQuery

WithUser tells the query-builder to eager-load the nodes that are connected to the "user" edge. The optional arguments are used to configure the query builder of the edge.

type UserSessionSelect

type UserSessionSelect struct {
	*UserSessionQuery
	// contains filtered or unexported fields
}

UserSessionSelect is the builder for selecting fields of UserSession entities.

func (*UserSessionSelect) Bool

func (uss *UserSessionSelect) Bool(ctx context.Context) (_ bool, err error)

Bool returns a single bool from a selector. It is only allowed when selecting one field.

func (*UserSessionSelect) BoolX

func (uss *UserSessionSelect) BoolX(ctx context.Context) bool

BoolX is like Bool, but panics if an error occurs.

func (*UserSessionSelect) Bools

func (uss *UserSessionSelect) Bools(ctx context.Context) ([]bool, error)

Bools returns list of bools from a selector. It is only allowed when selecting one field.

func (*UserSessionSelect) BoolsX

func (uss *UserSessionSelect) BoolsX(ctx context.Context) []bool

BoolsX is like Bools, but panics if an error occurs.

func (*UserSessionSelect) Float64

func (uss *UserSessionSelect) Float64(ctx context.Context) (_ float64, err error)

Float64 returns a single float64 from a selector. It is only allowed when selecting one field.

func (*UserSessionSelect) Float64X

func (uss *UserSessionSelect) Float64X(ctx context.Context) float64

Float64X is like Float64, but panics if an error occurs.

func (*UserSessionSelect) Float64s

func (uss *UserSessionSelect) Float64s(ctx context.Context) ([]float64, error)

Float64s returns list of float64s from a selector. It is only allowed when selecting one field.

func (*UserSessionSelect) Float64sX

func (uss *UserSessionSelect) Float64sX(ctx context.Context) []float64

Float64sX is like Float64s, but panics if an error occurs.

func (*UserSessionSelect) Int

func (uss *UserSessionSelect) Int(ctx context.Context) (_ int, err error)

Int returns a single int from a selector. It is only allowed when selecting one field.

func (*UserSessionSelect) IntX

func (uss *UserSessionSelect) IntX(ctx context.Context) int

IntX is like Int, but panics if an error occurs.

func (*UserSessionSelect) Ints

func (uss *UserSessionSelect) Ints(ctx context.Context) ([]int, error)

Ints returns list of ints from a selector. It is only allowed when selecting one field.

func (*UserSessionSelect) IntsX

func (uss *UserSessionSelect) IntsX(ctx context.Context) []int

IntsX is like Ints, but panics if an error occurs.

func (*UserSessionSelect) Scan

func (uss *UserSessionSelect) Scan(ctx context.Context, v interface{}) error

Scan applies the selector query and scans the result into the given value.

func (*UserSessionSelect) ScanX

func (uss *UserSessionSelect) ScanX(ctx context.Context, v interface{})

ScanX is like Scan, but panics if an error occurs.

func (*UserSessionSelect) String

func (uss *UserSessionSelect) String(ctx context.Context) (_ string, err error)

String returns a single string from a selector. It is only allowed when selecting one field.

func (*UserSessionSelect) StringX

func (uss *UserSessionSelect) StringX(ctx context.Context) string

StringX is like String, but panics if an error occurs.

func (*UserSessionSelect) Strings

func (uss *UserSessionSelect) Strings(ctx context.Context) ([]string, error)

Strings returns list of strings from a selector. It is only allowed when selecting one field.

func (*UserSessionSelect) StringsX

func (uss *UserSessionSelect) StringsX(ctx context.Context) []string

StringsX is like Strings, but panics if an error occurs.

type UserSessionUpdate

type UserSessionUpdate struct {
	// contains filtered or unexported fields
}

UserSessionUpdate is the builder for updating UserSession entities.

func (*UserSessionUpdate) ClearMeta

func (usu *UserSessionUpdate) ClearMeta() *UserSessionUpdate

ClearMeta clears the value of the "meta" field.

func (*UserSessionUpdate) ClearUser

func (usu *UserSessionUpdate) ClearUser() *UserSessionUpdate

ClearUser clears the "user" edge to the User entity.

func (*UserSessionUpdate) Exec

func (usu *UserSessionUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*UserSessionUpdate) ExecX

func (usu *UserSessionUpdate) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*UserSessionUpdate) Mutation

func (usu *UserSessionUpdate) Mutation() *UserSessionMutation

Mutation returns the UserSessionMutation object of the builder.

func (*UserSessionUpdate) Save

func (usu *UserSessionUpdate) Save(ctx context.Context) (int, error)

Save executes the query and returns the number of nodes affected by the update operation.

func (*UserSessionUpdate) SaveX

func (usu *UserSessionUpdate) SaveX(ctx context.Context) int

SaveX is like Save, but panics if an error occurs.

func (*UserSessionUpdate) SetActive

func (usu *UserSessionUpdate) SetActive(b bool) *UserSessionUpdate

SetActive sets the "active" field.

func (*UserSessionUpdate) SetIP

SetIP sets the "ip" field.

func (*UserSessionUpdate) SetLastActivity

func (usu *UserSessionUpdate) SetLastActivity(t time.Time) *UserSessionUpdate

SetLastActivity sets the "last_activity" field.

func (*UserSessionUpdate) SetMeta

func (usu *UserSessionUpdate) SetMeta(m map[string]interface{}) *UserSessionUpdate

SetMeta sets the "meta" field.

func (*UserSessionUpdate) SetNillableActive

func (usu *UserSessionUpdate) SetNillableActive(b *bool) *UserSessionUpdate

SetNillableActive sets the "active" field if the given value is not nil.

func (*UserSessionUpdate) SetNillableLastActivity

func (usu *UserSessionUpdate) SetNillableLastActivity(t *time.Time) *UserSessionUpdate

SetNillableLastActivity sets the "last_activity" field if the given value is not nil.

func (*UserSessionUpdate) SetUpdateTime

func (usu *UserSessionUpdate) SetUpdateTime(t time.Time) *UserSessionUpdate

SetUpdateTime sets the "update_time" field.

func (*UserSessionUpdate) SetUser

func (usu *UserSessionUpdate) SetUser(u *User) *UserSessionUpdate

SetUser sets the "user" edge to the User entity.

func (*UserSessionUpdate) SetUserAgent

func (usu *UserSessionUpdate) SetUserAgent(s string) *UserSessionUpdate

SetUserAgent sets the "user_agent" field.

func (*UserSessionUpdate) SetUserID

func (usu *UserSessionUpdate) SetUserID(id uuid.UUID) *UserSessionUpdate

SetUserID sets the "user" edge to the User entity by ID.

func (*UserSessionUpdate) Where

Where appends a list predicates to the UserSessionUpdate builder.

type UserSessionUpdateOne

type UserSessionUpdateOne struct {
	// contains filtered or unexported fields
}

UserSessionUpdateOne is the builder for updating a single UserSession entity.

func (*UserSessionUpdateOne) ClearMeta

func (usuo *UserSessionUpdateOne) ClearMeta() *UserSessionUpdateOne

ClearMeta clears the value of the "meta" field.

func (*UserSessionUpdateOne) ClearUser

func (usuo *UserSessionUpdateOne) ClearUser() *UserSessionUpdateOne

ClearUser clears the "user" edge to the User entity.

func (*UserSessionUpdateOne) Exec

func (usuo *UserSessionUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*UserSessionUpdateOne) ExecX

func (usuo *UserSessionUpdateOne) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*UserSessionUpdateOne) Mutation

func (usuo *UserSessionUpdateOne) Mutation() *UserSessionMutation

Mutation returns the UserSessionMutation object of the builder.

func (*UserSessionUpdateOne) Save

Save executes the query and returns the updated UserSession entity.

func (*UserSessionUpdateOne) SaveX

func (usuo *UserSessionUpdateOne) SaveX(ctx context.Context) *UserSession

SaveX is like Save, but panics if an error occurs.

func (*UserSessionUpdateOne) Select

func (usuo *UserSessionUpdateOne) Select(field string, fields ...string) *UserSessionUpdateOne

Select allows selecting one or more fields (columns) of the returned entity. The default is selecting all fields defined in the entity schema.

func (*UserSessionUpdateOne) SetActive

func (usuo *UserSessionUpdateOne) SetActive(b bool) *UserSessionUpdateOne

SetActive sets the "active" field.

func (*UserSessionUpdateOne) SetIP

SetIP sets the "ip" field.

func (*UserSessionUpdateOne) SetLastActivity

func (usuo *UserSessionUpdateOne) SetLastActivity(t time.Time) *UserSessionUpdateOne

SetLastActivity sets the "last_activity" field.

func (*UserSessionUpdateOne) SetMeta

func (usuo *UserSessionUpdateOne) SetMeta(m map[string]interface{}) *UserSessionUpdateOne

SetMeta sets the "meta" field.

func (*UserSessionUpdateOne) SetNillableActive

func (usuo *UserSessionUpdateOne) SetNillableActive(b *bool) *UserSessionUpdateOne

SetNillableActive sets the "active" field if the given value is not nil.

func (*UserSessionUpdateOne) SetNillableLastActivity

func (usuo *UserSessionUpdateOne) SetNillableLastActivity(t *time.Time) *UserSessionUpdateOne

SetNillableLastActivity sets the "last_activity" field if the given value is not nil.

func (*UserSessionUpdateOne) SetUpdateTime

func (usuo *UserSessionUpdateOne) SetUpdateTime(t time.Time) *UserSessionUpdateOne

SetUpdateTime sets the "update_time" field.

func (*UserSessionUpdateOne) SetUser

func (usuo *UserSessionUpdateOne) SetUser(u *User) *UserSessionUpdateOne

SetUser sets the "user" edge to the User entity.

func (*UserSessionUpdateOne) SetUserAgent

func (usuo *UserSessionUpdateOne) SetUserAgent(s string) *UserSessionUpdateOne

SetUserAgent sets the "user_agent" field.

func (*UserSessionUpdateOne) SetUserID

func (usuo *UserSessionUpdateOne) SetUserID(id uuid.UUID) *UserSessionUpdateOne

SetUserID sets the "user" edge to the User entity by ID.

type UserSessions

type UserSessions []*UserSession

UserSessions is a parsable slice of UserSession.

type UserUpdate

type UserUpdate struct {
	// contains filtered or unexported fields
}

UserUpdate is the builder for updating User entities.

func (*UserUpdate) AddBadgeIDs

func (uu *UserUpdate) AddBadgeIDs(ids ...int) *UserUpdate

AddBadgeIDs adds the "badges" edge to the Badge entity by IDs.

func (*UserUpdate) AddBadges

func (uu *UserUpdate) AddBadges(b ...*Badge) *UserUpdate

AddBadges adds the "badges" edges to the Badge entity.

func (*UserUpdate) AddChallengeIDs

func (uu *UserUpdate) AddChallengeIDs(ids ...uuid.UUID) *UserUpdate

AddChallengeIDs adds the "challenges" edge to the Challenge entity by IDs.

func (*UserUpdate) AddChallenges

func (uu *UserUpdate) AddChallenges(c ...*Challenge) *UserUpdate

AddChallenges adds the "challenges" edges to the Challenge entity.

func (*UserUpdate) AddPredictionIDs

func (uu *UserUpdate) AddPredictionIDs(ids ...uuid.UUID) *UserUpdate

AddPredictionIDs adds the "predictions" edge to the Prediction entity by IDs.

func (*UserUpdate) AddPredictions

func (uu *UserUpdate) AddPredictions(p ...*Prediction) *UserUpdate

AddPredictions adds the "predictions" edges to the Prediction entity.

func (*UserUpdate) AddSessionIDs

func (uu *UserUpdate) AddSessionIDs(ids ...int) *UserUpdate

AddSessionIDs adds the "sessions" edge to the UserSession entity by IDs.

func (*UserUpdate) AddSessions

func (uu *UserUpdate) AddSessions(u ...*UserSession) *UserUpdate

AddSessions adds the "sessions" edges to the UserSession entity.

func (*UserUpdate) ClearBadges

func (uu *UserUpdate) ClearBadges() *UserUpdate

ClearBadges clears all "badges" edges to the Badge entity.

func (*UserUpdate) ClearChallenges

func (uu *UserUpdate) ClearChallenges() *UserUpdate

ClearChallenges clears all "challenges" edges to the Challenge entity.

func (*UserUpdate) ClearMeta

func (uu *UserUpdate) ClearMeta() *UserUpdate

ClearMeta clears the value of the "meta" field.

func (*UserUpdate) ClearPicture

func (uu *UserUpdate) ClearPicture() *UserUpdate

ClearPicture clears the value of the "picture" field.

func (*UserUpdate) ClearPredictions

func (uu *UserUpdate) ClearPredictions() *UserUpdate

ClearPredictions clears all "predictions" edges to the Prediction entity.

func (*UserUpdate) ClearSessions

func (uu *UserUpdate) ClearSessions() *UserUpdate

ClearSessions clears all "sessions" edges to the UserSession entity.

func (*UserUpdate) Exec

func (uu *UserUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*UserUpdate) ExecX

func (uu *UserUpdate) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*UserUpdate) Mutation

func (uu *UserUpdate) Mutation() *UserMutation

Mutation returns the UserMutation object of the builder.

func (*UserUpdate) RemoveBadgeIDs

func (uu *UserUpdate) RemoveBadgeIDs(ids ...int) *UserUpdate

RemoveBadgeIDs removes the "badges" edge to Badge entities by IDs.

func (*UserUpdate) RemoveBadges

func (uu *UserUpdate) RemoveBadges(b ...*Badge) *UserUpdate

RemoveBadges removes "badges" edges to Badge entities.

func (*UserUpdate) RemoveChallengeIDs

func (uu *UserUpdate) RemoveChallengeIDs(ids ...uuid.UUID) *UserUpdate

RemoveChallengeIDs removes the "challenges" edge to Challenge entities by IDs.

func (*UserUpdate) RemoveChallenges

func (uu *UserUpdate) RemoveChallenges(c ...*Challenge) *UserUpdate

RemoveChallenges removes "challenges" edges to Challenge entities.

func (*UserUpdate) RemovePredictionIDs

func (uu *UserUpdate) RemovePredictionIDs(ids ...uuid.UUID) *UserUpdate

RemovePredictionIDs removes the "predictions" edge to Prediction entities by IDs.

func (*UserUpdate) RemovePredictions

func (uu *UserUpdate) RemovePredictions(p ...*Prediction) *UserUpdate

RemovePredictions removes "predictions" edges to Prediction entities.

func (*UserUpdate) RemoveSessionIDs

func (uu *UserUpdate) RemoveSessionIDs(ids ...int) *UserUpdate

RemoveSessionIDs removes the "sessions" edge to UserSession entities by IDs.

func (*UserUpdate) RemoveSessions

func (uu *UserUpdate) RemoveSessions(u ...*UserSession) *UserUpdate

RemoveSessions removes "sessions" edges to UserSession entities.

func (*UserUpdate) Save

func (uu *UserUpdate) Save(ctx context.Context) (int, error)

Save executes the query and returns the number of nodes affected by the update operation.

func (*UserUpdate) SaveX

func (uu *UserUpdate) SaveX(ctx context.Context) int

SaveX is like Save, but panics if an error occurs.

func (*UserUpdate) SetAdmin

func (uu *UserUpdate) SetAdmin(b bool) *UserUpdate

SetAdmin sets the "admin" field.

func (*UserUpdate) SetEmail

func (uu *UserUpdate) SetEmail(s string) *UserUpdate

SetEmail sets the "email" field.

func (*UserUpdate) SetLocale

func (uu *UserUpdate) SetLocale(u user.Locale) *UserUpdate

SetLocale sets the "locale" field.

func (*UserUpdate) SetMeta

func (uu *UserUpdate) SetMeta(m map[string]interface{}) *UserUpdate

SetMeta sets the "meta" field.

func (*UserUpdate) SetName

func (uu *UserUpdate) SetName(s string) *UserUpdate

SetName sets the "name" field.

func (*UserUpdate) SetNillableAdmin

func (uu *UserUpdate) SetNillableAdmin(b *bool) *UserUpdate

SetNillableAdmin sets the "admin" field if the given value is not nil.

func (*UserUpdate) SetNillableLocale

func (uu *UserUpdate) SetNillableLocale(u *user.Locale) *UserUpdate

SetNillableLocale sets the "locale" field if the given value is not nil.

func (*UserUpdate) SetNillablePicture

func (uu *UserUpdate) SetNillablePicture(s *string) *UserUpdate

SetNillablePicture sets the "picture" field if the given value is not nil.

func (*UserUpdate) SetPasswordHash

func (uu *UserUpdate) SetPasswordHash(s string) *UserUpdate

SetPasswordHash sets the "password_hash" field.

func (*UserUpdate) SetPicture

func (uu *UserUpdate) SetPicture(s string) *UserUpdate

SetPicture sets the "picture" field.

func (*UserUpdate) SetUpdateTime

func (uu *UserUpdate) SetUpdateTime(t time.Time) *UserUpdate

SetUpdateTime sets the "update_time" field.

func (*UserUpdate) Where

func (uu *UserUpdate) Where(ps ...predicate.User) *UserUpdate

Where appends a list predicates to the UserUpdate builder.

type UserUpdateOne

type UserUpdateOne struct {
	// contains filtered or unexported fields
}

UserUpdateOne is the builder for updating a single User entity.

func (*UserUpdateOne) AddBadgeIDs

func (uuo *UserUpdateOne) AddBadgeIDs(ids ...int) *UserUpdateOne

AddBadgeIDs adds the "badges" edge to the Badge entity by IDs.

func (*UserUpdateOne) AddBadges

func (uuo *UserUpdateOne) AddBadges(b ...*Badge) *UserUpdateOne

AddBadges adds the "badges" edges to the Badge entity.

func (*UserUpdateOne) AddChallengeIDs

func (uuo *UserUpdateOne) AddChallengeIDs(ids ...uuid.UUID) *UserUpdateOne

AddChallengeIDs adds the "challenges" edge to the Challenge entity by IDs.

func (*UserUpdateOne) AddChallenges

func (uuo *UserUpdateOne) AddChallenges(c ...*Challenge) *UserUpdateOne

AddChallenges adds the "challenges" edges to the Challenge entity.

func (*UserUpdateOne) AddPredictionIDs

func (uuo *UserUpdateOne) AddPredictionIDs(ids ...uuid.UUID) *UserUpdateOne

AddPredictionIDs adds the "predictions" edge to the Prediction entity by IDs.

func (*UserUpdateOne) AddPredictions

func (uuo *UserUpdateOne) AddPredictions(p ...*Prediction) *UserUpdateOne

AddPredictions adds the "predictions" edges to the Prediction entity.

func (*UserUpdateOne) AddSessionIDs

func (uuo *UserUpdateOne) AddSessionIDs(ids ...int) *UserUpdateOne

AddSessionIDs adds the "sessions" edge to the UserSession entity by IDs.

func (*UserUpdateOne) AddSessions

func (uuo *UserUpdateOne) AddSessions(u ...*UserSession) *UserUpdateOne

AddSessions adds the "sessions" edges to the UserSession entity.

func (*UserUpdateOne) ClearBadges

func (uuo *UserUpdateOne) ClearBadges() *UserUpdateOne

ClearBadges clears all "badges" edges to the Badge entity.

func (*UserUpdateOne) ClearChallenges

func (uuo *UserUpdateOne) ClearChallenges() *UserUpdateOne

ClearChallenges clears all "challenges" edges to the Challenge entity.

func (*UserUpdateOne) ClearMeta

func (uuo *UserUpdateOne) ClearMeta() *UserUpdateOne

ClearMeta clears the value of the "meta" field.

func (*UserUpdateOne) ClearPicture

func (uuo *UserUpdateOne) ClearPicture() *UserUpdateOne

ClearPicture clears the value of the "picture" field.

func (*UserUpdateOne) ClearPredictions

func (uuo *UserUpdateOne) ClearPredictions() *UserUpdateOne

ClearPredictions clears all "predictions" edges to the Prediction entity.

func (*UserUpdateOne) ClearSessions

func (uuo *UserUpdateOne) ClearSessions() *UserUpdateOne

ClearSessions clears all "sessions" edges to the UserSession entity.

func (*UserUpdateOne) Exec

func (uuo *UserUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*UserUpdateOne) ExecX

func (uuo *UserUpdateOne) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*UserUpdateOne) Mutation

func (uuo *UserUpdateOne) Mutation() *UserMutation

Mutation returns the UserMutation object of the builder.

func (*UserUpdateOne) RemoveBadgeIDs

func (uuo *UserUpdateOne) RemoveBadgeIDs(ids ...int) *UserUpdateOne

RemoveBadgeIDs removes the "badges" edge to Badge entities by IDs.

func (*UserUpdateOne) RemoveBadges

func (uuo *UserUpdateOne) RemoveBadges(b ...*Badge) *UserUpdateOne

RemoveBadges removes "badges" edges to Badge entities.

func (*UserUpdateOne) RemoveChallengeIDs

func (uuo *UserUpdateOne) RemoveChallengeIDs(ids ...uuid.UUID) *UserUpdateOne

RemoveChallengeIDs removes the "challenges" edge to Challenge entities by IDs.

func (*UserUpdateOne) RemoveChallenges

func (uuo *UserUpdateOne) RemoveChallenges(c ...*Challenge) *UserUpdateOne

RemoveChallenges removes "challenges" edges to Challenge entities.

func (*UserUpdateOne) RemovePredictionIDs

func (uuo *UserUpdateOne) RemovePredictionIDs(ids ...uuid.UUID) *UserUpdateOne

RemovePredictionIDs removes the "predictions" edge to Prediction entities by IDs.

func (*UserUpdateOne) RemovePredictions

func (uuo *UserUpdateOne) RemovePredictions(p ...*Prediction) *UserUpdateOne

RemovePredictions removes "predictions" edges to Prediction entities.

func (*UserUpdateOne) RemoveSessionIDs

func (uuo *UserUpdateOne) RemoveSessionIDs(ids ...int) *UserUpdateOne

RemoveSessionIDs removes the "sessions" edge to UserSession entities by IDs.

func (*UserUpdateOne) RemoveSessions

func (uuo *UserUpdateOne) RemoveSessions(u ...*UserSession) *UserUpdateOne

RemoveSessions removes "sessions" edges to UserSession entities.

func (*UserUpdateOne) Save

func (uuo *UserUpdateOne) Save(ctx context.Context) (*User, error)

Save executes the query and returns the updated User entity.

func (*UserUpdateOne) SaveX

func (uuo *UserUpdateOne) SaveX(ctx context.Context) *User

SaveX is like Save, but panics if an error occurs.

func (*UserUpdateOne) Select

func (uuo *UserUpdateOne) Select(field string, fields ...string) *UserUpdateOne

Select allows selecting one or more fields (columns) of the returned entity. The default is selecting all fields defined in the entity schema.

func (*UserUpdateOne) SetAdmin

func (uuo *UserUpdateOne) SetAdmin(b bool) *UserUpdateOne

SetAdmin sets the "admin" field.

func (*UserUpdateOne) SetEmail

func (uuo *UserUpdateOne) SetEmail(s string) *UserUpdateOne

SetEmail sets the "email" field.

func (*UserUpdateOne) SetLocale

func (uuo *UserUpdateOne) SetLocale(u user.Locale) *UserUpdateOne

SetLocale sets the "locale" field.

func (*UserUpdateOne) SetMeta

func (uuo *UserUpdateOne) SetMeta(m map[string]interface{}) *UserUpdateOne

SetMeta sets the "meta" field.

func (*UserUpdateOne) SetName

func (uuo *UserUpdateOne) SetName(s string) *UserUpdateOne

SetName sets the "name" field.

func (*UserUpdateOne) SetNillableAdmin

func (uuo *UserUpdateOne) SetNillableAdmin(b *bool) *UserUpdateOne

SetNillableAdmin sets the "admin" field if the given value is not nil.

func (*UserUpdateOne) SetNillableLocale

func (uuo *UserUpdateOne) SetNillableLocale(u *user.Locale) *UserUpdateOne

SetNillableLocale sets the "locale" field if the given value is not nil.

func (*UserUpdateOne) SetNillablePicture

func (uuo *UserUpdateOne) SetNillablePicture(s *string) *UserUpdateOne

SetNillablePicture sets the "picture" field if the given value is not nil.

func (*UserUpdateOne) SetPasswordHash

func (uuo *UserUpdateOne) SetPasswordHash(s string) *UserUpdateOne

SetPasswordHash sets the "password_hash" field.

func (*UserUpdateOne) SetPicture

func (uuo *UserUpdateOne) SetPicture(s string) *UserUpdateOne

SetPicture sets the "picture" field.

func (*UserUpdateOne) SetUpdateTime

func (uuo *UserUpdateOne) SetUpdateTime(t time.Time) *UserUpdateOne

SetUpdateTime sets the "update_time" field.

type Users

type Users []*User

Users is a parsable slice of User.

type ValidationError

type ValidationError struct {
	Name string // Field or edge name.
	// contains filtered or unexported fields
}

ValidationError returns when validating a field or edge fails.

func (*ValidationError) Error

func (e *ValidationError) Error() string

Error implements the error interface.

func (*ValidationError) Unwrap

func (e *ValidationError) Unwrap() error

Unwrap implements the errors.Wrapper interface.

type Value

type Value = ent.Value

ent aliases to avoid import conflicts in user's code.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL