ent

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2021 License: GPL-3.0 Imports: 20 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.
	TypeMedia     = "Media"
	TypeMediaFile = "MediaFile"
)

Variables

This section is empty.

Functions

func IsConstraintError

func IsConstraintError(err error) bool

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

func IsNotFound

func IsNotFound(err error) bool

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

func IsNotLoaded

func IsNotLoaded(err error) bool

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

func IsNotSingular

func IsNotSingular(err error) bool

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

func IsValidationError

func IsValidationError(err error) bool

IsValidationError returns a boolean indicating whether the error is a validaton 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 Client attached.

Types

type AggregateFunc

type AggregateFunc func(*sql.Selector, func(string) bool) 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
	// Media is the client for interacting with the Media builders.
	Media *MediaClient
	// MediaFile is the client for interacting with the MediaFile builders.
	MediaFile *MediaFileClient
	// contains filtered or unexported fields
}

Client is the client that holds all ent builders.

func FromContext

func FromContext(ctx context.Context) *Client

FromContext returns the Client stored in 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 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().
	Media.
	Query().
	Count(ctx)

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(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 Committer 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 conflict in user's code.

type Media

type Media struct {

	// ID of the ent.
	ID uuid.UUID `json:"id,omitempty"`
	// Title holds the value of the "title" field.
	Title string `json:"title,omitempty"`
	// OriginalFilename holds the value of the "original_filename" field.
	OriginalFilename string `json:"original_filename,omitempty"`
	// Status holds the value of the "status" field.
	Status media.Status `json:"status,omitempty"`
	// CreatedAt holds the value of the "created_at" field.
	CreatedAt time.Time `json:"created_at,omitempty"`
	// UpdatedAt holds the value of the "updated_at" field.
	UpdatedAt time.Time `json:"updated_at,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the MediaQuery when eager-loading is set.
	Edges MediaEdges `json:"edges"`
	// contains filtered or unexported fields
}

Media is the model entity for the Media schema.

func (*Media) QueryMediaFiles

func (m *Media) QueryMediaFiles() *MediaFileQuery

QueryMediaFiles queries the media_files edge of the Media.

func (*Media) String

func (m *Media) String() string

String implements the fmt.Stringer.

func (*Media) Unwrap

func (m *Media) Unwrap() *Media

Unwrap unwraps the entity that was returned from a transaction after it was closed, so that all next queries will be executed through the driver which created the transaction.

func (*Media) Update

func (m *Media) Update() *MediaUpdateOne

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

type MediaClient

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

MediaClient is a client for the Media schema.

func NewMediaClient

func NewMediaClient(c config) *MediaClient

NewMediaClient returns a client for the Media from the given config.

func (*MediaClient) Create

func (c *MediaClient) Create() *MediaCreate

Create returns a create builder for Media.

func (*MediaClient) CreateBulk

func (c *MediaClient) CreateBulk(builders ...*MediaCreate) *MediaCreateBulk

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

func (*MediaClient) Delete

func (c *MediaClient) Delete() *MediaDelete

Delete returns a delete builder for Media.

func (*MediaClient) DeleteOne

func (c *MediaClient) DeleteOne(m *Media) *MediaDeleteOne

DeleteOne returns a delete builder for the given entity.

func (*MediaClient) DeleteOneID

func (c *MediaClient) DeleteOneID(id uuid.UUID) *MediaDeleteOne

DeleteOneID returns a delete builder for the given id.

func (*MediaClient) Get

func (c *MediaClient) Get(ctx context.Context, id uuid.UUID) (*Media, error)

Get returns a Media entity by its id.

func (*MediaClient) GetX

func (c *MediaClient) GetX(ctx context.Context, id uuid.UUID) *Media

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

func (*MediaClient) Hooks

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

Hooks returns the client hooks.

func (*MediaClient) Query

func (c *MediaClient) Query() *MediaQuery

Query returns a query builder for Media.

func (*MediaClient) QueryMediaFiles

func (c *MediaClient) QueryMediaFiles(m *Media) *MediaFileQuery

QueryMediaFiles queries the media_files edge of a Media.

func (*MediaClient) Update

func (c *MediaClient) Update() *MediaUpdate

Update returns an update builder for Media.

func (*MediaClient) UpdateOne

func (c *MediaClient) UpdateOne(m *Media) *MediaUpdateOne

UpdateOne returns an update builder for the given entity.

func (*MediaClient) UpdateOneID

func (c *MediaClient) UpdateOneID(id uuid.UUID) *MediaUpdateOne

UpdateOneID returns an update builder for the given id.

func (*MediaClient) Use

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

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

type MediaCreate

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

MediaCreate is the builder for creating a Media entity.

func (*MediaCreate) AddMediaFileIDs

func (mc *MediaCreate) AddMediaFileIDs(ids ...uuid.UUID) *MediaCreate

AddMediaFileIDs adds the media_files edge to MediaFile by ids.

func (*MediaCreate) AddMediaFiles

func (mc *MediaCreate) AddMediaFiles(m ...*MediaFile) *MediaCreate

AddMediaFiles adds the media_files edges to MediaFile.

func (*MediaCreate) Mutation

func (mc *MediaCreate) Mutation() *MediaMutation

Mutation returns the MediaMutation object of the builder.

func (*MediaCreate) Save

func (mc *MediaCreate) Save(ctx context.Context) (*Media, error)

Save creates the Media in the database.

func (*MediaCreate) SaveX

func (mc *MediaCreate) SaveX(ctx context.Context) *Media

SaveX calls Save and panics if Save returns an error.

func (*MediaCreate) SetCreatedAt

func (mc *MediaCreate) SetCreatedAt(t time.Time) *MediaCreate

SetCreatedAt sets the created_at field.

func (*MediaCreate) SetID

func (mc *MediaCreate) SetID(u uuid.UUID) *MediaCreate

SetID sets the id field.

func (*MediaCreate) SetNillableCreatedAt

func (mc *MediaCreate) SetNillableCreatedAt(t *time.Time) *MediaCreate

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

func (*MediaCreate) SetNillableOriginalFilename

func (mc *MediaCreate) SetNillableOriginalFilename(s *string) *MediaCreate

SetNillableOriginalFilename sets the original_filename field if the given value is not nil.

func (*MediaCreate) SetNillableUpdatedAt

func (mc *MediaCreate) SetNillableUpdatedAt(t *time.Time) *MediaCreate

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

func (*MediaCreate) SetOriginalFilename

func (mc *MediaCreate) SetOriginalFilename(s string) *MediaCreate

SetOriginalFilename sets the original_filename field.

func (*MediaCreate) SetStatus

func (mc *MediaCreate) SetStatus(m media.Status) *MediaCreate

SetStatus sets the status field.

func (*MediaCreate) SetTitle

func (mc *MediaCreate) SetTitle(s string) *MediaCreate

SetTitle sets the title field.

func (*MediaCreate) SetUpdatedAt

func (mc *MediaCreate) SetUpdatedAt(t time.Time) *MediaCreate

SetUpdatedAt sets the updated_at field.

type MediaCreateBulk

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

MediaCreateBulk is the builder for creating a bulk of Media entities.

func (*MediaCreateBulk) Save

func (mcb *MediaCreateBulk) Save(ctx context.Context) ([]*Media, error)

Save creates the Media entities in the database.

func (*MediaCreateBulk) SaveX

func (mcb *MediaCreateBulk) SaveX(ctx context.Context) []*Media

SaveX calls Save and panics if Save returns an error.

type MediaDelete

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

MediaDelete is the builder for deleting a Media entity.

func (*MediaDelete) Exec

func (md *MediaDelete) Exec(ctx context.Context) (int, error)

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

func (*MediaDelete) ExecX

func (md *MediaDelete) ExecX(ctx context.Context) int

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

func (*MediaDelete) Where

func (md *MediaDelete) Where(ps ...predicate.Media) *MediaDelete

Where adds a new predicate to the delete builder.

type MediaDeleteOne

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

MediaDeleteOne is the builder for deleting a single Media entity.

func (*MediaDeleteOne) Exec

func (mdo *MediaDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*MediaDeleteOne) ExecX

func (mdo *MediaDeleteOne) ExecX(ctx context.Context)

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

type MediaEdges

type MediaEdges struct {
	// MediaFiles holds the value of the media_files edge.
	MediaFiles []*MediaFile `json:"media_files,omitempty"`
	// contains filtered or unexported fields
}

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

func (MediaEdges) MediaFilesOrErr

func (e MediaEdges) MediaFilesOrErr() ([]*MediaFile, error)

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

type MediaFile

type MediaFile struct {

	// ID of the ent.
	ID uuid.UUID `json:"id,omitempty"`
	// RenditionName holds the value of the "rendition_name" field.
	RenditionName string `json:"rendition_name,omitempty"`
	// Format holds the value of the "format" field.
	Format string `json:"format,omitempty"`
	// TargetBandwidth holds the value of the "target_bandwidth" field.
	TargetBandwidth uint64 `json:"target_bandwidth,omitempty"`
	// VideoBitrate holds the value of the "video_bitrate" field.
	VideoBitrate int64 `json:"video_bitrate,omitempty"`
	// ResolutionWidth holds the value of the "resolution_width" field.
	ResolutionWidth uint16 `json:"resolution_width,omitempty"`
	// ResolutionHeight holds the value of the "resolution_height" field.
	ResolutionHeight uint16 `json:"resolution_height,omitempty"`
	// Framerate holds the value of the "framerate" field.
	Framerate uint8 `json:"framerate,omitempty"`
	// DurationSeconds holds the value of the "duration_seconds" field.
	DurationSeconds float64 `json:"duration_seconds,omitempty"`
	// MediaType holds the value of the "media_type" field.
	MediaType mediafile.MediaType `json:"media_type,omitempty"`
	// CreatedAt holds the value of the "created_at" field.
	CreatedAt time.Time `json:"created_at,omitempty"`
	// UpdatedAt holds the value of the "updated_at" field.
	UpdatedAt time.Time `json:"updated_at,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the MediaFileQuery when eager-loading is set.
	Edges MediaFileEdges `json:"edges"`
	// contains filtered or unexported fields
}

MediaFile is the model entity for the MediaFile schema.

func (*MediaFile) QueryMedia

func (mf *MediaFile) QueryMedia() *MediaQuery

QueryMedia queries the media edge of the MediaFile.

func (*MediaFile) String

func (mf *MediaFile) String() string

String implements the fmt.Stringer.

func (*MediaFile) Unwrap

func (mf *MediaFile) Unwrap() *MediaFile

Unwrap unwraps the entity that was returned from a transaction after it was closed, so that all next queries will be executed through the driver which created the transaction.

func (*MediaFile) Update

func (mf *MediaFile) Update() *MediaFileUpdateOne

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

type MediaFileClient

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

MediaFileClient is a client for the MediaFile schema.

func NewMediaFileClient

func NewMediaFileClient(c config) *MediaFileClient

NewMediaFileClient returns a client for the MediaFile from the given config.

func (*MediaFileClient) Create

func (c *MediaFileClient) Create() *MediaFileCreate

Create returns a create builder for MediaFile.

func (*MediaFileClient) CreateBulk

func (c *MediaFileClient) CreateBulk(builders ...*MediaFileCreate) *MediaFileCreateBulk

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

func (*MediaFileClient) Delete

func (c *MediaFileClient) Delete() *MediaFileDelete

Delete returns a delete builder for MediaFile.

func (*MediaFileClient) DeleteOne

func (c *MediaFileClient) DeleteOne(mf *MediaFile) *MediaFileDeleteOne

DeleteOne returns a delete builder for the given entity.

func (*MediaFileClient) DeleteOneID

func (c *MediaFileClient) DeleteOneID(id uuid.UUID) *MediaFileDeleteOne

DeleteOneID returns a delete builder for the given id.

func (*MediaFileClient) Get

func (c *MediaFileClient) Get(ctx context.Context, id uuid.UUID) (*MediaFile, error)

Get returns a MediaFile entity by its id.

func (*MediaFileClient) GetX

func (c *MediaFileClient) GetX(ctx context.Context, id uuid.UUID) *MediaFile

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

func (*MediaFileClient) Hooks

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

Hooks returns the client hooks.

func (*MediaFileClient) Query

func (c *MediaFileClient) Query() *MediaFileQuery

Query returns a query builder for MediaFile.

func (*MediaFileClient) QueryMedia

func (c *MediaFileClient) QueryMedia(mf *MediaFile) *MediaQuery

QueryMedia queries the media edge of a MediaFile.

func (*MediaFileClient) Update

func (c *MediaFileClient) Update() *MediaFileUpdate

Update returns an update builder for MediaFile.

func (*MediaFileClient) UpdateOne

func (c *MediaFileClient) UpdateOne(mf *MediaFile) *MediaFileUpdateOne

UpdateOne returns an update builder for the given entity.

func (*MediaFileClient) UpdateOneID

func (c *MediaFileClient) UpdateOneID(id uuid.UUID) *MediaFileUpdateOne

UpdateOneID returns an update builder for the given id.

func (*MediaFileClient) Use

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

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

type MediaFileCreate

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

MediaFileCreate is the builder for creating a MediaFile entity.

func (*MediaFileCreate) Mutation

func (mfc *MediaFileCreate) Mutation() *MediaFileMutation

Mutation returns the MediaFileMutation object of the builder.

func (*MediaFileCreate) Save

func (mfc *MediaFileCreate) Save(ctx context.Context) (*MediaFile, error)

Save creates the MediaFile in the database.

func (*MediaFileCreate) SaveX

func (mfc *MediaFileCreate) SaveX(ctx context.Context) *MediaFile

SaveX calls Save and panics if Save returns an error.

func (*MediaFileCreate) SetCreatedAt

func (mfc *MediaFileCreate) SetCreatedAt(t time.Time) *MediaFileCreate

SetCreatedAt sets the created_at field.

func (*MediaFileCreate) SetDurationSeconds

func (mfc *MediaFileCreate) SetDurationSeconds(f float64) *MediaFileCreate

SetDurationSeconds sets the duration_seconds field.

func (*MediaFileCreate) SetFormat

func (mfc *MediaFileCreate) SetFormat(s string) *MediaFileCreate

SetFormat sets the format field.

func (*MediaFileCreate) SetFramerate

func (mfc *MediaFileCreate) SetFramerate(u uint8) *MediaFileCreate

SetFramerate sets the framerate field.

func (*MediaFileCreate) SetID

func (mfc *MediaFileCreate) SetID(u uuid.UUID) *MediaFileCreate

SetID sets the id field.

func (*MediaFileCreate) SetMedia

func (mfc *MediaFileCreate) SetMedia(m *Media) *MediaFileCreate

SetMedia sets the media edge to Media.

func (*MediaFileCreate) SetMediaID

func (mfc *MediaFileCreate) SetMediaID(id uuid.UUID) *MediaFileCreate

SetMediaID sets the media edge to Media by id.

func (*MediaFileCreate) SetMediaType

func (mfc *MediaFileCreate) SetMediaType(mt mediafile.MediaType) *MediaFileCreate

SetMediaType sets the media_type field.

func (*MediaFileCreate) SetNillableCreatedAt

func (mfc *MediaFileCreate) SetNillableCreatedAt(t *time.Time) *MediaFileCreate

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

func (*MediaFileCreate) SetNillableTargetBandwidth

func (mfc *MediaFileCreate) SetNillableTargetBandwidth(u *uint64) *MediaFileCreate

SetNillableTargetBandwidth sets the target_bandwidth field if the given value is not nil.

func (*MediaFileCreate) SetNillableUpdatedAt

func (mfc *MediaFileCreate) SetNillableUpdatedAt(t *time.Time) *MediaFileCreate

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

func (*MediaFileCreate) SetRenditionName

func (mfc *MediaFileCreate) SetRenditionName(s string) *MediaFileCreate

SetRenditionName sets the rendition_name field.

func (*MediaFileCreate) SetResolutionHeight

func (mfc *MediaFileCreate) SetResolutionHeight(u uint16) *MediaFileCreate

SetResolutionHeight sets the resolution_height field.

func (*MediaFileCreate) SetResolutionWidth

func (mfc *MediaFileCreate) SetResolutionWidth(u uint16) *MediaFileCreate

SetResolutionWidth sets the resolution_width field.

func (*MediaFileCreate) SetTargetBandwidth

func (mfc *MediaFileCreate) SetTargetBandwidth(u uint64) *MediaFileCreate

SetTargetBandwidth sets the target_bandwidth field.

func (*MediaFileCreate) SetUpdatedAt

func (mfc *MediaFileCreate) SetUpdatedAt(t time.Time) *MediaFileCreate

SetUpdatedAt sets the updated_at field.

func (*MediaFileCreate) SetVideoBitrate

func (mfc *MediaFileCreate) SetVideoBitrate(i int64) *MediaFileCreate

SetVideoBitrate sets the video_bitrate field.

type MediaFileCreateBulk

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

MediaFileCreateBulk is the builder for creating a bulk of MediaFile entities.

func (*MediaFileCreateBulk) Save

func (mfcb *MediaFileCreateBulk) Save(ctx context.Context) ([]*MediaFile, error)

Save creates the MediaFile entities in the database.

func (*MediaFileCreateBulk) SaveX

func (mfcb *MediaFileCreateBulk) SaveX(ctx context.Context) []*MediaFile

SaveX calls Save and panics if Save returns an error.

type MediaFileDelete

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

MediaFileDelete is the builder for deleting a MediaFile entity.

func (*MediaFileDelete) Exec

func (mfd *MediaFileDelete) Exec(ctx context.Context) (int, error)

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

func (*MediaFileDelete) ExecX

func (mfd *MediaFileDelete) ExecX(ctx context.Context) int

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

func (*MediaFileDelete) Where

Where adds a new predicate to the delete builder.

type MediaFileDeleteOne

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

MediaFileDeleteOne is the builder for deleting a single MediaFile entity.

func (*MediaFileDeleteOne) Exec

func (mfdo *MediaFileDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*MediaFileDeleteOne) ExecX

func (mfdo *MediaFileDeleteOne) ExecX(ctx context.Context)

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

type MediaFileEdges

type MediaFileEdges struct {
	// Media holds the value of the media edge.
	Media *Media `json"media,omitempty"`
	// contains filtered or unexported fields
}

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

func (MediaFileEdges) MediaOrErr

func (e MediaFileEdges) MediaOrErr() (*Media, error)

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

type MediaFileGroupBy

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

MediaFileGroupBy is the builder for group-by MediaFile entities.

func (*MediaFileGroupBy) Aggregate

func (mfgb *MediaFileGroupBy) Aggregate(fns ...AggregateFunc) *MediaFileGroupBy

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

func (*MediaFileGroupBy) Bool

func (mfgb *MediaFileGroupBy) Bool(ctx context.Context) (_ bool, err error)

Bool returns a single bool from group-by. It is only allowed when querying group-by with one field.

func (*MediaFileGroupBy) BoolX

func (mfgb *MediaFileGroupBy) BoolX(ctx context.Context) bool

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

func (*MediaFileGroupBy) Bools

func (mfgb *MediaFileGroupBy) Bools(ctx context.Context) ([]bool, error)

Bools returns list of bools from group-by. It is only allowed when querying group-by with one field.

func (*MediaFileGroupBy) BoolsX

func (mfgb *MediaFileGroupBy) BoolsX(ctx context.Context) []bool

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

func (*MediaFileGroupBy) Float64

func (mfgb *MediaFileGroupBy) Float64(ctx context.Context) (_ float64, err error)

Float64 returns a single float64 from group-by. It is only allowed when querying group-by with one field.

func (*MediaFileGroupBy) Float64X

func (mfgb *MediaFileGroupBy) Float64X(ctx context.Context) float64

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

func (*MediaFileGroupBy) Float64s

func (mfgb *MediaFileGroupBy) Float64s(ctx context.Context) ([]float64, error)

Float64s returns list of float64s from group-by. It is only allowed when querying group-by with one field.

func (*MediaFileGroupBy) Float64sX

func (mfgb *MediaFileGroupBy) Float64sX(ctx context.Context) []float64

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

func (*MediaFileGroupBy) Int

func (mfgb *MediaFileGroupBy) Int(ctx context.Context) (_ int, err error)

Int returns a single int from group-by. It is only allowed when querying group-by with one field.

func (*MediaFileGroupBy) IntX

func (mfgb *MediaFileGroupBy) IntX(ctx context.Context) int

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

func (*MediaFileGroupBy) Ints

func (mfgb *MediaFileGroupBy) Ints(ctx context.Context) ([]int, error)

Ints returns list of ints from group-by. It is only allowed when querying group-by with one field.

func (*MediaFileGroupBy) IntsX

func (mfgb *MediaFileGroupBy) IntsX(ctx context.Context) []int

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

func (*MediaFileGroupBy) Scan

func (mfgb *MediaFileGroupBy) Scan(ctx context.Context, v interface{}) error

Scan applies the group-by query and scan the result into the given value.

func (*MediaFileGroupBy) ScanX

func (mfgb *MediaFileGroupBy) ScanX(ctx context.Context, v interface{})

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

func (*MediaFileGroupBy) String

func (mfgb *MediaFileGroupBy) String(ctx context.Context) (_ string, err error)

String returns a single string from group-by. It is only allowed when querying group-by with one field.

func (*MediaFileGroupBy) StringX

func (mfgb *MediaFileGroupBy) StringX(ctx context.Context) string

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

func (*MediaFileGroupBy) Strings

func (mfgb *MediaFileGroupBy) Strings(ctx context.Context) ([]string, error)

Strings returns list of strings from group-by. It is only allowed when querying group-by with one field.

func (*MediaFileGroupBy) StringsX

func (mfgb *MediaFileGroupBy) StringsX(ctx context.Context) []string

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

type MediaFileMutation

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

MediaFileMutation represents an operation that mutate the MediaFiles nodes in the graph.

func (*MediaFileMutation) AddDurationSeconds

func (m *MediaFileMutation) AddDurationSeconds(f float64)

AddDurationSeconds adds f to duration_seconds.

func (*MediaFileMutation) AddField

func (m *MediaFileMutation) AddField(name string, value ent.Value) error

AddField adds the value for the given name. It returns an error if the field is not defined in the schema, or if the type mismatch the field type.

func (*MediaFileMutation) AddFramerate

func (m *MediaFileMutation) AddFramerate(u uint8)

AddFramerate adds u to framerate.

func (*MediaFileMutation) AddResolutionHeight

func (m *MediaFileMutation) AddResolutionHeight(u uint16)

AddResolutionHeight adds u to resolution_height.

func (*MediaFileMutation) AddResolutionWidth

func (m *MediaFileMutation) AddResolutionWidth(u uint16)

AddResolutionWidth adds u to resolution_width.

func (*MediaFileMutation) AddTargetBandwidth

func (m *MediaFileMutation) AddTargetBandwidth(u uint64)

AddTargetBandwidth adds u to target_bandwidth.

func (*MediaFileMutation) AddVideoBitrate

func (m *MediaFileMutation) AddVideoBitrate(i int64)

AddVideoBitrate adds i to video_bitrate.

func (*MediaFileMutation) AddedDurationSeconds

func (m *MediaFileMutation) AddedDurationSeconds() (r float64, exists bool)

AddedDurationSeconds returns the value that was added to the duration_seconds field in this mutation.

func (*MediaFileMutation) AddedEdges

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

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

func (*MediaFileMutation) AddedField

func (m *MediaFileMutation) AddedField(name string) (ent.Value, bool)

AddedField returns the numeric value that was in/decremented from a field with the given name. The second value indicates that this field was not set, or was not define in the schema.

func (*MediaFileMutation) AddedFields

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

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

func (*MediaFileMutation) AddedFramerate

func (m *MediaFileMutation) AddedFramerate() (r uint8, exists bool)

AddedFramerate returns the value that was added to the framerate field in this mutation.

func (*MediaFileMutation) AddedIDs

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

AddedIDs returns all ids (to other nodes) that were added for the given edge name.

func (*MediaFileMutation) AddedResolutionHeight

func (m *MediaFileMutation) AddedResolutionHeight() (r uint16, exists bool)

AddedResolutionHeight returns the value that was added to the resolution_height field in this mutation.

func (*MediaFileMutation) AddedResolutionWidth

func (m *MediaFileMutation) AddedResolutionWidth() (r uint16, exists bool)

AddedResolutionWidth returns the value that was added to the resolution_width field in this mutation.

func (*MediaFileMutation) AddedTargetBandwidth

func (m *MediaFileMutation) AddedTargetBandwidth() (r uint64, exists bool)

AddedTargetBandwidth returns the value that was added to the target_bandwidth field in this mutation.

func (*MediaFileMutation) AddedVideoBitrate

func (m *MediaFileMutation) AddedVideoBitrate() (r int64, exists bool)

AddedVideoBitrate returns the value that was added to the video_bitrate field in this mutation.

func (*MediaFileMutation) ClearEdge

func (m *MediaFileMutation) ClearEdge(name string) error

ClearEdge clears the value for the given name. It returns an error if the edge name is not defined in the schema.

func (*MediaFileMutation) ClearField

func (m *MediaFileMutation) ClearField(name string) error

ClearField clears the value for the given name. It returns an error if the field is not defined in the schema.

func (*MediaFileMutation) ClearMedia

func (m *MediaFileMutation) ClearMedia()

ClearMedia clears the media edge to Media.

func (*MediaFileMutation) ClearedEdges

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

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

func (*MediaFileMutation) ClearedFields

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

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

func (MediaFileMutation) Client

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

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

CreatedAt returns the created_at value in the mutation.

func (*MediaFileMutation) DurationSeconds

func (m *MediaFileMutation) DurationSeconds() (r float64, exists bool)

DurationSeconds returns the duration_seconds value in the mutation.

func (*MediaFileMutation) EdgeCleared

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

EdgeCleared returns a boolean indicates if this edge was cleared in this mutation.

func (*MediaFileMutation) Field

func (m *MediaFileMutation) Field(name string) (ent.Value, bool)

Field returns the value of a field with the given name. The second boolean value indicates that this field was not set, or was not define in the schema.

func (*MediaFileMutation) FieldCleared

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

FieldCleared returns a boolean indicates if this field was cleared in this mutation.

func (*MediaFileMutation) Fields

func (m *MediaFileMutation) Fields() []string

Fields returns all fields that were changed during this mutation. Note that, in order to get all numeric fields that were in/decremented, call AddedFields().

func (*MediaFileMutation) Format

func (m *MediaFileMutation) Format() (r string, exists bool)

Format returns the format value in the mutation.

func (*MediaFileMutation) Framerate

func (m *MediaFileMutation) Framerate() (r uint8, exists bool)

Framerate returns the framerate value in the mutation.

func (*MediaFileMutation) ID

func (m *MediaFileMutation) ID() (id uuid.UUID, exists bool)

ID returns the id value in the mutation. Note that, the id is available only if it was provided to the builder.

func (*MediaFileMutation) MediaCleared

func (m *MediaFileMutation) MediaCleared() bool

MediaCleared returns if the edge media was cleared.

func (*MediaFileMutation) MediaID

func (m *MediaFileMutation) MediaID() (id uuid.UUID, exists bool)

MediaID returns the media id in the mutation.

func (*MediaFileMutation) MediaIDs

func (m *MediaFileMutation) MediaIDs() (ids []uuid.UUID)

MediaIDs returns the media ids in the mutation. Note that ids always returns len(ids) <= 1 for unique edges, and you should use MediaID instead. It exists only for internal usage by the builders.

func (*MediaFileMutation) MediaType

func (m *MediaFileMutation) MediaType() (r mediafile.MediaType, exists bool)

MediaType returns the media_type value in the mutation.

func (*MediaFileMutation) OldCreatedAt

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

OldCreatedAt returns the old created_at value of the MediaFile. If the MediaFile 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 database query fails.

func (*MediaFileMutation) OldDurationSeconds

func (m *MediaFileMutation) OldDurationSeconds(ctx context.Context) (v float64, err error)

OldDurationSeconds returns the old duration_seconds value of the MediaFile. If the MediaFile 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 database query fails.

func (*MediaFileMutation) OldField

func (m *MediaFileMutation) 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 was failed.

func (*MediaFileMutation) OldFormat

func (m *MediaFileMutation) OldFormat(ctx context.Context) (v string, err error)

OldFormat returns the old format value of the MediaFile. If the MediaFile 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 database query fails.

func (*MediaFileMutation) OldFramerate

func (m *MediaFileMutation) OldFramerate(ctx context.Context) (v uint8, err error)

OldFramerate returns the old framerate value of the MediaFile. If the MediaFile 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 database query fails.

func (*MediaFileMutation) OldMediaType

func (m *MediaFileMutation) OldMediaType(ctx context.Context) (v mediafile.MediaType, err error)

OldMediaType returns the old media_type value of the MediaFile. If the MediaFile 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 database query fails.

func (*MediaFileMutation) OldRenditionName

func (m *MediaFileMutation) OldRenditionName(ctx context.Context) (v string, err error)

OldRenditionName returns the old rendition_name value of the MediaFile. If the MediaFile 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 database query fails.

func (*MediaFileMutation) OldResolutionHeight

func (m *MediaFileMutation) OldResolutionHeight(ctx context.Context) (v uint16, err error)

OldResolutionHeight returns the old resolution_height value of the MediaFile. If the MediaFile 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 database query fails.

func (*MediaFileMutation) OldResolutionWidth

func (m *MediaFileMutation) OldResolutionWidth(ctx context.Context) (v uint16, err error)

OldResolutionWidth returns the old resolution_width value of the MediaFile. If the MediaFile 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 database query fails.

func (*MediaFileMutation) OldTargetBandwidth

func (m *MediaFileMutation) OldTargetBandwidth(ctx context.Context) (v uint64, err error)

OldTargetBandwidth returns the old target_bandwidth value of the MediaFile. If the MediaFile 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 database query fails.

func (*MediaFileMutation) OldUpdatedAt

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

OldUpdatedAt returns the old updated_at value of the MediaFile. If the MediaFile 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 database query fails.

func (*MediaFileMutation) OldVideoBitrate

func (m *MediaFileMutation) OldVideoBitrate(ctx context.Context) (v int64, err error)

OldVideoBitrate returns the old video_bitrate value of the MediaFile. If the MediaFile 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 database query fails.

func (*MediaFileMutation) Op

func (m *MediaFileMutation) Op() Op

Op returns the operation name.

func (*MediaFileMutation) RemovedEdges

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

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

func (*MediaFileMutation) RemovedIDs

func (m *MediaFileMutation) RemovedIDs(name string) []ent.Value

RemovedIDs returns all ids (to other nodes) that were removed for the given edge name.

func (*MediaFileMutation) RenditionName

func (m *MediaFileMutation) RenditionName() (r string, exists bool)

RenditionName returns the rendition_name value in the mutation.

func (*MediaFileMutation) ResetCreatedAt

func (m *MediaFileMutation) ResetCreatedAt()

ResetCreatedAt reset all changes of the "created_at" field.

func (*MediaFileMutation) ResetDurationSeconds

func (m *MediaFileMutation) ResetDurationSeconds()

ResetDurationSeconds reset all changes of the "duration_seconds" field.

func (*MediaFileMutation) ResetEdge

func (m *MediaFileMutation) ResetEdge(name string) error

ResetEdge resets all changes in the mutation regarding the given edge name. It returns an error if the edge is not defined in the schema.

func (*MediaFileMutation) ResetField

func (m *MediaFileMutation) ResetField(name string) error

ResetField resets all changes in the mutation regarding the given field name. It returns an error if the field is not defined in the schema.

func (*MediaFileMutation) ResetFormat

func (m *MediaFileMutation) ResetFormat()

ResetFormat reset all changes of the "format" field.

func (*MediaFileMutation) ResetFramerate

func (m *MediaFileMutation) ResetFramerate()

ResetFramerate reset all changes of the "framerate" field.

func (*MediaFileMutation) ResetMedia

func (m *MediaFileMutation) ResetMedia()

ResetMedia reset all changes of the "media" edge.

func (*MediaFileMutation) ResetMediaType

func (m *MediaFileMutation) ResetMediaType()

ResetMediaType reset all changes of the "media_type" field.

func (*MediaFileMutation) ResetRenditionName

func (m *MediaFileMutation) ResetRenditionName()

ResetRenditionName reset all changes of the "rendition_name" field.

func (*MediaFileMutation) ResetResolutionHeight

func (m *MediaFileMutation) ResetResolutionHeight()

ResetResolutionHeight reset all changes of the "resolution_height" field.

func (*MediaFileMutation) ResetResolutionWidth

func (m *MediaFileMutation) ResetResolutionWidth()

ResetResolutionWidth reset all changes of the "resolution_width" field.

func (*MediaFileMutation) ResetTargetBandwidth

func (m *MediaFileMutation) ResetTargetBandwidth()

ResetTargetBandwidth reset all changes of the "target_bandwidth" field.

func (*MediaFileMutation) ResetUpdatedAt

func (m *MediaFileMutation) ResetUpdatedAt()

ResetUpdatedAt reset all changes of the "updated_at" field.

func (*MediaFileMutation) ResetVideoBitrate

func (m *MediaFileMutation) ResetVideoBitrate()

ResetVideoBitrate reset all changes of the "video_bitrate" field.

func (*MediaFileMutation) ResolutionHeight

func (m *MediaFileMutation) ResolutionHeight() (r uint16, exists bool)

ResolutionHeight returns the resolution_height value in the mutation.

func (*MediaFileMutation) ResolutionWidth

func (m *MediaFileMutation) ResolutionWidth() (r uint16, exists bool)

ResolutionWidth returns the resolution_width value in the mutation.

func (*MediaFileMutation) SetCreatedAt

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

SetCreatedAt sets the created_at field.

func (*MediaFileMutation) SetDurationSeconds

func (m *MediaFileMutation) SetDurationSeconds(f float64)

SetDurationSeconds sets the duration_seconds field.

func (*MediaFileMutation) SetField

func (m *MediaFileMutation) SetField(name string, value ent.Value) error

SetField sets the value for the given name. It returns an error if the field is not defined in the schema, or if the type mismatch the field type.

func (*MediaFileMutation) SetFormat

func (m *MediaFileMutation) SetFormat(s string)

SetFormat sets the format field.

func (*MediaFileMutation) SetFramerate

func (m *MediaFileMutation) SetFramerate(u uint8)

SetFramerate sets the framerate field.

func (*MediaFileMutation) SetID

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

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

func (*MediaFileMutation) SetMediaID

func (m *MediaFileMutation) SetMediaID(id uuid.UUID)

SetMediaID sets the media edge to Media by id.

func (*MediaFileMutation) SetMediaType

func (m *MediaFileMutation) SetMediaType(mt mediafile.MediaType)

SetMediaType sets the media_type field.

func (*MediaFileMutation) SetRenditionName

func (m *MediaFileMutation) SetRenditionName(s string)

SetRenditionName sets the rendition_name field.

func (*MediaFileMutation) SetResolutionHeight

func (m *MediaFileMutation) SetResolutionHeight(u uint16)

SetResolutionHeight sets the resolution_height field.

func (*MediaFileMutation) SetResolutionWidth

func (m *MediaFileMutation) SetResolutionWidth(u uint16)

SetResolutionWidth sets the resolution_width field.

func (*MediaFileMutation) SetTargetBandwidth

func (m *MediaFileMutation) SetTargetBandwidth(u uint64)

SetTargetBandwidth sets the target_bandwidth field.

func (*MediaFileMutation) SetUpdatedAt

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

SetUpdatedAt sets the updated_at field.

func (*MediaFileMutation) SetVideoBitrate

func (m *MediaFileMutation) SetVideoBitrate(i int64)

SetVideoBitrate sets the video_bitrate field.

func (*MediaFileMutation) TargetBandwidth

func (m *MediaFileMutation) TargetBandwidth() (r uint64, exists bool)

TargetBandwidth returns the target_bandwidth value in the mutation.

func (MediaFileMutation) Tx

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

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

func (*MediaFileMutation) Type

func (m *MediaFileMutation) Type() string

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

func (*MediaFileMutation) UpdatedAt

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

UpdatedAt returns the updated_at value in the mutation.

func (*MediaFileMutation) VideoBitrate

func (m *MediaFileMutation) VideoBitrate() (r int64, exists bool)

VideoBitrate returns the video_bitrate value in the mutation.

type MediaFileQuery

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

MediaFileQuery is the builder for querying MediaFile entities.

func (*MediaFileQuery) All

func (mfq *MediaFileQuery) All(ctx context.Context) ([]*MediaFile, error)

All executes the query and returns a list of MediaFiles.

func (*MediaFileQuery) AllX

func (mfq *MediaFileQuery) AllX(ctx context.Context) []*MediaFile

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

func (*MediaFileQuery) Clone

func (mfq *MediaFileQuery) Clone() *MediaFileQuery

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

func (*MediaFileQuery) Count

func (mfq *MediaFileQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*MediaFileQuery) CountX

func (mfq *MediaFileQuery) CountX(ctx context.Context) int

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

func (*MediaFileQuery) Exist

func (mfq *MediaFileQuery) Exist(ctx context.Context) (bool, error)

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

func (*MediaFileQuery) ExistX

func (mfq *MediaFileQuery) ExistX(ctx context.Context) bool

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

func (*MediaFileQuery) First

func (mfq *MediaFileQuery) First(ctx context.Context) (*MediaFile, error)

First returns the first MediaFile entity in the query. Returns *NotFoundError when no mediafile was found.

func (*MediaFileQuery) FirstID

func (mfq *MediaFileQuery) FirstID(ctx context.Context) (id uuid.UUID, err error)

FirstID returns the first MediaFile id in the query. Returns *NotFoundError when no id was found.

func (*MediaFileQuery) FirstIDX

func (mfq *MediaFileQuery) FirstIDX(ctx context.Context) uuid.UUID

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

func (*MediaFileQuery) FirstX

func (mfq *MediaFileQuery) FirstX(ctx context.Context) *MediaFile

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

func (*MediaFileQuery) GroupBy

func (mfq *MediaFileQuery) GroupBy(field string, fields ...string) *MediaFileGroupBy

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

client.MediaFile.Query().
	GroupBy(mediafile.FieldRenditionName).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*MediaFileQuery) IDs

func (mfq *MediaFileQuery) IDs(ctx context.Context) ([]uuid.UUID, error)

IDs executes the query and returns a list of MediaFile ids.

func (*MediaFileQuery) IDsX

func (mfq *MediaFileQuery) IDsX(ctx context.Context) []uuid.UUID

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

func (*MediaFileQuery) Limit

func (mfq *MediaFileQuery) Limit(limit int) *MediaFileQuery

Limit adds a limit step to the query.

func (*MediaFileQuery) Offset

func (mfq *MediaFileQuery) Offset(offset int) *MediaFileQuery

Offset adds an offset step to the query.

func (*MediaFileQuery) Only

func (mfq *MediaFileQuery) Only(ctx context.Context) (*MediaFile, error)

Only returns the only MediaFile entity in the query, returns an error if not exactly one entity was returned.

func (*MediaFileQuery) OnlyID

func (mfq *MediaFileQuery) OnlyID(ctx context.Context) (id uuid.UUID, err error)

OnlyID returns the only MediaFile id in the query, returns an error if not exactly one id was returned.

func (*MediaFileQuery) OnlyIDX

func (mfq *MediaFileQuery) OnlyIDX(ctx context.Context) uuid.UUID

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

func (*MediaFileQuery) OnlyX

func (mfq *MediaFileQuery) OnlyX(ctx context.Context) *MediaFile

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

func (*MediaFileQuery) Order

func (mfq *MediaFileQuery) Order(o ...OrderFunc) *MediaFileQuery

Order adds an order step to the query.

func (*MediaFileQuery) QueryMedia

func (mfq *MediaFileQuery) QueryMedia() *MediaQuery

QueryMedia chains the current query on the media edge.

func (*MediaFileQuery) Select

func (mfq *MediaFileQuery) Select(field string, fields ...string) *MediaFileSelect

Select one or more fields from the given query.

Example:

var v []struct {
	RenditionName string `json:"rendition_name,omitempty"`
}

client.MediaFile.Query().
	Select(mediafile.FieldRenditionName).
	Scan(ctx, &v)

func (*MediaFileQuery) Where

func (mfq *MediaFileQuery) Where(ps ...predicate.MediaFile) *MediaFileQuery

Where adds a new predicate for the builder.

func (*MediaFileQuery) WithMedia

func (mfq *MediaFileQuery) WithMedia(opts ...func(*MediaQuery)) *MediaFileQuery
WithMedia tells the query-builder to eager-loads the nodes that are connected to

the "media" edge. The optional arguments used to configure the query builder of the edge.

type MediaFileSelect

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

MediaFileSelect is the builder for select fields of MediaFile entities.

func (*MediaFileSelect) Bool

func (mfs *MediaFileSelect) Bool(ctx context.Context) (_ bool, err error)

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

func (*MediaFileSelect) BoolX

func (mfs *MediaFileSelect) BoolX(ctx context.Context) bool

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

func (*MediaFileSelect) Bools

func (mfs *MediaFileSelect) Bools(ctx context.Context) ([]bool, error)

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

func (*MediaFileSelect) BoolsX

func (mfs *MediaFileSelect) BoolsX(ctx context.Context) []bool

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

func (*MediaFileSelect) Float64

func (mfs *MediaFileSelect) Float64(ctx context.Context) (_ float64, err error)

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

func (*MediaFileSelect) Float64X

func (mfs *MediaFileSelect) Float64X(ctx context.Context) float64

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

func (*MediaFileSelect) Float64s

func (mfs *MediaFileSelect) Float64s(ctx context.Context) ([]float64, error)

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

func (*MediaFileSelect) Float64sX

func (mfs *MediaFileSelect) Float64sX(ctx context.Context) []float64

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

func (*MediaFileSelect) Int

func (mfs *MediaFileSelect) Int(ctx context.Context) (_ int, err error)

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

func (*MediaFileSelect) IntX

func (mfs *MediaFileSelect) IntX(ctx context.Context) int

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

func (*MediaFileSelect) Ints

func (mfs *MediaFileSelect) Ints(ctx context.Context) ([]int, error)

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

func (*MediaFileSelect) IntsX

func (mfs *MediaFileSelect) IntsX(ctx context.Context) []int

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

func (*MediaFileSelect) Scan

func (mfs *MediaFileSelect) Scan(ctx context.Context, v interface{}) error

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

func (*MediaFileSelect) ScanX

func (mfs *MediaFileSelect) ScanX(ctx context.Context, v interface{})

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

func (*MediaFileSelect) String

func (mfs *MediaFileSelect) String(ctx context.Context) (_ string, err error)

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

func (*MediaFileSelect) StringX

func (mfs *MediaFileSelect) StringX(ctx context.Context) string

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

func (*MediaFileSelect) Strings

func (mfs *MediaFileSelect) Strings(ctx context.Context) ([]string, error)

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

func (*MediaFileSelect) StringsX

func (mfs *MediaFileSelect) StringsX(ctx context.Context) []string

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

type MediaFileUpdate

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

MediaFileUpdate is the builder for updating MediaFile entities.

func (*MediaFileUpdate) AddDurationSeconds

func (mfu *MediaFileUpdate) AddDurationSeconds(f float64) *MediaFileUpdate

AddDurationSeconds adds f to duration_seconds.

func (*MediaFileUpdate) AddFramerate

func (mfu *MediaFileUpdate) AddFramerate(u uint8) *MediaFileUpdate

AddFramerate adds u to framerate.

func (*MediaFileUpdate) AddResolutionHeight

func (mfu *MediaFileUpdate) AddResolutionHeight(u uint16) *MediaFileUpdate

AddResolutionHeight adds u to resolution_height.

func (*MediaFileUpdate) AddResolutionWidth

func (mfu *MediaFileUpdate) AddResolutionWidth(u uint16) *MediaFileUpdate

AddResolutionWidth adds u to resolution_width.

func (*MediaFileUpdate) AddTargetBandwidth

func (mfu *MediaFileUpdate) AddTargetBandwidth(u uint64) *MediaFileUpdate

AddTargetBandwidth adds u to target_bandwidth.

func (*MediaFileUpdate) AddVideoBitrate

func (mfu *MediaFileUpdate) AddVideoBitrate(i int64) *MediaFileUpdate

AddVideoBitrate adds i to video_bitrate.

func (*MediaFileUpdate) ClearMedia

func (mfu *MediaFileUpdate) ClearMedia() *MediaFileUpdate

ClearMedia clears the "media" edge to type Media.

func (*MediaFileUpdate) Exec

func (mfu *MediaFileUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*MediaFileUpdate) ExecX

func (mfu *MediaFileUpdate) ExecX(ctx context.Context)

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

func (*MediaFileUpdate) Mutation

func (mfu *MediaFileUpdate) Mutation() *MediaFileMutation

Mutation returns the MediaFileMutation object of the builder.

func (*MediaFileUpdate) Save

func (mfu *MediaFileUpdate) Save(ctx context.Context) (int, error)

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

func (*MediaFileUpdate) SaveX

func (mfu *MediaFileUpdate) SaveX(ctx context.Context) int

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

func (*MediaFileUpdate) SetCreatedAt

func (mfu *MediaFileUpdate) SetCreatedAt(t time.Time) *MediaFileUpdate

SetCreatedAt sets the created_at field.

func (*MediaFileUpdate) SetDurationSeconds

func (mfu *MediaFileUpdate) SetDurationSeconds(f float64) *MediaFileUpdate

SetDurationSeconds sets the duration_seconds field.

func (*MediaFileUpdate) SetFormat

func (mfu *MediaFileUpdate) SetFormat(s string) *MediaFileUpdate

SetFormat sets the format field.

func (*MediaFileUpdate) SetFramerate

func (mfu *MediaFileUpdate) SetFramerate(u uint8) *MediaFileUpdate

SetFramerate sets the framerate field.

func (*MediaFileUpdate) SetMedia

func (mfu *MediaFileUpdate) SetMedia(m *Media) *MediaFileUpdate

SetMedia sets the media edge to Media.

func (*MediaFileUpdate) SetMediaID

func (mfu *MediaFileUpdate) SetMediaID(id uuid.UUID) *MediaFileUpdate

SetMediaID sets the media edge to Media by id.

func (*MediaFileUpdate) SetMediaType

func (mfu *MediaFileUpdate) SetMediaType(mt mediafile.MediaType) *MediaFileUpdate

SetMediaType sets the media_type field.

func (*MediaFileUpdate) SetNillableCreatedAt

func (mfu *MediaFileUpdate) SetNillableCreatedAt(t *time.Time) *MediaFileUpdate

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

func (*MediaFileUpdate) SetNillableTargetBandwidth

func (mfu *MediaFileUpdate) SetNillableTargetBandwidth(u *uint64) *MediaFileUpdate

SetNillableTargetBandwidth sets the target_bandwidth field if the given value is not nil.

func (*MediaFileUpdate) SetRenditionName

func (mfu *MediaFileUpdate) SetRenditionName(s string) *MediaFileUpdate

SetRenditionName sets the rendition_name field.

func (*MediaFileUpdate) SetResolutionHeight

func (mfu *MediaFileUpdate) SetResolutionHeight(u uint16) *MediaFileUpdate

SetResolutionHeight sets the resolution_height field.

func (*MediaFileUpdate) SetResolutionWidth

func (mfu *MediaFileUpdate) SetResolutionWidth(u uint16) *MediaFileUpdate

SetResolutionWidth sets the resolution_width field.

func (*MediaFileUpdate) SetTargetBandwidth

func (mfu *MediaFileUpdate) SetTargetBandwidth(u uint64) *MediaFileUpdate

SetTargetBandwidth sets the target_bandwidth field.

func (*MediaFileUpdate) SetUpdatedAt

func (mfu *MediaFileUpdate) SetUpdatedAt(t time.Time) *MediaFileUpdate

SetUpdatedAt sets the updated_at field.

func (*MediaFileUpdate) SetVideoBitrate

func (mfu *MediaFileUpdate) SetVideoBitrate(i int64) *MediaFileUpdate

SetVideoBitrate sets the video_bitrate field.

func (*MediaFileUpdate) Where

Where adds a new predicate for the builder.

type MediaFileUpdateOne

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

MediaFileUpdateOne is the builder for updating a single MediaFile entity.

func (*MediaFileUpdateOne) AddDurationSeconds

func (mfuo *MediaFileUpdateOne) AddDurationSeconds(f float64) *MediaFileUpdateOne

AddDurationSeconds adds f to duration_seconds.

func (*MediaFileUpdateOne) AddFramerate

func (mfuo *MediaFileUpdateOne) AddFramerate(u uint8) *MediaFileUpdateOne

AddFramerate adds u to framerate.

func (*MediaFileUpdateOne) AddResolutionHeight

func (mfuo *MediaFileUpdateOne) AddResolutionHeight(u uint16) *MediaFileUpdateOne

AddResolutionHeight adds u to resolution_height.

func (*MediaFileUpdateOne) AddResolutionWidth

func (mfuo *MediaFileUpdateOne) AddResolutionWidth(u uint16) *MediaFileUpdateOne

AddResolutionWidth adds u to resolution_width.

func (*MediaFileUpdateOne) AddTargetBandwidth

func (mfuo *MediaFileUpdateOne) AddTargetBandwidth(u uint64) *MediaFileUpdateOne

AddTargetBandwidth adds u to target_bandwidth.

func (*MediaFileUpdateOne) AddVideoBitrate

func (mfuo *MediaFileUpdateOne) AddVideoBitrate(i int64) *MediaFileUpdateOne

AddVideoBitrate adds i to video_bitrate.

func (*MediaFileUpdateOne) ClearMedia

func (mfuo *MediaFileUpdateOne) ClearMedia() *MediaFileUpdateOne

ClearMedia clears the "media" edge to type Media.

func (*MediaFileUpdateOne) Exec

func (mfuo *MediaFileUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*MediaFileUpdateOne) ExecX

func (mfuo *MediaFileUpdateOne) ExecX(ctx context.Context)

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

func (*MediaFileUpdateOne) Mutation

func (mfuo *MediaFileUpdateOne) Mutation() *MediaFileMutation

Mutation returns the MediaFileMutation object of the builder.

func (*MediaFileUpdateOne) Save

func (mfuo *MediaFileUpdateOne) Save(ctx context.Context) (*MediaFile, error)

Save executes the query and returns the updated entity.

func (*MediaFileUpdateOne) SaveX

func (mfuo *MediaFileUpdateOne) SaveX(ctx context.Context) *MediaFile

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

func (*MediaFileUpdateOne) SetCreatedAt

func (mfuo *MediaFileUpdateOne) SetCreatedAt(t time.Time) *MediaFileUpdateOne

SetCreatedAt sets the created_at field.

func (*MediaFileUpdateOne) SetDurationSeconds

func (mfuo *MediaFileUpdateOne) SetDurationSeconds(f float64) *MediaFileUpdateOne

SetDurationSeconds sets the duration_seconds field.

func (*MediaFileUpdateOne) SetFormat

func (mfuo *MediaFileUpdateOne) SetFormat(s string) *MediaFileUpdateOne

SetFormat sets the format field.

func (*MediaFileUpdateOne) SetFramerate

func (mfuo *MediaFileUpdateOne) SetFramerate(u uint8) *MediaFileUpdateOne

SetFramerate sets the framerate field.

func (*MediaFileUpdateOne) SetMedia

func (mfuo *MediaFileUpdateOne) SetMedia(m *Media) *MediaFileUpdateOne

SetMedia sets the media edge to Media.

func (*MediaFileUpdateOne) SetMediaID

func (mfuo *MediaFileUpdateOne) SetMediaID(id uuid.UUID) *MediaFileUpdateOne

SetMediaID sets the media edge to Media by id.

func (*MediaFileUpdateOne) SetMediaType

func (mfuo *MediaFileUpdateOne) SetMediaType(mt mediafile.MediaType) *MediaFileUpdateOne

SetMediaType sets the media_type field.

func (*MediaFileUpdateOne) SetNillableCreatedAt

func (mfuo *MediaFileUpdateOne) SetNillableCreatedAt(t *time.Time) *MediaFileUpdateOne

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

func (*MediaFileUpdateOne) SetNillableTargetBandwidth

func (mfuo *MediaFileUpdateOne) SetNillableTargetBandwidth(u *uint64) *MediaFileUpdateOne

SetNillableTargetBandwidth sets the target_bandwidth field if the given value is not nil.

func (*MediaFileUpdateOne) SetRenditionName

func (mfuo *MediaFileUpdateOne) SetRenditionName(s string) *MediaFileUpdateOne

SetRenditionName sets the rendition_name field.

func (*MediaFileUpdateOne) SetResolutionHeight

func (mfuo *MediaFileUpdateOne) SetResolutionHeight(u uint16) *MediaFileUpdateOne

SetResolutionHeight sets the resolution_height field.

func (*MediaFileUpdateOne) SetResolutionWidth

func (mfuo *MediaFileUpdateOne) SetResolutionWidth(u uint16) *MediaFileUpdateOne

SetResolutionWidth sets the resolution_width field.

func (*MediaFileUpdateOne) SetTargetBandwidth

func (mfuo *MediaFileUpdateOne) SetTargetBandwidth(u uint64) *MediaFileUpdateOne

SetTargetBandwidth sets the target_bandwidth field.

func (*MediaFileUpdateOne) SetUpdatedAt

func (mfuo *MediaFileUpdateOne) SetUpdatedAt(t time.Time) *MediaFileUpdateOne

SetUpdatedAt sets the updated_at field.

func (*MediaFileUpdateOne) SetVideoBitrate

func (mfuo *MediaFileUpdateOne) SetVideoBitrate(i int64) *MediaFileUpdateOne

SetVideoBitrate sets the video_bitrate field.

type MediaFiles

type MediaFiles []*MediaFile

MediaFiles is a parsable slice of MediaFile.

type MediaGroupBy

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

MediaGroupBy is the builder for group-by Media entities.

func (*MediaGroupBy) Aggregate

func (mgb *MediaGroupBy) Aggregate(fns ...AggregateFunc) *MediaGroupBy

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

func (*MediaGroupBy) Bool

func (mgb *MediaGroupBy) Bool(ctx context.Context) (_ bool, err error)

Bool returns a single bool from group-by. It is only allowed when querying group-by with one field.

func (*MediaGroupBy) BoolX

func (mgb *MediaGroupBy) BoolX(ctx context.Context) bool

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

func (*MediaGroupBy) Bools

func (mgb *MediaGroupBy) Bools(ctx context.Context) ([]bool, error)

Bools returns list of bools from group-by. It is only allowed when querying group-by with one field.

func (*MediaGroupBy) BoolsX

func (mgb *MediaGroupBy) BoolsX(ctx context.Context) []bool

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

func (*MediaGroupBy) Float64

func (mgb *MediaGroupBy) Float64(ctx context.Context) (_ float64, err error)

Float64 returns a single float64 from group-by. It is only allowed when querying group-by with one field.

func (*MediaGroupBy) Float64X

func (mgb *MediaGroupBy) Float64X(ctx context.Context) float64

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

func (*MediaGroupBy) Float64s

func (mgb *MediaGroupBy) Float64s(ctx context.Context) ([]float64, error)

Float64s returns list of float64s from group-by. It is only allowed when querying group-by with one field.

func (*MediaGroupBy) Float64sX

func (mgb *MediaGroupBy) Float64sX(ctx context.Context) []float64

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

func (*MediaGroupBy) Int

func (mgb *MediaGroupBy) Int(ctx context.Context) (_ int, err error)

Int returns a single int from group-by. It is only allowed when querying group-by with one field.

func (*MediaGroupBy) IntX

func (mgb *MediaGroupBy) IntX(ctx context.Context) int

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

func (*MediaGroupBy) Ints

func (mgb *MediaGroupBy) Ints(ctx context.Context) ([]int, error)

Ints returns list of ints from group-by. It is only allowed when querying group-by with one field.

func (*MediaGroupBy) IntsX

func (mgb *MediaGroupBy) IntsX(ctx context.Context) []int

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

func (*MediaGroupBy) Scan

func (mgb *MediaGroupBy) Scan(ctx context.Context, v interface{}) error

Scan applies the group-by query and scan the result into the given value.

func (*MediaGroupBy) ScanX

func (mgb *MediaGroupBy) ScanX(ctx context.Context, v interface{})

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

func (*MediaGroupBy) String

func (mgb *MediaGroupBy) String(ctx context.Context) (_ string, err error)

String returns a single string from group-by. It is only allowed when querying group-by with one field.

func (*MediaGroupBy) StringX

func (mgb *MediaGroupBy) StringX(ctx context.Context) string

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

func (*MediaGroupBy) Strings

func (mgb *MediaGroupBy) Strings(ctx context.Context) ([]string, error)

Strings returns list of strings from group-by. It is only allowed when querying group-by with one field.

func (*MediaGroupBy) StringsX

func (mgb *MediaGroupBy) StringsX(ctx context.Context) []string

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

type MediaMutation

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

MediaMutation represents an operation that mutate the MediaSlice nodes in the graph.

func (*MediaMutation) AddField

func (m *MediaMutation) AddField(name string, value ent.Value) error

AddField adds the value for the given name. It returns an error if the field is not defined in the schema, or if the type mismatch the field type.

func (*MediaMutation) AddMediaFileIDs

func (m *MediaMutation) AddMediaFileIDs(ids ...uuid.UUID)

AddMediaFileIDs adds the media_files edge to MediaFile by ids.

func (*MediaMutation) AddedEdges

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

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

func (*MediaMutation) AddedField

func (m *MediaMutation) AddedField(name string) (ent.Value, bool)

AddedField returns the numeric value that was in/decremented from a field with the given name. The second value indicates that this field was not set, or was not define in the schema.

func (*MediaMutation) AddedFields

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

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

func (*MediaMutation) AddedIDs

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

AddedIDs returns all ids (to other nodes) that were added for the given edge name.

func (*MediaMutation) ClearEdge

func (m *MediaMutation) ClearEdge(name string) error

ClearEdge clears the value for the given name. It returns an error if the edge name is not defined in the schema.

func (*MediaMutation) ClearField

func (m *MediaMutation) ClearField(name string) error

ClearField clears the value for the given name. It returns an error if the field is not defined in the schema.

func (*MediaMutation) ClearMediaFiles

func (m *MediaMutation) ClearMediaFiles()

ClearMediaFiles clears the media_files edge to MediaFile.

func (*MediaMutation) ClearOriginalFilename

func (m *MediaMutation) ClearOriginalFilename()

ClearOriginalFilename clears the value of original_filename.

func (*MediaMutation) ClearedEdges

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

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

func (*MediaMutation) ClearedFields

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

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

func (MediaMutation) Client

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

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

CreatedAt returns the created_at value in the mutation.

func (*MediaMutation) EdgeCleared

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

EdgeCleared returns a boolean indicates if this edge was cleared in this mutation.

func (*MediaMutation) Field

func (m *MediaMutation) Field(name string) (ent.Value, bool)

Field returns the value of a field with the given name. The second boolean value indicates that this field was not set, or was not define in the schema.

func (*MediaMutation) FieldCleared

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

FieldCleared returns a boolean indicates if this field was cleared in this mutation.

func (*MediaMutation) Fields

func (m *MediaMutation) Fields() []string

Fields returns all fields that were changed during this mutation. Note that, in order to get all numeric fields that were in/decremented, call AddedFields().

func (*MediaMutation) ID

func (m *MediaMutation) ID() (id uuid.UUID, exists bool)

ID returns the id value in the mutation. Note that, the id is available only if it was provided to the builder.

func (*MediaMutation) MediaFilesCleared

func (m *MediaMutation) MediaFilesCleared() bool

MediaFilesCleared returns if the edge media_files was cleared.

func (*MediaMutation) MediaFilesIDs

func (m *MediaMutation) MediaFilesIDs() (ids []uuid.UUID)

MediaFilesIDs returns the media_files ids in the mutation.

func (*MediaMutation) OldCreatedAt

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

OldCreatedAt returns the old created_at value of the Media. If the Media 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 database query fails.

func (*MediaMutation) OldField

func (m *MediaMutation) 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 was failed.

func (*MediaMutation) OldOriginalFilename

func (m *MediaMutation) OldOriginalFilename(ctx context.Context) (v string, err error)

OldOriginalFilename returns the old original_filename value of the Media. If the Media 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 database query fails.

func (*MediaMutation) OldStatus

func (m *MediaMutation) OldStatus(ctx context.Context) (v media.Status, err error)

OldStatus returns the old status value of the Media. If the Media 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 database query fails.

func (*MediaMutation) OldTitle

func (m *MediaMutation) OldTitle(ctx context.Context) (v string, err error)

OldTitle returns the old title value of the Media. If the Media 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 database query fails.

func (*MediaMutation) OldUpdatedAt

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

OldUpdatedAt returns the old updated_at value of the Media. If the Media 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 database query fails.

func (*MediaMutation) Op

func (m *MediaMutation) Op() Op

Op returns the operation name.

func (*MediaMutation) OriginalFilename

func (m *MediaMutation) OriginalFilename() (r string, exists bool)

OriginalFilename returns the original_filename value in the mutation.

func (*MediaMutation) OriginalFilenameCleared

func (m *MediaMutation) OriginalFilenameCleared() bool

OriginalFilenameCleared returns if the field original_filename was cleared in this mutation.

func (*MediaMutation) RemoveMediaFileIDs

func (m *MediaMutation) RemoveMediaFileIDs(ids ...uuid.UUID)

RemoveMediaFileIDs removes the media_files edge to MediaFile by ids.

func (*MediaMutation) RemovedEdges

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

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

func (*MediaMutation) RemovedIDs

func (m *MediaMutation) RemovedIDs(name string) []ent.Value

RemovedIDs returns all ids (to other nodes) that were removed for the given edge name.

func (*MediaMutation) RemovedMediaFilesIDs

func (m *MediaMutation) RemovedMediaFilesIDs() (ids []uuid.UUID)

RemovedMediaFiles returns the removed ids of media_files.

func (*MediaMutation) ResetCreatedAt

func (m *MediaMutation) ResetCreatedAt()

ResetCreatedAt reset all changes of the "created_at" field.

func (*MediaMutation) ResetEdge

func (m *MediaMutation) ResetEdge(name string) error

ResetEdge resets all changes in the mutation regarding the given edge name. It returns an error if the edge is not defined in the schema.

func (*MediaMutation) ResetField

func (m *MediaMutation) ResetField(name string) error

ResetField resets all changes in the mutation regarding the given field name. It returns an error if the field is not defined in the schema.

func (*MediaMutation) ResetMediaFiles

func (m *MediaMutation) ResetMediaFiles()

ResetMediaFiles reset all changes of the "media_files" edge.

func (*MediaMutation) ResetOriginalFilename

func (m *MediaMutation) ResetOriginalFilename()

ResetOriginalFilename reset all changes of the "original_filename" field.

func (*MediaMutation) ResetStatus

func (m *MediaMutation) ResetStatus()

ResetStatus reset all changes of the "status" field.

func (*MediaMutation) ResetTitle

func (m *MediaMutation) ResetTitle()

ResetTitle reset all changes of the "title" field.

func (*MediaMutation) ResetUpdatedAt

func (m *MediaMutation) ResetUpdatedAt()

ResetUpdatedAt reset all changes of the "updated_at" field.

func (*MediaMutation) SetCreatedAt

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

SetCreatedAt sets the created_at field.

func (*MediaMutation) SetField

func (m *MediaMutation) SetField(name string, value ent.Value) error

SetField sets the value for the given name. It returns an error if the field is not defined in the schema, or if the type mismatch the field type.

func (*MediaMutation) SetID

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

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

func (*MediaMutation) SetOriginalFilename

func (m *MediaMutation) SetOriginalFilename(s string)

SetOriginalFilename sets the original_filename field.

func (*MediaMutation) SetStatus

func (m *MediaMutation) SetStatus(value media.Status)

SetStatus sets the status field.

func (*MediaMutation) SetTitle

func (m *MediaMutation) SetTitle(s string)

SetTitle sets the title field.

func (*MediaMutation) SetUpdatedAt

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

SetUpdatedAt sets the updated_at field.

func (*MediaMutation) Status

func (m *MediaMutation) Status() (r media.Status, exists bool)

Status returns the status value in the mutation.

func (*MediaMutation) Title

func (m *MediaMutation) Title() (r string, exists bool)

Title returns the title value in the mutation.

func (MediaMutation) Tx

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

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

func (*MediaMutation) Type

func (m *MediaMutation) Type() string

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

func (*MediaMutation) UpdatedAt

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

UpdatedAt returns the updated_at value in the mutation.

type MediaQuery

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

MediaQuery is the builder for querying Media entities.

func (*MediaQuery) All

func (mq *MediaQuery) All(ctx context.Context) ([]*Media, error)

All executes the query and returns a list of MediaSlice.

func (*MediaQuery) AllX

func (mq *MediaQuery) AllX(ctx context.Context) []*Media

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

func (*MediaQuery) Clone

func (mq *MediaQuery) Clone() *MediaQuery

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

func (*MediaQuery) Count

func (mq *MediaQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*MediaQuery) CountX

func (mq *MediaQuery) CountX(ctx context.Context) int

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

func (*MediaQuery) Exist

func (mq *MediaQuery) Exist(ctx context.Context) (bool, error)

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

func (*MediaQuery) ExistX

func (mq *MediaQuery) ExistX(ctx context.Context) bool

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

func (*MediaQuery) First

func (mq *MediaQuery) First(ctx context.Context) (*Media, error)

First returns the first Media entity in the query. Returns *NotFoundError when no media was found.

func (*MediaQuery) FirstID

func (mq *MediaQuery) FirstID(ctx context.Context) (id uuid.UUID, err error)

FirstID returns the first Media id in the query. Returns *NotFoundError when no id was found.

func (*MediaQuery) FirstIDX

func (mq *MediaQuery) FirstIDX(ctx context.Context) uuid.UUID

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

func (*MediaQuery) FirstX

func (mq *MediaQuery) FirstX(ctx context.Context) *Media

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

func (*MediaQuery) GroupBy

func (mq *MediaQuery) GroupBy(field string, fields ...string) *MediaGroupBy

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

client.Media.Query().
	GroupBy(media.FieldTitle).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*MediaQuery) IDs

func (mq *MediaQuery) IDs(ctx context.Context) ([]uuid.UUID, error)

IDs executes the query and returns a list of Media ids.

func (*MediaQuery) IDsX

func (mq *MediaQuery) IDsX(ctx context.Context) []uuid.UUID

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

func (*MediaQuery) Limit

func (mq *MediaQuery) Limit(limit int) *MediaQuery

Limit adds a limit step to the query.

func (*MediaQuery) Offset

func (mq *MediaQuery) Offset(offset int) *MediaQuery

Offset adds an offset step to the query.

func (*MediaQuery) Only

func (mq *MediaQuery) Only(ctx context.Context) (*Media, error)

Only returns the only Media entity in the query, returns an error if not exactly one entity was returned.

func (*MediaQuery) OnlyID

func (mq *MediaQuery) OnlyID(ctx context.Context) (id uuid.UUID, err error)

OnlyID returns the only Media id in the query, returns an error if not exactly one id was returned.

func (*MediaQuery) OnlyIDX

func (mq *MediaQuery) OnlyIDX(ctx context.Context) uuid.UUID

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

func (*MediaQuery) OnlyX

func (mq *MediaQuery) OnlyX(ctx context.Context) *Media

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

func (*MediaQuery) Order

func (mq *MediaQuery) Order(o ...OrderFunc) *MediaQuery

Order adds an order step to the query.

func (*MediaQuery) QueryMediaFiles

func (mq *MediaQuery) QueryMediaFiles() *MediaFileQuery

QueryMediaFiles chains the current query on the media_files edge.

func (*MediaQuery) Select

func (mq *MediaQuery) Select(field string, fields ...string) *MediaSelect

Select one or more fields from the given query.

Example:

var v []struct {
	Title string `json:"title,omitempty"`
}

client.Media.Query().
	Select(media.FieldTitle).
	Scan(ctx, &v)

func (*MediaQuery) Where

func (mq *MediaQuery) Where(ps ...predicate.Media) *MediaQuery

Where adds a new predicate for the builder.

func (*MediaQuery) WithMediaFiles

func (mq *MediaQuery) WithMediaFiles(opts ...func(*MediaFileQuery)) *MediaQuery
WithMediaFiles tells the query-builder to eager-loads the nodes that are connected to

the "media_files" edge. The optional arguments used to configure the query builder of the edge.

type MediaSelect

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

MediaSelect is the builder for select fields of Media entities.

func (*MediaSelect) Bool

func (ms *MediaSelect) Bool(ctx context.Context) (_ bool, err error)

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

func (*MediaSelect) BoolX

func (ms *MediaSelect) BoolX(ctx context.Context) bool

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

func (*MediaSelect) Bools

func (ms *MediaSelect) Bools(ctx context.Context) ([]bool, error)

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

func (*MediaSelect) BoolsX

func (ms *MediaSelect) BoolsX(ctx context.Context) []bool

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

func (*MediaSelect) Float64

func (ms *MediaSelect) Float64(ctx context.Context) (_ float64, err error)

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

func (*MediaSelect) Float64X

func (ms *MediaSelect) Float64X(ctx context.Context) float64

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

func (*MediaSelect) Float64s

func (ms *MediaSelect) Float64s(ctx context.Context) ([]float64, error)

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

func (*MediaSelect) Float64sX

func (ms *MediaSelect) Float64sX(ctx context.Context) []float64

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

func (*MediaSelect) Int

func (ms *MediaSelect) Int(ctx context.Context) (_ int, err error)

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

func (*MediaSelect) IntX

func (ms *MediaSelect) IntX(ctx context.Context) int

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

func (*MediaSelect) Ints

func (ms *MediaSelect) Ints(ctx context.Context) ([]int, error)

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

func (*MediaSelect) IntsX

func (ms *MediaSelect) IntsX(ctx context.Context) []int

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

func (*MediaSelect) Scan

func (ms *MediaSelect) Scan(ctx context.Context, v interface{}) error

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

func (*MediaSelect) ScanX

func (ms *MediaSelect) ScanX(ctx context.Context, v interface{})

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

func (*MediaSelect) String

func (ms *MediaSelect) String(ctx context.Context) (_ string, err error)

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

func (*MediaSelect) StringX

func (ms *MediaSelect) StringX(ctx context.Context) string

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

func (*MediaSelect) Strings

func (ms *MediaSelect) Strings(ctx context.Context) ([]string, error)

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

func (*MediaSelect) StringsX

func (ms *MediaSelect) StringsX(ctx context.Context) []string

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

type MediaSlice

type MediaSlice []*Media

MediaSlice is a parsable slice of Media.

type MediaUpdate

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

MediaUpdate is the builder for updating Media entities.

func (*MediaUpdate) AddMediaFileIDs

func (mu *MediaUpdate) AddMediaFileIDs(ids ...uuid.UUID) *MediaUpdate

AddMediaFileIDs adds the media_files edge to MediaFile by ids.

func (*MediaUpdate) AddMediaFiles

func (mu *MediaUpdate) AddMediaFiles(m ...*MediaFile) *MediaUpdate

AddMediaFiles adds the media_files edges to MediaFile.

func (*MediaUpdate) ClearMediaFiles

func (mu *MediaUpdate) ClearMediaFiles() *MediaUpdate

ClearMediaFiles clears all "media_files" edges to type MediaFile.

func (*MediaUpdate) ClearOriginalFilename

func (mu *MediaUpdate) ClearOriginalFilename() *MediaUpdate

ClearOriginalFilename clears the value of original_filename.

func (*MediaUpdate) Exec

func (mu *MediaUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*MediaUpdate) ExecX

func (mu *MediaUpdate) ExecX(ctx context.Context)

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

func (*MediaUpdate) Mutation

func (mu *MediaUpdate) Mutation() *MediaMutation

Mutation returns the MediaMutation object of the builder.

func (*MediaUpdate) RemoveMediaFileIDs

func (mu *MediaUpdate) RemoveMediaFileIDs(ids ...uuid.UUID) *MediaUpdate

RemoveMediaFileIDs removes the media_files edge to MediaFile by ids.

func (*MediaUpdate) RemoveMediaFiles

func (mu *MediaUpdate) RemoveMediaFiles(m ...*MediaFile) *MediaUpdate

RemoveMediaFiles removes media_files edges to MediaFile.

func (*MediaUpdate) Save

func (mu *MediaUpdate) Save(ctx context.Context) (int, error)

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

func (*MediaUpdate) SaveX

func (mu *MediaUpdate) SaveX(ctx context.Context) int

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

func (*MediaUpdate) SetCreatedAt

func (mu *MediaUpdate) SetCreatedAt(t time.Time) *MediaUpdate

SetCreatedAt sets the created_at field.

func (*MediaUpdate) SetNillableCreatedAt

func (mu *MediaUpdate) SetNillableCreatedAt(t *time.Time) *MediaUpdate

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

func (*MediaUpdate) SetNillableOriginalFilename

func (mu *MediaUpdate) SetNillableOriginalFilename(s *string) *MediaUpdate

SetNillableOriginalFilename sets the original_filename field if the given value is not nil.

func (*MediaUpdate) SetOriginalFilename

func (mu *MediaUpdate) SetOriginalFilename(s string) *MediaUpdate

SetOriginalFilename sets the original_filename field.

func (*MediaUpdate) SetStatus

func (mu *MediaUpdate) SetStatus(m media.Status) *MediaUpdate

SetStatus sets the status field.

func (*MediaUpdate) SetTitle

func (mu *MediaUpdate) SetTitle(s string) *MediaUpdate

SetTitle sets the title field.

func (*MediaUpdate) SetUpdatedAt

func (mu *MediaUpdate) SetUpdatedAt(t time.Time) *MediaUpdate

SetUpdatedAt sets the updated_at field.

func (*MediaUpdate) Where

func (mu *MediaUpdate) Where(ps ...predicate.Media) *MediaUpdate

Where adds a new predicate for the builder.

type MediaUpdateOne

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

MediaUpdateOne is the builder for updating a single Media entity.

func (*MediaUpdateOne) AddMediaFileIDs

func (muo *MediaUpdateOne) AddMediaFileIDs(ids ...uuid.UUID) *MediaUpdateOne

AddMediaFileIDs adds the media_files edge to MediaFile by ids.

func (*MediaUpdateOne) AddMediaFiles

func (muo *MediaUpdateOne) AddMediaFiles(m ...*MediaFile) *MediaUpdateOne

AddMediaFiles adds the media_files edges to MediaFile.

func (*MediaUpdateOne) ClearMediaFiles

func (muo *MediaUpdateOne) ClearMediaFiles() *MediaUpdateOne

ClearMediaFiles clears all "media_files" edges to type MediaFile.

func (*MediaUpdateOne) ClearOriginalFilename

func (muo *MediaUpdateOne) ClearOriginalFilename() *MediaUpdateOne

ClearOriginalFilename clears the value of original_filename.

func (*MediaUpdateOne) Exec

func (muo *MediaUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*MediaUpdateOne) ExecX

func (muo *MediaUpdateOne) ExecX(ctx context.Context)

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

func (*MediaUpdateOne) Mutation

func (muo *MediaUpdateOne) Mutation() *MediaMutation

Mutation returns the MediaMutation object of the builder.

func (*MediaUpdateOne) RemoveMediaFileIDs

func (muo *MediaUpdateOne) RemoveMediaFileIDs(ids ...uuid.UUID) *MediaUpdateOne

RemoveMediaFileIDs removes the media_files edge to MediaFile by ids.

func (*MediaUpdateOne) RemoveMediaFiles

func (muo *MediaUpdateOne) RemoveMediaFiles(m ...*MediaFile) *MediaUpdateOne

RemoveMediaFiles removes media_files edges to MediaFile.

func (*MediaUpdateOne) Save

func (muo *MediaUpdateOne) Save(ctx context.Context) (*Media, error)

Save executes the query and returns the updated entity.

func (*MediaUpdateOne) SaveX

func (muo *MediaUpdateOne) SaveX(ctx context.Context) *Media

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

func (*MediaUpdateOne) SetCreatedAt

func (muo *MediaUpdateOne) SetCreatedAt(t time.Time) *MediaUpdateOne

SetCreatedAt sets the created_at field.

func (*MediaUpdateOne) SetNillableCreatedAt

func (muo *MediaUpdateOne) SetNillableCreatedAt(t *time.Time) *MediaUpdateOne

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

func (*MediaUpdateOne) SetNillableOriginalFilename

func (muo *MediaUpdateOne) SetNillableOriginalFilename(s *string) *MediaUpdateOne

SetNillableOriginalFilename sets the original_filename field if the given value is not nil.

func (*MediaUpdateOne) SetOriginalFilename

func (muo *MediaUpdateOne) SetOriginalFilename(s string) *MediaUpdateOne

SetOriginalFilename sets the original_filename field.

func (*MediaUpdateOne) SetStatus

func (muo *MediaUpdateOne) SetStatus(m media.Status) *MediaUpdateOne

SetStatus sets the status field.

func (*MediaUpdateOne) SetTitle

func (muo *MediaUpdateOne) SetTitle(s string) *MediaUpdateOne

SetTitle sets the title field.

func (*MediaUpdateOne) SetUpdatedAt

func (muo *MediaUpdateOne) SetUpdatedAt(t time.Time) *MediaUpdateOne

SetUpdatedAt sets the updated_at field.

type MutateFunc

type MutateFunc = ent.MutateFunc

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

type Mutation

type Mutation = ent.Mutation

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

type Mutator

type Mutator = ent.Mutator

ent aliases to avoid import conflict 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 conflict 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(...interface{})) Option

Log sets the logging function for debug mode.

type OrderFunc

type OrderFunc func(*sql.Selector, func(string) bool)

OrderFunc applies an ordering on the sql selector.

func Asc

func Asc(fields ...string) OrderFunc

Asc applies the given fields in ASC order.

func Desc

func Desc(fields ...string) OrderFunc

Desc applies the given fields in DESC order.

type Policy

type Policy = ent.Policy

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

type Query

type Query = ent.Query

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

type RollbackFunc

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

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

func (RollbackFunc) Rollback

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

Rollback calls f(ctx, m).

type RollbackHook

type RollbackHook func(Rollbacker) Rollbacker

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

hook := func(next ent.Rollbacker) ent.Rollbacker {
	return ent.RollbackFunc(func(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 Rollbacker method.

type Tx

type Tx struct {

	// Media is the client for interacting with the Media builders.
	Media *MediaClient
	// MediaFile is the client for interacting with the MediaFile builders.
	MediaFile *MediaFileClient
	// 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 the Tx stored in 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 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 conflict in user's code.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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