ent

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2023 License: Apache-2.0 Imports: 21 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.
	TypeChunk  = "Chunk"
	TypeWorker = "Worker"
)

Variables

This section is empty.

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 Chunk

type Chunk struct {

	// ID of the ent.
	// Like 2006-01-02T15
	ID string `json:"id,omitempty"`
	// Time when entity was created.
	CreatedAt time.Time `json:"created_at,omitempty"`
	// Time when entity was updated.
	UpdatedAt time.Time `json:"updated_at,omitempty"`
	// Minimum possible time of entry in chunk
	Start time.Time `json:"start,omitempty"`
	// State expiration like heartbeat
	LeaseExpiresAt time.Time `json:"lease_expires_at,omitempty"`
	// State holds the value of the "state" field.
	State chunk.State `json:"state,omitempty"`
	// SizeInput holds the value of the "size_input" field.
	SizeInput int64 `json:"size_input,omitempty"`
	// SizeContent holds the value of the "size_content" field.
	SizeContent int64 `json:"size_content,omitempty"`
	// SizeOutput holds the value of the "size_output" field.
	SizeOutput int64 `json:"size_output,omitempty"`
	// Sha256Input holds the value of the "sha256_input" field.
	Sha256Input *string `json:"sha256_input,omitempty"`
	// Sha256Content holds the value of the "sha256_content" field.
	Sha256Content *string `json:"sha256_content,omitempty"`
	// Sha256Output holds the value of the "sha256_output" field.
	Sha256Output *string `json:"sha256_output,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the ChunkQuery when eager-loading is set.
	Edges ChunkEdges `json:"edges"`
	// contains filtered or unexported fields
}

Chunk is the model entity for the Chunk schema.

func (*Chunk) QueryWorker

func (c *Chunk) QueryWorker() *WorkerQuery

QueryWorker queries the "worker" edge of the Chunk entity.

func (*Chunk) String

func (c *Chunk) String() string

String implements the fmt.Stringer.

func (*Chunk) Unwrap

func (c *Chunk) Unwrap() *Chunk

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

func (c *Chunk) Update() *ChunkUpdateOne

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

func (*Chunk) Value added in v0.2.0

func (c *Chunk) Value(name string) (ent.Value, error)

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

type ChunkClient

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

ChunkClient is a client for the Chunk schema.

func NewChunkClient

func NewChunkClient(c config) *ChunkClient

NewChunkClient returns a client for the Chunk from the given config.

func (*ChunkClient) Create

func (c *ChunkClient) Create() *ChunkCreate

Create returns a builder for creating a Chunk entity.

func (*ChunkClient) CreateBulk

func (c *ChunkClient) CreateBulk(builders ...*ChunkCreate) *ChunkCreateBulk

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

func (*ChunkClient) Delete

func (c *ChunkClient) Delete() *ChunkDelete

Delete returns a delete builder for Chunk.

func (*ChunkClient) DeleteOne

func (c *ChunkClient) DeleteOne(ch *Chunk) *ChunkDeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*ChunkClient) DeleteOneID

func (c *ChunkClient) DeleteOneID(id string) *ChunkDeleteOne

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

func (*ChunkClient) Get

func (c *ChunkClient) Get(ctx context.Context, id string) (*Chunk, error)

Get returns a Chunk entity by its id.

func (*ChunkClient) GetX

func (c *ChunkClient) GetX(ctx context.Context, id string) *Chunk

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

func (*ChunkClient) Hooks

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

Hooks returns the client hooks.

func (*ChunkClient) Intercept added in v0.2.0

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

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

func (*ChunkClient) Interceptors added in v0.2.0

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

Interceptors returns the client interceptors.

func (*ChunkClient) Query

func (c *ChunkClient) Query() *ChunkQuery

Query returns a query builder for Chunk.

func (*ChunkClient) QueryWorker

func (c *ChunkClient) QueryWorker(ch *Chunk) *WorkerQuery

QueryWorker queries the worker edge of a Chunk.

func (*ChunkClient) Update

func (c *ChunkClient) Update() *ChunkUpdate

Update returns an update builder for Chunk.

func (*ChunkClient) UpdateOne

func (c *ChunkClient) UpdateOne(ch *Chunk) *ChunkUpdateOne

UpdateOne returns an update builder for the given entity.

func (*ChunkClient) UpdateOneID

func (c *ChunkClient) UpdateOneID(id string) *ChunkUpdateOne

UpdateOneID returns an update builder for the given id.

func (*ChunkClient) Use

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

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

type ChunkCreate

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

ChunkCreate is the builder for creating a Chunk entity.

func (*ChunkCreate) Exec

func (cc *ChunkCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*ChunkCreate) ExecX

func (cc *ChunkCreate) ExecX(ctx context.Context)

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

func (*ChunkCreate) Mutation

func (cc *ChunkCreate) Mutation() *ChunkMutation

Mutation returns the ChunkMutation object of the builder.

func (*ChunkCreate) OnConflict added in v0.2.0

func (cc *ChunkCreate) OnConflict(opts ...sql.ConflictOption) *ChunkUpsertOne

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

client.Chunk.Create().
	SetCreatedAt(v).
	OnConflict(
		// Update the row with the new values
		// the was proposed for insertion.
		sql.ResolveWithNewValues(),
	).
	// Override some of the fields with custom
	// update values.
	Update(func(u *ent.ChunkUpsert) {
		SetCreatedAt(v+v).
	}).
	Exec(ctx)

func (*ChunkCreate) OnConflictColumns added in v0.2.0

func (cc *ChunkCreate) OnConflictColumns(columns ...string) *ChunkUpsertOne

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

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

func (*ChunkCreate) Save

func (cc *ChunkCreate) Save(ctx context.Context) (*Chunk, error)

Save creates the Chunk in the database.

func (*ChunkCreate) SaveX

func (cc *ChunkCreate) SaveX(ctx context.Context) *Chunk

SaveX calls Save and panics if Save returns an error.

func (*ChunkCreate) SetCreatedAt

func (cc *ChunkCreate) SetCreatedAt(t time.Time) *ChunkCreate

SetCreatedAt sets the "created_at" field.

func (*ChunkCreate) SetID

func (cc *ChunkCreate) SetID(s string) *ChunkCreate

SetID sets the "id" field.

func (*ChunkCreate) SetLeaseExpiresAt

func (cc *ChunkCreate) SetLeaseExpiresAt(t time.Time) *ChunkCreate

SetLeaseExpiresAt sets the "lease_expires_at" field.

func (*ChunkCreate) SetNillableCreatedAt

func (cc *ChunkCreate) SetNillableCreatedAt(t *time.Time) *ChunkCreate

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

func (*ChunkCreate) SetNillableLeaseExpiresAt

func (cc *ChunkCreate) SetNillableLeaseExpiresAt(t *time.Time) *ChunkCreate

SetNillableLeaseExpiresAt sets the "lease_expires_at" field if the given value is not nil.

func (*ChunkCreate) SetNillableSha256Content

func (cc *ChunkCreate) SetNillableSha256Content(s *string) *ChunkCreate

SetNillableSha256Content sets the "sha256_content" field if the given value is not nil.

func (*ChunkCreate) SetNillableSha256Input

func (cc *ChunkCreate) SetNillableSha256Input(s *string) *ChunkCreate

SetNillableSha256Input sets the "sha256_input" field if the given value is not nil.

func (*ChunkCreate) SetNillableSha256Output

func (cc *ChunkCreate) SetNillableSha256Output(s *string) *ChunkCreate

SetNillableSha256Output sets the "sha256_output" field if the given value is not nil.

func (*ChunkCreate) SetNillableSizeContent

func (cc *ChunkCreate) SetNillableSizeContent(i *int64) *ChunkCreate

SetNillableSizeContent sets the "size_content" field if the given value is not nil.

func (*ChunkCreate) SetNillableSizeInput

func (cc *ChunkCreate) SetNillableSizeInput(i *int64) *ChunkCreate

SetNillableSizeInput sets the "size_input" field if the given value is not nil.

func (*ChunkCreate) SetNillableSizeOutput

func (cc *ChunkCreate) SetNillableSizeOutput(i *int64) *ChunkCreate

SetNillableSizeOutput sets the "size_output" field if the given value is not nil.

func (*ChunkCreate) SetNillableState

func (cc *ChunkCreate) SetNillableState(c *chunk.State) *ChunkCreate

SetNillableState sets the "state" field if the given value is not nil.

func (*ChunkCreate) SetNillableUpdatedAt

func (cc *ChunkCreate) SetNillableUpdatedAt(t *time.Time) *ChunkCreate

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

func (*ChunkCreate) SetNillableWorkerID

func (cc *ChunkCreate) SetNillableWorkerID(id *uuid.UUID) *ChunkCreate

SetNillableWorkerID sets the "worker" edge to the Worker entity by ID if the given value is not nil.

func (*ChunkCreate) SetSha256Content

func (cc *ChunkCreate) SetSha256Content(s string) *ChunkCreate

SetSha256Content sets the "sha256_content" field.

func (*ChunkCreate) SetSha256Input

func (cc *ChunkCreate) SetSha256Input(s string) *ChunkCreate

SetSha256Input sets the "sha256_input" field.

func (*ChunkCreate) SetSha256Output

func (cc *ChunkCreate) SetSha256Output(s string) *ChunkCreate

SetSha256Output sets the "sha256_output" field.

func (*ChunkCreate) SetSizeContent

func (cc *ChunkCreate) SetSizeContent(i int64) *ChunkCreate

SetSizeContent sets the "size_content" field.

func (*ChunkCreate) SetSizeInput

func (cc *ChunkCreate) SetSizeInput(i int64) *ChunkCreate

SetSizeInput sets the "size_input" field.

func (*ChunkCreate) SetSizeOutput

func (cc *ChunkCreate) SetSizeOutput(i int64) *ChunkCreate

SetSizeOutput sets the "size_output" field.

func (*ChunkCreate) SetStart

func (cc *ChunkCreate) SetStart(t time.Time) *ChunkCreate

SetStart sets the "start" field.

func (*ChunkCreate) SetState

func (cc *ChunkCreate) SetState(c chunk.State) *ChunkCreate

SetState sets the "state" field.

func (*ChunkCreate) SetUpdatedAt

func (cc *ChunkCreate) SetUpdatedAt(t time.Time) *ChunkCreate

SetUpdatedAt sets the "updated_at" field.

func (*ChunkCreate) SetWorker

func (cc *ChunkCreate) SetWorker(w *Worker) *ChunkCreate

SetWorker sets the "worker" edge to the Worker entity.

func (*ChunkCreate) SetWorkerID

func (cc *ChunkCreate) SetWorkerID(id uuid.UUID) *ChunkCreate

SetWorkerID sets the "worker" edge to the Worker entity by ID.

type ChunkCreateBulk

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

ChunkCreateBulk is the builder for creating many Chunk entities in bulk.

func (*ChunkCreateBulk) Exec

func (ccb *ChunkCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*ChunkCreateBulk) ExecX

func (ccb *ChunkCreateBulk) ExecX(ctx context.Context)

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

func (*ChunkCreateBulk) OnConflict added in v0.2.0

func (ccb *ChunkCreateBulk) OnConflict(opts ...sql.ConflictOption) *ChunkUpsertBulk

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

client.Chunk.CreateBulk(builders...).
	OnConflict(
		// Update the row with the new values
		// the was proposed for insertion.
		sql.ResolveWithNewValues(),
	).
	// Override some of the fields with custom
	// update values.
	Update(func(u *ent.ChunkUpsert) {
		SetCreatedAt(v+v).
	}).
	Exec(ctx)

func (*ChunkCreateBulk) OnConflictColumns added in v0.2.0

func (ccb *ChunkCreateBulk) OnConflictColumns(columns ...string) *ChunkUpsertBulk

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

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

func (*ChunkCreateBulk) Save

func (ccb *ChunkCreateBulk) Save(ctx context.Context) ([]*Chunk, error)

Save creates the Chunk entities in the database.

func (*ChunkCreateBulk) SaveX

func (ccb *ChunkCreateBulk) SaveX(ctx context.Context) []*Chunk

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

type ChunkDelete

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

ChunkDelete is the builder for deleting a Chunk entity.

func (*ChunkDelete) Exec

func (cd *ChunkDelete) Exec(ctx context.Context) (int, error)

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

func (*ChunkDelete) ExecX

func (cd *ChunkDelete) ExecX(ctx context.Context) int

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

func (*ChunkDelete) Where

func (cd *ChunkDelete) Where(ps ...predicate.Chunk) *ChunkDelete

Where appends a list predicates to the ChunkDelete builder.

type ChunkDeleteOne

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

ChunkDeleteOne is the builder for deleting a single Chunk entity.

func (*ChunkDeleteOne) Exec

func (cdo *ChunkDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*ChunkDeleteOne) ExecX

func (cdo *ChunkDeleteOne) ExecX(ctx context.Context)

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

func (*ChunkDeleteOne) Where added in v0.2.0

func (cdo *ChunkDeleteOne) Where(ps ...predicate.Chunk) *ChunkDeleteOne

Where appends a list predicates to the ChunkDelete builder.

type ChunkEdges

type ChunkEdges struct {
	// Worker holds the value of the worker edge.
	Worker *Worker `json:"worker,omitempty"`
	// contains filtered or unexported fields
}

ChunkEdges holds the relations/edges for other nodes in the graph.

func (ChunkEdges) WorkerOrErr

func (e ChunkEdges) WorkerOrErr() (*Worker, error)

WorkerOrErr returns the Worker value or an error if the edge was not loaded in eager-loading, or loaded but was not found.

type ChunkGroupBy

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

ChunkGroupBy is the group-by builder for Chunk entities.

func (*ChunkGroupBy) Aggregate

func (cgb *ChunkGroupBy) Aggregate(fns ...AggregateFunc) *ChunkGroupBy

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

func (*ChunkGroupBy) Bool

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

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

func (*ChunkGroupBy) BoolX

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

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

func (*ChunkGroupBy) Bools

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

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

func (*ChunkGroupBy) BoolsX

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

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

func (*ChunkGroupBy) Float64

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

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

func (*ChunkGroupBy) Float64X

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

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

func (*ChunkGroupBy) Float64s

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

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

func (*ChunkGroupBy) Float64sX

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

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

func (*ChunkGroupBy) Int

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

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

func (*ChunkGroupBy) IntX

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

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

func (*ChunkGroupBy) Ints

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

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

func (*ChunkGroupBy) IntsX

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

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

func (*ChunkGroupBy) Scan

func (cgb *ChunkGroupBy) Scan(ctx context.Context, v any) error

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

func (*ChunkGroupBy) ScanX

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

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

func (*ChunkGroupBy) String

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

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

func (*ChunkGroupBy) StringX

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

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

func (*ChunkGroupBy) Strings

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

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

func (*ChunkGroupBy) StringsX

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

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

type ChunkMutation

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

ChunkMutation represents an operation that mutates the Chunk nodes in the graph.

func (*ChunkMutation) AddField

func (m *ChunkMutation) 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 (*ChunkMutation) AddSizeContent

func (m *ChunkMutation) AddSizeContent(i int64)

AddSizeContent adds i to the "size_content" field.

func (*ChunkMutation) AddSizeInput

func (m *ChunkMutation) AddSizeInput(i int64)

AddSizeInput adds i to the "size_input" field.

func (*ChunkMutation) AddSizeOutput

func (m *ChunkMutation) AddSizeOutput(i int64)

AddSizeOutput adds i to the "size_output" field.

func (*ChunkMutation) AddedEdges

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

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

func (*ChunkMutation) AddedField

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

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

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

func (*ChunkMutation) AddedIDs

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

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

func (*ChunkMutation) AddedSizeContent

func (m *ChunkMutation) AddedSizeContent() (r int64, exists bool)

AddedSizeContent returns the value that was added to the "size_content" field in this mutation.

func (*ChunkMutation) AddedSizeInput

func (m *ChunkMutation) AddedSizeInput() (r int64, exists bool)

AddedSizeInput returns the value that was added to the "size_input" field in this mutation.

func (*ChunkMutation) AddedSizeOutput

func (m *ChunkMutation) AddedSizeOutput() (r int64, exists bool)

AddedSizeOutput returns the value that was added to the "size_output" field in this mutation.

func (*ChunkMutation) ClearEdge

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

func (m *ChunkMutation) 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 (*ChunkMutation) ClearLeaseExpiresAt

func (m *ChunkMutation) ClearLeaseExpiresAt()

ClearLeaseExpiresAt clears the value of the "lease_expires_at" field.

func (*ChunkMutation) ClearSha256Content

func (m *ChunkMutation) ClearSha256Content()

ClearSha256Content clears the value of the "sha256_content" field.

func (*ChunkMutation) ClearSha256Input

func (m *ChunkMutation) ClearSha256Input()

ClearSha256Input clears the value of the "sha256_input" field.

func (*ChunkMutation) ClearSha256Output

func (m *ChunkMutation) ClearSha256Output()

ClearSha256Output clears the value of the "sha256_output" field.

func (*ChunkMutation) ClearSizeContent

func (m *ChunkMutation) ClearSizeContent()

ClearSizeContent clears the value of the "size_content" field.

func (*ChunkMutation) ClearSizeInput

func (m *ChunkMutation) ClearSizeInput()

ClearSizeInput clears the value of the "size_input" field.

func (*ChunkMutation) ClearSizeOutput

func (m *ChunkMutation) ClearSizeOutput()

ClearSizeOutput clears the value of the "size_output" field.

func (*ChunkMutation) ClearWorker

func (m *ChunkMutation) ClearWorker()

ClearWorker clears the "worker" edge to the Worker entity.

func (*ChunkMutation) ClearedEdges

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

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

func (*ChunkMutation) ClearedFields

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

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

func (ChunkMutation) Client

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

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

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

func (*ChunkMutation) EdgeCleared

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

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

func (*ChunkMutation) Field

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

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

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

func (*ChunkMutation) Fields

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

func (m *ChunkMutation) ID() (id string, exists bool)

ID returns the ID value in the mutation. Note that the ID is only available if it was provided to the builder or after it was returned from the database.

func (*ChunkMutation) IDs added in v0.2.0

func (m *ChunkMutation) IDs(ctx context.Context) ([]string, error)

IDs queries the database and returns the entity ids that match the mutation's predicate. That means, if the mutation is applied within a transaction with an isolation level such as sql.LevelSerializable, the returned ids match the ids of the rows that will be updated or updated by the mutation.

func (*ChunkMutation) LeaseExpiresAt

func (m *ChunkMutation) LeaseExpiresAt() (r time.Time, exists bool)

LeaseExpiresAt returns the value of the "lease_expires_at" field in the mutation.

func (*ChunkMutation) LeaseExpiresAtCleared

func (m *ChunkMutation) LeaseExpiresAtCleared() bool

LeaseExpiresAtCleared returns if the "lease_expires_at" field was cleared in this mutation.

func (*ChunkMutation) OldCreatedAt

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

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

func (m *ChunkMutation) 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 (*ChunkMutation) OldLeaseExpiresAt

func (m *ChunkMutation) OldLeaseExpiresAt(ctx context.Context) (v time.Time, err error)

OldLeaseExpiresAt returns the old "lease_expires_at" field's value of the Chunk entity. If the Chunk 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 (*ChunkMutation) OldSha256Content

func (m *ChunkMutation) OldSha256Content(ctx context.Context) (v *string, err error)

OldSha256Content returns the old "sha256_content" field's value of the Chunk entity. If the Chunk 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 (*ChunkMutation) OldSha256Input

func (m *ChunkMutation) OldSha256Input(ctx context.Context) (v *string, err error)

OldSha256Input returns the old "sha256_input" field's value of the Chunk entity. If the Chunk 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 (*ChunkMutation) OldSha256Output

func (m *ChunkMutation) OldSha256Output(ctx context.Context) (v *string, err error)

OldSha256Output returns the old "sha256_output" field's value of the Chunk entity. If the Chunk 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 (*ChunkMutation) OldSizeContent

func (m *ChunkMutation) OldSizeContent(ctx context.Context) (v int64, err error)

OldSizeContent returns the old "size_content" field's value of the Chunk entity. If the Chunk 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 (*ChunkMutation) OldSizeInput

func (m *ChunkMutation) OldSizeInput(ctx context.Context) (v int64, err error)

OldSizeInput returns the old "size_input" field's value of the Chunk entity. If the Chunk 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 (*ChunkMutation) OldSizeOutput

func (m *ChunkMutation) OldSizeOutput(ctx context.Context) (v int64, err error)

OldSizeOutput returns the old "size_output" field's value of the Chunk entity. If the Chunk 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 (*ChunkMutation) OldStart

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

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

func (m *ChunkMutation) OldState(ctx context.Context) (v chunk.State, err error)

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

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

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

func (m *ChunkMutation) Op() Op

Op returns the operation name.

func (*ChunkMutation) RemovedEdges

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

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

func (*ChunkMutation) RemovedIDs

func (m *ChunkMutation) 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 (*ChunkMutation) ResetCreatedAt

func (m *ChunkMutation) ResetCreatedAt()

ResetCreatedAt resets all changes to the "created_at" field.

func (*ChunkMutation) ResetEdge

func (m *ChunkMutation) 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 (*ChunkMutation) ResetField

func (m *ChunkMutation) 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 (*ChunkMutation) ResetLeaseExpiresAt

func (m *ChunkMutation) ResetLeaseExpiresAt()

ResetLeaseExpiresAt resets all changes to the "lease_expires_at" field.

func (*ChunkMutation) ResetSha256Content

func (m *ChunkMutation) ResetSha256Content()

ResetSha256Content resets all changes to the "sha256_content" field.

func (*ChunkMutation) ResetSha256Input

func (m *ChunkMutation) ResetSha256Input()

ResetSha256Input resets all changes to the "sha256_input" field.

func (*ChunkMutation) ResetSha256Output

func (m *ChunkMutation) ResetSha256Output()

ResetSha256Output resets all changes to the "sha256_output" field.

func (*ChunkMutation) ResetSizeContent

func (m *ChunkMutation) ResetSizeContent()

ResetSizeContent resets all changes to the "size_content" field.

func (*ChunkMutation) ResetSizeInput

func (m *ChunkMutation) ResetSizeInput()

ResetSizeInput resets all changes to the "size_input" field.

func (*ChunkMutation) ResetSizeOutput

func (m *ChunkMutation) ResetSizeOutput()

ResetSizeOutput resets all changes to the "size_output" field.

func (*ChunkMutation) ResetStart

func (m *ChunkMutation) ResetStart()

ResetStart resets all changes to the "start" field.

func (*ChunkMutation) ResetState

func (m *ChunkMutation) ResetState()

ResetState resets all changes to the "state" field.

func (*ChunkMutation) ResetUpdatedAt

func (m *ChunkMutation) ResetUpdatedAt()

ResetUpdatedAt resets all changes to the "updated_at" field.

func (*ChunkMutation) ResetWorker

func (m *ChunkMutation) ResetWorker()

ResetWorker resets all changes to the "worker" edge.

func (*ChunkMutation) SetCreatedAt

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

SetCreatedAt sets the "created_at" field.

func (*ChunkMutation) SetField

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

func (m *ChunkMutation) SetID(id string)

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

func (*ChunkMutation) SetLeaseExpiresAt

func (m *ChunkMutation) SetLeaseExpiresAt(t time.Time)

SetLeaseExpiresAt sets the "lease_expires_at" field.

func (*ChunkMutation) SetOp added in v0.2.0

func (m *ChunkMutation) SetOp(op Op)

SetOp allows setting the mutation operation.

func (*ChunkMutation) SetSha256Content

func (m *ChunkMutation) SetSha256Content(s string)

SetSha256Content sets the "sha256_content" field.

func (*ChunkMutation) SetSha256Input

func (m *ChunkMutation) SetSha256Input(s string)

SetSha256Input sets the "sha256_input" field.

func (*ChunkMutation) SetSha256Output

func (m *ChunkMutation) SetSha256Output(s string)

SetSha256Output sets the "sha256_output" field.

func (*ChunkMutation) SetSizeContent

func (m *ChunkMutation) SetSizeContent(i int64)

SetSizeContent sets the "size_content" field.

func (*ChunkMutation) SetSizeInput

func (m *ChunkMutation) SetSizeInput(i int64)

SetSizeInput sets the "size_input" field.

func (*ChunkMutation) SetSizeOutput

func (m *ChunkMutation) SetSizeOutput(i int64)

SetSizeOutput sets the "size_output" field.

func (*ChunkMutation) SetStart

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

SetStart sets the "start" field.

func (*ChunkMutation) SetState

func (m *ChunkMutation) SetState(c chunk.State)

SetState sets the "state" field.

func (*ChunkMutation) SetUpdatedAt

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

SetUpdatedAt sets the "updated_at" field.

func (*ChunkMutation) SetWorkerID

func (m *ChunkMutation) SetWorkerID(id uuid.UUID)

SetWorkerID sets the "worker" edge to the Worker entity by id.

func (*ChunkMutation) Sha256Content

func (m *ChunkMutation) Sha256Content() (r string, exists bool)

Sha256Content returns the value of the "sha256_content" field in the mutation.

func (*ChunkMutation) Sha256ContentCleared

func (m *ChunkMutation) Sha256ContentCleared() bool

Sha256ContentCleared returns if the "sha256_content" field was cleared in this mutation.

func (*ChunkMutation) Sha256Input

func (m *ChunkMutation) Sha256Input() (r string, exists bool)

Sha256Input returns the value of the "sha256_input" field in the mutation.

func (*ChunkMutation) Sha256InputCleared

func (m *ChunkMutation) Sha256InputCleared() bool

Sha256InputCleared returns if the "sha256_input" field was cleared in this mutation.

func (*ChunkMutation) Sha256Output

func (m *ChunkMutation) Sha256Output() (r string, exists bool)

Sha256Output returns the value of the "sha256_output" field in the mutation.

func (*ChunkMutation) Sha256OutputCleared

func (m *ChunkMutation) Sha256OutputCleared() bool

Sha256OutputCleared returns if the "sha256_output" field was cleared in this mutation.

func (*ChunkMutation) SizeContent

func (m *ChunkMutation) SizeContent() (r int64, exists bool)

SizeContent returns the value of the "size_content" field in the mutation.

func (*ChunkMutation) SizeContentCleared

func (m *ChunkMutation) SizeContentCleared() bool

SizeContentCleared returns if the "size_content" field was cleared in this mutation.

func (*ChunkMutation) SizeInput

func (m *ChunkMutation) SizeInput() (r int64, exists bool)

SizeInput returns the value of the "size_input" field in the mutation.

func (*ChunkMutation) SizeInputCleared

func (m *ChunkMutation) SizeInputCleared() bool

SizeInputCleared returns if the "size_input" field was cleared in this mutation.

func (*ChunkMutation) SizeOutput

func (m *ChunkMutation) SizeOutput() (r int64, exists bool)

SizeOutput returns the value of the "size_output" field in the mutation.

func (*ChunkMutation) SizeOutputCleared

func (m *ChunkMutation) SizeOutputCleared() bool

SizeOutputCleared returns if the "size_output" field was cleared in this mutation.

func (*ChunkMutation) Start

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

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

func (*ChunkMutation) State

func (m *ChunkMutation) State() (r chunk.State, exists bool)

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

func (ChunkMutation) Tx

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

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

func (*ChunkMutation) Type

func (m *ChunkMutation) Type() string

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

func (*ChunkMutation) UpdatedAt

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

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

func (*ChunkMutation) Where

func (m *ChunkMutation) Where(ps ...predicate.Chunk)

Where appends a list predicates to the ChunkMutation builder.

func (*ChunkMutation) WhereP added in v0.2.0

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

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

func (*ChunkMutation) WorkerCleared

func (m *ChunkMutation) WorkerCleared() bool

WorkerCleared reports if the "worker" edge to the Worker entity was cleared.

func (*ChunkMutation) WorkerID

func (m *ChunkMutation) WorkerID() (id uuid.UUID, exists bool)

WorkerID returns the "worker" edge ID in the mutation.

func (*ChunkMutation) WorkerIDs

func (m *ChunkMutation) WorkerIDs() (ids []uuid.UUID)

WorkerIDs returns the "worker" edge IDs in the mutation. Note that IDs always returns len(IDs) <= 1 for unique edges, and you should use WorkerID instead. It exists only for internal usage by the builders.

type ChunkQuery

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

ChunkQuery is the builder for querying Chunk entities.

func (*ChunkQuery) Aggregate added in v0.2.0

func (cq *ChunkQuery) Aggregate(fns ...AggregateFunc) *ChunkSelect

Aggregate returns a ChunkSelect configured with the given aggregations.

func (*ChunkQuery) All

func (cq *ChunkQuery) All(ctx context.Context) ([]*Chunk, error)

All executes the query and returns a list of Chunks.

func (*ChunkQuery) AllX

func (cq *ChunkQuery) AllX(ctx context.Context) []*Chunk

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

func (*ChunkQuery) Clone

func (cq *ChunkQuery) Clone() *ChunkQuery

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

func (*ChunkQuery) Count

func (cq *ChunkQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*ChunkQuery) CountX

func (cq *ChunkQuery) CountX(ctx context.Context) int

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

func (*ChunkQuery) Exist

func (cq *ChunkQuery) Exist(ctx context.Context) (bool, error)

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

func (*ChunkQuery) ExistX

func (cq *ChunkQuery) ExistX(ctx context.Context) bool

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

func (*ChunkQuery) First

func (cq *ChunkQuery) First(ctx context.Context) (*Chunk, error)

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

func (*ChunkQuery) FirstID

func (cq *ChunkQuery) FirstID(ctx context.Context) (id string, err error)

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

func (*ChunkQuery) FirstIDX

func (cq *ChunkQuery) FirstIDX(ctx context.Context) string

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

func (*ChunkQuery) FirstX

func (cq *ChunkQuery) FirstX(ctx context.Context) *Chunk

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

func (*ChunkQuery) ForShare

func (cq *ChunkQuery) ForShare(opts ...sql.LockOption) *ChunkQuery

ForShare behaves similarly to ForUpdate, except that it acquires a shared mode lock on any rows that are read. Other sessions can read the rows, but cannot modify them until your transaction commits.

func (*ChunkQuery) ForUpdate

func (cq *ChunkQuery) ForUpdate(opts ...sql.LockOption) *ChunkQuery

ForUpdate locks the selected rows against concurrent updates, and prevent them from being updated, deleted or "selected ... for update" by other sessions, until the transaction is either committed or rolled-back.

func (*ChunkQuery) GroupBy

func (cq *ChunkQuery) GroupBy(field string, fields ...string) *ChunkGroupBy

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.Chunk.Query().
	GroupBy(chunk.FieldCreatedAt).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*ChunkQuery) IDs

func (cq *ChunkQuery) IDs(ctx context.Context) (ids []string, err error)

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

func (*ChunkQuery) IDsX

func (cq *ChunkQuery) IDsX(ctx context.Context) []string

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

func (*ChunkQuery) Limit

func (cq *ChunkQuery) Limit(limit int) *ChunkQuery

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

func (*ChunkQuery) Offset

func (cq *ChunkQuery) Offset(offset int) *ChunkQuery

Offset to start from.

func (*ChunkQuery) Only

func (cq *ChunkQuery) Only(ctx context.Context) (*Chunk, error)

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

func (*ChunkQuery) OnlyID

func (cq *ChunkQuery) OnlyID(ctx context.Context) (id string, err error)

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

func (*ChunkQuery) OnlyIDX

func (cq *ChunkQuery) OnlyIDX(ctx context.Context) string

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

func (*ChunkQuery) OnlyX

func (cq *ChunkQuery) OnlyX(ctx context.Context) *Chunk

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

func (*ChunkQuery) Order

func (cq *ChunkQuery) Order(o ...chunk.OrderOption) *ChunkQuery

Order specifies how the records should be ordered.

func (*ChunkQuery) QueryWorker

func (cq *ChunkQuery) QueryWorker() *WorkerQuery

QueryWorker chains the current query on the "worker" edge.

func (*ChunkQuery) Select

func (cq *ChunkQuery) Select(fields ...string) *ChunkSelect

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.Chunk.Query().
	Select(chunk.FieldCreatedAt).
	Scan(ctx, &v)

func (*ChunkQuery) Unique

func (cq *ChunkQuery) Unique(unique bool) *ChunkQuery

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

func (cq *ChunkQuery) Where(ps ...predicate.Chunk) *ChunkQuery

Where adds a new predicate for the ChunkQuery builder.

func (*ChunkQuery) WithWorker

func (cq *ChunkQuery) WithWorker(opts ...func(*WorkerQuery)) *ChunkQuery

WithWorker tells the query-builder to eager-load the nodes that are connected to the "worker" edge. The optional arguments are used to configure the query builder of the edge.

type ChunkSelect

type ChunkSelect struct {
	*ChunkQuery
	// contains filtered or unexported fields
}

ChunkSelect is the builder for selecting fields of Chunk entities.

func (*ChunkSelect) Aggregate added in v0.2.0

func (cs *ChunkSelect) Aggregate(fns ...AggregateFunc) *ChunkSelect

Aggregate adds the given aggregation functions to the selector query.

func (*ChunkSelect) Bool

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

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

func (*ChunkSelect) BoolX

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

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

func (*ChunkSelect) Bools

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

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

func (*ChunkSelect) BoolsX

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

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

func (*ChunkSelect) Float64

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

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

func (*ChunkSelect) Float64X

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

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

func (*ChunkSelect) Float64s

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

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

func (*ChunkSelect) Float64sX

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

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

func (*ChunkSelect) Int

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

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

func (*ChunkSelect) IntX

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

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

func (*ChunkSelect) Ints

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

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

func (*ChunkSelect) IntsX

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

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

func (*ChunkSelect) Scan

func (cs *ChunkSelect) Scan(ctx context.Context, v any) error

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

func (*ChunkSelect) ScanX

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

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

func (*ChunkSelect) String

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

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

func (*ChunkSelect) StringX

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

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

func (*ChunkSelect) Strings

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

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

func (*ChunkSelect) StringsX

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

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

type ChunkUpdate

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

ChunkUpdate is the builder for updating Chunk entities.

func (*ChunkUpdate) AddSizeContent

func (cu *ChunkUpdate) AddSizeContent(i int64) *ChunkUpdate

AddSizeContent adds i to the "size_content" field.

func (*ChunkUpdate) AddSizeInput

func (cu *ChunkUpdate) AddSizeInput(i int64) *ChunkUpdate

AddSizeInput adds i to the "size_input" field.

func (*ChunkUpdate) AddSizeOutput

func (cu *ChunkUpdate) AddSizeOutput(i int64) *ChunkUpdate

AddSizeOutput adds i to the "size_output" field.

func (*ChunkUpdate) ClearLeaseExpiresAt

func (cu *ChunkUpdate) ClearLeaseExpiresAt() *ChunkUpdate

ClearLeaseExpiresAt clears the value of the "lease_expires_at" field.

func (*ChunkUpdate) ClearSha256Content

func (cu *ChunkUpdate) ClearSha256Content() *ChunkUpdate

ClearSha256Content clears the value of the "sha256_content" field.

func (*ChunkUpdate) ClearSha256Input

func (cu *ChunkUpdate) ClearSha256Input() *ChunkUpdate

ClearSha256Input clears the value of the "sha256_input" field.

func (*ChunkUpdate) ClearSha256Output

func (cu *ChunkUpdate) ClearSha256Output() *ChunkUpdate

ClearSha256Output clears the value of the "sha256_output" field.

func (*ChunkUpdate) ClearSizeContent

func (cu *ChunkUpdate) ClearSizeContent() *ChunkUpdate

ClearSizeContent clears the value of the "size_content" field.

func (*ChunkUpdate) ClearSizeInput

func (cu *ChunkUpdate) ClearSizeInput() *ChunkUpdate

ClearSizeInput clears the value of the "size_input" field.

func (*ChunkUpdate) ClearSizeOutput

func (cu *ChunkUpdate) ClearSizeOutput() *ChunkUpdate

ClearSizeOutput clears the value of the "size_output" field.

func (*ChunkUpdate) ClearWorker

func (cu *ChunkUpdate) ClearWorker() *ChunkUpdate

ClearWorker clears the "worker" edge to the Worker entity.

func (*ChunkUpdate) Exec

func (cu *ChunkUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*ChunkUpdate) ExecX

func (cu *ChunkUpdate) ExecX(ctx context.Context)

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

func (*ChunkUpdate) Mutation

func (cu *ChunkUpdate) Mutation() *ChunkMutation

Mutation returns the ChunkMutation object of the builder.

func (*ChunkUpdate) Save

func (cu *ChunkUpdate) Save(ctx context.Context) (int, error)

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

func (*ChunkUpdate) SaveX

func (cu *ChunkUpdate) SaveX(ctx context.Context) int

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

func (*ChunkUpdate) SetLeaseExpiresAt

func (cu *ChunkUpdate) SetLeaseExpiresAt(t time.Time) *ChunkUpdate

SetLeaseExpiresAt sets the "lease_expires_at" field.

func (*ChunkUpdate) SetNillableLeaseExpiresAt

func (cu *ChunkUpdate) SetNillableLeaseExpiresAt(t *time.Time) *ChunkUpdate

SetNillableLeaseExpiresAt sets the "lease_expires_at" field if the given value is not nil.

func (*ChunkUpdate) SetNillableSha256Content

func (cu *ChunkUpdate) SetNillableSha256Content(s *string) *ChunkUpdate

SetNillableSha256Content sets the "sha256_content" field if the given value is not nil.

func (*ChunkUpdate) SetNillableSha256Input

func (cu *ChunkUpdate) SetNillableSha256Input(s *string) *ChunkUpdate

SetNillableSha256Input sets the "sha256_input" field if the given value is not nil.

func (*ChunkUpdate) SetNillableSha256Output

func (cu *ChunkUpdate) SetNillableSha256Output(s *string) *ChunkUpdate

SetNillableSha256Output sets the "sha256_output" field if the given value is not nil.

func (*ChunkUpdate) SetNillableSizeContent

func (cu *ChunkUpdate) SetNillableSizeContent(i *int64) *ChunkUpdate

SetNillableSizeContent sets the "size_content" field if the given value is not nil.

func (*ChunkUpdate) SetNillableSizeInput

func (cu *ChunkUpdate) SetNillableSizeInput(i *int64) *ChunkUpdate

SetNillableSizeInput sets the "size_input" field if the given value is not nil.

func (*ChunkUpdate) SetNillableSizeOutput

func (cu *ChunkUpdate) SetNillableSizeOutput(i *int64) *ChunkUpdate

SetNillableSizeOutput sets the "size_output" field if the given value is not nil.

func (*ChunkUpdate) SetNillableState

func (cu *ChunkUpdate) SetNillableState(c *chunk.State) *ChunkUpdate

SetNillableState sets the "state" field if the given value is not nil.

func (*ChunkUpdate) SetNillableWorkerID

func (cu *ChunkUpdate) SetNillableWorkerID(id *uuid.UUID) *ChunkUpdate

SetNillableWorkerID sets the "worker" edge to the Worker entity by ID if the given value is not nil.

func (*ChunkUpdate) SetSha256Content

func (cu *ChunkUpdate) SetSha256Content(s string) *ChunkUpdate

SetSha256Content sets the "sha256_content" field.

func (*ChunkUpdate) SetSha256Input

func (cu *ChunkUpdate) SetSha256Input(s string) *ChunkUpdate

SetSha256Input sets the "sha256_input" field.

func (*ChunkUpdate) SetSha256Output

func (cu *ChunkUpdate) SetSha256Output(s string) *ChunkUpdate

SetSha256Output sets the "sha256_output" field.

func (*ChunkUpdate) SetSizeContent

func (cu *ChunkUpdate) SetSizeContent(i int64) *ChunkUpdate

SetSizeContent sets the "size_content" field.

func (*ChunkUpdate) SetSizeInput

func (cu *ChunkUpdate) SetSizeInput(i int64) *ChunkUpdate

SetSizeInput sets the "size_input" field.

func (*ChunkUpdate) SetSizeOutput

func (cu *ChunkUpdate) SetSizeOutput(i int64) *ChunkUpdate

SetSizeOutput sets the "size_output" field.

func (*ChunkUpdate) SetStart

func (cu *ChunkUpdate) SetStart(t time.Time) *ChunkUpdate

SetStart sets the "start" field.

func (*ChunkUpdate) SetState

func (cu *ChunkUpdate) SetState(c chunk.State) *ChunkUpdate

SetState sets the "state" field.

func (*ChunkUpdate) SetUpdatedAt

func (cu *ChunkUpdate) SetUpdatedAt(t time.Time) *ChunkUpdate

SetUpdatedAt sets the "updated_at" field.

func (*ChunkUpdate) SetWorker

func (cu *ChunkUpdate) SetWorker(w *Worker) *ChunkUpdate

SetWorker sets the "worker" edge to the Worker entity.

func (*ChunkUpdate) SetWorkerID

func (cu *ChunkUpdate) SetWorkerID(id uuid.UUID) *ChunkUpdate

SetWorkerID sets the "worker" edge to the Worker entity by ID.

func (*ChunkUpdate) Where

func (cu *ChunkUpdate) Where(ps ...predicate.Chunk) *ChunkUpdate

Where appends a list predicates to the ChunkUpdate builder.

type ChunkUpdateOne

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

ChunkUpdateOne is the builder for updating a single Chunk entity.

func (*ChunkUpdateOne) AddSizeContent

func (cuo *ChunkUpdateOne) AddSizeContent(i int64) *ChunkUpdateOne

AddSizeContent adds i to the "size_content" field.

func (*ChunkUpdateOne) AddSizeInput

func (cuo *ChunkUpdateOne) AddSizeInput(i int64) *ChunkUpdateOne

AddSizeInput adds i to the "size_input" field.

func (*ChunkUpdateOne) AddSizeOutput

func (cuo *ChunkUpdateOne) AddSizeOutput(i int64) *ChunkUpdateOne

AddSizeOutput adds i to the "size_output" field.

func (*ChunkUpdateOne) ClearLeaseExpiresAt

func (cuo *ChunkUpdateOne) ClearLeaseExpiresAt() *ChunkUpdateOne

ClearLeaseExpiresAt clears the value of the "lease_expires_at" field.

func (*ChunkUpdateOne) ClearSha256Content

func (cuo *ChunkUpdateOne) ClearSha256Content() *ChunkUpdateOne

ClearSha256Content clears the value of the "sha256_content" field.

func (*ChunkUpdateOne) ClearSha256Input

func (cuo *ChunkUpdateOne) ClearSha256Input() *ChunkUpdateOne

ClearSha256Input clears the value of the "sha256_input" field.

func (*ChunkUpdateOne) ClearSha256Output

func (cuo *ChunkUpdateOne) ClearSha256Output() *ChunkUpdateOne

ClearSha256Output clears the value of the "sha256_output" field.

func (*ChunkUpdateOne) ClearSizeContent

func (cuo *ChunkUpdateOne) ClearSizeContent() *ChunkUpdateOne

ClearSizeContent clears the value of the "size_content" field.

func (*ChunkUpdateOne) ClearSizeInput

func (cuo *ChunkUpdateOne) ClearSizeInput() *ChunkUpdateOne

ClearSizeInput clears the value of the "size_input" field.

func (*ChunkUpdateOne) ClearSizeOutput

func (cuo *ChunkUpdateOne) ClearSizeOutput() *ChunkUpdateOne

ClearSizeOutput clears the value of the "size_output" field.

func (*ChunkUpdateOne) ClearWorker

func (cuo *ChunkUpdateOne) ClearWorker() *ChunkUpdateOne

ClearWorker clears the "worker" edge to the Worker entity.

func (*ChunkUpdateOne) Exec

func (cuo *ChunkUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*ChunkUpdateOne) ExecX

func (cuo *ChunkUpdateOne) ExecX(ctx context.Context)

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

func (*ChunkUpdateOne) Mutation

func (cuo *ChunkUpdateOne) Mutation() *ChunkMutation

Mutation returns the ChunkMutation object of the builder.

func (*ChunkUpdateOne) Save

func (cuo *ChunkUpdateOne) Save(ctx context.Context) (*Chunk, error)

Save executes the query and returns the updated Chunk entity.

func (*ChunkUpdateOne) SaveX

func (cuo *ChunkUpdateOne) SaveX(ctx context.Context) *Chunk

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

func (*ChunkUpdateOne) Select

func (cuo *ChunkUpdateOne) Select(field string, fields ...string) *ChunkUpdateOne

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

func (*ChunkUpdateOne) SetLeaseExpiresAt

func (cuo *ChunkUpdateOne) SetLeaseExpiresAt(t time.Time) *ChunkUpdateOne

SetLeaseExpiresAt sets the "lease_expires_at" field.

func (*ChunkUpdateOne) SetNillableLeaseExpiresAt

func (cuo *ChunkUpdateOne) SetNillableLeaseExpiresAt(t *time.Time) *ChunkUpdateOne

SetNillableLeaseExpiresAt sets the "lease_expires_at" field if the given value is not nil.

func (*ChunkUpdateOne) SetNillableSha256Content

func (cuo *ChunkUpdateOne) SetNillableSha256Content(s *string) *ChunkUpdateOne

SetNillableSha256Content sets the "sha256_content" field if the given value is not nil.

func (*ChunkUpdateOne) SetNillableSha256Input

func (cuo *ChunkUpdateOne) SetNillableSha256Input(s *string) *ChunkUpdateOne

SetNillableSha256Input sets the "sha256_input" field if the given value is not nil.

func (*ChunkUpdateOne) SetNillableSha256Output

func (cuo *ChunkUpdateOne) SetNillableSha256Output(s *string) *ChunkUpdateOne

SetNillableSha256Output sets the "sha256_output" field if the given value is not nil.

func (*ChunkUpdateOne) SetNillableSizeContent

func (cuo *ChunkUpdateOne) SetNillableSizeContent(i *int64) *ChunkUpdateOne

SetNillableSizeContent sets the "size_content" field if the given value is not nil.

func (*ChunkUpdateOne) SetNillableSizeInput

func (cuo *ChunkUpdateOne) SetNillableSizeInput(i *int64) *ChunkUpdateOne

SetNillableSizeInput sets the "size_input" field if the given value is not nil.

func (*ChunkUpdateOne) SetNillableSizeOutput

func (cuo *ChunkUpdateOne) SetNillableSizeOutput(i *int64) *ChunkUpdateOne

SetNillableSizeOutput sets the "size_output" field if the given value is not nil.

func (*ChunkUpdateOne) SetNillableState

func (cuo *ChunkUpdateOne) SetNillableState(c *chunk.State) *ChunkUpdateOne

SetNillableState sets the "state" field if the given value is not nil.

func (*ChunkUpdateOne) SetNillableWorkerID

func (cuo *ChunkUpdateOne) SetNillableWorkerID(id *uuid.UUID) *ChunkUpdateOne

SetNillableWorkerID sets the "worker" edge to the Worker entity by ID if the given value is not nil.

func (*ChunkUpdateOne) SetSha256Content

func (cuo *ChunkUpdateOne) SetSha256Content(s string) *ChunkUpdateOne

SetSha256Content sets the "sha256_content" field.

func (*ChunkUpdateOne) SetSha256Input

func (cuo *ChunkUpdateOne) SetSha256Input(s string) *ChunkUpdateOne

SetSha256Input sets the "sha256_input" field.

func (*ChunkUpdateOne) SetSha256Output

func (cuo *ChunkUpdateOne) SetSha256Output(s string) *ChunkUpdateOne

SetSha256Output sets the "sha256_output" field.

func (*ChunkUpdateOne) SetSizeContent

func (cuo *ChunkUpdateOne) SetSizeContent(i int64) *ChunkUpdateOne

SetSizeContent sets the "size_content" field.

func (*ChunkUpdateOne) SetSizeInput

func (cuo *ChunkUpdateOne) SetSizeInput(i int64) *ChunkUpdateOne

SetSizeInput sets the "size_input" field.

func (*ChunkUpdateOne) SetSizeOutput

func (cuo *ChunkUpdateOne) SetSizeOutput(i int64) *ChunkUpdateOne

SetSizeOutput sets the "size_output" field.

func (*ChunkUpdateOne) SetStart

func (cuo *ChunkUpdateOne) SetStart(t time.Time) *ChunkUpdateOne

SetStart sets the "start" field.

func (*ChunkUpdateOne) SetState

func (cuo *ChunkUpdateOne) SetState(c chunk.State) *ChunkUpdateOne

SetState sets the "state" field.

func (*ChunkUpdateOne) SetUpdatedAt

func (cuo *ChunkUpdateOne) SetUpdatedAt(t time.Time) *ChunkUpdateOne

SetUpdatedAt sets the "updated_at" field.

func (*ChunkUpdateOne) SetWorker

func (cuo *ChunkUpdateOne) SetWorker(w *Worker) *ChunkUpdateOne

SetWorker sets the "worker" edge to the Worker entity.

func (*ChunkUpdateOne) SetWorkerID

func (cuo *ChunkUpdateOne) SetWorkerID(id uuid.UUID) *ChunkUpdateOne

SetWorkerID sets the "worker" edge to the Worker entity by ID.

func (*ChunkUpdateOne) Where added in v0.2.0

func (cuo *ChunkUpdateOne) Where(ps ...predicate.Chunk) *ChunkUpdateOne

Where appends a list predicates to the ChunkUpdate builder.

type ChunkUpsert added in v0.2.0

type ChunkUpsert struct {
	*sql.UpdateSet
}

ChunkUpsert is the "OnConflict" setter.

func (*ChunkUpsert) AddSizeContent added in v0.2.0

func (u *ChunkUpsert) AddSizeContent(v int64) *ChunkUpsert

AddSizeContent adds v to the "size_content" field.

func (*ChunkUpsert) AddSizeInput added in v0.2.0

func (u *ChunkUpsert) AddSizeInput(v int64) *ChunkUpsert

AddSizeInput adds v to the "size_input" field.

func (*ChunkUpsert) AddSizeOutput added in v0.2.0

func (u *ChunkUpsert) AddSizeOutput(v int64) *ChunkUpsert

AddSizeOutput adds v to the "size_output" field.

func (*ChunkUpsert) ClearLeaseExpiresAt added in v0.2.0

func (u *ChunkUpsert) ClearLeaseExpiresAt() *ChunkUpsert

ClearLeaseExpiresAt clears the value of the "lease_expires_at" field.

func (*ChunkUpsert) ClearSha256Content added in v0.2.0

func (u *ChunkUpsert) ClearSha256Content() *ChunkUpsert

ClearSha256Content clears the value of the "sha256_content" field.

func (*ChunkUpsert) ClearSha256Input added in v0.2.0

func (u *ChunkUpsert) ClearSha256Input() *ChunkUpsert

ClearSha256Input clears the value of the "sha256_input" field.

func (*ChunkUpsert) ClearSha256Output added in v0.2.0

func (u *ChunkUpsert) ClearSha256Output() *ChunkUpsert

ClearSha256Output clears the value of the "sha256_output" field.

func (*ChunkUpsert) ClearSizeContent added in v0.2.0

func (u *ChunkUpsert) ClearSizeContent() *ChunkUpsert

ClearSizeContent clears the value of the "size_content" field.

func (*ChunkUpsert) ClearSizeInput added in v0.2.0

func (u *ChunkUpsert) ClearSizeInput() *ChunkUpsert

ClearSizeInput clears the value of the "size_input" field.

func (*ChunkUpsert) ClearSizeOutput added in v0.2.0

func (u *ChunkUpsert) ClearSizeOutput() *ChunkUpsert

ClearSizeOutput clears the value of the "size_output" field.

func (*ChunkUpsert) SetLeaseExpiresAt added in v0.2.0

func (u *ChunkUpsert) SetLeaseExpiresAt(v time.Time) *ChunkUpsert

SetLeaseExpiresAt sets the "lease_expires_at" field.

func (*ChunkUpsert) SetSha256Content added in v0.2.0

func (u *ChunkUpsert) SetSha256Content(v string) *ChunkUpsert

SetSha256Content sets the "sha256_content" field.

func (*ChunkUpsert) SetSha256Input added in v0.2.0

func (u *ChunkUpsert) SetSha256Input(v string) *ChunkUpsert

SetSha256Input sets the "sha256_input" field.

func (*ChunkUpsert) SetSha256Output added in v0.2.0

func (u *ChunkUpsert) SetSha256Output(v string) *ChunkUpsert

SetSha256Output sets the "sha256_output" field.

func (*ChunkUpsert) SetSizeContent added in v0.2.0

func (u *ChunkUpsert) SetSizeContent(v int64) *ChunkUpsert

SetSizeContent sets the "size_content" field.

func (*ChunkUpsert) SetSizeInput added in v0.2.0

func (u *ChunkUpsert) SetSizeInput(v int64) *ChunkUpsert

SetSizeInput sets the "size_input" field.

func (*ChunkUpsert) SetSizeOutput added in v0.2.0

func (u *ChunkUpsert) SetSizeOutput(v int64) *ChunkUpsert

SetSizeOutput sets the "size_output" field.

func (*ChunkUpsert) SetStart added in v0.2.0

func (u *ChunkUpsert) SetStart(v time.Time) *ChunkUpsert

SetStart sets the "start" field.

func (*ChunkUpsert) SetState added in v0.2.0

func (u *ChunkUpsert) SetState(v chunk.State) *ChunkUpsert

SetState sets the "state" field.

func (*ChunkUpsert) SetUpdatedAt added in v0.2.0

func (u *ChunkUpsert) SetUpdatedAt(v time.Time) *ChunkUpsert

SetUpdatedAt sets the "updated_at" field.

func (*ChunkUpsert) UpdateLeaseExpiresAt added in v0.2.0

func (u *ChunkUpsert) UpdateLeaseExpiresAt() *ChunkUpsert

UpdateLeaseExpiresAt sets the "lease_expires_at" field to the value that was provided on create.

func (*ChunkUpsert) UpdateSha256Content added in v0.2.0

func (u *ChunkUpsert) UpdateSha256Content() *ChunkUpsert

UpdateSha256Content sets the "sha256_content" field to the value that was provided on create.

func (*ChunkUpsert) UpdateSha256Input added in v0.2.0

func (u *ChunkUpsert) UpdateSha256Input() *ChunkUpsert

UpdateSha256Input sets the "sha256_input" field to the value that was provided on create.

func (*ChunkUpsert) UpdateSha256Output added in v0.2.0

func (u *ChunkUpsert) UpdateSha256Output() *ChunkUpsert

UpdateSha256Output sets the "sha256_output" field to the value that was provided on create.

func (*ChunkUpsert) UpdateSizeContent added in v0.2.0

func (u *ChunkUpsert) UpdateSizeContent() *ChunkUpsert

UpdateSizeContent sets the "size_content" field to the value that was provided on create.

func (*ChunkUpsert) UpdateSizeInput added in v0.2.0

func (u *ChunkUpsert) UpdateSizeInput() *ChunkUpsert

UpdateSizeInput sets the "size_input" field to the value that was provided on create.

func (*ChunkUpsert) UpdateSizeOutput added in v0.2.0

func (u *ChunkUpsert) UpdateSizeOutput() *ChunkUpsert

UpdateSizeOutput sets the "size_output" field to the value that was provided on create.

func (*ChunkUpsert) UpdateStart added in v0.2.0

func (u *ChunkUpsert) UpdateStart() *ChunkUpsert

UpdateStart sets the "start" field to the value that was provided on create.

func (*ChunkUpsert) UpdateState added in v0.2.0

func (u *ChunkUpsert) UpdateState() *ChunkUpsert

UpdateState sets the "state" field to the value that was provided on create.

func (*ChunkUpsert) UpdateUpdatedAt added in v0.2.0

func (u *ChunkUpsert) UpdateUpdatedAt() *ChunkUpsert

UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create.

type ChunkUpsertBulk added in v0.2.0

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

ChunkUpsertBulk is the builder for "upsert"-ing a bulk of Chunk nodes.

func (*ChunkUpsertBulk) AddSizeContent added in v0.2.0

func (u *ChunkUpsertBulk) AddSizeContent(v int64) *ChunkUpsertBulk

AddSizeContent adds v to the "size_content" field.

func (*ChunkUpsertBulk) AddSizeInput added in v0.2.0

func (u *ChunkUpsertBulk) AddSizeInput(v int64) *ChunkUpsertBulk

AddSizeInput adds v to the "size_input" field.

func (*ChunkUpsertBulk) AddSizeOutput added in v0.2.0

func (u *ChunkUpsertBulk) AddSizeOutput(v int64) *ChunkUpsertBulk

AddSizeOutput adds v to the "size_output" field.

func (*ChunkUpsertBulk) ClearLeaseExpiresAt added in v0.2.0

func (u *ChunkUpsertBulk) ClearLeaseExpiresAt() *ChunkUpsertBulk

ClearLeaseExpiresAt clears the value of the "lease_expires_at" field.

func (*ChunkUpsertBulk) ClearSha256Content added in v0.2.0

func (u *ChunkUpsertBulk) ClearSha256Content() *ChunkUpsertBulk

ClearSha256Content clears the value of the "sha256_content" field.

func (*ChunkUpsertBulk) ClearSha256Input added in v0.2.0

func (u *ChunkUpsertBulk) ClearSha256Input() *ChunkUpsertBulk

ClearSha256Input clears the value of the "sha256_input" field.

func (*ChunkUpsertBulk) ClearSha256Output added in v0.2.0

func (u *ChunkUpsertBulk) ClearSha256Output() *ChunkUpsertBulk

ClearSha256Output clears the value of the "sha256_output" field.

func (*ChunkUpsertBulk) ClearSizeContent added in v0.2.0

func (u *ChunkUpsertBulk) ClearSizeContent() *ChunkUpsertBulk

ClearSizeContent clears the value of the "size_content" field.

func (*ChunkUpsertBulk) ClearSizeInput added in v0.2.0

func (u *ChunkUpsertBulk) ClearSizeInput() *ChunkUpsertBulk

ClearSizeInput clears the value of the "size_input" field.

func (*ChunkUpsertBulk) ClearSizeOutput added in v0.2.0

func (u *ChunkUpsertBulk) ClearSizeOutput() *ChunkUpsertBulk

ClearSizeOutput clears the value of the "size_output" field.

func (*ChunkUpsertBulk) DoNothing added in v0.2.0

func (u *ChunkUpsertBulk) DoNothing() *ChunkUpsertBulk

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

func (*ChunkUpsertBulk) Exec added in v0.2.0

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

Exec executes the query.

func (*ChunkUpsertBulk) ExecX added in v0.2.0

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

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

func (*ChunkUpsertBulk) Ignore added in v0.2.0

func (u *ChunkUpsertBulk) Ignore() *ChunkUpsertBulk

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

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

func (*ChunkUpsertBulk) SetLeaseExpiresAt added in v0.2.0

func (u *ChunkUpsertBulk) SetLeaseExpiresAt(v time.Time) *ChunkUpsertBulk

SetLeaseExpiresAt sets the "lease_expires_at" field.

func (*ChunkUpsertBulk) SetSha256Content added in v0.2.0

func (u *ChunkUpsertBulk) SetSha256Content(v string) *ChunkUpsertBulk

SetSha256Content sets the "sha256_content" field.

func (*ChunkUpsertBulk) SetSha256Input added in v0.2.0

func (u *ChunkUpsertBulk) SetSha256Input(v string) *ChunkUpsertBulk

SetSha256Input sets the "sha256_input" field.

func (*ChunkUpsertBulk) SetSha256Output added in v0.2.0

func (u *ChunkUpsertBulk) SetSha256Output(v string) *ChunkUpsertBulk

SetSha256Output sets the "sha256_output" field.

func (*ChunkUpsertBulk) SetSizeContent added in v0.2.0

func (u *ChunkUpsertBulk) SetSizeContent(v int64) *ChunkUpsertBulk

SetSizeContent sets the "size_content" field.

func (*ChunkUpsertBulk) SetSizeInput added in v0.2.0

func (u *ChunkUpsertBulk) SetSizeInput(v int64) *ChunkUpsertBulk

SetSizeInput sets the "size_input" field.

func (*ChunkUpsertBulk) SetSizeOutput added in v0.2.0

func (u *ChunkUpsertBulk) SetSizeOutput(v int64) *ChunkUpsertBulk

SetSizeOutput sets the "size_output" field.

func (*ChunkUpsertBulk) SetStart added in v0.2.0

func (u *ChunkUpsertBulk) SetStart(v time.Time) *ChunkUpsertBulk

SetStart sets the "start" field.

func (*ChunkUpsertBulk) SetState added in v0.2.0

func (u *ChunkUpsertBulk) SetState(v chunk.State) *ChunkUpsertBulk

SetState sets the "state" field.

func (*ChunkUpsertBulk) SetUpdatedAt added in v0.2.0

func (u *ChunkUpsertBulk) SetUpdatedAt(v time.Time) *ChunkUpsertBulk

SetUpdatedAt sets the "updated_at" field.

func (*ChunkUpsertBulk) Update added in v0.2.0

func (u *ChunkUpsertBulk) Update(set func(*ChunkUpsert)) *ChunkUpsertBulk

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

func (*ChunkUpsertBulk) UpdateLeaseExpiresAt added in v0.2.0

func (u *ChunkUpsertBulk) UpdateLeaseExpiresAt() *ChunkUpsertBulk

UpdateLeaseExpiresAt sets the "lease_expires_at" field to the value that was provided on create.

func (*ChunkUpsertBulk) UpdateNewValues added in v0.2.0

func (u *ChunkUpsertBulk) UpdateNewValues() *ChunkUpsertBulk

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

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

func (*ChunkUpsertBulk) UpdateSha256Content added in v0.2.0

func (u *ChunkUpsertBulk) UpdateSha256Content() *ChunkUpsertBulk

UpdateSha256Content sets the "sha256_content" field to the value that was provided on create.

func (*ChunkUpsertBulk) UpdateSha256Input added in v0.2.0

func (u *ChunkUpsertBulk) UpdateSha256Input() *ChunkUpsertBulk

UpdateSha256Input sets the "sha256_input" field to the value that was provided on create.

func (*ChunkUpsertBulk) UpdateSha256Output added in v0.2.0

func (u *ChunkUpsertBulk) UpdateSha256Output() *ChunkUpsertBulk

UpdateSha256Output sets the "sha256_output" field to the value that was provided on create.

func (*ChunkUpsertBulk) UpdateSizeContent added in v0.2.0

func (u *ChunkUpsertBulk) UpdateSizeContent() *ChunkUpsertBulk

UpdateSizeContent sets the "size_content" field to the value that was provided on create.

func (*ChunkUpsertBulk) UpdateSizeInput added in v0.2.0

func (u *ChunkUpsertBulk) UpdateSizeInput() *ChunkUpsertBulk

UpdateSizeInput sets the "size_input" field to the value that was provided on create.

func (*ChunkUpsertBulk) UpdateSizeOutput added in v0.2.0

func (u *ChunkUpsertBulk) UpdateSizeOutput() *ChunkUpsertBulk

UpdateSizeOutput sets the "size_output" field to the value that was provided on create.

func (*ChunkUpsertBulk) UpdateStart added in v0.2.0

func (u *ChunkUpsertBulk) UpdateStart() *ChunkUpsertBulk

UpdateStart sets the "start" field to the value that was provided on create.

func (*ChunkUpsertBulk) UpdateState added in v0.2.0

func (u *ChunkUpsertBulk) UpdateState() *ChunkUpsertBulk

UpdateState sets the "state" field to the value that was provided on create.

func (*ChunkUpsertBulk) UpdateUpdatedAt added in v0.2.0

func (u *ChunkUpsertBulk) UpdateUpdatedAt() *ChunkUpsertBulk

UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create.

type ChunkUpsertOne added in v0.2.0

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

ChunkUpsertOne is the builder for "upsert"-ing

one Chunk node.

func (*ChunkUpsertOne) AddSizeContent added in v0.2.0

func (u *ChunkUpsertOne) AddSizeContent(v int64) *ChunkUpsertOne

AddSizeContent adds v to the "size_content" field.

func (*ChunkUpsertOne) AddSizeInput added in v0.2.0

func (u *ChunkUpsertOne) AddSizeInput(v int64) *ChunkUpsertOne

AddSizeInput adds v to the "size_input" field.

func (*ChunkUpsertOne) AddSizeOutput added in v0.2.0

func (u *ChunkUpsertOne) AddSizeOutput(v int64) *ChunkUpsertOne

AddSizeOutput adds v to the "size_output" field.

func (*ChunkUpsertOne) ClearLeaseExpiresAt added in v0.2.0

func (u *ChunkUpsertOne) ClearLeaseExpiresAt() *ChunkUpsertOne

ClearLeaseExpiresAt clears the value of the "lease_expires_at" field.

func (*ChunkUpsertOne) ClearSha256Content added in v0.2.0

func (u *ChunkUpsertOne) ClearSha256Content() *ChunkUpsertOne

ClearSha256Content clears the value of the "sha256_content" field.

func (*ChunkUpsertOne) ClearSha256Input added in v0.2.0

func (u *ChunkUpsertOne) ClearSha256Input() *ChunkUpsertOne

ClearSha256Input clears the value of the "sha256_input" field.

func (*ChunkUpsertOne) ClearSha256Output added in v0.2.0

func (u *ChunkUpsertOne) ClearSha256Output() *ChunkUpsertOne

ClearSha256Output clears the value of the "sha256_output" field.

func (*ChunkUpsertOne) ClearSizeContent added in v0.2.0

func (u *ChunkUpsertOne) ClearSizeContent() *ChunkUpsertOne

ClearSizeContent clears the value of the "size_content" field.

func (*ChunkUpsertOne) ClearSizeInput added in v0.2.0

func (u *ChunkUpsertOne) ClearSizeInput() *ChunkUpsertOne

ClearSizeInput clears the value of the "size_input" field.

func (*ChunkUpsertOne) ClearSizeOutput added in v0.2.0

func (u *ChunkUpsertOne) ClearSizeOutput() *ChunkUpsertOne

ClearSizeOutput clears the value of the "size_output" field.

func (*ChunkUpsertOne) DoNothing added in v0.2.0

func (u *ChunkUpsertOne) DoNothing() *ChunkUpsertOne

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

func (*ChunkUpsertOne) Exec added in v0.2.0

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

Exec executes the query.

func (*ChunkUpsertOne) ExecX added in v0.2.0

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

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

func (*ChunkUpsertOne) ID added in v0.2.0

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

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

func (*ChunkUpsertOne) IDX added in v0.2.0

func (u *ChunkUpsertOne) IDX(ctx context.Context) string

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

func (*ChunkUpsertOne) Ignore added in v0.2.0

func (u *ChunkUpsertOne) Ignore() *ChunkUpsertOne

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

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

func (*ChunkUpsertOne) SetLeaseExpiresAt added in v0.2.0

func (u *ChunkUpsertOne) SetLeaseExpiresAt(v time.Time) *ChunkUpsertOne

SetLeaseExpiresAt sets the "lease_expires_at" field.

func (*ChunkUpsertOne) SetSha256Content added in v0.2.0

func (u *ChunkUpsertOne) SetSha256Content(v string) *ChunkUpsertOne

SetSha256Content sets the "sha256_content" field.

func (*ChunkUpsertOne) SetSha256Input added in v0.2.0

func (u *ChunkUpsertOne) SetSha256Input(v string) *ChunkUpsertOne

SetSha256Input sets the "sha256_input" field.

func (*ChunkUpsertOne) SetSha256Output added in v0.2.0

func (u *ChunkUpsertOne) SetSha256Output(v string) *ChunkUpsertOne

SetSha256Output sets the "sha256_output" field.

func (*ChunkUpsertOne) SetSizeContent added in v0.2.0

func (u *ChunkUpsertOne) SetSizeContent(v int64) *ChunkUpsertOne

SetSizeContent sets the "size_content" field.

func (*ChunkUpsertOne) SetSizeInput added in v0.2.0

func (u *ChunkUpsertOne) SetSizeInput(v int64) *ChunkUpsertOne

SetSizeInput sets the "size_input" field.

func (*ChunkUpsertOne) SetSizeOutput added in v0.2.0

func (u *ChunkUpsertOne) SetSizeOutput(v int64) *ChunkUpsertOne

SetSizeOutput sets the "size_output" field.

func (*ChunkUpsertOne) SetStart added in v0.2.0

func (u *ChunkUpsertOne) SetStart(v time.Time) *ChunkUpsertOne

SetStart sets the "start" field.

func (*ChunkUpsertOne) SetState added in v0.2.0

func (u *ChunkUpsertOne) SetState(v chunk.State) *ChunkUpsertOne

SetState sets the "state" field.

func (*ChunkUpsertOne) SetUpdatedAt added in v0.2.0

func (u *ChunkUpsertOne) SetUpdatedAt(v time.Time) *ChunkUpsertOne

SetUpdatedAt sets the "updated_at" field.

func (*ChunkUpsertOne) Update added in v0.2.0

func (u *ChunkUpsertOne) Update(set func(*ChunkUpsert)) *ChunkUpsertOne

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

func (*ChunkUpsertOne) UpdateLeaseExpiresAt added in v0.2.0

func (u *ChunkUpsertOne) UpdateLeaseExpiresAt() *ChunkUpsertOne

UpdateLeaseExpiresAt sets the "lease_expires_at" field to the value that was provided on create.

func (*ChunkUpsertOne) UpdateNewValues added in v0.2.0

func (u *ChunkUpsertOne) UpdateNewValues() *ChunkUpsertOne

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

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

func (*ChunkUpsertOne) UpdateSha256Content added in v0.2.0

func (u *ChunkUpsertOne) UpdateSha256Content() *ChunkUpsertOne

UpdateSha256Content sets the "sha256_content" field to the value that was provided on create.

func (*ChunkUpsertOne) UpdateSha256Input added in v0.2.0

func (u *ChunkUpsertOne) UpdateSha256Input() *ChunkUpsertOne

UpdateSha256Input sets the "sha256_input" field to the value that was provided on create.

func (*ChunkUpsertOne) UpdateSha256Output added in v0.2.0

func (u *ChunkUpsertOne) UpdateSha256Output() *ChunkUpsertOne

UpdateSha256Output sets the "sha256_output" field to the value that was provided on create.

func (*ChunkUpsertOne) UpdateSizeContent added in v0.2.0

func (u *ChunkUpsertOne) UpdateSizeContent() *ChunkUpsertOne

UpdateSizeContent sets the "size_content" field to the value that was provided on create.

func (*ChunkUpsertOne) UpdateSizeInput added in v0.2.0

func (u *ChunkUpsertOne) UpdateSizeInput() *ChunkUpsertOne

UpdateSizeInput sets the "size_input" field to the value that was provided on create.

func (*ChunkUpsertOne) UpdateSizeOutput added in v0.2.0

func (u *ChunkUpsertOne) UpdateSizeOutput() *ChunkUpsertOne

UpdateSizeOutput sets the "size_output" field to the value that was provided on create.

func (*ChunkUpsertOne) UpdateStart added in v0.2.0

func (u *ChunkUpsertOne) UpdateStart() *ChunkUpsertOne

UpdateStart sets the "start" field to the value that was provided on create.

func (*ChunkUpsertOne) UpdateState added in v0.2.0

func (u *ChunkUpsertOne) UpdateState() *ChunkUpsertOne

UpdateState sets the "state" field to the value that was provided on create.

func (*ChunkUpsertOne) UpdateUpdatedAt added in v0.2.0

func (u *ChunkUpsertOne) UpdateUpdatedAt() *ChunkUpsertOne

UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create.

type Chunks

type Chunks []*Chunk

Chunks is a parsable slice of Chunk.

type Client

type Client struct {

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

func (*Client) Intercept added in v0.2.0

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 added in v0.2.0

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 added in v0.2.0

type InterceptFunc = ent.InterceptFunc

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

type Interceptor added in v0.2.0

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 added in v0.2.0

type Querier = ent.Querier

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

type QuerierFunc added in v0.2.0

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 added in v0.2.0

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 added in v0.2.0

type TraverseFunc = ent.TraverseFunc

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

type Traverser added in v0.2.0

type Traverser = ent.Traverser

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

type Tx

type Tx struct {

	// Chunk is the client for interacting with the Chunk builders.
	Chunk *ChunkClient
	// Worker is the client for interacting with the Worker builders.
	Worker *WorkerClient
	// 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.

type Worker

type Worker struct {

	// ID of the ent.
	ID uuid.UUID `json:"id,omitempty"`
	// Time when entity was created.
	CreatedAt time.Time `json:"created_at,omitempty"`
	// Time when entity was updated.
	UpdatedAt time.Time `json:"updated_at,omitempty"`
	// Name holds the value of the "name" field.
	Name string `json:"name,omitempty"`
	// Token holds the value of the "token" field.
	Token string `json:"token,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the WorkerQuery when eager-loading is set.
	Edges WorkerEdges `json:"edges"`
	// contains filtered or unexported fields
}

Worker is the model entity for the Worker schema.

func (*Worker) QueryChunks

func (w *Worker) QueryChunks() *ChunkQuery

QueryChunks queries the "chunks" edge of the Worker entity.

func (*Worker) String

func (w *Worker) String() string

String implements the fmt.Stringer.

func (*Worker) Unwrap

func (w *Worker) Unwrap() *Worker

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

func (w *Worker) Update() *WorkerUpdateOne

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

func (*Worker) Value added in v0.2.0

func (w *Worker) Value(name string) (ent.Value, error)

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

type WorkerClient

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

WorkerClient is a client for the Worker schema.

func NewWorkerClient

func NewWorkerClient(c config) *WorkerClient

NewWorkerClient returns a client for the Worker from the given config.

func (*WorkerClient) Create

func (c *WorkerClient) Create() *WorkerCreate

Create returns a builder for creating a Worker entity.

func (*WorkerClient) CreateBulk

func (c *WorkerClient) CreateBulk(builders ...*WorkerCreate) *WorkerCreateBulk

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

func (*WorkerClient) Delete

func (c *WorkerClient) Delete() *WorkerDelete

Delete returns a delete builder for Worker.

func (*WorkerClient) DeleteOne

func (c *WorkerClient) DeleteOne(w *Worker) *WorkerDeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*WorkerClient) DeleteOneID

func (c *WorkerClient) DeleteOneID(id uuid.UUID) *WorkerDeleteOne

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

func (*WorkerClient) Get

func (c *WorkerClient) Get(ctx context.Context, id uuid.UUID) (*Worker, error)

Get returns a Worker entity by its id.

func (*WorkerClient) GetX

func (c *WorkerClient) GetX(ctx context.Context, id uuid.UUID) *Worker

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

func (*WorkerClient) Hooks

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

Hooks returns the client hooks.

func (*WorkerClient) Intercept added in v0.2.0

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

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

func (*WorkerClient) Interceptors added in v0.2.0

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

Interceptors returns the client interceptors.

func (*WorkerClient) Query

func (c *WorkerClient) Query() *WorkerQuery

Query returns a query builder for Worker.

func (*WorkerClient) QueryChunks

func (c *WorkerClient) QueryChunks(w *Worker) *ChunkQuery

QueryChunks queries the chunks edge of a Worker.

func (*WorkerClient) Update

func (c *WorkerClient) Update() *WorkerUpdate

Update returns an update builder for Worker.

func (*WorkerClient) UpdateOne

func (c *WorkerClient) UpdateOne(w *Worker) *WorkerUpdateOne

UpdateOne returns an update builder for the given entity.

func (*WorkerClient) UpdateOneID

func (c *WorkerClient) UpdateOneID(id uuid.UUID) *WorkerUpdateOne

UpdateOneID returns an update builder for the given id.

func (*WorkerClient) Use

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

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

type WorkerCreate

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

WorkerCreate is the builder for creating a Worker entity.

func (*WorkerCreate) AddChunkIDs

func (wc *WorkerCreate) AddChunkIDs(ids ...string) *WorkerCreate

AddChunkIDs adds the "chunks" edge to the Chunk entity by IDs.

func (*WorkerCreate) AddChunks

func (wc *WorkerCreate) AddChunks(c ...*Chunk) *WorkerCreate

AddChunks adds the "chunks" edges to the Chunk entity.

func (*WorkerCreate) Exec

func (wc *WorkerCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*WorkerCreate) ExecX

func (wc *WorkerCreate) ExecX(ctx context.Context)

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

func (*WorkerCreate) Mutation

func (wc *WorkerCreate) Mutation() *WorkerMutation

Mutation returns the WorkerMutation object of the builder.

func (*WorkerCreate) OnConflict added in v0.2.0

func (wc *WorkerCreate) OnConflict(opts ...sql.ConflictOption) *WorkerUpsertOne

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

client.Worker.Create().
	SetCreatedAt(v).
	OnConflict(
		// Update the row with the new values
		// the was proposed for insertion.
		sql.ResolveWithNewValues(),
	).
	// Override some of the fields with custom
	// update values.
	Update(func(u *ent.WorkerUpsert) {
		SetCreatedAt(v+v).
	}).
	Exec(ctx)

func (*WorkerCreate) OnConflictColumns added in v0.2.0

func (wc *WorkerCreate) OnConflictColumns(columns ...string) *WorkerUpsertOne

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

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

func (*WorkerCreate) Save

func (wc *WorkerCreate) Save(ctx context.Context) (*Worker, error)

Save creates the Worker in the database.

func (*WorkerCreate) SaveX

func (wc *WorkerCreate) SaveX(ctx context.Context) *Worker

SaveX calls Save and panics if Save returns an error.

func (*WorkerCreate) SetCreatedAt

func (wc *WorkerCreate) SetCreatedAt(t time.Time) *WorkerCreate

SetCreatedAt sets the "created_at" field.

func (*WorkerCreate) SetID

func (wc *WorkerCreate) SetID(u uuid.UUID) *WorkerCreate

SetID sets the "id" field.

func (*WorkerCreate) SetName

func (wc *WorkerCreate) SetName(s string) *WorkerCreate

SetName sets the "name" field.

func (*WorkerCreate) SetNillableCreatedAt

func (wc *WorkerCreate) SetNillableCreatedAt(t *time.Time) *WorkerCreate

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

func (*WorkerCreate) SetNillableID added in v0.2.0

func (wc *WorkerCreate) SetNillableID(u *uuid.UUID) *WorkerCreate

SetNillableID sets the "id" field if the given value is not nil.

func (*WorkerCreate) SetNillableUpdatedAt

func (wc *WorkerCreate) SetNillableUpdatedAt(t *time.Time) *WorkerCreate

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

func (*WorkerCreate) SetToken

func (wc *WorkerCreate) SetToken(s string) *WorkerCreate

SetToken sets the "token" field.

func (*WorkerCreate) SetUpdatedAt

func (wc *WorkerCreate) SetUpdatedAt(t time.Time) *WorkerCreate

SetUpdatedAt sets the "updated_at" field.

type WorkerCreateBulk

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

WorkerCreateBulk is the builder for creating many Worker entities in bulk.

func (*WorkerCreateBulk) Exec

func (wcb *WorkerCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*WorkerCreateBulk) ExecX

func (wcb *WorkerCreateBulk) ExecX(ctx context.Context)

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

func (*WorkerCreateBulk) OnConflict added in v0.2.0

func (wcb *WorkerCreateBulk) OnConflict(opts ...sql.ConflictOption) *WorkerUpsertBulk

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

client.Worker.CreateBulk(builders...).
	OnConflict(
		// Update the row with the new values
		// the was proposed for insertion.
		sql.ResolveWithNewValues(),
	).
	// Override some of the fields with custom
	// update values.
	Update(func(u *ent.WorkerUpsert) {
		SetCreatedAt(v+v).
	}).
	Exec(ctx)

func (*WorkerCreateBulk) OnConflictColumns added in v0.2.0

func (wcb *WorkerCreateBulk) OnConflictColumns(columns ...string) *WorkerUpsertBulk

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

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

func (*WorkerCreateBulk) Save

func (wcb *WorkerCreateBulk) Save(ctx context.Context) ([]*Worker, error)

Save creates the Worker entities in the database.

func (*WorkerCreateBulk) SaveX

func (wcb *WorkerCreateBulk) SaveX(ctx context.Context) []*Worker

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

type WorkerDelete

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

WorkerDelete is the builder for deleting a Worker entity.

func (*WorkerDelete) Exec

func (wd *WorkerDelete) Exec(ctx context.Context) (int, error)

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

func (*WorkerDelete) ExecX

func (wd *WorkerDelete) ExecX(ctx context.Context) int

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

func (*WorkerDelete) Where

func (wd *WorkerDelete) Where(ps ...predicate.Worker) *WorkerDelete

Where appends a list predicates to the WorkerDelete builder.

type WorkerDeleteOne

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

WorkerDeleteOne is the builder for deleting a single Worker entity.

func (*WorkerDeleteOne) Exec

func (wdo *WorkerDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*WorkerDeleteOne) ExecX

func (wdo *WorkerDeleteOne) ExecX(ctx context.Context)

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

func (*WorkerDeleteOne) Where added in v0.2.0

func (wdo *WorkerDeleteOne) Where(ps ...predicate.Worker) *WorkerDeleteOne

Where appends a list predicates to the WorkerDelete builder.

type WorkerEdges

type WorkerEdges struct {
	// Chunks holds the value of the chunks edge.
	Chunks []*Chunk `json:"chunks,omitempty"`
	// contains filtered or unexported fields
}

WorkerEdges holds the relations/edges for other nodes in the graph.

func (WorkerEdges) ChunksOrErr

func (e WorkerEdges) ChunksOrErr() ([]*Chunk, error)

ChunksOrErr returns the Chunks value or an error if the edge was not loaded in eager-loading.

type WorkerGroupBy

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

WorkerGroupBy is the group-by builder for Worker entities.

func (*WorkerGroupBy) Aggregate

func (wgb *WorkerGroupBy) Aggregate(fns ...AggregateFunc) *WorkerGroupBy

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

func (*WorkerGroupBy) Bool

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

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

func (*WorkerGroupBy) BoolX

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

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

func (*WorkerGroupBy) Bools

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

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

func (*WorkerGroupBy) BoolsX

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

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

func (*WorkerGroupBy) Float64

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

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

func (*WorkerGroupBy) Float64X

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

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

func (*WorkerGroupBy) Float64s

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

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

func (*WorkerGroupBy) Float64sX

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

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

func (*WorkerGroupBy) Int

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

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

func (*WorkerGroupBy) IntX

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

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

func (*WorkerGroupBy) Ints

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

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

func (*WorkerGroupBy) IntsX

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

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

func (*WorkerGroupBy) Scan

func (wgb *WorkerGroupBy) Scan(ctx context.Context, v any) error

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

func (*WorkerGroupBy) ScanX

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

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

func (*WorkerGroupBy) String

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

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

func (*WorkerGroupBy) StringX

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

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

func (*WorkerGroupBy) Strings

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

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

func (*WorkerGroupBy) StringsX

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

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

type WorkerMutation

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

WorkerMutation represents an operation that mutates the Worker nodes in the graph.

func (*WorkerMutation) AddChunkIDs

func (m *WorkerMutation) AddChunkIDs(ids ...string)

AddChunkIDs adds the "chunks" edge to the Chunk entity by ids.

func (*WorkerMutation) AddField

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

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

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

func (*WorkerMutation) AddedField

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

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

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

func (*WorkerMutation) AddedIDs

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

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

func (*WorkerMutation) ChunksCleared

func (m *WorkerMutation) ChunksCleared() bool

ChunksCleared reports if the "chunks" edge to the Chunk entity was cleared.

func (*WorkerMutation) ChunksIDs

func (m *WorkerMutation) ChunksIDs() (ids []string)

ChunksIDs returns the "chunks" edge IDs in the mutation.

func (*WorkerMutation) ClearChunks

func (m *WorkerMutation) ClearChunks()

ClearChunks clears the "chunks" edge to the Chunk entity.

func (*WorkerMutation) ClearEdge

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

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

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

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

func (*WorkerMutation) ClearedFields

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

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

func (WorkerMutation) Client

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

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

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

func (*WorkerMutation) EdgeCleared

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

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

func (*WorkerMutation) Field

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

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

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

func (*WorkerMutation) Fields

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

func (m *WorkerMutation) 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 (*WorkerMutation) IDs added in v0.2.0

func (m *WorkerMutation) 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 (*WorkerMutation) Name

func (m *WorkerMutation) Name() (r string, exists bool)

Name returns the value of the "name" field in the mutation.

func (*WorkerMutation) OldCreatedAt

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

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

func (m *WorkerMutation) 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 (*WorkerMutation) OldName

func (m *WorkerMutation) OldName(ctx context.Context) (v string, err error)

OldName returns the old "name" field's value of the Worker entity. If the Worker 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 (*WorkerMutation) OldToken

func (m *WorkerMutation) OldToken(ctx context.Context) (v string, err error)

OldToken returns the old "token" field's value of the Worker entity. If the Worker 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 (*WorkerMutation) OldUpdatedAt

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

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

func (m *WorkerMutation) Op() Op

Op returns the operation name.

func (*WorkerMutation) RemoveChunkIDs

func (m *WorkerMutation) RemoveChunkIDs(ids ...string)

RemoveChunkIDs removes the "chunks" edge to the Chunk entity by IDs.

func (*WorkerMutation) RemovedChunksIDs

func (m *WorkerMutation) RemovedChunksIDs() (ids []string)

RemovedChunks returns the removed IDs of the "chunks" edge to the Chunk entity.

func (*WorkerMutation) RemovedEdges

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

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

func (*WorkerMutation) RemovedIDs

func (m *WorkerMutation) 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 (*WorkerMutation) ResetChunks

func (m *WorkerMutation) ResetChunks()

ResetChunks resets all changes to the "chunks" edge.

func (*WorkerMutation) ResetCreatedAt

func (m *WorkerMutation) ResetCreatedAt()

ResetCreatedAt resets all changes to the "created_at" field.

func (*WorkerMutation) ResetEdge

func (m *WorkerMutation) 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 (*WorkerMutation) ResetField

func (m *WorkerMutation) 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 (*WorkerMutation) ResetName

func (m *WorkerMutation) ResetName()

ResetName resets all changes to the "name" field.

func (*WorkerMutation) ResetToken

func (m *WorkerMutation) ResetToken()

ResetToken resets all changes to the "token" field.

func (*WorkerMutation) ResetUpdatedAt

func (m *WorkerMutation) ResetUpdatedAt()

ResetUpdatedAt resets all changes to the "updated_at" field.

func (*WorkerMutation) SetCreatedAt

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

SetCreatedAt sets the "created_at" field.

func (*WorkerMutation) SetField

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

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

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

func (*WorkerMutation) SetName

func (m *WorkerMutation) SetName(s string)

SetName sets the "name" field.

func (*WorkerMutation) SetOp added in v0.2.0

func (m *WorkerMutation) SetOp(op Op)

SetOp allows setting the mutation operation.

func (*WorkerMutation) SetToken

func (m *WorkerMutation) SetToken(s string)

SetToken sets the "token" field.

func (*WorkerMutation) SetUpdatedAt

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

SetUpdatedAt sets the "updated_at" field.

func (*WorkerMutation) Token

func (m *WorkerMutation) Token() (r string, exists bool)

Token returns the value of the "token" field in the mutation.

func (WorkerMutation) Tx

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

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

func (*WorkerMutation) Type

func (m *WorkerMutation) Type() string

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

func (*WorkerMutation) UpdatedAt

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

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

func (*WorkerMutation) Where

func (m *WorkerMutation) Where(ps ...predicate.Worker)

Where appends a list predicates to the WorkerMutation builder.

func (*WorkerMutation) WhereP added in v0.2.0

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

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

type WorkerQuery

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

WorkerQuery is the builder for querying Worker entities.

func (*WorkerQuery) Aggregate added in v0.2.0

func (wq *WorkerQuery) Aggregate(fns ...AggregateFunc) *WorkerSelect

Aggregate returns a WorkerSelect configured with the given aggregations.

func (*WorkerQuery) All

func (wq *WorkerQuery) All(ctx context.Context) ([]*Worker, error)

All executes the query and returns a list of Workers.

func (*WorkerQuery) AllX

func (wq *WorkerQuery) AllX(ctx context.Context) []*Worker

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

func (*WorkerQuery) Clone

func (wq *WorkerQuery) Clone() *WorkerQuery

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

func (*WorkerQuery) Count

func (wq *WorkerQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*WorkerQuery) CountX

func (wq *WorkerQuery) CountX(ctx context.Context) int

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

func (*WorkerQuery) Exist

func (wq *WorkerQuery) Exist(ctx context.Context) (bool, error)

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

func (*WorkerQuery) ExistX

func (wq *WorkerQuery) ExistX(ctx context.Context) bool

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

func (*WorkerQuery) First

func (wq *WorkerQuery) First(ctx context.Context) (*Worker, error)

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

func (*WorkerQuery) FirstID

func (wq *WorkerQuery) FirstID(ctx context.Context) (id uuid.UUID, err error)

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

func (*WorkerQuery) FirstIDX

func (wq *WorkerQuery) FirstIDX(ctx context.Context) uuid.UUID

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

func (*WorkerQuery) FirstX

func (wq *WorkerQuery) FirstX(ctx context.Context) *Worker

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

func (*WorkerQuery) ForShare

func (wq *WorkerQuery) ForShare(opts ...sql.LockOption) *WorkerQuery

ForShare behaves similarly to ForUpdate, except that it acquires a shared mode lock on any rows that are read. Other sessions can read the rows, but cannot modify them until your transaction commits.

func (*WorkerQuery) ForUpdate

func (wq *WorkerQuery) ForUpdate(opts ...sql.LockOption) *WorkerQuery

ForUpdate locks the selected rows against concurrent updates, and prevent them from being updated, deleted or "selected ... for update" by other sessions, until the transaction is either committed or rolled-back.

func (*WorkerQuery) GroupBy

func (wq *WorkerQuery) GroupBy(field string, fields ...string) *WorkerGroupBy

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.Worker.Query().
	GroupBy(worker.FieldCreatedAt).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*WorkerQuery) IDs

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

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

func (*WorkerQuery) IDsX

func (wq *WorkerQuery) IDsX(ctx context.Context) []uuid.UUID

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

func (*WorkerQuery) Limit

func (wq *WorkerQuery) Limit(limit int) *WorkerQuery

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

func (*WorkerQuery) Offset

func (wq *WorkerQuery) Offset(offset int) *WorkerQuery

Offset to start from.

func (*WorkerQuery) Only

func (wq *WorkerQuery) Only(ctx context.Context) (*Worker, error)

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

func (*WorkerQuery) OnlyID

func (wq *WorkerQuery) OnlyID(ctx context.Context) (id uuid.UUID, err error)

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

func (*WorkerQuery) OnlyIDX

func (wq *WorkerQuery) OnlyIDX(ctx context.Context) uuid.UUID

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

func (*WorkerQuery) OnlyX

func (wq *WorkerQuery) OnlyX(ctx context.Context) *Worker

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

func (*WorkerQuery) Order

func (wq *WorkerQuery) Order(o ...worker.OrderOption) *WorkerQuery

Order specifies how the records should be ordered.

func (*WorkerQuery) QueryChunks

func (wq *WorkerQuery) QueryChunks() *ChunkQuery

QueryChunks chains the current query on the "chunks" edge.

func (*WorkerQuery) Select

func (wq *WorkerQuery) Select(fields ...string) *WorkerSelect

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.Worker.Query().
	Select(worker.FieldCreatedAt).
	Scan(ctx, &v)

func (*WorkerQuery) Unique

func (wq *WorkerQuery) Unique(unique bool) *WorkerQuery

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

func (wq *WorkerQuery) Where(ps ...predicate.Worker) *WorkerQuery

Where adds a new predicate for the WorkerQuery builder.

func (*WorkerQuery) WithChunks

func (wq *WorkerQuery) WithChunks(opts ...func(*ChunkQuery)) *WorkerQuery

WithChunks tells the query-builder to eager-load the nodes that are connected to the "chunks" edge. The optional arguments are used to configure the query builder of the edge.

type WorkerSelect

type WorkerSelect struct {
	*WorkerQuery
	// contains filtered or unexported fields
}

WorkerSelect is the builder for selecting fields of Worker entities.

func (*WorkerSelect) Aggregate added in v0.2.0

func (ws *WorkerSelect) Aggregate(fns ...AggregateFunc) *WorkerSelect

Aggregate adds the given aggregation functions to the selector query.

func (*WorkerSelect) Bool

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

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

func (*WorkerSelect) BoolX

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

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

func (*WorkerSelect) Bools

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

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

func (*WorkerSelect) BoolsX

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

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

func (*WorkerSelect) Float64

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

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

func (*WorkerSelect) Float64X

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

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

func (*WorkerSelect) Float64s

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

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

func (*WorkerSelect) Float64sX

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

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

func (*WorkerSelect) Int

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

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

func (*WorkerSelect) IntX

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

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

func (*WorkerSelect) Ints

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

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

func (*WorkerSelect) IntsX

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

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

func (*WorkerSelect) Scan

func (ws *WorkerSelect) Scan(ctx context.Context, v any) error

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

func (*WorkerSelect) ScanX

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

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

func (*WorkerSelect) String

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

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

func (*WorkerSelect) StringX

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

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

func (*WorkerSelect) Strings

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

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

func (*WorkerSelect) StringsX

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

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

type WorkerUpdate

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

WorkerUpdate is the builder for updating Worker entities.

func (*WorkerUpdate) AddChunkIDs

func (wu *WorkerUpdate) AddChunkIDs(ids ...string) *WorkerUpdate

AddChunkIDs adds the "chunks" edge to the Chunk entity by IDs.

func (*WorkerUpdate) AddChunks

func (wu *WorkerUpdate) AddChunks(c ...*Chunk) *WorkerUpdate

AddChunks adds the "chunks" edges to the Chunk entity.

func (*WorkerUpdate) ClearChunks

func (wu *WorkerUpdate) ClearChunks() *WorkerUpdate

ClearChunks clears all "chunks" edges to the Chunk entity.

func (*WorkerUpdate) Exec

func (wu *WorkerUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*WorkerUpdate) ExecX

func (wu *WorkerUpdate) ExecX(ctx context.Context)

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

func (*WorkerUpdate) Mutation

func (wu *WorkerUpdate) Mutation() *WorkerMutation

Mutation returns the WorkerMutation object of the builder.

func (*WorkerUpdate) RemoveChunkIDs

func (wu *WorkerUpdate) RemoveChunkIDs(ids ...string) *WorkerUpdate

RemoveChunkIDs removes the "chunks" edge to Chunk entities by IDs.

func (*WorkerUpdate) RemoveChunks

func (wu *WorkerUpdate) RemoveChunks(c ...*Chunk) *WorkerUpdate

RemoveChunks removes "chunks" edges to Chunk entities.

func (*WorkerUpdate) Save

func (wu *WorkerUpdate) Save(ctx context.Context) (int, error)

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

func (*WorkerUpdate) SaveX

func (wu *WorkerUpdate) SaveX(ctx context.Context) int

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

func (*WorkerUpdate) SetName

func (wu *WorkerUpdate) SetName(s string) *WorkerUpdate

SetName sets the "name" field.

func (*WorkerUpdate) SetToken

func (wu *WorkerUpdate) SetToken(s string) *WorkerUpdate

SetToken sets the "token" field.

func (*WorkerUpdate) SetUpdatedAt

func (wu *WorkerUpdate) SetUpdatedAt(t time.Time) *WorkerUpdate

SetUpdatedAt sets the "updated_at" field.

func (*WorkerUpdate) Where

func (wu *WorkerUpdate) Where(ps ...predicate.Worker) *WorkerUpdate

Where appends a list predicates to the WorkerUpdate builder.

type WorkerUpdateOne

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

WorkerUpdateOne is the builder for updating a single Worker entity.

func (*WorkerUpdateOne) AddChunkIDs

func (wuo *WorkerUpdateOne) AddChunkIDs(ids ...string) *WorkerUpdateOne

AddChunkIDs adds the "chunks" edge to the Chunk entity by IDs.

func (*WorkerUpdateOne) AddChunks

func (wuo *WorkerUpdateOne) AddChunks(c ...*Chunk) *WorkerUpdateOne

AddChunks adds the "chunks" edges to the Chunk entity.

func (*WorkerUpdateOne) ClearChunks

func (wuo *WorkerUpdateOne) ClearChunks() *WorkerUpdateOne

ClearChunks clears all "chunks" edges to the Chunk entity.

func (*WorkerUpdateOne) Exec

func (wuo *WorkerUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*WorkerUpdateOne) ExecX

func (wuo *WorkerUpdateOne) ExecX(ctx context.Context)

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

func (*WorkerUpdateOne) Mutation

func (wuo *WorkerUpdateOne) Mutation() *WorkerMutation

Mutation returns the WorkerMutation object of the builder.

func (*WorkerUpdateOne) RemoveChunkIDs

func (wuo *WorkerUpdateOne) RemoveChunkIDs(ids ...string) *WorkerUpdateOne

RemoveChunkIDs removes the "chunks" edge to Chunk entities by IDs.

func (*WorkerUpdateOne) RemoveChunks

func (wuo *WorkerUpdateOne) RemoveChunks(c ...*Chunk) *WorkerUpdateOne

RemoveChunks removes "chunks" edges to Chunk entities.

func (*WorkerUpdateOne) Save

func (wuo *WorkerUpdateOne) Save(ctx context.Context) (*Worker, error)

Save executes the query and returns the updated Worker entity.

func (*WorkerUpdateOne) SaveX

func (wuo *WorkerUpdateOne) SaveX(ctx context.Context) *Worker

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

func (*WorkerUpdateOne) Select

func (wuo *WorkerUpdateOne) Select(field string, fields ...string) *WorkerUpdateOne

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

func (*WorkerUpdateOne) SetName

func (wuo *WorkerUpdateOne) SetName(s string) *WorkerUpdateOne

SetName sets the "name" field.

func (*WorkerUpdateOne) SetToken

func (wuo *WorkerUpdateOne) SetToken(s string) *WorkerUpdateOne

SetToken sets the "token" field.

func (*WorkerUpdateOne) SetUpdatedAt

func (wuo *WorkerUpdateOne) SetUpdatedAt(t time.Time) *WorkerUpdateOne

SetUpdatedAt sets the "updated_at" field.

func (*WorkerUpdateOne) Where added in v0.2.0

func (wuo *WorkerUpdateOne) Where(ps ...predicate.Worker) *WorkerUpdateOne

Where appends a list predicates to the WorkerUpdate builder.

type WorkerUpsert added in v0.2.0

type WorkerUpsert struct {
	*sql.UpdateSet
}

WorkerUpsert is the "OnConflict" setter.

func (*WorkerUpsert) SetName added in v0.2.0

func (u *WorkerUpsert) SetName(v string) *WorkerUpsert

SetName sets the "name" field.

func (*WorkerUpsert) SetToken added in v0.2.0

func (u *WorkerUpsert) SetToken(v string) *WorkerUpsert

SetToken sets the "token" field.

func (*WorkerUpsert) SetUpdatedAt added in v0.2.0

func (u *WorkerUpsert) SetUpdatedAt(v time.Time) *WorkerUpsert

SetUpdatedAt sets the "updated_at" field.

func (*WorkerUpsert) UpdateName added in v0.2.0

func (u *WorkerUpsert) UpdateName() *WorkerUpsert

UpdateName sets the "name" field to the value that was provided on create.

func (*WorkerUpsert) UpdateToken added in v0.2.0

func (u *WorkerUpsert) UpdateToken() *WorkerUpsert

UpdateToken sets the "token" field to the value that was provided on create.

func (*WorkerUpsert) UpdateUpdatedAt added in v0.2.0

func (u *WorkerUpsert) UpdateUpdatedAt() *WorkerUpsert

UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create.

type WorkerUpsertBulk added in v0.2.0

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

WorkerUpsertBulk is the builder for "upsert"-ing a bulk of Worker nodes.

func (*WorkerUpsertBulk) DoNothing added in v0.2.0

func (u *WorkerUpsertBulk) DoNothing() *WorkerUpsertBulk

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

func (*WorkerUpsertBulk) Exec added in v0.2.0

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

Exec executes the query.

func (*WorkerUpsertBulk) ExecX added in v0.2.0

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

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

func (*WorkerUpsertBulk) Ignore added in v0.2.0

func (u *WorkerUpsertBulk) Ignore() *WorkerUpsertBulk

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

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

func (*WorkerUpsertBulk) SetName added in v0.2.0

func (u *WorkerUpsertBulk) SetName(v string) *WorkerUpsertBulk

SetName sets the "name" field.

func (*WorkerUpsertBulk) SetToken added in v0.2.0

func (u *WorkerUpsertBulk) SetToken(v string) *WorkerUpsertBulk

SetToken sets the "token" field.

func (*WorkerUpsertBulk) SetUpdatedAt added in v0.2.0

func (u *WorkerUpsertBulk) SetUpdatedAt(v time.Time) *WorkerUpsertBulk

SetUpdatedAt sets the "updated_at" field.

func (*WorkerUpsertBulk) Update added in v0.2.0

func (u *WorkerUpsertBulk) Update(set func(*WorkerUpsert)) *WorkerUpsertBulk

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

func (*WorkerUpsertBulk) UpdateName added in v0.2.0

func (u *WorkerUpsertBulk) UpdateName() *WorkerUpsertBulk

UpdateName sets the "name" field to the value that was provided on create.

func (*WorkerUpsertBulk) UpdateNewValues added in v0.2.0

func (u *WorkerUpsertBulk) UpdateNewValues() *WorkerUpsertBulk

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

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

func (*WorkerUpsertBulk) UpdateToken added in v0.2.0

func (u *WorkerUpsertBulk) UpdateToken() *WorkerUpsertBulk

UpdateToken sets the "token" field to the value that was provided on create.

func (*WorkerUpsertBulk) UpdateUpdatedAt added in v0.2.0

func (u *WorkerUpsertBulk) UpdateUpdatedAt() *WorkerUpsertBulk

UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create.

type WorkerUpsertOne added in v0.2.0

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

WorkerUpsertOne is the builder for "upsert"-ing

one Worker node.

func (*WorkerUpsertOne) DoNothing added in v0.2.0

func (u *WorkerUpsertOne) DoNothing() *WorkerUpsertOne

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

func (*WorkerUpsertOne) Exec added in v0.2.0

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

Exec executes the query.

func (*WorkerUpsertOne) ExecX added in v0.2.0

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

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

func (*WorkerUpsertOne) ID added in v0.2.0

func (u *WorkerUpsertOne) ID(ctx context.Context) (id uuid.UUID, err error)

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

func (*WorkerUpsertOne) IDX added in v0.2.0

func (u *WorkerUpsertOne) IDX(ctx context.Context) uuid.UUID

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

func (*WorkerUpsertOne) Ignore added in v0.2.0

func (u *WorkerUpsertOne) Ignore() *WorkerUpsertOne

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

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

func (*WorkerUpsertOne) SetName added in v0.2.0

func (u *WorkerUpsertOne) SetName(v string) *WorkerUpsertOne

SetName sets the "name" field.

func (*WorkerUpsertOne) SetToken added in v0.2.0

func (u *WorkerUpsertOne) SetToken(v string) *WorkerUpsertOne

SetToken sets the "token" field.

func (*WorkerUpsertOne) SetUpdatedAt added in v0.2.0

func (u *WorkerUpsertOne) SetUpdatedAt(v time.Time) *WorkerUpsertOne

SetUpdatedAt sets the "updated_at" field.

func (*WorkerUpsertOne) Update added in v0.2.0

func (u *WorkerUpsertOne) Update(set func(*WorkerUpsert)) *WorkerUpsertOne

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

func (*WorkerUpsertOne) UpdateName added in v0.2.0

func (u *WorkerUpsertOne) UpdateName() *WorkerUpsertOne

UpdateName sets the "name" field to the value that was provided on create.

func (*WorkerUpsertOne) UpdateNewValues added in v0.2.0

func (u *WorkerUpsertOne) UpdateNewValues() *WorkerUpsertOne

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

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

func (*WorkerUpsertOne) UpdateToken added in v0.2.0

func (u *WorkerUpsertOne) UpdateToken() *WorkerUpsertOne

UpdateToken sets the "token" field to the value that was provided on create.

func (*WorkerUpsertOne) UpdateUpdatedAt added in v0.2.0

func (u *WorkerUpsertOne) UpdateUpdatedAt() *WorkerUpsertOne

UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create.

type Workers

type Workers []*Worker

Workers is a parsable slice of Worker.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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