ent

package
v0.0.0-...-bcec15c Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2024 License: GPL-3.0 Imports: 36 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.
	TypeJudge      = "Judge"
	TypeProblem    = "Problem"
	TypeSubmission = "Submission"
)

Variables

View Source
var DefaultJudgeOrder = &JudgeOrder{
	Direction: entgql.OrderDirectionAsc,
	Field: &JudgeOrderField{
		Value: func(j *Judge) (ent.Value, error) {
			return j.ID, nil
		},
		column: judge.FieldID,
		toTerm: judge.ByID,
		toCursor: func(j *Judge) Cursor {
			return Cursor{ID: j.ID}
		},
	},
}

DefaultJudgeOrder is the default ordering of Judge.

View Source
var DefaultProblemOrder = &ProblemOrder{
	Direction: entgql.OrderDirectionAsc,
	Field: &ProblemOrderField{
		Value: func(pr *Problem) (ent.Value, error) {
			return pr.ID, nil
		},
		column: problem.FieldID,
		toTerm: problem.ByID,
		toCursor: func(pr *Problem) Cursor {
			return Cursor{ID: pr.ID}
		},
	},
}

DefaultProblemOrder is the default ordering of Problem.

View Source
var DefaultSubmissionOrder = &SubmissionOrder{
	Direction: entgql.OrderDirectionAsc,
	Field: &SubmissionOrderField{
		Value: func(s *Submission) (ent.Value, error) {
			return s.ID, nil
		},
		column: submission.FieldID,
		toTerm: submission.ByID,
		toCursor: func(s *Submission) Cursor {
			return Cursor{ID: s.ID}
		},
	},
}

DefaultSubmissionOrder is the default ordering of Submission.

View Source
var ErrTxStarted = errors.New("ent: cannot start a transaction within a transaction")

ErrTxStarted is returned when trying to start a new transaction from a transactional client.

View Source
var OpenAPIFs embed.FS

Functions

func Asc

func Asc(fields ...string) func(*sql.Selector)

Asc applies the given fields in ASC order.

func Desc

func Desc(fields ...string) func(*sql.Selector)

Desc applies the given fields in DESC order.

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.

func OpenTxFromContext

func OpenTxFromContext(ctx context.Context) (context.Context, driver.Tx, error)

OpenTxFromContext open transactions from client stored in context.

Types

type AggregateFunc

type AggregateFunc func(*sql.Selector) string

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

func As

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

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

func Count

func Count() AggregateFunc

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

func Max

func Max(field string) AggregateFunc

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

func Mean

func Mean(field string) AggregateFunc

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

func Min

func Min(field string) AggregateFunc

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

func Sum

func Sum(field string) AggregateFunc

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

type Client

type Client struct {

	// Schema is the client for creating, migrating and dropping schema.
	Schema *migrate.Schema
	// Judge is the client for interacting with the Judge builders.
	Judge *JudgeClient
	// Problem is the client for interacting with the Problem builders.
	Problem *ProblemClient
	// Submission is the client for interacting with the Submission builders.
	Submission *SubmissionClient
	// 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().
	Judge.
	Query().
	Count(ctx)

func (*Client) Intercept

func (c *Client) Intercept(interceptors ...Interceptor)

Intercept adds the query interceptors to all the entity clients. In order to add interceptors to a specific client, call: `client.Node.Intercept(...)`.

func (*Client) Mutate

func (c *Client) Mutate(ctx context.Context, m Mutation) (Value, error)

Mutate implements the ent.Mutator interface.

func (*Client) Noder

func (c *Client) Noder(ctx context.Context, id int, opts ...NodeOption) (_ Noder, err error)

Noder returns a Node by its id. If the NodeType was not provided, it will be derived from the id value according to the universal-id configuration.

c.Noder(ctx, id)
c.Noder(ctx, id, ent.WithNodeType(typeResolver))

func (*Client) Noders

func (c *Client) Noders(ctx context.Context, ids []int, opts ...NodeOption) ([]Noder, error)

func (*Client) OpenTx

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

OpenTx opens a transaction and returns a transactional context along with the created transaction.

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 CreateJudgeInput

type CreateJudgeInput struct {
	CreatedAt     *time.Time
	UpdatedAt     *time.Time
	Name          string
	Code          string
	Type          *judge.Type
	Configuration string
	ProblemIDs    []int
}

CreateJudgeInput represents a mutation input for creating judges.

func (*CreateJudgeInput) Mutate

func (i *CreateJudgeInput) Mutate(m *JudgeMutation)

Mutate applies the CreateJudgeInput on the JudgeMutation builder.

type CreateProblemInput

type CreateProblemInput struct {
	CreatedAt     *time.Time
	UpdatedAt     *time.Time
	Name          string
	Code          string
	SubmissionIDs []int
	JudgeID       int
}

CreateProblemInput represents a mutation input for creating problems.

func (*CreateProblemInput) Mutate

func (i *CreateProblemInput) Mutate(m *ProblemMutation)

Mutate applies the CreateProblemInput on the ProblemMutation builder.

type CreateSubmissionInput

type CreateSubmissionInput struct {
	CreatedAt *time.Time
	UpdatedAt *time.Time
	Status    *submission.Status
	Verdict   *submission.Verdict
	TestCount *int
	ProblemID int
}

CreateSubmissionInput represents a mutation input for creating submissions.

func (*CreateSubmissionInput) Mutate

Mutate applies the CreateSubmissionInput on the SubmissionMutation builder.

type Cursor

type Cursor = entgql.Cursor[int]

Common entgql types.

type Hook

type Hook = ent.Hook

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

type InterceptFunc

type InterceptFunc = ent.InterceptFunc

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

type Interceptor

type Interceptor = ent.Interceptor

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

type Judge

type Judge struct {

	// ID of the ent.
	ID int `json:"id,omitempty"`
	// Time when the entity was created.
	CreatedAt time.Time `json:"created_at,omitempty"`
	// Time when the entity was last updated.
	UpdatedAt time.Time `json:"updated_at,omitempty"`
	// Name of the judge. Example: Aizu Online Judge
	Name string `json:"name,omitempty"`
	// Unique codename of the judge. Example: AZOJ
	Code string `json:"code,omitempty"`
	// Type of the judge. Example: local
	Type judge.Type `json:"type,omitempty"`
	// Configuration of the judge. Encoded in form urlencoded format (key1=value1&key2=value2...).
	Configuration string `json:"configuration,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the JudgeQuery when eager-loading is set.
	Edges JudgeEdges `json:"edges"`
	// contains filtered or unexported fields
}

Judge is the model entity for the Judge schema.

func (*Judge) IsNode

func (*Judge) IsNode()

IsNode implements the Node interface check for GQLGen.

func (*Judge) NamedProblems

func (j *Judge) NamedProblems(name string) ([]*Problem, error)

NamedProblems returns the Problems named value or an error if the edge was not loaded in eager-loading with this name.

func (*Judge) Problems

func (j *Judge) Problems(
	ctx context.Context, after *Cursor, first *int, before *Cursor, last *int,
) (*ProblemConnection, error)

func (*Judge) QueryProblems

func (j *Judge) QueryProblems() *ProblemQuery

QueryProblems queries the "problems" edge of the Judge entity.

func (*Judge) String

func (j *Judge) String() string

String implements the fmt.Stringer.

func (*Judge) ToEdge

func (j *Judge) ToEdge(order *JudgeOrder) *JudgeEdge

ToEdge converts Judge into JudgeEdge.

func (*Judge) Unwrap

func (j *Judge) Unwrap() *Judge

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

func (j *Judge) Update() *JudgeUpdateOne

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

func (*Judge) Value

func (j *Judge) Value(name string) (ent.Value, error)

Value returns the ent.Value that was dynamically selected and assigned to the Judge. This includes values selected through modifiers, order, etc.

type JudgeClient

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

JudgeClient is a client for the Judge schema.

func NewJudgeClient

func NewJudgeClient(c config) *JudgeClient

NewJudgeClient returns a client for the Judge from the given config.

func (*JudgeClient) Create

func (c *JudgeClient) Create() *JudgeCreate

Create returns a builder for creating a Judge entity.

func (*JudgeClient) CreateBulk

func (c *JudgeClient) CreateBulk(builders ...*JudgeCreate) *JudgeCreateBulk

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

func (*JudgeClient) Delete

func (c *JudgeClient) Delete() *JudgeDelete

Delete returns a delete builder for Judge.

func (*JudgeClient) DeleteOne

func (c *JudgeClient) DeleteOne(j *Judge) *JudgeDeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*JudgeClient) DeleteOneID

func (c *JudgeClient) DeleteOneID(id int) *JudgeDeleteOne

DeleteOneID returns a builder for deleting the given entity by its id.

func (*JudgeClient) Get

func (c *JudgeClient) Get(ctx context.Context, id int) (*Judge, error)

Get returns a Judge entity by its id.

func (*JudgeClient) GetX

func (c *JudgeClient) GetX(ctx context.Context, id int) *Judge

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

func (*JudgeClient) Hooks

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

Hooks returns the client hooks.

func (*JudgeClient) Intercept

func (c *JudgeClient) Intercept(interceptors ...Interceptor)

Intercept adds a list of query interceptors to the interceptors stack. A call to `Intercept(f, g, h)` equals to `judge.Intercept(f(g(h())))`.

func (*JudgeClient) Interceptors

func (c *JudgeClient) Interceptors() []Interceptor

Interceptors returns the client interceptors.

func (*JudgeClient) MapCreateBulk

func (c *JudgeClient) MapCreateBulk(slice any, setFunc func(*JudgeCreate, int)) *JudgeCreateBulk

MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates a builder and applies setFunc on it.

func (*JudgeClient) Query

func (c *JudgeClient) Query() *JudgeQuery

Query returns a query builder for Judge.

func (*JudgeClient) QueryProblems

func (c *JudgeClient) QueryProblems(j *Judge) *ProblemQuery

QueryProblems queries the problems edge of a Judge.

func (*JudgeClient) Update

func (c *JudgeClient) Update() *JudgeUpdate

Update returns an update builder for Judge.

func (*JudgeClient) UpdateOne

func (c *JudgeClient) UpdateOne(j *Judge) *JudgeUpdateOne

UpdateOne returns an update builder for the given entity.

func (*JudgeClient) UpdateOneID

func (c *JudgeClient) UpdateOneID(id int) *JudgeUpdateOne

UpdateOneID returns an update builder for the given id.

func (*JudgeClient) Use

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

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

type JudgeConnection

type JudgeConnection struct {
	Edges      []*JudgeEdge `json:"edges"`
	PageInfo   PageInfo     `json:"pageInfo"`
	TotalCount int          `json:"totalCount"`
}

JudgeConnection is the connection containing edges to Judge.

type JudgeCreate

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

JudgeCreate is the builder for creating a Judge entity.

func (*JudgeCreate) AddProblemIDs

func (jc *JudgeCreate) AddProblemIDs(ids ...int) *JudgeCreate

AddProblemIDs adds the "problems" edge to the Problem entity by IDs.

func (*JudgeCreate) AddProblems

func (jc *JudgeCreate) AddProblems(p ...*Problem) *JudgeCreate

AddProblems adds the "problems" edges to the Problem entity.

func (*JudgeCreate) Exec

func (jc *JudgeCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*JudgeCreate) ExecX

func (jc *JudgeCreate) ExecX(ctx context.Context)

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

func (*JudgeCreate) Mutation

func (jc *JudgeCreate) Mutation() *JudgeMutation

Mutation returns the JudgeMutation object of the builder.

func (*JudgeCreate) Save

func (jc *JudgeCreate) Save(ctx context.Context) (*Judge, error)

Save creates the Judge in the database.

func (*JudgeCreate) SaveX

func (jc *JudgeCreate) SaveX(ctx context.Context) *Judge

SaveX calls Save and panics if Save returns an error.

func (*JudgeCreate) SetCode

func (jc *JudgeCreate) SetCode(s string) *JudgeCreate

SetCode sets the "code" field.

func (*JudgeCreate) SetConfiguration

func (jc *JudgeCreate) SetConfiguration(s string) *JudgeCreate

SetConfiguration sets the "configuration" field.

func (*JudgeCreate) SetCreatedAt

func (jc *JudgeCreate) SetCreatedAt(t time.Time) *JudgeCreate

SetCreatedAt sets the "created_at" field.

func (*JudgeCreate) SetInput

func (c *JudgeCreate) SetInput(i CreateJudgeInput) *JudgeCreate

SetInput applies the change-set in the CreateJudgeInput on the JudgeCreate builder.

func (*JudgeCreate) SetName

func (jc *JudgeCreate) SetName(s string) *JudgeCreate

SetName sets the "name" field.

func (*JudgeCreate) SetNillableCreatedAt

func (jc *JudgeCreate) SetNillableCreatedAt(t *time.Time) *JudgeCreate

SetNillableCreatedAt sets the "created_at" field if the given value is not nil.

func (*JudgeCreate) SetNillableType

func (jc *JudgeCreate) SetNillableType(j *judge.Type) *JudgeCreate

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

func (*JudgeCreate) SetNillableUpdatedAt

func (jc *JudgeCreate) SetNillableUpdatedAt(t *time.Time) *JudgeCreate

SetNillableUpdatedAt sets the "updated_at" field if the given value is not nil.

func (*JudgeCreate) SetType

func (jc *JudgeCreate) SetType(j judge.Type) *JudgeCreate

SetType sets the "type" field.

func (*JudgeCreate) SetUpdatedAt

func (jc *JudgeCreate) SetUpdatedAt(t time.Time) *JudgeCreate

SetUpdatedAt sets the "updated_at" field.

type JudgeCreateBulk

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

JudgeCreateBulk is the builder for creating many Judge entities in bulk.

func (*JudgeCreateBulk) Exec

func (jcb *JudgeCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*JudgeCreateBulk) ExecX

func (jcb *JudgeCreateBulk) ExecX(ctx context.Context)

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

func (*JudgeCreateBulk) Save

func (jcb *JudgeCreateBulk) Save(ctx context.Context) ([]*Judge, error)

Save creates the Judge entities in the database.

func (*JudgeCreateBulk) SaveX

func (jcb *JudgeCreateBulk) SaveX(ctx context.Context) []*Judge

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

type JudgeDelete

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

JudgeDelete is the builder for deleting a Judge entity.

func (*JudgeDelete) Exec

func (jd *JudgeDelete) Exec(ctx context.Context) (int, error)

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

func (*JudgeDelete) ExecX

func (jd *JudgeDelete) ExecX(ctx context.Context) int

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

func (*JudgeDelete) Where

func (jd *JudgeDelete) Where(ps ...predicate.Judge) *JudgeDelete

Where appends a list predicates to the JudgeDelete builder.

type JudgeDeleteOne

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

JudgeDeleteOne is the builder for deleting a single Judge entity.

func (*JudgeDeleteOne) Exec

func (jdo *JudgeDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*JudgeDeleteOne) ExecX

func (jdo *JudgeDeleteOne) ExecX(ctx context.Context)

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

func (*JudgeDeleteOne) Where

func (jdo *JudgeDeleteOne) Where(ps ...predicate.Judge) *JudgeDeleteOne

Where appends a list predicates to the JudgeDelete builder.

type JudgeEdge

type JudgeEdge struct {
	Node   *Judge `json:"node"`
	Cursor Cursor `json:"cursor"`
}

JudgeEdge is the edge representation of Judge.

type JudgeEdges

type JudgeEdges struct {
	// Problems holds the value of the problems edge.
	Problems []*Problem `json:"problems,omitempty"`
	// contains filtered or unexported fields
}

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

func (JudgeEdges) ProblemsOrErr

func (e JudgeEdges) ProblemsOrErr() ([]*Problem, error)

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

type JudgeGroupBy

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

JudgeGroupBy is the group-by builder for Judge entities.

func (*JudgeGroupBy) Aggregate

func (jgb *JudgeGroupBy) Aggregate(fns ...AggregateFunc) *JudgeGroupBy

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

func (*JudgeGroupBy) Bool

func (s *JudgeGroupBy) Bool(ctx context.Context) (_ bool, err error)

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

func (*JudgeGroupBy) BoolX

func (s *JudgeGroupBy) BoolX(ctx context.Context) bool

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

func (*JudgeGroupBy) Bools

func (s *JudgeGroupBy) Bools(ctx context.Context) ([]bool, error)

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

func (*JudgeGroupBy) BoolsX

func (s *JudgeGroupBy) BoolsX(ctx context.Context) []bool

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

func (*JudgeGroupBy) Float64

func (s *JudgeGroupBy) Float64(ctx context.Context) (_ float64, err error)

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

func (*JudgeGroupBy) Float64X

func (s *JudgeGroupBy) Float64X(ctx context.Context) float64

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

func (*JudgeGroupBy) Float64s

func (s *JudgeGroupBy) Float64s(ctx context.Context) ([]float64, error)

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

func (*JudgeGroupBy) Float64sX

func (s *JudgeGroupBy) Float64sX(ctx context.Context) []float64

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

func (*JudgeGroupBy) Int

func (s *JudgeGroupBy) Int(ctx context.Context) (_ int, err error)

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

func (*JudgeGroupBy) IntX

func (s *JudgeGroupBy) IntX(ctx context.Context) int

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

func (*JudgeGroupBy) Ints

func (s *JudgeGroupBy) Ints(ctx context.Context) ([]int, error)

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

func (*JudgeGroupBy) IntsX

func (s *JudgeGroupBy) IntsX(ctx context.Context) []int

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

func (*JudgeGroupBy) Scan

func (jgb *JudgeGroupBy) Scan(ctx context.Context, v any) error

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

func (*JudgeGroupBy) ScanX

func (s *JudgeGroupBy) ScanX(ctx context.Context, v any)

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

func (*JudgeGroupBy) String

func (s *JudgeGroupBy) String(ctx context.Context) (_ string, err error)

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

func (*JudgeGroupBy) StringX

func (s *JudgeGroupBy) StringX(ctx context.Context) string

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

func (*JudgeGroupBy) Strings

func (s *JudgeGroupBy) Strings(ctx context.Context) ([]string, error)

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

func (*JudgeGroupBy) StringsX

func (s *JudgeGroupBy) StringsX(ctx context.Context) []string

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

type JudgeMutation

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

JudgeMutation represents an operation that mutates the Judge nodes in the graph.

func (*JudgeMutation) AddField

func (m *JudgeMutation) 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 (*JudgeMutation) AddProblemIDs

func (m *JudgeMutation) AddProblemIDs(ids ...int)

AddProblemIDs adds the "problems" edge to the Problem entity by ids.

func (*JudgeMutation) AddedEdges

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

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

func (*JudgeMutation) AddedField

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

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

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

func (*JudgeMutation) AddedIDs

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

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

func (*JudgeMutation) ClearEdge

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

func (m *JudgeMutation) 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 (*JudgeMutation) ClearProblems

func (m *JudgeMutation) ClearProblems()

ClearProblems clears the "problems" edge to the Problem entity.

func (*JudgeMutation) ClearedEdges

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

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

func (*JudgeMutation) ClearedFields

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

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

func (JudgeMutation) Client

func (m JudgeMutation) 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 (*JudgeMutation) Code

func (m *JudgeMutation) Code() (r string, exists bool)

Code returns the value of the "code" field in the mutation.

func (*JudgeMutation) Configuration

func (m *JudgeMutation) Configuration() (r string, exists bool)

Configuration returns the value of the "configuration" field in the mutation.

func (*JudgeMutation) CreatedAt

func (m *JudgeMutation) CreatedAt() (r time.Time, exists bool)

CreatedAt returns the value of the "created_at" field in the mutation.

func (*JudgeMutation) EdgeCleared

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

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

func (*JudgeMutation) Field

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

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

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

func (*JudgeMutation) Fields

func (m *JudgeMutation) 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 (*JudgeMutation) GetType

func (m *JudgeMutation) GetType() (r judge.Type, exists bool)

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

func (*JudgeMutation) ID

func (m *JudgeMutation) 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 (*JudgeMutation) IDs

func (m *JudgeMutation) 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 (*JudgeMutation) Name

func (m *JudgeMutation) Name() (r string, exists bool)

Name returns the value of the "name" field in the mutation.

func (*JudgeMutation) OldCode

func (m *JudgeMutation) OldCode(ctx context.Context) (v string, err error)

OldCode returns the old "code" field's value of the Judge entity. If the Judge 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 (*JudgeMutation) OldConfiguration

func (m *JudgeMutation) OldConfiguration(ctx context.Context) (v string, err error)

OldConfiguration returns the old "configuration" field's value of the Judge entity. If the Judge 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 (*JudgeMutation) OldCreatedAt

func (m *JudgeMutation) OldCreatedAt(ctx context.Context) (v time.Time, err error)

OldCreatedAt returns the old "created_at" field's value of the Judge entity. If the Judge 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 (*JudgeMutation) OldField

func (m *JudgeMutation) 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 (*JudgeMutation) OldName

func (m *JudgeMutation) OldName(ctx context.Context) (v string, err error)

OldName returns the old "name" field's value of the Judge entity. If the Judge 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 (*JudgeMutation) OldType

func (m *JudgeMutation) OldType(ctx context.Context) (v judge.Type, err error)

OldType returns the old "type" field's value of the Judge entity. If the Judge 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 (*JudgeMutation) OldUpdatedAt

func (m *JudgeMutation) OldUpdatedAt(ctx context.Context) (v time.Time, err error)

OldUpdatedAt returns the old "updated_at" field's value of the Judge entity. If the Judge 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 (*JudgeMutation) Op

func (m *JudgeMutation) Op() Op

Op returns the operation name.

func (*JudgeMutation) ProblemsCleared

func (m *JudgeMutation) ProblemsCleared() bool

ProblemsCleared reports if the "problems" edge to the Problem entity was cleared.

func (*JudgeMutation) ProblemsIDs

func (m *JudgeMutation) ProblemsIDs() (ids []int)

ProblemsIDs returns the "problems" edge IDs in the mutation.

func (*JudgeMutation) RemoveProblemIDs

func (m *JudgeMutation) RemoveProblemIDs(ids ...int)

RemoveProblemIDs removes the "problems" edge to the Problem entity by IDs.

func (*JudgeMutation) RemovedEdges

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

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

func (*JudgeMutation) RemovedIDs

func (m *JudgeMutation) 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 (*JudgeMutation) RemovedProblemsIDs

func (m *JudgeMutation) RemovedProblemsIDs() (ids []int)

RemovedProblems returns the removed IDs of the "problems" edge to the Problem entity.

func (*JudgeMutation) ResetCode

func (m *JudgeMutation) ResetCode()

ResetCode resets all changes to the "code" field.

func (*JudgeMutation) ResetConfiguration

func (m *JudgeMutation) ResetConfiguration()

ResetConfiguration resets all changes to the "configuration" field.

func (*JudgeMutation) ResetCreatedAt

func (m *JudgeMutation) ResetCreatedAt()

ResetCreatedAt resets all changes to the "created_at" field.

func (*JudgeMutation) ResetEdge

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

func (m *JudgeMutation) 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 (*JudgeMutation) ResetName

func (m *JudgeMutation) ResetName()

ResetName resets all changes to the "name" field.

func (*JudgeMutation) ResetProblems

func (m *JudgeMutation) ResetProblems()

ResetProblems resets all changes to the "problems" edge.

func (*JudgeMutation) ResetType

func (m *JudgeMutation) ResetType()

ResetType resets all changes to the "type" field.

func (*JudgeMutation) ResetUpdatedAt

func (m *JudgeMutation) ResetUpdatedAt()

ResetUpdatedAt resets all changes to the "updated_at" field.

func (*JudgeMutation) SetCode

func (m *JudgeMutation) SetCode(s string)

SetCode sets the "code" field.

func (*JudgeMutation) SetConfiguration

func (m *JudgeMutation) SetConfiguration(s string)

SetConfiguration sets the "configuration" field.

func (*JudgeMutation) SetCreatedAt

func (m *JudgeMutation) SetCreatedAt(t time.Time)

SetCreatedAt sets the "created_at" field.

func (*JudgeMutation) SetField

func (m *JudgeMutation) 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 (*JudgeMutation) SetName

func (m *JudgeMutation) SetName(s string)

SetName sets the "name" field.

func (*JudgeMutation) SetOp

func (m *JudgeMutation) SetOp(op Op)

SetOp allows setting the mutation operation.

func (*JudgeMutation) SetType

func (m *JudgeMutation) SetType(j judge.Type)

SetType sets the "type" field.

func (*JudgeMutation) SetUpdatedAt

func (m *JudgeMutation) SetUpdatedAt(t time.Time)

SetUpdatedAt sets the "updated_at" field.

func (JudgeMutation) Tx

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

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

func (*JudgeMutation) Type

func (m *JudgeMutation) Type() string

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

func (*JudgeMutation) UpdatedAt

func (m *JudgeMutation) UpdatedAt() (r time.Time, exists bool)

UpdatedAt returns the value of the "updated_at" field in the mutation.

func (*JudgeMutation) Where

func (m *JudgeMutation) Where(ps ...predicate.Judge)

Where appends a list predicates to the JudgeMutation builder.

func (*JudgeMutation) WhereP

func (m *JudgeMutation) WhereP(ps ...func(*sql.Selector))

WhereP appends storage-level predicates to the JudgeMutation builder. Using this method, users can use type-assertion to append predicates that do not depend on any generated package.

type JudgeOrder

type JudgeOrder struct {
	Direction OrderDirection   `json:"direction"`
	Field     *JudgeOrderField `json:"field"`
}

JudgeOrder defines the ordering of Judge.

type JudgeOrderField

type JudgeOrderField struct {
	// Value extracts the ordering value from the given Judge.
	Value func(*Judge) (ent.Value, error)
	// contains filtered or unexported fields
}

JudgeOrderField defines the ordering field of Judge.

type JudgePaginateOption

type JudgePaginateOption func(*judgePager) error

JudgePaginateOption enables pagination customization.

func WithJudgeFilter

func WithJudgeFilter(filter func(*JudgeQuery) (*JudgeQuery, error)) JudgePaginateOption

WithJudgeFilter configures pagination filter.

func WithJudgeOrder

func WithJudgeOrder(order *JudgeOrder) JudgePaginateOption

WithJudgeOrder configures pagination ordering.

type JudgeQuery

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

JudgeQuery is the builder for querying Judge entities.

func (*JudgeQuery) Aggregate

func (jq *JudgeQuery) Aggregate(fns ...AggregateFunc) *JudgeSelect

Aggregate returns a JudgeSelect configured with the given aggregations.

func (*JudgeQuery) All

func (jq *JudgeQuery) All(ctx context.Context) ([]*Judge, error)

All executes the query and returns a list of Judges.

func (*JudgeQuery) AllX

func (jq *JudgeQuery) AllX(ctx context.Context) []*Judge

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

func (*JudgeQuery) Clone

func (jq *JudgeQuery) Clone() *JudgeQuery

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

func (*JudgeQuery) CollectFields

func (j *JudgeQuery) CollectFields(ctx context.Context, satisfies ...string) (*JudgeQuery, error)

CollectFields tells the query-builder to eagerly load connected nodes by resolver context.

func (*JudgeQuery) Count

func (jq *JudgeQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*JudgeQuery) CountX

func (jq *JudgeQuery) CountX(ctx context.Context) int

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

func (*JudgeQuery) Exist

func (jq *JudgeQuery) Exist(ctx context.Context) (bool, error)

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

func (*JudgeQuery) ExistX

func (jq *JudgeQuery) ExistX(ctx context.Context) bool

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

func (*JudgeQuery) First

func (jq *JudgeQuery) First(ctx context.Context) (*Judge, error)

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

func (*JudgeQuery) FirstID

func (jq *JudgeQuery) FirstID(ctx context.Context) (id int, err error)

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

func (*JudgeQuery) FirstIDX

func (jq *JudgeQuery) FirstIDX(ctx context.Context) int

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

func (*JudgeQuery) FirstX

func (jq *JudgeQuery) FirstX(ctx context.Context) *Judge

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

func (*JudgeQuery) GroupBy

func (jq *JudgeQuery) GroupBy(field string, fields ...string) *JudgeGroupBy

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

client.Judge.Query().
	GroupBy(judge.FieldCreatedAt).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*JudgeQuery) IDs

func (jq *JudgeQuery) IDs(ctx context.Context) (ids []int, err error)

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

func (*JudgeQuery) IDsX

func (jq *JudgeQuery) IDsX(ctx context.Context) []int

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

func (*JudgeQuery) Limit

func (jq *JudgeQuery) Limit(limit int) *JudgeQuery

Limit the number of records to be returned by this query.

func (*JudgeQuery) Offset

func (jq *JudgeQuery) Offset(offset int) *JudgeQuery

Offset to start from.

func (*JudgeQuery) Only

func (jq *JudgeQuery) Only(ctx context.Context) (*Judge, error)

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

func (*JudgeQuery) OnlyID

func (jq *JudgeQuery) OnlyID(ctx context.Context) (id int, err error)

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

func (*JudgeQuery) OnlyIDX

func (jq *JudgeQuery) OnlyIDX(ctx context.Context) int

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

func (*JudgeQuery) OnlyX

func (jq *JudgeQuery) OnlyX(ctx context.Context) *Judge

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

func (*JudgeQuery) Order

func (jq *JudgeQuery) Order(o ...judge.OrderOption) *JudgeQuery

Order specifies how the records should be ordered.

func (*JudgeQuery) Paginate

func (j *JudgeQuery) Paginate(
	ctx context.Context, after *Cursor, first *int,
	before *Cursor, last *int, opts ...JudgePaginateOption,
) (*JudgeConnection, error)

Paginate executes the query and returns a relay based cursor connection to Judge.

func (*JudgeQuery) QueryProblems

func (jq *JudgeQuery) QueryProblems() *ProblemQuery

QueryProblems chains the current query on the "problems" edge.

func (*JudgeQuery) Select

func (jq *JudgeQuery) Select(fields ...string) *JudgeSelect

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 {
	CreatedAt time.Time `json:"created_at,omitempty"`
}

client.Judge.Query().
	Select(judge.FieldCreatedAt).
	Scan(ctx, &v)

func (*JudgeQuery) Unique

func (jq *JudgeQuery) Unique(unique bool) *JudgeQuery

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

func (jq *JudgeQuery) Where(ps ...predicate.Judge) *JudgeQuery

Where adds a new predicate for the JudgeQuery builder.

func (*JudgeQuery) WithNamedProblems

func (jq *JudgeQuery) WithNamedProblems(name string, opts ...func(*ProblemQuery)) *JudgeQuery

WithNamedProblems tells the query-builder to eager-load the nodes that are connected to the "problems" edge with the given name. The optional arguments are used to configure the query builder of the edge.

func (*JudgeQuery) WithProblems

func (jq *JudgeQuery) WithProblems(opts ...func(*ProblemQuery)) *JudgeQuery

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

type JudgeSelect

type JudgeSelect struct {
	*JudgeQuery
	// contains filtered or unexported fields
}

JudgeSelect is the builder for selecting fields of Judge entities.

func (*JudgeSelect) Aggregate

func (js *JudgeSelect) Aggregate(fns ...AggregateFunc) *JudgeSelect

Aggregate adds the given aggregation functions to the selector query.

func (*JudgeSelect) Bool

func (s *JudgeSelect) Bool(ctx context.Context) (_ bool, err error)

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

func (*JudgeSelect) BoolX

func (s *JudgeSelect) BoolX(ctx context.Context) bool

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

func (*JudgeSelect) Bools

func (s *JudgeSelect) Bools(ctx context.Context) ([]bool, error)

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

func (*JudgeSelect) BoolsX

func (s *JudgeSelect) BoolsX(ctx context.Context) []bool

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

func (*JudgeSelect) Float64

func (s *JudgeSelect) Float64(ctx context.Context) (_ float64, err error)

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

func (*JudgeSelect) Float64X

func (s *JudgeSelect) Float64X(ctx context.Context) float64

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

func (*JudgeSelect) Float64s

func (s *JudgeSelect) Float64s(ctx context.Context) ([]float64, error)

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

func (*JudgeSelect) Float64sX

func (s *JudgeSelect) Float64sX(ctx context.Context) []float64

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

func (*JudgeSelect) Int

func (s *JudgeSelect) Int(ctx context.Context) (_ int, err error)

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

func (*JudgeSelect) IntX

func (s *JudgeSelect) IntX(ctx context.Context) int

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

func (*JudgeSelect) Ints

func (s *JudgeSelect) Ints(ctx context.Context) ([]int, error)

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

func (*JudgeSelect) IntsX

func (s *JudgeSelect) IntsX(ctx context.Context) []int

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

func (*JudgeSelect) Scan

func (js *JudgeSelect) Scan(ctx context.Context, v any) error

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

func (*JudgeSelect) ScanX

func (s *JudgeSelect) ScanX(ctx context.Context, v any)

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

func (*JudgeSelect) String

func (s *JudgeSelect) String(ctx context.Context) (_ string, err error)

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

func (*JudgeSelect) StringX

func (s *JudgeSelect) StringX(ctx context.Context) string

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

func (*JudgeSelect) Strings

func (s *JudgeSelect) Strings(ctx context.Context) ([]string, error)

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

func (*JudgeSelect) StringsX

func (s *JudgeSelect) StringsX(ctx context.Context) []string

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

type JudgeUpdate

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

JudgeUpdate is the builder for updating Judge entities.

func (*JudgeUpdate) AddProblemIDs

func (ju *JudgeUpdate) AddProblemIDs(ids ...int) *JudgeUpdate

AddProblemIDs adds the "problems" edge to the Problem entity by IDs.

func (*JudgeUpdate) AddProblems

func (ju *JudgeUpdate) AddProblems(p ...*Problem) *JudgeUpdate

AddProblems adds the "problems" edges to the Problem entity.

func (*JudgeUpdate) ClearProblems

func (ju *JudgeUpdate) ClearProblems() *JudgeUpdate

ClearProblems clears all "problems" edges to the Problem entity.

func (*JudgeUpdate) Exec

func (ju *JudgeUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*JudgeUpdate) ExecX

func (ju *JudgeUpdate) ExecX(ctx context.Context)

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

func (*JudgeUpdate) Mutation

func (ju *JudgeUpdate) Mutation() *JudgeMutation

Mutation returns the JudgeMutation object of the builder.

func (*JudgeUpdate) RemoveProblemIDs

func (ju *JudgeUpdate) RemoveProblemIDs(ids ...int) *JudgeUpdate

RemoveProblemIDs removes the "problems" edge to Problem entities by IDs.

func (*JudgeUpdate) RemoveProblems

func (ju *JudgeUpdate) RemoveProblems(p ...*Problem) *JudgeUpdate

RemoveProblems removes "problems" edges to Problem entities.

func (*JudgeUpdate) Save

func (ju *JudgeUpdate) Save(ctx context.Context) (int, error)

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

func (*JudgeUpdate) SaveX

func (ju *JudgeUpdate) SaveX(ctx context.Context) int

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

func (*JudgeUpdate) SetCode

func (ju *JudgeUpdate) SetCode(s string) *JudgeUpdate

SetCode sets the "code" field.

func (*JudgeUpdate) SetConfiguration

func (ju *JudgeUpdate) SetConfiguration(s string) *JudgeUpdate

SetConfiguration sets the "configuration" field.

func (*JudgeUpdate) SetInput

func (c *JudgeUpdate) SetInput(i UpdateJudgeInput) *JudgeUpdate

SetInput applies the change-set in the UpdateJudgeInput on the JudgeUpdate builder.

func (*JudgeUpdate) SetName

func (ju *JudgeUpdate) SetName(s string) *JudgeUpdate

SetName sets the "name" field.

func (*JudgeUpdate) SetNillableCode

func (ju *JudgeUpdate) SetNillableCode(s *string) *JudgeUpdate

SetNillableCode sets the "code" field if the given value is not nil.

func (*JudgeUpdate) SetNillableConfiguration

func (ju *JudgeUpdate) SetNillableConfiguration(s *string) *JudgeUpdate

SetNillableConfiguration sets the "configuration" field if the given value is not nil.

func (*JudgeUpdate) SetNillableName

func (ju *JudgeUpdate) SetNillableName(s *string) *JudgeUpdate

SetNillableName sets the "name" field if the given value is not nil.

func (*JudgeUpdate) SetNillableType

func (ju *JudgeUpdate) SetNillableType(j *judge.Type) *JudgeUpdate

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

func (*JudgeUpdate) SetType

func (ju *JudgeUpdate) SetType(j judge.Type) *JudgeUpdate

SetType sets the "type" field.

func (*JudgeUpdate) SetUpdatedAt

func (ju *JudgeUpdate) SetUpdatedAt(t time.Time) *JudgeUpdate

SetUpdatedAt sets the "updated_at" field.

func (*JudgeUpdate) Where

func (ju *JudgeUpdate) Where(ps ...predicate.Judge) *JudgeUpdate

Where appends a list predicates to the JudgeUpdate builder.

type JudgeUpdateOne

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

JudgeUpdateOne is the builder for updating a single Judge entity.

func (*JudgeUpdateOne) AddProblemIDs

func (juo *JudgeUpdateOne) AddProblemIDs(ids ...int) *JudgeUpdateOne

AddProblemIDs adds the "problems" edge to the Problem entity by IDs.

func (*JudgeUpdateOne) AddProblems

func (juo *JudgeUpdateOne) AddProblems(p ...*Problem) *JudgeUpdateOne

AddProblems adds the "problems" edges to the Problem entity.

func (*JudgeUpdateOne) ClearProblems

func (juo *JudgeUpdateOne) ClearProblems() *JudgeUpdateOne

ClearProblems clears all "problems" edges to the Problem entity.

func (*JudgeUpdateOne) Exec

func (juo *JudgeUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*JudgeUpdateOne) ExecX

func (juo *JudgeUpdateOne) ExecX(ctx context.Context)

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

func (*JudgeUpdateOne) Mutation

func (juo *JudgeUpdateOne) Mutation() *JudgeMutation

Mutation returns the JudgeMutation object of the builder.

func (*JudgeUpdateOne) RemoveProblemIDs

func (juo *JudgeUpdateOne) RemoveProblemIDs(ids ...int) *JudgeUpdateOne

RemoveProblemIDs removes the "problems" edge to Problem entities by IDs.

func (*JudgeUpdateOne) RemoveProblems

func (juo *JudgeUpdateOne) RemoveProblems(p ...*Problem) *JudgeUpdateOne

RemoveProblems removes "problems" edges to Problem entities.

func (*JudgeUpdateOne) Save

func (juo *JudgeUpdateOne) Save(ctx context.Context) (*Judge, error)

Save executes the query and returns the updated Judge entity.

func (*JudgeUpdateOne) SaveX

func (juo *JudgeUpdateOne) SaveX(ctx context.Context) *Judge

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

func (*JudgeUpdateOne) Select

func (juo *JudgeUpdateOne) Select(field string, fields ...string) *JudgeUpdateOne

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

func (*JudgeUpdateOne) SetCode

func (juo *JudgeUpdateOne) SetCode(s string) *JudgeUpdateOne

SetCode sets the "code" field.

func (*JudgeUpdateOne) SetConfiguration

func (juo *JudgeUpdateOne) SetConfiguration(s string) *JudgeUpdateOne

SetConfiguration sets the "configuration" field.

func (*JudgeUpdateOne) SetInput

SetInput applies the change-set in the UpdateJudgeInput on the JudgeUpdateOne builder.

func (*JudgeUpdateOne) SetName

func (juo *JudgeUpdateOne) SetName(s string) *JudgeUpdateOne

SetName sets the "name" field.

func (*JudgeUpdateOne) SetNillableCode

func (juo *JudgeUpdateOne) SetNillableCode(s *string) *JudgeUpdateOne

SetNillableCode sets the "code" field if the given value is not nil.

func (*JudgeUpdateOne) SetNillableConfiguration

func (juo *JudgeUpdateOne) SetNillableConfiguration(s *string) *JudgeUpdateOne

SetNillableConfiguration sets the "configuration" field if the given value is not nil.

func (*JudgeUpdateOne) SetNillableName

func (juo *JudgeUpdateOne) SetNillableName(s *string) *JudgeUpdateOne

SetNillableName sets the "name" field if the given value is not nil.

func (*JudgeUpdateOne) SetNillableType

func (juo *JudgeUpdateOne) SetNillableType(j *judge.Type) *JudgeUpdateOne

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

func (*JudgeUpdateOne) SetType

func (juo *JudgeUpdateOne) SetType(j judge.Type) *JudgeUpdateOne

SetType sets the "type" field.

func (*JudgeUpdateOne) SetUpdatedAt

func (juo *JudgeUpdateOne) SetUpdatedAt(t time.Time) *JudgeUpdateOne

SetUpdatedAt sets the "updated_at" field.

func (*JudgeUpdateOne) Where

func (juo *JudgeUpdateOne) Where(ps ...predicate.Judge) *JudgeUpdateOne

Where appends a list predicates to the JudgeUpdate builder.

type Judges

type Judges []*Judge

Judges is a parsable slice of Judge.

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 NodeOption

type NodeOption func(*nodeOptions)

NodeOption allows configuring the Noder execution using functional options.

func WithFixedNodeType

func WithFixedNodeType(t string) NodeOption

WithFixedNodeType sets the Type of the node to a fixed value.

func WithNodeType

func WithNodeType(f func(context.Context, int) (string, error)) NodeOption

WithNodeType sets the node Type resolver function (i.e. the table to query). If was not provided, the table will be derived from the universal-id configuration as described in: https://entgo.io/docs/migrate/#universal-ids.

type Noder

type Noder interface {
	IsNode()
}

Noder wraps the basic Node method.

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(...any)) Option

Log sets the logging function for debug mode.

type OrderDirection

type OrderDirection = entgql.OrderDirection

Common entgql types.

type OrderFunc

type OrderFunc func(*sql.Selector)

OrderFunc applies an ordering on the sql selector. Deprecated: Use Asc/Desc functions or the package builders instead.

type PageInfo

type PageInfo = entgql.PageInfo[int]

Common entgql types.

type Policy

type Policy = ent.Policy

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

type Problem

type Problem struct {

	// ID of the ent.
	ID int `json:"id,omitempty"`
	// Time when the entity was created.
	CreatedAt time.Time `json:"created_at,omitempty"`
	// Time when the entity was last updated.
	UpdatedAt time.Time `json:"updated_at,omitempty"`
	// Name of the problem. Example: A+B Problem
	Name string `json:"name,omitempty"`
	// Unique codename of the problem. Example: AZ2008B
	Code string `json:"code,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the ProblemQuery when eager-loading is set.
	Edges ProblemEdges `json:"edges"`
	// contains filtered or unexported fields
}

Problem is the model entity for the Problem schema.

func (*Problem) IsNode

func (*Problem) IsNode()

IsNode implements the Node interface check for GQLGen.

func (*Problem) Judge

func (pr *Problem) Judge(ctx context.Context) (*Judge, error)

func (*Problem) NamedSubmissions

func (pr *Problem) NamedSubmissions(name string) ([]*Submission, error)

NamedSubmissions returns the Submissions named value or an error if the edge was not loaded in eager-loading with this name.

func (*Problem) QueryJudge

func (pr *Problem) QueryJudge() *JudgeQuery

QueryJudge queries the "judge" edge of the Problem entity.

func (*Problem) QuerySubmissions

func (pr *Problem) QuerySubmissions() *SubmissionQuery

QuerySubmissions queries the "submissions" edge of the Problem entity.

func (*Problem) String

func (pr *Problem) String() string

String implements the fmt.Stringer.

func (*Problem) Submissions

func (pr *Problem) Submissions(
	ctx context.Context, after *Cursor, first *int, before *Cursor, last *int,
) (*SubmissionConnection, error)

func (*Problem) ToEdge

func (pr *Problem) ToEdge(order *ProblemOrder) *ProblemEdge

ToEdge converts Problem into ProblemEdge.

func (*Problem) Unwrap

func (pr *Problem) Unwrap() *Problem

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

func (pr *Problem) Update() *ProblemUpdateOne

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

func (*Problem) Value

func (pr *Problem) Value(name string) (ent.Value, error)

Value returns the ent.Value that was dynamically selected and assigned to the Problem. This includes values selected through modifiers, order, etc.

type ProblemClient

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

ProblemClient is a client for the Problem schema.

func NewProblemClient

func NewProblemClient(c config) *ProblemClient

NewProblemClient returns a client for the Problem from the given config.

func (*ProblemClient) Create

func (c *ProblemClient) Create() *ProblemCreate

Create returns a builder for creating a Problem entity.

func (*ProblemClient) CreateBulk

func (c *ProblemClient) CreateBulk(builders ...*ProblemCreate) *ProblemCreateBulk

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

func (*ProblemClient) Delete

func (c *ProblemClient) Delete() *ProblemDelete

Delete returns a delete builder for Problem.

func (*ProblemClient) DeleteOne

func (c *ProblemClient) DeleteOne(pr *Problem) *ProblemDeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*ProblemClient) DeleteOneID

func (c *ProblemClient) DeleteOneID(id int) *ProblemDeleteOne

DeleteOneID returns a builder for deleting the given entity by its id.

func (*ProblemClient) Get

func (c *ProblemClient) Get(ctx context.Context, id int) (*Problem, error)

Get returns a Problem entity by its id.

func (*ProblemClient) GetX

func (c *ProblemClient) GetX(ctx context.Context, id int) *Problem

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

func (*ProblemClient) Hooks

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

Hooks returns the client hooks.

func (*ProblemClient) Intercept

func (c *ProblemClient) Intercept(interceptors ...Interceptor)

Intercept adds a list of query interceptors to the interceptors stack. A call to `Intercept(f, g, h)` equals to `problem.Intercept(f(g(h())))`.

func (*ProblemClient) Interceptors

func (c *ProblemClient) Interceptors() []Interceptor

Interceptors returns the client interceptors.

func (*ProblemClient) MapCreateBulk

func (c *ProblemClient) MapCreateBulk(slice any, setFunc func(*ProblemCreate, int)) *ProblemCreateBulk

MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates a builder and applies setFunc on it.

func (*ProblemClient) Query

func (c *ProblemClient) Query() *ProblemQuery

Query returns a query builder for Problem.

func (*ProblemClient) QueryJudge

func (c *ProblemClient) QueryJudge(pr *Problem) *JudgeQuery

QueryJudge queries the judge edge of a Problem.

func (*ProblemClient) QuerySubmissions

func (c *ProblemClient) QuerySubmissions(pr *Problem) *SubmissionQuery

QuerySubmissions queries the submissions edge of a Problem.

func (*ProblemClient) Update

func (c *ProblemClient) Update() *ProblemUpdate

Update returns an update builder for Problem.

func (*ProblemClient) UpdateOne

func (c *ProblemClient) UpdateOne(pr *Problem) *ProblemUpdateOne

UpdateOne returns an update builder for the given entity.

func (*ProblemClient) UpdateOneID

func (c *ProblemClient) UpdateOneID(id int) *ProblemUpdateOne

UpdateOneID returns an update builder for the given id.

func (*ProblemClient) Use

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

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

type ProblemConnection

type ProblemConnection struct {
	Edges      []*ProblemEdge `json:"edges"`
	PageInfo   PageInfo       `json:"pageInfo"`
	TotalCount int            `json:"totalCount"`
}

ProblemConnection is the connection containing edges to Problem.

type ProblemCreate

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

ProblemCreate is the builder for creating a Problem entity.

func (*ProblemCreate) AddSubmissionIDs

func (pc *ProblemCreate) AddSubmissionIDs(ids ...int) *ProblemCreate

AddSubmissionIDs adds the "submissions" edge to the Submission entity by IDs.

func (*ProblemCreate) AddSubmissions

func (pc *ProblemCreate) AddSubmissions(s ...*Submission) *ProblemCreate

AddSubmissions adds the "submissions" edges to the Submission entity.

func (*ProblemCreate) Exec

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

Exec executes the query.

func (*ProblemCreate) ExecX

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

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

func (*ProblemCreate) Mutation

func (pc *ProblemCreate) Mutation() *ProblemMutation

Mutation returns the ProblemMutation object of the builder.

func (*ProblemCreate) Save

func (pc *ProblemCreate) Save(ctx context.Context) (*Problem, error)

Save creates the Problem in the database.

func (*ProblemCreate) SaveX

func (pc *ProblemCreate) SaveX(ctx context.Context) *Problem

SaveX calls Save and panics if Save returns an error.

func (*ProblemCreate) SetCode

func (pc *ProblemCreate) SetCode(s string) *ProblemCreate

SetCode sets the "code" field.

func (*ProblemCreate) SetCreatedAt

func (pc *ProblemCreate) SetCreatedAt(t time.Time) *ProblemCreate

SetCreatedAt sets the "created_at" field.

func (*ProblemCreate) SetInput

SetInput applies the change-set in the CreateProblemInput on the ProblemCreate builder.

func (*ProblemCreate) SetJudge

func (pc *ProblemCreate) SetJudge(j *Judge) *ProblemCreate

SetJudge sets the "judge" edge to the Judge entity.

func (*ProblemCreate) SetJudgeID

func (pc *ProblemCreate) SetJudgeID(id int) *ProblemCreate

SetJudgeID sets the "judge" edge to the Judge entity by ID.

func (*ProblemCreate) SetName

func (pc *ProblemCreate) SetName(s string) *ProblemCreate

SetName sets the "name" field.

func (*ProblemCreate) SetNillableCreatedAt

func (pc *ProblemCreate) SetNillableCreatedAt(t *time.Time) *ProblemCreate

SetNillableCreatedAt sets the "created_at" field if the given value is not nil.

func (*ProblemCreate) SetNillableUpdatedAt

func (pc *ProblemCreate) SetNillableUpdatedAt(t *time.Time) *ProblemCreate

SetNillableUpdatedAt sets the "updated_at" field if the given value is not nil.

func (*ProblemCreate) SetUpdatedAt

func (pc *ProblemCreate) SetUpdatedAt(t time.Time) *ProblemCreate

SetUpdatedAt sets the "updated_at" field.

type ProblemCreateBulk

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

ProblemCreateBulk is the builder for creating many Problem entities in bulk.

func (*ProblemCreateBulk) Exec

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

Exec executes the query.

func (*ProblemCreateBulk) ExecX

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

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

func (*ProblemCreateBulk) Save

func (pcb *ProblemCreateBulk) Save(ctx context.Context) ([]*Problem, error)

Save creates the Problem entities in the database.

func (*ProblemCreateBulk) SaveX

func (pcb *ProblemCreateBulk) SaveX(ctx context.Context) []*Problem

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

type ProblemDelete

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

ProblemDelete is the builder for deleting a Problem entity.

func (*ProblemDelete) Exec

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

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

func (*ProblemDelete) ExecX

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

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

func (*ProblemDelete) Where

func (pd *ProblemDelete) Where(ps ...predicate.Problem) *ProblemDelete

Where appends a list predicates to the ProblemDelete builder.

type ProblemDeleteOne

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

ProblemDeleteOne is the builder for deleting a single Problem entity.

func (*ProblemDeleteOne) Exec

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

Exec executes the deletion query.

func (*ProblemDeleteOne) ExecX

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

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

func (*ProblemDeleteOne) Where

Where appends a list predicates to the ProblemDelete builder.

type ProblemEdge

type ProblemEdge struct {
	Node   *Problem `json:"node"`
	Cursor Cursor   `json:"cursor"`
}

ProblemEdge is the edge representation of Problem.

type ProblemEdges

type ProblemEdges struct {
	// Submissions holds the value of the submissions edge.
	Submissions []*Submission `json:"submissions,omitempty"`
	// Judge holds the value of the judge edge.
	Judge *Judge `json:"judge,omitempty"`
	// contains filtered or unexported fields
}

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

func (ProblemEdges) JudgeOrErr

func (e ProblemEdges) JudgeOrErr() (*Judge, error)

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

func (ProblemEdges) SubmissionsOrErr

func (e ProblemEdges) SubmissionsOrErr() ([]*Submission, error)

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

type ProblemGroupBy

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

ProblemGroupBy is the group-by builder for Problem entities.

func (*ProblemGroupBy) Aggregate

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

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

func (*ProblemGroupBy) Bool

func (s *ProblemGroupBy) Bool(ctx context.Context) (_ bool, err error)

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

func (*ProblemGroupBy) BoolX

func (s *ProblemGroupBy) BoolX(ctx context.Context) bool

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

func (*ProblemGroupBy) Bools

func (s *ProblemGroupBy) Bools(ctx context.Context) ([]bool, error)

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

func (*ProblemGroupBy) BoolsX

func (s *ProblemGroupBy) BoolsX(ctx context.Context) []bool

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

func (*ProblemGroupBy) Float64

func (s *ProblemGroupBy) Float64(ctx context.Context) (_ float64, err error)

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

func (*ProblemGroupBy) Float64X

func (s *ProblemGroupBy) Float64X(ctx context.Context) float64

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

func (*ProblemGroupBy) Float64s

func (s *ProblemGroupBy) Float64s(ctx context.Context) ([]float64, error)

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

func (*ProblemGroupBy) Float64sX

func (s *ProblemGroupBy) Float64sX(ctx context.Context) []float64

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

func (*ProblemGroupBy) Int

func (s *ProblemGroupBy) Int(ctx context.Context) (_ int, err error)

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

func (*ProblemGroupBy) IntX

func (s *ProblemGroupBy) IntX(ctx context.Context) int

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

func (*ProblemGroupBy) Ints

func (s *ProblemGroupBy) Ints(ctx context.Context) ([]int, error)

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

func (*ProblemGroupBy) IntsX

func (s *ProblemGroupBy) IntsX(ctx context.Context) []int

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

func (*ProblemGroupBy) Scan

func (pgb *ProblemGroupBy) Scan(ctx context.Context, v any) error

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

func (*ProblemGroupBy) ScanX

func (s *ProblemGroupBy) ScanX(ctx context.Context, v any)

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

func (*ProblemGroupBy) String

func (s *ProblemGroupBy) String(ctx context.Context) (_ string, err error)

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

func (*ProblemGroupBy) StringX

func (s *ProblemGroupBy) StringX(ctx context.Context) string

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

func (*ProblemGroupBy) Strings

func (s *ProblemGroupBy) Strings(ctx context.Context) ([]string, error)

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

func (*ProblemGroupBy) StringsX

func (s *ProblemGroupBy) StringsX(ctx context.Context) []string

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

type ProblemMutation

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

ProblemMutation represents an operation that mutates the Problem nodes in the graph.

func (*ProblemMutation) AddField

func (m *ProblemMutation) 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 (*ProblemMutation) AddSubmissionIDs

func (m *ProblemMutation) AddSubmissionIDs(ids ...int)

AddSubmissionIDs adds the "submissions" edge to the Submission entity by ids.

func (*ProblemMutation) AddedEdges

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

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

func (*ProblemMutation) AddedField

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

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

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

func (*ProblemMutation) AddedIDs

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

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

func (*ProblemMutation) ClearEdge

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

func (m *ProblemMutation) 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 (*ProblemMutation) ClearJudge

func (m *ProblemMutation) ClearJudge()

ClearJudge clears the "judge" edge to the Judge entity.

func (*ProblemMutation) ClearSubmissions

func (m *ProblemMutation) ClearSubmissions()

ClearSubmissions clears the "submissions" edge to the Submission entity.

func (*ProblemMutation) ClearedEdges

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

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

func (*ProblemMutation) ClearedFields

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

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

func (ProblemMutation) Client

func (m ProblemMutation) 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 (*ProblemMutation) Code

func (m *ProblemMutation) Code() (r string, exists bool)

Code returns the value of the "code" field in the mutation.

func (*ProblemMutation) CreatedAt

func (m *ProblemMutation) CreatedAt() (r time.Time, exists bool)

CreatedAt returns the value of the "created_at" field in the mutation.

func (*ProblemMutation) EdgeCleared

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

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

func (*ProblemMutation) Field

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

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

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

func (*ProblemMutation) Fields

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

func (m *ProblemMutation) 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 (*ProblemMutation) IDs

func (m *ProblemMutation) 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 (*ProblemMutation) JudgeCleared

func (m *ProblemMutation) JudgeCleared() bool

JudgeCleared reports if the "judge" edge to the Judge entity was cleared.

func (*ProblemMutation) JudgeID

func (m *ProblemMutation) JudgeID() (id int, exists bool)

JudgeID returns the "judge" edge ID in the mutation.

func (*ProblemMutation) JudgeIDs

func (m *ProblemMutation) JudgeIDs() (ids []int)

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

func (*ProblemMutation) Name

func (m *ProblemMutation) Name() (r string, exists bool)

Name returns the value of the "name" field in the mutation.

func (*ProblemMutation) OldCode

func (m *ProblemMutation) OldCode(ctx context.Context) (v string, err error)

OldCode returns the old "code" field's value of the Problem entity. If the Problem 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 (*ProblemMutation) OldCreatedAt

func (m *ProblemMutation) OldCreatedAt(ctx context.Context) (v time.Time, err error)

OldCreatedAt returns the old "created_at" field's value of the Problem entity. If the Problem 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 (*ProblemMutation) OldField

func (m *ProblemMutation) 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 (*ProblemMutation) OldName

func (m *ProblemMutation) OldName(ctx context.Context) (v string, err error)

OldName returns the old "name" field's value of the Problem entity. If the Problem 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 (*ProblemMutation) OldUpdatedAt

func (m *ProblemMutation) OldUpdatedAt(ctx context.Context) (v time.Time, err error)

OldUpdatedAt returns the old "updated_at" field's value of the Problem entity. If the Problem 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 (*ProblemMutation) Op

func (m *ProblemMutation) Op() Op

Op returns the operation name.

func (*ProblemMutation) RemoveSubmissionIDs

func (m *ProblemMutation) RemoveSubmissionIDs(ids ...int)

RemoveSubmissionIDs removes the "submissions" edge to the Submission entity by IDs.

func (*ProblemMutation) RemovedEdges

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

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

func (*ProblemMutation) RemovedIDs

func (m *ProblemMutation) 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 (*ProblemMutation) RemovedSubmissionsIDs

func (m *ProblemMutation) RemovedSubmissionsIDs() (ids []int)

RemovedSubmissions returns the removed IDs of the "submissions" edge to the Submission entity.

func (*ProblemMutation) ResetCode

func (m *ProblemMutation) ResetCode()

ResetCode resets all changes to the "code" field.

func (*ProblemMutation) ResetCreatedAt

func (m *ProblemMutation) ResetCreatedAt()

ResetCreatedAt resets all changes to the "created_at" field.

func (*ProblemMutation) ResetEdge

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

func (m *ProblemMutation) 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 (*ProblemMutation) ResetJudge

func (m *ProblemMutation) ResetJudge()

ResetJudge resets all changes to the "judge" edge.

func (*ProblemMutation) ResetName

func (m *ProblemMutation) ResetName()

ResetName resets all changes to the "name" field.

func (*ProblemMutation) ResetSubmissions

func (m *ProblemMutation) ResetSubmissions()

ResetSubmissions resets all changes to the "submissions" edge.

func (*ProblemMutation) ResetUpdatedAt

func (m *ProblemMutation) ResetUpdatedAt()

ResetUpdatedAt resets all changes to the "updated_at" field.

func (*ProblemMutation) SetCode

func (m *ProblemMutation) SetCode(s string)

SetCode sets the "code" field.

func (*ProblemMutation) SetCreatedAt

func (m *ProblemMutation) SetCreatedAt(t time.Time)

SetCreatedAt sets the "created_at" field.

func (*ProblemMutation) SetField

func (m *ProblemMutation) 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 (*ProblemMutation) SetJudgeID

func (m *ProblemMutation) SetJudgeID(id int)

SetJudgeID sets the "judge" edge to the Judge entity by id.

func (*ProblemMutation) SetName

func (m *ProblemMutation) SetName(s string)

SetName sets the "name" field.

func (*ProblemMutation) SetOp

func (m *ProblemMutation) SetOp(op Op)

SetOp allows setting the mutation operation.

func (*ProblemMutation) SetUpdatedAt

func (m *ProblemMutation) SetUpdatedAt(t time.Time)

SetUpdatedAt sets the "updated_at" field.

func (*ProblemMutation) SubmissionsCleared

func (m *ProblemMutation) SubmissionsCleared() bool

SubmissionsCleared reports if the "submissions" edge to the Submission entity was cleared.

func (*ProblemMutation) SubmissionsIDs

func (m *ProblemMutation) SubmissionsIDs() (ids []int)

SubmissionsIDs returns the "submissions" edge IDs in the mutation.

func (ProblemMutation) Tx

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

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

func (*ProblemMutation) Type

func (m *ProblemMutation) Type() string

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

func (*ProblemMutation) UpdatedAt

func (m *ProblemMutation) UpdatedAt() (r time.Time, exists bool)

UpdatedAt returns the value of the "updated_at" field in the mutation.

func (*ProblemMutation) Where

func (m *ProblemMutation) Where(ps ...predicate.Problem)

Where appends a list predicates to the ProblemMutation builder.

func (*ProblemMutation) WhereP

func (m *ProblemMutation) WhereP(ps ...func(*sql.Selector))

WhereP appends storage-level predicates to the ProblemMutation builder. Using this method, users can use type-assertion to append predicates that do not depend on any generated package.

type ProblemOrder

type ProblemOrder struct {
	Direction OrderDirection     `json:"direction"`
	Field     *ProblemOrderField `json:"field"`
}

ProblemOrder defines the ordering of Problem.

type ProblemOrderField

type ProblemOrderField struct {
	// Value extracts the ordering value from the given Problem.
	Value func(*Problem) (ent.Value, error)
	// contains filtered or unexported fields
}

ProblemOrderField defines the ordering field of Problem.

type ProblemPaginateOption

type ProblemPaginateOption func(*problemPager) error

ProblemPaginateOption enables pagination customization.

func WithProblemFilter

func WithProblemFilter(filter func(*ProblemQuery) (*ProblemQuery, error)) ProblemPaginateOption

WithProblemFilter configures pagination filter.

func WithProblemOrder

func WithProblemOrder(order *ProblemOrder) ProblemPaginateOption

WithProblemOrder configures pagination ordering.

type ProblemQuery

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

ProblemQuery is the builder for querying Problem entities.

func (*ProblemQuery) Aggregate

func (pq *ProblemQuery) Aggregate(fns ...AggregateFunc) *ProblemSelect

Aggregate returns a ProblemSelect configured with the given aggregations.

func (*ProblemQuery) All

func (pq *ProblemQuery) All(ctx context.Context) ([]*Problem, error)

All executes the query and returns a list of Problems.

func (*ProblemQuery) AllX

func (pq *ProblemQuery) AllX(ctx context.Context) []*Problem

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

func (*ProblemQuery) Clone

func (pq *ProblemQuery) Clone() *ProblemQuery

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

func (*ProblemQuery) CollectFields

func (pr *ProblemQuery) CollectFields(ctx context.Context, satisfies ...string) (*ProblemQuery, error)

CollectFields tells the query-builder to eagerly load connected nodes by resolver context.

func (*ProblemQuery) Count

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

Count returns the count of the given query.

func (*ProblemQuery) CountX

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

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

func (*ProblemQuery) Exist

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

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

func (*ProblemQuery) ExistX

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

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

func (*ProblemQuery) First

func (pq *ProblemQuery) First(ctx context.Context) (*Problem, error)

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

func (*ProblemQuery) FirstID

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

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

func (*ProblemQuery) FirstIDX

func (pq *ProblemQuery) FirstIDX(ctx context.Context) int

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

func (*ProblemQuery) FirstX

func (pq *ProblemQuery) FirstX(ctx context.Context) *Problem

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

func (*ProblemQuery) GroupBy

func (pq *ProblemQuery) GroupBy(field string, fields ...string) *ProblemGroupBy

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

client.Problem.Query().
	GroupBy(problem.FieldCreatedAt).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*ProblemQuery) IDs

func (pq *ProblemQuery) IDs(ctx context.Context) (ids []int, err error)

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

func (*ProblemQuery) IDsX

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

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

func (*ProblemQuery) Limit

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

Limit the number of records to be returned by this query.

func (*ProblemQuery) Offset

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

Offset to start from.

func (*ProblemQuery) Only

func (pq *ProblemQuery) Only(ctx context.Context) (*Problem, error)

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

func (*ProblemQuery) OnlyID

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

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

func (*ProblemQuery) OnlyIDX

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

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

func (*ProblemQuery) OnlyX

func (pq *ProblemQuery) OnlyX(ctx context.Context) *Problem

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

func (*ProblemQuery) Order

func (pq *ProblemQuery) Order(o ...problem.OrderOption) *ProblemQuery

Order specifies how the records should be ordered.

func (*ProblemQuery) Paginate

func (pr *ProblemQuery) Paginate(
	ctx context.Context, after *Cursor, first *int,
	before *Cursor, last *int, opts ...ProblemPaginateOption,
) (*ProblemConnection, error)

Paginate executes the query and returns a relay based cursor connection to Problem.

func (*ProblemQuery) QueryJudge

func (pq *ProblemQuery) QueryJudge() *JudgeQuery

QueryJudge chains the current query on the "judge" edge.

func (*ProblemQuery) QuerySubmissions

func (pq *ProblemQuery) QuerySubmissions() *SubmissionQuery

QuerySubmissions chains the current query on the "submissions" edge.

func (*ProblemQuery) Select

func (pq *ProblemQuery) Select(fields ...string) *ProblemSelect

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 {
	CreatedAt time.Time `json:"created_at,omitempty"`
}

client.Problem.Query().
	Select(problem.FieldCreatedAt).
	Scan(ctx, &v)

func (*ProblemQuery) Unique

func (pq *ProblemQuery) Unique(unique bool) *ProblemQuery

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

func (pq *ProblemQuery) Where(ps ...predicate.Problem) *ProblemQuery

Where adds a new predicate for the ProblemQuery builder.

func (*ProblemQuery) WithJudge

func (pq *ProblemQuery) WithJudge(opts ...func(*JudgeQuery)) *ProblemQuery

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

func (*ProblemQuery) WithNamedSubmissions

func (pq *ProblemQuery) WithNamedSubmissions(name string, opts ...func(*SubmissionQuery)) *ProblemQuery

WithNamedSubmissions tells the query-builder to eager-load the nodes that are connected to the "submissions" edge with the given name. The optional arguments are used to configure the query builder of the edge.

func (*ProblemQuery) WithSubmissions

func (pq *ProblemQuery) WithSubmissions(opts ...func(*SubmissionQuery)) *ProblemQuery

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

type ProblemSelect

type ProblemSelect struct {
	*ProblemQuery
	// contains filtered or unexported fields
}

ProblemSelect is the builder for selecting fields of Problem entities.

func (*ProblemSelect) Aggregate

func (ps *ProblemSelect) Aggregate(fns ...AggregateFunc) *ProblemSelect

Aggregate adds the given aggregation functions to the selector query.

func (*ProblemSelect) Bool

func (s *ProblemSelect) Bool(ctx context.Context) (_ bool, err error)

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

func (*ProblemSelect) BoolX

func (s *ProblemSelect) BoolX(ctx context.Context) bool

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

func (*ProblemSelect) Bools

func (s *ProblemSelect) Bools(ctx context.Context) ([]bool, error)

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

func (*ProblemSelect) BoolsX

func (s *ProblemSelect) BoolsX(ctx context.Context) []bool

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

func (*ProblemSelect) Float64

func (s *ProblemSelect) Float64(ctx context.Context) (_ float64, err error)

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

func (*ProblemSelect) Float64X

func (s *ProblemSelect) Float64X(ctx context.Context) float64

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

func (*ProblemSelect) Float64s

func (s *ProblemSelect) Float64s(ctx context.Context) ([]float64, error)

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

func (*ProblemSelect) Float64sX

func (s *ProblemSelect) Float64sX(ctx context.Context) []float64

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

func (*ProblemSelect) Int

func (s *ProblemSelect) Int(ctx context.Context) (_ int, err error)

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

func (*ProblemSelect) IntX

func (s *ProblemSelect) IntX(ctx context.Context) int

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

func (*ProblemSelect) Ints

func (s *ProblemSelect) Ints(ctx context.Context) ([]int, error)

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

func (*ProblemSelect) IntsX

func (s *ProblemSelect) IntsX(ctx context.Context) []int

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

func (*ProblemSelect) Scan

func (ps *ProblemSelect) Scan(ctx context.Context, v any) error

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

func (*ProblemSelect) ScanX

func (s *ProblemSelect) ScanX(ctx context.Context, v any)

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

func (*ProblemSelect) String

func (s *ProblemSelect) String(ctx context.Context) (_ string, err error)

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

func (*ProblemSelect) StringX

func (s *ProblemSelect) StringX(ctx context.Context) string

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

func (*ProblemSelect) Strings

func (s *ProblemSelect) Strings(ctx context.Context) ([]string, error)

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

func (*ProblemSelect) StringsX

func (s *ProblemSelect) StringsX(ctx context.Context) []string

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

type ProblemUpdate

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

ProblemUpdate is the builder for updating Problem entities.

func (*ProblemUpdate) AddSubmissionIDs

func (pu *ProblemUpdate) AddSubmissionIDs(ids ...int) *ProblemUpdate

AddSubmissionIDs adds the "submissions" edge to the Submission entity by IDs.

func (*ProblemUpdate) AddSubmissions

func (pu *ProblemUpdate) AddSubmissions(s ...*Submission) *ProblemUpdate

AddSubmissions adds the "submissions" edges to the Submission entity.

func (*ProblemUpdate) ClearJudge

func (pu *ProblemUpdate) ClearJudge() *ProblemUpdate

ClearJudge clears the "judge" edge to the Judge entity.

func (*ProblemUpdate) ClearSubmissions

func (pu *ProblemUpdate) ClearSubmissions() *ProblemUpdate

ClearSubmissions clears all "submissions" edges to the Submission entity.

func (*ProblemUpdate) Exec

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

Exec executes the query.

func (*ProblemUpdate) ExecX

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

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

func (*ProblemUpdate) Mutation

func (pu *ProblemUpdate) Mutation() *ProblemMutation

Mutation returns the ProblemMutation object of the builder.

func (*ProblemUpdate) RemoveSubmissionIDs

func (pu *ProblemUpdate) RemoveSubmissionIDs(ids ...int) *ProblemUpdate

RemoveSubmissionIDs removes the "submissions" edge to Submission entities by IDs.

func (*ProblemUpdate) RemoveSubmissions

func (pu *ProblemUpdate) RemoveSubmissions(s ...*Submission) *ProblemUpdate

RemoveSubmissions removes "submissions" edges to Submission entities.

func (*ProblemUpdate) Save

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

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

func (*ProblemUpdate) SaveX

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

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

func (*ProblemUpdate) SetCode

func (pu *ProblemUpdate) SetCode(s string) *ProblemUpdate

SetCode sets the "code" field.

func (*ProblemUpdate) SetInput

SetInput applies the change-set in the UpdateProblemInput on the ProblemUpdate builder.

func (*ProblemUpdate) SetJudge

func (pu *ProblemUpdate) SetJudge(j *Judge) *ProblemUpdate

SetJudge sets the "judge" edge to the Judge entity.

func (*ProblemUpdate) SetJudgeID

func (pu *ProblemUpdate) SetJudgeID(id int) *ProblemUpdate

SetJudgeID sets the "judge" edge to the Judge entity by ID.

func (*ProblemUpdate) SetName

func (pu *ProblemUpdate) SetName(s string) *ProblemUpdate

SetName sets the "name" field.

func (*ProblemUpdate) SetNillableCode

func (pu *ProblemUpdate) SetNillableCode(s *string) *ProblemUpdate

SetNillableCode sets the "code" field if the given value is not nil.

func (*ProblemUpdate) SetNillableName

func (pu *ProblemUpdate) SetNillableName(s *string) *ProblemUpdate

SetNillableName sets the "name" field if the given value is not nil.

func (*ProblemUpdate) SetUpdatedAt

func (pu *ProblemUpdate) SetUpdatedAt(t time.Time) *ProblemUpdate

SetUpdatedAt sets the "updated_at" field.

func (*ProblemUpdate) Where

func (pu *ProblemUpdate) Where(ps ...predicate.Problem) *ProblemUpdate

Where appends a list predicates to the ProblemUpdate builder.

type ProblemUpdateOne

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

ProblemUpdateOne is the builder for updating a single Problem entity.

func (*ProblemUpdateOne) AddSubmissionIDs

func (puo *ProblemUpdateOne) AddSubmissionIDs(ids ...int) *ProblemUpdateOne

AddSubmissionIDs adds the "submissions" edge to the Submission entity by IDs.

func (*ProblemUpdateOne) AddSubmissions

func (puo *ProblemUpdateOne) AddSubmissions(s ...*Submission) *ProblemUpdateOne

AddSubmissions adds the "submissions" edges to the Submission entity.

func (*ProblemUpdateOne) ClearJudge

func (puo *ProblemUpdateOne) ClearJudge() *ProblemUpdateOne

ClearJudge clears the "judge" edge to the Judge entity.

func (*ProblemUpdateOne) ClearSubmissions

func (puo *ProblemUpdateOne) ClearSubmissions() *ProblemUpdateOne

ClearSubmissions clears all "submissions" edges to the Submission entity.

func (*ProblemUpdateOne) Exec

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

Exec executes the query on the entity.

func (*ProblemUpdateOne) ExecX

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

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

func (*ProblemUpdateOne) Mutation

func (puo *ProblemUpdateOne) Mutation() *ProblemMutation

Mutation returns the ProblemMutation object of the builder.

func (*ProblemUpdateOne) RemoveSubmissionIDs

func (puo *ProblemUpdateOne) RemoveSubmissionIDs(ids ...int) *ProblemUpdateOne

RemoveSubmissionIDs removes the "submissions" edge to Submission entities by IDs.

func (*ProblemUpdateOne) RemoveSubmissions

func (puo *ProblemUpdateOne) RemoveSubmissions(s ...*Submission) *ProblemUpdateOne

RemoveSubmissions removes "submissions" edges to Submission entities.

func (*ProblemUpdateOne) Save

func (puo *ProblemUpdateOne) Save(ctx context.Context) (*Problem, error)

Save executes the query and returns the updated Problem entity.

func (*ProblemUpdateOne) SaveX

func (puo *ProblemUpdateOne) SaveX(ctx context.Context) *Problem

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

func (*ProblemUpdateOne) Select

func (puo *ProblemUpdateOne) Select(field string, fields ...string) *ProblemUpdateOne

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

func (*ProblemUpdateOne) SetCode

func (puo *ProblemUpdateOne) SetCode(s string) *ProblemUpdateOne

SetCode sets the "code" field.

func (*ProblemUpdateOne) SetInput

SetInput applies the change-set in the UpdateProblemInput on the ProblemUpdateOne builder.

func (*ProblemUpdateOne) SetJudge

func (puo *ProblemUpdateOne) SetJudge(j *Judge) *ProblemUpdateOne

SetJudge sets the "judge" edge to the Judge entity.

func (*ProblemUpdateOne) SetJudgeID

func (puo *ProblemUpdateOne) SetJudgeID(id int) *ProblemUpdateOne

SetJudgeID sets the "judge" edge to the Judge entity by ID.

func (*ProblemUpdateOne) SetName

func (puo *ProblemUpdateOne) SetName(s string) *ProblemUpdateOne

SetName sets the "name" field.

func (*ProblemUpdateOne) SetNillableCode

func (puo *ProblemUpdateOne) SetNillableCode(s *string) *ProblemUpdateOne

SetNillableCode sets the "code" field if the given value is not nil.

func (*ProblemUpdateOne) SetNillableName

func (puo *ProblemUpdateOne) SetNillableName(s *string) *ProblemUpdateOne

SetNillableName sets the "name" field if the given value is not nil.

func (*ProblemUpdateOne) SetUpdatedAt

func (puo *ProblemUpdateOne) SetUpdatedAt(t time.Time) *ProblemUpdateOne

SetUpdatedAt sets the "updated_at" field.

func (*ProblemUpdateOne) Where

Where appends a list predicates to the ProblemUpdate builder.

type Problems

type Problems []*Problem

Problems is a parsable slice of Problem.

type Querier

type Querier = ent.Querier

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

type QuerierFunc

type QuerierFunc = ent.QuerierFunc

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

type Query

type Query = ent.Query

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

type QueryContext

type QueryContext = ent.QueryContext

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 Submission

type Submission struct {

	// ID of the ent.
	ID int `json:"id,omitempty"`
	// Time when the entity was created.
	CreatedAt time.Time `json:"created_at,omitempty"`
	// Time when the entity was last updated.
	UpdatedAt time.Time `json:"updated_at,omitempty"`
	// Status of the submission. Example: finished
	Status submission.Status `json:"status,omitempty"`
	// Verdict of the submission. Example: OK
	Verdict submission.Verdict `json:"verdict,omitempty"`
	// Number of test cases finished or currently judging. Example: 13
	TestCount int `json:"test_count,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the SubmissionQuery when eager-loading is set.
	Edges SubmissionEdges `json:"edges"`
	// contains filtered or unexported fields
}

Submission is the model entity for the Submission schema.

func (*Submission) IsNode

func (*Submission) IsNode()

IsNode implements the Node interface check for GQLGen.

func (*Submission) Problem

func (s *Submission) Problem(ctx context.Context) (*Problem, error)

func (*Submission) QueryProblem

func (s *Submission) QueryProblem() *ProblemQuery

QueryProblem queries the "problem" edge of the Submission entity.

func (*Submission) String

func (s *Submission) String() string

String implements the fmt.Stringer.

func (*Submission) ToEdge

func (s *Submission) ToEdge(order *SubmissionOrder) *SubmissionEdge

ToEdge converts Submission into SubmissionEdge.

func (*Submission) Unwrap

func (s *Submission) Unwrap() *Submission

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

func (s *Submission) Update() *SubmissionUpdateOne

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

func (*Submission) Value

func (s *Submission) Value(name string) (ent.Value, error)

Value returns the ent.Value that was dynamically selected and assigned to the Submission. This includes values selected through modifiers, order, etc.

type SubmissionClient

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

SubmissionClient is a client for the Submission schema.

func NewSubmissionClient

func NewSubmissionClient(c config) *SubmissionClient

NewSubmissionClient returns a client for the Submission from the given config.

func (*SubmissionClient) Create

func (c *SubmissionClient) Create() *SubmissionCreate

Create returns a builder for creating a Submission entity.

func (*SubmissionClient) CreateBulk

func (c *SubmissionClient) CreateBulk(builders ...*SubmissionCreate) *SubmissionCreateBulk

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

func (*SubmissionClient) Delete

func (c *SubmissionClient) Delete() *SubmissionDelete

Delete returns a delete builder for Submission.

func (*SubmissionClient) DeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*SubmissionClient) DeleteOneID

func (c *SubmissionClient) DeleteOneID(id int) *SubmissionDeleteOne

DeleteOneID returns a builder for deleting the given entity by its id.

func (*SubmissionClient) Get

func (c *SubmissionClient) Get(ctx context.Context, id int) (*Submission, error)

Get returns a Submission entity by its id.

func (*SubmissionClient) GetX

func (c *SubmissionClient) GetX(ctx context.Context, id int) *Submission

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

func (*SubmissionClient) Hooks

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

Hooks returns the client hooks.

func (*SubmissionClient) Intercept

func (c *SubmissionClient) Intercept(interceptors ...Interceptor)

Intercept adds a list of query interceptors to the interceptors stack. A call to `Intercept(f, g, h)` equals to `submission.Intercept(f(g(h())))`.

func (*SubmissionClient) Interceptors

func (c *SubmissionClient) Interceptors() []Interceptor

Interceptors returns the client interceptors.

func (*SubmissionClient) MapCreateBulk

func (c *SubmissionClient) MapCreateBulk(slice any, setFunc func(*SubmissionCreate, int)) *SubmissionCreateBulk

MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates a builder and applies setFunc on it.

func (*SubmissionClient) Query

func (c *SubmissionClient) Query() *SubmissionQuery

Query returns a query builder for Submission.

func (*SubmissionClient) QueryProblem

func (c *SubmissionClient) QueryProblem(s *Submission) *ProblemQuery

QueryProblem queries the problem edge of a Submission.

func (*SubmissionClient) Update

func (c *SubmissionClient) Update() *SubmissionUpdate

Update returns an update builder for Submission.

func (*SubmissionClient) UpdateOne

UpdateOne returns an update builder for the given entity.

func (*SubmissionClient) UpdateOneID

func (c *SubmissionClient) UpdateOneID(id int) *SubmissionUpdateOne

UpdateOneID returns an update builder for the given id.

func (*SubmissionClient) Use

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

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

type SubmissionConnection

type SubmissionConnection struct {
	Edges      []*SubmissionEdge `json:"edges"`
	PageInfo   PageInfo          `json:"pageInfo"`
	TotalCount int               `json:"totalCount"`
}

SubmissionConnection is the connection containing edges to Submission.

type SubmissionCreate

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

SubmissionCreate is the builder for creating a Submission entity.

func (*SubmissionCreate) Exec

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

Exec executes the query.

func (*SubmissionCreate) ExecX

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

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

func (*SubmissionCreate) Mutation

func (sc *SubmissionCreate) Mutation() *SubmissionMutation

Mutation returns the SubmissionMutation object of the builder.

func (*SubmissionCreate) Save

func (sc *SubmissionCreate) Save(ctx context.Context) (*Submission, error)

Save creates the Submission in the database.

func (*SubmissionCreate) SaveX

func (sc *SubmissionCreate) SaveX(ctx context.Context) *Submission

SaveX calls Save and panics if Save returns an error.

func (*SubmissionCreate) SetCreatedAt

func (sc *SubmissionCreate) SetCreatedAt(t time.Time) *SubmissionCreate

SetCreatedAt sets the "created_at" field.

func (*SubmissionCreate) SetInput

SetInput applies the change-set in the CreateSubmissionInput on the SubmissionCreate builder.

func (*SubmissionCreate) SetNillableCreatedAt

func (sc *SubmissionCreate) SetNillableCreatedAt(t *time.Time) *SubmissionCreate

SetNillableCreatedAt sets the "created_at" field if the given value is not nil.

func (*SubmissionCreate) SetNillableStatus

func (sc *SubmissionCreate) SetNillableStatus(s *submission.Status) *SubmissionCreate

SetNillableStatus sets the "status" field if the given value is not nil.

func (*SubmissionCreate) SetNillableTestCount

func (sc *SubmissionCreate) SetNillableTestCount(i *int) *SubmissionCreate

SetNillableTestCount sets the "test_count" field if the given value is not nil.

func (*SubmissionCreate) SetNillableUpdatedAt

func (sc *SubmissionCreate) SetNillableUpdatedAt(t *time.Time) *SubmissionCreate

SetNillableUpdatedAt sets the "updated_at" field if the given value is not nil.

func (*SubmissionCreate) SetNillableVerdict

func (sc *SubmissionCreate) SetNillableVerdict(s *submission.Verdict) *SubmissionCreate

SetNillableVerdict sets the "verdict" field if the given value is not nil.

func (*SubmissionCreate) SetProblem

func (sc *SubmissionCreate) SetProblem(p *Problem) *SubmissionCreate

SetProblem sets the "problem" edge to the Problem entity.

func (*SubmissionCreate) SetProblemID

func (sc *SubmissionCreate) SetProblemID(id int) *SubmissionCreate

SetProblemID sets the "problem" edge to the Problem entity by ID.

func (*SubmissionCreate) SetStatus

SetStatus sets the "status" field.

func (*SubmissionCreate) SetTestCount

func (sc *SubmissionCreate) SetTestCount(i int) *SubmissionCreate

SetTestCount sets the "test_count" field.

func (*SubmissionCreate) SetUpdatedAt

func (sc *SubmissionCreate) SetUpdatedAt(t time.Time) *SubmissionCreate

SetUpdatedAt sets the "updated_at" field.

func (*SubmissionCreate) SetVerdict

SetVerdict sets the "verdict" field.

type SubmissionCreateBulk

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

SubmissionCreateBulk is the builder for creating many Submission entities in bulk.

func (*SubmissionCreateBulk) Exec

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

Exec executes the query.

func (*SubmissionCreateBulk) ExecX

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

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

func (*SubmissionCreateBulk) Save

func (scb *SubmissionCreateBulk) Save(ctx context.Context) ([]*Submission, error)

Save creates the Submission entities in the database.

func (*SubmissionCreateBulk) SaveX

func (scb *SubmissionCreateBulk) SaveX(ctx context.Context) []*Submission

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

type SubmissionDelete

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

SubmissionDelete is the builder for deleting a Submission entity.

func (*SubmissionDelete) Exec

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

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

func (*SubmissionDelete) ExecX

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

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

func (*SubmissionDelete) Where

Where appends a list predicates to the SubmissionDelete builder.

type SubmissionDeleteOne

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

SubmissionDeleteOne is the builder for deleting a single Submission entity.

func (*SubmissionDeleteOne) Exec

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

Exec executes the deletion query.

func (*SubmissionDeleteOne) ExecX

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

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

func (*SubmissionDeleteOne) Where

Where appends a list predicates to the SubmissionDelete builder.

type SubmissionEdge

type SubmissionEdge struct {
	Node   *Submission `json:"node"`
	Cursor Cursor      `json:"cursor"`
}

SubmissionEdge is the edge representation of Submission.

type SubmissionEdges

type SubmissionEdges struct {
	// Problem holds the value of the problem edge.
	Problem *Problem `json:"problem,omitempty"`
	// contains filtered or unexported fields
}

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

func (SubmissionEdges) ProblemOrErr

func (e SubmissionEdges) ProblemOrErr() (*Problem, error)

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

type SubmissionGroupBy

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

SubmissionGroupBy is the group-by builder for Submission entities.

func (*SubmissionGroupBy) Aggregate

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

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

func (*SubmissionGroupBy) Bool

func (s *SubmissionGroupBy) Bool(ctx context.Context) (_ bool, err error)

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

func (*SubmissionGroupBy) BoolX

func (s *SubmissionGroupBy) BoolX(ctx context.Context) bool

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

func (*SubmissionGroupBy) Bools

func (s *SubmissionGroupBy) Bools(ctx context.Context) ([]bool, error)

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

func (*SubmissionGroupBy) BoolsX

func (s *SubmissionGroupBy) BoolsX(ctx context.Context) []bool

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

func (*SubmissionGroupBy) Float64

func (s *SubmissionGroupBy) Float64(ctx context.Context) (_ float64, err error)

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

func (*SubmissionGroupBy) Float64X

func (s *SubmissionGroupBy) Float64X(ctx context.Context) float64

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

func (*SubmissionGroupBy) Float64s

func (s *SubmissionGroupBy) Float64s(ctx context.Context) ([]float64, error)

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

func (*SubmissionGroupBy) Float64sX

func (s *SubmissionGroupBy) Float64sX(ctx context.Context) []float64

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

func (*SubmissionGroupBy) Int

func (s *SubmissionGroupBy) Int(ctx context.Context) (_ int, err error)

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

func (*SubmissionGroupBy) IntX

func (s *SubmissionGroupBy) IntX(ctx context.Context) int

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

func (*SubmissionGroupBy) Ints

func (s *SubmissionGroupBy) Ints(ctx context.Context) ([]int, error)

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

func (*SubmissionGroupBy) IntsX

func (s *SubmissionGroupBy) IntsX(ctx context.Context) []int

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

func (*SubmissionGroupBy) Scan

func (sgb *SubmissionGroupBy) Scan(ctx context.Context, v any) error

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

func (*SubmissionGroupBy) ScanX

func (s *SubmissionGroupBy) ScanX(ctx context.Context, v any)

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

func (*SubmissionGroupBy) String

func (s *SubmissionGroupBy) String(ctx context.Context) (_ string, err error)

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

func (*SubmissionGroupBy) StringX

func (s *SubmissionGroupBy) StringX(ctx context.Context) string

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

func (*SubmissionGroupBy) Strings

func (s *SubmissionGroupBy) Strings(ctx context.Context) ([]string, error)

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

func (*SubmissionGroupBy) StringsX

func (s *SubmissionGroupBy) StringsX(ctx context.Context) []string

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

type SubmissionMutation

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

SubmissionMutation represents an operation that mutates the Submission nodes in the graph.

func (*SubmissionMutation) AddField

func (m *SubmissionMutation) 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 (*SubmissionMutation) AddTestCount

func (m *SubmissionMutation) AddTestCount(i int)

AddTestCount adds i to the "test_count" field.

func (*SubmissionMutation) AddedEdges

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

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

func (*SubmissionMutation) AddedField

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

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

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

func (*SubmissionMutation) AddedIDs

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

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

func (*SubmissionMutation) AddedTestCount

func (m *SubmissionMutation) AddedTestCount() (r int, exists bool)

AddedTestCount returns the value that was added to the "test_count" field in this mutation.

func (*SubmissionMutation) ClearEdge

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

func (m *SubmissionMutation) 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 (*SubmissionMutation) ClearProblem

func (m *SubmissionMutation) ClearProblem()

ClearProblem clears the "problem" edge to the Problem entity.

func (*SubmissionMutation) ClearedEdges

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

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

func (*SubmissionMutation) ClearedFields

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

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

func (SubmissionMutation) Client

func (m SubmissionMutation) 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 (*SubmissionMutation) CreatedAt

func (m *SubmissionMutation) CreatedAt() (r time.Time, exists bool)

CreatedAt returns the value of the "created_at" field in the mutation.

func (*SubmissionMutation) EdgeCleared

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

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

func (*SubmissionMutation) Field

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

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

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

func (*SubmissionMutation) Fields

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

func (m *SubmissionMutation) 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 (*SubmissionMutation) IDs

func (m *SubmissionMutation) 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 (*SubmissionMutation) OldCreatedAt

func (m *SubmissionMutation) OldCreatedAt(ctx context.Context) (v time.Time, err error)

OldCreatedAt returns the old "created_at" field's value of the Submission entity. If the Submission 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 (*SubmissionMutation) OldField

func (m *SubmissionMutation) 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 (*SubmissionMutation) OldStatus

func (m *SubmissionMutation) OldStatus(ctx context.Context) (v submission.Status, err error)

OldStatus returns the old "status" field's value of the Submission entity. If the Submission 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 (*SubmissionMutation) OldTestCount

func (m *SubmissionMutation) OldTestCount(ctx context.Context) (v int, err error)

OldTestCount returns the old "test_count" field's value of the Submission entity. If the Submission 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 (*SubmissionMutation) OldUpdatedAt

func (m *SubmissionMutation) OldUpdatedAt(ctx context.Context) (v time.Time, err error)

OldUpdatedAt returns the old "updated_at" field's value of the Submission entity. If the Submission 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 (*SubmissionMutation) OldVerdict

func (m *SubmissionMutation) OldVerdict(ctx context.Context) (v submission.Verdict, err error)

OldVerdict returns the old "verdict" field's value of the Submission entity. If the Submission 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 (*SubmissionMutation) Op

func (m *SubmissionMutation) Op() Op

Op returns the operation name.

func (*SubmissionMutation) ProblemCleared

func (m *SubmissionMutation) ProblemCleared() bool

ProblemCleared reports if the "problem" edge to the Problem entity was cleared.

func (*SubmissionMutation) ProblemID

func (m *SubmissionMutation) ProblemID() (id int, exists bool)

ProblemID returns the "problem" edge ID in the mutation.

func (*SubmissionMutation) ProblemIDs

func (m *SubmissionMutation) ProblemIDs() (ids []int)

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

func (*SubmissionMutation) RemovedEdges

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

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

func (*SubmissionMutation) RemovedIDs

func (m *SubmissionMutation) 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 (*SubmissionMutation) ResetCreatedAt

func (m *SubmissionMutation) ResetCreatedAt()

ResetCreatedAt resets all changes to the "created_at" field.

func (*SubmissionMutation) ResetEdge

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

func (m *SubmissionMutation) 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 (*SubmissionMutation) ResetProblem

func (m *SubmissionMutation) ResetProblem()

ResetProblem resets all changes to the "problem" edge.

func (*SubmissionMutation) ResetStatus

func (m *SubmissionMutation) ResetStatus()

ResetStatus resets all changes to the "status" field.

func (*SubmissionMutation) ResetTestCount

func (m *SubmissionMutation) ResetTestCount()

ResetTestCount resets all changes to the "test_count" field.

func (*SubmissionMutation) ResetUpdatedAt

func (m *SubmissionMutation) ResetUpdatedAt()

ResetUpdatedAt resets all changes to the "updated_at" field.

func (*SubmissionMutation) ResetVerdict

func (m *SubmissionMutation) ResetVerdict()

ResetVerdict resets all changes to the "verdict" field.

func (*SubmissionMutation) SetCreatedAt

func (m *SubmissionMutation) SetCreatedAt(t time.Time)

SetCreatedAt sets the "created_at" field.

func (*SubmissionMutation) SetField

func (m *SubmissionMutation) 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 (*SubmissionMutation) SetOp

func (m *SubmissionMutation) SetOp(op Op)

SetOp allows setting the mutation operation.

func (*SubmissionMutation) SetProblemID

func (m *SubmissionMutation) SetProblemID(id int)

SetProblemID sets the "problem" edge to the Problem entity by id.

func (*SubmissionMutation) SetStatus

func (m *SubmissionMutation) SetStatus(s submission.Status)

SetStatus sets the "status" field.

func (*SubmissionMutation) SetTestCount

func (m *SubmissionMutation) SetTestCount(i int)

SetTestCount sets the "test_count" field.

func (*SubmissionMutation) SetUpdatedAt

func (m *SubmissionMutation) SetUpdatedAt(t time.Time)

SetUpdatedAt sets the "updated_at" field.

func (*SubmissionMutation) SetVerdict

func (m *SubmissionMutation) SetVerdict(s submission.Verdict)

SetVerdict sets the "verdict" field.

func (*SubmissionMutation) Status

func (m *SubmissionMutation) Status() (r submission.Status, exists bool)

Status returns the value of the "status" field in the mutation.

func (*SubmissionMutation) TestCount

func (m *SubmissionMutation) TestCount() (r int, exists bool)

TestCount returns the value of the "test_count" field in the mutation.

func (SubmissionMutation) Tx

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

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

func (*SubmissionMutation) Type

func (m *SubmissionMutation) Type() string

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

func (*SubmissionMutation) UpdatedAt

func (m *SubmissionMutation) UpdatedAt() (r time.Time, exists bool)

UpdatedAt returns the value of the "updated_at" field in the mutation.

func (*SubmissionMutation) Verdict

func (m *SubmissionMutation) Verdict() (r submission.Verdict, exists bool)

Verdict returns the value of the "verdict" field in the mutation.

func (*SubmissionMutation) Where

func (m *SubmissionMutation) Where(ps ...predicate.Submission)

Where appends a list predicates to the SubmissionMutation builder.

func (*SubmissionMutation) WhereP

func (m *SubmissionMutation) WhereP(ps ...func(*sql.Selector))

WhereP appends storage-level predicates to the SubmissionMutation builder. Using this method, users can use type-assertion to append predicates that do not depend on any generated package.

type SubmissionOrder

type SubmissionOrder struct {
	Direction OrderDirection        `json:"direction"`
	Field     *SubmissionOrderField `json:"field"`
}

SubmissionOrder defines the ordering of Submission.

type SubmissionOrderField

type SubmissionOrderField struct {
	// Value extracts the ordering value from the given Submission.
	Value func(*Submission) (ent.Value, error)
	// contains filtered or unexported fields
}

SubmissionOrderField defines the ordering field of Submission.

type SubmissionPaginateOption

type SubmissionPaginateOption func(*submissionPager) error

SubmissionPaginateOption enables pagination customization.

func WithSubmissionFilter

func WithSubmissionFilter(filter func(*SubmissionQuery) (*SubmissionQuery, error)) SubmissionPaginateOption

WithSubmissionFilter configures pagination filter.

func WithSubmissionOrder

func WithSubmissionOrder(order *SubmissionOrder) SubmissionPaginateOption

WithSubmissionOrder configures pagination ordering.

type SubmissionQuery

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

SubmissionQuery is the builder for querying Submission entities.

func (*SubmissionQuery) Aggregate

func (sq *SubmissionQuery) Aggregate(fns ...AggregateFunc) *SubmissionSelect

Aggregate returns a SubmissionSelect configured with the given aggregations.

func (*SubmissionQuery) All

func (sq *SubmissionQuery) All(ctx context.Context) ([]*Submission, error)

All executes the query and returns a list of Submissions.

func (*SubmissionQuery) AllX

func (sq *SubmissionQuery) AllX(ctx context.Context) []*Submission

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

func (*SubmissionQuery) Clone

func (sq *SubmissionQuery) Clone() *SubmissionQuery

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

func (*SubmissionQuery) CollectFields

func (s *SubmissionQuery) CollectFields(ctx context.Context, satisfies ...string) (*SubmissionQuery, error)

CollectFields tells the query-builder to eagerly load connected nodes by resolver context.

func (*SubmissionQuery) Count

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

Count returns the count of the given query.

func (*SubmissionQuery) CountX

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

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

func (*SubmissionQuery) Exist

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

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

func (*SubmissionQuery) ExistX

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

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

func (*SubmissionQuery) First

func (sq *SubmissionQuery) First(ctx context.Context) (*Submission, error)

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

func (*SubmissionQuery) FirstID

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

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

func (*SubmissionQuery) FirstIDX

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

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

func (*SubmissionQuery) FirstX

func (sq *SubmissionQuery) FirstX(ctx context.Context) *Submission

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

func (*SubmissionQuery) GroupBy

func (sq *SubmissionQuery) GroupBy(field string, fields ...string) *SubmissionGroupBy

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

client.Submission.Query().
	GroupBy(submission.FieldCreatedAt).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*SubmissionQuery) IDs

func (sq *SubmissionQuery) IDs(ctx context.Context) (ids []int, err error)

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

func (*SubmissionQuery) IDsX

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

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

func (*SubmissionQuery) Limit

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

Limit the number of records to be returned by this query.

func (*SubmissionQuery) Offset

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

Offset to start from.

func (*SubmissionQuery) Only

func (sq *SubmissionQuery) Only(ctx context.Context) (*Submission, error)

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

func (*SubmissionQuery) OnlyID

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

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

func (*SubmissionQuery) OnlyIDX

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

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

func (*SubmissionQuery) OnlyX

func (sq *SubmissionQuery) OnlyX(ctx context.Context) *Submission

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

func (*SubmissionQuery) Order

Order specifies how the records should be ordered.

func (*SubmissionQuery) Paginate

func (s *SubmissionQuery) Paginate(
	ctx context.Context, after *Cursor, first *int,
	before *Cursor, last *int, opts ...SubmissionPaginateOption,
) (*SubmissionConnection, error)

Paginate executes the query and returns a relay based cursor connection to Submission.

func (*SubmissionQuery) QueryProblem

func (sq *SubmissionQuery) QueryProblem() *ProblemQuery

QueryProblem chains the current query on the "problem" edge.

func (*SubmissionQuery) Select

func (sq *SubmissionQuery) Select(fields ...string) *SubmissionSelect

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 {
	CreatedAt time.Time `json:"created_at,omitempty"`
}

client.Submission.Query().
	Select(submission.FieldCreatedAt).
	Scan(ctx, &v)

func (*SubmissionQuery) Unique

func (sq *SubmissionQuery) Unique(unique bool) *SubmissionQuery

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

Where adds a new predicate for the SubmissionQuery builder.

func (*SubmissionQuery) WithProblem

func (sq *SubmissionQuery) WithProblem(opts ...func(*ProblemQuery)) *SubmissionQuery

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

type SubmissionSelect

type SubmissionSelect struct {
	*SubmissionQuery
	// contains filtered or unexported fields
}

SubmissionSelect is the builder for selecting fields of Submission entities.

func (*SubmissionSelect) Aggregate

func (ss *SubmissionSelect) Aggregate(fns ...AggregateFunc) *SubmissionSelect

Aggregate adds the given aggregation functions to the selector query.

func (*SubmissionSelect) Bool

func (s *SubmissionSelect) Bool(ctx context.Context) (_ bool, err error)

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

func (*SubmissionSelect) BoolX

func (s *SubmissionSelect) BoolX(ctx context.Context) bool

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

func (*SubmissionSelect) Bools

func (s *SubmissionSelect) Bools(ctx context.Context) ([]bool, error)

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

func (*SubmissionSelect) BoolsX

func (s *SubmissionSelect) BoolsX(ctx context.Context) []bool

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

func (*SubmissionSelect) Float64

func (s *SubmissionSelect) Float64(ctx context.Context) (_ float64, err error)

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

func (*SubmissionSelect) Float64X

func (s *SubmissionSelect) Float64X(ctx context.Context) float64

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

func (*SubmissionSelect) Float64s

func (s *SubmissionSelect) Float64s(ctx context.Context) ([]float64, error)

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

func (*SubmissionSelect) Float64sX

func (s *SubmissionSelect) Float64sX(ctx context.Context) []float64

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

func (*SubmissionSelect) Int

func (s *SubmissionSelect) Int(ctx context.Context) (_ int, err error)

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

func (*SubmissionSelect) IntX

func (s *SubmissionSelect) IntX(ctx context.Context) int

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

func (*SubmissionSelect) Ints

func (s *SubmissionSelect) Ints(ctx context.Context) ([]int, error)

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

func (*SubmissionSelect) IntsX

func (s *SubmissionSelect) IntsX(ctx context.Context) []int

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

func (*SubmissionSelect) Scan

func (ss *SubmissionSelect) Scan(ctx context.Context, v any) error

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

func (*SubmissionSelect) ScanX

func (s *SubmissionSelect) ScanX(ctx context.Context, v any)

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

func (*SubmissionSelect) String

func (s *SubmissionSelect) String(ctx context.Context) (_ string, err error)

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

func (*SubmissionSelect) StringX

func (s *SubmissionSelect) StringX(ctx context.Context) string

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

func (*SubmissionSelect) Strings

func (s *SubmissionSelect) Strings(ctx context.Context) ([]string, error)

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

func (*SubmissionSelect) StringsX

func (s *SubmissionSelect) StringsX(ctx context.Context) []string

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

type SubmissionUpdate

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

SubmissionUpdate is the builder for updating Submission entities.

func (*SubmissionUpdate) AddTestCount

func (su *SubmissionUpdate) AddTestCount(i int) *SubmissionUpdate

AddTestCount adds i to the "test_count" field.

func (*SubmissionUpdate) ClearProblem

func (su *SubmissionUpdate) ClearProblem() *SubmissionUpdate

ClearProblem clears the "problem" edge to the Problem entity.

func (*SubmissionUpdate) Exec

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

Exec executes the query.

func (*SubmissionUpdate) ExecX

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

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

func (*SubmissionUpdate) Mutation

func (su *SubmissionUpdate) Mutation() *SubmissionMutation

Mutation returns the SubmissionMutation object of the builder.

func (*SubmissionUpdate) Save

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

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

func (*SubmissionUpdate) SaveX

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

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

func (*SubmissionUpdate) SetInput

SetInput applies the change-set in the UpdateSubmissionInput on the SubmissionUpdate builder.

func (*SubmissionUpdate) SetNillableStatus

func (su *SubmissionUpdate) SetNillableStatus(s *submission.Status) *SubmissionUpdate

SetNillableStatus sets the "status" field if the given value is not nil.

func (*SubmissionUpdate) SetNillableTestCount

func (su *SubmissionUpdate) SetNillableTestCount(i *int) *SubmissionUpdate

SetNillableTestCount sets the "test_count" field if the given value is not nil.

func (*SubmissionUpdate) SetNillableVerdict

func (su *SubmissionUpdate) SetNillableVerdict(s *submission.Verdict) *SubmissionUpdate

SetNillableVerdict sets the "verdict" field if the given value is not nil.

func (*SubmissionUpdate) SetProblem

func (su *SubmissionUpdate) SetProblem(p *Problem) *SubmissionUpdate

SetProblem sets the "problem" edge to the Problem entity.

func (*SubmissionUpdate) SetProblemID

func (su *SubmissionUpdate) SetProblemID(id int) *SubmissionUpdate

SetProblemID sets the "problem" edge to the Problem entity by ID.

func (*SubmissionUpdate) SetStatus

SetStatus sets the "status" field.

func (*SubmissionUpdate) SetTestCount

func (su *SubmissionUpdate) SetTestCount(i int) *SubmissionUpdate

SetTestCount sets the "test_count" field.

func (*SubmissionUpdate) SetUpdatedAt

func (su *SubmissionUpdate) SetUpdatedAt(t time.Time) *SubmissionUpdate

SetUpdatedAt sets the "updated_at" field.

func (*SubmissionUpdate) SetVerdict

SetVerdict sets the "verdict" field.

func (*SubmissionUpdate) Where

Where appends a list predicates to the SubmissionUpdate builder.

type SubmissionUpdateOne

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

SubmissionUpdateOne is the builder for updating a single Submission entity.

func (*SubmissionUpdateOne) AddTestCount

func (suo *SubmissionUpdateOne) AddTestCount(i int) *SubmissionUpdateOne

AddTestCount adds i to the "test_count" field.

func (*SubmissionUpdateOne) ClearProblem

func (suo *SubmissionUpdateOne) ClearProblem() *SubmissionUpdateOne

ClearProblem clears the "problem" edge to the Problem entity.

func (*SubmissionUpdateOne) Exec

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

Exec executes the query on the entity.

func (*SubmissionUpdateOne) ExecX

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

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

func (*SubmissionUpdateOne) Mutation

func (suo *SubmissionUpdateOne) Mutation() *SubmissionMutation

Mutation returns the SubmissionMutation object of the builder.

func (*SubmissionUpdateOne) Save

func (suo *SubmissionUpdateOne) Save(ctx context.Context) (*Submission, error)

Save executes the query and returns the updated Submission entity.

func (*SubmissionUpdateOne) SaveX

func (suo *SubmissionUpdateOne) SaveX(ctx context.Context) *Submission

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

func (*SubmissionUpdateOne) Select

func (suo *SubmissionUpdateOne) Select(field string, fields ...string) *SubmissionUpdateOne

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

func (*SubmissionUpdateOne) SetInput

SetInput applies the change-set in the UpdateSubmissionInput on the SubmissionUpdateOne builder.

func (*SubmissionUpdateOne) SetNillableStatus

func (suo *SubmissionUpdateOne) SetNillableStatus(s *submission.Status) *SubmissionUpdateOne

SetNillableStatus sets the "status" field if the given value is not nil.

func (*SubmissionUpdateOne) SetNillableTestCount

func (suo *SubmissionUpdateOne) SetNillableTestCount(i *int) *SubmissionUpdateOne

SetNillableTestCount sets the "test_count" field if the given value is not nil.

func (*SubmissionUpdateOne) SetNillableVerdict

func (suo *SubmissionUpdateOne) SetNillableVerdict(s *submission.Verdict) *SubmissionUpdateOne

SetNillableVerdict sets the "verdict" field if the given value is not nil.

func (*SubmissionUpdateOne) SetProblem

func (suo *SubmissionUpdateOne) SetProblem(p *Problem) *SubmissionUpdateOne

SetProblem sets the "problem" edge to the Problem entity.

func (*SubmissionUpdateOne) SetProblemID

func (suo *SubmissionUpdateOne) SetProblemID(id int) *SubmissionUpdateOne

SetProblemID sets the "problem" edge to the Problem entity by ID.

func (*SubmissionUpdateOne) SetStatus

SetStatus sets the "status" field.

func (*SubmissionUpdateOne) SetTestCount

func (suo *SubmissionUpdateOne) SetTestCount(i int) *SubmissionUpdateOne

SetTestCount sets the "test_count" field.

func (*SubmissionUpdateOne) SetUpdatedAt

func (suo *SubmissionUpdateOne) SetUpdatedAt(t time.Time) *SubmissionUpdateOne

SetUpdatedAt sets the "updated_at" field.

func (*SubmissionUpdateOne) SetVerdict

SetVerdict sets the "verdict" field.

func (*SubmissionUpdateOne) Where

Where appends a list predicates to the SubmissionUpdate builder.

type Submissions

type Submissions []*Submission

Submissions is a parsable slice of Submission.

type TraverseFunc

type TraverseFunc = ent.TraverseFunc

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

type Traverser

type Traverser = ent.Traverser

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

type Tx

type Tx struct {

	// Judge is the client for interacting with the Judge builders.
	Judge *JudgeClient
	// Problem is the client for interacting with the Problem builders.
	Problem *ProblemClient
	// Submission is the client for interacting with the Submission builders.
	Submission *SubmissionClient
	// 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 UpdateJudgeInput

type UpdateJudgeInput struct {
	UpdatedAt        *time.Time
	Name             *string
	Code             *string
	Type             *judge.Type
	Configuration    *string
	ClearProblems    bool
	AddProblemIDs    []int
	RemoveProblemIDs []int
}

UpdateJudgeInput represents a mutation input for updating judges.

func (*UpdateJudgeInput) Mutate

func (i *UpdateJudgeInput) Mutate(m *JudgeMutation)

Mutate applies the UpdateJudgeInput on the JudgeMutation builder.

type UpdateProblemInput

type UpdateProblemInput struct {
	UpdatedAt           *time.Time
	Name                *string
	Code                *string
	ClearSubmissions    bool
	AddSubmissionIDs    []int
	RemoveSubmissionIDs []int
	JudgeID             *int
}

UpdateProblemInput represents a mutation input for updating problems.

func (*UpdateProblemInput) Mutate

func (i *UpdateProblemInput) Mutate(m *ProblemMutation)

Mutate applies the UpdateProblemInput on the ProblemMutation builder.

type UpdateSubmissionInput

type UpdateSubmissionInput struct {
	UpdatedAt *time.Time
	Status    *submission.Status
	Verdict   *submission.Verdict
	TestCount *int
	ProblemID *int
}

UpdateSubmissionInput represents a mutation input for updating submissions.

func (*UpdateSubmissionInput) Mutate

Mutate applies the UpdateSubmissionInput on the SubmissionMutation builder.

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
Code generated by ogen, DO NOT EDIT.
Code generated by ogen, DO NOT EDIT.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL