ent

package
v0.0.0-...-73ad954 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2024 License: AGPL-3.0 Imports: 19 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.
	TypePkg    = "Pkg"
	TypeTarget = "Target"
)

Variables

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

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

Functions

func Asc

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

Asc applies the given fields in ASC order.

func Desc

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

Desc applies the given fields in DESC order.

func IsConstraintError

func IsConstraintError(err error) bool

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

func IsNotFound

func IsNotFound(err error) bool

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

func IsNotLoaded

func IsNotLoaded(err error) bool

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

func IsNotSingular

func IsNotSingular(err error) bool

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

func IsValidationError

func IsValidationError(err error) bool

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

func MaskNotFound

func MaskNotFound(err error) error

MaskNotFound masks not found error.

func NewContext

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

NewContext returns a new context with the given Client attached.

func NewTxContext

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

NewTxContext returns a new context with the given Tx attached.

Types

type AggregateFunc

type AggregateFunc func(*sql.Selector) string

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

func As

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

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

func Count

func Count() AggregateFunc

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

func Max

func Max(field string) AggregateFunc

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

func Mean

func Mean(field string) AggregateFunc

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

func Min

func Min(field string) AggregateFunc

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

func Sum

func Sum(field string) AggregateFunc

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

type Client

type Client struct {

	// Schema is the client for creating, migrating and dropping schema.
	Schema *migrate.Schema
	// Pkg is the client for interacting with the Pkg builders.
	Pkg *PkgClient
	// Target is the client for interacting with the Target builders.
	Target *TargetClient
	// 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().
	Pkg.
	Query().
	Count(ctx)

func (*Client) Intercept

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

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

func (*Client) Mutate

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

Mutate implements the ent.Mutator interface.

func (*Client) Tx

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

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

func (*Client) Use

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

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

type CommitFunc

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

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

func (CommitFunc) Commit

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

Commit calls f(ctx, m).

type CommitHook

type CommitHook func(Committer) Committer

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

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

type Committer

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

Committer is the interface that wraps the Commit method.

type ConstraintError

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

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

func (ConstraintError) Error

func (e ConstraintError) Error() string

Error implements the error interface.

func (*ConstraintError) Unwrap

func (e *ConstraintError) Unwrap() error

Unwrap implements the errors.Wrapper interface.

type Hook

type Hook = ent.Hook

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

type InterceptFunc

type InterceptFunc = ent.InterceptFunc

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

type Interceptor

type Interceptor = ent.Interceptor

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

type MutateFunc

type MutateFunc = ent.MutateFunc

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

type Mutation

type Mutation = ent.Mutation

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

type Mutator

type Mutator = ent.Mutator

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

type NotFoundError

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

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

func (*NotFoundError) Error

func (e *NotFoundError) Error() string

Error implements the error interface.

type NotLoadedError

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

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

func (*NotLoadedError) Error

func (e *NotLoadedError) Error() string

Error implements the error interface.

type NotSingularError

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

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

func (*NotSingularError) Error

func (e *NotSingularError) Error() string

Error implements the error interface.

type Op

type Op = ent.Op

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

type Option

type Option func(*config)

Option function to configure the client.

func Debug

func Debug() Option

Debug enables debug logging on the ent.Driver.

func Driver

func Driver(driver dialect.Driver) Option

Driver configures the client driver.

func Log

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

Log sets the logging function for debug mode.

type OrderFunc

type OrderFunc func(*sql.Selector)

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

type Pkg

type Pkg struct {

	// ID of the ent.
	ID uuid.UUID `json:"id,omitempty"`
	// contains filtered or unexported fields
}

Pkg is the model entity for the Pkg schema.

func (*Pkg) String

func (pk *Pkg) String() string

String implements the fmt.Stringer.

func (*Pkg) Unwrap

func (pk *Pkg) Unwrap() *Pkg

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

func (pk *Pkg) Update() *PkgUpdateOne

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

func (*Pkg) Value

func (pk *Pkg) Value(name string) (ent.Value, error)

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

type PkgClient

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

PkgClient is a client for the Pkg schema.

func NewPkgClient

func NewPkgClient(c config) *PkgClient

NewPkgClient returns a client for the Pkg from the given config.

func (*PkgClient) Create

func (c *PkgClient) Create() *PkgCreate

Create returns a builder for creating a Pkg entity.

func (*PkgClient) CreateBulk

func (c *PkgClient) CreateBulk(builders ...*PkgCreate) *PkgCreateBulk

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

func (*PkgClient) Delete

func (c *PkgClient) Delete() *PkgDelete

Delete returns a delete builder for Pkg.

func (*PkgClient) DeleteOne

func (c *PkgClient) DeleteOne(pk *Pkg) *PkgDeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*PkgClient) DeleteOneID

func (c *PkgClient) DeleteOneID(id uuid.UUID) *PkgDeleteOne

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

func (*PkgClient) Get

func (c *PkgClient) Get(ctx context.Context, id uuid.UUID) (*Pkg, error)

Get returns a Pkg entity by its id.

func (*PkgClient) GetX

func (c *PkgClient) GetX(ctx context.Context, id uuid.UUID) *Pkg

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

func (*PkgClient) Hooks

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

Hooks returns the client hooks.

func (*PkgClient) Intercept

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

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

func (*PkgClient) Interceptors

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

Interceptors returns the client interceptors.

func (*PkgClient) MapCreateBulk

func (c *PkgClient) MapCreateBulk(slice any, setFunc func(*PkgCreate, int)) *PkgCreateBulk

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

func (*PkgClient) Query

func (c *PkgClient) Query() *PkgQuery

Query returns a query builder for Pkg.

func (*PkgClient) Update

func (c *PkgClient) Update() *PkgUpdate

Update returns an update builder for Pkg.

func (*PkgClient) UpdateOne

func (c *PkgClient) UpdateOne(pk *Pkg) *PkgUpdateOne

UpdateOne returns an update builder for the given entity.

func (*PkgClient) UpdateOneID

func (c *PkgClient) UpdateOneID(id uuid.UUID) *PkgUpdateOne

UpdateOneID returns an update builder for the given id.

func (*PkgClient) Use

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

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

type PkgCreate

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

PkgCreate is the builder for creating a Pkg entity.

func (*PkgCreate) Exec

func (pc *PkgCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*PkgCreate) ExecX

func (pc *PkgCreate) ExecX(ctx context.Context)

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

func (*PkgCreate) Mutation

func (pc *PkgCreate) Mutation() *PkgMutation

Mutation returns the PkgMutation object of the builder.

func (*PkgCreate) Save

func (pc *PkgCreate) Save(ctx context.Context) (*Pkg, error)

Save creates the Pkg in the database.

func (*PkgCreate) SaveX

func (pc *PkgCreate) SaveX(ctx context.Context) *Pkg

SaveX calls Save and panics if Save returns an error.

func (*PkgCreate) SetID

func (pc *PkgCreate) SetID(u uuid.UUID) *PkgCreate

SetID sets the "id" field.

func (*PkgCreate) SetNillableID

func (pc *PkgCreate) SetNillableID(u *uuid.UUID) *PkgCreate

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

type PkgCreateBulk

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

PkgCreateBulk is the builder for creating many Pkg entities in bulk.

func (*PkgCreateBulk) Exec

func (pcb *PkgCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*PkgCreateBulk) ExecX

func (pcb *PkgCreateBulk) ExecX(ctx context.Context)

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

func (*PkgCreateBulk) Save

func (pcb *PkgCreateBulk) Save(ctx context.Context) ([]*Pkg, error)

Save creates the Pkg entities in the database.

func (*PkgCreateBulk) SaveX

func (pcb *PkgCreateBulk) SaveX(ctx context.Context) []*Pkg

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

type PkgDelete

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

PkgDelete is the builder for deleting a Pkg entity.

func (*PkgDelete) Exec

func (pd *PkgDelete) Exec(ctx context.Context) (int, error)

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

func (*PkgDelete) ExecX

func (pd *PkgDelete) ExecX(ctx context.Context) int

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

func (*PkgDelete) Where

func (pd *PkgDelete) Where(ps ...predicate.Pkg) *PkgDelete

Where appends a list predicates to the PkgDelete builder.

type PkgDeleteOne

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

PkgDeleteOne is the builder for deleting a single Pkg entity.

func (*PkgDeleteOne) Exec

func (pdo *PkgDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*PkgDeleteOne) ExecX

func (pdo *PkgDeleteOne) ExecX(ctx context.Context)

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

func (*PkgDeleteOne) Where

func (pdo *PkgDeleteOne) Where(ps ...predicate.Pkg) *PkgDeleteOne

Where appends a list predicates to the PkgDelete builder.

type PkgGroupBy

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

PkgGroupBy is the group-by builder for Pkg entities.

func (*PkgGroupBy) Aggregate

func (pgb *PkgGroupBy) Aggregate(fns ...AggregateFunc) *PkgGroupBy

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

func (*PkgGroupBy) Bool

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

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

func (*PkgGroupBy) BoolX

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

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

func (*PkgGroupBy) Bools

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

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

func (*PkgGroupBy) BoolsX

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

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

func (*PkgGroupBy) Float64

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

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

func (*PkgGroupBy) Float64X

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

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

func (*PkgGroupBy) Float64s

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

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

func (*PkgGroupBy) Float64sX

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

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

func (*PkgGroupBy) Int

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

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

func (*PkgGroupBy) IntX

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

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

func (*PkgGroupBy) Ints

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

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

func (*PkgGroupBy) IntsX

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

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

func (*PkgGroupBy) Scan

func (pgb *PkgGroupBy) Scan(ctx context.Context, v any) error

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

func (*PkgGroupBy) ScanX

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

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

func (*PkgGroupBy) String

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

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

func (*PkgGroupBy) StringX

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

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

func (*PkgGroupBy) Strings

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

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

func (*PkgGroupBy) StringsX

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

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

type PkgMutation

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

PkgMutation represents an operation that mutates the Pkg nodes in the graph.

func (*PkgMutation) AddField

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

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

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

func (*PkgMutation) AddedField

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

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

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

func (*PkgMutation) AddedIDs

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

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

func (*PkgMutation) ClearEdge

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

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

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

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

func (*PkgMutation) ClearedFields

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

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

func (PkgMutation) Client

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

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

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

func (*PkgMutation) Field

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

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

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

func (*PkgMutation) Fields

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

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

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

func (*PkgMutation) IDs

func (m *PkgMutation) IDs(ctx context.Context) ([]uuid.UUID, error)

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

func (*PkgMutation) OldField

func (m *PkgMutation) 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 (*PkgMutation) Op

func (m *PkgMutation) Op() Op

Op returns the operation name.

func (*PkgMutation) RemovedEdges

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

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

func (*PkgMutation) RemovedIDs

func (m *PkgMutation) 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 (*PkgMutation) ResetEdge

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

func (m *PkgMutation) 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 (*PkgMutation) SetField

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

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

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

func (*PkgMutation) SetOp

func (m *PkgMutation) SetOp(op Op)

SetOp allows setting the mutation operation.

func (PkgMutation) Tx

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

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

func (*PkgMutation) Type

func (m *PkgMutation) Type() string

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

func (*PkgMutation) Where

func (m *PkgMutation) Where(ps ...predicate.Pkg)

Where appends a list predicates to the PkgMutation builder.

func (*PkgMutation) WhereP

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

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

type PkgQuery

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

PkgQuery is the builder for querying Pkg entities.

func (*PkgQuery) Aggregate

func (pq *PkgQuery) Aggregate(fns ...AggregateFunc) *PkgSelect

Aggregate returns a PkgSelect configured with the given aggregations.

func (*PkgQuery) All

func (pq *PkgQuery) All(ctx context.Context) ([]*Pkg, error)

All executes the query and returns a list of Pkgs.

func (*PkgQuery) AllX

func (pq *PkgQuery) AllX(ctx context.Context) []*Pkg

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

func (*PkgQuery) Clone

func (pq *PkgQuery) Clone() *PkgQuery

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

func (*PkgQuery) Count

func (pq *PkgQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*PkgQuery) CountX

func (pq *PkgQuery) CountX(ctx context.Context) int

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

func (*PkgQuery) Exist

func (pq *PkgQuery) Exist(ctx context.Context) (bool, error)

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

func (*PkgQuery) ExistX

func (pq *PkgQuery) ExistX(ctx context.Context) bool

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

func (*PkgQuery) First

func (pq *PkgQuery) First(ctx context.Context) (*Pkg, error)

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

func (*PkgQuery) FirstID

func (pq *PkgQuery) FirstID(ctx context.Context) (id uuid.UUID, err error)

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

func (*PkgQuery) FirstIDX

func (pq *PkgQuery) FirstIDX(ctx context.Context) uuid.UUID

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

func (*PkgQuery) FirstX

func (pq *PkgQuery) FirstX(ctx context.Context) *Pkg

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

func (*PkgQuery) GroupBy

func (pq *PkgQuery) GroupBy(field string, fields ...string) *PkgGroupBy

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.

func (*PkgQuery) IDs

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

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

func (*PkgQuery) IDsX

func (pq *PkgQuery) IDsX(ctx context.Context) []uuid.UUID

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

func (*PkgQuery) Limit

func (pq *PkgQuery) Limit(limit int) *PkgQuery

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

func (*PkgQuery) Offset

func (pq *PkgQuery) Offset(offset int) *PkgQuery

Offset to start from.

func (*PkgQuery) Only

func (pq *PkgQuery) Only(ctx context.Context) (*Pkg, error)

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

func (*PkgQuery) OnlyID

func (pq *PkgQuery) OnlyID(ctx context.Context) (id uuid.UUID, err error)

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

func (*PkgQuery) OnlyIDX

func (pq *PkgQuery) OnlyIDX(ctx context.Context) uuid.UUID

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

func (*PkgQuery) OnlyX

func (pq *PkgQuery) OnlyX(ctx context.Context) *Pkg

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

func (*PkgQuery) Order

func (pq *PkgQuery) Order(o ...pkg.OrderOption) *PkgQuery

Order specifies how the records should be ordered.

func (*PkgQuery) Select

func (pq *PkgQuery) Select(fields ...string) *PkgSelect

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

func (*PkgQuery) Unique

func (pq *PkgQuery) Unique(unique bool) *PkgQuery

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

func (pq *PkgQuery) Where(ps ...predicate.Pkg) *PkgQuery

Where adds a new predicate for the PkgQuery builder.

type PkgSelect

type PkgSelect struct {
	*PkgQuery
	// contains filtered or unexported fields
}

PkgSelect is the builder for selecting fields of Pkg entities.

func (*PkgSelect) Aggregate

func (ps *PkgSelect) Aggregate(fns ...AggregateFunc) *PkgSelect

Aggregate adds the given aggregation functions to the selector query.

func (*PkgSelect) Bool

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

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

func (*PkgSelect) BoolX

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

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

func (*PkgSelect) Bools

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

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

func (*PkgSelect) BoolsX

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

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

func (*PkgSelect) Float64

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

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

func (*PkgSelect) Float64X

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

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

func (*PkgSelect) Float64s

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

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

func (*PkgSelect) Float64sX

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

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

func (*PkgSelect) Int

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

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

func (*PkgSelect) IntX

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

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

func (*PkgSelect) Ints

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

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

func (*PkgSelect) IntsX

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

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

func (*PkgSelect) Scan

func (ps *PkgSelect) Scan(ctx context.Context, v any) error

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

func (*PkgSelect) ScanX

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

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

func (*PkgSelect) String

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

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

func (*PkgSelect) StringX

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

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

func (*PkgSelect) Strings

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

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

func (*PkgSelect) StringsX

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

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

type PkgUpdate

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

PkgUpdate is the builder for updating Pkg entities.

func (*PkgUpdate) Exec

func (pu *PkgUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*PkgUpdate) ExecX

func (pu *PkgUpdate) ExecX(ctx context.Context)

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

func (*PkgUpdate) Mutation

func (pu *PkgUpdate) Mutation() *PkgMutation

Mutation returns the PkgMutation object of the builder.

func (*PkgUpdate) Save

func (pu *PkgUpdate) Save(ctx context.Context) (int, error)

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

func (*PkgUpdate) SaveX

func (pu *PkgUpdate) SaveX(ctx context.Context) int

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

func (*PkgUpdate) Where

func (pu *PkgUpdate) Where(ps ...predicate.Pkg) *PkgUpdate

Where appends a list predicates to the PkgUpdate builder.

type PkgUpdateOne

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

PkgUpdateOne is the builder for updating a single Pkg entity.

func (*PkgUpdateOne) Exec

func (puo *PkgUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*PkgUpdateOne) ExecX

func (puo *PkgUpdateOne) ExecX(ctx context.Context)

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

func (*PkgUpdateOne) Mutation

func (puo *PkgUpdateOne) Mutation() *PkgMutation

Mutation returns the PkgMutation object of the builder.

func (*PkgUpdateOne) Save

func (puo *PkgUpdateOne) Save(ctx context.Context) (*Pkg, error)

Save executes the query and returns the updated Pkg entity.

func (*PkgUpdateOne) SaveX

func (puo *PkgUpdateOne) SaveX(ctx context.Context) *Pkg

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

func (*PkgUpdateOne) Select

func (puo *PkgUpdateOne) Select(field string, fields ...string) *PkgUpdateOne

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

func (*PkgUpdateOne) Where

func (puo *PkgUpdateOne) Where(ps ...predicate.Pkg) *PkgUpdateOne

Where appends a list predicates to the PkgUpdate builder.

type Pkgs

type Pkgs []*Pkg

Pkgs is a parsable slice of Pkg.

type Policy

type Policy = ent.Policy

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

type Querier

type Querier = ent.Querier

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

type QuerierFunc

type QuerierFunc = ent.QuerierFunc

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

type Query

type Query = ent.Query

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

type QueryContext

type QueryContext = ent.QueryContext

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

type RollbackFunc

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

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

func (RollbackFunc) Rollback

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

Rollback calls f(ctx, m).

type RollbackHook

type RollbackHook func(Rollbacker) Rollbacker

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

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

type Rollbacker

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

Rollbacker is the interface that wraps the Rollback method.

type Target

type Target struct {

	// ID of the ent.
	ID uuid.UUID `json:"id,omitempty"`
	// Name holds the value of the "name" field.
	Name string `json:"name,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the TargetQuery when eager-loading is set.
	Edges TargetEdges `json:"edges"`
	// contains filtered or unexported fields
}

Target is the model entity for the Target schema.

func (*Target) QueryPkgs

func (t *Target) QueryPkgs() *PkgQuery

QueryPkgs queries the "pkgs" edge of the Target entity.

func (*Target) String

func (t *Target) String() string

String implements the fmt.Stringer.

func (*Target) Unwrap

func (t *Target) Unwrap() *Target

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

func (t *Target) Update() *TargetUpdateOne

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

func (*Target) Value

func (t *Target) Value(name string) (ent.Value, error)

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

type TargetClient

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

TargetClient is a client for the Target schema.

func NewTargetClient

func NewTargetClient(c config) *TargetClient

NewTargetClient returns a client for the Target from the given config.

func (*TargetClient) Create

func (c *TargetClient) Create() *TargetCreate

Create returns a builder for creating a Target entity.

func (*TargetClient) CreateBulk

func (c *TargetClient) CreateBulk(builders ...*TargetCreate) *TargetCreateBulk

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

func (*TargetClient) Delete

func (c *TargetClient) Delete() *TargetDelete

Delete returns a delete builder for Target.

func (*TargetClient) DeleteOne

func (c *TargetClient) DeleteOne(t *Target) *TargetDeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*TargetClient) DeleteOneID

func (c *TargetClient) DeleteOneID(id uuid.UUID) *TargetDeleteOne

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

func (*TargetClient) Get

func (c *TargetClient) Get(ctx context.Context, id uuid.UUID) (*Target, error)

Get returns a Target entity by its id.

func (*TargetClient) GetX

func (c *TargetClient) GetX(ctx context.Context, id uuid.UUID) *Target

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

func (*TargetClient) Hooks

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

Hooks returns the client hooks.

func (*TargetClient) Intercept

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

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

func (*TargetClient) Interceptors

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

Interceptors returns the client interceptors.

func (*TargetClient) MapCreateBulk

func (c *TargetClient) MapCreateBulk(slice any, setFunc func(*TargetCreate, int)) *TargetCreateBulk

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

func (*TargetClient) Query

func (c *TargetClient) Query() *TargetQuery

Query returns a query builder for Target.

func (*TargetClient) QueryPkgs

func (c *TargetClient) QueryPkgs(t *Target) *PkgQuery

QueryPkgs queries the pkgs edge of a Target.

func (*TargetClient) Update

func (c *TargetClient) Update() *TargetUpdate

Update returns an update builder for Target.

func (*TargetClient) UpdateOne

func (c *TargetClient) UpdateOne(t *Target) *TargetUpdateOne

UpdateOne returns an update builder for the given entity.

func (*TargetClient) UpdateOneID

func (c *TargetClient) UpdateOneID(id uuid.UUID) *TargetUpdateOne

UpdateOneID returns an update builder for the given id.

func (*TargetClient) Use

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

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

type TargetCreate

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

TargetCreate is the builder for creating a Target entity.

func (*TargetCreate) Exec

func (tc *TargetCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*TargetCreate) ExecX

func (tc *TargetCreate) ExecX(ctx context.Context)

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

func (*TargetCreate) Mutation

func (tc *TargetCreate) Mutation() *TargetMutation

Mutation returns the TargetMutation object of the builder.

func (*TargetCreate) Save

func (tc *TargetCreate) Save(ctx context.Context) (*Target, error)

Save creates the Target in the database.

func (*TargetCreate) SaveX

func (tc *TargetCreate) SaveX(ctx context.Context) *Target

SaveX calls Save and panics if Save returns an error.

func (*TargetCreate) SetID

func (tc *TargetCreate) SetID(u uuid.UUID) *TargetCreate

SetID sets the "id" field.

func (*TargetCreate) SetName

func (tc *TargetCreate) SetName(s string) *TargetCreate

SetName sets the "name" field.

func (*TargetCreate) SetNillableID

func (tc *TargetCreate) SetNillableID(u *uuid.UUID) *TargetCreate

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

func (*TargetCreate) SetNillablePkgsID

func (tc *TargetCreate) SetNillablePkgsID(id *uuid.UUID) *TargetCreate

SetNillablePkgsID sets the "pkgs" edge to the Pkg entity by ID if the given value is not nil.

func (*TargetCreate) SetPkgs

func (tc *TargetCreate) SetPkgs(p *Pkg) *TargetCreate

SetPkgs sets the "pkgs" edge to the Pkg entity.

func (*TargetCreate) SetPkgsID

func (tc *TargetCreate) SetPkgsID(id uuid.UUID) *TargetCreate

SetPkgsID sets the "pkgs" edge to the Pkg entity by ID.

type TargetCreateBulk

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

TargetCreateBulk is the builder for creating many Target entities in bulk.

func (*TargetCreateBulk) Exec

func (tcb *TargetCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*TargetCreateBulk) ExecX

func (tcb *TargetCreateBulk) ExecX(ctx context.Context)

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

func (*TargetCreateBulk) Save

func (tcb *TargetCreateBulk) Save(ctx context.Context) ([]*Target, error)

Save creates the Target entities in the database.

func (*TargetCreateBulk) SaveX

func (tcb *TargetCreateBulk) SaveX(ctx context.Context) []*Target

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

type TargetDelete

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

TargetDelete is the builder for deleting a Target entity.

func (*TargetDelete) Exec

func (td *TargetDelete) Exec(ctx context.Context) (int, error)

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

func (*TargetDelete) ExecX

func (td *TargetDelete) ExecX(ctx context.Context) int

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

func (*TargetDelete) Where

func (td *TargetDelete) Where(ps ...predicate.Target) *TargetDelete

Where appends a list predicates to the TargetDelete builder.

type TargetDeleteOne

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

TargetDeleteOne is the builder for deleting a single Target entity.

func (*TargetDeleteOne) Exec

func (tdo *TargetDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*TargetDeleteOne) ExecX

func (tdo *TargetDeleteOne) ExecX(ctx context.Context)

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

func (*TargetDeleteOne) Where

func (tdo *TargetDeleteOne) Where(ps ...predicate.Target) *TargetDeleteOne

Where appends a list predicates to the TargetDelete builder.

type TargetEdges

type TargetEdges struct {
	// Packages in this target
	Pkgs *Pkg `json:"pkgs,omitempty"`
	// contains filtered or unexported fields
}

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

func (TargetEdges) PkgsOrErr

func (e TargetEdges) PkgsOrErr() (*Pkg, error)

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

type TargetGroupBy

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

TargetGroupBy is the group-by builder for Target entities.

func (*TargetGroupBy) Aggregate

func (tgb *TargetGroupBy) Aggregate(fns ...AggregateFunc) *TargetGroupBy

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

func (*TargetGroupBy) Bool

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

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

func (*TargetGroupBy) BoolX

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

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

func (*TargetGroupBy) Bools

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

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

func (*TargetGroupBy) BoolsX

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

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

func (*TargetGroupBy) Float64

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

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

func (*TargetGroupBy) Float64X

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

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

func (*TargetGroupBy) Float64s

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

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

func (*TargetGroupBy) Float64sX

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

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

func (*TargetGroupBy) Int

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

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

func (*TargetGroupBy) IntX

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

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

func (*TargetGroupBy) Ints

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

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

func (*TargetGroupBy) IntsX

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

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

func (*TargetGroupBy) Scan

func (tgb *TargetGroupBy) Scan(ctx context.Context, v any) error

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

func (*TargetGroupBy) ScanX

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

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

func (*TargetGroupBy) String

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

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

func (*TargetGroupBy) StringX

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

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

func (*TargetGroupBy) Strings

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

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

func (*TargetGroupBy) StringsX

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

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

type TargetMutation

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

TargetMutation represents an operation that mutates the Target nodes in the graph.

func (*TargetMutation) AddField

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

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

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

func (*TargetMutation) AddedField

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

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

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

func (*TargetMutation) AddedIDs

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

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

func (*TargetMutation) ClearEdge

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

func (m *TargetMutation) 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 (*TargetMutation) ClearPkgs

func (m *TargetMutation) ClearPkgs()

ClearPkgs clears the "pkgs" edge to the Pkg entity.

func (*TargetMutation) ClearedEdges

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

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

func (*TargetMutation) ClearedFields

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

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

func (TargetMutation) Client

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

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

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

func (*TargetMutation) Field

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

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

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

func (*TargetMutation) Fields

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

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

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

func (*TargetMutation) IDs

func (m *TargetMutation) IDs(ctx context.Context) ([]uuid.UUID, error)

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

func (*TargetMutation) Name

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

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

func (*TargetMutation) OldField

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

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

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

func (m *TargetMutation) Op() Op

Op returns the operation name.

func (*TargetMutation) PkgsCleared

func (m *TargetMutation) PkgsCleared() bool

PkgsCleared reports if the "pkgs" edge to the Pkg entity was cleared.

func (*TargetMutation) PkgsID

func (m *TargetMutation) PkgsID() (id uuid.UUID, exists bool)

PkgsID returns the "pkgs" edge ID in the mutation.

func (*TargetMutation) PkgsIDs

func (m *TargetMutation) PkgsIDs() (ids []uuid.UUID)

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

func (*TargetMutation) RemovedEdges

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

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

func (*TargetMutation) RemovedIDs

func (m *TargetMutation) 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 (*TargetMutation) ResetEdge

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

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

func (m *TargetMutation) ResetName()

ResetName resets all changes to the "name" field.

func (*TargetMutation) ResetPkgs

func (m *TargetMutation) ResetPkgs()

ResetPkgs resets all changes to the "pkgs" edge.

func (*TargetMutation) SetField

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

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

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

func (*TargetMutation) SetName

func (m *TargetMutation) SetName(s string)

SetName sets the "name" field.

func (*TargetMutation) SetOp

func (m *TargetMutation) SetOp(op Op)

SetOp allows setting the mutation operation.

func (*TargetMutation) SetPkgsID

func (m *TargetMutation) SetPkgsID(id uuid.UUID)

SetPkgsID sets the "pkgs" edge to the Pkg entity by id.

func (TargetMutation) Tx

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

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

func (*TargetMutation) Type

func (m *TargetMutation) Type() string

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

func (*TargetMutation) Where

func (m *TargetMutation) Where(ps ...predicate.Target)

Where appends a list predicates to the TargetMutation builder.

func (*TargetMutation) WhereP

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

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

type TargetQuery

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

TargetQuery is the builder for querying Target entities.

func (*TargetQuery) Aggregate

func (tq *TargetQuery) Aggregate(fns ...AggregateFunc) *TargetSelect

Aggregate returns a TargetSelect configured with the given aggregations.

func (*TargetQuery) All

func (tq *TargetQuery) All(ctx context.Context) ([]*Target, error)

All executes the query and returns a list of Targets.

func (*TargetQuery) AllX

func (tq *TargetQuery) AllX(ctx context.Context) []*Target

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

func (*TargetQuery) Clone

func (tq *TargetQuery) Clone() *TargetQuery

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

func (*TargetQuery) Count

func (tq *TargetQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*TargetQuery) CountX

func (tq *TargetQuery) CountX(ctx context.Context) int

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

func (*TargetQuery) Exist

func (tq *TargetQuery) Exist(ctx context.Context) (bool, error)

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

func (*TargetQuery) ExistX

func (tq *TargetQuery) ExistX(ctx context.Context) bool

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

func (*TargetQuery) First

func (tq *TargetQuery) First(ctx context.Context) (*Target, error)

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

func (*TargetQuery) FirstID

func (tq *TargetQuery) FirstID(ctx context.Context) (id uuid.UUID, err error)

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

func (*TargetQuery) FirstIDX

func (tq *TargetQuery) FirstIDX(ctx context.Context) uuid.UUID

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

func (*TargetQuery) FirstX

func (tq *TargetQuery) FirstX(ctx context.Context) *Target

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

func (*TargetQuery) GroupBy

func (tq *TargetQuery) GroupBy(field string, fields ...string) *TargetGroupBy

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

Example:

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

client.Target.Query().
	GroupBy(target.FieldName).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*TargetQuery) IDs

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

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

func (*TargetQuery) IDsX

func (tq *TargetQuery) IDsX(ctx context.Context) []uuid.UUID

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

func (*TargetQuery) Limit

func (tq *TargetQuery) Limit(limit int) *TargetQuery

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

func (*TargetQuery) Offset

func (tq *TargetQuery) Offset(offset int) *TargetQuery

Offset to start from.

func (*TargetQuery) Only

func (tq *TargetQuery) Only(ctx context.Context) (*Target, error)

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

func (*TargetQuery) OnlyID

func (tq *TargetQuery) OnlyID(ctx context.Context) (id uuid.UUID, err error)

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

func (*TargetQuery) OnlyIDX

func (tq *TargetQuery) OnlyIDX(ctx context.Context) uuid.UUID

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

func (*TargetQuery) OnlyX

func (tq *TargetQuery) OnlyX(ctx context.Context) *Target

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

func (*TargetQuery) Order

func (tq *TargetQuery) Order(o ...target.OrderOption) *TargetQuery

Order specifies how the records should be ordered.

func (*TargetQuery) QueryPkgs

func (tq *TargetQuery) QueryPkgs() *PkgQuery

QueryPkgs chains the current query on the "pkgs" edge.

func (*TargetQuery) Select

func (tq *TargetQuery) Select(fields ...string) *TargetSelect

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

Example:

var v []struct {
	Name string `json:"name,omitempty"`
}

client.Target.Query().
	Select(target.FieldName).
	Scan(ctx, &v)

func (*TargetQuery) Unique

func (tq *TargetQuery) Unique(unique bool) *TargetQuery

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

func (tq *TargetQuery) Where(ps ...predicate.Target) *TargetQuery

Where adds a new predicate for the TargetQuery builder.

func (*TargetQuery) WithPkgs

func (tq *TargetQuery) WithPkgs(opts ...func(*PkgQuery)) *TargetQuery

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

type TargetSelect

type TargetSelect struct {
	*TargetQuery
	// contains filtered or unexported fields
}

TargetSelect is the builder for selecting fields of Target entities.

func (*TargetSelect) Aggregate

func (ts *TargetSelect) Aggregate(fns ...AggregateFunc) *TargetSelect

Aggregate adds the given aggregation functions to the selector query.

func (*TargetSelect) Bool

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

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

func (*TargetSelect) BoolX

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

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

func (*TargetSelect) Bools

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

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

func (*TargetSelect) BoolsX

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

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

func (*TargetSelect) Float64

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

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

func (*TargetSelect) Float64X

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

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

func (*TargetSelect) Float64s

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

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

func (*TargetSelect) Float64sX

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

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

func (*TargetSelect) Int

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

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

func (*TargetSelect) IntX

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

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

func (*TargetSelect) Ints

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

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

func (*TargetSelect) IntsX

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

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

func (*TargetSelect) Scan

func (ts *TargetSelect) Scan(ctx context.Context, v any) error

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

func (*TargetSelect) ScanX

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

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

func (*TargetSelect) String

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

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

func (*TargetSelect) StringX

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

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

func (*TargetSelect) Strings

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

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

func (*TargetSelect) StringsX

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

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

type TargetUpdate

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

TargetUpdate is the builder for updating Target entities.

func (*TargetUpdate) ClearPkgs

func (tu *TargetUpdate) ClearPkgs() *TargetUpdate

ClearPkgs clears the "pkgs" edge to the Pkg entity.

func (*TargetUpdate) Exec

func (tu *TargetUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*TargetUpdate) ExecX

func (tu *TargetUpdate) ExecX(ctx context.Context)

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

func (*TargetUpdate) Mutation

func (tu *TargetUpdate) Mutation() *TargetMutation

Mutation returns the TargetMutation object of the builder.

func (*TargetUpdate) Save

func (tu *TargetUpdate) Save(ctx context.Context) (int, error)

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

func (*TargetUpdate) SaveX

func (tu *TargetUpdate) SaveX(ctx context.Context) int

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

func (*TargetUpdate) SetName

func (tu *TargetUpdate) SetName(s string) *TargetUpdate

SetName sets the "name" field.

func (*TargetUpdate) SetNillableName

func (tu *TargetUpdate) SetNillableName(s *string) *TargetUpdate

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

func (*TargetUpdate) SetNillablePkgsID

func (tu *TargetUpdate) SetNillablePkgsID(id *uuid.UUID) *TargetUpdate

SetNillablePkgsID sets the "pkgs" edge to the Pkg entity by ID if the given value is not nil.

func (*TargetUpdate) SetPkgs

func (tu *TargetUpdate) SetPkgs(p *Pkg) *TargetUpdate

SetPkgs sets the "pkgs" edge to the Pkg entity.

func (*TargetUpdate) SetPkgsID

func (tu *TargetUpdate) SetPkgsID(id uuid.UUID) *TargetUpdate

SetPkgsID sets the "pkgs" edge to the Pkg entity by ID.

func (*TargetUpdate) Where

func (tu *TargetUpdate) Where(ps ...predicate.Target) *TargetUpdate

Where appends a list predicates to the TargetUpdate builder.

type TargetUpdateOne

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

TargetUpdateOne is the builder for updating a single Target entity.

func (*TargetUpdateOne) ClearPkgs

func (tuo *TargetUpdateOne) ClearPkgs() *TargetUpdateOne

ClearPkgs clears the "pkgs" edge to the Pkg entity.

func (*TargetUpdateOne) Exec

func (tuo *TargetUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*TargetUpdateOne) ExecX

func (tuo *TargetUpdateOne) ExecX(ctx context.Context)

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

func (*TargetUpdateOne) Mutation

func (tuo *TargetUpdateOne) Mutation() *TargetMutation

Mutation returns the TargetMutation object of the builder.

func (*TargetUpdateOne) Save

func (tuo *TargetUpdateOne) Save(ctx context.Context) (*Target, error)

Save executes the query and returns the updated Target entity.

func (*TargetUpdateOne) SaveX

func (tuo *TargetUpdateOne) SaveX(ctx context.Context) *Target

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

func (*TargetUpdateOne) Select

func (tuo *TargetUpdateOne) Select(field string, fields ...string) *TargetUpdateOne

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

func (*TargetUpdateOne) SetName

func (tuo *TargetUpdateOne) SetName(s string) *TargetUpdateOne

SetName sets the "name" field.

func (*TargetUpdateOne) SetNillableName

func (tuo *TargetUpdateOne) SetNillableName(s *string) *TargetUpdateOne

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

func (*TargetUpdateOne) SetNillablePkgsID

func (tuo *TargetUpdateOne) SetNillablePkgsID(id *uuid.UUID) *TargetUpdateOne

SetNillablePkgsID sets the "pkgs" edge to the Pkg entity by ID if the given value is not nil.

func (*TargetUpdateOne) SetPkgs

func (tuo *TargetUpdateOne) SetPkgs(p *Pkg) *TargetUpdateOne

SetPkgs sets the "pkgs" edge to the Pkg entity.

func (*TargetUpdateOne) SetPkgsID

func (tuo *TargetUpdateOne) SetPkgsID(id uuid.UUID) *TargetUpdateOne

SetPkgsID sets the "pkgs" edge to the Pkg entity by ID.

func (*TargetUpdateOne) Where

func (tuo *TargetUpdateOne) Where(ps ...predicate.Target) *TargetUpdateOne

Where appends a list predicates to the TargetUpdate builder.

type Targets

type Targets []*Target

Targets is a parsable slice of Target.

type TraverseFunc

type TraverseFunc = ent.TraverseFunc

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

type Traverser

type Traverser = ent.Traverser

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

type Tx

type Tx struct {

	// Pkg is the client for interacting with the Pkg builders.
	Pkg *PkgClient
	// Target is the client for interacting with the Target builders.
	Target *TargetClient
	// 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