ent

package
v0.0.0-...-a9081ec Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2023 License: MIT Imports: 21 Imported by: 0

Documentation

Overview

Package ent contains the schema for frontend entities.

Index

Constants

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

	// Node types.
	TypeAdmin   = "Admin"
	TypeStudent = "Student"
)

Variables

This section is empty.

Functions

func IsConstraintError

func IsConstraintError(err error) bool

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

func IsNotFound

func IsNotFound(err error) bool

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

func IsNotLoaded

func IsNotLoaded(err error) bool

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

func IsNotSingular

func IsNotSingular(err error) bool

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

func IsValidationError

func IsValidationError(err error) bool

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

func MaskNotFound

func MaskNotFound(err error) error

MaskNotFound masks not found error.

func NewContext

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

NewContext returns a new context with the given Client attached.

func NewTxContext

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

NewTxContext returns a new context with the given Tx attached.

Types

type Admin

type Admin struct {

	// ID of the ent.
	ID uuid.UUID `json:"id,omitempty"`
	// CreatedAt holds the value of the "created_at" field.
	CreatedAt time.Time `json:"created_at,omitempty"`
	// UpdatedAt holds the value of the "updated_at" field.
	UpdatedAt time.Time `json:"updated_at,omitempty"`
	// Pseudo holds the value of the "pseudo" field.
	Pseudo string `json:"pseudo,omitempty"`
	// PasswordHash holds the value of the "password_hash" field.
	PasswordHash []byte `json:"-"`
	// contains filtered or unexported fields
}

Admin is the model entity for the Admin schema.

func (*Admin) String

func (a *Admin) String() string

String implements the fmt.Stringer.

func (*Admin) ToFront

func (a *Admin) ToFront() *AdminFront

ToFront is the structure returned to the frontend

func (*Admin) Unwrap

func (a *Admin) Unwrap() *Admin

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

func (a *Admin) Update() *AdminUpdateOne

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

type AdminClient

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

AdminClient is a client for the Admin schema.

func NewAdminClient

func NewAdminClient(c config) *AdminClient

NewAdminClient returns a client for the Admin from the given config.

func (*AdminClient) Create

func (c *AdminClient) Create() *AdminCreate

Create returns a builder for creating a Admin entity.

func (*AdminClient) CreateBulk

func (c *AdminClient) CreateBulk(builders ...*AdminCreate) *AdminCreateBulk

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

func (*AdminClient) Delete

func (c *AdminClient) Delete() *AdminDelete

Delete returns a delete builder for Admin.

func (*AdminClient) DeleteOne

func (c *AdminClient) DeleteOne(a *Admin) *AdminDeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*AdminClient) DeleteOneID

func (c *AdminClient) DeleteOneID(id uuid.UUID) *AdminDeleteOne

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

func (*AdminClient) Get

func (c *AdminClient) Get(ctx context.Context, id uuid.UUID) (*Admin, error)

Get returns a Admin entity by its id.

func (*AdminClient) GetX

func (c *AdminClient) GetX(ctx context.Context, id uuid.UUID) *Admin

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

func (*AdminClient) Hooks

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

Hooks returns the client hooks.

func (*AdminClient) Intercept

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

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

func (*AdminClient) Interceptors

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

Interceptors returns the client interceptors.

func (*AdminClient) Query

func (c *AdminClient) Query() *AdminQuery

Query returns a query builder for Admin.

func (*AdminClient) Update

func (c *AdminClient) Update() *AdminUpdate

Update returns an update builder for Admin.

func (*AdminClient) UpdateOne

func (c *AdminClient) UpdateOne(a *Admin) *AdminUpdateOne

UpdateOne returns an update builder for the given entity.

func (*AdminClient) UpdateOneID

func (c *AdminClient) UpdateOneID(id uuid.UUID) *AdminUpdateOne

UpdateOneID returns an update builder for the given id.

func (*AdminClient) Use

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

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

type AdminCreate

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

AdminCreate is the builder for creating a Admin entity.

func (*AdminCreate) Exec

func (ac *AdminCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*AdminCreate) ExecX

func (ac *AdminCreate) ExecX(ctx context.Context)

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

func (*AdminCreate) Mutation

func (ac *AdminCreate) Mutation() *AdminMutation

Mutation returns the AdminMutation object of the builder.

func (*AdminCreate) Save

func (ac *AdminCreate) Save(ctx context.Context) (*Admin, error)

Save creates the Admin in the database.

func (*AdminCreate) SaveX

func (ac *AdminCreate) SaveX(ctx context.Context) *Admin

SaveX calls Save and panics if Save returns an error.

func (*AdminCreate) SetCreatedAt

func (ac *AdminCreate) SetCreatedAt(t time.Time) *AdminCreate

SetCreatedAt sets the "created_at" field.

func (*AdminCreate) SetID

func (ac *AdminCreate) SetID(u uuid.UUID) *AdminCreate

SetID sets the "id" field.

func (*AdminCreate) SetNillableCreatedAt

func (ac *AdminCreate) SetNillableCreatedAt(t *time.Time) *AdminCreate

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

func (*AdminCreate) SetNillableID

func (ac *AdminCreate) SetNillableID(u *uuid.UUID) *AdminCreate

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

func (*AdminCreate) SetNillableUpdatedAt

func (ac *AdminCreate) SetNillableUpdatedAt(t *time.Time) *AdminCreate

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

func (*AdminCreate) SetPasswordHash

func (ac *AdminCreate) SetPasswordHash(b []byte) *AdminCreate

SetPasswordHash sets the "password_hash" field.

func (*AdminCreate) SetPseudo

func (ac *AdminCreate) SetPseudo(s string) *AdminCreate

SetPseudo sets the "pseudo" field.

func (*AdminCreate) SetUpdatedAt

func (ac *AdminCreate) SetUpdatedAt(t time.Time) *AdminCreate

SetUpdatedAt sets the "updated_at" field.

type AdminCreateBulk

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

AdminCreateBulk is the builder for creating many Admin entities in bulk.

func (*AdminCreateBulk) Exec

func (acb *AdminCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*AdminCreateBulk) ExecX

func (acb *AdminCreateBulk) ExecX(ctx context.Context)

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

func (*AdminCreateBulk) Save

func (acb *AdminCreateBulk) Save(ctx context.Context) ([]*Admin, error)

Save creates the Admin entities in the database.

func (*AdminCreateBulk) SaveX

func (acb *AdminCreateBulk) SaveX(ctx context.Context) []*Admin

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

type AdminDelete

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

AdminDelete is the builder for deleting a Admin entity.

func (*AdminDelete) Exec

func (ad *AdminDelete) Exec(ctx context.Context) (int, error)

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

func (*AdminDelete) ExecX

func (ad *AdminDelete) ExecX(ctx context.Context) int

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

func (*AdminDelete) Where

func (ad *AdminDelete) Where(ps ...predicate.Admin) *AdminDelete

Where appends a list predicates to the AdminDelete builder.

type AdminDeleteOne

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

AdminDeleteOne is the builder for deleting a single Admin entity.

func (*AdminDeleteOne) Exec

func (ado *AdminDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*AdminDeleteOne) ExecX

func (ado *AdminDeleteOne) ExecX(ctx context.Context)

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

func (*AdminDeleteOne) Where

func (ado *AdminDeleteOne) Where(ps ...predicate.Admin) *AdminDeleteOne

Where appends a list predicates to the AdminDelete builder.

type AdminDisplayFront

type AdminDisplayFront struct {
	// Pseudo holds the value of the "pseudo" field.
	Pseudo string `json:"pseudo"`
}

AdminDisplayFront is the model entity for the Admin schema.

type AdminFront

type AdminFront struct {
	Display *AdminDisplayFront `json:"display,omitempty"`
	ID      uuid.UUID          `json:"id,omitempty"`
}

AdminFront is the model entity returned to the frontend

type AdminGroupBy

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

AdminGroupBy is the group-by builder for Admin entities.

func (*AdminGroupBy) Aggregate

func (agb *AdminGroupBy) Aggregate(fns ...AggregateFunc) *AdminGroupBy

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

func (*AdminGroupBy) Bool

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

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

func (*AdminGroupBy) BoolX

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

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

func (*AdminGroupBy) Bools

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

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

func (*AdminGroupBy) BoolsX

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

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

func (*AdminGroupBy) Float64

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

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

func (*AdminGroupBy) Float64X

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

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

func (*AdminGroupBy) Float64s

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

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

func (*AdminGroupBy) Float64sX

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

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

func (*AdminGroupBy) Int

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

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

func (*AdminGroupBy) IntX

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

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

func (*AdminGroupBy) Ints

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

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

func (*AdminGroupBy) IntsX

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

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

func (*AdminGroupBy) Scan

func (agb *AdminGroupBy) Scan(ctx context.Context, v any) error

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

func (*AdminGroupBy) ScanX

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

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

func (*AdminGroupBy) String

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

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

func (*AdminGroupBy) StringX

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

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

func (*AdminGroupBy) Strings

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

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

func (*AdminGroupBy) StringsX

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

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

type AdminMutation

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

AdminMutation represents an operation that mutates the Admin nodes in the graph.

func (*AdminMutation) AddField

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

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

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

func (*AdminMutation) AddedField

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

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

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

func (*AdminMutation) AddedIDs

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

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

func (*AdminMutation) ClearEdge

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

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

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

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

func (*AdminMutation) ClearedFields

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

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

func (AdminMutation) Client

func (m AdminMutation) 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 (*AdminMutation) CreatedAt

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

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

func (*AdminMutation) EdgeCleared

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

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

func (*AdminMutation) Field

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

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

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

func (*AdminMutation) Fields

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

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

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

func (*AdminMutation) IDs

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

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

func (*AdminMutation) OldCreatedAt

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

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

func (m *AdminMutation) 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 (*AdminMutation) OldPasswordHash

func (m *AdminMutation) OldPasswordHash(ctx context.Context) (v []byte, err error)

OldPasswordHash returns the old "password_hash" field's value of the Admin entity. If the Admin 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 (*AdminMutation) OldPseudo

func (m *AdminMutation) OldPseudo(ctx context.Context) (v string, err error)

OldPseudo returns the old "pseudo" field's value of the Admin entity. If the Admin 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 (*AdminMutation) OldUpdatedAt

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

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

func (m *AdminMutation) Op() Op

Op returns the operation name.

func (*AdminMutation) PasswordHash

func (m *AdminMutation) PasswordHash() (r []byte, exists bool)

PasswordHash returns the value of the "password_hash" field in the mutation.

func (*AdminMutation) Pseudo

func (m *AdminMutation) Pseudo() (r string, exists bool)

Pseudo returns the value of the "pseudo" field in the mutation.

func (*AdminMutation) RemovedEdges

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

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

func (*AdminMutation) RemovedIDs

func (m *AdminMutation) 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 (*AdminMutation) ResetCreatedAt

func (m *AdminMutation) ResetCreatedAt()

ResetCreatedAt resets all changes to the "created_at" field.

func (*AdminMutation) ResetEdge

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

func (m *AdminMutation) 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 (*AdminMutation) ResetPasswordHash

func (m *AdminMutation) ResetPasswordHash()

ResetPasswordHash resets all changes to the "password_hash" field.

func (*AdminMutation) ResetPseudo

func (m *AdminMutation) ResetPseudo()

ResetPseudo resets all changes to the "pseudo" field.

func (*AdminMutation) ResetUpdatedAt

func (m *AdminMutation) ResetUpdatedAt()

ResetUpdatedAt resets all changes to the "updated_at" field.

func (*AdminMutation) SetCreatedAt

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

SetCreatedAt sets the "created_at" field.

func (*AdminMutation) SetField

func (m *AdminMutation) 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 (*AdminMutation) SetID

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

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

func (*AdminMutation) SetOp

func (m *AdminMutation) SetOp(op Op)

SetOp allows setting the mutation operation.

func (*AdminMutation) SetPasswordHash

func (m *AdminMutation) SetPasswordHash(b []byte)

SetPasswordHash sets the "password_hash" field.

func (*AdminMutation) SetPseudo

func (m *AdminMutation) SetPseudo(s string)

SetPseudo sets the "pseudo" field.

func (*AdminMutation) SetUpdatedAt

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

SetUpdatedAt sets the "updated_at" field.

func (AdminMutation) Tx

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

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

func (*AdminMutation) Type

func (m *AdminMutation) Type() string

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

func (*AdminMutation) UpdatedAt

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

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

func (*AdminMutation) Where

func (m *AdminMutation) Where(ps ...predicate.Admin)

Where appends a list predicates to the AdminMutation builder.

func (*AdminMutation) WhereP

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

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

type AdminQuery

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

AdminQuery is the builder for querying Admin entities.

func (*AdminQuery) Aggregate

func (aq *AdminQuery) Aggregate(fns ...AggregateFunc) *AdminSelect

Aggregate returns a AdminSelect configured with the given aggregations.

func (*AdminQuery) All

func (aq *AdminQuery) All(ctx context.Context) ([]*Admin, error)

All executes the query and returns a list of Admins.

func (*AdminQuery) AllX

func (aq *AdminQuery) AllX(ctx context.Context) []*Admin

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

func (*AdminQuery) Clone

func (aq *AdminQuery) Clone() *AdminQuery

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

func (*AdminQuery) Count

func (aq *AdminQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*AdminQuery) CountX

func (aq *AdminQuery) CountX(ctx context.Context) int

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

func (*AdminQuery) Exist

func (aq *AdminQuery) Exist(ctx context.Context) (bool, error)

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

func (*AdminQuery) ExistX

func (aq *AdminQuery) ExistX(ctx context.Context) bool

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

func (*AdminQuery) First

func (aq *AdminQuery) First(ctx context.Context) (*Admin, error)

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

func (*AdminQuery) FirstID

func (aq *AdminQuery) FirstID(ctx context.Context) (id uuid.UUID, err error)

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

func (*AdminQuery) FirstIDX

func (aq *AdminQuery) FirstIDX(ctx context.Context) uuid.UUID

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

func (*AdminQuery) FirstX

func (aq *AdminQuery) FirstX(ctx context.Context) *Admin

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

func (*AdminQuery) GroupBy

func (aq *AdminQuery) GroupBy(field string, fields ...string) *AdminGroupBy

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.Admin.Query().
	GroupBy(admin.FieldCreatedAt).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*AdminQuery) IDs

func (aq *AdminQuery) IDs(ctx context.Context) (ids []uuid.UUID, err error)

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

func (*AdminQuery) IDsX

func (aq *AdminQuery) IDsX(ctx context.Context) []uuid.UUID

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

func (*AdminQuery) Limit

func (aq *AdminQuery) Limit(limit int) *AdminQuery

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

func (*AdminQuery) Offset

func (aq *AdminQuery) Offset(offset int) *AdminQuery

Offset to start from.

func (*AdminQuery) Only

func (aq *AdminQuery) Only(ctx context.Context) (*Admin, error)

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

func (*AdminQuery) OnlyID

func (aq *AdminQuery) OnlyID(ctx context.Context) (id uuid.UUID, err error)

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

func (*AdminQuery) OnlyIDX

func (aq *AdminQuery) OnlyIDX(ctx context.Context) uuid.UUID

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

func (*AdminQuery) OnlyX

func (aq *AdminQuery) OnlyX(ctx context.Context) *Admin

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

func (*AdminQuery) Order

func (aq *AdminQuery) Order(o ...OrderFunc) *AdminQuery

Order specifies how the records should be ordered.

func (*AdminQuery) Select

func (aq *AdminQuery) Select(fields ...string) *AdminSelect

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.Admin.Query().
	Select(admin.FieldCreatedAt).
	Scan(ctx, &v)

func (*AdminQuery) Unique

func (aq *AdminQuery) Unique(unique bool) *AdminQuery

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

func (aq *AdminQuery) Where(ps ...predicate.Admin) *AdminQuery

Where adds a new predicate for the AdminQuery builder.

type AdminSelect

type AdminSelect struct {
	*AdminQuery
	// contains filtered or unexported fields
}

AdminSelect is the builder for selecting fields of Admin entities.

func (*AdminSelect) Aggregate

func (as *AdminSelect) Aggregate(fns ...AggregateFunc) *AdminSelect

Aggregate adds the given aggregation functions to the selector query.

func (*AdminSelect) Bool

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

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

func (*AdminSelect) BoolX

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

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

func (*AdminSelect) Bools

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

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

func (*AdminSelect) BoolsX

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

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

func (*AdminSelect) Float64

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

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

func (*AdminSelect) Float64X

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

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

func (*AdminSelect) Float64s

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

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

func (*AdminSelect) Float64sX

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

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

func (*AdminSelect) Int

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

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

func (*AdminSelect) IntX

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

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

func (*AdminSelect) Ints

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

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

func (*AdminSelect) IntsX

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

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

func (*AdminSelect) Scan

func (as *AdminSelect) Scan(ctx context.Context, v any) error

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

func (*AdminSelect) ScanX

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

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

func (*AdminSelect) String

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

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

func (*AdminSelect) StringX

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

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

func (*AdminSelect) Strings

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

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

func (*AdminSelect) StringsX

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

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

type AdminUpdate

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

AdminUpdate is the builder for updating Admin entities.

func (*AdminUpdate) Exec

func (au *AdminUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*AdminUpdate) ExecX

func (au *AdminUpdate) ExecX(ctx context.Context)

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

func (*AdminUpdate) Mutation

func (au *AdminUpdate) Mutation() *AdminMutation

Mutation returns the AdminMutation object of the builder.

func (*AdminUpdate) Save

func (au *AdminUpdate) Save(ctx context.Context) (int, error)

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

func (*AdminUpdate) SaveX

func (au *AdminUpdate) SaveX(ctx context.Context) int

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

func (*AdminUpdate) SetPasswordHash

func (au *AdminUpdate) SetPasswordHash(b []byte) *AdminUpdate

SetPasswordHash sets the "password_hash" field.

func (*AdminUpdate) SetPseudo

func (au *AdminUpdate) SetPseudo(s string) *AdminUpdate

SetPseudo sets the "pseudo" field.

func (*AdminUpdate) SetUpdatedAt

func (au *AdminUpdate) SetUpdatedAt(t time.Time) *AdminUpdate

SetUpdatedAt sets the "updated_at" field.

func (*AdminUpdate) Where

func (au *AdminUpdate) Where(ps ...predicate.Admin) *AdminUpdate

Where appends a list predicates to the AdminUpdate builder.

type AdminUpdateOne

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

AdminUpdateOne is the builder for updating a single Admin entity.

func (*AdminUpdateOne) Exec

func (auo *AdminUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*AdminUpdateOne) ExecX

func (auo *AdminUpdateOne) ExecX(ctx context.Context)

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

func (*AdminUpdateOne) Mutation

func (auo *AdminUpdateOne) Mutation() *AdminMutation

Mutation returns the AdminMutation object of the builder.

func (*AdminUpdateOne) Save

func (auo *AdminUpdateOne) Save(ctx context.Context) (*Admin, error)

Save executes the query and returns the updated Admin entity.

func (*AdminUpdateOne) SaveX

func (auo *AdminUpdateOne) SaveX(ctx context.Context) *Admin

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

func (*AdminUpdateOne) Select

func (auo *AdminUpdateOne) Select(field string, fields ...string) *AdminUpdateOne

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

func (*AdminUpdateOne) SetPasswordHash

func (auo *AdminUpdateOne) SetPasswordHash(b []byte) *AdminUpdateOne

SetPasswordHash sets the "password_hash" field.

func (*AdminUpdateOne) SetPseudo

func (auo *AdminUpdateOne) SetPseudo(s string) *AdminUpdateOne

SetPseudo sets the "pseudo" field.

func (*AdminUpdateOne) SetUpdatedAt

func (auo *AdminUpdateOne) SetUpdatedAt(t time.Time) *AdminUpdateOne

SetUpdatedAt sets the "updated_at" field.

func (*AdminUpdateOne) Where

func (auo *AdminUpdateOne) Where(ps ...predicate.Admin) *AdminUpdateOne

Where appends a list predicates to the AdminUpdate builder.

type Admins

type Admins []*Admin

Admins is a parsable slice of Admin.

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
	// Admin is the client for interacting with the Admin builders.
	Admin *AdminClient
	// Student is the client for interacting with the Student builders.
	Student *StudentClient
	// 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().
	Admin.
	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) Tx

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

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

func (*Client) Use

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

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

type CommitFunc

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

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

func (CommitFunc) Commit

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

Commit calls f(ctx, m).

type CommitHook

type CommitHook func(Committer) Committer

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

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

type Committer

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

Committer is the interface that wraps the Commit method.

type ConstraintError

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

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

func (ConstraintError) Error

func (e ConstraintError) Error() string

Error implements the error interface.

func (*ConstraintError) Unwrap

func (e *ConstraintError) Unwrap() error

Unwrap implements the errors.Wrapper interface.

type Hook

type Hook = ent.Hook

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

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

type MutateFunc = ent.MutateFunc

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

type Mutation

type Mutation = ent.Mutation

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

type Mutator

type Mutator = ent.Mutator

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

type NotFoundError

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

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

func (*NotFoundError) Error

func (e *NotFoundError) Error() string

Error implements the error interface.

type NotLoadedError

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

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

func (*NotLoadedError) Error

func (e *NotLoadedError) Error() string

Error implements the error interface.

type NotSingularError

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

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

func (*NotSingularError) Error

func (e *NotSingularError) Error() string

Error implements the error interface.

type Op

type Op = ent.Op

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

type Option

type Option func(*config)

Option function to configure the client.

func Debug

func Debug() Option

Debug enables debug logging on the ent.Driver.

func Driver

func Driver(driver dialect.Driver) Option

Driver configures the client driver.

func Log

func Log(fn func(...any)) Option

Log sets the logging function for debug mode.

type OrderFunc

type OrderFunc func(*sql.Selector)

OrderFunc applies an ordering on the sql selector.

func Asc

func Asc(fields ...string) OrderFunc

Asc applies the given fields in ASC order.

func Desc

func Desc(fields ...string) OrderFunc

Desc applies the given fields in DESC order.

type Policy

type Policy = ent.Policy

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

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

type Student struct {

	// ID of the ent.
	ID uuid.UUID `json:"id,omitempty"`
	// CreatedAt holds the value of the "created_at" field.
	CreatedAt time.Time `json:"created_at,omitempty"`
	// UpdatedAt holds the value of the "updated_at" field.
	UpdatedAt time.Time `json:"updated_at,omitempty"`
	// FirstName holds the value of the "first_name" field.
	FirstName string `json:"first_name,omitempty"`
	// LastName holds the value of the "last_name" field.
	LastName string `json:"last_name,omitempty"`
	// Pseudo holds the value of the "pseudo" field.
	Pseudo string `json:"pseudo,omitempty"`
	// Gender holds the value of the "gender" field.
	Gender primitive.Gender `json:"gender,omitempty"`
	// Birthday holds the value of the "birthday" field.
	Birthday time.Time `json:"birthday,omitempty"`
	// PasswordHash holds the value of the "password_hash" field.
	PasswordHash []byte `json:"-"`
	// contains filtered or unexported fields
}

Student is the model entity for the Student schema.

func (*Student) String

func (s *Student) String() string

String implements the fmt.Stringer.

func (*Student) ToFront

func (s *Student) ToFront() *StudentFront

ToFront is the structure returned to the frontend

func (*Student) Unwrap

func (s *Student) Unwrap() *Student

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

func (s *Student) Update() *StudentUpdateOne

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

type StudentClient

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

StudentClient is a client for the Student schema.

func NewStudentClient

func NewStudentClient(c config) *StudentClient

NewStudentClient returns a client for the Student from the given config.

func (*StudentClient) Create

func (c *StudentClient) Create() *StudentCreate

Create returns a builder for creating a Student entity.

func (*StudentClient) CreateBulk

func (c *StudentClient) CreateBulk(builders ...*StudentCreate) *StudentCreateBulk

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

func (*StudentClient) Delete

func (c *StudentClient) Delete() *StudentDelete

Delete returns a delete builder for Student.

func (*StudentClient) DeleteOne

func (c *StudentClient) DeleteOne(s *Student) *StudentDeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*StudentClient) DeleteOneID

func (c *StudentClient) DeleteOneID(id uuid.UUID) *StudentDeleteOne

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

func (*StudentClient) Get

func (c *StudentClient) Get(ctx context.Context, id uuid.UUID) (*Student, error)

Get returns a Student entity by its id.

func (*StudentClient) GetX

func (c *StudentClient) GetX(ctx context.Context, id uuid.UUID) *Student

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

func (*StudentClient) Hooks

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

Hooks returns the client hooks.

func (*StudentClient) Intercept

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

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

func (*StudentClient) Interceptors

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

Interceptors returns the client interceptors.

func (*StudentClient) Query

func (c *StudentClient) Query() *StudentQuery

Query returns a query builder for Student.

func (*StudentClient) Update

func (c *StudentClient) Update() *StudentUpdate

Update returns an update builder for Student.

func (*StudentClient) UpdateOne

func (c *StudentClient) UpdateOne(s *Student) *StudentUpdateOne

UpdateOne returns an update builder for the given entity.

func (*StudentClient) UpdateOneID

func (c *StudentClient) UpdateOneID(id uuid.UUID) *StudentUpdateOne

UpdateOneID returns an update builder for the given id.

func (*StudentClient) Use

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

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

type StudentCreate

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

StudentCreate is the builder for creating a Student entity.

func (*StudentCreate) Exec

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

Exec executes the query.

func (*StudentCreate) ExecX

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

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

func (*StudentCreate) Mutation

func (sc *StudentCreate) Mutation() *StudentMutation

Mutation returns the StudentMutation object of the builder.

func (*StudentCreate) Save

func (sc *StudentCreate) Save(ctx context.Context) (*Student, error)

Save creates the Student in the database.

func (*StudentCreate) SaveX

func (sc *StudentCreate) SaveX(ctx context.Context) *Student

SaveX calls Save and panics if Save returns an error.

func (*StudentCreate) SetBirthday

func (sc *StudentCreate) SetBirthday(t time.Time) *StudentCreate

SetBirthday sets the "birthday" field.

func (*StudentCreate) SetCreatedAt

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

SetCreatedAt sets the "created_at" field.

func (*StudentCreate) SetFirstName

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

SetFirstName sets the "first_name" field.

func (*StudentCreate) SetGender

func (sc *StudentCreate) SetGender(pr primitive.Gender) *StudentCreate

SetGender sets the "gender" field.

func (*StudentCreate) SetID

func (sc *StudentCreate) SetID(u uuid.UUID) *StudentCreate

SetID sets the "id" field.

func (*StudentCreate) SetLastName

func (sc *StudentCreate) SetLastName(s string) *StudentCreate

SetLastName sets the "last_name" field.

func (*StudentCreate) SetNillableBirthday

func (sc *StudentCreate) SetNillableBirthday(t *time.Time) *StudentCreate

SetNillableBirthday sets the "birthday" field if the given value is not nil.

func (*StudentCreate) SetNillableCreatedAt

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

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

func (*StudentCreate) SetNillableID

func (sc *StudentCreate) SetNillableID(u *uuid.UUID) *StudentCreate

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

func (*StudentCreate) SetNillableUpdatedAt

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

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

func (*StudentCreate) SetPasswordHash

func (sc *StudentCreate) SetPasswordHash(b []byte) *StudentCreate

SetPasswordHash sets the "password_hash" field.

func (*StudentCreate) SetPseudo

func (sc *StudentCreate) SetPseudo(s string) *StudentCreate

SetPseudo sets the "pseudo" field.

func (*StudentCreate) SetUpdatedAt

func (sc *StudentCreate) SetUpdatedAt(t time.Time) *StudentCreate

SetUpdatedAt sets the "updated_at" field.

type StudentCreateBulk

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

StudentCreateBulk is the builder for creating many Student entities in bulk.

func (*StudentCreateBulk) Exec

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

Exec executes the query.

func (*StudentCreateBulk) ExecX

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

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

func (*StudentCreateBulk) Save

func (scb *StudentCreateBulk) Save(ctx context.Context) ([]*Student, error)

Save creates the Student entities in the database.

func (*StudentCreateBulk) SaveX

func (scb *StudentCreateBulk) SaveX(ctx context.Context) []*Student

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

type StudentDelete

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

StudentDelete is the builder for deleting a Student entity.

func (*StudentDelete) Exec

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

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

func (*StudentDelete) ExecX

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

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

func (*StudentDelete) Where

func (sd *StudentDelete) Where(ps ...predicate.Student) *StudentDelete

Where appends a list predicates to the StudentDelete builder.

type StudentDeleteOne

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

StudentDeleteOne is the builder for deleting a single Student entity.

func (*StudentDeleteOne) Exec

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

Exec executes the deletion query.

func (*StudentDeleteOne) ExecX

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

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

func (*StudentDeleteOne) Where

Where appends a list predicates to the StudentDelete builder.

type StudentDisplayFront

type StudentDisplayFront struct {
	FirstName string           `json:"firstname,omitempty"`
	LastName  string           `json:"lastname,omitempty"`
	Pseudo    string           `json:"pseudo,omitempty"`
	Gender    primitive.Gender `json:"gender,omitempty"`
	Birthday  string           `json:"birthday,omitempty"`
}

StudentDisplayFront is the model entity for the Student schema.

type StudentFront

type StudentFront struct {
	Display      *StudentDisplayFront `json:"display,omitempty"`
	PasswordHash []byte               `json:"-"`
	ID           uuid.UUID            `json:"id,omitempty"`
}

StudentFront is the model entity returned to frontend

type StudentGroupBy

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

StudentGroupBy is the group-by builder for Student entities.

func (*StudentGroupBy) Aggregate

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

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

func (*StudentGroupBy) Bool

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

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

func (*StudentGroupBy) BoolX

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

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

func (*StudentGroupBy) Bools

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

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

func (*StudentGroupBy) BoolsX

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

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

func (*StudentGroupBy) Float64

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

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

func (*StudentGroupBy) Float64X

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

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

func (*StudentGroupBy) Float64s

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

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

func (*StudentGroupBy) Float64sX

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

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

func (*StudentGroupBy) Int

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

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

func (*StudentGroupBy) IntX

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

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

func (*StudentGroupBy) Ints

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

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

func (*StudentGroupBy) IntsX

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

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

func (*StudentGroupBy) Scan

func (sgb *StudentGroupBy) Scan(ctx context.Context, v any) error

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

func (*StudentGroupBy) ScanX

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

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

func (*StudentGroupBy) String

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

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

func (*StudentGroupBy) StringX

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

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

func (*StudentGroupBy) Strings

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

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

func (*StudentGroupBy) StringsX

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

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

type StudentMutation

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

StudentMutation represents an operation that mutates the Student nodes in the graph.

func (*StudentMutation) AddField

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

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

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

func (*StudentMutation) AddedField

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

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

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

func (*StudentMutation) AddedIDs

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

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

func (*StudentMutation) Birthday

func (m *StudentMutation) Birthday() (r time.Time, exists bool)

Birthday returns the value of the "birthday" field in the mutation.

func (*StudentMutation) BirthdayCleared

func (m *StudentMutation) BirthdayCleared() bool

BirthdayCleared returns if the "birthday" field was cleared in this mutation.

func (*StudentMutation) ClearBirthday

func (m *StudentMutation) ClearBirthday()

ClearBirthday clears the value of the "birthday" field.

func (*StudentMutation) ClearEdge

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

func (m *StudentMutation) 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 (*StudentMutation) ClearPasswordHash

func (m *StudentMutation) ClearPasswordHash()

ClearPasswordHash clears the value of the "password_hash" field.

func (*StudentMutation) ClearedEdges

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

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

func (*StudentMutation) ClearedFields

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

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

func (StudentMutation) Client

func (m StudentMutation) 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 (*StudentMutation) CreatedAt

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

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

func (*StudentMutation) EdgeCleared

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

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

func (*StudentMutation) Field

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

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

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

func (*StudentMutation) Fields

func (m *StudentMutation) 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 (*StudentMutation) FirstName

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

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

func (*StudentMutation) Gender

func (m *StudentMutation) Gender() (r primitive.Gender, exists bool)

Gender returns the value of the "gender" field in the mutation.

func (*StudentMutation) ID

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

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

func (*StudentMutation) IDs

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

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

func (*StudentMutation) LastName

func (m *StudentMutation) LastName() (r string, exists bool)

LastName returns the value of the "last_name" field in the mutation.

func (*StudentMutation) OldBirthday

func (m *StudentMutation) OldBirthday(ctx context.Context) (v time.Time, err error)

OldBirthday returns the old "birthday" field's value of the Student entity. If the Student 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 (*StudentMutation) OldCreatedAt

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

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

func (m *StudentMutation) 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 (*StudentMutation) OldFirstName

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

OldFirstName returns the old "first_name" field's value of the Student entity. If the Student 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 (*StudentMutation) OldGender

func (m *StudentMutation) OldGender(ctx context.Context) (v primitive.Gender, err error)

OldGender returns the old "gender" field's value of the Student entity. If the Student 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 (*StudentMutation) OldLastName

func (m *StudentMutation) OldLastName(ctx context.Context) (v string, err error)

OldLastName returns the old "last_name" field's value of the Student entity. If the Student 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 (*StudentMutation) OldPasswordHash

func (m *StudentMutation) OldPasswordHash(ctx context.Context) (v []byte, err error)

OldPasswordHash returns the old "password_hash" field's value of the Student entity. If the Student 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 (*StudentMutation) OldPseudo

func (m *StudentMutation) OldPseudo(ctx context.Context) (v string, err error)

OldPseudo returns the old "pseudo" field's value of the Student entity. If the Student 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 (*StudentMutation) OldUpdatedAt

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

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

func (m *StudentMutation) Op() Op

Op returns the operation name.

func (*StudentMutation) PasswordHash

func (m *StudentMutation) PasswordHash() (r []byte, exists bool)

PasswordHash returns the value of the "password_hash" field in the mutation.

func (*StudentMutation) PasswordHashCleared

func (m *StudentMutation) PasswordHashCleared() bool

PasswordHashCleared returns if the "password_hash" field was cleared in this mutation.

func (*StudentMutation) Pseudo

func (m *StudentMutation) Pseudo() (r string, exists bool)

Pseudo returns the value of the "pseudo" field in the mutation.

func (*StudentMutation) RemovedEdges

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

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

func (*StudentMutation) RemovedIDs

func (m *StudentMutation) 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 (*StudentMutation) ResetBirthday

func (m *StudentMutation) ResetBirthday()

ResetBirthday resets all changes to the "birthday" field.

func (*StudentMutation) ResetCreatedAt

func (m *StudentMutation) ResetCreatedAt()

ResetCreatedAt resets all changes to the "created_at" field.

func (*StudentMutation) ResetEdge

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

func (m *StudentMutation) 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 (*StudentMutation) ResetFirstName

func (m *StudentMutation) ResetFirstName()

ResetFirstName resets all changes to the "first_name" field.

func (*StudentMutation) ResetGender

func (m *StudentMutation) ResetGender()

ResetGender resets all changes to the "gender" field.

func (*StudentMutation) ResetLastName

func (m *StudentMutation) ResetLastName()

ResetLastName resets all changes to the "last_name" field.

func (*StudentMutation) ResetPasswordHash

func (m *StudentMutation) ResetPasswordHash()

ResetPasswordHash resets all changes to the "password_hash" field.

func (*StudentMutation) ResetPseudo

func (m *StudentMutation) ResetPseudo()

ResetPseudo resets all changes to the "pseudo" field.

func (*StudentMutation) ResetUpdatedAt

func (m *StudentMutation) ResetUpdatedAt()

ResetUpdatedAt resets all changes to the "updated_at" field.

func (*StudentMutation) SetBirthday

func (m *StudentMutation) SetBirthday(t time.Time)

SetBirthday sets the "birthday" field.

func (*StudentMutation) SetCreatedAt

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

SetCreatedAt sets the "created_at" field.

func (*StudentMutation) SetField

func (m *StudentMutation) 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 (*StudentMutation) SetFirstName

func (m *StudentMutation) SetFirstName(s string)

SetFirstName sets the "first_name" field.

func (*StudentMutation) SetGender

func (m *StudentMutation) SetGender(pr primitive.Gender)

SetGender sets the "gender" field.

func (*StudentMutation) SetID

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

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

func (*StudentMutation) SetLastName

func (m *StudentMutation) SetLastName(s string)

SetLastName sets the "last_name" field.

func (*StudentMutation) SetOp

func (m *StudentMutation) SetOp(op Op)

SetOp allows setting the mutation operation.

func (*StudentMutation) SetPasswordHash

func (m *StudentMutation) SetPasswordHash(b []byte)

SetPasswordHash sets the "password_hash" field.

func (*StudentMutation) SetPseudo

func (m *StudentMutation) SetPseudo(s string)

SetPseudo sets the "pseudo" field.

func (*StudentMutation) SetUpdatedAt

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

SetUpdatedAt sets the "updated_at" field.

func (StudentMutation) Tx

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

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

func (*StudentMutation) Type

func (m *StudentMutation) Type() string

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

func (*StudentMutation) UpdatedAt

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

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

func (*StudentMutation) Where

func (m *StudentMutation) Where(ps ...predicate.Student)

Where appends a list predicates to the StudentMutation builder.

func (*StudentMutation) WhereP

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

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

type StudentQuery

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

StudentQuery is the builder for querying Student entities.

func (*StudentQuery) Aggregate

func (sq *StudentQuery) Aggregate(fns ...AggregateFunc) *StudentSelect

Aggregate returns a StudentSelect configured with the given aggregations.

func (*StudentQuery) All

func (sq *StudentQuery) All(ctx context.Context) ([]*Student, error)

All executes the query and returns a list of Students.

func (*StudentQuery) AllX

func (sq *StudentQuery) AllX(ctx context.Context) []*Student

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

func (*StudentQuery) Clone

func (sq *StudentQuery) Clone() *StudentQuery

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

func (*StudentQuery) Count

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

Count returns the count of the given query.

func (*StudentQuery) CountX

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

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

func (*StudentQuery) Exist

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

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

func (*StudentQuery) ExistX

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

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

func (*StudentQuery) First

func (sq *StudentQuery) First(ctx context.Context) (*Student, error)

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

func (*StudentQuery) FirstID

func (sq *StudentQuery) FirstID(ctx context.Context) (id uuid.UUID, err error)

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

func (*StudentQuery) FirstIDX

func (sq *StudentQuery) FirstIDX(ctx context.Context) uuid.UUID

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

func (*StudentQuery) FirstX

func (sq *StudentQuery) FirstX(ctx context.Context) *Student

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

func (*StudentQuery) GroupBy

func (sq *StudentQuery) GroupBy(field string, fields ...string) *StudentGroupBy

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.Student.Query().
	GroupBy(student.FieldCreatedAt).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*StudentQuery) IDs

func (sq *StudentQuery) IDs(ctx context.Context) (ids []uuid.UUID, err error)

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

func (*StudentQuery) IDsX

func (sq *StudentQuery) IDsX(ctx context.Context) []uuid.UUID

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

func (*StudentQuery) Limit

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

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

func (*StudentQuery) Offset

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

Offset to start from.

func (*StudentQuery) Only

func (sq *StudentQuery) Only(ctx context.Context) (*Student, error)

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

func (*StudentQuery) OnlyID

func (sq *StudentQuery) OnlyID(ctx context.Context) (id uuid.UUID, err error)

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

func (*StudentQuery) OnlyIDX

func (sq *StudentQuery) OnlyIDX(ctx context.Context) uuid.UUID

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

func (*StudentQuery) OnlyX

func (sq *StudentQuery) OnlyX(ctx context.Context) *Student

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

func (*StudentQuery) Order

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

Order specifies how the records should be ordered.

func (*StudentQuery) Select

func (sq *StudentQuery) Select(fields ...string) *StudentSelect

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.Student.Query().
	Select(student.FieldCreatedAt).
	Scan(ctx, &v)

func (*StudentQuery) Unique

func (sq *StudentQuery) Unique(unique bool) *StudentQuery

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

func (sq *StudentQuery) Where(ps ...predicate.Student) *StudentQuery

Where adds a new predicate for the StudentQuery builder.

type StudentSelect

type StudentSelect struct {
	*StudentQuery
	// contains filtered or unexported fields
}

StudentSelect is the builder for selecting fields of Student entities.

func (*StudentSelect) Aggregate

func (ss *StudentSelect) Aggregate(fns ...AggregateFunc) *StudentSelect

Aggregate adds the given aggregation functions to the selector query.

func (*StudentSelect) Bool

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

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

func (*StudentSelect) BoolX

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

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

func (*StudentSelect) Bools

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

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

func (*StudentSelect) BoolsX

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

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

func (*StudentSelect) Float64

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

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

func (*StudentSelect) Float64X

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

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

func (*StudentSelect) Float64s

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

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

func (*StudentSelect) Float64sX

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

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

func (*StudentSelect) Int

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

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

func (*StudentSelect) IntX

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

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

func (*StudentSelect) Ints

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

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

func (*StudentSelect) IntsX

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

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

func (*StudentSelect) Scan

func (ss *StudentSelect) Scan(ctx context.Context, v any) error

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

func (*StudentSelect) ScanX

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

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

func (*StudentSelect) String

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

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

func (*StudentSelect) StringX

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

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

func (*StudentSelect) Strings

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

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

func (*StudentSelect) StringsX

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

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

type StudentUpdate

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

StudentUpdate is the builder for updating Student entities.

func (*StudentUpdate) ClearBirthday

func (su *StudentUpdate) ClearBirthday() *StudentUpdate

ClearBirthday clears the value of the "birthday" field.

func (*StudentUpdate) ClearPasswordHash

func (su *StudentUpdate) ClearPasswordHash() *StudentUpdate

ClearPasswordHash clears the value of the "password_hash" field.

func (*StudentUpdate) Exec

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

Exec executes the query.

func (*StudentUpdate) ExecX

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

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

func (*StudentUpdate) Mutation

func (su *StudentUpdate) Mutation() *StudentMutation

Mutation returns the StudentMutation object of the builder.

func (*StudentUpdate) Save

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

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

func (*StudentUpdate) SaveX

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

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

func (*StudentUpdate) SetBirthday

func (su *StudentUpdate) SetBirthday(t time.Time) *StudentUpdate

SetBirthday sets the "birthday" field.

func (*StudentUpdate) SetFirstName

func (su *StudentUpdate) SetFirstName(s string) *StudentUpdate

SetFirstName sets the "first_name" field.

func (*StudentUpdate) SetGender

func (su *StudentUpdate) SetGender(pr primitive.Gender) *StudentUpdate

SetGender sets the "gender" field.

func (*StudentUpdate) SetLastName

func (su *StudentUpdate) SetLastName(s string) *StudentUpdate

SetLastName sets the "last_name" field.

func (*StudentUpdate) SetNillableBirthday

func (su *StudentUpdate) SetNillableBirthday(t *time.Time) *StudentUpdate

SetNillableBirthday sets the "birthday" field if the given value is not nil.

func (*StudentUpdate) SetPasswordHash

func (su *StudentUpdate) SetPasswordHash(b []byte) *StudentUpdate

SetPasswordHash sets the "password_hash" field.

func (*StudentUpdate) SetPseudo

func (su *StudentUpdate) SetPseudo(s string) *StudentUpdate

SetPseudo sets the "pseudo" field.

func (*StudentUpdate) SetUpdatedAt

func (su *StudentUpdate) SetUpdatedAt(t time.Time) *StudentUpdate

SetUpdatedAt sets the "updated_at" field.

func (*StudentUpdate) Where

func (su *StudentUpdate) Where(ps ...predicate.Student) *StudentUpdate

Where appends a list predicates to the StudentUpdate builder.

type StudentUpdateOne

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

StudentUpdateOne is the builder for updating a single Student entity.

func (*StudentUpdateOne) ClearBirthday

func (suo *StudentUpdateOne) ClearBirthday() *StudentUpdateOne

ClearBirthday clears the value of the "birthday" field.

func (*StudentUpdateOne) ClearPasswordHash

func (suo *StudentUpdateOne) ClearPasswordHash() *StudentUpdateOne

ClearPasswordHash clears the value of the "password_hash" field.

func (*StudentUpdateOne) Exec

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

Exec executes the query on the entity.

func (*StudentUpdateOne) ExecX

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

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

func (*StudentUpdateOne) Mutation

func (suo *StudentUpdateOne) Mutation() *StudentMutation

Mutation returns the StudentMutation object of the builder.

func (*StudentUpdateOne) Save

func (suo *StudentUpdateOne) Save(ctx context.Context) (*Student, error)

Save executes the query and returns the updated Student entity.

func (*StudentUpdateOne) SaveX

func (suo *StudentUpdateOne) SaveX(ctx context.Context) *Student

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

func (*StudentUpdateOne) Select

func (suo *StudentUpdateOne) Select(field string, fields ...string) *StudentUpdateOne

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

func (*StudentUpdateOne) SetBirthday

func (suo *StudentUpdateOne) SetBirthday(t time.Time) *StudentUpdateOne

SetBirthday sets the "birthday" field.

func (*StudentUpdateOne) SetFirstName

func (suo *StudentUpdateOne) SetFirstName(s string) *StudentUpdateOne

SetFirstName sets the "first_name" field.

func (*StudentUpdateOne) SetGender

func (suo *StudentUpdateOne) SetGender(pr primitive.Gender) *StudentUpdateOne

SetGender sets the "gender" field.

func (*StudentUpdateOne) SetLastName

func (suo *StudentUpdateOne) SetLastName(s string) *StudentUpdateOne

SetLastName sets the "last_name" field.

func (*StudentUpdateOne) SetNillableBirthday

func (suo *StudentUpdateOne) SetNillableBirthday(t *time.Time) *StudentUpdateOne

SetNillableBirthday sets the "birthday" field if the given value is not nil.

func (*StudentUpdateOne) SetPasswordHash

func (suo *StudentUpdateOne) SetPasswordHash(b []byte) *StudentUpdateOne

SetPasswordHash sets the "password_hash" field.

func (*StudentUpdateOne) SetPseudo

func (suo *StudentUpdateOne) SetPseudo(s string) *StudentUpdateOne

SetPseudo sets the "pseudo" field.

func (*StudentUpdateOne) SetUpdatedAt

func (suo *StudentUpdateOne) SetUpdatedAt(t time.Time) *StudentUpdateOne

SetUpdatedAt sets the "updated_at" field.

func (*StudentUpdateOne) Where

Where appends a list predicates to the StudentUpdate builder.

type Students

type Students []*Student

Students is a parsable slice of Student.

func (Students) ToFront

func (s Students) ToFront() []*StudentFront

ToFront is the structure returned to the frontend

type StudentsFront

type StudentsFront []*StudentFront

StudentsFront is a parsable slice of StudentFront.

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 {

	// Admin is the client for interacting with the Admin builders.
	Admin *AdminClient
	// Student is the client for interacting with the Student builders.
	Student *StudentClient
	// contains filtered or unexported fields
}

Tx is a transactional client that is created by calling Client.Tx().

func TxFromContext

func TxFromContext(ctx context.Context) *Tx

TxFromContext returns a Tx stored inside a context, or nil if there isn't one.

func (*Tx) Client

func (tx *Tx) Client() *Client

Client returns a Client that binds to current transaction.

func (*Tx) Commit

func (tx *Tx) Commit() error

Commit commits the transaction.

func (*Tx) OnCommit

func (tx *Tx) OnCommit(f CommitHook)

OnCommit adds a hook to call on commit.

func (*Tx) OnRollback

func (tx *Tx) OnRollback(f RollbackHook)

OnRollback adds a hook to call on rollback.

func (*Tx) Rollback

func (tx *Tx) Rollback() error

Rollback rollbacks the transaction.

type ValidationError

type ValidationError struct {
	Name string // Field or edge name.
	// contains filtered or unexported fields
}

ValidationError returns when validating a field 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
Package schema contains the schema definition for the ent package.
Package schema contains the schema definition for the ent package.
mixin/timemixin
Package timemixin implements the ent.Mixin about time fields.
Package timemixin implements the ent.Mixin about time fields.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL