ent

package
v1.2.4 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2025 License: AGPL-3.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Operation types.
	OpCreate    = ent.OpCreate
	OpDelete    = ent.OpDelete
	OpDeleteOne = ent.OpDeleteOne
	OpUpdate    = ent.OpUpdate
	OpUpdateOne = ent.OpUpdateOne

	// Node types.
	TypeResource = "Resource"
	TypeStorage  = "Storage"
	TypeVersion  = "Version"
)

Variables

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

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

Functions

func Asc

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

Asc applies the given fields in ASC order.

func Desc

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

Desc applies the given fields in DESC order.

func IsConstraintError

func IsConstraintError(err error) bool

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

func IsNotFound

func IsNotFound(err error) bool

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

func IsNotLoaded

func IsNotLoaded(err error) bool

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

func IsNotSingular

func IsNotSingular(err error) bool

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

func IsValidationError

func IsValidationError(err error) bool

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

func MaskNotFound

func MaskNotFound(err error) error

MaskNotFound masks not found error.

func NewContext

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

NewContext returns a new context with the given Client attached.

func NewTxContext

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

NewTxContext returns a new context with the given Tx attached.

Types

type AggregateFunc

type AggregateFunc func(*sql.Selector) string

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

func As

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

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

func Count

func Count() AggregateFunc

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

func Max

func Max(field string) AggregateFunc

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

func Mean

func Mean(field string) AggregateFunc

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

func Min

func Min(field string) AggregateFunc

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

func Sum

func Sum(field string) AggregateFunc

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

type Client

type Client struct {

	// Schema is the client for creating, migrating and dropping schema.
	Schema *migrate.Schema
	// Resource is the client for interacting with the Resource builders.
	Resource *ResourceClient
	// Storage is the client for interacting with the Storage builders.
	Storage *StorageClient
	// Version is the client for interacting with the Version builders.
	Version *VersionClient
	// 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().
	Resource.
	Query().
	Count(ctx)

func (*Client) Intercept

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

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

func (*Client) Mutate

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

Mutate implements the ent.Mutator interface.

func (*Client) Tx

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

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

func (*Client) Use

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

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

type CommitFunc

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

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

func (CommitFunc) Commit

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

Commit calls f(ctx, m).

type CommitHook

type CommitHook func(Committer) Committer

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

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

type Committer

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

Committer is the interface that wraps the Commit method.

type ConstraintError

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

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

func (ConstraintError) Error

func (e ConstraintError) Error() string

Error implements the error interface.

func (*ConstraintError) Unwrap

func (e *ConstraintError) Unwrap() error

Unwrap implements the errors.Wrapper interface.

type Hook

type Hook = ent.Hook

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

type InterceptFunc

type InterceptFunc = ent.InterceptFunc

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

type Interceptor

type Interceptor = ent.Interceptor

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

type MutateFunc

type MutateFunc = ent.MutateFunc

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

type Mutation

type Mutation = ent.Mutation

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

type Mutator

type Mutator = ent.Mutator

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

type NotFoundError

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

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

func (*NotFoundError) Error

func (e *NotFoundError) Error() string

Error implements the error interface.

type NotLoadedError

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

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

func (*NotLoadedError) Error

func (e *NotLoadedError) Error() string

Error implements the error interface.

type NotSingularError

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

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

func (*NotSingularError) Error

func (e *NotSingularError) Error() string

Error implements the error interface.

type Op

type Op = ent.Op

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

type Option

type Option func(*config)

Option function to configure the client.

func Debug

func Debug() Option

Debug enables debug logging on the ent.Driver.

func Driver

func Driver(driver dialect.Driver) Option

Driver configures the client driver.

func Log

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

Log sets the logging function for debug mode.

type OrderFunc

type OrderFunc func(*sql.Selector)

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

type Policy

type Policy = ent.Policy

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

type Querier

type Querier = ent.Querier

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

type QuerierFunc

type QuerierFunc = ent.QuerierFunc

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

type Query

type Query = ent.Query

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

type QueryContext

type QueryContext = ent.QueryContext

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

type Resource

type Resource struct {

	// ID of the ent.
	ID string `json:"id,omitempty"`
	// Name holds the value of the "name" field.
	Name string `json:"name,omitempty"`
	// Description holds the value of the "description" field.
	Description string `json:"description,omitempty"`
	// CreatedAt holds the value of the "created_at" field.
	CreatedAt time.Time `json:"created_at,omitempty"`
	// UpdateType holds the value of the "update_type" field.
	UpdateType string `json:"update_type,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the ResourceQuery when eager-loading is set.
	Edges ResourceEdges `json:"edges"`
	// contains filtered or unexported fields
}

Resource is the model entity for the Resource schema.

func (*Resource) QueryVersions

func (r *Resource) QueryVersions() *VersionQuery

QueryVersions queries the "versions" edge of the Resource entity.

func (*Resource) String

func (r *Resource) String() string

String implements the fmt.Stringer.

func (*Resource) Unwrap

func (r *Resource) Unwrap() *Resource

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

func (r *Resource) Update() *ResourceUpdateOne

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

func (*Resource) Value

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

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

type ResourceClient

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

ResourceClient is a client for the Resource schema.

func NewResourceClient

func NewResourceClient(c config) *ResourceClient

NewResourceClient returns a client for the Resource from the given config.

func (*ResourceClient) Create

func (c *ResourceClient) Create() *ResourceCreate

Create returns a builder for creating a Resource entity.

func (*ResourceClient) CreateBulk

func (c *ResourceClient) CreateBulk(builders ...*ResourceCreate) *ResourceCreateBulk

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

func (*ResourceClient) Delete

func (c *ResourceClient) Delete() *ResourceDelete

Delete returns a delete builder for Resource.

func (*ResourceClient) DeleteOne

func (c *ResourceClient) DeleteOne(r *Resource) *ResourceDeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*ResourceClient) DeleteOneID

func (c *ResourceClient) DeleteOneID(id string) *ResourceDeleteOne

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

func (*ResourceClient) Get

func (c *ResourceClient) Get(ctx context.Context, id string) (*Resource, error)

Get returns a Resource entity by its id.

func (*ResourceClient) GetX

func (c *ResourceClient) GetX(ctx context.Context, id string) *Resource

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

func (*ResourceClient) Hooks

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

Hooks returns the client hooks.

func (*ResourceClient) Intercept

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

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

func (*ResourceClient) Interceptors

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

Interceptors returns the client interceptors.

func (*ResourceClient) MapCreateBulk

func (c *ResourceClient) MapCreateBulk(slice any, setFunc func(*ResourceCreate, int)) *ResourceCreateBulk

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

func (*ResourceClient) Query

func (c *ResourceClient) Query() *ResourceQuery

Query returns a query builder for Resource.

func (*ResourceClient) QueryVersions

func (c *ResourceClient) QueryVersions(r *Resource) *VersionQuery

QueryVersions queries the versions edge of a Resource.

func (*ResourceClient) Update

func (c *ResourceClient) Update() *ResourceUpdate

Update returns an update builder for Resource.

func (*ResourceClient) UpdateOne

func (c *ResourceClient) UpdateOne(r *Resource) *ResourceUpdateOne

UpdateOne returns an update builder for the given entity.

func (*ResourceClient) UpdateOneID

func (c *ResourceClient) UpdateOneID(id string) *ResourceUpdateOne

UpdateOneID returns an update builder for the given id.

func (*ResourceClient) Use

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

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

type ResourceCreate

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

ResourceCreate is the builder for creating a Resource entity.

func (*ResourceCreate) AddVersionIDs

func (rc *ResourceCreate) AddVersionIDs(ids ...int) *ResourceCreate

AddVersionIDs adds the "versions" edge to the Version entity by IDs.

func (*ResourceCreate) AddVersions

func (rc *ResourceCreate) AddVersions(v ...*Version) *ResourceCreate

AddVersions adds the "versions" edges to the Version entity.

func (*ResourceCreate) Exec

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

Exec executes the query.

func (*ResourceCreate) ExecX

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

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

func (*ResourceCreate) Mutation

func (rc *ResourceCreate) Mutation() *ResourceMutation

Mutation returns the ResourceMutation object of the builder.

func (*ResourceCreate) Save

func (rc *ResourceCreate) Save(ctx context.Context) (*Resource, error)

Save creates the Resource in the database.

func (*ResourceCreate) SaveX

func (rc *ResourceCreate) SaveX(ctx context.Context) *Resource

SaveX calls Save and panics if Save returns an error.

func (*ResourceCreate) SetCreatedAt

func (rc *ResourceCreate) SetCreatedAt(t time.Time) *ResourceCreate

SetCreatedAt sets the "created_at" field.

func (*ResourceCreate) SetDescription

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

SetDescription sets the "description" field.

func (*ResourceCreate) SetID added in v0.2.0

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

SetID sets the "id" field.

func (*ResourceCreate) SetName

func (rc *ResourceCreate) SetName(s string) *ResourceCreate

SetName sets the "name" field.

func (*ResourceCreate) SetNillableCreatedAt

func (rc *ResourceCreate) SetNillableCreatedAt(t *time.Time) *ResourceCreate

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

func (*ResourceCreate) SetNillableUpdateType added in v0.5.1

func (rc *ResourceCreate) SetNillableUpdateType(s *string) *ResourceCreate

SetNillableUpdateType sets the "update_type" field if the given value is not nil.

func (*ResourceCreate) SetUpdateType added in v0.5.1

func (rc *ResourceCreate) SetUpdateType(s string) *ResourceCreate

SetUpdateType sets the "update_type" field.

type ResourceCreateBulk

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

ResourceCreateBulk is the builder for creating many Resource entities in bulk.

func (*ResourceCreateBulk) Exec

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

Exec executes the query.

func (*ResourceCreateBulk) ExecX

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

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

func (*ResourceCreateBulk) Save

func (rcb *ResourceCreateBulk) Save(ctx context.Context) ([]*Resource, error)

Save creates the Resource entities in the database.

func (*ResourceCreateBulk) SaveX

func (rcb *ResourceCreateBulk) SaveX(ctx context.Context) []*Resource

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

type ResourceDelete

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

ResourceDelete is the builder for deleting a Resource entity.

func (*ResourceDelete) Exec

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

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

func (*ResourceDelete) ExecX

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

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

func (*ResourceDelete) Where

func (rd *ResourceDelete) Where(ps ...predicate.Resource) *ResourceDelete

Where appends a list predicates to the ResourceDelete builder.

type ResourceDeleteOne

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

ResourceDeleteOne is the builder for deleting a single Resource entity.

func (*ResourceDeleteOne) Exec

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

Exec executes the deletion query.

func (*ResourceDeleteOne) ExecX

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

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

func (*ResourceDeleteOne) Where

Where appends a list predicates to the ResourceDelete builder.

type ResourceEdges

type ResourceEdges struct {
	// Versions holds the value of the versions edge.
	Versions []*Version `json:"versions,omitempty"`
	// contains filtered or unexported fields
}

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

func (ResourceEdges) VersionsOrErr

func (e ResourceEdges) VersionsOrErr() ([]*Version, error)

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

type ResourceGroupBy

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

ResourceGroupBy is the group-by builder for Resource entities.

func (*ResourceGroupBy) Aggregate

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

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

func (*ResourceGroupBy) Bool

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

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

func (*ResourceGroupBy) BoolX

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

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

func (*ResourceGroupBy) Bools

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

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

func (*ResourceGroupBy) BoolsX

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

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

func (*ResourceGroupBy) Float64

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

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

func (*ResourceGroupBy) Float64X

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

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

func (*ResourceGroupBy) Float64s

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

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

func (*ResourceGroupBy) Float64sX

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

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

func (*ResourceGroupBy) Int

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

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

func (*ResourceGroupBy) IntX

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

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

func (*ResourceGroupBy) Ints

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

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

func (*ResourceGroupBy) IntsX

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

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

func (*ResourceGroupBy) Scan

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

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

func (*ResourceGroupBy) ScanX

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

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

func (*ResourceGroupBy) String

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

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

func (*ResourceGroupBy) StringX

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

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

func (*ResourceGroupBy) Strings

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

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

func (*ResourceGroupBy) StringsX

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

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

type ResourceMutation

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

ResourceMutation represents an operation that mutates the Resource nodes in the graph.

func (*ResourceMutation) AddField

func (m *ResourceMutation) 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 (*ResourceMutation) AddVersionIDs

func (m *ResourceMutation) AddVersionIDs(ids ...int)

AddVersionIDs adds the "versions" edge to the Version entity by ids.

func (*ResourceMutation) AddedEdges

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

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

func (*ResourceMutation) AddedField

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

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

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

func (*ResourceMutation) AddedIDs

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

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

func (*ResourceMutation) ClearEdge

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

func (m *ResourceMutation) 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 (*ResourceMutation) ClearVersions

func (m *ResourceMutation) ClearVersions()

ClearVersions clears the "versions" edge to the Version entity.

func (*ResourceMutation) ClearedEdges

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

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

func (*ResourceMutation) ClearedFields

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

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

func (ResourceMutation) Client

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

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

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

func (*ResourceMutation) Description

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

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

func (*ResourceMutation) EdgeCleared

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

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

func (*ResourceMutation) Field

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

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

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

func (*ResourceMutation) Fields

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

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

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

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

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

func (*ResourceMutation) OldCreatedAt

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

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

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

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

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

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

OldName returns the old "name" field's value of the Resource entity. If the Resource 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 (*ResourceMutation) OldUpdateType added in v0.5.1

func (m *ResourceMutation) OldUpdateType(ctx context.Context) (v string, err error)

OldUpdateType returns the old "update_type" field's value of the Resource entity. If the Resource 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 (*ResourceMutation) Op

func (m *ResourceMutation) Op() Op

Op returns the operation name.

func (*ResourceMutation) RemoveVersionIDs

func (m *ResourceMutation) RemoveVersionIDs(ids ...int)

RemoveVersionIDs removes the "versions" edge to the Version entity by IDs.

func (*ResourceMutation) RemovedEdges

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

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

func (*ResourceMutation) RemovedIDs

func (m *ResourceMutation) 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 (*ResourceMutation) RemovedVersionsIDs

func (m *ResourceMutation) RemovedVersionsIDs() (ids []int)

RemovedVersions returns the removed IDs of the "versions" edge to the Version entity.

func (*ResourceMutation) ResetCreatedAt

func (m *ResourceMutation) ResetCreatedAt()

ResetCreatedAt resets all changes to the "created_at" field.

func (*ResourceMutation) ResetDescription

func (m *ResourceMutation) ResetDescription()

ResetDescription resets all changes to the "description" field.

func (*ResourceMutation) ResetEdge

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

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

func (m *ResourceMutation) ResetName()

ResetName resets all changes to the "name" field.

func (*ResourceMutation) ResetUpdateType added in v0.5.1

func (m *ResourceMutation) ResetUpdateType()

ResetUpdateType resets all changes to the "update_type" field.

func (*ResourceMutation) ResetVersions

func (m *ResourceMutation) ResetVersions()

ResetVersions resets all changes to the "versions" edge.

func (*ResourceMutation) SetCreatedAt

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

SetCreatedAt sets the "created_at" field.

func (*ResourceMutation) SetDescription

func (m *ResourceMutation) SetDescription(s string)

SetDescription sets the "description" field.

func (*ResourceMutation) SetField

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

func (m *ResourceMutation) SetID(id string)

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

func (*ResourceMutation) SetName

func (m *ResourceMutation) SetName(s string)

SetName sets the "name" field.

func (*ResourceMutation) SetOp

func (m *ResourceMutation) SetOp(op Op)

SetOp allows setting the mutation operation.

func (*ResourceMutation) SetUpdateType added in v0.5.1

func (m *ResourceMutation) SetUpdateType(s string)

SetUpdateType sets the "update_type" field.

func (ResourceMutation) Tx

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

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

func (*ResourceMutation) Type

func (m *ResourceMutation) Type() string

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

func (*ResourceMutation) UpdateType added in v0.5.1

func (m *ResourceMutation) UpdateType() (r string, exists bool)

UpdateType returns the value of the "update_type" field in the mutation.

func (*ResourceMutation) VersionsCleared

func (m *ResourceMutation) VersionsCleared() bool

VersionsCleared reports if the "versions" edge to the Version entity was cleared.

func (*ResourceMutation) VersionsIDs

func (m *ResourceMutation) VersionsIDs() (ids []int)

VersionsIDs returns the "versions" edge IDs in the mutation.

func (*ResourceMutation) Where

func (m *ResourceMutation) Where(ps ...predicate.Resource)

Where appends a list predicates to the ResourceMutation builder.

func (*ResourceMutation) WhereP

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

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

type ResourceQuery

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

ResourceQuery is the builder for querying Resource entities.

func (*ResourceQuery) Aggregate

func (rq *ResourceQuery) Aggregate(fns ...AggregateFunc) *ResourceSelect

Aggregate returns a ResourceSelect configured with the given aggregations.

func (*ResourceQuery) All

func (rq *ResourceQuery) All(ctx context.Context) ([]*Resource, error)

All executes the query and returns a list of Resources.

func (*ResourceQuery) AllX

func (rq *ResourceQuery) AllX(ctx context.Context) []*Resource

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

func (*ResourceQuery) Clone

func (rq *ResourceQuery) Clone() *ResourceQuery

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

func (*ResourceQuery) Count

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

Count returns the count of the given query.

func (*ResourceQuery) CountX

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

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

func (*ResourceQuery) Exist

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

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

func (*ResourceQuery) ExistX

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

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

func (*ResourceQuery) First

func (rq *ResourceQuery) First(ctx context.Context) (*Resource, error)

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

func (*ResourceQuery) FirstID

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

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

func (*ResourceQuery) FirstIDX

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

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

func (*ResourceQuery) FirstX

func (rq *ResourceQuery) FirstX(ctx context.Context) *Resource

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

func (*ResourceQuery) GroupBy

func (rq *ResourceQuery) GroupBy(field string, fields ...string) *ResourceGroupBy

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

client.Resource.Query().
	GroupBy(resource.FieldName).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*ResourceQuery) IDs

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

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

func (*ResourceQuery) IDsX

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

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

func (*ResourceQuery) Limit

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

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

func (*ResourceQuery) Offset

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

Offset to start from.

func (*ResourceQuery) Only

func (rq *ResourceQuery) Only(ctx context.Context) (*Resource, error)

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

func (*ResourceQuery) OnlyID

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

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

func (*ResourceQuery) OnlyIDX

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

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

func (*ResourceQuery) OnlyX

func (rq *ResourceQuery) OnlyX(ctx context.Context) *Resource

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

func (*ResourceQuery) Order

Order specifies how the records should be ordered.

func (*ResourceQuery) QueryVersions

func (rq *ResourceQuery) QueryVersions() *VersionQuery

QueryVersions chains the current query on the "versions" edge.

func (*ResourceQuery) Select

func (rq *ResourceQuery) Select(fields ...string) *ResourceSelect

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

client.Resource.Query().
	Select(resource.FieldName).
	Scan(ctx, &v)

func (*ResourceQuery) Unique

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

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

func (rq *ResourceQuery) Where(ps ...predicate.Resource) *ResourceQuery

Where adds a new predicate for the ResourceQuery builder.

func (*ResourceQuery) WithVersions

func (rq *ResourceQuery) WithVersions(opts ...func(*VersionQuery)) *ResourceQuery

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

type ResourceSelect

type ResourceSelect struct {
	*ResourceQuery
	// contains filtered or unexported fields
}

ResourceSelect is the builder for selecting fields of Resource entities.

func (*ResourceSelect) Aggregate

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

Aggregate adds the given aggregation functions to the selector query.

func (*ResourceSelect) Bool

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

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

func (*ResourceSelect) BoolX

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

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

func (*ResourceSelect) Bools

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

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

func (*ResourceSelect) BoolsX

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

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

func (*ResourceSelect) Float64

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

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

func (*ResourceSelect) Float64X

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

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

func (*ResourceSelect) Float64s

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

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

func (*ResourceSelect) Float64sX

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

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

func (*ResourceSelect) Int

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

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

func (*ResourceSelect) IntX

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

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

func (*ResourceSelect) Ints

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

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

func (*ResourceSelect) IntsX

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

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

func (*ResourceSelect) Scan

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

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

func (*ResourceSelect) ScanX

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

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

func (*ResourceSelect) String

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

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

func (*ResourceSelect) StringX

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

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

func (*ResourceSelect) Strings

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

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

func (*ResourceSelect) StringsX

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

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

type ResourceUpdate

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

ResourceUpdate is the builder for updating Resource entities.

func (*ResourceUpdate) AddVersionIDs

func (ru *ResourceUpdate) AddVersionIDs(ids ...int) *ResourceUpdate

AddVersionIDs adds the "versions" edge to the Version entity by IDs.

func (*ResourceUpdate) AddVersions

func (ru *ResourceUpdate) AddVersions(v ...*Version) *ResourceUpdate

AddVersions adds the "versions" edges to the Version entity.

func (*ResourceUpdate) ClearVersions

func (ru *ResourceUpdate) ClearVersions() *ResourceUpdate

ClearVersions clears all "versions" edges to the Version entity.

func (*ResourceUpdate) Exec

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

Exec executes the query.

func (*ResourceUpdate) ExecX

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

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

func (*ResourceUpdate) Mutation

func (ru *ResourceUpdate) Mutation() *ResourceMutation

Mutation returns the ResourceMutation object of the builder.

func (*ResourceUpdate) RemoveVersionIDs

func (ru *ResourceUpdate) RemoveVersionIDs(ids ...int) *ResourceUpdate

RemoveVersionIDs removes the "versions" edge to Version entities by IDs.

func (*ResourceUpdate) RemoveVersions

func (ru *ResourceUpdate) RemoveVersions(v ...*Version) *ResourceUpdate

RemoveVersions removes "versions" edges to Version entities.

func (*ResourceUpdate) Save

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

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

func (*ResourceUpdate) SaveX

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

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

func (*ResourceUpdate) SetCreatedAt

func (ru *ResourceUpdate) SetCreatedAt(t time.Time) *ResourceUpdate

SetCreatedAt sets the "created_at" field.

func (*ResourceUpdate) SetDescription

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

SetDescription sets the "description" field.

func (*ResourceUpdate) SetName

func (ru *ResourceUpdate) SetName(s string) *ResourceUpdate

SetName sets the "name" field.

func (*ResourceUpdate) SetNillableCreatedAt

func (ru *ResourceUpdate) SetNillableCreatedAt(t *time.Time) *ResourceUpdate

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

func (*ResourceUpdate) SetNillableDescription

func (ru *ResourceUpdate) SetNillableDescription(s *string) *ResourceUpdate

SetNillableDescription sets the "description" field if the given value is not nil.

func (*ResourceUpdate) SetNillableName

func (ru *ResourceUpdate) SetNillableName(s *string) *ResourceUpdate

SetNillableName sets the "name" field if the given value is not nil.

func (*ResourceUpdate) SetNillableUpdateType added in v0.5.1

func (ru *ResourceUpdate) SetNillableUpdateType(s *string) *ResourceUpdate

SetNillableUpdateType sets the "update_type" field if the given value is not nil.

func (*ResourceUpdate) SetUpdateType added in v0.5.1

func (ru *ResourceUpdate) SetUpdateType(s string) *ResourceUpdate

SetUpdateType sets the "update_type" field.

func (*ResourceUpdate) Where

func (ru *ResourceUpdate) Where(ps ...predicate.Resource) *ResourceUpdate

Where appends a list predicates to the ResourceUpdate builder.

type ResourceUpdateOne

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

ResourceUpdateOne is the builder for updating a single Resource entity.

func (*ResourceUpdateOne) AddVersionIDs

func (ruo *ResourceUpdateOne) AddVersionIDs(ids ...int) *ResourceUpdateOne

AddVersionIDs adds the "versions" edge to the Version entity by IDs.

func (*ResourceUpdateOne) AddVersions

func (ruo *ResourceUpdateOne) AddVersions(v ...*Version) *ResourceUpdateOne

AddVersions adds the "versions" edges to the Version entity.

func (*ResourceUpdateOne) ClearVersions

func (ruo *ResourceUpdateOne) ClearVersions() *ResourceUpdateOne

ClearVersions clears all "versions" edges to the Version entity.

func (*ResourceUpdateOne) Exec

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

Exec executes the query on the entity.

func (*ResourceUpdateOne) ExecX

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

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

func (*ResourceUpdateOne) Mutation

func (ruo *ResourceUpdateOne) Mutation() *ResourceMutation

Mutation returns the ResourceMutation object of the builder.

func (*ResourceUpdateOne) RemoveVersionIDs

func (ruo *ResourceUpdateOne) RemoveVersionIDs(ids ...int) *ResourceUpdateOne

RemoveVersionIDs removes the "versions" edge to Version entities by IDs.

func (*ResourceUpdateOne) RemoveVersions

func (ruo *ResourceUpdateOne) RemoveVersions(v ...*Version) *ResourceUpdateOne

RemoveVersions removes "versions" edges to Version entities.

func (*ResourceUpdateOne) Save

func (ruo *ResourceUpdateOne) Save(ctx context.Context) (*Resource, error)

Save executes the query and returns the updated Resource entity.

func (*ResourceUpdateOne) SaveX

func (ruo *ResourceUpdateOne) SaveX(ctx context.Context) *Resource

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

func (*ResourceUpdateOne) Select

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

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

func (*ResourceUpdateOne) SetCreatedAt

func (ruo *ResourceUpdateOne) SetCreatedAt(t time.Time) *ResourceUpdateOne

SetCreatedAt sets the "created_at" field.

func (*ResourceUpdateOne) SetDescription

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

SetDescription sets the "description" field.

func (*ResourceUpdateOne) SetName

func (ruo *ResourceUpdateOne) SetName(s string) *ResourceUpdateOne

SetName sets the "name" field.

func (*ResourceUpdateOne) SetNillableCreatedAt

func (ruo *ResourceUpdateOne) SetNillableCreatedAt(t *time.Time) *ResourceUpdateOne

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

func (*ResourceUpdateOne) SetNillableDescription

func (ruo *ResourceUpdateOne) SetNillableDescription(s *string) *ResourceUpdateOne

SetNillableDescription sets the "description" field if the given value is not nil.

func (*ResourceUpdateOne) SetNillableName

func (ruo *ResourceUpdateOne) SetNillableName(s *string) *ResourceUpdateOne

SetNillableName sets the "name" field if the given value is not nil.

func (*ResourceUpdateOne) SetNillableUpdateType added in v0.5.1

func (ruo *ResourceUpdateOne) SetNillableUpdateType(s *string) *ResourceUpdateOne

SetNillableUpdateType sets the "update_type" field if the given value is not nil.

func (*ResourceUpdateOne) SetUpdateType added in v0.5.1

func (ruo *ResourceUpdateOne) SetUpdateType(s string) *ResourceUpdateOne

SetUpdateType sets the "update_type" field.

func (*ResourceUpdateOne) Where

Where appends a list predicates to the ResourceUpdate builder.

type Resources

type Resources []*Resource

Resources is a parsable slice of Resource.

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 Storage

type Storage struct {

	// ID of the ent.
	ID int `json:"id,omitempty"`
	// UpdateType holds the value of the "update_type" field.
	UpdateType storage.UpdateType `json:"update_type,omitempty"`
	// Os holds the value of the "os" field.
	Os string `json:"os,omitempty"`
	// Arch holds the value of the "arch" field.
	Arch string `json:"arch,omitempty"`
	// PackagePath holds the value of the "package_path" field.
	PackagePath string `json:"package_path,omitempty"`
	// PackageHashSha256 holds the value of the "package_hash_sha256" field.
	PackageHashSha256 string `json:"package_hash_sha256,omitempty"`
	// only for full update
	FileType string `json:"file_type,omitempty"`
	// file size
	FileSize int64 `json:"file_size,omitempty"`
	// only for full update
	FileHashes map[string]string `json:"file_hashes,omitempty"`
	// CreatedAt holds the value of the "created_at" field.
	CreatedAt time.Time `json:"created_at,omitempty"`
	// VersionStorages holds the value of the "version_storages" field.
	VersionStorages int `json:"version_storages,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the StorageQuery when eager-loading is set.
	Edges StorageEdges `json:"edges"`
	// contains filtered or unexported fields
}

Storage is the model entity for the Storage schema.

func (*Storage) QueryOldVersion added in v0.3.0

func (s *Storage) QueryOldVersion() *VersionQuery

QueryOldVersion queries the "old_version" edge of the Storage entity.

func (*Storage) QueryVersion

func (s *Storage) QueryVersion() *VersionQuery

QueryVersion queries the "version" edge of the Storage entity.

func (*Storage) String

func (s *Storage) String() string

String implements the fmt.Stringer.

func (*Storage) Unwrap

func (s *Storage) Unwrap() *Storage

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

func (s *Storage) Update() *StorageUpdateOne

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

func (*Storage) Value

func (s *Storage) Value(name string) (ent.Value, error)

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

type StorageClient

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

StorageClient is a client for the Storage schema.

func NewStorageClient

func NewStorageClient(c config) *StorageClient

NewStorageClient returns a client for the Storage from the given config.

func (*StorageClient) Create

func (c *StorageClient) Create() *StorageCreate

Create returns a builder for creating a Storage entity.

func (*StorageClient) CreateBulk

func (c *StorageClient) CreateBulk(builders ...*StorageCreate) *StorageCreateBulk

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

func (*StorageClient) Delete

func (c *StorageClient) Delete() *StorageDelete

Delete returns a delete builder for Storage.

func (*StorageClient) DeleteOne

func (c *StorageClient) DeleteOne(s *Storage) *StorageDeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*StorageClient) DeleteOneID

func (c *StorageClient) DeleteOneID(id int) *StorageDeleteOne

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

func (*StorageClient) Get

func (c *StorageClient) Get(ctx context.Context, id int) (*Storage, error)

Get returns a Storage entity by its id.

func (*StorageClient) GetX

func (c *StorageClient) GetX(ctx context.Context, id int) *Storage

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

func (*StorageClient) Hooks

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

Hooks returns the client hooks.

func (*StorageClient) Intercept

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

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

func (*StorageClient) Interceptors

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

Interceptors returns the client interceptors.

func (*StorageClient) MapCreateBulk

func (c *StorageClient) MapCreateBulk(slice any, setFunc func(*StorageCreate, int)) *StorageCreateBulk

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

func (*StorageClient) Query

func (c *StorageClient) Query() *StorageQuery

Query returns a query builder for Storage.

func (*StorageClient) QueryOldVersion added in v0.3.0

func (c *StorageClient) QueryOldVersion(s *Storage) *VersionQuery

QueryOldVersion queries the old_version edge of a Storage.

func (*StorageClient) QueryVersion

func (c *StorageClient) QueryVersion(s *Storage) *VersionQuery

QueryVersion queries the version edge of a Storage.

func (*StorageClient) Update

func (c *StorageClient) Update() *StorageUpdate

Update returns an update builder for Storage.

func (*StorageClient) UpdateOne

func (c *StorageClient) UpdateOne(s *Storage) *StorageUpdateOne

UpdateOne returns an update builder for the given entity.

func (*StorageClient) UpdateOneID

func (c *StorageClient) UpdateOneID(id int) *StorageUpdateOne

UpdateOneID returns an update builder for the given id.

func (*StorageClient) Use

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

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

type StorageCreate

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

StorageCreate is the builder for creating a Storage entity.

func (*StorageCreate) Exec

func (sc *StorageCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*StorageCreate) ExecX

func (sc *StorageCreate) ExecX(ctx context.Context)

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

func (*StorageCreate) Mutation

func (sc *StorageCreate) Mutation() *StorageMutation

Mutation returns the StorageMutation object of the builder.

func (*StorageCreate) Save

func (sc *StorageCreate) Save(ctx context.Context) (*Storage, error)

Save creates the Storage in the database.

func (*StorageCreate) SaveX

func (sc *StorageCreate) SaveX(ctx context.Context) *Storage

SaveX calls Save and panics if Save returns an error.

func (*StorageCreate) SetArch added in v0.3.0

func (sc *StorageCreate) SetArch(s string) *StorageCreate

SetArch sets the "arch" field.

func (*StorageCreate) SetCreatedAt

func (sc *StorageCreate) SetCreatedAt(t time.Time) *StorageCreate

SetCreatedAt sets the "created_at" field.

func (*StorageCreate) SetFileHashes added in v0.3.0

func (sc *StorageCreate) SetFileHashes(m map[string]string) *StorageCreate

SetFileHashes sets the "file_hashes" field.

func (*StorageCreate) SetFileSize added in v0.12.0

func (sc *StorageCreate) SetFileSize(i int64) *StorageCreate

SetFileSize sets the "file_size" field.

func (*StorageCreate) SetFileType added in v0.12.0

func (sc *StorageCreate) SetFileType(s string) *StorageCreate

SetFileType sets the "file_type" field.

func (*StorageCreate) SetNillableArch added in v0.3.0

func (sc *StorageCreate) SetNillableArch(s *string) *StorageCreate

SetNillableArch sets the "arch" field if the given value is not nil.

func (*StorageCreate) SetNillableCreatedAt

func (sc *StorageCreate) SetNillableCreatedAt(t *time.Time) *StorageCreate

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

func (*StorageCreate) SetNillableFileSize added in v0.12.0

func (sc *StorageCreate) SetNillableFileSize(i *int64) *StorageCreate

SetNillableFileSize sets the "file_size" field if the given value is not nil.

func (*StorageCreate) SetNillableFileType added in v0.12.0

func (sc *StorageCreate) SetNillableFileType(s *string) *StorageCreate

SetNillableFileType sets the "file_type" field if the given value is not nil.

func (*StorageCreate) SetNillableOldVersionID added in v0.3.0

func (sc *StorageCreate) SetNillableOldVersionID(id *int) *StorageCreate

SetNillableOldVersionID sets the "old_version" edge to the Version entity by ID if the given value is not nil.

func (*StorageCreate) SetNillableOs added in v0.3.0

func (sc *StorageCreate) SetNillableOs(s *string) *StorageCreate

SetNillableOs sets the "os" field if the given value is not nil.

func (*StorageCreate) SetNillablePackageHashSha256 added in v0.4.0

func (sc *StorageCreate) SetNillablePackageHashSha256(s *string) *StorageCreate

SetNillablePackageHashSha256 sets the "package_hash_sha256" field if the given value is not nil.

func (*StorageCreate) SetNillablePackagePath added in v0.3.0

func (sc *StorageCreate) SetNillablePackagePath(s *string) *StorageCreate

SetNillablePackagePath sets the "package_path" field if the given value is not nil.

func (*StorageCreate) SetOldVersion added in v0.3.0

func (sc *StorageCreate) SetOldVersion(v *Version) *StorageCreate

SetOldVersion sets the "old_version" edge to the Version entity.

func (*StorageCreate) SetOldVersionID added in v0.3.0

func (sc *StorageCreate) SetOldVersionID(id int) *StorageCreate

SetOldVersionID sets the "old_version" edge to the Version entity by ID.

func (*StorageCreate) SetOs added in v0.3.0

func (sc *StorageCreate) SetOs(s string) *StorageCreate

SetOs sets the "os" field.

func (*StorageCreate) SetPackageHashSha256 added in v0.4.0

func (sc *StorageCreate) SetPackageHashSha256(s string) *StorageCreate

SetPackageHashSha256 sets the "package_hash_sha256" field.

func (*StorageCreate) SetPackagePath added in v0.3.0

func (sc *StorageCreate) SetPackagePath(s string) *StorageCreate

SetPackagePath sets the "package_path" field.

func (*StorageCreate) SetUpdateType added in v0.3.0

func (sc *StorageCreate) SetUpdateType(st storage.UpdateType) *StorageCreate

SetUpdateType sets the "update_type" field.

func (*StorageCreate) SetVersion

func (sc *StorageCreate) SetVersion(v *Version) *StorageCreate

SetVersion sets the "version" edge to the Version entity.

func (*StorageCreate) SetVersionID

func (sc *StorageCreate) SetVersionID(id int) *StorageCreate

SetVersionID sets the "version" edge to the Version entity by ID.

func (*StorageCreate) SetVersionStorages added in v0.5.1

func (sc *StorageCreate) SetVersionStorages(i int) *StorageCreate

SetVersionStorages sets the "version_storages" field.

type StorageCreateBulk

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

StorageCreateBulk is the builder for creating many Storage entities in bulk.

func (*StorageCreateBulk) Exec

func (scb *StorageCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*StorageCreateBulk) ExecX

func (scb *StorageCreateBulk) ExecX(ctx context.Context)

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

func (*StorageCreateBulk) Save

func (scb *StorageCreateBulk) Save(ctx context.Context) ([]*Storage, error)

Save creates the Storage entities in the database.

func (*StorageCreateBulk) SaveX

func (scb *StorageCreateBulk) SaveX(ctx context.Context) []*Storage

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

type StorageDelete

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

StorageDelete is the builder for deleting a Storage entity.

func (*StorageDelete) Exec

func (sd *StorageDelete) Exec(ctx context.Context) (int, error)

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

func (*StorageDelete) ExecX

func (sd *StorageDelete) ExecX(ctx context.Context) int

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

func (*StorageDelete) Where

func (sd *StorageDelete) Where(ps ...predicate.Storage) *StorageDelete

Where appends a list predicates to the StorageDelete builder.

type StorageDeleteOne

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

StorageDeleteOne is the builder for deleting a single Storage entity.

func (*StorageDeleteOne) Exec

func (sdo *StorageDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*StorageDeleteOne) ExecX

func (sdo *StorageDeleteOne) ExecX(ctx context.Context)

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

func (*StorageDeleteOne) Where

Where appends a list predicates to the StorageDelete builder.

type StorageEdges

type StorageEdges struct {
	// Version holds the value of the version edge.
	Version *Version `json:"version,omitempty"`
	// only for incremental update
	OldVersion *Version `json:"old_version,omitempty"`
	// contains filtered or unexported fields
}

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

func (StorageEdges) OldVersionOrErr added in v0.3.0

func (e StorageEdges) OldVersionOrErr() (*Version, error)

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

func (StorageEdges) VersionOrErr

func (e StorageEdges) VersionOrErr() (*Version, error)

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

type StorageGroupBy

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

StorageGroupBy is the group-by builder for Storage entities.

func (*StorageGroupBy) Aggregate

func (sgb *StorageGroupBy) Aggregate(fns ...AggregateFunc) *StorageGroupBy

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

func (*StorageGroupBy) Bool

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

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

func (*StorageGroupBy) BoolX

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

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

func (*StorageGroupBy) Bools

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

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

func (*StorageGroupBy) BoolsX

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

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

func (*StorageGroupBy) Float64

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

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

func (*StorageGroupBy) Float64X

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

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

func (*StorageGroupBy) Float64s

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

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

func (*StorageGroupBy) Float64sX

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

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

func (*StorageGroupBy) Int

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

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

func (*StorageGroupBy) IntX

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

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

func (*StorageGroupBy) Ints

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

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

func (*StorageGroupBy) IntsX

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

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

func (*StorageGroupBy) Scan

func (sgb *StorageGroupBy) Scan(ctx context.Context, v any) error

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

func (*StorageGroupBy) ScanX

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

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

func (*StorageGroupBy) String

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

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

func (*StorageGroupBy) StringX

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

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

func (*StorageGroupBy) Strings

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

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

func (*StorageGroupBy) StringsX

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

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

type StorageMutation

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

StorageMutation represents an operation that mutates the Storage nodes in the graph.

func (*StorageMutation) AddField

func (m *StorageMutation) 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 (*StorageMutation) AddFileSize added in v0.12.0

func (m *StorageMutation) AddFileSize(i int64)

AddFileSize adds i to the "file_size" field.

func (*StorageMutation) AddedEdges

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

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

func (*StorageMutation) AddedField

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

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

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

func (*StorageMutation) AddedFileSize added in v0.12.0

func (m *StorageMutation) AddedFileSize() (r int64, exists bool)

AddedFileSize returns the value that was added to the "file_size" field in this mutation.

func (*StorageMutation) AddedIDs

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

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

func (*StorageMutation) Arch added in v0.3.0

func (m *StorageMutation) Arch() (r string, exists bool)

Arch returns the value of the "arch" field in the mutation.

func (*StorageMutation) ClearEdge

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

func (m *StorageMutation) 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 (*StorageMutation) ClearFileHashes added in v0.3.0

func (m *StorageMutation) ClearFileHashes()

ClearFileHashes clears the value of the "file_hashes" field.

func (*StorageMutation) ClearFileType added in v0.12.0

func (m *StorageMutation) ClearFileType()

ClearFileType clears the value of the "file_type" field.

func (*StorageMutation) ClearOldVersion added in v0.3.0

func (m *StorageMutation) ClearOldVersion()

ClearOldVersion clears the "old_version" edge to the Version entity.

func (*StorageMutation) ClearPackageHashSha256 added in v0.4.0

func (m *StorageMutation) ClearPackageHashSha256()

ClearPackageHashSha256 clears the value of the "package_hash_sha256" field.

func (*StorageMutation) ClearPackagePath added in v0.3.0

func (m *StorageMutation) ClearPackagePath()

ClearPackagePath clears the value of the "package_path" field.

func (*StorageMutation) ClearVersion

func (m *StorageMutation) ClearVersion()

ClearVersion clears the "version" edge to the Version entity.

func (*StorageMutation) ClearedEdges

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

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

func (*StorageMutation) ClearedFields

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

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

func (StorageMutation) Client

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

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

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

func (*StorageMutation) EdgeCleared

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

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

func (*StorageMutation) Field

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

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

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

func (*StorageMutation) Fields

func (m *StorageMutation) 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 (*StorageMutation) FileHashes added in v0.3.0

func (m *StorageMutation) FileHashes() (r map[string]string, exists bool)

FileHashes returns the value of the "file_hashes" field in the mutation.

func (*StorageMutation) FileHashesCleared added in v0.3.0

func (m *StorageMutation) FileHashesCleared() bool

FileHashesCleared returns if the "file_hashes" field was cleared in this mutation.

func (*StorageMutation) FileSize added in v0.12.0

func (m *StorageMutation) FileSize() (r int64, exists bool)

FileSize returns the value of the "file_size" field in the mutation.

func (*StorageMutation) FileType added in v0.12.0

func (m *StorageMutation) FileType() (r string, exists bool)

FileType returns the value of the "file_type" field in the mutation.

func (*StorageMutation) FileTypeCleared added in v0.12.0

func (m *StorageMutation) FileTypeCleared() bool

FileTypeCleared returns if the "file_type" field was cleared in this mutation.

func (*StorageMutation) ID

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

func (m *StorageMutation) IDs(ctx context.Context) ([]int, 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 (*StorageMutation) OldArch added in v0.3.0

func (m *StorageMutation) OldArch(ctx context.Context) (v string, err error)

OldArch returns the old "arch" field's value of the Storage entity. If the Storage 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 (*StorageMutation) OldCreatedAt

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

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

func (m *StorageMutation) 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 (*StorageMutation) OldFileHashes added in v0.3.0

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

OldFileHashes returns the old "file_hashes" field's value of the Storage entity. If the Storage 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 (*StorageMutation) OldFileSize added in v0.12.0

func (m *StorageMutation) OldFileSize(ctx context.Context) (v int64, err error)

OldFileSize returns the old "file_size" field's value of the Storage entity. If the Storage 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 (*StorageMutation) OldFileType added in v0.12.0

func (m *StorageMutation) OldFileType(ctx context.Context) (v string, err error)

OldFileType returns the old "file_type" field's value of the Storage entity. If the Storage 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 (*StorageMutation) OldOs added in v0.3.0

func (m *StorageMutation) OldOs(ctx context.Context) (v string, err error)

OldOs returns the old "os" field's value of the Storage entity. If the Storage 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 (*StorageMutation) OldPackageHashSha256 added in v0.4.0

func (m *StorageMutation) OldPackageHashSha256(ctx context.Context) (v string, err error)

OldPackageHashSha256 returns the old "package_hash_sha256" field's value of the Storage entity. If the Storage 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 (*StorageMutation) OldPackagePath added in v0.3.0

func (m *StorageMutation) OldPackagePath(ctx context.Context) (v string, err error)

OldPackagePath returns the old "package_path" field's value of the Storage entity. If the Storage 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 (*StorageMutation) OldUpdateType added in v0.3.0

func (m *StorageMutation) OldUpdateType(ctx context.Context) (v storage.UpdateType, err error)

OldUpdateType returns the old "update_type" field's value of the Storage entity. If the Storage 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 (*StorageMutation) OldVersionCleared added in v0.3.0

func (m *StorageMutation) OldVersionCleared() bool

OldVersionCleared reports if the "old_version" edge to the Version entity was cleared.

func (*StorageMutation) OldVersionID added in v0.3.0

func (m *StorageMutation) OldVersionID() (id int, exists bool)

OldVersionID returns the "old_version" edge ID in the mutation.

func (*StorageMutation) OldVersionIDs added in v0.3.0

func (m *StorageMutation) OldVersionIDs() (ids []int)

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

func (*StorageMutation) OldVersionStorages added in v0.5.1

func (m *StorageMutation) OldVersionStorages(ctx context.Context) (v int, err error)

OldVersionStorages returns the old "version_storages" field's value of the Storage entity. If the Storage 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 (*StorageMutation) Op

func (m *StorageMutation) Op() Op

Op returns the operation name.

func (*StorageMutation) Os added in v0.3.0

func (m *StorageMutation) Os() (r string, exists bool)

Os returns the value of the "os" field in the mutation.

func (*StorageMutation) PackageHashSha256 added in v0.4.0

func (m *StorageMutation) PackageHashSha256() (r string, exists bool)

PackageHashSha256 returns the value of the "package_hash_sha256" field in the mutation.

func (*StorageMutation) PackageHashSha256Cleared added in v0.4.0

func (m *StorageMutation) PackageHashSha256Cleared() bool

PackageHashSha256Cleared returns if the "package_hash_sha256" field was cleared in this mutation.

func (*StorageMutation) PackagePath added in v0.3.0

func (m *StorageMutation) PackagePath() (r string, exists bool)

PackagePath returns the value of the "package_path" field in the mutation.

func (*StorageMutation) PackagePathCleared added in v0.3.0

func (m *StorageMutation) PackagePathCleared() bool

PackagePathCleared returns if the "package_path" field was cleared in this mutation.

func (*StorageMutation) RemovedEdges

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

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

func (*StorageMutation) RemovedIDs

func (m *StorageMutation) 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 (*StorageMutation) ResetArch added in v0.3.0

func (m *StorageMutation) ResetArch()

ResetArch resets all changes to the "arch" field.

func (*StorageMutation) ResetCreatedAt

func (m *StorageMutation) ResetCreatedAt()

ResetCreatedAt resets all changes to the "created_at" field.

func (*StorageMutation) ResetEdge

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

func (m *StorageMutation) 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 (*StorageMutation) ResetFileHashes added in v0.3.0

func (m *StorageMutation) ResetFileHashes()

ResetFileHashes resets all changes to the "file_hashes" field.

func (*StorageMutation) ResetFileSize added in v0.12.0

func (m *StorageMutation) ResetFileSize()

ResetFileSize resets all changes to the "file_size" field.

func (*StorageMutation) ResetFileType added in v0.12.0

func (m *StorageMutation) ResetFileType()

ResetFileType resets all changes to the "file_type" field.

func (*StorageMutation) ResetOldVersion added in v0.3.0

func (m *StorageMutation) ResetOldVersion()

ResetOldVersion resets all changes to the "old_version" edge.

func (*StorageMutation) ResetOs added in v0.3.0

func (m *StorageMutation) ResetOs()

ResetOs resets all changes to the "os" field.

func (*StorageMutation) ResetPackageHashSha256 added in v0.4.0

func (m *StorageMutation) ResetPackageHashSha256()

ResetPackageHashSha256 resets all changes to the "package_hash_sha256" field.

func (*StorageMutation) ResetPackagePath added in v0.3.0

func (m *StorageMutation) ResetPackagePath()

ResetPackagePath resets all changes to the "package_path" field.

func (*StorageMutation) ResetUpdateType added in v0.3.0

func (m *StorageMutation) ResetUpdateType()

ResetUpdateType resets all changes to the "update_type" field.

func (*StorageMutation) ResetVersion

func (m *StorageMutation) ResetVersion()

ResetVersion resets all changes to the "version" edge.

func (*StorageMutation) ResetVersionStorages added in v0.5.1

func (m *StorageMutation) ResetVersionStorages()

ResetVersionStorages resets all changes to the "version_storages" field.

func (*StorageMutation) SetArch added in v0.3.0

func (m *StorageMutation) SetArch(s string)

SetArch sets the "arch" field.

func (*StorageMutation) SetCreatedAt

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

SetCreatedAt sets the "created_at" field.

func (*StorageMutation) SetField

func (m *StorageMutation) 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 (*StorageMutation) SetFileHashes added in v0.3.0

func (m *StorageMutation) SetFileHashes(value map[string]string)

SetFileHashes sets the "file_hashes" field.

func (*StorageMutation) SetFileSize added in v0.12.0

func (m *StorageMutation) SetFileSize(i int64)

SetFileSize sets the "file_size" field.

func (*StorageMutation) SetFileType added in v0.12.0

func (m *StorageMutation) SetFileType(s string)

SetFileType sets the "file_type" field.

func (*StorageMutation) SetOldVersionID added in v0.3.0

func (m *StorageMutation) SetOldVersionID(id int)

SetOldVersionID sets the "old_version" edge to the Version entity by id.

func (*StorageMutation) SetOp

func (m *StorageMutation) SetOp(op Op)

SetOp allows setting the mutation operation.

func (*StorageMutation) SetOs added in v0.3.0

func (m *StorageMutation) SetOs(s string)

SetOs sets the "os" field.

func (*StorageMutation) SetPackageHashSha256 added in v0.4.0

func (m *StorageMutation) SetPackageHashSha256(s string)

SetPackageHashSha256 sets the "package_hash_sha256" field.

func (*StorageMutation) SetPackagePath added in v0.3.0

func (m *StorageMutation) SetPackagePath(s string)

SetPackagePath sets the "package_path" field.

func (*StorageMutation) SetUpdateType added in v0.3.0

func (m *StorageMutation) SetUpdateType(st storage.UpdateType)

SetUpdateType sets the "update_type" field.

func (*StorageMutation) SetVersionID

func (m *StorageMutation) SetVersionID(id int)

SetVersionID sets the "version" edge to the Version entity by id.

func (*StorageMutation) SetVersionStorages added in v0.5.1

func (m *StorageMutation) SetVersionStorages(i int)

SetVersionStorages sets the "version_storages" field.

func (StorageMutation) Tx

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

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

func (*StorageMutation) Type

func (m *StorageMutation) Type() string

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

func (*StorageMutation) UpdateType added in v0.3.0

func (m *StorageMutation) UpdateType() (r storage.UpdateType, exists bool)

UpdateType returns the value of the "update_type" field in the mutation.

func (*StorageMutation) VersionCleared

func (m *StorageMutation) VersionCleared() bool

VersionCleared reports if the "version" edge to the Version entity was cleared.

func (*StorageMutation) VersionID

func (m *StorageMutation) VersionID() (id int, exists bool)

VersionID returns the "version" edge ID in the mutation.

func (*StorageMutation) VersionIDs

func (m *StorageMutation) VersionIDs() (ids []int)

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

func (*StorageMutation) VersionStorages added in v0.5.1

func (m *StorageMutation) VersionStorages() (r int, exists bool)

VersionStorages returns the value of the "version_storages" field in the mutation.

func (*StorageMutation) Where

func (m *StorageMutation) Where(ps ...predicate.Storage)

Where appends a list predicates to the StorageMutation builder.

func (*StorageMutation) WhereP

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

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

type StorageQuery

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

StorageQuery is the builder for querying Storage entities.

func (*StorageQuery) Aggregate

func (sq *StorageQuery) Aggregate(fns ...AggregateFunc) *StorageSelect

Aggregate returns a StorageSelect configured with the given aggregations.

func (*StorageQuery) All

func (sq *StorageQuery) All(ctx context.Context) ([]*Storage, error)

All executes the query and returns a list of Storages.

func (*StorageQuery) AllX

func (sq *StorageQuery) AllX(ctx context.Context) []*Storage

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

func (*StorageQuery) Clone

func (sq *StorageQuery) Clone() *StorageQuery

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

func (*StorageQuery) Count

func (sq *StorageQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*StorageQuery) CountX

func (sq *StorageQuery) CountX(ctx context.Context) int

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

func (*StorageQuery) Exist

func (sq *StorageQuery) Exist(ctx context.Context) (bool, error)

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

func (*StorageQuery) ExistX

func (sq *StorageQuery) ExistX(ctx context.Context) bool

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

func (*StorageQuery) First

func (sq *StorageQuery) First(ctx context.Context) (*Storage, error)

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

func (*StorageQuery) FirstID

func (sq *StorageQuery) FirstID(ctx context.Context) (id int, err error)

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

func (*StorageQuery) FirstIDX

func (sq *StorageQuery) FirstIDX(ctx context.Context) int

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

func (*StorageQuery) FirstX

func (sq *StorageQuery) FirstX(ctx context.Context) *Storage

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

func (*StorageQuery) GroupBy

func (sq *StorageQuery) GroupBy(field string, fields ...string) *StorageGroupBy

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 {
	UpdateType storage.UpdateType `json:"update_type,omitempty"`
	Count int `json:"count,omitempty"`
}

client.Storage.Query().
	GroupBy(storage.FieldUpdateType).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*StorageQuery) IDs

func (sq *StorageQuery) IDs(ctx context.Context) (ids []int, err error)

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

func (*StorageQuery) IDsX

func (sq *StorageQuery) IDsX(ctx context.Context) []int

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

func (*StorageQuery) Limit

func (sq *StorageQuery) Limit(limit int) *StorageQuery

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

func (*StorageQuery) Offset

func (sq *StorageQuery) Offset(offset int) *StorageQuery

Offset to start from.

func (*StorageQuery) Only

func (sq *StorageQuery) Only(ctx context.Context) (*Storage, error)

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

func (*StorageQuery) OnlyID

func (sq *StorageQuery) OnlyID(ctx context.Context) (id int, err error)

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

func (*StorageQuery) OnlyIDX

func (sq *StorageQuery) OnlyIDX(ctx context.Context) int

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

func (*StorageQuery) OnlyX

func (sq *StorageQuery) OnlyX(ctx context.Context) *Storage

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

func (*StorageQuery) Order

func (sq *StorageQuery) Order(o ...storage.OrderOption) *StorageQuery

Order specifies how the records should be ordered.

func (*StorageQuery) QueryOldVersion added in v0.3.0

func (sq *StorageQuery) QueryOldVersion() *VersionQuery

QueryOldVersion chains the current query on the "old_version" edge.

func (*StorageQuery) QueryVersion

func (sq *StorageQuery) QueryVersion() *VersionQuery

QueryVersion chains the current query on the "version" edge.

func (*StorageQuery) Select

func (sq *StorageQuery) Select(fields ...string) *StorageSelect

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 {
	UpdateType storage.UpdateType `json:"update_type,omitempty"`
}

client.Storage.Query().
	Select(storage.FieldUpdateType).
	Scan(ctx, &v)

func (*StorageQuery) Unique

func (sq *StorageQuery) Unique(unique bool) *StorageQuery

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

func (sq *StorageQuery) Where(ps ...predicate.Storage) *StorageQuery

Where adds a new predicate for the StorageQuery builder.

func (*StorageQuery) WithOldVersion added in v0.3.0

func (sq *StorageQuery) WithOldVersion(opts ...func(*VersionQuery)) *StorageQuery

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

func (*StorageQuery) WithVersion

func (sq *StorageQuery) WithVersion(opts ...func(*VersionQuery)) *StorageQuery

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

type StorageSelect

type StorageSelect struct {
	*StorageQuery
	// contains filtered or unexported fields
}

StorageSelect is the builder for selecting fields of Storage entities.

func (*StorageSelect) Aggregate

func (ss *StorageSelect) Aggregate(fns ...AggregateFunc) *StorageSelect

Aggregate adds the given aggregation functions to the selector query.

func (*StorageSelect) Bool

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

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

func (*StorageSelect) BoolX

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

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

func (*StorageSelect) Bools

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

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

func (*StorageSelect) BoolsX

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

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

func (*StorageSelect) Float64

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

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

func (*StorageSelect) Float64X

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

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

func (*StorageSelect) Float64s

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

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

func (*StorageSelect) Float64sX

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

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

func (*StorageSelect) Int

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

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

func (*StorageSelect) IntX

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

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

func (*StorageSelect) Ints

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

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

func (*StorageSelect) IntsX

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

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

func (*StorageSelect) Scan

func (ss *StorageSelect) Scan(ctx context.Context, v any) error

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

func (*StorageSelect) ScanX

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

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

func (*StorageSelect) String

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

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

func (*StorageSelect) StringX

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

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

func (*StorageSelect) Strings

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

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

func (*StorageSelect) StringsX

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

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

type StorageUpdate

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

StorageUpdate is the builder for updating Storage entities.

func (*StorageUpdate) AddFileSize added in v0.12.0

func (su *StorageUpdate) AddFileSize(i int64) *StorageUpdate

AddFileSize adds i to the "file_size" field.

func (*StorageUpdate) ClearFileHashes added in v0.3.0

func (su *StorageUpdate) ClearFileHashes() *StorageUpdate

ClearFileHashes clears the value of the "file_hashes" field.

func (*StorageUpdate) ClearFileType added in v0.12.0

func (su *StorageUpdate) ClearFileType() *StorageUpdate

ClearFileType clears the value of the "file_type" field.

func (*StorageUpdate) ClearOldVersion added in v0.3.0

func (su *StorageUpdate) ClearOldVersion() *StorageUpdate

ClearOldVersion clears the "old_version" edge to the Version entity.

func (*StorageUpdate) ClearPackageHashSha256 added in v0.4.0

func (su *StorageUpdate) ClearPackageHashSha256() *StorageUpdate

ClearPackageHashSha256 clears the value of the "package_hash_sha256" field.

func (*StorageUpdate) ClearPackagePath added in v0.3.0

func (su *StorageUpdate) ClearPackagePath() *StorageUpdate

ClearPackagePath clears the value of the "package_path" field.

func (*StorageUpdate) ClearVersion

func (su *StorageUpdate) ClearVersion() *StorageUpdate

ClearVersion clears the "version" edge to the Version entity.

func (*StorageUpdate) Exec

func (su *StorageUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*StorageUpdate) ExecX

func (su *StorageUpdate) ExecX(ctx context.Context)

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

func (*StorageUpdate) Mutation

func (su *StorageUpdate) Mutation() *StorageMutation

Mutation returns the StorageMutation object of the builder.

func (*StorageUpdate) Save

func (su *StorageUpdate) Save(ctx context.Context) (int, error)

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

func (*StorageUpdate) SaveX

func (su *StorageUpdate) SaveX(ctx context.Context) int

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

func (*StorageUpdate) SetArch added in v0.3.0

func (su *StorageUpdate) SetArch(s string) *StorageUpdate

SetArch sets the "arch" field.

func (*StorageUpdate) SetCreatedAt

func (su *StorageUpdate) SetCreatedAt(t time.Time) *StorageUpdate

SetCreatedAt sets the "created_at" field.

func (*StorageUpdate) SetFileHashes added in v0.3.0

func (su *StorageUpdate) SetFileHashes(m map[string]string) *StorageUpdate

SetFileHashes sets the "file_hashes" field.

func (*StorageUpdate) SetFileSize added in v0.12.0

func (su *StorageUpdate) SetFileSize(i int64) *StorageUpdate

SetFileSize sets the "file_size" field.

func (*StorageUpdate) SetFileType added in v0.12.0

func (su *StorageUpdate) SetFileType(s string) *StorageUpdate

SetFileType sets the "file_type" field.

func (*StorageUpdate) SetNillableArch added in v0.3.0

func (su *StorageUpdate) SetNillableArch(s *string) *StorageUpdate

SetNillableArch sets the "arch" field if the given value is not nil.

func (*StorageUpdate) SetNillableCreatedAt

func (su *StorageUpdate) SetNillableCreatedAt(t *time.Time) *StorageUpdate

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

func (*StorageUpdate) SetNillableFileSize added in v0.12.0

func (su *StorageUpdate) SetNillableFileSize(i *int64) *StorageUpdate

SetNillableFileSize sets the "file_size" field if the given value is not nil.

func (*StorageUpdate) SetNillableFileType added in v0.12.0

func (su *StorageUpdate) SetNillableFileType(s *string) *StorageUpdate

SetNillableFileType sets the "file_type" field if the given value is not nil.

func (*StorageUpdate) SetNillableOldVersionID added in v0.3.0

func (su *StorageUpdate) SetNillableOldVersionID(id *int) *StorageUpdate

SetNillableOldVersionID sets the "old_version" edge to the Version entity by ID if the given value is not nil.

func (*StorageUpdate) SetNillableOs added in v0.3.0

func (su *StorageUpdate) SetNillableOs(s *string) *StorageUpdate

SetNillableOs sets the "os" field if the given value is not nil.

func (*StorageUpdate) SetNillablePackageHashSha256 added in v0.4.0

func (su *StorageUpdate) SetNillablePackageHashSha256(s *string) *StorageUpdate

SetNillablePackageHashSha256 sets the "package_hash_sha256" field if the given value is not nil.

func (*StorageUpdate) SetNillablePackagePath added in v0.3.0

func (su *StorageUpdate) SetNillablePackagePath(s *string) *StorageUpdate

SetNillablePackagePath sets the "package_path" field if the given value is not nil.

func (*StorageUpdate) SetNillableUpdateType added in v0.3.0

func (su *StorageUpdate) SetNillableUpdateType(st *storage.UpdateType) *StorageUpdate

SetNillableUpdateType sets the "update_type" field if the given value is not nil.

func (*StorageUpdate) SetNillableVersionStorages added in v0.5.1

func (su *StorageUpdate) SetNillableVersionStorages(i *int) *StorageUpdate

SetNillableVersionStorages sets the "version_storages" field if the given value is not nil.

func (*StorageUpdate) SetOldVersion added in v0.3.0

func (su *StorageUpdate) SetOldVersion(v *Version) *StorageUpdate

SetOldVersion sets the "old_version" edge to the Version entity.

func (*StorageUpdate) SetOldVersionID added in v0.3.0

func (su *StorageUpdate) SetOldVersionID(id int) *StorageUpdate

SetOldVersionID sets the "old_version" edge to the Version entity by ID.

func (*StorageUpdate) SetOs added in v0.3.0

func (su *StorageUpdate) SetOs(s string) *StorageUpdate

SetOs sets the "os" field.

func (*StorageUpdate) SetPackageHashSha256 added in v0.4.0

func (su *StorageUpdate) SetPackageHashSha256(s string) *StorageUpdate

SetPackageHashSha256 sets the "package_hash_sha256" field.

func (*StorageUpdate) SetPackagePath added in v0.3.0

func (su *StorageUpdate) SetPackagePath(s string) *StorageUpdate

SetPackagePath sets the "package_path" field.

func (*StorageUpdate) SetUpdateType added in v0.3.0

func (su *StorageUpdate) SetUpdateType(st storage.UpdateType) *StorageUpdate

SetUpdateType sets the "update_type" field.

func (*StorageUpdate) SetVersion

func (su *StorageUpdate) SetVersion(v *Version) *StorageUpdate

SetVersion sets the "version" edge to the Version entity.

func (*StorageUpdate) SetVersionID

func (su *StorageUpdate) SetVersionID(id int) *StorageUpdate

SetVersionID sets the "version" edge to the Version entity by ID.

func (*StorageUpdate) SetVersionStorages added in v0.5.1

func (su *StorageUpdate) SetVersionStorages(i int) *StorageUpdate

SetVersionStorages sets the "version_storages" field.

func (*StorageUpdate) Where

func (su *StorageUpdate) Where(ps ...predicate.Storage) *StorageUpdate

Where appends a list predicates to the StorageUpdate builder.

type StorageUpdateOne

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

StorageUpdateOne is the builder for updating a single Storage entity.

func (*StorageUpdateOne) AddFileSize added in v0.12.0

func (suo *StorageUpdateOne) AddFileSize(i int64) *StorageUpdateOne

AddFileSize adds i to the "file_size" field.

func (*StorageUpdateOne) ClearFileHashes added in v0.3.0

func (suo *StorageUpdateOne) ClearFileHashes() *StorageUpdateOne

ClearFileHashes clears the value of the "file_hashes" field.

func (*StorageUpdateOne) ClearFileType added in v0.12.0

func (suo *StorageUpdateOne) ClearFileType() *StorageUpdateOne

ClearFileType clears the value of the "file_type" field.

func (*StorageUpdateOne) ClearOldVersion added in v0.3.0

func (suo *StorageUpdateOne) ClearOldVersion() *StorageUpdateOne

ClearOldVersion clears the "old_version" edge to the Version entity.

func (*StorageUpdateOne) ClearPackageHashSha256 added in v0.4.0

func (suo *StorageUpdateOne) ClearPackageHashSha256() *StorageUpdateOne

ClearPackageHashSha256 clears the value of the "package_hash_sha256" field.

func (*StorageUpdateOne) ClearPackagePath added in v0.3.0

func (suo *StorageUpdateOne) ClearPackagePath() *StorageUpdateOne

ClearPackagePath clears the value of the "package_path" field.

func (*StorageUpdateOne) ClearVersion

func (suo *StorageUpdateOne) ClearVersion() *StorageUpdateOne

ClearVersion clears the "version" edge to the Version entity.

func (*StorageUpdateOne) Exec

func (suo *StorageUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*StorageUpdateOne) ExecX

func (suo *StorageUpdateOne) ExecX(ctx context.Context)

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

func (*StorageUpdateOne) Mutation

func (suo *StorageUpdateOne) Mutation() *StorageMutation

Mutation returns the StorageMutation object of the builder.

func (*StorageUpdateOne) Save

func (suo *StorageUpdateOne) Save(ctx context.Context) (*Storage, error)

Save executes the query and returns the updated Storage entity.

func (*StorageUpdateOne) SaveX

func (suo *StorageUpdateOne) SaveX(ctx context.Context) *Storage

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

func (*StorageUpdateOne) Select

func (suo *StorageUpdateOne) Select(field string, fields ...string) *StorageUpdateOne

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

func (*StorageUpdateOne) SetArch added in v0.3.0

func (suo *StorageUpdateOne) SetArch(s string) *StorageUpdateOne

SetArch sets the "arch" field.

func (*StorageUpdateOne) SetCreatedAt

func (suo *StorageUpdateOne) SetCreatedAt(t time.Time) *StorageUpdateOne

SetCreatedAt sets the "created_at" field.

func (*StorageUpdateOne) SetFileHashes added in v0.3.0

func (suo *StorageUpdateOne) SetFileHashes(m map[string]string) *StorageUpdateOne

SetFileHashes sets the "file_hashes" field.

func (*StorageUpdateOne) SetFileSize added in v0.12.0

func (suo *StorageUpdateOne) SetFileSize(i int64) *StorageUpdateOne

SetFileSize sets the "file_size" field.

func (*StorageUpdateOne) SetFileType added in v0.12.0

func (suo *StorageUpdateOne) SetFileType(s string) *StorageUpdateOne

SetFileType sets the "file_type" field.

func (*StorageUpdateOne) SetNillableArch added in v0.3.0

func (suo *StorageUpdateOne) SetNillableArch(s *string) *StorageUpdateOne

SetNillableArch sets the "arch" field if the given value is not nil.

func (*StorageUpdateOne) SetNillableCreatedAt

func (suo *StorageUpdateOne) SetNillableCreatedAt(t *time.Time) *StorageUpdateOne

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

func (*StorageUpdateOne) SetNillableFileSize added in v0.12.0

func (suo *StorageUpdateOne) SetNillableFileSize(i *int64) *StorageUpdateOne

SetNillableFileSize sets the "file_size" field if the given value is not nil.

func (*StorageUpdateOne) SetNillableFileType added in v0.12.0

func (suo *StorageUpdateOne) SetNillableFileType(s *string) *StorageUpdateOne

SetNillableFileType sets the "file_type" field if the given value is not nil.

func (*StorageUpdateOne) SetNillableOldVersionID added in v0.3.0

func (suo *StorageUpdateOne) SetNillableOldVersionID(id *int) *StorageUpdateOne

SetNillableOldVersionID sets the "old_version" edge to the Version entity by ID if the given value is not nil.

func (*StorageUpdateOne) SetNillableOs added in v0.3.0

func (suo *StorageUpdateOne) SetNillableOs(s *string) *StorageUpdateOne

SetNillableOs sets the "os" field if the given value is not nil.

func (*StorageUpdateOne) SetNillablePackageHashSha256 added in v0.4.0

func (suo *StorageUpdateOne) SetNillablePackageHashSha256(s *string) *StorageUpdateOne

SetNillablePackageHashSha256 sets the "package_hash_sha256" field if the given value is not nil.

func (*StorageUpdateOne) SetNillablePackagePath added in v0.3.0

func (suo *StorageUpdateOne) SetNillablePackagePath(s *string) *StorageUpdateOne

SetNillablePackagePath sets the "package_path" field if the given value is not nil.

func (*StorageUpdateOne) SetNillableUpdateType added in v0.3.0

func (suo *StorageUpdateOne) SetNillableUpdateType(st *storage.UpdateType) *StorageUpdateOne

SetNillableUpdateType sets the "update_type" field if the given value is not nil.

func (*StorageUpdateOne) SetNillableVersionStorages added in v0.5.1

func (suo *StorageUpdateOne) SetNillableVersionStorages(i *int) *StorageUpdateOne

SetNillableVersionStorages sets the "version_storages" field if the given value is not nil.

func (*StorageUpdateOne) SetOldVersion added in v0.3.0

func (suo *StorageUpdateOne) SetOldVersion(v *Version) *StorageUpdateOne

SetOldVersion sets the "old_version" edge to the Version entity.

func (*StorageUpdateOne) SetOldVersionID added in v0.3.0

func (suo *StorageUpdateOne) SetOldVersionID(id int) *StorageUpdateOne

SetOldVersionID sets the "old_version" edge to the Version entity by ID.

func (*StorageUpdateOne) SetOs added in v0.3.0

func (suo *StorageUpdateOne) SetOs(s string) *StorageUpdateOne

SetOs sets the "os" field.

func (*StorageUpdateOne) SetPackageHashSha256 added in v0.4.0

func (suo *StorageUpdateOne) SetPackageHashSha256(s string) *StorageUpdateOne

SetPackageHashSha256 sets the "package_hash_sha256" field.

func (*StorageUpdateOne) SetPackagePath added in v0.3.0

func (suo *StorageUpdateOne) SetPackagePath(s string) *StorageUpdateOne

SetPackagePath sets the "package_path" field.

func (*StorageUpdateOne) SetUpdateType added in v0.3.0

func (suo *StorageUpdateOne) SetUpdateType(st storage.UpdateType) *StorageUpdateOne

SetUpdateType sets the "update_type" field.

func (*StorageUpdateOne) SetVersion

func (suo *StorageUpdateOne) SetVersion(v *Version) *StorageUpdateOne

SetVersion sets the "version" edge to the Version entity.

func (*StorageUpdateOne) SetVersionID

func (suo *StorageUpdateOne) SetVersionID(id int) *StorageUpdateOne

SetVersionID sets the "version" edge to the Version entity by ID.

func (*StorageUpdateOne) SetVersionStorages added in v0.5.1

func (suo *StorageUpdateOne) SetVersionStorages(i int) *StorageUpdateOne

SetVersionStorages sets the "version_storages" field.

func (*StorageUpdateOne) Where

Where appends a list predicates to the StorageUpdate builder.

type Storages

type Storages []*Storage

Storages is a parsable slice of Storage.

type TraverseFunc

type TraverseFunc = ent.TraverseFunc

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

type Traverser

type Traverser = ent.Traverser

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

type Tx

type Tx struct {

	// Resource is the client for interacting with the Resource builders.
	Resource *ResourceClient
	// Storage is the client for interacting with the Storage builders.
	Storage *StorageClient
	// Version is the client for interacting with the Version builders.
	Version *VersionClient
	// 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 Version

type Version struct {

	// ID of the ent.
	ID int `json:"id,omitempty"`
	// Channel holds the value of the "channel" field.
	Channel version.Channel `json:"channel,omitempty"`
	// Name holds the value of the "name" field.
	Name string `json:"name,omitempty"`
	// Number holds the value of the "number" field.
	Number uint64 `json:"number,omitempty"`
	// ReleaseNote holds the value of the "release_note" field.
	ReleaseNote string `json:"release_note,omitempty"`
	// CustomData holds the value of the "custom_data" field.
	CustomData string `json:"custom_data,omitempty"`
	// CreatedAt holds the value of the "created_at" field.
	CreatedAt time.Time `json:"created_at,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the VersionQuery when eager-loading is set.
	Edges VersionEdges `json:"edges"`
	// contains filtered or unexported fields
}

Version is the model entity for the Version schema.

func (*Version) QueryResource

func (v *Version) QueryResource() *ResourceQuery

QueryResource queries the "resource" edge of the Version entity.

func (*Version) QueryStorages added in v0.3.0

func (v *Version) QueryStorages() *StorageQuery

QueryStorages queries the "storages" edge of the Version entity.

func (*Version) String

func (v *Version) String() string

String implements the fmt.Stringer.

func (*Version) Unwrap

func (v *Version) Unwrap() *Version

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

func (v *Version) Update() *VersionUpdateOne

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

func (*Version) Value

func (v *Version) Value(name string) (ent.Value, error)

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

type VersionClient

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

VersionClient is a client for the Version schema.

func NewVersionClient

func NewVersionClient(c config) *VersionClient

NewVersionClient returns a client for the Version from the given config.

func (*VersionClient) Create

func (c *VersionClient) Create() *VersionCreate

Create returns a builder for creating a Version entity.

func (*VersionClient) CreateBulk

func (c *VersionClient) CreateBulk(builders ...*VersionCreate) *VersionCreateBulk

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

func (*VersionClient) Delete

func (c *VersionClient) Delete() *VersionDelete

Delete returns a delete builder for Version.

func (*VersionClient) DeleteOne

func (c *VersionClient) DeleteOne(v *Version) *VersionDeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*VersionClient) DeleteOneID

func (c *VersionClient) DeleteOneID(id int) *VersionDeleteOne

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

func (*VersionClient) Get

func (c *VersionClient) Get(ctx context.Context, id int) (*Version, error)

Get returns a Version entity by its id.

func (*VersionClient) GetX

func (c *VersionClient) GetX(ctx context.Context, id int) *Version

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

func (*VersionClient) Hooks

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

Hooks returns the client hooks.

func (*VersionClient) Intercept

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

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

func (*VersionClient) Interceptors

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

Interceptors returns the client interceptors.

func (*VersionClient) MapCreateBulk

func (c *VersionClient) MapCreateBulk(slice any, setFunc func(*VersionCreate, int)) *VersionCreateBulk

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

func (*VersionClient) Query

func (c *VersionClient) Query() *VersionQuery

Query returns a query builder for Version.

func (*VersionClient) QueryResource

func (c *VersionClient) QueryResource(v *Version) *ResourceQuery

QueryResource queries the resource edge of a Version.

func (*VersionClient) QueryStorages added in v0.3.0

func (c *VersionClient) QueryStorages(v *Version) *StorageQuery

QueryStorages queries the storages edge of a Version.

func (*VersionClient) Update

func (c *VersionClient) Update() *VersionUpdate

Update returns an update builder for Version.

func (*VersionClient) UpdateOne

func (c *VersionClient) UpdateOne(v *Version) *VersionUpdateOne

UpdateOne returns an update builder for the given entity.

func (*VersionClient) UpdateOneID

func (c *VersionClient) UpdateOneID(id int) *VersionUpdateOne

UpdateOneID returns an update builder for the given id.

func (*VersionClient) Use

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

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

type VersionCreate

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

VersionCreate is the builder for creating a Version entity.

func (*VersionCreate) AddStorageIDs

func (vc *VersionCreate) AddStorageIDs(ids ...int) *VersionCreate

AddStorageIDs adds the "storages" edge to the Storage entity by IDs.

func (*VersionCreate) AddStorages added in v0.3.0

func (vc *VersionCreate) AddStorages(s ...*Storage) *VersionCreate

AddStorages adds the "storages" edges to the Storage entity.

func (*VersionCreate) Exec

func (vc *VersionCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*VersionCreate) ExecX

func (vc *VersionCreate) ExecX(ctx context.Context)

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

func (*VersionCreate) Mutation

func (vc *VersionCreate) Mutation() *VersionMutation

Mutation returns the VersionMutation object of the builder.

func (*VersionCreate) Save

func (vc *VersionCreate) Save(ctx context.Context) (*Version, error)

Save creates the Version in the database.

func (*VersionCreate) SaveX

func (vc *VersionCreate) SaveX(ctx context.Context) *Version

SaveX calls Save and panics if Save returns an error.

func (*VersionCreate) SetChannel added in v0.3.0

func (vc *VersionCreate) SetChannel(v version.Channel) *VersionCreate

SetChannel sets the "channel" field.

func (*VersionCreate) SetCreatedAt

func (vc *VersionCreate) SetCreatedAt(t time.Time) *VersionCreate

SetCreatedAt sets the "created_at" field.

func (*VersionCreate) SetCustomData added in v0.4.0

func (vc *VersionCreate) SetCustomData(s string) *VersionCreate

SetCustomData sets the "custom_data" field.

func (*VersionCreate) SetName

func (vc *VersionCreate) SetName(s string) *VersionCreate

SetName sets the "name" field.

func (*VersionCreate) SetNillableChannel added in v0.3.0

func (vc *VersionCreate) SetNillableChannel(v *version.Channel) *VersionCreate

SetNillableChannel sets the "channel" field if the given value is not nil.

func (*VersionCreate) SetNillableCreatedAt

func (vc *VersionCreate) SetNillableCreatedAt(t *time.Time) *VersionCreate

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

func (*VersionCreate) SetNillableCustomData added in v0.4.0

func (vc *VersionCreate) SetNillableCustomData(s *string) *VersionCreate

SetNillableCustomData sets the "custom_data" field if the given value is not nil.

func (*VersionCreate) SetNillableReleaseNote added in v0.4.0

func (vc *VersionCreate) SetNillableReleaseNote(s *string) *VersionCreate

SetNillableReleaseNote sets the "release_note" field if the given value is not nil.

func (*VersionCreate) SetNillableResourceID

func (vc *VersionCreate) SetNillableResourceID(id *string) *VersionCreate

SetNillableResourceID sets the "resource" edge to the Resource entity by ID if the given value is not nil.

func (*VersionCreate) SetNumber

func (vc *VersionCreate) SetNumber(u uint64) *VersionCreate

SetNumber sets the "number" field.

func (*VersionCreate) SetReleaseNote added in v0.4.0

func (vc *VersionCreate) SetReleaseNote(s string) *VersionCreate

SetReleaseNote sets the "release_note" field.

func (*VersionCreate) SetResource

func (vc *VersionCreate) SetResource(r *Resource) *VersionCreate

SetResource sets the "resource" edge to the Resource entity.

func (*VersionCreate) SetResourceID

func (vc *VersionCreate) SetResourceID(id string) *VersionCreate

SetResourceID sets the "resource" edge to the Resource entity by ID.

type VersionCreateBulk

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

VersionCreateBulk is the builder for creating many Version entities in bulk.

func (*VersionCreateBulk) Exec

func (vcb *VersionCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*VersionCreateBulk) ExecX

func (vcb *VersionCreateBulk) ExecX(ctx context.Context)

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

func (*VersionCreateBulk) Save

func (vcb *VersionCreateBulk) Save(ctx context.Context) ([]*Version, error)

Save creates the Version entities in the database.

func (*VersionCreateBulk) SaveX

func (vcb *VersionCreateBulk) SaveX(ctx context.Context) []*Version

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

type VersionDelete

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

VersionDelete is the builder for deleting a Version entity.

func (*VersionDelete) Exec

func (vd *VersionDelete) Exec(ctx context.Context) (int, error)

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

func (*VersionDelete) ExecX

func (vd *VersionDelete) ExecX(ctx context.Context) int

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

func (*VersionDelete) Where

func (vd *VersionDelete) Where(ps ...predicate.Version) *VersionDelete

Where appends a list predicates to the VersionDelete builder.

type VersionDeleteOne

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

VersionDeleteOne is the builder for deleting a single Version entity.

func (*VersionDeleteOne) Exec

func (vdo *VersionDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*VersionDeleteOne) ExecX

func (vdo *VersionDeleteOne) ExecX(ctx context.Context)

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

func (*VersionDeleteOne) Where

Where appends a list predicates to the VersionDelete builder.

type VersionEdges

type VersionEdges struct {
	// Storages holds the value of the storages edge.
	Storages []*Storage `json:"storages,omitempty"`
	// Resource holds the value of the resource edge.
	Resource *Resource `json:"resource,omitempty"`
	// contains filtered or unexported fields
}

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

func (VersionEdges) ResourceOrErr

func (e VersionEdges) ResourceOrErr() (*Resource, error)

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

func (VersionEdges) StoragesOrErr added in v0.3.0

func (e VersionEdges) StoragesOrErr() ([]*Storage, error)

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

type VersionGroupBy

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

VersionGroupBy is the group-by builder for Version entities.

func (*VersionGroupBy) Aggregate

func (vgb *VersionGroupBy) Aggregate(fns ...AggregateFunc) *VersionGroupBy

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

func (*VersionGroupBy) Bool

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

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

func (*VersionGroupBy) BoolX

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

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

func (*VersionGroupBy) Bools

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

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

func (*VersionGroupBy) BoolsX

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

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

func (*VersionGroupBy) Float64

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

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

func (*VersionGroupBy) Float64X

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

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

func (*VersionGroupBy) Float64s

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

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

func (*VersionGroupBy) Float64sX

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

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

func (*VersionGroupBy) Int

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

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

func (*VersionGroupBy) IntX

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

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

func (*VersionGroupBy) Ints

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

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

func (*VersionGroupBy) IntsX

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

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

func (*VersionGroupBy) Scan

func (vgb *VersionGroupBy) Scan(ctx context.Context, v any) error

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

func (*VersionGroupBy) ScanX

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

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

func (*VersionGroupBy) String

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

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

func (*VersionGroupBy) StringX

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

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

func (*VersionGroupBy) Strings

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

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

func (*VersionGroupBy) StringsX

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

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

type VersionMutation

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

VersionMutation represents an operation that mutates the Version nodes in the graph.

func (*VersionMutation) AddField

func (m *VersionMutation) 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 (*VersionMutation) AddNumber

func (m *VersionMutation) AddNumber(u int64)

AddNumber adds u to the "number" field.

func (*VersionMutation) AddStorageIDs

func (m *VersionMutation) AddStorageIDs(ids ...int)

AddStorageIDs adds the "storages" edge to the Storage entity by ids.

func (*VersionMutation) AddedEdges

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

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

func (*VersionMutation) AddedField

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

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

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

func (*VersionMutation) AddedIDs

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

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

func (*VersionMutation) AddedNumber

func (m *VersionMutation) AddedNumber() (r int64, exists bool)

AddedNumber returns the value that was added to the "number" field in this mutation.

func (*VersionMutation) Channel added in v0.3.0

func (m *VersionMutation) Channel() (r version.Channel, exists bool)

Channel returns the value of the "channel" field in the mutation.

func (*VersionMutation) ClearEdge

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

func (m *VersionMutation) 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 (*VersionMutation) ClearResource

func (m *VersionMutation) ClearResource()

ClearResource clears the "resource" edge to the Resource entity.

func (*VersionMutation) ClearStorages added in v0.3.0

func (m *VersionMutation) ClearStorages()

ClearStorages clears the "storages" edge to the Storage entity.

func (*VersionMutation) ClearedEdges

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

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

func (*VersionMutation) ClearedFields

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

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

func (VersionMutation) Client

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

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

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

func (*VersionMutation) CustomData added in v0.4.0

func (m *VersionMutation) CustomData() (r string, exists bool)

CustomData returns the value of the "custom_data" field in the mutation.

func (*VersionMutation) EdgeCleared

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

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

func (*VersionMutation) Field

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

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

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

func (*VersionMutation) Fields

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

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

func (m *VersionMutation) IDs(ctx context.Context) ([]int, 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 (*VersionMutation) Name

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

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

func (*VersionMutation) Number

func (m *VersionMutation) Number() (r uint64, exists bool)

Number returns the value of the "number" field in the mutation.

func (*VersionMutation) OldChannel added in v0.3.0

func (m *VersionMutation) OldChannel(ctx context.Context) (v version.Channel, err error)

OldChannel returns the old "channel" field's value of the Version entity. If the Version 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 (*VersionMutation) OldCreatedAt

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

OldCreatedAt returns the old "created_at" field's value of the Version entity. If the Version 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 (*VersionMutation) OldCustomData added in v0.4.0

func (m *VersionMutation) OldCustomData(ctx context.Context) (v string, err error)

OldCustomData returns the old "custom_data" field's value of the Version entity. If the Version 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 (*VersionMutation) OldField

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

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

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

func (m *VersionMutation) OldNumber(ctx context.Context) (v uint64, err error)

OldNumber returns the old "number" field's value of the Version entity. If the Version 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 (*VersionMutation) OldReleaseNote added in v0.4.0

func (m *VersionMutation) OldReleaseNote(ctx context.Context) (v string, err error)

OldReleaseNote returns the old "release_note" field's value of the Version entity. If the Version 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 (*VersionMutation) Op

func (m *VersionMutation) Op() Op

Op returns the operation name.

func (*VersionMutation) ReleaseNote added in v0.4.0

func (m *VersionMutation) ReleaseNote() (r string, exists bool)

ReleaseNote returns the value of the "release_note" field in the mutation.

func (*VersionMutation) RemoveStorageIDs

func (m *VersionMutation) RemoveStorageIDs(ids ...int)

RemoveStorageIDs removes the "storages" edge to the Storage entity by IDs.

func (*VersionMutation) RemovedEdges

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

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

func (*VersionMutation) RemovedIDs

func (m *VersionMutation) 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 (*VersionMutation) RemovedStoragesIDs added in v0.3.0

func (m *VersionMutation) RemovedStoragesIDs() (ids []int)

RemovedStorages returns the removed IDs of the "storages" edge to the Storage entity.

func (*VersionMutation) ResetChannel added in v0.3.0

func (m *VersionMutation) ResetChannel()

ResetChannel resets all changes to the "channel" field.

func (*VersionMutation) ResetCreatedAt

func (m *VersionMutation) ResetCreatedAt()

ResetCreatedAt resets all changes to the "created_at" field.

func (*VersionMutation) ResetCustomData added in v0.4.0

func (m *VersionMutation) ResetCustomData()

ResetCustomData resets all changes to the "custom_data" field.

func (*VersionMutation) ResetEdge

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

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

func (m *VersionMutation) ResetName()

ResetName resets all changes to the "name" field.

func (*VersionMutation) ResetNumber

func (m *VersionMutation) ResetNumber()

ResetNumber resets all changes to the "number" field.

func (*VersionMutation) ResetReleaseNote added in v0.4.0

func (m *VersionMutation) ResetReleaseNote()

ResetReleaseNote resets all changes to the "release_note" field.

func (*VersionMutation) ResetResource

func (m *VersionMutation) ResetResource()

ResetResource resets all changes to the "resource" edge.

func (*VersionMutation) ResetStorages added in v0.3.0

func (m *VersionMutation) ResetStorages()

ResetStorages resets all changes to the "storages" edge.

func (*VersionMutation) ResourceCleared

func (m *VersionMutation) ResourceCleared() bool

ResourceCleared reports if the "resource" edge to the Resource entity was cleared.

func (*VersionMutation) ResourceID

func (m *VersionMutation) ResourceID() (id string, exists bool)

ResourceID returns the "resource" edge ID in the mutation.

func (*VersionMutation) ResourceIDs

func (m *VersionMutation) ResourceIDs() (ids []string)

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

func (*VersionMutation) SetChannel added in v0.3.0

func (m *VersionMutation) SetChannel(v version.Channel)

SetChannel sets the "channel" field.

func (*VersionMutation) SetCreatedAt

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

SetCreatedAt sets the "created_at" field.

func (*VersionMutation) SetCustomData added in v0.4.0

func (m *VersionMutation) SetCustomData(s string)

SetCustomData sets the "custom_data" field.

func (*VersionMutation) SetField

func (m *VersionMutation) 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 (*VersionMutation) SetName

func (m *VersionMutation) SetName(s string)

SetName sets the "name" field.

func (*VersionMutation) SetNumber

func (m *VersionMutation) SetNumber(u uint64)

SetNumber sets the "number" field.

func (*VersionMutation) SetOp

func (m *VersionMutation) SetOp(op Op)

SetOp allows setting the mutation operation.

func (*VersionMutation) SetReleaseNote added in v0.4.0

func (m *VersionMutation) SetReleaseNote(s string)

SetReleaseNote sets the "release_note" field.

func (*VersionMutation) SetResourceID

func (m *VersionMutation) SetResourceID(id string)

SetResourceID sets the "resource" edge to the Resource entity by id.

func (*VersionMutation) StoragesCleared added in v0.3.0

func (m *VersionMutation) StoragesCleared() bool

StoragesCleared reports if the "storages" edge to the Storage entity was cleared.

func (*VersionMutation) StoragesIDs added in v0.3.0

func (m *VersionMutation) StoragesIDs() (ids []int)

StoragesIDs returns the "storages" edge IDs in the mutation.

func (VersionMutation) Tx

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

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

func (*VersionMutation) Type

func (m *VersionMutation) Type() string

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

func (*VersionMutation) Where

func (m *VersionMutation) Where(ps ...predicate.Version)

Where appends a list predicates to the VersionMutation builder.

func (*VersionMutation) WhereP

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

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

type VersionQuery

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

VersionQuery is the builder for querying Version entities.

func (*VersionQuery) Aggregate

func (vq *VersionQuery) Aggregate(fns ...AggregateFunc) *VersionSelect

Aggregate returns a VersionSelect configured with the given aggregations.

func (*VersionQuery) All

func (vq *VersionQuery) All(ctx context.Context) ([]*Version, error)

All executes the query and returns a list of Versions.

func (*VersionQuery) AllX

func (vq *VersionQuery) AllX(ctx context.Context) []*Version

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

func (*VersionQuery) Clone

func (vq *VersionQuery) Clone() *VersionQuery

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

func (*VersionQuery) Count

func (vq *VersionQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*VersionQuery) CountX

func (vq *VersionQuery) CountX(ctx context.Context) int

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

func (*VersionQuery) Exist

func (vq *VersionQuery) Exist(ctx context.Context) (bool, error)

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

func (*VersionQuery) ExistX

func (vq *VersionQuery) ExistX(ctx context.Context) bool

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

func (*VersionQuery) First

func (vq *VersionQuery) First(ctx context.Context) (*Version, error)

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

func (*VersionQuery) FirstID

func (vq *VersionQuery) FirstID(ctx context.Context) (id int, err error)

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

func (*VersionQuery) FirstIDX

func (vq *VersionQuery) FirstIDX(ctx context.Context) int

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

func (*VersionQuery) FirstX

func (vq *VersionQuery) FirstX(ctx context.Context) *Version

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

func (*VersionQuery) GroupBy

func (vq *VersionQuery) GroupBy(field string, fields ...string) *VersionGroupBy

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 {
	Channel version.Channel `json:"channel,omitempty"`
	Count int `json:"count,omitempty"`
}

client.Version.Query().
	GroupBy(version.FieldChannel).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*VersionQuery) IDs

func (vq *VersionQuery) IDs(ctx context.Context) (ids []int, err error)

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

func (*VersionQuery) IDsX

func (vq *VersionQuery) IDsX(ctx context.Context) []int

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

func (*VersionQuery) Limit

func (vq *VersionQuery) Limit(limit int) *VersionQuery

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

func (*VersionQuery) Offset

func (vq *VersionQuery) Offset(offset int) *VersionQuery

Offset to start from.

func (*VersionQuery) Only

func (vq *VersionQuery) Only(ctx context.Context) (*Version, error)

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

func (*VersionQuery) OnlyID

func (vq *VersionQuery) OnlyID(ctx context.Context) (id int, err error)

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

func (*VersionQuery) OnlyIDX

func (vq *VersionQuery) OnlyIDX(ctx context.Context) int

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

func (*VersionQuery) OnlyX

func (vq *VersionQuery) OnlyX(ctx context.Context) *Version

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

func (*VersionQuery) Order

func (vq *VersionQuery) Order(o ...version.OrderOption) *VersionQuery

Order specifies how the records should be ordered.

func (*VersionQuery) QueryResource

func (vq *VersionQuery) QueryResource() *ResourceQuery

QueryResource chains the current query on the "resource" edge.

func (*VersionQuery) QueryStorages added in v0.3.0

func (vq *VersionQuery) QueryStorages() *StorageQuery

QueryStorages chains the current query on the "storages" edge.

func (*VersionQuery) Select

func (vq *VersionQuery) Select(fields ...string) *VersionSelect

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 {
	Channel version.Channel `json:"channel,omitempty"`
}

client.Version.Query().
	Select(version.FieldChannel).
	Scan(ctx, &v)

func (*VersionQuery) Unique

func (vq *VersionQuery) Unique(unique bool) *VersionQuery

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

func (vq *VersionQuery) Where(ps ...predicate.Version) *VersionQuery

Where adds a new predicate for the VersionQuery builder.

func (*VersionQuery) WithResource

func (vq *VersionQuery) WithResource(opts ...func(*ResourceQuery)) *VersionQuery

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

func (*VersionQuery) WithStorages added in v0.3.0

func (vq *VersionQuery) WithStorages(opts ...func(*StorageQuery)) *VersionQuery

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

type VersionSelect

type VersionSelect struct {
	*VersionQuery
	// contains filtered or unexported fields
}

VersionSelect is the builder for selecting fields of Version entities.

func (*VersionSelect) Aggregate

func (vs *VersionSelect) Aggregate(fns ...AggregateFunc) *VersionSelect

Aggregate adds the given aggregation functions to the selector query.

func (*VersionSelect) Bool

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

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

func (*VersionSelect) BoolX

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

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

func (*VersionSelect) Bools

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

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

func (*VersionSelect) BoolsX

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

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

func (*VersionSelect) Float64

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

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

func (*VersionSelect) Float64X

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

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

func (*VersionSelect) Float64s

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

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

func (*VersionSelect) Float64sX

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

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

func (*VersionSelect) Int

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

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

func (*VersionSelect) IntX

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

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

func (*VersionSelect) Ints

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

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

func (*VersionSelect) IntsX

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

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

func (*VersionSelect) Scan

func (vs *VersionSelect) Scan(ctx context.Context, v any) error

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

func (*VersionSelect) ScanX

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

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

func (*VersionSelect) String

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

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

func (*VersionSelect) StringX

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

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

func (*VersionSelect) Strings

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

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

func (*VersionSelect) StringsX

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

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

type VersionUpdate

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

VersionUpdate is the builder for updating Version entities.

func (*VersionUpdate) AddNumber

func (vu *VersionUpdate) AddNumber(u int64) *VersionUpdate

AddNumber adds u to the "number" field.

func (*VersionUpdate) AddStorageIDs

func (vu *VersionUpdate) AddStorageIDs(ids ...int) *VersionUpdate

AddStorageIDs adds the "storages" edge to the Storage entity by IDs.

func (*VersionUpdate) AddStorages added in v0.3.0

func (vu *VersionUpdate) AddStorages(s ...*Storage) *VersionUpdate

AddStorages adds the "storages" edges to the Storage entity.

func (*VersionUpdate) ClearResource

func (vu *VersionUpdate) ClearResource() *VersionUpdate

ClearResource clears the "resource" edge to the Resource entity.

func (*VersionUpdate) ClearStorages added in v0.3.0

func (vu *VersionUpdate) ClearStorages() *VersionUpdate

ClearStorages clears all "storages" edges to the Storage entity.

func (*VersionUpdate) Exec

func (vu *VersionUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*VersionUpdate) ExecX

func (vu *VersionUpdate) ExecX(ctx context.Context)

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

func (*VersionUpdate) Mutation

func (vu *VersionUpdate) Mutation() *VersionMutation

Mutation returns the VersionMutation object of the builder.

func (*VersionUpdate) RemoveStorageIDs

func (vu *VersionUpdate) RemoveStorageIDs(ids ...int) *VersionUpdate

RemoveStorageIDs removes the "storages" edge to Storage entities by IDs.

func (*VersionUpdate) RemoveStorages added in v0.3.0

func (vu *VersionUpdate) RemoveStorages(s ...*Storage) *VersionUpdate

RemoveStorages removes "storages" edges to Storage entities.

func (*VersionUpdate) Save

func (vu *VersionUpdate) Save(ctx context.Context) (int, error)

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

func (*VersionUpdate) SaveX

func (vu *VersionUpdate) SaveX(ctx context.Context) int

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

func (*VersionUpdate) SetChannel added in v0.3.0

func (vu *VersionUpdate) SetChannel(v version.Channel) *VersionUpdate

SetChannel sets the "channel" field.

func (*VersionUpdate) SetCreatedAt

func (vu *VersionUpdate) SetCreatedAt(t time.Time) *VersionUpdate

SetCreatedAt sets the "created_at" field.

func (*VersionUpdate) SetCustomData added in v0.4.0

func (vu *VersionUpdate) SetCustomData(s string) *VersionUpdate

SetCustomData sets the "custom_data" field.

func (*VersionUpdate) SetName

func (vu *VersionUpdate) SetName(s string) *VersionUpdate

SetName sets the "name" field.

func (*VersionUpdate) SetNillableChannel added in v0.3.0

func (vu *VersionUpdate) SetNillableChannel(v *version.Channel) *VersionUpdate

SetNillableChannel sets the "channel" field if the given value is not nil.

func (*VersionUpdate) SetNillableCreatedAt

func (vu *VersionUpdate) SetNillableCreatedAt(t *time.Time) *VersionUpdate

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

func (*VersionUpdate) SetNillableCustomData added in v0.4.0

func (vu *VersionUpdate) SetNillableCustomData(s *string) *VersionUpdate

SetNillableCustomData sets the "custom_data" field if the given value is not nil.

func (*VersionUpdate) SetNillableName

func (vu *VersionUpdate) SetNillableName(s *string) *VersionUpdate

SetNillableName sets the "name" field if the given value is not nil.

func (*VersionUpdate) SetNillableNumber

func (vu *VersionUpdate) SetNillableNumber(u *uint64) *VersionUpdate

SetNillableNumber sets the "number" field if the given value is not nil.

func (*VersionUpdate) SetNillableReleaseNote added in v0.4.0

func (vu *VersionUpdate) SetNillableReleaseNote(s *string) *VersionUpdate

SetNillableReleaseNote sets the "release_note" field if the given value is not nil.

func (*VersionUpdate) SetNillableResourceID

func (vu *VersionUpdate) SetNillableResourceID(id *string) *VersionUpdate

SetNillableResourceID sets the "resource" edge to the Resource entity by ID if the given value is not nil.

func (*VersionUpdate) SetNumber

func (vu *VersionUpdate) SetNumber(u uint64) *VersionUpdate

SetNumber sets the "number" field.

func (*VersionUpdate) SetReleaseNote added in v0.4.0

func (vu *VersionUpdate) SetReleaseNote(s string) *VersionUpdate

SetReleaseNote sets the "release_note" field.

func (*VersionUpdate) SetResource

func (vu *VersionUpdate) SetResource(r *Resource) *VersionUpdate

SetResource sets the "resource" edge to the Resource entity.

func (*VersionUpdate) SetResourceID

func (vu *VersionUpdate) SetResourceID(id string) *VersionUpdate

SetResourceID sets the "resource" edge to the Resource entity by ID.

func (*VersionUpdate) Where

func (vu *VersionUpdate) Where(ps ...predicate.Version) *VersionUpdate

Where appends a list predicates to the VersionUpdate builder.

type VersionUpdateOne

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

VersionUpdateOne is the builder for updating a single Version entity.

func (*VersionUpdateOne) AddNumber

func (vuo *VersionUpdateOne) AddNumber(u int64) *VersionUpdateOne

AddNumber adds u to the "number" field.

func (*VersionUpdateOne) AddStorageIDs

func (vuo *VersionUpdateOne) AddStorageIDs(ids ...int) *VersionUpdateOne

AddStorageIDs adds the "storages" edge to the Storage entity by IDs.

func (*VersionUpdateOne) AddStorages added in v0.3.0

func (vuo *VersionUpdateOne) AddStorages(s ...*Storage) *VersionUpdateOne

AddStorages adds the "storages" edges to the Storage entity.

func (*VersionUpdateOne) ClearResource

func (vuo *VersionUpdateOne) ClearResource() *VersionUpdateOne

ClearResource clears the "resource" edge to the Resource entity.

func (*VersionUpdateOne) ClearStorages added in v0.3.0

func (vuo *VersionUpdateOne) ClearStorages() *VersionUpdateOne

ClearStorages clears all "storages" edges to the Storage entity.

func (*VersionUpdateOne) Exec

func (vuo *VersionUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*VersionUpdateOne) ExecX

func (vuo *VersionUpdateOne) ExecX(ctx context.Context)

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

func (*VersionUpdateOne) Mutation

func (vuo *VersionUpdateOne) Mutation() *VersionMutation

Mutation returns the VersionMutation object of the builder.

func (*VersionUpdateOne) RemoveStorageIDs

func (vuo *VersionUpdateOne) RemoveStorageIDs(ids ...int) *VersionUpdateOne

RemoveStorageIDs removes the "storages" edge to Storage entities by IDs.

func (*VersionUpdateOne) RemoveStorages added in v0.3.0

func (vuo *VersionUpdateOne) RemoveStorages(s ...*Storage) *VersionUpdateOne

RemoveStorages removes "storages" edges to Storage entities.

func (*VersionUpdateOne) Save

func (vuo *VersionUpdateOne) Save(ctx context.Context) (*Version, error)

Save executes the query and returns the updated Version entity.

func (*VersionUpdateOne) SaveX

func (vuo *VersionUpdateOne) SaveX(ctx context.Context) *Version

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

func (*VersionUpdateOne) Select

func (vuo *VersionUpdateOne) Select(field string, fields ...string) *VersionUpdateOne

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

func (*VersionUpdateOne) SetChannel added in v0.3.0

func (vuo *VersionUpdateOne) SetChannel(v version.Channel) *VersionUpdateOne

SetChannel sets the "channel" field.

func (*VersionUpdateOne) SetCreatedAt

func (vuo *VersionUpdateOne) SetCreatedAt(t time.Time) *VersionUpdateOne

SetCreatedAt sets the "created_at" field.

func (*VersionUpdateOne) SetCustomData added in v0.4.0

func (vuo *VersionUpdateOne) SetCustomData(s string) *VersionUpdateOne

SetCustomData sets the "custom_data" field.

func (*VersionUpdateOne) SetName

func (vuo *VersionUpdateOne) SetName(s string) *VersionUpdateOne

SetName sets the "name" field.

func (*VersionUpdateOne) SetNillableChannel added in v0.3.0

func (vuo *VersionUpdateOne) SetNillableChannel(v *version.Channel) *VersionUpdateOne

SetNillableChannel sets the "channel" field if the given value is not nil.

func (*VersionUpdateOne) SetNillableCreatedAt

func (vuo *VersionUpdateOne) SetNillableCreatedAt(t *time.Time) *VersionUpdateOne

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

func (*VersionUpdateOne) SetNillableCustomData added in v0.4.0

func (vuo *VersionUpdateOne) SetNillableCustomData(s *string) *VersionUpdateOne

SetNillableCustomData sets the "custom_data" field if the given value is not nil.

func (*VersionUpdateOne) SetNillableName

func (vuo *VersionUpdateOne) SetNillableName(s *string) *VersionUpdateOne

SetNillableName sets the "name" field if the given value is not nil.

func (*VersionUpdateOne) SetNillableNumber

func (vuo *VersionUpdateOne) SetNillableNumber(u *uint64) *VersionUpdateOne

SetNillableNumber sets the "number" field if the given value is not nil.

func (*VersionUpdateOne) SetNillableReleaseNote added in v0.4.0

func (vuo *VersionUpdateOne) SetNillableReleaseNote(s *string) *VersionUpdateOne

SetNillableReleaseNote sets the "release_note" field if the given value is not nil.

func (*VersionUpdateOne) SetNillableResourceID

func (vuo *VersionUpdateOne) SetNillableResourceID(id *string) *VersionUpdateOne

SetNillableResourceID sets the "resource" edge to the Resource entity by ID if the given value is not nil.

func (*VersionUpdateOne) SetNumber

func (vuo *VersionUpdateOne) SetNumber(u uint64) *VersionUpdateOne

SetNumber sets the "number" field.

func (*VersionUpdateOne) SetReleaseNote added in v0.4.0

func (vuo *VersionUpdateOne) SetReleaseNote(s string) *VersionUpdateOne

SetReleaseNote sets the "release_note" field.

func (*VersionUpdateOne) SetResource

func (vuo *VersionUpdateOne) SetResource(r *Resource) *VersionUpdateOne

SetResource sets the "resource" edge to the Resource entity.

func (*VersionUpdateOne) SetResourceID

func (vuo *VersionUpdateOne) SetResourceID(id string) *VersionUpdateOne

SetResourceID sets the "resource" edge to the Resource entity by ID.

func (*VersionUpdateOne) Where

Where appends a list predicates to the VersionUpdate builder.

type Versions

type Versions []*Version

Versions is a parsable slice of Version.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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