ent

package
v1.2.0-beta.4 Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2023 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

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

	// Node types.
	TypeCertification = "Certification"
	TypeLocalKey      = "LocalKey"
)

Variables

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.

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.

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 Certification

type Certification struct {

	// ID of the ent.
	ID uuid.UUID `json:"id,omitempty"`
	// AnchorID holds the value of the "anchor_id" field.
	AnchorID int `json:"anchor_id,omitempty"`
	// Hash holds the value of the "hash" field.
	Hash string `json:"hash,omitempty"`
	// DataID holds the value of the "data_id" field.
	DataID string `json:"data_id,omitempty"`
	// contains filtered or unexported fields
}

Certification is the model entity for the Certification schema.

func (*Certification) String

func (c *Certification) String() string

String implements the fmt.Stringer.

func (*Certification) Unwrap

func (c *Certification) Unwrap() *Certification

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

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

func (*Certification) Value

func (c *Certification) Value(name string) (ent.Value, error)

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

type CertificationClient

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

CertificationClient is a client for the Certification schema.

func NewCertificationClient

func NewCertificationClient(c config) *CertificationClient

NewCertificationClient returns a client for the Certification from the given config.

func (*CertificationClient) Create

Create returns a builder for creating a Certification entity.

func (*CertificationClient) CreateBulk

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

func (*CertificationClient) Delete

Delete returns a delete builder for Certification.

func (*CertificationClient) DeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*CertificationClient) DeleteOneID

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

func (*CertificationClient) Get

Get returns a Certification entity by its id.

func (*CertificationClient) GetX

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

func (*CertificationClient) Hooks

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

Hooks returns the client hooks.

func (*CertificationClient) Intercept

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

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

func (*CertificationClient) Interceptors

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

Interceptors returns the client interceptors.

func (*CertificationClient) MapCreateBulk

func (c *CertificationClient) MapCreateBulk(slice any, setFunc func(*CertificationCreate, int)) *CertificationCreateBulk

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 (*CertificationClient) Query

Query returns a query builder for Certification.

func (*CertificationClient) Update

Update returns an update builder for Certification.

func (*CertificationClient) UpdateOne

UpdateOne returns an update builder for the given entity.

func (*CertificationClient) UpdateOneID

UpdateOneID returns an update builder for the given id.

func (*CertificationClient) Use

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

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

type CertificationCreate

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

CertificationCreate is the builder for creating a Certification entity.

func (*CertificationCreate) Exec

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

Exec executes the query.

func (*CertificationCreate) ExecX

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

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

func (*CertificationCreate) Mutation

Mutation returns the CertificationMutation object of the builder.

func (*CertificationCreate) Save

Save creates the Certification in the database.

func (*CertificationCreate) SaveX

SaveX calls Save and panics if Save returns an error.

func (*CertificationCreate) SetAnchorID

func (cc *CertificationCreate) SetAnchorID(i int) *CertificationCreate

SetAnchorID sets the "anchor_id" field.

func (*CertificationCreate) SetDataID

SetDataID sets the "data_id" field.

func (*CertificationCreate) SetHash

SetHash sets the "hash" field.

func (*CertificationCreate) SetID

SetID sets the "id" field.

func (*CertificationCreate) SetNillableID

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

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

type CertificationCreateBulk

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

CertificationCreateBulk is the builder for creating many Certification entities in bulk.

func (*CertificationCreateBulk) Exec

Exec executes the query.

func (*CertificationCreateBulk) ExecX

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

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

func (*CertificationCreateBulk) Save

Save creates the Certification entities in the database.

func (*CertificationCreateBulk) SaveX

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

type CertificationDelete

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

CertificationDelete is the builder for deleting a Certification entity.

func (*CertificationDelete) Exec

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

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

func (*CertificationDelete) ExecX

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

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

func (*CertificationDelete) Where

Where appends a list predicates to the CertificationDelete builder.

type CertificationDeleteOne

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

CertificationDeleteOne is the builder for deleting a single Certification entity.

func (*CertificationDeleteOne) Exec

Exec executes the deletion query.

func (*CertificationDeleteOne) ExecX

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

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

func (*CertificationDeleteOne) Where

Where appends a list predicates to the CertificationDelete builder.

type CertificationGroupBy

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

CertificationGroupBy is the group-by builder for Certification entities.

func (*CertificationGroupBy) Aggregate

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

func (*CertificationGroupBy) Bool

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

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

func (*CertificationGroupBy) BoolX

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

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

func (*CertificationGroupBy) Bools

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

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

func (*CertificationGroupBy) BoolsX

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

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

func (*CertificationGroupBy) Float64

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

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

func (*CertificationGroupBy) Float64X

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

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

func (*CertificationGroupBy) Float64s

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

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

func (*CertificationGroupBy) Float64sX

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

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

func (*CertificationGroupBy) Int

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

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

func (*CertificationGroupBy) IntX

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

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

func (*CertificationGroupBy) Ints

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

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

func (*CertificationGroupBy) IntsX

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

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

func (*CertificationGroupBy) Scan

func (cgb *CertificationGroupBy) Scan(ctx context.Context, v any) error

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

func (*CertificationGroupBy) ScanX

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

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

func (*CertificationGroupBy) String

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

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

func (*CertificationGroupBy) StringX

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

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

func (*CertificationGroupBy) Strings

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

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

func (*CertificationGroupBy) StringsX

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

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

type CertificationMutation

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

CertificationMutation represents an operation that mutates the Certification nodes in the graph.

func (*CertificationMutation) AddAnchorID

func (m *CertificationMutation) AddAnchorID(i int)

AddAnchorID adds i to the "anchor_id" field.

func (*CertificationMutation) AddField

func (m *CertificationMutation) 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 (*CertificationMutation) AddedAnchorID

func (m *CertificationMutation) AddedAnchorID() (r int, exists bool)

AddedAnchorID returns the value that was added to the "anchor_id" field in this mutation.

func (*CertificationMutation) AddedEdges

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

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

func (*CertificationMutation) AddedField

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

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

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

func (*CertificationMutation) AddedIDs

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

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

func (*CertificationMutation) AnchorID

func (m *CertificationMutation) AnchorID() (r int, exists bool)

AnchorID returns the value of the "anchor_id" field in the mutation.

func (*CertificationMutation) ClearEdge

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

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

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

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

func (*CertificationMutation) ClearedFields

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

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

func (CertificationMutation) Client

func (m CertificationMutation) 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 (*CertificationMutation) DataID

func (m *CertificationMutation) DataID() (r string, exists bool)

DataID returns the value of the "data_id" field in the mutation.

func (*CertificationMutation) EdgeCleared

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

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

func (*CertificationMutation) Field

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

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

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

func (*CertificationMutation) Fields

func (m *CertificationMutation) 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 (*CertificationMutation) Hash

func (m *CertificationMutation) Hash() (r string, exists bool)

Hash returns the value of the "hash" field in the mutation.

func (*CertificationMutation) ID

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

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 (*CertificationMutation) OldAnchorID

func (m *CertificationMutation) OldAnchorID(ctx context.Context) (v int, err error)

OldAnchorID returns the old "anchor_id" field's value of the Certification entity. If the Certification 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 (*CertificationMutation) OldDataID

func (m *CertificationMutation) OldDataID(ctx context.Context) (v string, err error)

OldDataID returns the old "data_id" field's value of the Certification entity. If the Certification 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 (*CertificationMutation) OldField

func (m *CertificationMutation) 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 (*CertificationMutation) OldHash

func (m *CertificationMutation) OldHash(ctx context.Context) (v string, err error)

OldHash returns the old "hash" field's value of the Certification entity. If the Certification 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 (*CertificationMutation) Op

func (m *CertificationMutation) Op() Op

Op returns the operation name.

func (*CertificationMutation) RemovedEdges

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

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

func (*CertificationMutation) RemovedIDs

func (m *CertificationMutation) 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 (*CertificationMutation) ResetAnchorID

func (m *CertificationMutation) ResetAnchorID()

ResetAnchorID resets all changes to the "anchor_id" field.

func (*CertificationMutation) ResetDataID

func (m *CertificationMutation) ResetDataID()

ResetDataID resets all changes to the "data_id" field.

func (*CertificationMutation) ResetEdge

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

func (m *CertificationMutation) 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 (*CertificationMutation) ResetHash

func (m *CertificationMutation) ResetHash()

ResetHash resets all changes to the "hash" field.

func (*CertificationMutation) SetAnchorID

func (m *CertificationMutation) SetAnchorID(i int)

SetAnchorID sets the "anchor_id" field.

func (*CertificationMutation) SetDataID

func (m *CertificationMutation) SetDataID(s string)

SetDataID sets the "data_id" field.

func (*CertificationMutation) SetField

func (m *CertificationMutation) 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 (*CertificationMutation) SetHash

func (m *CertificationMutation) SetHash(s string)

SetHash sets the "hash" field.

func (*CertificationMutation) SetID

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

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

func (*CertificationMutation) SetOp

func (m *CertificationMutation) SetOp(op Op)

SetOp allows setting the mutation operation.

func (CertificationMutation) Tx

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

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

func (*CertificationMutation) Type

func (m *CertificationMutation) Type() string

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

func (*CertificationMutation) Where

Where appends a list predicates to the CertificationMutation builder.

func (*CertificationMutation) WhereP

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

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

type CertificationQuery

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

CertificationQuery is the builder for querying Certification entities.

func (*CertificationQuery) Aggregate

func (cq *CertificationQuery) Aggregate(fns ...AggregateFunc) *CertificationSelect

Aggregate returns a CertificationSelect configured with the given aggregations.

func (*CertificationQuery) All

All executes the query and returns a list of Certifications.

func (*CertificationQuery) AllX

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

func (*CertificationQuery) Clone

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

func (*CertificationQuery) Count

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

Count returns the count of the given query.

func (*CertificationQuery) CountX

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

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

func (*CertificationQuery) Exist

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

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

func (*CertificationQuery) ExistX

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

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

func (*CertificationQuery) First

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

func (*CertificationQuery) FirstID

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

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

func (*CertificationQuery) FirstIDX

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

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

func (*CertificationQuery) FirstX

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

func (*CertificationQuery) GroupBy

func (cq *CertificationQuery) GroupBy(field string, fields ...string) *CertificationGroupBy

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

client.Certification.Query().
	GroupBy(certification.FieldAnchorID).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*CertificationQuery) IDs

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

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

func (*CertificationQuery) IDsX

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

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

func (*CertificationQuery) Limit

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

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

func (*CertificationQuery) Offset

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

Offset to start from.

func (*CertificationQuery) Only

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

func (*CertificationQuery) OnlyID

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

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

func (*CertificationQuery) OnlyIDX

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

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

func (*CertificationQuery) OnlyX

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

func (*CertificationQuery) Order

Order specifies how the records should be ordered.

func (*CertificationQuery) Select

func (cq *CertificationQuery) Select(fields ...string) *CertificationSelect

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

client.Certification.Query().
	Select(certification.FieldAnchorID).
	Scan(ctx, &v)

func (*CertificationQuery) Unique

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

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

Where adds a new predicate for the CertificationQuery builder.

type CertificationSelect

type CertificationSelect struct {
	*CertificationQuery
	// contains filtered or unexported fields
}

CertificationSelect is the builder for selecting fields of Certification entities.

func (*CertificationSelect) Aggregate

func (cs *CertificationSelect) Aggregate(fns ...AggregateFunc) *CertificationSelect

Aggregate adds the given aggregation functions to the selector query.

func (*CertificationSelect) Bool

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

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

func (*CertificationSelect) BoolX

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

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

func (*CertificationSelect) Bools

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

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

func (*CertificationSelect) BoolsX

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

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

func (*CertificationSelect) Float64

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

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

func (*CertificationSelect) Float64X

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

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

func (*CertificationSelect) Float64s

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

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

func (*CertificationSelect) Float64sX

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

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

func (*CertificationSelect) Int

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

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

func (*CertificationSelect) IntX

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

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

func (*CertificationSelect) Ints

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

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

func (*CertificationSelect) IntsX

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

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

func (*CertificationSelect) Scan

func (cs *CertificationSelect) Scan(ctx context.Context, v any) error

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

func (*CertificationSelect) ScanX

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

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

func (*CertificationSelect) String

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

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

func (*CertificationSelect) StringX

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

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

func (*CertificationSelect) Strings

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

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

func (*CertificationSelect) StringsX

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

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

type CertificationUpdate

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

CertificationUpdate is the builder for updating Certification entities.

func (*CertificationUpdate) AddAnchorID

func (cu *CertificationUpdate) AddAnchorID(i int) *CertificationUpdate

AddAnchorID adds i to the "anchor_id" field.

func (*CertificationUpdate) Exec

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

Exec executes the query.

func (*CertificationUpdate) ExecX

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

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

func (*CertificationUpdate) Mutation

Mutation returns the CertificationMutation object of the builder.

func (*CertificationUpdate) Save

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

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

func (*CertificationUpdate) SaveX

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

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

func (*CertificationUpdate) SetAnchorID

func (cu *CertificationUpdate) SetAnchorID(i int) *CertificationUpdate

SetAnchorID sets the "anchor_id" field.

func (*CertificationUpdate) SetDataID

SetDataID sets the "data_id" field.

func (*CertificationUpdate) SetHash

SetHash sets the "hash" field.

func (*CertificationUpdate) Where

Where appends a list predicates to the CertificationUpdate builder.

type CertificationUpdateOne

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

CertificationUpdateOne is the builder for updating a single Certification entity.

func (*CertificationUpdateOne) AddAnchorID

func (cuo *CertificationUpdateOne) AddAnchorID(i int) *CertificationUpdateOne

AddAnchorID adds i to the "anchor_id" field.

func (*CertificationUpdateOne) Exec

Exec executes the query on the entity.

func (*CertificationUpdateOne) ExecX

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

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

func (*CertificationUpdateOne) Mutation

Mutation returns the CertificationMutation object of the builder.

func (*CertificationUpdateOne) Save

Save executes the query and returns the updated Certification entity.

func (*CertificationUpdateOne) SaveX

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

func (*CertificationUpdateOne) Select

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

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

func (*CertificationUpdateOne) SetAnchorID

func (cuo *CertificationUpdateOne) SetAnchorID(i int) *CertificationUpdateOne

SetAnchorID sets the "anchor_id" field.

func (*CertificationUpdateOne) SetDataID

SetDataID sets the "data_id" field.

func (*CertificationUpdateOne) SetHash

SetHash sets the "hash" field.

func (*CertificationUpdateOne) Where

Where appends a list predicates to the CertificationUpdate builder.

type Certifications

type Certifications []*Certification

Certifications is a parsable slice of Certification.

type Client

type Client struct {

	// Schema is the client for creating, migrating and dropping schema.
	Schema *migrate.Schema
	// Certification is the client for interacting with the Certification builders.
	Certification *CertificationClient
	// LocalKey is the client for interacting with the LocalKey builders.
	LocalKey *LocalKeyClient
	// 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().
	Certification.
	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 LocalKey

type LocalKey struct {

	// ID of the ent.
	ID uuid.UUID `json:"id,omitempty"`
	// LocalKey holds the value of the "local_key" field.
	LocalKey *key.LocalKey `json:"local_key,omitempty"`
	// KeyType holds the value of the "key_type" field.
	KeyType string `json:"key_type,omitempty"`
	// contains filtered or unexported fields
}

LocalKey is the model entity for the LocalKey schema.

func (*LocalKey) String

func (lk *LocalKey) String() string

String implements the fmt.Stringer.

func (*LocalKey) Unwrap

func (lk *LocalKey) Unwrap() *LocalKey

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

func (lk *LocalKey) Update() *LocalKeyUpdateOne

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

func (*LocalKey) Value

func (lk *LocalKey) Value(name string) (ent.Value, error)

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

type LocalKeyClient

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

LocalKeyClient is a client for the LocalKey schema.

func NewLocalKeyClient

func NewLocalKeyClient(c config) *LocalKeyClient

NewLocalKeyClient returns a client for the LocalKey from the given config.

func (*LocalKeyClient) Create

func (c *LocalKeyClient) Create() *LocalKeyCreate

Create returns a builder for creating a LocalKey entity.

func (*LocalKeyClient) CreateBulk

func (c *LocalKeyClient) CreateBulk(builders ...*LocalKeyCreate) *LocalKeyCreateBulk

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

func (*LocalKeyClient) Delete

func (c *LocalKeyClient) Delete() *LocalKeyDelete

Delete returns a delete builder for LocalKey.

func (*LocalKeyClient) DeleteOne

func (c *LocalKeyClient) DeleteOne(lk *LocalKey) *LocalKeyDeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*LocalKeyClient) DeleteOneID

func (c *LocalKeyClient) DeleteOneID(id uuid.UUID) *LocalKeyDeleteOne

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

func (*LocalKeyClient) Get

func (c *LocalKeyClient) Get(ctx context.Context, id uuid.UUID) (*LocalKey, error)

Get returns a LocalKey entity by its id.

func (*LocalKeyClient) GetX

func (c *LocalKeyClient) GetX(ctx context.Context, id uuid.UUID) *LocalKey

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

func (*LocalKeyClient) Hooks

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

Hooks returns the client hooks.

func (*LocalKeyClient) Intercept

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

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

func (*LocalKeyClient) Interceptors

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

Interceptors returns the client interceptors.

func (*LocalKeyClient) MapCreateBulk

func (c *LocalKeyClient) MapCreateBulk(slice any, setFunc func(*LocalKeyCreate, int)) *LocalKeyCreateBulk

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 (*LocalKeyClient) Query

func (c *LocalKeyClient) Query() *LocalKeyQuery

Query returns a query builder for LocalKey.

func (*LocalKeyClient) Update

func (c *LocalKeyClient) Update() *LocalKeyUpdate

Update returns an update builder for LocalKey.

func (*LocalKeyClient) UpdateOne

func (c *LocalKeyClient) UpdateOne(lk *LocalKey) *LocalKeyUpdateOne

UpdateOne returns an update builder for the given entity.

func (*LocalKeyClient) UpdateOneID

func (c *LocalKeyClient) UpdateOneID(id uuid.UUID) *LocalKeyUpdateOne

UpdateOneID returns an update builder for the given id.

func (*LocalKeyClient) Use

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

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

type LocalKeyCreate

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

LocalKeyCreate is the builder for creating a LocalKey entity.

func (*LocalKeyCreate) Exec

func (lkc *LocalKeyCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*LocalKeyCreate) ExecX

func (lkc *LocalKeyCreate) ExecX(ctx context.Context)

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

func (*LocalKeyCreate) Mutation

func (lkc *LocalKeyCreate) Mutation() *LocalKeyMutation

Mutation returns the LocalKeyMutation object of the builder.

func (*LocalKeyCreate) Save

func (lkc *LocalKeyCreate) Save(ctx context.Context) (*LocalKey, error)

Save creates the LocalKey in the database.

func (*LocalKeyCreate) SaveX

func (lkc *LocalKeyCreate) SaveX(ctx context.Context) *LocalKey

SaveX calls Save and panics if Save returns an error.

func (*LocalKeyCreate) SetID

func (lkc *LocalKeyCreate) SetID(u uuid.UUID) *LocalKeyCreate

SetID sets the "id" field.

func (*LocalKeyCreate) SetKeyType

func (lkc *LocalKeyCreate) SetKeyType(s string) *LocalKeyCreate

SetKeyType sets the "key_type" field.

func (*LocalKeyCreate) SetLocalKey

func (lkc *LocalKeyCreate) SetLocalKey(kk *key.LocalKey) *LocalKeyCreate

SetLocalKey sets the "local_key" field.

func (*LocalKeyCreate) SetNillableID

func (lkc *LocalKeyCreate) SetNillableID(u *uuid.UUID) *LocalKeyCreate

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

type LocalKeyCreateBulk

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

LocalKeyCreateBulk is the builder for creating many LocalKey entities in bulk.

func (*LocalKeyCreateBulk) Exec

func (lkcb *LocalKeyCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*LocalKeyCreateBulk) ExecX

func (lkcb *LocalKeyCreateBulk) ExecX(ctx context.Context)

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

func (*LocalKeyCreateBulk) Save

func (lkcb *LocalKeyCreateBulk) Save(ctx context.Context) ([]*LocalKey, error)

Save creates the LocalKey entities in the database.

func (*LocalKeyCreateBulk) SaveX

func (lkcb *LocalKeyCreateBulk) SaveX(ctx context.Context) []*LocalKey

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

type LocalKeyDelete

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

LocalKeyDelete is the builder for deleting a LocalKey entity.

func (*LocalKeyDelete) Exec

func (lkd *LocalKeyDelete) Exec(ctx context.Context) (int, error)

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

func (*LocalKeyDelete) ExecX

func (lkd *LocalKeyDelete) ExecX(ctx context.Context) int

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

func (*LocalKeyDelete) Where

func (lkd *LocalKeyDelete) Where(ps ...predicate.LocalKey) *LocalKeyDelete

Where appends a list predicates to the LocalKeyDelete builder.

type LocalKeyDeleteOne

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

LocalKeyDeleteOne is the builder for deleting a single LocalKey entity.

func (*LocalKeyDeleteOne) Exec

func (lkdo *LocalKeyDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*LocalKeyDeleteOne) ExecX

func (lkdo *LocalKeyDeleteOne) ExecX(ctx context.Context)

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

func (*LocalKeyDeleteOne) Where

Where appends a list predicates to the LocalKeyDelete builder.

type LocalKeyGroupBy

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

LocalKeyGroupBy is the group-by builder for LocalKey entities.

func (*LocalKeyGroupBy) Aggregate

func (lkgb *LocalKeyGroupBy) Aggregate(fns ...AggregateFunc) *LocalKeyGroupBy

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

func (*LocalKeyGroupBy) Bool

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

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

func (*LocalKeyGroupBy) BoolX

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

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

func (*LocalKeyGroupBy) Bools

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

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

func (*LocalKeyGroupBy) BoolsX

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

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

func (*LocalKeyGroupBy) Float64

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

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

func (*LocalKeyGroupBy) Float64X

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

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

func (*LocalKeyGroupBy) Float64s

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

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

func (*LocalKeyGroupBy) Float64sX

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

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

func (*LocalKeyGroupBy) Int

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

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

func (*LocalKeyGroupBy) IntX

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

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

func (*LocalKeyGroupBy) Ints

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

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

func (*LocalKeyGroupBy) IntsX

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

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

func (*LocalKeyGroupBy) Scan

func (lkgb *LocalKeyGroupBy) Scan(ctx context.Context, v any) error

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

func (*LocalKeyGroupBy) ScanX

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

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

func (*LocalKeyGroupBy) String

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

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

func (*LocalKeyGroupBy) StringX

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

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

func (*LocalKeyGroupBy) Strings

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

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

func (*LocalKeyGroupBy) StringsX

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

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

type LocalKeyMutation

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

LocalKeyMutation represents an operation that mutates the LocalKey nodes in the graph.

func (*LocalKeyMutation) AddField

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

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

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

func (*LocalKeyMutation) AddedField

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

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

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

func (*LocalKeyMutation) AddedIDs

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

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

func (*LocalKeyMutation) ClearEdge

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

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

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

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

func (*LocalKeyMutation) ClearedFields

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

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

func (LocalKeyMutation) Client

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

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

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

func (*LocalKeyMutation) Field

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

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

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

func (*LocalKeyMutation) Fields

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

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

func (m *LocalKeyMutation) 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 (*LocalKeyMutation) KeyType

func (m *LocalKeyMutation) KeyType() (r string, exists bool)

KeyType returns the value of the "key_type" field in the mutation.

func (*LocalKeyMutation) LocalKey

func (m *LocalKeyMutation) LocalKey() (r *key.LocalKey, exists bool)

LocalKey returns the value of the "local_key" field in the mutation.

func (*LocalKeyMutation) OldField

func (m *LocalKeyMutation) 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 (*LocalKeyMutation) OldKeyType

func (m *LocalKeyMutation) OldKeyType(ctx context.Context) (v string, err error)

OldKeyType returns the old "key_type" field's value of the LocalKey entity. If the LocalKey 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 (*LocalKeyMutation) OldLocalKey

func (m *LocalKeyMutation) OldLocalKey(ctx context.Context) (v *key.LocalKey, err error)

OldLocalKey returns the old "local_key" field's value of the LocalKey entity. If the LocalKey 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 (*LocalKeyMutation) Op

func (m *LocalKeyMutation) Op() Op

Op returns the operation name.

func (*LocalKeyMutation) RemovedEdges

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

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

func (*LocalKeyMutation) RemovedIDs

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

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

func (m *LocalKeyMutation) 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 (*LocalKeyMutation) ResetKeyType

func (m *LocalKeyMutation) ResetKeyType()

ResetKeyType resets all changes to the "key_type" field.

func (*LocalKeyMutation) ResetLocalKey

func (m *LocalKeyMutation) ResetLocalKey()

ResetLocalKey resets all changes to the "local_key" field.

func (*LocalKeyMutation) SetField

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

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

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

func (*LocalKeyMutation) SetKeyType

func (m *LocalKeyMutation) SetKeyType(s string)

SetKeyType sets the "key_type" field.

func (*LocalKeyMutation) SetLocalKey

func (m *LocalKeyMutation) SetLocalKey(kk *key.LocalKey)

SetLocalKey sets the "local_key" field.

func (*LocalKeyMutation) SetOp

func (m *LocalKeyMutation) SetOp(op Op)

SetOp allows setting the mutation operation.

func (LocalKeyMutation) Tx

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

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

func (*LocalKeyMutation) Type

func (m *LocalKeyMutation) Type() string

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

func (*LocalKeyMutation) Where

func (m *LocalKeyMutation) Where(ps ...predicate.LocalKey)

Where appends a list predicates to the LocalKeyMutation builder.

func (*LocalKeyMutation) WhereP

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

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

type LocalKeyQuery

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

LocalKeyQuery is the builder for querying LocalKey entities.

func (*LocalKeyQuery) Aggregate

func (lkq *LocalKeyQuery) Aggregate(fns ...AggregateFunc) *LocalKeySelect

Aggregate returns a LocalKeySelect configured with the given aggregations.

func (*LocalKeyQuery) All

func (lkq *LocalKeyQuery) All(ctx context.Context) ([]*LocalKey, error)

All executes the query and returns a list of LocalKeys.

func (*LocalKeyQuery) AllX

func (lkq *LocalKeyQuery) AllX(ctx context.Context) []*LocalKey

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

func (*LocalKeyQuery) Clone

func (lkq *LocalKeyQuery) Clone() *LocalKeyQuery

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

func (*LocalKeyQuery) Count

func (lkq *LocalKeyQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*LocalKeyQuery) CountX

func (lkq *LocalKeyQuery) CountX(ctx context.Context) int

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

func (*LocalKeyQuery) Exist

func (lkq *LocalKeyQuery) Exist(ctx context.Context) (bool, error)

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

func (*LocalKeyQuery) ExistX

func (lkq *LocalKeyQuery) ExistX(ctx context.Context) bool

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

func (*LocalKeyQuery) First

func (lkq *LocalKeyQuery) First(ctx context.Context) (*LocalKey, error)

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

func (*LocalKeyQuery) FirstID

func (lkq *LocalKeyQuery) FirstID(ctx context.Context) (id uuid.UUID, err error)

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

func (*LocalKeyQuery) FirstIDX

func (lkq *LocalKeyQuery) FirstIDX(ctx context.Context) uuid.UUID

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

func (*LocalKeyQuery) FirstX

func (lkq *LocalKeyQuery) FirstX(ctx context.Context) *LocalKey

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

func (*LocalKeyQuery) GroupBy

func (lkq *LocalKeyQuery) GroupBy(field string, fields ...string) *LocalKeyGroupBy

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 {
	LocalKey *key.LocalKey `json:"local_key,omitempty"`
	Count int `json:"count,omitempty"`
}

client.LocalKey.Query().
	GroupBy(localkey.FieldLocalKey).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*LocalKeyQuery) IDs

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

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

func (*LocalKeyQuery) IDsX

func (lkq *LocalKeyQuery) IDsX(ctx context.Context) []uuid.UUID

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

func (*LocalKeyQuery) Limit

func (lkq *LocalKeyQuery) Limit(limit int) *LocalKeyQuery

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

func (*LocalKeyQuery) Offset

func (lkq *LocalKeyQuery) Offset(offset int) *LocalKeyQuery

Offset to start from.

func (*LocalKeyQuery) Only

func (lkq *LocalKeyQuery) Only(ctx context.Context) (*LocalKey, error)

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

func (*LocalKeyQuery) OnlyID

func (lkq *LocalKeyQuery) OnlyID(ctx context.Context) (id uuid.UUID, err error)

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

func (*LocalKeyQuery) OnlyIDX

func (lkq *LocalKeyQuery) OnlyIDX(ctx context.Context) uuid.UUID

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

func (*LocalKeyQuery) OnlyX

func (lkq *LocalKeyQuery) OnlyX(ctx context.Context) *LocalKey

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

func (*LocalKeyQuery) Order

func (lkq *LocalKeyQuery) Order(o ...localkey.OrderOption) *LocalKeyQuery

Order specifies how the records should be ordered.

func (*LocalKeyQuery) Select

func (lkq *LocalKeyQuery) Select(fields ...string) *LocalKeySelect

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 {
	LocalKey *key.LocalKey `json:"local_key,omitempty"`
}

client.LocalKey.Query().
	Select(localkey.FieldLocalKey).
	Scan(ctx, &v)

func (*LocalKeyQuery) Unique

func (lkq *LocalKeyQuery) Unique(unique bool) *LocalKeyQuery

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

func (lkq *LocalKeyQuery) Where(ps ...predicate.LocalKey) *LocalKeyQuery

Where adds a new predicate for the LocalKeyQuery builder.

type LocalKeySelect

type LocalKeySelect struct {
	*LocalKeyQuery
	// contains filtered or unexported fields
}

LocalKeySelect is the builder for selecting fields of LocalKey entities.

func (*LocalKeySelect) Aggregate

func (lks *LocalKeySelect) Aggregate(fns ...AggregateFunc) *LocalKeySelect

Aggregate adds the given aggregation functions to the selector query.

func (*LocalKeySelect) Bool

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

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

func (*LocalKeySelect) BoolX

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

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

func (*LocalKeySelect) Bools

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

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

func (*LocalKeySelect) BoolsX

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

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

func (*LocalKeySelect) Float64

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

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

func (*LocalKeySelect) Float64X

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

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

func (*LocalKeySelect) Float64s

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

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

func (*LocalKeySelect) Float64sX

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

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

func (*LocalKeySelect) Int

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

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

func (*LocalKeySelect) IntX

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

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

func (*LocalKeySelect) Ints

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

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

func (*LocalKeySelect) IntsX

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

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

func (*LocalKeySelect) Scan

func (lks *LocalKeySelect) Scan(ctx context.Context, v any) error

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

func (*LocalKeySelect) ScanX

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

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

func (*LocalKeySelect) String

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

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

func (*LocalKeySelect) StringX

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

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

func (*LocalKeySelect) Strings

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

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

func (*LocalKeySelect) StringsX

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

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

type LocalKeyUpdate

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

LocalKeyUpdate is the builder for updating LocalKey entities.

func (*LocalKeyUpdate) Exec

func (lku *LocalKeyUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*LocalKeyUpdate) ExecX

func (lku *LocalKeyUpdate) ExecX(ctx context.Context)

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

func (*LocalKeyUpdate) Mutation

func (lku *LocalKeyUpdate) Mutation() *LocalKeyMutation

Mutation returns the LocalKeyMutation object of the builder.

func (*LocalKeyUpdate) Save

func (lku *LocalKeyUpdate) Save(ctx context.Context) (int, error)

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

func (*LocalKeyUpdate) SaveX

func (lku *LocalKeyUpdate) SaveX(ctx context.Context) int

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

func (*LocalKeyUpdate) SetKeyType

func (lku *LocalKeyUpdate) SetKeyType(s string) *LocalKeyUpdate

SetKeyType sets the "key_type" field.

func (*LocalKeyUpdate) SetLocalKey

func (lku *LocalKeyUpdate) SetLocalKey(kk *key.LocalKey) *LocalKeyUpdate

SetLocalKey sets the "local_key" field.

func (*LocalKeyUpdate) Where

func (lku *LocalKeyUpdate) Where(ps ...predicate.LocalKey) *LocalKeyUpdate

Where appends a list predicates to the LocalKeyUpdate builder.

type LocalKeyUpdateOne

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

LocalKeyUpdateOne is the builder for updating a single LocalKey entity.

func (*LocalKeyUpdateOne) Exec

func (lkuo *LocalKeyUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*LocalKeyUpdateOne) ExecX

func (lkuo *LocalKeyUpdateOne) ExecX(ctx context.Context)

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

func (*LocalKeyUpdateOne) Mutation

func (lkuo *LocalKeyUpdateOne) Mutation() *LocalKeyMutation

Mutation returns the LocalKeyMutation object of the builder.

func (*LocalKeyUpdateOne) Save

func (lkuo *LocalKeyUpdateOne) Save(ctx context.Context) (*LocalKey, error)

Save executes the query and returns the updated LocalKey entity.

func (*LocalKeyUpdateOne) SaveX

func (lkuo *LocalKeyUpdateOne) SaveX(ctx context.Context) *LocalKey

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

func (*LocalKeyUpdateOne) Select

func (lkuo *LocalKeyUpdateOne) Select(field string, fields ...string) *LocalKeyUpdateOne

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

func (*LocalKeyUpdateOne) SetKeyType

func (lkuo *LocalKeyUpdateOne) SetKeyType(s string) *LocalKeyUpdateOne

SetKeyType sets the "key_type" field.

func (*LocalKeyUpdateOne) SetLocalKey

func (lkuo *LocalKeyUpdateOne) SetLocalKey(kk *key.LocalKey) *LocalKeyUpdateOne

SetLocalKey sets the "local_key" field.

func (*LocalKeyUpdateOne) Where

Where appends a list predicates to the LocalKeyUpdate builder.

type LocalKeys

type LocalKeys []*LocalKey

LocalKeys is a parsable slice of LocalKey.

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. Deprecated: Use Asc/Desc functions or the package builders instead.

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 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 {

	// Certification is the client for interacting with the Certification builders.
	Certification *CertificationClient
	// LocalKey is the client for interacting with the LocalKey builders.
	LocalKey *LocalKeyClient
	// 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

Jump to

Keyboard shortcuts

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