db

package
v1.0.0-beta.107 Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2024 License: Apache-2.0 Imports: 23 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.
	TypeBalanceSnapshot = "BalanceSnapshot"
	TypeGrant           = "Grant"
)

Variables

View Source
var ErrTxStarted = errors.New("db: 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(db.As(db.Sum(field1), "sum_field1"), (db.As(db.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 BalanceSnapshot

type BalanceSnapshot struct {

	// ID of the ent.
	ID int `json:"id,omitempty"`
	// Namespace holds the value of the "namespace" field.
	Namespace string `json:"namespace,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"`
	// DeletedAt holds the value of the "deleted_at" field.
	DeletedAt *time.Time `json:"deleted_at,omitempty"`
	// OwnerID holds the value of the "owner_id" field.
	OwnerID credit.GrantOwner `json:"owner_id,omitempty"`
	// GrantBalances holds the value of the "grant_balances" field.
	GrantBalances credit.GrantBalanceMap `json:"grant_balances,omitempty"`
	// Balance holds the value of the "balance" field.
	Balance float64 `json:"balance,omitempty"`
	// Overage holds the value of the "overage" field.
	Overage float64 `json:"overage,omitempty"`
	// At holds the value of the "at" field.
	At time.Time `json:"at,omitempty"`
	// contains filtered or unexported fields
}

BalanceSnapshot is the model entity for the BalanceSnapshot schema.

func (*BalanceSnapshot) String

func (bs *BalanceSnapshot) String() string

String implements the fmt.Stringer.

func (*BalanceSnapshot) Unwrap

func (bs *BalanceSnapshot) Unwrap() *BalanceSnapshot

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

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

func (*BalanceSnapshot) Value

func (bs *BalanceSnapshot) Value(name string) (ent.Value, error)

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

type BalanceSnapshotClient

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

BalanceSnapshotClient is a client for the BalanceSnapshot schema.

func NewBalanceSnapshotClient

func NewBalanceSnapshotClient(c config) *BalanceSnapshotClient

NewBalanceSnapshotClient returns a client for the BalanceSnapshot from the given config.

func (*BalanceSnapshotClient) Create

Create returns a builder for creating a BalanceSnapshot entity.

func (*BalanceSnapshotClient) CreateBulk

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

func (*BalanceSnapshotClient) Delete

Delete returns a delete builder for BalanceSnapshot.

func (*BalanceSnapshotClient) DeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*BalanceSnapshotClient) DeleteOneID

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

func (*BalanceSnapshotClient) Get

Get returns a BalanceSnapshot entity by its id.

func (*BalanceSnapshotClient) GetX

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

func (*BalanceSnapshotClient) Hooks

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

Hooks returns the client hooks.

func (*BalanceSnapshotClient) Intercept

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

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

func (*BalanceSnapshotClient) Interceptors

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

Interceptors returns the client interceptors.

func (*BalanceSnapshotClient) MapCreateBulk

func (c *BalanceSnapshotClient) MapCreateBulk(slice any, setFunc func(*BalanceSnapshotCreate, int)) *BalanceSnapshotCreateBulk

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

Query returns a query builder for BalanceSnapshot.

func (*BalanceSnapshotClient) Update

Update returns an update builder for BalanceSnapshot.

func (*BalanceSnapshotClient) UpdateOne

UpdateOne returns an update builder for the given entity.

func (*BalanceSnapshotClient) UpdateOneID

UpdateOneID returns an update builder for the given id.

func (*BalanceSnapshotClient) Use

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

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

type BalanceSnapshotCreate

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

BalanceSnapshotCreate is the builder for creating a BalanceSnapshot entity.

func (*BalanceSnapshotCreate) Exec

func (bsc *BalanceSnapshotCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*BalanceSnapshotCreate) ExecX

func (bsc *BalanceSnapshotCreate) ExecX(ctx context.Context)

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

func (*BalanceSnapshotCreate) Mutation

Mutation returns the BalanceSnapshotMutation object of the builder.

func (*BalanceSnapshotCreate) OnConflict

OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause of the `INSERT` statement. For example:

client.BalanceSnapshot.Create().
	SetNamespace(v).
	OnConflict(
		// Update the row with the new values
		// the was proposed for insertion.
		sql.ResolveWithNewValues(),
	).
	// Override some of the fields with custom
	// update values.
	Update(func(u *ent.BalanceSnapshotUpsert) {
		SetNamespace(v+v).
	}).
	Exec(ctx)

func (*BalanceSnapshotCreate) OnConflictColumns

func (bsc *BalanceSnapshotCreate) OnConflictColumns(columns ...string) *BalanceSnapshotUpsertOne

OnConflictColumns calls `OnConflict` and configures the columns as conflict target. Using this option is equivalent to using:

client.BalanceSnapshot.Create().
	OnConflict(sql.ConflictColumns(columns...)).
	Exec(ctx)

func (*BalanceSnapshotCreate) Save

Save creates the BalanceSnapshot in the database.

func (*BalanceSnapshotCreate) SaveX

SaveX calls Save and panics if Save returns an error.

func (*BalanceSnapshotCreate) SetAt

SetAt sets the "at" field.

func (*BalanceSnapshotCreate) SetBalance

SetBalance sets the "balance" field.

func (*BalanceSnapshotCreate) SetCreatedAt

func (bsc *BalanceSnapshotCreate) SetCreatedAt(t time.Time) *BalanceSnapshotCreate

SetCreatedAt sets the "created_at" field.

func (*BalanceSnapshotCreate) SetDeletedAt

func (bsc *BalanceSnapshotCreate) SetDeletedAt(t time.Time) *BalanceSnapshotCreate

SetDeletedAt sets the "deleted_at" field.

func (*BalanceSnapshotCreate) SetGrantBalances

SetGrantBalances sets the "grant_balances" field.

func (*BalanceSnapshotCreate) SetNamespace

func (bsc *BalanceSnapshotCreate) SetNamespace(s string) *BalanceSnapshotCreate

SetNamespace sets the "namespace" field.

func (*BalanceSnapshotCreate) SetNillableCreatedAt

func (bsc *BalanceSnapshotCreate) SetNillableCreatedAt(t *time.Time) *BalanceSnapshotCreate

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

func (*BalanceSnapshotCreate) SetNillableDeletedAt

func (bsc *BalanceSnapshotCreate) SetNillableDeletedAt(t *time.Time) *BalanceSnapshotCreate

SetNillableDeletedAt sets the "deleted_at" field if the given value is not nil.

func (*BalanceSnapshotCreate) SetNillableUpdatedAt

func (bsc *BalanceSnapshotCreate) SetNillableUpdatedAt(t *time.Time) *BalanceSnapshotCreate

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

func (*BalanceSnapshotCreate) SetOverage

SetOverage sets the "overage" field.

func (*BalanceSnapshotCreate) SetOwnerID

SetOwnerID sets the "owner_id" field.

func (*BalanceSnapshotCreate) SetUpdatedAt

func (bsc *BalanceSnapshotCreate) SetUpdatedAt(t time.Time) *BalanceSnapshotCreate

SetUpdatedAt sets the "updated_at" field.

type BalanceSnapshotCreateBulk

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

BalanceSnapshotCreateBulk is the builder for creating many BalanceSnapshot entities in bulk.

func (*BalanceSnapshotCreateBulk) Exec

Exec executes the query.

func (*BalanceSnapshotCreateBulk) ExecX

func (bscb *BalanceSnapshotCreateBulk) ExecX(ctx context.Context)

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

func (*BalanceSnapshotCreateBulk) OnConflict

OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause of the `INSERT` statement. For example:

client.BalanceSnapshot.CreateBulk(builders...).
	OnConflict(
		// Update the row with the new values
		// the was proposed for insertion.
		sql.ResolveWithNewValues(),
	).
	// Override some of the fields with custom
	// update values.
	Update(func(u *ent.BalanceSnapshotUpsert) {
		SetNamespace(v+v).
	}).
	Exec(ctx)

func (*BalanceSnapshotCreateBulk) OnConflictColumns

func (bscb *BalanceSnapshotCreateBulk) OnConflictColumns(columns ...string) *BalanceSnapshotUpsertBulk

OnConflictColumns calls `OnConflict` and configures the columns as conflict target. Using this option is equivalent to using:

client.BalanceSnapshot.Create().
	OnConflict(sql.ConflictColumns(columns...)).
	Exec(ctx)

func (*BalanceSnapshotCreateBulk) Save

Save creates the BalanceSnapshot entities in the database.

func (*BalanceSnapshotCreateBulk) SaveX

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

type BalanceSnapshotDelete

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

BalanceSnapshotDelete is the builder for deleting a BalanceSnapshot entity.

func (*BalanceSnapshotDelete) Exec

func (bsd *BalanceSnapshotDelete) Exec(ctx context.Context) (int, error)

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

func (*BalanceSnapshotDelete) ExecX

func (bsd *BalanceSnapshotDelete) ExecX(ctx context.Context) int

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

func (*BalanceSnapshotDelete) Where

Where appends a list predicates to the BalanceSnapshotDelete builder.

type BalanceSnapshotDeleteOne

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

BalanceSnapshotDeleteOne is the builder for deleting a single BalanceSnapshot entity.

func (*BalanceSnapshotDeleteOne) Exec

Exec executes the deletion query.

func (*BalanceSnapshotDeleteOne) ExecX

func (bsdo *BalanceSnapshotDeleteOne) ExecX(ctx context.Context)

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

func (*BalanceSnapshotDeleteOne) Where

Where appends a list predicates to the BalanceSnapshotDelete builder.

type BalanceSnapshotGroupBy

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

BalanceSnapshotGroupBy is the group-by builder for BalanceSnapshot entities.

func (*BalanceSnapshotGroupBy) Aggregate

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

func (*BalanceSnapshotGroupBy) Bool

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

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

func (*BalanceSnapshotGroupBy) BoolX

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

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

func (*BalanceSnapshotGroupBy) Bools

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

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

func (*BalanceSnapshotGroupBy) BoolsX

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

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

func (*BalanceSnapshotGroupBy) Float64

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

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

func (*BalanceSnapshotGroupBy) Float64X

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

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

func (*BalanceSnapshotGroupBy) Float64s

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

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

func (*BalanceSnapshotGroupBy) Float64sX

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

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

func (*BalanceSnapshotGroupBy) Int

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

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

func (*BalanceSnapshotGroupBy) IntX

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

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

func (*BalanceSnapshotGroupBy) Ints

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

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

func (*BalanceSnapshotGroupBy) IntsX

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

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

func (*BalanceSnapshotGroupBy) Scan

func (bsgb *BalanceSnapshotGroupBy) Scan(ctx context.Context, v any) error

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

func (*BalanceSnapshotGroupBy) ScanX

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

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

func (*BalanceSnapshotGroupBy) String

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

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

func (*BalanceSnapshotGroupBy) StringX

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

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

func (*BalanceSnapshotGroupBy) Strings

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

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

func (*BalanceSnapshotGroupBy) StringsX

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

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

type BalanceSnapshotMutation

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

BalanceSnapshotMutation represents an operation that mutates the BalanceSnapshot nodes in the graph.

func (*BalanceSnapshotMutation) AddBalance

func (m *BalanceSnapshotMutation) AddBalance(f float64)

AddBalance adds f to the "balance" field.

func (*BalanceSnapshotMutation) AddField

func (m *BalanceSnapshotMutation) 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 (*BalanceSnapshotMutation) AddOverage

func (m *BalanceSnapshotMutation) AddOverage(f float64)

AddOverage adds f to the "overage" field.

func (*BalanceSnapshotMutation) AddedBalance

func (m *BalanceSnapshotMutation) AddedBalance() (r float64, exists bool)

AddedBalance returns the value that was added to the "balance" field in this mutation.

func (*BalanceSnapshotMutation) AddedEdges

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

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

func (*BalanceSnapshotMutation) AddedField

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

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

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

func (*BalanceSnapshotMutation) AddedIDs

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

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

func (*BalanceSnapshotMutation) AddedOverage

func (m *BalanceSnapshotMutation) AddedOverage() (r float64, exists bool)

AddedOverage returns the value that was added to the "overage" field in this mutation.

func (*BalanceSnapshotMutation) At

func (m *BalanceSnapshotMutation) At() (r time.Time, exists bool)

At returns the value of the "at" field in the mutation.

func (*BalanceSnapshotMutation) Balance

func (m *BalanceSnapshotMutation) Balance() (r float64, exists bool)

Balance returns the value of the "balance" field in the mutation.

func (*BalanceSnapshotMutation) ClearDeletedAt

func (m *BalanceSnapshotMutation) ClearDeletedAt()

ClearDeletedAt clears the value of the "deleted_at" field.

func (*BalanceSnapshotMutation) ClearEdge

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

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

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

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

func (*BalanceSnapshotMutation) ClearedFields

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

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

func (BalanceSnapshotMutation) Client

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

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

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

func (*BalanceSnapshotMutation) DeletedAt

func (m *BalanceSnapshotMutation) DeletedAt() (r time.Time, exists bool)

DeletedAt returns the value of the "deleted_at" field in the mutation.

func (*BalanceSnapshotMutation) DeletedAtCleared

func (m *BalanceSnapshotMutation) DeletedAtCleared() bool

DeletedAtCleared returns if the "deleted_at" field was cleared in this mutation.

func (*BalanceSnapshotMutation) EdgeCleared

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

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

func (*BalanceSnapshotMutation) Field

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

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

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

func (*BalanceSnapshotMutation) Fields

func (m *BalanceSnapshotMutation) 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 (*BalanceSnapshotMutation) GrantBalances

func (m *BalanceSnapshotMutation) GrantBalances() (r credit.GrantBalanceMap, exists bool)

GrantBalances returns the value of the "grant_balances" field in the mutation.

func (*BalanceSnapshotMutation) ID

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

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

func (*BalanceSnapshotMutation) IDs

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

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

func (*BalanceSnapshotMutation) Namespace

func (m *BalanceSnapshotMutation) Namespace() (r string, exists bool)

Namespace returns the value of the "namespace" field in the mutation.

func (*BalanceSnapshotMutation) OldAt

func (m *BalanceSnapshotMutation) OldAt(ctx context.Context) (v time.Time, err error)

OldAt returns the old "at" field's value of the BalanceSnapshot entity. If the BalanceSnapshot 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 (*BalanceSnapshotMutation) OldBalance

func (m *BalanceSnapshotMutation) OldBalance(ctx context.Context) (v float64, err error)

OldBalance returns the old "balance" field's value of the BalanceSnapshot entity. If the BalanceSnapshot 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 (*BalanceSnapshotMutation) OldCreatedAt

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

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

func (m *BalanceSnapshotMutation) OldDeletedAt(ctx context.Context) (v *time.Time, err error)

OldDeletedAt returns the old "deleted_at" field's value of the BalanceSnapshot entity. If the BalanceSnapshot 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 (*BalanceSnapshotMutation) OldField

func (m *BalanceSnapshotMutation) 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 (*BalanceSnapshotMutation) OldGrantBalances

func (m *BalanceSnapshotMutation) OldGrantBalances(ctx context.Context) (v credit.GrantBalanceMap, err error)

OldGrantBalances returns the old "grant_balances" field's value of the BalanceSnapshot entity. If the BalanceSnapshot 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 (*BalanceSnapshotMutation) OldNamespace

func (m *BalanceSnapshotMutation) OldNamespace(ctx context.Context) (v string, err error)

OldNamespace returns the old "namespace" field's value of the BalanceSnapshot entity. If the BalanceSnapshot 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 (*BalanceSnapshotMutation) OldOverage

func (m *BalanceSnapshotMutation) OldOverage(ctx context.Context) (v float64, err error)

OldOverage returns the old "overage" field's value of the BalanceSnapshot entity. If the BalanceSnapshot 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 (*BalanceSnapshotMutation) OldOwnerID

func (m *BalanceSnapshotMutation) OldOwnerID(ctx context.Context) (v credit.GrantOwner, err error)

OldOwnerID returns the old "owner_id" field's value of the BalanceSnapshot entity. If the BalanceSnapshot 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 (*BalanceSnapshotMutation) OldUpdatedAt

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

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

func (m *BalanceSnapshotMutation) Op() Op

Op returns the operation name.

func (*BalanceSnapshotMutation) Overage

func (m *BalanceSnapshotMutation) Overage() (r float64, exists bool)

Overage returns the value of the "overage" field in the mutation.

func (*BalanceSnapshotMutation) OwnerID

func (m *BalanceSnapshotMutation) OwnerID() (r credit.GrantOwner, exists bool)

OwnerID returns the value of the "owner_id" field in the mutation.

func (*BalanceSnapshotMutation) RemovedEdges

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

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

func (*BalanceSnapshotMutation) RemovedIDs

func (m *BalanceSnapshotMutation) 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 (*BalanceSnapshotMutation) ResetAt

func (m *BalanceSnapshotMutation) ResetAt()

ResetAt resets all changes to the "at" field.

func (*BalanceSnapshotMutation) ResetBalance

func (m *BalanceSnapshotMutation) ResetBalance()

ResetBalance resets all changes to the "balance" field.

func (*BalanceSnapshotMutation) ResetCreatedAt

func (m *BalanceSnapshotMutation) ResetCreatedAt()

ResetCreatedAt resets all changes to the "created_at" field.

func (*BalanceSnapshotMutation) ResetDeletedAt

func (m *BalanceSnapshotMutation) ResetDeletedAt()

ResetDeletedAt resets all changes to the "deleted_at" field.

func (*BalanceSnapshotMutation) ResetEdge

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

func (m *BalanceSnapshotMutation) 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 (*BalanceSnapshotMutation) ResetGrantBalances

func (m *BalanceSnapshotMutation) ResetGrantBalances()

ResetGrantBalances resets all changes to the "grant_balances" field.

func (*BalanceSnapshotMutation) ResetNamespace

func (m *BalanceSnapshotMutation) ResetNamespace()

ResetNamespace resets all changes to the "namespace" field.

func (*BalanceSnapshotMutation) ResetOverage

func (m *BalanceSnapshotMutation) ResetOverage()

ResetOverage resets all changes to the "overage" field.

func (*BalanceSnapshotMutation) ResetOwnerID

func (m *BalanceSnapshotMutation) ResetOwnerID()

ResetOwnerID resets all changes to the "owner_id" field.

func (*BalanceSnapshotMutation) ResetUpdatedAt

func (m *BalanceSnapshotMutation) ResetUpdatedAt()

ResetUpdatedAt resets all changes to the "updated_at" field.

func (*BalanceSnapshotMutation) SetAt

func (m *BalanceSnapshotMutation) SetAt(t time.Time)

SetAt sets the "at" field.

func (*BalanceSnapshotMutation) SetBalance

func (m *BalanceSnapshotMutation) SetBalance(f float64)

SetBalance sets the "balance" field.

func (*BalanceSnapshotMutation) SetCreatedAt

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

SetCreatedAt sets the "created_at" field.

func (*BalanceSnapshotMutation) SetDeletedAt

func (m *BalanceSnapshotMutation) SetDeletedAt(t time.Time)

SetDeletedAt sets the "deleted_at" field.

func (*BalanceSnapshotMutation) SetField

func (m *BalanceSnapshotMutation) 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 (*BalanceSnapshotMutation) SetGrantBalances

func (m *BalanceSnapshotMutation) SetGrantBalances(cbm credit.GrantBalanceMap)

SetGrantBalances sets the "grant_balances" field.

func (*BalanceSnapshotMutation) SetNamespace

func (m *BalanceSnapshotMutation) SetNamespace(s string)

SetNamespace sets the "namespace" field.

func (*BalanceSnapshotMutation) SetOp

func (m *BalanceSnapshotMutation) SetOp(op Op)

SetOp allows setting the mutation operation.

func (*BalanceSnapshotMutation) SetOverage

func (m *BalanceSnapshotMutation) SetOverage(f float64)

SetOverage sets the "overage" field.

func (*BalanceSnapshotMutation) SetOwnerID

func (m *BalanceSnapshotMutation) SetOwnerID(co credit.GrantOwner)

SetOwnerID sets the "owner_id" field.

func (*BalanceSnapshotMutation) SetUpdatedAt

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

SetUpdatedAt sets the "updated_at" field.

func (BalanceSnapshotMutation) Tx

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

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

func (*BalanceSnapshotMutation) Type

func (m *BalanceSnapshotMutation) Type() string

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

func (*BalanceSnapshotMutation) UpdatedAt

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

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

func (*BalanceSnapshotMutation) Where

Where appends a list predicates to the BalanceSnapshotMutation builder.

func (*BalanceSnapshotMutation) WhereP

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

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

type BalanceSnapshotQuery

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

BalanceSnapshotQuery is the builder for querying BalanceSnapshot entities.

func (*BalanceSnapshotQuery) Aggregate

Aggregate returns a BalanceSnapshotSelect configured with the given aggregations.

func (*BalanceSnapshotQuery) All

All executes the query and returns a list of BalanceSnapshots.

func (*BalanceSnapshotQuery) AllX

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

func (*BalanceSnapshotQuery) Clone

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

func (*BalanceSnapshotQuery) Count

func (bsq *BalanceSnapshotQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*BalanceSnapshotQuery) CountX

func (bsq *BalanceSnapshotQuery) CountX(ctx context.Context) int

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

func (*BalanceSnapshotQuery) Exist

func (bsq *BalanceSnapshotQuery) Exist(ctx context.Context) (bool, error)

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

func (*BalanceSnapshotQuery) ExistX

func (bsq *BalanceSnapshotQuery) ExistX(ctx context.Context) bool

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

func (*BalanceSnapshotQuery) First

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

func (*BalanceSnapshotQuery) FirstID

func (bsq *BalanceSnapshotQuery) FirstID(ctx context.Context) (id int, err error)

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

func (*BalanceSnapshotQuery) FirstIDX

func (bsq *BalanceSnapshotQuery) FirstIDX(ctx context.Context) int

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

func (*BalanceSnapshotQuery) FirstX

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

func (*BalanceSnapshotQuery) ForShare

func (bsq *BalanceSnapshotQuery) ForShare(opts ...sql.LockOption) *BalanceSnapshotQuery

ForShare behaves similarly to ForUpdate, except that it acquires a shared mode lock on any rows that are read. Other sessions can read the rows, but cannot modify them until your transaction commits.

func (*BalanceSnapshotQuery) ForUpdate

func (bsq *BalanceSnapshotQuery) ForUpdate(opts ...sql.LockOption) *BalanceSnapshotQuery

ForUpdate locks the selected rows against concurrent updates, and prevent them from being updated, deleted or "selected ... for update" by other sessions, until the transaction is either committed or rolled-back.

func (*BalanceSnapshotQuery) GroupBy

func (bsq *BalanceSnapshotQuery) GroupBy(field string, fields ...string) *BalanceSnapshotGroupBy

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 {
	Namespace string `json:"namespace,omitempty"`
	Count int `json:"count,omitempty"`
}

client.BalanceSnapshot.Query().
	GroupBy(balancesnapshot.FieldNamespace).
	Aggregate(db.Count()).
	Scan(ctx, &v)

func (*BalanceSnapshotQuery) IDs

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

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

func (*BalanceSnapshotQuery) IDsX

func (bsq *BalanceSnapshotQuery) IDsX(ctx context.Context) []int

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

func (*BalanceSnapshotQuery) Limit

func (bsq *BalanceSnapshotQuery) Limit(limit int) *BalanceSnapshotQuery

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

func (*BalanceSnapshotQuery) Offset

func (bsq *BalanceSnapshotQuery) Offset(offset int) *BalanceSnapshotQuery

Offset to start from.

func (*BalanceSnapshotQuery) Only

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

func (*BalanceSnapshotQuery) OnlyID

func (bsq *BalanceSnapshotQuery) OnlyID(ctx context.Context) (id int, err error)

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

func (*BalanceSnapshotQuery) OnlyIDX

func (bsq *BalanceSnapshotQuery) OnlyIDX(ctx context.Context) int

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

func (*BalanceSnapshotQuery) OnlyX

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

func (*BalanceSnapshotQuery) Order

Order specifies how the records should be ordered.

func (*BalanceSnapshotQuery) Select

func (bsq *BalanceSnapshotQuery) Select(fields ...string) *BalanceSnapshotSelect

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 {
	Namespace string `json:"namespace,omitempty"`
}

client.BalanceSnapshot.Query().
	Select(balancesnapshot.FieldNamespace).
	Scan(ctx, &v)

func (*BalanceSnapshotQuery) Unique

func (bsq *BalanceSnapshotQuery) Unique(unique bool) *BalanceSnapshotQuery

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

Where adds a new predicate for the BalanceSnapshotQuery builder.

type BalanceSnapshotSelect

type BalanceSnapshotSelect struct {
	*BalanceSnapshotQuery
	// contains filtered or unexported fields
}

BalanceSnapshotSelect is the builder for selecting fields of BalanceSnapshot entities.

func (*BalanceSnapshotSelect) Aggregate

Aggregate adds the given aggregation functions to the selector query.

func (*BalanceSnapshotSelect) Bool

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

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

func (*BalanceSnapshotSelect) BoolX

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

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

func (*BalanceSnapshotSelect) Bools

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

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

func (*BalanceSnapshotSelect) BoolsX

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

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

func (*BalanceSnapshotSelect) Float64

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

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

func (*BalanceSnapshotSelect) Float64X

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

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

func (*BalanceSnapshotSelect) Float64s

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

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

func (*BalanceSnapshotSelect) Float64sX

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

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

func (*BalanceSnapshotSelect) Int

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

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

func (*BalanceSnapshotSelect) IntX

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

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

func (*BalanceSnapshotSelect) Ints

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

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

func (*BalanceSnapshotSelect) IntsX

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

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

func (*BalanceSnapshotSelect) Scan

func (bss *BalanceSnapshotSelect) Scan(ctx context.Context, v any) error

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

func (*BalanceSnapshotSelect) ScanX

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

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

func (*BalanceSnapshotSelect) String

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

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

func (*BalanceSnapshotSelect) StringX

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

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

func (*BalanceSnapshotSelect) Strings

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

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

func (*BalanceSnapshotSelect) StringsX

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

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

type BalanceSnapshotUpdate

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

BalanceSnapshotUpdate is the builder for updating BalanceSnapshot entities.

func (*BalanceSnapshotUpdate) ClearDeletedAt

func (bsu *BalanceSnapshotUpdate) ClearDeletedAt() *BalanceSnapshotUpdate

ClearDeletedAt clears the value of the "deleted_at" field.

func (*BalanceSnapshotUpdate) Exec

func (bsu *BalanceSnapshotUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*BalanceSnapshotUpdate) ExecX

func (bsu *BalanceSnapshotUpdate) ExecX(ctx context.Context)

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

func (*BalanceSnapshotUpdate) Mutation

Mutation returns the BalanceSnapshotMutation object of the builder.

func (*BalanceSnapshotUpdate) Save

func (bsu *BalanceSnapshotUpdate) Save(ctx context.Context) (int, error)

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

func (*BalanceSnapshotUpdate) SaveX

func (bsu *BalanceSnapshotUpdate) SaveX(ctx context.Context) int

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

func (*BalanceSnapshotUpdate) SetDeletedAt

func (bsu *BalanceSnapshotUpdate) SetDeletedAt(t time.Time) *BalanceSnapshotUpdate

SetDeletedAt sets the "deleted_at" field.

func (*BalanceSnapshotUpdate) SetNillableDeletedAt

func (bsu *BalanceSnapshotUpdate) SetNillableDeletedAt(t *time.Time) *BalanceSnapshotUpdate

SetNillableDeletedAt sets the "deleted_at" field if the given value is not nil.

func (*BalanceSnapshotUpdate) SetUpdatedAt

func (bsu *BalanceSnapshotUpdate) SetUpdatedAt(t time.Time) *BalanceSnapshotUpdate

SetUpdatedAt sets the "updated_at" field.

func (*BalanceSnapshotUpdate) Where

Where appends a list predicates to the BalanceSnapshotUpdate builder.

type BalanceSnapshotUpdateOne

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

BalanceSnapshotUpdateOne is the builder for updating a single BalanceSnapshot entity.

func (*BalanceSnapshotUpdateOne) ClearDeletedAt

func (bsuo *BalanceSnapshotUpdateOne) ClearDeletedAt() *BalanceSnapshotUpdateOne

ClearDeletedAt clears the value of the "deleted_at" field.

func (*BalanceSnapshotUpdateOne) Exec

Exec executes the query on the entity.

func (*BalanceSnapshotUpdateOne) ExecX

func (bsuo *BalanceSnapshotUpdateOne) ExecX(ctx context.Context)

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

func (*BalanceSnapshotUpdateOne) Mutation

Mutation returns the BalanceSnapshotMutation object of the builder.

func (*BalanceSnapshotUpdateOne) Save

Save executes the query and returns the updated BalanceSnapshot entity.

func (*BalanceSnapshotUpdateOne) SaveX

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

func (*BalanceSnapshotUpdateOne) Select

func (bsuo *BalanceSnapshotUpdateOne) Select(field string, fields ...string) *BalanceSnapshotUpdateOne

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

func (*BalanceSnapshotUpdateOne) SetDeletedAt

SetDeletedAt sets the "deleted_at" field.

func (*BalanceSnapshotUpdateOne) SetNillableDeletedAt

func (bsuo *BalanceSnapshotUpdateOne) SetNillableDeletedAt(t *time.Time) *BalanceSnapshotUpdateOne

SetNillableDeletedAt sets the "deleted_at" field if the given value is not nil.

func (*BalanceSnapshotUpdateOne) SetUpdatedAt

SetUpdatedAt sets the "updated_at" field.

func (*BalanceSnapshotUpdateOne) Where

Where appends a list predicates to the BalanceSnapshotUpdate builder.

type BalanceSnapshotUpsert

type BalanceSnapshotUpsert struct {
	*sql.UpdateSet
}

BalanceSnapshotUpsert is the "OnConflict" setter.

func (*BalanceSnapshotUpsert) ClearDeletedAt

func (u *BalanceSnapshotUpsert) ClearDeletedAt() *BalanceSnapshotUpsert

ClearDeletedAt clears the value of the "deleted_at" field.

func (*BalanceSnapshotUpsert) SetDeletedAt

SetDeletedAt sets the "deleted_at" field.

func (*BalanceSnapshotUpsert) SetUpdatedAt

SetUpdatedAt sets the "updated_at" field.

func (*BalanceSnapshotUpsert) UpdateDeletedAt

func (u *BalanceSnapshotUpsert) UpdateDeletedAt() *BalanceSnapshotUpsert

UpdateDeletedAt sets the "deleted_at" field to the value that was provided on create.

func (*BalanceSnapshotUpsert) UpdateUpdatedAt

func (u *BalanceSnapshotUpsert) UpdateUpdatedAt() *BalanceSnapshotUpsert

UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create.

type BalanceSnapshotUpsertBulk

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

BalanceSnapshotUpsertBulk is the builder for "upsert"-ing a bulk of BalanceSnapshot nodes.

func (*BalanceSnapshotUpsertBulk) ClearDeletedAt

ClearDeletedAt clears the value of the "deleted_at" field.

func (*BalanceSnapshotUpsertBulk) DoNothing

DoNothing configures the conflict_action to `DO NOTHING`. Supported only by SQLite and PostgreSQL.

func (*BalanceSnapshotUpsertBulk) Exec

Exec executes the query.

func (*BalanceSnapshotUpsertBulk) ExecX

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

func (*BalanceSnapshotUpsertBulk) Ignore

Ignore sets each column to itself in case of conflict. Using this option is equivalent to using:

client.BalanceSnapshot.Create().
	OnConflict(sql.ResolveWithIgnore()).
	Exec(ctx)

func (*BalanceSnapshotUpsertBulk) SetDeletedAt

SetDeletedAt sets the "deleted_at" field.

func (*BalanceSnapshotUpsertBulk) SetUpdatedAt

SetUpdatedAt sets the "updated_at" field.

func (*BalanceSnapshotUpsertBulk) Update

Update allows overriding fields `UPDATE` values. See the BalanceSnapshotCreateBulk.OnConflict documentation for more info.

func (*BalanceSnapshotUpsertBulk) UpdateDeletedAt

UpdateDeletedAt sets the "deleted_at" field to the value that was provided on create.

func (*BalanceSnapshotUpsertBulk) UpdateNewValues

UpdateNewValues updates the mutable fields using the new values that were set on create. Using this option is equivalent to using:

client.BalanceSnapshot.Create().
	OnConflict(
		sql.ResolveWithNewValues(),
	).
	Exec(ctx)

func (*BalanceSnapshotUpsertBulk) UpdateUpdatedAt

UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create.

type BalanceSnapshotUpsertOne

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

BalanceSnapshotUpsertOne is the builder for "upsert"-ing

one BalanceSnapshot node.

func (*BalanceSnapshotUpsertOne) ClearDeletedAt

ClearDeletedAt clears the value of the "deleted_at" field.

func (*BalanceSnapshotUpsertOne) DoNothing

DoNothing configures the conflict_action to `DO NOTHING`. Supported only by SQLite and PostgreSQL.

func (*BalanceSnapshotUpsertOne) Exec

Exec executes the query.

func (*BalanceSnapshotUpsertOne) ExecX

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

func (*BalanceSnapshotUpsertOne) ID

func (u *BalanceSnapshotUpsertOne) ID(ctx context.Context) (id int, err error)

Exec executes the UPSERT query and returns the inserted/updated ID.

func (*BalanceSnapshotUpsertOne) IDX

IDX is like ID, but panics if an error occurs.

func (*BalanceSnapshotUpsertOne) Ignore

Ignore sets each column to itself in case of conflict. Using this option is equivalent to using:

client.BalanceSnapshot.Create().
    OnConflict(sql.ResolveWithIgnore()).
    Exec(ctx)

func (*BalanceSnapshotUpsertOne) SetDeletedAt

SetDeletedAt sets the "deleted_at" field.

func (*BalanceSnapshotUpsertOne) SetUpdatedAt

SetUpdatedAt sets the "updated_at" field.

func (*BalanceSnapshotUpsertOne) Update

Update allows overriding fields `UPDATE` values. See the BalanceSnapshotCreate.OnConflict documentation for more info.

func (*BalanceSnapshotUpsertOne) UpdateDeletedAt

func (u *BalanceSnapshotUpsertOne) UpdateDeletedAt() *BalanceSnapshotUpsertOne

UpdateDeletedAt sets the "deleted_at" field to the value that was provided on create.

func (*BalanceSnapshotUpsertOne) UpdateNewValues

func (u *BalanceSnapshotUpsertOne) UpdateNewValues() *BalanceSnapshotUpsertOne

UpdateNewValues updates the mutable fields using the new values that were set on create. Using this option is equivalent to using:

client.BalanceSnapshot.Create().
	OnConflict(
		sql.ResolveWithNewValues(),
	).
	Exec(ctx)

func (*BalanceSnapshotUpsertOne) UpdateUpdatedAt

func (u *BalanceSnapshotUpsertOne) UpdateUpdatedAt() *BalanceSnapshotUpsertOne

UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create.

type BalanceSnapshots

type BalanceSnapshots []*BalanceSnapshot

BalanceSnapshots is a parsable slice of BalanceSnapshot.

type Client

type Client struct {

	// Schema is the client for creating, migrating and dropping schema.
	Schema *migrate.Schema
	// BalanceSnapshot is the client for interacting with the BalanceSnapshot builders.
	BalanceSnapshot *BalanceSnapshotClient
	// Grant is the client for interacting with the Grant builders.
	Grant *GrantClient
	// 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().
	BalanceSnapshot.
	Query().
	Count(ctx)

func (*Client) GetConfig

func (c *Client) GetConfig() *entutils.RawEntConfig

func (*Client) HijackTx

HijackTx returns a new transaction driver with the provided options. The returned transaction can later be used to instanciate new clients.

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 ExposedTxDriver

type ExposedTxDriver struct {
	Driver *txDriver
}

func (*ExposedTxDriver) Commit

func (d *ExposedTxDriver) Commit() error

ignores hooks

func (*ExposedTxDriver) Rollback

func (d *ExposedTxDriver) Rollback() error

ignores hooks

type Grant

type Grant struct {

	// ID of the ent.
	ID string `json:"id,omitempty"`
	// Namespace holds the value of the "namespace" field.
	Namespace string `json:"namespace,omitempty"`
	// Metadata holds the value of the "metadata" field.
	Metadata map[string]string `json:"metadata,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"`
	// DeletedAt holds the value of the "deleted_at" field.
	DeletedAt *time.Time `json:"deleted_at,omitempty"`
	// OwnerID holds the value of the "owner_id" field.
	OwnerID credit.GrantOwner `json:"owner_id,omitempty"`
	// Amount holds the value of the "amount" field.
	Amount float64 `json:"amount,omitempty"`
	// Priority holds the value of the "priority" field.
	Priority uint8 `json:"priority,omitempty"`
	// EffectiveAt holds the value of the "effective_at" field.
	EffectiveAt time.Time `json:"effective_at,omitempty"`
	// Expiration holds the value of the "expiration" field.
	Expiration credit.ExpirationPeriod `json:"expiration,omitempty"`
	// ExpiresAt holds the value of the "expires_at" field.
	ExpiresAt time.Time `json:"expires_at,omitempty"`
	// VoidedAt holds the value of the "voided_at" field.
	VoidedAt *time.Time `json:"voided_at,omitempty"`
	// ResetMaxRollover holds the value of the "reset_max_rollover" field.
	ResetMaxRollover float64 `json:"reset_max_rollover,omitempty"`
	// ResetMinRollover holds the value of the "reset_min_rollover" field.
	ResetMinRollover float64 `json:"reset_min_rollover,omitempty"`
	// RecurrencePeriod holds the value of the "recurrence_period" field.
	RecurrencePeriod *recurrence.RecurrenceInterval `json:"recurrence_period,omitempty"`
	// RecurrenceAnchor holds the value of the "recurrence_anchor" field.
	RecurrenceAnchor *time.Time `json:"recurrence_anchor,omitempty"`
	// contains filtered or unexported fields
}

Grant is the model entity for the Grant schema.

func (*Grant) String

func (gr *Grant) String() string

String implements the fmt.Stringer.

func (*Grant) Unwrap

func (gr *Grant) Unwrap() *Grant

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

func (gr *Grant) Update() *GrantUpdateOne

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

func (*Grant) Value

func (gr *Grant) Value(name string) (ent.Value, error)

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

type GrantClient

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

GrantClient is a client for the Grant schema.

func NewGrantClient

func NewGrantClient(c config) *GrantClient

NewGrantClient returns a client for the Grant from the given config.

func (*GrantClient) Create

func (c *GrantClient) Create() *GrantCreate

Create returns a builder for creating a Grant entity.

func (*GrantClient) CreateBulk

func (c *GrantClient) CreateBulk(builders ...*GrantCreate) *GrantCreateBulk

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

func (*GrantClient) Delete

func (c *GrantClient) Delete() *GrantDelete

Delete returns a delete builder for Grant.

func (*GrantClient) DeleteOne

func (c *GrantClient) DeleteOne(gr *Grant) *GrantDeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*GrantClient) DeleteOneID

func (c *GrantClient) DeleteOneID(id string) *GrantDeleteOne

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

func (*GrantClient) Get

func (c *GrantClient) Get(ctx context.Context, id string) (*Grant, error)

Get returns a Grant entity by its id.

func (*GrantClient) GetX

func (c *GrantClient) GetX(ctx context.Context, id string) *Grant

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

func (*GrantClient) Hooks

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

Hooks returns the client hooks.

func (*GrantClient) Intercept

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

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

func (*GrantClient) Interceptors

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

Interceptors returns the client interceptors.

func (*GrantClient) MapCreateBulk

func (c *GrantClient) MapCreateBulk(slice any, setFunc func(*GrantCreate, int)) *GrantCreateBulk

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

func (c *GrantClient) Query() *GrantQuery

Query returns a query builder for Grant.

func (*GrantClient) Update

func (c *GrantClient) Update() *GrantUpdate

Update returns an update builder for Grant.

func (*GrantClient) UpdateOne

func (c *GrantClient) UpdateOne(gr *Grant) *GrantUpdateOne

UpdateOne returns an update builder for the given entity.

func (*GrantClient) UpdateOneID

func (c *GrantClient) UpdateOneID(id string) *GrantUpdateOne

UpdateOneID returns an update builder for the given id.

func (*GrantClient) Use

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

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

type GrantCreate

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

GrantCreate is the builder for creating a Grant entity.

func (*GrantCreate) Exec

func (gc *GrantCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*GrantCreate) ExecX

func (gc *GrantCreate) ExecX(ctx context.Context)

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

func (*GrantCreate) Mutation

func (gc *GrantCreate) Mutation() *GrantMutation

Mutation returns the GrantMutation object of the builder.

func (*GrantCreate) OnConflict

func (gc *GrantCreate) OnConflict(opts ...sql.ConflictOption) *GrantUpsertOne

OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause of the `INSERT` statement. For example:

client.Grant.Create().
	SetNamespace(v).
	OnConflict(
		// Update the row with the new values
		// the was proposed for insertion.
		sql.ResolveWithNewValues(),
	).
	// Override some of the fields with custom
	// update values.
	Update(func(u *ent.GrantUpsert) {
		SetNamespace(v+v).
	}).
	Exec(ctx)

func (*GrantCreate) OnConflictColumns

func (gc *GrantCreate) OnConflictColumns(columns ...string) *GrantUpsertOne

OnConflictColumns calls `OnConflict` and configures the columns as conflict target. Using this option is equivalent to using:

client.Grant.Create().
	OnConflict(sql.ConflictColumns(columns...)).
	Exec(ctx)

func (*GrantCreate) Save

func (gc *GrantCreate) Save(ctx context.Context) (*Grant, error)

Save creates the Grant in the database.

func (*GrantCreate) SaveX

func (gc *GrantCreate) SaveX(ctx context.Context) *Grant

SaveX calls Save and panics if Save returns an error.

func (*GrantCreate) SetAmount

func (gc *GrantCreate) SetAmount(f float64) *GrantCreate

SetAmount sets the "amount" field.

func (*GrantCreate) SetCreatedAt

func (gc *GrantCreate) SetCreatedAt(t time.Time) *GrantCreate

SetCreatedAt sets the "created_at" field.

func (*GrantCreate) SetDeletedAt

func (gc *GrantCreate) SetDeletedAt(t time.Time) *GrantCreate

SetDeletedAt sets the "deleted_at" field.

func (*GrantCreate) SetEffectiveAt

func (gc *GrantCreate) SetEffectiveAt(t time.Time) *GrantCreate

SetEffectiveAt sets the "effective_at" field.

func (*GrantCreate) SetExpiration

func (gc *GrantCreate) SetExpiration(cp credit.ExpirationPeriod) *GrantCreate

SetExpiration sets the "expiration" field.

func (*GrantCreate) SetExpiresAt

func (gc *GrantCreate) SetExpiresAt(t time.Time) *GrantCreate

SetExpiresAt sets the "expires_at" field.

func (*GrantCreate) SetID

func (gc *GrantCreate) SetID(s string) *GrantCreate

SetID sets the "id" field.

func (*GrantCreate) SetMetadata

func (gc *GrantCreate) SetMetadata(m map[string]string) *GrantCreate

SetMetadata sets the "metadata" field.

func (*GrantCreate) SetNamespace

func (gc *GrantCreate) SetNamespace(s string) *GrantCreate

SetNamespace sets the "namespace" field.

func (*GrantCreate) SetNillableCreatedAt

func (gc *GrantCreate) SetNillableCreatedAt(t *time.Time) *GrantCreate

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

func (*GrantCreate) SetNillableDeletedAt

func (gc *GrantCreate) SetNillableDeletedAt(t *time.Time) *GrantCreate

SetNillableDeletedAt sets the "deleted_at" field if the given value is not nil.

func (*GrantCreate) SetNillableID

func (gc *GrantCreate) SetNillableID(s *string) *GrantCreate

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

func (*GrantCreate) SetNillablePriority

func (gc *GrantCreate) SetNillablePriority(u *uint8) *GrantCreate

SetNillablePriority sets the "priority" field if the given value is not nil.

func (*GrantCreate) SetNillableRecurrenceAnchor

func (gc *GrantCreate) SetNillableRecurrenceAnchor(t *time.Time) *GrantCreate

SetNillableRecurrenceAnchor sets the "recurrence_anchor" field if the given value is not nil.

func (*GrantCreate) SetNillableRecurrencePeriod

func (gc *GrantCreate) SetNillableRecurrencePeriod(ri *recurrence.RecurrenceInterval) *GrantCreate

SetNillableRecurrencePeriod sets the "recurrence_period" field if the given value is not nil.

func (*GrantCreate) SetNillableUpdatedAt

func (gc *GrantCreate) SetNillableUpdatedAt(t *time.Time) *GrantCreate

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

func (*GrantCreate) SetNillableVoidedAt

func (gc *GrantCreate) SetNillableVoidedAt(t *time.Time) *GrantCreate

SetNillableVoidedAt sets the "voided_at" field if the given value is not nil.

func (*GrantCreate) SetOwnerID

func (gc *GrantCreate) SetOwnerID(co credit.GrantOwner) *GrantCreate

SetOwnerID sets the "owner_id" field.

func (*GrantCreate) SetPriority

func (gc *GrantCreate) SetPriority(u uint8) *GrantCreate

SetPriority sets the "priority" field.

func (*GrantCreate) SetRecurrenceAnchor

func (gc *GrantCreate) SetRecurrenceAnchor(t time.Time) *GrantCreate

SetRecurrenceAnchor sets the "recurrence_anchor" field.

func (*GrantCreate) SetRecurrencePeriod

func (gc *GrantCreate) SetRecurrencePeriod(ri recurrence.RecurrenceInterval) *GrantCreate

SetRecurrencePeriod sets the "recurrence_period" field.

func (*GrantCreate) SetResetMaxRollover

func (gc *GrantCreate) SetResetMaxRollover(f float64) *GrantCreate

SetResetMaxRollover sets the "reset_max_rollover" field.

func (*GrantCreate) SetResetMinRollover

func (gc *GrantCreate) SetResetMinRollover(f float64) *GrantCreate

SetResetMinRollover sets the "reset_min_rollover" field.

func (*GrantCreate) SetUpdatedAt

func (gc *GrantCreate) SetUpdatedAt(t time.Time) *GrantCreate

SetUpdatedAt sets the "updated_at" field.

func (*GrantCreate) SetVoidedAt

func (gc *GrantCreate) SetVoidedAt(t time.Time) *GrantCreate

SetVoidedAt sets the "voided_at" field.

type GrantCreateBulk

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

GrantCreateBulk is the builder for creating many Grant entities in bulk.

func (*GrantCreateBulk) Exec

func (gcb *GrantCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*GrantCreateBulk) ExecX

func (gcb *GrantCreateBulk) ExecX(ctx context.Context)

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

func (*GrantCreateBulk) OnConflict

func (gcb *GrantCreateBulk) OnConflict(opts ...sql.ConflictOption) *GrantUpsertBulk

OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause of the `INSERT` statement. For example:

client.Grant.CreateBulk(builders...).
	OnConflict(
		// Update the row with the new values
		// the was proposed for insertion.
		sql.ResolveWithNewValues(),
	).
	// Override some of the fields with custom
	// update values.
	Update(func(u *ent.GrantUpsert) {
		SetNamespace(v+v).
	}).
	Exec(ctx)

func (*GrantCreateBulk) OnConflictColumns

func (gcb *GrantCreateBulk) OnConflictColumns(columns ...string) *GrantUpsertBulk

OnConflictColumns calls `OnConflict` and configures the columns as conflict target. Using this option is equivalent to using:

client.Grant.Create().
	OnConflict(sql.ConflictColumns(columns...)).
	Exec(ctx)

func (*GrantCreateBulk) Save

func (gcb *GrantCreateBulk) Save(ctx context.Context) ([]*Grant, error)

Save creates the Grant entities in the database.

func (*GrantCreateBulk) SaveX

func (gcb *GrantCreateBulk) SaveX(ctx context.Context) []*Grant

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

type GrantDelete

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

GrantDelete is the builder for deleting a Grant entity.

func (*GrantDelete) Exec

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

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

func (*GrantDelete) ExecX

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

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

func (*GrantDelete) Where

func (gd *GrantDelete) Where(ps ...predicate.Grant) *GrantDelete

Where appends a list predicates to the GrantDelete builder.

type GrantDeleteOne

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

GrantDeleteOne is the builder for deleting a single Grant entity.

func (*GrantDeleteOne) Exec

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

Exec executes the deletion query.

func (*GrantDeleteOne) ExecX

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

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

func (*GrantDeleteOne) Where

func (gdo *GrantDeleteOne) Where(ps ...predicate.Grant) *GrantDeleteOne

Where appends a list predicates to the GrantDelete builder.

type GrantGroupBy

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

GrantGroupBy is the group-by builder for Grant entities.

func (*GrantGroupBy) Aggregate

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

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

func (*GrantGroupBy) Bool

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

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

func (*GrantGroupBy) BoolX

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

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

func (*GrantGroupBy) Bools

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

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

func (*GrantGroupBy) BoolsX

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

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

func (*GrantGroupBy) Float64

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

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

func (*GrantGroupBy) Float64X

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

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

func (*GrantGroupBy) Float64s

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

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

func (*GrantGroupBy) Float64sX

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

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

func (*GrantGroupBy) Int

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

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

func (*GrantGroupBy) IntX

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

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

func (*GrantGroupBy) Ints

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

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

func (*GrantGroupBy) IntsX

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

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

func (*GrantGroupBy) Scan

func (ggb *GrantGroupBy) Scan(ctx context.Context, v any) error

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

func (*GrantGroupBy) ScanX

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

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

func (*GrantGroupBy) String

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

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

func (*GrantGroupBy) StringX

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

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

func (*GrantGroupBy) Strings

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

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

func (*GrantGroupBy) StringsX

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

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

type GrantMutation

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

GrantMutation represents an operation that mutates the Grant nodes in the graph.

func (*GrantMutation) AddAmount

func (m *GrantMutation) AddAmount(f float64)

AddAmount adds f to the "amount" field.

func (*GrantMutation) AddField

func (m *GrantMutation) 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 (*GrantMutation) AddPriority

func (m *GrantMutation) AddPriority(u int8)

AddPriority adds u to the "priority" field.

func (*GrantMutation) AddResetMaxRollover

func (m *GrantMutation) AddResetMaxRollover(f float64)

AddResetMaxRollover adds f to the "reset_max_rollover" field.

func (*GrantMutation) AddResetMinRollover

func (m *GrantMutation) AddResetMinRollover(f float64)

AddResetMinRollover adds f to the "reset_min_rollover" field.

func (*GrantMutation) AddedAmount

func (m *GrantMutation) AddedAmount() (r float64, exists bool)

AddedAmount returns the value that was added to the "amount" field in this mutation.

func (*GrantMutation) AddedEdges

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

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

func (*GrantMutation) AddedField

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

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

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

func (*GrantMutation) AddedIDs

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

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

func (*GrantMutation) AddedPriority

func (m *GrantMutation) AddedPriority() (r int8, exists bool)

AddedPriority returns the value that was added to the "priority" field in this mutation.

func (*GrantMutation) AddedResetMaxRollover

func (m *GrantMutation) AddedResetMaxRollover() (r float64, exists bool)

AddedResetMaxRollover returns the value that was added to the "reset_max_rollover" field in this mutation.

func (*GrantMutation) AddedResetMinRollover

func (m *GrantMutation) AddedResetMinRollover() (r float64, exists bool)

AddedResetMinRollover returns the value that was added to the "reset_min_rollover" field in this mutation.

func (*GrantMutation) Amount

func (m *GrantMutation) Amount() (r float64, exists bool)

Amount returns the value of the "amount" field in the mutation.

func (*GrantMutation) ClearDeletedAt

func (m *GrantMutation) ClearDeletedAt()

ClearDeletedAt clears the value of the "deleted_at" field.

func (*GrantMutation) ClearEdge

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

func (m *GrantMutation) 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 (*GrantMutation) ClearMetadata

func (m *GrantMutation) ClearMetadata()

ClearMetadata clears the value of the "metadata" field.

func (*GrantMutation) ClearRecurrenceAnchor

func (m *GrantMutation) ClearRecurrenceAnchor()

ClearRecurrenceAnchor clears the value of the "recurrence_anchor" field.

func (*GrantMutation) ClearRecurrencePeriod

func (m *GrantMutation) ClearRecurrencePeriod()

ClearRecurrencePeriod clears the value of the "recurrence_period" field.

func (*GrantMutation) ClearVoidedAt

func (m *GrantMutation) ClearVoidedAt()

ClearVoidedAt clears the value of the "voided_at" field.

func (*GrantMutation) ClearedEdges

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

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

func (*GrantMutation) ClearedFields

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

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

func (GrantMutation) Client

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

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

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

func (*GrantMutation) DeletedAt

func (m *GrantMutation) DeletedAt() (r time.Time, exists bool)

DeletedAt returns the value of the "deleted_at" field in the mutation.

func (*GrantMutation) DeletedAtCleared

func (m *GrantMutation) DeletedAtCleared() bool

DeletedAtCleared returns if the "deleted_at" field was cleared in this mutation.

func (*GrantMutation) EdgeCleared

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

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

func (*GrantMutation) EffectiveAt

func (m *GrantMutation) EffectiveAt() (r time.Time, exists bool)

EffectiveAt returns the value of the "effective_at" field in the mutation.

func (*GrantMutation) Expiration

func (m *GrantMutation) Expiration() (r credit.ExpirationPeriod, exists bool)

Expiration returns the value of the "expiration" field in the mutation.

func (*GrantMutation) ExpiresAt

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

ExpiresAt returns the value of the "expires_at" field in the mutation.

func (*GrantMutation) Field

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

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

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

func (*GrantMutation) Fields

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

func (m *GrantMutation) ID() (id string, 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 (*GrantMutation) IDs

func (m *GrantMutation) IDs(ctx context.Context) ([]string, 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 (*GrantMutation) Metadata

func (m *GrantMutation) Metadata() (r map[string]string, exists bool)

Metadata returns the value of the "metadata" field in the mutation.

func (*GrantMutation) MetadataCleared

func (m *GrantMutation) MetadataCleared() bool

MetadataCleared returns if the "metadata" field was cleared in this mutation.

func (*GrantMutation) Namespace

func (m *GrantMutation) Namespace() (r string, exists bool)

Namespace returns the value of the "namespace" field in the mutation.

func (*GrantMutation) OldAmount

func (m *GrantMutation) OldAmount(ctx context.Context) (v float64, err error)

OldAmount returns the old "amount" field's value of the Grant entity. If the Grant 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 (*GrantMutation) OldCreatedAt

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

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

func (m *GrantMutation) OldDeletedAt(ctx context.Context) (v *time.Time, err error)

OldDeletedAt returns the old "deleted_at" field's value of the Grant entity. If the Grant 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 (*GrantMutation) OldEffectiveAt

func (m *GrantMutation) OldEffectiveAt(ctx context.Context) (v time.Time, err error)

OldEffectiveAt returns the old "effective_at" field's value of the Grant entity. If the Grant 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 (*GrantMutation) OldExpiration

func (m *GrantMutation) OldExpiration(ctx context.Context) (v credit.ExpirationPeriod, err error)

OldExpiration returns the old "expiration" field's value of the Grant entity. If the Grant 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 (*GrantMutation) OldExpiresAt

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

OldExpiresAt returns the old "expires_at" field's value of the Grant entity. If the Grant 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 (*GrantMutation) OldField

func (m *GrantMutation) 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 (*GrantMutation) OldMetadata

func (m *GrantMutation) OldMetadata(ctx context.Context) (v map[string]string, err error)

OldMetadata returns the old "metadata" field's value of the Grant entity. If the Grant 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 (*GrantMutation) OldNamespace

func (m *GrantMutation) OldNamespace(ctx context.Context) (v string, err error)

OldNamespace returns the old "namespace" field's value of the Grant entity. If the Grant 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 (*GrantMutation) OldOwnerID

func (m *GrantMutation) OldOwnerID(ctx context.Context) (v credit.GrantOwner, err error)

OldOwnerID returns the old "owner_id" field's value of the Grant entity. If the Grant 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 (*GrantMutation) OldPriority

func (m *GrantMutation) OldPriority(ctx context.Context) (v uint8, err error)

OldPriority returns the old "priority" field's value of the Grant entity. If the Grant 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 (*GrantMutation) OldRecurrenceAnchor

func (m *GrantMutation) OldRecurrenceAnchor(ctx context.Context) (v *time.Time, err error)

OldRecurrenceAnchor returns the old "recurrence_anchor" field's value of the Grant entity. If the Grant 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 (*GrantMutation) OldRecurrencePeriod

func (m *GrantMutation) OldRecurrencePeriod(ctx context.Context) (v *recurrence.RecurrenceInterval, err error)

OldRecurrencePeriod returns the old "recurrence_period" field's value of the Grant entity. If the Grant 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 (*GrantMutation) OldResetMaxRollover

func (m *GrantMutation) OldResetMaxRollover(ctx context.Context) (v float64, err error)

OldResetMaxRollover returns the old "reset_max_rollover" field's value of the Grant entity. If the Grant 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 (*GrantMutation) OldResetMinRollover

func (m *GrantMutation) OldResetMinRollover(ctx context.Context) (v float64, err error)

OldResetMinRollover returns the old "reset_min_rollover" field's value of the Grant entity. If the Grant 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 (*GrantMutation) OldUpdatedAt

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

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

func (m *GrantMutation) OldVoidedAt(ctx context.Context) (v *time.Time, err error)

OldVoidedAt returns the old "voided_at" field's value of the Grant entity. If the Grant 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 (*GrantMutation) Op

func (m *GrantMutation) Op() Op

Op returns the operation name.

func (*GrantMutation) OwnerID

func (m *GrantMutation) OwnerID() (r credit.GrantOwner, exists bool)

OwnerID returns the value of the "owner_id" field in the mutation.

func (*GrantMutation) Priority

func (m *GrantMutation) Priority() (r uint8, exists bool)

Priority returns the value of the "priority" field in the mutation.

func (*GrantMutation) RecurrenceAnchor

func (m *GrantMutation) RecurrenceAnchor() (r time.Time, exists bool)

RecurrenceAnchor returns the value of the "recurrence_anchor" field in the mutation.

func (*GrantMutation) RecurrenceAnchorCleared

func (m *GrantMutation) RecurrenceAnchorCleared() bool

RecurrenceAnchorCleared returns if the "recurrence_anchor" field was cleared in this mutation.

func (*GrantMutation) RecurrencePeriod

func (m *GrantMutation) RecurrencePeriod() (r recurrence.RecurrenceInterval, exists bool)

RecurrencePeriod returns the value of the "recurrence_period" field in the mutation.

func (*GrantMutation) RecurrencePeriodCleared

func (m *GrantMutation) RecurrencePeriodCleared() bool

RecurrencePeriodCleared returns if the "recurrence_period" field was cleared in this mutation.

func (*GrantMutation) RemovedEdges

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

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

func (*GrantMutation) RemovedIDs

func (m *GrantMutation) 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 (*GrantMutation) ResetAmount

func (m *GrantMutation) ResetAmount()

ResetAmount resets all changes to the "amount" field.

func (*GrantMutation) ResetCreatedAt

func (m *GrantMutation) ResetCreatedAt()

ResetCreatedAt resets all changes to the "created_at" field.

func (*GrantMutation) ResetDeletedAt

func (m *GrantMutation) ResetDeletedAt()

ResetDeletedAt resets all changes to the "deleted_at" field.

func (*GrantMutation) ResetEdge

func (m *GrantMutation) 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 (*GrantMutation) ResetEffectiveAt

func (m *GrantMutation) ResetEffectiveAt()

ResetEffectiveAt resets all changes to the "effective_at" field.

func (*GrantMutation) ResetExpiration

func (m *GrantMutation) ResetExpiration()

ResetExpiration resets all changes to the "expiration" field.

func (*GrantMutation) ResetExpiresAt

func (m *GrantMutation) ResetExpiresAt()

ResetExpiresAt resets all changes to the "expires_at" field.

func (*GrantMutation) ResetField

func (m *GrantMutation) 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 (*GrantMutation) ResetMaxRollover

func (m *GrantMutation) ResetMaxRollover() (r float64, exists bool)

ResetMaxRollover returns the value of the "reset_max_rollover" field in the mutation.

func (*GrantMutation) ResetMetadata

func (m *GrantMutation) ResetMetadata()

ResetMetadata resets all changes to the "metadata" field.

func (*GrantMutation) ResetMinRollover

func (m *GrantMutation) ResetMinRollover() (r float64, exists bool)

ResetMinRollover returns the value of the "reset_min_rollover" field in the mutation.

func (*GrantMutation) ResetNamespace

func (m *GrantMutation) ResetNamespace()

ResetNamespace resets all changes to the "namespace" field.

func (*GrantMutation) ResetOwnerID

func (m *GrantMutation) ResetOwnerID()

ResetOwnerID resets all changes to the "owner_id" field.

func (*GrantMutation) ResetPriority

func (m *GrantMutation) ResetPriority()

ResetPriority resets all changes to the "priority" field.

func (*GrantMutation) ResetRecurrenceAnchor

func (m *GrantMutation) ResetRecurrenceAnchor()

ResetRecurrenceAnchor resets all changes to the "recurrence_anchor" field.

func (*GrantMutation) ResetRecurrencePeriod

func (m *GrantMutation) ResetRecurrencePeriod()

ResetRecurrencePeriod resets all changes to the "recurrence_period" field.

func (*GrantMutation) ResetResetMaxRollover

func (m *GrantMutation) ResetResetMaxRollover()

ResetResetMaxRollover resets all changes to the "reset_max_rollover" field.

func (*GrantMutation) ResetResetMinRollover

func (m *GrantMutation) ResetResetMinRollover()

ResetResetMinRollover resets all changes to the "reset_min_rollover" field.

func (*GrantMutation) ResetUpdatedAt

func (m *GrantMutation) ResetUpdatedAt()

ResetUpdatedAt resets all changes to the "updated_at" field.

func (*GrantMutation) ResetVoidedAt

func (m *GrantMutation) ResetVoidedAt()

ResetVoidedAt resets all changes to the "voided_at" field.

func (*GrantMutation) SetAmount

func (m *GrantMutation) SetAmount(f float64)

SetAmount sets the "amount" field.

func (*GrantMutation) SetCreatedAt

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

SetCreatedAt sets the "created_at" field.

func (*GrantMutation) SetDeletedAt

func (m *GrantMutation) SetDeletedAt(t time.Time)

SetDeletedAt sets the "deleted_at" field.

func (*GrantMutation) SetEffectiveAt

func (m *GrantMutation) SetEffectiveAt(t time.Time)

SetEffectiveAt sets the "effective_at" field.

func (*GrantMutation) SetExpiration

func (m *GrantMutation) SetExpiration(cp credit.ExpirationPeriod)

SetExpiration sets the "expiration" field.

func (*GrantMutation) SetExpiresAt

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

SetExpiresAt sets the "expires_at" field.

func (*GrantMutation) SetField

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

func (m *GrantMutation) SetID(id string)

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

func (*GrantMutation) SetMetadata

func (m *GrantMutation) SetMetadata(value map[string]string)

SetMetadata sets the "metadata" field.

func (*GrantMutation) SetNamespace

func (m *GrantMutation) SetNamespace(s string)

SetNamespace sets the "namespace" field.

func (*GrantMutation) SetOp

func (m *GrantMutation) SetOp(op Op)

SetOp allows setting the mutation operation.

func (*GrantMutation) SetOwnerID

func (m *GrantMutation) SetOwnerID(co credit.GrantOwner)

SetOwnerID sets the "owner_id" field.

func (*GrantMutation) SetPriority

func (m *GrantMutation) SetPriority(u uint8)

SetPriority sets the "priority" field.

func (*GrantMutation) SetRecurrenceAnchor

func (m *GrantMutation) SetRecurrenceAnchor(t time.Time)

SetRecurrenceAnchor sets the "recurrence_anchor" field.

func (*GrantMutation) SetRecurrencePeriod

func (m *GrantMutation) SetRecurrencePeriod(ri recurrence.RecurrenceInterval)

SetRecurrencePeriod sets the "recurrence_period" field.

func (*GrantMutation) SetResetMaxRollover

func (m *GrantMutation) SetResetMaxRollover(f float64)

SetResetMaxRollover sets the "reset_max_rollover" field.

func (*GrantMutation) SetResetMinRollover

func (m *GrantMutation) SetResetMinRollover(f float64)

SetResetMinRollover sets the "reset_min_rollover" field.

func (*GrantMutation) SetUpdatedAt

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

SetUpdatedAt sets the "updated_at" field.

func (*GrantMutation) SetVoidedAt

func (m *GrantMutation) SetVoidedAt(t time.Time)

SetVoidedAt sets the "voided_at" field.

func (GrantMutation) Tx

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

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

func (*GrantMutation) Type

func (m *GrantMutation) Type() string

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

func (*GrantMutation) UpdatedAt

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

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

func (*GrantMutation) VoidedAt

func (m *GrantMutation) VoidedAt() (r time.Time, exists bool)

VoidedAt returns the value of the "voided_at" field in the mutation.

func (*GrantMutation) VoidedAtCleared

func (m *GrantMutation) VoidedAtCleared() bool

VoidedAtCleared returns if the "voided_at" field was cleared in this mutation.

func (*GrantMutation) Where

func (m *GrantMutation) Where(ps ...predicate.Grant)

Where appends a list predicates to the GrantMutation builder.

func (*GrantMutation) WhereP

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

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

type GrantQuery

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

GrantQuery is the builder for querying Grant entities.

func (*GrantQuery) Aggregate

func (gq *GrantQuery) Aggregate(fns ...AggregateFunc) *GrantSelect

Aggregate returns a GrantSelect configured with the given aggregations.

func (*GrantQuery) All

func (gq *GrantQuery) All(ctx context.Context) ([]*Grant, error)

All executes the query and returns a list of Grants.

func (*GrantQuery) AllX

func (gq *GrantQuery) AllX(ctx context.Context) []*Grant

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

func (*GrantQuery) Clone

func (gq *GrantQuery) Clone() *GrantQuery

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

func (*GrantQuery) Count

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

Count returns the count of the given query.

func (*GrantQuery) CountX

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

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

func (*GrantQuery) Exist

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

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

func (*GrantQuery) ExistX

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

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

func (*GrantQuery) First

func (gq *GrantQuery) First(ctx context.Context) (*Grant, error)

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

func (*GrantQuery) FirstID

func (gq *GrantQuery) FirstID(ctx context.Context) (id string, err error)

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

func (*GrantQuery) FirstIDX

func (gq *GrantQuery) FirstIDX(ctx context.Context) string

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

func (*GrantQuery) FirstX

func (gq *GrantQuery) FirstX(ctx context.Context) *Grant

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

func (*GrantQuery) ForShare

func (gq *GrantQuery) ForShare(opts ...sql.LockOption) *GrantQuery

ForShare behaves similarly to ForUpdate, except that it acquires a shared mode lock on any rows that are read. Other sessions can read the rows, but cannot modify them until your transaction commits.

func (*GrantQuery) ForUpdate

func (gq *GrantQuery) ForUpdate(opts ...sql.LockOption) *GrantQuery

ForUpdate locks the selected rows against concurrent updates, and prevent them from being updated, deleted or "selected ... for update" by other sessions, until the transaction is either committed or rolled-back.

func (*GrantQuery) GroupBy

func (gq *GrantQuery) GroupBy(field string, fields ...string) *GrantGroupBy

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 {
	Namespace string `json:"namespace,omitempty"`
	Count int `json:"count,omitempty"`
}

client.Grant.Query().
	GroupBy(grant.FieldNamespace).
	Aggregate(db.Count()).
	Scan(ctx, &v)

func (*GrantQuery) IDs

func (gq *GrantQuery) IDs(ctx context.Context) (ids []string, err error)

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

func (*GrantQuery) IDsX

func (gq *GrantQuery) IDsX(ctx context.Context) []string

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

func (*GrantQuery) Limit

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

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

func (*GrantQuery) Offset

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

Offset to start from.

func (*GrantQuery) Only

func (gq *GrantQuery) Only(ctx context.Context) (*Grant, error)

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

func (*GrantQuery) OnlyID

func (gq *GrantQuery) OnlyID(ctx context.Context) (id string, err error)

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

func (*GrantQuery) OnlyIDX

func (gq *GrantQuery) OnlyIDX(ctx context.Context) string

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

func (*GrantQuery) OnlyX

func (gq *GrantQuery) OnlyX(ctx context.Context) *Grant

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

func (*GrantQuery) Order

func (gq *GrantQuery) Order(o ...grant.OrderOption) *GrantQuery

Order specifies how the records should be ordered.

func (*GrantQuery) Select

func (gq *GrantQuery) Select(fields ...string) *GrantSelect

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 {
	Namespace string `json:"namespace,omitempty"`
}

client.Grant.Query().
	Select(grant.FieldNamespace).
	Scan(ctx, &v)

func (*GrantQuery) Unique

func (gq *GrantQuery) Unique(unique bool) *GrantQuery

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

func (gq *GrantQuery) Where(ps ...predicate.Grant) *GrantQuery

Where adds a new predicate for the GrantQuery builder.

type GrantSelect

type GrantSelect struct {
	*GrantQuery
	// contains filtered or unexported fields
}

GrantSelect is the builder for selecting fields of Grant entities.

func (*GrantSelect) Aggregate

func (gs *GrantSelect) Aggregate(fns ...AggregateFunc) *GrantSelect

Aggregate adds the given aggregation functions to the selector query.

func (*GrantSelect) Bool

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

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

func (*GrantSelect) BoolX

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

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

func (*GrantSelect) Bools

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

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

func (*GrantSelect) BoolsX

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

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

func (*GrantSelect) Float64

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

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

func (*GrantSelect) Float64X

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

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

func (*GrantSelect) Float64s

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

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

func (*GrantSelect) Float64sX

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

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

func (*GrantSelect) Int

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

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

func (*GrantSelect) IntX

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

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

func (*GrantSelect) Ints

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

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

func (*GrantSelect) IntsX

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

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

func (*GrantSelect) Scan

func (gs *GrantSelect) Scan(ctx context.Context, v any) error

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

func (*GrantSelect) ScanX

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

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

func (*GrantSelect) String

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

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

func (*GrantSelect) StringX

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

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

func (*GrantSelect) Strings

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

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

func (*GrantSelect) StringsX

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

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

type GrantUpdate

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

GrantUpdate is the builder for updating Grant entities.

func (*GrantUpdate) ClearDeletedAt

func (gu *GrantUpdate) ClearDeletedAt() *GrantUpdate

ClearDeletedAt clears the value of the "deleted_at" field.

func (*GrantUpdate) ClearMetadata

func (gu *GrantUpdate) ClearMetadata() *GrantUpdate

ClearMetadata clears the value of the "metadata" field.

func (*GrantUpdate) ClearVoidedAt

func (gu *GrantUpdate) ClearVoidedAt() *GrantUpdate

ClearVoidedAt clears the value of the "voided_at" field.

func (*GrantUpdate) Exec

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

Exec executes the query.

func (*GrantUpdate) ExecX

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

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

func (*GrantUpdate) Mutation

func (gu *GrantUpdate) Mutation() *GrantMutation

Mutation returns the GrantMutation object of the builder.

func (*GrantUpdate) Save

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

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

func (*GrantUpdate) SaveX

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

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

func (*GrantUpdate) SetDeletedAt

func (gu *GrantUpdate) SetDeletedAt(t time.Time) *GrantUpdate

SetDeletedAt sets the "deleted_at" field.

func (*GrantUpdate) SetMetadata

func (gu *GrantUpdate) SetMetadata(m map[string]string) *GrantUpdate

SetMetadata sets the "metadata" field.

func (*GrantUpdate) SetNillableDeletedAt

func (gu *GrantUpdate) SetNillableDeletedAt(t *time.Time) *GrantUpdate

SetNillableDeletedAt sets the "deleted_at" field if the given value is not nil.

func (*GrantUpdate) SetNillableVoidedAt

func (gu *GrantUpdate) SetNillableVoidedAt(t *time.Time) *GrantUpdate

SetNillableVoidedAt sets the "voided_at" field if the given value is not nil.

func (*GrantUpdate) SetUpdatedAt

func (gu *GrantUpdate) SetUpdatedAt(t time.Time) *GrantUpdate

SetUpdatedAt sets the "updated_at" field.

func (*GrantUpdate) SetVoidedAt

func (gu *GrantUpdate) SetVoidedAt(t time.Time) *GrantUpdate

SetVoidedAt sets the "voided_at" field.

func (*GrantUpdate) Where

func (gu *GrantUpdate) Where(ps ...predicate.Grant) *GrantUpdate

Where appends a list predicates to the GrantUpdate builder.

type GrantUpdateOne

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

GrantUpdateOne is the builder for updating a single Grant entity.

func (*GrantUpdateOne) ClearDeletedAt

func (guo *GrantUpdateOne) ClearDeletedAt() *GrantUpdateOne

ClearDeletedAt clears the value of the "deleted_at" field.

func (*GrantUpdateOne) ClearMetadata

func (guo *GrantUpdateOne) ClearMetadata() *GrantUpdateOne

ClearMetadata clears the value of the "metadata" field.

func (*GrantUpdateOne) ClearVoidedAt

func (guo *GrantUpdateOne) ClearVoidedAt() *GrantUpdateOne

ClearVoidedAt clears the value of the "voided_at" field.

func (*GrantUpdateOne) Exec

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

Exec executes the query on the entity.

func (*GrantUpdateOne) ExecX

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

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

func (*GrantUpdateOne) Mutation

func (guo *GrantUpdateOne) Mutation() *GrantMutation

Mutation returns the GrantMutation object of the builder.

func (*GrantUpdateOne) Save

func (guo *GrantUpdateOne) Save(ctx context.Context) (*Grant, error)

Save executes the query and returns the updated Grant entity.

func (*GrantUpdateOne) SaveX

func (guo *GrantUpdateOne) SaveX(ctx context.Context) *Grant

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

func (*GrantUpdateOne) Select

func (guo *GrantUpdateOne) Select(field string, fields ...string) *GrantUpdateOne

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

func (*GrantUpdateOne) SetDeletedAt

func (guo *GrantUpdateOne) SetDeletedAt(t time.Time) *GrantUpdateOne

SetDeletedAt sets the "deleted_at" field.

func (*GrantUpdateOne) SetMetadata

func (guo *GrantUpdateOne) SetMetadata(m map[string]string) *GrantUpdateOne

SetMetadata sets the "metadata" field.

func (*GrantUpdateOne) SetNillableDeletedAt

func (guo *GrantUpdateOne) SetNillableDeletedAt(t *time.Time) *GrantUpdateOne

SetNillableDeletedAt sets the "deleted_at" field if the given value is not nil.

func (*GrantUpdateOne) SetNillableVoidedAt

func (guo *GrantUpdateOne) SetNillableVoidedAt(t *time.Time) *GrantUpdateOne

SetNillableVoidedAt sets the "voided_at" field if the given value is not nil.

func (*GrantUpdateOne) SetUpdatedAt

func (guo *GrantUpdateOne) SetUpdatedAt(t time.Time) *GrantUpdateOne

SetUpdatedAt sets the "updated_at" field.

func (*GrantUpdateOne) SetVoidedAt

func (guo *GrantUpdateOne) SetVoidedAt(t time.Time) *GrantUpdateOne

SetVoidedAt sets the "voided_at" field.

func (*GrantUpdateOne) Where

func (guo *GrantUpdateOne) Where(ps ...predicate.Grant) *GrantUpdateOne

Where appends a list predicates to the GrantUpdate builder.

type GrantUpsert

type GrantUpsert struct {
	*sql.UpdateSet
}

GrantUpsert is the "OnConflict" setter.

func (*GrantUpsert) ClearDeletedAt

func (u *GrantUpsert) ClearDeletedAt() *GrantUpsert

ClearDeletedAt clears the value of the "deleted_at" field.

func (*GrantUpsert) ClearMetadata

func (u *GrantUpsert) ClearMetadata() *GrantUpsert

ClearMetadata clears the value of the "metadata" field.

func (*GrantUpsert) ClearVoidedAt

func (u *GrantUpsert) ClearVoidedAt() *GrantUpsert

ClearVoidedAt clears the value of the "voided_at" field.

func (*GrantUpsert) SetDeletedAt

func (u *GrantUpsert) SetDeletedAt(v time.Time) *GrantUpsert

SetDeletedAt sets the "deleted_at" field.

func (*GrantUpsert) SetMetadata

func (u *GrantUpsert) SetMetadata(v map[string]string) *GrantUpsert

SetMetadata sets the "metadata" field.

func (*GrantUpsert) SetUpdatedAt

func (u *GrantUpsert) SetUpdatedAt(v time.Time) *GrantUpsert

SetUpdatedAt sets the "updated_at" field.

func (*GrantUpsert) SetVoidedAt

func (u *GrantUpsert) SetVoidedAt(v time.Time) *GrantUpsert

SetVoidedAt sets the "voided_at" field.

func (*GrantUpsert) UpdateDeletedAt

func (u *GrantUpsert) UpdateDeletedAt() *GrantUpsert

UpdateDeletedAt sets the "deleted_at" field to the value that was provided on create.

func (*GrantUpsert) UpdateMetadata

func (u *GrantUpsert) UpdateMetadata() *GrantUpsert

UpdateMetadata sets the "metadata" field to the value that was provided on create.

func (*GrantUpsert) UpdateUpdatedAt

func (u *GrantUpsert) UpdateUpdatedAt() *GrantUpsert

UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create.

func (*GrantUpsert) UpdateVoidedAt

func (u *GrantUpsert) UpdateVoidedAt() *GrantUpsert

UpdateVoidedAt sets the "voided_at" field to the value that was provided on create.

type GrantUpsertBulk

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

GrantUpsertBulk is the builder for "upsert"-ing a bulk of Grant nodes.

func (*GrantUpsertBulk) ClearDeletedAt

func (u *GrantUpsertBulk) ClearDeletedAt() *GrantUpsertBulk

ClearDeletedAt clears the value of the "deleted_at" field.

func (*GrantUpsertBulk) ClearMetadata

func (u *GrantUpsertBulk) ClearMetadata() *GrantUpsertBulk

ClearMetadata clears the value of the "metadata" field.

func (*GrantUpsertBulk) ClearVoidedAt

func (u *GrantUpsertBulk) ClearVoidedAt() *GrantUpsertBulk

ClearVoidedAt clears the value of the "voided_at" field.

func (*GrantUpsertBulk) DoNothing

func (u *GrantUpsertBulk) DoNothing() *GrantUpsertBulk

DoNothing configures the conflict_action to `DO NOTHING`. Supported only by SQLite and PostgreSQL.

func (*GrantUpsertBulk) Exec

func (u *GrantUpsertBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*GrantUpsertBulk) ExecX

func (u *GrantUpsertBulk) ExecX(ctx context.Context)

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

func (*GrantUpsertBulk) Ignore

func (u *GrantUpsertBulk) Ignore() *GrantUpsertBulk

Ignore sets each column to itself in case of conflict. Using this option is equivalent to using:

client.Grant.Create().
	OnConflict(sql.ResolveWithIgnore()).
	Exec(ctx)

func (*GrantUpsertBulk) SetDeletedAt

func (u *GrantUpsertBulk) SetDeletedAt(v time.Time) *GrantUpsertBulk

SetDeletedAt sets the "deleted_at" field.

func (*GrantUpsertBulk) SetMetadata

func (u *GrantUpsertBulk) SetMetadata(v map[string]string) *GrantUpsertBulk

SetMetadata sets the "metadata" field.

func (*GrantUpsertBulk) SetUpdatedAt

func (u *GrantUpsertBulk) SetUpdatedAt(v time.Time) *GrantUpsertBulk

SetUpdatedAt sets the "updated_at" field.

func (*GrantUpsertBulk) SetVoidedAt

func (u *GrantUpsertBulk) SetVoidedAt(v time.Time) *GrantUpsertBulk

SetVoidedAt sets the "voided_at" field.

func (*GrantUpsertBulk) Update

func (u *GrantUpsertBulk) Update(set func(*GrantUpsert)) *GrantUpsertBulk

Update allows overriding fields `UPDATE` values. See the GrantCreateBulk.OnConflict documentation for more info.

func (*GrantUpsertBulk) UpdateDeletedAt

func (u *GrantUpsertBulk) UpdateDeletedAt() *GrantUpsertBulk

UpdateDeletedAt sets the "deleted_at" field to the value that was provided on create.

func (*GrantUpsertBulk) UpdateMetadata

func (u *GrantUpsertBulk) UpdateMetadata() *GrantUpsertBulk

UpdateMetadata sets the "metadata" field to the value that was provided on create.

func (*GrantUpsertBulk) UpdateNewValues

func (u *GrantUpsertBulk) UpdateNewValues() *GrantUpsertBulk

UpdateNewValues updates the mutable fields using the new values that were set on create. Using this option is equivalent to using:

client.Grant.Create().
	OnConflict(
		sql.ResolveWithNewValues(),
		sql.ResolveWith(func(u *sql.UpdateSet) {
			u.SetIgnore(grant.FieldID)
		}),
	).
	Exec(ctx)

func (*GrantUpsertBulk) UpdateUpdatedAt

func (u *GrantUpsertBulk) UpdateUpdatedAt() *GrantUpsertBulk

UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create.

func (*GrantUpsertBulk) UpdateVoidedAt

func (u *GrantUpsertBulk) UpdateVoidedAt() *GrantUpsertBulk

UpdateVoidedAt sets the "voided_at" field to the value that was provided on create.

type GrantUpsertOne

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

GrantUpsertOne is the builder for "upsert"-ing

one Grant node.

func (*GrantUpsertOne) ClearDeletedAt

func (u *GrantUpsertOne) ClearDeletedAt() *GrantUpsertOne

ClearDeletedAt clears the value of the "deleted_at" field.

func (*GrantUpsertOne) ClearMetadata

func (u *GrantUpsertOne) ClearMetadata() *GrantUpsertOne

ClearMetadata clears the value of the "metadata" field.

func (*GrantUpsertOne) ClearVoidedAt

func (u *GrantUpsertOne) ClearVoidedAt() *GrantUpsertOne

ClearVoidedAt clears the value of the "voided_at" field.

func (*GrantUpsertOne) DoNothing

func (u *GrantUpsertOne) DoNothing() *GrantUpsertOne

DoNothing configures the conflict_action to `DO NOTHING`. Supported only by SQLite and PostgreSQL.

func (*GrantUpsertOne) Exec

func (u *GrantUpsertOne) Exec(ctx context.Context) error

Exec executes the query.

func (*GrantUpsertOne) ExecX

func (u *GrantUpsertOne) ExecX(ctx context.Context)

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

func (*GrantUpsertOne) ID

func (u *GrantUpsertOne) ID(ctx context.Context) (id string, err error)

Exec executes the UPSERT query and returns the inserted/updated ID.

func (*GrantUpsertOne) IDX

func (u *GrantUpsertOne) IDX(ctx context.Context) string

IDX is like ID, but panics if an error occurs.

func (*GrantUpsertOne) Ignore

func (u *GrantUpsertOne) Ignore() *GrantUpsertOne

Ignore sets each column to itself in case of conflict. Using this option is equivalent to using:

client.Grant.Create().
    OnConflict(sql.ResolveWithIgnore()).
    Exec(ctx)

func (*GrantUpsertOne) SetDeletedAt

func (u *GrantUpsertOne) SetDeletedAt(v time.Time) *GrantUpsertOne

SetDeletedAt sets the "deleted_at" field.

func (*GrantUpsertOne) SetMetadata

func (u *GrantUpsertOne) SetMetadata(v map[string]string) *GrantUpsertOne

SetMetadata sets the "metadata" field.

func (*GrantUpsertOne) SetUpdatedAt

func (u *GrantUpsertOne) SetUpdatedAt(v time.Time) *GrantUpsertOne

SetUpdatedAt sets the "updated_at" field.

func (*GrantUpsertOne) SetVoidedAt

func (u *GrantUpsertOne) SetVoidedAt(v time.Time) *GrantUpsertOne

SetVoidedAt sets the "voided_at" field.

func (*GrantUpsertOne) Update

func (u *GrantUpsertOne) Update(set func(*GrantUpsert)) *GrantUpsertOne

Update allows overriding fields `UPDATE` values. See the GrantCreate.OnConflict documentation for more info.

func (*GrantUpsertOne) UpdateDeletedAt

func (u *GrantUpsertOne) UpdateDeletedAt() *GrantUpsertOne

UpdateDeletedAt sets the "deleted_at" field to the value that was provided on create.

func (*GrantUpsertOne) UpdateMetadata

func (u *GrantUpsertOne) UpdateMetadata() *GrantUpsertOne

UpdateMetadata sets the "metadata" field to the value that was provided on create.

func (*GrantUpsertOne) UpdateNewValues

func (u *GrantUpsertOne) UpdateNewValues() *GrantUpsertOne

UpdateNewValues updates the mutable fields using the new values that were set on create except the ID field. Using this option is equivalent to using:

client.Grant.Create().
	OnConflict(
		sql.ResolveWithNewValues(),
		sql.ResolveWith(func(u *sql.UpdateSet) {
			u.SetIgnore(grant.FieldID)
		}),
	).
	Exec(ctx)

func (*GrantUpsertOne) UpdateUpdatedAt

func (u *GrantUpsertOne) UpdateUpdatedAt() *GrantUpsertOne

UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create.

func (*GrantUpsertOne) UpdateVoidedAt

func (u *GrantUpsertOne) UpdateVoidedAt() *GrantUpsertOne

UpdateVoidedAt sets the "voided_at" field to the value that was provided on create.

type Grants

type Grants []*Grant

Grants is a parsable slice of Grant.

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

	// BalanceSnapshot is the client for interacting with the BalanceSnapshot builders.
	BalanceSnapshot *BalanceSnapshotClient
	// Grant is the client for interacting with the Grant builders.
	Grant *GrantClient
	// contains filtered or unexported fields
}

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

func NewTxClientFromRawConfig

func NewTxClientFromRawConfig(ctx context.Context, cfg entutils.RawEntConfig) *Tx

NewTxClientFromConfig creates a new transactional client from a (hijacked) configuration.

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