ent

package
v0.5.6 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2021 License: Apache-2.0 Imports: 17 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.
	TypeMetrics = "Metrics"
)

Variables

This section is empty.

Functions

func IsConstraintError

func IsConstraintError(err error) bool

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

func IsNotFound

func IsNotFound(err error) bool

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

func IsNotLoaded

func IsNotLoaded(err error) bool

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

func IsNotSingular

func IsNotSingular(err error) bool

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

func IsValidationError

func IsValidationError(err error) bool

IsValidationError returns a boolean indicating whether the error is a validaton 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, func(string) bool) string

AggregateFunc applies an aggregation step on the group-by traversal/selector.

func As

As is a pseudo aggregation function for renaming another other functions with custom names. For example:

GroupBy(field1, field2).
Aggregate(ent.As(ent.Sum(field1), "sum_field1"), (ent.As(ent.Sum(field2), "sum_field2")).
Scan(ctx, &v)

func Count

func Count() AggregateFunc

Count applies the "count" aggregation function on each group.

func Max

func Max(field string) AggregateFunc

Max applies the "max" aggregation function on the given field of each group.

func Mean

func Mean(field string) AggregateFunc

Mean applies the "mean" aggregation function on the given field of each group.

func Min

func Min(field string) AggregateFunc

Min applies the "min" aggregation function on the given field of each group.

func Sum

func Sum(field string) AggregateFunc

Sum applies the "sum" aggregation function on the given field of each group.

type Client

type Client struct {

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

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(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 Committer method.

type ConstraintError

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

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

func (ConstraintError) Error

func (e ConstraintError) Error() string

Error implements the error interface.

func (*ConstraintError) Unwrap

func (e *ConstraintError) Unwrap() error

Unwrap implements the errors.Wrapper interface.

type Hook

type Hook = ent.Hook

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

type Metrics

type Metrics struct {

	// ID of the ent.
	ID int `json:"id,omitempty"`
	// Namespace holds the value of the "namespace" field.
	Namespace string `json:"namespace,omitempty"`
	// Workflow holds the value of the "workflow" field.
	Workflow string `json:"workflow,omitempty"`
	// Instance holds the value of the "instance" field.
	Instance string `json:"instance,omitempty"`
	// State holds the value of the "state" field.
	State string `json:"state,omitempty"`
	// Timestamp holds the value of the "timestamp" field.
	Timestamp time.Time `json:"timestamp,omitempty"`
	// WorkflowMs holds the value of the "workflow_ms" field.
	WorkflowMs int64 `json:"workflow_ms,omitempty"`
	// IsolateMs holds the value of the "isolate_ms" field.
	IsolateMs int64 `json:"isolate_ms,omitempty"`
	// ErrorCode holds the value of the "error_code" field.
	ErrorCode string `json:"error_code,omitempty"`
	// Invoker holds the value of the "invoker" field.
	Invoker string `json:"invoker,omitempty"`
	// Next holds the value of the "next" field.
	Next int8 `json:"next,omitempty"`
	// Transition holds the value of the "transition" field.
	Transition string `json:"transition,omitempty"`
	// contains filtered or unexported fields
}

Metrics is the model entity for the Metrics schema.

func (*Metrics) String

func (m *Metrics) String() string

String implements the fmt.Stringer.

func (*Metrics) Unwrap

func (m *Metrics) Unwrap() *Metrics

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

func (m *Metrics) Update() *MetricsUpdateOne

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

type MetricsClient

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

MetricsClient is a client for the Metrics schema.

func NewMetricsClient

func NewMetricsClient(c config) *MetricsClient

NewMetricsClient returns a client for the Metrics from the given config.

func (*MetricsClient) Create

func (c *MetricsClient) Create() *MetricsCreate

Create returns a create builder for Metrics.

func (*MetricsClient) CreateBulk

func (c *MetricsClient) CreateBulk(builders ...*MetricsCreate) *MetricsCreateBulk

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

func (*MetricsClient) Delete

func (c *MetricsClient) Delete() *MetricsDelete

Delete returns a delete builder for Metrics.

func (*MetricsClient) DeleteOne

func (c *MetricsClient) DeleteOne(m *Metrics) *MetricsDeleteOne

DeleteOne returns a delete builder for the given entity.

func (*MetricsClient) DeleteOneID

func (c *MetricsClient) DeleteOneID(id int) *MetricsDeleteOne

DeleteOneID returns a delete builder for the given id.

func (*MetricsClient) Get

func (c *MetricsClient) Get(ctx context.Context, id int) (*Metrics, error)

Get returns a Metrics entity by its id.

func (*MetricsClient) GetX

func (c *MetricsClient) GetX(ctx context.Context, id int) *Metrics

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

func (*MetricsClient) Hooks

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

Hooks returns the client hooks.

func (*MetricsClient) Query

func (c *MetricsClient) Query() *MetricsQuery

Query returns a query builder for Metrics.

func (*MetricsClient) Update

func (c *MetricsClient) Update() *MetricsUpdate

Update returns an update builder for Metrics.

func (*MetricsClient) UpdateOne

func (c *MetricsClient) UpdateOne(m *Metrics) *MetricsUpdateOne

UpdateOne returns an update builder for the given entity.

func (*MetricsClient) UpdateOneID

func (c *MetricsClient) UpdateOneID(id int) *MetricsUpdateOne

UpdateOneID returns an update builder for the given id.

func (*MetricsClient) Use

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

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

type MetricsCreate

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

MetricsCreate is the builder for creating a Metrics entity.

func (*MetricsCreate) Mutation

func (mc *MetricsCreate) Mutation() *MetricsMutation

Mutation returns the MetricsMutation object of the builder.

func (*MetricsCreate) Save

func (mc *MetricsCreate) Save(ctx context.Context) (*Metrics, error)

Save creates the Metrics in the database.

func (*MetricsCreate) SaveX

func (mc *MetricsCreate) SaveX(ctx context.Context) *Metrics

SaveX calls Save and panics if Save returns an error.

func (*MetricsCreate) SetErrorCode

func (mc *MetricsCreate) SetErrorCode(s string) *MetricsCreate

SetErrorCode sets the "error_code" field.

func (*MetricsCreate) SetInstance

func (mc *MetricsCreate) SetInstance(s string) *MetricsCreate

SetInstance sets the "instance" field.

func (*MetricsCreate) SetInvoker

func (mc *MetricsCreate) SetInvoker(s string) *MetricsCreate

SetInvoker sets the "invoker" field.

func (*MetricsCreate) SetIsolateMs

func (mc *MetricsCreate) SetIsolateMs(i int64) *MetricsCreate

SetIsolateMs sets the "isolate_ms" field.

func (*MetricsCreate) SetNamespace

func (mc *MetricsCreate) SetNamespace(s string) *MetricsCreate

SetNamespace sets the "namespace" field.

func (*MetricsCreate) SetNext

func (mc *MetricsCreate) SetNext(i int8) *MetricsCreate

SetNext sets the "next" field.

func (*MetricsCreate) SetNillableErrorCode

func (mc *MetricsCreate) SetNillableErrorCode(s *string) *MetricsCreate

SetNillableErrorCode sets the "error_code" field if the given value is not nil.

func (*MetricsCreate) SetNillableTransition

func (mc *MetricsCreate) SetNillableTransition(s *string) *MetricsCreate

SetNillableTransition sets the "transition" field if the given value is not nil.

func (*MetricsCreate) SetState

func (mc *MetricsCreate) SetState(s string) *MetricsCreate

SetState sets the "state" field.

func (*MetricsCreate) SetTimestamp

func (mc *MetricsCreate) SetTimestamp(t time.Time) *MetricsCreate

SetTimestamp sets the "timestamp" field.

func (*MetricsCreate) SetTransition

func (mc *MetricsCreate) SetTransition(s string) *MetricsCreate

SetTransition sets the "transition" field.

func (*MetricsCreate) SetWorkflow

func (mc *MetricsCreate) SetWorkflow(s string) *MetricsCreate

SetWorkflow sets the "workflow" field.

func (*MetricsCreate) SetWorkflowMs

func (mc *MetricsCreate) SetWorkflowMs(i int64) *MetricsCreate

SetWorkflowMs sets the "workflow_ms" field.

type MetricsCreateBulk

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

MetricsCreateBulk is the builder for creating many Metrics entities in bulk.

func (*MetricsCreateBulk) Save

func (mcb *MetricsCreateBulk) Save(ctx context.Context) ([]*Metrics, error)

Save creates the Metrics entities in the database.

func (*MetricsCreateBulk) SaveX

func (mcb *MetricsCreateBulk) SaveX(ctx context.Context) []*Metrics

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

type MetricsDelete

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

MetricsDelete is the builder for deleting a Metrics entity.

func (*MetricsDelete) Exec

func (md *MetricsDelete) Exec(ctx context.Context) (int, error)

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

func (*MetricsDelete) ExecX

func (md *MetricsDelete) ExecX(ctx context.Context) int

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

func (*MetricsDelete) Where

func (md *MetricsDelete) Where(ps ...predicate.Metrics) *MetricsDelete

Where adds a new predicate to the MetricsDelete builder.

type MetricsDeleteOne

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

MetricsDeleteOne is the builder for deleting a single Metrics entity.

func (*MetricsDeleteOne) Exec

func (mdo *MetricsDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*MetricsDeleteOne) ExecX

func (mdo *MetricsDeleteOne) ExecX(ctx context.Context)

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

type MetricsGroupBy

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

MetricsGroupBy is the group-by builder for Metrics entities.

func (*MetricsGroupBy) Aggregate

func (mgb *MetricsGroupBy) Aggregate(fns ...AggregateFunc) *MetricsGroupBy

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

func (*MetricsGroupBy) Bool

func (mgb *MetricsGroupBy) Bool(ctx context.Context) (_ bool, err error)

Bool returns a single bool from a group-by query. It is only allowed when executing a group-by query with one field.

func (*MetricsGroupBy) BoolX

func (mgb *MetricsGroupBy) BoolX(ctx context.Context) bool

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

func (*MetricsGroupBy) Bools

func (mgb *MetricsGroupBy) Bools(ctx context.Context) ([]bool, error)

Bools returns list of bools from group-by. It is only allowed when executing a group-by query with one field.

func (*MetricsGroupBy) BoolsX

func (mgb *MetricsGroupBy) BoolsX(ctx context.Context) []bool

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

func (*MetricsGroupBy) Float64

func (mgb *MetricsGroupBy) Float64(ctx context.Context) (_ float64, err error)

Float64 returns a single float64 from a group-by query. It is only allowed when executing a group-by query with one field.

func (*MetricsGroupBy) Float64X

func (mgb *MetricsGroupBy) Float64X(ctx context.Context) float64

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

func (*MetricsGroupBy) Float64s

func (mgb *MetricsGroupBy) Float64s(ctx context.Context) ([]float64, error)

Float64s returns list of float64s from group-by. It is only allowed when executing a group-by query with one field.

func (*MetricsGroupBy) Float64sX

func (mgb *MetricsGroupBy) Float64sX(ctx context.Context) []float64

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

func (*MetricsGroupBy) Int

func (mgb *MetricsGroupBy) Int(ctx context.Context) (_ int, err error)

Int returns a single int from a group-by query. It is only allowed when executing a group-by query with one field.

func (*MetricsGroupBy) IntX

func (mgb *MetricsGroupBy) IntX(ctx context.Context) int

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

func (*MetricsGroupBy) Ints

func (mgb *MetricsGroupBy) Ints(ctx context.Context) ([]int, error)

Ints returns list of ints from group-by. It is only allowed when executing a group-by query with one field.

func (*MetricsGroupBy) IntsX

func (mgb *MetricsGroupBy) IntsX(ctx context.Context) []int

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

func (*MetricsGroupBy) Scan

func (mgb *MetricsGroupBy) Scan(ctx context.Context, v interface{}) error

Scan applies the group-by query and scans the result into the given value.

func (*MetricsGroupBy) ScanX

func (mgb *MetricsGroupBy) ScanX(ctx context.Context, v interface{})

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

func (*MetricsGroupBy) String

func (mgb *MetricsGroupBy) String(ctx context.Context) (_ string, err error)

String returns a single string from a group-by query. It is only allowed when executing a group-by query with one field.

func (*MetricsGroupBy) StringX

func (mgb *MetricsGroupBy) StringX(ctx context.Context) string

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

func (*MetricsGroupBy) Strings

func (mgb *MetricsGroupBy) Strings(ctx context.Context) ([]string, error)

Strings returns list of strings from group-by. It is only allowed when executing a group-by query with one field.

func (*MetricsGroupBy) StringsX

func (mgb *MetricsGroupBy) StringsX(ctx context.Context) []string

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

type MetricsMutation

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

MetricsMutation represents an operation that mutates the Metrics nodes in the graph.

func (*MetricsMutation) AddField

func (m *MetricsMutation) 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 (*MetricsMutation) AddIsolateMs

func (m *MetricsMutation) AddIsolateMs(i int64)

AddIsolateMs adds i to the "isolate_ms" field.

func (*MetricsMutation) AddNext

func (m *MetricsMutation) AddNext(i int8)

AddNext adds i to the "next" field.

func (*MetricsMutation) AddWorkflowMs

func (m *MetricsMutation) AddWorkflowMs(i int64)

AddWorkflowMs adds i to the "workflow_ms" field.

func (*MetricsMutation) AddedEdges

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

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

func (*MetricsMutation) AddedField

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

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

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

func (*MetricsMutation) AddedIDs

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

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

func (*MetricsMutation) AddedIsolateMs

func (m *MetricsMutation) AddedIsolateMs() (r int64, exists bool)

AddedIsolateMs returns the value that was added to the "isolate_ms" field in this mutation.

func (*MetricsMutation) AddedNext

func (m *MetricsMutation) AddedNext() (r int8, exists bool)

AddedNext returns the value that was added to the "next" field in this mutation.

func (*MetricsMutation) AddedWorkflowMs

func (m *MetricsMutation) AddedWorkflowMs() (r int64, exists bool)

AddedWorkflowMs returns the value that was added to the "workflow_ms" field in this mutation.

func (*MetricsMutation) ClearEdge

func (m *MetricsMutation) 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 (*MetricsMutation) ClearErrorCode

func (m *MetricsMutation) ClearErrorCode()

ClearErrorCode clears the value of the "error_code" field.

func (*MetricsMutation) ClearField

func (m *MetricsMutation) 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 (*MetricsMutation) ClearTransition

func (m *MetricsMutation) ClearTransition()

ClearTransition clears the value of the "transition" field.

func (*MetricsMutation) ClearedEdges

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

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

func (*MetricsMutation) ClearedFields

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

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

func (MetricsMutation) Client

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

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

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

func (*MetricsMutation) ErrorCode

func (m *MetricsMutation) ErrorCode() (r string, exists bool)

ErrorCode returns the value of the "error_code" field in the mutation.

func (*MetricsMutation) ErrorCodeCleared

func (m *MetricsMutation) ErrorCodeCleared() bool

ErrorCodeCleared returns if the "error_code" field was cleared in this mutation.

func (*MetricsMutation) Field

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

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

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

func (*MetricsMutation) Fields

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

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

ID returns the ID value in the mutation. Note that the ID is only available if it was provided to the builder.

func (*MetricsMutation) Instance

func (m *MetricsMutation) Instance() (r string, exists bool)

Instance returns the value of the "instance" field in the mutation.

func (*MetricsMutation) Invoker

func (m *MetricsMutation) Invoker() (r string, exists bool)

Invoker returns the value of the "invoker" field in the mutation.

func (*MetricsMutation) IsolateMs

func (m *MetricsMutation) IsolateMs() (r int64, exists bool)

IsolateMs returns the value of the "isolate_ms" field in the mutation.

func (*MetricsMutation) Namespace

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

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

func (*MetricsMutation) Next

func (m *MetricsMutation) Next() (r int8, exists bool)

Next returns the value of the "next" field in the mutation.

func (*MetricsMutation) OldErrorCode

func (m *MetricsMutation) OldErrorCode(ctx context.Context) (v string, err error)

OldErrorCode returns the old "error_code" field's value of the Metrics entity. If the Metrics 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 (*MetricsMutation) OldField

func (m *MetricsMutation) 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 (*MetricsMutation) OldInstance

func (m *MetricsMutation) OldInstance(ctx context.Context) (v string, err error)

OldInstance returns the old "instance" field's value of the Metrics entity. If the Metrics 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 (*MetricsMutation) OldInvoker

func (m *MetricsMutation) OldInvoker(ctx context.Context) (v string, err error)

OldInvoker returns the old "invoker" field's value of the Metrics entity. If the Metrics 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 (*MetricsMutation) OldIsolateMs

func (m *MetricsMutation) OldIsolateMs(ctx context.Context) (v int64, err error)

OldIsolateMs returns the old "isolate_ms" field's value of the Metrics entity. If the Metrics 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 (*MetricsMutation) OldNamespace

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

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

func (m *MetricsMutation) OldNext(ctx context.Context) (v int8, err error)

OldNext returns the old "next" field's value of the Metrics entity. If the Metrics 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 (*MetricsMutation) OldState

func (m *MetricsMutation) OldState(ctx context.Context) (v string, err error)

OldState returns the old "state" field's value of the Metrics entity. If the Metrics 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 (*MetricsMutation) OldTimestamp

func (m *MetricsMutation) OldTimestamp(ctx context.Context) (v time.Time, err error)

OldTimestamp returns the old "timestamp" field's value of the Metrics entity. If the Metrics 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 (*MetricsMutation) OldTransition

func (m *MetricsMutation) OldTransition(ctx context.Context) (v string, err error)

OldTransition returns the old "transition" field's value of the Metrics entity. If the Metrics 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 (*MetricsMutation) OldWorkflow

func (m *MetricsMutation) OldWorkflow(ctx context.Context) (v string, err error)

OldWorkflow returns the old "workflow" field's value of the Metrics entity. If the Metrics 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 (*MetricsMutation) OldWorkflowMs

func (m *MetricsMutation) OldWorkflowMs(ctx context.Context) (v int64, err error)

OldWorkflowMs returns the old "workflow_ms" field's value of the Metrics entity. If the Metrics 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 (*MetricsMutation) Op

func (m *MetricsMutation) Op() Op

Op returns the operation name.

func (*MetricsMutation) RemovedEdges

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

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

func (*MetricsMutation) RemovedIDs

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

func (m *MetricsMutation) 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 (*MetricsMutation) ResetErrorCode

func (m *MetricsMutation) ResetErrorCode()

ResetErrorCode resets all changes to the "error_code" field.

func (*MetricsMutation) ResetField

func (m *MetricsMutation) 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 (*MetricsMutation) ResetInstance

func (m *MetricsMutation) ResetInstance()

ResetInstance resets all changes to the "instance" field.

func (*MetricsMutation) ResetInvoker

func (m *MetricsMutation) ResetInvoker()

ResetInvoker resets all changes to the "invoker" field.

func (*MetricsMutation) ResetIsolateMs

func (m *MetricsMutation) ResetIsolateMs()

ResetIsolateMs resets all changes to the "isolate_ms" field.

func (*MetricsMutation) ResetNamespace

func (m *MetricsMutation) ResetNamespace()

ResetNamespace resets all changes to the "namespace" field.

func (*MetricsMutation) ResetNext

func (m *MetricsMutation) ResetNext()

ResetNext resets all changes to the "next" field.

func (*MetricsMutation) ResetState

func (m *MetricsMutation) ResetState()

ResetState resets all changes to the "state" field.

func (*MetricsMutation) ResetTimestamp

func (m *MetricsMutation) ResetTimestamp()

ResetTimestamp resets all changes to the "timestamp" field.

func (*MetricsMutation) ResetTransition

func (m *MetricsMutation) ResetTransition()

ResetTransition resets all changes to the "transition" field.

func (*MetricsMutation) ResetWorkflow

func (m *MetricsMutation) ResetWorkflow()

ResetWorkflow resets all changes to the "workflow" field.

func (*MetricsMutation) ResetWorkflowMs

func (m *MetricsMutation) ResetWorkflowMs()

ResetWorkflowMs resets all changes to the "workflow_ms" field.

func (*MetricsMutation) SetErrorCode

func (m *MetricsMutation) SetErrorCode(s string)

SetErrorCode sets the "error_code" field.

func (*MetricsMutation) SetField

func (m *MetricsMutation) 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 (*MetricsMutation) SetInstance

func (m *MetricsMutation) SetInstance(s string)

SetInstance sets the "instance" field.

func (*MetricsMutation) SetInvoker

func (m *MetricsMutation) SetInvoker(s string)

SetInvoker sets the "invoker" field.

func (*MetricsMutation) SetIsolateMs

func (m *MetricsMutation) SetIsolateMs(i int64)

SetIsolateMs sets the "isolate_ms" field.

func (*MetricsMutation) SetNamespace

func (m *MetricsMutation) SetNamespace(s string)

SetNamespace sets the "namespace" field.

func (*MetricsMutation) SetNext

func (m *MetricsMutation) SetNext(i int8)

SetNext sets the "next" field.

func (*MetricsMutation) SetState

func (m *MetricsMutation) SetState(s string)

SetState sets the "state" field.

func (*MetricsMutation) SetTimestamp

func (m *MetricsMutation) SetTimestamp(t time.Time)

SetTimestamp sets the "timestamp" field.

func (*MetricsMutation) SetTransition

func (m *MetricsMutation) SetTransition(s string)

SetTransition sets the "transition" field.

func (*MetricsMutation) SetWorkflow

func (m *MetricsMutation) SetWorkflow(s string)

SetWorkflow sets the "workflow" field.

func (*MetricsMutation) SetWorkflowMs

func (m *MetricsMutation) SetWorkflowMs(i int64)

SetWorkflowMs sets the "workflow_ms" field.

func (*MetricsMutation) State

func (m *MetricsMutation) State() (r string, exists bool)

State returns the value of the "state" field in the mutation.

func (*MetricsMutation) Timestamp

func (m *MetricsMutation) Timestamp() (r time.Time, exists bool)

Timestamp returns the value of the "timestamp" field in the mutation.

func (*MetricsMutation) Transition

func (m *MetricsMutation) Transition() (r string, exists bool)

Transition returns the value of the "transition" field in the mutation.

func (*MetricsMutation) TransitionCleared

func (m *MetricsMutation) TransitionCleared() bool

TransitionCleared returns if the "transition" field was cleared in this mutation.

func (MetricsMutation) Tx

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

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

func (*MetricsMutation) Type

func (m *MetricsMutation) Type() string

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

func (*MetricsMutation) Workflow

func (m *MetricsMutation) Workflow() (r string, exists bool)

Workflow returns the value of the "workflow" field in the mutation.

func (*MetricsMutation) WorkflowMs

func (m *MetricsMutation) WorkflowMs() (r int64, exists bool)

WorkflowMs returns the value of the "workflow_ms" field in the mutation.

type MetricsQuery

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

MetricsQuery is the builder for querying Metrics entities.

func (*MetricsQuery) All

func (mq *MetricsQuery) All(ctx context.Context) ([]*Metrics, error)

All executes the query and returns a list of MetricsSlice.

func (*MetricsQuery) AllX

func (mq *MetricsQuery) AllX(ctx context.Context) []*Metrics

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

func (*MetricsQuery) Clone

func (mq *MetricsQuery) Clone() *MetricsQuery

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

func (*MetricsQuery) Count

func (mq *MetricsQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*MetricsQuery) CountX

func (mq *MetricsQuery) CountX(ctx context.Context) int

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

func (*MetricsQuery) Exist

func (mq *MetricsQuery) Exist(ctx context.Context) (bool, error)

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

func (*MetricsQuery) ExistX

func (mq *MetricsQuery) ExistX(ctx context.Context) bool

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

func (*MetricsQuery) First

func (mq *MetricsQuery) First(ctx context.Context) (*Metrics, error)

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

func (*MetricsQuery) FirstID

func (mq *MetricsQuery) FirstID(ctx context.Context) (id int, err error)

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

func (*MetricsQuery) FirstIDX

func (mq *MetricsQuery) FirstIDX(ctx context.Context) int

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

func (*MetricsQuery) FirstX

func (mq *MetricsQuery) FirstX(ctx context.Context) *Metrics

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

func (*MetricsQuery) GroupBy

func (mq *MetricsQuery) GroupBy(field string, fields ...string) *MetricsGroupBy

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

Example:

var v []struct {
	Namespace string `json:"namespace,omitempty"`
	Count int `json:"count,omitempty"`
}

client.Metrics.Query().
	GroupBy(metrics.FieldNamespace).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*MetricsQuery) IDs

func (mq *MetricsQuery) IDs(ctx context.Context) ([]int, error)

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

func (*MetricsQuery) IDsX

func (mq *MetricsQuery) IDsX(ctx context.Context) []int

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

func (*MetricsQuery) Limit

func (mq *MetricsQuery) Limit(limit int) *MetricsQuery

Limit adds a limit step to the query.

func (*MetricsQuery) Offset

func (mq *MetricsQuery) Offset(offset int) *MetricsQuery

Offset adds an offset step to the query.

func (*MetricsQuery) Only

func (mq *MetricsQuery) Only(ctx context.Context) (*Metrics, error)

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

func (*MetricsQuery) OnlyID

func (mq *MetricsQuery) OnlyID(ctx context.Context) (id int, err error)

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

func (*MetricsQuery) OnlyIDX

func (mq *MetricsQuery) OnlyIDX(ctx context.Context) int

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

func (*MetricsQuery) OnlyX

func (mq *MetricsQuery) OnlyX(ctx context.Context) *Metrics

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

func (*MetricsQuery) Order

func (mq *MetricsQuery) Order(o ...OrderFunc) *MetricsQuery

Order adds an order step to the query.

func (*MetricsQuery) Select

func (mq *MetricsQuery) Select(field string, fields ...string) *MetricsSelect

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

Example:

var v []struct {
	Namespace string `json:"namespace,omitempty"`
}

client.Metrics.Query().
	Select(metrics.FieldNamespace).
	Scan(ctx, &v)

func (*MetricsQuery) Where

func (mq *MetricsQuery) Where(ps ...predicate.Metrics) *MetricsQuery

Where adds a new predicate for the MetricsQuery builder.

type MetricsSelect

type MetricsSelect struct {
	*MetricsQuery
	// contains filtered or unexported fields
}

MetricsSelect is the builder for selecting fields of Metrics entities.

func (*MetricsSelect) Bool

func (ms *MetricsSelect) Bool(ctx context.Context) (_ bool, err error)

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

func (*MetricsSelect) BoolX

func (ms *MetricsSelect) BoolX(ctx context.Context) bool

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

func (*MetricsSelect) Bools

func (ms *MetricsSelect) Bools(ctx context.Context) ([]bool, error)

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

func (*MetricsSelect) BoolsX

func (ms *MetricsSelect) BoolsX(ctx context.Context) []bool

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

func (*MetricsSelect) Float64

func (ms *MetricsSelect) Float64(ctx context.Context) (_ float64, err error)

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

func (*MetricsSelect) Float64X

func (ms *MetricsSelect) Float64X(ctx context.Context) float64

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

func (*MetricsSelect) Float64s

func (ms *MetricsSelect) Float64s(ctx context.Context) ([]float64, error)

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

func (*MetricsSelect) Float64sX

func (ms *MetricsSelect) Float64sX(ctx context.Context) []float64

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

func (*MetricsSelect) Int

func (ms *MetricsSelect) Int(ctx context.Context) (_ int, err error)

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

func (*MetricsSelect) IntX

func (ms *MetricsSelect) IntX(ctx context.Context) int

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

func (*MetricsSelect) Ints

func (ms *MetricsSelect) Ints(ctx context.Context) ([]int, error)

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

func (*MetricsSelect) IntsX

func (ms *MetricsSelect) IntsX(ctx context.Context) []int

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

func (*MetricsSelect) Scan

func (ms *MetricsSelect) Scan(ctx context.Context, v interface{}) error

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

func (*MetricsSelect) ScanX

func (ms *MetricsSelect) ScanX(ctx context.Context, v interface{})

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

func (*MetricsSelect) String

func (ms *MetricsSelect) String(ctx context.Context) (_ string, err error)

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

func (*MetricsSelect) StringX

func (ms *MetricsSelect) StringX(ctx context.Context) string

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

func (*MetricsSelect) Strings

func (ms *MetricsSelect) Strings(ctx context.Context) ([]string, error)

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

func (*MetricsSelect) StringsX

func (ms *MetricsSelect) StringsX(ctx context.Context) []string

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

type MetricsSlice

type MetricsSlice []*Metrics

MetricsSlice is a parsable slice of Metrics.

type MetricsUpdate

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

MetricsUpdate is the builder for updating Metrics entities.

func (*MetricsUpdate) AddIsolateMs

func (mu *MetricsUpdate) AddIsolateMs(i int64) *MetricsUpdate

AddIsolateMs adds i to the "isolate_ms" field.

func (*MetricsUpdate) AddNext

func (mu *MetricsUpdate) AddNext(i int8) *MetricsUpdate

AddNext adds i to the "next" field.

func (*MetricsUpdate) AddWorkflowMs

func (mu *MetricsUpdate) AddWorkflowMs(i int64) *MetricsUpdate

AddWorkflowMs adds i to the "workflow_ms" field.

func (*MetricsUpdate) ClearErrorCode

func (mu *MetricsUpdate) ClearErrorCode() *MetricsUpdate

ClearErrorCode clears the value of the "error_code" field.

func (*MetricsUpdate) ClearTransition

func (mu *MetricsUpdate) ClearTransition() *MetricsUpdate

ClearTransition clears the value of the "transition" field.

func (*MetricsUpdate) Exec

func (mu *MetricsUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*MetricsUpdate) ExecX

func (mu *MetricsUpdate) ExecX(ctx context.Context)

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

func (*MetricsUpdate) Mutation

func (mu *MetricsUpdate) Mutation() *MetricsMutation

Mutation returns the MetricsMutation object of the builder.

func (*MetricsUpdate) Save

func (mu *MetricsUpdate) Save(ctx context.Context) (int, error)

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

func (*MetricsUpdate) SaveX

func (mu *MetricsUpdate) SaveX(ctx context.Context) int

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

func (*MetricsUpdate) SetErrorCode

func (mu *MetricsUpdate) SetErrorCode(s string) *MetricsUpdate

SetErrorCode sets the "error_code" field.

func (*MetricsUpdate) SetInstance

func (mu *MetricsUpdate) SetInstance(s string) *MetricsUpdate

SetInstance sets the "instance" field.

func (*MetricsUpdate) SetInvoker

func (mu *MetricsUpdate) SetInvoker(s string) *MetricsUpdate

SetInvoker sets the "invoker" field.

func (*MetricsUpdate) SetIsolateMs

func (mu *MetricsUpdate) SetIsolateMs(i int64) *MetricsUpdate

SetIsolateMs sets the "isolate_ms" field.

func (*MetricsUpdate) SetNamespace

func (mu *MetricsUpdate) SetNamespace(s string) *MetricsUpdate

SetNamespace sets the "namespace" field.

func (*MetricsUpdate) SetNext

func (mu *MetricsUpdate) SetNext(i int8) *MetricsUpdate

SetNext sets the "next" field.

func (*MetricsUpdate) SetNillableErrorCode

func (mu *MetricsUpdate) SetNillableErrorCode(s *string) *MetricsUpdate

SetNillableErrorCode sets the "error_code" field if the given value is not nil.

func (*MetricsUpdate) SetNillableTransition

func (mu *MetricsUpdate) SetNillableTransition(s *string) *MetricsUpdate

SetNillableTransition sets the "transition" field if the given value is not nil.

func (*MetricsUpdate) SetState

func (mu *MetricsUpdate) SetState(s string) *MetricsUpdate

SetState sets the "state" field.

func (*MetricsUpdate) SetTimestamp

func (mu *MetricsUpdate) SetTimestamp(t time.Time) *MetricsUpdate

SetTimestamp sets the "timestamp" field.

func (*MetricsUpdate) SetTransition

func (mu *MetricsUpdate) SetTransition(s string) *MetricsUpdate

SetTransition sets the "transition" field.

func (*MetricsUpdate) SetWorkflow

func (mu *MetricsUpdate) SetWorkflow(s string) *MetricsUpdate

SetWorkflow sets the "workflow" field.

func (*MetricsUpdate) SetWorkflowMs

func (mu *MetricsUpdate) SetWorkflowMs(i int64) *MetricsUpdate

SetWorkflowMs sets the "workflow_ms" field.

func (*MetricsUpdate) Where

func (mu *MetricsUpdate) Where(ps ...predicate.Metrics) *MetricsUpdate

Where adds a new predicate for the MetricsUpdate builder.

type MetricsUpdateOne

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

MetricsUpdateOne is the builder for updating a single Metrics entity.

func (*MetricsUpdateOne) AddIsolateMs

func (muo *MetricsUpdateOne) AddIsolateMs(i int64) *MetricsUpdateOne

AddIsolateMs adds i to the "isolate_ms" field.

func (*MetricsUpdateOne) AddNext

func (muo *MetricsUpdateOne) AddNext(i int8) *MetricsUpdateOne

AddNext adds i to the "next" field.

func (*MetricsUpdateOne) AddWorkflowMs

func (muo *MetricsUpdateOne) AddWorkflowMs(i int64) *MetricsUpdateOne

AddWorkflowMs adds i to the "workflow_ms" field.

func (*MetricsUpdateOne) ClearErrorCode

func (muo *MetricsUpdateOne) ClearErrorCode() *MetricsUpdateOne

ClearErrorCode clears the value of the "error_code" field.

func (*MetricsUpdateOne) ClearTransition

func (muo *MetricsUpdateOne) ClearTransition() *MetricsUpdateOne

ClearTransition clears the value of the "transition" field.

func (*MetricsUpdateOne) Exec

func (muo *MetricsUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*MetricsUpdateOne) ExecX

func (muo *MetricsUpdateOne) ExecX(ctx context.Context)

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

func (*MetricsUpdateOne) Mutation

func (muo *MetricsUpdateOne) Mutation() *MetricsMutation

Mutation returns the MetricsMutation object of the builder.

func (*MetricsUpdateOne) Save

func (muo *MetricsUpdateOne) Save(ctx context.Context) (*Metrics, error)

Save executes the query and returns the updated Metrics entity.

func (*MetricsUpdateOne) SaveX

func (muo *MetricsUpdateOne) SaveX(ctx context.Context) *Metrics

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

func (*MetricsUpdateOne) SetErrorCode

func (muo *MetricsUpdateOne) SetErrorCode(s string) *MetricsUpdateOne

SetErrorCode sets the "error_code" field.

func (*MetricsUpdateOne) SetInstance

func (muo *MetricsUpdateOne) SetInstance(s string) *MetricsUpdateOne

SetInstance sets the "instance" field.

func (*MetricsUpdateOne) SetInvoker

func (muo *MetricsUpdateOne) SetInvoker(s string) *MetricsUpdateOne

SetInvoker sets the "invoker" field.

func (*MetricsUpdateOne) SetIsolateMs

func (muo *MetricsUpdateOne) SetIsolateMs(i int64) *MetricsUpdateOne

SetIsolateMs sets the "isolate_ms" field.

func (*MetricsUpdateOne) SetNamespace

func (muo *MetricsUpdateOne) SetNamespace(s string) *MetricsUpdateOne

SetNamespace sets the "namespace" field.

func (*MetricsUpdateOne) SetNext

func (muo *MetricsUpdateOne) SetNext(i int8) *MetricsUpdateOne

SetNext sets the "next" field.

func (*MetricsUpdateOne) SetNillableErrorCode

func (muo *MetricsUpdateOne) SetNillableErrorCode(s *string) *MetricsUpdateOne

SetNillableErrorCode sets the "error_code" field if the given value is not nil.

func (*MetricsUpdateOne) SetNillableTransition

func (muo *MetricsUpdateOne) SetNillableTransition(s *string) *MetricsUpdateOne

SetNillableTransition sets the "transition" field if the given value is not nil.

func (*MetricsUpdateOne) SetState

func (muo *MetricsUpdateOne) SetState(s string) *MetricsUpdateOne

SetState sets the "state" field.

func (*MetricsUpdateOne) SetTimestamp

func (muo *MetricsUpdateOne) SetTimestamp(t time.Time) *MetricsUpdateOne

SetTimestamp sets the "timestamp" field.

func (*MetricsUpdateOne) SetTransition

func (muo *MetricsUpdateOne) SetTransition(s string) *MetricsUpdateOne

SetTransition sets the "transition" field.

func (*MetricsUpdateOne) SetWorkflow

func (muo *MetricsUpdateOne) SetWorkflow(s string) *MetricsUpdateOne

SetWorkflow sets the "workflow" field.

func (*MetricsUpdateOne) SetWorkflowMs

func (muo *MetricsUpdateOne) SetWorkflowMs(i int64) *MetricsUpdateOne

SetWorkflowMs sets the "workflow_ms" field.

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(...interface{})) Option

Log sets the logging function for debug mode.

type OrderFunc

type OrderFunc func(*sql.Selector, func(string) bool)

OrderFunc applies an ordering on the sql selector.

func Asc

func Asc(fields ...string) OrderFunc

Asc applies the given fields in ASC order.

func Desc

func Desc(fields ...string) OrderFunc

Desc applies the given fields in DESC order.

type Policy

type Policy = ent.Policy

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

type Query

type Query = ent.Query

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(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 Rollbacker method.

type Tx

type Tx struct {

	// Metrics is the client for interacting with the Metrics builders.
	Metrics *MetricsClient
	// 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 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