ent

package
v0.0.0-...-9c07312 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2022 License: MIT Imports: 17 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.
	TypeArtifact = "Artifact"
	TypeMetadata = "Metadata"
)

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 validation error.

func MaskNotFound

func MaskNotFound(err error) error

MaskNotFound masks not found error.

func NewContext

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

NewContext returns a new context with the given Client attached.

func NewTxContext

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

NewTxContext returns a new context with the given Tx attached.

Types

type AggregateFunc

type AggregateFunc func(*sql.Selector) string

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

func As

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

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

func Count

func Count() AggregateFunc

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

func Max

func Max(field string) AggregateFunc

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

func Mean

func Mean(field string) AggregateFunc

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

func Min

func Min(field string) AggregateFunc

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

func Sum

func Sum(field string) AggregateFunc

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

type Artifact

type Artifact struct {

	// ID of the ent.
	ID int `json:"id,omitempty"`
	// FilePath holds the value of the "file_path" field.
	FilePath string `json:"file_path,omitempty"`
	// ArchivePath holds the value of the "archive_path" field.
	ArchivePath string `json:"archive_path,omitempty"`
	// FileType holds the value of the "file_type" field.
	FileType string `json:"file_type,omitempty"`
	// Content holds the value of the "content" field.
	Content string `json:"content,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the ArtifactQuery when eager-loading is set.
	Edges ArtifactEdges `json:"edges"`
	// contains filtered or unexported fields
}

Artifact is the model entity for the Artifact schema.

func (*Artifact) QueryMetadata

func (a *Artifact) QueryMetadata() *MetadataQuery

QueryMetadata queries the "metadata" edge of the Artifact entity.

func (*Artifact) String

func (a *Artifact) String() string

String implements the fmt.Stringer.

func (*Artifact) Unwrap

func (a *Artifact) Unwrap() *Artifact

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

func (*Artifact) Update

func (a *Artifact) Update() *ArtifactUpdateOne

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

type ArtifactClient

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

ArtifactClient is a client for the Artifact schema.

func NewArtifactClient

func NewArtifactClient(c config) *ArtifactClient

NewArtifactClient returns a client for the Artifact from the given config.

func (*ArtifactClient) Create

func (c *ArtifactClient) Create() *ArtifactCreate

Create returns a create builder for Artifact.

func (*ArtifactClient) CreateBulk

func (c *ArtifactClient) CreateBulk(builders ...*ArtifactCreate) *ArtifactCreateBulk

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

func (*ArtifactClient) Delete

func (c *ArtifactClient) Delete() *ArtifactDelete

Delete returns a delete builder for Artifact.

func (*ArtifactClient) DeleteOne

func (c *ArtifactClient) DeleteOne(a *Artifact) *ArtifactDeleteOne

DeleteOne returns a delete builder for the given entity.

func (*ArtifactClient) DeleteOneID

func (c *ArtifactClient) DeleteOneID(id int) *ArtifactDeleteOne

DeleteOneID returns a delete builder for the given id.

func (*ArtifactClient) Get

func (c *ArtifactClient) Get(ctx context.Context, id int) (*Artifact, error)

Get returns a Artifact entity by its id.

func (*ArtifactClient) GetX

func (c *ArtifactClient) GetX(ctx context.Context, id int) *Artifact

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

func (*ArtifactClient) Hooks

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

Hooks returns the client hooks.

func (*ArtifactClient) Query

func (c *ArtifactClient) Query() *ArtifactQuery

Query returns a query builder for Artifact.

func (*ArtifactClient) QueryMetadata

func (c *ArtifactClient) QueryMetadata(a *Artifact) *MetadataQuery

QueryMetadata queries the metadata edge of a Artifact.

func (*ArtifactClient) Update

func (c *ArtifactClient) Update() *ArtifactUpdate

Update returns an update builder for Artifact.

func (*ArtifactClient) UpdateOne

func (c *ArtifactClient) UpdateOne(a *Artifact) *ArtifactUpdateOne

UpdateOne returns an update builder for the given entity.

func (*ArtifactClient) UpdateOneID

func (c *ArtifactClient) UpdateOneID(id int) *ArtifactUpdateOne

UpdateOneID returns an update builder for the given id.

func (*ArtifactClient) Use

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

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

type ArtifactCreate

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

ArtifactCreate is the builder for creating a Artifact entity.

func (*ArtifactCreate) AddMetadata

func (ac *ArtifactCreate) AddMetadata(m ...*Metadata) *ArtifactCreate

AddMetadata adds the "metadata" edges to the Metadata entity.

func (*ArtifactCreate) AddMetadatumIDs

func (ac *ArtifactCreate) AddMetadatumIDs(ids ...int) *ArtifactCreate

AddMetadatumIDs adds the "metadata" edge to the Metadata entity by IDs.

func (*ArtifactCreate) Exec

func (ac *ArtifactCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*ArtifactCreate) ExecX

func (ac *ArtifactCreate) ExecX(ctx context.Context)

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

func (*ArtifactCreate) Mutation

func (ac *ArtifactCreate) Mutation() *ArtifactMutation

Mutation returns the ArtifactMutation object of the builder.

func (*ArtifactCreate) OnConflict

func (ac *ArtifactCreate) OnConflict(opts ...sql.ConflictOption) *ArtifactUpsertOne

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

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

func (*ArtifactCreate) OnConflictColumns

func (ac *ArtifactCreate) OnConflictColumns(columns ...string) *ArtifactUpsertOne

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

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

func (*ArtifactCreate) Save

func (ac *ArtifactCreate) Save(ctx context.Context) (*Artifact, error)

Save creates the Artifact in the database.

func (*ArtifactCreate) SaveX

func (ac *ArtifactCreate) SaveX(ctx context.Context) *Artifact

SaveX calls Save and panics if Save returns an error.

func (*ArtifactCreate) SetArchivePath

func (ac *ArtifactCreate) SetArchivePath(s string) *ArtifactCreate

SetArchivePath sets the "archive_path" field.

func (*ArtifactCreate) SetContent

func (ac *ArtifactCreate) SetContent(s string) *ArtifactCreate

SetContent sets the "content" field.

func (*ArtifactCreate) SetFilePath

func (ac *ArtifactCreate) SetFilePath(s string) *ArtifactCreate

SetFilePath sets the "file_path" field.

func (*ArtifactCreate) SetFileType

func (ac *ArtifactCreate) SetFileType(s string) *ArtifactCreate

SetFileType sets the "file_type" field.

func (*ArtifactCreate) SetNillableArchivePath

func (ac *ArtifactCreate) SetNillableArchivePath(s *string) *ArtifactCreate

SetNillableArchivePath sets the "archive_path" field if the given value is not nil.

type ArtifactCreateBulk

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

ArtifactCreateBulk is the builder for creating many Artifact entities in bulk.

func (*ArtifactCreateBulk) Exec

func (acb *ArtifactCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*ArtifactCreateBulk) ExecX

func (acb *ArtifactCreateBulk) ExecX(ctx context.Context)

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

func (*ArtifactCreateBulk) OnConflict

func (acb *ArtifactCreateBulk) OnConflict(opts ...sql.ConflictOption) *ArtifactUpsertBulk

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

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

func (*ArtifactCreateBulk) OnConflictColumns

func (acb *ArtifactCreateBulk) OnConflictColumns(columns ...string) *ArtifactUpsertBulk

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

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

func (*ArtifactCreateBulk) Save

func (acb *ArtifactCreateBulk) Save(ctx context.Context) ([]*Artifact, error)

Save creates the Artifact entities in the database.

func (*ArtifactCreateBulk) SaveX

func (acb *ArtifactCreateBulk) SaveX(ctx context.Context) []*Artifact

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

type ArtifactDelete

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

ArtifactDelete is the builder for deleting a Artifact entity.

func (*ArtifactDelete) Exec

func (ad *ArtifactDelete) Exec(ctx context.Context) (int, error)

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

func (*ArtifactDelete) ExecX

func (ad *ArtifactDelete) ExecX(ctx context.Context) int

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

func (*ArtifactDelete) Where

func (ad *ArtifactDelete) Where(ps ...predicate.Artifact) *ArtifactDelete

Where appends a list predicates to the ArtifactDelete builder.

type ArtifactDeleteOne

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

ArtifactDeleteOne is the builder for deleting a single Artifact entity.

func (*ArtifactDeleteOne) Exec

func (ado *ArtifactDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*ArtifactDeleteOne) ExecX

func (ado *ArtifactDeleteOne) ExecX(ctx context.Context)

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

type ArtifactEdges

type ArtifactEdges struct {
	// Metadata holds the value of the metadata edge.
	Metadata []*Metadata `json:"metadata,omitempty"`
	// contains filtered or unexported fields
}

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

func (ArtifactEdges) MetadataOrErr

func (e ArtifactEdges) MetadataOrErr() ([]*Metadata, error)

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

type ArtifactGroupBy

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

ArtifactGroupBy is the group-by builder for Artifact entities.

func (*ArtifactGroupBy) Aggregate

func (agb *ArtifactGroupBy) Aggregate(fns ...AggregateFunc) *ArtifactGroupBy

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

func (*ArtifactGroupBy) Bool

func (agb *ArtifactGroupBy) Bool(ctx context.Context) (_ bool, err error)

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

func (*ArtifactGroupBy) BoolX

func (agb *ArtifactGroupBy) BoolX(ctx context.Context) bool

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

func (*ArtifactGroupBy) Bools

func (agb *ArtifactGroupBy) Bools(ctx context.Context) ([]bool, error)

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

func (*ArtifactGroupBy) BoolsX

func (agb *ArtifactGroupBy) BoolsX(ctx context.Context) []bool

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

func (*ArtifactGroupBy) Float64

func (agb *ArtifactGroupBy) Float64(ctx context.Context) (_ float64, err error)

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

func (*ArtifactGroupBy) Float64X

func (agb *ArtifactGroupBy) Float64X(ctx context.Context) float64

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

func (*ArtifactGroupBy) Float64s

func (agb *ArtifactGroupBy) Float64s(ctx context.Context) ([]float64, error)

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

func (*ArtifactGroupBy) Float64sX

func (agb *ArtifactGroupBy) Float64sX(ctx context.Context) []float64

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

func (*ArtifactGroupBy) Int

func (agb *ArtifactGroupBy) Int(ctx context.Context) (_ int, err error)

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

func (*ArtifactGroupBy) IntX

func (agb *ArtifactGroupBy) IntX(ctx context.Context) int

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

func (*ArtifactGroupBy) Ints

func (agb *ArtifactGroupBy) Ints(ctx context.Context) ([]int, error)

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

func (*ArtifactGroupBy) IntsX

func (agb *ArtifactGroupBy) IntsX(ctx context.Context) []int

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

func (*ArtifactGroupBy) Scan

func (agb *ArtifactGroupBy) Scan(ctx context.Context, v interface{}) error

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

func (*ArtifactGroupBy) ScanX

func (agb *ArtifactGroupBy) ScanX(ctx context.Context, v interface{})

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

func (*ArtifactGroupBy) String

func (agb *ArtifactGroupBy) String(ctx context.Context) (_ string, err error)

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

func (*ArtifactGroupBy) StringX

func (agb *ArtifactGroupBy) StringX(ctx context.Context) string

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

func (*ArtifactGroupBy) Strings

func (agb *ArtifactGroupBy) Strings(ctx context.Context) ([]string, error)

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

func (*ArtifactGroupBy) StringsX

func (agb *ArtifactGroupBy) StringsX(ctx context.Context) []string

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

type ArtifactMutation

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

ArtifactMutation represents an operation that mutates the Artifact nodes in the graph.

func (*ArtifactMutation) AddField

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

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

func (*ArtifactMutation) AddMetadatumIDs

func (m *ArtifactMutation) AddMetadatumIDs(ids ...int)

AddMetadatumIDs adds the "metadata" edge to the Metadata entity by ids.

func (*ArtifactMutation) AddedEdges

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

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

func (*ArtifactMutation) AddedField

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

AddedField returns the numeric value that was incremented/decremented on a field with the given name. The second boolean return value indicates that this field was not set, or was not defined in the schema.

func (*ArtifactMutation) AddedFields

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

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

func (*ArtifactMutation) AddedIDs

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

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

func (*ArtifactMutation) ArchivePath

func (m *ArtifactMutation) ArchivePath() (r string, exists bool)

ArchivePath returns the value of the "archive_path" field in the mutation.

func (*ArtifactMutation) ArchivePathCleared

func (m *ArtifactMutation) ArchivePathCleared() bool

ArchivePathCleared returns if the "archive_path" field was cleared in this mutation.

func (*ArtifactMutation) ClearArchivePath

func (m *ArtifactMutation) ClearArchivePath()

ClearArchivePath clears the value of the "archive_path" field.

func (*ArtifactMutation) ClearEdge

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

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

func (*ArtifactMutation) ClearField

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

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

func (*ArtifactMutation) ClearMetadata

func (m *ArtifactMutation) ClearMetadata()

ClearMetadata clears the "metadata" edge to the Metadata entity.

func (*ArtifactMutation) ClearedEdges

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

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

func (*ArtifactMutation) ClearedFields

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

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

func (ArtifactMutation) Client

func (m ArtifactMutation) 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 (*ArtifactMutation) Content

func (m *ArtifactMutation) Content() (r string, exists bool)

Content returns the value of the "content" field in the mutation.

func (*ArtifactMutation) EdgeCleared

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

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

func (*ArtifactMutation) Field

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

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

func (*ArtifactMutation) FieldCleared

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

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

func (*ArtifactMutation) Fields

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

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

func (*ArtifactMutation) FilePath

func (m *ArtifactMutation) FilePath() (r string, exists bool)

FilePath returns the value of the "file_path" field in the mutation.

func (*ArtifactMutation) FileType

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

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

func (*ArtifactMutation) ID

func (m *ArtifactMutation) ID() (id int, exists bool)

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

func (*ArtifactMutation) IDs

func (m *ArtifactMutation) IDs(ctx context.Context) ([]int, error)

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

func (*ArtifactMutation) MetadataCleared

func (m *ArtifactMutation) MetadataCleared() bool

MetadataCleared reports if the "metadata" edge to the Metadata entity was cleared.

func (*ArtifactMutation) MetadataIDs

func (m *ArtifactMutation) MetadataIDs() (ids []int)

MetadataIDs returns the "metadata" edge IDs in the mutation.

func (*ArtifactMutation) OldArchivePath

func (m *ArtifactMutation) OldArchivePath(ctx context.Context) (v string, err error)

OldArchivePath returns the old "archive_path" field's value of the Artifact entity. If the Artifact object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.

func (*ArtifactMutation) OldContent

func (m *ArtifactMutation) OldContent(ctx context.Context) (v string, err error)

OldContent returns the old "content" field's value of the Artifact entity. If the Artifact object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.

func (*ArtifactMutation) OldField

func (m *ArtifactMutation) OldField(ctx context.Context, name string) (ent.Value, error)

OldField returns the old value of the field from the database. An error is returned if the mutation operation is not UpdateOne, or the query to the database failed.

func (*ArtifactMutation) OldFilePath

func (m *ArtifactMutation) OldFilePath(ctx context.Context) (v string, err error)

OldFilePath returns the old "file_path" field's value of the Artifact entity. If the Artifact object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.

func (*ArtifactMutation) OldFileType

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

OldFileType returns the old "file_type" field's value of the Artifact entity. If the Artifact object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.

func (*ArtifactMutation) Op

func (m *ArtifactMutation) Op() Op

Op returns the operation name.

func (*ArtifactMutation) RemoveMetadatumIDs

func (m *ArtifactMutation) RemoveMetadatumIDs(ids ...int)

RemoveMetadatumIDs removes the "metadata" edge to the Metadata entity by IDs.

func (*ArtifactMutation) RemovedEdges

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

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

func (*ArtifactMutation) RemovedIDs

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

RemovedIDs returns all IDs (to other nodes) that were removed for the edge with the given name in this mutation.

func (*ArtifactMutation) RemovedMetadataIDs

func (m *ArtifactMutation) RemovedMetadataIDs() (ids []int)

RemovedMetadata returns the removed IDs of the "metadata" edge to the Metadata entity.

func (*ArtifactMutation) ResetArchivePath

func (m *ArtifactMutation) ResetArchivePath()

ResetArchivePath resets all changes to the "archive_path" field.

func (*ArtifactMutation) ResetContent

func (m *ArtifactMutation) ResetContent()

ResetContent resets all changes to the "content" field.

func (*ArtifactMutation) ResetEdge

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

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

func (*ArtifactMutation) ResetField

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

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

func (*ArtifactMutation) ResetFilePath

func (m *ArtifactMutation) ResetFilePath()

ResetFilePath resets all changes to the "file_path" field.

func (*ArtifactMutation) ResetFileType

func (m *ArtifactMutation) ResetFileType()

ResetFileType resets all changes to the "file_type" field.

func (*ArtifactMutation) ResetMetadata

func (m *ArtifactMutation) ResetMetadata()

ResetMetadata resets all changes to the "metadata" edge.

func (*ArtifactMutation) SetArchivePath

func (m *ArtifactMutation) SetArchivePath(s string)

SetArchivePath sets the "archive_path" field.

func (*ArtifactMutation) SetContent

func (m *ArtifactMutation) SetContent(s string)

SetContent sets the "content" field.

func (*ArtifactMutation) SetField

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

SetField sets the value of a field with the given name. It returns an error if the field is not defined in the schema, or if the type mismatched the field type.

func (*ArtifactMutation) SetFilePath

func (m *ArtifactMutation) SetFilePath(s string)

SetFilePath sets the "file_path" field.

func (*ArtifactMutation) SetFileType

func (m *ArtifactMutation) SetFileType(s string)

SetFileType sets the "file_type" field.

func (ArtifactMutation) Tx

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

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

func (*ArtifactMutation) Type

func (m *ArtifactMutation) Type() string

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

func (*ArtifactMutation) Where

func (m *ArtifactMutation) Where(ps ...predicate.Artifact)

Where appends a list predicates to the ArtifactMutation builder.

type ArtifactQuery

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

ArtifactQuery is the builder for querying Artifact entities.

func (*ArtifactQuery) All

func (aq *ArtifactQuery) All(ctx context.Context) ([]*Artifact, error)

All executes the query and returns a list of Artifacts.

func (*ArtifactQuery) AllX

func (aq *ArtifactQuery) AllX(ctx context.Context) []*Artifact

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

func (*ArtifactQuery) Clone

func (aq *ArtifactQuery) Clone() *ArtifactQuery

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

func (*ArtifactQuery) Count

func (aq *ArtifactQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*ArtifactQuery) CountX

func (aq *ArtifactQuery) CountX(ctx context.Context) int

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

func (*ArtifactQuery) Exist

func (aq *ArtifactQuery) Exist(ctx context.Context) (bool, error)

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

func (*ArtifactQuery) ExistX

func (aq *ArtifactQuery) ExistX(ctx context.Context) bool

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

func (*ArtifactQuery) First

func (aq *ArtifactQuery) First(ctx context.Context) (*Artifact, error)

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

func (*ArtifactQuery) FirstID

func (aq *ArtifactQuery) FirstID(ctx context.Context) (id int, err error)

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

func (*ArtifactQuery) FirstIDX

func (aq *ArtifactQuery) FirstIDX(ctx context.Context) int

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

func (*ArtifactQuery) FirstX

func (aq *ArtifactQuery) FirstX(ctx context.Context) *Artifact

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

func (*ArtifactQuery) GroupBy

func (aq *ArtifactQuery) GroupBy(field string, fields ...string) *ArtifactGroupBy

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

Example:

var v []struct {
	FilePath string `json:"file_path,omitempty"`
	Count int `json:"count,omitempty"`
}

client.Artifact.Query().
	GroupBy(artifact.FieldFilePath).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*ArtifactQuery) IDs

func (aq *ArtifactQuery) IDs(ctx context.Context) ([]int, error)

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

func (*ArtifactQuery) IDsX

func (aq *ArtifactQuery) IDsX(ctx context.Context) []int

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

func (*ArtifactQuery) Limit

func (aq *ArtifactQuery) Limit(limit int) *ArtifactQuery

Limit adds a limit step to the query.

func (*ArtifactQuery) Offset

func (aq *ArtifactQuery) Offset(offset int) *ArtifactQuery

Offset adds an offset step to the query.

func (*ArtifactQuery) Only

func (aq *ArtifactQuery) Only(ctx context.Context) (*Artifact, error)

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

func (*ArtifactQuery) OnlyID

func (aq *ArtifactQuery) OnlyID(ctx context.Context) (id int, err error)

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

func (*ArtifactQuery) OnlyIDX

func (aq *ArtifactQuery) OnlyIDX(ctx context.Context) int

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

func (*ArtifactQuery) OnlyX

func (aq *ArtifactQuery) OnlyX(ctx context.Context) *Artifact

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

func (*ArtifactQuery) Order

func (aq *ArtifactQuery) Order(o ...OrderFunc) *ArtifactQuery

Order adds an order step to the query.

func (*ArtifactQuery) QueryMetadata

func (aq *ArtifactQuery) QueryMetadata() *MetadataQuery

QueryMetadata chains the current query on the "metadata" edge.

func (*ArtifactQuery) Select

func (aq *ArtifactQuery) Select(fields ...string) *ArtifactSelect

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

Example:

var v []struct {
	FilePath string `json:"file_path,omitempty"`
}

client.Artifact.Query().
	Select(artifact.FieldFilePath).
	Scan(ctx, &v)

func (*ArtifactQuery) Unique

func (aq *ArtifactQuery) Unique(unique bool) *ArtifactQuery

Unique configures the query builder to filter duplicate records on query. By default, unique is set to true, and can be disabled using this method.

func (*ArtifactQuery) Where

func (aq *ArtifactQuery) Where(ps ...predicate.Artifact) *ArtifactQuery

Where adds a new predicate for the ArtifactQuery builder.

func (*ArtifactQuery) WithMetadata

func (aq *ArtifactQuery) WithMetadata(opts ...func(*MetadataQuery)) *ArtifactQuery

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

type ArtifactSelect

type ArtifactSelect struct {
	*ArtifactQuery
	// contains filtered or unexported fields
}

ArtifactSelect is the builder for selecting fields of Artifact entities.

func (*ArtifactSelect) Bool

func (as *ArtifactSelect) Bool(ctx context.Context) (_ bool, err error)

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

func (*ArtifactSelect) BoolX

func (as *ArtifactSelect) BoolX(ctx context.Context) bool

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

func (*ArtifactSelect) Bools

func (as *ArtifactSelect) Bools(ctx context.Context) ([]bool, error)

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

func (*ArtifactSelect) BoolsX

func (as *ArtifactSelect) BoolsX(ctx context.Context) []bool

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

func (*ArtifactSelect) Float64

func (as *ArtifactSelect) Float64(ctx context.Context) (_ float64, err error)

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

func (*ArtifactSelect) Float64X

func (as *ArtifactSelect) Float64X(ctx context.Context) float64

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

func (*ArtifactSelect) Float64s

func (as *ArtifactSelect) Float64s(ctx context.Context) ([]float64, error)

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

func (*ArtifactSelect) Float64sX

func (as *ArtifactSelect) Float64sX(ctx context.Context) []float64

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

func (*ArtifactSelect) Int

func (as *ArtifactSelect) Int(ctx context.Context) (_ int, err error)

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

func (*ArtifactSelect) IntX

func (as *ArtifactSelect) IntX(ctx context.Context) int

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

func (*ArtifactSelect) Ints

func (as *ArtifactSelect) Ints(ctx context.Context) ([]int, error)

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

func (*ArtifactSelect) IntsX

func (as *ArtifactSelect) IntsX(ctx context.Context) []int

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

func (*ArtifactSelect) Scan

func (as *ArtifactSelect) Scan(ctx context.Context, v interface{}) error

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

func (*ArtifactSelect) ScanX

func (as *ArtifactSelect) ScanX(ctx context.Context, v interface{})

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

func (*ArtifactSelect) String

func (as *ArtifactSelect) String(ctx context.Context) (_ string, err error)

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

func (*ArtifactSelect) StringX

func (as *ArtifactSelect) StringX(ctx context.Context) string

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

func (*ArtifactSelect) Strings

func (as *ArtifactSelect) Strings(ctx context.Context) ([]string, error)

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

func (*ArtifactSelect) StringsX

func (as *ArtifactSelect) StringsX(ctx context.Context) []string

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

type ArtifactUpdate

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

ArtifactUpdate is the builder for updating Artifact entities.

func (*ArtifactUpdate) AddMetadata

func (au *ArtifactUpdate) AddMetadata(m ...*Metadata) *ArtifactUpdate

AddMetadata adds the "metadata" edges to the Metadata entity.

func (*ArtifactUpdate) AddMetadatumIDs

func (au *ArtifactUpdate) AddMetadatumIDs(ids ...int) *ArtifactUpdate

AddMetadatumIDs adds the "metadata" edge to the Metadata entity by IDs.

func (*ArtifactUpdate) ClearArchivePath

func (au *ArtifactUpdate) ClearArchivePath() *ArtifactUpdate

ClearArchivePath clears the value of the "archive_path" field.

func (*ArtifactUpdate) ClearMetadata

func (au *ArtifactUpdate) ClearMetadata() *ArtifactUpdate

ClearMetadata clears all "metadata" edges to the Metadata entity.

func (*ArtifactUpdate) Exec

func (au *ArtifactUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*ArtifactUpdate) ExecX

func (au *ArtifactUpdate) ExecX(ctx context.Context)

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

func (*ArtifactUpdate) Mutation

func (au *ArtifactUpdate) Mutation() *ArtifactMutation

Mutation returns the ArtifactMutation object of the builder.

func (*ArtifactUpdate) RemoveMetadata

func (au *ArtifactUpdate) RemoveMetadata(m ...*Metadata) *ArtifactUpdate

RemoveMetadata removes "metadata" edges to Metadata entities.

func (*ArtifactUpdate) RemoveMetadatumIDs

func (au *ArtifactUpdate) RemoveMetadatumIDs(ids ...int) *ArtifactUpdate

RemoveMetadatumIDs removes the "metadata" edge to Metadata entities by IDs.

func (*ArtifactUpdate) Save

func (au *ArtifactUpdate) Save(ctx context.Context) (int, error)

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

func (*ArtifactUpdate) SaveX

func (au *ArtifactUpdate) SaveX(ctx context.Context) int

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

func (*ArtifactUpdate) SetArchivePath

func (au *ArtifactUpdate) SetArchivePath(s string) *ArtifactUpdate

SetArchivePath sets the "archive_path" field.

func (*ArtifactUpdate) SetContent

func (au *ArtifactUpdate) SetContent(s string) *ArtifactUpdate

SetContent sets the "content" field.

func (*ArtifactUpdate) SetFilePath

func (au *ArtifactUpdate) SetFilePath(s string) *ArtifactUpdate

SetFilePath sets the "file_path" field.

func (*ArtifactUpdate) SetFileType

func (au *ArtifactUpdate) SetFileType(s string) *ArtifactUpdate

SetFileType sets the "file_type" field.

func (*ArtifactUpdate) SetNillableArchivePath

func (au *ArtifactUpdate) SetNillableArchivePath(s *string) *ArtifactUpdate

SetNillableArchivePath sets the "archive_path" field if the given value is not nil.

func (*ArtifactUpdate) Where

func (au *ArtifactUpdate) Where(ps ...predicate.Artifact) *ArtifactUpdate

Where appends a list predicates to the ArtifactUpdate builder.

type ArtifactUpdateOne

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

ArtifactUpdateOne is the builder for updating a single Artifact entity.

func (*ArtifactUpdateOne) AddMetadata

func (auo *ArtifactUpdateOne) AddMetadata(m ...*Metadata) *ArtifactUpdateOne

AddMetadata adds the "metadata" edges to the Metadata entity.

func (*ArtifactUpdateOne) AddMetadatumIDs

func (auo *ArtifactUpdateOne) AddMetadatumIDs(ids ...int) *ArtifactUpdateOne

AddMetadatumIDs adds the "metadata" edge to the Metadata entity by IDs.

func (*ArtifactUpdateOne) ClearArchivePath

func (auo *ArtifactUpdateOne) ClearArchivePath() *ArtifactUpdateOne

ClearArchivePath clears the value of the "archive_path" field.

func (*ArtifactUpdateOne) ClearMetadata

func (auo *ArtifactUpdateOne) ClearMetadata() *ArtifactUpdateOne

ClearMetadata clears all "metadata" edges to the Metadata entity.

func (*ArtifactUpdateOne) Exec

func (auo *ArtifactUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*ArtifactUpdateOne) ExecX

func (auo *ArtifactUpdateOne) ExecX(ctx context.Context)

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

func (*ArtifactUpdateOne) Mutation

func (auo *ArtifactUpdateOne) Mutation() *ArtifactMutation

Mutation returns the ArtifactMutation object of the builder.

func (*ArtifactUpdateOne) RemoveMetadata

func (auo *ArtifactUpdateOne) RemoveMetadata(m ...*Metadata) *ArtifactUpdateOne

RemoveMetadata removes "metadata" edges to Metadata entities.

func (*ArtifactUpdateOne) RemoveMetadatumIDs

func (auo *ArtifactUpdateOne) RemoveMetadatumIDs(ids ...int) *ArtifactUpdateOne

RemoveMetadatumIDs removes the "metadata" edge to Metadata entities by IDs.

func (*ArtifactUpdateOne) Save

func (auo *ArtifactUpdateOne) Save(ctx context.Context) (*Artifact, error)

Save executes the query and returns the updated Artifact entity.

func (*ArtifactUpdateOne) SaveX

func (auo *ArtifactUpdateOne) SaveX(ctx context.Context) *Artifact

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

func (*ArtifactUpdateOne) Select

func (auo *ArtifactUpdateOne) Select(field string, fields ...string) *ArtifactUpdateOne

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

func (*ArtifactUpdateOne) SetArchivePath

func (auo *ArtifactUpdateOne) SetArchivePath(s string) *ArtifactUpdateOne

SetArchivePath sets the "archive_path" field.

func (*ArtifactUpdateOne) SetContent

func (auo *ArtifactUpdateOne) SetContent(s string) *ArtifactUpdateOne

SetContent sets the "content" field.

func (*ArtifactUpdateOne) SetFilePath

func (auo *ArtifactUpdateOne) SetFilePath(s string) *ArtifactUpdateOne

SetFilePath sets the "file_path" field.

func (*ArtifactUpdateOne) SetFileType

func (auo *ArtifactUpdateOne) SetFileType(s string) *ArtifactUpdateOne

SetFileType sets the "file_type" field.

func (*ArtifactUpdateOne) SetNillableArchivePath

func (auo *ArtifactUpdateOne) SetNillableArchivePath(s *string) *ArtifactUpdateOne

SetNillableArchivePath sets the "archive_path" field if the given value is not nil.

type ArtifactUpsert

type ArtifactUpsert struct {
	*sql.UpdateSet
}

ArtifactUpsert is the "OnConflict" setter.

func (*ArtifactUpsert) ClearArchivePath

func (u *ArtifactUpsert) ClearArchivePath() *ArtifactUpsert

ClearArchivePath clears the value of the "archive_path" field.

func (*ArtifactUpsert) SetArchivePath

func (u *ArtifactUpsert) SetArchivePath(v string) *ArtifactUpsert

SetArchivePath sets the "archive_path" field.

func (*ArtifactUpsert) SetContent

func (u *ArtifactUpsert) SetContent(v string) *ArtifactUpsert

SetContent sets the "content" field.

func (*ArtifactUpsert) SetFilePath

func (u *ArtifactUpsert) SetFilePath(v string) *ArtifactUpsert

SetFilePath sets the "file_path" field.

func (*ArtifactUpsert) SetFileType

func (u *ArtifactUpsert) SetFileType(v string) *ArtifactUpsert

SetFileType sets the "file_type" field.

func (*ArtifactUpsert) UpdateArchivePath

func (u *ArtifactUpsert) UpdateArchivePath() *ArtifactUpsert

UpdateArchivePath sets the "archive_path" field to the value that was provided on create.

func (*ArtifactUpsert) UpdateContent

func (u *ArtifactUpsert) UpdateContent() *ArtifactUpsert

UpdateContent sets the "content" field to the value that was provided on create.

func (*ArtifactUpsert) UpdateFilePath

func (u *ArtifactUpsert) UpdateFilePath() *ArtifactUpsert

UpdateFilePath sets the "file_path" field to the value that was provided on create.

func (*ArtifactUpsert) UpdateFileType

func (u *ArtifactUpsert) UpdateFileType() *ArtifactUpsert

UpdateFileType sets the "file_type" field to the value that was provided on create.

type ArtifactUpsertBulk

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

ArtifactUpsertBulk is the builder for "upsert"-ing a bulk of Artifact nodes.

func (*ArtifactUpsertBulk) ClearArchivePath

func (u *ArtifactUpsertBulk) ClearArchivePath() *ArtifactUpsertBulk

ClearArchivePath clears the value of the "archive_path" field.

func (*ArtifactUpsertBulk) DoNothing

func (u *ArtifactUpsertBulk) DoNothing() *ArtifactUpsertBulk

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

func (*ArtifactUpsertBulk) Exec

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

Exec executes the query.

func (*ArtifactUpsertBulk) ExecX

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

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

func (*ArtifactUpsertBulk) Ignore

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

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

func (*ArtifactUpsertBulk) SetArchivePath

func (u *ArtifactUpsertBulk) SetArchivePath(v string) *ArtifactUpsertBulk

SetArchivePath sets the "archive_path" field.

func (*ArtifactUpsertBulk) SetContent

func (u *ArtifactUpsertBulk) SetContent(v string) *ArtifactUpsertBulk

SetContent sets the "content" field.

func (*ArtifactUpsertBulk) SetFilePath

func (u *ArtifactUpsertBulk) SetFilePath(v string) *ArtifactUpsertBulk

SetFilePath sets the "file_path" field.

func (*ArtifactUpsertBulk) SetFileType

func (u *ArtifactUpsertBulk) SetFileType(v string) *ArtifactUpsertBulk

SetFileType sets the "file_type" field.

func (*ArtifactUpsertBulk) Update

func (u *ArtifactUpsertBulk) Update(set func(*ArtifactUpsert)) *ArtifactUpsertBulk

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

func (*ArtifactUpsertBulk) UpdateArchivePath

func (u *ArtifactUpsertBulk) UpdateArchivePath() *ArtifactUpsertBulk

UpdateArchivePath sets the "archive_path" field to the value that was provided on create.

func (*ArtifactUpsertBulk) UpdateContent

func (u *ArtifactUpsertBulk) UpdateContent() *ArtifactUpsertBulk

UpdateContent sets the "content" field to the value that was provided on create.

func (*ArtifactUpsertBulk) UpdateFilePath

func (u *ArtifactUpsertBulk) UpdateFilePath() *ArtifactUpsertBulk

UpdateFilePath sets the "file_path" field to the value that was provided on create.

func (*ArtifactUpsertBulk) UpdateFileType

func (u *ArtifactUpsertBulk) UpdateFileType() *ArtifactUpsertBulk

UpdateFileType sets the "file_type" field to the value that was provided on create.

func (*ArtifactUpsertBulk) UpdateNewValues

func (u *ArtifactUpsertBulk) UpdateNewValues() *ArtifactUpsertBulk

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

client.Artifact.Create().
	OnConflict(
		sql.ResolveWithNewValues(),
	).
	Exec(ctx)

type ArtifactUpsertOne

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

ArtifactUpsertOne is the builder for "upsert"-ing

one Artifact node.

func (*ArtifactUpsertOne) ClearArchivePath

func (u *ArtifactUpsertOne) ClearArchivePath() *ArtifactUpsertOne

ClearArchivePath clears the value of the "archive_path" field.

func (*ArtifactUpsertOne) DoNothing

func (u *ArtifactUpsertOne) DoNothing() *ArtifactUpsertOne

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

func (*ArtifactUpsertOne) Exec

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

Exec executes the query.

func (*ArtifactUpsertOne) ExecX

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

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

func (*ArtifactUpsertOne) ID

func (u *ArtifactUpsertOne) ID(ctx context.Context) (id int, err error)

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

func (*ArtifactUpsertOne) IDX

func (u *ArtifactUpsertOne) IDX(ctx context.Context) int

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

func (*ArtifactUpsertOne) Ignore

func (u *ArtifactUpsertOne) Ignore() *ArtifactUpsertOne

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

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

func (*ArtifactUpsertOne) SetArchivePath

func (u *ArtifactUpsertOne) SetArchivePath(v string) *ArtifactUpsertOne

SetArchivePath sets the "archive_path" field.

func (*ArtifactUpsertOne) SetContent

func (u *ArtifactUpsertOne) SetContent(v string) *ArtifactUpsertOne

SetContent sets the "content" field.

func (*ArtifactUpsertOne) SetFilePath

func (u *ArtifactUpsertOne) SetFilePath(v string) *ArtifactUpsertOne

SetFilePath sets the "file_path" field.

func (*ArtifactUpsertOne) SetFileType

func (u *ArtifactUpsertOne) SetFileType(v string) *ArtifactUpsertOne

SetFileType sets the "file_type" field.

func (*ArtifactUpsertOne) Update

func (u *ArtifactUpsertOne) Update(set func(*ArtifactUpsert)) *ArtifactUpsertOne

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

func (*ArtifactUpsertOne) UpdateArchivePath

func (u *ArtifactUpsertOne) UpdateArchivePath() *ArtifactUpsertOne

UpdateArchivePath sets the "archive_path" field to the value that was provided on create.

func (*ArtifactUpsertOne) UpdateContent

func (u *ArtifactUpsertOne) UpdateContent() *ArtifactUpsertOne

UpdateContent sets the "content" field to the value that was provided on create.

func (*ArtifactUpsertOne) UpdateFilePath

func (u *ArtifactUpsertOne) UpdateFilePath() *ArtifactUpsertOne

UpdateFilePath sets the "file_path" field to the value that was provided on create.

func (*ArtifactUpsertOne) UpdateFileType

func (u *ArtifactUpsertOne) UpdateFileType() *ArtifactUpsertOne

UpdateFileType sets the "file_type" field to the value that was provided on create.

func (*ArtifactUpsertOne) UpdateNewValues

func (u *ArtifactUpsertOne) UpdateNewValues() *ArtifactUpsertOne

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

client.Artifact.Create().
	OnConflict(
		sql.ResolveWithNewValues(),
	).
	Exec(ctx)

type Artifacts

type Artifacts []*Artifact

Artifacts is a parsable slice of Artifact.

type Client

type Client struct {

	// Schema is the client for creating, migrating and dropping schema.
	Schema *migrate.Schema
	// Artifact is the client for interacting with the Artifact builders.
	Artifact *ArtifactClient
	// Metadata is the client for interacting with the Metadata builders.
	Metadata *MetadataClient
	// contains filtered or unexported fields
}

Client is the client that holds all ent builders.

func FromContext

func FromContext(ctx context.Context) *Client

FromContext returns a Client stored inside a context, or nil if there isn't one.

func NewClient

func NewClient(opts ...Option) *Client

NewClient creates a new client configured with the given options.

func Open

func Open(driverName, dataSourceName string, options ...Option) (*Client, error)

Open opens a database/sql.DB specified by the driver name and the data source name, and returns a new client attached to it. Optional parameters can be added for configuring the client.

func (*Client) BeginTx

func (c *Client) BeginTx(ctx context.Context, opts *sql.TxOptions) (*Tx, error)

BeginTx returns a transactional client with specified options.

func (*Client) Close

func (c *Client) Close() error

Close closes the database connection and prevents new queries from starting.

func (*Client) Debug

func (c *Client) Debug() *Client

Debug returns a new debug-client. It's used to get verbose logging on specific operations.

client.Debug().
	Artifact.
	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(ctx context.Context, tx *ent.Tx) error {
		// Do some stuff before.
		if err := next.Commit(ctx, tx); err != nil {
			return err
		}
		// Do some stuff after.
		return nil
	})
}

type Committer

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

Committer is the interface that wraps the Commit method.

type ConstraintError

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

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

func (ConstraintError) Error

func (e ConstraintError) Error() string

Error implements the error interface.

func (*ConstraintError) Unwrap

func (e *ConstraintError) Unwrap() error

Unwrap implements the errors.Wrapper interface.

type Hook

type Hook = ent.Hook

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

type Metadata

type Metadata struct {

	// ID of the ent.
	ID int `json:"id,omitempty"`
	// Key holds the value of the "key" field.
	Key string `json:"key,omitempty"`
	// Value holds the value of the "value" field.
	Value string `json:"value,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the MetadataQuery when eager-loading is set.
	Edges MetadataEdges `json:"edges"`
	// contains filtered or unexported fields
}

Metadata is the model entity for the Metadata schema.

func (*Metadata) QueryArtifact

func (m *Metadata) QueryArtifact() *ArtifactQuery

QueryArtifact queries the "artifact" edge of the Metadata entity.

func (*Metadata) String

func (m *Metadata) String() string

String implements the fmt.Stringer.

func (*Metadata) Unwrap

func (m *Metadata) Unwrap() *Metadata

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

func (*Metadata) Update

func (m *Metadata) Update() *MetadataUpdateOne

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

type MetadataClient

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

MetadataClient is a client for the Metadata schema.

func NewMetadataClient

func NewMetadataClient(c config) *MetadataClient

NewMetadataClient returns a client for the Metadata from the given config.

func (*MetadataClient) Create

func (c *MetadataClient) Create() *MetadataCreate

Create returns a create builder for Metadata.

func (*MetadataClient) CreateBulk

func (c *MetadataClient) CreateBulk(builders ...*MetadataCreate) *MetadataCreateBulk

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

func (*MetadataClient) Delete

func (c *MetadataClient) Delete() *MetadataDelete

Delete returns a delete builder for Metadata.

func (*MetadataClient) DeleteOne

func (c *MetadataClient) DeleteOne(m *Metadata) *MetadataDeleteOne

DeleteOne returns a delete builder for the given entity.

func (*MetadataClient) DeleteOneID

func (c *MetadataClient) DeleteOneID(id int) *MetadataDeleteOne

DeleteOneID returns a delete builder for the given id.

func (*MetadataClient) Get

func (c *MetadataClient) Get(ctx context.Context, id int) (*Metadata, error)

Get returns a Metadata entity by its id.

func (*MetadataClient) GetX

func (c *MetadataClient) GetX(ctx context.Context, id int) *Metadata

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

func (*MetadataClient) Hooks

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

Hooks returns the client hooks.

func (*MetadataClient) Query

func (c *MetadataClient) Query() *MetadataQuery

Query returns a query builder for Metadata.

func (*MetadataClient) QueryArtifact

func (c *MetadataClient) QueryArtifact(m *Metadata) *ArtifactQuery

QueryArtifact queries the artifact edge of a Metadata.

func (*MetadataClient) Update

func (c *MetadataClient) Update() *MetadataUpdate

Update returns an update builder for Metadata.

func (*MetadataClient) UpdateOne

func (c *MetadataClient) UpdateOne(m *Metadata) *MetadataUpdateOne

UpdateOne returns an update builder for the given entity.

func (*MetadataClient) UpdateOneID

func (c *MetadataClient) UpdateOneID(id int) *MetadataUpdateOne

UpdateOneID returns an update builder for the given id.

func (*MetadataClient) Use

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

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

type MetadataCreate

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

MetadataCreate is the builder for creating a Metadata entity.

func (*MetadataCreate) Exec

func (mc *MetadataCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*MetadataCreate) ExecX

func (mc *MetadataCreate) ExecX(ctx context.Context)

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

func (*MetadataCreate) Mutation

func (mc *MetadataCreate) Mutation() *MetadataMutation

Mutation returns the MetadataMutation object of the builder.

func (*MetadataCreate) OnConflict

func (mc *MetadataCreate) OnConflict(opts ...sql.ConflictOption) *MetadataUpsertOne

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

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

func (*MetadataCreate) OnConflictColumns

func (mc *MetadataCreate) OnConflictColumns(columns ...string) *MetadataUpsertOne

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

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

func (*MetadataCreate) Save

func (mc *MetadataCreate) Save(ctx context.Context) (*Metadata, error)

Save creates the Metadata in the database.

func (*MetadataCreate) SaveX

func (mc *MetadataCreate) SaveX(ctx context.Context) *Metadata

SaveX calls Save and panics if Save returns an error.

func (*MetadataCreate) SetArtifact

func (mc *MetadataCreate) SetArtifact(a *Artifact) *MetadataCreate

SetArtifact sets the "artifact" edge to the Artifact entity.

func (*MetadataCreate) SetArtifactID

func (mc *MetadataCreate) SetArtifactID(id int) *MetadataCreate

SetArtifactID sets the "artifact" edge to the Artifact entity by ID.

func (*MetadataCreate) SetKey

func (mc *MetadataCreate) SetKey(s string) *MetadataCreate

SetKey sets the "key" field.

func (*MetadataCreate) SetNillableArtifactID

func (mc *MetadataCreate) SetNillableArtifactID(id *int) *MetadataCreate

SetNillableArtifactID sets the "artifact" edge to the Artifact entity by ID if the given value is not nil.

func (*MetadataCreate) SetValue

func (mc *MetadataCreate) SetValue(s string) *MetadataCreate

SetValue sets the "value" field.

type MetadataCreateBulk

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

MetadataCreateBulk is the builder for creating many Metadata entities in bulk.

func (*MetadataCreateBulk) Exec

func (mcb *MetadataCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*MetadataCreateBulk) ExecX

func (mcb *MetadataCreateBulk) ExecX(ctx context.Context)

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

func (*MetadataCreateBulk) OnConflict

func (mcb *MetadataCreateBulk) OnConflict(opts ...sql.ConflictOption) *MetadataUpsertBulk

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

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

func (*MetadataCreateBulk) OnConflictColumns

func (mcb *MetadataCreateBulk) OnConflictColumns(columns ...string) *MetadataUpsertBulk

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

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

func (*MetadataCreateBulk) Save

func (mcb *MetadataCreateBulk) Save(ctx context.Context) ([]*Metadata, error)

Save creates the Metadata entities in the database.

func (*MetadataCreateBulk) SaveX

func (mcb *MetadataCreateBulk) SaveX(ctx context.Context) []*Metadata

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

type MetadataDelete

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

MetadataDelete is the builder for deleting a Metadata entity.

func (*MetadataDelete) Exec

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

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

func (*MetadataDelete) ExecX

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

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

func (*MetadataDelete) Where

func (md *MetadataDelete) Where(ps ...predicate.Metadata) *MetadataDelete

Where appends a list predicates to the MetadataDelete builder.

type MetadataDeleteOne

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

MetadataDeleteOne is the builder for deleting a single Metadata entity.

func (*MetadataDeleteOne) Exec

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

Exec executes the deletion query.

func (*MetadataDeleteOne) ExecX

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

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

type MetadataEdges

type MetadataEdges struct {
	// Artifact holds the value of the artifact edge.
	Artifact *Artifact `json:"artifact,omitempty"`
	// contains filtered or unexported fields
}

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

func (MetadataEdges) ArtifactOrErr

func (e MetadataEdges) ArtifactOrErr() (*Artifact, error)

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

type MetadataGroupBy

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

MetadataGroupBy is the group-by builder for Metadata entities.

func (*MetadataGroupBy) Aggregate

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

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

func (*MetadataGroupBy) Bool

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

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

func (*MetadataGroupBy) BoolX

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

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

func (*MetadataGroupBy) Bools

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

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

func (*MetadataGroupBy) BoolsX

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

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

func (*MetadataGroupBy) Float64

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

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

func (*MetadataGroupBy) Float64X

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

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

func (*MetadataGroupBy) Float64s

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

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

func (*MetadataGroupBy) Float64sX

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

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

func (*MetadataGroupBy) Int

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

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

func (*MetadataGroupBy) IntX

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

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

func (*MetadataGroupBy) Ints

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

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

func (*MetadataGroupBy) IntsX

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

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

func (*MetadataGroupBy) Scan

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

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

func (*MetadataGroupBy) ScanX

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

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

func (*MetadataGroupBy) String

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

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

func (*MetadataGroupBy) StringX

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

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

func (*MetadataGroupBy) Strings

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

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

func (*MetadataGroupBy) StringsX

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

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

type MetadataMutation

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

MetadataMutation represents an operation that mutates the Metadata nodes in the graph.

func (*MetadataMutation) AddField

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

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

func (*MetadataMutation) AddedEdges

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

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

func (*MetadataMutation) AddedField

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

AddedField returns the numeric value that was incremented/decremented on a field with the given name. The second boolean return value indicates that this field was not set, or was not defined in the schema.

func (*MetadataMutation) AddedFields

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

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

func (*MetadataMutation) AddedIDs

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

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

func (*MetadataMutation) ArtifactCleared

func (m *MetadataMutation) ArtifactCleared() bool

ArtifactCleared reports if the "artifact" edge to the Artifact entity was cleared.

func (*MetadataMutation) ArtifactID

func (m *MetadataMutation) ArtifactID() (id int, exists bool)

ArtifactID returns the "artifact" edge ID in the mutation.

func (*MetadataMutation) ArtifactIDs

func (m *MetadataMutation) ArtifactIDs() (ids []int)

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

func (*MetadataMutation) ClearArtifact

func (m *MetadataMutation) ClearArtifact()

ClearArtifact clears the "artifact" edge to the Artifact entity.

func (*MetadataMutation) ClearEdge

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

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

func (*MetadataMutation) ClearField

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

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

func (*MetadataMutation) ClearedEdges

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

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

func (*MetadataMutation) ClearedFields

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

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

func (MetadataMutation) Client

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

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

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

func (*MetadataMutation) Field

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

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

func (*MetadataMutation) FieldCleared

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

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

func (*MetadataMutation) Fields

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

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

func (*MetadataMutation) ID

func (m *MetadataMutation) ID() (id int, exists bool)

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

func (*MetadataMutation) IDs

func (m *MetadataMutation) IDs(ctx context.Context) ([]int, error)

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

func (*MetadataMutation) Key

func (m *MetadataMutation) Key() (r string, exists bool)

Key returns the value of the "key" field in the mutation.

func (*MetadataMutation) OldField

func (m *MetadataMutation) OldField(ctx context.Context, name string) (ent.Value, error)

OldField returns the old value of the field from the database. An error is returned if the mutation operation is not UpdateOne, or the query to the database failed.

func (*MetadataMutation) OldKey

func (m *MetadataMutation) OldKey(ctx context.Context) (v string, err error)

OldKey returns the old "key" field's value of the Metadata entity. If the Metadata object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.

func (*MetadataMutation) OldValue

func (m *MetadataMutation) OldValue(ctx context.Context) (v string, err error)

OldValue returns the old "value" field's value of the Metadata entity. If the Metadata object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.

func (*MetadataMutation) Op

func (m *MetadataMutation) Op() Op

Op returns the operation name.

func (*MetadataMutation) RemovedEdges

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

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

func (*MetadataMutation) RemovedIDs

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

RemovedIDs returns all IDs (to other nodes) that were removed for the edge with the given name in this mutation.

func (*MetadataMutation) ResetArtifact

func (m *MetadataMutation) ResetArtifact()

ResetArtifact resets all changes to the "artifact" edge.

func (*MetadataMutation) ResetEdge

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

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

func (*MetadataMutation) ResetField

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

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

func (*MetadataMutation) ResetKey

func (m *MetadataMutation) ResetKey()

ResetKey resets all changes to the "key" field.

func (*MetadataMutation) ResetValue

func (m *MetadataMutation) ResetValue()

ResetValue resets all changes to the "value" field.

func (*MetadataMutation) SetArtifactID

func (m *MetadataMutation) SetArtifactID(id int)

SetArtifactID sets the "artifact" edge to the Artifact entity by id.

func (*MetadataMutation) SetField

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

SetField sets the value of a field with the given name. It returns an error if the field is not defined in the schema, or if the type mismatched the field type.

func (*MetadataMutation) SetKey

func (m *MetadataMutation) SetKey(s string)

SetKey sets the "key" field.

func (*MetadataMutation) SetValue

func (m *MetadataMutation) SetValue(s string)

SetValue sets the "value" field.

func (MetadataMutation) Tx

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

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

func (*MetadataMutation) Type

func (m *MetadataMutation) Type() string

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

func (*MetadataMutation) Value

func (m *MetadataMutation) Value() (r string, exists bool)

Value returns the value of the "value" field in the mutation.

func (*MetadataMutation) Where

func (m *MetadataMutation) Where(ps ...predicate.Metadata)

Where appends a list predicates to the MetadataMutation builder.

type MetadataQuery

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

MetadataQuery is the builder for querying Metadata entities.

func (*MetadataQuery) All

func (mq *MetadataQuery) All(ctx context.Context) ([]*Metadata, error)

All executes the query and returns a list of MetadataSlice.

func (*MetadataQuery) AllX

func (mq *MetadataQuery) AllX(ctx context.Context) []*Metadata

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

func (*MetadataQuery) Clone

func (mq *MetadataQuery) Clone() *MetadataQuery

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

func (*MetadataQuery) Count

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

Count returns the count of the given query.

func (*MetadataQuery) CountX

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

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

func (*MetadataQuery) Exist

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

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

func (*MetadataQuery) ExistX

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

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

func (*MetadataQuery) First

func (mq *MetadataQuery) First(ctx context.Context) (*Metadata, error)

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

func (*MetadataQuery) FirstID

func (mq *MetadataQuery) FirstID(ctx context.Context) (id int, err error)

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

func (*MetadataQuery) FirstIDX

func (mq *MetadataQuery) FirstIDX(ctx context.Context) int

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

func (*MetadataQuery) FirstX

func (mq *MetadataQuery) FirstX(ctx context.Context) *Metadata

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

func (*MetadataQuery) GroupBy

func (mq *MetadataQuery) GroupBy(field string, fields ...string) *MetadataGroupBy

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

Example:

var v []struct {
	Key string `json:"key,omitempty"`
	Count int `json:"count,omitempty"`
}

client.Metadata.Query().
	GroupBy(metadata.FieldKey).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*MetadataQuery) IDs

func (mq *MetadataQuery) IDs(ctx context.Context) ([]int, error)

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

func (*MetadataQuery) IDsX

func (mq *MetadataQuery) IDsX(ctx context.Context) []int

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

func (*MetadataQuery) Limit

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

Limit adds a limit step to the query.

func (*MetadataQuery) Offset

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

Offset adds an offset step to the query.

func (*MetadataQuery) Only

func (mq *MetadataQuery) Only(ctx context.Context) (*Metadata, error)

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

func (*MetadataQuery) OnlyID

func (mq *MetadataQuery) OnlyID(ctx context.Context) (id int, err error)

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

func (*MetadataQuery) OnlyIDX

func (mq *MetadataQuery) OnlyIDX(ctx context.Context) int

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

func (*MetadataQuery) OnlyX

func (mq *MetadataQuery) OnlyX(ctx context.Context) *Metadata

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

func (*MetadataQuery) Order

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

Order adds an order step to the query.

func (*MetadataQuery) QueryArtifact

func (mq *MetadataQuery) QueryArtifact() *ArtifactQuery

QueryArtifact chains the current query on the "artifact" edge.

func (*MetadataQuery) Select

func (mq *MetadataQuery) Select(fields ...string) *MetadataSelect

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

Example:

var v []struct {
	Key string `json:"key,omitempty"`
}

client.Metadata.Query().
	Select(metadata.FieldKey).
	Scan(ctx, &v)

func (*MetadataQuery) Unique

func (mq *MetadataQuery) Unique(unique bool) *MetadataQuery

Unique configures the query builder to filter duplicate records on query. By default, unique is set to true, and can be disabled using this method.

func (*MetadataQuery) Where

func (mq *MetadataQuery) Where(ps ...predicate.Metadata) *MetadataQuery

Where adds a new predicate for the MetadataQuery builder.

func (*MetadataQuery) WithArtifact

func (mq *MetadataQuery) WithArtifact(opts ...func(*ArtifactQuery)) *MetadataQuery

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

type MetadataSelect

type MetadataSelect struct {
	*MetadataQuery
	// contains filtered or unexported fields
}

MetadataSelect is the builder for selecting fields of Metadata entities.

func (*MetadataSelect) Bool

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

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

func (*MetadataSelect) BoolX

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

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

func (*MetadataSelect) Bools

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

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

func (*MetadataSelect) BoolsX

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

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

func (*MetadataSelect) Float64

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

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

func (*MetadataSelect) Float64X

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

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

func (*MetadataSelect) Float64s

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

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

func (*MetadataSelect) Float64sX

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

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

func (*MetadataSelect) Int

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

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

func (*MetadataSelect) IntX

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

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

func (*MetadataSelect) Ints

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

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

func (*MetadataSelect) IntsX

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

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

func (*MetadataSelect) Scan

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

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

func (*MetadataSelect) ScanX

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

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

func (*MetadataSelect) String

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

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

func (*MetadataSelect) StringX

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

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

func (*MetadataSelect) Strings

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

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

func (*MetadataSelect) StringsX

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

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

type MetadataSlice

type MetadataSlice []*Metadata

MetadataSlice is a parsable slice of Metadata.

type MetadataUpdate

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

MetadataUpdate is the builder for updating Metadata entities.

func (*MetadataUpdate) ClearArtifact

func (mu *MetadataUpdate) ClearArtifact() *MetadataUpdate

ClearArtifact clears the "artifact" edge to the Artifact entity.

func (*MetadataUpdate) Exec

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

Exec executes the query.

func (*MetadataUpdate) ExecX

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

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

func (*MetadataUpdate) Mutation

func (mu *MetadataUpdate) Mutation() *MetadataMutation

Mutation returns the MetadataMutation object of the builder.

func (*MetadataUpdate) Save

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

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

func (*MetadataUpdate) SaveX

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

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

func (*MetadataUpdate) SetArtifact

func (mu *MetadataUpdate) SetArtifact(a *Artifact) *MetadataUpdate

SetArtifact sets the "artifact" edge to the Artifact entity.

func (*MetadataUpdate) SetArtifactID

func (mu *MetadataUpdate) SetArtifactID(id int) *MetadataUpdate

SetArtifactID sets the "artifact" edge to the Artifact entity by ID.

func (*MetadataUpdate) SetKey

func (mu *MetadataUpdate) SetKey(s string) *MetadataUpdate

SetKey sets the "key" field.

func (*MetadataUpdate) SetNillableArtifactID

func (mu *MetadataUpdate) SetNillableArtifactID(id *int) *MetadataUpdate

SetNillableArtifactID sets the "artifact" edge to the Artifact entity by ID if the given value is not nil.

func (*MetadataUpdate) SetValue

func (mu *MetadataUpdate) SetValue(s string) *MetadataUpdate

SetValue sets the "value" field.

func (*MetadataUpdate) Where

func (mu *MetadataUpdate) Where(ps ...predicate.Metadata) *MetadataUpdate

Where appends a list predicates to the MetadataUpdate builder.

type MetadataUpdateOne

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

MetadataUpdateOne is the builder for updating a single Metadata entity.

func (*MetadataUpdateOne) ClearArtifact

func (muo *MetadataUpdateOne) ClearArtifact() *MetadataUpdateOne

ClearArtifact clears the "artifact" edge to the Artifact entity.

func (*MetadataUpdateOne) Exec

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

Exec executes the query on the entity.

func (*MetadataUpdateOne) ExecX

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

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

func (*MetadataUpdateOne) Mutation

func (muo *MetadataUpdateOne) Mutation() *MetadataMutation

Mutation returns the MetadataMutation object of the builder.

func (*MetadataUpdateOne) Save

func (muo *MetadataUpdateOne) Save(ctx context.Context) (*Metadata, error)

Save executes the query and returns the updated Metadata entity.

func (*MetadataUpdateOne) SaveX

func (muo *MetadataUpdateOne) SaveX(ctx context.Context) *Metadata

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

func (*MetadataUpdateOne) Select

func (muo *MetadataUpdateOne) Select(field string, fields ...string) *MetadataUpdateOne

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

func (*MetadataUpdateOne) SetArtifact

func (muo *MetadataUpdateOne) SetArtifact(a *Artifact) *MetadataUpdateOne

SetArtifact sets the "artifact" edge to the Artifact entity.

func (*MetadataUpdateOne) SetArtifactID

func (muo *MetadataUpdateOne) SetArtifactID(id int) *MetadataUpdateOne

SetArtifactID sets the "artifact" edge to the Artifact entity by ID.

func (*MetadataUpdateOne) SetKey

func (muo *MetadataUpdateOne) SetKey(s string) *MetadataUpdateOne

SetKey sets the "key" field.

func (*MetadataUpdateOne) SetNillableArtifactID

func (muo *MetadataUpdateOne) SetNillableArtifactID(id *int) *MetadataUpdateOne

SetNillableArtifactID sets the "artifact" edge to the Artifact entity by ID if the given value is not nil.

func (*MetadataUpdateOne) SetValue

func (muo *MetadataUpdateOne) SetValue(s string) *MetadataUpdateOne

SetValue sets the "value" field.

type MetadataUpsert

type MetadataUpsert struct {
	*sql.UpdateSet
}

MetadataUpsert is the "OnConflict" setter.

func (*MetadataUpsert) SetKey

func (u *MetadataUpsert) SetKey(v string) *MetadataUpsert

SetKey sets the "key" field.

func (*MetadataUpsert) SetValue

func (u *MetadataUpsert) SetValue(v string) *MetadataUpsert

SetValue sets the "value" field.

func (*MetadataUpsert) UpdateKey

func (u *MetadataUpsert) UpdateKey() *MetadataUpsert

UpdateKey sets the "key" field to the value that was provided on create.

func (*MetadataUpsert) UpdateValue

func (u *MetadataUpsert) UpdateValue() *MetadataUpsert

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

type MetadataUpsertBulk

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

MetadataUpsertBulk is the builder for "upsert"-ing a bulk of Metadata nodes.

func (*MetadataUpsertBulk) DoNothing

func (u *MetadataUpsertBulk) DoNothing() *MetadataUpsertBulk

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

func (*MetadataUpsertBulk) Exec

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

Exec executes the query.

func (*MetadataUpsertBulk) ExecX

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

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

func (*MetadataUpsertBulk) Ignore

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

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

func (*MetadataUpsertBulk) SetKey

SetKey sets the "key" field.

func (*MetadataUpsertBulk) SetValue

SetValue sets the "value" field.

func (*MetadataUpsertBulk) Update

func (u *MetadataUpsertBulk) Update(set func(*MetadataUpsert)) *MetadataUpsertBulk

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

func (*MetadataUpsertBulk) UpdateKey

func (u *MetadataUpsertBulk) UpdateKey() *MetadataUpsertBulk

UpdateKey sets the "key" field to the value that was provided on create.

func (*MetadataUpsertBulk) UpdateNewValues

func (u *MetadataUpsertBulk) UpdateNewValues() *MetadataUpsertBulk

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

client.Metadata.Create().
	OnConflict(
		sql.ResolveWithNewValues(),
	).
	Exec(ctx)

func (*MetadataUpsertBulk) UpdateValue

func (u *MetadataUpsertBulk) UpdateValue() *MetadataUpsertBulk

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

type MetadataUpsertOne

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

MetadataUpsertOne is the builder for "upsert"-ing

one Metadata node.

func (*MetadataUpsertOne) DoNothing

func (u *MetadataUpsertOne) DoNothing() *MetadataUpsertOne

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

func (*MetadataUpsertOne) Exec

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

Exec executes the query.

func (*MetadataUpsertOne) ExecX

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

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

func (*MetadataUpsertOne) ID

func (u *MetadataUpsertOne) ID(ctx context.Context) (id int, err error)

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

func (*MetadataUpsertOne) IDX

func (u *MetadataUpsertOne) IDX(ctx context.Context) int

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

func (*MetadataUpsertOne) Ignore

func (u *MetadataUpsertOne) Ignore() *MetadataUpsertOne

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

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

func (*MetadataUpsertOne) SetKey

SetKey sets the "key" field.

func (*MetadataUpsertOne) SetValue

func (u *MetadataUpsertOne) SetValue(v string) *MetadataUpsertOne

SetValue sets the "value" field.

func (*MetadataUpsertOne) Update

func (u *MetadataUpsertOne) Update(set func(*MetadataUpsert)) *MetadataUpsertOne

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

func (*MetadataUpsertOne) UpdateKey

func (u *MetadataUpsertOne) UpdateKey() *MetadataUpsertOne

UpdateKey sets the "key" field to the value that was provided on create.

func (*MetadataUpsertOne) UpdateNewValues

func (u *MetadataUpsertOne) UpdateNewValues() *MetadataUpsertOne

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

client.Metadata.Create().
	OnConflict(
		sql.ResolveWithNewValues(),
	).
	Exec(ctx)

func (*MetadataUpsertOne) UpdateValue

func (u *MetadataUpsertOne) UpdateValue() *MetadataUpsertOne

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

type MutateFunc

type MutateFunc = ent.MutateFunc

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

type Mutation

type Mutation = ent.Mutation

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

type Mutator

type Mutator = ent.Mutator

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

type NotFoundError

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

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

func (*NotFoundError) Error

func (e *NotFoundError) Error() string

Error implements the error interface.

type NotLoadedError

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

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

func (*NotLoadedError) Error

func (e *NotLoadedError) Error() string

Error implements the error interface.

type NotSingularError

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

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

func (*NotSingularError) Error

func (e *NotSingularError) Error() string

Error implements the error interface.

type Op

type Op = ent.Op

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

type Option

type Option func(*config)

Option function to configure the client.

func Debug

func Debug() Option

Debug enables debug logging on the ent.Driver.

func Driver

func Driver(driver dialect.Driver) Option

Driver configures the client driver.

func Log

func Log(fn func(...interface{})) Option

Log sets the logging function for debug mode.

type OrderFunc

type OrderFunc func(*sql.Selector)

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 conflicts in user's code.

type Query

type Query = ent.Query

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

type RollbackFunc

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

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

func (RollbackFunc) Rollback

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

Rollback calls f(ctx, m).

type RollbackHook

type RollbackHook func(Rollbacker) Rollbacker

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

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

type Rollbacker

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

Rollbacker is the interface that wraps the Rollback method.

type Tx

type Tx struct {

	// Artifact is the client for interacting with the Artifact builders.
	Artifact *ArtifactClient
	// Metadata is the client for interacting with the Metadata builders.
	Metadata *MetadataClient
	// contains filtered or unexported fields
}

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

func TxFromContext

func TxFromContext(ctx context.Context) *Tx

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

func (*Tx) Client

func (tx *Tx) Client() *Client

Client returns a Client that binds to current transaction.

func (*Tx) Commit

func (tx *Tx) Commit() error

Commit commits the transaction.

func (*Tx) OnCommit

func (tx *Tx) OnCommit(f CommitHook)

OnCommit adds a hook to call on commit.

func (*Tx) OnRollback

func (tx *Tx) OnRollback(f RollbackHook)

OnRollback adds a hook to call on rollback.

func (*Tx) Rollback

func (tx *Tx) Rollback() error

Rollback rollbacks the transaction.

type ValidationError

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

ValidationError returns when validating a field or edge fails.

func (*ValidationError) Error

func (e *ValidationError) Error() string

Error implements the error interface.

func (*ValidationError) Unwrap

func (e *ValidationError) Unwrap() error

Unwrap implements the errors.Wrapper interface.

type Value

type Value = ent.Value

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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