ent

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: May 12, 2022 License: Apache-2.0 Imports: 19 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.
	TypeRevision = "Revision"
)

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 validation error.

func MaskNotFound

func MaskNotFound(err error) error

MaskNotFound masks not found error.

func NewContext

func NewContext(parent context.Context, c *Client) context.Context

NewContext returns a new context with the given Client attached.

func NewTxContext

func NewTxContext(parent context.Context, tx *Tx) context.Context

NewTxContext returns a new context with the given Tx attached.

Types

type AggregateFunc

type AggregateFunc func(*sql.Selector) string

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

func As

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

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

func Count

func Count() AggregateFunc

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

func Max

func Max(field string) AggregateFunc

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

func Mean

func Mean(field string) AggregateFunc

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

func Min

func Min(field string) AggregateFunc

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

func Sum

func Sum(field string) AggregateFunc

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

type Client

type Client struct {

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

func (*Client) ExecContext

func (c *Client) ExecContext(ctx context.Context, query string, args ...interface{}) (stdsql.Result, error)

ExecContext allows calling the underlying ExecContext method of the driver if it is supported by it. See, database/sql#DB.ExecContext for more information.

func (*Client) QueryContext

func (c *Client) QueryContext(ctx context.Context, query string, args ...interface{}) (*stdsql.Rows, error)

QueryContext allows calling the underlying QueryContext method of the driver if it is supported by it. See, database/sql#DB.QueryContext for more information.

func (*Client) Tx

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

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

func (*Client) Use

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

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

type CommitFunc

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

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

func (CommitFunc) Commit

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

Commit calls f(ctx, m).

type CommitHook

type CommitHook func(Committer) Committer

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

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

type Committer

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

Committer is the interface that wraps the Commit method.

type ConstraintError

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

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

func (ConstraintError) Error

func (e ConstraintError) Error() string

Error implements the error interface.

func (*ConstraintError) Unwrap

func (e *ConstraintError) Unwrap() error

Unwrap implements the errors.Wrapper interface.

type Hook

type Hook = ent.Hook

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

type 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 AlternateSchema

func AlternateSchema(schemaConfig SchemaConfig) Option

AlternateSchemas allows alternate schema names to be passed into ent operations.

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)

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 Revision

type Revision struct {

	// ID of the ent.
	ID string `json:"id,omitempty"`
	// Description holds the value of the "description" field.
	Description string `json:"description,omitempty"`
	// ExecutionState holds the value of the "execution_state" field.
	ExecutionState revision.ExecutionState `json:"execution_state,omitempty"`
	// ExecutedAt holds the value of the "executed_at" field.
	ExecutedAt time.Time `json:"executed_at,omitempty"`
	// ExecutionTime holds the value of the "execution_time" field.
	ExecutionTime time.Duration `json:"execution_time,omitempty"`
	// Hash holds the value of the "hash" field.
	Hash string `json:"hash,omitempty"`
	// OperatorVersion holds the value of the "operator_version" field.
	OperatorVersion string `json:"operator_version,omitempty"`
	// Meta holds the value of the "meta" field.
	Meta map[string]string `json:"meta,omitempty"`
	// contains filtered or unexported fields
}

Revision is the model entity for the Revision schema.

func (*Revision) ExecContext

func (c *Revision) ExecContext(ctx context.Context, query string, args ...interface{}) (stdsql.Result, error)

ExecContext allows calling the underlying ExecContext method of the driver if it is supported by it. See, database/sql#DB.ExecContext for more information.

func (*Revision) QueryContext

func (c *Revision) QueryContext(ctx context.Context, query string, args ...interface{}) (*stdsql.Rows, error)

QueryContext allows calling the underlying QueryContext method of the driver if it is supported by it. See, database/sql#DB.QueryContext for more information.

func (*Revision) String

func (r *Revision) String() string

String implements the fmt.Stringer.

func (*Revision) Unwrap

func (r *Revision) Unwrap() *Revision

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

func (r *Revision) Update() *RevisionUpdateOne

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

type RevisionClient

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

RevisionClient is a client for the Revision schema.

func NewRevisionClient

func NewRevisionClient(c config) *RevisionClient

NewRevisionClient returns a client for the Revision from the given config.

func (*RevisionClient) Create

func (c *RevisionClient) Create() *RevisionCreate

Create returns a create builder for Revision.

func (*RevisionClient) CreateBulk

func (c *RevisionClient) CreateBulk(builders ...*RevisionCreate) *RevisionCreateBulk

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

func (*RevisionClient) Delete

func (c *RevisionClient) Delete() *RevisionDelete

Delete returns a delete builder for Revision.

func (*RevisionClient) DeleteOne

func (c *RevisionClient) DeleteOne(r *Revision) *RevisionDeleteOne

DeleteOne returns a delete builder for the given entity.

func (*RevisionClient) DeleteOneID

func (c *RevisionClient) DeleteOneID(id string) *RevisionDeleteOne

DeleteOneID returns a delete builder for the given id.

func (*RevisionClient) ExecContext

func (c *RevisionClient) ExecContext(ctx context.Context, query string, args ...interface{}) (stdsql.Result, error)

ExecContext allows calling the underlying ExecContext method of the driver if it is supported by it. See, database/sql#DB.ExecContext for more information.

func (*RevisionClient) Get

func (c *RevisionClient) Get(ctx context.Context, id string) (*Revision, error)

Get returns a Revision entity by its id.

func (*RevisionClient) GetX

func (c *RevisionClient) GetX(ctx context.Context, id string) *Revision

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

func (*RevisionClient) Hooks

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

Hooks returns the client hooks.

func (*RevisionClient) Query

func (c *RevisionClient) Query() *RevisionQuery

Query returns a query builder for Revision.

func (*RevisionClient) QueryContext

func (c *RevisionClient) QueryContext(ctx context.Context, query string, args ...interface{}) (*stdsql.Rows, error)

QueryContext allows calling the underlying QueryContext method of the driver if it is supported by it. See, database/sql#DB.QueryContext for more information.

func (*RevisionClient) Update

func (c *RevisionClient) Update() *RevisionUpdate

Update returns an update builder for Revision.

func (*RevisionClient) UpdateOne

func (c *RevisionClient) UpdateOne(r *Revision) *RevisionUpdateOne

UpdateOne returns an update builder for the given entity.

func (*RevisionClient) UpdateOneID

func (c *RevisionClient) UpdateOneID(id string) *RevisionUpdateOne

UpdateOneID returns an update builder for the given id.

func (*RevisionClient) Use

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

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

type RevisionCreate

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

RevisionCreate is the builder for creating a Revision entity.

func (*RevisionCreate) Exec

func (rc *RevisionCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*RevisionCreate) ExecContext

func (c *RevisionCreate) ExecContext(ctx context.Context, query string, args ...interface{}) (stdsql.Result, error)

ExecContext allows calling the underlying ExecContext method of the driver if it is supported by it. See, database/sql#DB.ExecContext for more information.

func (*RevisionCreate) ExecX

func (rc *RevisionCreate) ExecX(ctx context.Context)

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

func (*RevisionCreate) Mutation

func (rc *RevisionCreate) Mutation() *RevisionMutation

Mutation returns the RevisionMutation object of the builder.

func (*RevisionCreate) OnConflict

func (rc *RevisionCreate) OnConflict(opts ...sql.ConflictOption) *RevisionUpsertOne

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

client.Revision.Create().
	SetDescription(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.RevisionUpsert) {
		SetDescription(v+v).
	}).
	Exec(ctx)

func (*RevisionCreate) OnConflictColumns

func (rc *RevisionCreate) OnConflictColumns(columns ...string) *RevisionUpsertOne

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

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

func (*RevisionCreate) QueryContext

func (c *RevisionCreate) QueryContext(ctx context.Context, query string, args ...interface{}) (*stdsql.Rows, error)

QueryContext allows calling the underlying QueryContext method of the driver if it is supported by it. See, database/sql#DB.QueryContext for more information.

func (*RevisionCreate) Save

func (rc *RevisionCreate) Save(ctx context.Context) (*Revision, error)

Save creates the Revision in the database.

func (*RevisionCreate) SaveX

func (rc *RevisionCreate) SaveX(ctx context.Context) *Revision

SaveX calls Save and panics if Save returns an error.

func (*RevisionCreate) SetDescription

func (rc *RevisionCreate) SetDescription(s string) *RevisionCreate

SetDescription sets the "description" field.

func (*RevisionCreate) SetExecutedAt

func (rc *RevisionCreate) SetExecutedAt(t time.Time) *RevisionCreate

SetExecutedAt sets the "executed_at" field.

func (*RevisionCreate) SetExecutionState

func (rc *RevisionCreate) SetExecutionState(rs revision.ExecutionState) *RevisionCreate

SetExecutionState sets the "execution_state" field.

func (*RevisionCreate) SetExecutionTime

func (rc *RevisionCreate) SetExecutionTime(t time.Duration) *RevisionCreate

SetExecutionTime sets the "execution_time" field.

func (*RevisionCreate) SetHash

func (rc *RevisionCreate) SetHash(s string) *RevisionCreate

SetHash sets the "hash" field.

func (*RevisionCreate) SetID

func (rc *RevisionCreate) SetID(s string) *RevisionCreate

SetID sets the "id" field.

func (*RevisionCreate) SetMeta

func (rc *RevisionCreate) SetMeta(m map[string]string) *RevisionCreate

SetMeta sets the "meta" field.

func (*RevisionCreate) SetOperatorVersion

func (rc *RevisionCreate) SetOperatorVersion(s string) *RevisionCreate

SetOperatorVersion sets the "operator_version" field.

type RevisionCreateBulk

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

RevisionCreateBulk is the builder for creating many Revision entities in bulk.

func (*RevisionCreateBulk) Exec

func (rcb *RevisionCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*RevisionCreateBulk) ExecContext

func (c *RevisionCreateBulk) ExecContext(ctx context.Context, query string, args ...interface{}) (stdsql.Result, error)

ExecContext allows calling the underlying ExecContext method of the driver if it is supported by it. See, database/sql#DB.ExecContext for more information.

func (*RevisionCreateBulk) ExecX

func (rcb *RevisionCreateBulk) ExecX(ctx context.Context)

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

func (*RevisionCreateBulk) OnConflict

func (rcb *RevisionCreateBulk) OnConflict(opts ...sql.ConflictOption) *RevisionUpsertBulk

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

client.Revision.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.RevisionUpsert) {
		SetDescription(v+v).
	}).
	Exec(ctx)

func (*RevisionCreateBulk) OnConflictColumns

func (rcb *RevisionCreateBulk) OnConflictColumns(columns ...string) *RevisionUpsertBulk

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

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

func (*RevisionCreateBulk) QueryContext

func (c *RevisionCreateBulk) QueryContext(ctx context.Context, query string, args ...interface{}) (*stdsql.Rows, error)

QueryContext allows calling the underlying QueryContext method of the driver if it is supported by it. See, database/sql#DB.QueryContext for more information.

func (*RevisionCreateBulk) Save

func (rcb *RevisionCreateBulk) Save(ctx context.Context) ([]*Revision, error)

Save creates the Revision entities in the database.

func (*RevisionCreateBulk) SaveX

func (rcb *RevisionCreateBulk) SaveX(ctx context.Context) []*Revision

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

type RevisionDelete

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

RevisionDelete is the builder for deleting a Revision entity.

func (*RevisionDelete) Exec

func (rd *RevisionDelete) Exec(ctx context.Context) (int, error)

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

func (*RevisionDelete) ExecContext

func (c *RevisionDelete) ExecContext(ctx context.Context, query string, args ...interface{}) (stdsql.Result, error)

ExecContext allows calling the underlying ExecContext method of the driver if it is supported by it. See, database/sql#DB.ExecContext for more information.

func (*RevisionDelete) ExecX

func (rd *RevisionDelete) ExecX(ctx context.Context) int

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

func (*RevisionDelete) QueryContext

func (c *RevisionDelete) QueryContext(ctx context.Context, query string, args ...interface{}) (*stdsql.Rows, error)

QueryContext allows calling the underlying QueryContext method of the driver if it is supported by it. See, database/sql#DB.QueryContext for more information.

func (*RevisionDelete) Where

func (rd *RevisionDelete) Where(ps ...predicate.Revision) *RevisionDelete

Where appends a list predicates to the RevisionDelete builder.

type RevisionDeleteOne

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

RevisionDeleteOne is the builder for deleting a single Revision entity.

func (*RevisionDeleteOne) Exec

func (rdo *RevisionDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*RevisionDeleteOne) ExecX

func (rdo *RevisionDeleteOne) ExecX(ctx context.Context)

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

type RevisionGroupBy

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

RevisionGroupBy is the group-by builder for Revision entities.

func (*RevisionGroupBy) Aggregate

func (rgb *RevisionGroupBy) Aggregate(fns ...AggregateFunc) *RevisionGroupBy

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

func (*RevisionGroupBy) Bool

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

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

func (*RevisionGroupBy) BoolX

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

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

func (*RevisionGroupBy) Bools

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

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

func (*RevisionGroupBy) BoolsX

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

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

func (*RevisionGroupBy) ExecContext

func (c *RevisionGroupBy) ExecContext(ctx context.Context, query string, args ...interface{}) (stdsql.Result, error)

ExecContext allows calling the underlying ExecContext method of the driver if it is supported by it. See, database/sql#DB.ExecContext for more information.

func (*RevisionGroupBy) Float64

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

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

func (*RevisionGroupBy) Float64X

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

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

func (*RevisionGroupBy) Float64s

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

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

func (*RevisionGroupBy) Float64sX

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

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

func (*RevisionGroupBy) Int

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

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

func (*RevisionGroupBy) IntX

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

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

func (*RevisionGroupBy) Ints

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

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

func (*RevisionGroupBy) IntsX

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

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

func (*RevisionGroupBy) QueryContext

func (c *RevisionGroupBy) QueryContext(ctx context.Context, query string, args ...interface{}) (*stdsql.Rows, error)

QueryContext allows calling the underlying QueryContext method of the driver if it is supported by it. See, database/sql#DB.QueryContext for more information.

func (*RevisionGroupBy) Scan

func (rgb *RevisionGroupBy) Scan(ctx context.Context, v interface{}) error

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

func (*RevisionGroupBy) ScanX

func (s *RevisionGroupBy) ScanX(ctx context.Context, v interface{})

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

func (*RevisionGroupBy) String

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

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

func (*RevisionGroupBy) StringX

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

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

func (*RevisionGroupBy) Strings

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

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

func (*RevisionGroupBy) StringsX

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

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

type RevisionMutation

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

RevisionMutation represents an operation that mutates the Revision nodes in the graph.

func (*RevisionMutation) AddExecutionTime

func (m *RevisionMutation) AddExecutionTime(t time.Duration)

AddExecutionTime adds t to the "execution_time" field.

func (*RevisionMutation) AddField

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

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

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

func (*RevisionMutation) AddedExecutionTime

func (m *RevisionMutation) AddedExecutionTime() (r time.Duration, exists bool)

AddedExecutionTime returns the value that was added to the "execution_time" field in this mutation.

func (*RevisionMutation) AddedField

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

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

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

func (*RevisionMutation) AddedIDs

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

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

func (*RevisionMutation) ClearEdge

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

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

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

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

func (*RevisionMutation) ClearedFields

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

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

func (RevisionMutation) Client

func (m RevisionMutation) 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 (*RevisionMutation) Description

func (m *RevisionMutation) Description() (r string, exists bool)

Description returns the value of the "description" field in the mutation.

func (*RevisionMutation) EdgeCleared

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

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

func (*RevisionMutation) ExecContext

func (c *RevisionMutation) ExecContext(ctx context.Context, query string, args ...interface{}) (stdsql.Result, error)

ExecContext allows calling the underlying ExecContext method of the driver if it is supported by it. See, database/sql#DB.ExecContext for more information.

func (*RevisionMutation) ExecutedAt

func (m *RevisionMutation) ExecutedAt() (r time.Time, exists bool)

ExecutedAt returns the value of the "executed_at" field in the mutation.

func (*RevisionMutation) ExecutionState

func (m *RevisionMutation) ExecutionState() (r revision.ExecutionState, exists bool)

ExecutionState returns the value of the "execution_state" field in the mutation.

func (*RevisionMutation) ExecutionTime

func (m *RevisionMutation) ExecutionTime() (r time.Duration, exists bool)

ExecutionTime returns the value of the "execution_time" field in the mutation.

func (*RevisionMutation) Field

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

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

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

func (*RevisionMutation) Fields

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

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

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

func (*RevisionMutation) ID

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

func (m *RevisionMutation) 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 (*RevisionMutation) Meta

func (m *RevisionMutation) Meta() (r map[string]string, exists bool)

Meta returns the value of the "meta" field in the mutation.

func (*RevisionMutation) OldDescription

func (m *RevisionMutation) OldDescription(ctx context.Context) (v string, err error)

OldDescription returns the old "description" field's value of the Revision entity. If the Revision 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 (*RevisionMutation) OldExecutedAt

func (m *RevisionMutation) OldExecutedAt(ctx context.Context) (v time.Time, err error)

OldExecutedAt returns the old "executed_at" field's value of the Revision entity. If the Revision 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 (*RevisionMutation) OldExecutionState

func (m *RevisionMutation) OldExecutionState(ctx context.Context) (v revision.ExecutionState, err error)

OldExecutionState returns the old "execution_state" field's value of the Revision entity. If the Revision 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 (*RevisionMutation) OldExecutionTime

func (m *RevisionMutation) OldExecutionTime(ctx context.Context) (v time.Duration, err error)

OldExecutionTime returns the old "execution_time" field's value of the Revision entity. If the Revision 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 (*RevisionMutation) OldField

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

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

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

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

OldMeta returns the old "meta" field's value of the Revision entity. If the Revision 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 (*RevisionMutation) OldOperatorVersion

func (m *RevisionMutation) OldOperatorVersion(ctx context.Context) (v string, err error)

OldOperatorVersion returns the old "operator_version" field's value of the Revision entity. If the Revision 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 (*RevisionMutation) Op

func (m *RevisionMutation) Op() Op

Op returns the operation name.

func (*RevisionMutation) OperatorVersion

func (m *RevisionMutation) OperatorVersion() (r string, exists bool)

OperatorVersion returns the value of the "operator_version" field in the mutation.

func (*RevisionMutation) QueryContext

func (c *RevisionMutation) QueryContext(ctx context.Context, query string, args ...interface{}) (*stdsql.Rows, error)

QueryContext allows calling the underlying QueryContext method of the driver if it is supported by it. See, database/sql#DB.QueryContext for more information.

func (*RevisionMutation) RemovedEdges

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

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

func (*RevisionMutation) RemovedIDs

func (m *RevisionMutation) 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 (*RevisionMutation) ResetDescription

func (m *RevisionMutation) ResetDescription()

ResetDescription resets all changes to the "description" field.

func (*RevisionMutation) ResetEdge

func (m *RevisionMutation) 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 (*RevisionMutation) ResetExecutedAt

func (m *RevisionMutation) ResetExecutedAt()

ResetExecutedAt resets all changes to the "executed_at" field.

func (*RevisionMutation) ResetExecutionState

func (m *RevisionMutation) ResetExecutionState()

ResetExecutionState resets all changes to the "execution_state" field.

func (*RevisionMutation) ResetExecutionTime

func (m *RevisionMutation) ResetExecutionTime()

ResetExecutionTime resets all changes to the "execution_time" field.

func (*RevisionMutation) ResetField

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

func (m *RevisionMutation) ResetHash()

ResetHash resets all changes to the "hash" field.

func (*RevisionMutation) ResetMeta

func (m *RevisionMutation) ResetMeta()

ResetMeta resets all changes to the "meta" field.

func (*RevisionMutation) ResetOperatorVersion

func (m *RevisionMutation) ResetOperatorVersion()

ResetOperatorVersion resets all changes to the "operator_version" field.

func (*RevisionMutation) SetDescription

func (m *RevisionMutation) SetDescription(s string)

SetDescription sets the "description" field.

func (*RevisionMutation) SetExecutedAt

func (m *RevisionMutation) SetExecutedAt(t time.Time)

SetExecutedAt sets the "executed_at" field.

func (*RevisionMutation) SetExecutionState

func (m *RevisionMutation) SetExecutionState(rs revision.ExecutionState)

SetExecutionState sets the "execution_state" field.

func (*RevisionMutation) SetExecutionTime

func (m *RevisionMutation) SetExecutionTime(t time.Duration)

SetExecutionTime sets the "execution_time" field.

func (*RevisionMutation) SetField

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

func (m *RevisionMutation) SetHash(s string)

SetHash sets the "hash" field.

func (*RevisionMutation) SetID

func (m *RevisionMutation) SetID(id string)

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

func (*RevisionMutation) SetMeta

func (m *RevisionMutation) SetMeta(value map[string]string)

SetMeta sets the "meta" field.

func (*RevisionMutation) SetOperatorVersion

func (m *RevisionMutation) SetOperatorVersion(s string)

SetOperatorVersion sets the "operator_version" field.

func (RevisionMutation) Tx

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

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

func (*RevisionMutation) Type

func (m *RevisionMutation) Type() string

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

func (*RevisionMutation) Where

func (m *RevisionMutation) Where(ps ...predicate.Revision)

Where appends a list predicates to the RevisionMutation builder.

type RevisionQuery

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

RevisionQuery is the builder for querying Revision entities.

func (*RevisionQuery) All

func (rq *RevisionQuery) All(ctx context.Context) ([]*Revision, error)

All executes the query and returns a list of Revisions.

func (*RevisionQuery) AllX

func (rq *RevisionQuery) AllX(ctx context.Context) []*Revision

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

func (*RevisionQuery) Clone

func (rq *RevisionQuery) Clone() *RevisionQuery

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

func (*RevisionQuery) Count

func (rq *RevisionQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*RevisionQuery) CountX

func (rq *RevisionQuery) CountX(ctx context.Context) int

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

func (*RevisionQuery) ExecContext

func (c *RevisionQuery) ExecContext(ctx context.Context, query string, args ...interface{}) (stdsql.Result, error)

ExecContext allows calling the underlying ExecContext method of the driver if it is supported by it. See, database/sql#DB.ExecContext for more information.

func (*RevisionQuery) Exist

func (rq *RevisionQuery) Exist(ctx context.Context) (bool, error)

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

func (*RevisionQuery) ExistX

func (rq *RevisionQuery) ExistX(ctx context.Context) bool

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

func (*RevisionQuery) First

func (rq *RevisionQuery) First(ctx context.Context) (*Revision, error)

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

func (*RevisionQuery) FirstID

func (rq *RevisionQuery) FirstID(ctx context.Context) (id string, err error)

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

func (*RevisionQuery) FirstIDX

func (rq *RevisionQuery) FirstIDX(ctx context.Context) string

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

func (*RevisionQuery) FirstX

func (rq *RevisionQuery) FirstX(ctx context.Context) *Revision

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

func (*RevisionQuery) GroupBy

func (rq *RevisionQuery) GroupBy(field string, fields ...string) *RevisionGroupBy

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

client.Revision.Query().
	GroupBy(revision.FieldDescription).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*RevisionQuery) IDs

func (rq *RevisionQuery) IDs(ctx context.Context) ([]string, error)

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

func (*RevisionQuery) IDsX

func (rq *RevisionQuery) IDsX(ctx context.Context) []string

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

func (*RevisionQuery) Limit

func (rq *RevisionQuery) Limit(limit int) *RevisionQuery

Limit adds a limit step to the query.

func (*RevisionQuery) Offset

func (rq *RevisionQuery) Offset(offset int) *RevisionQuery

Offset adds an offset step to the query.

func (*RevisionQuery) Only

func (rq *RevisionQuery) Only(ctx context.Context) (*Revision, error)

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

func (*RevisionQuery) OnlyID

func (rq *RevisionQuery) OnlyID(ctx context.Context) (id string, err error)

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

func (*RevisionQuery) OnlyIDX

func (rq *RevisionQuery) OnlyIDX(ctx context.Context) string

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

func (*RevisionQuery) OnlyX

func (rq *RevisionQuery) OnlyX(ctx context.Context) *Revision

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

func (*RevisionQuery) Order

func (rq *RevisionQuery) Order(o ...OrderFunc) *RevisionQuery

Order adds an order step to the query.

func (*RevisionQuery) QueryContext

func (c *RevisionQuery) QueryContext(ctx context.Context, query string, args ...interface{}) (*stdsql.Rows, error)

QueryContext allows calling the underlying QueryContext method of the driver if it is supported by it. See, database/sql#DB.QueryContext for more information.

func (*RevisionQuery) Select

func (rq *RevisionQuery) Select(fields ...string) *RevisionSelect

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

client.Revision.Query().
	Select(revision.FieldDescription).
	Scan(ctx, &v)

func (*RevisionQuery) Unique

func (rq *RevisionQuery) Unique(unique bool) *RevisionQuery

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

func (rq *RevisionQuery) Where(ps ...predicate.Revision) *RevisionQuery

Where adds a new predicate for the RevisionQuery builder.

type RevisionSelect

type RevisionSelect struct {
	*RevisionQuery
	// contains filtered or unexported fields
}

RevisionSelect is the builder for selecting fields of Revision entities.

func (*RevisionSelect) Bool

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

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

func (*RevisionSelect) BoolX

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

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

func (*RevisionSelect) Bools

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

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

func (*RevisionSelect) BoolsX

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

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

func (RevisionSelect) ExecContext

func (c RevisionSelect) ExecContext(ctx context.Context, query string, args ...interface{}) (stdsql.Result, error)

ExecContext allows calling the underlying ExecContext method of the driver if it is supported by it. See, database/sql#DB.ExecContext for more information.

func (*RevisionSelect) Float64

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

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

func (*RevisionSelect) Float64X

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

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

func (*RevisionSelect) Float64s

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

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

func (*RevisionSelect) Float64sX

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

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

func (*RevisionSelect) Int

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

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

func (*RevisionSelect) IntX

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

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

func (*RevisionSelect) Ints

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

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

func (*RevisionSelect) IntsX

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

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

func (RevisionSelect) QueryContext

func (c RevisionSelect) QueryContext(ctx context.Context, query string, args ...interface{}) (*stdsql.Rows, error)

QueryContext allows calling the underlying QueryContext method of the driver if it is supported by it. See, database/sql#DB.QueryContext for more information.

func (*RevisionSelect) Scan

func (rs *RevisionSelect) Scan(ctx context.Context, v interface{}) error

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

func (*RevisionSelect) ScanX

func (s *RevisionSelect) ScanX(ctx context.Context, v interface{})

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

func (*RevisionSelect) String

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

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

func (*RevisionSelect) StringX

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

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

func (*RevisionSelect) Strings

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

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

func (*RevisionSelect) StringsX

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

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

type RevisionUpdate

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

RevisionUpdate is the builder for updating Revision entities.

func (*RevisionUpdate) AddExecutionTime

func (ru *RevisionUpdate) AddExecutionTime(t time.Duration) *RevisionUpdate

AddExecutionTime adds t to the "execution_time" field.

func (*RevisionUpdate) Exec

func (ru *RevisionUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*RevisionUpdate) ExecContext

func (c *RevisionUpdate) ExecContext(ctx context.Context, query string, args ...interface{}) (stdsql.Result, error)

ExecContext allows calling the underlying ExecContext method of the driver if it is supported by it. See, database/sql#DB.ExecContext for more information.

func (*RevisionUpdate) ExecX

func (ru *RevisionUpdate) ExecX(ctx context.Context)

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

func (*RevisionUpdate) Mutation

func (ru *RevisionUpdate) Mutation() *RevisionMutation

Mutation returns the RevisionMutation object of the builder.

func (*RevisionUpdate) QueryContext

func (c *RevisionUpdate) QueryContext(ctx context.Context, query string, args ...interface{}) (*stdsql.Rows, error)

QueryContext allows calling the underlying QueryContext method of the driver if it is supported by it. See, database/sql#DB.QueryContext for more information.

func (*RevisionUpdate) Save

func (ru *RevisionUpdate) Save(ctx context.Context) (int, error)

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

func (*RevisionUpdate) SaveX

func (ru *RevisionUpdate) SaveX(ctx context.Context) int

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

func (*RevisionUpdate) SetDescription

func (ru *RevisionUpdate) SetDescription(s string) *RevisionUpdate

SetDescription sets the "description" field.

func (*RevisionUpdate) SetExecutedAt

func (ru *RevisionUpdate) SetExecutedAt(t time.Time) *RevisionUpdate

SetExecutedAt sets the "executed_at" field.

func (*RevisionUpdate) SetExecutionState

func (ru *RevisionUpdate) SetExecutionState(rs revision.ExecutionState) *RevisionUpdate

SetExecutionState sets the "execution_state" field.

func (*RevisionUpdate) SetExecutionTime

func (ru *RevisionUpdate) SetExecutionTime(t time.Duration) *RevisionUpdate

SetExecutionTime sets the "execution_time" field.

func (*RevisionUpdate) SetHash

func (ru *RevisionUpdate) SetHash(s string) *RevisionUpdate

SetHash sets the "hash" field.

func (*RevisionUpdate) SetMeta

func (ru *RevisionUpdate) SetMeta(m map[string]string) *RevisionUpdate

SetMeta sets the "meta" field.

func (*RevisionUpdate) SetOperatorVersion

func (ru *RevisionUpdate) SetOperatorVersion(s string) *RevisionUpdate

SetOperatorVersion sets the "operator_version" field.

func (*RevisionUpdate) Where

func (ru *RevisionUpdate) Where(ps ...predicate.Revision) *RevisionUpdate

Where appends a list predicates to the RevisionUpdate builder.

type RevisionUpdateOne

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

RevisionUpdateOne is the builder for updating a single Revision entity.

func (*RevisionUpdateOne) AddExecutionTime

func (ruo *RevisionUpdateOne) AddExecutionTime(t time.Duration) *RevisionUpdateOne

AddExecutionTime adds t to the "execution_time" field.

func (*RevisionUpdateOne) Exec

func (ruo *RevisionUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*RevisionUpdateOne) ExecContext

func (c *RevisionUpdateOne) ExecContext(ctx context.Context, query string, args ...interface{}) (stdsql.Result, error)

ExecContext allows calling the underlying ExecContext method of the driver if it is supported by it. See, database/sql#DB.ExecContext for more information.

func (*RevisionUpdateOne) ExecX

func (ruo *RevisionUpdateOne) ExecX(ctx context.Context)

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

func (*RevisionUpdateOne) Mutation

func (ruo *RevisionUpdateOne) Mutation() *RevisionMutation

Mutation returns the RevisionMutation object of the builder.

func (*RevisionUpdateOne) QueryContext

func (c *RevisionUpdateOne) QueryContext(ctx context.Context, query string, args ...interface{}) (*stdsql.Rows, error)

QueryContext allows calling the underlying QueryContext method of the driver if it is supported by it. See, database/sql#DB.QueryContext for more information.

func (*RevisionUpdateOne) Save

func (ruo *RevisionUpdateOne) Save(ctx context.Context) (*Revision, error)

Save executes the query and returns the updated Revision entity.

func (*RevisionUpdateOne) SaveX

func (ruo *RevisionUpdateOne) SaveX(ctx context.Context) *Revision

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

func (*RevisionUpdateOne) Select

func (ruo *RevisionUpdateOne) Select(field string, fields ...string) *RevisionUpdateOne

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

func (*RevisionUpdateOne) SetDescription

func (ruo *RevisionUpdateOne) SetDescription(s string) *RevisionUpdateOne

SetDescription sets the "description" field.

func (*RevisionUpdateOne) SetExecutedAt

func (ruo *RevisionUpdateOne) SetExecutedAt(t time.Time) *RevisionUpdateOne

SetExecutedAt sets the "executed_at" field.

func (*RevisionUpdateOne) SetExecutionState

func (ruo *RevisionUpdateOne) SetExecutionState(rs revision.ExecutionState) *RevisionUpdateOne

SetExecutionState sets the "execution_state" field.

func (*RevisionUpdateOne) SetExecutionTime

func (ruo *RevisionUpdateOne) SetExecutionTime(t time.Duration) *RevisionUpdateOne

SetExecutionTime sets the "execution_time" field.

func (*RevisionUpdateOne) SetHash

func (ruo *RevisionUpdateOne) SetHash(s string) *RevisionUpdateOne

SetHash sets the "hash" field.

func (*RevisionUpdateOne) SetMeta

func (ruo *RevisionUpdateOne) SetMeta(m map[string]string) *RevisionUpdateOne

SetMeta sets the "meta" field.

func (*RevisionUpdateOne) SetOperatorVersion

func (ruo *RevisionUpdateOne) SetOperatorVersion(s string) *RevisionUpdateOne

SetOperatorVersion sets the "operator_version" field.

type RevisionUpsert

type RevisionUpsert struct {
	*sql.UpdateSet
}

RevisionUpsert is the "OnConflict" setter.

func (*RevisionUpsert) AddExecutionTime

func (u *RevisionUpsert) AddExecutionTime(v time.Duration) *RevisionUpsert

AddExecutionTime adds v to the "execution_time" field.

func (*RevisionUpsert) SetDescription

func (u *RevisionUpsert) SetDescription(v string) *RevisionUpsert

SetDescription sets the "description" field.

func (*RevisionUpsert) SetExecutedAt

func (u *RevisionUpsert) SetExecutedAt(v time.Time) *RevisionUpsert

SetExecutedAt sets the "executed_at" field.

func (*RevisionUpsert) SetExecutionState

func (u *RevisionUpsert) SetExecutionState(v revision.ExecutionState) *RevisionUpsert

SetExecutionState sets the "execution_state" field.

func (*RevisionUpsert) SetExecutionTime

func (u *RevisionUpsert) SetExecutionTime(v time.Duration) *RevisionUpsert

SetExecutionTime sets the "execution_time" field.

func (*RevisionUpsert) SetHash

func (u *RevisionUpsert) SetHash(v string) *RevisionUpsert

SetHash sets the "hash" field.

func (*RevisionUpsert) SetMeta

func (u *RevisionUpsert) SetMeta(v map[string]string) *RevisionUpsert

SetMeta sets the "meta" field.

func (*RevisionUpsert) SetOperatorVersion

func (u *RevisionUpsert) SetOperatorVersion(v string) *RevisionUpsert

SetOperatorVersion sets the "operator_version" field.

func (*RevisionUpsert) UpdateDescription

func (u *RevisionUpsert) UpdateDescription() *RevisionUpsert

UpdateDescription sets the "description" field to the value that was provided on create.

func (*RevisionUpsert) UpdateExecutedAt

func (u *RevisionUpsert) UpdateExecutedAt() *RevisionUpsert

UpdateExecutedAt sets the "executed_at" field to the value that was provided on create.

func (*RevisionUpsert) UpdateExecutionState

func (u *RevisionUpsert) UpdateExecutionState() *RevisionUpsert

UpdateExecutionState sets the "execution_state" field to the value that was provided on create.

func (*RevisionUpsert) UpdateExecutionTime

func (u *RevisionUpsert) UpdateExecutionTime() *RevisionUpsert

UpdateExecutionTime sets the "execution_time" field to the value that was provided on create.

func (*RevisionUpsert) UpdateHash

func (u *RevisionUpsert) UpdateHash() *RevisionUpsert

UpdateHash sets the "hash" field to the value that was provided on create.

func (*RevisionUpsert) UpdateMeta

func (u *RevisionUpsert) UpdateMeta() *RevisionUpsert

UpdateMeta sets the "meta" field to the value that was provided on create.

func (*RevisionUpsert) UpdateOperatorVersion

func (u *RevisionUpsert) UpdateOperatorVersion() *RevisionUpsert

UpdateOperatorVersion sets the "operator_version" field to the value that was provided on create.

type RevisionUpsertBulk

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

RevisionUpsertBulk is the builder for "upsert"-ing a bulk of Revision nodes.

func (*RevisionUpsertBulk) AddExecutionTime

func (u *RevisionUpsertBulk) AddExecutionTime(v time.Duration) *RevisionUpsertBulk

AddExecutionTime adds v to the "execution_time" field.

func (*RevisionUpsertBulk) DoNothing

func (u *RevisionUpsertBulk) DoNothing() *RevisionUpsertBulk

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

func (*RevisionUpsertBulk) Exec

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

Exec executes the query.

func (*RevisionUpsertBulk) ExecX

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

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

func (*RevisionUpsertBulk) Ignore

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

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

func (*RevisionUpsertBulk) SetDescription

func (u *RevisionUpsertBulk) SetDescription(v string) *RevisionUpsertBulk

SetDescription sets the "description" field.

func (*RevisionUpsertBulk) SetExecutedAt

func (u *RevisionUpsertBulk) SetExecutedAt(v time.Time) *RevisionUpsertBulk

SetExecutedAt sets the "executed_at" field.

func (*RevisionUpsertBulk) SetExecutionState

SetExecutionState sets the "execution_state" field.

func (*RevisionUpsertBulk) SetExecutionTime

func (u *RevisionUpsertBulk) SetExecutionTime(v time.Duration) *RevisionUpsertBulk

SetExecutionTime sets the "execution_time" field.

func (*RevisionUpsertBulk) SetHash

SetHash sets the "hash" field.

func (*RevisionUpsertBulk) SetMeta

SetMeta sets the "meta" field.

func (*RevisionUpsertBulk) SetOperatorVersion

func (u *RevisionUpsertBulk) SetOperatorVersion(v string) *RevisionUpsertBulk

SetOperatorVersion sets the "operator_version" field.

func (*RevisionUpsertBulk) Update

func (u *RevisionUpsertBulk) Update(set func(*RevisionUpsert)) *RevisionUpsertBulk

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

func (*RevisionUpsertBulk) UpdateDescription

func (u *RevisionUpsertBulk) UpdateDescription() *RevisionUpsertBulk

UpdateDescription sets the "description" field to the value that was provided on create.

func (*RevisionUpsertBulk) UpdateExecutedAt

func (u *RevisionUpsertBulk) UpdateExecutedAt() *RevisionUpsertBulk

UpdateExecutedAt sets the "executed_at" field to the value that was provided on create.

func (*RevisionUpsertBulk) UpdateExecutionState

func (u *RevisionUpsertBulk) UpdateExecutionState() *RevisionUpsertBulk

UpdateExecutionState sets the "execution_state" field to the value that was provided on create.

func (*RevisionUpsertBulk) UpdateExecutionTime

func (u *RevisionUpsertBulk) UpdateExecutionTime() *RevisionUpsertBulk

UpdateExecutionTime sets the "execution_time" field to the value that was provided on create.

func (*RevisionUpsertBulk) UpdateHash

func (u *RevisionUpsertBulk) UpdateHash() *RevisionUpsertBulk

UpdateHash sets the "hash" field to the value that was provided on create.

func (*RevisionUpsertBulk) UpdateMeta

func (u *RevisionUpsertBulk) UpdateMeta() *RevisionUpsertBulk

UpdateMeta sets the "meta" field to the value that was provided on create.

func (*RevisionUpsertBulk) UpdateNewValues

func (u *RevisionUpsertBulk) UpdateNewValues() *RevisionUpsertBulk

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

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

func (*RevisionUpsertBulk) UpdateOperatorVersion

func (u *RevisionUpsertBulk) UpdateOperatorVersion() *RevisionUpsertBulk

UpdateOperatorVersion sets the "operator_version" field to the value that was provided on create.

type RevisionUpsertOne

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

RevisionUpsertOne is the builder for "upsert"-ing

one Revision node.

func (*RevisionUpsertOne) AddExecutionTime

func (u *RevisionUpsertOne) AddExecutionTime(v time.Duration) *RevisionUpsertOne

AddExecutionTime adds v to the "execution_time" field.

func (*RevisionUpsertOne) DoNothing

func (u *RevisionUpsertOne) DoNothing() *RevisionUpsertOne

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

func (*RevisionUpsertOne) Exec

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

Exec executes the query.

func (*RevisionUpsertOne) ExecX

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

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

func (*RevisionUpsertOne) ID

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

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

func (*RevisionUpsertOne) IDX

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

func (*RevisionUpsertOne) Ignore

func (u *RevisionUpsertOne) Ignore() *RevisionUpsertOne

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

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

func (*RevisionUpsertOne) SetDescription

func (u *RevisionUpsertOne) SetDescription(v string) *RevisionUpsertOne

SetDescription sets the "description" field.

func (*RevisionUpsertOne) SetExecutedAt

func (u *RevisionUpsertOne) SetExecutedAt(v time.Time) *RevisionUpsertOne

SetExecutedAt sets the "executed_at" field.

func (*RevisionUpsertOne) SetExecutionState

SetExecutionState sets the "execution_state" field.

func (*RevisionUpsertOne) SetExecutionTime

func (u *RevisionUpsertOne) SetExecutionTime(v time.Duration) *RevisionUpsertOne

SetExecutionTime sets the "execution_time" field.

func (*RevisionUpsertOne) SetHash

SetHash sets the "hash" field.

func (*RevisionUpsertOne) SetMeta

func (u *RevisionUpsertOne) SetMeta(v map[string]string) *RevisionUpsertOne

SetMeta sets the "meta" field.

func (*RevisionUpsertOne) SetOperatorVersion

func (u *RevisionUpsertOne) SetOperatorVersion(v string) *RevisionUpsertOne

SetOperatorVersion sets the "operator_version" field.

func (*RevisionUpsertOne) Update

func (u *RevisionUpsertOne) Update(set func(*RevisionUpsert)) *RevisionUpsertOne

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

func (*RevisionUpsertOne) UpdateDescription

func (u *RevisionUpsertOne) UpdateDescription() *RevisionUpsertOne

UpdateDescription sets the "description" field to the value that was provided on create.

func (*RevisionUpsertOne) UpdateExecutedAt

func (u *RevisionUpsertOne) UpdateExecutedAt() *RevisionUpsertOne

UpdateExecutedAt sets the "executed_at" field to the value that was provided on create.

func (*RevisionUpsertOne) UpdateExecutionState

func (u *RevisionUpsertOne) UpdateExecutionState() *RevisionUpsertOne

UpdateExecutionState sets the "execution_state" field to the value that was provided on create.

func (*RevisionUpsertOne) UpdateExecutionTime

func (u *RevisionUpsertOne) UpdateExecutionTime() *RevisionUpsertOne

UpdateExecutionTime sets the "execution_time" field to the value that was provided on create.

func (*RevisionUpsertOne) UpdateHash

func (u *RevisionUpsertOne) UpdateHash() *RevisionUpsertOne

UpdateHash sets the "hash" field to the value that was provided on create.

func (*RevisionUpsertOne) UpdateMeta

func (u *RevisionUpsertOne) UpdateMeta() *RevisionUpsertOne

UpdateMeta sets the "meta" field to the value that was provided on create.

func (*RevisionUpsertOne) UpdateNewValues

func (u *RevisionUpsertOne) UpdateNewValues() *RevisionUpsertOne

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

func (*RevisionUpsertOne) UpdateOperatorVersion

func (u *RevisionUpsertOne) UpdateOperatorVersion() *RevisionUpsertOne

UpdateOperatorVersion sets the "operator_version" field to the value that was provided on create.

type Revisions

type Revisions []*Revision

Revisions is a parsable slice of Revision.

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 SchemaConfig

type SchemaConfig = internal.SchemaConfig

SchemaConfig represents alternative schema names for all tables that can be passed at runtime.

type Tx

type Tx struct {

	// Revision is the client for interacting with the Revision builders.
	Revision *RevisionClient
	// 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) ExecContext

func (c *Tx) ExecContext(ctx context.Context, query string, args ...interface{}) (stdsql.Result, error)

ExecContext allows calling the underlying ExecContext method of the driver if it is supported by it. See, database/sql#DB.ExecContext for more information.

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

func (c *Tx) QueryContext(ctx context.Context, query string, args ...interface{}) (*stdsql.Rows, error)

QueryContext allows calling the underlying QueryContext method of the driver if it is supported by it. See, database/sql#DB.QueryContext for more information.

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