db

package
v1.0.0-beta.112 Latest Latest
Warning

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

Go to latest
Published: Jul 4, 2024 License: Apache-2.0 Imports: 20 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.
	TypeFeature = "Feature"
)

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
	// Feature is the client for interacting with the Feature builders.
	Feature *FeatureClient
	// 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().
	Feature.
	Query().
	Count(ctx)

func (*Client) GetConfig

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

func (*Client) HijackTx

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

func (*Client) Intercept

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

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

func (*Client) Mutate

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

Mutate implements the ent.Mutator interface.

func (*Client) Tx

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

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

func (*Client) Use

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

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

type CommitFunc

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

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

func (CommitFunc) Commit

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

Commit calls f(ctx, m).

type CommitHook

type CommitHook func(Committer) Committer

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

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

type Committer

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

Committer is the interface that wraps the Commit method.

type ConstraintError

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

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

func (ConstraintError) Error

func (e ConstraintError) Error() string

Error implements the error interface.

func (*ConstraintError) Unwrap

func (e *ConstraintError) Unwrap() error

Unwrap implements the errors.Wrapper interface.

type ExposedTxDriver

type ExposedTxDriver struct {
	Driver *txDriver
}

func (*ExposedTxDriver) Commit

func (d *ExposedTxDriver) Commit() error

ignores hooks

func (*ExposedTxDriver) Rollback

func (d *ExposedTxDriver) Rollback() error

ignores hooks

type Feature

type Feature struct {

	// ID of the ent.
	ID string `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"`
	// DeletedAt holds the value of the "deleted_at" field.
	DeletedAt *time.Time `json:"deleted_at,omitempty"`
	// Metadata holds the value of the "metadata" field.
	Metadata map[string]string `json:"metadata,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"`
	// Key holds the value of the "key" field.
	Key string `json:"key,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"`
	// ArchivedAt holds the value of the "archived_at" field.
	ArchivedAt *time.Time `json:"archived_at,omitempty"`
	// contains filtered or unexported fields
}

Feature is the model entity for the Feature schema.

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 string) *FeatureDeleteOne

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

func (*FeatureClient) Get

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

Get returns a Feature entity by its id.

func (*FeatureClient) GetX

func (c *FeatureClient) GetX(ctx context.Context, id string) *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) 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 string) *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) 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) SetArchivedAt

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

SetArchivedAt sets the "archived_at" field.

func (*FeatureCreate) SetCreatedAt

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

SetCreatedAt sets the "created_at" field.

func (*FeatureCreate) SetDeletedAt

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

SetDeletedAt sets the "deleted_at" field.

func (*FeatureCreate) SetID

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

SetID sets the "id" field.

func (*FeatureCreate) SetKey

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

SetKey sets the "key" field.

func (*FeatureCreate) SetMetadata

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

SetMetadata sets the "metadata" 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) SetNillableArchivedAt

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

SetNillableArchivedAt sets the "archived_at" 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) SetNillableDeletedAt

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

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

func (*FeatureCreate) SetNillableID

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

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

func (*FeatureCreate) SetNillableMeterSlug

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

SetNillableMeterSlug sets the "meter_slug" 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 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) 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) ArchivedAt

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

ArchivedAt returns the value of the "archived_at" field in the mutation.

func (*FeatureMutation) ArchivedAtCleared

func (m *FeatureMutation) ArchivedAtCleared() bool

ArchivedAtCleared returns if the "archived_at" field was cleared in this mutation.

func (*FeatureMutation) ClearArchivedAt

func (m *FeatureMutation) ClearArchivedAt()

ClearArchivedAt clears the value of the "archived_at" field.

func (*FeatureMutation) ClearDeletedAt

func (m *FeatureMutation) ClearDeletedAt()

ClearDeletedAt clears the value of the "deleted_at" field.

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) ClearMetadata

func (m *FeatureMutation) ClearMetadata()

ClearMetadata clears the value of the "metadata" field.

func (*FeatureMutation) ClearMeterGroupByFilters

func (m *FeatureMutation) ClearMeterGroupByFilters()

ClearMeterGroupByFilters clears the value of the "meter_group_by_filters" field.

func (*FeatureMutation) ClearMeterSlug

func (m *FeatureMutation) ClearMeterSlug()

ClearMeterSlug clears the value of the "meter_slug" 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) DeletedAt

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

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

func (*FeatureMutation) DeletedAtCleared

func (m *FeatureMutation) DeletedAtCleared() bool

DeletedAtCleared returns if the "deleted_at" field was cleared in this 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 string, exists bool)

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

func (*FeatureMutation) IDs

func (m *FeatureMutation) IDs(ctx context.Context) ([]string, error)

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

func (*FeatureMutation) Key

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

Key returns the value of the "key" field in the mutation.

func (*FeatureMutation) Metadata

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

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

func (*FeatureMutation) MetadataCleared

func (m *FeatureMutation) MetadataCleared() bool

MetadataCleared returns if the "metadata" field was cleared in this 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) MeterSlugCleared

func (m *FeatureMutation) MeterSlugCleared() bool

MeterSlugCleared returns if the "meter_slug" field was cleared in this 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) OldArchivedAt

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

OldArchivedAt returns the old "archived_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) 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) OldDeletedAt

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

OldDeletedAt returns the old "deleted_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) OldKey

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

OldKey returns the old "key" 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) OldMetadata

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

OldMetadata returns the old "metadata" 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) 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) 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) ResetArchivedAt

func (m *FeatureMutation) ResetArchivedAt()

ResetArchivedAt resets all changes to the "archived_at" field.

func (*FeatureMutation) ResetCreatedAt

func (m *FeatureMutation) ResetCreatedAt()

ResetCreatedAt resets all changes to the "created_at" field.

func (*FeatureMutation) ResetDeletedAt

func (m *FeatureMutation) ResetDeletedAt()

ResetDeletedAt resets all changes to the "deleted_at" field.

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) ResetKey

func (m *FeatureMutation) ResetKey()

ResetKey resets all changes to the "key" field.

func (*FeatureMutation) ResetMetadata

func (m *FeatureMutation) ResetMetadata()

ResetMetadata resets all changes to the "metadata" field.

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) SetArchivedAt

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

SetArchivedAt sets the "archived_at" field.

func (*FeatureMutation) SetCreatedAt

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

SetCreatedAt sets the "created_at" field.

func (*FeatureMutation) SetDeletedAt

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

SetDeletedAt sets the "deleted_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 string)

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

func (*FeatureMutation) SetKey

func (m *FeatureMutation) SetKey(s string)

SetKey sets the "key" field.

func (*FeatureMutation) SetMetadata

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

SetMetadata sets the "metadata" field.

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 string, 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) string

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 []string, err error)

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

func (*FeatureQuery) IDsX

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

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 string, 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) string

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

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) ClearArchivedAt

func (fu *FeatureUpdate) ClearArchivedAt() *FeatureUpdate

ClearArchivedAt clears the value of the "archived_at" field.

func (*FeatureUpdate) ClearDeletedAt

func (fu *FeatureUpdate) ClearDeletedAt() *FeatureUpdate

ClearDeletedAt clears the value of the "deleted_at" field.

func (*FeatureUpdate) ClearMetadata

func (fu *FeatureUpdate) ClearMetadata() *FeatureUpdate

ClearMetadata clears the value of the "metadata" field.

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) 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) SetArchivedAt

func (fu *FeatureUpdate) SetArchivedAt(t time.Time) *FeatureUpdate

SetArchivedAt sets the "archived_at" field.

func (*FeatureUpdate) SetDeletedAt

func (fu *FeatureUpdate) SetDeletedAt(t time.Time) *FeatureUpdate

SetDeletedAt sets the "deleted_at" field.

func (*FeatureUpdate) SetMetadata

func (fu *FeatureUpdate) SetMetadata(m map[string]string) *FeatureUpdate

SetMetadata sets the "metadata" 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) SetNillableArchivedAt

func (fu *FeatureUpdate) SetNillableArchivedAt(t *time.Time) *FeatureUpdate

SetNillableArchivedAt sets the "archived_at" field if the given value is not nil.

func (*FeatureUpdate) SetNillableDeletedAt

func (fu *FeatureUpdate) SetNillableDeletedAt(t *time.Time) *FeatureUpdate

SetNillableDeletedAt sets the "deleted_at" 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) ClearArchivedAt

func (fuo *FeatureUpdateOne) ClearArchivedAt() *FeatureUpdateOne

ClearArchivedAt clears the value of the "archived_at" field.

func (*FeatureUpdateOne) ClearDeletedAt

func (fuo *FeatureUpdateOne) ClearDeletedAt() *FeatureUpdateOne

ClearDeletedAt clears the value of the "deleted_at" field.

func (*FeatureUpdateOne) ClearMetadata

func (fuo *FeatureUpdateOne) ClearMetadata() *FeatureUpdateOne

ClearMetadata clears the value of the "metadata" field.

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) 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) SetArchivedAt

func (fuo *FeatureUpdateOne) SetArchivedAt(t time.Time) *FeatureUpdateOne

SetArchivedAt sets the "archived_at" field.

func (*FeatureUpdateOne) SetDeletedAt

func (fuo *FeatureUpdateOne) SetDeletedAt(t time.Time) *FeatureUpdateOne

SetDeletedAt sets the "deleted_at" field.

func (*FeatureUpdateOne) SetMetadata

func (fuo *FeatureUpdateOne) SetMetadata(m map[string]string) *FeatureUpdateOne

SetMetadata sets the "metadata" 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) SetNillableArchivedAt

func (fuo *FeatureUpdateOne) SetNillableArchivedAt(t *time.Time) *FeatureUpdateOne

SetNillableArchivedAt sets the "archived_at" field if the given value is not nil.

func (*FeatureUpdateOne) SetNillableDeletedAt

func (fuo *FeatureUpdateOne) SetNillableDeletedAt(t *time.Time) *FeatureUpdateOne

SetNillableDeletedAt sets the "deleted_at" 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) ClearArchivedAt

func (u *FeatureUpsert) ClearArchivedAt() *FeatureUpsert

ClearArchivedAt clears the value of the "archived_at" field.

func (*FeatureUpsert) ClearDeletedAt

func (u *FeatureUpsert) ClearDeletedAt() *FeatureUpsert

ClearDeletedAt clears the value of the "deleted_at" field.

func (*FeatureUpsert) ClearMetadata

func (u *FeatureUpsert) ClearMetadata() *FeatureUpsert

ClearMetadata clears the value of the "metadata" field.

func (*FeatureUpsert) ClearMeterGroupByFilters

func (u *FeatureUpsert) ClearMeterGroupByFilters() *FeatureUpsert

ClearMeterGroupByFilters clears the value of the "meter_group_by_filters" field.

func (*FeatureUpsert) SetArchivedAt

func (u *FeatureUpsert) SetArchivedAt(v time.Time) *FeatureUpsert

SetArchivedAt sets the "archived_at" field.

func (*FeatureUpsert) SetDeletedAt

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

SetDeletedAt sets the "deleted_at" field.

func (*FeatureUpsert) SetMetadata

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

SetMetadata sets the "metadata" 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) UpdateArchivedAt

func (u *FeatureUpsert) UpdateArchivedAt() *FeatureUpsert

UpdateArchivedAt sets the "archived_at" field to the value that was provided on create.

func (*FeatureUpsert) UpdateDeletedAt

func (u *FeatureUpsert) UpdateDeletedAt() *FeatureUpsert

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

func (*FeatureUpsert) UpdateMetadata

func (u *FeatureUpsert) UpdateMetadata() *FeatureUpsert

UpdateMetadata sets the "metadata" 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) ClearArchivedAt

func (u *FeatureUpsertBulk) ClearArchivedAt() *FeatureUpsertBulk

ClearArchivedAt clears the value of the "archived_at" field.

func (*FeatureUpsertBulk) ClearDeletedAt

func (u *FeatureUpsertBulk) ClearDeletedAt() *FeatureUpsertBulk

ClearDeletedAt clears the value of the "deleted_at" field.

func (*FeatureUpsertBulk) ClearMetadata

func (u *FeatureUpsertBulk) ClearMetadata() *FeatureUpsertBulk

ClearMetadata clears the value of the "metadata" field.

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) SetArchivedAt

func (u *FeatureUpsertBulk) SetArchivedAt(v time.Time) *FeatureUpsertBulk

SetArchivedAt sets the "archived_at" field.

func (*FeatureUpsertBulk) SetDeletedAt

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

SetDeletedAt sets the "deleted_at" field.

func (*FeatureUpsertBulk) SetMetadata

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

SetMetadata sets the "metadata" 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) UpdateArchivedAt

func (u *FeatureUpsertBulk) UpdateArchivedAt() *FeatureUpsertBulk

UpdateArchivedAt sets the "archived_at" field to the value that was provided on create.

func (*FeatureUpsertBulk) UpdateDeletedAt

func (u *FeatureUpsertBulk) UpdateDeletedAt() *FeatureUpsertBulk

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

func (*FeatureUpsertBulk) UpdateMetadata

func (u *FeatureUpsertBulk) UpdateMetadata() *FeatureUpsertBulk

UpdateMetadata sets the "metadata" 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) ClearArchivedAt

func (u *FeatureUpsertOne) ClearArchivedAt() *FeatureUpsertOne

ClearArchivedAt clears the value of the "archived_at" field.

func (*FeatureUpsertOne) ClearDeletedAt

func (u *FeatureUpsertOne) ClearDeletedAt() *FeatureUpsertOne

ClearDeletedAt clears the value of the "deleted_at" field.

func (*FeatureUpsertOne) ClearMetadata

func (u *FeatureUpsertOne) ClearMetadata() *FeatureUpsertOne

ClearMetadata clears the value of the "metadata" field.

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 string, err error)

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

func (*FeatureUpsertOne) IDX

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

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) SetArchivedAt

func (u *FeatureUpsertOne) SetArchivedAt(v time.Time) *FeatureUpsertOne

SetArchivedAt sets the "archived_at" field.

func (*FeatureUpsertOne) SetDeletedAt

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

SetDeletedAt sets the "deleted_at" field.

func (*FeatureUpsertOne) SetMetadata

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

SetMetadata sets the "metadata" 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) UpdateArchivedAt

func (u *FeatureUpsertOne) UpdateArchivedAt() *FeatureUpsertOne

UpdateArchivedAt sets the "archived_at" field to the value that was provided on create.

func (*FeatureUpsertOne) UpdateDeletedAt

func (u *FeatureUpsertOne) UpdateDeletedAt() *FeatureUpsertOne

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

func (*FeatureUpsertOne) UpdateMetadata

func (u *FeatureUpsertOne) UpdateMetadata() *FeatureUpsertOne

UpdateMetadata sets the "metadata" 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 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 {

	// Feature is the client for interacting with the Feature builders.
	Feature *FeatureClient
	// contains filtered or unexported fields
}

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

func NewTxClientFromRawConfig

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

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

func TxFromContext

func TxFromContext(ctx context.Context) *Tx

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

func (*Tx) Client

func (tx *Tx) Client() *Client

Client returns a Client that binds to current transaction.

func (*Tx) Commit

func (tx *Tx) Commit() error

Commit commits the transaction.

func (*Tx) OnCommit

func (tx *Tx) OnCommit(f CommitHook)

OnCommit adds a hook to call on commit.

func (*Tx) OnRollback

func (tx *Tx) OnRollback(f RollbackHook)

OnRollback adds a hook to call on rollback.

func (*Tx) Rollback

func (tx *Tx) Rollback() error

Rollback rollbacks the transaction.

type ValidationError

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

ValidationError returns when validating a field or edge fails.

func (*ValidationError) Error

func (e *ValidationError) Error() string

Error implements the error interface.

func (*ValidationError) Unwrap

func (e *ValidationError) Unwrap() error

Unwrap implements the errors.Wrapper interface.

type Value

type Value = ent.Value

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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