ent

package
v0.0.0-...-fbc00b7 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2024 License: MIT 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.
	TypeRun = "Run"
)

Variables

View Source
var ErrTxStarted = errors.New("ent: cannot start a transaction within a transaction")

ErrTxStarted is returned when trying to start a new transaction from a transactional client.

Functions

func Asc

func Asc(fields ...string) func(*sql.Selector)

Asc applies the given fields in ASC order.

func Desc

func Desc(fields ...string) func(*sql.Selector)

Desc applies the given fields in DESC order.

func IsConstraintError

func IsConstraintError(err error) bool

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

func IsNotFound

func IsNotFound(err error) bool

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

func IsNotLoaded

func IsNotLoaded(err error) bool

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

func IsNotSingular

func IsNotSingular(err error) bool

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

func IsValidationError

func IsValidationError(err error) bool

IsValidationError returns a boolean indicating whether the error is a validation error.

func MaskNotFound

func MaskNotFound(err error) error

MaskNotFound masks not found error.

func NewContext

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

NewContext returns a new context with the given Client attached.

func NewTxContext

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

NewTxContext returns a new context with the given Tx attached.

Types

type AggregateFunc

type AggregateFunc func(*sql.Selector) string

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

func As

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

GroupBy(field1, field2).
Aggregate(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
	// Run is the client for interacting with the Run builders.
	Run *RunClient
	// 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().
	Run.
	Query().
	Count(ctx)

func (*Client) Intercept

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

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

func (*Client) Mutate

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

Mutate implements the ent.Mutator interface.

func (*Client) Tx

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

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

func (*Client) Use

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

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

type CommitFunc

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

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

func (CommitFunc) Commit

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

Commit calls f(ctx, m).

type CommitHook

type CommitHook func(Committer) Committer

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

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

type Committer

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

Committer is the interface that wraps the Commit method.

type ConstraintError

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

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

func (ConstraintError) Error

func (e ConstraintError) Error() string

Error implements the error interface.

func (*ConstraintError) Unwrap

func (e *ConstraintError) Unwrap() error

Unwrap implements the errors.Wrapper interface.

type Hook

type Hook = ent.Hook

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

type InterceptFunc

type InterceptFunc = ent.InterceptFunc

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

type Interceptor

type Interceptor = ent.Interceptor

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

type MutateFunc

type MutateFunc = ent.MutateFunc

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

type Mutation

type Mutation = ent.Mutation

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

type Mutator

type Mutator = ent.Mutator

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

type NotFoundError

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

NotFoundError returns when trying to fetch a specific entity and it was not found in the database.

func (*NotFoundError) Error

func (e *NotFoundError) Error() string

Error implements the error interface.

type NotLoadedError

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

NotLoadedError returns when trying to get a node that was not loaded by the query.

func (*NotLoadedError) Error

func (e *NotLoadedError) Error() string

Error implements the error interface.

type NotSingularError

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

NotSingularError returns when trying to fetch a singular entity and more then one was found in the database.

func (*NotSingularError) Error

func (e *NotSingularError) Error() string

Error implements the error interface.

type Op

type Op = ent.Op

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

type Option

type Option func(*config)

Option function to configure the client.

func Debug

func Debug() Option

Debug enables debug logging on the ent.Driver.

func Driver

func Driver(driver dialect.Driver) Option

Driver configures the client driver.

func Log

func Log(fn func(...any)) Option

Log sets the logging function for debug mode.

type OrderFunc

type OrderFunc func(*sql.Selector)

OrderFunc applies an ordering on the sql selector. Deprecated: Use Asc/Desc functions or the package builders instead.

type Policy

type Policy = ent.Policy

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

type Querier

type Querier = ent.Querier

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

type QuerierFunc

type QuerierFunc = ent.QuerierFunc

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

type Query

type Query = ent.Query

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

type QueryContext

type QueryContext = ent.QueryContext

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

type RollbackFunc

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

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

func (RollbackFunc) Rollback

func (f RollbackFunc) Rollback(ctx context.Context, tx *Tx) error

Rollback calls f(ctx, m).

type RollbackHook

type RollbackHook func(Rollbacker) Rollbacker

RollbackHook defines the "rollback middleware". A function that gets a Rollbacker and returns a Rollbacker. For example:

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

type Rollbacker

type Rollbacker interface {
	Rollback(context.Context, *Tx) error
}

Rollbacker is the interface that wraps the Rollback method.

type Run

type Run struct {

	// ID of the ent.
	ID uuid.UUID `json:"id,omitempty"`
	// Job holds the value of the "job" field.
	Job string `json:"job,omitempty"`
	// Start holds the value of the "start" field.
	Start time.Time `json:"start,omitempty"`
	// End holds the value of the "end" field.
	End time.Time `json:"end,omitempty"`
	// Status holds the value of the "status" field.
	Status run.Status `json:"status,omitempty"`
	// Log holds the value of the "log" field.
	Log string `json:"log,omitempty"`
	// contains filtered or unexported fields
}

Run is the model entity for the Run schema.

func (*Run) String

func (r *Run) String() string

String implements the fmt.Stringer.

func (*Run) Unwrap

func (r *Run) Unwrap() *Run

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

func (r *Run) Update() *RunUpdateOne

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

func (*Run) Value

func (r *Run) Value(name string) (ent.Value, error)

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

type RunClient

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

RunClient is a client for the Run schema.

func NewRunClient

func NewRunClient(c config) *RunClient

NewRunClient returns a client for the Run from the given config.

func (*RunClient) Create

func (c *RunClient) Create() *RunCreate

Create returns a builder for creating a Run entity.

func (*RunClient) CreateBulk

func (c *RunClient) CreateBulk(builders ...*RunCreate) *RunCreateBulk

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

func (*RunClient) Delete

func (c *RunClient) Delete() *RunDelete

Delete returns a delete builder for Run.

func (*RunClient) DeleteOne

func (c *RunClient) DeleteOne(r *Run) *RunDeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*RunClient) DeleteOneID

func (c *RunClient) DeleteOneID(id uuid.UUID) *RunDeleteOne

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

func (*RunClient) Get

func (c *RunClient) Get(ctx context.Context, id uuid.UUID) (*Run, error)

Get returns a Run entity by its id.

func (*RunClient) GetX

func (c *RunClient) GetX(ctx context.Context, id uuid.UUID) *Run

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

func (*RunClient) Hooks

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

Hooks returns the client hooks.

func (*RunClient) Intercept

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

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

func (*RunClient) Interceptors

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

Interceptors returns the client interceptors.

func (*RunClient) MapCreateBulk

func (c *RunClient) MapCreateBulk(slice any, setFunc func(*RunCreate, int)) *RunCreateBulk

MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates a builder and applies setFunc on it.

func (*RunClient) Query

func (c *RunClient) Query() *RunQuery

Query returns a query builder for Run.

func (*RunClient) Update

func (c *RunClient) Update() *RunUpdate

Update returns an update builder for Run.

func (*RunClient) UpdateOne

func (c *RunClient) UpdateOne(r *Run) *RunUpdateOne

UpdateOne returns an update builder for the given entity.

func (*RunClient) UpdateOneID

func (c *RunClient) UpdateOneID(id uuid.UUID) *RunUpdateOne

UpdateOneID returns an update builder for the given id.

func (*RunClient) Use

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

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

type RunCreate

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

RunCreate is the builder for creating a Run entity.

func (*RunCreate) Exec

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

Exec executes the query.

func (*RunCreate) ExecX

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

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

func (*RunCreate) Mutation

func (rc *RunCreate) Mutation() *RunMutation

Mutation returns the RunMutation object of the builder.

func (*RunCreate) Save

func (rc *RunCreate) Save(ctx context.Context) (*Run, error)

Save creates the Run in the database.

func (*RunCreate) SaveX

func (rc *RunCreate) SaveX(ctx context.Context) *Run

SaveX calls Save and panics if Save returns an error.

func (*RunCreate) SetEnd

func (rc *RunCreate) SetEnd(t time.Time) *RunCreate

SetEnd sets the "end" field.

func (*RunCreate) SetID

func (rc *RunCreate) SetID(u uuid.UUID) *RunCreate

SetID sets the "id" field.

func (*RunCreate) SetJob

func (rc *RunCreate) SetJob(s string) *RunCreate

SetJob sets the "job" field.

func (*RunCreate) SetLog

func (rc *RunCreate) SetLog(s string) *RunCreate

SetLog sets the "log" field.

func (*RunCreate) SetNillableEnd

func (rc *RunCreate) SetNillableEnd(t *time.Time) *RunCreate

SetNillableEnd sets the "end" field if the given value is not nil.

func (*RunCreate) SetNillableLog

func (rc *RunCreate) SetNillableLog(s *string) *RunCreate

SetNillableLog sets the "log" field if the given value is not nil.

func (*RunCreate) SetNillableStart

func (rc *RunCreate) SetNillableStart(t *time.Time) *RunCreate

SetNillableStart sets the "start" field if the given value is not nil.

func (*RunCreate) SetStart

func (rc *RunCreate) SetStart(t time.Time) *RunCreate

SetStart sets the "start" field.

func (*RunCreate) SetStatus

func (rc *RunCreate) SetStatus(r run.Status) *RunCreate

SetStatus sets the "status" field.

type RunCreateBulk

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

RunCreateBulk is the builder for creating many Run entities in bulk.

func (*RunCreateBulk) Exec

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

Exec executes the query.

func (*RunCreateBulk) ExecX

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

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

func (*RunCreateBulk) Save

func (rcb *RunCreateBulk) Save(ctx context.Context) ([]*Run, error)

Save creates the Run entities in the database.

func (*RunCreateBulk) SaveX

func (rcb *RunCreateBulk) SaveX(ctx context.Context) []*Run

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

type RunDelete

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

RunDelete is the builder for deleting a Run entity.

func (*RunDelete) Exec

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

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

func (*RunDelete) ExecX

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

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

func (*RunDelete) Where

func (rd *RunDelete) Where(ps ...predicate.Run) *RunDelete

Where appends a list predicates to the RunDelete builder.

type RunDeleteOne

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

RunDeleteOne is the builder for deleting a single Run entity.

func (*RunDeleteOne) Exec

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

Exec executes the deletion query.

func (*RunDeleteOne) ExecX

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

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

func (*RunDeleteOne) Where

func (rdo *RunDeleteOne) Where(ps ...predicate.Run) *RunDeleteOne

Where appends a list predicates to the RunDelete builder.

type RunGroupBy

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

RunGroupBy is the group-by builder for Run entities.

func (*RunGroupBy) Aggregate

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

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

func (*RunGroupBy) Bool

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

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

func (*RunGroupBy) BoolX

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

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

func (*RunGroupBy) Bools

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

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

func (*RunGroupBy) BoolsX

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

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

func (*RunGroupBy) Float64

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

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

func (*RunGroupBy) Float64X

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

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

func (*RunGroupBy) Float64s

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

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

func (*RunGroupBy) Float64sX

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

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

func (*RunGroupBy) Int

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

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

func (*RunGroupBy) IntX

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

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

func (*RunGroupBy) Ints

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

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

func (*RunGroupBy) IntsX

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

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

func (*RunGroupBy) Scan

func (rgb *RunGroupBy) Scan(ctx context.Context, v any) error

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

func (*RunGroupBy) ScanX

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

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

func (*RunGroupBy) String

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

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

func (*RunGroupBy) StringX

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

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

func (*RunGroupBy) Strings

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

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

func (*RunGroupBy) StringsX

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

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

type RunMutation

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

RunMutation represents an operation that mutates the Run nodes in the graph.

func (*RunMutation) AddField

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

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

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

func (*RunMutation) AddedField

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

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

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

func (*RunMutation) AddedIDs

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

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

func (*RunMutation) ClearEdge

func (m *RunMutation) 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 (*RunMutation) ClearEnd

func (m *RunMutation) ClearEnd()

ClearEnd clears the value of the "end" field.

func (*RunMutation) ClearField

func (m *RunMutation) 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 (*RunMutation) ClearLog

func (m *RunMutation) ClearLog()

ClearLog clears the value of the "log" field.

func (*RunMutation) ClearStart

func (m *RunMutation) ClearStart()

ClearStart clears the value of the "start" field.

func (*RunMutation) ClearedEdges

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

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

func (*RunMutation) ClearedFields

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

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

func (RunMutation) Client

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

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

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

func (*RunMutation) End

func (m *RunMutation) End() (r time.Time, exists bool)

End returns the value of the "end" field in the mutation.

func (*RunMutation) EndCleared

func (m *RunMutation) EndCleared() bool

EndCleared returns if the "end" field was cleared in this mutation.

func (*RunMutation) Field

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

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

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

func (*RunMutation) Fields

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

func (m *RunMutation) ID() (id uuid.UUID, 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 (*RunMutation) IDs

func (m *RunMutation) IDs(ctx context.Context) ([]uuid.UUID, 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 (*RunMutation) Job

func (m *RunMutation) Job() (r string, exists bool)

Job returns the value of the "job" field in the mutation.

func (*RunMutation) Log

func (m *RunMutation) Log() (r string, exists bool)

Log returns the value of the "log" field in the mutation.

func (*RunMutation) LogCleared

func (m *RunMutation) LogCleared() bool

LogCleared returns if the "log" field was cleared in this mutation.

func (*RunMutation) OldEnd

func (m *RunMutation) OldEnd(ctx context.Context) (v time.Time, err error)

OldEnd returns the old "end" field's value of the Run entity. If the Run 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 (*RunMutation) OldField

func (m *RunMutation) 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 (*RunMutation) OldJob

func (m *RunMutation) OldJob(ctx context.Context) (v string, err error)

OldJob returns the old "job" field's value of the Run entity. If the Run 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 (*RunMutation) OldLog

func (m *RunMutation) OldLog(ctx context.Context) (v string, err error)

OldLog returns the old "log" field's value of the Run entity. If the Run 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 (*RunMutation) OldStart

func (m *RunMutation) OldStart(ctx context.Context) (v time.Time, err error)

OldStart returns the old "start" field's value of the Run entity. If the Run 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 (*RunMutation) OldStatus

func (m *RunMutation) OldStatus(ctx context.Context) (v run.Status, err error)

OldStatus returns the old "status" field's value of the Run entity. If the Run 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 (*RunMutation) Op

func (m *RunMutation) Op() Op

Op returns the operation name.

func (*RunMutation) RemovedEdges

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

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

func (*RunMutation) RemovedIDs

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

func (m *RunMutation) 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 (*RunMutation) ResetEnd

func (m *RunMutation) ResetEnd()

ResetEnd resets all changes to the "end" field.

func (*RunMutation) ResetField

func (m *RunMutation) 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 (*RunMutation) ResetJob

func (m *RunMutation) ResetJob()

ResetJob resets all changes to the "job" field.

func (*RunMutation) ResetLog

func (m *RunMutation) ResetLog()

ResetLog resets all changes to the "log" field.

func (*RunMutation) ResetStart

func (m *RunMutation) ResetStart()

ResetStart resets all changes to the "start" field.

func (*RunMutation) ResetStatus

func (m *RunMutation) ResetStatus()

ResetStatus resets all changes to the "status" field.

func (*RunMutation) SetEnd

func (m *RunMutation) SetEnd(t time.Time)

SetEnd sets the "end" field.

func (*RunMutation) SetField

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

func (m *RunMutation) SetID(id uuid.UUID)

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

func (*RunMutation) SetJob

func (m *RunMutation) SetJob(s string)

SetJob sets the "job" field.

func (*RunMutation) SetLog

func (m *RunMutation) SetLog(s string)

SetLog sets the "log" field.

func (*RunMutation) SetOp

func (m *RunMutation) SetOp(op Op)

SetOp allows setting the mutation operation.

func (*RunMutation) SetStart

func (m *RunMutation) SetStart(t time.Time)

SetStart sets the "start" field.

func (*RunMutation) SetStatus

func (m *RunMutation) SetStatus(r run.Status)

SetStatus sets the "status" field.

func (*RunMutation) Start

func (m *RunMutation) Start() (r time.Time, exists bool)

Start returns the value of the "start" field in the mutation.

func (*RunMutation) StartCleared

func (m *RunMutation) StartCleared() bool

StartCleared returns if the "start" field was cleared in this mutation.

func (*RunMutation) Status

func (m *RunMutation) Status() (r run.Status, exists bool)

Status returns the value of the "status" field in the mutation.

func (RunMutation) Tx

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

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

func (*RunMutation) Type

func (m *RunMutation) Type() string

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

func (*RunMutation) Where

func (m *RunMutation) Where(ps ...predicate.Run)

Where appends a list predicates to the RunMutation builder.

func (*RunMutation) WhereP

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

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

type RunQuery

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

RunQuery is the builder for querying Run entities.

func (*RunQuery) Aggregate

func (rq *RunQuery) Aggregate(fns ...AggregateFunc) *RunSelect

Aggregate returns a RunSelect configured with the given aggregations.

func (*RunQuery) All

func (rq *RunQuery) All(ctx context.Context) ([]*Run, error)

All executes the query and returns a list of Runs.

func (*RunQuery) AllX

func (rq *RunQuery) AllX(ctx context.Context) []*Run

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

func (*RunQuery) Clone

func (rq *RunQuery) Clone() *RunQuery

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

func (*RunQuery) Count

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

Count returns the count of the given query.

func (*RunQuery) CountX

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

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

func (*RunQuery) Exist

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

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

func (*RunQuery) ExistX

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

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

func (*RunQuery) First

func (rq *RunQuery) First(ctx context.Context) (*Run, error)

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

func (*RunQuery) FirstID

func (rq *RunQuery) FirstID(ctx context.Context) (id uuid.UUID, err error)

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

func (*RunQuery) FirstIDX

func (rq *RunQuery) FirstIDX(ctx context.Context) uuid.UUID

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

func (*RunQuery) FirstX

func (rq *RunQuery) FirstX(ctx context.Context) *Run

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

func (*RunQuery) GroupBy

func (rq *RunQuery) GroupBy(field string, fields ...string) *RunGroupBy

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

client.Run.Query().
	GroupBy(run.FieldJob).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*RunQuery) IDs

func (rq *RunQuery) IDs(ctx context.Context) (ids []uuid.UUID, err error)

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

func (*RunQuery) IDsX

func (rq *RunQuery) IDsX(ctx context.Context) []uuid.UUID

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

func (*RunQuery) Limit

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

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

func (*RunQuery) Offset

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

Offset to start from.

func (*RunQuery) Only

func (rq *RunQuery) Only(ctx context.Context) (*Run, error)

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

func (*RunQuery) OnlyID

func (rq *RunQuery) OnlyID(ctx context.Context) (id uuid.UUID, err error)

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

func (*RunQuery) OnlyIDX

func (rq *RunQuery) OnlyIDX(ctx context.Context) uuid.UUID

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

func (*RunQuery) OnlyX

func (rq *RunQuery) OnlyX(ctx context.Context) *Run

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

func (*RunQuery) Order

func (rq *RunQuery) Order(o ...run.OrderOption) *RunQuery

Order specifies how the records should be ordered.

func (*RunQuery) Select

func (rq *RunQuery) Select(fields ...string) *RunSelect

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

client.Run.Query().
	Select(run.FieldJob).
	Scan(ctx, &v)

func (*RunQuery) Unique

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

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

func (rq *RunQuery) Where(ps ...predicate.Run) *RunQuery

Where adds a new predicate for the RunQuery builder.

type RunSelect

type RunSelect struct {
	*RunQuery
	// contains filtered or unexported fields
}

RunSelect is the builder for selecting fields of Run entities.

func (*RunSelect) Aggregate

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

Aggregate adds the given aggregation functions to the selector query.

func (*RunSelect) Bool

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

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

func (*RunSelect) BoolX

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

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

func (*RunSelect) Bools

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

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

func (*RunSelect) BoolsX

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

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

func (*RunSelect) Float64

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

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

func (*RunSelect) Float64X

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

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

func (*RunSelect) Float64s

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

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

func (*RunSelect) Float64sX

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

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

func (*RunSelect) Int

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

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

func (*RunSelect) IntX

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

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

func (*RunSelect) Ints

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

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

func (*RunSelect) IntsX

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

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

func (*RunSelect) Scan

func (rs *RunSelect) Scan(ctx context.Context, v any) error

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

func (*RunSelect) ScanX

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

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

func (*RunSelect) String

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

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

func (*RunSelect) StringX

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

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

func (*RunSelect) Strings

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

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

func (*RunSelect) StringsX

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

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

type RunUpdate

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

RunUpdate is the builder for updating Run entities.

func (*RunUpdate) ClearEnd

func (ru *RunUpdate) ClearEnd() *RunUpdate

ClearEnd clears the value of the "end" field.

func (*RunUpdate) ClearLog

func (ru *RunUpdate) ClearLog() *RunUpdate

ClearLog clears the value of the "log" field.

func (*RunUpdate) ClearStart

func (ru *RunUpdate) ClearStart() *RunUpdate

ClearStart clears the value of the "start" field.

func (*RunUpdate) Exec

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

Exec executes the query.

func (*RunUpdate) ExecX

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

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

func (*RunUpdate) Mutation

func (ru *RunUpdate) Mutation() *RunMutation

Mutation returns the RunMutation object of the builder.

func (*RunUpdate) Save

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

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

func (*RunUpdate) SaveX

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

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

func (*RunUpdate) SetEnd

func (ru *RunUpdate) SetEnd(t time.Time) *RunUpdate

SetEnd sets the "end" field.

func (*RunUpdate) SetJob

func (ru *RunUpdate) SetJob(s string) *RunUpdate

SetJob sets the "job" field.

func (*RunUpdate) SetLog

func (ru *RunUpdate) SetLog(s string) *RunUpdate

SetLog sets the "log" field.

func (*RunUpdate) SetNillableEnd

func (ru *RunUpdate) SetNillableEnd(t *time.Time) *RunUpdate

SetNillableEnd sets the "end" field if the given value is not nil.

func (*RunUpdate) SetNillableJob

func (ru *RunUpdate) SetNillableJob(s *string) *RunUpdate

SetNillableJob sets the "job" field if the given value is not nil.

func (*RunUpdate) SetNillableLog

func (ru *RunUpdate) SetNillableLog(s *string) *RunUpdate

SetNillableLog sets the "log" field if the given value is not nil.

func (*RunUpdate) SetNillableStart

func (ru *RunUpdate) SetNillableStart(t *time.Time) *RunUpdate

SetNillableStart sets the "start" field if the given value is not nil.

func (*RunUpdate) SetNillableStatus

func (ru *RunUpdate) SetNillableStatus(r *run.Status) *RunUpdate

SetNillableStatus sets the "status" field if the given value is not nil.

func (*RunUpdate) SetStart

func (ru *RunUpdate) SetStart(t time.Time) *RunUpdate

SetStart sets the "start" field.

func (*RunUpdate) SetStatus

func (ru *RunUpdate) SetStatus(r run.Status) *RunUpdate

SetStatus sets the "status" field.

func (*RunUpdate) Where

func (ru *RunUpdate) Where(ps ...predicate.Run) *RunUpdate

Where appends a list predicates to the RunUpdate builder.

type RunUpdateOne

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

RunUpdateOne is the builder for updating a single Run entity.

func (*RunUpdateOne) ClearEnd

func (ruo *RunUpdateOne) ClearEnd() *RunUpdateOne

ClearEnd clears the value of the "end" field.

func (*RunUpdateOne) ClearLog

func (ruo *RunUpdateOne) ClearLog() *RunUpdateOne

ClearLog clears the value of the "log" field.

func (*RunUpdateOne) ClearStart

func (ruo *RunUpdateOne) ClearStart() *RunUpdateOne

ClearStart clears the value of the "start" field.

func (*RunUpdateOne) Exec

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

Exec executes the query on the entity.

func (*RunUpdateOne) ExecX

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

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

func (*RunUpdateOne) Mutation

func (ruo *RunUpdateOne) Mutation() *RunMutation

Mutation returns the RunMutation object of the builder.

func (*RunUpdateOne) Save

func (ruo *RunUpdateOne) Save(ctx context.Context) (*Run, error)

Save executes the query and returns the updated Run entity.

func (*RunUpdateOne) SaveX

func (ruo *RunUpdateOne) SaveX(ctx context.Context) *Run

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

func (*RunUpdateOne) Select

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

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

func (*RunUpdateOne) SetEnd

func (ruo *RunUpdateOne) SetEnd(t time.Time) *RunUpdateOne

SetEnd sets the "end" field.

func (*RunUpdateOne) SetJob

func (ruo *RunUpdateOne) SetJob(s string) *RunUpdateOne

SetJob sets the "job" field.

func (*RunUpdateOne) SetLog

func (ruo *RunUpdateOne) SetLog(s string) *RunUpdateOne

SetLog sets the "log" field.

func (*RunUpdateOne) SetNillableEnd

func (ruo *RunUpdateOne) SetNillableEnd(t *time.Time) *RunUpdateOne

SetNillableEnd sets the "end" field if the given value is not nil.

func (*RunUpdateOne) SetNillableJob

func (ruo *RunUpdateOne) SetNillableJob(s *string) *RunUpdateOne

SetNillableJob sets the "job" field if the given value is not nil.

func (*RunUpdateOne) SetNillableLog

func (ruo *RunUpdateOne) SetNillableLog(s *string) *RunUpdateOne

SetNillableLog sets the "log" field if the given value is not nil.

func (*RunUpdateOne) SetNillableStart

func (ruo *RunUpdateOne) SetNillableStart(t *time.Time) *RunUpdateOne

SetNillableStart sets the "start" field if the given value is not nil.

func (*RunUpdateOne) SetNillableStatus

func (ruo *RunUpdateOne) SetNillableStatus(r *run.Status) *RunUpdateOne

SetNillableStatus sets the "status" field if the given value is not nil.

func (*RunUpdateOne) SetStart

func (ruo *RunUpdateOne) SetStart(t time.Time) *RunUpdateOne

SetStart sets the "start" field.

func (*RunUpdateOne) SetStatus

func (ruo *RunUpdateOne) SetStatus(r run.Status) *RunUpdateOne

SetStatus sets the "status" field.

func (*RunUpdateOne) Where

func (ruo *RunUpdateOne) Where(ps ...predicate.Run) *RunUpdateOne

Where appends a list predicates to the RunUpdate builder.

type Runs

type Runs []*Run

Runs is a parsable slice of Run.

type TraverseFunc

type TraverseFunc = ent.TraverseFunc

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

type Traverser

type Traverser = ent.Traverser

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

type Tx

type Tx struct {

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

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

func TxFromContext

func TxFromContext(ctx context.Context) *Tx

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

func (*Tx) Client

func (tx *Tx) Client() *Client

Client returns a Client that binds to current transaction.

func (*Tx) Commit

func (tx *Tx) Commit() error

Commit commits the transaction.

func (*Tx) OnCommit

func (tx *Tx) OnCommit(f CommitHook)

OnCommit adds a hook to call on commit.

func (*Tx) OnRollback

func (tx *Tx) OnRollback(f RollbackHook)

OnRollback adds a hook to call on rollback.

func (*Tx) Rollback

func (tx *Tx) Rollback() error

Rollback rollbacks the transaction.

type ValidationError

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

ValidationError returns when validating a field or edge fails.

func (*ValidationError) Error

func (e *ValidationError) Error() string

Error implements the error interface.

func (*ValidationError) Unwrap

func (e *ValidationError) Unwrap() error

Unwrap implements the errors.Wrapper interface.

type Value

type Value = ent.Value

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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