ent

package
v0.8.3 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2022 License: Apache-2.0 Imports: 22 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 ...any) (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 ...any) (*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(...any)) Option

Log sets the logging function for debug mode.

type OrderFunc

type OrderFunc func(*sql.Selector)

OrderFunc applies an ordering on the sql selector.

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"`
	// Type holds the value of the "type" field.
	Type migrate.RevisionType `json:"type,omitempty"`
	// Applied holds the value of the "applied" field.
	Applied int `json:"applied,omitempty"`
	// Total holds the value of the "total" field.
	Total int `json:"total,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"`
	// Error holds the value of the "error" field.
	Error string `json:"error,omitempty"`
	// ErrorStmt holds the value of the "error_stmt" field.
	ErrorStmt string `json:"error_stmt,omitempty"`
	// Hash holds the value of the "hash" field.
	Hash string `json:"hash,omitempty"`
	// PartialHashes holds the value of the "partial_hashes" field.
	PartialHashes []string `json:"partial_hashes,omitempty"`
	// OperatorVersion holds the value of the "operator_version" field.
	OperatorVersion string `json:"operator_version,omitempty"`
	// contains filtered or unexported fields
}

Revision is the model entity for the Revision schema.

func (*Revision) AtlasRevision added in v0.6.4

func (r *Revision) AtlasRevision() *migrate.Revision

AtlasRevision returns an migrate.Revision from the current Revision.

func (*Revision) ExecContext

func (c *Revision) ExecContext(ctx context.Context, query string, args ...any) (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 ...any) (*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 builder for creating a Revision entity.

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 builder for deleting the given entity.

func (*RevisionClient) DeleteOneID

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

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

func (*RevisionClient) ExecContext

func (c *RevisionClient) ExecContext(ctx context.Context, query string, args ...any) (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 ...any) (*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 ...any) (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 ...any) (*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) SetApplied added in v0.6.0

func (rc *RevisionCreate) SetApplied(i int) *RevisionCreate

SetApplied sets the "applied" field.

func (*RevisionCreate) SetDescription

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

SetDescription sets the "description" field.

func (*RevisionCreate) SetError added in v0.6.0

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

SetError sets the "error" field.

func (*RevisionCreate) SetErrorStmt added in v0.8.0

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

SetErrorStmt sets the "error_stmt" field.

func (*RevisionCreate) SetExecutedAt

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

SetExecutedAt sets the "executed_at" 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) SetNillableApplied added in v0.6.4

func (rc *RevisionCreate) SetNillableApplied(i *int) *RevisionCreate

SetNillableApplied sets the "applied" field if the given value is not nil.

func (*RevisionCreate) SetNillableError added in v0.6.0

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

SetNillableError sets the "error" field if the given value is not nil.

func (*RevisionCreate) SetNillableErrorStmt added in v0.8.0

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

SetNillableErrorStmt sets the "error_stmt" field if the given value is not nil.

func (*RevisionCreate) SetNillableTotal added in v0.6.4

func (rc *RevisionCreate) SetNillableTotal(i *int) *RevisionCreate

SetNillableTotal sets the "total" field if the given value is not nil.

func (*RevisionCreate) SetNillableType added in v0.6.4

func (rc *RevisionCreate) SetNillableType(mt *migrate.RevisionType) *RevisionCreate

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

func (*RevisionCreate) SetOperatorVersion

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

SetOperatorVersion sets the "operator_version" field.

func (*RevisionCreate) SetPartialHashes added in v0.6.0

func (rc *RevisionCreate) SetPartialHashes(s []string) *RevisionCreate

SetPartialHashes sets the "partial_hashes" field.

func (*RevisionCreate) SetRevision added in v0.6.4

func (rc *RevisionCreate) SetRevision(rev *migrate.Revision) *RevisionCreate

SetRevision takes the values for each field from the given migrate.Revision.

func (*RevisionCreate) SetTotal added in v0.6.0

func (rc *RevisionCreate) SetTotal(i int) *RevisionCreate

SetTotal sets the "total" field.

func (*RevisionCreate) SetType added in v0.6.0

SetType sets the "type" 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 ...any) (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 ...any) (*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 ...any) (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 ...any) (*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 ...any) (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 ...any) (*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 any) 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 any)

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) AddApplied added in v0.6.0

func (m *RevisionMutation) AddApplied(i int)

AddApplied adds i to the "applied" field.

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) AddTotal added in v0.6.0

func (m *RevisionMutation) AddTotal(i int)

AddTotal adds i to the "total" field.

func (*RevisionMutation) AddType added in v0.6.0

func (m *RevisionMutation) AddType(mt migrate.RevisionType)

AddType adds mt to the "type" field.

func (*RevisionMutation) AddedApplied added in v0.6.0

func (m *RevisionMutation) AddedApplied() (r int, exists bool)

AddedApplied returns the value that was added to the "applied" field in this mutation.

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) AddedTotal added in v0.6.0

func (m *RevisionMutation) AddedTotal() (r int, exists bool)

AddedTotal returns the value that was added to the "total" field in this mutation.

func (*RevisionMutation) AddedType added in v0.6.0

func (m *RevisionMutation) AddedType() (r migrate.RevisionType, exists bool)

AddedType returns the value that was added to the "type" field in this mutation.

func (*RevisionMutation) AppendPartialHashes added in v0.8.3

func (m *RevisionMutation) AppendPartialHashes(s []string)

AppendPartialHashes adds s to the "partial_hashes" field.

func (*RevisionMutation) AppendedPartialHashes added in v0.8.3

func (m *RevisionMutation) AppendedPartialHashes() ([]string, bool)

AppendedPartialHashes returns the list of values that were appended to the "partial_hashes" field in this mutation.

func (*RevisionMutation) Applied added in v0.6.0

func (m *RevisionMutation) Applied() (r int, exists bool)

Applied returns the value of the "applied" field in the 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) ClearError added in v0.6.0

func (m *RevisionMutation) ClearError()

ClearError clears the value of the "error" field.

func (*RevisionMutation) ClearErrorStmt added in v0.8.0

func (m *RevisionMutation) ClearErrorStmt()

ClearErrorStmt clears the value of the "error_stmt" field.

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) ClearPartialHashes added in v0.6.0

func (m *RevisionMutation) ClearPartialHashes()

ClearPartialHashes clears the value of the "partial_hashes" field.

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) Error added in v0.6.0

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

Error returns the value of the "error" field in the mutation.

func (*RevisionMutation) ErrorCleared added in v0.6.0

func (m *RevisionMutation) ErrorCleared() bool

ErrorCleared returns if the "error" field was cleared in this mutation.

func (*RevisionMutation) ErrorStmt added in v0.8.0

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

ErrorStmt returns the value of the "error_stmt" field in the mutation.

func (*RevisionMutation) ErrorStmtCleared added in v0.8.0

func (m *RevisionMutation) ErrorStmtCleared() bool

ErrorStmtCleared returns if the "error_stmt" field was cleared in this mutation.

func (*RevisionMutation) ExecContext

func (c *RevisionMutation) ExecContext(ctx context.Context, query string, args ...any) (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) 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) GetType added in v0.6.0

func (m *RevisionMutation) GetType() (r migrate.RevisionType, exists bool)

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

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) OldApplied added in v0.6.0

func (m *RevisionMutation) OldApplied(ctx context.Context) (v int, err error)

OldApplied returns the old "applied" 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) 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) OldError added in v0.6.0

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

OldError returns the old "error" 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) OldErrorStmt added in v0.8.0

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

OldErrorStmt returns the old "error_stmt" 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) 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) 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) OldPartialHashes added in v0.6.0

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

OldPartialHashes returns the old "partial_hashes" 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) OldTotal added in v0.6.0

func (m *RevisionMutation) OldTotal(ctx context.Context) (v int, err error)

OldTotal returns the old "total" 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) OldType added in v0.6.0

func (m *RevisionMutation) OldType(ctx context.Context) (v migrate.RevisionType, err error)

OldType returns the old "type" 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) PartialHashes added in v0.6.0

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

PartialHashes returns the value of the "partial_hashes" field in the mutation.

func (*RevisionMutation) PartialHashesCleared added in v0.6.0

func (m *RevisionMutation) PartialHashesCleared() bool

PartialHashesCleared returns if the "partial_hashes" field was cleared in this mutation.

func (*RevisionMutation) QueryContext

func (c *RevisionMutation) QueryContext(ctx context.Context, query string, args ...any) (*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) ResetApplied added in v0.6.0

func (m *RevisionMutation) ResetApplied()

ResetApplied resets all changes to the "applied" field.

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) ResetError added in v0.6.0

func (m *RevisionMutation) ResetError()

ResetError resets all changes to the "error" field.

func (*RevisionMutation) ResetErrorStmt added in v0.8.0

func (m *RevisionMutation) ResetErrorStmt()

ResetErrorStmt resets all changes to the "error_stmt" field.

func (*RevisionMutation) ResetExecutedAt

func (m *RevisionMutation) ResetExecutedAt()

ResetExecutedAt resets all changes to the "executed_at" 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) ResetOperatorVersion

func (m *RevisionMutation) ResetOperatorVersion()

ResetOperatorVersion resets all changes to the "operator_version" field.

func (*RevisionMutation) ResetPartialHashes added in v0.6.0

func (m *RevisionMutation) ResetPartialHashes()

ResetPartialHashes resets all changes to the "partial_hashes" field.

func (*RevisionMutation) ResetTotal added in v0.6.0

func (m *RevisionMutation) ResetTotal()

ResetTotal resets all changes to the "total" field.

func (*RevisionMutation) ResetType added in v0.6.0

func (m *RevisionMutation) ResetType()

ResetType resets all changes to the "type" field.

func (*RevisionMutation) SetApplied added in v0.6.0

func (m *RevisionMutation) SetApplied(i int)

SetApplied sets the "applied" field.

func (*RevisionMutation) SetDescription

func (m *RevisionMutation) SetDescription(s string)

SetDescription sets the "description" field.

func (*RevisionMutation) SetError added in v0.6.0

func (m *RevisionMutation) SetError(s string)

SetError sets the "error" field.

func (*RevisionMutation) SetErrorStmt added in v0.8.0

func (m *RevisionMutation) SetErrorStmt(s string)

SetErrorStmt sets the "error_stmt" field.

func (*RevisionMutation) SetExecutedAt

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

SetExecutedAt sets the "executed_at" 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) SetOperatorVersion

func (m *RevisionMutation) SetOperatorVersion(s string)

SetOperatorVersion sets the "operator_version" field.

func (*RevisionMutation) SetPartialHashes added in v0.6.0

func (m *RevisionMutation) SetPartialHashes(s []string)

SetPartialHashes sets the "partial_hashes" field.

func (*RevisionMutation) SetTotal added in v0.6.0

func (m *RevisionMutation) SetTotal(i int)

SetTotal sets the "total" field.

func (*RevisionMutation) SetType added in v0.6.0

func (m *RevisionMutation) SetType(mt migrate.RevisionType)

SetType sets the "type" field.

func (*RevisionMutation) Total added in v0.6.0

func (m *RevisionMutation) Total() (r int, exists bool)

Total returns the value of the "total" field in the mutation.

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) Aggregate added in v0.8.3

func (rq *RevisionQuery) Aggregate(fns ...AggregateFunc) *RevisionSelect

Aggregate returns a RevisionSelect configured with the given aggregations.

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 ...any) (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 ...any) (*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) Aggregate added in v0.8.3

func (rs *RevisionSelect) Aggregate(fns ...AggregateFunc) *RevisionSelect

Aggregate adds the given aggregation functions to the selector query.

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 ...any) (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 ...any) (*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 any) 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 any)

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) AddApplied added in v0.6.0

func (ru *RevisionUpdate) AddApplied(i int) *RevisionUpdate

AddApplied adds i to the "applied" field.

func (*RevisionUpdate) AddExecutionTime

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

AddExecutionTime adds t to the "execution_time" field.

func (*RevisionUpdate) AddTotal added in v0.6.0

func (ru *RevisionUpdate) AddTotal(i int) *RevisionUpdate

AddTotal adds i to the "total" field.

func (*RevisionUpdate) AddType added in v0.6.0

AddType adds mt to the "type" field.

func (*RevisionUpdate) AppendPartialHashes added in v0.8.3

func (ru *RevisionUpdate) AppendPartialHashes(s []string) *RevisionUpdate

AppendPartialHashes appends s to the "partial_hashes" field.

func (*RevisionUpdate) ClearError added in v0.6.0

func (ru *RevisionUpdate) ClearError() *RevisionUpdate

ClearError clears the value of the "error" field.

func (*RevisionUpdate) ClearErrorStmt added in v0.8.0

func (ru *RevisionUpdate) ClearErrorStmt() *RevisionUpdate

ClearErrorStmt clears the value of the "error_stmt" field.

func (*RevisionUpdate) ClearPartialHashes added in v0.6.0

func (ru *RevisionUpdate) ClearPartialHashes() *RevisionUpdate

ClearPartialHashes clears the value of the "partial_hashes" 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 ...any) (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 ...any) (*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) SetApplied added in v0.6.0

func (ru *RevisionUpdate) SetApplied(i int) *RevisionUpdate

SetApplied sets the "applied" field.

func (*RevisionUpdate) SetError added in v0.6.0

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

SetError sets the "error" field.

func (*RevisionUpdate) SetErrorStmt added in v0.8.0

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

SetErrorStmt sets the "error_stmt" 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) SetNillableApplied added in v0.6.4

func (ru *RevisionUpdate) SetNillableApplied(i *int) *RevisionUpdate

SetNillableApplied sets the "applied" field if the given value is not nil.

func (*RevisionUpdate) SetNillableError added in v0.6.0

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

SetNillableError sets the "error" field if the given value is not nil.

func (*RevisionUpdate) SetNillableErrorStmt added in v0.8.0

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

SetNillableErrorStmt sets the "error_stmt" field if the given value is not nil.

func (*RevisionUpdate) SetNillableTotal added in v0.6.4

func (ru *RevisionUpdate) SetNillableTotal(i *int) *RevisionUpdate

SetNillableTotal sets the "total" field if the given value is not nil.

func (*RevisionUpdate) SetNillableType added in v0.6.4

func (ru *RevisionUpdate) SetNillableType(mt *migrate.RevisionType) *RevisionUpdate

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

func (*RevisionUpdate) SetOperatorVersion

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

SetOperatorVersion sets the "operator_version" field.

func (*RevisionUpdate) SetPartialHashes added in v0.6.0

func (ru *RevisionUpdate) SetPartialHashes(s []string) *RevisionUpdate

SetPartialHashes sets the "partial_hashes" field.

func (*RevisionUpdate) SetTotal added in v0.6.0

func (ru *RevisionUpdate) SetTotal(i int) *RevisionUpdate

SetTotal sets the "total" field.

func (*RevisionUpdate) SetType added in v0.6.0

SetType sets the "type" 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) AddApplied added in v0.6.0

func (ruo *RevisionUpdateOne) AddApplied(i int) *RevisionUpdateOne

AddApplied adds i to the "applied" field.

func (*RevisionUpdateOne) AddExecutionTime

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

AddExecutionTime adds t to the "execution_time" field.

func (*RevisionUpdateOne) AddTotal added in v0.6.0

func (ruo *RevisionUpdateOne) AddTotal(i int) *RevisionUpdateOne

AddTotal adds i to the "total" field.

func (*RevisionUpdateOne) AddType added in v0.6.0

AddType adds mt to the "type" field.

func (*RevisionUpdateOne) AppendPartialHashes added in v0.8.3

func (ruo *RevisionUpdateOne) AppendPartialHashes(s []string) *RevisionUpdateOne

AppendPartialHashes appends s to the "partial_hashes" field.

func (*RevisionUpdateOne) ClearError added in v0.6.0

func (ruo *RevisionUpdateOne) ClearError() *RevisionUpdateOne

ClearError clears the value of the "error" field.

func (*RevisionUpdateOne) ClearErrorStmt added in v0.8.0

func (ruo *RevisionUpdateOne) ClearErrorStmt() *RevisionUpdateOne

ClearErrorStmt clears the value of the "error_stmt" field.

func (*RevisionUpdateOne) ClearPartialHashes added in v0.6.0

func (ruo *RevisionUpdateOne) ClearPartialHashes() *RevisionUpdateOne

ClearPartialHashes clears the value of the "partial_hashes" 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 ...any) (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 ...any) (*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) SetApplied added in v0.6.0

func (ruo *RevisionUpdateOne) SetApplied(i int) *RevisionUpdateOne

SetApplied sets the "applied" field.

func (*RevisionUpdateOne) SetError added in v0.6.0

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

SetError sets the "error" field.

func (*RevisionUpdateOne) SetErrorStmt added in v0.8.0

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

SetErrorStmt sets the "error_stmt" 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) SetNillableApplied added in v0.6.4

func (ruo *RevisionUpdateOne) SetNillableApplied(i *int) *RevisionUpdateOne

SetNillableApplied sets the "applied" field if the given value is not nil.

func (*RevisionUpdateOne) SetNillableError added in v0.6.0

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

SetNillableError sets the "error" field if the given value is not nil.

func (*RevisionUpdateOne) SetNillableErrorStmt added in v0.8.0

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

SetNillableErrorStmt sets the "error_stmt" field if the given value is not nil.

func (*RevisionUpdateOne) SetNillableTotal added in v0.6.4

func (ruo *RevisionUpdateOne) SetNillableTotal(i *int) *RevisionUpdateOne

SetNillableTotal sets the "total" field if the given value is not nil.

func (*RevisionUpdateOne) SetNillableType added in v0.6.4

func (ruo *RevisionUpdateOne) SetNillableType(mt *migrate.RevisionType) *RevisionUpdateOne

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

func (*RevisionUpdateOne) SetOperatorVersion

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

SetOperatorVersion sets the "operator_version" field.

func (*RevisionUpdateOne) SetPartialHashes added in v0.6.0

func (ruo *RevisionUpdateOne) SetPartialHashes(s []string) *RevisionUpdateOne

SetPartialHashes sets the "partial_hashes" field.

func (*RevisionUpdateOne) SetTotal added in v0.6.0

func (ruo *RevisionUpdateOne) SetTotal(i int) *RevisionUpdateOne

SetTotal sets the "total" field.

func (*RevisionUpdateOne) SetType added in v0.6.0

SetType sets the "type" field.

type RevisionUpsert

type RevisionUpsert struct {
	*sql.UpdateSet
}

RevisionUpsert is the "OnConflict" setter.

func (*RevisionUpsert) AddApplied added in v0.6.0

func (u *RevisionUpsert) AddApplied(v int) *RevisionUpsert

AddApplied adds v to the "applied" field.

func (*RevisionUpsert) AddExecutionTime

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

AddExecutionTime adds v to the "execution_time" field.

func (*RevisionUpsert) AddTotal added in v0.6.0

func (u *RevisionUpsert) AddTotal(v int) *RevisionUpsert

AddTotal adds v to the "total" field.

func (*RevisionUpsert) AddType added in v0.6.0

AddType adds v to the "type" field.

func (*RevisionUpsert) ClearError added in v0.6.0

func (u *RevisionUpsert) ClearError() *RevisionUpsert

ClearError clears the value of the "error" field.

func (*RevisionUpsert) ClearErrorStmt added in v0.8.0

func (u *RevisionUpsert) ClearErrorStmt() *RevisionUpsert

ClearErrorStmt clears the value of the "error_stmt" field.

func (*RevisionUpsert) ClearPartialHashes added in v0.6.0

func (u *RevisionUpsert) ClearPartialHashes() *RevisionUpsert

ClearPartialHashes clears the value of the "partial_hashes" field.

func (*RevisionUpsert) SetApplied added in v0.6.0

func (u *RevisionUpsert) SetApplied(v int) *RevisionUpsert

SetApplied sets the "applied" field.

func (*RevisionUpsert) SetError added in v0.6.0

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

SetError sets the "error" field.

func (*RevisionUpsert) SetErrorStmt added in v0.8.0

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

SetErrorStmt sets the "error_stmt" 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) SetOperatorVersion

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

SetOperatorVersion sets the "operator_version" field.

func (*RevisionUpsert) SetPartialHashes added in v0.6.0

func (u *RevisionUpsert) SetPartialHashes(v []string) *RevisionUpsert

SetPartialHashes sets the "partial_hashes" field.

func (*RevisionUpsert) SetTotal added in v0.6.0

func (u *RevisionUpsert) SetTotal(v int) *RevisionUpsert

SetTotal sets the "total" field.

func (*RevisionUpsert) SetType added in v0.6.0

SetType sets the "type" field.

func (*RevisionUpsert) UpdateApplied added in v0.6.0

func (u *RevisionUpsert) UpdateApplied() *RevisionUpsert

UpdateApplied sets the "applied" field to the value that was provided on create.

func (*RevisionUpsert) UpdateError added in v0.6.0

func (u *RevisionUpsert) UpdateError() *RevisionUpsert

UpdateError sets the "error" field to the value that was provided on create.

func (*RevisionUpsert) UpdateErrorStmt added in v0.8.0

func (u *RevisionUpsert) UpdateErrorStmt() *RevisionUpsert

UpdateErrorStmt sets the "error_stmt" 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) UpdateOperatorVersion

func (u *RevisionUpsert) UpdateOperatorVersion() *RevisionUpsert

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

func (*RevisionUpsert) UpdatePartialHashes added in v0.6.0

func (u *RevisionUpsert) UpdatePartialHashes() *RevisionUpsert

UpdatePartialHashes sets the "partial_hashes" field to the value that was provided on create.

func (*RevisionUpsert) UpdateTotal added in v0.6.0

func (u *RevisionUpsert) UpdateTotal() *RevisionUpsert

UpdateTotal sets the "total" field to the value that was provided on create.

func (*RevisionUpsert) UpdateType added in v0.6.0

func (u *RevisionUpsert) UpdateType() *RevisionUpsert

UpdateType sets the "type" 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) AddApplied added in v0.6.0

func (u *RevisionUpsertBulk) AddApplied(v int) *RevisionUpsertBulk

AddApplied adds v to the "applied" field.

func (*RevisionUpsertBulk) AddExecutionTime

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

AddExecutionTime adds v to the "execution_time" field.

func (*RevisionUpsertBulk) AddTotal added in v0.6.0

func (u *RevisionUpsertBulk) AddTotal(v int) *RevisionUpsertBulk

AddTotal adds v to the "total" field.

func (*RevisionUpsertBulk) AddType added in v0.6.0

AddType adds v to the "type" field.

func (*RevisionUpsertBulk) ClearError added in v0.6.0

func (u *RevisionUpsertBulk) ClearError() *RevisionUpsertBulk

ClearError clears the value of the "error" field.

func (*RevisionUpsertBulk) ClearErrorStmt added in v0.8.0

func (u *RevisionUpsertBulk) ClearErrorStmt() *RevisionUpsertBulk

ClearErrorStmt clears the value of the "error_stmt" field.

func (*RevisionUpsertBulk) ClearPartialHashes added in v0.6.0

func (u *RevisionUpsertBulk) ClearPartialHashes() *RevisionUpsertBulk

ClearPartialHashes clears the value of the "partial_hashes" 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) SetApplied added in v0.6.0

func (u *RevisionUpsertBulk) SetApplied(v int) *RevisionUpsertBulk

SetApplied sets the "applied" field.

func (*RevisionUpsertBulk) SetError added in v0.6.0

SetError sets the "error" field.

func (*RevisionUpsertBulk) SetErrorStmt added in v0.8.0

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

SetErrorStmt sets the "error_stmt" 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) SetOperatorVersion

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

SetOperatorVersion sets the "operator_version" field.

func (*RevisionUpsertBulk) SetPartialHashes added in v0.6.0

func (u *RevisionUpsertBulk) SetPartialHashes(v []string) *RevisionUpsertBulk

SetPartialHashes sets the "partial_hashes" field.

func (*RevisionUpsertBulk) SetTotal added in v0.6.0

func (u *RevisionUpsertBulk) SetTotal(v int) *RevisionUpsertBulk

SetTotal sets the "total" field.

func (*RevisionUpsertBulk) SetType added in v0.6.0

SetType sets the "type" 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) UpdateApplied added in v0.6.0

func (u *RevisionUpsertBulk) UpdateApplied() *RevisionUpsertBulk

UpdateApplied sets the "applied" field to the value that was provided on create.

func (*RevisionUpsertBulk) UpdateError added in v0.6.0

func (u *RevisionUpsertBulk) UpdateError() *RevisionUpsertBulk

UpdateError sets the "error" field to the value that was provided on create.

func (*RevisionUpsertBulk) UpdateErrorStmt added in v0.8.0

func (u *RevisionUpsertBulk) UpdateErrorStmt() *RevisionUpsertBulk

UpdateErrorStmt sets the "error_stmt" 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) 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.

func (*RevisionUpsertBulk) UpdatePartialHashes added in v0.6.0

func (u *RevisionUpsertBulk) UpdatePartialHashes() *RevisionUpsertBulk

UpdatePartialHashes sets the "partial_hashes" field to the value that was provided on create.

func (*RevisionUpsertBulk) UpdateTotal added in v0.6.0

func (u *RevisionUpsertBulk) UpdateTotal() *RevisionUpsertBulk

UpdateTotal sets the "total" field to the value that was provided on create.

func (*RevisionUpsertBulk) UpdateType added in v0.6.0

func (u *RevisionUpsertBulk) UpdateType() *RevisionUpsertBulk

UpdateType sets the "type" 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) AddApplied added in v0.6.0

func (u *RevisionUpsertOne) AddApplied(v int) *RevisionUpsertOne

AddApplied adds v to the "applied" field.

func (*RevisionUpsertOne) AddExecutionTime

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

AddExecutionTime adds v to the "execution_time" field.

func (*RevisionUpsertOne) AddTotal added in v0.6.0

func (u *RevisionUpsertOne) AddTotal(v int) *RevisionUpsertOne

AddTotal adds v to the "total" field.

func (*RevisionUpsertOne) AddType added in v0.6.0

AddType adds v to the "type" field.

func (*RevisionUpsertOne) ClearError added in v0.6.0

func (u *RevisionUpsertOne) ClearError() *RevisionUpsertOne

ClearError clears the value of the "error" field.

func (*RevisionUpsertOne) ClearErrorStmt added in v0.8.0

func (u *RevisionUpsertOne) ClearErrorStmt() *RevisionUpsertOne

ClearErrorStmt clears the value of the "error_stmt" field.

func (*RevisionUpsertOne) ClearPartialHashes added in v0.6.0

func (u *RevisionUpsertOne) ClearPartialHashes() *RevisionUpsertOne

ClearPartialHashes clears the value of the "partial_hashes" 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) SetApplied added in v0.6.0

func (u *RevisionUpsertOne) SetApplied(v int) *RevisionUpsertOne

SetApplied sets the "applied" field.

func (*RevisionUpsertOne) SetError added in v0.6.0

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

SetError sets the "error" field.

func (*RevisionUpsertOne) SetErrorStmt added in v0.8.0

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

SetErrorStmt sets the "error_stmt" 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) SetOperatorVersion

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

SetOperatorVersion sets the "operator_version" field.

func (*RevisionUpsertOne) SetPartialHashes added in v0.6.0

func (u *RevisionUpsertOne) SetPartialHashes(v []string) *RevisionUpsertOne

SetPartialHashes sets the "partial_hashes" field.

func (*RevisionUpsertOne) SetTotal added in v0.6.0

func (u *RevisionUpsertOne) SetTotal(v int) *RevisionUpsertOne

SetTotal sets the "total" field.

func (*RevisionUpsertOne) SetType added in v0.6.0

SetType sets the "type" 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) UpdateApplied added in v0.6.0

func (u *RevisionUpsertOne) UpdateApplied() *RevisionUpsertOne

UpdateApplied sets the "applied" field to the value that was provided on create.

func (*RevisionUpsertOne) UpdateError added in v0.6.0

func (u *RevisionUpsertOne) UpdateError() *RevisionUpsertOne

UpdateError sets the "error" field to the value that was provided on create.

func (*RevisionUpsertOne) UpdateErrorStmt added in v0.8.0

func (u *RevisionUpsertOne) UpdateErrorStmt() *RevisionUpsertOne

UpdateErrorStmt sets the "error_stmt" 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) 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.

func (*RevisionUpsertOne) UpdatePartialHashes added in v0.6.0

func (u *RevisionUpsertOne) UpdatePartialHashes() *RevisionUpsertOne

UpdatePartialHashes sets the "partial_hashes" field to the value that was provided on create.

func (*RevisionUpsertOne) UpdateTotal added in v0.6.0

func (u *RevisionUpsertOne) UpdateTotal() *RevisionUpsertOne

UpdateTotal sets the "total" field to the value that was provided on create.

func (*RevisionUpsertOne) UpdateType added in v0.6.0

func (u *RevisionUpsertOne) UpdateType() *RevisionUpsertOne

UpdateType sets the "type" 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 ...any) (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 ...any) (*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