ent

package
v0.0.0-...-b0e5677 Latest Latest
Warning

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

Go to latest
Published: May 11, 2024 License: MIT Imports: 18 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.
	TypeJob = "Job"
)

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
	// Job is the client for interacting with the Job builders.
	Job *JobClient
	// 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().
	Job.
	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 Job

type Job struct {

	// ID of the ent.
	ID uint64 `json:"id,omitempty"`
	// CreatedAt holds the value of the "created_at" field.
	CreatedAt time.Time `json:"created_at,omitempty"`
	// UpdatedAt holds the value of the "updated_at" field.
	UpdatedAt time.Time `json:"updated_at,omitempty"`
	// Status holds the value of the "status" field.
	Status job.Status `json:"status,omitempty"`
	// QueueName holds the value of the "queue_name" field.
	QueueName string `json:"queue_name,omitempty"`
	// RefID holds the value of the "ref_id" field.
	RefID string `json:"ref_id,omitempty"`
	// Priority holds the value of the "priority" field.
	Priority uint `json:"priority,omitempty"`
	// RetryTimes holds the value of the "retry_times" field.
	RetryTimes uint `json:"retry_times,omitempty"`
	// Body holds the value of the "body" field.
	Body string `json:"body,omitempty"`
	// Error holds the value of the "error" field.
	Error string `json:"error,omitempty"`
	// ScheduledAt holds the value of the "scheduled_at" field.
	ScheduledAt time.Time `json:"scheduled_at,omitempty"`
	// FinishedAt holds the value of the "finished_at" field.
	FinishedAt time.Time `json:"finished_at,omitempty"`
	// contains filtered or unexported fields
}

Job is the model entity for the Job schema.

func (*Job) String

func (j *Job) String() string

String implements the fmt.Stringer.

func (*Job) Unwrap

func (j *Job) Unwrap() *Job

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

func (j *Job) Update() *JobUpdateOne

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

func (*Job) Value

func (j *Job) Value(name string) (ent.Value, error)

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

type JobClient

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

JobClient is a client for the Job schema.

func NewJobClient

func NewJobClient(c config) *JobClient

NewJobClient returns a client for the Job from the given config.

func (*JobClient) Create

func (c *JobClient) Create() *JobCreate

Create returns a builder for creating a Job entity.

func (*JobClient) CreateBulk

func (c *JobClient) CreateBulk(builders ...*JobCreate) *JobCreateBulk

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

func (*JobClient) Delete

func (c *JobClient) Delete() *JobDelete

Delete returns a delete builder for Job.

func (*JobClient) DeleteOne

func (c *JobClient) DeleteOne(j *Job) *JobDeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*JobClient) DeleteOneID

func (c *JobClient) DeleteOneID(id uint64) *JobDeleteOne

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

func (*JobClient) Get

func (c *JobClient) Get(ctx context.Context, id uint64) (*Job, error)

Get returns a Job entity by its id.

func (*JobClient) GetX

func (c *JobClient) GetX(ctx context.Context, id uint64) *Job

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

func (*JobClient) Hooks

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

Hooks returns the client hooks.

func (*JobClient) Intercept

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

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

func (*JobClient) Interceptors

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

Interceptors returns the client interceptors.

func (*JobClient) MapCreateBulk

func (c *JobClient) MapCreateBulk(slice any, setFunc func(*JobCreate, int)) *JobCreateBulk

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 (*JobClient) Query

func (c *JobClient) Query() *JobQuery

Query returns a query builder for Job.

func (*JobClient) Update

func (c *JobClient) Update() *JobUpdate

Update returns an update builder for Job.

func (*JobClient) UpdateOne

func (c *JobClient) UpdateOne(j *Job) *JobUpdateOne

UpdateOne returns an update builder for the given entity.

func (*JobClient) UpdateOneID

func (c *JobClient) UpdateOneID(id uint64) *JobUpdateOne

UpdateOneID returns an update builder for the given id.

func (*JobClient) Use

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

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

type JobCreate

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

JobCreate is the builder for creating a Job entity.

func (*JobCreate) Exec

func (jc *JobCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*JobCreate) ExecX

func (jc *JobCreate) ExecX(ctx context.Context)

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

func (*JobCreate) Mutation

func (jc *JobCreate) Mutation() *JobMutation

Mutation returns the JobMutation object of the builder.

func (*JobCreate) Save

func (jc *JobCreate) Save(ctx context.Context) (*Job, error)

Save creates the Job in the database.

func (*JobCreate) SaveX

func (jc *JobCreate) SaveX(ctx context.Context) *Job

SaveX calls Save and panics if Save returns an error.

func (*JobCreate) SetBody

func (jc *JobCreate) SetBody(s string) *JobCreate

SetBody sets the "body" field.

func (*JobCreate) SetCreatedAt

func (jc *JobCreate) SetCreatedAt(t time.Time) *JobCreate

SetCreatedAt sets the "created_at" field.

func (*JobCreate) SetError

func (jc *JobCreate) SetError(s string) *JobCreate

SetError sets the "error" field.

func (*JobCreate) SetFinishedAt

func (jc *JobCreate) SetFinishedAt(t time.Time) *JobCreate

SetFinishedAt sets the "finished_at" field.

func (*JobCreate) SetNillableBody

func (jc *JobCreate) SetNillableBody(s *string) *JobCreate

SetNillableBody sets the "body" field if the given value is not nil.

func (*JobCreate) SetNillableCreatedAt

func (jc *JobCreate) SetNillableCreatedAt(t *time.Time) *JobCreate

SetNillableCreatedAt sets the "created_at" field if the given value is not nil.

func (*JobCreate) SetNillableError

func (jc *JobCreate) SetNillableError(s *string) *JobCreate

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

func (*JobCreate) SetNillableFinishedAt

func (jc *JobCreate) SetNillableFinishedAt(t *time.Time) *JobCreate

SetNillableFinishedAt sets the "finished_at" field if the given value is not nil.

func (*JobCreate) SetNillablePriority

func (jc *JobCreate) SetNillablePriority(u *uint) *JobCreate

SetNillablePriority sets the "priority" field if the given value is not nil.

func (*JobCreate) SetNillableQueueName

func (jc *JobCreate) SetNillableQueueName(s *string) *JobCreate

SetNillableQueueName sets the "queue_name" field if the given value is not nil.

func (*JobCreate) SetNillableRefID

func (jc *JobCreate) SetNillableRefID(s *string) *JobCreate

SetNillableRefID sets the "ref_id" field if the given value is not nil.

func (*JobCreate) SetNillableRetryTimes

func (jc *JobCreate) SetNillableRetryTimes(u *uint) *JobCreate

SetNillableRetryTimes sets the "retry_times" field if the given value is not nil.

func (*JobCreate) SetNillableScheduledAt

func (jc *JobCreate) SetNillableScheduledAt(t *time.Time) *JobCreate

SetNillableScheduledAt sets the "scheduled_at" field if the given value is not nil.

func (*JobCreate) SetNillableStatus

func (jc *JobCreate) SetNillableStatus(j *job.Status) *JobCreate

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

func (*JobCreate) SetNillableUpdatedAt

func (jc *JobCreate) SetNillableUpdatedAt(t *time.Time) *JobCreate

SetNillableUpdatedAt sets the "updated_at" field if the given value is not nil.

func (*JobCreate) SetPriority

func (jc *JobCreate) SetPriority(u uint) *JobCreate

SetPriority sets the "priority" field.

func (*JobCreate) SetQueueName

func (jc *JobCreate) SetQueueName(s string) *JobCreate

SetQueueName sets the "queue_name" field.

func (*JobCreate) SetRefID

func (jc *JobCreate) SetRefID(s string) *JobCreate

SetRefID sets the "ref_id" field.

func (*JobCreate) SetRetryTimes

func (jc *JobCreate) SetRetryTimes(u uint) *JobCreate

SetRetryTimes sets the "retry_times" field.

func (*JobCreate) SetScheduledAt

func (jc *JobCreate) SetScheduledAt(t time.Time) *JobCreate

SetScheduledAt sets the "scheduled_at" field.

func (*JobCreate) SetStatus

func (jc *JobCreate) SetStatus(j job.Status) *JobCreate

SetStatus sets the "status" field.

func (*JobCreate) SetUpdatedAt

func (jc *JobCreate) SetUpdatedAt(t time.Time) *JobCreate

SetUpdatedAt sets the "updated_at" field.

type JobCreateBulk

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

JobCreateBulk is the builder for creating many Job entities in bulk.

func (*JobCreateBulk) Exec

func (jcb *JobCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*JobCreateBulk) ExecX

func (jcb *JobCreateBulk) ExecX(ctx context.Context)

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

func (*JobCreateBulk) Save

func (jcb *JobCreateBulk) Save(ctx context.Context) ([]*Job, error)

Save creates the Job entities in the database.

func (*JobCreateBulk) SaveX

func (jcb *JobCreateBulk) SaveX(ctx context.Context) []*Job

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

type JobDelete

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

JobDelete is the builder for deleting a Job entity.

func (*JobDelete) Exec

func (jd *JobDelete) Exec(ctx context.Context) (int, error)

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

func (*JobDelete) ExecX

func (jd *JobDelete) ExecX(ctx context.Context) int

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

func (*JobDelete) Where

func (jd *JobDelete) Where(ps ...predicate.Job) *JobDelete

Where appends a list predicates to the JobDelete builder.

type JobDeleteOne

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

JobDeleteOne is the builder for deleting a single Job entity.

func (*JobDeleteOne) Exec

func (jdo *JobDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*JobDeleteOne) ExecX

func (jdo *JobDeleteOne) ExecX(ctx context.Context)

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

func (*JobDeleteOne) Where

func (jdo *JobDeleteOne) Where(ps ...predicate.Job) *JobDeleteOne

Where appends a list predicates to the JobDelete builder.

type JobGroupBy

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

JobGroupBy is the group-by builder for Job entities.

func (*JobGroupBy) Aggregate

func (jgb *JobGroupBy) Aggregate(fns ...AggregateFunc) *JobGroupBy

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

func (*JobGroupBy) Bool

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

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

func (*JobGroupBy) BoolX

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

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

func (*JobGroupBy) Bools

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

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

func (*JobGroupBy) BoolsX

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

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

func (*JobGroupBy) Float64

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

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

func (*JobGroupBy) Float64X

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

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

func (*JobGroupBy) Float64s

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

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

func (*JobGroupBy) Float64sX

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

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

func (*JobGroupBy) Int

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

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

func (*JobGroupBy) IntX

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

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

func (*JobGroupBy) Ints

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

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

func (*JobGroupBy) IntsX

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

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

func (*JobGroupBy) Scan

func (jgb *JobGroupBy) Scan(ctx context.Context, v any) error

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

func (*JobGroupBy) ScanX

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

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

func (*JobGroupBy) String

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

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

func (*JobGroupBy) StringX

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

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

func (*JobGroupBy) Strings

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

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

func (*JobGroupBy) StringsX

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

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

type JobMutation

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

JobMutation represents an operation that mutates the Job nodes in the graph.

func (*JobMutation) AddField

func (m *JobMutation) 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 (*JobMutation) AddPriority

func (m *JobMutation) AddPriority(u int)

AddPriority adds u to the "priority" field.

func (*JobMutation) AddRetryTimes

func (m *JobMutation) AddRetryTimes(u int)

AddRetryTimes adds u to the "retry_times" field.

func (*JobMutation) AddedEdges

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

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

func (*JobMutation) AddedField

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

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

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

func (*JobMutation) AddedIDs

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

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

func (*JobMutation) AddedPriority

func (m *JobMutation) AddedPriority() (r int, exists bool)

AddedPriority returns the value that was added to the "priority" field in this mutation.

func (*JobMutation) AddedRetryTimes

func (m *JobMutation) AddedRetryTimes() (r int, exists bool)

AddedRetryTimes returns the value that was added to the "retry_times" field in this mutation.

func (*JobMutation) Body

func (m *JobMutation) Body() (r string, exists bool)

Body returns the value of the "body" field in the mutation.

func (*JobMutation) BodyCleared

func (m *JobMutation) BodyCleared() bool

BodyCleared returns if the "body" field was cleared in this mutation.

func (*JobMutation) ClearBody

func (m *JobMutation) ClearBody()

ClearBody clears the value of the "body" field.

func (*JobMutation) ClearEdge

func (m *JobMutation) 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 (*JobMutation) ClearError

func (m *JobMutation) ClearError()

ClearError clears the value of the "error" field.

func (*JobMutation) ClearField

func (m *JobMutation) 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 (*JobMutation) ClearFinishedAt

func (m *JobMutation) ClearFinishedAt()

ClearFinishedAt clears the value of the "finished_at" field.

func (*JobMutation) ClearedEdges

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

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

func (*JobMutation) ClearedFields

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

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

func (JobMutation) Client

func (m JobMutation) 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 (*JobMutation) CreatedAt

func (m *JobMutation) CreatedAt() (r time.Time, exists bool)

CreatedAt returns the value of the "created_at" field in the mutation.

func (*JobMutation) EdgeCleared

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

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

func (*JobMutation) Error

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

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

func (*JobMutation) ErrorCleared

func (m *JobMutation) ErrorCleared() bool

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

func (*JobMutation) Field

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

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

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

func (*JobMutation) Fields

func (m *JobMutation) 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 (*JobMutation) FinishedAt

func (m *JobMutation) FinishedAt() (r time.Time, exists bool)

FinishedAt returns the value of the "finished_at" field in the mutation.

func (*JobMutation) FinishedAtCleared

func (m *JobMutation) FinishedAtCleared() bool

FinishedAtCleared returns if the "finished_at" field was cleared in this mutation.

func (*JobMutation) ID

func (m *JobMutation) ID() (id uint64, 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 (*JobMutation) IDs

func (m *JobMutation) IDs(ctx context.Context) ([]uint64, 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 (*JobMutation) OldBody

func (m *JobMutation) OldBody(ctx context.Context) (v string, err error)

OldBody returns the old "body" field's value of the Job entity. If the Job 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 (*JobMutation) OldCreatedAt

func (m *JobMutation) OldCreatedAt(ctx context.Context) (v time.Time, err error)

OldCreatedAt returns the old "created_at" field's value of the Job entity. If the Job 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 (*JobMutation) OldError

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

OldError returns the old "error" field's value of the Job entity. If the Job 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 (*JobMutation) OldField

func (m *JobMutation) 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 (*JobMutation) OldFinishedAt

func (m *JobMutation) OldFinishedAt(ctx context.Context) (v time.Time, err error)

OldFinishedAt returns the old "finished_at" field's value of the Job entity. If the Job 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 (*JobMutation) OldPriority

func (m *JobMutation) OldPriority(ctx context.Context) (v uint, err error)

OldPriority returns the old "priority" field's value of the Job entity. If the Job 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 (*JobMutation) OldQueueName

func (m *JobMutation) OldQueueName(ctx context.Context) (v string, err error)

OldQueueName returns the old "queue_name" field's value of the Job entity. If the Job 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 (*JobMutation) OldRefID

func (m *JobMutation) OldRefID(ctx context.Context) (v string, err error)

OldRefID returns the old "ref_id" field's value of the Job entity. If the Job 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 (*JobMutation) OldRetryTimes

func (m *JobMutation) OldRetryTimes(ctx context.Context) (v uint, err error)

OldRetryTimes returns the old "retry_times" field's value of the Job entity. If the Job 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 (*JobMutation) OldScheduledAt

func (m *JobMutation) OldScheduledAt(ctx context.Context) (v time.Time, err error)

OldScheduledAt returns the old "scheduled_at" field's value of the Job entity. If the Job 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 (*JobMutation) OldStatus

func (m *JobMutation) OldStatus(ctx context.Context) (v job.Status, err error)

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

func (m *JobMutation) OldUpdatedAt(ctx context.Context) (v time.Time, err error)

OldUpdatedAt returns the old "updated_at" field's value of the Job entity. If the Job 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 (*JobMutation) Op

func (m *JobMutation) Op() Op

Op returns the operation name.

func (*JobMutation) Priority

func (m *JobMutation) Priority() (r uint, exists bool)

Priority returns the value of the "priority" field in the mutation.

func (*JobMutation) QueueName

func (m *JobMutation) QueueName() (r string, exists bool)

QueueName returns the value of the "queue_name" field in the mutation.

func (*JobMutation) RefID

func (m *JobMutation) RefID() (r string, exists bool)

RefID returns the value of the "ref_id" field in the mutation.

func (*JobMutation) RemovedEdges

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

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

func (*JobMutation) RemovedIDs

func (m *JobMutation) 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 (*JobMutation) ResetBody

func (m *JobMutation) ResetBody()

ResetBody resets all changes to the "body" field.

func (*JobMutation) ResetCreatedAt

func (m *JobMutation) ResetCreatedAt()

ResetCreatedAt resets all changes to the "created_at" field.

func (*JobMutation) ResetEdge

func (m *JobMutation) 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 (*JobMutation) ResetError

func (m *JobMutation) ResetError()

ResetError resets all changes to the "error" field.

func (*JobMutation) ResetField

func (m *JobMutation) 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 (*JobMutation) ResetFinishedAt

func (m *JobMutation) ResetFinishedAt()

ResetFinishedAt resets all changes to the "finished_at" field.

func (*JobMutation) ResetPriority

func (m *JobMutation) ResetPriority()

ResetPriority resets all changes to the "priority" field.

func (*JobMutation) ResetQueueName

func (m *JobMutation) ResetQueueName()

ResetQueueName resets all changes to the "queue_name" field.

func (*JobMutation) ResetRefID

func (m *JobMutation) ResetRefID()

ResetRefID resets all changes to the "ref_id" field.

func (*JobMutation) ResetRetryTimes

func (m *JobMutation) ResetRetryTimes()

ResetRetryTimes resets all changes to the "retry_times" field.

func (*JobMutation) ResetScheduledAt

func (m *JobMutation) ResetScheduledAt()

ResetScheduledAt resets all changes to the "scheduled_at" field.

func (*JobMutation) ResetStatus

func (m *JobMutation) ResetStatus()

ResetStatus resets all changes to the "status" field.

func (*JobMutation) ResetUpdatedAt

func (m *JobMutation) ResetUpdatedAt()

ResetUpdatedAt resets all changes to the "updated_at" field.

func (*JobMutation) RetryTimes

func (m *JobMutation) RetryTimes() (r uint, exists bool)

RetryTimes returns the value of the "retry_times" field in the mutation.

func (*JobMutation) ScheduledAt

func (m *JobMutation) ScheduledAt() (r time.Time, exists bool)

ScheduledAt returns the value of the "scheduled_at" field in the mutation.

func (*JobMutation) SetBody

func (m *JobMutation) SetBody(s string)

SetBody sets the "body" field.

func (*JobMutation) SetCreatedAt

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

SetCreatedAt sets the "created_at" field.

func (*JobMutation) SetError

func (m *JobMutation) SetError(s string)

SetError sets the "error" field.

func (*JobMutation) SetField

func (m *JobMutation) 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 (*JobMutation) SetFinishedAt

func (m *JobMutation) SetFinishedAt(t time.Time)

SetFinishedAt sets the "finished_at" field.

func (*JobMutation) SetOp

func (m *JobMutation) SetOp(op Op)

SetOp allows setting the mutation operation.

func (*JobMutation) SetPriority

func (m *JobMutation) SetPriority(u uint)

SetPriority sets the "priority" field.

func (*JobMutation) SetQueueName

func (m *JobMutation) SetQueueName(s string)

SetQueueName sets the "queue_name" field.

func (*JobMutation) SetRefID

func (m *JobMutation) SetRefID(s string)

SetRefID sets the "ref_id" field.

func (*JobMutation) SetRetryTimes

func (m *JobMutation) SetRetryTimes(u uint)

SetRetryTimes sets the "retry_times" field.

func (*JobMutation) SetScheduledAt

func (m *JobMutation) SetScheduledAt(t time.Time)

SetScheduledAt sets the "scheduled_at" field.

func (*JobMutation) SetStatus

func (m *JobMutation) SetStatus(j job.Status)

SetStatus sets the "status" field.

func (*JobMutation) SetUpdatedAt

func (m *JobMutation) SetUpdatedAt(t time.Time)

SetUpdatedAt sets the "updated_at" field.

func (*JobMutation) Status

func (m *JobMutation) Status() (r job.Status, exists bool)

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

func (JobMutation) Tx

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

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

func (*JobMutation) Type

func (m *JobMutation) Type() string

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

func (*JobMutation) UpdatedAt

func (m *JobMutation) UpdatedAt() (r time.Time, exists bool)

UpdatedAt returns the value of the "updated_at" field in the mutation.

func (*JobMutation) Where

func (m *JobMutation) Where(ps ...predicate.Job)

Where appends a list predicates to the JobMutation builder.

func (*JobMutation) WhereP

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

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

type JobQuery

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

JobQuery is the builder for querying Job entities.

func (*JobQuery) Aggregate

func (jq *JobQuery) Aggregate(fns ...AggregateFunc) *JobSelect

Aggregate returns a JobSelect configured with the given aggregations.

func (*JobQuery) All

func (jq *JobQuery) All(ctx context.Context) ([]*Job, error)

All executes the query and returns a list of Jobs.

func (*JobQuery) AllX

func (jq *JobQuery) AllX(ctx context.Context) []*Job

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

func (*JobQuery) Clone

func (jq *JobQuery) Clone() *JobQuery

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

func (*JobQuery) Count

func (jq *JobQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*JobQuery) CountX

func (jq *JobQuery) CountX(ctx context.Context) int

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

func (*JobQuery) Exist

func (jq *JobQuery) Exist(ctx context.Context) (bool, error)

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

func (*JobQuery) ExistX

func (jq *JobQuery) ExistX(ctx context.Context) bool

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

func (*JobQuery) First

func (jq *JobQuery) First(ctx context.Context) (*Job, error)

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

func (*JobQuery) FirstID

func (jq *JobQuery) FirstID(ctx context.Context) (id uint64, err error)

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

func (*JobQuery) FirstIDX

func (jq *JobQuery) FirstIDX(ctx context.Context) uint64

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

func (*JobQuery) FirstX

func (jq *JobQuery) FirstX(ctx context.Context) *Job

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

func (*JobQuery) GroupBy

func (jq *JobQuery) GroupBy(field string, fields ...string) *JobGroupBy

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

Example:

var v []struct {
	CreatedAt time.Time `json:"created_at,omitempty"`
	Count int `json:"count,omitempty"`
}

client.Job.Query().
	GroupBy(job.FieldCreatedAt).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*JobQuery) IDs

func (jq *JobQuery) IDs(ctx context.Context) (ids []uint64, err error)

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

func (*JobQuery) IDsX

func (jq *JobQuery) IDsX(ctx context.Context) []uint64

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

func (*JobQuery) Limit

func (jq *JobQuery) Limit(limit int) *JobQuery

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

func (*JobQuery) Offset

func (jq *JobQuery) Offset(offset int) *JobQuery

Offset to start from.

func (*JobQuery) Only

func (jq *JobQuery) Only(ctx context.Context) (*Job, error)

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

func (*JobQuery) OnlyID

func (jq *JobQuery) OnlyID(ctx context.Context) (id uint64, err error)

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

func (*JobQuery) OnlyIDX

func (jq *JobQuery) OnlyIDX(ctx context.Context) uint64

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

func (*JobQuery) OnlyX

func (jq *JobQuery) OnlyX(ctx context.Context) *Job

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

func (*JobQuery) Order

func (jq *JobQuery) Order(o ...job.OrderOption) *JobQuery

Order specifies how the records should be ordered.

func (*JobQuery) Select

func (jq *JobQuery) Select(fields ...string) *JobSelect

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

Example:

var v []struct {
	CreatedAt time.Time `json:"created_at,omitempty"`
}

client.Job.Query().
	Select(job.FieldCreatedAt).
	Scan(ctx, &v)

func (*JobQuery) Unique

func (jq *JobQuery) Unique(unique bool) *JobQuery

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

func (jq *JobQuery) Where(ps ...predicate.Job) *JobQuery

Where adds a new predicate for the JobQuery builder.

type JobSelect

type JobSelect struct {
	*JobQuery
	// contains filtered or unexported fields
}

JobSelect is the builder for selecting fields of Job entities.

func (*JobSelect) Aggregate

func (js *JobSelect) Aggregate(fns ...AggregateFunc) *JobSelect

Aggregate adds the given aggregation functions to the selector query.

func (*JobSelect) Bool

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

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

func (*JobSelect) BoolX

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

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

func (*JobSelect) Bools

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

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

func (*JobSelect) BoolsX

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

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

func (*JobSelect) Float64

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

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

func (*JobSelect) Float64X

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

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

func (*JobSelect) Float64s

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

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

func (*JobSelect) Float64sX

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

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

func (*JobSelect) Int

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

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

func (*JobSelect) IntX

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

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

func (*JobSelect) Ints

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

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

func (*JobSelect) IntsX

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

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

func (*JobSelect) Scan

func (js *JobSelect) Scan(ctx context.Context, v any) error

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

func (*JobSelect) ScanX

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

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

func (*JobSelect) String

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

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

func (*JobSelect) StringX

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

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

func (*JobSelect) Strings

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

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

func (*JobSelect) StringsX

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

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

type JobUpdate

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

JobUpdate is the builder for updating Job entities.

func (*JobUpdate) AddPriority

func (ju *JobUpdate) AddPriority(u int) *JobUpdate

AddPriority adds u to the "priority" field.

func (*JobUpdate) AddRetryTimes

func (ju *JobUpdate) AddRetryTimes(u int) *JobUpdate

AddRetryTimes adds u to the "retry_times" field.

func (*JobUpdate) ClearBody

func (ju *JobUpdate) ClearBody() *JobUpdate

ClearBody clears the value of the "body" field.

func (*JobUpdate) ClearError

func (ju *JobUpdate) ClearError() *JobUpdate

ClearError clears the value of the "error" field.

func (*JobUpdate) ClearFinishedAt

func (ju *JobUpdate) ClearFinishedAt() *JobUpdate

ClearFinishedAt clears the value of the "finished_at" field.

func (*JobUpdate) Exec

func (ju *JobUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*JobUpdate) ExecX

func (ju *JobUpdate) ExecX(ctx context.Context)

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

func (*JobUpdate) Mutation

func (ju *JobUpdate) Mutation() *JobMutation

Mutation returns the JobMutation object of the builder.

func (*JobUpdate) Save

func (ju *JobUpdate) Save(ctx context.Context) (int, error)

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

func (*JobUpdate) SaveX

func (ju *JobUpdate) SaveX(ctx context.Context) int

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

func (*JobUpdate) SetBody

func (ju *JobUpdate) SetBody(s string) *JobUpdate

SetBody sets the "body" field.

func (*JobUpdate) SetCreatedAt

func (ju *JobUpdate) SetCreatedAt(t time.Time) *JobUpdate

SetCreatedAt sets the "created_at" field.

func (*JobUpdate) SetError

func (ju *JobUpdate) SetError(s string) *JobUpdate

SetError sets the "error" field.

func (*JobUpdate) SetFinishedAt

func (ju *JobUpdate) SetFinishedAt(t time.Time) *JobUpdate

SetFinishedAt sets the "finished_at" field.

func (*JobUpdate) SetNillableBody

func (ju *JobUpdate) SetNillableBody(s *string) *JobUpdate

SetNillableBody sets the "body" field if the given value is not nil.

func (*JobUpdate) SetNillableCreatedAt

func (ju *JobUpdate) SetNillableCreatedAt(t *time.Time) *JobUpdate

SetNillableCreatedAt sets the "created_at" field if the given value is not nil.

func (*JobUpdate) SetNillableError

func (ju *JobUpdate) SetNillableError(s *string) *JobUpdate

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

func (*JobUpdate) SetNillableFinishedAt

func (ju *JobUpdate) SetNillableFinishedAt(t *time.Time) *JobUpdate

SetNillableFinishedAt sets the "finished_at" field if the given value is not nil.

func (*JobUpdate) SetNillablePriority

func (ju *JobUpdate) SetNillablePriority(u *uint) *JobUpdate

SetNillablePriority sets the "priority" field if the given value is not nil.

func (*JobUpdate) SetNillableQueueName

func (ju *JobUpdate) SetNillableQueueName(s *string) *JobUpdate

SetNillableQueueName sets the "queue_name" field if the given value is not nil.

func (*JobUpdate) SetNillableRefID

func (ju *JobUpdate) SetNillableRefID(s *string) *JobUpdate

SetNillableRefID sets the "ref_id" field if the given value is not nil.

func (*JobUpdate) SetNillableRetryTimes

func (ju *JobUpdate) SetNillableRetryTimes(u *uint) *JobUpdate

SetNillableRetryTimes sets the "retry_times" field if the given value is not nil.

func (*JobUpdate) SetNillableScheduledAt

func (ju *JobUpdate) SetNillableScheduledAt(t *time.Time) *JobUpdate

SetNillableScheduledAt sets the "scheduled_at" field if the given value is not nil.

func (*JobUpdate) SetNillableStatus

func (ju *JobUpdate) SetNillableStatus(j *job.Status) *JobUpdate

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

func (*JobUpdate) SetPriority

func (ju *JobUpdate) SetPriority(u uint) *JobUpdate

SetPriority sets the "priority" field.

func (*JobUpdate) SetQueueName

func (ju *JobUpdate) SetQueueName(s string) *JobUpdate

SetQueueName sets the "queue_name" field.

func (*JobUpdate) SetRefID

func (ju *JobUpdate) SetRefID(s string) *JobUpdate

SetRefID sets the "ref_id" field.

func (*JobUpdate) SetRetryTimes

func (ju *JobUpdate) SetRetryTimes(u uint) *JobUpdate

SetRetryTimes sets the "retry_times" field.

func (*JobUpdate) SetScheduledAt

func (ju *JobUpdate) SetScheduledAt(t time.Time) *JobUpdate

SetScheduledAt sets the "scheduled_at" field.

func (*JobUpdate) SetStatus

func (ju *JobUpdate) SetStatus(j job.Status) *JobUpdate

SetStatus sets the "status" field.

func (*JobUpdate) SetUpdatedAt

func (ju *JobUpdate) SetUpdatedAt(t time.Time) *JobUpdate

SetUpdatedAt sets the "updated_at" field.

func (*JobUpdate) Where

func (ju *JobUpdate) Where(ps ...predicate.Job) *JobUpdate

Where appends a list predicates to the JobUpdate builder.

type JobUpdateOne

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

JobUpdateOne is the builder for updating a single Job entity.

func (*JobUpdateOne) AddPriority

func (juo *JobUpdateOne) AddPriority(u int) *JobUpdateOne

AddPriority adds u to the "priority" field.

func (*JobUpdateOne) AddRetryTimes

func (juo *JobUpdateOne) AddRetryTimes(u int) *JobUpdateOne

AddRetryTimes adds u to the "retry_times" field.

func (*JobUpdateOne) ClearBody

func (juo *JobUpdateOne) ClearBody() *JobUpdateOne

ClearBody clears the value of the "body" field.

func (*JobUpdateOne) ClearError

func (juo *JobUpdateOne) ClearError() *JobUpdateOne

ClearError clears the value of the "error" field.

func (*JobUpdateOne) ClearFinishedAt

func (juo *JobUpdateOne) ClearFinishedAt() *JobUpdateOne

ClearFinishedAt clears the value of the "finished_at" field.

func (*JobUpdateOne) Exec

func (juo *JobUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*JobUpdateOne) ExecX

func (juo *JobUpdateOne) ExecX(ctx context.Context)

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

func (*JobUpdateOne) Mutation

func (juo *JobUpdateOne) Mutation() *JobMutation

Mutation returns the JobMutation object of the builder.

func (*JobUpdateOne) Save

func (juo *JobUpdateOne) Save(ctx context.Context) (*Job, error)

Save executes the query and returns the updated Job entity.

func (*JobUpdateOne) SaveX

func (juo *JobUpdateOne) SaveX(ctx context.Context) *Job

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

func (*JobUpdateOne) Select

func (juo *JobUpdateOne) Select(field string, fields ...string) *JobUpdateOne

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

func (*JobUpdateOne) SetBody

func (juo *JobUpdateOne) SetBody(s string) *JobUpdateOne

SetBody sets the "body" field.

func (*JobUpdateOne) SetCreatedAt

func (juo *JobUpdateOne) SetCreatedAt(t time.Time) *JobUpdateOne

SetCreatedAt sets the "created_at" field.

func (*JobUpdateOne) SetError

func (juo *JobUpdateOne) SetError(s string) *JobUpdateOne

SetError sets the "error" field.

func (*JobUpdateOne) SetFinishedAt

func (juo *JobUpdateOne) SetFinishedAt(t time.Time) *JobUpdateOne

SetFinishedAt sets the "finished_at" field.

func (*JobUpdateOne) SetNillableBody

func (juo *JobUpdateOne) SetNillableBody(s *string) *JobUpdateOne

SetNillableBody sets the "body" field if the given value is not nil.

func (*JobUpdateOne) SetNillableCreatedAt

func (juo *JobUpdateOne) SetNillableCreatedAt(t *time.Time) *JobUpdateOne

SetNillableCreatedAt sets the "created_at" field if the given value is not nil.

func (*JobUpdateOne) SetNillableError

func (juo *JobUpdateOne) SetNillableError(s *string) *JobUpdateOne

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

func (*JobUpdateOne) SetNillableFinishedAt

func (juo *JobUpdateOne) SetNillableFinishedAt(t *time.Time) *JobUpdateOne

SetNillableFinishedAt sets the "finished_at" field if the given value is not nil.

func (*JobUpdateOne) SetNillablePriority

func (juo *JobUpdateOne) SetNillablePriority(u *uint) *JobUpdateOne

SetNillablePriority sets the "priority" field if the given value is not nil.

func (*JobUpdateOne) SetNillableQueueName

func (juo *JobUpdateOne) SetNillableQueueName(s *string) *JobUpdateOne

SetNillableQueueName sets the "queue_name" field if the given value is not nil.

func (*JobUpdateOne) SetNillableRefID

func (juo *JobUpdateOne) SetNillableRefID(s *string) *JobUpdateOne

SetNillableRefID sets the "ref_id" field if the given value is not nil.

func (*JobUpdateOne) SetNillableRetryTimes

func (juo *JobUpdateOne) SetNillableRetryTimes(u *uint) *JobUpdateOne

SetNillableRetryTimes sets the "retry_times" field if the given value is not nil.

func (*JobUpdateOne) SetNillableScheduledAt

func (juo *JobUpdateOne) SetNillableScheduledAt(t *time.Time) *JobUpdateOne

SetNillableScheduledAt sets the "scheduled_at" field if the given value is not nil.

func (*JobUpdateOne) SetNillableStatus

func (juo *JobUpdateOne) SetNillableStatus(j *job.Status) *JobUpdateOne

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

func (*JobUpdateOne) SetPriority

func (juo *JobUpdateOne) SetPriority(u uint) *JobUpdateOne

SetPriority sets the "priority" field.

func (*JobUpdateOne) SetQueueName

func (juo *JobUpdateOne) SetQueueName(s string) *JobUpdateOne

SetQueueName sets the "queue_name" field.

func (*JobUpdateOne) SetRefID

func (juo *JobUpdateOne) SetRefID(s string) *JobUpdateOne

SetRefID sets the "ref_id" field.

func (*JobUpdateOne) SetRetryTimes

func (juo *JobUpdateOne) SetRetryTimes(u uint) *JobUpdateOne

SetRetryTimes sets the "retry_times" field.

func (*JobUpdateOne) SetScheduledAt

func (juo *JobUpdateOne) SetScheduledAt(t time.Time) *JobUpdateOne

SetScheduledAt sets the "scheduled_at" field.

func (*JobUpdateOne) SetStatus

func (juo *JobUpdateOne) SetStatus(j job.Status) *JobUpdateOne

SetStatus sets the "status" field.

func (*JobUpdateOne) SetUpdatedAt

func (juo *JobUpdateOne) SetUpdatedAt(t time.Time) *JobUpdateOne

SetUpdatedAt sets the "updated_at" field.

func (*JobUpdateOne) Where

func (juo *JobUpdateOne) Where(ps ...predicate.Job) *JobUpdateOne

Where appends a list predicates to the JobUpdate builder.

type Jobs

type Jobs []*Job

Jobs is a parsable slice of Job.

type MutateFunc

type MutateFunc = ent.MutateFunc

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

type Mutation

type Mutation = ent.Mutation

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

type Mutator

type Mutator = ent.Mutator

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

type NotFoundError

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

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

func (*NotFoundError) Error

func (e *NotFoundError) Error() string

Error implements the error interface.

type NotLoadedError

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

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

func (*NotLoadedError) Error

func (e *NotLoadedError) Error() string

Error implements the error interface.

type NotSingularError

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

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

func (*NotSingularError) Error

func (e *NotSingularError) Error() string

Error implements the error interface.

type Op

type Op = ent.Op

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

type Option

type Option func(*config)

Option function to configure the client.

func Debug

func Debug() Option

Debug enables debug logging on the ent.Driver.

func Driver

func Driver(driver dialect.Driver) Option

Driver configures the client driver.

func Log

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

Log sets the logging function for debug mode.

type OrderFunc

type OrderFunc func(*sql.Selector)

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

type Policy

type Policy = ent.Policy

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

type Querier

type Querier = ent.Querier

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

type QuerierFunc

type QuerierFunc = ent.QuerierFunc

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

type Query

type Query = ent.Query

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

type QueryContext

type QueryContext = ent.QueryContext

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

type RollbackFunc

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

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

func (RollbackFunc) Rollback

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

Rollback calls f(ctx, m).

type RollbackHook

type RollbackHook func(Rollbacker) Rollbacker

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

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

type Rollbacker

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

Rollbacker is the interface that wraps the Rollback method.

type TraverseFunc

type TraverseFunc = ent.TraverseFunc

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

type Traverser

type Traverser = ent.Traverser

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

type Tx

type Tx struct {

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