ent

package
v0.4.4 Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2022 License: AGPL-3.0 Imports: 27 Imported by: 0

Documentation

Index

Examples

Constants

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

	// Node types.
	TypeCredential = "Credential"
	TypeEvent      = "Event"
	TypeFile       = "File"
	TypeJob        = "Job"
	TypeLink       = "Link"
	TypeService    = "Service"
	TypeTag        = "Tag"
	TypeTarget     = "Target"
	TypeTask       = "Task"
	TypeUser       = "User"
)

Variables

This section is empty.

Functions

func IsConstraintError added in v0.2.3

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

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

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

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

NewTxContext returns a new context with the given Tx attached.

Types

type AggregateFunc added in v0.4.3

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
	// Credential is the client for interacting with the Credential builders.
	Credential *CredentialClient
	// Event is the client for interacting with the Event builders.
	Event *EventClient
	// File is the client for interacting with the File builders.
	File *FileClient
	// Job is the client for interacting with the Job builders.
	Job *JobClient
	// Link is the client for interacting with the Link builders.
	Link *LinkClient
	// Service is the client for interacting with the Service builders.
	Service *ServiceClient
	// Tag is the client for interacting with the Tag builders.
	Tag *TagClient
	// Target is the client for interacting with the Target builders.
	Target *TargetClient
	// Task is the client for interacting with the Task builders.
	Task *TaskClient
	// User is the client for interacting with the User builders.
	User *UserClient
	// 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 added in v0.4.3

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().
	Credential.
	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 added in v0.4.3

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

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

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

Commit calls f(ctx, m).

type CommitHook added in v0.4.3

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

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

Committer is the interface that wraps the Commit method.

type ConstraintError added in v0.2.3

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

func (e ConstraintError) Error() string

Error implements the error interface.

func (*ConstraintError) Unwrap added in v0.2.3

func (e *ConstraintError) Unwrap() error

Unwrap implements the errors.Wrapper interface.

type Credential

type Credential struct {

	// ID of the ent.
	ID int `json:"id,omitempty"`
	// Principal holds the value of the "principal" field.
	// The principal for the Credential
	Principal string `json:"principal,omitempty"`
	// Secret holds the value of the "secret" field.
	// The secret for the Credential
	Secret string `json:"secret,omitempty"`
	// Kind holds the value of the "kind" field.
	// The kind of the credential (password, key, etc)
	Kind credential.Kind `json:"kind,omitempty"`
	// Fails holds the value of the "fails" field.
	// The number of failures for the Credential
	Fails int `json:"fails,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the CredentialQuery when eager-loading is set.
	Edges CredentialEdges `json:"edges"`
	// contains filtered or unexported fields
}

Credential is the model entity for the Credential schema.

Example
if dsn == "" {
	return
}
ctx := context.Background()
drv, err := sql.Open("mysql", dsn)
if err != nil {
	log.Fatalf("failed creating database client: %v", err)
}
defer drv.Close()
client := NewClient(Driver(drv))
// creating vertices for the credential's edges.

// create credential vertex with its edges.
c := client.Credential.
	Create().
	SetPrincipal("string").
	SetSecret("string").
	SetKind(credential.KindPassword).
	SetFails(1).
	SaveX(ctx)
log.Println("credential created:", c)

// query edges.
Output:

func (*Credential) QueryTarget added in v0.3.0

func (c *Credential) QueryTarget() *TargetQuery

QueryTarget queries the "target" edge of the Credential entity.

func (*Credential) String

func (c *Credential) String() string

String implements the fmt.Stringer.

func (*Credential) Unwrap

func (c *Credential) Unwrap() *Credential

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

func (c *Credential) Update() *CredentialUpdateOne

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

type CredentialClient

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

CredentialClient is a client for the Credential schema.

func NewCredentialClient

func NewCredentialClient(c config) *CredentialClient

NewCredentialClient returns a client for the Credential from the given config.

func (*CredentialClient) Create

func (c *CredentialClient) Create() *CredentialCreate

Create returns a create builder for Credential.

func (*CredentialClient) CreateBulk added in v0.4.3

func (c *CredentialClient) CreateBulk(builders ...*CredentialCreate) *CredentialCreateBulk

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

func (*CredentialClient) Delete

func (c *CredentialClient) Delete() *CredentialDelete

Delete returns a delete builder for Credential.

func (*CredentialClient) DeleteOne

func (c *CredentialClient) DeleteOne(cr *Credential) *CredentialDeleteOne

DeleteOne returns a delete builder for the given entity.

func (*CredentialClient) DeleteOneID

func (c *CredentialClient) DeleteOneID(id int) *CredentialDeleteOne

DeleteOneID returns a delete builder for the given id.

func (*CredentialClient) Get

func (c *CredentialClient) Get(ctx context.Context, id int) (*Credential, error)

Get returns a Credential entity by its id.

func (*CredentialClient) GetX

func (c *CredentialClient) GetX(ctx context.Context, id int) *Credential

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

func (*CredentialClient) Hooks added in v0.4.3

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

Hooks returns the client hooks.

func (*CredentialClient) Query

func (c *CredentialClient) Query() *CredentialQuery

Query returns a query builder for Credential.

func (*CredentialClient) QueryTarget added in v0.3.0

func (c *CredentialClient) QueryTarget(cr *Credential) *TargetQuery

QueryTarget queries the target edge of a Credential.

func (*CredentialClient) Update

func (c *CredentialClient) Update() *CredentialUpdate

Update returns an update builder for Credential.

func (*CredentialClient) UpdateOne

func (c *CredentialClient) UpdateOne(cr *Credential) *CredentialUpdateOne

UpdateOne returns an update builder for the given entity.

func (*CredentialClient) UpdateOneID

func (c *CredentialClient) UpdateOneID(id int) *CredentialUpdateOne

UpdateOneID returns an update builder for the given id.

func (*CredentialClient) Use added in v0.4.3

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

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

type CredentialCreate

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

CredentialCreate is the builder for creating a Credential entity.

func (*CredentialCreate) Exec added in v0.4.3

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

Exec executes the query.

func (*CredentialCreate) ExecX added in v0.4.3

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

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

func (*CredentialCreate) Mutation added in v0.4.3

func (cc *CredentialCreate) Mutation() *CredentialMutation

Mutation returns the CredentialMutation object of the builder.

func (*CredentialCreate) Save

func (cc *CredentialCreate) Save(ctx context.Context) (*Credential, error)

Save creates the Credential in the database.

func (*CredentialCreate) SaveX

func (cc *CredentialCreate) SaveX(ctx context.Context) *Credential

SaveX calls Save and panics if Save returns an error.

func (*CredentialCreate) SetFails

func (cc *CredentialCreate) SetFails(i int) *CredentialCreate

SetFails sets the "fails" field.

func (*CredentialCreate) SetKind added in v0.2.3

SetKind sets the "kind" field.

func (*CredentialCreate) SetNillableFails

func (cc *CredentialCreate) SetNillableFails(i *int) *CredentialCreate

SetNillableFails sets the "fails" field if the given value is not nil.

func (*CredentialCreate) SetNillableTargetID added in v0.3.0

func (cc *CredentialCreate) SetNillableTargetID(id *int) *CredentialCreate

SetNillableTargetID sets the "target" edge to the Target entity by ID if the given value is not nil.

func (*CredentialCreate) SetPrincipal

func (cc *CredentialCreate) SetPrincipal(s string) *CredentialCreate

SetPrincipal sets the "principal" field.

func (*CredentialCreate) SetSecret

func (cc *CredentialCreate) SetSecret(s string) *CredentialCreate

SetSecret sets the "secret" field.

func (*CredentialCreate) SetTarget added in v0.3.0

func (cc *CredentialCreate) SetTarget(t *Target) *CredentialCreate

SetTarget sets the "target" edge to the Target entity.

func (*CredentialCreate) SetTargetID added in v0.3.0

func (cc *CredentialCreate) SetTargetID(id int) *CredentialCreate

SetTargetID sets the "target" edge to the Target entity by ID.

type CredentialCreateBulk added in v0.4.3

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

CredentialCreateBulk is the builder for creating many Credential entities in bulk.

func (*CredentialCreateBulk) Exec added in v0.4.3

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

Exec executes the query.

func (*CredentialCreateBulk) ExecX added in v0.4.3

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

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

func (*CredentialCreateBulk) Save added in v0.4.3

func (ccb *CredentialCreateBulk) Save(ctx context.Context) ([]*Credential, error)

Save creates the Credential entities in the database.

func (*CredentialCreateBulk) SaveX added in v0.4.3

func (ccb *CredentialCreateBulk) SaveX(ctx context.Context) []*Credential

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

type CredentialDelete

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

CredentialDelete is the builder for deleting a Credential entity.

func (*CredentialDelete) Exec

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

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

func (*CredentialDelete) ExecX

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

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

func (*CredentialDelete) Where

Where appends a list predicates to the CredentialDelete builder.

type CredentialDeleteOne

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

CredentialDeleteOne is the builder for deleting a single Credential entity.

func (*CredentialDeleteOne) Exec

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

Exec executes the deletion query.

func (*CredentialDeleteOne) ExecX

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

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

type CredentialEdges added in v0.3.0

type CredentialEdges struct {
	// Target holds the value of the target edge.
	Target *Target `json:"target,omitempty"`
	// contains filtered or unexported fields
}

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

func (CredentialEdges) TargetOrErr added in v0.3.0

func (e CredentialEdges) TargetOrErr() (*Target, error)

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

type CredentialGroupBy

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

CredentialGroupBy is the group-by builder for Credential entities.

func (*CredentialGroupBy) Aggregate

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

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

func (*CredentialGroupBy) Bool added in v0.4.3

func (cgb *CredentialGroupBy) 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 (*CredentialGroupBy) BoolX added in v0.4.3

func (cgb *CredentialGroupBy) BoolX(ctx context.Context) bool

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

func (*CredentialGroupBy) Bools

func (cgb *CredentialGroupBy) 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 (*CredentialGroupBy) BoolsX

func (cgb *CredentialGroupBy) BoolsX(ctx context.Context) []bool

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

func (*CredentialGroupBy) Float64 added in v0.4.3

func (cgb *CredentialGroupBy) 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 (*CredentialGroupBy) Float64X added in v0.4.3

func (cgb *CredentialGroupBy) Float64X(ctx context.Context) float64

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

func (*CredentialGroupBy) Float64s

func (cgb *CredentialGroupBy) 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 (*CredentialGroupBy) Float64sX

func (cgb *CredentialGroupBy) Float64sX(ctx context.Context) []float64

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

func (*CredentialGroupBy) Int added in v0.4.3

func (cgb *CredentialGroupBy) 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 (*CredentialGroupBy) IntX added in v0.4.3

func (cgb *CredentialGroupBy) IntX(ctx context.Context) int

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

func (*CredentialGroupBy) Ints

func (cgb *CredentialGroupBy) 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 (*CredentialGroupBy) IntsX

func (cgb *CredentialGroupBy) IntsX(ctx context.Context) []int

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

func (*CredentialGroupBy) Scan

func (cgb *CredentialGroupBy) Scan(ctx context.Context, v interface{}) error

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

func (*CredentialGroupBy) ScanX

func (cgb *CredentialGroupBy) ScanX(ctx context.Context, v interface{})

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

func (*CredentialGroupBy) String added in v0.4.3

func (cgb *CredentialGroupBy) 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 (*CredentialGroupBy) StringX added in v0.4.3

func (cgb *CredentialGroupBy) StringX(ctx context.Context) string

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

func (*CredentialGroupBy) Strings

func (cgb *CredentialGroupBy) 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 (*CredentialGroupBy) StringsX

func (cgb *CredentialGroupBy) StringsX(ctx context.Context) []string

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

type CredentialMutation added in v0.4.3

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

CredentialMutation represents an operation that mutates the Credential nodes in the graph.

func (*CredentialMutation) AddFails added in v0.4.3

func (m *CredentialMutation) AddFails(i int)

AddFails adds i to the "fails" field.

func (*CredentialMutation) AddField added in v0.4.3

func (m *CredentialMutation) 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 (*CredentialMutation) AddedEdges added in v0.4.3

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

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

func (*CredentialMutation) AddedFails added in v0.4.3

func (m *CredentialMutation) AddedFails() (r int, exists bool)

AddedFails returns the value that was added to the "fails" field in this mutation.

func (*CredentialMutation) AddedField added in v0.4.3

func (m *CredentialMutation) 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 (*CredentialMutation) AddedFields added in v0.4.3

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

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

func (*CredentialMutation) AddedIDs added in v0.4.3

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

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

func (*CredentialMutation) ClearEdge added in v0.4.3

func (m *CredentialMutation) 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 (*CredentialMutation) ClearField added in v0.4.3

func (m *CredentialMutation) 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 (*CredentialMutation) ClearTarget added in v0.4.3

func (m *CredentialMutation) ClearTarget()

ClearTarget clears the "target" edge to the Target entity.

func (*CredentialMutation) ClearedEdges added in v0.4.3

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

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

func (*CredentialMutation) ClearedFields added in v0.4.3

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

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

func (CredentialMutation) Client added in v0.4.3

func (m CredentialMutation) 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 (*CredentialMutation) EdgeCleared added in v0.4.3

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

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

func (*CredentialMutation) Fails added in v0.4.3

func (m *CredentialMutation) Fails() (r int, exists bool)

Fails returns the value of the "fails" field in the mutation.

func (*CredentialMutation) Field added in v0.4.3

func (m *CredentialMutation) 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 (*CredentialMutation) FieldCleared added in v0.4.3

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

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

func (*CredentialMutation) Fields added in v0.4.3

func (m *CredentialMutation) 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 (*CredentialMutation) ID added in v0.4.3

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

func (m *CredentialMutation) 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 (*CredentialMutation) Kind added in v0.4.3

func (m *CredentialMutation) Kind() (r credential.Kind, exists bool)

Kind returns the value of the "kind" field in the mutation.

func (*CredentialMutation) OldFails added in v0.4.3

func (m *CredentialMutation) OldFails(ctx context.Context) (v int, err error)

OldFails returns the old "fails" field's value of the Credential entity. If the Credential 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 (*CredentialMutation) OldField added in v0.4.3

func (m *CredentialMutation) 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 (*CredentialMutation) OldKind added in v0.4.3

func (m *CredentialMutation) OldKind(ctx context.Context) (v credential.Kind, err error)

OldKind returns the old "kind" field's value of the Credential entity. If the Credential 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 (*CredentialMutation) OldPrincipal added in v0.4.3

func (m *CredentialMutation) OldPrincipal(ctx context.Context) (v string, err error)

OldPrincipal returns the old "principal" field's value of the Credential entity. If the Credential 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 (*CredentialMutation) OldSecret added in v0.4.3

func (m *CredentialMutation) OldSecret(ctx context.Context) (v string, err error)

OldSecret returns the old "secret" field's value of the Credential entity. If the Credential 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 (*CredentialMutation) Op added in v0.4.3

func (m *CredentialMutation) Op() Op

Op returns the operation name.

func (*CredentialMutation) Principal added in v0.4.3

func (m *CredentialMutation) Principal() (r string, exists bool)

Principal returns the value of the "principal" field in the mutation.

func (*CredentialMutation) RemovedEdges added in v0.4.3

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

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

func (*CredentialMutation) RemovedIDs added in v0.4.3

func (m *CredentialMutation) 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 (*CredentialMutation) ResetEdge added in v0.4.3

func (m *CredentialMutation) 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 (*CredentialMutation) ResetFails added in v0.4.3

func (m *CredentialMutation) ResetFails()

ResetFails resets all changes to the "fails" field.

func (*CredentialMutation) ResetField added in v0.4.3

func (m *CredentialMutation) 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 (*CredentialMutation) ResetKind added in v0.4.3

func (m *CredentialMutation) ResetKind()

ResetKind resets all changes to the "kind" field.

func (*CredentialMutation) ResetPrincipal added in v0.4.3

func (m *CredentialMutation) ResetPrincipal()

ResetPrincipal resets all changes to the "principal" field.

func (*CredentialMutation) ResetSecret added in v0.4.3

func (m *CredentialMutation) ResetSecret()

ResetSecret resets all changes to the "secret" field.

func (*CredentialMutation) ResetTarget added in v0.4.3

func (m *CredentialMutation) ResetTarget()

ResetTarget resets all changes to the "target" edge.

func (*CredentialMutation) Secret added in v0.4.3

func (m *CredentialMutation) Secret() (r string, exists bool)

Secret returns the value of the "secret" field in the mutation.

func (*CredentialMutation) SetFails added in v0.4.3

func (m *CredentialMutation) SetFails(i int)

SetFails sets the "fails" field.

func (*CredentialMutation) SetField added in v0.4.3

func (m *CredentialMutation) 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 (*CredentialMutation) SetKind added in v0.4.3

func (m *CredentialMutation) SetKind(c credential.Kind)

SetKind sets the "kind" field.

func (*CredentialMutation) SetPrincipal added in v0.4.3

func (m *CredentialMutation) SetPrincipal(s string)

SetPrincipal sets the "principal" field.

func (*CredentialMutation) SetSecret added in v0.4.3

func (m *CredentialMutation) SetSecret(s string)

SetSecret sets the "secret" field.

func (*CredentialMutation) SetTargetID added in v0.4.3

func (m *CredentialMutation) SetTargetID(id int)

SetTargetID sets the "target" edge to the Target entity by id.

func (*CredentialMutation) TargetCleared added in v0.4.3

func (m *CredentialMutation) TargetCleared() bool

TargetCleared reports if the "target" edge to the Target entity was cleared.

func (*CredentialMutation) TargetID added in v0.4.3

func (m *CredentialMutation) TargetID() (id int, exists bool)

TargetID returns the "target" edge ID in the mutation.

func (*CredentialMutation) TargetIDs added in v0.4.3

func (m *CredentialMutation) TargetIDs() (ids []int)

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

func (CredentialMutation) Tx added in v0.4.3

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

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

func (*CredentialMutation) Type added in v0.4.3

func (m *CredentialMutation) Type() string

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

func (*CredentialMutation) Where added in v0.4.3

func (m *CredentialMutation) Where(ps ...predicate.Credential)

Where appends a list predicates to the CredentialMutation builder.

type CredentialQuery

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

CredentialQuery is the builder for querying Credential entities.

func (*CredentialQuery) All

func (cq *CredentialQuery) All(ctx context.Context) ([]*Credential, error)

All executes the query and returns a list of Credentials.

func (*CredentialQuery) AllX

func (cq *CredentialQuery) AllX(ctx context.Context) []*Credential

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

func (*CredentialQuery) Clone

func (cq *CredentialQuery) Clone() *CredentialQuery

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

func (*CredentialQuery) Count

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

Count returns the count of the given query.

func (*CredentialQuery) CountX

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

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

func (*CredentialQuery) Exist

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

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

func (*CredentialQuery) ExistX

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

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

func (*CredentialQuery) First

func (cq *CredentialQuery) First(ctx context.Context) (*Credential, error)

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

func (*CredentialQuery) FirstID

func (cq *CredentialQuery) FirstID(ctx context.Context) (id int, err error)

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

func (*CredentialQuery) FirstIDX added in v0.4.3

func (cq *CredentialQuery) FirstIDX(ctx context.Context) int

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

func (*CredentialQuery) FirstX

func (cq *CredentialQuery) FirstX(ctx context.Context) *Credential

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

func (*CredentialQuery) GroupBy

func (cq *CredentialQuery) GroupBy(field string, fields ...string) *CredentialGroupBy

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

client.Credential.Query().
	GroupBy(credential.FieldPrincipal).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*CredentialQuery) IDs

func (cq *CredentialQuery) IDs(ctx context.Context) ([]int, error)

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

func (*CredentialQuery) IDsX

func (cq *CredentialQuery) IDsX(ctx context.Context) []int

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

func (*CredentialQuery) Limit

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

Limit adds a limit step to the query.

func (*CredentialQuery) Offset

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

Offset adds an offset step to the query.

func (*CredentialQuery) Only

func (cq *CredentialQuery) Only(ctx context.Context) (*Credential, error)

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

func (*CredentialQuery) OnlyID

func (cq *CredentialQuery) OnlyID(ctx context.Context) (id int, err error)

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

func (*CredentialQuery) OnlyIDX added in v0.4.3

func (cq *CredentialQuery) OnlyIDX(ctx context.Context) int

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

func (*CredentialQuery) OnlyX

func (cq *CredentialQuery) OnlyX(ctx context.Context) *Credential

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

func (*CredentialQuery) Order

func (cq *CredentialQuery) Order(o ...OrderFunc) *CredentialQuery

Order adds an order step to the query.

func (*CredentialQuery) QueryTarget added in v0.3.0

func (cq *CredentialQuery) QueryTarget() *TargetQuery

QueryTarget chains the current query on the "target" edge.

func (*CredentialQuery) Select

func (cq *CredentialQuery) Select(fields ...string) *CredentialSelect

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

client.Credential.Query().
	Select(credential.FieldPrincipal).
	Scan(ctx, &v)

func (*CredentialQuery) Unique added in v0.4.3

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

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

Where adds a new predicate for the CredentialQuery builder.

func (*CredentialQuery) WithTarget added in v0.3.0

func (cq *CredentialQuery) WithTarget(opts ...func(*TargetQuery)) *CredentialQuery

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

type CredentialSelect

type CredentialSelect struct {
	*CredentialQuery
	// contains filtered or unexported fields
}

CredentialSelect is the builder for selecting fields of Credential entities.

func (*CredentialSelect) Bool added in v0.4.3

func (cs *CredentialSelect) Bool(ctx context.Context) (_ bool, err error)

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

func (*CredentialSelect) BoolX added in v0.4.3

func (cs *CredentialSelect) BoolX(ctx context.Context) bool

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

func (*CredentialSelect) Bools

func (cs *CredentialSelect) Bools(ctx context.Context) ([]bool, error)

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

func (*CredentialSelect) BoolsX

func (cs *CredentialSelect) BoolsX(ctx context.Context) []bool

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

func (*CredentialSelect) Float64 added in v0.4.3

func (cs *CredentialSelect) Float64(ctx context.Context) (_ float64, err error)

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

func (*CredentialSelect) Float64X added in v0.4.3

func (cs *CredentialSelect) Float64X(ctx context.Context) float64

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

func (*CredentialSelect) Float64s

func (cs *CredentialSelect) Float64s(ctx context.Context) ([]float64, error)

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

func (*CredentialSelect) Float64sX

func (cs *CredentialSelect) Float64sX(ctx context.Context) []float64

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

func (*CredentialSelect) Int added in v0.4.3

func (cs *CredentialSelect) Int(ctx context.Context) (_ int, err error)

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

func (*CredentialSelect) IntX added in v0.4.3

func (cs *CredentialSelect) IntX(ctx context.Context) int

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

func (*CredentialSelect) Ints

func (cs *CredentialSelect) Ints(ctx context.Context) ([]int, error)

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

func (*CredentialSelect) IntsX

func (cs *CredentialSelect) IntsX(ctx context.Context) []int

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

func (*CredentialSelect) Scan

func (cs *CredentialSelect) Scan(ctx context.Context, v interface{}) error

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

func (*CredentialSelect) ScanX

func (cs *CredentialSelect) ScanX(ctx context.Context, v interface{})

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

func (*CredentialSelect) String added in v0.4.3

func (cs *CredentialSelect) String(ctx context.Context) (_ string, err error)

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

func (*CredentialSelect) StringX added in v0.4.3

func (cs *CredentialSelect) StringX(ctx context.Context) string

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

func (*CredentialSelect) Strings

func (cs *CredentialSelect) Strings(ctx context.Context) ([]string, error)

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

func (*CredentialSelect) StringsX

func (cs *CredentialSelect) StringsX(ctx context.Context) []string

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

type CredentialUpdate

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

CredentialUpdate is the builder for updating Credential entities.

func (*CredentialUpdate) AddFails

func (cu *CredentialUpdate) AddFails(i int) *CredentialUpdate

AddFails adds i to the "fails" field.

func (*CredentialUpdate) ClearTarget added in v0.3.0

func (cu *CredentialUpdate) ClearTarget() *CredentialUpdate

ClearTarget clears the "target" edge to the Target entity.

func (*CredentialUpdate) Exec

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

Exec executes the query.

func (*CredentialUpdate) ExecX

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

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

func (*CredentialUpdate) Mutation added in v0.4.3

func (cu *CredentialUpdate) Mutation() *CredentialMutation

Mutation returns the CredentialMutation object of the builder.

func (*CredentialUpdate) Save

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

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

func (*CredentialUpdate) SaveX

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

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

func (*CredentialUpdate) SetFails

func (cu *CredentialUpdate) SetFails(i int) *CredentialUpdate

SetFails sets the "fails" field.

func (*CredentialUpdate) SetKind added in v0.2.3

SetKind sets the "kind" field.

func (*CredentialUpdate) SetNillableFails

func (cu *CredentialUpdate) SetNillableFails(i *int) *CredentialUpdate

SetNillableFails sets the "fails" field if the given value is not nil.

func (*CredentialUpdate) SetNillableTargetID added in v0.3.0

func (cu *CredentialUpdate) SetNillableTargetID(id *int) *CredentialUpdate

SetNillableTargetID sets the "target" edge to the Target entity by ID if the given value is not nil.

func (*CredentialUpdate) SetPrincipal

func (cu *CredentialUpdate) SetPrincipal(s string) *CredentialUpdate

SetPrincipal sets the "principal" field.

func (*CredentialUpdate) SetSecret

func (cu *CredentialUpdate) SetSecret(s string) *CredentialUpdate

SetSecret sets the "secret" field.

func (*CredentialUpdate) SetTarget added in v0.3.0

func (cu *CredentialUpdate) SetTarget(t *Target) *CredentialUpdate

SetTarget sets the "target" edge to the Target entity.

func (*CredentialUpdate) SetTargetID added in v0.3.0

func (cu *CredentialUpdate) SetTargetID(id int) *CredentialUpdate

SetTargetID sets the "target" edge to the Target entity by ID.

func (*CredentialUpdate) Where

Where appends a list predicates to the CredentialUpdate builder.

type CredentialUpdateOne

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

CredentialUpdateOne is the builder for updating a single Credential entity.

func (*CredentialUpdateOne) AddFails

func (cuo *CredentialUpdateOne) AddFails(i int) *CredentialUpdateOne

AddFails adds i to the "fails" field.

func (*CredentialUpdateOne) ClearTarget added in v0.3.0

func (cuo *CredentialUpdateOne) ClearTarget() *CredentialUpdateOne

ClearTarget clears the "target" edge to the Target entity.

func (*CredentialUpdateOne) Exec

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

Exec executes the query on the entity.

func (*CredentialUpdateOne) ExecX

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

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

func (*CredentialUpdateOne) Mutation added in v0.4.3

func (cuo *CredentialUpdateOne) Mutation() *CredentialMutation

Mutation returns the CredentialMutation object of the builder.

func (*CredentialUpdateOne) Save

func (cuo *CredentialUpdateOne) Save(ctx context.Context) (*Credential, error)

Save executes the query and returns the updated Credential entity.

func (*CredentialUpdateOne) SaveX

func (cuo *CredentialUpdateOne) SaveX(ctx context.Context) *Credential

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

func (*CredentialUpdateOne) Select added in v0.4.3

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

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

func (*CredentialUpdateOne) SetFails

func (cuo *CredentialUpdateOne) SetFails(i int) *CredentialUpdateOne

SetFails sets the "fails" field.

func (*CredentialUpdateOne) SetKind added in v0.2.3

SetKind sets the "kind" field.

func (*CredentialUpdateOne) SetNillableFails

func (cuo *CredentialUpdateOne) SetNillableFails(i *int) *CredentialUpdateOne

SetNillableFails sets the "fails" field if the given value is not nil.

func (*CredentialUpdateOne) SetNillableTargetID added in v0.3.0

func (cuo *CredentialUpdateOne) SetNillableTargetID(id *int) *CredentialUpdateOne

SetNillableTargetID sets the "target" edge to the Target entity by ID if the given value is not nil.

func (*CredentialUpdateOne) SetPrincipal

func (cuo *CredentialUpdateOne) SetPrincipal(s string) *CredentialUpdateOne

SetPrincipal sets the "principal" field.

func (*CredentialUpdateOne) SetSecret

func (cuo *CredentialUpdateOne) SetSecret(s string) *CredentialUpdateOne

SetSecret sets the "secret" field.

func (*CredentialUpdateOne) SetTarget added in v0.3.0

func (cuo *CredentialUpdateOne) SetTarget(t *Target) *CredentialUpdateOne

SetTarget sets the "target" edge to the Target entity.

func (*CredentialUpdateOne) SetTargetID added in v0.3.0

func (cuo *CredentialUpdateOne) SetTargetID(id int) *CredentialUpdateOne

SetTargetID sets the "target" edge to the Target entity by ID.

type Credentials

type Credentials []*Credential

Credentials is a parsable slice of Credential.

type Event added in v0.3.0

type Event struct {

	// ID of the ent.
	ID int `json:"id,omitempty"`
	// CreationTime holds the value of the "CreationTime" field.
	// The timestamp for when the Job was created
	CreationTime time.Time `json:"CreationTime,omitempty"`
	// Kind holds the value of the "Kind" field.
	// The kind of event
	Kind event.Kind `json:"Kind,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the EventQuery when eager-loading is set.
	Edges EventEdges `json:"edges"`
	// contains filtered or unexported fields
}

Event is the model entity for the Event schema.

Example
if dsn == "" {
	return
}
ctx := context.Background()
drv, err := sql.Open("mysql", dsn)
if err != nil {
	log.Fatalf("failed creating database client: %v", err)
}
defer drv.Close()
client := NewClient(Driver(drv))
// creating vertices for the event's edges.
j0 := client.Job.
	Create().
	SetName("string").
	SetCreationTime(time.Now()).
	SetContent("string").
	SetStaged(true).
	SaveX(ctx)
log.Println("job created:", j0)
f1 := client.File.
	Create().
	SetName("string").
	SetCreationTime(time.Now()).
	SetLastModifiedTime(time.Now()).
	SetSize(1).
	SetContent(nil).
	SetHash("string").
	SetContentType("string").
	SaveX(ctx)
log.Println("file created:", f1)
c2 := client.Credential.
	Create().
	SetPrincipal("string").
	SetSecret("string").
	SetKind(credential.KindPassword).
	SetFails(1).
	SaveX(ctx)
log.Println("credential created:", c2)
l3 := client.Link.
	Create().
	SetAlias("string").
	SetExpirationTime(time.Now()).
	SetClicks(1).
	SaveX(ctx)
log.Println("link created:", l3)
t4 := client.Tag.
	Create().
	SetName("string").
	SaveX(ctx)
log.Println("tag created:", t4)
t5 := client.Target.
	Create().
	SetName("string").
	SetOS(target.OSLINUX).
	SetPrimaryIP("string").
	SetMachineUUID("string").
	SetPublicIP("string").
	SetPrimaryMAC("string").
	SetHostname("string").
	SetLastSeen(time.Now()).
	SaveX(ctx)
log.Println("target created:", t5)
t6 := client.Task.
	Create().
	SetQueueTime(time.Now()).
	SetLastChangedTime(time.Now()).
	SetClaimTime(time.Now()).
	SetExecStartTime(time.Now()).
	SetExecStopTime(time.Now()).
	SetContent("string").
	SetOutput("string").
	SetError("string").
	SetSessionID("string").
	SaveX(ctx)
log.Println("task created:", t6)
u7 := client.User.
	Create().
	SetName("string").
	SetOAuthID("string").
	SetPhotoURL("string").
	SetSessionToken("string").
	SetIsActivated(true).
	SetIsAdmin(true).
	SaveX(ctx)
log.Println("user created:", u7)
e8 := client.Event.
	Create().
	SetCreationTime(time.Now()).
	SetKind(event.KindCREATE_JOB).
	SaveX(ctx)
log.Println("event created:", e8)
s9 := client.Service.
	Create().
	SetName("string").
	SetPubKey("string").
	SetConfig("string").
	SetIsActivated(true).
	SaveX(ctx)
log.Println("service created:", s9)
u10 := client.User.
	Create().
	SetName("string").
	SetOAuthID("string").
	SetPhotoURL("string").
	SetSessionToken("string").
	SetIsActivated(true).
	SetIsAdmin(true).
	SaveX(ctx)
log.Println("user created:", u10)

// create event vertex with its edges.
e := client.Event.
	Create().
	SetCreationTime(time.Now()).
	SetKind(event.KindCREATE_JOB).
	SetJob(j0).
	SetFile(f1).
	SetCredential(c2).
	SetLink(l3).
	SetTag(t4).
	SetTarget(t5).
	SetTask(t6).
	SetUser(u7).
	SetEvent(e8).
	SetService(s9).
	AddLikers(u10).
	SaveX(ctx)
log.Println("event created:", e)

// query edges.
j0, err = e.QueryJob().First(ctx)
if err != nil {
	log.Fatalf("failed querying job: %v", err)
}
log.Println("job found:", j0)

f1, err = e.QueryFile().First(ctx)
if err != nil {
	log.Fatalf("failed querying file: %v", err)
}
log.Println("file found:", f1)

c2, err = e.QueryCredential().First(ctx)
if err != nil {
	log.Fatalf("failed querying credential: %v", err)
}
log.Println("credential found:", c2)

l3, err = e.QueryLink().First(ctx)
if err != nil {
	log.Fatalf("failed querying link: %v", err)
}
log.Println("link found:", l3)

t4, err = e.QueryTag().First(ctx)
if err != nil {
	log.Fatalf("failed querying tag: %v", err)
}
log.Println("tag found:", t4)

t5, err = e.QueryTarget().First(ctx)
if err != nil {
	log.Fatalf("failed querying target: %v", err)
}
log.Println("target found:", t5)

t6, err = e.QueryTask().First(ctx)
if err != nil {
	log.Fatalf("failed querying task: %v", err)
}
log.Println("task found:", t6)

u7, err = e.QueryUser().First(ctx)
if err != nil {
	log.Fatalf("failed querying user: %v", err)
}
log.Println("user found:", u7)

e8, err = e.QueryEvent().First(ctx)
if err != nil {
	log.Fatalf("failed querying event: %v", err)
}
log.Println("event found:", e8)

s9, err = e.QueryService().First(ctx)
if err != nil {
	log.Fatalf("failed querying service: %v", err)
}
log.Println("service found:", s9)

u10, err = e.QueryLikers().First(ctx)
if err != nil {
	log.Fatalf("failed querying likers: %v", err)
}
log.Println("likers found:", u10)
Output:

func (*Event) QueryCredential added in v0.3.0

func (e *Event) QueryCredential() *CredentialQuery

QueryCredential queries the "credential" edge of the Event entity.

func (*Event) QueryEvent added in v0.3.0

func (e *Event) QueryEvent() *EventQuery

QueryEvent queries the "event" edge of the Event entity.

func (*Event) QueryFile added in v0.3.0

func (e *Event) QueryFile() *FileQuery

QueryFile queries the "file" edge of the Event entity.

func (*Event) QueryJob added in v0.3.0

func (e *Event) QueryJob() *JobQuery

QueryJob queries the "job" edge of the Event entity.

func (*Event) QueryLikers added in v0.3.0

func (e *Event) QueryLikers() *UserQuery

QueryLikers queries the "likers" edge of the Event entity.

func (e *Event) QueryLink() *LinkQuery

QueryLink queries the "link" edge of the Event entity.

func (*Event) QueryOwner added in v0.3.0

func (e *Event) QueryOwner() *UserQuery

QueryOwner queries the "owner" edge of the Event entity.

func (*Event) QueryService added in v0.3.0

func (e *Event) QueryService() *ServiceQuery

QueryService queries the "service" edge of the Event entity.

func (*Event) QuerySvcOwner added in v0.3.0

func (e *Event) QuerySvcOwner() *ServiceQuery

QuerySvcOwner queries the "svcOwner" edge of the Event entity.

func (*Event) QueryTag added in v0.3.0

func (e *Event) QueryTag() *TagQuery

QueryTag queries the "tag" edge of the Event entity.

func (*Event) QueryTarget added in v0.3.0

func (e *Event) QueryTarget() *TargetQuery

QueryTarget queries the "target" edge of the Event entity.

func (*Event) QueryTask added in v0.3.0

func (e *Event) QueryTask() *TaskQuery

QueryTask queries the "task" edge of the Event entity.

func (*Event) QueryUser added in v0.3.0

func (e *Event) QueryUser() *UserQuery

QueryUser queries the "user" edge of the Event entity.

func (*Event) String added in v0.3.0

func (e *Event) String() string

String implements the fmt.Stringer.

func (*Event) Unwrap added in v0.3.0

func (e *Event) Unwrap() *Event

Unwrap unwraps the Event 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 (*Event) Update added in v0.3.0

func (e *Event) Update() *EventUpdateOne

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

type EventClient added in v0.3.0

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

EventClient is a client for the Event schema.

func NewEventClient added in v0.3.0

func NewEventClient(c config) *EventClient

NewEventClient returns a client for the Event from the given config.

func (*EventClient) Create added in v0.3.0

func (c *EventClient) Create() *EventCreate

Create returns a create builder for Event.

func (*EventClient) CreateBulk added in v0.4.3

func (c *EventClient) CreateBulk(builders ...*EventCreate) *EventCreateBulk

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

func (*EventClient) Delete added in v0.3.0

func (c *EventClient) Delete() *EventDelete

Delete returns a delete builder for Event.

func (*EventClient) DeleteOne added in v0.3.0

func (c *EventClient) DeleteOne(e *Event) *EventDeleteOne

DeleteOne returns a delete builder for the given entity.

func (*EventClient) DeleteOneID added in v0.3.0

func (c *EventClient) DeleteOneID(id int) *EventDeleteOne

DeleteOneID returns a delete builder for the given id.

func (*EventClient) Get added in v0.3.0

func (c *EventClient) Get(ctx context.Context, id int) (*Event, error)

Get returns a Event entity by its id.

func (*EventClient) GetX added in v0.3.0

func (c *EventClient) GetX(ctx context.Context, id int) *Event

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

func (*EventClient) Hooks added in v0.4.3

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

Hooks returns the client hooks.

func (*EventClient) Query added in v0.3.0

func (c *EventClient) Query() *EventQuery

Query returns a query builder for Event.

func (*EventClient) QueryCredential added in v0.3.0

func (c *EventClient) QueryCredential(e *Event) *CredentialQuery

QueryCredential queries the credential edge of a Event.

func (*EventClient) QueryEvent added in v0.3.0

func (c *EventClient) QueryEvent(e *Event) *EventQuery

QueryEvent queries the event edge of a Event.

func (*EventClient) QueryFile added in v0.3.0

func (c *EventClient) QueryFile(e *Event) *FileQuery

QueryFile queries the file edge of a Event.

func (*EventClient) QueryJob added in v0.3.0

func (c *EventClient) QueryJob(e *Event) *JobQuery

QueryJob queries the job edge of a Event.

func (*EventClient) QueryLikers added in v0.3.0

func (c *EventClient) QueryLikers(e *Event) *UserQuery

QueryLikers queries the likers edge of a Event.

func (c *EventClient) QueryLink(e *Event) *LinkQuery

QueryLink queries the link edge of a Event.

func (*EventClient) QueryOwner added in v0.3.0

func (c *EventClient) QueryOwner(e *Event) *UserQuery

QueryOwner queries the owner edge of a Event.

func (*EventClient) QueryService added in v0.3.0

func (c *EventClient) QueryService(e *Event) *ServiceQuery

QueryService queries the service edge of a Event.

func (*EventClient) QuerySvcOwner added in v0.3.0

func (c *EventClient) QuerySvcOwner(e *Event) *ServiceQuery

QuerySvcOwner queries the svcOwner edge of a Event.

func (*EventClient) QueryTag added in v0.3.0

func (c *EventClient) QueryTag(e *Event) *TagQuery

QueryTag queries the tag edge of a Event.

func (*EventClient) QueryTarget added in v0.3.0

func (c *EventClient) QueryTarget(e *Event) *TargetQuery

QueryTarget queries the target edge of a Event.

func (*EventClient) QueryTask added in v0.3.0

func (c *EventClient) QueryTask(e *Event) *TaskQuery

QueryTask queries the task edge of a Event.

func (*EventClient) QueryUser added in v0.3.0

func (c *EventClient) QueryUser(e *Event) *UserQuery

QueryUser queries the user edge of a Event.

func (*EventClient) Update added in v0.3.0

func (c *EventClient) Update() *EventUpdate

Update returns an update builder for Event.

func (*EventClient) UpdateOne added in v0.3.0

func (c *EventClient) UpdateOne(e *Event) *EventUpdateOne

UpdateOne returns an update builder for the given entity.

func (*EventClient) UpdateOneID added in v0.3.0

func (c *EventClient) UpdateOneID(id int) *EventUpdateOne

UpdateOneID returns an update builder for the given id.

func (*EventClient) Use added in v0.4.3

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

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

type EventCreate added in v0.3.0

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

EventCreate is the builder for creating a Event entity.

func (*EventCreate) AddLikerIDs added in v0.3.0

func (ec *EventCreate) AddLikerIDs(ids ...int) *EventCreate

AddLikerIDs adds the "likers" edge to the User entity by IDs.

func (*EventCreate) AddLikers added in v0.3.0

func (ec *EventCreate) AddLikers(u ...*User) *EventCreate

AddLikers adds the "likers" edges to the User entity.

func (*EventCreate) Exec added in v0.4.3

func (ec *EventCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*EventCreate) ExecX added in v0.4.3

func (ec *EventCreate) ExecX(ctx context.Context)

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

func (*EventCreate) Mutation added in v0.4.3

func (ec *EventCreate) Mutation() *EventMutation

Mutation returns the EventMutation object of the builder.

func (*EventCreate) Save added in v0.3.0

func (ec *EventCreate) Save(ctx context.Context) (*Event, error)

Save creates the Event in the database.

func (*EventCreate) SaveX added in v0.3.0

func (ec *EventCreate) SaveX(ctx context.Context) *Event

SaveX calls Save and panics if Save returns an error.

func (*EventCreate) SetCreationTime added in v0.3.0

func (ec *EventCreate) SetCreationTime(t time.Time) *EventCreate

SetCreationTime sets the "CreationTime" field.

func (*EventCreate) SetCredential added in v0.3.0

func (ec *EventCreate) SetCredential(c *Credential) *EventCreate

SetCredential sets the "credential" edge to the Credential entity.

func (*EventCreate) SetCredentialID added in v0.3.0

func (ec *EventCreate) SetCredentialID(id int) *EventCreate

SetCredentialID sets the "credential" edge to the Credential entity by ID.

func (*EventCreate) SetEvent added in v0.3.0

func (ec *EventCreate) SetEvent(e *Event) *EventCreate

SetEvent sets the "event" edge to the Event entity.

func (*EventCreate) SetEventID added in v0.3.0

func (ec *EventCreate) SetEventID(id int) *EventCreate

SetEventID sets the "event" edge to the Event entity by ID.

func (*EventCreate) SetFile added in v0.3.0

func (ec *EventCreate) SetFile(f *File) *EventCreate

SetFile sets the "file" edge to the File entity.

func (*EventCreate) SetFileID added in v0.3.0

func (ec *EventCreate) SetFileID(id int) *EventCreate

SetFileID sets the "file" edge to the File entity by ID.

func (*EventCreate) SetJob added in v0.3.0

func (ec *EventCreate) SetJob(j *Job) *EventCreate

SetJob sets the "job" edge to the Job entity.

func (*EventCreate) SetJobID added in v0.3.0

func (ec *EventCreate) SetJobID(id int) *EventCreate

SetJobID sets the "job" edge to the Job entity by ID.

func (*EventCreate) SetKind added in v0.3.0

func (ec *EventCreate) SetKind(e event.Kind) *EventCreate

SetKind sets the "Kind" field.

func (ec *EventCreate) SetLink(l *Link) *EventCreate

SetLink sets the "link" edge to the Link entity.

func (*EventCreate) SetLinkID added in v0.3.0

func (ec *EventCreate) SetLinkID(id int) *EventCreate

SetLinkID sets the "link" edge to the Link entity by ID.

func (*EventCreate) SetNillableCreationTime added in v0.3.0

func (ec *EventCreate) SetNillableCreationTime(t *time.Time) *EventCreate

SetNillableCreationTime sets the "CreationTime" field if the given value is not nil.

func (*EventCreate) SetNillableCredentialID added in v0.3.0

func (ec *EventCreate) SetNillableCredentialID(id *int) *EventCreate

SetNillableCredentialID sets the "credential" edge to the Credential entity by ID if the given value is not nil.

func (*EventCreate) SetNillableEventID added in v0.3.0

func (ec *EventCreate) SetNillableEventID(id *int) *EventCreate

SetNillableEventID sets the "event" edge to the Event entity by ID if the given value is not nil.

func (*EventCreate) SetNillableFileID added in v0.3.0

func (ec *EventCreate) SetNillableFileID(id *int) *EventCreate

SetNillableFileID sets the "file" edge to the File entity by ID if the given value is not nil.

func (*EventCreate) SetNillableJobID added in v0.3.0

func (ec *EventCreate) SetNillableJobID(id *int) *EventCreate

SetNillableJobID sets the "job" edge to the Job entity by ID if the given value is not nil.

func (*EventCreate) SetNillableLinkID added in v0.3.0

func (ec *EventCreate) SetNillableLinkID(id *int) *EventCreate

SetNillableLinkID sets the "link" edge to the Link entity by ID if the given value is not nil.

func (*EventCreate) SetNillableOwnerID added in v0.3.0

func (ec *EventCreate) SetNillableOwnerID(id *int) *EventCreate

SetNillableOwnerID sets the "owner" edge to the User entity by ID if the given value is not nil.

func (*EventCreate) SetNillableServiceID added in v0.3.0

func (ec *EventCreate) SetNillableServiceID(id *int) *EventCreate

SetNillableServiceID sets the "service" edge to the Service entity by ID if the given value is not nil.

func (*EventCreate) SetNillableSvcOwnerID added in v0.3.0

func (ec *EventCreate) SetNillableSvcOwnerID(id *int) *EventCreate

SetNillableSvcOwnerID sets the "svcOwner" edge to the Service entity by ID if the given value is not nil.

func (*EventCreate) SetNillableTagID added in v0.3.0

func (ec *EventCreate) SetNillableTagID(id *int) *EventCreate

SetNillableTagID sets the "tag" edge to the Tag entity by ID if the given value is not nil.

func (*EventCreate) SetNillableTargetID added in v0.3.0

func (ec *EventCreate) SetNillableTargetID(id *int) *EventCreate

SetNillableTargetID sets the "target" edge to the Target entity by ID if the given value is not nil.

func (*EventCreate) SetNillableTaskID added in v0.3.0

func (ec *EventCreate) SetNillableTaskID(id *int) *EventCreate

SetNillableTaskID sets the "task" edge to the Task entity by ID if the given value is not nil.

func (*EventCreate) SetNillableUserID added in v0.3.0

func (ec *EventCreate) SetNillableUserID(id *int) *EventCreate

SetNillableUserID sets the "user" edge to the User entity by ID if the given value is not nil.

func (*EventCreate) SetOwner added in v0.3.0

func (ec *EventCreate) SetOwner(u *User) *EventCreate

SetOwner sets the "owner" edge to the User entity.

func (*EventCreate) SetOwnerID added in v0.3.0

func (ec *EventCreate) SetOwnerID(id int) *EventCreate

SetOwnerID sets the "owner" edge to the User entity by ID.

func (*EventCreate) SetService added in v0.3.0

func (ec *EventCreate) SetService(s *Service) *EventCreate

SetService sets the "service" edge to the Service entity.

func (*EventCreate) SetServiceID added in v0.3.0

func (ec *EventCreate) SetServiceID(id int) *EventCreate

SetServiceID sets the "service" edge to the Service entity by ID.

func (*EventCreate) SetSvcOwner added in v0.3.0

func (ec *EventCreate) SetSvcOwner(s *Service) *EventCreate

SetSvcOwner sets the "svcOwner" edge to the Service entity.

func (*EventCreate) SetSvcOwnerID added in v0.3.0

func (ec *EventCreate) SetSvcOwnerID(id int) *EventCreate

SetSvcOwnerID sets the "svcOwner" edge to the Service entity by ID.

func (*EventCreate) SetTag added in v0.3.0

func (ec *EventCreate) SetTag(t *Tag) *EventCreate

SetTag sets the "tag" edge to the Tag entity.

func (*EventCreate) SetTagID added in v0.3.0

func (ec *EventCreate) SetTagID(id int) *EventCreate

SetTagID sets the "tag" edge to the Tag entity by ID.

func (*EventCreate) SetTarget added in v0.3.0

func (ec *EventCreate) SetTarget(t *Target) *EventCreate

SetTarget sets the "target" edge to the Target entity.

func (*EventCreate) SetTargetID added in v0.3.0

func (ec *EventCreate) SetTargetID(id int) *EventCreate

SetTargetID sets the "target" edge to the Target entity by ID.

func (*EventCreate) SetTask added in v0.3.0

func (ec *EventCreate) SetTask(t *Task) *EventCreate

SetTask sets the "task" edge to the Task entity.

func (*EventCreate) SetTaskID added in v0.3.0

func (ec *EventCreate) SetTaskID(id int) *EventCreate

SetTaskID sets the "task" edge to the Task entity by ID.

func (*EventCreate) SetUser added in v0.3.0

func (ec *EventCreate) SetUser(u *User) *EventCreate

SetUser sets the "user" edge to the User entity.

func (*EventCreate) SetUserID added in v0.3.0

func (ec *EventCreate) SetUserID(id int) *EventCreate

SetUserID sets the "user" edge to the User entity by ID.

type EventCreateBulk added in v0.4.3

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

EventCreateBulk is the builder for creating many Event entities in bulk.

func (*EventCreateBulk) Exec added in v0.4.3

func (ecb *EventCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*EventCreateBulk) ExecX added in v0.4.3

func (ecb *EventCreateBulk) ExecX(ctx context.Context)

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

func (*EventCreateBulk) Save added in v0.4.3

func (ecb *EventCreateBulk) Save(ctx context.Context) ([]*Event, error)

Save creates the Event entities in the database.

func (*EventCreateBulk) SaveX added in v0.4.3

func (ecb *EventCreateBulk) SaveX(ctx context.Context) []*Event

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

type EventDelete added in v0.3.0

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

EventDelete is the builder for deleting a Event entity.

func (*EventDelete) Exec added in v0.3.0

func (ed *EventDelete) Exec(ctx context.Context) (int, error)

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

func (*EventDelete) ExecX added in v0.3.0

func (ed *EventDelete) ExecX(ctx context.Context) int

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

func (*EventDelete) Where added in v0.3.0

func (ed *EventDelete) Where(ps ...predicate.Event) *EventDelete

Where appends a list predicates to the EventDelete builder.

type EventDeleteOne added in v0.3.0

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

EventDeleteOne is the builder for deleting a single Event entity.

func (*EventDeleteOne) Exec added in v0.3.0

func (edo *EventDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*EventDeleteOne) ExecX added in v0.3.0

func (edo *EventDeleteOne) ExecX(ctx context.Context)

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

type EventEdges added in v0.3.0

type EventEdges struct {
	// Job holds the value of the job edge.
	Job *Job `json:"job,omitempty"`
	// File holds the value of the file edge.
	File *File `json:"file,omitempty"`
	// Credential holds the value of the credential edge.
	Credential *Credential `json:"credential,omitempty"`
	// Link holds the value of the link edge.
	Link *Link `json:"link,omitempty"`
	// Tag holds the value of the tag edge.
	Tag *Tag `json:"tag,omitempty"`
	// Target holds the value of the target edge.
	Target *Target `json:"target,omitempty"`
	// Task holds the value of the task edge.
	Task *Task `json:"task,omitempty"`
	// User holds the value of the user edge.
	User *User `json:"user,omitempty"`
	// Event holds the value of the event edge.
	Event *Event `json:"event,omitempty"`
	// Service holds the value of the service edge.
	Service *Service `json:"service,omitempty"`
	// Likers holds the value of the likers edge.
	Likers []*User `json:"likers,omitempty"`
	// Owner holds the value of the owner edge.
	Owner *User `json:"owner,omitempty"`
	// SvcOwner holds the value of the svcOwner edge.
	SvcOwner *Service `json:"svcOwner,omitempty"`
	// contains filtered or unexported fields
}

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

func (EventEdges) CredentialOrErr added in v0.3.0

func (e EventEdges) CredentialOrErr() (*Credential, error)

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

func (EventEdges) EventOrErr added in v0.3.0

func (e EventEdges) EventOrErr() (*Event, error)

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

func (EventEdges) FileOrErr added in v0.3.0

func (e EventEdges) FileOrErr() (*File, error)

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

func (EventEdges) JobOrErr added in v0.3.0

func (e EventEdges) JobOrErr() (*Job, error)

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

func (EventEdges) LikersOrErr added in v0.3.0

func (e EventEdges) LikersOrErr() ([]*User, error)

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

func (EventEdges) LinkOrErr added in v0.3.0

func (e EventEdges) LinkOrErr() (*Link, error)

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

func (EventEdges) OwnerOrErr added in v0.3.0

func (e EventEdges) OwnerOrErr() (*User, error)

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

func (EventEdges) ServiceOrErr added in v0.3.0

func (e EventEdges) ServiceOrErr() (*Service, error)

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

func (EventEdges) SvcOwnerOrErr added in v0.3.0

func (e EventEdges) SvcOwnerOrErr() (*Service, error)

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

func (EventEdges) TagOrErr added in v0.3.0

func (e EventEdges) TagOrErr() (*Tag, error)

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

func (EventEdges) TargetOrErr added in v0.3.0

func (e EventEdges) TargetOrErr() (*Target, error)

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

func (EventEdges) TaskOrErr added in v0.3.0

func (e EventEdges) TaskOrErr() (*Task, error)

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

func (EventEdges) UserOrErr added in v0.3.0

func (e EventEdges) UserOrErr() (*User, error)

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

type EventGroupBy added in v0.3.0

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

EventGroupBy is the group-by builder for Event entities.

func (*EventGroupBy) Aggregate added in v0.3.0

func (egb *EventGroupBy) Aggregate(fns ...AggregateFunc) *EventGroupBy

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

func (*EventGroupBy) Bool added in v0.4.3

func (egb *EventGroupBy) 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 (*EventGroupBy) BoolX added in v0.4.3

func (egb *EventGroupBy) BoolX(ctx context.Context) bool

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

func (*EventGroupBy) Bools added in v0.3.0

func (egb *EventGroupBy) 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 (*EventGroupBy) BoolsX added in v0.3.0

func (egb *EventGroupBy) BoolsX(ctx context.Context) []bool

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

func (*EventGroupBy) Float64 added in v0.4.3

func (egb *EventGroupBy) 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 (*EventGroupBy) Float64X added in v0.4.3

func (egb *EventGroupBy) Float64X(ctx context.Context) float64

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

func (*EventGroupBy) Float64s added in v0.3.0

func (egb *EventGroupBy) 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 (*EventGroupBy) Float64sX added in v0.3.0

func (egb *EventGroupBy) Float64sX(ctx context.Context) []float64

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

func (*EventGroupBy) Int added in v0.4.3

func (egb *EventGroupBy) 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 (*EventGroupBy) IntX added in v0.4.3

func (egb *EventGroupBy) IntX(ctx context.Context) int

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

func (*EventGroupBy) Ints added in v0.3.0

func (egb *EventGroupBy) 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 (*EventGroupBy) IntsX added in v0.3.0

func (egb *EventGroupBy) IntsX(ctx context.Context) []int

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

func (*EventGroupBy) Scan added in v0.3.0

func (egb *EventGroupBy) Scan(ctx context.Context, v interface{}) error

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

func (*EventGroupBy) ScanX added in v0.3.0

func (egb *EventGroupBy) ScanX(ctx context.Context, v interface{})

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

func (*EventGroupBy) String added in v0.4.3

func (egb *EventGroupBy) 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 (*EventGroupBy) StringX added in v0.4.3

func (egb *EventGroupBy) StringX(ctx context.Context) string

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

func (*EventGroupBy) Strings added in v0.3.0

func (egb *EventGroupBy) 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 (*EventGroupBy) StringsX added in v0.3.0

func (egb *EventGroupBy) StringsX(ctx context.Context) []string

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

type EventMutation added in v0.4.3

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

EventMutation represents an operation that mutates the Event nodes in the graph.

func (*EventMutation) AddField added in v0.4.3

func (m *EventMutation) 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 (*EventMutation) AddLikerIDs added in v0.4.3

func (m *EventMutation) AddLikerIDs(ids ...int)

AddLikerIDs adds the "likers" edge to the User entity by ids.

func (*EventMutation) AddedEdges added in v0.4.3

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

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

func (*EventMutation) AddedField added in v0.4.3

func (m *EventMutation) 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 (*EventMutation) AddedFields added in v0.4.3

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

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

func (*EventMutation) AddedIDs added in v0.4.3

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

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

func (*EventMutation) ClearCredential added in v0.4.3

func (m *EventMutation) ClearCredential()

ClearCredential clears the "credential" edge to the Credential entity.

func (*EventMutation) ClearEdge added in v0.4.3

func (m *EventMutation) 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 (*EventMutation) ClearEvent added in v0.4.3

func (m *EventMutation) ClearEvent()

ClearEvent clears the "event" edge to the Event entity.

func (*EventMutation) ClearField added in v0.4.3

func (m *EventMutation) 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 (*EventMutation) ClearFile added in v0.4.3

func (m *EventMutation) ClearFile()

ClearFile clears the "file" edge to the File entity.

func (*EventMutation) ClearJob added in v0.4.3

func (m *EventMutation) ClearJob()

ClearJob clears the "job" edge to the Job entity.

func (*EventMutation) ClearLikers added in v0.4.3

func (m *EventMutation) ClearLikers()

ClearLikers clears the "likers" edge to the User entity.

func (m *EventMutation) ClearLink()

ClearLink clears the "link" edge to the Link entity.

func (*EventMutation) ClearOwner added in v0.4.3

func (m *EventMutation) ClearOwner()

ClearOwner clears the "owner" edge to the User entity.

func (*EventMutation) ClearService added in v0.4.3

func (m *EventMutation) ClearService()

ClearService clears the "service" edge to the Service entity.

func (*EventMutation) ClearSvcOwner added in v0.4.3

func (m *EventMutation) ClearSvcOwner()

ClearSvcOwner clears the "svcOwner" edge to the Service entity.

func (*EventMutation) ClearTag added in v0.4.3

func (m *EventMutation) ClearTag()

ClearTag clears the "tag" edge to the Tag entity.

func (*EventMutation) ClearTarget added in v0.4.3

func (m *EventMutation) ClearTarget()

ClearTarget clears the "target" edge to the Target entity.

func (*EventMutation) ClearTask added in v0.4.3

func (m *EventMutation) ClearTask()

ClearTask clears the "task" edge to the Task entity.

func (*EventMutation) ClearUser added in v0.4.3

func (m *EventMutation) ClearUser()

ClearUser clears the "user" edge to the User entity.

func (*EventMutation) ClearedEdges added in v0.4.3

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

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

func (*EventMutation) ClearedFields added in v0.4.3

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

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

func (EventMutation) Client added in v0.4.3

func (m EventMutation) 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 (*EventMutation) CreationTime added in v0.4.3

func (m *EventMutation) CreationTime() (r time.Time, exists bool)

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

func (*EventMutation) CredentialCleared added in v0.4.3

func (m *EventMutation) CredentialCleared() bool

CredentialCleared reports if the "credential" edge to the Credential entity was cleared.

func (*EventMutation) CredentialID added in v0.4.3

func (m *EventMutation) CredentialID() (id int, exists bool)

CredentialID returns the "credential" edge ID in the mutation.

func (*EventMutation) CredentialIDs added in v0.4.3

func (m *EventMutation) CredentialIDs() (ids []int)

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

func (*EventMutation) EdgeCleared added in v0.4.3

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

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

func (*EventMutation) EventCleared added in v0.4.3

func (m *EventMutation) EventCleared() bool

EventCleared reports if the "event" edge to the Event entity was cleared.

func (*EventMutation) EventID added in v0.4.3

func (m *EventMutation) EventID() (id int, exists bool)

EventID returns the "event" edge ID in the mutation.

func (*EventMutation) EventIDs added in v0.4.3

func (m *EventMutation) EventIDs() (ids []int)

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

func (*EventMutation) Field added in v0.4.3

func (m *EventMutation) 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 (*EventMutation) FieldCleared added in v0.4.3

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

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

func (*EventMutation) Fields added in v0.4.3

func (m *EventMutation) 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 (*EventMutation) FileCleared added in v0.4.3

func (m *EventMutation) FileCleared() bool

FileCleared reports if the "file" edge to the File entity was cleared.

func (*EventMutation) FileID added in v0.4.3

func (m *EventMutation) FileID() (id int, exists bool)

FileID returns the "file" edge ID in the mutation.

func (*EventMutation) FileIDs added in v0.4.3

func (m *EventMutation) FileIDs() (ids []int)

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

func (*EventMutation) ID added in v0.4.3

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

func (m *EventMutation) 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 (*EventMutation) JobCleared added in v0.4.3

func (m *EventMutation) JobCleared() bool

JobCleared reports if the "job" edge to the Job entity was cleared.

func (*EventMutation) JobID added in v0.4.3

func (m *EventMutation) JobID() (id int, exists bool)

JobID returns the "job" edge ID in the mutation.

func (*EventMutation) JobIDs added in v0.4.3

func (m *EventMutation) JobIDs() (ids []int)

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

func (*EventMutation) Kind added in v0.4.3

func (m *EventMutation) Kind() (r event.Kind, exists bool)

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

func (*EventMutation) LikersCleared added in v0.4.3

func (m *EventMutation) LikersCleared() bool

LikersCleared reports if the "likers" edge to the User entity was cleared.

func (*EventMutation) LikersIDs added in v0.4.3

func (m *EventMutation) LikersIDs() (ids []int)

LikersIDs returns the "likers" edge IDs in the mutation.

func (*EventMutation) LinkCleared added in v0.4.3

func (m *EventMutation) LinkCleared() bool

LinkCleared reports if the "link" edge to the Link entity was cleared.

func (*EventMutation) LinkID added in v0.4.3

func (m *EventMutation) LinkID() (id int, exists bool)

LinkID returns the "link" edge ID in the mutation.

func (*EventMutation) LinkIDs added in v0.4.3

func (m *EventMutation) LinkIDs() (ids []int)

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

func (*EventMutation) OldCreationTime added in v0.4.3

func (m *EventMutation) OldCreationTime(ctx context.Context) (v time.Time, err error)

OldCreationTime returns the old "CreationTime" field's value of the Event entity. If the Event 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 (*EventMutation) OldField added in v0.4.3

func (m *EventMutation) 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 (*EventMutation) OldKind added in v0.4.3

func (m *EventMutation) OldKind(ctx context.Context) (v event.Kind, err error)

OldKind returns the old "Kind" field's value of the Event entity. If the Event 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 (*EventMutation) Op added in v0.4.3

func (m *EventMutation) Op() Op

Op returns the operation name.

func (*EventMutation) OwnerCleared added in v0.4.3

func (m *EventMutation) OwnerCleared() bool

OwnerCleared reports if the "owner" edge to the User entity was cleared.

func (*EventMutation) OwnerID added in v0.4.3

func (m *EventMutation) OwnerID() (id int, exists bool)

OwnerID returns the "owner" edge ID in the mutation.

func (*EventMutation) OwnerIDs added in v0.4.3

func (m *EventMutation) OwnerIDs() (ids []int)

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

func (*EventMutation) RemoveLikerIDs added in v0.4.3

func (m *EventMutation) RemoveLikerIDs(ids ...int)

RemoveLikerIDs removes the "likers" edge to the User entity by IDs.

func (*EventMutation) RemovedEdges added in v0.4.3

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

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

func (*EventMutation) RemovedIDs added in v0.4.3

func (m *EventMutation) 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 (*EventMutation) RemovedLikersIDs added in v0.4.3

func (m *EventMutation) RemovedLikersIDs() (ids []int)

RemovedLikers returns the removed IDs of the "likers" edge to the User entity.

func (*EventMutation) ResetCreationTime added in v0.4.3

func (m *EventMutation) ResetCreationTime()

ResetCreationTime resets all changes to the "CreationTime" field.

func (*EventMutation) ResetCredential added in v0.4.3

func (m *EventMutation) ResetCredential()

ResetCredential resets all changes to the "credential" edge.

func (*EventMutation) ResetEdge added in v0.4.3

func (m *EventMutation) 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 (*EventMutation) ResetEvent added in v0.4.3

func (m *EventMutation) ResetEvent()

ResetEvent resets all changes to the "event" edge.

func (*EventMutation) ResetField added in v0.4.3

func (m *EventMutation) 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 (*EventMutation) ResetFile added in v0.4.3

func (m *EventMutation) ResetFile()

ResetFile resets all changes to the "file" edge.

func (*EventMutation) ResetJob added in v0.4.3

func (m *EventMutation) ResetJob()

ResetJob resets all changes to the "job" edge.

func (*EventMutation) ResetKind added in v0.4.3

func (m *EventMutation) ResetKind()

ResetKind resets all changes to the "Kind" field.

func (*EventMutation) ResetLikers added in v0.4.3

func (m *EventMutation) ResetLikers()

ResetLikers resets all changes to the "likers" edge.

func (m *EventMutation) ResetLink()

ResetLink resets all changes to the "link" edge.

func (*EventMutation) ResetOwner added in v0.4.3

func (m *EventMutation) ResetOwner()

ResetOwner resets all changes to the "owner" edge.

func (*EventMutation) ResetService added in v0.4.3

func (m *EventMutation) ResetService()

ResetService resets all changes to the "service" edge.

func (*EventMutation) ResetSvcOwner added in v0.4.3

func (m *EventMutation) ResetSvcOwner()

ResetSvcOwner resets all changes to the "svcOwner" edge.

func (*EventMutation) ResetTag added in v0.4.3

func (m *EventMutation) ResetTag()

ResetTag resets all changes to the "tag" edge.

func (*EventMutation) ResetTarget added in v0.4.3

func (m *EventMutation) ResetTarget()

ResetTarget resets all changes to the "target" edge.

func (*EventMutation) ResetTask added in v0.4.3

func (m *EventMutation) ResetTask()

ResetTask resets all changes to the "task" edge.

func (*EventMutation) ResetUser added in v0.4.3

func (m *EventMutation) ResetUser()

ResetUser resets all changes to the "user" edge.

func (*EventMutation) ServiceCleared added in v0.4.3

func (m *EventMutation) ServiceCleared() bool

ServiceCleared reports if the "service" edge to the Service entity was cleared.

func (*EventMutation) ServiceID added in v0.4.3

func (m *EventMutation) ServiceID() (id int, exists bool)

ServiceID returns the "service" edge ID in the mutation.

func (*EventMutation) ServiceIDs added in v0.4.3

func (m *EventMutation) ServiceIDs() (ids []int)

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

func (*EventMutation) SetCreationTime added in v0.4.3

func (m *EventMutation) SetCreationTime(t time.Time)

SetCreationTime sets the "CreationTime" field.

func (*EventMutation) SetCredentialID added in v0.4.3

func (m *EventMutation) SetCredentialID(id int)

SetCredentialID sets the "credential" edge to the Credential entity by id.

func (*EventMutation) SetEventID added in v0.4.3

func (m *EventMutation) SetEventID(id int)

SetEventID sets the "event" edge to the Event entity by id.

func (*EventMutation) SetField added in v0.4.3

func (m *EventMutation) 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 (*EventMutation) SetFileID added in v0.4.3

func (m *EventMutation) SetFileID(id int)

SetFileID sets the "file" edge to the File entity by id.

func (*EventMutation) SetJobID added in v0.4.3

func (m *EventMutation) SetJobID(id int)

SetJobID sets the "job" edge to the Job entity by id.

func (*EventMutation) SetKind added in v0.4.3

func (m *EventMutation) SetKind(e event.Kind)

SetKind sets the "Kind" field.

func (*EventMutation) SetLinkID added in v0.4.3

func (m *EventMutation) SetLinkID(id int)

SetLinkID sets the "link" edge to the Link entity by id.

func (*EventMutation) SetOwnerID added in v0.4.3

func (m *EventMutation) SetOwnerID(id int)

SetOwnerID sets the "owner" edge to the User entity by id.

func (*EventMutation) SetServiceID added in v0.4.3

func (m *EventMutation) SetServiceID(id int)

SetServiceID sets the "service" edge to the Service entity by id.

func (*EventMutation) SetSvcOwnerID added in v0.4.3

func (m *EventMutation) SetSvcOwnerID(id int)

SetSvcOwnerID sets the "svcOwner" edge to the Service entity by id.

func (*EventMutation) SetTagID added in v0.4.3

func (m *EventMutation) SetTagID(id int)

SetTagID sets the "tag" edge to the Tag entity by id.

func (*EventMutation) SetTargetID added in v0.4.3

func (m *EventMutation) SetTargetID(id int)

SetTargetID sets the "target" edge to the Target entity by id.

func (*EventMutation) SetTaskID added in v0.4.3

func (m *EventMutation) SetTaskID(id int)

SetTaskID sets the "task" edge to the Task entity by id.

func (*EventMutation) SetUserID added in v0.4.3

func (m *EventMutation) SetUserID(id int)

SetUserID sets the "user" edge to the User entity by id.

func (*EventMutation) SvcOwnerCleared added in v0.4.3

func (m *EventMutation) SvcOwnerCleared() bool

SvcOwnerCleared reports if the "svcOwner" edge to the Service entity was cleared.

func (*EventMutation) SvcOwnerID added in v0.4.3

func (m *EventMutation) SvcOwnerID() (id int, exists bool)

SvcOwnerID returns the "svcOwner" edge ID in the mutation.

func (*EventMutation) SvcOwnerIDs added in v0.4.3

func (m *EventMutation) SvcOwnerIDs() (ids []int)

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

func (*EventMutation) TagCleared added in v0.4.3

func (m *EventMutation) TagCleared() bool

TagCleared reports if the "tag" edge to the Tag entity was cleared.

func (*EventMutation) TagID added in v0.4.3

func (m *EventMutation) TagID() (id int, exists bool)

TagID returns the "tag" edge ID in the mutation.

func (*EventMutation) TagIDs added in v0.4.3

func (m *EventMutation) TagIDs() (ids []int)

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

func (*EventMutation) TargetCleared added in v0.4.3

func (m *EventMutation) TargetCleared() bool

TargetCleared reports if the "target" edge to the Target entity was cleared.

func (*EventMutation) TargetID added in v0.4.3

func (m *EventMutation) TargetID() (id int, exists bool)

TargetID returns the "target" edge ID in the mutation.

func (*EventMutation) TargetIDs added in v0.4.3

func (m *EventMutation) TargetIDs() (ids []int)

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

func (*EventMutation) TaskCleared added in v0.4.3

func (m *EventMutation) TaskCleared() bool

TaskCleared reports if the "task" edge to the Task entity was cleared.

func (*EventMutation) TaskID added in v0.4.3

func (m *EventMutation) TaskID() (id int, exists bool)

TaskID returns the "task" edge ID in the mutation.

func (*EventMutation) TaskIDs added in v0.4.3

func (m *EventMutation) TaskIDs() (ids []int)

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

func (EventMutation) Tx added in v0.4.3

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

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

func (*EventMutation) Type added in v0.4.3

func (m *EventMutation) Type() string

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

func (*EventMutation) UserCleared added in v0.4.3

func (m *EventMutation) UserCleared() bool

UserCleared reports if the "user" edge to the User entity was cleared.

func (*EventMutation) UserID added in v0.4.3

func (m *EventMutation) UserID() (id int, exists bool)

UserID returns the "user" edge ID in the mutation.

func (*EventMutation) UserIDs added in v0.4.3

func (m *EventMutation) UserIDs() (ids []int)

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

func (*EventMutation) Where added in v0.4.3

func (m *EventMutation) Where(ps ...predicate.Event)

Where appends a list predicates to the EventMutation builder.

type EventQuery added in v0.3.0

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

EventQuery is the builder for querying Event entities.

func (*EventQuery) All added in v0.3.0

func (eq *EventQuery) All(ctx context.Context) ([]*Event, error)

All executes the query and returns a list of Events.

func (*EventQuery) AllX added in v0.3.0

func (eq *EventQuery) AllX(ctx context.Context) []*Event

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

func (*EventQuery) Clone added in v0.3.0

func (eq *EventQuery) Clone() *EventQuery

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

func (*EventQuery) Count added in v0.3.0

func (eq *EventQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*EventQuery) CountX added in v0.3.0

func (eq *EventQuery) CountX(ctx context.Context) int

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

func (*EventQuery) Exist added in v0.3.0

func (eq *EventQuery) Exist(ctx context.Context) (bool, error)

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

func (*EventQuery) ExistX added in v0.3.0

func (eq *EventQuery) ExistX(ctx context.Context) bool

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

func (*EventQuery) First added in v0.3.0

func (eq *EventQuery) First(ctx context.Context) (*Event, error)

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

func (*EventQuery) FirstID added in v0.3.0

func (eq *EventQuery) FirstID(ctx context.Context) (id int, err error)

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

func (*EventQuery) FirstIDX added in v0.4.3

func (eq *EventQuery) FirstIDX(ctx context.Context) int

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

func (*EventQuery) FirstX added in v0.3.0

func (eq *EventQuery) FirstX(ctx context.Context) *Event

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

func (*EventQuery) GroupBy added in v0.3.0

func (eq *EventQuery) GroupBy(field string, fields ...string) *EventGroupBy

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 {
	CreationTime time.Time `json:"CreationTime,omitempty"`
	Count int `json:"count,omitempty"`
}

client.Event.Query().
	GroupBy(event.FieldCreationTime).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*EventQuery) IDs added in v0.3.0

func (eq *EventQuery) IDs(ctx context.Context) ([]int, error)

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

func (*EventQuery) IDsX added in v0.3.0

func (eq *EventQuery) IDsX(ctx context.Context) []int

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

func (*EventQuery) Limit added in v0.3.0

func (eq *EventQuery) Limit(limit int) *EventQuery

Limit adds a limit step to the query.

func (*EventQuery) Offset added in v0.3.0

func (eq *EventQuery) Offset(offset int) *EventQuery

Offset adds an offset step to the query.

func (*EventQuery) Only added in v0.3.0

func (eq *EventQuery) Only(ctx context.Context) (*Event, error)

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

func (*EventQuery) OnlyID added in v0.3.0

func (eq *EventQuery) OnlyID(ctx context.Context) (id int, err error)

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

func (*EventQuery) OnlyIDX added in v0.4.3

func (eq *EventQuery) OnlyIDX(ctx context.Context) int

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

func (*EventQuery) OnlyX added in v0.3.0

func (eq *EventQuery) OnlyX(ctx context.Context) *Event

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

func (*EventQuery) Order added in v0.3.0

func (eq *EventQuery) Order(o ...OrderFunc) *EventQuery

Order adds an order step to the query.

func (*EventQuery) QueryCredential added in v0.3.0

func (eq *EventQuery) QueryCredential() *CredentialQuery

QueryCredential chains the current query on the "credential" edge.

func (*EventQuery) QueryEvent added in v0.3.0

func (eq *EventQuery) QueryEvent() *EventQuery

QueryEvent chains the current query on the "event" edge.

func (*EventQuery) QueryFile added in v0.3.0

func (eq *EventQuery) QueryFile() *FileQuery

QueryFile chains the current query on the "file" edge.

func (*EventQuery) QueryJob added in v0.3.0

func (eq *EventQuery) QueryJob() *JobQuery

QueryJob chains the current query on the "job" edge.

func (*EventQuery) QueryLikers added in v0.3.0

func (eq *EventQuery) QueryLikers() *UserQuery

QueryLikers chains the current query on the "likers" edge.

func (eq *EventQuery) QueryLink() *LinkQuery

QueryLink chains the current query on the "link" edge.

func (*EventQuery) QueryOwner added in v0.3.0

func (eq *EventQuery) QueryOwner() *UserQuery

QueryOwner chains the current query on the "owner" edge.

func (*EventQuery) QueryService added in v0.3.0

func (eq *EventQuery) QueryService() *ServiceQuery

QueryService chains the current query on the "service" edge.

func (*EventQuery) QuerySvcOwner added in v0.3.0

func (eq *EventQuery) QuerySvcOwner() *ServiceQuery

QuerySvcOwner chains the current query on the "svcOwner" edge.

func (*EventQuery) QueryTag added in v0.3.0

func (eq *EventQuery) QueryTag() *TagQuery

QueryTag chains the current query on the "tag" edge.

func (*EventQuery) QueryTarget added in v0.3.0

func (eq *EventQuery) QueryTarget() *TargetQuery

QueryTarget chains the current query on the "target" edge.

func (*EventQuery) QueryTask added in v0.3.0

func (eq *EventQuery) QueryTask() *TaskQuery

QueryTask chains the current query on the "task" edge.

func (*EventQuery) QueryUser added in v0.3.0

func (eq *EventQuery) QueryUser() *UserQuery

QueryUser chains the current query on the "user" edge.

func (*EventQuery) Select added in v0.3.0

func (eq *EventQuery) Select(fields ...string) *EventSelect

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 {
	CreationTime time.Time `json:"CreationTime,omitempty"`
}

client.Event.Query().
	Select(event.FieldCreationTime).
	Scan(ctx, &v)

func (*EventQuery) Unique added in v0.4.3

func (eq *EventQuery) Unique(unique bool) *EventQuery

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 (*EventQuery) Where added in v0.3.0

func (eq *EventQuery) Where(ps ...predicate.Event) *EventQuery

Where adds a new predicate for the EventQuery builder.

func (*EventQuery) WithCredential added in v0.3.0

func (eq *EventQuery) WithCredential(opts ...func(*CredentialQuery)) *EventQuery

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

func (*EventQuery) WithEvent added in v0.3.0

func (eq *EventQuery) WithEvent(opts ...func(*EventQuery)) *EventQuery

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

func (*EventQuery) WithFile added in v0.3.0

func (eq *EventQuery) WithFile(opts ...func(*FileQuery)) *EventQuery

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

func (*EventQuery) WithJob added in v0.3.0

func (eq *EventQuery) WithJob(opts ...func(*JobQuery)) *EventQuery

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

func (*EventQuery) WithLikers added in v0.3.0

func (eq *EventQuery) WithLikers(opts ...func(*UserQuery)) *EventQuery

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

func (eq *EventQuery) WithLink(opts ...func(*LinkQuery)) *EventQuery

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

func (*EventQuery) WithOwner added in v0.3.0

func (eq *EventQuery) WithOwner(opts ...func(*UserQuery)) *EventQuery

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

func (*EventQuery) WithService added in v0.3.0

func (eq *EventQuery) WithService(opts ...func(*ServiceQuery)) *EventQuery

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

func (*EventQuery) WithSvcOwner added in v0.3.0

func (eq *EventQuery) WithSvcOwner(opts ...func(*ServiceQuery)) *EventQuery

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

func (*EventQuery) WithTag added in v0.3.0

func (eq *EventQuery) WithTag(opts ...func(*TagQuery)) *EventQuery

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

func (*EventQuery) WithTarget added in v0.3.0

func (eq *EventQuery) WithTarget(opts ...func(*TargetQuery)) *EventQuery

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

func (*EventQuery) WithTask added in v0.3.0

func (eq *EventQuery) WithTask(opts ...func(*TaskQuery)) *EventQuery

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

func (*EventQuery) WithUser added in v0.3.0

func (eq *EventQuery) WithUser(opts ...func(*UserQuery)) *EventQuery

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

type EventSelect added in v0.3.0

type EventSelect struct {
	*EventQuery
	// contains filtered or unexported fields
}

EventSelect is the builder for selecting fields of Event entities.

func (*EventSelect) Bool added in v0.4.3

func (es *EventSelect) Bool(ctx context.Context) (_ bool, err error)

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

func (*EventSelect) BoolX added in v0.4.3

func (es *EventSelect) BoolX(ctx context.Context) bool

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

func (*EventSelect) Bools added in v0.3.0

func (es *EventSelect) Bools(ctx context.Context) ([]bool, error)

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

func (*EventSelect) BoolsX added in v0.3.0

func (es *EventSelect) BoolsX(ctx context.Context) []bool

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

func (*EventSelect) Float64 added in v0.4.3

func (es *EventSelect) Float64(ctx context.Context) (_ float64, err error)

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

func (*EventSelect) Float64X added in v0.4.3

func (es *EventSelect) Float64X(ctx context.Context) float64

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

func (*EventSelect) Float64s added in v0.3.0

func (es *EventSelect) Float64s(ctx context.Context) ([]float64, error)

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

func (*EventSelect) Float64sX added in v0.3.0

func (es *EventSelect) Float64sX(ctx context.Context) []float64

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

func (*EventSelect) Int added in v0.4.3

func (es *EventSelect) Int(ctx context.Context) (_ int, err error)

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

func (*EventSelect) IntX added in v0.4.3

func (es *EventSelect) IntX(ctx context.Context) int

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

func (*EventSelect) Ints added in v0.3.0

func (es *EventSelect) Ints(ctx context.Context) ([]int, error)

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

func (*EventSelect) IntsX added in v0.3.0

func (es *EventSelect) IntsX(ctx context.Context) []int

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

func (*EventSelect) Scan added in v0.3.0

func (es *EventSelect) Scan(ctx context.Context, v interface{}) error

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

func (*EventSelect) ScanX added in v0.3.0

func (es *EventSelect) ScanX(ctx context.Context, v interface{})

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

func (*EventSelect) String added in v0.4.3

func (es *EventSelect) String(ctx context.Context) (_ string, err error)

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

func (*EventSelect) StringX added in v0.4.3

func (es *EventSelect) StringX(ctx context.Context) string

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

func (*EventSelect) Strings added in v0.3.0

func (es *EventSelect) Strings(ctx context.Context) ([]string, error)

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

func (*EventSelect) StringsX added in v0.3.0

func (es *EventSelect) StringsX(ctx context.Context) []string

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

type EventUpdate added in v0.3.0

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

EventUpdate is the builder for updating Event entities.

func (*EventUpdate) AddLikerIDs added in v0.3.0

func (eu *EventUpdate) AddLikerIDs(ids ...int) *EventUpdate

AddLikerIDs adds the "likers" edge to the User entity by IDs.

func (*EventUpdate) AddLikers added in v0.3.0

func (eu *EventUpdate) AddLikers(u ...*User) *EventUpdate

AddLikers adds the "likers" edges to the User entity.

func (*EventUpdate) ClearCredential added in v0.3.0

func (eu *EventUpdate) ClearCredential() *EventUpdate

ClearCredential clears the "credential" edge to the Credential entity.

func (*EventUpdate) ClearEvent added in v0.3.0

func (eu *EventUpdate) ClearEvent() *EventUpdate

ClearEvent clears the "event" edge to the Event entity.

func (*EventUpdate) ClearFile added in v0.3.0

func (eu *EventUpdate) ClearFile() *EventUpdate

ClearFile clears the "file" edge to the File entity.

func (*EventUpdate) ClearJob added in v0.3.0

func (eu *EventUpdate) ClearJob() *EventUpdate

ClearJob clears the "job" edge to the Job entity.

func (*EventUpdate) ClearLikers added in v0.4.3

func (eu *EventUpdate) ClearLikers() *EventUpdate

ClearLikers clears all "likers" edges to the User entity.

func (eu *EventUpdate) ClearLink() *EventUpdate

ClearLink clears the "link" edge to the Link entity.

func (*EventUpdate) ClearOwner added in v0.3.0

func (eu *EventUpdate) ClearOwner() *EventUpdate

ClearOwner clears the "owner" edge to the User entity.

func (*EventUpdate) ClearService added in v0.3.0

func (eu *EventUpdate) ClearService() *EventUpdate

ClearService clears the "service" edge to the Service entity.

func (*EventUpdate) ClearSvcOwner added in v0.3.0

func (eu *EventUpdate) ClearSvcOwner() *EventUpdate

ClearSvcOwner clears the "svcOwner" edge to the Service entity.

func (*EventUpdate) ClearTag added in v0.3.0

func (eu *EventUpdate) ClearTag() *EventUpdate

ClearTag clears the "tag" edge to the Tag entity.

func (*EventUpdate) ClearTarget added in v0.3.0

func (eu *EventUpdate) ClearTarget() *EventUpdate

ClearTarget clears the "target" edge to the Target entity.

func (*EventUpdate) ClearTask added in v0.3.0

func (eu *EventUpdate) ClearTask() *EventUpdate

ClearTask clears the "task" edge to the Task entity.

func (*EventUpdate) ClearUser added in v0.3.0

func (eu *EventUpdate) ClearUser() *EventUpdate

ClearUser clears the "user" edge to the User entity.

func (*EventUpdate) Exec added in v0.3.0

func (eu *EventUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*EventUpdate) ExecX added in v0.3.0

func (eu *EventUpdate) ExecX(ctx context.Context)

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

func (*EventUpdate) Mutation added in v0.4.3

func (eu *EventUpdate) Mutation() *EventMutation

Mutation returns the EventMutation object of the builder.

func (*EventUpdate) RemoveLikerIDs added in v0.3.0

func (eu *EventUpdate) RemoveLikerIDs(ids ...int) *EventUpdate

RemoveLikerIDs removes the "likers" edge to User entities by IDs.

func (*EventUpdate) RemoveLikers added in v0.3.0

func (eu *EventUpdate) RemoveLikers(u ...*User) *EventUpdate

RemoveLikers removes "likers" edges to User entities.

func (*EventUpdate) Save added in v0.3.0

func (eu *EventUpdate) Save(ctx context.Context) (int, error)

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

func (*EventUpdate) SaveX added in v0.3.0

func (eu *EventUpdate) SaveX(ctx context.Context) int

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

func (*EventUpdate) SetCreationTime added in v0.3.0

func (eu *EventUpdate) SetCreationTime(t time.Time) *EventUpdate

SetCreationTime sets the "CreationTime" field.

func (*EventUpdate) SetCredential added in v0.3.0

func (eu *EventUpdate) SetCredential(c *Credential) *EventUpdate

SetCredential sets the "credential" edge to the Credential entity.

func (*EventUpdate) SetCredentialID added in v0.3.0

func (eu *EventUpdate) SetCredentialID(id int) *EventUpdate

SetCredentialID sets the "credential" edge to the Credential entity by ID.

func (*EventUpdate) SetEvent added in v0.3.0

func (eu *EventUpdate) SetEvent(e *Event) *EventUpdate

SetEvent sets the "event" edge to the Event entity.

func (*EventUpdate) SetEventID added in v0.3.0

func (eu *EventUpdate) SetEventID(id int) *EventUpdate

SetEventID sets the "event" edge to the Event entity by ID.

func (*EventUpdate) SetFile added in v0.3.0

func (eu *EventUpdate) SetFile(f *File) *EventUpdate

SetFile sets the "file" edge to the File entity.

func (*EventUpdate) SetFileID added in v0.3.0

func (eu *EventUpdate) SetFileID(id int) *EventUpdate

SetFileID sets the "file" edge to the File entity by ID.

func (*EventUpdate) SetJob added in v0.3.0

func (eu *EventUpdate) SetJob(j *Job) *EventUpdate

SetJob sets the "job" edge to the Job entity.

func (*EventUpdate) SetJobID added in v0.3.0

func (eu *EventUpdate) SetJobID(id int) *EventUpdate

SetJobID sets the "job" edge to the Job entity by ID.

func (*EventUpdate) SetKind added in v0.3.0

func (eu *EventUpdate) SetKind(e event.Kind) *EventUpdate

SetKind sets the "Kind" field.

func (eu *EventUpdate) SetLink(l *Link) *EventUpdate

SetLink sets the "link" edge to the Link entity.

func (*EventUpdate) SetLinkID added in v0.3.0

func (eu *EventUpdate) SetLinkID(id int) *EventUpdate

SetLinkID sets the "link" edge to the Link entity by ID.

func (*EventUpdate) SetNillableCreationTime added in v0.3.0

func (eu *EventUpdate) SetNillableCreationTime(t *time.Time) *EventUpdate

SetNillableCreationTime sets the "CreationTime" field if the given value is not nil.

func (*EventUpdate) SetNillableCredentialID added in v0.3.0

func (eu *EventUpdate) SetNillableCredentialID(id *int) *EventUpdate

SetNillableCredentialID sets the "credential" edge to the Credential entity by ID if the given value is not nil.

func (*EventUpdate) SetNillableEventID added in v0.3.0

func (eu *EventUpdate) SetNillableEventID(id *int) *EventUpdate

SetNillableEventID sets the "event" edge to the Event entity by ID if the given value is not nil.

func (*EventUpdate) SetNillableFileID added in v0.3.0

func (eu *EventUpdate) SetNillableFileID(id *int) *EventUpdate

SetNillableFileID sets the "file" edge to the File entity by ID if the given value is not nil.

func (*EventUpdate) SetNillableJobID added in v0.3.0

func (eu *EventUpdate) SetNillableJobID(id *int) *EventUpdate

SetNillableJobID sets the "job" edge to the Job entity by ID if the given value is not nil.

func (*EventUpdate) SetNillableLinkID added in v0.3.0

func (eu *EventUpdate) SetNillableLinkID(id *int) *EventUpdate

SetNillableLinkID sets the "link" edge to the Link entity by ID if the given value is not nil.

func (*EventUpdate) SetNillableOwnerID added in v0.3.0

func (eu *EventUpdate) SetNillableOwnerID(id *int) *EventUpdate

SetNillableOwnerID sets the "owner" edge to the User entity by ID if the given value is not nil.

func (*EventUpdate) SetNillableServiceID added in v0.3.0

func (eu *EventUpdate) SetNillableServiceID(id *int) *EventUpdate

SetNillableServiceID sets the "service" edge to the Service entity by ID if the given value is not nil.

func (*EventUpdate) SetNillableSvcOwnerID added in v0.3.0

func (eu *EventUpdate) SetNillableSvcOwnerID(id *int) *EventUpdate

SetNillableSvcOwnerID sets the "svcOwner" edge to the Service entity by ID if the given value is not nil.

func (*EventUpdate) SetNillableTagID added in v0.3.0

func (eu *EventUpdate) SetNillableTagID(id *int) *EventUpdate

SetNillableTagID sets the "tag" edge to the Tag entity by ID if the given value is not nil.

func (*EventUpdate) SetNillableTargetID added in v0.3.0

func (eu *EventUpdate) SetNillableTargetID(id *int) *EventUpdate

SetNillableTargetID sets the "target" edge to the Target entity by ID if the given value is not nil.

func (*EventUpdate) SetNillableTaskID added in v0.3.0

func (eu *EventUpdate) SetNillableTaskID(id *int) *EventUpdate

SetNillableTaskID sets the "task" edge to the Task entity by ID if the given value is not nil.

func (*EventUpdate) SetNillableUserID added in v0.3.0

func (eu *EventUpdate) SetNillableUserID(id *int) *EventUpdate

SetNillableUserID sets the "user" edge to the User entity by ID if the given value is not nil.

func (*EventUpdate) SetOwner added in v0.3.0

func (eu *EventUpdate) SetOwner(u *User) *EventUpdate

SetOwner sets the "owner" edge to the User entity.

func (*EventUpdate) SetOwnerID added in v0.3.0

func (eu *EventUpdate) SetOwnerID(id int) *EventUpdate

SetOwnerID sets the "owner" edge to the User entity by ID.

func (*EventUpdate) SetService added in v0.3.0

func (eu *EventUpdate) SetService(s *Service) *EventUpdate

SetService sets the "service" edge to the Service entity.

func (*EventUpdate) SetServiceID added in v0.3.0

func (eu *EventUpdate) SetServiceID(id int) *EventUpdate

SetServiceID sets the "service" edge to the Service entity by ID.

func (*EventUpdate) SetSvcOwner added in v0.3.0

func (eu *EventUpdate) SetSvcOwner(s *Service) *EventUpdate

SetSvcOwner sets the "svcOwner" edge to the Service entity.

func (*EventUpdate) SetSvcOwnerID added in v0.3.0

func (eu *EventUpdate) SetSvcOwnerID(id int) *EventUpdate

SetSvcOwnerID sets the "svcOwner" edge to the Service entity by ID.

func (*EventUpdate) SetTag added in v0.3.0

func (eu *EventUpdate) SetTag(t *Tag) *EventUpdate

SetTag sets the "tag" edge to the Tag entity.

func (*EventUpdate) SetTagID added in v0.3.0

func (eu *EventUpdate) SetTagID(id int) *EventUpdate

SetTagID sets the "tag" edge to the Tag entity by ID.

func (*EventUpdate) SetTarget added in v0.3.0

func (eu *EventUpdate) SetTarget(t *Target) *EventUpdate

SetTarget sets the "target" edge to the Target entity.

func (*EventUpdate) SetTargetID added in v0.3.0

func (eu *EventUpdate) SetTargetID(id int) *EventUpdate

SetTargetID sets the "target" edge to the Target entity by ID.

func (*EventUpdate) SetTask added in v0.3.0

func (eu *EventUpdate) SetTask(t *Task) *EventUpdate

SetTask sets the "task" edge to the Task entity.

func (*EventUpdate) SetTaskID added in v0.3.0

func (eu *EventUpdate) SetTaskID(id int) *EventUpdate

SetTaskID sets the "task" edge to the Task entity by ID.

func (*EventUpdate) SetUser added in v0.3.0

func (eu *EventUpdate) SetUser(u *User) *EventUpdate

SetUser sets the "user" edge to the User entity.

func (*EventUpdate) SetUserID added in v0.3.0

func (eu *EventUpdate) SetUserID(id int) *EventUpdate

SetUserID sets the "user" edge to the User entity by ID.

func (*EventUpdate) Where added in v0.3.0

func (eu *EventUpdate) Where(ps ...predicate.Event) *EventUpdate

Where appends a list predicates to the EventUpdate builder.

type EventUpdateOne added in v0.3.0

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

EventUpdateOne is the builder for updating a single Event entity.

func (*EventUpdateOne) AddLikerIDs added in v0.3.0

func (euo *EventUpdateOne) AddLikerIDs(ids ...int) *EventUpdateOne

AddLikerIDs adds the "likers" edge to the User entity by IDs.

func (*EventUpdateOne) AddLikers added in v0.3.0

func (euo *EventUpdateOne) AddLikers(u ...*User) *EventUpdateOne

AddLikers adds the "likers" edges to the User entity.

func (*EventUpdateOne) ClearCredential added in v0.3.0

func (euo *EventUpdateOne) ClearCredential() *EventUpdateOne

ClearCredential clears the "credential" edge to the Credential entity.

func (*EventUpdateOne) ClearEvent added in v0.3.0

func (euo *EventUpdateOne) ClearEvent() *EventUpdateOne

ClearEvent clears the "event" edge to the Event entity.

func (*EventUpdateOne) ClearFile added in v0.3.0

func (euo *EventUpdateOne) ClearFile() *EventUpdateOne

ClearFile clears the "file" edge to the File entity.

func (*EventUpdateOne) ClearJob added in v0.3.0

func (euo *EventUpdateOne) ClearJob() *EventUpdateOne

ClearJob clears the "job" edge to the Job entity.

func (*EventUpdateOne) ClearLikers added in v0.4.3

func (euo *EventUpdateOne) ClearLikers() *EventUpdateOne

ClearLikers clears all "likers" edges to the User entity.

func (euo *EventUpdateOne) ClearLink() *EventUpdateOne

ClearLink clears the "link" edge to the Link entity.

func (*EventUpdateOne) ClearOwner added in v0.3.0

func (euo *EventUpdateOne) ClearOwner() *EventUpdateOne

ClearOwner clears the "owner" edge to the User entity.

func (*EventUpdateOne) ClearService added in v0.3.0

func (euo *EventUpdateOne) ClearService() *EventUpdateOne

ClearService clears the "service" edge to the Service entity.

func (*EventUpdateOne) ClearSvcOwner added in v0.3.0

func (euo *EventUpdateOne) ClearSvcOwner() *EventUpdateOne

ClearSvcOwner clears the "svcOwner" edge to the Service entity.

func (*EventUpdateOne) ClearTag added in v0.3.0

func (euo *EventUpdateOne) ClearTag() *EventUpdateOne

ClearTag clears the "tag" edge to the Tag entity.

func (*EventUpdateOne) ClearTarget added in v0.3.0

func (euo *EventUpdateOne) ClearTarget() *EventUpdateOne

ClearTarget clears the "target" edge to the Target entity.

func (*EventUpdateOne) ClearTask added in v0.3.0

func (euo *EventUpdateOne) ClearTask() *EventUpdateOne

ClearTask clears the "task" edge to the Task entity.

func (*EventUpdateOne) ClearUser added in v0.3.0

func (euo *EventUpdateOne) ClearUser() *EventUpdateOne

ClearUser clears the "user" edge to the User entity.

func (*EventUpdateOne) Exec added in v0.3.0

func (euo *EventUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*EventUpdateOne) ExecX added in v0.3.0

func (euo *EventUpdateOne) ExecX(ctx context.Context)

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

func (*EventUpdateOne) Mutation added in v0.4.3

func (euo *EventUpdateOne) Mutation() *EventMutation

Mutation returns the EventMutation object of the builder.

func (*EventUpdateOne) RemoveLikerIDs added in v0.3.0

func (euo *EventUpdateOne) RemoveLikerIDs(ids ...int) *EventUpdateOne

RemoveLikerIDs removes the "likers" edge to User entities by IDs.

func (*EventUpdateOne) RemoveLikers added in v0.3.0

func (euo *EventUpdateOne) RemoveLikers(u ...*User) *EventUpdateOne

RemoveLikers removes "likers" edges to User entities.

func (*EventUpdateOne) Save added in v0.3.0

func (euo *EventUpdateOne) Save(ctx context.Context) (*Event, error)

Save executes the query and returns the updated Event entity.

func (*EventUpdateOne) SaveX added in v0.3.0

func (euo *EventUpdateOne) SaveX(ctx context.Context) *Event

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

func (*EventUpdateOne) Select added in v0.4.3

func (euo *EventUpdateOne) Select(field string, fields ...string) *EventUpdateOne

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

func (*EventUpdateOne) SetCreationTime added in v0.3.0

func (euo *EventUpdateOne) SetCreationTime(t time.Time) *EventUpdateOne

SetCreationTime sets the "CreationTime" field.

func (*EventUpdateOne) SetCredential added in v0.3.0

func (euo *EventUpdateOne) SetCredential(c *Credential) *EventUpdateOne

SetCredential sets the "credential" edge to the Credential entity.

func (*EventUpdateOne) SetCredentialID added in v0.3.0

func (euo *EventUpdateOne) SetCredentialID(id int) *EventUpdateOne

SetCredentialID sets the "credential" edge to the Credential entity by ID.

func (*EventUpdateOne) SetEvent added in v0.3.0

func (euo *EventUpdateOne) SetEvent(e *Event) *EventUpdateOne

SetEvent sets the "event" edge to the Event entity.

func (*EventUpdateOne) SetEventID added in v0.3.0

func (euo *EventUpdateOne) SetEventID(id int) *EventUpdateOne

SetEventID sets the "event" edge to the Event entity by ID.

func (*EventUpdateOne) SetFile added in v0.3.0

func (euo *EventUpdateOne) SetFile(f *File) *EventUpdateOne

SetFile sets the "file" edge to the File entity.

func (*EventUpdateOne) SetFileID added in v0.3.0

func (euo *EventUpdateOne) SetFileID(id int) *EventUpdateOne

SetFileID sets the "file" edge to the File entity by ID.

func (*EventUpdateOne) SetJob added in v0.3.0

func (euo *EventUpdateOne) SetJob(j *Job) *EventUpdateOne

SetJob sets the "job" edge to the Job entity.

func (*EventUpdateOne) SetJobID added in v0.3.0

func (euo *EventUpdateOne) SetJobID(id int) *EventUpdateOne

SetJobID sets the "job" edge to the Job entity by ID.

func (*EventUpdateOne) SetKind added in v0.3.0

func (euo *EventUpdateOne) SetKind(e event.Kind) *EventUpdateOne

SetKind sets the "Kind" field.

func (euo *EventUpdateOne) SetLink(l *Link) *EventUpdateOne

SetLink sets the "link" edge to the Link entity.

func (*EventUpdateOne) SetLinkID added in v0.3.0

func (euo *EventUpdateOne) SetLinkID(id int) *EventUpdateOne

SetLinkID sets the "link" edge to the Link entity by ID.

func (*EventUpdateOne) SetNillableCreationTime added in v0.3.0

func (euo *EventUpdateOne) SetNillableCreationTime(t *time.Time) *EventUpdateOne

SetNillableCreationTime sets the "CreationTime" field if the given value is not nil.

func (*EventUpdateOne) SetNillableCredentialID added in v0.3.0

func (euo *EventUpdateOne) SetNillableCredentialID(id *int) *EventUpdateOne

SetNillableCredentialID sets the "credential" edge to the Credential entity by ID if the given value is not nil.

func (*EventUpdateOne) SetNillableEventID added in v0.3.0

func (euo *EventUpdateOne) SetNillableEventID(id *int) *EventUpdateOne

SetNillableEventID sets the "event" edge to the Event entity by ID if the given value is not nil.

func (*EventUpdateOne) SetNillableFileID added in v0.3.0

func (euo *EventUpdateOne) SetNillableFileID(id *int) *EventUpdateOne

SetNillableFileID sets the "file" edge to the File entity by ID if the given value is not nil.

func (*EventUpdateOne) SetNillableJobID added in v0.3.0

func (euo *EventUpdateOne) SetNillableJobID(id *int) *EventUpdateOne

SetNillableJobID sets the "job" edge to the Job entity by ID if the given value is not nil.

func (*EventUpdateOne) SetNillableLinkID added in v0.3.0

func (euo *EventUpdateOne) SetNillableLinkID(id *int) *EventUpdateOne

SetNillableLinkID sets the "link" edge to the Link entity by ID if the given value is not nil.

func (*EventUpdateOne) SetNillableOwnerID added in v0.3.0

func (euo *EventUpdateOne) SetNillableOwnerID(id *int) *EventUpdateOne

SetNillableOwnerID sets the "owner" edge to the User entity by ID if the given value is not nil.

func (*EventUpdateOne) SetNillableServiceID added in v0.3.0

func (euo *EventUpdateOne) SetNillableServiceID(id *int) *EventUpdateOne

SetNillableServiceID sets the "service" edge to the Service entity by ID if the given value is not nil.

func (*EventUpdateOne) SetNillableSvcOwnerID added in v0.3.0

func (euo *EventUpdateOne) SetNillableSvcOwnerID(id *int) *EventUpdateOne

SetNillableSvcOwnerID sets the "svcOwner" edge to the Service entity by ID if the given value is not nil.

func (*EventUpdateOne) SetNillableTagID added in v0.3.0

func (euo *EventUpdateOne) SetNillableTagID(id *int) *EventUpdateOne

SetNillableTagID sets the "tag" edge to the Tag entity by ID if the given value is not nil.

func (*EventUpdateOne) SetNillableTargetID added in v0.3.0

func (euo *EventUpdateOne) SetNillableTargetID(id *int) *EventUpdateOne

SetNillableTargetID sets the "target" edge to the Target entity by ID if the given value is not nil.

func (*EventUpdateOne) SetNillableTaskID added in v0.3.0

func (euo *EventUpdateOne) SetNillableTaskID(id *int) *EventUpdateOne

SetNillableTaskID sets the "task" edge to the Task entity by ID if the given value is not nil.

func (*EventUpdateOne) SetNillableUserID added in v0.3.0

func (euo *EventUpdateOne) SetNillableUserID(id *int) *EventUpdateOne

SetNillableUserID sets the "user" edge to the User entity by ID if the given value is not nil.

func (*EventUpdateOne) SetOwner added in v0.3.0

func (euo *EventUpdateOne) SetOwner(u *User) *EventUpdateOne

SetOwner sets the "owner" edge to the User entity.

func (*EventUpdateOne) SetOwnerID added in v0.3.0

func (euo *EventUpdateOne) SetOwnerID(id int) *EventUpdateOne

SetOwnerID sets the "owner" edge to the User entity by ID.

func (*EventUpdateOne) SetService added in v0.3.0

func (euo *EventUpdateOne) SetService(s *Service) *EventUpdateOne

SetService sets the "service" edge to the Service entity.

func (*EventUpdateOne) SetServiceID added in v0.3.0

func (euo *EventUpdateOne) SetServiceID(id int) *EventUpdateOne

SetServiceID sets the "service" edge to the Service entity by ID.

func (*EventUpdateOne) SetSvcOwner added in v0.3.0

func (euo *EventUpdateOne) SetSvcOwner(s *Service) *EventUpdateOne

SetSvcOwner sets the "svcOwner" edge to the Service entity.

func (*EventUpdateOne) SetSvcOwnerID added in v0.3.0

func (euo *EventUpdateOne) SetSvcOwnerID(id int) *EventUpdateOne

SetSvcOwnerID sets the "svcOwner" edge to the Service entity by ID.

func (*EventUpdateOne) SetTag added in v0.3.0

func (euo *EventUpdateOne) SetTag(t *Tag) *EventUpdateOne

SetTag sets the "tag" edge to the Tag entity.

func (*EventUpdateOne) SetTagID added in v0.3.0

func (euo *EventUpdateOne) SetTagID(id int) *EventUpdateOne

SetTagID sets the "tag" edge to the Tag entity by ID.

func (*EventUpdateOne) SetTarget added in v0.3.0

func (euo *EventUpdateOne) SetTarget(t *Target) *EventUpdateOne

SetTarget sets the "target" edge to the Target entity.

func (*EventUpdateOne) SetTargetID added in v0.3.0

func (euo *EventUpdateOne) SetTargetID(id int) *EventUpdateOne

SetTargetID sets the "target" edge to the Target entity by ID.

func (*EventUpdateOne) SetTask added in v0.3.0

func (euo *EventUpdateOne) SetTask(t *Task) *EventUpdateOne

SetTask sets the "task" edge to the Task entity.

func (*EventUpdateOne) SetTaskID added in v0.3.0

func (euo *EventUpdateOne) SetTaskID(id int) *EventUpdateOne

SetTaskID sets the "task" edge to the Task entity by ID.

func (*EventUpdateOne) SetUser added in v0.3.0

func (euo *EventUpdateOne) SetUser(u *User) *EventUpdateOne

SetUser sets the "user" edge to the User entity.

func (*EventUpdateOne) SetUserID added in v0.3.0

func (euo *EventUpdateOne) SetUserID(id int) *EventUpdateOne

SetUserID sets the "user" edge to the User entity by ID.

type Events added in v0.3.0

type Events []*Event

Events is a parsable slice of Event.

type File added in v0.2.3

type File struct {

	// ID of the ent.
	ID int `json:"id,omitempty"`
	// Name holds the value of the "Name" field.
	// The name of the file, used to reference it for downloads
	Name string `json:"Name,omitempty"`
	// CreationTime holds the value of the "CreationTime" field.
	// The timestamp for when the File was created
	CreationTime time.Time `json:"CreationTime,omitempty"`
	// LastModifiedTime holds the value of the "LastModifiedTime" field.
	// The timestamp for when the File was last modified
	LastModifiedTime time.Time `json:"LastModifiedTime,omitempty"`
	// Size holds the value of the "Size" field.
	// The size of the file in bytes
	Size int `json:"Size,omitempty"`
	// Content holds the value of the "Content" field.
	// The content of the file
	Content []byte `json:"Content,omitempty"`
	// Hash holds the value of the "Hash" field.
	// A SHA3 digest of the content field
	Hash string `json:"Hash,omitempty"`
	// ContentType holds the value of the "ContentType" field.
	// The content type of content
	ContentType string `json:"ContentType,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the FileQuery when eager-loading is set.
	Edges FileEdges `json:"edges"`
	// contains filtered or unexported fields
}

File is the model entity for the File schema.

Example
if dsn == "" {
	return
}
ctx := context.Background()
drv, err := sql.Open("mysql", dsn)
if err != nil {
	log.Fatalf("failed creating database client: %v", err)
}
defer drv.Close()
client := NewClient(Driver(drv))
// creating vertices for the file's edges.
l0 := client.Link.
	Create().
	SetAlias("string").
	SetExpirationTime(time.Now()).
	SetClicks(1).
	SaveX(ctx)
log.Println("link created:", l0)

// create file vertex with its edges.
f := client.File.
	Create().
	SetName("string").
	SetCreationTime(time.Now()).
	SetLastModifiedTime(time.Now()).
	SetSize(1).
	SetContent(nil).
	SetHash("string").
	SetContentType("string").
	AddLinks(l0).
	SaveX(ctx)
log.Println("file created:", f)

// query edges.
l0, err = f.QueryLinks().First(ctx)
if err != nil {
	log.Fatalf("failed querying links: %v", err)
}
log.Println("links found:", l0)
Output:

func (f *File) QueryLinks() *LinkQuery

QueryLinks queries the "links" edge of the File entity.

func (*File) String added in v0.2.3

func (f *File) String() string

String implements the fmt.Stringer.

func (*File) Unwrap added in v0.2.3

func (f *File) Unwrap() *File

Unwrap unwraps the File 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 (*File) Update added in v0.2.3

func (f *File) Update() *FileUpdateOne

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

type FileClient added in v0.2.3

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

FileClient is a client for the File schema.

func NewFileClient added in v0.2.3

func NewFileClient(c config) *FileClient

NewFileClient returns a client for the File from the given config.

func (*FileClient) Create added in v0.2.3

func (c *FileClient) Create() *FileCreate

Create returns a create builder for File.

func (*FileClient) CreateBulk added in v0.4.3

func (c *FileClient) CreateBulk(builders ...*FileCreate) *FileCreateBulk

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

func (*FileClient) Delete added in v0.2.3

func (c *FileClient) Delete() *FileDelete

Delete returns a delete builder for File.

func (*FileClient) DeleteOne added in v0.2.3

func (c *FileClient) DeleteOne(f *File) *FileDeleteOne

DeleteOne returns a delete builder for the given entity.

func (*FileClient) DeleteOneID added in v0.2.3

func (c *FileClient) DeleteOneID(id int) *FileDeleteOne

DeleteOneID returns a delete builder for the given id.

func (*FileClient) Get added in v0.2.3

func (c *FileClient) Get(ctx context.Context, id int) (*File, error)

Get returns a File entity by its id.

func (*FileClient) GetX added in v0.2.3

func (c *FileClient) GetX(ctx context.Context, id int) *File

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

func (*FileClient) Hooks added in v0.4.3

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

Hooks returns the client hooks.

func (*FileClient) Query added in v0.2.3

func (c *FileClient) Query() *FileQuery

Query returns a query builder for File.

func (c *FileClient) QueryLinks(f *File) *LinkQuery

QueryLinks queries the links edge of a File.

func (*FileClient) Update added in v0.2.3

func (c *FileClient) Update() *FileUpdate

Update returns an update builder for File.

func (*FileClient) UpdateOne added in v0.2.3

func (c *FileClient) UpdateOne(f *File) *FileUpdateOne

UpdateOne returns an update builder for the given entity.

func (*FileClient) UpdateOneID added in v0.2.3

func (c *FileClient) UpdateOneID(id int) *FileUpdateOne

UpdateOneID returns an update builder for the given id.

func (*FileClient) Use added in v0.4.3

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

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

type FileCreate added in v0.2.3

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

FileCreate is the builder for creating a File entity.

func (*FileCreate) AddLinkIDs added in v0.2.3

func (fc *FileCreate) AddLinkIDs(ids ...int) *FileCreate

AddLinkIDs adds the "links" edge to the Link entity by IDs.

func (fc *FileCreate) AddLinks(l ...*Link) *FileCreate

AddLinks adds the "links" edges to the Link entity.

func (*FileCreate) Exec added in v0.4.3

func (fc *FileCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*FileCreate) ExecX added in v0.4.3

func (fc *FileCreate) ExecX(ctx context.Context)

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

func (*FileCreate) Mutation added in v0.4.3

func (fc *FileCreate) Mutation() *FileMutation

Mutation returns the FileMutation object of the builder.

func (*FileCreate) Save added in v0.2.3

func (fc *FileCreate) Save(ctx context.Context) (*File, error)

Save creates the File in the database.

func (*FileCreate) SaveX added in v0.2.3

func (fc *FileCreate) SaveX(ctx context.Context) *File

SaveX calls Save and panics if Save returns an error.

func (*FileCreate) SetContent added in v0.2.3

func (fc *FileCreate) SetContent(b []byte) *FileCreate

SetContent sets the "Content" field.

func (*FileCreate) SetContentType added in v0.2.3

func (fc *FileCreate) SetContentType(s string) *FileCreate

SetContentType sets the "ContentType" field.

func (*FileCreate) SetCreationTime added in v0.2.3

func (fc *FileCreate) SetCreationTime(t time.Time) *FileCreate

SetCreationTime sets the "CreationTime" field.

func (*FileCreate) SetHash added in v0.2.3

func (fc *FileCreate) SetHash(s string) *FileCreate

SetHash sets the "Hash" field.

func (*FileCreate) SetLastModifiedTime added in v0.2.3

func (fc *FileCreate) SetLastModifiedTime(t time.Time) *FileCreate

SetLastModifiedTime sets the "LastModifiedTime" field.

func (*FileCreate) SetName added in v0.2.3

func (fc *FileCreate) SetName(s string) *FileCreate

SetName sets the "Name" field.

func (*FileCreate) SetNillableCreationTime added in v0.2.3

func (fc *FileCreate) SetNillableCreationTime(t *time.Time) *FileCreate

SetNillableCreationTime sets the "CreationTime" field if the given value is not nil.

func (*FileCreate) SetNillableSize added in v0.2.3

func (fc *FileCreate) SetNillableSize(i *int) *FileCreate

SetNillableSize sets the "Size" field if the given value is not nil.

func (*FileCreate) SetSize added in v0.2.3

func (fc *FileCreate) SetSize(i int) *FileCreate

SetSize sets the "Size" field.

type FileCreateBulk added in v0.4.3

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

FileCreateBulk is the builder for creating many File entities in bulk.

func (*FileCreateBulk) Exec added in v0.4.3

func (fcb *FileCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*FileCreateBulk) ExecX added in v0.4.3

func (fcb *FileCreateBulk) ExecX(ctx context.Context)

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

func (*FileCreateBulk) Save added in v0.4.3

func (fcb *FileCreateBulk) Save(ctx context.Context) ([]*File, error)

Save creates the File entities in the database.

func (*FileCreateBulk) SaveX added in v0.4.3

func (fcb *FileCreateBulk) SaveX(ctx context.Context) []*File

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

type FileDelete added in v0.2.3

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

FileDelete is the builder for deleting a File entity.

func (*FileDelete) Exec added in v0.2.3

func (fd *FileDelete) Exec(ctx context.Context) (int, error)

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

func (*FileDelete) ExecX added in v0.2.3

func (fd *FileDelete) ExecX(ctx context.Context) int

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

func (*FileDelete) Where added in v0.2.3

func (fd *FileDelete) Where(ps ...predicate.File) *FileDelete

Where appends a list predicates to the FileDelete builder.

type FileDeleteOne added in v0.2.3

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

FileDeleteOne is the builder for deleting a single File entity.

func (*FileDeleteOne) Exec added in v0.2.3

func (fdo *FileDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*FileDeleteOne) ExecX added in v0.2.3

func (fdo *FileDeleteOne) ExecX(ctx context.Context)

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

type FileEdges added in v0.3.0

type FileEdges struct {
	// Links holds the value of the links edge.
	Links []*Link `json:"links,omitempty"`
	// contains filtered or unexported fields
}

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

func (FileEdges) LinksOrErr added in v0.3.0

func (e FileEdges) LinksOrErr() ([]*Link, error)

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

type FileGroupBy added in v0.2.3

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

FileGroupBy is the group-by builder for File entities.

func (*FileGroupBy) Aggregate added in v0.2.3

func (fgb *FileGroupBy) Aggregate(fns ...AggregateFunc) *FileGroupBy

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

func (*FileGroupBy) Bool added in v0.4.3

func (fgb *FileGroupBy) 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 (*FileGroupBy) BoolX added in v0.4.3

func (fgb *FileGroupBy) BoolX(ctx context.Context) bool

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

func (*FileGroupBy) Bools added in v0.2.3

func (fgb *FileGroupBy) 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 (*FileGroupBy) BoolsX added in v0.2.3

func (fgb *FileGroupBy) BoolsX(ctx context.Context) []bool

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

func (*FileGroupBy) Float64 added in v0.4.3

func (fgb *FileGroupBy) 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 (*FileGroupBy) Float64X added in v0.4.3

func (fgb *FileGroupBy) Float64X(ctx context.Context) float64

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

func (*FileGroupBy) Float64s added in v0.2.3

func (fgb *FileGroupBy) 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 (*FileGroupBy) Float64sX added in v0.2.3

func (fgb *FileGroupBy) Float64sX(ctx context.Context) []float64

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

func (*FileGroupBy) Int added in v0.4.3

func (fgb *FileGroupBy) 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 (*FileGroupBy) IntX added in v0.4.3

func (fgb *FileGroupBy) IntX(ctx context.Context) int

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

func (*FileGroupBy) Ints added in v0.2.3

func (fgb *FileGroupBy) 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 (*FileGroupBy) IntsX added in v0.2.3

func (fgb *FileGroupBy) IntsX(ctx context.Context) []int

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

func (*FileGroupBy) Scan added in v0.2.3

func (fgb *FileGroupBy) Scan(ctx context.Context, v interface{}) error

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

func (*FileGroupBy) ScanX added in v0.2.3

func (fgb *FileGroupBy) ScanX(ctx context.Context, v interface{})

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

func (*FileGroupBy) String added in v0.4.3

func (fgb *FileGroupBy) 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 (*FileGroupBy) StringX added in v0.4.3

func (fgb *FileGroupBy) StringX(ctx context.Context) string

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

func (*FileGroupBy) Strings added in v0.2.3

func (fgb *FileGroupBy) 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 (*FileGroupBy) StringsX added in v0.2.3

func (fgb *FileGroupBy) StringsX(ctx context.Context) []string

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

type FileMutation added in v0.4.3

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

FileMutation represents an operation that mutates the File nodes in the graph.

func (*FileMutation) AddField added in v0.4.3

func (m *FileMutation) 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 (*FileMutation) AddLinkIDs added in v0.4.3

func (m *FileMutation) AddLinkIDs(ids ...int)

AddLinkIDs adds the "links" edge to the Link entity by ids.

func (*FileMutation) AddSize added in v0.4.3

func (m *FileMutation) AddSize(i int)

AddSize adds i to the "Size" field.

func (*FileMutation) AddedEdges added in v0.4.3

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

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

func (*FileMutation) AddedField added in v0.4.3

func (m *FileMutation) 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 (*FileMutation) AddedFields added in v0.4.3

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

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

func (*FileMutation) AddedIDs added in v0.4.3

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

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

func (*FileMutation) AddedSize added in v0.4.3

func (m *FileMutation) AddedSize() (r int, exists bool)

AddedSize returns the value that was added to the "Size" field in this mutation.

func (*FileMutation) ClearEdge added in v0.4.3

func (m *FileMutation) 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 (*FileMutation) ClearField added in v0.4.3

func (m *FileMutation) 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 (m *FileMutation) ClearLinks()

ClearLinks clears the "links" edge to the Link entity.

func (*FileMutation) ClearedEdges added in v0.4.3

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

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

func (*FileMutation) ClearedFields added in v0.4.3

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

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

func (FileMutation) Client added in v0.4.3

func (m FileMutation) 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 (*FileMutation) Content added in v0.4.3

func (m *FileMutation) Content() (r []byte, exists bool)

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

func (*FileMutation) ContentType added in v0.4.3

func (m *FileMutation) ContentType() (r string, exists bool)

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

func (*FileMutation) CreationTime added in v0.4.3

func (m *FileMutation) CreationTime() (r time.Time, exists bool)

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

func (*FileMutation) EdgeCleared added in v0.4.3

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

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

func (*FileMutation) Field added in v0.4.3

func (m *FileMutation) 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 (*FileMutation) FieldCleared added in v0.4.3

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

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

func (*FileMutation) Fields added in v0.4.3

func (m *FileMutation) 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 (*FileMutation) Hash added in v0.4.3

func (m *FileMutation) Hash() (r string, exists bool)

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

func (*FileMutation) ID added in v0.4.3

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

func (m *FileMutation) 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 (*FileMutation) LastModifiedTime added in v0.4.3

func (m *FileMutation) LastModifiedTime() (r time.Time, exists bool)

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

func (*FileMutation) LinksCleared added in v0.4.3

func (m *FileMutation) LinksCleared() bool

LinksCleared reports if the "links" edge to the Link entity was cleared.

func (*FileMutation) LinksIDs added in v0.4.3

func (m *FileMutation) LinksIDs() (ids []int)

LinksIDs returns the "links" edge IDs in the mutation.

func (*FileMutation) Name added in v0.4.3

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

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

func (*FileMutation) OldContent added in v0.4.3

func (m *FileMutation) OldContent(ctx context.Context) (v []byte, err error)

OldContent returns the old "Content" field's value of the File entity. If the File 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 (*FileMutation) OldContentType added in v0.4.3

func (m *FileMutation) OldContentType(ctx context.Context) (v string, err error)

OldContentType returns the old "ContentType" field's value of the File entity. If the File 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 (*FileMutation) OldCreationTime added in v0.4.3

func (m *FileMutation) OldCreationTime(ctx context.Context) (v time.Time, err error)

OldCreationTime returns the old "CreationTime" field's value of the File entity. If the File 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 (*FileMutation) OldField added in v0.4.3

func (m *FileMutation) 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 (*FileMutation) OldHash added in v0.4.3

func (m *FileMutation) OldHash(ctx context.Context) (v string, err error)

OldHash returns the old "Hash" field's value of the File entity. If the File 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 (*FileMutation) OldLastModifiedTime added in v0.4.3

func (m *FileMutation) OldLastModifiedTime(ctx context.Context) (v time.Time, err error)

OldLastModifiedTime returns the old "LastModifiedTime" field's value of the File entity. If the File 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 (*FileMutation) OldName added in v0.4.3

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

OldName returns the old "Name" field's value of the File entity. If the File 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 (*FileMutation) OldSize added in v0.4.3

func (m *FileMutation) OldSize(ctx context.Context) (v int, err error)

OldSize returns the old "Size" field's value of the File entity. If the File 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 (*FileMutation) Op added in v0.4.3

func (m *FileMutation) Op() Op

Op returns the operation name.

func (*FileMutation) RemoveLinkIDs added in v0.4.3

func (m *FileMutation) RemoveLinkIDs(ids ...int)

RemoveLinkIDs removes the "links" edge to the Link entity by IDs.

func (*FileMutation) RemovedEdges added in v0.4.3

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

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

func (*FileMutation) RemovedIDs added in v0.4.3

func (m *FileMutation) 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 (*FileMutation) RemovedLinksIDs added in v0.4.3

func (m *FileMutation) RemovedLinksIDs() (ids []int)

RemovedLinks returns the removed IDs of the "links" edge to the Link entity.

func (*FileMutation) ResetContent added in v0.4.3

func (m *FileMutation) ResetContent()

ResetContent resets all changes to the "Content" field.

func (*FileMutation) ResetContentType added in v0.4.3

func (m *FileMutation) ResetContentType()

ResetContentType resets all changes to the "ContentType" field.

func (*FileMutation) ResetCreationTime added in v0.4.3

func (m *FileMutation) ResetCreationTime()

ResetCreationTime resets all changes to the "CreationTime" field.

func (*FileMutation) ResetEdge added in v0.4.3

func (m *FileMutation) 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 (*FileMutation) ResetField added in v0.4.3

func (m *FileMutation) 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 (*FileMutation) ResetHash added in v0.4.3

func (m *FileMutation) ResetHash()

ResetHash resets all changes to the "Hash" field.

func (*FileMutation) ResetLastModifiedTime added in v0.4.3

func (m *FileMutation) ResetLastModifiedTime()

ResetLastModifiedTime resets all changes to the "LastModifiedTime" field.

func (m *FileMutation) ResetLinks()

ResetLinks resets all changes to the "links" edge.

func (*FileMutation) ResetName added in v0.4.3

func (m *FileMutation) ResetName()

ResetName resets all changes to the "Name" field.

func (*FileMutation) ResetSize added in v0.4.3

func (m *FileMutation) ResetSize()

ResetSize resets all changes to the "Size" field.

func (*FileMutation) SetContent added in v0.4.3

func (m *FileMutation) SetContent(b []byte)

SetContent sets the "Content" field.

func (*FileMutation) SetContentType added in v0.4.3

func (m *FileMutation) SetContentType(s string)

SetContentType sets the "ContentType" field.

func (*FileMutation) SetCreationTime added in v0.4.3

func (m *FileMutation) SetCreationTime(t time.Time)

SetCreationTime sets the "CreationTime" field.

func (*FileMutation) SetField added in v0.4.3

func (m *FileMutation) 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 (*FileMutation) SetHash added in v0.4.3

func (m *FileMutation) SetHash(s string)

SetHash sets the "Hash" field.

func (*FileMutation) SetLastModifiedTime added in v0.4.3

func (m *FileMutation) SetLastModifiedTime(t time.Time)

SetLastModifiedTime sets the "LastModifiedTime" field.

func (*FileMutation) SetName added in v0.4.3

func (m *FileMutation) SetName(s string)

SetName sets the "Name" field.

func (*FileMutation) SetSize added in v0.4.3

func (m *FileMutation) SetSize(i int)

SetSize sets the "Size" field.

func (*FileMutation) Size added in v0.4.3

func (m *FileMutation) Size() (r int, exists bool)

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

func (FileMutation) Tx added in v0.4.3

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

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

func (*FileMutation) Type added in v0.4.3

func (m *FileMutation) Type() string

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

func (*FileMutation) Where added in v0.4.3

func (m *FileMutation) Where(ps ...predicate.File)

Where appends a list predicates to the FileMutation builder.

type FileQuery added in v0.2.3

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

FileQuery is the builder for querying File entities.

func (*FileQuery) All added in v0.2.3

func (fq *FileQuery) All(ctx context.Context) ([]*File, error)

All executes the query and returns a list of Files.

func (*FileQuery) AllX added in v0.2.3

func (fq *FileQuery) AllX(ctx context.Context) []*File

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

func (*FileQuery) Clone added in v0.2.3

func (fq *FileQuery) Clone() *FileQuery

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

func (*FileQuery) Count added in v0.2.3

func (fq *FileQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*FileQuery) CountX added in v0.2.3

func (fq *FileQuery) CountX(ctx context.Context) int

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

func (*FileQuery) Exist added in v0.2.3

func (fq *FileQuery) Exist(ctx context.Context) (bool, error)

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

func (*FileQuery) ExistX added in v0.2.3

func (fq *FileQuery) ExistX(ctx context.Context) bool

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

func (*FileQuery) First added in v0.2.3

func (fq *FileQuery) First(ctx context.Context) (*File, error)

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

func (*FileQuery) FirstID added in v0.2.3

func (fq *FileQuery) FirstID(ctx context.Context) (id int, err error)

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

func (*FileQuery) FirstIDX added in v0.4.3

func (fq *FileQuery) FirstIDX(ctx context.Context) int

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

func (*FileQuery) FirstX added in v0.2.3

func (fq *FileQuery) FirstX(ctx context.Context) *File

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

func (*FileQuery) GroupBy added in v0.2.3

func (fq *FileQuery) GroupBy(field string, fields ...string) *FileGroupBy

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.File.Query().
	GroupBy(file.FieldName).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*FileQuery) IDs added in v0.2.3

func (fq *FileQuery) IDs(ctx context.Context) ([]int, error)

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

func (*FileQuery) IDsX added in v0.2.3

func (fq *FileQuery) IDsX(ctx context.Context) []int

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

func (*FileQuery) Limit added in v0.2.3

func (fq *FileQuery) Limit(limit int) *FileQuery

Limit adds a limit step to the query.

func (*FileQuery) Offset added in v0.2.3

func (fq *FileQuery) Offset(offset int) *FileQuery

Offset adds an offset step to the query.

func (*FileQuery) Only added in v0.2.3

func (fq *FileQuery) Only(ctx context.Context) (*File, error)

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

func (*FileQuery) OnlyID added in v0.2.3

func (fq *FileQuery) OnlyID(ctx context.Context) (id int, err error)

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

func (*FileQuery) OnlyIDX added in v0.4.3

func (fq *FileQuery) OnlyIDX(ctx context.Context) int

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

func (*FileQuery) OnlyX added in v0.2.3

func (fq *FileQuery) OnlyX(ctx context.Context) *File

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

func (*FileQuery) Order added in v0.2.3

func (fq *FileQuery) Order(o ...OrderFunc) *FileQuery

Order adds an order step to the query.

func (fq *FileQuery) QueryLinks() *LinkQuery

QueryLinks chains the current query on the "links" edge.

func (*FileQuery) Select added in v0.2.3

func (fq *FileQuery) Select(fields ...string) *FileSelect

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.File.Query().
	Select(file.FieldName).
	Scan(ctx, &v)

func (*FileQuery) Unique added in v0.4.3

func (fq *FileQuery) Unique(unique bool) *FileQuery

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 (*FileQuery) Where added in v0.2.3

func (fq *FileQuery) Where(ps ...predicate.File) *FileQuery

Where adds a new predicate for the FileQuery builder.

func (fq *FileQuery) WithLinks(opts ...func(*LinkQuery)) *FileQuery

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

type FileSelect added in v0.2.3

type FileSelect struct {
	*FileQuery
	// contains filtered or unexported fields
}

FileSelect is the builder for selecting fields of File entities.

func (*FileSelect) Bool added in v0.4.3

func (fs *FileSelect) Bool(ctx context.Context) (_ bool, err error)

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

func (*FileSelect) BoolX added in v0.4.3

func (fs *FileSelect) BoolX(ctx context.Context) bool

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

func (*FileSelect) Bools added in v0.2.3

func (fs *FileSelect) Bools(ctx context.Context) ([]bool, error)

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

func (*FileSelect) BoolsX added in v0.2.3

func (fs *FileSelect) BoolsX(ctx context.Context) []bool

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

func (*FileSelect) Float64 added in v0.4.3

func (fs *FileSelect) Float64(ctx context.Context) (_ float64, err error)

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

func (*FileSelect) Float64X added in v0.4.3

func (fs *FileSelect) Float64X(ctx context.Context) float64

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

func (*FileSelect) Float64s added in v0.2.3

func (fs *FileSelect) Float64s(ctx context.Context) ([]float64, error)

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

func (*FileSelect) Float64sX added in v0.2.3

func (fs *FileSelect) Float64sX(ctx context.Context) []float64

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

func (*FileSelect) Int added in v0.4.3

func (fs *FileSelect) Int(ctx context.Context) (_ int, err error)

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

func (*FileSelect) IntX added in v0.4.3

func (fs *FileSelect) IntX(ctx context.Context) int

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

func (*FileSelect) Ints added in v0.2.3

func (fs *FileSelect) Ints(ctx context.Context) ([]int, error)

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

func (*FileSelect) IntsX added in v0.2.3

func (fs *FileSelect) IntsX(ctx context.Context) []int

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

func (*FileSelect) Scan added in v0.2.3

func (fs *FileSelect) Scan(ctx context.Context, v interface{}) error

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

func (*FileSelect) ScanX added in v0.2.3

func (fs *FileSelect) ScanX(ctx context.Context, v interface{})

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

func (*FileSelect) String added in v0.4.3

func (fs *FileSelect) String(ctx context.Context) (_ string, err error)

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

func (*FileSelect) StringX added in v0.4.3

func (fs *FileSelect) StringX(ctx context.Context) string

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

func (*FileSelect) Strings added in v0.2.3

func (fs *FileSelect) Strings(ctx context.Context) ([]string, error)

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

func (*FileSelect) StringsX added in v0.2.3

func (fs *FileSelect) StringsX(ctx context.Context) []string

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

type FileUpdate added in v0.2.3

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

FileUpdate is the builder for updating File entities.

func (*FileUpdate) AddLinkIDs added in v0.2.3

func (fu *FileUpdate) AddLinkIDs(ids ...int) *FileUpdate

AddLinkIDs adds the "links" edge to the Link entity by IDs.

func (fu *FileUpdate) AddLinks(l ...*Link) *FileUpdate

AddLinks adds the "links" edges to the Link entity.

func (*FileUpdate) AddSize added in v0.2.3

func (fu *FileUpdate) AddSize(i int) *FileUpdate

AddSize adds i to the "Size" field.

func (fu *FileUpdate) ClearLinks() *FileUpdate

ClearLinks clears all "links" edges to the Link entity.

func (*FileUpdate) Exec added in v0.2.3

func (fu *FileUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*FileUpdate) ExecX added in v0.2.3

func (fu *FileUpdate) ExecX(ctx context.Context)

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

func (*FileUpdate) Mutation added in v0.4.3

func (fu *FileUpdate) Mutation() *FileMutation

Mutation returns the FileMutation object of the builder.

func (*FileUpdate) RemoveLinkIDs added in v0.2.3

func (fu *FileUpdate) RemoveLinkIDs(ids ...int) *FileUpdate

RemoveLinkIDs removes the "links" edge to Link entities by IDs.

func (fu *FileUpdate) RemoveLinks(l ...*Link) *FileUpdate

RemoveLinks removes "links" edges to Link entities.

func (*FileUpdate) Save added in v0.2.3

func (fu *FileUpdate) Save(ctx context.Context) (int, error)

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

func (*FileUpdate) SaveX added in v0.2.3

func (fu *FileUpdate) SaveX(ctx context.Context) int

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

func (*FileUpdate) SetContent added in v0.2.3

func (fu *FileUpdate) SetContent(b []byte) *FileUpdate

SetContent sets the "Content" field.

func (*FileUpdate) SetContentType added in v0.2.3

func (fu *FileUpdate) SetContentType(s string) *FileUpdate

SetContentType sets the "ContentType" field.

func (*FileUpdate) SetCreationTime added in v0.2.3

func (fu *FileUpdate) SetCreationTime(t time.Time) *FileUpdate

SetCreationTime sets the "CreationTime" field.

func (*FileUpdate) SetHash added in v0.2.3

func (fu *FileUpdate) SetHash(s string) *FileUpdate

SetHash sets the "Hash" field.

func (*FileUpdate) SetLastModifiedTime added in v0.2.3

func (fu *FileUpdate) SetLastModifiedTime(t time.Time) *FileUpdate

SetLastModifiedTime sets the "LastModifiedTime" field.

func (*FileUpdate) SetName added in v0.2.3

func (fu *FileUpdate) SetName(s string) *FileUpdate

SetName sets the "Name" field.

func (*FileUpdate) SetNillableCreationTime added in v0.2.3

func (fu *FileUpdate) SetNillableCreationTime(t *time.Time) *FileUpdate

SetNillableCreationTime sets the "CreationTime" field if the given value is not nil.

func (*FileUpdate) SetNillableSize added in v0.2.3

func (fu *FileUpdate) SetNillableSize(i *int) *FileUpdate

SetNillableSize sets the "Size" field if the given value is not nil.

func (*FileUpdate) SetSize added in v0.2.3

func (fu *FileUpdate) SetSize(i int) *FileUpdate

SetSize sets the "Size" field.

func (*FileUpdate) Where added in v0.2.3

func (fu *FileUpdate) Where(ps ...predicate.File) *FileUpdate

Where appends a list predicates to the FileUpdate builder.

type FileUpdateOne added in v0.2.3

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

FileUpdateOne is the builder for updating a single File entity.

func (*FileUpdateOne) AddLinkIDs added in v0.2.3

func (fuo *FileUpdateOne) AddLinkIDs(ids ...int) *FileUpdateOne

AddLinkIDs adds the "links" edge to the Link entity by IDs.

func (fuo *FileUpdateOne) AddLinks(l ...*Link) *FileUpdateOne

AddLinks adds the "links" edges to the Link entity.

func (*FileUpdateOne) AddSize added in v0.2.3

func (fuo *FileUpdateOne) AddSize(i int) *FileUpdateOne

AddSize adds i to the "Size" field.

func (fuo *FileUpdateOne) ClearLinks() *FileUpdateOne

ClearLinks clears all "links" edges to the Link entity.

func (*FileUpdateOne) Exec added in v0.2.3

func (fuo *FileUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*FileUpdateOne) ExecX added in v0.2.3

func (fuo *FileUpdateOne) ExecX(ctx context.Context)

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

func (*FileUpdateOne) Mutation added in v0.4.3

func (fuo *FileUpdateOne) Mutation() *FileMutation

Mutation returns the FileMutation object of the builder.

func (*FileUpdateOne) RemoveLinkIDs added in v0.2.3

func (fuo *FileUpdateOne) RemoveLinkIDs(ids ...int) *FileUpdateOne

RemoveLinkIDs removes the "links" edge to Link entities by IDs.

func (fuo *FileUpdateOne) RemoveLinks(l ...*Link) *FileUpdateOne

RemoveLinks removes "links" edges to Link entities.

func (*FileUpdateOne) Save added in v0.2.3

func (fuo *FileUpdateOne) Save(ctx context.Context) (*File, error)

Save executes the query and returns the updated File entity.

func (*FileUpdateOne) SaveX added in v0.2.3

func (fuo *FileUpdateOne) SaveX(ctx context.Context) *File

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

func (*FileUpdateOne) Select added in v0.4.3

func (fuo *FileUpdateOne) Select(field string, fields ...string) *FileUpdateOne

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

func (*FileUpdateOne) SetContent added in v0.2.3

func (fuo *FileUpdateOne) SetContent(b []byte) *FileUpdateOne

SetContent sets the "Content" field.

func (*FileUpdateOne) SetContentType added in v0.2.3

func (fuo *FileUpdateOne) SetContentType(s string) *FileUpdateOne

SetContentType sets the "ContentType" field.

func (*FileUpdateOne) SetCreationTime added in v0.2.3

func (fuo *FileUpdateOne) SetCreationTime(t time.Time) *FileUpdateOne

SetCreationTime sets the "CreationTime" field.

func (*FileUpdateOne) SetHash added in v0.2.3

func (fuo *FileUpdateOne) SetHash(s string) *FileUpdateOne

SetHash sets the "Hash" field.

func (*FileUpdateOne) SetLastModifiedTime added in v0.2.3

func (fuo *FileUpdateOne) SetLastModifiedTime(t time.Time) *FileUpdateOne

SetLastModifiedTime sets the "LastModifiedTime" field.

func (*FileUpdateOne) SetName added in v0.2.3

func (fuo *FileUpdateOne) SetName(s string) *FileUpdateOne

SetName sets the "Name" field.

func (*FileUpdateOne) SetNillableCreationTime added in v0.2.3

func (fuo *FileUpdateOne) SetNillableCreationTime(t *time.Time) *FileUpdateOne

SetNillableCreationTime sets the "CreationTime" field if the given value is not nil.

func (*FileUpdateOne) SetNillableSize added in v0.2.3

func (fuo *FileUpdateOne) SetNillableSize(i *int) *FileUpdateOne

SetNillableSize sets the "Size" field if the given value is not nil.

func (*FileUpdateOne) SetSize added in v0.2.3

func (fuo *FileUpdateOne) SetSize(i int) *FileUpdateOne

SetSize sets the "Size" field.

type Files added in v0.2.3

type Files []*File

Files is a parsable slice of File.

type Hook added in v0.4.3

type Hook = ent.Hook

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

type Job

type Job struct {

	// ID of the ent.
	ID int `json:"id,omitempty"`
	// Name holds the value of the "Name" field.
	// The name of the job
	Name string `json:"Name,omitempty"`
	// CreationTime holds the value of the "CreationTime" field.
	// The timestamp for when the Job was created
	CreationTime time.Time `json:"CreationTime,omitempty"`
	// Content holds the value of the "Content" field.
	// The content of the job (usually a Renegade Script)
	Content string `json:"Content,omitempty"`
	// Staged holds the value of the "Staged" field.
	// The boolean that represents if a job's tasks shall be emitted/returned from claimTasks (false means yes)
	Staged bool `json:"Staged,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the JobQuery when eager-loading is set.
	Edges JobEdges `json:"edges"`
	// contains filtered or unexported fields
}

Job is the model entity for the Job schema.

Example
if dsn == "" {
	return
}
ctx := context.Background()
drv, err := sql.Open("mysql", dsn)
if err != nil {
	log.Fatalf("failed creating database client: %v", err)
}
defer drv.Close()
client := NewClient(Driver(drv))
// creating vertices for the job's edges.
t0 := client.Task.
	Create().
	SetQueueTime(time.Now()).
	SetLastChangedTime(time.Now()).
	SetClaimTime(time.Now()).
	SetExecStartTime(time.Now()).
	SetExecStopTime(time.Now()).
	SetContent("string").
	SetOutput("string").
	SetError("string").
	SetSessionID("string").
	SaveX(ctx)
log.Println("task created:", t0)
t1 := client.Tag.
	Create().
	SetName("string").
	SaveX(ctx)
log.Println("tag created:", t1)
j3 := client.Job.
	Create().
	SetName("string").
	SetCreationTime(time.Now()).
	SetContent("string").
	SetStaged(true).
	SaveX(ctx)
log.Println("job created:", j3)

// create job vertex with its edges.
j := client.Job.
	Create().
	SetName("string").
	SetCreationTime(time.Now()).
	SetContent("string").
	SetStaged(true).
	AddTasks(t0).
	AddTags(t1).
	SetNext(j3).
	SaveX(ctx)
log.Println("job created:", j)

// query edges.
t0, err = j.QueryTasks().First(ctx)
if err != nil {
	log.Fatalf("failed querying tasks: %v", err)
}
log.Println("tasks found:", t0)

t1, err = j.QueryTags().First(ctx)
if err != nil {
	log.Fatalf("failed querying tags: %v", err)
}
log.Println("tags found:", t1)

j3, err = j.QueryNext().First(ctx)
if err != nil {
	log.Fatalf("failed querying next: %v", err)
}
log.Println("next found:", j3)
Output:

func (*Job) QueryNext

func (j *Job) QueryNext() *JobQuery

QueryNext queries the "next" edge of the Job entity.

func (*Job) QueryOwner added in v0.3.0

func (j *Job) QueryOwner() *UserQuery

QueryOwner queries the "owner" edge of the Job entity.

func (*Job) QueryPrev

func (j *Job) QueryPrev() *JobQuery

QueryPrev queries the "prev" edge of the Job entity.

func (*Job) QueryTags

func (j *Job) QueryTags() *TagQuery

QueryTags queries the "tags" edge of the Job entity.

func (*Job) QueryTasks

func (j *Job) QueryTasks() *TaskQuery

QueryTasks queries the "tasks" edge of the Job entity.

func (*Job) String

func (j *Job) String() string

String implements the fmt.Stringer.

func (*Job) Unwrap

func (j *Job) Unwrap() *Job

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

func (j *Job) Update() *JobUpdateOne

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

type JobClient

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

JobClient is a client for the Job schema.

func NewJobClient

func NewJobClient(c config) *JobClient

NewJobClient returns a client for the Job from the given config.

func (*JobClient) Create

func (c *JobClient) Create() *JobCreate

Create returns a create builder for Job.

func (*JobClient) CreateBulk added in v0.4.3

func (c *JobClient) CreateBulk(builders ...*JobCreate) *JobCreateBulk

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

func (*JobClient) Delete

func (c *JobClient) Delete() *JobDelete

Delete returns a delete builder for Job.

func (*JobClient) DeleteOne

func (c *JobClient) DeleteOne(j *Job) *JobDeleteOne

DeleteOne returns a delete builder for the given entity.

func (*JobClient) DeleteOneID

func (c *JobClient) DeleteOneID(id int) *JobDeleteOne

DeleteOneID returns a delete builder for the given id.

func (*JobClient) Get

func (c *JobClient) Get(ctx context.Context, id int) (*Job, error)

Get returns a Job entity by its id.

func (*JobClient) GetX

func (c *JobClient) GetX(ctx context.Context, id int) *Job

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

func (*JobClient) Hooks added in v0.4.3

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

Hooks returns the client hooks.

func (*JobClient) Query

func (c *JobClient) Query() *JobQuery

Query returns a query builder for Job.

func (*JobClient) QueryNext

func (c *JobClient) QueryNext(j *Job) *JobQuery

QueryNext queries the next edge of a Job.

func (*JobClient) QueryOwner added in v0.3.0

func (c *JobClient) QueryOwner(j *Job) *UserQuery

QueryOwner queries the owner edge of a Job.

func (*JobClient) QueryPrev

func (c *JobClient) QueryPrev(j *Job) *JobQuery

QueryPrev queries the prev edge of a Job.

func (*JobClient) QueryTags

func (c *JobClient) QueryTags(j *Job) *TagQuery

QueryTags queries the tags edge of a Job.

func (*JobClient) QueryTasks

func (c *JobClient) QueryTasks(j *Job) *TaskQuery

QueryTasks queries the tasks edge of a Job.

func (*JobClient) Update

func (c *JobClient) Update() *JobUpdate

Update returns an update builder for Job.

func (*JobClient) UpdateOne

func (c *JobClient) UpdateOne(j *Job) *JobUpdateOne

UpdateOne returns an update builder for the given entity.

func (*JobClient) UpdateOneID

func (c *JobClient) UpdateOneID(id int) *JobUpdateOne

UpdateOneID returns an update builder for the given id.

func (*JobClient) Use added in v0.4.3

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

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

type JobCreate

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

JobCreate is the builder for creating a Job entity.

func (*JobCreate) AddTagIDs

func (jc *JobCreate) AddTagIDs(ids ...int) *JobCreate

AddTagIDs adds the "tags" edge to the Tag entity by IDs.

func (*JobCreate) AddTags

func (jc *JobCreate) AddTags(t ...*Tag) *JobCreate

AddTags adds the "tags" edges to the Tag entity.

func (*JobCreate) AddTaskIDs

func (jc *JobCreate) AddTaskIDs(ids ...int) *JobCreate

AddTaskIDs adds the "tasks" edge to the Task entity by IDs.

func (*JobCreate) AddTasks

func (jc *JobCreate) AddTasks(t ...*Task) *JobCreate

AddTasks adds the "tasks" edges to the Task entity.

func (*JobCreate) Exec added in v0.4.3

func (jc *JobCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*JobCreate) ExecX added in v0.4.3

func (jc *JobCreate) ExecX(ctx context.Context)

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

func (*JobCreate) Mutation added in v0.4.3

func (jc *JobCreate) Mutation() *JobMutation

Mutation returns the JobMutation object of the builder.

func (*JobCreate) Save

func (jc *JobCreate) Save(ctx context.Context) (*Job, error)

Save creates the Job in the database.

func (*JobCreate) SaveX

func (jc *JobCreate) SaveX(ctx context.Context) *Job

SaveX calls Save and panics if Save returns an error.

func (*JobCreate) SetContent

func (jc *JobCreate) SetContent(s string) *JobCreate

SetContent sets the "Content" field.

func (*JobCreate) SetCreationTime

func (jc *JobCreate) SetCreationTime(t time.Time) *JobCreate

SetCreationTime sets the "CreationTime" field.

func (*JobCreate) SetName

func (jc *JobCreate) SetName(s string) *JobCreate

SetName sets the "Name" field.

func (*JobCreate) SetNext

func (jc *JobCreate) SetNext(j *Job) *JobCreate

SetNext sets the "next" edge to the Job entity.

func (*JobCreate) SetNextID

func (jc *JobCreate) SetNextID(id int) *JobCreate

SetNextID sets the "next" edge to the Job entity by ID.

func (*JobCreate) SetNillableCreationTime

func (jc *JobCreate) SetNillableCreationTime(t *time.Time) *JobCreate

SetNillableCreationTime sets the "CreationTime" field if the given value is not nil.

func (*JobCreate) SetNillableNextID

func (jc *JobCreate) SetNillableNextID(id *int) *JobCreate

SetNillableNextID sets the "next" edge to the Job entity by ID if the given value is not nil.

func (*JobCreate) SetNillablePrevID

func (jc *JobCreate) SetNillablePrevID(id *int) *JobCreate

SetNillablePrevID sets the "prev" edge to the Job entity by ID if the given value is not nil.

func (*JobCreate) SetOwner added in v0.3.0

func (jc *JobCreate) SetOwner(u *User) *JobCreate

SetOwner sets the "owner" edge to the User entity.

func (*JobCreate) SetOwnerID added in v0.3.0

func (jc *JobCreate) SetOwnerID(id int) *JobCreate

SetOwnerID sets the "owner" edge to the User entity by ID.

func (*JobCreate) SetPrev

func (jc *JobCreate) SetPrev(j *Job) *JobCreate

SetPrev sets the "prev" edge to the Job entity.

func (*JobCreate) SetPrevID

func (jc *JobCreate) SetPrevID(id int) *JobCreate

SetPrevID sets the "prev" edge to the Job entity by ID.

func (*JobCreate) SetStaged added in v0.3.0

func (jc *JobCreate) SetStaged(b bool) *JobCreate

SetStaged sets the "Staged" field.

type JobCreateBulk added in v0.4.3

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

JobCreateBulk is the builder for creating many Job entities in bulk.

func (*JobCreateBulk) Exec added in v0.4.3

func (jcb *JobCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*JobCreateBulk) ExecX added in v0.4.3

func (jcb *JobCreateBulk) ExecX(ctx context.Context)

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

func (*JobCreateBulk) Save added in v0.4.3

func (jcb *JobCreateBulk) Save(ctx context.Context) ([]*Job, error)

Save creates the Job entities in the database.

func (*JobCreateBulk) SaveX added in v0.4.3

func (jcb *JobCreateBulk) SaveX(ctx context.Context) []*Job

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

type JobDelete

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

JobDelete is the builder for deleting a Job entity.

func (*JobDelete) Exec

func (jd *JobDelete) Exec(ctx context.Context) (int, error)

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

func (*JobDelete) ExecX

func (jd *JobDelete) ExecX(ctx context.Context) int

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

func (*JobDelete) Where

func (jd *JobDelete) Where(ps ...predicate.Job) *JobDelete

Where appends a list predicates to the JobDelete builder.

type JobDeleteOne

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

JobDeleteOne is the builder for deleting a single Job entity.

func (*JobDeleteOne) Exec

func (jdo *JobDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*JobDeleteOne) ExecX

func (jdo *JobDeleteOne) ExecX(ctx context.Context)

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

type JobEdges added in v0.3.0

type JobEdges struct {
	// Tasks holds the value of the tasks edge.
	Tasks []*Task `json:"tasks,omitempty"`
	// Tags holds the value of the tags edge.
	Tags []*Tag `json:"tags,omitempty"`
	// Prev holds the value of the prev edge.
	Prev *Job `json:"prev,omitempty"`
	// Next holds the value of the next edge.
	Next *Job `json:"next,omitempty"`
	// Owner holds the value of the owner edge.
	Owner *User `json:"owner,omitempty"`
	// contains filtered or unexported fields
}

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

func (JobEdges) NextOrErr added in v0.3.0

func (e JobEdges) NextOrErr() (*Job, error)

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

func (JobEdges) OwnerOrErr added in v0.3.0

func (e JobEdges) OwnerOrErr() (*User, error)

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

func (JobEdges) PrevOrErr added in v0.3.0

func (e JobEdges) PrevOrErr() (*Job, error)

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

func (JobEdges) TagsOrErr added in v0.3.0

func (e JobEdges) TagsOrErr() ([]*Tag, error)

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

func (JobEdges) TasksOrErr added in v0.3.0

func (e JobEdges) TasksOrErr() ([]*Task, error)

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

type JobGroupBy

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

JobGroupBy is the group-by builder for Job entities.

func (*JobGroupBy) Aggregate

func (jgb *JobGroupBy) Aggregate(fns ...AggregateFunc) *JobGroupBy

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

func (*JobGroupBy) Bool added in v0.4.3

func (jgb *JobGroupBy) 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 (*JobGroupBy) BoolX added in v0.4.3

func (jgb *JobGroupBy) BoolX(ctx context.Context) bool

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

func (*JobGroupBy) Bools

func (jgb *JobGroupBy) 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 (*JobGroupBy) BoolsX

func (jgb *JobGroupBy) BoolsX(ctx context.Context) []bool

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

func (*JobGroupBy) Float64 added in v0.4.3

func (jgb *JobGroupBy) 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 (*JobGroupBy) Float64X added in v0.4.3

func (jgb *JobGroupBy) Float64X(ctx context.Context) float64

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

func (*JobGroupBy) Float64s

func (jgb *JobGroupBy) 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 (*JobGroupBy) Float64sX

func (jgb *JobGroupBy) Float64sX(ctx context.Context) []float64

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

func (*JobGroupBy) Int added in v0.4.3

func (jgb *JobGroupBy) 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 (*JobGroupBy) IntX added in v0.4.3

func (jgb *JobGroupBy) IntX(ctx context.Context) int

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

func (*JobGroupBy) Ints

func (jgb *JobGroupBy) 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 (*JobGroupBy) IntsX

func (jgb *JobGroupBy) IntsX(ctx context.Context) []int

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

func (*JobGroupBy) Scan

func (jgb *JobGroupBy) Scan(ctx context.Context, v interface{}) error

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

func (*JobGroupBy) ScanX

func (jgb *JobGroupBy) ScanX(ctx context.Context, v interface{})

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

func (*JobGroupBy) String added in v0.4.3

func (jgb *JobGroupBy) 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 (*JobGroupBy) StringX added in v0.4.3

func (jgb *JobGroupBy) StringX(ctx context.Context) string

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

func (*JobGroupBy) Strings

func (jgb *JobGroupBy) 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 (*JobGroupBy) StringsX

func (jgb *JobGroupBy) StringsX(ctx context.Context) []string

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

type JobMutation added in v0.4.3

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

JobMutation represents an operation that mutates the Job nodes in the graph.

func (*JobMutation) AddField added in v0.4.3

func (m *JobMutation) 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 (*JobMutation) AddTagIDs added in v0.4.3

func (m *JobMutation) AddTagIDs(ids ...int)

AddTagIDs adds the "tags" edge to the Tag entity by ids.

func (*JobMutation) AddTaskIDs added in v0.4.3

func (m *JobMutation) AddTaskIDs(ids ...int)

AddTaskIDs adds the "tasks" edge to the Task entity by ids.

func (*JobMutation) AddedEdges added in v0.4.3

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

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

func (*JobMutation) AddedField added in v0.4.3

func (m *JobMutation) 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 (*JobMutation) AddedFields added in v0.4.3

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

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

func (*JobMutation) AddedIDs added in v0.4.3

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

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

func (*JobMutation) ClearEdge added in v0.4.3

func (m *JobMutation) 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 (*JobMutation) ClearField added in v0.4.3

func (m *JobMutation) 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 (*JobMutation) ClearNext added in v0.4.3

func (m *JobMutation) ClearNext()

ClearNext clears the "next" edge to the Job entity.

func (*JobMutation) ClearOwner added in v0.4.3

func (m *JobMutation) ClearOwner()

ClearOwner clears the "owner" edge to the User entity.

func (*JobMutation) ClearPrev added in v0.4.3

func (m *JobMutation) ClearPrev()

ClearPrev clears the "prev" edge to the Job entity.

func (*JobMutation) ClearTags added in v0.4.3

func (m *JobMutation) ClearTags()

ClearTags clears the "tags" edge to the Tag entity.

func (*JobMutation) ClearTasks added in v0.4.3

func (m *JobMutation) ClearTasks()

ClearTasks clears the "tasks" edge to the Task entity.

func (*JobMutation) ClearedEdges added in v0.4.3

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

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

func (*JobMutation) ClearedFields added in v0.4.3

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

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

func (JobMutation) Client added in v0.4.3

func (m JobMutation) 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 (*JobMutation) Content added in v0.4.3

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

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

func (*JobMutation) CreationTime added in v0.4.3

func (m *JobMutation) CreationTime() (r time.Time, exists bool)

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

func (*JobMutation) EdgeCleared added in v0.4.3

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

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

func (*JobMutation) Field added in v0.4.3

func (m *JobMutation) 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 (*JobMutation) FieldCleared added in v0.4.3

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

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

func (*JobMutation) Fields added in v0.4.3

func (m *JobMutation) 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 (*JobMutation) ID added in v0.4.3

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

func (m *JobMutation) 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 (*JobMutation) Name added in v0.4.3

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

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

func (*JobMutation) NextCleared added in v0.4.3

func (m *JobMutation) NextCleared() bool

NextCleared reports if the "next" edge to the Job entity was cleared.

func (*JobMutation) NextID added in v0.4.3

func (m *JobMutation) NextID() (id int, exists bool)

NextID returns the "next" edge ID in the mutation.

func (*JobMutation) NextIDs added in v0.4.3

func (m *JobMutation) NextIDs() (ids []int)

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

func (*JobMutation) OldContent added in v0.4.3

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

OldContent returns the old "Content" field's value of the Job entity. If the Job 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 (*JobMutation) OldCreationTime added in v0.4.3

func (m *JobMutation) OldCreationTime(ctx context.Context) (v time.Time, err error)

OldCreationTime returns the old "CreationTime" field's value of the Job entity. If the Job 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 (*JobMutation) OldField added in v0.4.3

func (m *JobMutation) 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 (*JobMutation) OldName added in v0.4.3

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

OldName returns the old "Name" field's value of the Job entity. If the Job 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 (*JobMutation) OldStaged added in v0.4.3

func (m *JobMutation) OldStaged(ctx context.Context) (v bool, err error)

OldStaged returns the old "Staged" field's value of the Job entity. If the Job 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 (*JobMutation) Op added in v0.4.3

func (m *JobMutation) Op() Op

Op returns the operation name.

func (*JobMutation) OwnerCleared added in v0.4.3

func (m *JobMutation) OwnerCleared() bool

OwnerCleared reports if the "owner" edge to the User entity was cleared.

func (*JobMutation) OwnerID added in v0.4.3

func (m *JobMutation) OwnerID() (id int, exists bool)

OwnerID returns the "owner" edge ID in the mutation.

func (*JobMutation) OwnerIDs added in v0.4.3

func (m *JobMutation) OwnerIDs() (ids []int)

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

func (*JobMutation) PrevCleared added in v0.4.3

func (m *JobMutation) PrevCleared() bool

PrevCleared reports if the "prev" edge to the Job entity was cleared.

func (*JobMutation) PrevID added in v0.4.3

func (m *JobMutation) PrevID() (id int, exists bool)

PrevID returns the "prev" edge ID in the mutation.

func (*JobMutation) PrevIDs added in v0.4.3

func (m *JobMutation) PrevIDs() (ids []int)

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

func (*JobMutation) RemoveTagIDs added in v0.4.3

func (m *JobMutation) RemoveTagIDs(ids ...int)

RemoveTagIDs removes the "tags" edge to the Tag entity by IDs.

func (*JobMutation) RemoveTaskIDs added in v0.4.3

func (m *JobMutation) RemoveTaskIDs(ids ...int)

RemoveTaskIDs removes the "tasks" edge to the Task entity by IDs.

func (*JobMutation) RemovedEdges added in v0.4.3

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

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

func (*JobMutation) RemovedIDs added in v0.4.3

func (m *JobMutation) 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 (*JobMutation) RemovedTagsIDs added in v0.4.3

func (m *JobMutation) RemovedTagsIDs() (ids []int)

RemovedTags returns the removed IDs of the "tags" edge to the Tag entity.

func (*JobMutation) RemovedTasksIDs added in v0.4.3

func (m *JobMutation) RemovedTasksIDs() (ids []int)

RemovedTasks returns the removed IDs of the "tasks" edge to the Task entity.

func (*JobMutation) ResetContent added in v0.4.3

func (m *JobMutation) ResetContent()

ResetContent resets all changes to the "Content" field.

func (*JobMutation) ResetCreationTime added in v0.4.3

func (m *JobMutation) ResetCreationTime()

ResetCreationTime resets all changes to the "CreationTime" field.

func (*JobMutation) ResetEdge added in v0.4.3

func (m *JobMutation) 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 (*JobMutation) ResetField added in v0.4.3

func (m *JobMutation) 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 (*JobMutation) ResetName added in v0.4.3

func (m *JobMutation) ResetName()

ResetName resets all changes to the "Name" field.

func (*JobMutation) ResetNext added in v0.4.3

func (m *JobMutation) ResetNext()

ResetNext resets all changes to the "next" edge.

func (*JobMutation) ResetOwner added in v0.4.3

func (m *JobMutation) ResetOwner()

ResetOwner resets all changes to the "owner" edge.

func (*JobMutation) ResetPrev added in v0.4.3

func (m *JobMutation) ResetPrev()

ResetPrev resets all changes to the "prev" edge.

func (*JobMutation) ResetStaged added in v0.4.3

func (m *JobMutation) ResetStaged()

ResetStaged resets all changes to the "Staged" field.

func (*JobMutation) ResetTags added in v0.4.3

func (m *JobMutation) ResetTags()

ResetTags resets all changes to the "tags" edge.

func (*JobMutation) ResetTasks added in v0.4.3

func (m *JobMutation) ResetTasks()

ResetTasks resets all changes to the "tasks" edge.

func (*JobMutation) SetContent added in v0.4.3

func (m *JobMutation) SetContent(s string)

SetContent sets the "Content" field.

func (*JobMutation) SetCreationTime added in v0.4.3

func (m *JobMutation) SetCreationTime(t time.Time)

SetCreationTime sets the "CreationTime" field.

func (*JobMutation) SetField added in v0.4.3

func (m *JobMutation) 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 (*JobMutation) SetName added in v0.4.3

func (m *JobMutation) SetName(s string)

SetName sets the "Name" field.

func (*JobMutation) SetNextID added in v0.4.3

func (m *JobMutation) SetNextID(id int)

SetNextID sets the "next" edge to the Job entity by id.

func (*JobMutation) SetOwnerID added in v0.4.3

func (m *JobMutation) SetOwnerID(id int)

SetOwnerID sets the "owner" edge to the User entity by id.

func (*JobMutation) SetPrevID added in v0.4.3

func (m *JobMutation) SetPrevID(id int)

SetPrevID sets the "prev" edge to the Job entity by id.

func (*JobMutation) SetStaged added in v0.4.3

func (m *JobMutation) SetStaged(b bool)

SetStaged sets the "Staged" field.

func (*JobMutation) Staged added in v0.4.3

func (m *JobMutation) Staged() (r bool, exists bool)

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

func (*JobMutation) TagsCleared added in v0.4.3

func (m *JobMutation) TagsCleared() bool

TagsCleared reports if the "tags" edge to the Tag entity was cleared.

func (*JobMutation) TagsIDs added in v0.4.3

func (m *JobMutation) TagsIDs() (ids []int)

TagsIDs returns the "tags" edge IDs in the mutation.

func (*JobMutation) TasksCleared added in v0.4.3

func (m *JobMutation) TasksCleared() bool

TasksCleared reports if the "tasks" edge to the Task entity was cleared.

func (*JobMutation) TasksIDs added in v0.4.3

func (m *JobMutation) TasksIDs() (ids []int)

TasksIDs returns the "tasks" edge IDs in the mutation.

func (JobMutation) Tx added in v0.4.3

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

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

func (*JobMutation) Type added in v0.4.3

func (m *JobMutation) Type() string

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

func (*JobMutation) Where added in v0.4.3

func (m *JobMutation) Where(ps ...predicate.Job)

Where appends a list predicates to the JobMutation builder.

type JobQuery

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

JobQuery is the builder for querying Job entities.

func (*JobQuery) All

func (jq *JobQuery) All(ctx context.Context) ([]*Job, error)

All executes the query and returns a list of Jobs.

func (*JobQuery) AllX

func (jq *JobQuery) AllX(ctx context.Context) []*Job

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

func (*JobQuery) Clone

func (jq *JobQuery) Clone() *JobQuery

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

func (*JobQuery) Count

func (jq *JobQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*JobQuery) CountX

func (jq *JobQuery) CountX(ctx context.Context) int

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

func (*JobQuery) Exist

func (jq *JobQuery) Exist(ctx context.Context) (bool, error)

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

func (*JobQuery) ExistX

func (jq *JobQuery) ExistX(ctx context.Context) bool

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

func (*JobQuery) First

func (jq *JobQuery) First(ctx context.Context) (*Job, error)

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

func (*JobQuery) FirstID

func (jq *JobQuery) FirstID(ctx context.Context) (id int, err error)

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

func (*JobQuery) FirstIDX added in v0.4.3

func (jq *JobQuery) FirstIDX(ctx context.Context) int

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

func (*JobQuery) FirstX

func (jq *JobQuery) FirstX(ctx context.Context) *Job

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

func (*JobQuery) GroupBy

func (jq *JobQuery) GroupBy(field string, fields ...string) *JobGroupBy

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.Job.Query().
	GroupBy(job.FieldName).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*JobQuery) IDs

func (jq *JobQuery) IDs(ctx context.Context) ([]int, error)

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

func (*JobQuery) IDsX

func (jq *JobQuery) IDsX(ctx context.Context) []int

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

func (*JobQuery) Limit

func (jq *JobQuery) Limit(limit int) *JobQuery

Limit adds a limit step to the query.

func (*JobQuery) Offset

func (jq *JobQuery) Offset(offset int) *JobQuery

Offset adds an offset step to the query.

func (*JobQuery) Only

func (jq *JobQuery) Only(ctx context.Context) (*Job, error)

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

func (*JobQuery) OnlyID

func (jq *JobQuery) OnlyID(ctx context.Context) (id int, err error)

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

func (*JobQuery) OnlyIDX added in v0.4.3

func (jq *JobQuery) OnlyIDX(ctx context.Context) int

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

func (*JobQuery) OnlyX

func (jq *JobQuery) OnlyX(ctx context.Context) *Job

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

func (*JobQuery) Order

func (jq *JobQuery) Order(o ...OrderFunc) *JobQuery

Order adds an order step to the query.

func (*JobQuery) QueryNext

func (jq *JobQuery) QueryNext() *JobQuery

QueryNext chains the current query on the "next" edge.

func (*JobQuery) QueryOwner added in v0.3.0

func (jq *JobQuery) QueryOwner() *UserQuery

QueryOwner chains the current query on the "owner" edge.

func (*JobQuery) QueryPrev

func (jq *JobQuery) QueryPrev() *JobQuery

QueryPrev chains the current query on the "prev" edge.

func (*JobQuery) QueryTags

func (jq *JobQuery) QueryTags() *TagQuery

QueryTags chains the current query on the "tags" edge.

func (*JobQuery) QueryTasks

func (jq *JobQuery) QueryTasks() *TaskQuery

QueryTasks chains the current query on the "tasks" edge.

func (*JobQuery) Select

func (jq *JobQuery) Select(fields ...string) *JobSelect

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.Job.Query().
	Select(job.FieldName).
	Scan(ctx, &v)

func (*JobQuery) Unique added in v0.4.3

func (jq *JobQuery) Unique(unique bool) *JobQuery

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

func (jq *JobQuery) Where(ps ...predicate.Job) *JobQuery

Where adds a new predicate for the JobQuery builder.

func (*JobQuery) WithNext added in v0.2.3

func (jq *JobQuery) WithNext(opts ...func(*JobQuery)) *JobQuery

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

func (*JobQuery) WithOwner added in v0.3.0

func (jq *JobQuery) WithOwner(opts ...func(*UserQuery)) *JobQuery

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

func (*JobQuery) WithPrev added in v0.2.3

func (jq *JobQuery) WithPrev(opts ...func(*JobQuery)) *JobQuery

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

func (*JobQuery) WithTags added in v0.2.3

func (jq *JobQuery) WithTags(opts ...func(*TagQuery)) *JobQuery

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

func (*JobQuery) WithTasks added in v0.2.3

func (jq *JobQuery) WithTasks(opts ...func(*TaskQuery)) *JobQuery

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

type JobSelect

type JobSelect struct {
	*JobQuery
	// contains filtered or unexported fields
}

JobSelect is the builder for selecting fields of Job entities.

func (*JobSelect) Bool added in v0.4.3

func (js *JobSelect) Bool(ctx context.Context) (_ bool, err error)

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

func (*JobSelect) BoolX added in v0.4.3

func (js *JobSelect) BoolX(ctx context.Context) bool

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

func (*JobSelect) Bools

func (js *JobSelect) Bools(ctx context.Context) ([]bool, error)

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

func (*JobSelect) BoolsX

func (js *JobSelect) BoolsX(ctx context.Context) []bool

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

func (*JobSelect) Float64 added in v0.4.3

func (js *JobSelect) Float64(ctx context.Context) (_ float64, err error)

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

func (*JobSelect) Float64X added in v0.4.3

func (js *JobSelect) Float64X(ctx context.Context) float64

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

func (*JobSelect) Float64s

func (js *JobSelect) Float64s(ctx context.Context) ([]float64, error)

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

func (*JobSelect) Float64sX

func (js *JobSelect) Float64sX(ctx context.Context) []float64

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

func (*JobSelect) Int added in v0.4.3

func (js *JobSelect) Int(ctx context.Context) (_ int, err error)

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

func (*JobSelect) IntX added in v0.4.3

func (js *JobSelect) IntX(ctx context.Context) int

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

func (*JobSelect) Ints

func (js *JobSelect) Ints(ctx context.Context) ([]int, error)

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

func (*JobSelect) IntsX

func (js *JobSelect) IntsX(ctx context.Context) []int

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

func (*JobSelect) Scan

func (js *JobSelect) Scan(ctx context.Context, v interface{}) error

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

func (*JobSelect) ScanX

func (js *JobSelect) ScanX(ctx context.Context, v interface{})

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

func (*JobSelect) String added in v0.4.3

func (js *JobSelect) String(ctx context.Context) (_ string, err error)

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

func (*JobSelect) StringX added in v0.4.3

func (js *JobSelect) StringX(ctx context.Context) string

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

func (*JobSelect) Strings

func (js *JobSelect) Strings(ctx context.Context) ([]string, error)

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

func (*JobSelect) StringsX

func (js *JobSelect) StringsX(ctx context.Context) []string

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

type JobUpdate

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

JobUpdate is the builder for updating Job entities.

func (*JobUpdate) AddTagIDs

func (ju *JobUpdate) AddTagIDs(ids ...int) *JobUpdate

AddTagIDs adds the "tags" edge to the Tag entity by IDs.

func (*JobUpdate) AddTags

func (ju *JobUpdate) AddTags(t ...*Tag) *JobUpdate

AddTags adds the "tags" edges to the Tag entity.

func (*JobUpdate) AddTaskIDs

func (ju *JobUpdate) AddTaskIDs(ids ...int) *JobUpdate

AddTaskIDs adds the "tasks" edge to the Task entity by IDs.

func (*JobUpdate) AddTasks

func (ju *JobUpdate) AddTasks(t ...*Task) *JobUpdate

AddTasks adds the "tasks" edges to the Task entity.

func (*JobUpdate) ClearNext

func (ju *JobUpdate) ClearNext() *JobUpdate

ClearNext clears the "next" edge to the Job entity.

func (*JobUpdate) ClearOwner added in v0.3.0

func (ju *JobUpdate) ClearOwner() *JobUpdate

ClearOwner clears the "owner" edge to the User entity.

func (*JobUpdate) ClearPrev

func (ju *JobUpdate) ClearPrev() *JobUpdate

ClearPrev clears the "prev" edge to the Job entity.

func (*JobUpdate) ClearTags added in v0.4.3

func (ju *JobUpdate) ClearTags() *JobUpdate

ClearTags clears all "tags" edges to the Tag entity.

func (*JobUpdate) ClearTasks added in v0.4.3

func (ju *JobUpdate) ClearTasks() *JobUpdate

ClearTasks clears all "tasks" edges to the Task entity.

func (*JobUpdate) Exec

func (ju *JobUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*JobUpdate) ExecX

func (ju *JobUpdate) ExecX(ctx context.Context)

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

func (*JobUpdate) Mutation added in v0.4.3

func (ju *JobUpdate) Mutation() *JobMutation

Mutation returns the JobMutation object of the builder.

func (*JobUpdate) RemoveTagIDs

func (ju *JobUpdate) RemoveTagIDs(ids ...int) *JobUpdate

RemoveTagIDs removes the "tags" edge to Tag entities by IDs.

func (*JobUpdate) RemoveTags

func (ju *JobUpdate) RemoveTags(t ...*Tag) *JobUpdate

RemoveTags removes "tags" edges to Tag entities.

func (*JobUpdate) RemoveTaskIDs

func (ju *JobUpdate) RemoveTaskIDs(ids ...int) *JobUpdate

RemoveTaskIDs removes the "tasks" edge to Task entities by IDs.

func (*JobUpdate) RemoveTasks

func (ju *JobUpdate) RemoveTasks(t ...*Task) *JobUpdate

RemoveTasks removes "tasks" edges to Task entities.

func (*JobUpdate) Save

func (ju *JobUpdate) Save(ctx context.Context) (int, error)

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

func (*JobUpdate) SaveX

func (ju *JobUpdate) SaveX(ctx context.Context) int

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

func (*JobUpdate) SetContent

func (ju *JobUpdate) SetContent(s string) *JobUpdate

SetContent sets the "Content" field.

func (*JobUpdate) SetCreationTime

func (ju *JobUpdate) SetCreationTime(t time.Time) *JobUpdate

SetCreationTime sets the "CreationTime" field.

func (*JobUpdate) SetName

func (ju *JobUpdate) SetName(s string) *JobUpdate

SetName sets the "Name" field.

func (*JobUpdate) SetNext

func (ju *JobUpdate) SetNext(j *Job) *JobUpdate

SetNext sets the "next" edge to the Job entity.

func (*JobUpdate) SetNextID

func (ju *JobUpdate) SetNextID(id int) *JobUpdate

SetNextID sets the "next" edge to the Job entity by ID.

func (*JobUpdate) SetNillableCreationTime

func (ju *JobUpdate) SetNillableCreationTime(t *time.Time) *JobUpdate

SetNillableCreationTime sets the "CreationTime" field if the given value is not nil.

func (*JobUpdate) SetNillableNextID

func (ju *JobUpdate) SetNillableNextID(id *int) *JobUpdate

SetNillableNextID sets the "next" edge to the Job entity by ID if the given value is not nil.

func (*JobUpdate) SetNillablePrevID

func (ju *JobUpdate) SetNillablePrevID(id *int) *JobUpdate

SetNillablePrevID sets the "prev" edge to the Job entity by ID if the given value is not nil.

func (*JobUpdate) SetOwner added in v0.3.0

func (ju *JobUpdate) SetOwner(u *User) *JobUpdate

SetOwner sets the "owner" edge to the User entity.

func (*JobUpdate) SetOwnerID added in v0.3.0

func (ju *JobUpdate) SetOwnerID(id int) *JobUpdate

SetOwnerID sets the "owner" edge to the User entity by ID.

func (*JobUpdate) SetPrev

func (ju *JobUpdate) SetPrev(j *Job) *JobUpdate

SetPrev sets the "prev" edge to the Job entity.

func (*JobUpdate) SetPrevID

func (ju *JobUpdate) SetPrevID(id int) *JobUpdate

SetPrevID sets the "prev" edge to the Job entity by ID.

func (*JobUpdate) SetStaged added in v0.3.0

func (ju *JobUpdate) SetStaged(b bool) *JobUpdate

SetStaged sets the "Staged" field.

func (*JobUpdate) Where

func (ju *JobUpdate) Where(ps ...predicate.Job) *JobUpdate

Where appends a list predicates to the JobUpdate builder.

type JobUpdateOne

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

JobUpdateOne is the builder for updating a single Job entity.

func (*JobUpdateOne) AddTagIDs

func (juo *JobUpdateOne) AddTagIDs(ids ...int) *JobUpdateOne

AddTagIDs adds the "tags" edge to the Tag entity by IDs.

func (*JobUpdateOne) AddTags

func (juo *JobUpdateOne) AddTags(t ...*Tag) *JobUpdateOne

AddTags adds the "tags" edges to the Tag entity.

func (*JobUpdateOne) AddTaskIDs

func (juo *JobUpdateOne) AddTaskIDs(ids ...int) *JobUpdateOne

AddTaskIDs adds the "tasks" edge to the Task entity by IDs.

func (*JobUpdateOne) AddTasks

func (juo *JobUpdateOne) AddTasks(t ...*Task) *JobUpdateOne

AddTasks adds the "tasks" edges to the Task entity.

func (*JobUpdateOne) ClearNext

func (juo *JobUpdateOne) ClearNext() *JobUpdateOne

ClearNext clears the "next" edge to the Job entity.

func (*JobUpdateOne) ClearOwner added in v0.3.0

func (juo *JobUpdateOne) ClearOwner() *JobUpdateOne

ClearOwner clears the "owner" edge to the User entity.

func (*JobUpdateOne) ClearPrev

func (juo *JobUpdateOne) ClearPrev() *JobUpdateOne

ClearPrev clears the "prev" edge to the Job entity.

func (*JobUpdateOne) ClearTags added in v0.4.3

func (juo *JobUpdateOne) ClearTags() *JobUpdateOne

ClearTags clears all "tags" edges to the Tag entity.

func (*JobUpdateOne) ClearTasks added in v0.4.3

func (juo *JobUpdateOne) ClearTasks() *JobUpdateOne

ClearTasks clears all "tasks" edges to the Task entity.

func (*JobUpdateOne) Exec

func (juo *JobUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*JobUpdateOne) ExecX

func (juo *JobUpdateOne) ExecX(ctx context.Context)

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

func (*JobUpdateOne) Mutation added in v0.4.3

func (juo *JobUpdateOne) Mutation() *JobMutation

Mutation returns the JobMutation object of the builder.

func (*JobUpdateOne) RemoveTagIDs

func (juo *JobUpdateOne) RemoveTagIDs(ids ...int) *JobUpdateOne

RemoveTagIDs removes the "tags" edge to Tag entities by IDs.

func (*JobUpdateOne) RemoveTags

func (juo *JobUpdateOne) RemoveTags(t ...*Tag) *JobUpdateOne

RemoveTags removes "tags" edges to Tag entities.

func (*JobUpdateOne) RemoveTaskIDs

func (juo *JobUpdateOne) RemoveTaskIDs(ids ...int) *JobUpdateOne

RemoveTaskIDs removes the "tasks" edge to Task entities by IDs.

func (*JobUpdateOne) RemoveTasks

func (juo *JobUpdateOne) RemoveTasks(t ...*Task) *JobUpdateOne

RemoveTasks removes "tasks" edges to Task entities.

func (*JobUpdateOne) Save

func (juo *JobUpdateOne) Save(ctx context.Context) (*Job, error)

Save executes the query and returns the updated Job entity.

func (*JobUpdateOne) SaveX

func (juo *JobUpdateOne) SaveX(ctx context.Context) *Job

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

func (*JobUpdateOne) Select added in v0.4.3

func (juo *JobUpdateOne) Select(field string, fields ...string) *JobUpdateOne

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

func (*JobUpdateOne) SetContent

func (juo *JobUpdateOne) SetContent(s string) *JobUpdateOne

SetContent sets the "Content" field.

func (*JobUpdateOne) SetCreationTime

func (juo *JobUpdateOne) SetCreationTime(t time.Time) *JobUpdateOne

SetCreationTime sets the "CreationTime" field.

func (*JobUpdateOne) SetName

func (juo *JobUpdateOne) SetName(s string) *JobUpdateOne

SetName sets the "Name" field.

func (*JobUpdateOne) SetNext

func (juo *JobUpdateOne) SetNext(j *Job) *JobUpdateOne

SetNext sets the "next" edge to the Job entity.

func (*JobUpdateOne) SetNextID

func (juo *JobUpdateOne) SetNextID(id int) *JobUpdateOne

SetNextID sets the "next" edge to the Job entity by ID.

func (*JobUpdateOne) SetNillableCreationTime

func (juo *JobUpdateOne) SetNillableCreationTime(t *time.Time) *JobUpdateOne

SetNillableCreationTime sets the "CreationTime" field if the given value is not nil.

func (*JobUpdateOne) SetNillableNextID

func (juo *JobUpdateOne) SetNillableNextID(id *int) *JobUpdateOne

SetNillableNextID sets the "next" edge to the Job entity by ID if the given value is not nil.

func (*JobUpdateOne) SetNillablePrevID

func (juo *JobUpdateOne) SetNillablePrevID(id *int) *JobUpdateOne

SetNillablePrevID sets the "prev" edge to the Job entity by ID if the given value is not nil.

func (*JobUpdateOne) SetOwner added in v0.3.0

func (juo *JobUpdateOne) SetOwner(u *User) *JobUpdateOne

SetOwner sets the "owner" edge to the User entity.

func (*JobUpdateOne) SetOwnerID added in v0.3.0

func (juo *JobUpdateOne) SetOwnerID(id int) *JobUpdateOne

SetOwnerID sets the "owner" edge to the User entity by ID.

func (*JobUpdateOne) SetPrev

func (juo *JobUpdateOne) SetPrev(j *Job) *JobUpdateOne

SetPrev sets the "prev" edge to the Job entity.

func (*JobUpdateOne) SetPrevID

func (juo *JobUpdateOne) SetPrevID(id int) *JobUpdateOne

SetPrevID sets the "prev" edge to the Job entity by ID.

func (*JobUpdateOne) SetStaged added in v0.3.0

func (juo *JobUpdateOne) SetStaged(b bool) *JobUpdateOne

SetStaged sets the "Staged" field.

type Jobs

type Jobs []*Job

Jobs is a parsable slice of Job.

type Link struct {

	// ID of the ent.
	ID int `json:"id,omitempty"`
	// Alias holds the value of the "Alias" field.
	// The alias of the link which will be used for routing resolution
	Alias string `json:"Alias,omitempty"`
	// ExpirationTime holds the value of the "ExpirationTime" field.
	// The timestamp for when the link will be deleted
	ExpirationTime time.Time `json:"ExpirationTime,omitempty"`
	// Clicks holds the value of the "Clicks" field.
	// The number of clicks left on the link before it will be deleted (-1 means unlimited)
	Clicks int `json:"Clicks,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the LinkQuery when eager-loading is set.
	Edges LinkEdges `json:"edges"`
	// contains filtered or unexported fields
}

Link is the model entity for the Link schema.

func (*Link) QueryFile added in v0.2.3

func (l *Link) QueryFile() *FileQuery

QueryFile queries the "file" edge of the Link entity.

func (*Link) String added in v0.2.3

func (l *Link) String() string

String implements the fmt.Stringer.

func (*Link) Unwrap added in v0.2.3

func (l *Link) Unwrap() *Link

Unwrap unwraps the Link 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 (*Link) Update added in v0.2.3

func (l *Link) Update() *LinkUpdateOne

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

type LinkClient added in v0.2.3

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

LinkClient is a client for the Link schema.

func NewLinkClient added in v0.2.3

func NewLinkClient(c config) *LinkClient

NewLinkClient returns a client for the Link from the given config.

func (*LinkClient) Create added in v0.2.3

func (c *LinkClient) Create() *LinkCreate

Create returns a create builder for Link.

func (*LinkClient) CreateBulk added in v0.4.3

func (c *LinkClient) CreateBulk(builders ...*LinkCreate) *LinkCreateBulk

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

func (*LinkClient) Delete added in v0.2.3

func (c *LinkClient) Delete() *LinkDelete

Delete returns a delete builder for Link.

func (*LinkClient) DeleteOne added in v0.2.3

func (c *LinkClient) DeleteOne(l *Link) *LinkDeleteOne

DeleteOne returns a delete builder for the given entity.

func (*LinkClient) DeleteOneID added in v0.2.3

func (c *LinkClient) DeleteOneID(id int) *LinkDeleteOne

DeleteOneID returns a delete builder for the given id.

func (*LinkClient) Get added in v0.2.3

func (c *LinkClient) Get(ctx context.Context, id int) (*Link, error)

Get returns a Link entity by its id.

func (*LinkClient) GetX added in v0.2.3

func (c *LinkClient) GetX(ctx context.Context, id int) *Link

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

func (*LinkClient) Hooks added in v0.4.3

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

Hooks returns the client hooks.

func (*LinkClient) Query added in v0.2.3

func (c *LinkClient) Query() *LinkQuery

Query returns a query builder for Link.

func (*LinkClient) QueryFile added in v0.2.3

func (c *LinkClient) QueryFile(l *Link) *FileQuery

QueryFile queries the file edge of a Link.

func (*LinkClient) Update added in v0.2.3

func (c *LinkClient) Update() *LinkUpdate

Update returns an update builder for Link.

func (*LinkClient) UpdateOne added in v0.2.3

func (c *LinkClient) UpdateOne(l *Link) *LinkUpdateOne

UpdateOne returns an update builder for the given entity.

func (*LinkClient) UpdateOneID added in v0.2.3

func (c *LinkClient) UpdateOneID(id int) *LinkUpdateOne

UpdateOneID returns an update builder for the given id.

func (*LinkClient) Use added in v0.4.3

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

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

type LinkCreate added in v0.2.3

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

LinkCreate is the builder for creating a Link entity.

func (*LinkCreate) Exec added in v0.4.3

func (lc *LinkCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*LinkCreate) ExecX added in v0.4.3

func (lc *LinkCreate) ExecX(ctx context.Context)

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

func (*LinkCreate) Mutation added in v0.4.3

func (lc *LinkCreate) Mutation() *LinkMutation

Mutation returns the LinkMutation object of the builder.

func (*LinkCreate) Save added in v0.2.3

func (lc *LinkCreate) Save(ctx context.Context) (*Link, error)

Save creates the Link in the database.

func (*LinkCreate) SaveX added in v0.2.3

func (lc *LinkCreate) SaveX(ctx context.Context) *Link

SaveX calls Save and panics if Save returns an error.

func (*LinkCreate) SetAlias added in v0.2.3

func (lc *LinkCreate) SetAlias(s string) *LinkCreate

SetAlias sets the "Alias" field.

func (*LinkCreate) SetClicks added in v0.2.3

func (lc *LinkCreate) SetClicks(i int) *LinkCreate

SetClicks sets the "Clicks" field.

func (*LinkCreate) SetExpirationTime added in v0.2.3

func (lc *LinkCreate) SetExpirationTime(t time.Time) *LinkCreate

SetExpirationTime sets the "ExpirationTime" field.

func (*LinkCreate) SetFile added in v0.2.3

func (lc *LinkCreate) SetFile(f *File) *LinkCreate

SetFile sets the "file" edge to the File entity.

func (*LinkCreate) SetFileID added in v0.2.3

func (lc *LinkCreate) SetFileID(id int) *LinkCreate

SetFileID sets the "file" edge to the File entity by ID.

func (*LinkCreate) SetNillableClicks added in v0.2.3

func (lc *LinkCreate) SetNillableClicks(i *int) *LinkCreate

SetNillableClicks sets the "Clicks" field if the given value is not nil.

func (*LinkCreate) SetNillableExpirationTime added in v0.2.3

func (lc *LinkCreate) SetNillableExpirationTime(t *time.Time) *LinkCreate

SetNillableExpirationTime sets the "ExpirationTime" field if the given value is not nil.

func (*LinkCreate) SetNillableFileID added in v0.2.3

func (lc *LinkCreate) SetNillableFileID(id *int) *LinkCreate

SetNillableFileID sets the "file" edge to the File entity by ID if the given value is not nil.

type LinkCreateBulk added in v0.4.3

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

LinkCreateBulk is the builder for creating many Link entities in bulk.

func (*LinkCreateBulk) Exec added in v0.4.3

func (lcb *LinkCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*LinkCreateBulk) ExecX added in v0.4.3

func (lcb *LinkCreateBulk) ExecX(ctx context.Context)

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

func (*LinkCreateBulk) Save added in v0.4.3

func (lcb *LinkCreateBulk) Save(ctx context.Context) ([]*Link, error)

Save creates the Link entities in the database.

func (*LinkCreateBulk) SaveX added in v0.4.3

func (lcb *LinkCreateBulk) SaveX(ctx context.Context) []*Link

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

type LinkDelete added in v0.2.3

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

LinkDelete is the builder for deleting a Link entity.

func (*LinkDelete) Exec added in v0.2.3

func (ld *LinkDelete) Exec(ctx context.Context) (int, error)

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

func (*LinkDelete) ExecX added in v0.2.3

func (ld *LinkDelete) ExecX(ctx context.Context) int

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

func (*LinkDelete) Where added in v0.2.3

func (ld *LinkDelete) Where(ps ...predicate.Link) *LinkDelete

Where appends a list predicates to the LinkDelete builder.

type LinkDeleteOne added in v0.2.3

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

LinkDeleteOne is the builder for deleting a single Link entity.

func (*LinkDeleteOne) Exec added in v0.2.3

func (ldo *LinkDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*LinkDeleteOne) ExecX added in v0.2.3

func (ldo *LinkDeleteOne) ExecX(ctx context.Context)

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

type LinkEdges added in v0.3.0

type LinkEdges struct {
	// File holds the value of the file edge.
	File *File `json:"file,omitempty"`
	// contains filtered or unexported fields
}

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

func (LinkEdges) FileOrErr added in v0.3.0

func (e LinkEdges) FileOrErr() (*File, error)

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

type LinkGroupBy added in v0.2.3

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

LinkGroupBy is the group-by builder for Link entities.

func (*LinkGroupBy) Aggregate added in v0.2.3

func (lgb *LinkGroupBy) Aggregate(fns ...AggregateFunc) *LinkGroupBy

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

func (*LinkGroupBy) Bool added in v0.4.3

func (lgb *LinkGroupBy) 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 (*LinkGroupBy) BoolX added in v0.4.3

func (lgb *LinkGroupBy) BoolX(ctx context.Context) bool

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

func (*LinkGroupBy) Bools added in v0.2.3

func (lgb *LinkGroupBy) 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 (*LinkGroupBy) BoolsX added in v0.2.3

func (lgb *LinkGroupBy) BoolsX(ctx context.Context) []bool

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

func (*LinkGroupBy) Float64 added in v0.4.3

func (lgb *LinkGroupBy) 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 (*LinkGroupBy) Float64X added in v0.4.3

func (lgb *LinkGroupBy) Float64X(ctx context.Context) float64

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

func (*LinkGroupBy) Float64s added in v0.2.3

func (lgb *LinkGroupBy) 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 (*LinkGroupBy) Float64sX added in v0.2.3

func (lgb *LinkGroupBy) Float64sX(ctx context.Context) []float64

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

func (*LinkGroupBy) Int added in v0.4.3

func (lgb *LinkGroupBy) 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 (*LinkGroupBy) IntX added in v0.4.3

func (lgb *LinkGroupBy) IntX(ctx context.Context) int

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

func (*LinkGroupBy) Ints added in v0.2.3

func (lgb *LinkGroupBy) 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 (*LinkGroupBy) IntsX added in v0.2.3

func (lgb *LinkGroupBy) IntsX(ctx context.Context) []int

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

func (*LinkGroupBy) Scan added in v0.2.3

func (lgb *LinkGroupBy) Scan(ctx context.Context, v interface{}) error

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

func (*LinkGroupBy) ScanX added in v0.2.3

func (lgb *LinkGroupBy) ScanX(ctx context.Context, v interface{})

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

func (*LinkGroupBy) String added in v0.4.3

func (lgb *LinkGroupBy) 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 (*LinkGroupBy) StringX added in v0.4.3

func (lgb *LinkGroupBy) StringX(ctx context.Context) string

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

func (*LinkGroupBy) Strings added in v0.2.3

func (lgb *LinkGroupBy) 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 (*LinkGroupBy) StringsX added in v0.2.3

func (lgb *LinkGroupBy) StringsX(ctx context.Context) []string

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

type LinkMutation added in v0.4.3

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

LinkMutation represents an operation that mutates the Link nodes in the graph.

func (*LinkMutation) AddClicks added in v0.4.3

func (m *LinkMutation) AddClicks(i int)

AddClicks adds i to the "Clicks" field.

func (*LinkMutation) AddField added in v0.4.3

func (m *LinkMutation) 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 (*LinkMutation) AddedClicks added in v0.4.3

func (m *LinkMutation) AddedClicks() (r int, exists bool)

AddedClicks returns the value that was added to the "Clicks" field in this mutation.

func (*LinkMutation) AddedEdges added in v0.4.3

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

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

func (*LinkMutation) AddedField added in v0.4.3

func (m *LinkMutation) 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 (*LinkMutation) AddedFields added in v0.4.3

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

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

func (*LinkMutation) AddedIDs added in v0.4.3

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

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

func (*LinkMutation) Alias added in v0.4.3

func (m *LinkMutation) Alias() (r string, exists bool)

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

func (*LinkMutation) ClearEdge added in v0.4.3

func (m *LinkMutation) 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 (*LinkMutation) ClearExpirationTime added in v0.4.3

func (m *LinkMutation) ClearExpirationTime()

ClearExpirationTime clears the value of the "ExpirationTime" field.

func (*LinkMutation) ClearField added in v0.4.3

func (m *LinkMutation) 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 (*LinkMutation) ClearFile added in v0.4.3

func (m *LinkMutation) ClearFile()

ClearFile clears the "file" edge to the File entity.

func (*LinkMutation) ClearedEdges added in v0.4.3

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

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

func (*LinkMutation) ClearedFields added in v0.4.3

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

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

func (*LinkMutation) Clicks added in v0.4.3

func (m *LinkMutation) Clicks() (r int, exists bool)

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

func (LinkMutation) Client added in v0.4.3

func (m LinkMutation) 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 (*LinkMutation) EdgeCleared added in v0.4.3

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

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

func (*LinkMutation) ExpirationTime added in v0.4.3

func (m *LinkMutation) ExpirationTime() (r time.Time, exists bool)

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

func (*LinkMutation) ExpirationTimeCleared added in v0.4.3

func (m *LinkMutation) ExpirationTimeCleared() bool

ExpirationTimeCleared returns if the "ExpirationTime" field was cleared in this mutation.

func (*LinkMutation) Field added in v0.4.3

func (m *LinkMutation) 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 (*LinkMutation) FieldCleared added in v0.4.3

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

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

func (*LinkMutation) Fields added in v0.4.3

func (m *LinkMutation) 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 (*LinkMutation) FileCleared added in v0.4.3

func (m *LinkMutation) FileCleared() bool

FileCleared reports if the "file" edge to the File entity was cleared.

func (*LinkMutation) FileID added in v0.4.3

func (m *LinkMutation) FileID() (id int, exists bool)

FileID returns the "file" edge ID in the mutation.

func (*LinkMutation) FileIDs added in v0.4.3

func (m *LinkMutation) FileIDs() (ids []int)

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

func (*LinkMutation) ID added in v0.4.3

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

func (m *LinkMutation) 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 (*LinkMutation) OldAlias added in v0.4.3

func (m *LinkMutation) OldAlias(ctx context.Context) (v string, err error)

OldAlias returns the old "Alias" field's value of the Link entity. If the Link 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 (*LinkMutation) OldClicks added in v0.4.3

func (m *LinkMutation) OldClicks(ctx context.Context) (v int, err error)

OldClicks returns the old "Clicks" field's value of the Link entity. If the Link 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 (*LinkMutation) OldExpirationTime added in v0.4.3

func (m *LinkMutation) OldExpirationTime(ctx context.Context) (v time.Time, err error)

OldExpirationTime returns the old "ExpirationTime" field's value of the Link entity. If the Link 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 (*LinkMutation) OldField added in v0.4.3

func (m *LinkMutation) 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 (*LinkMutation) Op added in v0.4.3

func (m *LinkMutation) Op() Op

Op returns the operation name.

func (*LinkMutation) RemovedEdges added in v0.4.3

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

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

func (*LinkMutation) RemovedIDs added in v0.4.3

func (m *LinkMutation) 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 (*LinkMutation) ResetAlias added in v0.4.3

func (m *LinkMutation) ResetAlias()

ResetAlias resets all changes to the "Alias" field.

func (*LinkMutation) ResetClicks added in v0.4.3

func (m *LinkMutation) ResetClicks()

ResetClicks resets all changes to the "Clicks" field.

func (*LinkMutation) ResetEdge added in v0.4.3

func (m *LinkMutation) 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 (*LinkMutation) ResetExpirationTime added in v0.4.3

func (m *LinkMutation) ResetExpirationTime()

ResetExpirationTime resets all changes to the "ExpirationTime" field.

func (*LinkMutation) ResetField added in v0.4.3

func (m *LinkMutation) 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 (*LinkMutation) ResetFile added in v0.4.3

func (m *LinkMutation) ResetFile()

ResetFile resets all changes to the "file" edge.

func (*LinkMutation) SetAlias added in v0.4.3

func (m *LinkMutation) SetAlias(s string)

SetAlias sets the "Alias" field.

func (*LinkMutation) SetClicks added in v0.4.3

func (m *LinkMutation) SetClicks(i int)

SetClicks sets the "Clicks" field.

func (*LinkMutation) SetExpirationTime added in v0.4.3

func (m *LinkMutation) SetExpirationTime(t time.Time)

SetExpirationTime sets the "ExpirationTime" field.

func (*LinkMutation) SetField added in v0.4.3

func (m *LinkMutation) 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 (*LinkMutation) SetFileID added in v0.4.3

func (m *LinkMutation) SetFileID(id int)

SetFileID sets the "file" edge to the File entity by id.

func (LinkMutation) Tx added in v0.4.3

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

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

func (*LinkMutation) Type added in v0.4.3

func (m *LinkMutation) Type() string

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

func (*LinkMutation) Where added in v0.4.3

func (m *LinkMutation) Where(ps ...predicate.Link)

Where appends a list predicates to the LinkMutation builder.

type LinkQuery added in v0.2.3

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

LinkQuery is the builder for querying Link entities.

func (*LinkQuery) All added in v0.2.3

func (lq *LinkQuery) All(ctx context.Context) ([]*Link, error)

All executes the query and returns a list of Links.

func (*LinkQuery) AllX added in v0.2.3

func (lq *LinkQuery) AllX(ctx context.Context) []*Link

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

func (*LinkQuery) Clone added in v0.2.3

func (lq *LinkQuery) Clone() *LinkQuery

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

func (*LinkQuery) Count added in v0.2.3

func (lq *LinkQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*LinkQuery) CountX added in v0.2.3

func (lq *LinkQuery) CountX(ctx context.Context) int

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

func (*LinkQuery) Exist added in v0.2.3

func (lq *LinkQuery) Exist(ctx context.Context) (bool, error)

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

func (*LinkQuery) ExistX added in v0.2.3

func (lq *LinkQuery) ExistX(ctx context.Context) bool

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

func (*LinkQuery) First added in v0.2.3

func (lq *LinkQuery) First(ctx context.Context) (*Link, error)

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

func (*LinkQuery) FirstID added in v0.2.3

func (lq *LinkQuery) FirstID(ctx context.Context) (id int, err error)

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

func (*LinkQuery) FirstIDX added in v0.4.3

func (lq *LinkQuery) FirstIDX(ctx context.Context) int

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

func (*LinkQuery) FirstX added in v0.2.3

func (lq *LinkQuery) FirstX(ctx context.Context) *Link

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

func (*LinkQuery) GroupBy added in v0.2.3

func (lq *LinkQuery) GroupBy(field string, fields ...string) *LinkGroupBy

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

client.Link.Query().
	GroupBy(link.FieldAlias).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*LinkQuery) IDs added in v0.2.3

func (lq *LinkQuery) IDs(ctx context.Context) ([]int, error)

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

func (*LinkQuery) IDsX added in v0.2.3

func (lq *LinkQuery) IDsX(ctx context.Context) []int

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

func (*LinkQuery) Limit added in v0.2.3

func (lq *LinkQuery) Limit(limit int) *LinkQuery

Limit adds a limit step to the query.

func (*LinkQuery) Offset added in v0.2.3

func (lq *LinkQuery) Offset(offset int) *LinkQuery

Offset adds an offset step to the query.

func (*LinkQuery) Only added in v0.2.3

func (lq *LinkQuery) Only(ctx context.Context) (*Link, error)

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

func (*LinkQuery) OnlyID added in v0.2.3

func (lq *LinkQuery) OnlyID(ctx context.Context) (id int, err error)

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

func (*LinkQuery) OnlyIDX added in v0.4.3

func (lq *LinkQuery) OnlyIDX(ctx context.Context) int

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

func (*LinkQuery) OnlyX added in v0.2.3

func (lq *LinkQuery) OnlyX(ctx context.Context) *Link

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

func (*LinkQuery) Order added in v0.2.3

func (lq *LinkQuery) Order(o ...OrderFunc) *LinkQuery

Order adds an order step to the query.

func (*LinkQuery) QueryFile added in v0.2.3

func (lq *LinkQuery) QueryFile() *FileQuery

QueryFile chains the current query on the "file" edge.

func (*LinkQuery) Select added in v0.2.3

func (lq *LinkQuery) Select(fields ...string) *LinkSelect

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

client.Link.Query().
	Select(link.FieldAlias).
	Scan(ctx, &v)

func (*LinkQuery) Unique added in v0.4.3

func (lq *LinkQuery) Unique(unique bool) *LinkQuery

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 (*LinkQuery) Where added in v0.2.3

func (lq *LinkQuery) Where(ps ...predicate.Link) *LinkQuery

Where adds a new predicate for the LinkQuery builder.

func (*LinkQuery) WithFile added in v0.2.3

func (lq *LinkQuery) WithFile(opts ...func(*FileQuery)) *LinkQuery

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

type LinkSelect added in v0.2.3

type LinkSelect struct {
	*LinkQuery
	// contains filtered or unexported fields
}

LinkSelect is the builder for selecting fields of Link entities.

func (*LinkSelect) Bool added in v0.4.3

func (ls *LinkSelect) Bool(ctx context.Context) (_ bool, err error)

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

func (*LinkSelect) BoolX added in v0.4.3

func (ls *LinkSelect) BoolX(ctx context.Context) bool

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

func (*LinkSelect) Bools added in v0.2.3

func (ls *LinkSelect) Bools(ctx context.Context) ([]bool, error)

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

func (*LinkSelect) BoolsX added in v0.2.3

func (ls *LinkSelect) BoolsX(ctx context.Context) []bool

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

func (*LinkSelect) Float64 added in v0.4.3

func (ls *LinkSelect) Float64(ctx context.Context) (_ float64, err error)

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

func (*LinkSelect) Float64X added in v0.4.3

func (ls *LinkSelect) Float64X(ctx context.Context) float64

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

func (*LinkSelect) Float64s added in v0.2.3

func (ls *LinkSelect) Float64s(ctx context.Context) ([]float64, error)

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

func (*LinkSelect) Float64sX added in v0.2.3

func (ls *LinkSelect) Float64sX(ctx context.Context) []float64

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

func (*LinkSelect) Int added in v0.4.3

func (ls *LinkSelect) Int(ctx context.Context) (_ int, err error)

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

func (*LinkSelect) IntX added in v0.4.3

func (ls *LinkSelect) IntX(ctx context.Context) int

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

func (*LinkSelect) Ints added in v0.2.3

func (ls *LinkSelect) Ints(ctx context.Context) ([]int, error)

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

func (*LinkSelect) IntsX added in v0.2.3

func (ls *LinkSelect) IntsX(ctx context.Context) []int

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

func (*LinkSelect) Scan added in v0.2.3

func (ls *LinkSelect) Scan(ctx context.Context, v interface{}) error

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

func (*LinkSelect) ScanX added in v0.2.3

func (ls *LinkSelect) ScanX(ctx context.Context, v interface{})

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

func (*LinkSelect) String added in v0.4.3

func (ls *LinkSelect) String(ctx context.Context) (_ string, err error)

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

func (*LinkSelect) StringX added in v0.4.3

func (ls *LinkSelect) StringX(ctx context.Context) string

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

func (*LinkSelect) Strings added in v0.2.3

func (ls *LinkSelect) Strings(ctx context.Context) ([]string, error)

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

func (*LinkSelect) StringsX added in v0.2.3

func (ls *LinkSelect) StringsX(ctx context.Context) []string

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

type LinkUpdate added in v0.2.3

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

LinkUpdate is the builder for updating Link entities.

func (*LinkUpdate) AddClicks added in v0.2.3

func (lu *LinkUpdate) AddClicks(i int) *LinkUpdate

AddClicks adds i to the "Clicks" field.

func (*LinkUpdate) ClearExpirationTime added in v0.2.3

func (lu *LinkUpdate) ClearExpirationTime() *LinkUpdate

ClearExpirationTime clears the value of the "ExpirationTime" field.

func (*LinkUpdate) ClearFile added in v0.2.3

func (lu *LinkUpdate) ClearFile() *LinkUpdate

ClearFile clears the "file" edge to the File entity.

func (*LinkUpdate) Exec added in v0.2.3

func (lu *LinkUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*LinkUpdate) ExecX added in v0.2.3

func (lu *LinkUpdate) ExecX(ctx context.Context)

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

func (*LinkUpdate) Mutation added in v0.4.3

func (lu *LinkUpdate) Mutation() *LinkMutation

Mutation returns the LinkMutation object of the builder.

func (*LinkUpdate) Save added in v0.2.3

func (lu *LinkUpdate) Save(ctx context.Context) (int, error)

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

func (*LinkUpdate) SaveX added in v0.2.3

func (lu *LinkUpdate) SaveX(ctx context.Context) int

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

func (*LinkUpdate) SetAlias added in v0.2.3

func (lu *LinkUpdate) SetAlias(s string) *LinkUpdate

SetAlias sets the "Alias" field.

func (*LinkUpdate) SetClicks added in v0.2.3

func (lu *LinkUpdate) SetClicks(i int) *LinkUpdate

SetClicks sets the "Clicks" field.

func (*LinkUpdate) SetExpirationTime added in v0.2.3

func (lu *LinkUpdate) SetExpirationTime(t time.Time) *LinkUpdate

SetExpirationTime sets the "ExpirationTime" field.

func (*LinkUpdate) SetFile added in v0.2.3

func (lu *LinkUpdate) SetFile(f *File) *LinkUpdate

SetFile sets the "file" edge to the File entity.

func (*LinkUpdate) SetFileID added in v0.2.3

func (lu *LinkUpdate) SetFileID(id int) *LinkUpdate

SetFileID sets the "file" edge to the File entity by ID.

func (*LinkUpdate) SetNillableClicks added in v0.2.3

func (lu *LinkUpdate) SetNillableClicks(i *int) *LinkUpdate

SetNillableClicks sets the "Clicks" field if the given value is not nil.

func (*LinkUpdate) SetNillableExpirationTime added in v0.2.3

func (lu *LinkUpdate) SetNillableExpirationTime(t *time.Time) *LinkUpdate

SetNillableExpirationTime sets the "ExpirationTime" field if the given value is not nil.

func (*LinkUpdate) SetNillableFileID added in v0.2.3

func (lu *LinkUpdate) SetNillableFileID(id *int) *LinkUpdate

SetNillableFileID sets the "file" edge to the File entity by ID if the given value is not nil.

func (*LinkUpdate) Where added in v0.2.3

func (lu *LinkUpdate) Where(ps ...predicate.Link) *LinkUpdate

Where appends a list predicates to the LinkUpdate builder.

type LinkUpdateOne added in v0.2.3

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

LinkUpdateOne is the builder for updating a single Link entity.

func (*LinkUpdateOne) AddClicks added in v0.2.3

func (luo *LinkUpdateOne) AddClicks(i int) *LinkUpdateOne

AddClicks adds i to the "Clicks" field.

func (*LinkUpdateOne) ClearExpirationTime added in v0.2.3

func (luo *LinkUpdateOne) ClearExpirationTime() *LinkUpdateOne

ClearExpirationTime clears the value of the "ExpirationTime" field.

func (*LinkUpdateOne) ClearFile added in v0.2.3

func (luo *LinkUpdateOne) ClearFile() *LinkUpdateOne

ClearFile clears the "file" edge to the File entity.

func (*LinkUpdateOne) Exec added in v0.2.3

func (luo *LinkUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*LinkUpdateOne) ExecX added in v0.2.3

func (luo *LinkUpdateOne) ExecX(ctx context.Context)

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

func (*LinkUpdateOne) Mutation added in v0.4.3

func (luo *LinkUpdateOne) Mutation() *LinkMutation

Mutation returns the LinkMutation object of the builder.

func (*LinkUpdateOne) Save added in v0.2.3

func (luo *LinkUpdateOne) Save(ctx context.Context) (*Link, error)

Save executes the query and returns the updated Link entity.

func (*LinkUpdateOne) SaveX added in v0.2.3

func (luo *LinkUpdateOne) SaveX(ctx context.Context) *Link

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

func (*LinkUpdateOne) Select added in v0.4.3

func (luo *LinkUpdateOne) Select(field string, fields ...string) *LinkUpdateOne

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

func (*LinkUpdateOne) SetAlias added in v0.2.3

func (luo *LinkUpdateOne) SetAlias(s string) *LinkUpdateOne

SetAlias sets the "Alias" field.

func (*LinkUpdateOne) SetClicks added in v0.2.3

func (luo *LinkUpdateOne) SetClicks(i int) *LinkUpdateOne

SetClicks sets the "Clicks" field.

func (*LinkUpdateOne) SetExpirationTime added in v0.2.3

func (luo *LinkUpdateOne) SetExpirationTime(t time.Time) *LinkUpdateOne

SetExpirationTime sets the "ExpirationTime" field.

func (*LinkUpdateOne) SetFile added in v0.2.3

func (luo *LinkUpdateOne) SetFile(f *File) *LinkUpdateOne

SetFile sets the "file" edge to the File entity.

func (*LinkUpdateOne) SetFileID added in v0.2.3

func (luo *LinkUpdateOne) SetFileID(id int) *LinkUpdateOne

SetFileID sets the "file" edge to the File entity by ID.

func (*LinkUpdateOne) SetNillableClicks added in v0.2.3

func (luo *LinkUpdateOne) SetNillableClicks(i *int) *LinkUpdateOne

SetNillableClicks sets the "Clicks" field if the given value is not nil.

func (*LinkUpdateOne) SetNillableExpirationTime added in v0.2.3

func (luo *LinkUpdateOne) SetNillableExpirationTime(t *time.Time) *LinkUpdateOne

SetNillableExpirationTime sets the "ExpirationTime" field if the given value is not nil.

func (*LinkUpdateOne) SetNillableFileID added in v0.2.3

func (luo *LinkUpdateOne) SetNillableFileID(id *int) *LinkUpdateOne

SetNillableFileID sets the "file" edge to the File entity by ID if the given value is not nil.

type Links []*Link

Links is a parsable slice of Link.

type MutateFunc added in v0.4.3

type MutateFunc = ent.MutateFunc

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

type Mutation added in v0.4.3

type Mutation = ent.Mutation

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

type Mutator added in v0.4.3

type Mutator = ent.Mutator

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

type NotFoundError added in v0.3.0

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

func (e *NotFoundError) Error() string

Error implements the error interface.

type NotLoadedError added in v0.3.0

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

func (e *NotLoadedError) Error() string

Error implements the error interface.

type NotSingularError added in v0.3.0

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

func (e *NotSingularError) Error() string

Error implements the error interface.

type Op added in v0.4.3

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

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

type Policy = ent.Policy

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

type Query added in v0.4.3

type Query = ent.Query

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

type RollbackFunc added in v0.4.3

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

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

Rollback calls f(ctx, m).

type RollbackHook added in v0.4.3

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

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

Rollbacker is the interface that wraps the Rollback method.

type Service added in v0.3.0

type Service struct {

	// ID of the ent.
	ID int `json:"id,omitempty"`
	// Name holds the value of the "Name" field.
	// The name displayed for the service
	Name string `json:"Name,omitempty"`
	// PubKey holds the value of the "PubKey" field.
	// The ed25519 public key for the service (stored in Base64 of DER format)
	PubKey string `json:"PubKey,omitempty"`
	// Config holds the value of the "Config" field.
	// The configuration script of the service (usually a Renegade Script)
	Config string `json:"Config,omitempty"`
	// IsActivated holds the value of the "IsActivated" field.
	// True iff the service is active and able to authenticate
	IsActivated bool `json:"IsActivated,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the ServiceQuery when eager-loading is set.
	Edges ServiceEdges `json:"edges"`
	// contains filtered or unexported fields
}

Service is the model entity for the Service schema.

Example
if dsn == "" {
	return
}
ctx := context.Background()
drv, err := sql.Open("mysql", dsn)
if err != nil {
	log.Fatalf("failed creating database client: %v", err)
}
defer drv.Close()
client := NewClient(Driver(drv))
// creating vertices for the service's edges.
t0 := client.Tag.
	Create().
	SetName("string").
	SaveX(ctx)
log.Println("tag created:", t0)
e1 := client.Event.
	Create().
	SetCreationTime(time.Now()).
	SetKind(event.KindCREATE_JOB).
	SaveX(ctx)
log.Println("event created:", e1)

// create service vertex with its edges.
s := client.Service.
	Create().
	SetName("string").
	SetPubKey("string").
	SetConfig("string").
	SetIsActivated(true).
	SetTag(t0).
	AddEvents(e1).
	SaveX(ctx)
log.Println("service created:", s)

// query edges.
t0, err = s.QueryTag().First(ctx)
if err != nil {
	log.Fatalf("failed querying tag: %v", err)
}
log.Println("tag found:", t0)

e1, err = s.QueryEvents().First(ctx)
if err != nil {
	log.Fatalf("failed querying events: %v", err)
}
log.Println("events found:", e1)
Output:

func (*Service) IsIdentity added in v0.4.0

func (s *Service) IsIdentity()

IsIdentity is used to mark if an ent is used in the Identity type in GraphQL

func (*Service) QueryEvents added in v0.3.0

func (s *Service) QueryEvents() *EventQuery

QueryEvents queries the "events" edge of the Service entity.

func (*Service) QueryTag added in v0.3.0

func (s *Service) QueryTag() *TagQuery

QueryTag queries the "tag" edge of the Service entity.

func (*Service) String added in v0.3.0

func (s *Service) String() string

String implements the fmt.Stringer.

func (*Service) Unwrap added in v0.3.0

func (s *Service) Unwrap() *Service

Unwrap unwraps the Service 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 (*Service) Update added in v0.3.0

func (s *Service) Update() *ServiceUpdateOne

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

type ServiceClient added in v0.3.0

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

ServiceClient is a client for the Service schema.

func NewServiceClient added in v0.3.0

func NewServiceClient(c config) *ServiceClient

NewServiceClient returns a client for the Service from the given config.

func (*ServiceClient) Create added in v0.3.0

func (c *ServiceClient) Create() *ServiceCreate

Create returns a create builder for Service.

func (*ServiceClient) CreateBulk added in v0.4.3

func (c *ServiceClient) CreateBulk(builders ...*ServiceCreate) *ServiceCreateBulk

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

func (*ServiceClient) Delete added in v0.3.0

func (c *ServiceClient) Delete() *ServiceDelete

Delete returns a delete builder for Service.

func (*ServiceClient) DeleteOne added in v0.3.0

func (c *ServiceClient) DeleteOne(s *Service) *ServiceDeleteOne

DeleteOne returns a delete builder for the given entity.

func (*ServiceClient) DeleteOneID added in v0.3.0

func (c *ServiceClient) DeleteOneID(id int) *ServiceDeleteOne

DeleteOneID returns a delete builder for the given id.

func (*ServiceClient) Get added in v0.3.0

func (c *ServiceClient) Get(ctx context.Context, id int) (*Service, error)

Get returns a Service entity by its id.

func (*ServiceClient) GetX added in v0.3.0

func (c *ServiceClient) GetX(ctx context.Context, id int) *Service

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

func (*ServiceClient) Hooks added in v0.4.3

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

Hooks returns the client hooks.

func (*ServiceClient) Query added in v0.3.0

func (c *ServiceClient) Query() *ServiceQuery

Query returns a query builder for Service.

func (*ServiceClient) QueryEvents added in v0.3.0

func (c *ServiceClient) QueryEvents(s *Service) *EventQuery

QueryEvents queries the events edge of a Service.

func (*ServiceClient) QueryTag added in v0.3.0

func (c *ServiceClient) QueryTag(s *Service) *TagQuery

QueryTag queries the tag edge of a Service.

func (*ServiceClient) Update added in v0.3.0

func (c *ServiceClient) Update() *ServiceUpdate

Update returns an update builder for Service.

func (*ServiceClient) UpdateOne added in v0.3.0

func (c *ServiceClient) UpdateOne(s *Service) *ServiceUpdateOne

UpdateOne returns an update builder for the given entity.

func (*ServiceClient) UpdateOneID added in v0.3.0

func (c *ServiceClient) UpdateOneID(id int) *ServiceUpdateOne

UpdateOneID returns an update builder for the given id.

func (*ServiceClient) Use added in v0.4.3

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

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

type ServiceCreate added in v0.3.0

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

ServiceCreate is the builder for creating a Service entity.

func (*ServiceCreate) AddEventIDs added in v0.3.0

func (sc *ServiceCreate) AddEventIDs(ids ...int) *ServiceCreate

AddEventIDs adds the "events" edge to the Event entity by IDs.

func (*ServiceCreate) AddEvents added in v0.3.0

func (sc *ServiceCreate) AddEvents(e ...*Event) *ServiceCreate

AddEvents adds the "events" edges to the Event entity.

func (*ServiceCreate) Exec added in v0.4.3

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

Exec executes the query.

func (*ServiceCreate) ExecX added in v0.4.3

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

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

func (*ServiceCreate) Mutation added in v0.4.3

func (sc *ServiceCreate) Mutation() *ServiceMutation

Mutation returns the ServiceMutation object of the builder.

func (*ServiceCreate) Save added in v0.3.0

func (sc *ServiceCreate) Save(ctx context.Context) (*Service, error)

Save creates the Service in the database.

func (*ServiceCreate) SaveX added in v0.3.0

func (sc *ServiceCreate) SaveX(ctx context.Context) *Service

SaveX calls Save and panics if Save returns an error.

func (*ServiceCreate) SetConfig added in v0.4.0

func (sc *ServiceCreate) SetConfig(s string) *ServiceCreate

SetConfig sets the "Config" field.

func (*ServiceCreate) SetIsActivated added in v0.3.0

func (sc *ServiceCreate) SetIsActivated(b bool) *ServiceCreate

SetIsActivated sets the "IsActivated" field.

func (*ServiceCreate) SetName added in v0.3.0

func (sc *ServiceCreate) SetName(s string) *ServiceCreate

SetName sets the "Name" field.

func (*ServiceCreate) SetNillableConfig added in v0.4.0

func (sc *ServiceCreate) SetNillableConfig(s *string) *ServiceCreate

SetNillableConfig sets the "Config" field if the given value is not nil.

func (*ServiceCreate) SetNillableIsActivated added in v0.3.0

func (sc *ServiceCreate) SetNillableIsActivated(b *bool) *ServiceCreate

SetNillableIsActivated sets the "IsActivated" field if the given value is not nil.

func (*ServiceCreate) SetPubKey added in v0.3.0

func (sc *ServiceCreate) SetPubKey(s string) *ServiceCreate

SetPubKey sets the "PubKey" field.

func (*ServiceCreate) SetTag added in v0.3.0

func (sc *ServiceCreate) SetTag(t *Tag) *ServiceCreate

SetTag sets the "tag" edge to the Tag entity.

func (*ServiceCreate) SetTagID added in v0.3.0

func (sc *ServiceCreate) SetTagID(id int) *ServiceCreate

SetTagID sets the "tag" edge to the Tag entity by ID.

type ServiceCreateBulk added in v0.4.3

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

ServiceCreateBulk is the builder for creating many Service entities in bulk.

func (*ServiceCreateBulk) Exec added in v0.4.3

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

Exec executes the query.

func (*ServiceCreateBulk) ExecX added in v0.4.3

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

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

func (*ServiceCreateBulk) Save added in v0.4.3

func (scb *ServiceCreateBulk) Save(ctx context.Context) ([]*Service, error)

Save creates the Service entities in the database.

func (*ServiceCreateBulk) SaveX added in v0.4.3

func (scb *ServiceCreateBulk) SaveX(ctx context.Context) []*Service

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

type ServiceDelete added in v0.3.0

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

ServiceDelete is the builder for deleting a Service entity.

func (*ServiceDelete) Exec added in v0.3.0

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

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

func (*ServiceDelete) ExecX added in v0.3.0

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

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

func (*ServiceDelete) Where added in v0.3.0

func (sd *ServiceDelete) Where(ps ...predicate.Service) *ServiceDelete

Where appends a list predicates to the ServiceDelete builder.

type ServiceDeleteOne added in v0.3.0

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

ServiceDeleteOne is the builder for deleting a single Service entity.

func (*ServiceDeleteOne) Exec added in v0.3.0

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

Exec executes the deletion query.

func (*ServiceDeleteOne) ExecX added in v0.3.0

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

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

type ServiceEdges added in v0.3.0

type ServiceEdges struct {
	// Tag holds the value of the tag edge.
	Tag *Tag `json:"tag,omitempty"`
	// Events holds the value of the events edge.
	Events []*Event `json:"events,omitempty"`
	// contains filtered or unexported fields
}

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

func (ServiceEdges) EventsOrErr added in v0.3.0

func (e ServiceEdges) EventsOrErr() ([]*Event, error)

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

func (ServiceEdges) TagOrErr added in v0.3.0

func (e ServiceEdges) TagOrErr() (*Tag, error)

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

type ServiceGroupBy added in v0.3.0

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

ServiceGroupBy is the group-by builder for Service entities.

func (*ServiceGroupBy) Aggregate added in v0.3.0

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

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

func (*ServiceGroupBy) Bool added in v0.4.3

func (sgb *ServiceGroupBy) 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 (*ServiceGroupBy) BoolX added in v0.4.3

func (sgb *ServiceGroupBy) BoolX(ctx context.Context) bool

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

func (*ServiceGroupBy) Bools added in v0.3.0

func (sgb *ServiceGroupBy) 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 (*ServiceGroupBy) BoolsX added in v0.3.0

func (sgb *ServiceGroupBy) BoolsX(ctx context.Context) []bool

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

func (*ServiceGroupBy) Float64 added in v0.4.3

func (sgb *ServiceGroupBy) 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 (*ServiceGroupBy) Float64X added in v0.4.3

func (sgb *ServiceGroupBy) Float64X(ctx context.Context) float64

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

func (*ServiceGroupBy) Float64s added in v0.3.0

func (sgb *ServiceGroupBy) 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 (*ServiceGroupBy) Float64sX added in v0.3.0

func (sgb *ServiceGroupBy) Float64sX(ctx context.Context) []float64

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

func (*ServiceGroupBy) Int added in v0.4.3

func (sgb *ServiceGroupBy) 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 (*ServiceGroupBy) IntX added in v0.4.3

func (sgb *ServiceGroupBy) IntX(ctx context.Context) int

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

func (*ServiceGroupBy) Ints added in v0.3.0

func (sgb *ServiceGroupBy) 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 (*ServiceGroupBy) IntsX added in v0.3.0

func (sgb *ServiceGroupBy) IntsX(ctx context.Context) []int

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

func (*ServiceGroupBy) Scan added in v0.3.0

func (sgb *ServiceGroupBy) Scan(ctx context.Context, v interface{}) error

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

func (*ServiceGroupBy) ScanX added in v0.3.0

func (sgb *ServiceGroupBy) ScanX(ctx context.Context, v interface{})

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

func (*ServiceGroupBy) String added in v0.4.3

func (sgb *ServiceGroupBy) 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 (*ServiceGroupBy) StringX added in v0.4.3

func (sgb *ServiceGroupBy) StringX(ctx context.Context) string

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

func (*ServiceGroupBy) Strings added in v0.3.0

func (sgb *ServiceGroupBy) 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 (*ServiceGroupBy) StringsX added in v0.3.0

func (sgb *ServiceGroupBy) StringsX(ctx context.Context) []string

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

type ServiceMutation added in v0.4.3

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

ServiceMutation represents an operation that mutates the Service nodes in the graph.

func (*ServiceMutation) AddEventIDs added in v0.4.3

func (m *ServiceMutation) AddEventIDs(ids ...int)

AddEventIDs adds the "events" edge to the Event entity by ids.

func (*ServiceMutation) AddField added in v0.4.3

func (m *ServiceMutation) 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 (*ServiceMutation) AddedEdges added in v0.4.3

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

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

func (*ServiceMutation) AddedField added in v0.4.3

func (m *ServiceMutation) 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 (*ServiceMutation) AddedFields added in v0.4.3

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

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

func (*ServiceMutation) AddedIDs added in v0.4.3

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

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

func (*ServiceMutation) ClearEdge added in v0.4.3

func (m *ServiceMutation) 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 (*ServiceMutation) ClearEvents added in v0.4.3

func (m *ServiceMutation) ClearEvents()

ClearEvents clears the "events" edge to the Event entity.

func (*ServiceMutation) ClearField added in v0.4.3

func (m *ServiceMutation) 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 (*ServiceMutation) ClearTag added in v0.4.3

func (m *ServiceMutation) ClearTag()

ClearTag clears the "tag" edge to the Tag entity.

func (*ServiceMutation) ClearedEdges added in v0.4.3

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

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

func (*ServiceMutation) ClearedFields added in v0.4.3

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

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

func (ServiceMutation) Client added in v0.4.3

func (m ServiceMutation) 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 (*ServiceMutation) Config added in v0.4.3

func (m *ServiceMutation) Config() (r string, exists bool)

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

func (*ServiceMutation) EdgeCleared added in v0.4.3

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

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

func (*ServiceMutation) EventsCleared added in v0.4.3

func (m *ServiceMutation) EventsCleared() bool

EventsCleared reports if the "events" edge to the Event entity was cleared.

func (*ServiceMutation) EventsIDs added in v0.4.3

func (m *ServiceMutation) EventsIDs() (ids []int)

EventsIDs returns the "events" edge IDs in the mutation.

func (*ServiceMutation) Field added in v0.4.3

func (m *ServiceMutation) 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 (*ServiceMutation) FieldCleared added in v0.4.3

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

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

func (*ServiceMutation) Fields added in v0.4.3

func (m *ServiceMutation) 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 (*ServiceMutation) ID added in v0.4.3

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

func (m *ServiceMutation) 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 (*ServiceMutation) IsActivated added in v0.4.3

func (m *ServiceMutation) IsActivated() (r bool, exists bool)

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

func (*ServiceMutation) Name added in v0.4.3

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

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

func (*ServiceMutation) OldConfig added in v0.4.3

func (m *ServiceMutation) OldConfig(ctx context.Context) (v string, err error)

OldConfig returns the old "Config" field's value of the Service entity. If the Service 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 (*ServiceMutation) OldField added in v0.4.3

func (m *ServiceMutation) 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 (*ServiceMutation) OldIsActivated added in v0.4.3

func (m *ServiceMutation) OldIsActivated(ctx context.Context) (v bool, err error)

OldIsActivated returns the old "IsActivated" field's value of the Service entity. If the Service 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 (*ServiceMutation) OldName added in v0.4.3

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

OldName returns the old "Name" field's value of the Service entity. If the Service 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 (*ServiceMutation) OldPubKey added in v0.4.3

func (m *ServiceMutation) OldPubKey(ctx context.Context) (v string, err error)

OldPubKey returns the old "PubKey" field's value of the Service entity. If the Service 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 (*ServiceMutation) Op added in v0.4.3

func (m *ServiceMutation) Op() Op

Op returns the operation name.

func (*ServiceMutation) PubKey added in v0.4.3

func (m *ServiceMutation) PubKey() (r string, exists bool)

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

func (*ServiceMutation) RemoveEventIDs added in v0.4.3

func (m *ServiceMutation) RemoveEventIDs(ids ...int)

RemoveEventIDs removes the "events" edge to the Event entity by IDs.

func (*ServiceMutation) RemovedEdges added in v0.4.3

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

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

func (*ServiceMutation) RemovedEventsIDs added in v0.4.3

func (m *ServiceMutation) RemovedEventsIDs() (ids []int)

RemovedEvents returns the removed IDs of the "events" edge to the Event entity.

func (*ServiceMutation) RemovedIDs added in v0.4.3

func (m *ServiceMutation) 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 (*ServiceMutation) ResetConfig added in v0.4.3

func (m *ServiceMutation) ResetConfig()

ResetConfig resets all changes to the "Config" field.

func (*ServiceMutation) ResetEdge added in v0.4.3

func (m *ServiceMutation) 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 (*ServiceMutation) ResetEvents added in v0.4.3

func (m *ServiceMutation) ResetEvents()

ResetEvents resets all changes to the "events" edge.

func (*ServiceMutation) ResetField added in v0.4.3

func (m *ServiceMutation) 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 (*ServiceMutation) ResetIsActivated added in v0.4.3

func (m *ServiceMutation) ResetIsActivated()

ResetIsActivated resets all changes to the "IsActivated" field.

func (*ServiceMutation) ResetName added in v0.4.3

func (m *ServiceMutation) ResetName()

ResetName resets all changes to the "Name" field.

func (*ServiceMutation) ResetPubKey added in v0.4.3

func (m *ServiceMutation) ResetPubKey()

ResetPubKey resets all changes to the "PubKey" field.

func (*ServiceMutation) ResetTag added in v0.4.3

func (m *ServiceMutation) ResetTag()

ResetTag resets all changes to the "tag" edge.

func (*ServiceMutation) SetConfig added in v0.4.3

func (m *ServiceMutation) SetConfig(s string)

SetConfig sets the "Config" field.

func (*ServiceMutation) SetField added in v0.4.3

func (m *ServiceMutation) 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 (*ServiceMutation) SetIsActivated added in v0.4.3

func (m *ServiceMutation) SetIsActivated(b bool)

SetIsActivated sets the "IsActivated" field.

func (*ServiceMutation) SetName added in v0.4.3

func (m *ServiceMutation) SetName(s string)

SetName sets the "Name" field.

func (*ServiceMutation) SetPubKey added in v0.4.3

func (m *ServiceMutation) SetPubKey(s string)

SetPubKey sets the "PubKey" field.

func (*ServiceMutation) SetTagID added in v0.4.3

func (m *ServiceMutation) SetTagID(id int)

SetTagID sets the "tag" edge to the Tag entity by id.

func (*ServiceMutation) TagCleared added in v0.4.3

func (m *ServiceMutation) TagCleared() bool

TagCleared reports if the "tag" edge to the Tag entity was cleared.

func (*ServiceMutation) TagID added in v0.4.3

func (m *ServiceMutation) TagID() (id int, exists bool)

TagID returns the "tag" edge ID in the mutation.

func (*ServiceMutation) TagIDs added in v0.4.3

func (m *ServiceMutation) TagIDs() (ids []int)

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

func (ServiceMutation) Tx added in v0.4.3

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

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

func (*ServiceMutation) Type added in v0.4.3

func (m *ServiceMutation) Type() string

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

func (*ServiceMutation) Where added in v0.4.3

func (m *ServiceMutation) Where(ps ...predicate.Service)

Where appends a list predicates to the ServiceMutation builder.

type ServiceQuery added in v0.3.0

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

ServiceQuery is the builder for querying Service entities.

func (*ServiceQuery) All added in v0.3.0

func (sq *ServiceQuery) All(ctx context.Context) ([]*Service, error)

All executes the query and returns a list of Services.

func (*ServiceQuery) AllX added in v0.3.0

func (sq *ServiceQuery) AllX(ctx context.Context) []*Service

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

func (*ServiceQuery) Clone added in v0.3.0

func (sq *ServiceQuery) Clone() *ServiceQuery

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

func (*ServiceQuery) Count added in v0.3.0

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

Count returns the count of the given query.

func (*ServiceQuery) CountX added in v0.3.0

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

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

func (*ServiceQuery) Exist added in v0.3.0

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

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

func (*ServiceQuery) ExistX added in v0.3.0

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

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

func (*ServiceQuery) First added in v0.3.0

func (sq *ServiceQuery) First(ctx context.Context) (*Service, error)

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

func (*ServiceQuery) FirstID added in v0.3.0

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

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

func (*ServiceQuery) FirstIDX added in v0.4.3

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

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

func (*ServiceQuery) FirstX added in v0.3.0

func (sq *ServiceQuery) FirstX(ctx context.Context) *Service

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

func (*ServiceQuery) GroupBy added in v0.3.0

func (sq *ServiceQuery) GroupBy(field string, fields ...string) *ServiceGroupBy

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.Service.Query().
	GroupBy(service.FieldName).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*ServiceQuery) IDs added in v0.3.0

func (sq *ServiceQuery) IDs(ctx context.Context) ([]int, error)

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

func (*ServiceQuery) IDsX added in v0.3.0

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

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

func (*ServiceQuery) Limit added in v0.3.0

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

Limit adds a limit step to the query.

func (*ServiceQuery) Offset added in v0.3.0

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

Offset adds an offset step to the query.

func (*ServiceQuery) Only added in v0.3.0

func (sq *ServiceQuery) Only(ctx context.Context) (*Service, error)

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

func (*ServiceQuery) OnlyID added in v0.3.0

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

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

func (*ServiceQuery) OnlyIDX added in v0.4.3

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

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

func (*ServiceQuery) OnlyX added in v0.3.0

func (sq *ServiceQuery) OnlyX(ctx context.Context) *Service

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

func (*ServiceQuery) Order added in v0.3.0

func (sq *ServiceQuery) Order(o ...OrderFunc) *ServiceQuery

Order adds an order step to the query.

func (*ServiceQuery) QueryEvents added in v0.3.0

func (sq *ServiceQuery) QueryEvents() *EventQuery

QueryEvents chains the current query on the "events" edge.

func (*ServiceQuery) QueryTag added in v0.3.0

func (sq *ServiceQuery) QueryTag() *TagQuery

QueryTag chains the current query on the "tag" edge.

func (*ServiceQuery) Select added in v0.3.0

func (sq *ServiceQuery) Select(fields ...string) *ServiceSelect

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.Service.Query().
	Select(service.FieldName).
	Scan(ctx, &v)

func (*ServiceQuery) Unique added in v0.4.3

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

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 (*ServiceQuery) Where added in v0.3.0

func (sq *ServiceQuery) Where(ps ...predicate.Service) *ServiceQuery

Where adds a new predicate for the ServiceQuery builder.

func (*ServiceQuery) WithEvents added in v0.3.0

func (sq *ServiceQuery) WithEvents(opts ...func(*EventQuery)) *ServiceQuery

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

func (*ServiceQuery) WithTag added in v0.3.0

func (sq *ServiceQuery) WithTag(opts ...func(*TagQuery)) *ServiceQuery

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

type ServiceSelect added in v0.3.0

type ServiceSelect struct {
	*ServiceQuery
	// contains filtered or unexported fields
}

ServiceSelect is the builder for selecting fields of Service entities.

func (*ServiceSelect) Bool added in v0.4.3

func (ss *ServiceSelect) Bool(ctx context.Context) (_ bool, err error)

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

func (*ServiceSelect) BoolX added in v0.4.3

func (ss *ServiceSelect) BoolX(ctx context.Context) bool

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

func (*ServiceSelect) Bools added in v0.3.0

func (ss *ServiceSelect) Bools(ctx context.Context) ([]bool, error)

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

func (*ServiceSelect) BoolsX added in v0.3.0

func (ss *ServiceSelect) BoolsX(ctx context.Context) []bool

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

func (*ServiceSelect) Float64 added in v0.4.3

func (ss *ServiceSelect) Float64(ctx context.Context) (_ float64, err error)

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

func (*ServiceSelect) Float64X added in v0.4.3

func (ss *ServiceSelect) Float64X(ctx context.Context) float64

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

func (*ServiceSelect) Float64s added in v0.3.0

func (ss *ServiceSelect) Float64s(ctx context.Context) ([]float64, error)

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

func (*ServiceSelect) Float64sX added in v0.3.0

func (ss *ServiceSelect) Float64sX(ctx context.Context) []float64

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

func (*ServiceSelect) Int added in v0.4.3

func (ss *ServiceSelect) Int(ctx context.Context) (_ int, err error)

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

func (*ServiceSelect) IntX added in v0.4.3

func (ss *ServiceSelect) IntX(ctx context.Context) int

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

func (*ServiceSelect) Ints added in v0.3.0

func (ss *ServiceSelect) Ints(ctx context.Context) ([]int, error)

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

func (*ServiceSelect) IntsX added in v0.3.0

func (ss *ServiceSelect) IntsX(ctx context.Context) []int

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

func (*ServiceSelect) Scan added in v0.3.0

func (ss *ServiceSelect) Scan(ctx context.Context, v interface{}) error

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

func (*ServiceSelect) ScanX added in v0.3.0

func (ss *ServiceSelect) ScanX(ctx context.Context, v interface{})

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

func (*ServiceSelect) String added in v0.4.3

func (ss *ServiceSelect) String(ctx context.Context) (_ string, err error)

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

func (*ServiceSelect) StringX added in v0.4.3

func (ss *ServiceSelect) StringX(ctx context.Context) string

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

func (*ServiceSelect) Strings added in v0.3.0

func (ss *ServiceSelect) Strings(ctx context.Context) ([]string, error)

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

func (*ServiceSelect) StringsX added in v0.3.0

func (ss *ServiceSelect) StringsX(ctx context.Context) []string

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

type ServiceUpdate added in v0.3.0

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

ServiceUpdate is the builder for updating Service entities.

func (*ServiceUpdate) AddEventIDs added in v0.3.0

func (su *ServiceUpdate) AddEventIDs(ids ...int) *ServiceUpdate

AddEventIDs adds the "events" edge to the Event entity by IDs.

func (*ServiceUpdate) AddEvents added in v0.3.0

func (su *ServiceUpdate) AddEvents(e ...*Event) *ServiceUpdate

AddEvents adds the "events" edges to the Event entity.

func (*ServiceUpdate) ClearEvents added in v0.4.3

func (su *ServiceUpdate) ClearEvents() *ServiceUpdate

ClearEvents clears all "events" edges to the Event entity.

func (*ServiceUpdate) ClearTag added in v0.3.0

func (su *ServiceUpdate) ClearTag() *ServiceUpdate

ClearTag clears the "tag" edge to the Tag entity.

func (*ServiceUpdate) Exec added in v0.3.0

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

Exec executes the query.

func (*ServiceUpdate) ExecX added in v0.3.0

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

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

func (*ServiceUpdate) Mutation added in v0.4.3

func (su *ServiceUpdate) Mutation() *ServiceMutation

Mutation returns the ServiceMutation object of the builder.

func (*ServiceUpdate) RemoveEventIDs added in v0.3.0

func (su *ServiceUpdate) RemoveEventIDs(ids ...int) *ServiceUpdate

RemoveEventIDs removes the "events" edge to Event entities by IDs.

func (*ServiceUpdate) RemoveEvents added in v0.3.0

func (su *ServiceUpdate) RemoveEvents(e ...*Event) *ServiceUpdate

RemoveEvents removes "events" edges to Event entities.

func (*ServiceUpdate) Save added in v0.3.0

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

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

func (*ServiceUpdate) SaveX added in v0.3.0

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

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

func (*ServiceUpdate) SetConfig added in v0.4.0

func (su *ServiceUpdate) SetConfig(s string) *ServiceUpdate

SetConfig sets the "Config" field.

func (*ServiceUpdate) SetIsActivated added in v0.3.0

func (su *ServiceUpdate) SetIsActivated(b bool) *ServiceUpdate

SetIsActivated sets the "IsActivated" field.

func (*ServiceUpdate) SetName added in v0.3.0

func (su *ServiceUpdate) SetName(s string) *ServiceUpdate

SetName sets the "Name" field.

func (*ServiceUpdate) SetNillableConfig added in v0.4.0

func (su *ServiceUpdate) SetNillableConfig(s *string) *ServiceUpdate

SetNillableConfig sets the "Config" field if the given value is not nil.

func (*ServiceUpdate) SetNillableIsActivated added in v0.3.0

func (su *ServiceUpdate) SetNillableIsActivated(b *bool) *ServiceUpdate

SetNillableIsActivated sets the "IsActivated" field if the given value is not nil.

func (*ServiceUpdate) SetPubKey added in v0.3.0

func (su *ServiceUpdate) SetPubKey(s string) *ServiceUpdate

SetPubKey sets the "PubKey" field.

func (*ServiceUpdate) SetTag added in v0.3.0

func (su *ServiceUpdate) SetTag(t *Tag) *ServiceUpdate

SetTag sets the "tag" edge to the Tag entity.

func (*ServiceUpdate) SetTagID added in v0.3.0

func (su *ServiceUpdate) SetTagID(id int) *ServiceUpdate

SetTagID sets the "tag" edge to the Tag entity by ID.

func (*ServiceUpdate) Where added in v0.3.0

func (su *ServiceUpdate) Where(ps ...predicate.Service) *ServiceUpdate

Where appends a list predicates to the ServiceUpdate builder.

type ServiceUpdateOne added in v0.3.0

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

ServiceUpdateOne is the builder for updating a single Service entity.

func (*ServiceUpdateOne) AddEventIDs added in v0.3.0

func (suo *ServiceUpdateOne) AddEventIDs(ids ...int) *ServiceUpdateOne

AddEventIDs adds the "events" edge to the Event entity by IDs.

func (*ServiceUpdateOne) AddEvents added in v0.3.0

func (suo *ServiceUpdateOne) AddEvents(e ...*Event) *ServiceUpdateOne

AddEvents adds the "events" edges to the Event entity.

func (*ServiceUpdateOne) ClearEvents added in v0.4.3

func (suo *ServiceUpdateOne) ClearEvents() *ServiceUpdateOne

ClearEvents clears all "events" edges to the Event entity.

func (*ServiceUpdateOne) ClearTag added in v0.3.0

func (suo *ServiceUpdateOne) ClearTag() *ServiceUpdateOne

ClearTag clears the "tag" edge to the Tag entity.

func (*ServiceUpdateOne) Exec added in v0.3.0

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

Exec executes the query on the entity.

func (*ServiceUpdateOne) ExecX added in v0.3.0

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

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

func (*ServiceUpdateOne) Mutation added in v0.4.3

func (suo *ServiceUpdateOne) Mutation() *ServiceMutation

Mutation returns the ServiceMutation object of the builder.

func (*ServiceUpdateOne) RemoveEventIDs added in v0.3.0

func (suo *ServiceUpdateOne) RemoveEventIDs(ids ...int) *ServiceUpdateOne

RemoveEventIDs removes the "events" edge to Event entities by IDs.

func (*ServiceUpdateOne) RemoveEvents added in v0.3.0

func (suo *ServiceUpdateOne) RemoveEvents(e ...*Event) *ServiceUpdateOne

RemoveEvents removes "events" edges to Event entities.

func (*ServiceUpdateOne) Save added in v0.3.0

func (suo *ServiceUpdateOne) Save(ctx context.Context) (*Service, error)

Save executes the query and returns the updated Service entity.

func (*ServiceUpdateOne) SaveX added in v0.3.0

func (suo *ServiceUpdateOne) SaveX(ctx context.Context) *Service

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

func (*ServiceUpdateOne) Select added in v0.4.3

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

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

func (*ServiceUpdateOne) SetConfig added in v0.4.0

func (suo *ServiceUpdateOne) SetConfig(s string) *ServiceUpdateOne

SetConfig sets the "Config" field.

func (*ServiceUpdateOne) SetIsActivated added in v0.3.0

func (suo *ServiceUpdateOne) SetIsActivated(b bool) *ServiceUpdateOne

SetIsActivated sets the "IsActivated" field.

func (*ServiceUpdateOne) SetName added in v0.3.0

func (suo *ServiceUpdateOne) SetName(s string) *ServiceUpdateOne

SetName sets the "Name" field.

func (*ServiceUpdateOne) SetNillableConfig added in v0.4.0

func (suo *ServiceUpdateOne) SetNillableConfig(s *string) *ServiceUpdateOne

SetNillableConfig sets the "Config" field if the given value is not nil.

func (*ServiceUpdateOne) SetNillableIsActivated added in v0.3.0

func (suo *ServiceUpdateOne) SetNillableIsActivated(b *bool) *ServiceUpdateOne

SetNillableIsActivated sets the "IsActivated" field if the given value is not nil.

func (*ServiceUpdateOne) SetPubKey added in v0.3.0

func (suo *ServiceUpdateOne) SetPubKey(s string) *ServiceUpdateOne

SetPubKey sets the "PubKey" field.

func (*ServiceUpdateOne) SetTag added in v0.3.0

func (suo *ServiceUpdateOne) SetTag(t *Tag) *ServiceUpdateOne

SetTag sets the "tag" edge to the Tag entity.

func (*ServiceUpdateOne) SetTagID added in v0.3.0

func (suo *ServiceUpdateOne) SetTagID(id int) *ServiceUpdateOne

SetTagID sets the "tag" edge to the Tag entity by ID.

type Services added in v0.3.0

type Services []*Service

Services is a parsable slice of Service.

type Tag

type Tag struct {

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

Tag is the model entity for the Tag schema.

Example
if dsn == "" {
	return
}
ctx := context.Background()
drv, err := sql.Open("mysql", dsn)
if err != nil {
	log.Fatalf("failed creating database client: %v", err)
}
defer drv.Close()
client := NewClient(Driver(drv))
// creating vertices for the tag's edges.

// create tag vertex with its edges.
t := client.Tag.
	Create().
	SetName("string").
	SaveX(ctx)
log.Println("tag created:", t)

// query edges.
Output:

func (*Tag) QueryJobs

func (t *Tag) QueryJobs() *JobQuery

QueryJobs queries the "jobs" edge of the Tag entity.

func (*Tag) QueryTargets

func (t *Tag) QueryTargets() *TargetQuery

QueryTargets queries the "targets" edge of the Tag entity.

func (*Tag) QueryTasks

func (t *Tag) QueryTasks() *TaskQuery

QueryTasks queries the "tasks" edge of the Tag entity.

func (*Tag) String

func (t *Tag) String() string

String implements the fmt.Stringer.

func (*Tag) Unwrap

func (t *Tag) Unwrap() *Tag

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

func (t *Tag) Update() *TagUpdateOne

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

type TagClient

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

TagClient is a client for the Tag schema.

func NewTagClient

func NewTagClient(c config) *TagClient

NewTagClient returns a client for the Tag from the given config.

func (*TagClient) Create

func (c *TagClient) Create() *TagCreate

Create returns a create builder for Tag.

func (*TagClient) CreateBulk added in v0.4.3

func (c *TagClient) CreateBulk(builders ...*TagCreate) *TagCreateBulk

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

func (*TagClient) Delete

func (c *TagClient) Delete() *TagDelete

Delete returns a delete builder for Tag.

func (*TagClient) DeleteOne

func (c *TagClient) DeleteOne(t *Tag) *TagDeleteOne

DeleteOne returns a delete builder for the given entity.

func (*TagClient) DeleteOneID

func (c *TagClient) DeleteOneID(id int) *TagDeleteOne

DeleteOneID returns a delete builder for the given id.

func (*TagClient) Get

func (c *TagClient) Get(ctx context.Context, id int) (*Tag, error)

Get returns a Tag entity by its id.

func (*TagClient) GetX

func (c *TagClient) GetX(ctx context.Context, id int) *Tag

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

func (*TagClient) Hooks added in v0.4.3

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

Hooks returns the client hooks.

func (*TagClient) Query

func (c *TagClient) Query() *TagQuery

Query returns a query builder for Tag.

func (*TagClient) QueryJobs

func (c *TagClient) QueryJobs(t *Tag) *JobQuery

QueryJobs queries the jobs edge of a Tag.

func (*TagClient) QueryTargets

func (c *TagClient) QueryTargets(t *Tag) *TargetQuery

QueryTargets queries the targets edge of a Tag.

func (*TagClient) QueryTasks

func (c *TagClient) QueryTasks(t *Tag) *TaskQuery

QueryTasks queries the tasks edge of a Tag.

func (*TagClient) Update

func (c *TagClient) Update() *TagUpdate

Update returns an update builder for Tag.

func (*TagClient) UpdateOne

func (c *TagClient) UpdateOne(t *Tag) *TagUpdateOne

UpdateOne returns an update builder for the given entity.

func (*TagClient) UpdateOneID

func (c *TagClient) UpdateOneID(id int) *TagUpdateOne

UpdateOneID returns an update builder for the given id.

func (*TagClient) Use added in v0.4.3

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

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

type TagCreate

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

TagCreate is the builder for creating a Tag entity.

func (*TagCreate) AddJobIDs

func (tc *TagCreate) AddJobIDs(ids ...int) *TagCreate

AddJobIDs adds the "jobs" edge to the Job entity by IDs.

func (*TagCreate) AddJobs

func (tc *TagCreate) AddJobs(j ...*Job) *TagCreate

AddJobs adds the "jobs" edges to the Job entity.

func (*TagCreate) AddTargetIDs

func (tc *TagCreate) AddTargetIDs(ids ...int) *TagCreate

AddTargetIDs adds the "targets" edge to the Target entity by IDs.

func (*TagCreate) AddTargets

func (tc *TagCreate) AddTargets(t ...*Target) *TagCreate

AddTargets adds the "targets" edges to the Target entity.

func (*TagCreate) AddTaskIDs

func (tc *TagCreate) AddTaskIDs(ids ...int) *TagCreate

AddTaskIDs adds the "tasks" edge to the Task entity by IDs.

func (*TagCreate) AddTasks

func (tc *TagCreate) AddTasks(t ...*Task) *TagCreate

AddTasks adds the "tasks" edges to the Task entity.

func (*TagCreate) Exec added in v0.4.3

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

Exec executes the query.

func (*TagCreate) ExecX added in v0.4.3

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

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

func (*TagCreate) Mutation added in v0.4.3

func (tc *TagCreate) Mutation() *TagMutation

Mutation returns the TagMutation object of the builder.

func (*TagCreate) Save

func (tc *TagCreate) Save(ctx context.Context) (*Tag, error)

Save creates the Tag in the database.

func (*TagCreate) SaveX

func (tc *TagCreate) SaveX(ctx context.Context) *Tag

SaveX calls Save and panics if Save returns an error.

func (*TagCreate) SetName

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

SetName sets the "Name" field.

type TagCreateBulk added in v0.4.3

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

TagCreateBulk is the builder for creating many Tag entities in bulk.

func (*TagCreateBulk) Exec added in v0.4.3

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

Exec executes the query.

func (*TagCreateBulk) ExecX added in v0.4.3

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

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

func (*TagCreateBulk) Save added in v0.4.3

func (tcb *TagCreateBulk) Save(ctx context.Context) ([]*Tag, error)

Save creates the Tag entities in the database.

func (*TagCreateBulk) SaveX added in v0.4.3

func (tcb *TagCreateBulk) SaveX(ctx context.Context) []*Tag

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

type TagDelete

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

TagDelete is the builder for deleting a Tag entity.

func (*TagDelete) Exec

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

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

func (*TagDelete) ExecX

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

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

func (*TagDelete) Where

func (td *TagDelete) Where(ps ...predicate.Tag) *TagDelete

Where appends a list predicates to the TagDelete builder.

type TagDeleteOne

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

TagDeleteOne is the builder for deleting a single Tag entity.

func (*TagDeleteOne) Exec

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

Exec executes the deletion query.

func (*TagDeleteOne) ExecX

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

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

type TagEdges added in v0.3.0

type TagEdges struct {
	// Targets holds the value of the targets edge.
	Targets []*Target `json:"targets,omitempty"`
	// Tasks holds the value of the tasks edge.
	Tasks []*Task `json:"tasks,omitempty"`
	// Jobs holds the value of the jobs edge.
	Jobs []*Job `json:"jobs,omitempty"`
	// contains filtered or unexported fields
}

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

func (TagEdges) JobsOrErr added in v0.3.0

func (e TagEdges) JobsOrErr() ([]*Job, error)

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

func (TagEdges) TargetsOrErr added in v0.3.0

func (e TagEdges) TargetsOrErr() ([]*Target, error)

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

func (TagEdges) TasksOrErr added in v0.3.0

func (e TagEdges) TasksOrErr() ([]*Task, error)

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

type TagGroupBy

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

TagGroupBy is the group-by builder for Tag entities.

func (*TagGroupBy) Aggregate

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

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

func (*TagGroupBy) Bool added in v0.4.3

func (tgb *TagGroupBy) 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 (*TagGroupBy) BoolX added in v0.4.3

func (tgb *TagGroupBy) BoolX(ctx context.Context) bool

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

func (*TagGroupBy) Bools

func (tgb *TagGroupBy) 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 (*TagGroupBy) BoolsX

func (tgb *TagGroupBy) BoolsX(ctx context.Context) []bool

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

func (*TagGroupBy) Float64 added in v0.4.3

func (tgb *TagGroupBy) 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 (*TagGroupBy) Float64X added in v0.4.3

func (tgb *TagGroupBy) Float64X(ctx context.Context) float64

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

func (*TagGroupBy) Float64s

func (tgb *TagGroupBy) 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 (*TagGroupBy) Float64sX

func (tgb *TagGroupBy) Float64sX(ctx context.Context) []float64

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

func (*TagGroupBy) Int added in v0.4.3

func (tgb *TagGroupBy) 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 (*TagGroupBy) IntX added in v0.4.3

func (tgb *TagGroupBy) IntX(ctx context.Context) int

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

func (*TagGroupBy) Ints

func (tgb *TagGroupBy) 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 (*TagGroupBy) IntsX

func (tgb *TagGroupBy) IntsX(ctx context.Context) []int

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

func (*TagGroupBy) Scan

func (tgb *TagGroupBy) Scan(ctx context.Context, v interface{}) error

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

func (*TagGroupBy) ScanX

func (tgb *TagGroupBy) ScanX(ctx context.Context, v interface{})

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

func (*TagGroupBy) String added in v0.4.3

func (tgb *TagGroupBy) 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 (*TagGroupBy) StringX added in v0.4.3

func (tgb *TagGroupBy) StringX(ctx context.Context) string

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

func (*TagGroupBy) Strings

func (tgb *TagGroupBy) 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 (*TagGroupBy) StringsX

func (tgb *TagGroupBy) StringsX(ctx context.Context) []string

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

type TagMutation added in v0.4.3

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

TagMutation represents an operation that mutates the Tag nodes in the graph.

func (*TagMutation) AddField added in v0.4.3

func (m *TagMutation) 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 (*TagMutation) AddJobIDs added in v0.4.3

func (m *TagMutation) AddJobIDs(ids ...int)

AddJobIDs adds the "jobs" edge to the Job entity by ids.

func (*TagMutation) AddTargetIDs added in v0.4.3

func (m *TagMutation) AddTargetIDs(ids ...int)

AddTargetIDs adds the "targets" edge to the Target entity by ids.

func (*TagMutation) AddTaskIDs added in v0.4.3

func (m *TagMutation) AddTaskIDs(ids ...int)

AddTaskIDs adds the "tasks" edge to the Task entity by ids.

func (*TagMutation) AddedEdges added in v0.4.3

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

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

func (*TagMutation) AddedField added in v0.4.3

func (m *TagMutation) 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 (*TagMutation) AddedFields added in v0.4.3

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

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

func (*TagMutation) AddedIDs added in v0.4.3

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

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

func (*TagMutation) ClearEdge added in v0.4.3

func (m *TagMutation) 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 (*TagMutation) ClearField added in v0.4.3

func (m *TagMutation) 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 (*TagMutation) ClearJobs added in v0.4.3

func (m *TagMutation) ClearJobs()

ClearJobs clears the "jobs" edge to the Job entity.

func (*TagMutation) ClearTargets added in v0.4.3

func (m *TagMutation) ClearTargets()

ClearTargets clears the "targets" edge to the Target entity.

func (*TagMutation) ClearTasks added in v0.4.3

func (m *TagMutation) ClearTasks()

ClearTasks clears the "tasks" edge to the Task entity.

func (*TagMutation) ClearedEdges added in v0.4.3

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

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

func (*TagMutation) ClearedFields added in v0.4.3

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

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

func (TagMutation) Client added in v0.4.3

func (m TagMutation) 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 (*TagMutation) EdgeCleared added in v0.4.3

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

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

func (*TagMutation) Field added in v0.4.3

func (m *TagMutation) 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 (*TagMutation) FieldCleared added in v0.4.3

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

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

func (*TagMutation) Fields added in v0.4.3

func (m *TagMutation) 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 (*TagMutation) ID added in v0.4.3

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

func (m *TagMutation) 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 (*TagMutation) JobsCleared added in v0.4.3

func (m *TagMutation) JobsCleared() bool

JobsCleared reports if the "jobs" edge to the Job entity was cleared.

func (*TagMutation) JobsIDs added in v0.4.3

func (m *TagMutation) JobsIDs() (ids []int)

JobsIDs returns the "jobs" edge IDs in the mutation.

func (*TagMutation) Name added in v0.4.3

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

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

func (*TagMutation) OldField added in v0.4.3

func (m *TagMutation) 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 (*TagMutation) OldName added in v0.4.3

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

OldName returns the old "Name" field's value of the Tag entity. If the Tag 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 (*TagMutation) Op added in v0.4.3

func (m *TagMutation) Op() Op

Op returns the operation name.

func (*TagMutation) RemoveJobIDs added in v0.4.3

func (m *TagMutation) RemoveJobIDs(ids ...int)

RemoveJobIDs removes the "jobs" edge to the Job entity by IDs.

func (*TagMutation) RemoveTargetIDs added in v0.4.3

func (m *TagMutation) RemoveTargetIDs(ids ...int)

RemoveTargetIDs removes the "targets" edge to the Target entity by IDs.

func (*TagMutation) RemoveTaskIDs added in v0.4.3

func (m *TagMutation) RemoveTaskIDs(ids ...int)

RemoveTaskIDs removes the "tasks" edge to the Task entity by IDs.

func (*TagMutation) RemovedEdges added in v0.4.3

func (m *TagMutation) RemovedEdges() []string

RemovedEdges returns all edge names that were removed in this mutation.

func (*TagMutation) RemovedIDs added in v0.4.3

func (m *TagMutation) 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 (*TagMutation) RemovedJobsIDs added in v0.4.3

func (m *TagMutation) RemovedJobsIDs() (ids []int)

RemovedJobs returns the removed IDs of the "jobs" edge to the Job entity.

func (*TagMutation) RemovedTargetsIDs added in v0.4.3

func (m *TagMutation) RemovedTargetsIDs() (ids []int)

RemovedTargets returns the removed IDs of the "targets" edge to the Target entity.

func (*TagMutation) RemovedTasksIDs added in v0.4.3

func (m *TagMutation) RemovedTasksIDs() (ids []int)

RemovedTasks returns the removed IDs of the "tasks" edge to the Task entity.

func (*TagMutation) ResetEdge added in v0.4.3

func (m *TagMutation) 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 (*TagMutation) ResetField added in v0.4.3

func (m *TagMutation) 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 (*TagMutation) ResetJobs added in v0.4.3

func (m *TagMutation) ResetJobs()

ResetJobs resets all changes to the "jobs" edge.

func (*TagMutation) ResetName added in v0.4.3

func (m *TagMutation) ResetName()

ResetName resets all changes to the "Name" field.

func (*TagMutation) ResetTargets added in v0.4.3

func (m *TagMutation) ResetTargets()

ResetTargets resets all changes to the "targets" edge.

func (*TagMutation) ResetTasks added in v0.4.3

func (m *TagMutation) ResetTasks()

ResetTasks resets all changes to the "tasks" edge.

func (*TagMutation) SetField added in v0.4.3

func (m *TagMutation) 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 (*TagMutation) SetName added in v0.4.3

func (m *TagMutation) SetName(s string)

SetName sets the "Name" field.

func (*TagMutation) TargetsCleared added in v0.4.3

func (m *TagMutation) TargetsCleared() bool

TargetsCleared reports if the "targets" edge to the Target entity was cleared.

func (*TagMutation) TargetsIDs added in v0.4.3

func (m *TagMutation) TargetsIDs() (ids []int)

TargetsIDs returns the "targets" edge IDs in the mutation.

func (*TagMutation) TasksCleared added in v0.4.3

func (m *TagMutation) TasksCleared() bool

TasksCleared reports if the "tasks" edge to the Task entity was cleared.

func (*TagMutation) TasksIDs added in v0.4.3

func (m *TagMutation) TasksIDs() (ids []int)

TasksIDs returns the "tasks" edge IDs in the mutation.

func (TagMutation) Tx added in v0.4.3

func (m TagMutation) Tx() (*Tx, error)

Tx returns an `ent.Tx` for mutations that were executed in transactions; it returns an error otherwise.

func (*TagMutation) Type added in v0.4.3

func (m *TagMutation) Type() string

Type returns the node type of this mutation (Tag).

func (*TagMutation) Where added in v0.4.3

func (m *TagMutation) Where(ps ...predicate.Tag)

Where appends a list predicates to the TagMutation builder.

type TagQuery

type TagQuery struct {
	// contains filtered or unexported fields
}

TagQuery is the builder for querying Tag entities.

func (*TagQuery) All

func (tq *TagQuery) All(ctx context.Context) ([]*Tag, error)

All executes the query and returns a list of Tags.

func (*TagQuery) AllX

func (tq *TagQuery) AllX(ctx context.Context) []*Tag

AllX is like All, but panics if an error occurs.

func (*TagQuery) Clone

func (tq *TagQuery) Clone() *TagQuery

Clone returns a duplicate of the TagQuery builder, including all associated steps. It can be used to prepare common query builders and use them differently after the clone is made.

func (*TagQuery) Count

func (tq *TagQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*TagQuery) CountX

func (tq *TagQuery) CountX(ctx context.Context) int

CountX is like Count, but panics if an error occurs.

func (*TagQuery) Exist

func (tq *TagQuery) Exist(ctx context.Context) (bool, error)

Exist returns true if the query has elements in the graph.

func (*TagQuery) ExistX

func (tq *TagQuery) ExistX(ctx context.Context) bool

ExistX is like Exist, but panics if an error occurs.

func (*TagQuery) First

func (tq *TagQuery) First(ctx context.Context) (*Tag, error)

First returns the first Tag entity from the query. Returns a *NotFoundError when no Tag was found.

func (*TagQuery) FirstID

func (tq *TagQuery) FirstID(ctx context.Context) (id int, err error)

FirstID returns the first Tag ID from the query. Returns a *NotFoundError when no Tag ID was found.

func (*TagQuery) FirstIDX added in v0.4.3

func (tq *TagQuery) FirstIDX(ctx context.Context) int

FirstIDX is like FirstID, but panics if an error occurs.

func (*TagQuery) FirstX

func (tq *TagQuery) FirstX(ctx context.Context) *Tag

FirstX is like First, but panics if an error occurs.

func (*TagQuery) GroupBy

func (tq *TagQuery) GroupBy(field string, fields ...string) *TagGroupBy

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.Tag.Query().
	GroupBy(tag.FieldName).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*TagQuery) IDs

func (tq *TagQuery) IDs(ctx context.Context) ([]int, error)

IDs executes the query and returns a list of Tag IDs.

func (*TagQuery) IDsX

func (tq *TagQuery) IDsX(ctx context.Context) []int

IDsX is like IDs, but panics if an error occurs.

func (*TagQuery) Limit

func (tq *TagQuery) Limit(limit int) *TagQuery

Limit adds a limit step to the query.

func (*TagQuery) Offset

func (tq *TagQuery) Offset(offset int) *TagQuery

Offset adds an offset step to the query.

func (*TagQuery) Only

func (tq *TagQuery) Only(ctx context.Context) (*Tag, error)

Only returns a single Tag entity found by the query, ensuring it only returns one. Returns a *NotSingularError when exactly one Tag entity is not found. Returns a *NotFoundError when no Tag entities are found.

func (*TagQuery) OnlyID

func (tq *TagQuery) OnlyID(ctx context.Context) (id int, err error)

OnlyID is like Only, but returns the only Tag ID in the query. Returns a *NotSingularError when exactly one Tag ID is not found. Returns a *NotFoundError when no entities are found.

func (*TagQuery) OnlyIDX added in v0.4.3

func (tq *TagQuery) OnlyIDX(ctx context.Context) int

OnlyIDX is like OnlyID, but panics if an error occurs.

func (*TagQuery) OnlyX

func (tq *TagQuery) OnlyX(ctx context.Context) *Tag

OnlyX is like Only, but panics if an error occurs.

func (*TagQuery) Order

func (tq *TagQuery) Order(o ...OrderFunc) *TagQuery

Order adds an order step to the query.

func (*TagQuery) QueryJobs

func (tq *TagQuery) QueryJobs() *JobQuery

QueryJobs chains the current query on the "jobs" edge.

func (*TagQuery) QueryTargets

func (tq *TagQuery) QueryTargets() *TargetQuery

QueryTargets chains the current query on the "targets" edge.

func (*TagQuery) QueryTasks

func (tq *TagQuery) QueryTasks() *TaskQuery

QueryTasks chains the current query on the "tasks" edge.

func (*TagQuery) Select

func (tq *TagQuery) Select(fields ...string) *TagSelect

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.Tag.Query().
	Select(tag.FieldName).
	Scan(ctx, &v)

func (*TagQuery) Unique added in v0.4.3

func (tq *TagQuery) Unique(unique bool) *TagQuery

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 (*TagQuery) Where

func (tq *TagQuery) Where(ps ...predicate.Tag) *TagQuery

Where adds a new predicate for the TagQuery builder.

func (*TagQuery) WithJobs added in v0.2.3

func (tq *TagQuery) WithJobs(opts ...func(*JobQuery)) *TagQuery

WithJobs tells the query-builder to eager-load the nodes that are connected to the "jobs" edge. The optional arguments are used to configure the query builder of the edge.

func (*TagQuery) WithTargets added in v0.2.3

func (tq *TagQuery) WithTargets(opts ...func(*TargetQuery)) *TagQuery

WithTargets tells the query-builder to eager-load the nodes that are connected to the "targets" edge. The optional arguments are used to configure the query builder of the edge.

func (*TagQuery) WithTasks added in v0.2.3

func (tq *TagQuery) WithTasks(opts ...func(*TaskQuery)) *TagQuery

WithTasks tells the query-builder to eager-load the nodes that are connected to the "tasks" edge. The optional arguments are used to configure the query builder of the edge.

type TagSelect

type TagSelect struct {
	*TagQuery
	// contains filtered or unexported fields
}

TagSelect is the builder for selecting fields of Tag entities.

func (*TagSelect) Bool added in v0.4.3

func (ts *TagSelect) Bool(ctx context.Context) (_ bool, err error)

Bool returns a single bool from a selector. It is only allowed when selecting one field.

func (*TagSelect) BoolX added in v0.4.3

func (ts *TagSelect) BoolX(ctx context.Context) bool

BoolX is like Bool, but panics if an error occurs.

func (*TagSelect) Bools

func (ts *TagSelect) Bools(ctx context.Context) ([]bool, error)

Bools returns list of bools from a selector. It is only allowed when selecting one field.

func (*TagSelect) BoolsX

func (ts *TagSelect) BoolsX(ctx context.Context) []bool

BoolsX is like Bools, but panics if an error occurs.

func (*TagSelect) Float64 added in v0.4.3

func (ts *TagSelect) Float64(ctx context.Context) (_ float64, err error)

Float64 returns a single float64 from a selector. It is only allowed when selecting one field.

func (*TagSelect) Float64X added in v0.4.3

func (ts *TagSelect) Float64X(ctx context.Context) float64

Float64X is like Float64, but panics if an error occurs.

func (*TagSelect) Float64s

func (ts *TagSelect) Float64s(ctx context.Context) ([]float64, error)

Float64s returns list of float64s from a selector. It is only allowed when selecting one field.

func (*TagSelect) Float64sX

func (ts *TagSelect) Float64sX(ctx context.Context) []float64

Float64sX is like Float64s, but panics if an error occurs.

func (*TagSelect) Int added in v0.4.3

func (ts *TagSelect) Int(ctx context.Context) (_ int, err error)

Int returns a single int from a selector. It is only allowed when selecting one field.

func (*TagSelect) IntX added in v0.4.3

func (ts *TagSelect) IntX(ctx context.Context) int

IntX is like Int, but panics if an error occurs.

func (*TagSelect) Ints

func (ts *TagSelect) Ints(ctx context.Context) ([]int, error)

Ints returns list of ints from a selector. It is only allowed when selecting one field.

func (*TagSelect) IntsX

func (ts *TagSelect) IntsX(ctx context.Context) []int

IntsX is like Ints, but panics if an error occurs.

func (*TagSelect) Scan

func (ts *TagSelect) Scan(ctx context.Context, v interface{}) error

Scan applies the selector query and scans the result into the given value.

func (*TagSelect) ScanX

func (ts *TagSelect) ScanX(ctx context.Context, v interface{})

ScanX is like Scan, but panics if an error occurs.

func (*TagSelect) String added in v0.4.3

func (ts *TagSelect) String(ctx context.Context) (_ string, err error)

String returns a single string from a selector. It is only allowed when selecting one field.

func (*TagSelect) StringX added in v0.4.3

func (ts *TagSelect) StringX(ctx context.Context) string

StringX is like String, but panics if an error occurs.

func (*TagSelect) Strings

func (ts *TagSelect) Strings(ctx context.Context) ([]string, error)

Strings returns list of strings from a selector. It is only allowed when selecting one field.

func (*TagSelect) StringsX

func (ts *TagSelect) StringsX(ctx context.Context) []string

StringsX is like Strings, but panics if an error occurs.

type TagUpdate

type TagUpdate struct {
	// contains filtered or unexported fields
}

TagUpdate is the builder for updating Tag entities.

func (*TagUpdate) AddJobIDs

func (tu *TagUpdate) AddJobIDs(ids ...int) *TagUpdate

AddJobIDs adds the "jobs" edge to the Job entity by IDs.

func (*TagUpdate) AddJobs

func (tu *TagUpdate) AddJobs(j ...*Job) *TagUpdate

AddJobs adds the "jobs" edges to the Job entity.

func (*TagUpdate) AddTargetIDs

func (tu *TagUpdate) AddTargetIDs(ids ...int) *TagUpdate

AddTargetIDs adds the "targets" edge to the Target entity by IDs.

func (*TagUpdate) AddTargets

func (tu *TagUpdate) AddTargets(t ...*Target) *TagUpdate

AddTargets adds the "targets" edges to the Target entity.

func (*TagUpdate) AddTaskIDs

func (tu *TagUpdate) AddTaskIDs(ids ...int) *TagUpdate

AddTaskIDs adds the "tasks" edge to the Task entity by IDs.

func (*TagUpdate) AddTasks

func (tu *TagUpdate) AddTasks(t ...*Task) *TagUpdate

AddTasks adds the "tasks" edges to the Task entity.

func (*TagUpdate) ClearJobs added in v0.4.3

func (tu *TagUpdate) ClearJobs() *TagUpdate

ClearJobs clears all "jobs" edges to the Job entity.

func (*TagUpdate) ClearTargets added in v0.4.3

func (tu *TagUpdate) ClearTargets() *TagUpdate

ClearTargets clears all "targets" edges to the Target entity.

func (*TagUpdate) ClearTasks added in v0.4.3

func (tu *TagUpdate) ClearTasks() *TagUpdate

ClearTasks clears all "tasks" edges to the Task entity.

func (*TagUpdate) Exec

func (tu *TagUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*TagUpdate) ExecX

func (tu *TagUpdate) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*TagUpdate) Mutation added in v0.4.3

func (tu *TagUpdate) Mutation() *TagMutation

Mutation returns the TagMutation object of the builder.

func (*TagUpdate) RemoveJobIDs

func (tu *TagUpdate) RemoveJobIDs(ids ...int) *TagUpdate

RemoveJobIDs removes the "jobs" edge to Job entities by IDs.

func (*TagUpdate) RemoveJobs

func (tu *TagUpdate) RemoveJobs(j ...*Job) *TagUpdate

RemoveJobs removes "jobs" edges to Job entities.

func (*TagUpdate) RemoveTargetIDs

func (tu *TagUpdate) RemoveTargetIDs(ids ...int) *TagUpdate

RemoveTargetIDs removes the "targets" edge to Target entities by IDs.

func (*TagUpdate) RemoveTargets

func (tu *TagUpdate) RemoveTargets(t ...*Target) *TagUpdate

RemoveTargets removes "targets" edges to Target entities.

func (*TagUpdate) RemoveTaskIDs

func (tu *TagUpdate) RemoveTaskIDs(ids ...int) *TagUpdate

RemoveTaskIDs removes the "tasks" edge to Task entities by IDs.

func (*TagUpdate) RemoveTasks

func (tu *TagUpdate) RemoveTasks(t ...*Task) *TagUpdate

RemoveTasks removes "tasks" edges to Task entities.

func (*TagUpdate) Save

func (tu *TagUpdate) Save(ctx context.Context) (int, error)

Save executes the query and returns the number of nodes affected by the update operation.

func (*TagUpdate) SaveX

func (tu *TagUpdate) SaveX(ctx context.Context) int

SaveX is like Save, but panics if an error occurs.

func (*TagUpdate) SetName

func (tu *TagUpdate) SetName(s string) *TagUpdate

SetName sets the "Name" field.

func (*TagUpdate) Where

func (tu *TagUpdate) Where(ps ...predicate.Tag) *TagUpdate

Where appends a list predicates to the TagUpdate builder.

type TagUpdateOne

type TagUpdateOne struct {
	// contains filtered or unexported fields
}

TagUpdateOne is the builder for updating a single Tag entity.

func (*TagUpdateOne) AddJobIDs

func (tuo *TagUpdateOne) AddJobIDs(ids ...int) *TagUpdateOne

AddJobIDs adds the "jobs" edge to the Job entity by IDs.

func (*TagUpdateOne) AddJobs

func (tuo *TagUpdateOne) AddJobs(j ...*Job) *TagUpdateOne

AddJobs adds the "jobs" edges to the Job entity.

func (*TagUpdateOne) AddTargetIDs

func (tuo *TagUpdateOne) AddTargetIDs(ids ...int) *TagUpdateOne

AddTargetIDs adds the "targets" edge to the Target entity by IDs.

func (*TagUpdateOne) AddTargets

func (tuo *TagUpdateOne) AddTargets(t ...*Target) *TagUpdateOne

AddTargets adds the "targets" edges to the Target entity.

func (*TagUpdateOne) AddTaskIDs

func (tuo *TagUpdateOne) AddTaskIDs(ids ...int) *TagUpdateOne

AddTaskIDs adds the "tasks" edge to the Task entity by IDs.

func (*TagUpdateOne) AddTasks

func (tuo *TagUpdateOne) AddTasks(t ...*Task) *TagUpdateOne

AddTasks adds the "tasks" edges to the Task entity.

func (*TagUpdateOne) ClearJobs added in v0.4.3

func (tuo *TagUpdateOne) ClearJobs() *TagUpdateOne

ClearJobs clears all "jobs" edges to the Job entity.

func (*TagUpdateOne) ClearTargets added in v0.4.3

func (tuo *TagUpdateOne) ClearTargets() *TagUpdateOne

ClearTargets clears all "targets" edges to the Target entity.

func (*TagUpdateOne) ClearTasks added in v0.4.3

func (tuo *TagUpdateOne) ClearTasks() *TagUpdateOne

ClearTasks clears all "tasks" edges to the Task entity.

func (*TagUpdateOne) Exec

func (tuo *TagUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*TagUpdateOne) ExecX

func (tuo *TagUpdateOne) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*TagUpdateOne) Mutation added in v0.4.3

func (tuo *TagUpdateOne) Mutation() *TagMutation

Mutation returns the TagMutation object of the builder.

func (*TagUpdateOne) RemoveJobIDs

func (tuo *TagUpdateOne) RemoveJobIDs(ids ...int) *TagUpdateOne

RemoveJobIDs removes the "jobs" edge to Job entities by IDs.

func (*TagUpdateOne) RemoveJobs

func (tuo *TagUpdateOne) RemoveJobs(j ...*Job) *TagUpdateOne

RemoveJobs removes "jobs" edges to Job entities.

func (*TagUpdateOne) RemoveTargetIDs

func (tuo *TagUpdateOne) RemoveTargetIDs(ids ...int) *TagUpdateOne

RemoveTargetIDs removes the "targets" edge to Target entities by IDs.

func (*TagUpdateOne) RemoveTargets

func (tuo *TagUpdateOne) RemoveTargets(t ...*Target) *TagUpdateOne

RemoveTargets removes "targets" edges to Target entities.

func (*TagUpdateOne) RemoveTaskIDs

func (tuo *TagUpdateOne) RemoveTaskIDs(ids ...int) *TagUpdateOne

RemoveTaskIDs removes the "tasks" edge to Task entities by IDs.

func (*TagUpdateOne) RemoveTasks

func (tuo *TagUpdateOne) RemoveTasks(t ...*Task) *TagUpdateOne

RemoveTasks removes "tasks" edges to Task entities.

func (*TagUpdateOne) Save

func (tuo *TagUpdateOne) Save(ctx context.Context) (*Tag, error)

Save executes the query and returns the updated Tag entity.

func (*TagUpdateOne) SaveX

func (tuo *TagUpdateOne) SaveX(ctx context.Context) *Tag

SaveX is like Save, but panics if an error occurs.

func (*TagUpdateOne) Select added in v0.4.3

func (tuo *TagUpdateOne) Select(field string, fields ...string) *TagUpdateOne

Select allows selecting one or more fields (columns) of the returned entity. The default is selecting all fields defined in the entity schema.

func (*TagUpdateOne) SetName

func (tuo *TagUpdateOne) SetName(s string) *TagUpdateOne

SetName sets the "Name" field.

type Tags

type Tags []*Tag

Tags is a parsable slice of Tag.

type Target

type Target struct {

	// ID of the ent.
	ID int `json:"id,omitempty"`
	// Name holds the value of the "Name" field.
	// The name of the Target
	Name string `json:"Name,omitempty"`
	// OS holds the value of the "OS" field.
	// The OS of the target
	OS target.OS `json:"OS,omitempty"`
	// PrimaryIP holds the value of the "PrimaryIP" field.
	// The IP Address for the primary interface of the Target
	PrimaryIP string `json:"PrimaryIP,omitempty"`
	// MachineUUID holds the value of the "MachineUUID" field.
	// The machine UUID of the Target
	MachineUUID string `json:"MachineUUID,omitempty"`
	// PublicIP holds the value of the "PublicIP" field.
	// The Public IP Address for the Target
	PublicIP string `json:"PublicIP,omitempty"`
	// PrimaryMAC holds the value of the "PrimaryMAC" field.
	// The MAC Address for the primary interface of the Target
	PrimaryMAC string `json:"PrimaryMAC,omitempty"`
	// Hostname holds the value of the "Hostname" field.
	// The hostname for the Target
	Hostname string `json:"Hostname,omitempty"`
	// LastSeen holds the value of the "LastSeen" field.
	// The time the Target was last seen
	LastSeen time.Time `json:"LastSeen,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.

Example
if dsn == "" {
	return
}
ctx := context.Background()
drv, err := sql.Open("mysql", dsn)
if err != nil {
	log.Fatalf("failed creating database client: %v", err)
}
defer drv.Close()
client := NewClient(Driver(drv))
// creating vertices for the target's edges.
t0 := client.Task.
	Create().
	SetQueueTime(time.Now()).
	SetLastChangedTime(time.Now()).
	SetClaimTime(time.Now()).
	SetExecStartTime(time.Now()).
	SetExecStopTime(time.Now()).
	SetContent("string").
	SetOutput("string").
	SetError("string").
	SetSessionID("string").
	SaveX(ctx)
log.Println("task created:", t0)
t1 := client.Tag.
	Create().
	SetName("string").
	SaveX(ctx)
log.Println("tag created:", t1)
c2 := client.Credential.
	Create().
	SetPrincipal("string").
	SetSecret("string").
	SetKind(credential.KindPassword).
	SetFails(1).
	SaveX(ctx)
log.Println("credential created:", c2)

// create target vertex with its edges.
t := client.Target.
	Create().
	SetName("string").
	SetOS(target.OSLINUX).
	SetPrimaryIP("string").
	SetMachineUUID("string").
	SetPublicIP("string").
	SetPrimaryMAC("string").
	SetHostname("string").
	SetLastSeen(time.Now()).
	AddTasks(t0).
	AddTags(t1).
	AddCredentials(c2).
	SaveX(ctx)
log.Println("target created:", t)

// query edges.
t0, err = t.QueryTasks().First(ctx)
if err != nil {
	log.Fatalf("failed querying tasks: %v", err)
}
log.Println("tasks found:", t0)

t1, err = t.QueryTags().First(ctx)
if err != nil {
	log.Fatalf("failed querying tags: %v", err)
}
log.Println("tags found:", t1)

c2, err = t.QueryCredentials().First(ctx)
if err != nil {
	log.Fatalf("failed querying credentials: %v", err)
}
log.Println("credentials found:", c2)
Output:

func (*Target) QueryCredentials

func (t *Target) QueryCredentials() *CredentialQuery

QueryCredentials queries the "credentials" edge of the Target entity.

func (*Target) QueryTags

func (t *Target) QueryTags() *TagQuery

QueryTags queries the "tags" edge of the Target entity.

func (*Target) QueryTasks

func (t *Target) QueryTasks() *TaskQuery

QueryTasks queries the "tasks" 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.

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 create builder for Target.

func (*TargetClient) CreateBulk added in v0.4.3

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 delete builder for the given entity.

func (*TargetClient) DeleteOneID

func (c *TargetClient) DeleteOneID(id int) *TargetDeleteOne

DeleteOneID returns a delete builder for the given id.

func (*TargetClient) Get

func (c *TargetClient) Get(ctx context.Context, id int) (*Target, error)

Get returns a Target entity by its id.

func (*TargetClient) GetX

func (c *TargetClient) GetX(ctx context.Context, id int) *Target

GetX is like Get, but panics if an error occurs.

func (*TargetClient) Hooks added in v0.4.3

func (c *TargetClient) Hooks() []Hook

Hooks returns the client hooks.

func (*TargetClient) Query

func (c *TargetClient) Query() *TargetQuery

Query returns a query builder for Target.

func (*TargetClient) QueryCredentials

func (c *TargetClient) QueryCredentials(t *Target) *CredentialQuery

QueryCredentials queries the credentials edge of a Target.

func (*TargetClient) QueryTags

func (c *TargetClient) QueryTags(t *Target) *TagQuery

QueryTags queries the tags edge of a Target.

func (*TargetClient) QueryTasks

func (c *TargetClient) QueryTasks(t *Target) *TaskQuery

QueryTasks queries the tasks 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 int) *TargetUpdateOne

UpdateOneID returns an update builder for the given id.

func (*TargetClient) Use added in v0.4.3

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) AddCredentialIDs

func (tc *TargetCreate) AddCredentialIDs(ids ...int) *TargetCreate

AddCredentialIDs adds the "credentials" edge to the Credential entity by IDs.

func (*TargetCreate) AddCredentials

func (tc *TargetCreate) AddCredentials(c ...*Credential) *TargetCreate

AddCredentials adds the "credentials" edges to the Credential entity.

func (*TargetCreate) AddTagIDs

func (tc *TargetCreate) AddTagIDs(ids ...int) *TargetCreate

AddTagIDs adds the "tags" edge to the Tag entity by IDs.

func (*TargetCreate) AddTags

func (tc *TargetCreate) AddTags(t ...*Tag) *TargetCreate

AddTags adds the "tags" edges to the Tag entity.

func (*TargetCreate) AddTaskIDs

func (tc *TargetCreate) AddTaskIDs(ids ...int) *TargetCreate

AddTaskIDs adds the "tasks" edge to the Task entity by IDs.

func (*TargetCreate) AddTasks

func (tc *TargetCreate) AddTasks(t ...*Task) *TargetCreate

AddTasks adds the "tasks" edges to the Task entity.

func (*TargetCreate) Exec added in v0.4.3

func (tc *TargetCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*TargetCreate) ExecX added in v0.4.3

func (tc *TargetCreate) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*TargetCreate) Mutation added in v0.4.3

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) SetHostname

func (tc *TargetCreate) SetHostname(s string) *TargetCreate

SetHostname sets the "Hostname" field.

func (*TargetCreate) SetLastSeen

func (tc *TargetCreate) SetLastSeen(t time.Time) *TargetCreate

SetLastSeen sets the "LastSeen" field.

func (*TargetCreate) SetMachineUUID

func (tc *TargetCreate) SetMachineUUID(s string) *TargetCreate

SetMachineUUID sets the "MachineUUID" field.

func (*TargetCreate) SetName

func (tc *TargetCreate) SetName(s string) *TargetCreate

SetName sets the "Name" field.

func (*TargetCreate) SetNillableHostname

func (tc *TargetCreate) SetNillableHostname(s *string) *TargetCreate

SetNillableHostname sets the "Hostname" field if the given value is not nil.

func (*TargetCreate) SetNillableLastSeen

func (tc *TargetCreate) SetNillableLastSeen(t *time.Time) *TargetCreate

SetNillableLastSeen sets the "LastSeen" field if the given value is not nil.

func (*TargetCreate) SetNillableMachineUUID

func (tc *TargetCreate) SetNillableMachineUUID(s *string) *TargetCreate

SetNillableMachineUUID sets the "MachineUUID" field if the given value is not nil.

func (*TargetCreate) SetNillablePrimaryMAC

func (tc *TargetCreate) SetNillablePrimaryMAC(s *string) *TargetCreate

SetNillablePrimaryMAC sets the "PrimaryMAC" field if the given value is not nil.

func (*TargetCreate) SetNillablePublicIP

func (tc *TargetCreate) SetNillablePublicIP(s *string) *TargetCreate

SetNillablePublicIP sets the "PublicIP" field if the given value is not nil.

func (*TargetCreate) SetOS added in v0.4.0

func (tc *TargetCreate) SetOS(t target.OS) *TargetCreate

SetOS sets the "OS" field.

func (*TargetCreate) SetPrimaryIP

func (tc *TargetCreate) SetPrimaryIP(s string) *TargetCreate

SetPrimaryIP sets the "PrimaryIP" field.

func (*TargetCreate) SetPrimaryMAC

func (tc *TargetCreate) SetPrimaryMAC(s string) *TargetCreate

SetPrimaryMAC sets the "PrimaryMAC" field.

func (*TargetCreate) SetPublicIP

func (tc *TargetCreate) SetPublicIP(s string) *TargetCreate

SetPublicIP sets the "PublicIP" field.

type TargetCreateBulk added in v0.4.3

type TargetCreateBulk struct {
	// contains filtered or unexported fields
}

TargetCreateBulk is the builder for creating many Target entities in bulk.

func (*TargetCreateBulk) Exec added in v0.4.3

func (tcb *TargetCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*TargetCreateBulk) ExecX added in v0.4.3

func (tcb *TargetCreateBulk) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*TargetCreateBulk) Save added in v0.4.3

func (tcb *TargetCreateBulk) Save(ctx context.Context) ([]*Target, error)

Save creates the Target entities in the database.

func (*TargetCreateBulk) SaveX added in v0.4.3

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.

type TargetEdges added in v0.3.0

type TargetEdges struct {
	// Tasks holds the value of the tasks edge.
	Tasks []*Task `json:"tasks,omitempty"`
	// Tags holds the value of the tags edge.
	Tags []*Tag `json:"tags,omitempty"`
	// Credentials holds the value of the credentials edge.
	Credentials []*Credential `json:"credentials,omitempty"`
	// contains filtered or unexported fields
}

TargetEdges holds the relations/edges for other nodes in the graph.

func (TargetEdges) CredentialsOrErr added in v0.3.0

func (e TargetEdges) CredentialsOrErr() ([]*Credential, error)

CredentialsOrErr returns the Credentials value or an error if the edge was not loaded in eager-loading.

func (TargetEdges) TagsOrErr added in v0.3.0

func (e TargetEdges) TagsOrErr() ([]*Tag, error)

TagsOrErr returns the Tags value or an error if the edge was not loaded in eager-loading.

func (TargetEdges) TasksOrErr added in v0.3.0

func (e TargetEdges) TasksOrErr() ([]*Task, error)

TasksOrErr returns the Tasks value or an error if the edge was not loaded in eager-loading.

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 added in v0.4.3

func (tgb *TargetGroupBy) 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 (*TargetGroupBy) BoolX added in v0.4.3

func (tgb *TargetGroupBy) BoolX(ctx context.Context) bool

BoolX is like Bool, but panics if an error occurs.

func (*TargetGroupBy) Bools

func (tgb *TargetGroupBy) 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 (*TargetGroupBy) BoolsX

func (tgb *TargetGroupBy) BoolsX(ctx context.Context) []bool

BoolsX is like Bools, but panics if an error occurs.

func (*TargetGroupBy) Float64 added in v0.4.3

func (tgb *TargetGroupBy) 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 (*TargetGroupBy) Float64X added in v0.4.3

func (tgb *TargetGroupBy) Float64X(ctx context.Context) float64

Float64X is like Float64, but panics if an error occurs.

func (*TargetGroupBy) Float64s

func (tgb *TargetGroupBy) 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 (*TargetGroupBy) Float64sX

func (tgb *TargetGroupBy) Float64sX(ctx context.Context) []float64

Float64sX is like Float64s, but panics if an error occurs.

func (*TargetGroupBy) Int added in v0.4.3

func (tgb *TargetGroupBy) 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 (*TargetGroupBy) IntX added in v0.4.3

func (tgb *TargetGroupBy) IntX(ctx context.Context) int

IntX is like Int, but panics if an error occurs.

func (*TargetGroupBy) Ints

func (tgb *TargetGroupBy) 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 (*TargetGroupBy) IntsX

func (tgb *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 interface{}) error

Scan applies the group-by query and scans the result into the given value.

func (*TargetGroupBy) ScanX

func (tgb *TargetGroupBy) ScanX(ctx context.Context, v interface{})

ScanX is like Scan, but panics if an error occurs.

func (*TargetGroupBy) String added in v0.4.3

func (tgb *TargetGroupBy) 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 (*TargetGroupBy) StringX added in v0.4.3

func (tgb *TargetGroupBy) StringX(ctx context.Context) string

StringX is like String, but panics if an error occurs.

func (*TargetGroupBy) Strings

func (tgb *TargetGroupBy) 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 (*TargetGroupBy) StringsX

func (tgb *TargetGroupBy) StringsX(ctx context.Context) []string

StringsX is like Strings, but panics if an error occurs.

type TargetMutation added in v0.4.3

type TargetMutation struct {
	// contains filtered or unexported fields
}

TargetMutation represents an operation that mutates the Target nodes in the graph.

func (*TargetMutation) AddCredentialIDs added in v0.4.3

func (m *TargetMutation) AddCredentialIDs(ids ...int)

AddCredentialIDs adds the "credentials" edge to the Credential entity by ids.

func (*TargetMutation) AddField added in v0.4.3

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) AddTagIDs added in v0.4.3

func (m *TargetMutation) AddTagIDs(ids ...int)

AddTagIDs adds the "tags" edge to the Tag entity by ids.

func (*TargetMutation) AddTaskIDs added in v0.4.3

func (m *TargetMutation) AddTaskIDs(ids ...int)

AddTaskIDs adds the "tasks" edge to the Task entity by ids.

func (*TargetMutation) AddedEdges added in v0.4.3

func (m *TargetMutation) AddedEdges() []string

AddedEdges returns all edge names that were set/added in this mutation.

func (*TargetMutation) AddedField added in v0.4.3

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 added in v0.4.3

func (m *TargetMutation) AddedFields() []string

AddedFields returns all numeric fields that were incremented/decremented during this mutation.

func (*TargetMutation) AddedIDs added in v0.4.3

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) ClearCredentials added in v0.4.3

func (m *TargetMutation) ClearCredentials()

ClearCredentials clears the "credentials" edge to the Credential entity.

func (*TargetMutation) ClearEdge added in v0.4.3

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 added in v0.4.3

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) ClearHostname added in v0.4.3

func (m *TargetMutation) ClearHostname()

ClearHostname clears the value of the "Hostname" field.

func (*TargetMutation) ClearLastSeen added in v0.4.3

func (m *TargetMutation) ClearLastSeen()

ClearLastSeen clears the value of the "LastSeen" field.

func (*TargetMutation) ClearMachineUUID added in v0.4.3

func (m *TargetMutation) ClearMachineUUID()

ClearMachineUUID clears the value of the "MachineUUID" field.

func (*TargetMutation) ClearPrimaryMAC added in v0.4.3

func (m *TargetMutation) ClearPrimaryMAC()

ClearPrimaryMAC clears the value of the "PrimaryMAC" field.

func (*TargetMutation) ClearPublicIP added in v0.4.3

func (m *TargetMutation) ClearPublicIP()

ClearPublicIP clears the value of the "PublicIP" field.

func (*TargetMutation) ClearTags added in v0.4.3

func (m *TargetMutation) ClearTags()

ClearTags clears the "tags" edge to the Tag entity.

func (*TargetMutation) ClearTasks added in v0.4.3

func (m *TargetMutation) ClearTasks()

ClearTasks clears the "tasks" edge to the Task entity.

func (*TargetMutation) ClearedEdges added in v0.4.3

func (m *TargetMutation) ClearedEdges() []string

ClearedEdges returns all edge names that were cleared in this mutation.

func (*TargetMutation) ClearedFields added in v0.4.3

func (m *TargetMutation) ClearedFields() []string

ClearedFields returns all nullable fields that were cleared during this mutation.

func (TargetMutation) Client added in v0.4.3

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) CredentialsCleared added in v0.4.3

func (m *TargetMutation) CredentialsCleared() bool

CredentialsCleared reports if the "credentials" edge to the Credential entity was cleared.

func (*TargetMutation) CredentialsIDs added in v0.4.3

func (m *TargetMutation) CredentialsIDs() (ids []int)

CredentialsIDs returns the "credentials" edge IDs in the mutation.

func (*TargetMutation) EdgeCleared added in v0.4.3

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 added in v0.4.3

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 added in v0.4.3

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 added in v0.4.3

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) Hostname added in v0.4.3

func (m *TargetMutation) Hostname() (r string, exists bool)

Hostname returns the value of the "Hostname" field in the mutation.

func (*TargetMutation) HostnameCleared added in v0.4.3

func (m *TargetMutation) HostnameCleared() bool

HostnameCleared returns if the "Hostname" field was cleared in this mutation.

func (*TargetMutation) ID added in v0.4.3

func (m *TargetMutation) 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 (*TargetMutation) IDs added in v0.4.3

func (m *TargetMutation) 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 (*TargetMutation) LastSeen added in v0.4.3

func (m *TargetMutation) LastSeen() (r time.Time, exists bool)

LastSeen returns the value of the "LastSeen" field in the mutation.

func (*TargetMutation) LastSeenCleared added in v0.4.3

func (m *TargetMutation) LastSeenCleared() bool

LastSeenCleared returns if the "LastSeen" field was cleared in this mutation.

func (*TargetMutation) MachineUUID added in v0.4.3

func (m *TargetMutation) MachineUUID() (r string, exists bool)

MachineUUID returns the value of the "MachineUUID" field in the mutation.

func (*TargetMutation) MachineUUIDCleared added in v0.4.3

func (m *TargetMutation) MachineUUIDCleared() bool

MachineUUIDCleared returns if the "MachineUUID" field was cleared in this mutation.

func (*TargetMutation) Name added in v0.4.3

func (m *TargetMutation) Name() (r string, exists bool)

Name returns the value of the "Name" field in the mutation.

func (*TargetMutation) OS added in v0.4.3

func (m *TargetMutation) OS() (r target.OS, exists bool)

OS returns the value of the "OS" field in the mutation.

func (*TargetMutation) OldField added in v0.4.3

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) OldHostname added in v0.4.3

func (m *TargetMutation) OldHostname(ctx context.Context) (v string, err error)

OldHostname returns the old "Hostname" 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) OldLastSeen added in v0.4.3

func (m *TargetMutation) OldLastSeen(ctx context.Context) (v time.Time, err error)

OldLastSeen returns the old "LastSeen" 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) OldMachineUUID added in v0.4.3

func (m *TargetMutation) OldMachineUUID(ctx context.Context) (v string, err error)

OldMachineUUID returns the old "MachineUUID" 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) OldName added in v0.4.3

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) OldOS added in v0.4.3

func (m *TargetMutation) OldOS(ctx context.Context) (v target.OS, err error)

OldOS returns the old "OS" 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) OldPrimaryIP added in v0.4.3

func (m *TargetMutation) OldPrimaryIP(ctx context.Context) (v string, err error)

OldPrimaryIP returns the old "PrimaryIP" 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) OldPrimaryMAC added in v0.4.3

func (m *TargetMutation) OldPrimaryMAC(ctx context.Context) (v string, err error)

OldPrimaryMAC returns the old "PrimaryMAC" 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) OldPublicIP added in v0.4.3

func (m *TargetMutation) OldPublicIP(ctx context.Context) (v string, err error)

OldPublicIP returns the old "PublicIP" 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 added in v0.4.3

func (m *TargetMutation) Op() Op

Op returns the operation name.

func (*TargetMutation) PrimaryIP added in v0.4.3

func (m *TargetMutation) PrimaryIP() (r string, exists bool)

PrimaryIP returns the value of the "PrimaryIP" field in the mutation.

func (*TargetMutation) PrimaryMAC added in v0.4.3

func (m *TargetMutation) PrimaryMAC() (r string, exists bool)

PrimaryMAC returns the value of the "PrimaryMAC" field in the mutation.

func (*TargetMutation) PrimaryMACCleared added in v0.4.3

func (m *TargetMutation) PrimaryMACCleared() bool

PrimaryMACCleared returns if the "PrimaryMAC" field was cleared in this mutation.

func (*TargetMutation) PublicIP added in v0.4.3

func (m *TargetMutation) PublicIP() (r string, exists bool)

PublicIP returns the value of the "PublicIP" field in the mutation.

func (*TargetMutation) PublicIPCleared added in v0.4.3

func (m *TargetMutation) PublicIPCleared() bool

PublicIPCleared returns if the "PublicIP" field was cleared in this mutation.

func (*TargetMutation) RemoveCredentialIDs added in v0.4.3

func (m *TargetMutation) RemoveCredentialIDs(ids ...int)

RemoveCredentialIDs removes the "credentials" edge to the Credential entity by IDs.

func (*TargetMutation) RemoveTagIDs added in v0.4.3

func (m *TargetMutation) RemoveTagIDs(ids ...int)

RemoveTagIDs removes the "tags" edge to the Tag entity by IDs.

func (*TargetMutation) RemoveTaskIDs added in v0.4.3

func (m *TargetMutation) RemoveTaskIDs(ids ...int)

RemoveTaskIDs removes the "tasks" edge to the Task entity by IDs.

func (*TargetMutation) RemovedCredentialsIDs added in v0.4.3

func (m *TargetMutation) RemovedCredentialsIDs() (ids []int)

RemovedCredentials returns the removed IDs of the "credentials" edge to the Credential entity.

func (*TargetMutation) RemovedEdges added in v0.4.3

func (m *TargetMutation) RemovedEdges() []string

RemovedEdges returns all edge names that were removed in this mutation.

func (*TargetMutation) RemovedIDs added in v0.4.3

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) RemovedTagsIDs added in v0.4.3

func (m *TargetMutation) RemovedTagsIDs() (ids []int)

RemovedTags returns the removed IDs of the "tags" edge to the Tag entity.

func (*TargetMutation) RemovedTasksIDs added in v0.4.3

func (m *TargetMutation) RemovedTasksIDs() (ids []int)

RemovedTasks returns the removed IDs of the "tasks" edge to the Task entity.

func (*TargetMutation) ResetCredentials added in v0.4.3

func (m *TargetMutation) ResetCredentials()

ResetCredentials resets all changes to the "credentials" edge.

func (*TargetMutation) ResetEdge added in v0.4.3

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 added in v0.4.3

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) ResetHostname added in v0.4.3

func (m *TargetMutation) ResetHostname()

ResetHostname resets all changes to the "Hostname" field.

func (*TargetMutation) ResetLastSeen added in v0.4.3

func (m *TargetMutation) ResetLastSeen()

ResetLastSeen resets all changes to the "LastSeen" field.

func (*TargetMutation) ResetMachineUUID added in v0.4.3

func (m *TargetMutation) ResetMachineUUID()

ResetMachineUUID resets all changes to the "MachineUUID" field.

func (*TargetMutation) ResetName added in v0.4.3

func (m *TargetMutation) ResetName()

ResetName resets all changes to the "Name" field.

func (*TargetMutation) ResetOS added in v0.4.3

func (m *TargetMutation) ResetOS()

ResetOS resets all changes to the "OS" field.

func (*TargetMutation) ResetPrimaryIP added in v0.4.3

func (m *TargetMutation) ResetPrimaryIP()

ResetPrimaryIP resets all changes to the "PrimaryIP" field.

func (*TargetMutation) ResetPrimaryMAC added in v0.4.3

func (m *TargetMutation) ResetPrimaryMAC()

ResetPrimaryMAC resets all changes to the "PrimaryMAC" field.

func (*TargetMutation) ResetPublicIP added in v0.4.3

func (m *TargetMutation) ResetPublicIP()

ResetPublicIP resets all changes to the "PublicIP" field.

func (*TargetMutation) ResetTags added in v0.4.3

func (m *TargetMutation) ResetTags()

ResetTags resets all changes to the "tags" edge.

func (*TargetMutation) ResetTasks added in v0.4.3

func (m *TargetMutation) ResetTasks()

ResetTasks resets all changes to the "tasks" edge.

func (*TargetMutation) SetField added in v0.4.3

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) SetHostname added in v0.4.3

func (m *TargetMutation) SetHostname(s string)

SetHostname sets the "Hostname" field.

func (*TargetMutation) SetLastSeen added in v0.4.3

func (m *TargetMutation) SetLastSeen(t time.Time)

SetLastSeen sets the "LastSeen" field.

func (*TargetMutation) SetMachineUUID added in v0.4.3

func (m *TargetMutation) SetMachineUUID(s string)

SetMachineUUID sets the "MachineUUID" field.

func (*TargetMutation) SetName added in v0.4.3

func (m *TargetMutation) SetName(s string)

SetName sets the "Name" field.

func (*TargetMutation) SetOS added in v0.4.3

func (m *TargetMutation) SetOS(t target.OS)

SetOS sets the "OS" field.

func (*TargetMutation) SetPrimaryIP added in v0.4.3

func (m *TargetMutation) SetPrimaryIP(s string)

SetPrimaryIP sets the "PrimaryIP" field.

func (*TargetMutation) SetPrimaryMAC added in v0.4.3

func (m *TargetMutation) SetPrimaryMAC(s string)

SetPrimaryMAC sets the "PrimaryMAC" field.

func (*TargetMutation) SetPublicIP added in v0.4.3

func (m *TargetMutation) SetPublicIP(s string)

SetPublicIP sets the "PublicIP" field.

func (*TargetMutation) TagsCleared added in v0.4.3

func (m *TargetMutation) TagsCleared() bool

TagsCleared reports if the "tags" edge to the Tag entity was cleared.

func (*TargetMutation) TagsIDs added in v0.4.3

func (m *TargetMutation) TagsIDs() (ids []int)

TagsIDs returns the "tags" edge IDs in the mutation.

func (*TargetMutation) TasksCleared added in v0.4.3

func (m *TargetMutation) TasksCleared() bool

TasksCleared reports if the "tasks" edge to the Task entity was cleared.

func (*TargetMutation) TasksIDs added in v0.4.3

func (m *TargetMutation) TasksIDs() (ids []int)

TasksIDs returns the "tasks" edge IDs in the mutation.

func (TargetMutation) Tx added in v0.4.3

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 added in v0.4.3

func (m *TargetMutation) Type() string

Type returns the node type of this mutation (Target).

func (*TargetMutation) Where added in v0.4.3

func (m *TargetMutation) Where(ps ...predicate.Target)

Where appends a list predicates to the TargetMutation builder.

type TargetQuery

type TargetQuery struct {
	// contains filtered or unexported fields
}

TargetQuery is the builder for querying Target entities.

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 int, err error)

FirstID returns the first Target ID from the query. Returns a *NotFoundError when no Target ID was found.

func (*TargetQuery) FirstIDX added in v0.4.3

func (tq *TargetQuery) FirstIDX(ctx context.Context) int

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) ([]int, error)

IDs executes the query and returns a list of Target IDs.

func (*TargetQuery) IDsX

func (tq *TargetQuery) IDsX(ctx context.Context) []int

IDsX is like IDs, but panics if an error occurs.

func (*TargetQuery) Limit

func (tq *TargetQuery) Limit(limit int) *TargetQuery

Limit adds a limit step to the query.

func (*TargetQuery) Offset

func (tq *TargetQuery) Offset(offset int) *TargetQuery

Offset adds an offset step to the query.

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 exactly one Target entity is not found. Returns a *NotFoundError when no Target entities are found.

func (*TargetQuery) OnlyID

func (tq *TargetQuery) OnlyID(ctx context.Context) (id int, err error)

OnlyID is like Only, but returns the only Target ID in the query. Returns a *NotSingularError when exactly one Target ID is not found. Returns a *NotFoundError when no entities are found.

func (*TargetQuery) OnlyIDX added in v0.4.3

func (tq *TargetQuery) OnlyIDX(ctx context.Context) int

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 ...OrderFunc) *TargetQuery

Order adds an order step to the query.

func (*TargetQuery) QueryCredentials

func (tq *TargetQuery) QueryCredentials() *CredentialQuery

QueryCredentials chains the current query on the "credentials" edge.

func (*TargetQuery) QueryTags

func (tq *TargetQuery) QueryTags() *TagQuery

QueryTags chains the current query on the "tags" edge.

func (*TargetQuery) QueryTasks

func (tq *TargetQuery) QueryTasks() *TaskQuery

QueryTasks chains the current query on the "tasks" 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 added in v0.4.3

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) WithCredentials added in v0.2.3

func (tq *TargetQuery) WithCredentials(opts ...func(*CredentialQuery)) *TargetQuery

WithCredentials tells the query-builder to eager-load the nodes that are connected to the "credentials" edge. The optional arguments are used to configure the query builder of the edge.

func (*TargetQuery) WithTags added in v0.2.3

func (tq *TargetQuery) WithTags(opts ...func(*TagQuery)) *TargetQuery

WithTags tells the query-builder to eager-load the nodes that are connected to the "tags" edge. The optional arguments are used to configure the query builder of the edge.

func (*TargetQuery) WithTasks added in v0.2.3

func (tq *TargetQuery) WithTasks(opts ...func(*TaskQuery)) *TargetQuery

WithTasks tells the query-builder to eager-load the nodes that are connected to the "tasks" 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) Bool added in v0.4.3

func (ts *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 added in v0.4.3

func (ts *TargetSelect) BoolX(ctx context.Context) bool

BoolX is like Bool, but panics if an error occurs.

func (*TargetSelect) Bools

func (ts *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 (ts *TargetSelect) BoolsX(ctx context.Context) []bool

BoolsX is like Bools, but panics if an error occurs.

func (*TargetSelect) Float64 added in v0.4.3

func (ts *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 added in v0.4.3

func (ts *TargetSelect) Float64X(ctx context.Context) float64

Float64X is like Float64, but panics if an error occurs.

func (*TargetSelect) Float64s

func (ts *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 (ts *TargetSelect) Float64sX(ctx context.Context) []float64

Float64sX is like Float64s, but panics if an error occurs.

func (*TargetSelect) Int added in v0.4.3

func (ts *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 added in v0.4.3

func (ts *TargetSelect) IntX(ctx context.Context) int

IntX is like Int, but panics if an error occurs.

func (*TargetSelect) Ints

func (ts *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 (ts *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 interface{}) error

Scan applies the selector query and scans the result into the given value.

func (*TargetSelect) ScanX

func (ts *TargetSelect) ScanX(ctx context.Context, v interface{})

ScanX is like Scan, but panics if an error occurs.

func (*TargetSelect) String added in v0.4.3

func (ts *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 added in v0.4.3

func (ts *TargetSelect) StringX(ctx context.Context) string

StringX is like String, but panics if an error occurs.

func (*TargetSelect) Strings

func (ts *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 (ts *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) AddCredentialIDs

func (tu *TargetUpdate) AddCredentialIDs(ids ...int) *TargetUpdate

AddCredentialIDs adds the "credentials" edge to the Credential entity by IDs.

func (*TargetUpdate) AddCredentials

func (tu *TargetUpdate) AddCredentials(c ...*Credential) *TargetUpdate

AddCredentials adds the "credentials" edges to the Credential entity.

func (*TargetUpdate) AddTagIDs

func (tu *TargetUpdate) AddTagIDs(ids ...int) *TargetUpdate

AddTagIDs adds the "tags" edge to the Tag entity by IDs.

func (*TargetUpdate) AddTags

func (tu *TargetUpdate) AddTags(t ...*Tag) *TargetUpdate

AddTags adds the "tags" edges to the Tag entity.

func (*TargetUpdate) AddTaskIDs

func (tu *TargetUpdate) AddTaskIDs(ids ...int) *TargetUpdate

AddTaskIDs adds the "tasks" edge to the Task entity by IDs.

func (*TargetUpdate) AddTasks

func (tu *TargetUpdate) AddTasks(t ...*Task) *TargetUpdate

AddTasks adds the "tasks" edges to the Task entity.

func (*TargetUpdate) ClearCredentials added in v0.4.3

func (tu *TargetUpdate) ClearCredentials() *TargetUpdate

ClearCredentials clears all "credentials" edges to the Credential entity.

func (*TargetUpdate) ClearHostname

func (tu *TargetUpdate) ClearHostname() *TargetUpdate

ClearHostname clears the value of the "Hostname" field.

func (*TargetUpdate) ClearLastSeen

func (tu *TargetUpdate) ClearLastSeen() *TargetUpdate

ClearLastSeen clears the value of the "LastSeen" field.

func (*TargetUpdate) ClearMachineUUID

func (tu *TargetUpdate) ClearMachineUUID() *TargetUpdate

ClearMachineUUID clears the value of the "MachineUUID" field.

func (*TargetUpdate) ClearPrimaryMAC

func (tu *TargetUpdate) ClearPrimaryMAC() *TargetUpdate

ClearPrimaryMAC clears the value of the "PrimaryMAC" field.

func (*TargetUpdate) ClearPublicIP

func (tu *TargetUpdate) ClearPublicIP() *TargetUpdate

ClearPublicIP clears the value of the "PublicIP" field.

func (*TargetUpdate) ClearTags added in v0.4.3

func (tu *TargetUpdate) ClearTags() *TargetUpdate

ClearTags clears all "tags" edges to the Tag entity.

func (*TargetUpdate) ClearTasks added in v0.4.3

func (tu *TargetUpdate) ClearTasks() *TargetUpdate

ClearTasks clears all "tasks" edges to the Task 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 added in v0.4.3

func (tu *TargetUpdate) Mutation() *TargetMutation

Mutation returns the TargetMutation object of the builder.

func (*TargetUpdate) RemoveCredentialIDs

func (tu *TargetUpdate) RemoveCredentialIDs(ids ...int) *TargetUpdate

RemoveCredentialIDs removes the "credentials" edge to Credential entities by IDs.

func (*TargetUpdate) RemoveCredentials

func (tu *TargetUpdate) RemoveCredentials(c ...*Credential) *TargetUpdate

RemoveCredentials removes "credentials" edges to Credential entities.

func (*TargetUpdate) RemoveTagIDs

func (tu *TargetUpdate) RemoveTagIDs(ids ...int) *TargetUpdate

RemoveTagIDs removes the "tags" edge to Tag entities by IDs.

func (*TargetUpdate) RemoveTags

func (tu *TargetUpdate) RemoveTags(t ...*Tag) *TargetUpdate

RemoveTags removes "tags" edges to Tag entities.

func (*TargetUpdate) RemoveTaskIDs

func (tu *TargetUpdate) RemoveTaskIDs(ids ...int) *TargetUpdate

RemoveTaskIDs removes the "tasks" edge to Task entities by IDs.

func (*TargetUpdate) RemoveTasks

func (tu *TargetUpdate) RemoveTasks(t ...*Task) *TargetUpdate

RemoveTasks removes "tasks" edges to Task entities.

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) SetHostname

func (tu *TargetUpdate) SetHostname(s string) *TargetUpdate

SetHostname sets the "Hostname" field.

func (*TargetUpdate) SetLastSeen

func (tu *TargetUpdate) SetLastSeen(t time.Time) *TargetUpdate

SetLastSeen sets the "LastSeen" field.

func (*TargetUpdate) SetMachineUUID

func (tu *TargetUpdate) SetMachineUUID(s string) *TargetUpdate

SetMachineUUID sets the "MachineUUID" field.

func (*TargetUpdate) SetName

func (tu *TargetUpdate) SetName(s string) *TargetUpdate

SetName sets the "Name" field.

func (*TargetUpdate) SetNillableHostname

func (tu *TargetUpdate) SetNillableHostname(s *string) *TargetUpdate

SetNillableHostname sets the "Hostname" field if the given value is not nil.

func (*TargetUpdate) SetNillableLastSeen

func (tu *TargetUpdate) SetNillableLastSeen(t *time.Time) *TargetUpdate

SetNillableLastSeen sets the "LastSeen" field if the given value is not nil.

func (*TargetUpdate) SetNillableMachineUUID

func (tu *TargetUpdate) SetNillableMachineUUID(s *string) *TargetUpdate

SetNillableMachineUUID sets the "MachineUUID" field if the given value is not nil.

func (*TargetUpdate) SetNillablePrimaryMAC

func (tu *TargetUpdate) SetNillablePrimaryMAC(s *string) *TargetUpdate

SetNillablePrimaryMAC sets the "PrimaryMAC" field if the given value is not nil.

func (*TargetUpdate) SetNillablePublicIP

func (tu *TargetUpdate) SetNillablePublicIP(s *string) *TargetUpdate

SetNillablePublicIP sets the "PublicIP" field if the given value is not nil.

func (*TargetUpdate) SetOS added in v0.4.0

func (tu *TargetUpdate) SetOS(t target.OS) *TargetUpdate

SetOS sets the "OS" field.

func (*TargetUpdate) SetPrimaryIP

func (tu *TargetUpdate) SetPrimaryIP(s string) *TargetUpdate

SetPrimaryIP sets the "PrimaryIP" field.

func (*TargetUpdate) SetPrimaryMAC

func (tu *TargetUpdate) SetPrimaryMAC(s string) *TargetUpdate

SetPrimaryMAC sets the "PrimaryMAC" field.

func (*TargetUpdate) SetPublicIP

func (tu *TargetUpdate) SetPublicIP(s string) *TargetUpdate

SetPublicIP sets the "PublicIP" field.

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) AddCredentialIDs

func (tuo *TargetUpdateOne) AddCredentialIDs(ids ...int) *TargetUpdateOne

AddCredentialIDs adds the "credentials" edge to the Credential entity by IDs.

func (*TargetUpdateOne) AddCredentials

func (tuo *TargetUpdateOne) AddCredentials(c ...*Credential) *TargetUpdateOne

AddCredentials adds the "credentials" edges to the Credential entity.

func (*TargetUpdateOne) AddTagIDs

func (tuo *TargetUpdateOne) AddTagIDs(ids ...int) *TargetUpdateOne

AddTagIDs adds the "tags" edge to the Tag entity by IDs.

func (*TargetUpdateOne) AddTags

func (tuo *TargetUpdateOne) AddTags(t ...*Tag) *TargetUpdateOne

AddTags adds the "tags" edges to the Tag entity.

func (*TargetUpdateOne) AddTaskIDs

func (tuo *TargetUpdateOne) AddTaskIDs(ids ...int) *TargetUpdateOne

AddTaskIDs adds the "tasks" edge to the Task entity by IDs.

func (*TargetUpdateOne) AddTasks

func (tuo *TargetUpdateOne) AddTasks(t ...*Task) *TargetUpdateOne

AddTasks adds the "tasks" edges to the Task entity.

func (*TargetUpdateOne) ClearCredentials added in v0.4.3

func (tuo *TargetUpdateOne) ClearCredentials() *TargetUpdateOne

ClearCredentials clears all "credentials" edges to the Credential entity.

func (*TargetUpdateOne) ClearHostname

func (tuo *TargetUpdateOne) ClearHostname() *TargetUpdateOne

ClearHostname clears the value of the "Hostname" field.

func (*TargetUpdateOne) ClearLastSeen

func (tuo *TargetUpdateOne) ClearLastSeen() *TargetUpdateOne

ClearLastSeen clears the value of the "LastSeen" field.

func (*TargetUpdateOne) ClearMachineUUID

func (tuo *TargetUpdateOne) ClearMachineUUID() *TargetUpdateOne

ClearMachineUUID clears the value of the "MachineUUID" field.

func (*TargetUpdateOne) ClearPrimaryMAC

func (tuo *TargetUpdateOne) ClearPrimaryMAC() *TargetUpdateOne

ClearPrimaryMAC clears the value of the "PrimaryMAC" field.

func (*TargetUpdateOne) ClearPublicIP

func (tuo *TargetUpdateOne) ClearPublicIP() *TargetUpdateOne

ClearPublicIP clears the value of the "PublicIP" field.

func (*TargetUpdateOne) ClearTags added in v0.4.3

func (tuo *TargetUpdateOne) ClearTags() *TargetUpdateOne

ClearTags clears all "tags" edges to the Tag entity.

func (*TargetUpdateOne) ClearTasks added in v0.4.3

func (tuo *TargetUpdateOne) ClearTasks() *TargetUpdateOne

ClearTasks clears all "tasks" edges to the Task 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 added in v0.4.3

func (tuo *TargetUpdateOne) Mutation() *TargetMutation

Mutation returns the TargetMutation object of the builder.

func (*TargetUpdateOne) RemoveCredentialIDs

func (tuo *TargetUpdateOne) RemoveCredentialIDs(ids ...int) *TargetUpdateOne

RemoveCredentialIDs removes the "credentials" edge to Credential entities by IDs.

func (*TargetUpdateOne) RemoveCredentials

func (tuo *TargetUpdateOne) RemoveCredentials(c ...*Credential) *TargetUpdateOne

RemoveCredentials removes "credentials" edges to Credential entities.

func (*TargetUpdateOne) RemoveTagIDs

func (tuo *TargetUpdateOne) RemoveTagIDs(ids ...int) *TargetUpdateOne

RemoveTagIDs removes the "tags" edge to Tag entities by IDs.

func (*TargetUpdateOne) RemoveTags

func (tuo *TargetUpdateOne) RemoveTags(t ...*Tag) *TargetUpdateOne

RemoveTags removes "tags" edges to Tag entities.

func (*TargetUpdateOne) RemoveTaskIDs

func (tuo *TargetUpdateOne) RemoveTaskIDs(ids ...int) *TargetUpdateOne

RemoveTaskIDs removes the "tasks" edge to Task entities by IDs.

func (*TargetUpdateOne) RemoveTasks

func (tuo *TargetUpdateOne) RemoveTasks(t ...*Task) *TargetUpdateOne

RemoveTasks removes "tasks" edges to Task entities.

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 added in v0.4.3

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) SetHostname

func (tuo *TargetUpdateOne) SetHostname(s string) *TargetUpdateOne

SetHostname sets the "Hostname" field.

func (*TargetUpdateOne) SetLastSeen

func (tuo *TargetUpdateOne) SetLastSeen(t time.Time) *TargetUpdateOne

SetLastSeen sets the "LastSeen" field.

func (*TargetUpdateOne) SetMachineUUID

func (tuo *TargetUpdateOne) SetMachineUUID(s string) *TargetUpdateOne

SetMachineUUID sets the "MachineUUID" field.

func (*TargetUpdateOne) SetName

func (tuo *TargetUpdateOne) SetName(s string) *TargetUpdateOne

SetName sets the "Name" field.

func (*TargetUpdateOne) SetNillableHostname

func (tuo *TargetUpdateOne) SetNillableHostname(s *string) *TargetUpdateOne

SetNillableHostname sets the "Hostname" field if the given value is not nil.

func (*TargetUpdateOne) SetNillableLastSeen

func (tuo *TargetUpdateOne) SetNillableLastSeen(t *time.Time) *TargetUpdateOne

SetNillableLastSeen sets the "LastSeen" field if the given value is not nil.

func (*TargetUpdateOne) SetNillableMachineUUID

func (tuo *TargetUpdateOne) SetNillableMachineUUID(s *string) *TargetUpdateOne

SetNillableMachineUUID sets the "MachineUUID" field if the given value is not nil.

func (*TargetUpdateOne) SetNillablePrimaryMAC

func (tuo *TargetUpdateOne) SetNillablePrimaryMAC(s *string) *TargetUpdateOne

SetNillablePrimaryMAC sets the "PrimaryMAC" field if the given value is not nil.

func (*TargetUpdateOne) SetNillablePublicIP

func (tuo *TargetUpdateOne) SetNillablePublicIP(s *string) *TargetUpdateOne

SetNillablePublicIP sets the "PublicIP" field if the given value is not nil.

func (*TargetUpdateOne) SetOS added in v0.4.0

func (tuo *TargetUpdateOne) SetOS(t target.OS) *TargetUpdateOne

SetOS sets the "OS" field.

func (*TargetUpdateOne) SetPrimaryIP

func (tuo *TargetUpdateOne) SetPrimaryIP(s string) *TargetUpdateOne

SetPrimaryIP sets the "PrimaryIP" field.

func (*TargetUpdateOne) SetPrimaryMAC

func (tuo *TargetUpdateOne) SetPrimaryMAC(s string) *TargetUpdateOne

SetPrimaryMAC sets the "PrimaryMAC" field.

func (*TargetUpdateOne) SetPublicIP

func (tuo *TargetUpdateOne) SetPublicIP(s string) *TargetUpdateOne

SetPublicIP sets the "PublicIP" field.

type Targets

type Targets []*Target

Targets is a parsable slice of Target.

type Task

type Task struct {

	// ID of the ent.
	ID int `json:"id,omitempty"`
	// QueueTime holds the value of the "QueueTime" field.
	// The timestamp for when the Task was queued/created
	QueueTime time.Time `json:"QueueTime,omitempty"`
	// LastChangedTime holds the value of the "LastChangedTime" field.
	// The timestamp for when the Task was last changed
	LastChangedTime time.Time `json:"LastChangedTime,omitempty"`
	// ClaimTime holds the value of the "ClaimTime" field.
	// The timestamp for when the Task was claim
	ClaimTime time.Time `json:"ClaimTime,omitempty"`
	// ExecStartTime holds the value of the "ExecStartTime" field.
	// The timestamp for when the Task was executed
	ExecStartTime time.Time `json:"ExecStartTime,omitempty"`
	// ExecStopTime holds the value of the "ExecStopTime" field.
	// The timestamp for when the Task's execution ended
	ExecStopTime time.Time `json:"ExecStopTime,omitempty"`
	// Content holds the value of the "Content" field.
	// The content of the task (usually a Renegade Script)
	Content string `json:"Content,omitempty"`
	// Output holds the value of the "Output" field.
	// The output from executing the task
	Output string `json:"Output,omitempty"`
	// Error holds the value of the "Error" field.
	// The error, if any, produced while executing the Task
	Error string `json:"Error,omitempty"`
	// SessionID holds the value of the "SessionID" field.
	SessionID string `json:"SessionID,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the TaskQuery when eager-loading is set.
	Edges TaskEdges `json:"edges"`
	// contains filtered or unexported fields
}

Task is the model entity for the Task schema.

Example
if dsn == "" {
	return
}
ctx := context.Background()
drv, err := sql.Open("mysql", dsn)
if err != nil {
	log.Fatalf("failed creating database client: %v", err)
}
defer drv.Close()
client := NewClient(Driver(drv))
// creating vertices for the task's edges.
t0 := client.Tag.
	Create().
	SetName("string").
	SaveX(ctx)
log.Println("tag created:", t0)

// create task vertex with its edges.
t := client.Task.
	Create().
	SetQueueTime(time.Now()).
	SetLastChangedTime(time.Now()).
	SetClaimTime(time.Now()).
	SetExecStartTime(time.Now()).
	SetExecStopTime(time.Now()).
	SetContent("string").
	SetOutput("string").
	SetError("string").
	SetSessionID("string").
	AddTags(t0).
	SaveX(ctx)
log.Println("task created:", t)

// query edges.
t0, err = t.QueryTags().First(ctx)
if err != nil {
	log.Fatalf("failed querying tags: %v", err)
}
log.Println("tags found:", t0)
Output:

func (*Task) QueryJob

func (t *Task) QueryJob() *JobQuery

QueryJob queries the "job" edge of the Task entity.

func (*Task) QueryTags

func (t *Task) QueryTags() *TagQuery

QueryTags queries the "tags" edge of the Task entity.

func (*Task) QueryTarget added in v0.2.2

func (t *Task) QueryTarget() *TargetQuery

QueryTarget queries the "target" edge of the Task entity.

func (*Task) String

func (t *Task) String() string

String implements the fmt.Stringer.

func (*Task) Unwrap

func (t *Task) Unwrap() *Task

Unwrap unwraps the Task 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 (*Task) Update

func (t *Task) Update() *TaskUpdateOne

Update returns a builder for updating this Task. Note that you need to call Task.Unwrap() before calling this method if this Task was returned from a transaction, and the transaction was committed or rolled back.

type TaskClient

type TaskClient struct {
	// contains filtered or unexported fields
}

TaskClient is a client for the Task schema.

func NewTaskClient

func NewTaskClient(c config) *TaskClient

NewTaskClient returns a client for the Task from the given config.

func (*TaskClient) Create

func (c *TaskClient) Create() *TaskCreate

Create returns a create builder for Task.

func (*TaskClient) CreateBulk added in v0.4.3

func (c *TaskClient) CreateBulk(builders ...*TaskCreate) *TaskCreateBulk

CreateBulk returns a builder for creating a bulk of Task entities.

func (*TaskClient) Delete

func (c *TaskClient) Delete() *TaskDelete

Delete returns a delete builder for Task.

func (*TaskClient) DeleteOne

func (c *TaskClient) DeleteOne(t *Task) *TaskDeleteOne

DeleteOne returns a delete builder for the given entity.

func (*TaskClient) DeleteOneID

func (c *TaskClient) DeleteOneID(id int) *TaskDeleteOne

DeleteOneID returns a delete builder for the given id.

func (*TaskClient) Get

func (c *TaskClient) Get(ctx context.Context, id int) (*Task, error)

Get returns a Task entity by its id.

func (*TaskClient) GetX

func (c *TaskClient) GetX(ctx context.Context, id int) *Task

GetX is like Get, but panics if an error occurs.

func (*TaskClient) Hooks added in v0.4.3

func (c *TaskClient) Hooks() []Hook

Hooks returns the client hooks.

func (*TaskClient) Query

func (c *TaskClient) Query() *TaskQuery

Query returns a query builder for Task.

func (*TaskClient) QueryJob

func (c *TaskClient) QueryJob(t *Task) *JobQuery

QueryJob queries the job edge of a Task.

func (*TaskClient) QueryTags

func (c *TaskClient) QueryTags(t *Task) *TagQuery

QueryTags queries the tags edge of a Task.

func (*TaskClient) QueryTarget added in v0.2.2

func (c *TaskClient) QueryTarget(t *Task) *TargetQuery

QueryTarget queries the target edge of a Task.

func (*TaskClient) Update

func (c *TaskClient) Update() *TaskUpdate

Update returns an update builder for Task.

func (*TaskClient) UpdateOne

func (c *TaskClient) UpdateOne(t *Task) *TaskUpdateOne

UpdateOne returns an update builder for the given entity.

func (*TaskClient) UpdateOneID

func (c *TaskClient) UpdateOneID(id int) *TaskUpdateOne

UpdateOneID returns an update builder for the given id.

func (*TaskClient) Use added in v0.4.3

func (c *TaskClient) Use(hooks ...Hook)

Use adds a list of mutation hooks to the hooks stack. A call to `Use(f, g, h)` equals to `task.Hooks(f(g(h())))`.

type TaskCreate

type TaskCreate struct {
	// contains filtered or unexported fields
}

TaskCreate is the builder for creating a Task entity.

func (*TaskCreate) AddTagIDs

func (tc *TaskCreate) AddTagIDs(ids ...int) *TaskCreate

AddTagIDs adds the "tags" edge to the Tag entity by IDs.

func (*TaskCreate) AddTags

func (tc *TaskCreate) AddTags(t ...*Tag) *TaskCreate

AddTags adds the "tags" edges to the Tag entity.

func (*TaskCreate) Exec added in v0.4.3

func (tc *TaskCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*TaskCreate) ExecX added in v0.4.3

func (tc *TaskCreate) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*TaskCreate) Mutation added in v0.4.3

func (tc *TaskCreate) Mutation() *TaskMutation

Mutation returns the TaskMutation object of the builder.

func (*TaskCreate) Save

func (tc *TaskCreate) Save(ctx context.Context) (*Task, error)

Save creates the Task in the database.

func (*TaskCreate) SaveX

func (tc *TaskCreate) SaveX(ctx context.Context) *Task

SaveX calls Save and panics if Save returns an error.

func (*TaskCreate) SetClaimTime

func (tc *TaskCreate) SetClaimTime(t time.Time) *TaskCreate

SetClaimTime sets the "ClaimTime" field.

func (*TaskCreate) SetContent

func (tc *TaskCreate) SetContent(s string) *TaskCreate

SetContent sets the "Content" field.

func (*TaskCreate) SetError

func (tc *TaskCreate) SetError(s string) *TaskCreate

SetError sets the "Error" field.

func (*TaskCreate) SetExecStartTime

func (tc *TaskCreate) SetExecStartTime(t time.Time) *TaskCreate

SetExecStartTime sets the "ExecStartTime" field.

func (*TaskCreate) SetExecStopTime

func (tc *TaskCreate) SetExecStopTime(t time.Time) *TaskCreate

SetExecStopTime sets the "ExecStopTime" field.

func (*TaskCreate) SetJob

func (tc *TaskCreate) SetJob(j *Job) *TaskCreate

SetJob sets the "job" edge to the Job entity.

func (*TaskCreate) SetJobID

func (tc *TaskCreate) SetJobID(id int) *TaskCreate

SetJobID sets the "job" edge to the Job entity by ID.

func (*TaskCreate) SetLastChangedTime added in v0.2.2

func (tc *TaskCreate) SetLastChangedTime(t time.Time) *TaskCreate

SetLastChangedTime sets the "LastChangedTime" field.

func (*TaskCreate) SetNillableClaimTime

func (tc *TaskCreate) SetNillableClaimTime(t *time.Time) *TaskCreate

SetNillableClaimTime sets the "ClaimTime" field if the given value is not nil.

func (*TaskCreate) SetNillableError

func (tc *TaskCreate) SetNillableError(s *string) *TaskCreate

SetNillableError sets the "Error" field if the given value is not nil.

func (*TaskCreate) SetNillableExecStartTime

func (tc *TaskCreate) SetNillableExecStartTime(t *time.Time) *TaskCreate

SetNillableExecStartTime sets the "ExecStartTime" field if the given value is not nil.

func (*TaskCreate) SetNillableExecStopTime

func (tc *TaskCreate) SetNillableExecStopTime(t *time.Time) *TaskCreate

SetNillableExecStopTime sets the "ExecStopTime" field if the given value is not nil.

func (*TaskCreate) SetNillableOutput

func (tc *TaskCreate) SetNillableOutput(s *string) *TaskCreate

SetNillableOutput sets the "Output" field if the given value is not nil.

func (*TaskCreate) SetNillableQueueTime

func (tc *TaskCreate) SetNillableQueueTime(t *time.Time) *TaskCreate

SetNillableQueueTime sets the "QueueTime" field if the given value is not nil.

func (*TaskCreate) SetNillableSessionID

func (tc *TaskCreate) SetNillableSessionID(s *string) *TaskCreate

SetNillableSessionID sets the "SessionID" field if the given value is not nil.

func (*TaskCreate) SetNillableTargetID added in v0.2.2

func (tc *TaskCreate) SetNillableTargetID(id *int) *TaskCreate

SetNillableTargetID sets the "target" edge to the Target entity by ID if the given value is not nil.

func (*TaskCreate) SetOutput

func (tc *TaskCreate) SetOutput(s string) *TaskCreate

SetOutput sets the "Output" field.

func (*TaskCreate) SetQueueTime

func (tc *TaskCreate) SetQueueTime(t time.Time) *TaskCreate

SetQueueTime sets the "QueueTime" field.

func (*TaskCreate) SetSessionID

func (tc *TaskCreate) SetSessionID(s string) *TaskCreate

SetSessionID sets the "SessionID" field.

func (*TaskCreate) SetTarget added in v0.2.2

func (tc *TaskCreate) SetTarget(t *Target) *TaskCreate

SetTarget sets the "target" edge to the Target entity.

func (*TaskCreate) SetTargetID added in v0.2.2

func (tc *TaskCreate) SetTargetID(id int) *TaskCreate

SetTargetID sets the "target" edge to the Target entity by ID.

type TaskCreateBulk added in v0.4.3

type TaskCreateBulk struct {
	// contains filtered or unexported fields
}

TaskCreateBulk is the builder for creating many Task entities in bulk.

func (*TaskCreateBulk) Exec added in v0.4.3

func (tcb *TaskCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*TaskCreateBulk) ExecX added in v0.4.3

func (tcb *TaskCreateBulk) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*TaskCreateBulk) Save added in v0.4.3

func (tcb *TaskCreateBulk) Save(ctx context.Context) ([]*Task, error)

Save creates the Task entities in the database.

func (*TaskCreateBulk) SaveX added in v0.4.3

func (tcb *TaskCreateBulk) SaveX(ctx context.Context) []*Task

SaveX is like Save, but panics if an error occurs.

type TaskDelete

type TaskDelete struct {
	// contains filtered or unexported fields
}

TaskDelete is the builder for deleting a Task entity.

func (*TaskDelete) Exec

func (td *TaskDelete) Exec(ctx context.Context) (int, error)

Exec executes the deletion query and returns how many vertices were deleted.

func (*TaskDelete) ExecX

func (td *TaskDelete) ExecX(ctx context.Context) int

ExecX is like Exec, but panics if an error occurs.

func (*TaskDelete) Where

func (td *TaskDelete) Where(ps ...predicate.Task) *TaskDelete

Where appends a list predicates to the TaskDelete builder.

type TaskDeleteOne

type TaskDeleteOne struct {
	// contains filtered or unexported fields
}

TaskDeleteOne is the builder for deleting a single Task entity.

func (*TaskDeleteOne) Exec

func (tdo *TaskDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*TaskDeleteOne) ExecX

func (tdo *TaskDeleteOne) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

type TaskEdges added in v0.3.0

type TaskEdges struct {
	// Tags holds the value of the tags edge.
	Tags []*Tag `json:"tags,omitempty"`
	// Job holds the value of the job edge.
	Job *Job `json:"job,omitempty"`
	// Target holds the value of the target edge.
	Target *Target `json:"target,omitempty"`
	// contains filtered or unexported fields
}

TaskEdges holds the relations/edges for other nodes in the graph.

func (TaskEdges) JobOrErr added in v0.3.0

func (e TaskEdges) JobOrErr() (*Job, error)

JobOrErr returns the Job value or an error if the edge was not loaded in eager-loading, or loaded but was not found.

func (TaskEdges) TagsOrErr added in v0.3.0

func (e TaskEdges) TagsOrErr() ([]*Tag, error)

TagsOrErr returns the Tags value or an error if the edge was not loaded in eager-loading.

func (TaskEdges) TargetOrErr added in v0.3.0

func (e TaskEdges) TargetOrErr() (*Target, error)

TargetOrErr returns the Target value or an error if the edge was not loaded in eager-loading, or loaded but was not found.

type TaskGroupBy

type TaskGroupBy struct {
	// contains filtered or unexported fields
}

TaskGroupBy is the group-by builder for Task entities.

func (*TaskGroupBy) Aggregate

func (tgb *TaskGroupBy) Aggregate(fns ...AggregateFunc) *TaskGroupBy

Aggregate adds the given aggregation functions to the group-by query.

func (*TaskGroupBy) Bool added in v0.4.3

func (tgb *TaskGroupBy) 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 (*TaskGroupBy) BoolX added in v0.4.3

func (tgb *TaskGroupBy) BoolX(ctx context.Context) bool

BoolX is like Bool, but panics if an error occurs.

func (*TaskGroupBy) Bools

func (tgb *TaskGroupBy) 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 (*TaskGroupBy) BoolsX

func (tgb *TaskGroupBy) BoolsX(ctx context.Context) []bool

BoolsX is like Bools, but panics if an error occurs.

func (*TaskGroupBy) Float64 added in v0.4.3

func (tgb *TaskGroupBy) 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 (*TaskGroupBy) Float64X added in v0.4.3

func (tgb *TaskGroupBy) Float64X(ctx context.Context) float64

Float64X is like Float64, but panics if an error occurs.

func (*TaskGroupBy) Float64s

func (tgb *TaskGroupBy) 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 (*TaskGroupBy) Float64sX

func (tgb *TaskGroupBy) Float64sX(ctx context.Context) []float64

Float64sX is like Float64s, but panics if an error occurs.

func (*TaskGroupBy) Int added in v0.4.3

func (tgb *TaskGroupBy) 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 (*TaskGroupBy) IntX added in v0.4.3

func (tgb *TaskGroupBy) IntX(ctx context.Context) int

IntX is like Int, but panics if an error occurs.

func (*TaskGroupBy) Ints

func (tgb *TaskGroupBy) 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 (*TaskGroupBy) IntsX

func (tgb *TaskGroupBy) IntsX(ctx context.Context) []int

IntsX is like Ints, but panics if an error occurs.

func (*TaskGroupBy) Scan

func (tgb *TaskGroupBy) Scan(ctx context.Context, v interface{}) error

Scan applies the group-by query and scans the result into the given value.

func (*TaskGroupBy) ScanX

func (tgb *TaskGroupBy) ScanX(ctx context.Context, v interface{})

ScanX is like Scan, but panics if an error occurs.

func (*TaskGroupBy) String added in v0.4.3

func (tgb *TaskGroupBy) 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 (*TaskGroupBy) StringX added in v0.4.3

func (tgb *TaskGroupBy) StringX(ctx context.Context) string

StringX is like String, but panics if an error occurs.

func (*TaskGroupBy) Strings

func (tgb *TaskGroupBy) 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 (*TaskGroupBy) StringsX

func (tgb *TaskGroupBy) StringsX(ctx context.Context) []string

StringsX is like Strings, but panics if an error occurs.

type TaskMutation added in v0.4.3

type TaskMutation struct {
	// contains filtered or unexported fields
}

TaskMutation represents an operation that mutates the Task nodes in the graph.

func (*TaskMutation) AddField added in v0.4.3

func (m *TaskMutation) 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 (*TaskMutation) AddTagIDs added in v0.4.3

func (m *TaskMutation) AddTagIDs(ids ...int)

AddTagIDs adds the "tags" edge to the Tag entity by ids.

func (*TaskMutation) AddedEdges added in v0.4.3

func (m *TaskMutation) AddedEdges() []string

AddedEdges returns all edge names that were set/added in this mutation.

func (*TaskMutation) AddedField added in v0.4.3

func (m *TaskMutation) 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 (*TaskMutation) AddedFields added in v0.4.3

func (m *TaskMutation) AddedFields() []string

AddedFields returns all numeric fields that were incremented/decremented during this mutation.

func (*TaskMutation) AddedIDs added in v0.4.3

func (m *TaskMutation) AddedIDs(name string) []ent.Value

AddedIDs returns all IDs (to other nodes) that were added for the given edge name in this mutation.

func (*TaskMutation) ClaimTime added in v0.4.3

func (m *TaskMutation) ClaimTime() (r time.Time, exists bool)

ClaimTime returns the value of the "ClaimTime" field in the mutation.

func (*TaskMutation) ClaimTimeCleared added in v0.4.3

func (m *TaskMutation) ClaimTimeCleared() bool

ClaimTimeCleared returns if the "ClaimTime" field was cleared in this mutation.

func (*TaskMutation) ClearClaimTime added in v0.4.3

func (m *TaskMutation) ClearClaimTime()

ClearClaimTime clears the value of the "ClaimTime" field.

func (*TaskMutation) ClearEdge added in v0.4.3

func (m *TaskMutation) 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 (*TaskMutation) ClearError added in v0.4.3

func (m *TaskMutation) ClearError()

ClearError clears the value of the "Error" field.

func (*TaskMutation) ClearExecStartTime added in v0.4.3

func (m *TaskMutation) ClearExecStartTime()

ClearExecStartTime clears the value of the "ExecStartTime" field.

func (*TaskMutation) ClearExecStopTime added in v0.4.3

func (m *TaskMutation) ClearExecStopTime()

ClearExecStopTime clears the value of the "ExecStopTime" field.

func (*TaskMutation) ClearField added in v0.4.3

func (m *TaskMutation) 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 (*TaskMutation) ClearJob added in v0.4.3

func (m *TaskMutation) ClearJob()

ClearJob clears the "job" edge to the Job entity.

func (*TaskMutation) ClearOutput added in v0.4.3

func (m *TaskMutation) ClearOutput()

ClearOutput clears the value of the "Output" field.

func (*TaskMutation) ClearSessionID added in v0.4.3

func (m *TaskMutation) ClearSessionID()

ClearSessionID clears the value of the "SessionID" field.

func (*TaskMutation) ClearTags added in v0.4.3

func (m *TaskMutation) ClearTags()

ClearTags clears the "tags" edge to the Tag entity.

func (*TaskMutation) ClearTarget added in v0.4.3

func (m *TaskMutation) ClearTarget()

ClearTarget clears the "target" edge to the Target entity.

func (*TaskMutation) ClearedEdges added in v0.4.3

func (m *TaskMutation) ClearedEdges() []string

ClearedEdges returns all edge names that were cleared in this mutation.

func (*TaskMutation) ClearedFields added in v0.4.3

func (m *TaskMutation) ClearedFields() []string

ClearedFields returns all nullable fields that were cleared during this mutation.

func (TaskMutation) Client added in v0.4.3

func (m TaskMutation) 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 (*TaskMutation) Content added in v0.4.3

func (m *TaskMutation) Content() (r string, exists bool)

Content returns the value of the "Content" field in the mutation.

func (*TaskMutation) EdgeCleared added in v0.4.3

func (m *TaskMutation) EdgeCleared(name string) bool

EdgeCleared returns a boolean which indicates if the edge with the given name was cleared in this mutation.

func (*TaskMutation) Error added in v0.4.3

func (m *TaskMutation) Error() (r string, exists bool)

Error returns the value of the "Error" field in the mutation.

func (*TaskMutation) ErrorCleared added in v0.4.3

func (m *TaskMutation) ErrorCleared() bool

ErrorCleared returns if the "Error" field was cleared in this mutation.

func (*TaskMutation) ExecStartTime added in v0.4.3

func (m *TaskMutation) ExecStartTime() (r time.Time, exists bool)

ExecStartTime returns the value of the "ExecStartTime" field in the mutation.

func (*TaskMutation) ExecStartTimeCleared added in v0.4.3

func (m *TaskMutation) ExecStartTimeCleared() bool

ExecStartTimeCleared returns if the "ExecStartTime" field was cleared in this mutation.

func (*TaskMutation) ExecStopTime added in v0.4.3

func (m *TaskMutation) ExecStopTime() (r time.Time, exists bool)

ExecStopTime returns the value of the "ExecStopTime" field in the mutation.

func (*TaskMutation) ExecStopTimeCleared added in v0.4.3

func (m *TaskMutation) ExecStopTimeCleared() bool

ExecStopTimeCleared returns if the "ExecStopTime" field was cleared in this mutation.

func (*TaskMutation) Field added in v0.4.3

func (m *TaskMutation) 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 (*TaskMutation) FieldCleared added in v0.4.3

func (m *TaskMutation) FieldCleared(name string) bool

FieldCleared returns a boolean indicating if a field with the given name was cleared in this mutation.

func (*TaskMutation) Fields added in v0.4.3

func (m *TaskMutation) 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 (*TaskMutation) ID added in v0.4.3

func (m *TaskMutation) 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 (*TaskMutation) IDs added in v0.4.3

func (m *TaskMutation) 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 (*TaskMutation) JobCleared added in v0.4.3

func (m *TaskMutation) JobCleared() bool

JobCleared reports if the "job" edge to the Job entity was cleared.

func (*TaskMutation) JobID added in v0.4.3

func (m *TaskMutation) JobID() (id int, exists bool)

JobID returns the "job" edge ID in the mutation.

func (*TaskMutation) JobIDs added in v0.4.3

func (m *TaskMutation) JobIDs() (ids []int)

JobIDs returns the "job" edge IDs in the mutation. Note that IDs always returns len(IDs) <= 1 for unique edges, and you should use JobID instead. It exists only for internal usage by the builders.

func (*TaskMutation) LastChangedTime added in v0.4.3

func (m *TaskMutation) LastChangedTime() (r time.Time, exists bool)

LastChangedTime returns the value of the "LastChangedTime" field in the mutation.

func (*TaskMutation) OldClaimTime added in v0.4.3

func (m *TaskMutation) OldClaimTime(ctx context.Context) (v time.Time, err error)

OldClaimTime returns the old "ClaimTime" field's value of the Task entity. If the Task 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 (*TaskMutation) OldContent added in v0.4.3

func (m *TaskMutation) OldContent(ctx context.Context) (v string, err error)

OldContent returns the old "Content" field's value of the Task entity. If the Task 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 (*TaskMutation) OldError added in v0.4.3

func (m *TaskMutation) OldError(ctx context.Context) (v string, err error)

OldError returns the old "Error" field's value of the Task entity. If the Task 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 (*TaskMutation) OldExecStartTime added in v0.4.3

func (m *TaskMutation) OldExecStartTime(ctx context.Context) (v time.Time, err error)

OldExecStartTime returns the old "ExecStartTime" field's value of the Task entity. If the Task 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 (*TaskMutation) OldExecStopTime added in v0.4.3

func (m *TaskMutation) OldExecStopTime(ctx context.Context) (v time.Time, err error)

OldExecStopTime returns the old "ExecStopTime" field's value of the Task entity. If the Task 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 (*TaskMutation) OldField added in v0.4.3

func (m *TaskMutation) 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 (*TaskMutation) OldLastChangedTime added in v0.4.3

func (m *TaskMutation) OldLastChangedTime(ctx context.Context) (v time.Time, err error)

OldLastChangedTime returns the old "LastChangedTime" field's value of the Task entity. If the Task 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 (*TaskMutation) OldOutput added in v0.4.3

func (m *TaskMutation) OldOutput(ctx context.Context) (v string, err error)

OldOutput returns the old "Output" field's value of the Task entity. If the Task 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 (*TaskMutation) OldQueueTime added in v0.4.3

func (m *TaskMutation) OldQueueTime(ctx context.Context) (v time.Time, err error)

OldQueueTime returns the old "QueueTime" field's value of the Task entity. If the Task 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 (*TaskMutation) OldSessionID added in v0.4.3

func (m *TaskMutation) OldSessionID(ctx context.Context) (v string, err error)

OldSessionID returns the old "SessionID" field's value of the Task entity. If the Task 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 (*TaskMutation) Op added in v0.4.3

func (m *TaskMutation) Op() Op

Op returns the operation name.

func (*TaskMutation) Output added in v0.4.3

func (m *TaskMutation) Output() (r string, exists bool)

Output returns the value of the "Output" field in the mutation.

func (*TaskMutation) OutputCleared added in v0.4.3

func (m *TaskMutation) OutputCleared() bool

OutputCleared returns if the "Output" field was cleared in this mutation.

func (*TaskMutation) QueueTime added in v0.4.3

func (m *TaskMutation) QueueTime() (r time.Time, exists bool)

QueueTime returns the value of the "QueueTime" field in the mutation.

func (*TaskMutation) RemoveTagIDs added in v0.4.3

func (m *TaskMutation) RemoveTagIDs(ids ...int)

RemoveTagIDs removes the "tags" edge to the Tag entity by IDs.

func (*TaskMutation) RemovedEdges added in v0.4.3

func (m *TaskMutation) RemovedEdges() []string

RemovedEdges returns all edge names that were removed in this mutation.

func (*TaskMutation) RemovedIDs added in v0.4.3

func (m *TaskMutation) 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 (*TaskMutation) RemovedTagsIDs added in v0.4.3

func (m *TaskMutation) RemovedTagsIDs() (ids []int)

RemovedTags returns the removed IDs of the "tags" edge to the Tag entity.

func (*TaskMutation) ResetClaimTime added in v0.4.3

func (m *TaskMutation) ResetClaimTime()

ResetClaimTime resets all changes to the "ClaimTime" field.

func (*TaskMutation) ResetContent added in v0.4.3

func (m *TaskMutation) ResetContent()

ResetContent resets all changes to the "Content" field.

func (*TaskMutation) ResetEdge added in v0.4.3

func (m *TaskMutation) 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 (*TaskMutation) ResetError added in v0.4.3

func (m *TaskMutation) ResetError()

ResetError resets all changes to the "Error" field.

func (*TaskMutation) ResetExecStartTime added in v0.4.3

func (m *TaskMutation) ResetExecStartTime()

ResetExecStartTime resets all changes to the "ExecStartTime" field.

func (*TaskMutation) ResetExecStopTime added in v0.4.3

func (m *TaskMutation) ResetExecStopTime()

ResetExecStopTime resets all changes to the "ExecStopTime" field.

func (*TaskMutation) ResetField added in v0.4.3

func (m *TaskMutation) 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 (*TaskMutation) ResetJob added in v0.4.3

func (m *TaskMutation) ResetJob()

ResetJob resets all changes to the "job" edge.

func (*TaskMutation) ResetLastChangedTime added in v0.4.3

func (m *TaskMutation) ResetLastChangedTime()

ResetLastChangedTime resets all changes to the "LastChangedTime" field.

func (*TaskMutation) ResetOutput added in v0.4.3

func (m *TaskMutation) ResetOutput()

ResetOutput resets all changes to the "Output" field.

func (*TaskMutation) ResetQueueTime added in v0.4.3

func (m *TaskMutation) ResetQueueTime()

ResetQueueTime resets all changes to the "QueueTime" field.

func (*TaskMutation) ResetSessionID added in v0.4.3

func (m *TaskMutation) ResetSessionID()

ResetSessionID resets all changes to the "SessionID" field.

func (*TaskMutation) ResetTags added in v0.4.3

func (m *TaskMutation) ResetTags()

ResetTags resets all changes to the "tags" edge.

func (*TaskMutation) ResetTarget added in v0.4.3

func (m *TaskMutation) ResetTarget()

ResetTarget resets all changes to the "target" edge.

func (*TaskMutation) SessionID added in v0.4.3

func (m *TaskMutation) SessionID() (r string, exists bool)

SessionID returns the value of the "SessionID" field in the mutation.

func (*TaskMutation) SessionIDCleared added in v0.4.3

func (m *TaskMutation) SessionIDCleared() bool

SessionIDCleared returns if the "SessionID" field was cleared in this mutation.

func (*TaskMutation) SetClaimTime added in v0.4.3

func (m *TaskMutation) SetClaimTime(t time.Time)

SetClaimTime sets the "ClaimTime" field.

func (*TaskMutation) SetContent added in v0.4.3

func (m *TaskMutation) SetContent(s string)

SetContent sets the "Content" field.

func (*TaskMutation) SetError added in v0.4.3

func (m *TaskMutation) SetError(s string)

SetError sets the "Error" field.

func (*TaskMutation) SetExecStartTime added in v0.4.3

func (m *TaskMutation) SetExecStartTime(t time.Time)

SetExecStartTime sets the "ExecStartTime" field.

func (*TaskMutation) SetExecStopTime added in v0.4.3

func (m *TaskMutation) SetExecStopTime(t time.Time)

SetExecStopTime sets the "ExecStopTime" field.

func (*TaskMutation) SetField added in v0.4.3

func (m *TaskMutation) 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 (*TaskMutation) SetJobID added in v0.4.3

func (m *TaskMutation) SetJobID(id int)

SetJobID sets the "job" edge to the Job entity by id.

func (*TaskMutation) SetLastChangedTime added in v0.4.3

func (m *TaskMutation) SetLastChangedTime(t time.Time)

SetLastChangedTime sets the "LastChangedTime" field.

func (*TaskMutation) SetOutput added in v0.4.3

func (m *TaskMutation) SetOutput(s string)

SetOutput sets the "Output" field.

func (*TaskMutation) SetQueueTime added in v0.4.3

func (m *TaskMutation) SetQueueTime(t time.Time)

SetQueueTime sets the "QueueTime" field.

func (*TaskMutation) SetSessionID added in v0.4.3

func (m *TaskMutation) SetSessionID(s string)

SetSessionID sets the "SessionID" field.

func (*TaskMutation) SetTargetID added in v0.4.3

func (m *TaskMutation) SetTargetID(id int)

SetTargetID sets the "target" edge to the Target entity by id.

func (*TaskMutation) TagsCleared added in v0.4.3

func (m *TaskMutation) TagsCleared() bool

TagsCleared reports if the "tags" edge to the Tag entity was cleared.

func (*TaskMutation) TagsIDs added in v0.4.3

func (m *TaskMutation) TagsIDs() (ids []int)

TagsIDs returns the "tags" edge IDs in the mutation.

func (*TaskMutation) TargetCleared added in v0.4.3

func (m *TaskMutation) TargetCleared() bool

TargetCleared reports if the "target" edge to the Target entity was cleared.

func (*TaskMutation) TargetID added in v0.4.3

func (m *TaskMutation) TargetID() (id int, exists bool)

TargetID returns the "target" edge ID in the mutation.

func (*TaskMutation) TargetIDs added in v0.4.3

func (m *TaskMutation) TargetIDs() (ids []int)

TargetIDs returns the "target" edge IDs in the mutation. Note that IDs always returns len(IDs) <= 1 for unique edges, and you should use TargetID instead. It exists only for internal usage by the builders.

func (TaskMutation) Tx added in v0.4.3

func (m TaskMutation) Tx() (*Tx, error)

Tx returns an `ent.Tx` for mutations that were executed in transactions; it returns an error otherwise.

func (*TaskMutation) Type added in v0.4.3

func (m *TaskMutation) Type() string

Type returns the node type of this mutation (Task).

func (*TaskMutation) Where added in v0.4.3

func (m *TaskMutation) Where(ps ...predicate.Task)

Where appends a list predicates to the TaskMutation builder.

type TaskQuery

type TaskQuery struct {
	// contains filtered or unexported fields
}

TaskQuery is the builder for querying Task entities.

func (*TaskQuery) All

func (tq *TaskQuery) All(ctx context.Context) ([]*Task, error)

All executes the query and returns a list of Tasks.

func (*TaskQuery) AllX

func (tq *TaskQuery) AllX(ctx context.Context) []*Task

AllX is like All, but panics if an error occurs.

func (*TaskQuery) Clone

func (tq *TaskQuery) Clone() *TaskQuery

Clone returns a duplicate of the TaskQuery builder, including all associated steps. It can be used to prepare common query builders and use them differently after the clone is made.

func (*TaskQuery) Count

func (tq *TaskQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*TaskQuery) CountX

func (tq *TaskQuery) CountX(ctx context.Context) int

CountX is like Count, but panics if an error occurs.

func (*TaskQuery) Exist

func (tq *TaskQuery) Exist(ctx context.Context) (bool, error)

Exist returns true if the query has elements in the graph.

func (*TaskQuery) ExistX

func (tq *TaskQuery) ExistX(ctx context.Context) bool

ExistX is like Exist, but panics if an error occurs.

func (*TaskQuery) First

func (tq *TaskQuery) First(ctx context.Context) (*Task, error)

First returns the first Task entity from the query. Returns a *NotFoundError when no Task was found.

func (*TaskQuery) FirstID

func (tq *TaskQuery) FirstID(ctx context.Context) (id int, err error)

FirstID returns the first Task ID from the query. Returns a *NotFoundError when no Task ID was found.

func (*TaskQuery) FirstIDX added in v0.4.3

func (tq *TaskQuery) FirstIDX(ctx context.Context) int

FirstIDX is like FirstID, but panics if an error occurs.

func (*TaskQuery) FirstX

func (tq *TaskQuery) FirstX(ctx context.Context) *Task

FirstX is like First, but panics if an error occurs.

func (*TaskQuery) GroupBy

func (tq *TaskQuery) GroupBy(field string, fields ...string) *TaskGroupBy

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 {
	QueueTime time.Time `json:"QueueTime,omitempty"`
	Count int `json:"count,omitempty"`
}

client.Task.Query().
	GroupBy(task.FieldQueueTime).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*TaskQuery) IDs

func (tq *TaskQuery) IDs(ctx context.Context) ([]int, error)

IDs executes the query and returns a list of Task IDs.

func (*TaskQuery) IDsX

func (tq *TaskQuery) IDsX(ctx context.Context) []int

IDsX is like IDs, but panics if an error occurs.

func (*TaskQuery) Limit

func (tq *TaskQuery) Limit(limit int) *TaskQuery

Limit adds a limit step to the query.

func (*TaskQuery) Offset

func (tq *TaskQuery) Offset(offset int) *TaskQuery

Offset adds an offset step to the query.

func (*TaskQuery) Only

func (tq *TaskQuery) Only(ctx context.Context) (*Task, error)

Only returns a single Task entity found by the query, ensuring it only returns one. Returns a *NotSingularError when exactly one Task entity is not found. Returns a *NotFoundError when no Task entities are found.

func (*TaskQuery) OnlyID

func (tq *TaskQuery) OnlyID(ctx context.Context) (id int, err error)

OnlyID is like Only, but returns the only Task ID in the query. Returns a *NotSingularError when exactly one Task ID is not found. Returns a *NotFoundError when no entities are found.

func (*TaskQuery) OnlyIDX added in v0.4.3

func (tq *TaskQuery) OnlyIDX(ctx context.Context) int

OnlyIDX is like OnlyID, but panics if an error occurs.

func (*TaskQuery) OnlyX

func (tq *TaskQuery) OnlyX(ctx context.Context) *Task

OnlyX is like Only, but panics if an error occurs.

func (*TaskQuery) Order

func (tq *TaskQuery) Order(o ...OrderFunc) *TaskQuery

Order adds an order step to the query.

func (*TaskQuery) QueryJob

func (tq *TaskQuery) QueryJob() *JobQuery

QueryJob chains the current query on the "job" edge.

func (*TaskQuery) QueryTags

func (tq *TaskQuery) QueryTags() *TagQuery

QueryTags chains the current query on the "tags" edge.

func (*TaskQuery) QueryTarget added in v0.2.2

func (tq *TaskQuery) QueryTarget() *TargetQuery

QueryTarget chains the current query on the "target" edge.

func (*TaskQuery) Select

func (tq *TaskQuery) Select(fields ...string) *TaskSelect

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 {
	QueueTime time.Time `json:"QueueTime,omitempty"`
}

client.Task.Query().
	Select(task.FieldQueueTime).
	Scan(ctx, &v)

func (*TaskQuery) Unique added in v0.4.3

func (tq *TaskQuery) Unique(unique bool) *TaskQuery

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 (*TaskQuery) Where

func (tq *TaskQuery) Where(ps ...predicate.Task) *TaskQuery

Where adds a new predicate for the TaskQuery builder.

func (*TaskQuery) WithJob added in v0.2.3

func (tq *TaskQuery) WithJob(opts ...func(*JobQuery)) *TaskQuery

WithJob tells the query-builder to eager-load the nodes that are connected to the "job" edge. The optional arguments are used to configure the query builder of the edge.

func (*TaskQuery) WithTags added in v0.2.3

func (tq *TaskQuery) WithTags(opts ...func(*TagQuery)) *TaskQuery

WithTags tells the query-builder to eager-load the nodes that are connected to the "tags" edge. The optional arguments are used to configure the query builder of the edge.

func (*TaskQuery) WithTarget added in v0.2.3

func (tq *TaskQuery) WithTarget(opts ...func(*TargetQuery)) *TaskQuery

WithTarget tells the query-builder to eager-load the nodes that are connected to the "target" edge. The optional arguments are used to configure the query builder of the edge.

type TaskSelect

type TaskSelect struct {
	*TaskQuery
	// contains filtered or unexported fields
}

TaskSelect is the builder for selecting fields of Task entities.

func (*TaskSelect) Bool added in v0.4.3

func (ts *TaskSelect) Bool(ctx context.Context) (_ bool, err error)

Bool returns a single bool from a selector. It is only allowed when selecting one field.

func (*TaskSelect) BoolX added in v0.4.3

func (ts *TaskSelect) BoolX(ctx context.Context) bool

BoolX is like Bool, but panics if an error occurs.

func (*TaskSelect) Bools

func (ts *TaskSelect) Bools(ctx context.Context) ([]bool, error)

Bools returns list of bools from a selector. It is only allowed when selecting one field.

func (*TaskSelect) BoolsX

func (ts *TaskSelect) BoolsX(ctx context.Context) []bool

BoolsX is like Bools, but panics if an error occurs.

func (*TaskSelect) Float64 added in v0.4.3

func (ts *TaskSelect) Float64(ctx context.Context) (_ float64, err error)

Float64 returns a single float64 from a selector. It is only allowed when selecting one field.

func (*TaskSelect) Float64X added in v0.4.3

func (ts *TaskSelect) Float64X(ctx context.Context) float64

Float64X is like Float64, but panics if an error occurs.

func (*TaskSelect) Float64s

func (ts *TaskSelect) Float64s(ctx context.Context) ([]float64, error)

Float64s returns list of float64s from a selector. It is only allowed when selecting one field.

func (*TaskSelect) Float64sX

func (ts *TaskSelect) Float64sX(ctx context.Context) []float64

Float64sX is like Float64s, but panics if an error occurs.

func (*TaskSelect) Int added in v0.4.3

func (ts *TaskSelect) Int(ctx context.Context) (_ int, err error)

Int returns a single int from a selector. It is only allowed when selecting one field.

func (*TaskSelect) IntX added in v0.4.3

func (ts *TaskSelect) IntX(ctx context.Context) int

IntX is like Int, but panics if an error occurs.

func (*TaskSelect) Ints

func (ts *TaskSelect) Ints(ctx context.Context) ([]int, error)

Ints returns list of ints from a selector. It is only allowed when selecting one field.

func (*TaskSelect) IntsX

func (ts *TaskSelect) IntsX(ctx context.Context) []int

IntsX is like Ints, but panics if an error occurs.

func (*TaskSelect) Scan

func (ts *TaskSelect) Scan(ctx context.Context, v interface{}) error

Scan applies the selector query and scans the result into the given value.

func (*TaskSelect) ScanX

func (ts *TaskSelect) ScanX(ctx context.Context, v interface{})

ScanX is like Scan, but panics if an error occurs.

func (*TaskSelect) String added in v0.4.3

func (ts *TaskSelect) String(ctx context.Context) (_ string, err error)

String returns a single string from a selector. It is only allowed when selecting one field.

func (*TaskSelect) StringX added in v0.4.3

func (ts *TaskSelect) StringX(ctx context.Context) string

StringX is like String, but panics if an error occurs.

func (*TaskSelect) Strings

func (ts *TaskSelect) Strings(ctx context.Context) ([]string, error)

Strings returns list of strings from a selector. It is only allowed when selecting one field.

func (*TaskSelect) StringsX

func (ts *TaskSelect) StringsX(ctx context.Context) []string

StringsX is like Strings, but panics if an error occurs.

type TaskUpdate

type TaskUpdate struct {
	// contains filtered or unexported fields
}

TaskUpdate is the builder for updating Task entities.

func (*TaskUpdate) AddTagIDs

func (tu *TaskUpdate) AddTagIDs(ids ...int) *TaskUpdate

AddTagIDs adds the "tags" edge to the Tag entity by IDs.

func (*TaskUpdate) AddTags

func (tu *TaskUpdate) AddTags(t ...*Tag) *TaskUpdate

AddTags adds the "tags" edges to the Tag entity.

func (*TaskUpdate) ClearClaimTime

func (tu *TaskUpdate) ClearClaimTime() *TaskUpdate

ClearClaimTime clears the value of the "ClaimTime" field.

func (*TaskUpdate) ClearError

func (tu *TaskUpdate) ClearError() *TaskUpdate

ClearError clears the value of the "Error" field.

func (*TaskUpdate) ClearExecStartTime

func (tu *TaskUpdate) ClearExecStartTime() *TaskUpdate

ClearExecStartTime clears the value of the "ExecStartTime" field.

func (*TaskUpdate) ClearExecStopTime

func (tu *TaskUpdate) ClearExecStopTime() *TaskUpdate

ClearExecStopTime clears the value of the "ExecStopTime" field.

func (*TaskUpdate) ClearJob

func (tu *TaskUpdate) ClearJob() *TaskUpdate

ClearJob clears the "job" edge to the Job entity.

func (*TaskUpdate) ClearOutput

func (tu *TaskUpdate) ClearOutput() *TaskUpdate

ClearOutput clears the value of the "Output" field.

func (*TaskUpdate) ClearSessionID

func (tu *TaskUpdate) ClearSessionID() *TaskUpdate

ClearSessionID clears the value of the "SessionID" field.

func (*TaskUpdate) ClearTags added in v0.4.3

func (tu *TaskUpdate) ClearTags() *TaskUpdate

ClearTags clears all "tags" edges to the Tag entity.

func (*TaskUpdate) ClearTarget added in v0.2.2

func (tu *TaskUpdate) ClearTarget() *TaskUpdate

ClearTarget clears the "target" edge to the Target entity.

func (*TaskUpdate) Exec

func (tu *TaskUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*TaskUpdate) ExecX

func (tu *TaskUpdate) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*TaskUpdate) Mutation added in v0.4.3

func (tu *TaskUpdate) Mutation() *TaskMutation

Mutation returns the TaskMutation object of the builder.

func (*TaskUpdate) RemoveTagIDs

func (tu *TaskUpdate) RemoveTagIDs(ids ...int) *TaskUpdate

RemoveTagIDs removes the "tags" edge to Tag entities by IDs.

func (*TaskUpdate) RemoveTags

func (tu *TaskUpdate) RemoveTags(t ...*Tag) *TaskUpdate

RemoveTags removes "tags" edges to Tag entities.

func (*TaskUpdate) Save

func (tu *TaskUpdate) Save(ctx context.Context) (int, error)

Save executes the query and returns the number of nodes affected by the update operation.

func (*TaskUpdate) SaveX

func (tu *TaskUpdate) SaveX(ctx context.Context) int

SaveX is like Save, but panics if an error occurs.

func (*TaskUpdate) SetClaimTime

func (tu *TaskUpdate) SetClaimTime(t time.Time) *TaskUpdate

SetClaimTime sets the "ClaimTime" field.

func (*TaskUpdate) SetContent

func (tu *TaskUpdate) SetContent(s string) *TaskUpdate

SetContent sets the "Content" field.

func (*TaskUpdate) SetError

func (tu *TaskUpdate) SetError(s string) *TaskUpdate

SetError sets the "Error" field.

func (*TaskUpdate) SetExecStartTime

func (tu *TaskUpdate) SetExecStartTime(t time.Time) *TaskUpdate

SetExecStartTime sets the "ExecStartTime" field.

func (*TaskUpdate) SetExecStopTime

func (tu *TaskUpdate) SetExecStopTime(t time.Time) *TaskUpdate

SetExecStopTime sets the "ExecStopTime" field.

func (*TaskUpdate) SetJob

func (tu *TaskUpdate) SetJob(j *Job) *TaskUpdate

SetJob sets the "job" edge to the Job entity.

func (*TaskUpdate) SetJobID

func (tu *TaskUpdate) SetJobID(id int) *TaskUpdate

SetJobID sets the "job" edge to the Job entity by ID.

func (*TaskUpdate) SetLastChangedTime added in v0.2.2

func (tu *TaskUpdate) SetLastChangedTime(t time.Time) *TaskUpdate

SetLastChangedTime sets the "LastChangedTime" field.

func (*TaskUpdate) SetNillableClaimTime

func (tu *TaskUpdate) SetNillableClaimTime(t *time.Time) *TaskUpdate

SetNillableClaimTime sets the "ClaimTime" field if the given value is not nil.

func (*TaskUpdate) SetNillableError

func (tu *TaskUpdate) SetNillableError(s *string) *TaskUpdate

SetNillableError sets the "Error" field if the given value is not nil.

func (*TaskUpdate) SetNillableExecStartTime

func (tu *TaskUpdate) SetNillableExecStartTime(t *time.Time) *TaskUpdate

SetNillableExecStartTime sets the "ExecStartTime" field if the given value is not nil.

func (*TaskUpdate) SetNillableExecStopTime

func (tu *TaskUpdate) SetNillableExecStopTime(t *time.Time) *TaskUpdate

SetNillableExecStopTime sets the "ExecStopTime" field if the given value is not nil.

func (*TaskUpdate) SetNillableOutput

func (tu *TaskUpdate) SetNillableOutput(s *string) *TaskUpdate

SetNillableOutput sets the "Output" field if the given value is not nil.

func (*TaskUpdate) SetNillableQueueTime

func (tu *TaskUpdate) SetNillableQueueTime(t *time.Time) *TaskUpdate

SetNillableQueueTime sets the "QueueTime" field if the given value is not nil.

func (*TaskUpdate) SetNillableSessionID

func (tu *TaskUpdate) SetNillableSessionID(s *string) *TaskUpdate

SetNillableSessionID sets the "SessionID" field if the given value is not nil.

func (*TaskUpdate) SetNillableTargetID added in v0.2.2

func (tu *TaskUpdate) SetNillableTargetID(id *int) *TaskUpdate

SetNillableTargetID sets the "target" edge to the Target entity by ID if the given value is not nil.

func (*TaskUpdate) SetOutput

func (tu *TaskUpdate) SetOutput(s string) *TaskUpdate

SetOutput sets the "Output" field.

func (*TaskUpdate) SetQueueTime

func (tu *TaskUpdate) SetQueueTime(t time.Time) *TaskUpdate

SetQueueTime sets the "QueueTime" field.

func (*TaskUpdate) SetSessionID

func (tu *TaskUpdate) SetSessionID(s string) *TaskUpdate

SetSessionID sets the "SessionID" field.

func (*TaskUpdate) SetTarget added in v0.2.2

func (tu *TaskUpdate) SetTarget(t *Target) *TaskUpdate

SetTarget sets the "target" edge to the Target entity.

func (*TaskUpdate) SetTargetID added in v0.2.2

func (tu *TaskUpdate) SetTargetID(id int) *TaskUpdate

SetTargetID sets the "target" edge to the Target entity by ID.

func (*TaskUpdate) Where

func (tu *TaskUpdate) Where(ps ...predicate.Task) *TaskUpdate

Where appends a list predicates to the TaskUpdate builder.

type TaskUpdateOne

type TaskUpdateOne struct {
	// contains filtered or unexported fields
}

TaskUpdateOne is the builder for updating a single Task entity.

func (*TaskUpdateOne) AddTagIDs

func (tuo *TaskUpdateOne) AddTagIDs(ids ...int) *TaskUpdateOne

AddTagIDs adds the "tags" edge to the Tag entity by IDs.

func (*TaskUpdateOne) AddTags

func (tuo *TaskUpdateOne) AddTags(t ...*Tag) *TaskUpdateOne

AddTags adds the "tags" edges to the Tag entity.

func (*TaskUpdateOne) ClearClaimTime

func (tuo *TaskUpdateOne) ClearClaimTime() *TaskUpdateOne

ClearClaimTime clears the value of the "ClaimTime" field.

func (*TaskUpdateOne) ClearError

func (tuo *TaskUpdateOne) ClearError() *TaskUpdateOne

ClearError clears the value of the "Error" field.

func (*TaskUpdateOne) ClearExecStartTime

func (tuo *TaskUpdateOne) ClearExecStartTime() *TaskUpdateOne

ClearExecStartTime clears the value of the "ExecStartTime" field.

func (*TaskUpdateOne) ClearExecStopTime

func (tuo *TaskUpdateOne) ClearExecStopTime() *TaskUpdateOne

ClearExecStopTime clears the value of the "ExecStopTime" field.

func (*TaskUpdateOne) ClearJob

func (tuo *TaskUpdateOne) ClearJob() *TaskUpdateOne

ClearJob clears the "job" edge to the Job entity.

func (*TaskUpdateOne) ClearOutput

func (tuo *TaskUpdateOne) ClearOutput() *TaskUpdateOne

ClearOutput clears the value of the "Output" field.

func (*TaskUpdateOne) ClearSessionID

func (tuo *TaskUpdateOne) ClearSessionID() *TaskUpdateOne

ClearSessionID clears the value of the "SessionID" field.

func (*TaskUpdateOne) ClearTags added in v0.4.3

func (tuo *TaskUpdateOne) ClearTags() *TaskUpdateOne

ClearTags clears all "tags" edges to the Tag entity.

func (*TaskUpdateOne) ClearTarget added in v0.2.2

func (tuo *TaskUpdateOne) ClearTarget() *TaskUpdateOne

ClearTarget clears the "target" edge to the Target entity.

func (*TaskUpdateOne) Exec

func (tuo *TaskUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*TaskUpdateOne) ExecX

func (tuo *TaskUpdateOne) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*TaskUpdateOne) Mutation added in v0.4.3

func (tuo *TaskUpdateOne) Mutation() *TaskMutation

Mutation returns the TaskMutation object of the builder.

func (*TaskUpdateOne) RemoveTagIDs

func (tuo *TaskUpdateOne) RemoveTagIDs(ids ...int) *TaskUpdateOne

RemoveTagIDs removes the "tags" edge to Tag entities by IDs.

func (*TaskUpdateOne) RemoveTags

func (tuo *TaskUpdateOne) RemoveTags(t ...*Tag) *TaskUpdateOne

RemoveTags removes "tags" edges to Tag entities.

func (*TaskUpdateOne) Save

func (tuo *TaskUpdateOne) Save(ctx context.Context) (*Task, error)

Save executes the query and returns the updated Task entity.

func (*TaskUpdateOne) SaveX

func (tuo *TaskUpdateOne) SaveX(ctx context.Context) *Task

SaveX is like Save, but panics if an error occurs.

func (*TaskUpdateOne) Select added in v0.4.3

func (tuo *TaskUpdateOne) Select(field string, fields ...string) *TaskUpdateOne

Select allows selecting one or more fields (columns) of the returned entity. The default is selecting all fields defined in the entity schema.

func (*TaskUpdateOne) SetClaimTime

func (tuo *TaskUpdateOne) SetClaimTime(t time.Time) *TaskUpdateOne

SetClaimTime sets the "ClaimTime" field.

func (*TaskUpdateOne) SetContent

func (tuo *TaskUpdateOne) SetContent(s string) *TaskUpdateOne

SetContent sets the "Content" field.

func (*TaskUpdateOne) SetError

func (tuo *TaskUpdateOne) SetError(s string) *TaskUpdateOne

SetError sets the "Error" field.

func (*TaskUpdateOne) SetExecStartTime

func (tuo *TaskUpdateOne) SetExecStartTime(t time.Time) *TaskUpdateOne

SetExecStartTime sets the "ExecStartTime" field.

func (*TaskUpdateOne) SetExecStopTime

func (tuo *TaskUpdateOne) SetExecStopTime(t time.Time) *TaskUpdateOne

SetExecStopTime sets the "ExecStopTime" field.

func (*TaskUpdateOne) SetJob

func (tuo *TaskUpdateOne) SetJob(j *Job) *TaskUpdateOne

SetJob sets the "job" edge to the Job entity.

func (*TaskUpdateOne) SetJobID

func (tuo *TaskUpdateOne) SetJobID(id int) *TaskUpdateOne

SetJobID sets the "job" edge to the Job entity by ID.

func (*TaskUpdateOne) SetLastChangedTime added in v0.2.2

func (tuo *TaskUpdateOne) SetLastChangedTime(t time.Time) *TaskUpdateOne

SetLastChangedTime sets the "LastChangedTime" field.

func (*TaskUpdateOne) SetNillableClaimTime

func (tuo *TaskUpdateOne) SetNillableClaimTime(t *time.Time) *TaskUpdateOne

SetNillableClaimTime sets the "ClaimTime" field if the given value is not nil.

func (*TaskUpdateOne) SetNillableError

func (tuo *TaskUpdateOne) SetNillableError(s *string) *TaskUpdateOne

SetNillableError sets the "Error" field if the given value is not nil.

func (*TaskUpdateOne) SetNillableExecStartTime

func (tuo *TaskUpdateOne) SetNillableExecStartTime(t *time.Time) *TaskUpdateOne

SetNillableExecStartTime sets the "ExecStartTime" field if the given value is not nil.

func (*TaskUpdateOne) SetNillableExecStopTime

func (tuo *TaskUpdateOne) SetNillableExecStopTime(t *time.Time) *TaskUpdateOne

SetNillableExecStopTime sets the "ExecStopTime" field if the given value is not nil.

func (*TaskUpdateOne) SetNillableOutput

func (tuo *TaskUpdateOne) SetNillableOutput(s *string) *TaskUpdateOne

SetNillableOutput sets the "Output" field if the given value is not nil.

func (*TaskUpdateOne) SetNillableQueueTime

func (tuo *TaskUpdateOne) SetNillableQueueTime(t *time.Time) *TaskUpdateOne

SetNillableQueueTime sets the "QueueTime" field if the given value is not nil.

func (*TaskUpdateOne) SetNillableSessionID

func (tuo *TaskUpdateOne) SetNillableSessionID(s *string) *TaskUpdateOne

SetNillableSessionID sets the "SessionID" field if the given value is not nil.

func (*TaskUpdateOne) SetNillableTargetID added in v0.2.2

func (tuo *TaskUpdateOne) SetNillableTargetID(id *int) *TaskUpdateOne

SetNillableTargetID sets the "target" edge to the Target entity by ID if the given value is not nil.

func (*TaskUpdateOne) SetOutput

func (tuo *TaskUpdateOne) SetOutput(s string) *TaskUpdateOne

SetOutput sets the "Output" field.

func (*TaskUpdateOne) SetQueueTime

func (tuo *TaskUpdateOne) SetQueueTime(t time.Time) *TaskUpdateOne

SetQueueTime sets the "QueueTime" field.

func (*TaskUpdateOne) SetSessionID

func (tuo *TaskUpdateOne) SetSessionID(s string) *TaskUpdateOne

SetSessionID sets the "SessionID" field.

func (*TaskUpdateOne) SetTarget added in v0.2.2

func (tuo *TaskUpdateOne) SetTarget(t *Target) *TaskUpdateOne

SetTarget sets the "target" edge to the Target entity.

func (*TaskUpdateOne) SetTargetID added in v0.2.2

func (tuo *TaskUpdateOne) SetTargetID(id int) *TaskUpdateOne

SetTargetID sets the "target" edge to the Target entity by ID.

type Tasks

type Tasks []*Task

Tasks is a parsable slice of Task.

type Tx

type Tx struct {

	// Credential is the client for interacting with the Credential builders.
	Credential *CredentialClient
	// Event is the client for interacting with the Event builders.
	Event *EventClient
	// File is the client for interacting with the File builders.
	File *FileClient
	// Job is the client for interacting with the Job builders.
	Job *JobClient
	// Link is the client for interacting with the Link builders.
	Link *LinkClient
	// Service is the client for interacting with the Service builders.
	Service *ServiceClient
	// Tag is the client for interacting with the Tag builders.
	Tag *TagClient
	// Target is the client for interacting with the Target builders.
	Target *TargetClient
	// Task is the client for interacting with the Task builders.
	Task *TaskClient
	// User is the client for interacting with the User builders.
	User *UserClient
	// contains filtered or unexported fields
}

Tx is a transactional client that is created by calling Client.Tx().

func TxFromContext added in v0.4.3

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 added in v0.4.3

func (tx *Tx) OnCommit(f CommitHook)

OnCommit adds a hook to call on commit.

func (*Tx) OnRollback added in v0.4.3

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 User added in v0.3.0

type User struct {

	// ID of the ent.
	ID int `json:"id,omitempty"`
	// Name holds the value of the "Name" field.
	// The name displayed for the user
	Name string `json:"Name,omitempty"`
	// OAuthID holds the value of the "OAuthID" field.
	// OAuth Subject ID of the user
	OAuthID string `json:"-"`
	// PhotoURL holds the value of the "PhotoURL" field.
	// URL to the user's profile photo.
	PhotoURL string `json:"PhotoURL,omitempty"`
	// SessionToken holds the value of the "SessionToken" field.
	// The session token currently authenticating the user
	SessionToken string `json:"-"`
	// IsActivated holds the value of the "IsActivated" field.
	// True iff the user is active and able to authenticate
	IsActivated bool `json:"IsActivated,omitempty"`
	// IsAdmin holds the value of the "IsAdmin" field.
	// True iff the user is an Admin
	IsAdmin bool `json:"IsAdmin,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the UserQuery when eager-loading is set.
	Edges UserEdges `json:"edges"`
	// contains filtered or unexported fields
}

User is the model entity for the User schema.

Example
if dsn == "" {
	return
}
ctx := context.Background()
drv, err := sql.Open("mysql", dsn)
if err != nil {
	log.Fatalf("failed creating database client: %v", err)
}
defer drv.Close()
client := NewClient(Driver(drv))
// creating vertices for the user's edges.
j0 := client.Job.
	Create().
	SetName("string").
	SetCreationTime(time.Now()).
	SetContent("string").
	SetStaged(true).
	SaveX(ctx)
log.Println("job created:", j0)
e1 := client.Event.
	Create().
	SetCreationTime(time.Now()).
	SetKind(event.KindCREATE_JOB).
	SaveX(ctx)
log.Println("event created:", e1)

// create user vertex with its edges.
u := client.User.
	Create().
	SetName("string").
	SetOAuthID("string").
	SetPhotoURL("string").
	SetSessionToken("string").
	SetIsActivated(true).
	SetIsAdmin(true).
	AddJobs(j0).
	AddEvents(e1).
	SaveX(ctx)
log.Println("user created:", u)

// query edges.
j0, err = u.QueryJobs().First(ctx)
if err != nil {
	log.Fatalf("failed querying jobs: %v", err)
}
log.Println("jobs found:", j0)

e1, err = u.QueryEvents().First(ctx)
if err != nil {
	log.Fatalf("failed querying events: %v", err)
}
log.Println("events found:", e1)
Output:

func (*User) IsIdentity added in v0.4.0

func (u *User) IsIdentity()

IsIdentity is used to mark if an ent is used in the Identity type in GraphQL

func (*User) QueryEvents added in v0.3.0

func (u *User) QueryEvents() *EventQuery

QueryEvents queries the "events" edge of the User entity.

func (*User) QueryJobs added in v0.3.0

func (u *User) QueryJobs() *JobQuery

QueryJobs queries the "jobs" edge of the User entity.

func (*User) String added in v0.3.0

func (u *User) String() string

String implements the fmt.Stringer.

func (*User) Unwrap added in v0.3.0

func (u *User) Unwrap() *User

Unwrap unwraps the User 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 (*User) Update added in v0.3.0

func (u *User) Update() *UserUpdateOne

Update returns a builder for updating this User. Note that you need to call User.Unwrap() before calling this method if this User was returned from a transaction, and the transaction was committed or rolled back.

type UserClient added in v0.3.0

type UserClient struct {
	// contains filtered or unexported fields
}

UserClient is a client for the User schema.

func NewUserClient added in v0.3.0

func NewUserClient(c config) *UserClient

NewUserClient returns a client for the User from the given config.

func (*UserClient) Create added in v0.3.0

func (c *UserClient) Create() *UserCreate

Create returns a create builder for User.

func (*UserClient) CreateBulk added in v0.4.3

func (c *UserClient) CreateBulk(builders ...*UserCreate) *UserCreateBulk

CreateBulk returns a builder for creating a bulk of User entities.

func (*UserClient) Delete added in v0.3.0

func (c *UserClient) Delete() *UserDelete

Delete returns a delete builder for User.

func (*UserClient) DeleteOne added in v0.3.0

func (c *UserClient) DeleteOne(u *User) *UserDeleteOne

DeleteOne returns a delete builder for the given entity.

func (*UserClient) DeleteOneID added in v0.3.0

func (c *UserClient) DeleteOneID(id int) *UserDeleteOne

DeleteOneID returns a delete builder for the given id.

func (*UserClient) Get added in v0.3.0

func (c *UserClient) Get(ctx context.Context, id int) (*User, error)

Get returns a User entity by its id.

func (*UserClient) GetX added in v0.3.0

func (c *UserClient) GetX(ctx context.Context, id int) *User

GetX is like Get, but panics if an error occurs.

func (*UserClient) Hooks added in v0.4.3

func (c *UserClient) Hooks() []Hook

Hooks returns the client hooks.

func (*UserClient) Query added in v0.3.0

func (c *UserClient) Query() *UserQuery

Query returns a query builder for User.

func (*UserClient) QueryEvents added in v0.3.0

func (c *UserClient) QueryEvents(u *User) *EventQuery

QueryEvents queries the events edge of a User.

func (*UserClient) QueryJobs added in v0.3.0

func (c *UserClient) QueryJobs(u *User) *JobQuery

QueryJobs queries the jobs edge of a User.

func (*UserClient) Update added in v0.3.0

func (c *UserClient) Update() *UserUpdate

Update returns an update builder for User.

func (*UserClient) UpdateOne added in v0.3.0

func (c *UserClient) UpdateOne(u *User) *UserUpdateOne

UpdateOne returns an update builder for the given entity.

func (*UserClient) UpdateOneID added in v0.3.0

func (c *UserClient) UpdateOneID(id int) *UserUpdateOne

UpdateOneID returns an update builder for the given id.

func (*UserClient) Use added in v0.4.3

func (c *UserClient) Use(hooks ...Hook)

Use adds a list of mutation hooks to the hooks stack. A call to `Use(f, g, h)` equals to `user.Hooks(f(g(h())))`.

type UserCreate added in v0.3.0

type UserCreate struct {
	// contains filtered or unexported fields
}

UserCreate is the builder for creating a User entity.

func (*UserCreate) AddEventIDs added in v0.3.0

func (uc *UserCreate) AddEventIDs(ids ...int) *UserCreate

AddEventIDs adds the "events" edge to the Event entity by IDs.

func (*UserCreate) AddEvents added in v0.3.0

func (uc *UserCreate) AddEvents(e ...*Event) *UserCreate

AddEvents adds the "events" edges to the Event entity.

func (*UserCreate) AddJobIDs added in v0.3.0

func (uc *UserCreate) AddJobIDs(ids ...int) *UserCreate

AddJobIDs adds the "jobs" edge to the Job entity by IDs.

func (*UserCreate) AddJobs added in v0.3.0

func (uc *UserCreate) AddJobs(j ...*Job) *UserCreate

AddJobs adds the "jobs" edges to the Job entity.

func (*UserCreate) Exec added in v0.4.3

func (uc *UserCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*UserCreate) ExecX added in v0.4.3

func (uc *UserCreate) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*UserCreate) Mutation added in v0.4.3

func (uc *UserCreate) Mutation() *UserMutation

Mutation returns the UserMutation object of the builder.

func (*UserCreate) Save added in v0.3.0

func (uc *UserCreate) Save(ctx context.Context) (*User, error)

Save creates the User in the database.

func (*UserCreate) SaveX added in v0.3.0

func (uc *UserCreate) SaveX(ctx context.Context) *User

SaveX calls Save and panics if Save returns an error.

func (*UserCreate) SetIsActivated added in v0.3.0

func (uc *UserCreate) SetIsActivated(b bool) *UserCreate

SetIsActivated sets the "IsActivated" field.

func (*UserCreate) SetIsAdmin added in v0.3.0

func (uc *UserCreate) SetIsAdmin(b bool) *UserCreate

SetIsAdmin sets the "IsAdmin" field.

func (*UserCreate) SetName added in v0.3.0

func (uc *UserCreate) SetName(s string) *UserCreate

SetName sets the "Name" field.

func (*UserCreate) SetNillableIsActivated added in v0.3.0

func (uc *UserCreate) SetNillableIsActivated(b *bool) *UserCreate

SetNillableIsActivated sets the "IsActivated" field if the given value is not nil.

func (*UserCreate) SetNillableIsAdmin added in v0.3.0

func (uc *UserCreate) SetNillableIsAdmin(b *bool) *UserCreate

SetNillableIsAdmin sets the "IsAdmin" field if the given value is not nil.

func (*UserCreate) SetNillableSessionToken added in v0.3.0

func (uc *UserCreate) SetNillableSessionToken(s *string) *UserCreate

SetNillableSessionToken sets the "SessionToken" field if the given value is not nil.

func (*UserCreate) SetOAuthID added in v0.3.0

func (uc *UserCreate) SetOAuthID(s string) *UserCreate

SetOAuthID sets the "OAuthID" field.

func (*UserCreate) SetPhotoURL added in v0.3.0

func (uc *UserCreate) SetPhotoURL(s string) *UserCreate

SetPhotoURL sets the "PhotoURL" field.

func (*UserCreate) SetSessionToken added in v0.3.0

func (uc *UserCreate) SetSessionToken(s string) *UserCreate

SetSessionToken sets the "SessionToken" field.

type UserCreateBulk added in v0.4.3

type UserCreateBulk struct {
	// contains filtered or unexported fields
}

UserCreateBulk is the builder for creating many User entities in bulk.

func (*UserCreateBulk) Exec added in v0.4.3

func (ucb *UserCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*UserCreateBulk) ExecX added in v0.4.3

func (ucb *UserCreateBulk) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*UserCreateBulk) Save added in v0.4.3

func (ucb *UserCreateBulk) Save(ctx context.Context) ([]*User, error)

Save creates the User entities in the database.

func (*UserCreateBulk) SaveX added in v0.4.3

func (ucb *UserCreateBulk) SaveX(ctx context.Context) []*User

SaveX is like Save, but panics if an error occurs.

type UserDelete added in v0.3.0

type UserDelete struct {
	// contains filtered or unexported fields
}

UserDelete is the builder for deleting a User entity.

func (*UserDelete) Exec added in v0.3.0

func (ud *UserDelete) Exec(ctx context.Context) (int, error)

Exec executes the deletion query and returns how many vertices were deleted.

func (*UserDelete) ExecX added in v0.3.0

func (ud *UserDelete) ExecX(ctx context.Context) int

ExecX is like Exec, but panics if an error occurs.

func (*UserDelete) Where added in v0.3.0

func (ud *UserDelete) Where(ps ...predicate.User) *UserDelete

Where appends a list predicates to the UserDelete builder.

type UserDeleteOne added in v0.3.0

type UserDeleteOne struct {
	// contains filtered or unexported fields
}

UserDeleteOne is the builder for deleting a single User entity.

func (*UserDeleteOne) Exec added in v0.3.0

func (udo *UserDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*UserDeleteOne) ExecX added in v0.3.0

func (udo *UserDeleteOne) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

type UserEdges added in v0.3.0

type UserEdges struct {
	// Jobs holds the value of the jobs edge.
	Jobs []*Job `json:"jobs,omitempty"`
	// Events holds the value of the events edge.
	Events []*Event `json:"events,omitempty"`
	// contains filtered or unexported fields
}

UserEdges holds the relations/edges for other nodes in the graph.

func (UserEdges) EventsOrErr added in v0.3.0

func (e UserEdges) EventsOrErr() ([]*Event, error)

EventsOrErr returns the Events value or an error if the edge was not loaded in eager-loading.

func (UserEdges) JobsOrErr added in v0.3.0

func (e UserEdges) JobsOrErr() ([]*Job, error)

JobsOrErr returns the Jobs value or an error if the edge was not loaded in eager-loading.

type UserGroupBy added in v0.3.0

type UserGroupBy struct {
	// contains filtered or unexported fields
}

UserGroupBy is the group-by builder for User entities.

func (*UserGroupBy) Aggregate added in v0.3.0

func (ugb *UserGroupBy) Aggregate(fns ...AggregateFunc) *UserGroupBy

Aggregate adds the given aggregation functions to the group-by query.

func (*UserGroupBy) Bool added in v0.4.3

func (ugb *UserGroupBy) 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 (*UserGroupBy) BoolX added in v0.4.3

func (ugb *UserGroupBy) BoolX(ctx context.Context) bool

BoolX is like Bool, but panics if an error occurs.

func (*UserGroupBy) Bools added in v0.3.0

func (ugb *UserGroupBy) 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 (*UserGroupBy) BoolsX added in v0.3.0

func (ugb *UserGroupBy) BoolsX(ctx context.Context) []bool

BoolsX is like Bools, but panics if an error occurs.

func (*UserGroupBy) Float64 added in v0.4.3

func (ugb *UserGroupBy) 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 (*UserGroupBy) Float64X added in v0.4.3

func (ugb *UserGroupBy) Float64X(ctx context.Context) float64

Float64X is like Float64, but panics if an error occurs.

func (*UserGroupBy) Float64s added in v0.3.0

func (ugb *UserGroupBy) 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 (*UserGroupBy) Float64sX added in v0.3.0

func (ugb *UserGroupBy) Float64sX(ctx context.Context) []float64

Float64sX is like Float64s, but panics if an error occurs.

func (*UserGroupBy) Int added in v0.4.3

func (ugb *UserGroupBy) 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 (*UserGroupBy) IntX added in v0.4.3

func (ugb *UserGroupBy) IntX(ctx context.Context) int

IntX is like Int, but panics if an error occurs.

func (*UserGroupBy) Ints added in v0.3.0

func (ugb *UserGroupBy) 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 (*UserGroupBy) IntsX added in v0.3.0

func (ugb *UserGroupBy) IntsX(ctx context.Context) []int

IntsX is like Ints, but panics if an error occurs.

func (*UserGroupBy) Scan added in v0.3.0

func (ugb *UserGroupBy) Scan(ctx context.Context, v interface{}) error

Scan applies the group-by query and scans the result into the given value.

func (*UserGroupBy) ScanX added in v0.3.0

func (ugb *UserGroupBy) ScanX(ctx context.Context, v interface{})

ScanX is like Scan, but panics if an error occurs.

func (*UserGroupBy) String added in v0.4.3

func (ugb *UserGroupBy) 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 (*UserGroupBy) StringX added in v0.4.3

func (ugb *UserGroupBy) StringX(ctx context.Context) string

StringX is like String, but panics if an error occurs.

func (*UserGroupBy) Strings added in v0.3.0

func (ugb *UserGroupBy) 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 (*UserGroupBy) StringsX added in v0.3.0

func (ugb *UserGroupBy) StringsX(ctx context.Context) []string

StringsX is like Strings, but panics if an error occurs.

type UserMutation added in v0.4.3

type UserMutation struct {
	// contains filtered or unexported fields
}

UserMutation represents an operation that mutates the User nodes in the graph.

func (*UserMutation) AddEventIDs added in v0.4.3

func (m *UserMutation) AddEventIDs(ids ...int)

AddEventIDs adds the "events" edge to the Event entity by ids.

func (*UserMutation) AddField added in v0.4.3

func (m *UserMutation) 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 (*UserMutation) AddJobIDs added in v0.4.3

func (m *UserMutation) AddJobIDs(ids ...int)

AddJobIDs adds the "jobs" edge to the Job entity by ids.

func (*UserMutation) AddedEdges added in v0.4.3

func (m *UserMutation) AddedEdges() []string

AddedEdges returns all edge names that were set/added in this mutation.

func (*UserMutation) AddedField added in v0.4.3

func (m *UserMutation) 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 (*UserMutation) AddedFields added in v0.4.3

func (m *UserMutation) AddedFields() []string

AddedFields returns all numeric fields that were incremented/decremented during this mutation.

func (*UserMutation) AddedIDs added in v0.4.3

func (m *UserMutation) AddedIDs(name string) []ent.Value

AddedIDs returns all IDs (to other nodes) that were added for the given edge name in this mutation.

func (*UserMutation) ClearEdge added in v0.4.3

func (m *UserMutation) 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 (*UserMutation) ClearEvents added in v0.4.3

func (m *UserMutation) ClearEvents()

ClearEvents clears the "events" edge to the Event entity.

func (*UserMutation) ClearField added in v0.4.3

func (m *UserMutation) 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 (*UserMutation) ClearJobs added in v0.4.3

func (m *UserMutation) ClearJobs()

ClearJobs clears the "jobs" edge to the Job entity.

func (*UserMutation) ClearSessionToken added in v0.4.3

func (m *UserMutation) ClearSessionToken()

ClearSessionToken clears the value of the "SessionToken" field.

func (*UserMutation) ClearedEdges added in v0.4.3

func (m *UserMutation) ClearedEdges() []string

ClearedEdges returns all edge names that were cleared in this mutation.

func (*UserMutation) ClearedFields added in v0.4.3

func (m *UserMutation) ClearedFields() []string

ClearedFields returns all nullable fields that were cleared during this mutation.

func (UserMutation) Client added in v0.4.3

func (m UserMutation) 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 (*UserMutation) EdgeCleared added in v0.4.3

func (m *UserMutation) EdgeCleared(name string) bool

EdgeCleared returns a boolean which indicates if the edge with the given name was cleared in this mutation.

func (*UserMutation) EventsCleared added in v0.4.3

func (m *UserMutation) EventsCleared() bool

EventsCleared reports if the "events" edge to the Event entity was cleared.

func (*UserMutation) EventsIDs added in v0.4.3

func (m *UserMutation) EventsIDs() (ids []int)

EventsIDs returns the "events" edge IDs in the mutation.

func (*UserMutation) Field added in v0.4.3

func (m *UserMutation) 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 (*UserMutation) FieldCleared added in v0.4.3

func (m *UserMutation) FieldCleared(name string) bool

FieldCleared returns a boolean indicating if a field with the given name was cleared in this mutation.

func (*UserMutation) Fields added in v0.4.3

func (m *UserMutation) 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 (*UserMutation) ID added in v0.4.3

func (m *UserMutation) 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 (*UserMutation) IDs added in v0.4.3

func (m *UserMutation) 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 (*UserMutation) IsActivated added in v0.4.3

func (m *UserMutation) IsActivated() (r bool, exists bool)

IsActivated returns the value of the "IsActivated" field in the mutation.

func (*UserMutation) IsAdmin added in v0.4.3

func (m *UserMutation) IsAdmin() (r bool, exists bool)

IsAdmin returns the value of the "IsAdmin" field in the mutation.

func (*UserMutation) JobsCleared added in v0.4.3

func (m *UserMutation) JobsCleared() bool

JobsCleared reports if the "jobs" edge to the Job entity was cleared.

func (*UserMutation) JobsIDs added in v0.4.3

func (m *UserMutation) JobsIDs() (ids []int)

JobsIDs returns the "jobs" edge IDs in the mutation.

func (*UserMutation) Name added in v0.4.3

func (m *UserMutation) Name() (r string, exists bool)

Name returns the value of the "Name" field in the mutation.

func (*UserMutation) OAuthID added in v0.4.3

func (m *UserMutation) OAuthID() (r string, exists bool)

OAuthID returns the value of the "OAuthID" field in the mutation.

func (*UserMutation) OldField added in v0.4.3

func (m *UserMutation) 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 (*UserMutation) OldIsActivated added in v0.4.3

func (m *UserMutation) OldIsActivated(ctx context.Context) (v bool, err error)

OldIsActivated returns the old "IsActivated" field's value of the User entity. If the User 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 (*UserMutation) OldIsAdmin added in v0.4.3

func (m *UserMutation) OldIsAdmin(ctx context.Context) (v bool, err error)

OldIsAdmin returns the old "IsAdmin" field's value of the User entity. If the User 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 (*UserMutation) OldName added in v0.4.3

func (m *UserMutation) OldName(ctx context.Context) (v string, err error)

OldName returns the old "Name" field's value of the User entity. If the User 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 (*UserMutation) OldOAuthID added in v0.4.3

func (m *UserMutation) OldOAuthID(ctx context.Context) (v string, err error)

OldOAuthID returns the old "OAuthID" field's value of the User entity. If the User 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 (*UserMutation) OldPhotoURL added in v0.4.3

func (m *UserMutation) OldPhotoURL(ctx context.Context) (v string, err error)

OldPhotoURL returns the old "PhotoURL" field's value of the User entity. If the User 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 (*UserMutation) OldSessionToken added in v0.4.3

func (m *UserMutation) OldSessionToken(ctx context.Context) (v string, err error)

OldSessionToken returns the old "SessionToken" field's value of the User entity. If the User 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 (*UserMutation) Op added in v0.4.3

func (m *UserMutation) Op() Op

Op returns the operation name.

func (*UserMutation) PhotoURL added in v0.4.3

func (m *UserMutation) PhotoURL() (r string, exists bool)

PhotoURL returns the value of the "PhotoURL" field in the mutation.

func (*UserMutation) RemoveEventIDs added in v0.4.3

func (m *UserMutation) RemoveEventIDs(ids ...int)

RemoveEventIDs removes the "events" edge to the Event entity by IDs.

func (*UserMutation) RemoveJobIDs added in v0.4.3

func (m *UserMutation) RemoveJobIDs(ids ...int)

RemoveJobIDs removes the "jobs" edge to the Job entity by IDs.

func (*UserMutation) RemovedEdges added in v0.4.3

func (m *UserMutation) RemovedEdges() []string

RemovedEdges returns all edge names that were removed in this mutation.

func (*UserMutation) RemovedEventsIDs added in v0.4.3

func (m *UserMutation) RemovedEventsIDs() (ids []int)

RemovedEvents returns the removed IDs of the "events" edge to the Event entity.

func (*UserMutation) RemovedIDs added in v0.4.3

func (m *UserMutation) 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 (*UserMutation) RemovedJobsIDs added in v0.4.3

func (m *UserMutation) RemovedJobsIDs() (ids []int)

RemovedJobs returns the removed IDs of the "jobs" edge to the Job entity.

func (*UserMutation) ResetEdge added in v0.4.3

func (m *UserMutation) 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 (*UserMutation) ResetEvents added in v0.4.3

func (m *UserMutation) ResetEvents()

ResetEvents resets all changes to the "events" edge.

func (*UserMutation) ResetField added in v0.4.3

func (m *UserMutation) 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 (*UserMutation) ResetIsActivated added in v0.4.3

func (m *UserMutation) ResetIsActivated()

ResetIsActivated resets all changes to the "IsActivated" field.

func (*UserMutation) ResetIsAdmin added in v0.4.3

func (m *UserMutation) ResetIsAdmin()

ResetIsAdmin resets all changes to the "IsAdmin" field.

func (*UserMutation) ResetJobs added in v0.4.3

func (m *UserMutation) ResetJobs()

ResetJobs resets all changes to the "jobs" edge.

func (*UserMutation) ResetName added in v0.4.3

func (m *UserMutation) ResetName()

ResetName resets all changes to the "Name" field.

func (*UserMutation) ResetOAuthID added in v0.4.3

func (m *UserMutation) ResetOAuthID()

ResetOAuthID resets all changes to the "OAuthID" field.

func (*UserMutation) ResetPhotoURL added in v0.4.3

func (m *UserMutation) ResetPhotoURL()

ResetPhotoURL resets all changes to the "PhotoURL" field.

func (*UserMutation) ResetSessionToken added in v0.4.3

func (m *UserMutation) ResetSessionToken()

ResetSessionToken resets all changes to the "SessionToken" field.

func (*UserMutation) SessionToken added in v0.4.3

func (m *UserMutation) SessionToken() (r string, exists bool)

SessionToken returns the value of the "SessionToken" field in the mutation.

func (*UserMutation) SessionTokenCleared added in v0.4.3

func (m *UserMutation) SessionTokenCleared() bool

SessionTokenCleared returns if the "SessionToken" field was cleared in this mutation.

func (*UserMutation) SetField added in v0.4.3

func (m *UserMutation) 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 (*UserMutation) SetIsActivated added in v0.4.3

func (m *UserMutation) SetIsActivated(b bool)

SetIsActivated sets the "IsActivated" field.

func (*UserMutation) SetIsAdmin added in v0.4.3

func (m *UserMutation) SetIsAdmin(b bool)

SetIsAdmin sets the "IsAdmin" field.

func (*UserMutation) SetName added in v0.4.3

func (m *UserMutation) SetName(s string)

SetName sets the "Name" field.

func (*UserMutation) SetOAuthID added in v0.4.3

func (m *UserMutation) SetOAuthID(s string)

SetOAuthID sets the "OAuthID" field.

func (*UserMutation) SetPhotoURL added in v0.4.3

func (m *UserMutation) SetPhotoURL(s string)

SetPhotoURL sets the "PhotoURL" field.

func (*UserMutation) SetSessionToken added in v0.4.3

func (m *UserMutation) SetSessionToken(s string)

SetSessionToken sets the "SessionToken" field.

func (UserMutation) Tx added in v0.4.3

func (m UserMutation) Tx() (*Tx, error)

Tx returns an `ent.Tx` for mutations that were executed in transactions; it returns an error otherwise.

func (*UserMutation) Type added in v0.4.3

func (m *UserMutation) Type() string

Type returns the node type of this mutation (User).

func (*UserMutation) Where added in v0.4.3

func (m *UserMutation) Where(ps ...predicate.User)

Where appends a list predicates to the UserMutation builder.

type UserQuery added in v0.3.0

type UserQuery struct {
	// contains filtered or unexported fields
}

UserQuery is the builder for querying User entities.

func (*UserQuery) All added in v0.3.0

func (uq *UserQuery) All(ctx context.Context) ([]*User, error)

All executes the query and returns a list of Users.

func (*UserQuery) AllX added in v0.3.0

func (uq *UserQuery) AllX(ctx context.Context) []*User

AllX is like All, but panics if an error occurs.

func (*UserQuery) Clone added in v0.3.0

func (uq *UserQuery) Clone() *UserQuery

Clone returns a duplicate of the UserQuery builder, including all associated steps. It can be used to prepare common query builders and use them differently after the clone is made.

func (*UserQuery) Count added in v0.3.0

func (uq *UserQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*UserQuery) CountX added in v0.3.0

func (uq *UserQuery) CountX(ctx context.Context) int

CountX is like Count, but panics if an error occurs.

func (*UserQuery) Exist added in v0.3.0

func (uq *UserQuery) Exist(ctx context.Context) (bool, error)

Exist returns true if the query has elements in the graph.

func (*UserQuery) ExistX added in v0.3.0

func (uq *UserQuery) ExistX(ctx context.Context) bool

ExistX is like Exist, but panics if an error occurs.

func (*UserQuery) First added in v0.3.0

func (uq *UserQuery) First(ctx context.Context) (*User, error)

First returns the first User entity from the query. Returns a *NotFoundError when no User was found.

func (*UserQuery) FirstID added in v0.3.0

func (uq *UserQuery) FirstID(ctx context.Context) (id int, err error)

FirstID returns the first User ID from the query. Returns a *NotFoundError when no User ID was found.

func (*UserQuery) FirstIDX added in v0.4.3

func (uq *UserQuery) FirstIDX(ctx context.Context) int

FirstIDX is like FirstID, but panics if an error occurs.

func (*UserQuery) FirstX added in v0.3.0

func (uq *UserQuery) FirstX(ctx context.Context) *User

FirstX is like First, but panics if an error occurs.

func (*UserQuery) GroupBy added in v0.3.0

func (uq *UserQuery) GroupBy(field string, fields ...string) *UserGroupBy

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.User.Query().
	GroupBy(user.FieldName).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*UserQuery) IDs added in v0.3.0

func (uq *UserQuery) IDs(ctx context.Context) ([]int, error)

IDs executes the query and returns a list of User IDs.

func (*UserQuery) IDsX added in v0.3.0

func (uq *UserQuery) IDsX(ctx context.Context) []int

IDsX is like IDs, but panics if an error occurs.

func (*UserQuery) Limit added in v0.3.0

func (uq *UserQuery) Limit(limit int) *UserQuery

Limit adds a limit step to the query.

func (*UserQuery) Offset added in v0.3.0

func (uq *UserQuery) Offset(offset int) *UserQuery

Offset adds an offset step to the query.

func (*UserQuery) Only added in v0.3.0

func (uq *UserQuery) Only(ctx context.Context) (*User, error)

Only returns a single User entity found by the query, ensuring it only returns one. Returns a *NotSingularError when exactly one User entity is not found. Returns a *NotFoundError when no User entities are found.

func (*UserQuery) OnlyID added in v0.3.0

func (uq *UserQuery) OnlyID(ctx context.Context) (id int, err error)

OnlyID is like Only, but returns the only User ID in the query. Returns a *NotSingularError when exactly one User ID is not found. Returns a *NotFoundError when no entities are found.

func (*UserQuery) OnlyIDX added in v0.4.3

func (uq *UserQuery) OnlyIDX(ctx context.Context) int

OnlyIDX is like OnlyID, but panics if an error occurs.

func (*UserQuery) OnlyX added in v0.3.0

func (uq *UserQuery) OnlyX(ctx context.Context) *User

OnlyX is like Only, but panics if an error occurs.

func (*UserQuery) Order added in v0.3.0

func (uq *UserQuery) Order(o ...OrderFunc) *UserQuery

Order adds an order step to the query.

func (*UserQuery) QueryEvents added in v0.3.0

func (uq *UserQuery) QueryEvents() *EventQuery

QueryEvents chains the current query on the "events" edge.

func (*UserQuery) QueryJobs added in v0.3.0

func (uq *UserQuery) QueryJobs() *JobQuery

QueryJobs chains the current query on the "jobs" edge.

func (*UserQuery) Select added in v0.3.0

func (uq *UserQuery) Select(fields ...string) *UserSelect

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.User.Query().
	Select(user.FieldName).
	Scan(ctx, &v)

func (*UserQuery) Unique added in v0.4.3

func (uq *UserQuery) Unique(unique bool) *UserQuery

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 (*UserQuery) Where added in v0.3.0

func (uq *UserQuery) Where(ps ...predicate.User) *UserQuery

Where adds a new predicate for the UserQuery builder.

func (*UserQuery) WithEvents added in v0.3.0

func (uq *UserQuery) WithEvents(opts ...func(*EventQuery)) *UserQuery

WithEvents tells the query-builder to eager-load the nodes that are connected to the "events" edge. The optional arguments are used to configure the query builder of the edge.

func (*UserQuery) WithJobs added in v0.3.0

func (uq *UserQuery) WithJobs(opts ...func(*JobQuery)) *UserQuery

WithJobs tells the query-builder to eager-load the nodes that are connected to the "jobs" edge. The optional arguments are used to configure the query builder of the edge.

type UserSelect added in v0.3.0

type UserSelect struct {
	*UserQuery
	// contains filtered or unexported fields
}

UserSelect is the builder for selecting fields of User entities.

func (*UserSelect) Bool added in v0.4.3

func (us *UserSelect) Bool(ctx context.Context) (_ bool, err error)

Bool returns a single bool from a selector. It is only allowed when selecting one field.

func (*UserSelect) BoolX added in v0.4.3

func (us *UserSelect) BoolX(ctx context.Context) bool

BoolX is like Bool, but panics if an error occurs.

func (*UserSelect) Bools added in v0.3.0

func (us *UserSelect) Bools(ctx context.Context) ([]bool, error)

Bools returns list of bools from a selector. It is only allowed when selecting one field.

func (*UserSelect) BoolsX added in v0.3.0

func (us *UserSelect) BoolsX(ctx context.Context) []bool

BoolsX is like Bools, but panics if an error occurs.

func (*UserSelect) Float64 added in v0.4.3

func (us *UserSelect) Float64(ctx context.Context) (_ float64, err error)

Float64 returns a single float64 from a selector. It is only allowed when selecting one field.

func (*UserSelect) Float64X added in v0.4.3

func (us *UserSelect) Float64X(ctx context.Context) float64

Float64X is like Float64, but panics if an error occurs.

func (*UserSelect) Float64s added in v0.3.0

func (us *UserSelect) Float64s(ctx context.Context) ([]float64, error)

Float64s returns list of float64s from a selector. It is only allowed when selecting one field.

func (*UserSelect) Float64sX added in v0.3.0

func (us *UserSelect) Float64sX(ctx context.Context) []float64

Float64sX is like Float64s, but panics if an error occurs.

func (*UserSelect) Int added in v0.4.3

func (us *UserSelect) Int(ctx context.Context) (_ int, err error)

Int returns a single int from a selector. It is only allowed when selecting one field.

func (*UserSelect) IntX added in v0.4.3

func (us *UserSelect) IntX(ctx context.Context) int

IntX is like Int, but panics if an error occurs.

func (*UserSelect) Ints added in v0.3.0

func (us *UserSelect) Ints(ctx context.Context) ([]int, error)

Ints returns list of ints from a selector. It is only allowed when selecting one field.

func (*UserSelect) IntsX added in v0.3.0

func (us *UserSelect) IntsX(ctx context.Context) []int

IntsX is like Ints, but panics if an error occurs.

func (*UserSelect) Scan added in v0.3.0

func (us *UserSelect) Scan(ctx context.Context, v interface{}) error

Scan applies the selector query and scans the result into the given value.

func (*UserSelect) ScanX added in v0.3.0

func (us *UserSelect) ScanX(ctx context.Context, v interface{})

ScanX is like Scan, but panics if an error occurs.

func (*UserSelect) String added in v0.4.3

func (us *UserSelect) String(ctx context.Context) (_ string, err error)

String returns a single string from a selector. It is only allowed when selecting one field.

func (*UserSelect) StringX added in v0.4.3

func (us *UserSelect) StringX(ctx context.Context) string

StringX is like String, but panics if an error occurs.

func (*UserSelect) Strings added in v0.3.0

func (us *UserSelect) Strings(ctx context.Context) ([]string, error)

Strings returns list of strings from a selector. It is only allowed when selecting one field.

func (*UserSelect) StringsX added in v0.3.0

func (us *UserSelect) StringsX(ctx context.Context) []string

StringsX is like Strings, but panics if an error occurs.

type UserUpdate added in v0.3.0

type UserUpdate struct {
	// contains filtered or unexported fields
}

UserUpdate is the builder for updating User entities.

func (*UserUpdate) AddEventIDs added in v0.3.0

func (uu *UserUpdate) AddEventIDs(ids ...int) *UserUpdate

AddEventIDs adds the "events" edge to the Event entity by IDs.

func (*UserUpdate) AddEvents added in v0.3.0

func (uu *UserUpdate) AddEvents(e ...*Event) *UserUpdate

AddEvents adds the "events" edges to the Event entity.

func (*UserUpdate) AddJobIDs added in v0.3.0

func (uu *UserUpdate) AddJobIDs(ids ...int) *UserUpdate

AddJobIDs adds the "jobs" edge to the Job entity by IDs.

func (*UserUpdate) AddJobs added in v0.3.0

func (uu *UserUpdate) AddJobs(j ...*Job) *UserUpdate

AddJobs adds the "jobs" edges to the Job entity.

func (*UserUpdate) ClearEvents added in v0.4.3

func (uu *UserUpdate) ClearEvents() *UserUpdate

ClearEvents clears all "events" edges to the Event entity.

func (*UserUpdate) ClearJobs added in v0.4.3

func (uu *UserUpdate) ClearJobs() *UserUpdate

ClearJobs clears all "jobs" edges to the Job entity.

func (*UserUpdate) ClearSessionToken added in v0.3.0

func (uu *UserUpdate) ClearSessionToken() *UserUpdate

ClearSessionToken clears the value of the "SessionToken" field.

func (*UserUpdate) Exec added in v0.3.0

func (uu *UserUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*UserUpdate) ExecX added in v0.3.0

func (uu *UserUpdate) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*UserUpdate) Mutation added in v0.4.3

func (uu *UserUpdate) Mutation() *UserMutation

Mutation returns the UserMutation object of the builder.

func (*UserUpdate) RemoveEventIDs added in v0.3.0

func (uu *UserUpdate) RemoveEventIDs(ids ...int) *UserUpdate

RemoveEventIDs removes the "events" edge to Event entities by IDs.

func (*UserUpdate) RemoveEvents added in v0.3.0

func (uu *UserUpdate) RemoveEvents(e ...*Event) *UserUpdate

RemoveEvents removes "events" edges to Event entities.

func (*UserUpdate) RemoveJobIDs added in v0.3.0

func (uu *UserUpdate) RemoveJobIDs(ids ...int) *UserUpdate

RemoveJobIDs removes the "jobs" edge to Job entities by IDs.

func (*UserUpdate) RemoveJobs added in v0.3.0

func (uu *UserUpdate) RemoveJobs(j ...*Job) *UserUpdate

RemoveJobs removes "jobs" edges to Job entities.

func (*UserUpdate) Save added in v0.3.0

func (uu *UserUpdate) Save(ctx context.Context) (int, error)

Save executes the query and returns the number of nodes affected by the update operation.

func (*UserUpdate) SaveX added in v0.3.0

func (uu *UserUpdate) SaveX(ctx context.Context) int

SaveX is like Save, but panics if an error occurs.

func (*UserUpdate) SetIsActivated added in v0.3.0

func (uu *UserUpdate) SetIsActivated(b bool) *UserUpdate

SetIsActivated sets the "IsActivated" field.

func (*UserUpdate) SetIsAdmin added in v0.3.0

func (uu *UserUpdate) SetIsAdmin(b bool) *UserUpdate

SetIsAdmin sets the "IsAdmin" field.

func (*UserUpdate) SetName added in v0.3.0

func (uu *UserUpdate) SetName(s string) *UserUpdate

SetName sets the "Name" field.

func (*UserUpdate) SetNillableIsActivated added in v0.3.0

func (uu *UserUpdate) SetNillableIsActivated(b *bool) *UserUpdate

SetNillableIsActivated sets the "IsActivated" field if the given value is not nil.

func (*UserUpdate) SetNillableIsAdmin added in v0.3.0

func (uu *UserUpdate) SetNillableIsAdmin(b *bool) *UserUpdate

SetNillableIsAdmin sets the "IsAdmin" field if the given value is not nil.

func (*UserUpdate) SetNillableSessionToken added in v0.3.0

func (uu *UserUpdate) SetNillableSessionToken(s *string) *UserUpdate

SetNillableSessionToken sets the "SessionToken" field if the given value is not nil.

func (*UserUpdate) SetPhotoURL added in v0.3.0

func (uu *UserUpdate) SetPhotoURL(s string) *UserUpdate

SetPhotoURL sets the "PhotoURL" field.

func (*UserUpdate) SetSessionToken added in v0.3.0

func (uu *UserUpdate) SetSessionToken(s string) *UserUpdate

SetSessionToken sets the "SessionToken" field.

func (*UserUpdate) Where added in v0.3.0

func (uu *UserUpdate) Where(ps ...predicate.User) *UserUpdate

Where appends a list predicates to the UserUpdate builder.

type UserUpdateOne added in v0.3.0

type UserUpdateOne struct {
	// contains filtered or unexported fields
}

UserUpdateOne is the builder for updating a single User entity.

func (*UserUpdateOne) AddEventIDs added in v0.3.0

func (uuo *UserUpdateOne) AddEventIDs(ids ...int) *UserUpdateOne

AddEventIDs adds the "events" edge to the Event entity by IDs.

func (*UserUpdateOne) AddEvents added in v0.3.0

func (uuo *UserUpdateOne) AddEvents(e ...*Event) *UserUpdateOne

AddEvents adds the "events" edges to the Event entity.

func (*UserUpdateOne) AddJobIDs added in v0.3.0

func (uuo *UserUpdateOne) AddJobIDs(ids ...int) *UserUpdateOne

AddJobIDs adds the "jobs" edge to the Job entity by IDs.

func (*UserUpdateOne) AddJobs added in v0.3.0

func (uuo *UserUpdateOne) AddJobs(j ...*Job) *UserUpdateOne

AddJobs adds the "jobs" edges to the Job entity.

func (*UserUpdateOne) ClearEvents added in v0.4.3

func (uuo *UserUpdateOne) ClearEvents() *UserUpdateOne

ClearEvents clears all "events" edges to the Event entity.

func (*UserUpdateOne) ClearJobs added in v0.4.3

func (uuo *UserUpdateOne) ClearJobs() *UserUpdateOne

ClearJobs clears all "jobs" edges to the Job entity.

func (*UserUpdateOne) ClearSessionToken added in v0.3.0

func (uuo *UserUpdateOne) ClearSessionToken() *UserUpdateOne

ClearSessionToken clears the value of the "SessionToken" field.

func (*UserUpdateOne) Exec added in v0.3.0

func (uuo *UserUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*UserUpdateOne) ExecX added in v0.3.0

func (uuo *UserUpdateOne) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*UserUpdateOne) Mutation added in v0.4.3

func (uuo *UserUpdateOne) Mutation() *UserMutation

Mutation returns the UserMutation object of the builder.

func (*UserUpdateOne) RemoveEventIDs added in v0.3.0

func (uuo *UserUpdateOne) RemoveEventIDs(ids ...int) *UserUpdateOne

RemoveEventIDs removes the "events" edge to Event entities by IDs.

func (*UserUpdateOne) RemoveEvents added in v0.3.0

func (uuo *UserUpdateOne) RemoveEvents(e ...*Event) *UserUpdateOne

RemoveEvents removes "events" edges to Event entities.

func (*UserUpdateOne) RemoveJobIDs added in v0.3.0

func (uuo *UserUpdateOne) RemoveJobIDs(ids ...int) *UserUpdateOne

RemoveJobIDs removes the "jobs" edge to Job entities by IDs.

func (*UserUpdateOne) RemoveJobs added in v0.3.0

func (uuo *UserUpdateOne) RemoveJobs(j ...*Job) *UserUpdateOne

RemoveJobs removes "jobs" edges to Job entities.

func (*UserUpdateOne) Save added in v0.3.0

func (uuo *UserUpdateOne) Save(ctx context.Context) (*User, error)

Save executes the query and returns the updated User entity.

func (*UserUpdateOne) SaveX added in v0.3.0

func (uuo *UserUpdateOne) SaveX(ctx context.Context) *User

SaveX is like Save, but panics if an error occurs.

func (*UserUpdateOne) Select added in v0.4.3

func (uuo *UserUpdateOne) Select(field string, fields ...string) *UserUpdateOne

Select allows selecting one or more fields (columns) of the returned entity. The default is selecting all fields defined in the entity schema.

func (*UserUpdateOne) SetIsActivated added in v0.3.0

func (uuo *UserUpdateOne) SetIsActivated(b bool) *UserUpdateOne

SetIsActivated sets the "IsActivated" field.

func (*UserUpdateOne) SetIsAdmin added in v0.3.0

func (uuo *UserUpdateOne) SetIsAdmin(b bool) *UserUpdateOne

SetIsAdmin sets the "IsAdmin" field.

func (*UserUpdateOne) SetName added in v0.3.0

func (uuo *UserUpdateOne) SetName(s string) *UserUpdateOne

SetName sets the "Name" field.

func (*UserUpdateOne) SetNillableIsActivated added in v0.3.0

func (uuo *UserUpdateOne) SetNillableIsActivated(b *bool) *UserUpdateOne

SetNillableIsActivated sets the "IsActivated" field if the given value is not nil.

func (*UserUpdateOne) SetNillableIsAdmin added in v0.3.0

func (uuo *UserUpdateOne) SetNillableIsAdmin(b *bool) *UserUpdateOne

SetNillableIsAdmin sets the "IsAdmin" field if the given value is not nil.

func (*UserUpdateOne) SetNillableSessionToken added in v0.3.0

func (uuo *UserUpdateOne) SetNillableSessionToken(s *string) *UserUpdateOne

SetNillableSessionToken sets the "SessionToken" field if the given value is not nil.

func (*UserUpdateOne) SetPhotoURL added in v0.3.0

func (uuo *UserUpdateOne) SetPhotoURL(s string) *UserUpdateOne

SetPhotoURL sets the "PhotoURL" field.

func (*UserUpdateOne) SetSessionToken added in v0.3.0

func (uuo *UserUpdateOne) SetSessionToken(s string) *UserUpdateOne

SetSessionToken sets the "SessionToken" field.

type Users added in v0.3.0

type Users []*User

Users is a parsable slice of User.

type ValidationError added in v0.4.3

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 added in v0.4.3

func (e *ValidationError) Error() string

Error implements the error interface.

func (*ValidationError) Unwrap added in v0.4.3

func (e *ValidationError) Unwrap() error

Unwrap implements the errors.Wrapper interface.

type Value added in v0.4.3

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