db

package
v1.0.0-beta.75 Latest Latest
Warning

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

Go to latest
Published: May 14, 2024 License: Apache-2.0 Imports: 24 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.
	TypeCreditEntry = "CreditEntry"
	TypeFeature     = "Feature"
	TypeLedger      = "Ledger"
)

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 Client

type Client struct {

	// Schema is the client for creating, migrating and dropping schema.
	Schema *migrate.Schema
	// CreditEntry is the client for interacting with the CreditEntry builders.
	CreditEntry *CreditEntryClient
	// Feature is the client for interacting with the Feature builders.
	Feature *FeatureClient
	// Ledger is the client for interacting with the Ledger builders.
	Ledger *LedgerClient
	// 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().
	CreditEntry.
	Query().
	Count(ctx)

func (*Client) Intercept

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

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

func (*Client) Mutate

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

Mutate implements the ent.Mutator interface.

func (*Client) Tx

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

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

func (*Client) Use

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

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

type CommitFunc

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

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

func (CommitFunc) Commit

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

Commit calls f(ctx, m).

type CommitHook

type CommitHook func(Committer) Committer

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

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

type Committer

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

Committer is the interface that wraps the Commit method.

type ConstraintError

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

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

func (ConstraintError) Error

func (e ConstraintError) Error() string

Error implements the error interface.

func (*ConstraintError) Unwrap

func (e *ConstraintError) Unwrap() error

Unwrap implements the errors.Wrapper interface.

type CreditEntries

type CreditEntries []*CreditEntry

CreditEntries is a parsable slice of CreditEntry.

type CreditEntry

type CreditEntry struct {

	// ID of the ent.
	ID pgulid.ULID `json:"id,omitempty"`
	// CreatedAt holds the value of the "created_at" field.
	CreatedAt time.Time `json:"created_at,omitempty"`
	// UpdatedAt holds the value of the "updated_at" field.
	UpdatedAt time.Time `json:"updated_at,omitempty"`
	// Namespace holds the value of the "namespace" field.
	Namespace string `json:"namespace,omitempty"`
	// LedgerID holds the value of the "ledger_id" field.
	LedgerID pgulid.ULID `json:"ledger_id,omitempty"`
	// EntryType holds the value of the "entry_type" field.
	EntryType credit.EntryType `json:"entry_type,omitempty"`
	// Type holds the value of the "type" field.
	Type *credit.GrantType `json:"type,omitempty"`
	// FeatureID holds the value of the "feature_id" field.
	FeatureID *pgulid.ULID `json:"feature_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"`
	// ExpirationPeriodDuration holds the value of the "expiration_period_duration" field.
	ExpirationPeriodDuration *credit.ExpirationPeriodDuration `json:"expiration_period_duration,omitempty"`
	// ExpirationPeriodCount holds the value of the "expiration_period_count" field.
	ExpirationPeriodCount *uint8 `json:"expiration_period_count,omitempty"`
	// ExpirationAt holds the value of the "expiration_at" field.
	ExpirationAt *time.Time `json:"expiration_at,omitempty"`
	// RolloverType holds the value of the "rollover_type" field.
	RolloverType *credit.GrantRolloverType `json:"rollover_type,omitempty"`
	// RolloverMaxAmount holds the value of the "rollover_max_amount" field.
	RolloverMaxAmount *float64 `json:"rollover_max_amount,omitempty"`
	// Metadata holds the value of the "metadata" field.
	Metadata map[string]string `json:"metadata,omitempty"`
	// ParentID holds the value of the "parent_id" field.
	ParentID *pgulid.ULID `json:"parent_id,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the CreditEntryQuery when eager-loading is set.
	Edges CreditEntryEdges `json:"edges"`
	// contains filtered or unexported fields
}

CreditEntry is the model entity for the CreditEntry schema.

func (*CreditEntry) QueryChildren

func (ce *CreditEntry) QueryChildren() *CreditEntryQuery

QueryChildren queries the "children" edge of the CreditEntry entity.

func (*CreditEntry) QueryFeature

func (ce *CreditEntry) QueryFeature() *FeatureQuery

QueryFeature queries the "feature" edge of the CreditEntry entity.

func (*CreditEntry) QueryParent

func (ce *CreditEntry) QueryParent() *CreditEntryQuery

QueryParent queries the "parent" edge of the CreditEntry entity.

func (*CreditEntry) String

func (ce *CreditEntry) String() string

String implements the fmt.Stringer.

func (*CreditEntry) Unwrap

func (ce *CreditEntry) Unwrap() *CreditEntry

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

func (ce *CreditEntry) Update() *CreditEntryUpdateOne

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

func (*CreditEntry) Value

func (ce *CreditEntry) Value(name string) (ent.Value, error)

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

type CreditEntryClient

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

CreditEntryClient is a client for the CreditEntry schema.

func NewCreditEntryClient

func NewCreditEntryClient(c config) *CreditEntryClient

NewCreditEntryClient returns a client for the CreditEntry from the given config.

func (*CreditEntryClient) Create

func (c *CreditEntryClient) Create() *CreditEntryCreate

Create returns a builder for creating a CreditEntry entity.

func (*CreditEntryClient) CreateBulk

func (c *CreditEntryClient) CreateBulk(builders ...*CreditEntryCreate) *CreditEntryCreateBulk

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

func (*CreditEntryClient) Delete

func (c *CreditEntryClient) Delete() *CreditEntryDelete

Delete returns a delete builder for CreditEntry.

func (*CreditEntryClient) DeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*CreditEntryClient) DeleteOneID

func (c *CreditEntryClient) DeleteOneID(id pgulid.ULID) *CreditEntryDeleteOne

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

func (*CreditEntryClient) Get

Get returns a CreditEntry entity by its id.

func (*CreditEntryClient) GetX

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

func (*CreditEntryClient) Hooks

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

Hooks returns the client hooks.

func (*CreditEntryClient) Intercept

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

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

func (*CreditEntryClient) Interceptors

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

Interceptors returns the client interceptors.

func (*CreditEntryClient) MapCreateBulk

func (c *CreditEntryClient) MapCreateBulk(slice any, setFunc func(*CreditEntryCreate, int)) *CreditEntryCreateBulk

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

func (c *CreditEntryClient) Query() *CreditEntryQuery

Query returns a query builder for CreditEntry.

func (*CreditEntryClient) QueryChildren

func (c *CreditEntryClient) QueryChildren(ce *CreditEntry) *CreditEntryQuery

QueryChildren queries the children edge of a CreditEntry.

func (*CreditEntryClient) QueryFeature

func (c *CreditEntryClient) QueryFeature(ce *CreditEntry) *FeatureQuery

QueryFeature queries the feature edge of a CreditEntry.

func (*CreditEntryClient) QueryParent

func (c *CreditEntryClient) QueryParent(ce *CreditEntry) *CreditEntryQuery

QueryParent queries the parent edge of a CreditEntry.

func (*CreditEntryClient) Update

func (c *CreditEntryClient) Update() *CreditEntryUpdate

Update returns an update builder for CreditEntry.

func (*CreditEntryClient) UpdateOne

UpdateOne returns an update builder for the given entity.

func (*CreditEntryClient) UpdateOneID

func (c *CreditEntryClient) UpdateOneID(id pgulid.ULID) *CreditEntryUpdateOne

UpdateOneID returns an update builder for the given id.

func (*CreditEntryClient) Use

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

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

type CreditEntryCreate

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

CreditEntryCreate is the builder for creating a CreditEntry entity.

func (*CreditEntryCreate) Exec

func (cec *CreditEntryCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*CreditEntryCreate) ExecX

func (cec *CreditEntryCreate) ExecX(ctx context.Context)

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

func (*CreditEntryCreate) Mutation

func (cec *CreditEntryCreate) Mutation() *CreditEntryMutation

Mutation returns the CreditEntryMutation object of the builder.

func (*CreditEntryCreate) OnConflict

func (cec *CreditEntryCreate) OnConflict(opts ...sql.ConflictOption) *CreditEntryUpsertOne

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

client.CreditEntry.Create().
	SetCreatedAt(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.CreditEntryUpsert) {
		SetCreatedAt(v+v).
	}).
	Exec(ctx)

func (*CreditEntryCreate) OnConflictColumns

func (cec *CreditEntryCreate) OnConflictColumns(columns ...string) *CreditEntryUpsertOne

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

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

func (*CreditEntryCreate) Save

func (cec *CreditEntryCreate) Save(ctx context.Context) (*CreditEntry, error)

Save creates the CreditEntry in the database.

func (*CreditEntryCreate) SaveX

func (cec *CreditEntryCreate) SaveX(ctx context.Context) *CreditEntry

SaveX calls Save and panics if Save returns an error.

func (*CreditEntryCreate) SetAmount

func (cec *CreditEntryCreate) SetAmount(f float64) *CreditEntryCreate

SetAmount sets the "amount" field.

func (*CreditEntryCreate) SetChildren

func (cec *CreditEntryCreate) SetChildren(c *CreditEntry) *CreditEntryCreate

SetChildren sets the "children" edge to the CreditEntry entity.

func (*CreditEntryCreate) SetChildrenID

func (cec *CreditEntryCreate) SetChildrenID(id pgulid.ULID) *CreditEntryCreate

SetChildrenID sets the "children" edge to the CreditEntry entity by ID.

func (*CreditEntryCreate) SetCreatedAt

func (cec *CreditEntryCreate) SetCreatedAt(t time.Time) *CreditEntryCreate

SetCreatedAt sets the "created_at" field.

func (*CreditEntryCreate) SetEffectiveAt

func (cec *CreditEntryCreate) SetEffectiveAt(t time.Time) *CreditEntryCreate

SetEffectiveAt sets the "effective_at" field.

func (*CreditEntryCreate) SetEntryType

func (cec *CreditEntryCreate) SetEntryType(ct credit.EntryType) *CreditEntryCreate

SetEntryType sets the "entry_type" field.

func (*CreditEntryCreate) SetExpirationAt

func (cec *CreditEntryCreate) SetExpirationAt(t time.Time) *CreditEntryCreate

SetExpirationAt sets the "expiration_at" field.

func (*CreditEntryCreate) SetExpirationPeriodCount

func (cec *CreditEntryCreate) SetExpirationPeriodCount(u uint8) *CreditEntryCreate

SetExpirationPeriodCount sets the "expiration_period_count" field.

func (*CreditEntryCreate) SetExpirationPeriodDuration

func (cec *CreditEntryCreate) SetExpirationPeriodDuration(cpd credit.ExpirationPeriodDuration) *CreditEntryCreate

SetExpirationPeriodDuration sets the "expiration_period_duration" field.

func (*CreditEntryCreate) SetFeature

func (cec *CreditEntryCreate) SetFeature(f *Feature) *CreditEntryCreate

SetFeature sets the "feature" edge to the Feature entity.

func (*CreditEntryCreate) SetFeatureID

func (cec *CreditEntryCreate) SetFeatureID(pg pgulid.ULID) *CreditEntryCreate

SetFeatureID sets the "feature_id" field.

func (*CreditEntryCreate) SetID

SetID sets the "id" field.

func (*CreditEntryCreate) SetLedgerID

func (cec *CreditEntryCreate) SetLedgerID(pg pgulid.ULID) *CreditEntryCreate

SetLedgerID sets the "ledger_id" field.

func (*CreditEntryCreate) SetMetadata

func (cec *CreditEntryCreate) SetMetadata(m map[string]string) *CreditEntryCreate

SetMetadata sets the "metadata" field.

func (*CreditEntryCreate) SetNamespace

func (cec *CreditEntryCreate) SetNamespace(s string) *CreditEntryCreate

SetNamespace sets the "namespace" field.

func (*CreditEntryCreate) SetNillableAmount

func (cec *CreditEntryCreate) SetNillableAmount(f *float64) *CreditEntryCreate

SetNillableAmount sets the "amount" field if the given value is not nil.

func (*CreditEntryCreate) SetNillableChildrenID

func (cec *CreditEntryCreate) SetNillableChildrenID(id *pgulid.ULID) *CreditEntryCreate

SetNillableChildrenID sets the "children" edge to the CreditEntry entity by ID if the given value is not nil.

func (*CreditEntryCreate) SetNillableCreatedAt

func (cec *CreditEntryCreate) SetNillableCreatedAt(t *time.Time) *CreditEntryCreate

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

func (*CreditEntryCreate) SetNillableEffectiveAt

func (cec *CreditEntryCreate) SetNillableEffectiveAt(t *time.Time) *CreditEntryCreate

SetNillableEffectiveAt sets the "effective_at" field if the given value is not nil.

func (*CreditEntryCreate) SetNillableExpirationAt

func (cec *CreditEntryCreate) SetNillableExpirationAt(t *time.Time) *CreditEntryCreate

SetNillableExpirationAt sets the "expiration_at" field if the given value is not nil.

func (*CreditEntryCreate) SetNillableExpirationPeriodCount

func (cec *CreditEntryCreate) SetNillableExpirationPeriodCount(u *uint8) *CreditEntryCreate

SetNillableExpirationPeriodCount sets the "expiration_period_count" field if the given value is not nil.

func (*CreditEntryCreate) SetNillableExpirationPeriodDuration

func (cec *CreditEntryCreate) SetNillableExpirationPeriodDuration(cpd *credit.ExpirationPeriodDuration) *CreditEntryCreate

SetNillableExpirationPeriodDuration sets the "expiration_period_duration" field if the given value is not nil.

func (*CreditEntryCreate) SetNillableFeatureID

func (cec *CreditEntryCreate) SetNillableFeatureID(pg *pgulid.ULID) *CreditEntryCreate

SetNillableFeatureID sets the "feature_id" field if the given value is not nil.

func (*CreditEntryCreate) SetNillableID

func (cec *CreditEntryCreate) SetNillableID(pg *pgulid.ULID) *CreditEntryCreate

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

func (*CreditEntryCreate) SetNillableParentID

func (cec *CreditEntryCreate) SetNillableParentID(pg *pgulid.ULID) *CreditEntryCreate

SetNillableParentID sets the "parent_id" field if the given value is not nil.

func (*CreditEntryCreate) SetNillablePriority

func (cec *CreditEntryCreate) SetNillablePriority(u *uint8) *CreditEntryCreate

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

func (*CreditEntryCreate) SetNillableRolloverMaxAmount

func (cec *CreditEntryCreate) SetNillableRolloverMaxAmount(f *float64) *CreditEntryCreate

SetNillableRolloverMaxAmount sets the "rollover_max_amount" field if the given value is not nil.

func (*CreditEntryCreate) SetNillableRolloverType

func (cec *CreditEntryCreate) SetNillableRolloverType(crt *credit.GrantRolloverType) *CreditEntryCreate

SetNillableRolloverType sets the "rollover_type" field if the given value is not nil.

func (*CreditEntryCreate) SetNillableType

func (cec *CreditEntryCreate) SetNillableType(ct *credit.GrantType) *CreditEntryCreate

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

func (*CreditEntryCreate) SetNillableUpdatedAt

func (cec *CreditEntryCreate) SetNillableUpdatedAt(t *time.Time) *CreditEntryCreate

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

func (*CreditEntryCreate) SetParent

func (cec *CreditEntryCreate) SetParent(c *CreditEntry) *CreditEntryCreate

SetParent sets the "parent" edge to the CreditEntry entity.

func (*CreditEntryCreate) SetParentID

func (cec *CreditEntryCreate) SetParentID(pg pgulid.ULID) *CreditEntryCreate

SetParentID sets the "parent_id" field.

func (*CreditEntryCreate) SetPriority

func (cec *CreditEntryCreate) SetPriority(u uint8) *CreditEntryCreate

SetPriority sets the "priority" field.

func (*CreditEntryCreate) SetRolloverMaxAmount

func (cec *CreditEntryCreate) SetRolloverMaxAmount(f float64) *CreditEntryCreate

SetRolloverMaxAmount sets the "rollover_max_amount" field.

func (*CreditEntryCreate) SetRolloverType

func (cec *CreditEntryCreate) SetRolloverType(crt credit.GrantRolloverType) *CreditEntryCreate

SetRolloverType sets the "rollover_type" field.

func (*CreditEntryCreate) SetType

SetType sets the "type" field.

func (*CreditEntryCreate) SetUpdatedAt

func (cec *CreditEntryCreate) SetUpdatedAt(t time.Time) *CreditEntryCreate

SetUpdatedAt sets the "updated_at" field.

type CreditEntryCreateBulk

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

CreditEntryCreateBulk is the builder for creating many CreditEntry entities in bulk.

func (*CreditEntryCreateBulk) Exec

func (cecb *CreditEntryCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*CreditEntryCreateBulk) ExecX

func (cecb *CreditEntryCreateBulk) ExecX(ctx context.Context)

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

func (*CreditEntryCreateBulk) OnConflict

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

client.CreditEntry.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.CreditEntryUpsert) {
		SetCreatedAt(v+v).
	}).
	Exec(ctx)

func (*CreditEntryCreateBulk) OnConflictColumns

func (cecb *CreditEntryCreateBulk) OnConflictColumns(columns ...string) *CreditEntryUpsertBulk

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

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

func (*CreditEntryCreateBulk) Save

func (cecb *CreditEntryCreateBulk) Save(ctx context.Context) ([]*CreditEntry, error)

Save creates the CreditEntry entities in the database.

func (*CreditEntryCreateBulk) SaveX

func (cecb *CreditEntryCreateBulk) SaveX(ctx context.Context) []*CreditEntry

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

type CreditEntryDelete

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

CreditEntryDelete is the builder for deleting a CreditEntry entity.

func (*CreditEntryDelete) Exec

func (ced *CreditEntryDelete) Exec(ctx context.Context) (int, error)

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

func (*CreditEntryDelete) ExecX

func (ced *CreditEntryDelete) ExecX(ctx context.Context) int

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

func (*CreditEntryDelete) Where

Where appends a list predicates to the CreditEntryDelete builder.

type CreditEntryDeleteOne

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

CreditEntryDeleteOne is the builder for deleting a single CreditEntry entity.

func (*CreditEntryDeleteOne) Exec

func (cedo *CreditEntryDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*CreditEntryDeleteOne) ExecX

func (cedo *CreditEntryDeleteOne) ExecX(ctx context.Context)

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

func (*CreditEntryDeleteOne) Where

Where appends a list predicates to the CreditEntryDelete builder.

type CreditEntryEdges

type CreditEntryEdges struct {
	// Parent holds the value of the parent edge.
	Parent *CreditEntry `json:"parent,omitempty"`
	// Children holds the value of the children edge.
	Children *CreditEntry `json:"children,omitempty"`
	// Feature holds the value of the feature edge.
	Feature *Feature `json:"feature,omitempty"`
	// contains filtered or unexported fields
}

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

func (CreditEntryEdges) ChildrenOrErr

func (e CreditEntryEdges) ChildrenOrErr() (*CreditEntry, error)

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

func (CreditEntryEdges) FeatureOrErr

func (e CreditEntryEdges) FeatureOrErr() (*Feature, error)

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

func (CreditEntryEdges) ParentOrErr

func (e CreditEntryEdges) ParentOrErr() (*CreditEntry, error)

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

type CreditEntryGroupBy

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

CreditEntryGroupBy is the group-by builder for CreditEntry entities.

func (*CreditEntryGroupBy) Aggregate

func (cegb *CreditEntryGroupBy) Aggregate(fns ...AggregateFunc) *CreditEntryGroupBy

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

func (*CreditEntryGroupBy) Bool

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

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

func (*CreditEntryGroupBy) BoolX

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

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

func (*CreditEntryGroupBy) Bools

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

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

func (*CreditEntryGroupBy) BoolsX

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

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

func (*CreditEntryGroupBy) Float64

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

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

func (*CreditEntryGroupBy) Float64X

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

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

func (*CreditEntryGroupBy) Float64s

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

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

func (*CreditEntryGroupBy) Float64sX

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

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

func (*CreditEntryGroupBy) Int

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

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

func (*CreditEntryGroupBy) IntX

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

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

func (*CreditEntryGroupBy) Ints

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

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

func (*CreditEntryGroupBy) IntsX

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

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

func (*CreditEntryGroupBy) Scan

func (cegb *CreditEntryGroupBy) Scan(ctx context.Context, v any) error

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

func (*CreditEntryGroupBy) ScanX

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

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

func (*CreditEntryGroupBy) String

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

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

func (*CreditEntryGroupBy) StringX

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

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

func (*CreditEntryGroupBy) Strings

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

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

func (*CreditEntryGroupBy) StringsX

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

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

type CreditEntryMutation

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

CreditEntryMutation represents an operation that mutates the CreditEntry nodes in the graph.

func (*CreditEntryMutation) AddAmount

func (m *CreditEntryMutation) AddAmount(f float64)

AddAmount adds f to the "amount" field.

func (*CreditEntryMutation) AddExpirationPeriodCount

func (m *CreditEntryMutation) AddExpirationPeriodCount(u int8)

AddExpirationPeriodCount adds u to the "expiration_period_count" field.

func (*CreditEntryMutation) AddField

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

func (m *CreditEntryMutation) AddPriority(u int8)

AddPriority adds u to the "priority" field.

func (*CreditEntryMutation) AddRolloverMaxAmount

func (m *CreditEntryMutation) AddRolloverMaxAmount(f float64)

AddRolloverMaxAmount adds f to the "rollover_max_amount" field.

func (*CreditEntryMutation) AddedAmount

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

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

func (*CreditEntryMutation) AddedEdges

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

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

func (*CreditEntryMutation) AddedExpirationPeriodCount

func (m *CreditEntryMutation) AddedExpirationPeriodCount() (r int8, exists bool)

AddedExpirationPeriodCount returns the value that was added to the "expiration_period_count" field in this mutation.

func (*CreditEntryMutation) AddedField

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

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

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

func (*CreditEntryMutation) AddedIDs

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

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

func (*CreditEntryMutation) AddedPriority

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

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

func (*CreditEntryMutation) AddedRolloverMaxAmount

func (m *CreditEntryMutation) AddedRolloverMaxAmount() (r float64, exists bool)

AddedRolloverMaxAmount returns the value that was added to the "rollover_max_amount" field in this mutation.

func (*CreditEntryMutation) Amount

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

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

func (*CreditEntryMutation) AmountCleared

func (m *CreditEntryMutation) AmountCleared() bool

AmountCleared returns if the "amount" field was cleared in this mutation.

func (*CreditEntryMutation) ChildrenCleared

func (m *CreditEntryMutation) ChildrenCleared() bool

ChildrenCleared reports if the "children" edge to the CreditEntry entity was cleared.

func (*CreditEntryMutation) ChildrenID

func (m *CreditEntryMutation) ChildrenID() (id pgulid.ULID, exists bool)

ChildrenID returns the "children" edge ID in the mutation.

func (*CreditEntryMutation) ChildrenIDs

func (m *CreditEntryMutation) ChildrenIDs() (ids []pgulid.ULID)

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

func (*CreditEntryMutation) ClearAmount

func (m *CreditEntryMutation) ClearAmount()

ClearAmount clears the value of the "amount" field.

func (*CreditEntryMutation) ClearChildren

func (m *CreditEntryMutation) ClearChildren()

ClearChildren clears the "children" edge to the CreditEntry entity.

func (*CreditEntryMutation) ClearEdge

func (m *CreditEntryMutation) 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 (*CreditEntryMutation) ClearExpirationAt

func (m *CreditEntryMutation) ClearExpirationAt()

ClearExpirationAt clears the value of the "expiration_at" field.

func (*CreditEntryMutation) ClearExpirationPeriodCount

func (m *CreditEntryMutation) ClearExpirationPeriodCount()

ClearExpirationPeriodCount clears the value of the "expiration_period_count" field.

func (*CreditEntryMutation) ClearExpirationPeriodDuration

func (m *CreditEntryMutation) ClearExpirationPeriodDuration()

ClearExpirationPeriodDuration clears the value of the "expiration_period_duration" field.

func (*CreditEntryMutation) ClearFeature

func (m *CreditEntryMutation) ClearFeature()

ClearFeature clears the "feature" edge to the Feature entity.

func (*CreditEntryMutation) ClearFeatureID

func (m *CreditEntryMutation) ClearFeatureID()

ClearFeatureID clears the value of the "feature_id" field.

func (*CreditEntryMutation) ClearField

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

func (m *CreditEntryMutation) ClearMetadata()

ClearMetadata clears the value of the "metadata" field.

func (*CreditEntryMutation) ClearParent

func (m *CreditEntryMutation) ClearParent()

ClearParent clears the "parent" edge to the CreditEntry entity.

func (*CreditEntryMutation) ClearParentID

func (m *CreditEntryMutation) ClearParentID()

ClearParentID clears the value of the "parent_id" field.

func (*CreditEntryMutation) ClearRolloverMaxAmount

func (m *CreditEntryMutation) ClearRolloverMaxAmount()

ClearRolloverMaxAmount clears the value of the "rollover_max_amount" field.

func (*CreditEntryMutation) ClearRolloverType

func (m *CreditEntryMutation) ClearRolloverType()

ClearRolloverType clears the value of the "rollover_type" field.

func (*CreditEntryMutation) ClearType

func (m *CreditEntryMutation) ClearType()

ClearType clears the value of the "type" field.

func (*CreditEntryMutation) ClearedEdges

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

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

func (*CreditEntryMutation) ClearedFields

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

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

func (CreditEntryMutation) Client

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

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

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

func (*CreditEntryMutation) EdgeCleared

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

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

func (*CreditEntryMutation) EffectiveAt

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

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

func (*CreditEntryMutation) EntryType

func (m *CreditEntryMutation) EntryType() (r credit.EntryType, exists bool)

EntryType returns the value of the "entry_type" field in the mutation.

func (*CreditEntryMutation) ExpirationAt

func (m *CreditEntryMutation) ExpirationAt() (r time.Time, exists bool)

ExpirationAt returns the value of the "expiration_at" field in the mutation.

func (*CreditEntryMutation) ExpirationAtCleared

func (m *CreditEntryMutation) ExpirationAtCleared() bool

ExpirationAtCleared returns if the "expiration_at" field was cleared in this mutation.

func (*CreditEntryMutation) ExpirationPeriodCount

func (m *CreditEntryMutation) ExpirationPeriodCount() (r uint8, exists bool)

ExpirationPeriodCount returns the value of the "expiration_period_count" field in the mutation.

func (*CreditEntryMutation) ExpirationPeriodCountCleared

func (m *CreditEntryMutation) ExpirationPeriodCountCleared() bool

ExpirationPeriodCountCleared returns if the "expiration_period_count" field was cleared in this mutation.

func (*CreditEntryMutation) ExpirationPeriodDuration

func (m *CreditEntryMutation) ExpirationPeriodDuration() (r credit.ExpirationPeriodDuration, exists bool)

ExpirationPeriodDuration returns the value of the "expiration_period_duration" field in the mutation.

func (*CreditEntryMutation) ExpirationPeriodDurationCleared

func (m *CreditEntryMutation) ExpirationPeriodDurationCleared() bool

ExpirationPeriodDurationCleared returns if the "expiration_period_duration" field was cleared in this mutation.

func (*CreditEntryMutation) FeatureCleared

func (m *CreditEntryMutation) FeatureCleared() bool

FeatureCleared reports if the "feature" edge to the Feature entity was cleared.

func (*CreditEntryMutation) FeatureID

func (m *CreditEntryMutation) FeatureID() (r pgulid.ULID, exists bool)

FeatureID returns the value of the "feature_id" field in the mutation.

func (*CreditEntryMutation) FeatureIDCleared

func (m *CreditEntryMutation) FeatureIDCleared() bool

FeatureIDCleared returns if the "feature_id" field was cleared in this mutation.

func (*CreditEntryMutation) FeatureIDs

func (m *CreditEntryMutation) FeatureIDs() (ids []pgulid.ULID)

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

func (*CreditEntryMutation) Field

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

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

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

func (*CreditEntryMutation) Fields

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

func (m *CreditEntryMutation) GetType() (r credit.GrantType, exists bool)

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

func (*CreditEntryMutation) ID

func (m *CreditEntryMutation) ID() (id pgulid.ULID, 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 (*CreditEntryMutation) IDs

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

func (*CreditEntryMutation) LedgerID

func (m *CreditEntryMutation) LedgerID() (r pgulid.ULID, exists bool)

LedgerID returns the value of the "ledger_id" field in the mutation.

func (*CreditEntryMutation) Metadata

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

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

func (*CreditEntryMutation) MetadataCleared

func (m *CreditEntryMutation) MetadataCleared() bool

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

func (*CreditEntryMutation) Namespace

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

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

func (*CreditEntryMutation) OldAmount

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

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

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

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

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

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

func (m *CreditEntryMutation) OldEntryType(ctx context.Context) (v credit.EntryType, err error)

OldEntryType returns the old "entry_type" field's value of the CreditEntry entity. If the CreditEntry 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 (*CreditEntryMutation) OldExpirationAt

func (m *CreditEntryMutation) OldExpirationAt(ctx context.Context) (v *time.Time, err error)

OldExpirationAt returns the old "expiration_at" field's value of the CreditEntry entity. If the CreditEntry 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 (*CreditEntryMutation) OldExpirationPeriodCount

func (m *CreditEntryMutation) OldExpirationPeriodCount(ctx context.Context) (v *uint8, err error)

OldExpirationPeriodCount returns the old "expiration_period_count" field's value of the CreditEntry entity. If the CreditEntry 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 (*CreditEntryMutation) OldExpirationPeriodDuration

func (m *CreditEntryMutation) OldExpirationPeriodDuration(ctx context.Context) (v *credit.ExpirationPeriodDuration, err error)

OldExpirationPeriodDuration returns the old "expiration_period_duration" field's value of the CreditEntry entity. If the CreditEntry 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 (*CreditEntryMutation) OldFeatureID

func (m *CreditEntryMutation) OldFeatureID(ctx context.Context) (v *pgulid.ULID, err error)

OldFeatureID returns the old "feature_id" field's value of the CreditEntry entity. If the CreditEntry 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 (*CreditEntryMutation) OldField

func (m *CreditEntryMutation) 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 (*CreditEntryMutation) OldLedgerID

func (m *CreditEntryMutation) OldLedgerID(ctx context.Context) (v pgulid.ULID, err error)

OldLedgerID returns the old "ledger_id" field's value of the CreditEntry entity. If the CreditEntry 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 (*CreditEntryMutation) OldMetadata

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

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

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

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

func (m *CreditEntryMutation) OldParentID(ctx context.Context) (v *pgulid.ULID, err error)

OldParentID returns the old "parent_id" field's value of the CreditEntry entity. If the CreditEntry 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 (*CreditEntryMutation) OldPriority

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

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

func (m *CreditEntryMutation) OldRolloverMaxAmount(ctx context.Context) (v *float64, err error)

OldRolloverMaxAmount returns the old "rollover_max_amount" field's value of the CreditEntry entity. If the CreditEntry 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 (*CreditEntryMutation) OldRolloverType

func (m *CreditEntryMutation) OldRolloverType(ctx context.Context) (v *credit.GrantRolloverType, err error)

OldRolloverType returns the old "rollover_type" field's value of the CreditEntry entity. If the CreditEntry 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 (*CreditEntryMutation) OldType

func (m *CreditEntryMutation) OldType(ctx context.Context) (v *credit.GrantType, err error)

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

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

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

func (m *CreditEntryMutation) Op() Op

Op returns the operation name.

func (*CreditEntryMutation) ParentCleared

func (m *CreditEntryMutation) ParentCleared() bool

ParentCleared reports if the "parent" edge to the CreditEntry entity was cleared.

func (*CreditEntryMutation) ParentID

func (m *CreditEntryMutation) ParentID() (r pgulid.ULID, exists bool)

ParentID returns the value of the "parent_id" field in the mutation.

func (*CreditEntryMutation) ParentIDCleared

func (m *CreditEntryMutation) ParentIDCleared() bool

ParentIDCleared returns if the "parent_id" field was cleared in this mutation.

func (*CreditEntryMutation) ParentIDs

func (m *CreditEntryMutation) ParentIDs() (ids []pgulid.ULID)

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

func (*CreditEntryMutation) Priority

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

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

func (*CreditEntryMutation) RemovedEdges

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

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

func (*CreditEntryMutation) RemovedIDs

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

func (m *CreditEntryMutation) ResetAmount()

ResetAmount resets all changes to the "amount" field.

func (*CreditEntryMutation) ResetChildren

func (m *CreditEntryMutation) ResetChildren()

ResetChildren resets all changes to the "children" edge.

func (*CreditEntryMutation) ResetCreatedAt

func (m *CreditEntryMutation) ResetCreatedAt()

ResetCreatedAt resets all changes to the "created_at" field.

func (*CreditEntryMutation) ResetEdge

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

func (m *CreditEntryMutation) ResetEffectiveAt()

ResetEffectiveAt resets all changes to the "effective_at" field.

func (*CreditEntryMutation) ResetEntryType

func (m *CreditEntryMutation) ResetEntryType()

ResetEntryType resets all changes to the "entry_type" field.

func (*CreditEntryMutation) ResetExpirationAt

func (m *CreditEntryMutation) ResetExpirationAt()

ResetExpirationAt resets all changes to the "expiration_at" field.

func (*CreditEntryMutation) ResetExpirationPeriodCount

func (m *CreditEntryMutation) ResetExpirationPeriodCount()

ResetExpirationPeriodCount resets all changes to the "expiration_period_count" field.

func (*CreditEntryMutation) ResetExpirationPeriodDuration

func (m *CreditEntryMutation) ResetExpirationPeriodDuration()

ResetExpirationPeriodDuration resets all changes to the "expiration_period_duration" field.

func (*CreditEntryMutation) ResetFeature

func (m *CreditEntryMutation) ResetFeature()

ResetFeature resets all changes to the "feature" edge.

func (*CreditEntryMutation) ResetFeatureID

func (m *CreditEntryMutation) ResetFeatureID()

ResetFeatureID resets all changes to the "feature_id" field.

func (*CreditEntryMutation) ResetField

func (m *CreditEntryMutation) 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 (*CreditEntryMutation) ResetLedgerID

func (m *CreditEntryMutation) ResetLedgerID()

ResetLedgerID resets all changes to the "ledger_id" field.

func (*CreditEntryMutation) ResetMetadata

func (m *CreditEntryMutation) ResetMetadata()

ResetMetadata resets all changes to the "metadata" field.

func (*CreditEntryMutation) ResetNamespace

func (m *CreditEntryMutation) ResetNamespace()

ResetNamespace resets all changes to the "namespace" field.

func (*CreditEntryMutation) ResetParent

func (m *CreditEntryMutation) ResetParent()

ResetParent resets all changes to the "parent" edge.

func (*CreditEntryMutation) ResetParentID

func (m *CreditEntryMutation) ResetParentID()

ResetParentID resets all changes to the "parent_id" field.

func (*CreditEntryMutation) ResetPriority

func (m *CreditEntryMutation) ResetPriority()

ResetPriority resets all changes to the "priority" field.

func (*CreditEntryMutation) ResetRolloverMaxAmount

func (m *CreditEntryMutation) ResetRolloverMaxAmount()

ResetRolloverMaxAmount resets all changes to the "rollover_max_amount" field.

func (*CreditEntryMutation) ResetRolloverType

func (m *CreditEntryMutation) ResetRolloverType()

ResetRolloverType resets all changes to the "rollover_type" field.

func (*CreditEntryMutation) ResetType

func (m *CreditEntryMutation) ResetType()

ResetType resets all changes to the "type" field.

func (*CreditEntryMutation) ResetUpdatedAt

func (m *CreditEntryMutation) ResetUpdatedAt()

ResetUpdatedAt resets all changes to the "updated_at" field.

func (*CreditEntryMutation) RolloverMaxAmount

func (m *CreditEntryMutation) RolloverMaxAmount() (r float64, exists bool)

RolloverMaxAmount returns the value of the "rollover_max_amount" field in the mutation.

func (*CreditEntryMutation) RolloverMaxAmountCleared

func (m *CreditEntryMutation) RolloverMaxAmountCleared() bool

RolloverMaxAmountCleared returns if the "rollover_max_amount" field was cleared in this mutation.

func (*CreditEntryMutation) RolloverType

func (m *CreditEntryMutation) RolloverType() (r credit.GrantRolloverType, exists bool)

RolloverType returns the value of the "rollover_type" field in the mutation.

func (*CreditEntryMutation) RolloverTypeCleared

func (m *CreditEntryMutation) RolloverTypeCleared() bool

RolloverTypeCleared returns if the "rollover_type" field was cleared in this mutation.

func (*CreditEntryMutation) SetAmount

func (m *CreditEntryMutation) SetAmount(f float64)

SetAmount sets the "amount" field.

func (*CreditEntryMutation) SetChildrenID

func (m *CreditEntryMutation) SetChildrenID(id pgulid.ULID)

SetChildrenID sets the "children" edge to the CreditEntry entity by id.

func (*CreditEntryMutation) SetCreatedAt

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

SetCreatedAt sets the "created_at" field.

func (*CreditEntryMutation) SetEffectiveAt

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

SetEffectiveAt sets the "effective_at" field.

func (*CreditEntryMutation) SetEntryType

func (m *CreditEntryMutation) SetEntryType(ct credit.EntryType)

SetEntryType sets the "entry_type" field.

func (*CreditEntryMutation) SetExpirationAt

func (m *CreditEntryMutation) SetExpirationAt(t time.Time)

SetExpirationAt sets the "expiration_at" field.

func (*CreditEntryMutation) SetExpirationPeriodCount

func (m *CreditEntryMutation) SetExpirationPeriodCount(u uint8)

SetExpirationPeriodCount sets the "expiration_period_count" field.

func (*CreditEntryMutation) SetExpirationPeriodDuration

func (m *CreditEntryMutation) SetExpirationPeriodDuration(cpd credit.ExpirationPeriodDuration)

SetExpirationPeriodDuration sets the "expiration_period_duration" field.

func (*CreditEntryMutation) SetFeatureID

func (m *CreditEntryMutation) SetFeatureID(pg pgulid.ULID)

SetFeatureID sets the "feature_id" field.

func (*CreditEntryMutation) SetField

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

func (m *CreditEntryMutation) SetID(id pgulid.ULID)

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

func (*CreditEntryMutation) SetLedgerID

func (m *CreditEntryMutation) SetLedgerID(pg pgulid.ULID)

SetLedgerID sets the "ledger_id" field.

func (*CreditEntryMutation) SetMetadata

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

SetMetadata sets the "metadata" field.

func (*CreditEntryMutation) SetNamespace

func (m *CreditEntryMutation) SetNamespace(s string)

SetNamespace sets the "namespace" field.

func (*CreditEntryMutation) SetOp

func (m *CreditEntryMutation) SetOp(op Op)

SetOp allows setting the mutation operation.

func (*CreditEntryMutation) SetParentID

func (m *CreditEntryMutation) SetParentID(pg pgulid.ULID)

SetParentID sets the "parent_id" field.

func (*CreditEntryMutation) SetPriority

func (m *CreditEntryMutation) SetPriority(u uint8)

SetPriority sets the "priority" field.

func (*CreditEntryMutation) SetRolloverMaxAmount

func (m *CreditEntryMutation) SetRolloverMaxAmount(f float64)

SetRolloverMaxAmount sets the "rollover_max_amount" field.

func (*CreditEntryMutation) SetRolloverType

func (m *CreditEntryMutation) SetRolloverType(crt credit.GrantRolloverType)

SetRolloverType sets the "rollover_type" field.

func (*CreditEntryMutation) SetType

func (m *CreditEntryMutation) SetType(ct credit.GrantType)

SetType sets the "type" field.

func (*CreditEntryMutation) SetUpdatedAt

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

SetUpdatedAt sets the "updated_at" field.

func (CreditEntryMutation) Tx

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

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

func (*CreditEntryMutation) Type

func (m *CreditEntryMutation) Type() string

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

func (*CreditEntryMutation) TypeCleared

func (m *CreditEntryMutation) TypeCleared() bool

TypeCleared returns if the "type" field was cleared in this mutation.

func (*CreditEntryMutation) UpdatedAt

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

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

func (*CreditEntryMutation) Where

func (m *CreditEntryMutation) Where(ps ...predicate.CreditEntry)

Where appends a list predicates to the CreditEntryMutation builder.

func (*CreditEntryMutation) WhereP

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

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

type CreditEntryQuery

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

CreditEntryQuery is the builder for querying CreditEntry entities.

func (*CreditEntryQuery) Aggregate

func (ceq *CreditEntryQuery) Aggregate(fns ...AggregateFunc) *CreditEntrySelect

Aggregate returns a CreditEntrySelect configured with the given aggregations.

func (*CreditEntryQuery) All

func (ceq *CreditEntryQuery) All(ctx context.Context) ([]*CreditEntry, error)

All executes the query and returns a list of CreditEntries.

func (*CreditEntryQuery) AllX

func (ceq *CreditEntryQuery) AllX(ctx context.Context) []*CreditEntry

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

func (*CreditEntryQuery) Clone

func (ceq *CreditEntryQuery) Clone() *CreditEntryQuery

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

func (*CreditEntryQuery) Count

func (ceq *CreditEntryQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*CreditEntryQuery) CountX

func (ceq *CreditEntryQuery) CountX(ctx context.Context) int

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

func (*CreditEntryQuery) Exist

func (ceq *CreditEntryQuery) Exist(ctx context.Context) (bool, error)

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

func (*CreditEntryQuery) ExistX

func (ceq *CreditEntryQuery) ExistX(ctx context.Context) bool

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

func (*CreditEntryQuery) First

func (ceq *CreditEntryQuery) First(ctx context.Context) (*CreditEntry, error)

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

func (*CreditEntryQuery) FirstID

func (ceq *CreditEntryQuery) FirstID(ctx context.Context) (id pgulid.ULID, err error)

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

func (*CreditEntryQuery) FirstIDX

func (ceq *CreditEntryQuery) FirstIDX(ctx context.Context) pgulid.ULID

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

func (*CreditEntryQuery) FirstX

func (ceq *CreditEntryQuery) FirstX(ctx context.Context) *CreditEntry

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

func (*CreditEntryQuery) ForShare

func (ceq *CreditEntryQuery) ForShare(opts ...sql.LockOption) *CreditEntryQuery

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 (*CreditEntryQuery) ForUpdate

func (ceq *CreditEntryQuery) ForUpdate(opts ...sql.LockOption) *CreditEntryQuery

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 (*CreditEntryQuery) GroupBy

func (ceq *CreditEntryQuery) GroupBy(field string, fields ...string) *CreditEntryGroupBy

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

Example:

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

client.CreditEntry.Query().
	GroupBy(creditentry.FieldCreatedAt).
	Aggregate(db.Count()).
	Scan(ctx, &v)

func (*CreditEntryQuery) IDs

func (ceq *CreditEntryQuery) IDs(ctx context.Context) (ids []pgulid.ULID, err error)

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

func (*CreditEntryQuery) IDsX

func (ceq *CreditEntryQuery) IDsX(ctx context.Context) []pgulid.ULID

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

func (*CreditEntryQuery) Limit

func (ceq *CreditEntryQuery) Limit(limit int) *CreditEntryQuery

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

func (*CreditEntryQuery) Offset

func (ceq *CreditEntryQuery) Offset(offset int) *CreditEntryQuery

Offset to start from.

func (*CreditEntryQuery) Only

func (ceq *CreditEntryQuery) Only(ctx context.Context) (*CreditEntry, error)

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

func (*CreditEntryQuery) OnlyID

func (ceq *CreditEntryQuery) OnlyID(ctx context.Context) (id pgulid.ULID, err error)

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

func (*CreditEntryQuery) OnlyIDX

func (ceq *CreditEntryQuery) OnlyIDX(ctx context.Context) pgulid.ULID

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

func (*CreditEntryQuery) OnlyX

func (ceq *CreditEntryQuery) OnlyX(ctx context.Context) *CreditEntry

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

func (*CreditEntryQuery) Order

Order specifies how the records should be ordered.

func (*CreditEntryQuery) QueryChildren

func (ceq *CreditEntryQuery) QueryChildren() *CreditEntryQuery

QueryChildren chains the current query on the "children" edge.

func (*CreditEntryQuery) QueryFeature

func (ceq *CreditEntryQuery) QueryFeature() *FeatureQuery

QueryFeature chains the current query on the "feature" edge.

func (*CreditEntryQuery) QueryParent

func (ceq *CreditEntryQuery) QueryParent() *CreditEntryQuery

QueryParent chains the current query on the "parent" edge.

func (*CreditEntryQuery) Select

func (ceq *CreditEntryQuery) Select(fields ...string) *CreditEntrySelect

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

Example:

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

client.CreditEntry.Query().
	Select(creditentry.FieldCreatedAt).
	Scan(ctx, &v)

func (*CreditEntryQuery) Unique

func (ceq *CreditEntryQuery) Unique(unique bool) *CreditEntryQuery

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

Where adds a new predicate for the CreditEntryQuery builder.

func (*CreditEntryQuery) WithChildren

func (ceq *CreditEntryQuery) WithChildren(opts ...func(*CreditEntryQuery)) *CreditEntryQuery

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

func (*CreditEntryQuery) WithFeature

func (ceq *CreditEntryQuery) WithFeature(opts ...func(*FeatureQuery)) *CreditEntryQuery

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

func (*CreditEntryQuery) WithParent

func (ceq *CreditEntryQuery) WithParent(opts ...func(*CreditEntryQuery)) *CreditEntryQuery

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

type CreditEntrySelect

type CreditEntrySelect struct {
	*CreditEntryQuery
	// contains filtered or unexported fields
}

CreditEntrySelect is the builder for selecting fields of CreditEntry entities.

func (*CreditEntrySelect) Aggregate

func (ces *CreditEntrySelect) Aggregate(fns ...AggregateFunc) *CreditEntrySelect

Aggregate adds the given aggregation functions to the selector query.

func (*CreditEntrySelect) Bool

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

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

func (*CreditEntrySelect) BoolX

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

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

func (*CreditEntrySelect) Bools

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

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

func (*CreditEntrySelect) BoolsX

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

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

func (*CreditEntrySelect) Float64

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

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

func (*CreditEntrySelect) Float64X

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

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

func (*CreditEntrySelect) Float64s

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

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

func (*CreditEntrySelect) Float64sX

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

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

func (*CreditEntrySelect) Int

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

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

func (*CreditEntrySelect) IntX

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

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

func (*CreditEntrySelect) Ints

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

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

func (*CreditEntrySelect) IntsX

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

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

func (*CreditEntrySelect) Scan

func (ces *CreditEntrySelect) Scan(ctx context.Context, v any) error

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

func (*CreditEntrySelect) ScanX

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

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

func (*CreditEntrySelect) String

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

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

func (*CreditEntrySelect) StringX

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

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

func (*CreditEntrySelect) Strings

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

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

func (*CreditEntrySelect) StringsX

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

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

type CreditEntryUpdate

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

CreditEntryUpdate is the builder for updating CreditEntry entities.

func (*CreditEntryUpdate) ClearChildren

func (ceu *CreditEntryUpdate) ClearChildren() *CreditEntryUpdate

ClearChildren clears the "children" edge to the CreditEntry entity.

func (*CreditEntryUpdate) ClearMetadata

func (ceu *CreditEntryUpdate) ClearMetadata() *CreditEntryUpdate

ClearMetadata clears the value of the "metadata" field.

func (*CreditEntryUpdate) Exec

func (ceu *CreditEntryUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*CreditEntryUpdate) ExecX

func (ceu *CreditEntryUpdate) ExecX(ctx context.Context)

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

func (*CreditEntryUpdate) Mutation

func (ceu *CreditEntryUpdate) Mutation() *CreditEntryMutation

Mutation returns the CreditEntryMutation object of the builder.

func (*CreditEntryUpdate) Save

func (ceu *CreditEntryUpdate) Save(ctx context.Context) (int, error)

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

func (*CreditEntryUpdate) SaveX

func (ceu *CreditEntryUpdate) SaveX(ctx context.Context) int

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

func (*CreditEntryUpdate) SetChildren

func (ceu *CreditEntryUpdate) SetChildren(c *CreditEntry) *CreditEntryUpdate

SetChildren sets the "children" edge to the CreditEntry entity.

func (*CreditEntryUpdate) SetChildrenID

func (ceu *CreditEntryUpdate) SetChildrenID(id pgulid.ULID) *CreditEntryUpdate

SetChildrenID sets the "children" edge to the CreditEntry entity by ID.

func (*CreditEntryUpdate) SetMetadata

func (ceu *CreditEntryUpdate) SetMetadata(m map[string]string) *CreditEntryUpdate

SetMetadata sets the "metadata" field.

func (*CreditEntryUpdate) SetNillableChildrenID

func (ceu *CreditEntryUpdate) SetNillableChildrenID(id *pgulid.ULID) *CreditEntryUpdate

SetNillableChildrenID sets the "children" edge to the CreditEntry entity by ID if the given value is not nil.

func (*CreditEntryUpdate) SetUpdatedAt

func (ceu *CreditEntryUpdate) SetUpdatedAt(t time.Time) *CreditEntryUpdate

SetUpdatedAt sets the "updated_at" field.

func (*CreditEntryUpdate) Where

Where appends a list predicates to the CreditEntryUpdate builder.

type CreditEntryUpdateOne

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

CreditEntryUpdateOne is the builder for updating a single CreditEntry entity.

func (*CreditEntryUpdateOne) ClearChildren

func (ceuo *CreditEntryUpdateOne) ClearChildren() *CreditEntryUpdateOne

ClearChildren clears the "children" edge to the CreditEntry entity.

func (*CreditEntryUpdateOne) ClearMetadata

func (ceuo *CreditEntryUpdateOne) ClearMetadata() *CreditEntryUpdateOne

ClearMetadata clears the value of the "metadata" field.

func (*CreditEntryUpdateOne) Exec

func (ceuo *CreditEntryUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*CreditEntryUpdateOne) ExecX

func (ceuo *CreditEntryUpdateOne) ExecX(ctx context.Context)

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

func (*CreditEntryUpdateOne) Mutation

func (ceuo *CreditEntryUpdateOne) Mutation() *CreditEntryMutation

Mutation returns the CreditEntryMutation object of the builder.

func (*CreditEntryUpdateOne) Save

Save executes the query and returns the updated CreditEntry entity.

func (*CreditEntryUpdateOne) SaveX

func (ceuo *CreditEntryUpdateOne) SaveX(ctx context.Context) *CreditEntry

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

func (*CreditEntryUpdateOne) Select

func (ceuo *CreditEntryUpdateOne) Select(field string, fields ...string) *CreditEntryUpdateOne

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

func (*CreditEntryUpdateOne) SetChildren

func (ceuo *CreditEntryUpdateOne) SetChildren(c *CreditEntry) *CreditEntryUpdateOne

SetChildren sets the "children" edge to the CreditEntry entity.

func (*CreditEntryUpdateOne) SetChildrenID

func (ceuo *CreditEntryUpdateOne) SetChildrenID(id pgulid.ULID) *CreditEntryUpdateOne

SetChildrenID sets the "children" edge to the CreditEntry entity by ID.

func (*CreditEntryUpdateOne) SetMetadata

func (ceuo *CreditEntryUpdateOne) SetMetadata(m map[string]string) *CreditEntryUpdateOne

SetMetadata sets the "metadata" field.

func (*CreditEntryUpdateOne) SetNillableChildrenID

func (ceuo *CreditEntryUpdateOne) SetNillableChildrenID(id *pgulid.ULID) *CreditEntryUpdateOne

SetNillableChildrenID sets the "children" edge to the CreditEntry entity by ID if the given value is not nil.

func (*CreditEntryUpdateOne) SetUpdatedAt

func (ceuo *CreditEntryUpdateOne) SetUpdatedAt(t time.Time) *CreditEntryUpdateOne

SetUpdatedAt sets the "updated_at" field.

func (*CreditEntryUpdateOne) Where

Where appends a list predicates to the CreditEntryUpdate builder.

type CreditEntryUpsert

type CreditEntryUpsert struct {
	*sql.UpdateSet
}

CreditEntryUpsert is the "OnConflict" setter.

func (*CreditEntryUpsert) ClearMetadata

func (u *CreditEntryUpsert) ClearMetadata() *CreditEntryUpsert

ClearMetadata clears the value of the "metadata" field.

func (*CreditEntryUpsert) SetMetadata

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

SetMetadata sets the "metadata" field.

func (*CreditEntryUpsert) SetUpdatedAt

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

SetUpdatedAt sets the "updated_at" field.

func (*CreditEntryUpsert) UpdateMetadata

func (u *CreditEntryUpsert) UpdateMetadata() *CreditEntryUpsert

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

func (*CreditEntryUpsert) UpdateUpdatedAt

func (u *CreditEntryUpsert) UpdateUpdatedAt() *CreditEntryUpsert

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

type CreditEntryUpsertBulk

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

CreditEntryUpsertBulk is the builder for "upsert"-ing a bulk of CreditEntry nodes.

func (*CreditEntryUpsertBulk) ClearMetadata

func (u *CreditEntryUpsertBulk) ClearMetadata() *CreditEntryUpsertBulk

ClearMetadata clears the value of the "metadata" field.

func (*CreditEntryUpsertBulk) DoNothing

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

func (*CreditEntryUpsertBulk) Exec

Exec executes the query.

func (*CreditEntryUpsertBulk) ExecX

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

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

func (*CreditEntryUpsertBulk) Ignore

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

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

func (*CreditEntryUpsertBulk) SetMetadata

SetMetadata sets the "metadata" field.

func (*CreditEntryUpsertBulk) SetUpdatedAt

SetUpdatedAt sets the "updated_at" field.

func (*CreditEntryUpsertBulk) Update

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

func (*CreditEntryUpsertBulk) UpdateMetadata

func (u *CreditEntryUpsertBulk) UpdateMetadata() *CreditEntryUpsertBulk

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

func (*CreditEntryUpsertBulk) UpdateNewValues

func (u *CreditEntryUpsertBulk) UpdateNewValues() *CreditEntryUpsertBulk

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

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

func (*CreditEntryUpsertBulk) UpdateUpdatedAt

func (u *CreditEntryUpsertBulk) UpdateUpdatedAt() *CreditEntryUpsertBulk

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

type CreditEntryUpsertOne

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

CreditEntryUpsertOne is the builder for "upsert"-ing

one CreditEntry node.

func (*CreditEntryUpsertOne) ClearMetadata

func (u *CreditEntryUpsertOne) ClearMetadata() *CreditEntryUpsertOne

ClearMetadata clears the value of the "metadata" field.

func (*CreditEntryUpsertOne) DoNothing

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

func (*CreditEntryUpsertOne) Exec

Exec executes the query.

func (*CreditEntryUpsertOne) ExecX

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

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

func (*CreditEntryUpsertOne) ID

func (u *CreditEntryUpsertOne) ID(ctx context.Context) (id pgulid.ULID, err error)

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

func (*CreditEntryUpsertOne) IDX

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

func (*CreditEntryUpsertOne) Ignore

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

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

func (*CreditEntryUpsertOne) SetMetadata

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

SetMetadata sets the "metadata" field.

func (*CreditEntryUpsertOne) SetUpdatedAt

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

SetUpdatedAt sets the "updated_at" field.

func (*CreditEntryUpsertOne) Update

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

func (*CreditEntryUpsertOne) UpdateMetadata

func (u *CreditEntryUpsertOne) UpdateMetadata() *CreditEntryUpsertOne

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

func (*CreditEntryUpsertOne) UpdateNewValues

func (u *CreditEntryUpsertOne) UpdateNewValues() *CreditEntryUpsertOne

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.CreditEntry.Create().
	OnConflict(
		sql.ResolveWithNewValues(),
		sql.ResolveWith(func(u *sql.UpdateSet) {
			u.SetIgnore(creditentry.FieldID)
		}),
	).
	Exec(ctx)

func (*CreditEntryUpsertOne) UpdateUpdatedAt

func (u *CreditEntryUpsertOne) UpdateUpdatedAt() *CreditEntryUpsertOne

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

type Feature

type Feature struct {

	// ID of the ent.
	ID pgulid.ULID `json:"id,omitempty"`
	// CreatedAt holds the value of the "created_at" field.
	CreatedAt time.Time `json:"created_at,omitempty"`
	// UpdatedAt holds the value of the "updated_at" field.
	UpdatedAt time.Time `json:"updated_at,omitempty"`
	// Namespace holds the value of the "namespace" field.
	Namespace string `json:"namespace,omitempty"`
	// Name holds the value of the "name" field.
	Name string `json:"name,omitempty"`
	// MeterSlug holds the value of the "meter_slug" field.
	MeterSlug string `json:"meter_slug,omitempty"`
	// MeterGroupByFilters holds the value of the "meter_group_by_filters" field.
	MeterGroupByFilters map[string]string `json:"meter_group_by_filters,omitempty"`
	// Archived holds the value of the "archived" field.
	Archived bool `json:"archived,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the FeatureQuery when eager-loading is set.
	Edges FeatureEdges `json:"edges"`
	// contains filtered or unexported fields
}

Feature is the model entity for the Feature schema.

func (*Feature) QueryCreditGrants

func (f *Feature) QueryCreditGrants() *CreditEntryQuery

QueryCreditGrants queries the "credit_grants" edge of the Feature entity.

func (*Feature) String

func (f *Feature) String() string

String implements the fmt.Stringer.

func (*Feature) Unwrap

func (f *Feature) Unwrap() *Feature

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

func (f *Feature) Update() *FeatureUpdateOne

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

func (*Feature) Value

func (f *Feature) Value(name string) (ent.Value, error)

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

type FeatureClient

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

FeatureClient is a client for the Feature schema.

func NewFeatureClient

func NewFeatureClient(c config) *FeatureClient

NewFeatureClient returns a client for the Feature from the given config.

func (*FeatureClient) Create

func (c *FeatureClient) Create() *FeatureCreate

Create returns a builder for creating a Feature entity.

func (*FeatureClient) CreateBulk

func (c *FeatureClient) CreateBulk(builders ...*FeatureCreate) *FeatureCreateBulk

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

func (*FeatureClient) Delete

func (c *FeatureClient) Delete() *FeatureDelete

Delete returns a delete builder for Feature.

func (*FeatureClient) DeleteOne

func (c *FeatureClient) DeleteOne(f *Feature) *FeatureDeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*FeatureClient) DeleteOneID

func (c *FeatureClient) DeleteOneID(id pgulid.ULID) *FeatureDeleteOne

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

func (*FeatureClient) Get

func (c *FeatureClient) Get(ctx context.Context, id pgulid.ULID) (*Feature, error)

Get returns a Feature entity by its id.

func (*FeatureClient) GetX

func (c *FeatureClient) GetX(ctx context.Context, id pgulid.ULID) *Feature

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

func (*FeatureClient) Hooks

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

Hooks returns the client hooks.

func (*FeatureClient) Intercept

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

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

func (*FeatureClient) Interceptors

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

Interceptors returns the client interceptors.

func (*FeatureClient) MapCreateBulk

func (c *FeatureClient) MapCreateBulk(slice any, setFunc func(*FeatureCreate, int)) *FeatureCreateBulk

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

func (c *FeatureClient) Query() *FeatureQuery

Query returns a query builder for Feature.

func (*FeatureClient) QueryCreditGrants

func (c *FeatureClient) QueryCreditGrants(f *Feature) *CreditEntryQuery

QueryCreditGrants queries the credit_grants edge of a Feature.

func (*FeatureClient) Update

func (c *FeatureClient) Update() *FeatureUpdate

Update returns an update builder for Feature.

func (*FeatureClient) UpdateOne

func (c *FeatureClient) UpdateOne(f *Feature) *FeatureUpdateOne

UpdateOne returns an update builder for the given entity.

func (*FeatureClient) UpdateOneID

func (c *FeatureClient) UpdateOneID(id pgulid.ULID) *FeatureUpdateOne

UpdateOneID returns an update builder for the given id.

func (*FeatureClient) Use

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

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

type FeatureCreate

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

FeatureCreate is the builder for creating a Feature entity.

func (*FeatureCreate) AddCreditGrantIDs

func (fc *FeatureCreate) AddCreditGrantIDs(ids ...pgulid.ULID) *FeatureCreate

AddCreditGrantIDs adds the "credit_grants" edge to the CreditEntry entity by IDs.

func (*FeatureCreate) AddCreditGrants

func (fc *FeatureCreate) AddCreditGrants(c ...*CreditEntry) *FeatureCreate

AddCreditGrants adds the "credit_grants" edges to the CreditEntry entity.

func (*FeatureCreate) Exec

func (fc *FeatureCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*FeatureCreate) ExecX

func (fc *FeatureCreate) ExecX(ctx context.Context)

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

func (*FeatureCreate) Mutation

func (fc *FeatureCreate) Mutation() *FeatureMutation

Mutation returns the FeatureMutation object of the builder.

func (*FeatureCreate) OnConflict

func (fc *FeatureCreate) OnConflict(opts ...sql.ConflictOption) *FeatureUpsertOne

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

client.Feature.Create().
	SetCreatedAt(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.FeatureUpsert) {
		SetCreatedAt(v+v).
	}).
	Exec(ctx)

func (*FeatureCreate) OnConflictColumns

func (fc *FeatureCreate) OnConflictColumns(columns ...string) *FeatureUpsertOne

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

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

func (*FeatureCreate) Save

func (fc *FeatureCreate) Save(ctx context.Context) (*Feature, error)

Save creates the Feature in the database.

func (*FeatureCreate) SaveX

func (fc *FeatureCreate) SaveX(ctx context.Context) *Feature

SaveX calls Save and panics if Save returns an error.

func (*FeatureCreate) SetArchived

func (fc *FeatureCreate) SetArchived(b bool) *FeatureCreate

SetArchived sets the "archived" field.

func (*FeatureCreate) SetCreatedAt

func (fc *FeatureCreate) SetCreatedAt(t time.Time) *FeatureCreate

SetCreatedAt sets the "created_at" field.

func (*FeatureCreate) SetID

func (fc *FeatureCreate) SetID(pg pgulid.ULID) *FeatureCreate

SetID sets the "id" field.

func (*FeatureCreate) SetMeterGroupByFilters

func (fc *FeatureCreate) SetMeterGroupByFilters(m map[string]string) *FeatureCreate

SetMeterGroupByFilters sets the "meter_group_by_filters" field.

func (*FeatureCreate) SetMeterSlug

func (fc *FeatureCreate) SetMeterSlug(s string) *FeatureCreate

SetMeterSlug sets the "meter_slug" field.

func (*FeatureCreate) SetName

func (fc *FeatureCreate) SetName(s string) *FeatureCreate

SetName sets the "name" field.

func (*FeatureCreate) SetNamespace

func (fc *FeatureCreate) SetNamespace(s string) *FeatureCreate

SetNamespace sets the "namespace" field.

func (*FeatureCreate) SetNillableArchived

func (fc *FeatureCreate) SetNillableArchived(b *bool) *FeatureCreate

SetNillableArchived sets the "archived" field if the given value is not nil.

func (*FeatureCreate) SetNillableCreatedAt

func (fc *FeatureCreate) SetNillableCreatedAt(t *time.Time) *FeatureCreate

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

func (*FeatureCreate) SetNillableID

func (fc *FeatureCreate) SetNillableID(pg *pgulid.ULID) *FeatureCreate

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

func (*FeatureCreate) SetNillableUpdatedAt

func (fc *FeatureCreate) SetNillableUpdatedAt(t *time.Time) *FeatureCreate

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

func (*FeatureCreate) SetUpdatedAt

func (fc *FeatureCreate) SetUpdatedAt(t time.Time) *FeatureCreate

SetUpdatedAt sets the "updated_at" field.

type FeatureCreateBulk

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

FeatureCreateBulk is the builder for creating many Feature entities in bulk.

func (*FeatureCreateBulk) Exec

func (fcb *FeatureCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*FeatureCreateBulk) ExecX

func (fcb *FeatureCreateBulk) ExecX(ctx context.Context)

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

func (*FeatureCreateBulk) OnConflict

func (fcb *FeatureCreateBulk) OnConflict(opts ...sql.ConflictOption) *FeatureUpsertBulk

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

client.Feature.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.FeatureUpsert) {
		SetCreatedAt(v+v).
	}).
	Exec(ctx)

func (*FeatureCreateBulk) OnConflictColumns

func (fcb *FeatureCreateBulk) OnConflictColumns(columns ...string) *FeatureUpsertBulk

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

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

func (*FeatureCreateBulk) Save

func (fcb *FeatureCreateBulk) Save(ctx context.Context) ([]*Feature, error)

Save creates the Feature entities in the database.

func (*FeatureCreateBulk) SaveX

func (fcb *FeatureCreateBulk) SaveX(ctx context.Context) []*Feature

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

type FeatureDelete

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

FeatureDelete is the builder for deleting a Feature entity.

func (*FeatureDelete) Exec

func (fd *FeatureDelete) Exec(ctx context.Context) (int, error)

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

func (*FeatureDelete) ExecX

func (fd *FeatureDelete) ExecX(ctx context.Context) int

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

func (*FeatureDelete) Where

func (fd *FeatureDelete) Where(ps ...predicate.Feature) *FeatureDelete

Where appends a list predicates to the FeatureDelete builder.

type FeatureDeleteOne

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

FeatureDeleteOne is the builder for deleting a single Feature entity.

func (*FeatureDeleteOne) Exec

func (fdo *FeatureDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*FeatureDeleteOne) ExecX

func (fdo *FeatureDeleteOne) ExecX(ctx context.Context)

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

func (*FeatureDeleteOne) Where

Where appends a list predicates to the FeatureDelete builder.

type FeatureEdges

type FeatureEdges struct {
	// CreditGrants holds the value of the credit_grants edge.
	CreditGrants []*CreditEntry `json:"credit_grants,omitempty"`
	// contains filtered or unexported fields
}

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

func (FeatureEdges) CreditGrantsOrErr

func (e FeatureEdges) CreditGrantsOrErr() ([]*CreditEntry, error)

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

type FeatureGroupBy

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

FeatureGroupBy is the group-by builder for Feature entities.

func (*FeatureGroupBy) Aggregate

func (fgb *FeatureGroupBy) Aggregate(fns ...AggregateFunc) *FeatureGroupBy

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

func (*FeatureGroupBy) Bool

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

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

func (*FeatureGroupBy) BoolX

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

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

func (*FeatureGroupBy) Bools

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

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

func (*FeatureGroupBy) BoolsX

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

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

func (*FeatureGroupBy) Float64

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

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

func (*FeatureGroupBy) Float64X

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

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

func (*FeatureGroupBy) Float64s

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

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

func (*FeatureGroupBy) Float64sX

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

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

func (*FeatureGroupBy) Int

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

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

func (*FeatureGroupBy) IntX

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

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

func (*FeatureGroupBy) Ints

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

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

func (*FeatureGroupBy) IntsX

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

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

func (*FeatureGroupBy) Scan

func (fgb *FeatureGroupBy) Scan(ctx context.Context, v any) error

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

func (*FeatureGroupBy) ScanX

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

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

func (*FeatureGroupBy) String

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

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

func (*FeatureGroupBy) StringX

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

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

func (*FeatureGroupBy) Strings

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

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

func (*FeatureGroupBy) StringsX

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

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

type FeatureMutation

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

FeatureMutation represents an operation that mutates the Feature nodes in the graph.

func (*FeatureMutation) AddCreditGrantIDs

func (m *FeatureMutation) AddCreditGrantIDs(ids ...pgulid.ULID)

AddCreditGrantIDs adds the "credit_grants" edge to the CreditEntry entity by ids.

func (*FeatureMutation) AddField

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

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

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

func (*FeatureMutation) AddedField

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

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

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

func (*FeatureMutation) AddedIDs

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

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

func (*FeatureMutation) Archived

func (m *FeatureMutation) Archived() (r bool, exists bool)

Archived returns the value of the "archived" field in the mutation.

func (*FeatureMutation) ClearCreditGrants

func (m *FeatureMutation) ClearCreditGrants()

ClearCreditGrants clears the "credit_grants" edge to the CreditEntry entity.

func (*FeatureMutation) ClearEdge

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

func (m *FeatureMutation) 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 (*FeatureMutation) ClearMeterGroupByFilters

func (m *FeatureMutation) ClearMeterGroupByFilters()

ClearMeterGroupByFilters clears the value of the "meter_group_by_filters" field.

func (*FeatureMutation) ClearedEdges

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

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

func (*FeatureMutation) ClearedFields

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

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

func (FeatureMutation) Client

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

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

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

func (*FeatureMutation) CreditGrantsCleared

func (m *FeatureMutation) CreditGrantsCleared() bool

CreditGrantsCleared reports if the "credit_grants" edge to the CreditEntry entity was cleared.

func (*FeatureMutation) CreditGrantsIDs

func (m *FeatureMutation) CreditGrantsIDs() (ids []pgulid.ULID)

CreditGrantsIDs returns the "credit_grants" edge IDs in the mutation.

func (*FeatureMutation) EdgeCleared

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

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

func (*FeatureMutation) Field

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

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

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

func (*FeatureMutation) Fields

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

func (m *FeatureMutation) ID() (id pgulid.ULID, 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 (*FeatureMutation) IDs

func (m *FeatureMutation) IDs(ctx context.Context) ([]pgulid.ULID, 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 (*FeatureMutation) MeterGroupByFilters

func (m *FeatureMutation) MeterGroupByFilters() (r map[string]string, exists bool)

MeterGroupByFilters returns the value of the "meter_group_by_filters" field in the mutation.

func (*FeatureMutation) MeterGroupByFiltersCleared

func (m *FeatureMutation) MeterGroupByFiltersCleared() bool

MeterGroupByFiltersCleared returns if the "meter_group_by_filters" field was cleared in this mutation.

func (*FeatureMutation) MeterSlug

func (m *FeatureMutation) MeterSlug() (r string, exists bool)

MeterSlug returns the value of the "meter_slug" field in the mutation.

func (*FeatureMutation) Name

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

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

func (*FeatureMutation) Namespace

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

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

func (*FeatureMutation) OldArchived

func (m *FeatureMutation) OldArchived(ctx context.Context) (v bool, err error)

OldArchived returns the old "archived" field's value of the Feature entity. If the Feature 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 (*FeatureMutation) OldCreatedAt

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

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

func (m *FeatureMutation) 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 (*FeatureMutation) OldMeterGroupByFilters

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

OldMeterGroupByFilters returns the old "meter_group_by_filters" field's value of the Feature entity. If the Feature 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 (*FeatureMutation) OldMeterSlug

func (m *FeatureMutation) OldMeterSlug(ctx context.Context) (v string, err error)

OldMeterSlug returns the old "meter_slug" field's value of the Feature entity. If the Feature 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 (*FeatureMutation) OldName

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

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

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

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

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

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

func (m *FeatureMutation) Op() Op

Op returns the operation name.

func (*FeatureMutation) RemoveCreditGrantIDs

func (m *FeatureMutation) RemoveCreditGrantIDs(ids ...pgulid.ULID)

RemoveCreditGrantIDs removes the "credit_grants" edge to the CreditEntry entity by IDs.

func (*FeatureMutation) RemovedCreditGrantsIDs

func (m *FeatureMutation) RemovedCreditGrantsIDs() (ids []pgulid.ULID)

RemovedCreditGrants returns the removed IDs of the "credit_grants" edge to the CreditEntry entity.

func (*FeatureMutation) RemovedEdges

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

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

func (*FeatureMutation) RemovedIDs

func (m *FeatureMutation) 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 (*FeatureMutation) ResetArchived

func (m *FeatureMutation) ResetArchived()

ResetArchived resets all changes to the "archived" field.

func (*FeatureMutation) ResetCreatedAt

func (m *FeatureMutation) ResetCreatedAt()

ResetCreatedAt resets all changes to the "created_at" field.

func (*FeatureMutation) ResetCreditGrants

func (m *FeatureMutation) ResetCreditGrants()

ResetCreditGrants resets all changes to the "credit_grants" edge.

func (*FeatureMutation) ResetEdge

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

func (m *FeatureMutation) 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 (*FeatureMutation) ResetMeterGroupByFilters

func (m *FeatureMutation) ResetMeterGroupByFilters()

ResetMeterGroupByFilters resets all changes to the "meter_group_by_filters" field.

func (*FeatureMutation) ResetMeterSlug

func (m *FeatureMutation) ResetMeterSlug()

ResetMeterSlug resets all changes to the "meter_slug" field.

func (*FeatureMutation) ResetName

func (m *FeatureMutation) ResetName()

ResetName resets all changes to the "name" field.

func (*FeatureMutation) ResetNamespace

func (m *FeatureMutation) ResetNamespace()

ResetNamespace resets all changes to the "namespace" field.

func (*FeatureMutation) ResetUpdatedAt

func (m *FeatureMutation) ResetUpdatedAt()

ResetUpdatedAt resets all changes to the "updated_at" field.

func (*FeatureMutation) SetArchived

func (m *FeatureMutation) SetArchived(b bool)

SetArchived sets the "archived" field.

func (*FeatureMutation) SetCreatedAt

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

SetCreatedAt sets the "created_at" field.

func (*FeatureMutation) SetField

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

func (m *FeatureMutation) SetID(id pgulid.ULID)

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

func (*FeatureMutation) SetMeterGroupByFilters

func (m *FeatureMutation) SetMeterGroupByFilters(value map[string]string)

SetMeterGroupByFilters sets the "meter_group_by_filters" field.

func (*FeatureMutation) SetMeterSlug

func (m *FeatureMutation) SetMeterSlug(s string)

SetMeterSlug sets the "meter_slug" field.

func (*FeatureMutation) SetName

func (m *FeatureMutation) SetName(s string)

SetName sets the "name" field.

func (*FeatureMutation) SetNamespace

func (m *FeatureMutation) SetNamespace(s string)

SetNamespace sets the "namespace" field.

func (*FeatureMutation) SetOp

func (m *FeatureMutation) SetOp(op Op)

SetOp allows setting the mutation operation.

func (*FeatureMutation) SetUpdatedAt

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

SetUpdatedAt sets the "updated_at" field.

func (FeatureMutation) Tx

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

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

func (*FeatureMutation) Type

func (m *FeatureMutation) Type() string

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

func (*FeatureMutation) UpdatedAt

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

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

func (*FeatureMutation) Where

func (m *FeatureMutation) Where(ps ...predicate.Feature)

Where appends a list predicates to the FeatureMutation builder.

func (*FeatureMutation) WhereP

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

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

type FeatureQuery

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

FeatureQuery is the builder for querying Feature entities.

func (*FeatureQuery) Aggregate

func (fq *FeatureQuery) Aggregate(fns ...AggregateFunc) *FeatureSelect

Aggregate returns a FeatureSelect configured with the given aggregations.

func (*FeatureQuery) All

func (fq *FeatureQuery) All(ctx context.Context) ([]*Feature, error)

All executes the query and returns a list of Features.

func (*FeatureQuery) AllX

func (fq *FeatureQuery) AllX(ctx context.Context) []*Feature

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

func (*FeatureQuery) Clone

func (fq *FeatureQuery) Clone() *FeatureQuery

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

func (*FeatureQuery) Count

func (fq *FeatureQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*FeatureQuery) CountX

func (fq *FeatureQuery) CountX(ctx context.Context) int

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

func (*FeatureQuery) Exist

func (fq *FeatureQuery) Exist(ctx context.Context) (bool, error)

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

func (*FeatureQuery) ExistX

func (fq *FeatureQuery) ExistX(ctx context.Context) bool

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

func (*FeatureQuery) First

func (fq *FeatureQuery) First(ctx context.Context) (*Feature, error)

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

func (*FeatureQuery) FirstID

func (fq *FeatureQuery) FirstID(ctx context.Context) (id pgulid.ULID, err error)

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

func (*FeatureQuery) FirstIDX

func (fq *FeatureQuery) FirstIDX(ctx context.Context) pgulid.ULID

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

func (*FeatureQuery) FirstX

func (fq *FeatureQuery) FirstX(ctx context.Context) *Feature

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

func (*FeatureQuery) ForShare

func (fq *FeatureQuery) ForShare(opts ...sql.LockOption) *FeatureQuery

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 (*FeatureQuery) ForUpdate

func (fq *FeatureQuery) ForUpdate(opts ...sql.LockOption) *FeatureQuery

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 (*FeatureQuery) GroupBy

func (fq *FeatureQuery) GroupBy(field string, fields ...string) *FeatureGroupBy

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

Example:

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

client.Feature.Query().
	GroupBy(feature.FieldCreatedAt).
	Aggregate(db.Count()).
	Scan(ctx, &v)

func (*FeatureQuery) IDs

func (fq *FeatureQuery) IDs(ctx context.Context) (ids []pgulid.ULID, err error)

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

func (*FeatureQuery) IDsX

func (fq *FeatureQuery) IDsX(ctx context.Context) []pgulid.ULID

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

func (*FeatureQuery) Limit

func (fq *FeatureQuery) Limit(limit int) *FeatureQuery

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

func (*FeatureQuery) Offset

func (fq *FeatureQuery) Offset(offset int) *FeatureQuery

Offset to start from.

func (*FeatureQuery) Only

func (fq *FeatureQuery) Only(ctx context.Context) (*Feature, error)

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

func (*FeatureQuery) OnlyID

func (fq *FeatureQuery) OnlyID(ctx context.Context) (id pgulid.ULID, err error)

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

func (*FeatureQuery) OnlyIDX

func (fq *FeatureQuery) OnlyIDX(ctx context.Context) pgulid.ULID

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

func (*FeatureQuery) OnlyX

func (fq *FeatureQuery) OnlyX(ctx context.Context) *Feature

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

func (*FeatureQuery) Order

func (fq *FeatureQuery) Order(o ...feature.OrderOption) *FeatureQuery

Order specifies how the records should be ordered.

func (*FeatureQuery) QueryCreditGrants

func (fq *FeatureQuery) QueryCreditGrants() *CreditEntryQuery

QueryCreditGrants chains the current query on the "credit_grants" edge.

func (*FeatureQuery) Select

func (fq *FeatureQuery) Select(fields ...string) *FeatureSelect

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

Example:

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

client.Feature.Query().
	Select(feature.FieldCreatedAt).
	Scan(ctx, &v)

func (*FeatureQuery) Unique

func (fq *FeatureQuery) Unique(unique bool) *FeatureQuery

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

func (fq *FeatureQuery) Where(ps ...predicate.Feature) *FeatureQuery

Where adds a new predicate for the FeatureQuery builder.

func (*FeatureQuery) WithCreditGrants

func (fq *FeatureQuery) WithCreditGrants(opts ...func(*CreditEntryQuery)) *FeatureQuery

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

type FeatureSelect

type FeatureSelect struct {
	*FeatureQuery
	// contains filtered or unexported fields
}

FeatureSelect is the builder for selecting fields of Feature entities.

func (*FeatureSelect) Aggregate

func (fs *FeatureSelect) Aggregate(fns ...AggregateFunc) *FeatureSelect

Aggregate adds the given aggregation functions to the selector query.

func (*FeatureSelect) Bool

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

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

func (*FeatureSelect) BoolX

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

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

func (*FeatureSelect) Bools

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

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

func (*FeatureSelect) BoolsX

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

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

func (*FeatureSelect) Float64

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

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

func (*FeatureSelect) Float64X

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

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

func (*FeatureSelect) Float64s

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

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

func (*FeatureSelect) Float64sX

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

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

func (*FeatureSelect) Int

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

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

func (*FeatureSelect) IntX

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

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

func (*FeatureSelect) Ints

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

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

func (*FeatureSelect) IntsX

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

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

func (*FeatureSelect) Scan

func (fs *FeatureSelect) Scan(ctx context.Context, v any) error

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

func (*FeatureSelect) ScanX

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

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

func (*FeatureSelect) String

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

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

func (*FeatureSelect) StringX

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

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

func (*FeatureSelect) Strings

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

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

func (*FeatureSelect) StringsX

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

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

type FeatureUpdate

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

FeatureUpdate is the builder for updating Feature entities.

func (*FeatureUpdate) AddCreditGrantIDs

func (fu *FeatureUpdate) AddCreditGrantIDs(ids ...pgulid.ULID) *FeatureUpdate

AddCreditGrantIDs adds the "credit_grants" edge to the CreditEntry entity by IDs.

func (*FeatureUpdate) AddCreditGrants

func (fu *FeatureUpdate) AddCreditGrants(c ...*CreditEntry) *FeatureUpdate

AddCreditGrants adds the "credit_grants" edges to the CreditEntry entity.

func (*FeatureUpdate) ClearCreditGrants

func (fu *FeatureUpdate) ClearCreditGrants() *FeatureUpdate

ClearCreditGrants clears all "credit_grants" edges to the CreditEntry entity.

func (*FeatureUpdate) ClearMeterGroupByFilters

func (fu *FeatureUpdate) ClearMeterGroupByFilters() *FeatureUpdate

ClearMeterGroupByFilters clears the value of the "meter_group_by_filters" field.

func (*FeatureUpdate) Exec

func (fu *FeatureUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*FeatureUpdate) ExecX

func (fu *FeatureUpdate) ExecX(ctx context.Context)

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

func (*FeatureUpdate) Mutation

func (fu *FeatureUpdate) Mutation() *FeatureMutation

Mutation returns the FeatureMutation object of the builder.

func (*FeatureUpdate) RemoveCreditGrantIDs

func (fu *FeatureUpdate) RemoveCreditGrantIDs(ids ...pgulid.ULID) *FeatureUpdate

RemoveCreditGrantIDs removes the "credit_grants" edge to CreditEntry entities by IDs.

func (*FeatureUpdate) RemoveCreditGrants

func (fu *FeatureUpdate) RemoveCreditGrants(c ...*CreditEntry) *FeatureUpdate

RemoveCreditGrants removes "credit_grants" edges to CreditEntry entities.

func (*FeatureUpdate) Save

func (fu *FeatureUpdate) Save(ctx context.Context) (int, error)

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

func (*FeatureUpdate) SaveX

func (fu *FeatureUpdate) SaveX(ctx context.Context) int

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

func (*FeatureUpdate) SetArchived

func (fu *FeatureUpdate) SetArchived(b bool) *FeatureUpdate

SetArchived sets the "archived" field.

func (*FeatureUpdate) SetMeterGroupByFilters

func (fu *FeatureUpdate) SetMeterGroupByFilters(m map[string]string) *FeatureUpdate

SetMeterGroupByFilters sets the "meter_group_by_filters" field.

func (*FeatureUpdate) SetName

func (fu *FeatureUpdate) SetName(s string) *FeatureUpdate

SetName sets the "name" field.

func (*FeatureUpdate) SetNillableArchived

func (fu *FeatureUpdate) SetNillableArchived(b *bool) *FeatureUpdate

SetNillableArchived sets the "archived" field if the given value is not nil.

func (*FeatureUpdate) SetNillableName

func (fu *FeatureUpdate) SetNillableName(s *string) *FeatureUpdate

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

func (*FeatureUpdate) SetUpdatedAt

func (fu *FeatureUpdate) SetUpdatedAt(t time.Time) *FeatureUpdate

SetUpdatedAt sets the "updated_at" field.

func (*FeatureUpdate) Where

func (fu *FeatureUpdate) Where(ps ...predicate.Feature) *FeatureUpdate

Where appends a list predicates to the FeatureUpdate builder.

type FeatureUpdateOne

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

FeatureUpdateOne is the builder for updating a single Feature entity.

func (*FeatureUpdateOne) AddCreditGrantIDs

func (fuo *FeatureUpdateOne) AddCreditGrantIDs(ids ...pgulid.ULID) *FeatureUpdateOne

AddCreditGrantIDs adds the "credit_grants" edge to the CreditEntry entity by IDs.

func (*FeatureUpdateOne) AddCreditGrants

func (fuo *FeatureUpdateOne) AddCreditGrants(c ...*CreditEntry) *FeatureUpdateOne

AddCreditGrants adds the "credit_grants" edges to the CreditEntry entity.

func (*FeatureUpdateOne) ClearCreditGrants

func (fuo *FeatureUpdateOne) ClearCreditGrants() *FeatureUpdateOne

ClearCreditGrants clears all "credit_grants" edges to the CreditEntry entity.

func (*FeatureUpdateOne) ClearMeterGroupByFilters

func (fuo *FeatureUpdateOne) ClearMeterGroupByFilters() *FeatureUpdateOne

ClearMeterGroupByFilters clears the value of the "meter_group_by_filters" field.

func (*FeatureUpdateOne) Exec

func (fuo *FeatureUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*FeatureUpdateOne) ExecX

func (fuo *FeatureUpdateOne) ExecX(ctx context.Context)

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

func (*FeatureUpdateOne) Mutation

func (fuo *FeatureUpdateOne) Mutation() *FeatureMutation

Mutation returns the FeatureMutation object of the builder.

func (*FeatureUpdateOne) RemoveCreditGrantIDs

func (fuo *FeatureUpdateOne) RemoveCreditGrantIDs(ids ...pgulid.ULID) *FeatureUpdateOne

RemoveCreditGrantIDs removes the "credit_grants" edge to CreditEntry entities by IDs.

func (*FeatureUpdateOne) RemoveCreditGrants

func (fuo *FeatureUpdateOne) RemoveCreditGrants(c ...*CreditEntry) *FeatureUpdateOne

RemoveCreditGrants removes "credit_grants" edges to CreditEntry entities.

func (*FeatureUpdateOne) Save

func (fuo *FeatureUpdateOne) Save(ctx context.Context) (*Feature, error)

Save executes the query and returns the updated Feature entity.

func (*FeatureUpdateOne) SaveX

func (fuo *FeatureUpdateOne) SaveX(ctx context.Context) *Feature

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

func (*FeatureUpdateOne) Select

func (fuo *FeatureUpdateOne) Select(field string, fields ...string) *FeatureUpdateOne

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

func (*FeatureUpdateOne) SetArchived

func (fuo *FeatureUpdateOne) SetArchived(b bool) *FeatureUpdateOne

SetArchived sets the "archived" field.

func (*FeatureUpdateOne) SetMeterGroupByFilters

func (fuo *FeatureUpdateOne) SetMeterGroupByFilters(m map[string]string) *FeatureUpdateOne

SetMeterGroupByFilters sets the "meter_group_by_filters" field.

func (*FeatureUpdateOne) SetName

func (fuo *FeatureUpdateOne) SetName(s string) *FeatureUpdateOne

SetName sets the "name" field.

func (*FeatureUpdateOne) SetNillableArchived

func (fuo *FeatureUpdateOne) SetNillableArchived(b *bool) *FeatureUpdateOne

SetNillableArchived sets the "archived" field if the given value is not nil.

func (*FeatureUpdateOne) SetNillableName

func (fuo *FeatureUpdateOne) SetNillableName(s *string) *FeatureUpdateOne

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

func (*FeatureUpdateOne) SetUpdatedAt

func (fuo *FeatureUpdateOne) SetUpdatedAt(t time.Time) *FeatureUpdateOne

SetUpdatedAt sets the "updated_at" field.

func (*FeatureUpdateOne) Where

Where appends a list predicates to the FeatureUpdate builder.

type FeatureUpsert

type FeatureUpsert struct {
	*sql.UpdateSet
}

FeatureUpsert is the "OnConflict" setter.

func (*FeatureUpsert) ClearMeterGroupByFilters

func (u *FeatureUpsert) ClearMeterGroupByFilters() *FeatureUpsert

ClearMeterGroupByFilters clears the value of the "meter_group_by_filters" field.

func (*FeatureUpsert) SetArchived

func (u *FeatureUpsert) SetArchived(v bool) *FeatureUpsert

SetArchived sets the "archived" field.

func (*FeatureUpsert) SetMeterGroupByFilters

func (u *FeatureUpsert) SetMeterGroupByFilters(v map[string]string) *FeatureUpsert

SetMeterGroupByFilters sets the "meter_group_by_filters" field.

func (*FeatureUpsert) SetName

func (u *FeatureUpsert) SetName(v string) *FeatureUpsert

SetName sets the "name" field.

func (*FeatureUpsert) SetUpdatedAt

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

SetUpdatedAt sets the "updated_at" field.

func (*FeatureUpsert) UpdateArchived

func (u *FeatureUpsert) UpdateArchived() *FeatureUpsert

UpdateArchived sets the "archived" field to the value that was provided on create.

func (*FeatureUpsert) UpdateMeterGroupByFilters

func (u *FeatureUpsert) UpdateMeterGroupByFilters() *FeatureUpsert

UpdateMeterGroupByFilters sets the "meter_group_by_filters" field to the value that was provided on create.

func (*FeatureUpsert) UpdateName

func (u *FeatureUpsert) UpdateName() *FeatureUpsert

UpdateName sets the "name" field to the value that was provided on create.

func (*FeatureUpsert) UpdateUpdatedAt

func (u *FeatureUpsert) UpdateUpdatedAt() *FeatureUpsert

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

type FeatureUpsertBulk

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

FeatureUpsertBulk is the builder for "upsert"-ing a bulk of Feature nodes.

func (*FeatureUpsertBulk) ClearMeterGroupByFilters

func (u *FeatureUpsertBulk) ClearMeterGroupByFilters() *FeatureUpsertBulk

ClearMeterGroupByFilters clears the value of the "meter_group_by_filters" field.

func (*FeatureUpsertBulk) DoNothing

func (u *FeatureUpsertBulk) DoNothing() *FeatureUpsertBulk

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

func (*FeatureUpsertBulk) Exec

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

Exec executes the query.

func (*FeatureUpsertBulk) ExecX

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

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

func (*FeatureUpsertBulk) Ignore

func (u *FeatureUpsertBulk) Ignore() *FeatureUpsertBulk

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

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

func (*FeatureUpsertBulk) SetArchived

func (u *FeatureUpsertBulk) SetArchived(v bool) *FeatureUpsertBulk

SetArchived sets the "archived" field.

func (*FeatureUpsertBulk) SetMeterGroupByFilters

func (u *FeatureUpsertBulk) SetMeterGroupByFilters(v map[string]string) *FeatureUpsertBulk

SetMeterGroupByFilters sets the "meter_group_by_filters" field.

func (*FeatureUpsertBulk) SetName

SetName sets the "name" field.

func (*FeatureUpsertBulk) SetUpdatedAt

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

SetUpdatedAt sets the "updated_at" field.

func (*FeatureUpsertBulk) Update

func (u *FeatureUpsertBulk) Update(set func(*FeatureUpsert)) *FeatureUpsertBulk

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

func (*FeatureUpsertBulk) UpdateArchived

func (u *FeatureUpsertBulk) UpdateArchived() *FeatureUpsertBulk

UpdateArchived sets the "archived" field to the value that was provided on create.

func (*FeatureUpsertBulk) UpdateMeterGroupByFilters

func (u *FeatureUpsertBulk) UpdateMeterGroupByFilters() *FeatureUpsertBulk

UpdateMeterGroupByFilters sets the "meter_group_by_filters" field to the value that was provided on create.

func (*FeatureUpsertBulk) UpdateName

func (u *FeatureUpsertBulk) UpdateName() *FeatureUpsertBulk

UpdateName sets the "name" field to the value that was provided on create.

func (*FeatureUpsertBulk) UpdateNewValues

func (u *FeatureUpsertBulk) UpdateNewValues() *FeatureUpsertBulk

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

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

func (*FeatureUpsertBulk) UpdateUpdatedAt

func (u *FeatureUpsertBulk) UpdateUpdatedAt() *FeatureUpsertBulk

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

type FeatureUpsertOne

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

FeatureUpsertOne is the builder for "upsert"-ing

one Feature node.

func (*FeatureUpsertOne) ClearMeterGroupByFilters

func (u *FeatureUpsertOne) ClearMeterGroupByFilters() *FeatureUpsertOne

ClearMeterGroupByFilters clears the value of the "meter_group_by_filters" field.

func (*FeatureUpsertOne) DoNothing

func (u *FeatureUpsertOne) DoNothing() *FeatureUpsertOne

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

func (*FeatureUpsertOne) Exec

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

Exec executes the query.

func (*FeatureUpsertOne) ExecX

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

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

func (*FeatureUpsertOne) ID

func (u *FeatureUpsertOne) ID(ctx context.Context) (id pgulid.ULID, err error)

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

func (*FeatureUpsertOne) IDX

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

func (*FeatureUpsertOne) Ignore

func (u *FeatureUpsertOne) Ignore() *FeatureUpsertOne

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

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

func (*FeatureUpsertOne) SetArchived

func (u *FeatureUpsertOne) SetArchived(v bool) *FeatureUpsertOne

SetArchived sets the "archived" field.

func (*FeatureUpsertOne) SetMeterGroupByFilters

func (u *FeatureUpsertOne) SetMeterGroupByFilters(v map[string]string) *FeatureUpsertOne

SetMeterGroupByFilters sets the "meter_group_by_filters" field.

func (*FeatureUpsertOne) SetName

func (u *FeatureUpsertOne) SetName(v string) *FeatureUpsertOne

SetName sets the "name" field.

func (*FeatureUpsertOne) SetUpdatedAt

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

SetUpdatedAt sets the "updated_at" field.

func (*FeatureUpsertOne) Update

func (u *FeatureUpsertOne) Update(set func(*FeatureUpsert)) *FeatureUpsertOne

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

func (*FeatureUpsertOne) UpdateArchived

func (u *FeatureUpsertOne) UpdateArchived() *FeatureUpsertOne

UpdateArchived sets the "archived" field to the value that was provided on create.

func (*FeatureUpsertOne) UpdateMeterGroupByFilters

func (u *FeatureUpsertOne) UpdateMeterGroupByFilters() *FeatureUpsertOne

UpdateMeterGroupByFilters sets the "meter_group_by_filters" field to the value that was provided on create.

func (*FeatureUpsertOne) UpdateName

func (u *FeatureUpsertOne) UpdateName() *FeatureUpsertOne

UpdateName sets the "name" field to the value that was provided on create.

func (*FeatureUpsertOne) UpdateNewValues

func (u *FeatureUpsertOne) UpdateNewValues() *FeatureUpsertOne

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.Feature.Create().
	OnConflict(
		sql.ResolveWithNewValues(),
		sql.ResolveWith(func(u *sql.UpdateSet) {
			u.SetIgnore(feature.FieldID)
		}),
	).
	Exec(ctx)

func (*FeatureUpsertOne) UpdateUpdatedAt

func (u *FeatureUpsertOne) UpdateUpdatedAt() *FeatureUpsertOne

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

type Features

type Features []*Feature

Features is a parsable slice of Feature.

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 Ledger

type Ledger struct {

	// ID of the ent.
	ID pgulid.ULID `json:"id,omitempty"`
	// CreatedAt holds the value of the "created_at" field.
	CreatedAt time.Time `json:"created_at,omitempty"`
	// UpdatedAt holds the value of the "updated_at" field.
	UpdatedAt time.Time `json:"updated_at,omitempty"`
	// Namespace holds the value of the "namespace" field.
	Namespace string `json:"namespace,omitempty"`
	// Subject holds the value of the "subject" field.
	Subject string `json:"subject,omitempty"`
	// Metadata holds the value of the "metadata" field.
	Metadata map[string]string `json:"metadata,omitempty"`
	// Highwatermark holds the value of the "highwatermark" field.
	Highwatermark time.Time `json:"highwatermark,omitempty"`
	// contains filtered or unexported fields
}

Ledger is the model entity for the Ledger schema.

func (*Ledger) String

func (l *Ledger) String() string

String implements the fmt.Stringer.

func (*Ledger) Unwrap

func (l *Ledger) Unwrap() *Ledger

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

func (l *Ledger) Update() *LedgerUpdateOne

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

func (*Ledger) Value

func (l *Ledger) Value(name string) (ent.Value, error)

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

type LedgerClient

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

LedgerClient is a client for the Ledger schema.

func NewLedgerClient

func NewLedgerClient(c config) *LedgerClient

NewLedgerClient returns a client for the Ledger from the given config.

func (*LedgerClient) Create

func (c *LedgerClient) Create() *LedgerCreate

Create returns a builder for creating a Ledger entity.

func (*LedgerClient) CreateBulk

func (c *LedgerClient) CreateBulk(builders ...*LedgerCreate) *LedgerCreateBulk

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

func (*LedgerClient) Delete

func (c *LedgerClient) Delete() *LedgerDelete

Delete returns a delete builder for Ledger.

func (*LedgerClient) DeleteOne

func (c *LedgerClient) DeleteOne(l *Ledger) *LedgerDeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*LedgerClient) DeleteOneID

func (c *LedgerClient) DeleteOneID(id pgulid.ULID) *LedgerDeleteOne

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

func (*LedgerClient) Get

func (c *LedgerClient) Get(ctx context.Context, id pgulid.ULID) (*Ledger, error)

Get returns a Ledger entity by its id.

func (*LedgerClient) GetX

func (c *LedgerClient) GetX(ctx context.Context, id pgulid.ULID) *Ledger

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

func (*LedgerClient) Hooks

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

Hooks returns the client hooks.

func (*LedgerClient) Intercept

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

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

func (*LedgerClient) Interceptors

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

Interceptors returns the client interceptors.

func (*LedgerClient) MapCreateBulk

func (c *LedgerClient) MapCreateBulk(slice any, setFunc func(*LedgerCreate, int)) *LedgerCreateBulk

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

func (c *LedgerClient) Query() *LedgerQuery

Query returns a query builder for Ledger.

func (*LedgerClient) Update

func (c *LedgerClient) Update() *LedgerUpdate

Update returns an update builder for Ledger.

func (*LedgerClient) UpdateOne

func (c *LedgerClient) UpdateOne(l *Ledger) *LedgerUpdateOne

UpdateOne returns an update builder for the given entity.

func (*LedgerClient) UpdateOneID

func (c *LedgerClient) UpdateOneID(id pgulid.ULID) *LedgerUpdateOne

UpdateOneID returns an update builder for the given id.

func (*LedgerClient) Use

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

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

type LedgerCreate

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

LedgerCreate is the builder for creating a Ledger entity.

func (*LedgerCreate) Exec

func (lc *LedgerCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*LedgerCreate) ExecX

func (lc *LedgerCreate) ExecX(ctx context.Context)

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

func (*LedgerCreate) Mutation

func (lc *LedgerCreate) Mutation() *LedgerMutation

Mutation returns the LedgerMutation object of the builder.

func (*LedgerCreate) OnConflict

func (lc *LedgerCreate) OnConflict(opts ...sql.ConflictOption) *LedgerUpsertOne

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

client.Ledger.Create().
	SetCreatedAt(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.LedgerUpsert) {
		SetCreatedAt(v+v).
	}).
	Exec(ctx)

func (*LedgerCreate) OnConflictColumns

func (lc *LedgerCreate) OnConflictColumns(columns ...string) *LedgerUpsertOne

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

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

func (*LedgerCreate) Save

func (lc *LedgerCreate) Save(ctx context.Context) (*Ledger, error)

Save creates the Ledger in the database.

func (*LedgerCreate) SaveX

func (lc *LedgerCreate) SaveX(ctx context.Context) *Ledger

SaveX calls Save and panics if Save returns an error.

func (*LedgerCreate) SetCreatedAt

func (lc *LedgerCreate) SetCreatedAt(t time.Time) *LedgerCreate

SetCreatedAt sets the "created_at" field.

func (*LedgerCreate) SetHighwatermark

func (lc *LedgerCreate) SetHighwatermark(t time.Time) *LedgerCreate

SetHighwatermark sets the "highwatermark" field.

func (*LedgerCreate) SetID

func (lc *LedgerCreate) SetID(pg pgulid.ULID) *LedgerCreate

SetID sets the "id" field.

func (*LedgerCreate) SetMetadata

func (lc *LedgerCreate) SetMetadata(m map[string]string) *LedgerCreate

SetMetadata sets the "metadata" field.

func (*LedgerCreate) SetNamespace

func (lc *LedgerCreate) SetNamespace(s string) *LedgerCreate

SetNamespace sets the "namespace" field.

func (*LedgerCreate) SetNillableCreatedAt

func (lc *LedgerCreate) SetNillableCreatedAt(t *time.Time) *LedgerCreate

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

func (*LedgerCreate) SetNillableHighwatermark

func (lc *LedgerCreate) SetNillableHighwatermark(t *time.Time) *LedgerCreate

SetNillableHighwatermark sets the "highwatermark" field if the given value is not nil.

func (*LedgerCreate) SetNillableID

func (lc *LedgerCreate) SetNillableID(pg *pgulid.ULID) *LedgerCreate

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

func (*LedgerCreate) SetNillableUpdatedAt

func (lc *LedgerCreate) SetNillableUpdatedAt(t *time.Time) *LedgerCreate

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

func (*LedgerCreate) SetSubject

func (lc *LedgerCreate) SetSubject(s string) *LedgerCreate

SetSubject sets the "subject" field.

func (*LedgerCreate) SetUpdatedAt

func (lc *LedgerCreate) SetUpdatedAt(t time.Time) *LedgerCreate

SetUpdatedAt sets the "updated_at" field.

type LedgerCreateBulk

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

LedgerCreateBulk is the builder for creating many Ledger entities in bulk.

func (*LedgerCreateBulk) Exec

func (lcb *LedgerCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*LedgerCreateBulk) ExecX

func (lcb *LedgerCreateBulk) ExecX(ctx context.Context)

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

func (*LedgerCreateBulk) OnConflict

func (lcb *LedgerCreateBulk) OnConflict(opts ...sql.ConflictOption) *LedgerUpsertBulk

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

client.Ledger.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.LedgerUpsert) {
		SetCreatedAt(v+v).
	}).
	Exec(ctx)

func (*LedgerCreateBulk) OnConflictColumns

func (lcb *LedgerCreateBulk) OnConflictColumns(columns ...string) *LedgerUpsertBulk

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

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

func (*LedgerCreateBulk) Save

func (lcb *LedgerCreateBulk) Save(ctx context.Context) ([]*Ledger, error)

Save creates the Ledger entities in the database.

func (*LedgerCreateBulk) SaveX

func (lcb *LedgerCreateBulk) SaveX(ctx context.Context) []*Ledger

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

type LedgerDelete

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

LedgerDelete is the builder for deleting a Ledger entity.

func (*LedgerDelete) Exec

func (ld *LedgerDelete) Exec(ctx context.Context) (int, error)

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

func (*LedgerDelete) ExecX

func (ld *LedgerDelete) ExecX(ctx context.Context) int

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

func (*LedgerDelete) Where

func (ld *LedgerDelete) Where(ps ...predicate.Ledger) *LedgerDelete

Where appends a list predicates to the LedgerDelete builder.

type LedgerDeleteOne

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

LedgerDeleteOne is the builder for deleting a single Ledger entity.

func (*LedgerDeleteOne) Exec

func (ldo *LedgerDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*LedgerDeleteOne) ExecX

func (ldo *LedgerDeleteOne) ExecX(ctx context.Context)

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

func (*LedgerDeleteOne) Where

func (ldo *LedgerDeleteOne) Where(ps ...predicate.Ledger) *LedgerDeleteOne

Where appends a list predicates to the LedgerDelete builder.

type LedgerGroupBy

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

LedgerGroupBy is the group-by builder for Ledger entities.

func (*LedgerGroupBy) Aggregate

func (lgb *LedgerGroupBy) Aggregate(fns ...AggregateFunc) *LedgerGroupBy

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

func (*LedgerGroupBy) Bool

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

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

func (*LedgerGroupBy) BoolX

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

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

func (*LedgerGroupBy) Bools

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

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

func (*LedgerGroupBy) BoolsX

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

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

func (*LedgerGroupBy) Float64

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

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

func (*LedgerGroupBy) Float64X

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

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

func (*LedgerGroupBy) Float64s

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

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

func (*LedgerGroupBy) Float64sX

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

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

func (*LedgerGroupBy) Int

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

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

func (*LedgerGroupBy) IntX

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

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

func (*LedgerGroupBy) Ints

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

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

func (*LedgerGroupBy) IntsX

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

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

func (*LedgerGroupBy) Scan

func (lgb *LedgerGroupBy) Scan(ctx context.Context, v any) error

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

func (*LedgerGroupBy) ScanX

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

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

func (*LedgerGroupBy) String

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

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

func (*LedgerGroupBy) StringX

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

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

func (*LedgerGroupBy) Strings

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

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

func (*LedgerGroupBy) StringsX

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

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

type LedgerMutation

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

LedgerMutation represents an operation that mutates the Ledger nodes in the graph.

func (*LedgerMutation) AddField

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

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

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

func (*LedgerMutation) AddedField

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

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

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

func (*LedgerMutation) AddedIDs

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

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

func (*LedgerMutation) ClearEdge

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

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

func (m *LedgerMutation) ClearMetadata()

ClearMetadata clears the value of the "metadata" field.

func (*LedgerMutation) ClearedEdges

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

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

func (*LedgerMutation) ClearedFields

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

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

func (LedgerMutation) Client

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

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

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

func (*LedgerMutation) EdgeCleared

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

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

func (*LedgerMutation) Field

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

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

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

func (*LedgerMutation) Fields

func (m *LedgerMutation) 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 (*LedgerMutation) Highwatermark

func (m *LedgerMutation) Highwatermark() (r time.Time, exists bool)

Highwatermark returns the value of the "highwatermark" field in the mutation.

func (*LedgerMutation) ID

func (m *LedgerMutation) ID() (id pgulid.ULID, 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 (*LedgerMutation) IDs

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

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

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

func (*LedgerMutation) MetadataCleared

func (m *LedgerMutation) MetadataCleared() bool

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

func (*LedgerMutation) Namespace

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

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

func (*LedgerMutation) OldCreatedAt

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

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

func (m *LedgerMutation) 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 (*LedgerMutation) OldHighwatermark

func (m *LedgerMutation) OldHighwatermark(ctx context.Context) (v time.Time, err error)

OldHighwatermark returns the old "highwatermark" field's value of the Ledger entity. If the Ledger 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 (*LedgerMutation) OldMetadata

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

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

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

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

func (m *LedgerMutation) OldSubject(ctx context.Context) (v string, err error)

OldSubject returns the old "subject" field's value of the Ledger entity. If the Ledger 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 (*LedgerMutation) OldUpdatedAt

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

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

func (m *LedgerMutation) Op() Op

Op returns the operation name.

func (*LedgerMutation) RemovedEdges

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

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

func (*LedgerMutation) RemovedIDs

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

func (m *LedgerMutation) ResetCreatedAt()

ResetCreatedAt resets all changes to the "created_at" field.

func (*LedgerMutation) ResetEdge

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

func (m *LedgerMutation) 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 (*LedgerMutation) ResetHighwatermark

func (m *LedgerMutation) ResetHighwatermark()

ResetHighwatermark resets all changes to the "highwatermark" field.

func (*LedgerMutation) ResetMetadata

func (m *LedgerMutation) ResetMetadata()

ResetMetadata resets all changes to the "metadata" field.

func (*LedgerMutation) ResetNamespace

func (m *LedgerMutation) ResetNamespace()

ResetNamespace resets all changes to the "namespace" field.

func (*LedgerMutation) ResetSubject

func (m *LedgerMutation) ResetSubject()

ResetSubject resets all changes to the "subject" field.

func (*LedgerMutation) ResetUpdatedAt

func (m *LedgerMutation) ResetUpdatedAt()

ResetUpdatedAt resets all changes to the "updated_at" field.

func (*LedgerMutation) SetCreatedAt

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

SetCreatedAt sets the "created_at" field.

func (*LedgerMutation) SetField

func (m *LedgerMutation) 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 (*LedgerMutation) SetHighwatermark

func (m *LedgerMutation) SetHighwatermark(t time.Time)

SetHighwatermark sets the "highwatermark" field.

func (*LedgerMutation) SetID

func (m *LedgerMutation) SetID(id pgulid.ULID)

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

func (*LedgerMutation) SetMetadata

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

SetMetadata sets the "metadata" field.

func (*LedgerMutation) SetNamespace

func (m *LedgerMutation) SetNamespace(s string)

SetNamespace sets the "namespace" field.

func (*LedgerMutation) SetOp

func (m *LedgerMutation) SetOp(op Op)

SetOp allows setting the mutation operation.

func (*LedgerMutation) SetSubject

func (m *LedgerMutation) SetSubject(s string)

SetSubject sets the "subject" field.

func (*LedgerMutation) SetUpdatedAt

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

SetUpdatedAt sets the "updated_at" field.

func (*LedgerMutation) Subject

func (m *LedgerMutation) Subject() (r string, exists bool)

Subject returns the value of the "subject" field in the mutation.

func (LedgerMutation) Tx

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

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

func (*LedgerMutation) Type

func (m *LedgerMutation) Type() string

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

func (*LedgerMutation) UpdatedAt

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

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

func (*LedgerMutation) Where

func (m *LedgerMutation) Where(ps ...predicate.Ledger)

Where appends a list predicates to the LedgerMutation builder.

func (*LedgerMutation) WhereP

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

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

type LedgerQuery

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

LedgerQuery is the builder for querying Ledger entities.

func (*LedgerQuery) Aggregate

func (lq *LedgerQuery) Aggregate(fns ...AggregateFunc) *LedgerSelect

Aggregate returns a LedgerSelect configured with the given aggregations.

func (*LedgerQuery) All

func (lq *LedgerQuery) All(ctx context.Context) ([]*Ledger, error)

All executes the query and returns a list of Ledgers.

func (*LedgerQuery) AllX

func (lq *LedgerQuery) AllX(ctx context.Context) []*Ledger

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

func (*LedgerQuery) Clone

func (lq *LedgerQuery) Clone() *LedgerQuery

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

func (*LedgerQuery) Count

func (lq *LedgerQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*LedgerQuery) CountX

func (lq *LedgerQuery) CountX(ctx context.Context) int

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

func (*LedgerQuery) Exist

func (lq *LedgerQuery) Exist(ctx context.Context) (bool, error)

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

func (*LedgerQuery) ExistX

func (lq *LedgerQuery) ExistX(ctx context.Context) bool

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

func (*LedgerQuery) First

func (lq *LedgerQuery) First(ctx context.Context) (*Ledger, error)

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

func (*LedgerQuery) FirstID

func (lq *LedgerQuery) FirstID(ctx context.Context) (id pgulid.ULID, err error)

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

func (*LedgerQuery) FirstIDX

func (lq *LedgerQuery) FirstIDX(ctx context.Context) pgulid.ULID

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

func (*LedgerQuery) FirstX

func (lq *LedgerQuery) FirstX(ctx context.Context) *Ledger

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

func (*LedgerQuery) ForShare

func (lq *LedgerQuery) ForShare(opts ...sql.LockOption) *LedgerQuery

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 (*LedgerQuery) ForUpdate

func (lq *LedgerQuery) ForUpdate(opts ...sql.LockOption) *LedgerQuery

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 (*LedgerQuery) GroupBy

func (lq *LedgerQuery) GroupBy(field string, fields ...string) *LedgerGroupBy

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

Example:

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

client.Ledger.Query().
	GroupBy(ledger.FieldCreatedAt).
	Aggregate(db.Count()).
	Scan(ctx, &v)

func (*LedgerQuery) IDs

func (lq *LedgerQuery) IDs(ctx context.Context) (ids []pgulid.ULID, err error)

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

func (*LedgerQuery) IDsX

func (lq *LedgerQuery) IDsX(ctx context.Context) []pgulid.ULID

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

func (*LedgerQuery) Limit

func (lq *LedgerQuery) Limit(limit int) *LedgerQuery

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

func (*LedgerQuery) Offset

func (lq *LedgerQuery) Offset(offset int) *LedgerQuery

Offset to start from.

func (*LedgerQuery) Only

func (lq *LedgerQuery) Only(ctx context.Context) (*Ledger, error)

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

func (*LedgerQuery) OnlyID

func (lq *LedgerQuery) OnlyID(ctx context.Context) (id pgulid.ULID, err error)

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

func (*LedgerQuery) OnlyIDX

func (lq *LedgerQuery) OnlyIDX(ctx context.Context) pgulid.ULID

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

func (*LedgerQuery) OnlyX

func (lq *LedgerQuery) OnlyX(ctx context.Context) *Ledger

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

func (*LedgerQuery) Order

func (lq *LedgerQuery) Order(o ...ledger.OrderOption) *LedgerQuery

Order specifies how the records should be ordered.

func (*LedgerQuery) Select

func (lq *LedgerQuery) Select(fields ...string) *LedgerSelect

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

Example:

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

client.Ledger.Query().
	Select(ledger.FieldCreatedAt).
	Scan(ctx, &v)

func (*LedgerQuery) Unique

func (lq *LedgerQuery) Unique(unique bool) *LedgerQuery

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

func (lq *LedgerQuery) Where(ps ...predicate.Ledger) *LedgerQuery

Where adds a new predicate for the LedgerQuery builder.

type LedgerSelect

type LedgerSelect struct {
	*LedgerQuery
	// contains filtered or unexported fields
}

LedgerSelect is the builder for selecting fields of Ledger entities.

func (*LedgerSelect) Aggregate

func (ls *LedgerSelect) Aggregate(fns ...AggregateFunc) *LedgerSelect

Aggregate adds the given aggregation functions to the selector query.

func (*LedgerSelect) Bool

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

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

func (*LedgerSelect) BoolX

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

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

func (*LedgerSelect) Bools

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

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

func (*LedgerSelect) BoolsX

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

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

func (*LedgerSelect) Float64

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

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

func (*LedgerSelect) Float64X

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

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

func (*LedgerSelect) Float64s

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

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

func (*LedgerSelect) Float64sX

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

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

func (*LedgerSelect) Int

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

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

func (*LedgerSelect) IntX

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

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

func (*LedgerSelect) Ints

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

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

func (*LedgerSelect) IntsX

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

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

func (*LedgerSelect) Scan

func (ls *LedgerSelect) Scan(ctx context.Context, v any) error

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

func (*LedgerSelect) ScanX

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

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

func (*LedgerSelect) String

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

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

func (*LedgerSelect) StringX

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

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

func (*LedgerSelect) Strings

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

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

func (*LedgerSelect) StringsX

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

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

type LedgerUpdate

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

LedgerUpdate is the builder for updating Ledger entities.

func (*LedgerUpdate) ClearMetadata

func (lu *LedgerUpdate) ClearMetadata() *LedgerUpdate

ClearMetadata clears the value of the "metadata" field.

func (*LedgerUpdate) Exec

func (lu *LedgerUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*LedgerUpdate) ExecX

func (lu *LedgerUpdate) ExecX(ctx context.Context)

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

func (*LedgerUpdate) Mutation

func (lu *LedgerUpdate) Mutation() *LedgerMutation

Mutation returns the LedgerMutation object of the builder.

func (*LedgerUpdate) Save

func (lu *LedgerUpdate) Save(ctx context.Context) (int, error)

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

func (*LedgerUpdate) SaveX

func (lu *LedgerUpdate) SaveX(ctx context.Context) int

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

func (*LedgerUpdate) SetHighwatermark

func (lu *LedgerUpdate) SetHighwatermark(t time.Time) *LedgerUpdate

SetHighwatermark sets the "highwatermark" field.

func (*LedgerUpdate) SetMetadata

func (lu *LedgerUpdate) SetMetadata(m map[string]string) *LedgerUpdate

SetMetadata sets the "metadata" field.

func (*LedgerUpdate) SetNillableHighwatermark

func (lu *LedgerUpdate) SetNillableHighwatermark(t *time.Time) *LedgerUpdate

SetNillableHighwatermark sets the "highwatermark" field if the given value is not nil.

func (*LedgerUpdate) SetUpdatedAt

func (lu *LedgerUpdate) SetUpdatedAt(t time.Time) *LedgerUpdate

SetUpdatedAt sets the "updated_at" field.

func (*LedgerUpdate) Where

func (lu *LedgerUpdate) Where(ps ...predicate.Ledger) *LedgerUpdate

Where appends a list predicates to the LedgerUpdate builder.

type LedgerUpdateOne

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

LedgerUpdateOne is the builder for updating a single Ledger entity.

func (*LedgerUpdateOne) ClearMetadata

func (luo *LedgerUpdateOne) ClearMetadata() *LedgerUpdateOne

ClearMetadata clears the value of the "metadata" field.

func (*LedgerUpdateOne) Exec

func (luo *LedgerUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*LedgerUpdateOne) ExecX

func (luo *LedgerUpdateOne) ExecX(ctx context.Context)

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

func (*LedgerUpdateOne) Mutation

func (luo *LedgerUpdateOne) Mutation() *LedgerMutation

Mutation returns the LedgerMutation object of the builder.

func (*LedgerUpdateOne) Save

func (luo *LedgerUpdateOne) Save(ctx context.Context) (*Ledger, error)

Save executes the query and returns the updated Ledger entity.

func (*LedgerUpdateOne) SaveX

func (luo *LedgerUpdateOne) SaveX(ctx context.Context) *Ledger

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

func (*LedgerUpdateOne) Select

func (luo *LedgerUpdateOne) Select(field string, fields ...string) *LedgerUpdateOne

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

func (*LedgerUpdateOne) SetHighwatermark

func (luo *LedgerUpdateOne) SetHighwatermark(t time.Time) *LedgerUpdateOne

SetHighwatermark sets the "highwatermark" field.

func (*LedgerUpdateOne) SetMetadata

func (luo *LedgerUpdateOne) SetMetadata(m map[string]string) *LedgerUpdateOne

SetMetadata sets the "metadata" field.

func (*LedgerUpdateOne) SetNillableHighwatermark

func (luo *LedgerUpdateOne) SetNillableHighwatermark(t *time.Time) *LedgerUpdateOne

SetNillableHighwatermark sets the "highwatermark" field if the given value is not nil.

func (*LedgerUpdateOne) SetUpdatedAt

func (luo *LedgerUpdateOne) SetUpdatedAt(t time.Time) *LedgerUpdateOne

SetUpdatedAt sets the "updated_at" field.

func (*LedgerUpdateOne) Where

func (luo *LedgerUpdateOne) Where(ps ...predicate.Ledger) *LedgerUpdateOne

Where appends a list predicates to the LedgerUpdate builder.

type LedgerUpsert

type LedgerUpsert struct {
	*sql.UpdateSet
}

LedgerUpsert is the "OnConflict" setter.

func (*LedgerUpsert) ClearMetadata

func (u *LedgerUpsert) ClearMetadata() *LedgerUpsert

ClearMetadata clears the value of the "metadata" field.

func (*LedgerUpsert) SetHighwatermark

func (u *LedgerUpsert) SetHighwatermark(v time.Time) *LedgerUpsert

SetHighwatermark sets the "highwatermark" field.

func (*LedgerUpsert) SetMetadata

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

SetMetadata sets the "metadata" field.

func (*LedgerUpsert) SetUpdatedAt

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

SetUpdatedAt sets the "updated_at" field.

func (*LedgerUpsert) UpdateHighwatermark

func (u *LedgerUpsert) UpdateHighwatermark() *LedgerUpsert

UpdateHighwatermark sets the "highwatermark" field to the value that was provided on create.

func (*LedgerUpsert) UpdateMetadata

func (u *LedgerUpsert) UpdateMetadata() *LedgerUpsert

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

func (*LedgerUpsert) UpdateUpdatedAt

func (u *LedgerUpsert) UpdateUpdatedAt() *LedgerUpsert

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

type LedgerUpsertBulk

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

LedgerUpsertBulk is the builder for "upsert"-ing a bulk of Ledger nodes.

func (*LedgerUpsertBulk) ClearMetadata

func (u *LedgerUpsertBulk) ClearMetadata() *LedgerUpsertBulk

ClearMetadata clears the value of the "metadata" field.

func (*LedgerUpsertBulk) DoNothing

func (u *LedgerUpsertBulk) DoNothing() *LedgerUpsertBulk

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

func (*LedgerUpsertBulk) Exec

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

Exec executes the query.

func (*LedgerUpsertBulk) ExecX

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

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

func (*LedgerUpsertBulk) Ignore

func (u *LedgerUpsertBulk) Ignore() *LedgerUpsertBulk

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

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

func (*LedgerUpsertBulk) SetHighwatermark

func (u *LedgerUpsertBulk) SetHighwatermark(v time.Time) *LedgerUpsertBulk

SetHighwatermark sets the "highwatermark" field.

func (*LedgerUpsertBulk) SetMetadata

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

SetMetadata sets the "metadata" field.

func (*LedgerUpsertBulk) SetUpdatedAt

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

SetUpdatedAt sets the "updated_at" field.

func (*LedgerUpsertBulk) Update

func (u *LedgerUpsertBulk) Update(set func(*LedgerUpsert)) *LedgerUpsertBulk

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

func (*LedgerUpsertBulk) UpdateHighwatermark

func (u *LedgerUpsertBulk) UpdateHighwatermark() *LedgerUpsertBulk

UpdateHighwatermark sets the "highwatermark" field to the value that was provided on create.

func (*LedgerUpsertBulk) UpdateMetadata

func (u *LedgerUpsertBulk) UpdateMetadata() *LedgerUpsertBulk

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

func (*LedgerUpsertBulk) UpdateNewValues

func (u *LedgerUpsertBulk) UpdateNewValues() *LedgerUpsertBulk

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

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

func (*LedgerUpsertBulk) UpdateUpdatedAt

func (u *LedgerUpsertBulk) UpdateUpdatedAt() *LedgerUpsertBulk

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

type LedgerUpsertOne

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

LedgerUpsertOne is the builder for "upsert"-ing

one Ledger node.

func (*LedgerUpsertOne) ClearMetadata

func (u *LedgerUpsertOne) ClearMetadata() *LedgerUpsertOne

ClearMetadata clears the value of the "metadata" field.

func (*LedgerUpsertOne) DoNothing

func (u *LedgerUpsertOne) DoNothing() *LedgerUpsertOne

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

func (*LedgerUpsertOne) Exec

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

Exec executes the query.

func (*LedgerUpsertOne) ExecX

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

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

func (*LedgerUpsertOne) ID

func (u *LedgerUpsertOne) ID(ctx context.Context) (id pgulid.ULID, err error)

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

func (*LedgerUpsertOne) IDX

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

func (*LedgerUpsertOne) Ignore

func (u *LedgerUpsertOne) Ignore() *LedgerUpsertOne

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

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

func (*LedgerUpsertOne) SetHighwatermark

func (u *LedgerUpsertOne) SetHighwatermark(v time.Time) *LedgerUpsertOne

SetHighwatermark sets the "highwatermark" field.

func (*LedgerUpsertOne) SetMetadata

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

SetMetadata sets the "metadata" field.

func (*LedgerUpsertOne) SetUpdatedAt

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

SetUpdatedAt sets the "updated_at" field.

func (*LedgerUpsertOne) Update

func (u *LedgerUpsertOne) Update(set func(*LedgerUpsert)) *LedgerUpsertOne

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

func (*LedgerUpsertOne) UpdateHighwatermark

func (u *LedgerUpsertOne) UpdateHighwatermark() *LedgerUpsertOne

UpdateHighwatermark sets the "highwatermark" field to the value that was provided on create.

func (*LedgerUpsertOne) UpdateMetadata

func (u *LedgerUpsertOne) UpdateMetadata() *LedgerUpsertOne

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

func (*LedgerUpsertOne) UpdateNewValues

func (u *LedgerUpsertOne) UpdateNewValues() *LedgerUpsertOne

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.Ledger.Create().
	OnConflict(
		sql.ResolveWithNewValues(),
		sql.ResolveWith(func(u *sql.UpdateSet) {
			u.SetIgnore(ledger.FieldID)
		}),
	).
	Exec(ctx)

func (*LedgerUpsertOne) UpdateUpdatedAt

func (u *LedgerUpsertOne) UpdateUpdatedAt() *LedgerUpsertOne

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

type Ledgers

type Ledgers []*Ledger

Ledgers is a parsable slice of Ledger.

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 {

	// CreditEntry is the client for interacting with the CreditEntry builders.
	CreditEntry *CreditEntryClient
	// Feature is the client for interacting with the Feature builders.
	Feature *FeatureClient
	// Ledger is the client for interacting with the Ledger builders.
	Ledger *LedgerClient
	// contains filtered or unexported fields
}

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

func TxFromContext

func TxFromContext(ctx context.Context) *Tx

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

func (*Tx) Client

func (tx *Tx) Client() *Client

Client returns a Client that binds to current transaction.

func (*Tx) Commit

func (tx *Tx) Commit() error

Commit commits the transaction.

func (*Tx) OnCommit

func (tx *Tx) OnCommit(f CommitHook)

OnCommit adds a hook to call on commit.

func (*Tx) OnRollback

func (tx *Tx) OnRollback(f RollbackHook)

OnRollback adds a hook to call on rollback.

func (*Tx) Rollback

func (tx *Tx) Rollback() error

Rollback rollbacks the transaction.

type ValidationError

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

ValidationError returns when validating a field or edge fails.

func (*ValidationError) Error

func (e *ValidationError) Error() string

Error implements the error interface.

func (*ValidationError) Unwrap

func (e *ValidationError) Unwrap() error

Unwrap implements the errors.Wrapper interface.

type Value

type Value = ent.Value

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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