ent

package
v0.2.3 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2025 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

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

	// Node types.
	TypeAgent    = "Agent"
	TypeListener = "Listener"
	TypeSession  = "Session"
)

Variables

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

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

Functions

func Asc

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

Asc applies the given fields in ASC order.

func Desc

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

Desc applies the given fields in DESC order.

func IsConstraintError

func IsConstraintError(err error) bool

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

func IsNotFound

func IsNotFound(err error) bool

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

func IsNotLoaded

func IsNotLoaded(err error) bool

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

func IsNotSingular

func IsNotSingular(err error) bool

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

func IsValidationError

func IsValidationError(err error) bool

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

func MaskNotFound

func MaskNotFound(err error) error

MaskNotFound masks not found error.

func NewContext

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

NewContext returns a new context with the given Client attached.

func NewTxContext

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

NewTxContext returns a new context with the given Tx attached.

Types

type Agent

type Agent struct {

	// ID of the ent.
	ID string `json:"id,omitempty"`
	// CreatedAt holds the value of the "created_at" field.
	CreatedAt time.Time `json:"created_at,omitempty"`
	// Name holds the value of the "name" field.
	Name string `json:"name,omitempty"`
	// Comment holds the value of the "comment" field.
	Comment string `json:"comment,omitempty"`
	// Os holds the value of the "os" field.
	Os string `json:"os,omitempty"`
	// Arch holds the value of the "arch" field.
	Arch string `json:"arch,omitempty"`
	// Servers holds the value of the "servers" field.
	Servers []string `json:"servers,omitempty"`
	// Shared holds the value of the "shared" field.
	Shared bool `json:"shared,omitempty"`
	// Pie holds the value of the "pie" field.
	Pie bool `json:"pie,omitempty"`
	// Garble holds the value of the "garble" field.
	Garble bool `json:"garble,omitempty"`
	// Subsystems holds the value of the "subsystems" field.
	Subsystems []string `json:"subsystems,omitempty"`
	// Xxhash holds the value of the "xxhash" field.
	Xxhash string `json:"xxhash,omitempty"`
	// Path holds the value of the "path" field.
	Path string `json:"path,omitempty"`
	// URL holds the value of the "url" field.
	URL string `json:"url,omitempty"`
	// Hosted holds the value of the "hosted" field.
	Hosted bool `json:"hosted,omitempty"`
	// Callbacks holds the value of the "callbacks" field.
	Callbacks int `json:"callbacks,omitempty"`
	// Downloads holds the value of the "downloads" field.
	Downloads int `json:"downloads,omitempty"`
	// PublicKey holds the value of the "public_key" field.
	PublicKey []byte `json:"public_key,omitempty"`
	// contains filtered or unexported fields
}

Agent is the model entity for the Agent schema.

func (*Agent) String

func (_m *Agent) String() string

String implements the fmt.Stringer.

func (*Agent) Unwrap

func (_m *Agent) Unwrap() *Agent

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

func (_m *Agent) Update() *AgentUpdateOne

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

func (*Agent) Value

func (_m *Agent) Value(name string) (ent.Value, error)

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

type AgentClient

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

AgentClient is a client for the Agent schema.

func NewAgentClient

func NewAgentClient(c config) *AgentClient

NewAgentClient returns a client for the Agent from the given config.

func (*AgentClient) Create

func (c *AgentClient) Create() *AgentCreate

Create returns a builder for creating a Agent entity.

func (*AgentClient) CreateBulk

func (c *AgentClient) CreateBulk(builders ...*AgentCreate) *AgentCreateBulk

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

func (*AgentClient) Delete

func (c *AgentClient) Delete() *AgentDelete

Delete returns a delete builder for Agent.

func (*AgentClient) DeleteOne

func (c *AgentClient) DeleteOne(_m *Agent) *AgentDeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*AgentClient) DeleteOneID

func (c *AgentClient) DeleteOneID(id string) *AgentDeleteOne

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

func (*AgentClient) Get

func (c *AgentClient) Get(ctx context.Context, id string) (*Agent, error)

Get returns a Agent entity by its id.

func (*AgentClient) GetX

func (c *AgentClient) GetX(ctx context.Context, id string) *Agent

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

func (*AgentClient) Hooks

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

Hooks returns the client hooks.

func (*AgentClient) Intercept

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

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

func (*AgentClient) Interceptors

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

Interceptors returns the client interceptors.

func (*AgentClient) MapCreateBulk

func (c *AgentClient) MapCreateBulk(slice any, setFunc func(*AgentCreate, int)) *AgentCreateBulk

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

func (*AgentClient) Query

func (c *AgentClient) Query() *AgentQuery

Query returns a query builder for Agent.

func (*AgentClient) Update

func (c *AgentClient) Update() *AgentUpdate

Update returns an update builder for Agent.

func (*AgentClient) UpdateOne

func (c *AgentClient) UpdateOne(_m *Agent) *AgentUpdateOne

UpdateOne returns an update builder for the given entity.

func (*AgentClient) UpdateOneID

func (c *AgentClient) UpdateOneID(id string) *AgentUpdateOne

UpdateOneID returns an update builder for the given id.

func (*AgentClient) Use

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

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

type AgentCreate

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

AgentCreate is the builder for creating a Agent entity.

func (*AgentCreate) Exec

func (_c *AgentCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*AgentCreate) ExecX

func (_c *AgentCreate) ExecX(ctx context.Context)

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

func (*AgentCreate) Mutation

func (_c *AgentCreate) Mutation() *AgentMutation

Mutation returns the AgentMutation object of the builder.

func (*AgentCreate) Save

func (_c *AgentCreate) Save(ctx context.Context) (*Agent, error)

Save creates the Agent in the database.

func (*AgentCreate) SaveX

func (_c *AgentCreate) SaveX(ctx context.Context) *Agent

SaveX calls Save and panics if Save returns an error.

func (*AgentCreate) SetArch

func (_c *AgentCreate) SetArch(v string) *AgentCreate

SetArch sets the "arch" field.

func (*AgentCreate) SetCallbacks

func (_c *AgentCreate) SetCallbacks(v int) *AgentCreate

SetCallbacks sets the "callbacks" field.

func (*AgentCreate) SetComment

func (_c *AgentCreate) SetComment(v string) *AgentCreate

SetComment sets the "comment" field.

func (*AgentCreate) SetCreatedAt

func (_c *AgentCreate) SetCreatedAt(v time.Time) *AgentCreate

SetCreatedAt sets the "created_at" field.

func (*AgentCreate) SetDownloads

func (_c *AgentCreate) SetDownloads(v int) *AgentCreate

SetDownloads sets the "downloads" field.

func (*AgentCreate) SetGarble

func (_c *AgentCreate) SetGarble(v bool) *AgentCreate

SetGarble sets the "garble" field.

func (*AgentCreate) SetHosted

func (_c *AgentCreate) SetHosted(v bool) *AgentCreate

SetHosted sets the "hosted" field.

func (*AgentCreate) SetID

func (_c *AgentCreate) SetID(v string) *AgentCreate

SetID sets the "id" field.

func (*AgentCreate) SetName

func (_c *AgentCreate) SetName(v string) *AgentCreate

SetName sets the "name" field.

func (*AgentCreate) SetNillableCallbacks

func (_c *AgentCreate) SetNillableCallbacks(v *int) *AgentCreate

SetNillableCallbacks sets the "callbacks" field if the given value is not nil.

func (*AgentCreate) SetNillableComment

func (_c *AgentCreate) SetNillableComment(v *string) *AgentCreate

SetNillableComment sets the "comment" field if the given value is not nil.

func (*AgentCreate) SetNillableCreatedAt

func (_c *AgentCreate) SetNillableCreatedAt(v *time.Time) *AgentCreate

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

func (*AgentCreate) SetNillableDownloads

func (_c *AgentCreate) SetNillableDownloads(v *int) *AgentCreate

SetNillableDownloads sets the "downloads" field if the given value is not nil.

func (*AgentCreate) SetNillableGarble

func (_c *AgentCreate) SetNillableGarble(v *bool) *AgentCreate

SetNillableGarble sets the "garble" field if the given value is not nil.

func (*AgentCreate) SetNillableHosted

func (_c *AgentCreate) SetNillableHosted(v *bool) *AgentCreate

SetNillableHosted sets the "hosted" field if the given value is not nil.

func (*AgentCreate) SetNillableID

func (_c *AgentCreate) SetNillableID(v *string) *AgentCreate

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

func (*AgentCreate) SetNillablePie

func (_c *AgentCreate) SetNillablePie(v *bool) *AgentCreate

SetNillablePie sets the "pie" field if the given value is not nil.

func (*AgentCreate) SetNillableShared

func (_c *AgentCreate) SetNillableShared(v *bool) *AgentCreate

SetNillableShared sets the "shared" field if the given value is not nil.

func (*AgentCreate) SetNillableURL

func (_c *AgentCreate) SetNillableURL(v *string) *AgentCreate

SetNillableURL sets the "url" field if the given value is not nil.

func (*AgentCreate) SetOs

func (_c *AgentCreate) SetOs(v string) *AgentCreate

SetOs sets the "os" field.

func (*AgentCreate) SetPath

func (_c *AgentCreate) SetPath(v string) *AgentCreate

SetPath sets the "path" field.

func (*AgentCreate) SetPie

func (_c *AgentCreate) SetPie(v bool) *AgentCreate

SetPie sets the "pie" field.

func (*AgentCreate) SetPublicKey

func (_c *AgentCreate) SetPublicKey(v []byte) *AgentCreate

SetPublicKey sets the "public_key" field.

func (*AgentCreate) SetServers

func (_c *AgentCreate) SetServers(v []string) *AgentCreate

SetServers sets the "servers" field.

func (*AgentCreate) SetShared

func (_c *AgentCreate) SetShared(v bool) *AgentCreate

SetShared sets the "shared" field.

func (*AgentCreate) SetSubsystems

func (_c *AgentCreate) SetSubsystems(v []string) *AgentCreate

SetSubsystems sets the "subsystems" field.

func (*AgentCreate) SetURL

func (_c *AgentCreate) SetURL(v string) *AgentCreate

SetURL sets the "url" field.

func (*AgentCreate) SetXxhash

func (_c *AgentCreate) SetXxhash(v string) *AgentCreate

SetXxhash sets the "xxhash" field.

type AgentCreateBulk

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

AgentCreateBulk is the builder for creating many Agent entities in bulk.

func (*AgentCreateBulk) Exec

func (_c *AgentCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*AgentCreateBulk) ExecX

func (_c *AgentCreateBulk) ExecX(ctx context.Context)

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

func (*AgentCreateBulk) Save

func (_c *AgentCreateBulk) Save(ctx context.Context) ([]*Agent, error)

Save creates the Agent entities in the database.

func (*AgentCreateBulk) SaveX

func (_c *AgentCreateBulk) SaveX(ctx context.Context) []*Agent

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

type AgentDelete

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

AgentDelete is the builder for deleting a Agent entity.

func (*AgentDelete) Exec

func (_d *AgentDelete) Exec(ctx context.Context) (int, error)

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

func (*AgentDelete) ExecX

func (_d *AgentDelete) ExecX(ctx context.Context) int

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

func (*AgentDelete) Where

func (_d *AgentDelete) Where(ps ...predicate.Agent) *AgentDelete

Where appends a list predicates to the AgentDelete builder.

type AgentDeleteOne

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

AgentDeleteOne is the builder for deleting a single Agent entity.

func (*AgentDeleteOne) Exec

func (_d *AgentDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*AgentDeleteOne) ExecX

func (_d *AgentDeleteOne) ExecX(ctx context.Context)

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

func (*AgentDeleteOne) Where

func (_d *AgentDeleteOne) Where(ps ...predicate.Agent) *AgentDeleteOne

Where appends a list predicates to the AgentDelete builder.

type AgentGroupBy

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

AgentGroupBy is the group-by builder for Agent entities.

func (*AgentGroupBy) Aggregate

func (_g *AgentGroupBy) Aggregate(fns ...AggregateFunc) *AgentGroupBy

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

func (*AgentGroupBy) Bool

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

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

func (*AgentGroupBy) BoolX

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

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

func (*AgentGroupBy) Bools

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

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

func (*AgentGroupBy) BoolsX

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

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

func (*AgentGroupBy) Float64

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

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

func (*AgentGroupBy) Float64X

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

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

func (*AgentGroupBy) Float64s

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

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

func (*AgentGroupBy) Float64sX

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

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

func (*AgentGroupBy) Int

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

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

func (*AgentGroupBy) IntX

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

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

func (*AgentGroupBy) Ints

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

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

func (*AgentGroupBy) IntsX

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

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

func (*AgentGroupBy) Scan

func (_g *AgentGroupBy) Scan(ctx context.Context, v any) error

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

func (*AgentGroupBy) ScanX

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

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

func (*AgentGroupBy) String

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

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

func (*AgentGroupBy) StringX

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

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

func (*AgentGroupBy) Strings

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

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

func (*AgentGroupBy) StringsX

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

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

type AgentMutation

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

AgentMutation represents an operation that mutates the Agent nodes in the graph.

func (*AgentMutation) AddCallbacks

func (m *AgentMutation) AddCallbacks(i int)

AddCallbacks adds i to the "callbacks" field.

func (*AgentMutation) AddDownloads

func (m *AgentMutation) AddDownloads(i int)

AddDownloads adds i to the "downloads" field.

func (*AgentMutation) AddField

func (m *AgentMutation) 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 (*AgentMutation) AddedCallbacks

func (m *AgentMutation) AddedCallbacks() (r int, exists bool)

AddedCallbacks returns the value that was added to the "callbacks" field in this mutation.

func (*AgentMutation) AddedDownloads

func (m *AgentMutation) AddedDownloads() (r int, exists bool)

AddedDownloads returns the value that was added to the "downloads" field in this mutation.

func (*AgentMutation) AddedEdges

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

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

func (*AgentMutation) AddedField

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

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

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

func (*AgentMutation) AddedIDs

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

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

func (*AgentMutation) AppendServers

func (m *AgentMutation) AppendServers(s []string)

AppendServers adds s to the "servers" field.

func (*AgentMutation) AppendSubsystems

func (m *AgentMutation) AppendSubsystems(s []string)

AppendSubsystems adds s to the "subsystems" field.

func (*AgentMutation) AppendedServers

func (m *AgentMutation) AppendedServers() ([]string, bool)

AppendedServers returns the list of values that were appended to the "servers" field in this mutation.

func (*AgentMutation) AppendedSubsystems

func (m *AgentMutation) AppendedSubsystems() ([]string, bool)

AppendedSubsystems returns the list of values that were appended to the "subsystems" field in this mutation.

func (*AgentMutation) Arch

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

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

func (*AgentMutation) Callbacks

func (m *AgentMutation) Callbacks() (r int, exists bool)

Callbacks returns the value of the "callbacks" field in the mutation.

func (*AgentMutation) ClearComment

func (m *AgentMutation) ClearComment()

ClearComment clears the value of the "comment" field.

func (*AgentMutation) ClearEdge

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

func (m *AgentMutation) 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 (*AgentMutation) ClearURL

func (m *AgentMutation) ClearURL()

ClearURL clears the value of the "url" field.

func (*AgentMutation) ClearedEdges

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

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

func (*AgentMutation) ClearedFields

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

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

func (AgentMutation) Client

func (m AgentMutation) 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 (*AgentMutation) Comment

func (m *AgentMutation) Comment() (r string, exists bool)

Comment returns the value of the "comment" field in the mutation.

func (*AgentMutation) CommentCleared

func (m *AgentMutation) CommentCleared() bool

CommentCleared returns if the "comment" field was cleared in this mutation.

func (*AgentMutation) CreatedAt

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

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

func (*AgentMutation) Downloads

func (m *AgentMutation) Downloads() (r int, exists bool)

Downloads returns the value of the "downloads" field in the mutation.

func (*AgentMutation) EdgeCleared

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

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

func (*AgentMutation) Field

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

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

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

func (*AgentMutation) Fields

func (m *AgentMutation) 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 (*AgentMutation) Garble

func (m *AgentMutation) Garble() (r bool, exists bool)

Garble returns the value of the "garble" field in the mutation.

func (*AgentMutation) Hosted

func (m *AgentMutation) Hosted() (r bool, exists bool)

Hosted returns the value of the "hosted" field in the mutation.

func (*AgentMutation) ID

func (m *AgentMutation) ID() (id string, exists bool)

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

func (*AgentMutation) IDs

func (m *AgentMutation) IDs(ctx context.Context) ([]string, error)

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

func (*AgentMutation) Name

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

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

func (*AgentMutation) OldArch

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

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

func (m *AgentMutation) OldCallbacks(ctx context.Context) (v int, err error)

OldCallbacks returns the old "callbacks" field's value of the Agent entity. If the Agent 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 (*AgentMutation) OldComment

func (m *AgentMutation) OldComment(ctx context.Context) (v string, err error)

OldComment returns the old "comment" field's value of the Agent entity. If the Agent 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 (*AgentMutation) OldCreatedAt

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

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

func (m *AgentMutation) OldDownloads(ctx context.Context) (v int, err error)

OldDownloads returns the old "downloads" field's value of the Agent entity. If the Agent 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 (*AgentMutation) OldField

func (m *AgentMutation) 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 (*AgentMutation) OldGarble

func (m *AgentMutation) OldGarble(ctx context.Context) (v bool, err error)

OldGarble returns the old "garble" field's value of the Agent entity. If the Agent 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 (*AgentMutation) OldHosted

func (m *AgentMutation) OldHosted(ctx context.Context) (v bool, err error)

OldHosted returns the old "hosted" field's value of the Agent entity. If the Agent 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 (*AgentMutation) OldName

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

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

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

OldOs returns the old "os" field's value of the Agent entity. If the Agent 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 (*AgentMutation) OldPath

func (m *AgentMutation) OldPath(ctx context.Context) (v string, err error)

OldPath returns the old "path" field's value of the Agent entity. If the Agent 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 (*AgentMutation) OldPie

func (m *AgentMutation) OldPie(ctx context.Context) (v bool, err error)

OldPie returns the old "pie" field's value of the Agent entity. If the Agent 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 (*AgentMutation) OldPublicKey

func (m *AgentMutation) OldPublicKey(ctx context.Context) (v []byte, err error)

OldPublicKey returns the old "public_key" field's value of the Agent entity. If the Agent 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 (*AgentMutation) OldServers

func (m *AgentMutation) OldServers(ctx context.Context) (v []string, err error)

OldServers returns the old "servers" field's value of the Agent entity. If the Agent 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 (*AgentMutation) OldShared

func (m *AgentMutation) OldShared(ctx context.Context) (v bool, err error)

OldShared returns the old "shared" field's value of the Agent entity. If the Agent 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 (*AgentMutation) OldSubsystems

func (m *AgentMutation) OldSubsystems(ctx context.Context) (v []string, err error)

OldSubsystems returns the old "subsystems" field's value of the Agent entity. If the Agent 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 (*AgentMutation) OldURL

func (m *AgentMutation) OldURL(ctx context.Context) (v string, err error)

OldURL returns the old "url" field's value of the Agent entity. If the Agent 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 (*AgentMutation) OldXxhash

func (m *AgentMutation) OldXxhash(ctx context.Context) (v string, err error)

OldXxhash returns the old "xxhash" field's value of the Agent entity. If the Agent 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 (*AgentMutation) Op

func (m *AgentMutation) Op() Op

Op returns the operation name.

func (*AgentMutation) Os

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

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

func (*AgentMutation) Path

func (m *AgentMutation) Path() (r string, exists bool)

Path returns the value of the "path" field in the mutation.

func (*AgentMutation) Pie

func (m *AgentMutation) Pie() (r bool, exists bool)

Pie returns the value of the "pie" field in the mutation.

func (*AgentMutation) PublicKey

func (m *AgentMutation) PublicKey() (r []byte, exists bool)

PublicKey returns the value of the "public_key" field in the mutation.

func (*AgentMutation) RemovedEdges

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

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

func (*AgentMutation) RemovedIDs

func (m *AgentMutation) 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 (*AgentMutation) ResetArch

func (m *AgentMutation) ResetArch()

ResetArch resets all changes to the "arch" field.

func (*AgentMutation) ResetCallbacks

func (m *AgentMutation) ResetCallbacks()

ResetCallbacks resets all changes to the "callbacks" field.

func (*AgentMutation) ResetComment

func (m *AgentMutation) ResetComment()

ResetComment resets all changes to the "comment" field.

func (*AgentMutation) ResetCreatedAt

func (m *AgentMutation) ResetCreatedAt()

ResetCreatedAt resets all changes to the "created_at" field.

func (*AgentMutation) ResetDownloads

func (m *AgentMutation) ResetDownloads()

ResetDownloads resets all changes to the "downloads" field.

func (*AgentMutation) ResetEdge

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

func (m *AgentMutation) 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 (*AgentMutation) ResetGarble

func (m *AgentMutation) ResetGarble()

ResetGarble resets all changes to the "garble" field.

func (*AgentMutation) ResetHosted

func (m *AgentMutation) ResetHosted()

ResetHosted resets all changes to the "hosted" field.

func (*AgentMutation) ResetName

func (m *AgentMutation) ResetName()

ResetName resets all changes to the "name" field.

func (*AgentMutation) ResetOs

func (m *AgentMutation) ResetOs()

ResetOs resets all changes to the "os" field.

func (*AgentMutation) ResetPath

func (m *AgentMutation) ResetPath()

ResetPath resets all changes to the "path" field.

func (*AgentMutation) ResetPie

func (m *AgentMutation) ResetPie()

ResetPie resets all changes to the "pie" field.

func (*AgentMutation) ResetPublicKey

func (m *AgentMutation) ResetPublicKey()

ResetPublicKey resets all changes to the "public_key" field.

func (*AgentMutation) ResetServers

func (m *AgentMutation) ResetServers()

ResetServers resets all changes to the "servers" field.

func (*AgentMutation) ResetShared

func (m *AgentMutation) ResetShared()

ResetShared resets all changes to the "shared" field.

func (*AgentMutation) ResetSubsystems

func (m *AgentMutation) ResetSubsystems()

ResetSubsystems resets all changes to the "subsystems" field.

func (*AgentMutation) ResetURL

func (m *AgentMutation) ResetURL()

ResetURL resets all changes to the "url" field.

func (*AgentMutation) ResetXxhash

func (m *AgentMutation) ResetXxhash()

ResetXxhash resets all changes to the "xxhash" field.

func (*AgentMutation) Servers

func (m *AgentMutation) Servers() (r []string, exists bool)

Servers returns the value of the "servers" field in the mutation.

func (*AgentMutation) SetArch

func (m *AgentMutation) SetArch(s string)

SetArch sets the "arch" field.

func (*AgentMutation) SetCallbacks

func (m *AgentMutation) SetCallbacks(i int)

SetCallbacks sets the "callbacks" field.

func (*AgentMutation) SetComment

func (m *AgentMutation) SetComment(s string)

SetComment sets the "comment" field.

func (*AgentMutation) SetCreatedAt

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

SetCreatedAt sets the "created_at" field.

func (*AgentMutation) SetDownloads

func (m *AgentMutation) SetDownloads(i int)

SetDownloads sets the "downloads" field.

func (*AgentMutation) SetField

func (m *AgentMutation) 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 (*AgentMutation) SetGarble

func (m *AgentMutation) SetGarble(b bool)

SetGarble sets the "garble" field.

func (*AgentMutation) SetHosted

func (m *AgentMutation) SetHosted(b bool)

SetHosted sets the "hosted" field.

func (*AgentMutation) SetID

func (m *AgentMutation) SetID(id string)

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

func (*AgentMutation) SetName

func (m *AgentMutation) SetName(s string)

SetName sets the "name" field.

func (*AgentMutation) SetOp

func (m *AgentMutation) SetOp(op Op)

SetOp allows setting the mutation operation.

func (*AgentMutation) SetOs

func (m *AgentMutation) SetOs(s string)

SetOs sets the "os" field.

func (*AgentMutation) SetPath

func (m *AgentMutation) SetPath(s string)

SetPath sets the "path" field.

func (*AgentMutation) SetPie

func (m *AgentMutation) SetPie(b bool)

SetPie sets the "pie" field.

func (*AgentMutation) SetPublicKey

func (m *AgentMutation) SetPublicKey(b []byte)

SetPublicKey sets the "public_key" field.

func (*AgentMutation) SetServers

func (m *AgentMutation) SetServers(s []string)

SetServers sets the "servers" field.

func (*AgentMutation) SetShared

func (m *AgentMutation) SetShared(b bool)

SetShared sets the "shared" field.

func (*AgentMutation) SetSubsystems

func (m *AgentMutation) SetSubsystems(s []string)

SetSubsystems sets the "subsystems" field.

func (*AgentMutation) SetURL

func (m *AgentMutation) SetURL(s string)

SetURL sets the "url" field.

func (*AgentMutation) SetXxhash

func (m *AgentMutation) SetXxhash(s string)

SetXxhash sets the "xxhash" field.

func (*AgentMutation) Shared

func (m *AgentMutation) Shared() (r bool, exists bool)

Shared returns the value of the "shared" field in the mutation.

func (*AgentMutation) Subsystems

func (m *AgentMutation) Subsystems() (r []string, exists bool)

Subsystems returns the value of the "subsystems" field in the mutation.

func (AgentMutation) Tx

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

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

func (*AgentMutation) Type

func (m *AgentMutation) Type() string

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

func (*AgentMutation) URL

func (m *AgentMutation) URL() (r string, exists bool)

URL returns the value of the "url" field in the mutation.

func (*AgentMutation) URLCleared

func (m *AgentMutation) URLCleared() bool

URLCleared returns if the "url" field was cleared in this mutation.

func (*AgentMutation) Where

func (m *AgentMutation) Where(ps ...predicate.Agent)

Where appends a list predicates to the AgentMutation builder.

func (*AgentMutation) WhereP

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

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

func (*AgentMutation) Xxhash

func (m *AgentMutation) Xxhash() (r string, exists bool)

Xxhash returns the value of the "xxhash" field in the mutation.

type AgentQuery

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

AgentQuery is the builder for querying Agent entities.

func (*AgentQuery) Aggregate

func (_q *AgentQuery) Aggregate(fns ...AggregateFunc) *AgentSelect

Aggregate returns a AgentSelect configured with the given aggregations.

func (*AgentQuery) All

func (_q *AgentQuery) All(ctx context.Context) ([]*Agent, error)

All executes the query and returns a list of Agents.

func (*AgentQuery) AllX

func (_q *AgentQuery) AllX(ctx context.Context) []*Agent

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

func (*AgentQuery) Clone

func (_q *AgentQuery) Clone() *AgentQuery

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

func (*AgentQuery) Count

func (_q *AgentQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*AgentQuery) CountX

func (_q *AgentQuery) CountX(ctx context.Context) int

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

func (*AgentQuery) Exist

func (_q *AgentQuery) Exist(ctx context.Context) (bool, error)

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

func (*AgentQuery) ExistX

func (_q *AgentQuery) ExistX(ctx context.Context) bool

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

func (*AgentQuery) First

func (_q *AgentQuery) First(ctx context.Context) (*Agent, error)

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

func (*AgentQuery) FirstID

func (_q *AgentQuery) FirstID(ctx context.Context) (id string, err error)

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

func (*AgentQuery) FirstIDX

func (_q *AgentQuery) FirstIDX(ctx context.Context) string

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

func (*AgentQuery) FirstX

func (_q *AgentQuery) FirstX(ctx context.Context) *Agent

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

func (*AgentQuery) GroupBy

func (_q *AgentQuery) GroupBy(field string, fields ...string) *AgentGroupBy

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

client.Agent.Query().
	GroupBy(agent.FieldCreatedAt).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*AgentQuery) IDs

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

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

func (*AgentQuery) IDsX

func (_q *AgentQuery) IDsX(ctx context.Context) []string

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

func (*AgentQuery) Limit

func (_q *AgentQuery) Limit(limit int) *AgentQuery

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

func (*AgentQuery) Offset

func (_q *AgentQuery) Offset(offset int) *AgentQuery

Offset to start from.

func (*AgentQuery) Only

func (_q *AgentQuery) Only(ctx context.Context) (*Agent, error)

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

func (*AgentQuery) OnlyID

func (_q *AgentQuery) OnlyID(ctx context.Context) (id string, err error)

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

func (*AgentQuery) OnlyIDX

func (_q *AgentQuery) OnlyIDX(ctx context.Context) string

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

func (*AgentQuery) OnlyX

func (_q *AgentQuery) OnlyX(ctx context.Context) *Agent

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

func (*AgentQuery) Order

func (_q *AgentQuery) Order(o ...agent.OrderOption) *AgentQuery

Order specifies how the records should be ordered.

func (*AgentQuery) Select

func (_q *AgentQuery) Select(fields ...string) *AgentSelect

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

client.Agent.Query().
	Select(agent.FieldCreatedAt).
	Scan(ctx, &v)

func (*AgentQuery) Unique

func (_q *AgentQuery) Unique(unique bool) *AgentQuery

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

func (_q *AgentQuery) Where(ps ...predicate.Agent) *AgentQuery

Where adds a new predicate for the AgentQuery builder.

type AgentSelect

type AgentSelect struct {
	*AgentQuery
	// contains filtered or unexported fields
}

AgentSelect is the builder for selecting fields of Agent entities.

func (*AgentSelect) Aggregate

func (_s *AgentSelect) Aggregate(fns ...AggregateFunc) *AgentSelect

Aggregate adds the given aggregation functions to the selector query.

func (*AgentSelect) Bool

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

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

func (*AgentSelect) BoolX

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

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

func (*AgentSelect) Bools

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

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

func (*AgentSelect) BoolsX

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

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

func (*AgentSelect) Float64

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

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

func (*AgentSelect) Float64X

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

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

func (*AgentSelect) Float64s

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

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

func (*AgentSelect) Float64sX

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

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

func (*AgentSelect) Int

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

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

func (*AgentSelect) IntX

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

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

func (*AgentSelect) Ints

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

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

func (*AgentSelect) IntsX

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

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

func (*AgentSelect) Scan

func (_s *AgentSelect) Scan(ctx context.Context, v any) error

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

func (*AgentSelect) ScanX

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

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

func (*AgentSelect) String

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

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

func (*AgentSelect) StringX

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

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

func (*AgentSelect) Strings

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

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

func (*AgentSelect) StringsX

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

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

type AgentUpdate

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

AgentUpdate is the builder for updating Agent entities.

func (*AgentUpdate) AddCallbacks

func (_u *AgentUpdate) AddCallbacks(v int) *AgentUpdate

AddCallbacks adds value to the "callbacks" field.

func (*AgentUpdate) AddDownloads

func (_u *AgentUpdate) AddDownloads(v int) *AgentUpdate

AddDownloads adds value to the "downloads" field.

func (*AgentUpdate) ClearComment

func (_u *AgentUpdate) ClearComment() *AgentUpdate

ClearComment clears the value of the "comment" field.

func (*AgentUpdate) ClearURL

func (_u *AgentUpdate) ClearURL() *AgentUpdate

ClearURL clears the value of the "url" field.

func (*AgentUpdate) Exec

func (_u *AgentUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*AgentUpdate) ExecX

func (_u *AgentUpdate) ExecX(ctx context.Context)

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

func (*AgentUpdate) Mutation

func (_u *AgentUpdate) Mutation() *AgentMutation

Mutation returns the AgentMutation object of the builder.

func (*AgentUpdate) Save

func (_u *AgentUpdate) Save(ctx context.Context) (int, error)

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

func (*AgentUpdate) SaveX

func (_u *AgentUpdate) SaveX(ctx context.Context) int

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

func (*AgentUpdate) SetCallbacks

func (_u *AgentUpdate) SetCallbacks(v int) *AgentUpdate

SetCallbacks sets the "callbacks" field.

func (*AgentUpdate) SetComment

func (_u *AgentUpdate) SetComment(v string) *AgentUpdate

SetComment sets the "comment" field.

func (*AgentUpdate) SetDownloads

func (_u *AgentUpdate) SetDownloads(v int) *AgentUpdate

SetDownloads sets the "downloads" field.

func (*AgentUpdate) SetHosted

func (_u *AgentUpdate) SetHosted(v bool) *AgentUpdate

SetHosted sets the "hosted" field.

func (*AgentUpdate) SetNillableCallbacks

func (_u *AgentUpdate) SetNillableCallbacks(v *int) *AgentUpdate

SetNillableCallbacks sets the "callbacks" field if the given value is not nil.

func (*AgentUpdate) SetNillableComment

func (_u *AgentUpdate) SetNillableComment(v *string) *AgentUpdate

SetNillableComment sets the "comment" field if the given value is not nil.

func (*AgentUpdate) SetNillableDownloads

func (_u *AgentUpdate) SetNillableDownloads(v *int) *AgentUpdate

SetNillableDownloads sets the "downloads" field if the given value is not nil.

func (*AgentUpdate) SetNillableHosted

func (_u *AgentUpdate) SetNillableHosted(v *bool) *AgentUpdate

SetNillableHosted sets the "hosted" field if the given value is not nil.

func (*AgentUpdate) SetNillableURL

func (_u *AgentUpdate) SetNillableURL(v *string) *AgentUpdate

SetNillableURL sets the "url" field if the given value is not nil.

func (*AgentUpdate) SetURL

func (_u *AgentUpdate) SetURL(v string) *AgentUpdate

SetURL sets the "url" field.

func (*AgentUpdate) Where

func (_u *AgentUpdate) Where(ps ...predicate.Agent) *AgentUpdate

Where appends a list predicates to the AgentUpdate builder.

type AgentUpdateOne

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

AgentUpdateOne is the builder for updating a single Agent entity.

func (*AgentUpdateOne) AddCallbacks

func (_u *AgentUpdateOne) AddCallbacks(v int) *AgentUpdateOne

AddCallbacks adds value to the "callbacks" field.

func (*AgentUpdateOne) AddDownloads

func (_u *AgentUpdateOne) AddDownloads(v int) *AgentUpdateOne

AddDownloads adds value to the "downloads" field.

func (*AgentUpdateOne) ClearComment

func (_u *AgentUpdateOne) ClearComment() *AgentUpdateOne

ClearComment clears the value of the "comment" field.

func (*AgentUpdateOne) ClearURL

func (_u *AgentUpdateOne) ClearURL() *AgentUpdateOne

ClearURL clears the value of the "url" field.

func (*AgentUpdateOne) Exec

func (_u *AgentUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*AgentUpdateOne) ExecX

func (_u *AgentUpdateOne) ExecX(ctx context.Context)

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

func (*AgentUpdateOne) Mutation

func (_u *AgentUpdateOne) Mutation() *AgentMutation

Mutation returns the AgentMutation object of the builder.

func (*AgentUpdateOne) Save

func (_u *AgentUpdateOne) Save(ctx context.Context) (*Agent, error)

Save executes the query and returns the updated Agent entity.

func (*AgentUpdateOne) SaveX

func (_u *AgentUpdateOne) SaveX(ctx context.Context) *Agent

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

func (*AgentUpdateOne) Select

func (_u *AgentUpdateOne) Select(field string, fields ...string) *AgentUpdateOne

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

func (*AgentUpdateOne) SetCallbacks

func (_u *AgentUpdateOne) SetCallbacks(v int) *AgentUpdateOne

SetCallbacks sets the "callbacks" field.

func (*AgentUpdateOne) SetComment

func (_u *AgentUpdateOne) SetComment(v string) *AgentUpdateOne

SetComment sets the "comment" field.

func (*AgentUpdateOne) SetDownloads

func (_u *AgentUpdateOne) SetDownloads(v int) *AgentUpdateOne

SetDownloads sets the "downloads" field.

func (*AgentUpdateOne) SetHosted

func (_u *AgentUpdateOne) SetHosted(v bool) *AgentUpdateOne

SetHosted sets the "hosted" field.

func (*AgentUpdateOne) SetNillableCallbacks

func (_u *AgentUpdateOne) SetNillableCallbacks(v *int) *AgentUpdateOne

SetNillableCallbacks sets the "callbacks" field if the given value is not nil.

func (*AgentUpdateOne) SetNillableComment

func (_u *AgentUpdateOne) SetNillableComment(v *string) *AgentUpdateOne

SetNillableComment sets the "comment" field if the given value is not nil.

func (*AgentUpdateOne) SetNillableDownloads

func (_u *AgentUpdateOne) SetNillableDownloads(v *int) *AgentUpdateOne

SetNillableDownloads sets the "downloads" field if the given value is not nil.

func (*AgentUpdateOne) SetNillableHosted

func (_u *AgentUpdateOne) SetNillableHosted(v *bool) *AgentUpdateOne

SetNillableHosted sets the "hosted" field if the given value is not nil.

func (*AgentUpdateOne) SetNillableURL

func (_u *AgentUpdateOne) SetNillableURL(v *string) *AgentUpdateOne

SetNillableURL sets the "url" field if the given value is not nil.

func (*AgentUpdateOne) SetURL

func (_u *AgentUpdateOne) SetURL(v string) *AgentUpdateOne

SetURL sets the "url" field.

func (*AgentUpdateOne) Where

func (_u *AgentUpdateOne) Where(ps ...predicate.Agent) *AgentUpdateOne

Where appends a list predicates to the AgentUpdate builder.

type Agents

type Agents []*Agent

Agents is a parsable slice of Agent.

type AggregateFunc

type AggregateFunc func(*sql.Selector) string

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

func As

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

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

func Count

func Count() AggregateFunc

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

func Max

func Max(field string) AggregateFunc

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

func Mean

func Mean(field string) AggregateFunc

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

func Min

func Min(field string) AggregateFunc

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

func Sum

func Sum(field string) AggregateFunc

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

type Client

type Client struct {

	// Schema is the client for creating, migrating and dropping schema.
	Schema *migrate.Schema
	// Agent is the client for interacting with the Agent builders.
	Agent *AgentClient
	// Listener is the client for interacting with the Listener builders.
	Listener *ListenerClient
	// Session is the client for interacting with the Session builders.
	Session *SessionClient
	// contains filtered or unexported fields
}

Client is the client that holds all ent builders.

func FromContext

func FromContext(ctx context.Context) *Client

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

func NewClient

func NewClient(opts ...Option) *Client

NewClient creates a new client configured with the given options.

func Open

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

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

func (*Client) BeginTx

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

BeginTx returns a transactional client with specified options.

func (*Client) Close

func (c *Client) Close() error

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

func (*Client) Debug

func (c *Client) Debug() *Client

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

client.Debug().
	Agent.
	Query().
	Count(ctx)

func (*Client) Intercept

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

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

func (*Client) Mutate

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

Mutate implements the ent.Mutator interface.

func (*Client) Tx

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

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

func (*Client) Use

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

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

type CommitFunc

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

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

func (CommitFunc) Commit

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

Commit calls f(ctx, m).

type CommitHook

type CommitHook func(Committer) Committer

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

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

type Committer

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

Committer is the interface that wraps the Commit method.

type ConstraintError

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

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

func (ConstraintError) Error

func (e ConstraintError) Error() string

Error implements the error interface.

func (*ConstraintError) Unwrap

func (e *ConstraintError) Unwrap() error

Unwrap implements the errors.Wrapper interface.

type Hook

type Hook = ent.Hook

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

type InterceptFunc

type InterceptFunc = ent.InterceptFunc

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

type Interceptor

type Interceptor = ent.Interceptor

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

type Listener

type Listener struct {

	// ID of the ent.
	ID string `json:"id,omitempty"`
	// Name holds the value of the "name" field.
	Name string `json:"name,omitempty"`
	// PrivateKey holds the value of the "private_key" field.
	PrivateKey []byte `json:"private_key,omitempty"`
	// Fingerprint holds the value of the "fingerprint" field.
	Fingerprint string `json:"fingerprint,omitempty"`
	// contains filtered or unexported fields
}

Listener is the model entity for the Listener schema.

func (*Listener) String

func (_m *Listener) String() string

String implements the fmt.Stringer.

func (*Listener) Unwrap

func (_m *Listener) Unwrap() *Listener

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

func (_m *Listener) Update() *ListenerUpdateOne

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

func (*Listener) Value

func (_m *Listener) Value(name string) (ent.Value, error)

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

type ListenerClient

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

ListenerClient is a client for the Listener schema.

func NewListenerClient

func NewListenerClient(c config) *ListenerClient

NewListenerClient returns a client for the Listener from the given config.

func (*ListenerClient) Create

func (c *ListenerClient) Create() *ListenerCreate

Create returns a builder for creating a Listener entity.

func (*ListenerClient) CreateBulk

func (c *ListenerClient) CreateBulk(builders ...*ListenerCreate) *ListenerCreateBulk

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

func (*ListenerClient) Delete

func (c *ListenerClient) Delete() *ListenerDelete

Delete returns a delete builder for Listener.

func (*ListenerClient) DeleteOne

func (c *ListenerClient) DeleteOne(_m *Listener) *ListenerDeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*ListenerClient) DeleteOneID

func (c *ListenerClient) DeleteOneID(id string) *ListenerDeleteOne

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

func (*ListenerClient) Get

func (c *ListenerClient) Get(ctx context.Context, id string) (*Listener, error)

Get returns a Listener entity by its id.

func (*ListenerClient) GetX

func (c *ListenerClient) GetX(ctx context.Context, id string) *Listener

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

func (*ListenerClient) Hooks

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

Hooks returns the client hooks.

func (*ListenerClient) Intercept

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

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

func (*ListenerClient) Interceptors

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

Interceptors returns the client interceptors.

func (*ListenerClient) MapCreateBulk

func (c *ListenerClient) MapCreateBulk(slice any, setFunc func(*ListenerCreate, int)) *ListenerCreateBulk

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

func (*ListenerClient) Query

func (c *ListenerClient) Query() *ListenerQuery

Query returns a query builder for Listener.

func (*ListenerClient) Update

func (c *ListenerClient) Update() *ListenerUpdate

Update returns an update builder for Listener.

func (*ListenerClient) UpdateOne

func (c *ListenerClient) UpdateOne(_m *Listener) *ListenerUpdateOne

UpdateOne returns an update builder for the given entity.

func (*ListenerClient) UpdateOneID

func (c *ListenerClient) UpdateOneID(id string) *ListenerUpdateOne

UpdateOneID returns an update builder for the given id.

func (*ListenerClient) Use

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

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

type ListenerCreate

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

ListenerCreate is the builder for creating a Listener entity.

func (*ListenerCreate) Exec

func (_c *ListenerCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*ListenerCreate) ExecX

func (_c *ListenerCreate) ExecX(ctx context.Context)

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

func (*ListenerCreate) Mutation

func (_c *ListenerCreate) Mutation() *ListenerMutation

Mutation returns the ListenerMutation object of the builder.

func (*ListenerCreate) Save

func (_c *ListenerCreate) Save(ctx context.Context) (*Listener, error)

Save creates the Listener in the database.

func (*ListenerCreate) SaveX

func (_c *ListenerCreate) SaveX(ctx context.Context) *Listener

SaveX calls Save and panics if Save returns an error.

func (*ListenerCreate) SetFingerprint

func (_c *ListenerCreate) SetFingerprint(v string) *ListenerCreate

SetFingerprint sets the "fingerprint" field.

func (*ListenerCreate) SetID

func (_c *ListenerCreate) SetID(v string) *ListenerCreate

SetID sets the "id" field.

func (*ListenerCreate) SetName

func (_c *ListenerCreate) SetName(v string) *ListenerCreate

SetName sets the "name" field.

func (*ListenerCreate) SetNillableID

func (_c *ListenerCreate) SetNillableID(v *string) *ListenerCreate

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

func (*ListenerCreate) SetPrivateKey

func (_c *ListenerCreate) SetPrivateKey(v []byte) *ListenerCreate

SetPrivateKey sets the "private_key" field.

type ListenerCreateBulk

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

ListenerCreateBulk is the builder for creating many Listener entities in bulk.

func (*ListenerCreateBulk) Exec

func (_c *ListenerCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*ListenerCreateBulk) ExecX

func (_c *ListenerCreateBulk) ExecX(ctx context.Context)

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

func (*ListenerCreateBulk) Save

func (_c *ListenerCreateBulk) Save(ctx context.Context) ([]*Listener, error)

Save creates the Listener entities in the database.

func (*ListenerCreateBulk) SaveX

func (_c *ListenerCreateBulk) SaveX(ctx context.Context) []*Listener

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

type ListenerDelete

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

ListenerDelete is the builder for deleting a Listener entity.

func (*ListenerDelete) Exec

func (_d *ListenerDelete) Exec(ctx context.Context) (int, error)

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

func (*ListenerDelete) ExecX

func (_d *ListenerDelete) ExecX(ctx context.Context) int

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

func (*ListenerDelete) Where

func (_d *ListenerDelete) Where(ps ...predicate.Listener) *ListenerDelete

Where appends a list predicates to the ListenerDelete builder.

type ListenerDeleteOne

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

ListenerDeleteOne is the builder for deleting a single Listener entity.

func (*ListenerDeleteOne) Exec

func (_d *ListenerDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*ListenerDeleteOne) ExecX

func (_d *ListenerDeleteOne) ExecX(ctx context.Context)

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

func (*ListenerDeleteOne) Where

Where appends a list predicates to the ListenerDelete builder.

type ListenerGroupBy

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

ListenerGroupBy is the group-by builder for Listener entities.

func (*ListenerGroupBy) Aggregate

func (_g *ListenerGroupBy) Aggregate(fns ...AggregateFunc) *ListenerGroupBy

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

func (*ListenerGroupBy) Bool

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

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

func (*ListenerGroupBy) BoolX

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

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

func (*ListenerGroupBy) Bools

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

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

func (*ListenerGroupBy) BoolsX

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

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

func (*ListenerGroupBy) Float64

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

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

func (*ListenerGroupBy) Float64X

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

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

func (*ListenerGroupBy) Float64s

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

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

func (*ListenerGroupBy) Float64sX

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

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

func (*ListenerGroupBy) Int

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

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

func (*ListenerGroupBy) IntX

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

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

func (*ListenerGroupBy) Ints

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

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

func (*ListenerGroupBy) IntsX

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

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

func (*ListenerGroupBy) Scan

func (_g *ListenerGroupBy) Scan(ctx context.Context, v any) error

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

func (*ListenerGroupBy) ScanX

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

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

func (*ListenerGroupBy) String

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

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

func (*ListenerGroupBy) StringX

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

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

func (*ListenerGroupBy) Strings

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

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

func (*ListenerGroupBy) StringsX

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

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

type ListenerMutation

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

ListenerMutation represents an operation that mutates the Listener nodes in the graph.

func (*ListenerMutation) AddField

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

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

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

func (*ListenerMutation) AddedField

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

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

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

func (*ListenerMutation) AddedIDs

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

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

func (*ListenerMutation) ClearEdge

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

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

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

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

func (*ListenerMutation) ClearedFields

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

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

func (ListenerMutation) Client

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

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

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

func (*ListenerMutation) Field

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

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

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

func (*ListenerMutation) Fields

func (m *ListenerMutation) 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 (*ListenerMutation) Fingerprint

func (m *ListenerMutation) Fingerprint() (r string, exists bool)

Fingerprint returns the value of the "fingerprint" field in the mutation.

func (*ListenerMutation) ID

func (m *ListenerMutation) ID() (id string, exists bool)

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

func (*ListenerMutation) IDs

func (m *ListenerMutation) IDs(ctx context.Context) ([]string, error)

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

func (*ListenerMutation) Name

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

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

func (*ListenerMutation) OldField

func (m *ListenerMutation) 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 (*ListenerMutation) OldFingerprint

func (m *ListenerMutation) OldFingerprint(ctx context.Context) (v string, err error)

OldFingerprint returns the old "fingerprint" field's value of the Listener entity. If the Listener 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 (*ListenerMutation) OldName

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

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

func (m *ListenerMutation) OldPrivateKey(ctx context.Context) (v []byte, err error)

OldPrivateKey returns the old "private_key" field's value of the Listener entity. If the Listener 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 (*ListenerMutation) Op

func (m *ListenerMutation) Op() Op

Op returns the operation name.

func (*ListenerMutation) PrivateKey

func (m *ListenerMutation) PrivateKey() (r []byte, exists bool)

PrivateKey returns the value of the "private_key" field in the mutation.

func (*ListenerMutation) RemovedEdges

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

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

func (*ListenerMutation) RemovedIDs

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

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

func (m *ListenerMutation) 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 (*ListenerMutation) ResetFingerprint

func (m *ListenerMutation) ResetFingerprint()

ResetFingerprint resets all changes to the "fingerprint" field.

func (*ListenerMutation) ResetName

func (m *ListenerMutation) ResetName()

ResetName resets all changes to the "name" field.

func (*ListenerMutation) ResetPrivateKey

func (m *ListenerMutation) ResetPrivateKey()

ResetPrivateKey resets all changes to the "private_key" field.

func (*ListenerMutation) SetField

func (m *ListenerMutation) 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 (*ListenerMutation) SetFingerprint

func (m *ListenerMutation) SetFingerprint(s string)

SetFingerprint sets the "fingerprint" field.

func (*ListenerMutation) SetID

func (m *ListenerMutation) SetID(id string)

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

func (*ListenerMutation) SetName

func (m *ListenerMutation) SetName(s string)

SetName sets the "name" field.

func (*ListenerMutation) SetOp

func (m *ListenerMutation) SetOp(op Op)

SetOp allows setting the mutation operation.

func (*ListenerMutation) SetPrivateKey

func (m *ListenerMutation) SetPrivateKey(b []byte)

SetPrivateKey sets the "private_key" field.

func (ListenerMutation) Tx

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

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

func (*ListenerMutation) Type

func (m *ListenerMutation) Type() string

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

func (*ListenerMutation) Where

func (m *ListenerMutation) Where(ps ...predicate.Listener)

Where appends a list predicates to the ListenerMutation builder.

func (*ListenerMutation) WhereP

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

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

type ListenerQuery

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

ListenerQuery is the builder for querying Listener entities.

func (*ListenerQuery) Aggregate

func (_q *ListenerQuery) Aggregate(fns ...AggregateFunc) *ListenerSelect

Aggregate returns a ListenerSelect configured with the given aggregations.

func (*ListenerQuery) All

func (_q *ListenerQuery) All(ctx context.Context) ([]*Listener, error)

All executes the query and returns a list of Listeners.

func (*ListenerQuery) AllX

func (_q *ListenerQuery) AllX(ctx context.Context) []*Listener

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

func (*ListenerQuery) Clone

func (_q *ListenerQuery) Clone() *ListenerQuery

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

func (*ListenerQuery) Count

func (_q *ListenerQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*ListenerQuery) CountX

func (_q *ListenerQuery) CountX(ctx context.Context) int

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

func (*ListenerQuery) Exist

func (_q *ListenerQuery) Exist(ctx context.Context) (bool, error)

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

func (*ListenerQuery) ExistX

func (_q *ListenerQuery) ExistX(ctx context.Context) bool

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

func (*ListenerQuery) First

func (_q *ListenerQuery) First(ctx context.Context) (*Listener, error)

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

func (*ListenerQuery) FirstID

func (_q *ListenerQuery) FirstID(ctx context.Context) (id string, err error)

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

func (*ListenerQuery) FirstIDX

func (_q *ListenerQuery) FirstIDX(ctx context.Context) string

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

func (*ListenerQuery) FirstX

func (_q *ListenerQuery) FirstX(ctx context.Context) *Listener

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

func (*ListenerQuery) GroupBy

func (_q *ListenerQuery) GroupBy(field string, fields ...string) *ListenerGroupBy

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.Listener.Query().
	GroupBy(listener.FieldName).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*ListenerQuery) IDs

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

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

func (*ListenerQuery) IDsX

func (_q *ListenerQuery) IDsX(ctx context.Context) []string

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

func (*ListenerQuery) Limit

func (_q *ListenerQuery) Limit(limit int) *ListenerQuery

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

func (*ListenerQuery) Offset

func (_q *ListenerQuery) Offset(offset int) *ListenerQuery

Offset to start from.

func (*ListenerQuery) Only

func (_q *ListenerQuery) Only(ctx context.Context) (*Listener, error)

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

func (*ListenerQuery) OnlyID

func (_q *ListenerQuery) OnlyID(ctx context.Context) (id string, err error)

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

func (*ListenerQuery) OnlyIDX

func (_q *ListenerQuery) OnlyIDX(ctx context.Context) string

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

func (*ListenerQuery) OnlyX

func (_q *ListenerQuery) OnlyX(ctx context.Context) *Listener

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

func (*ListenerQuery) Order

Order specifies how the records should be ordered.

func (*ListenerQuery) Select

func (_q *ListenerQuery) Select(fields ...string) *ListenerSelect

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.Listener.Query().
	Select(listener.FieldName).
	Scan(ctx, &v)

func (*ListenerQuery) Unique

func (_q *ListenerQuery) Unique(unique bool) *ListenerQuery

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

func (_q *ListenerQuery) Where(ps ...predicate.Listener) *ListenerQuery

Where adds a new predicate for the ListenerQuery builder.

type ListenerSelect

type ListenerSelect struct {
	*ListenerQuery
	// contains filtered or unexported fields
}

ListenerSelect is the builder for selecting fields of Listener entities.

func (*ListenerSelect) Aggregate

func (_s *ListenerSelect) Aggregate(fns ...AggregateFunc) *ListenerSelect

Aggregate adds the given aggregation functions to the selector query.

func (*ListenerSelect) Bool

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

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

func (*ListenerSelect) BoolX

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

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

func (*ListenerSelect) Bools

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

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

func (*ListenerSelect) BoolsX

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

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

func (*ListenerSelect) Float64

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

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

func (*ListenerSelect) Float64X

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

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

func (*ListenerSelect) Float64s

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

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

func (*ListenerSelect) Float64sX

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

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

func (*ListenerSelect) Int

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

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

func (*ListenerSelect) IntX

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

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

func (*ListenerSelect) Ints

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

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

func (*ListenerSelect) IntsX

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

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

func (*ListenerSelect) Scan

func (_s *ListenerSelect) Scan(ctx context.Context, v any) error

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

func (*ListenerSelect) ScanX

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

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

func (*ListenerSelect) String

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

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

func (*ListenerSelect) StringX

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

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

func (*ListenerSelect) Strings

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

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

func (*ListenerSelect) StringsX

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

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

type ListenerUpdate

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

ListenerUpdate is the builder for updating Listener entities.

func (*ListenerUpdate) Exec

func (_u *ListenerUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*ListenerUpdate) ExecX

func (_u *ListenerUpdate) ExecX(ctx context.Context)

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

func (*ListenerUpdate) Mutation

func (_u *ListenerUpdate) Mutation() *ListenerMutation

Mutation returns the ListenerMutation object of the builder.

func (*ListenerUpdate) Save

func (_u *ListenerUpdate) Save(ctx context.Context) (int, error)

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

func (*ListenerUpdate) SaveX

func (_u *ListenerUpdate) SaveX(ctx context.Context) int

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

func (*ListenerUpdate) SetFingerprint

func (_u *ListenerUpdate) SetFingerprint(v string) *ListenerUpdate

SetFingerprint sets the "fingerprint" field.

func (*ListenerUpdate) SetName

func (_u *ListenerUpdate) SetName(v string) *ListenerUpdate

SetName sets the "name" field.

func (*ListenerUpdate) SetNillableFingerprint

func (_u *ListenerUpdate) SetNillableFingerprint(v *string) *ListenerUpdate

SetNillableFingerprint sets the "fingerprint" field if the given value is not nil.

func (*ListenerUpdate) SetNillableName

func (_u *ListenerUpdate) SetNillableName(v *string) *ListenerUpdate

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

func (*ListenerUpdate) SetPrivateKey

func (_u *ListenerUpdate) SetPrivateKey(v []byte) *ListenerUpdate

SetPrivateKey sets the "private_key" field.

func (*ListenerUpdate) Where

func (_u *ListenerUpdate) Where(ps ...predicate.Listener) *ListenerUpdate

Where appends a list predicates to the ListenerUpdate builder.

type ListenerUpdateOne

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

ListenerUpdateOne is the builder for updating a single Listener entity.

func (*ListenerUpdateOne) Exec

func (_u *ListenerUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*ListenerUpdateOne) ExecX

func (_u *ListenerUpdateOne) ExecX(ctx context.Context)

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

func (*ListenerUpdateOne) Mutation

func (_u *ListenerUpdateOne) Mutation() *ListenerMutation

Mutation returns the ListenerMutation object of the builder.

func (*ListenerUpdateOne) Save

func (_u *ListenerUpdateOne) Save(ctx context.Context) (*Listener, error)

Save executes the query and returns the updated Listener entity.

func (*ListenerUpdateOne) SaveX

func (_u *ListenerUpdateOne) SaveX(ctx context.Context) *Listener

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

func (*ListenerUpdateOne) Select

func (_u *ListenerUpdateOne) Select(field string, fields ...string) *ListenerUpdateOne

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

func (*ListenerUpdateOne) SetFingerprint

func (_u *ListenerUpdateOne) SetFingerprint(v string) *ListenerUpdateOne

SetFingerprint sets the "fingerprint" field.

func (*ListenerUpdateOne) SetName

func (_u *ListenerUpdateOne) SetName(v string) *ListenerUpdateOne

SetName sets the "name" field.

func (*ListenerUpdateOne) SetNillableFingerprint

func (_u *ListenerUpdateOne) SetNillableFingerprint(v *string) *ListenerUpdateOne

SetNillableFingerprint sets the "fingerprint" field if the given value is not nil.

func (*ListenerUpdateOne) SetNillableName

func (_u *ListenerUpdateOne) SetNillableName(v *string) *ListenerUpdateOne

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

func (*ListenerUpdateOne) SetPrivateKey

func (_u *ListenerUpdateOne) SetPrivateKey(v []byte) *ListenerUpdateOne

SetPrivateKey sets the "private_key" field.

func (*ListenerUpdateOne) Where

Where appends a list predicates to the ListenerUpdate builder.

type Listeners

type Listeners []*Listener

Listeners is a parsable slice of Listener.

type MutateFunc

type MutateFunc = ent.MutateFunc

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

type Mutation

type Mutation = ent.Mutation

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

type Mutator

type Mutator = ent.Mutator

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

type NotFoundError

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

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

func (*NotFoundError) Error

func (e *NotFoundError) Error() string

Error implements the error interface.

type NotLoadedError

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

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

func (*NotLoadedError) Error

func (e *NotLoadedError) Error() string

Error implements the error interface.

type NotSingularError

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

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

func (*NotSingularError) Error

func (e *NotSingularError) Error() string

Error implements the error interface.

type Op

type Op = ent.Op

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

type Option

type Option func(*config)

Option function to configure the client.

func Debug

func Debug() Option

Debug enables debug logging on the ent.Driver.

func Driver

func Driver(driver dialect.Driver) Option

Driver configures the client driver.

func Log

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

Log sets the logging function for debug mode.

type OrderFunc

type OrderFunc func(*sql.Selector)

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

type Policy

type Policy = ent.Policy

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

type Querier

type Querier = ent.Querier

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

type QuerierFunc

type QuerierFunc = ent.QuerierFunc

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

type Query

type Query = ent.Query

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

type QueryContext

type QueryContext = ent.QueryContext

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

type RollbackFunc

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

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

func (RollbackFunc) Rollback

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

Rollback calls f(ctx, m).

type RollbackHook

type RollbackHook func(Rollbacker) Rollbacker

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

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

type Rollbacker

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

Rollbacker is the interface that wraps the Rollback method.

type Session

type Session struct {

	// ID of the ent.
	ID string `json:"id,omitempty"`
	// CreatedAt holds the value of the "created_at" field.
	CreatedAt time.Time `json:"created_at,omitempty"`
	// AgentID holds the value of the "agent_id" field.
	AgentID string `json:"agent_id,omitempty"`
	// Username holds the value of the "username" field.
	Username string `json:"username,omitempty"`
	// Hostname holds the value of the "hostname" field.
	Hostname string `json:"hostname,omitempty"`
	// Domain holds the value of the "domain" field.
	Domain string `json:"domain,omitempty"`
	// IsPriv holds the value of the "is_priv" field.
	IsPriv bool `json:"is_priv,omitempty"`
	// Ips holds the value of the "ips" field.
	Ips []string `json:"ips,omitempty"`
	// OsMeta holds the value of the "os_meta" field.
	OsMeta string `json:"os_meta,omitempty"`
	// ProcName holds the value of the "proc_name" field.
	ProcName string `json:"proc_name,omitempty"`
	// Extra holds the value of the "extra" field.
	Extra string `json:"extra,omitempty"`
	// contains filtered or unexported fields
}

Session is the model entity for the Session schema.

func (*Session) String

func (_m *Session) String() string

String implements the fmt.Stringer.

func (*Session) Unwrap

func (_m *Session) Unwrap() *Session

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

func (_m *Session) Update() *SessionUpdateOne

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

func (*Session) Value

func (_m *Session) Value(name string) (ent.Value, error)

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

type SessionClient

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

SessionClient is a client for the Session schema.

func NewSessionClient

func NewSessionClient(c config) *SessionClient

NewSessionClient returns a client for the Session from the given config.

func (*SessionClient) Create

func (c *SessionClient) Create() *SessionCreate

Create returns a builder for creating a Session entity.

func (*SessionClient) CreateBulk

func (c *SessionClient) CreateBulk(builders ...*SessionCreate) *SessionCreateBulk

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

func (*SessionClient) Delete

func (c *SessionClient) Delete() *SessionDelete

Delete returns a delete builder for Session.

func (*SessionClient) DeleteOne

func (c *SessionClient) DeleteOne(_m *Session) *SessionDeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*SessionClient) DeleteOneID

func (c *SessionClient) DeleteOneID(id string) *SessionDeleteOne

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

func (*SessionClient) Get

func (c *SessionClient) Get(ctx context.Context, id string) (*Session, error)

Get returns a Session entity by its id.

func (*SessionClient) GetX

func (c *SessionClient) GetX(ctx context.Context, id string) *Session

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

func (*SessionClient) Hooks

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

Hooks returns the client hooks.

func (*SessionClient) Intercept

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

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

func (*SessionClient) Interceptors

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

Interceptors returns the client interceptors.

func (*SessionClient) MapCreateBulk

func (c *SessionClient) MapCreateBulk(slice any, setFunc func(*SessionCreate, int)) *SessionCreateBulk

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

func (*SessionClient) Query

func (c *SessionClient) Query() *SessionQuery

Query returns a query builder for Session.

func (*SessionClient) Update

func (c *SessionClient) Update() *SessionUpdate

Update returns an update builder for Session.

func (*SessionClient) UpdateOne

func (c *SessionClient) UpdateOne(_m *Session) *SessionUpdateOne

UpdateOne returns an update builder for the given entity.

func (*SessionClient) UpdateOneID

func (c *SessionClient) UpdateOneID(id string) *SessionUpdateOne

UpdateOneID returns an update builder for the given id.

func (*SessionClient) Use

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

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

type SessionCreate

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

SessionCreate is the builder for creating a Session entity.

func (*SessionCreate) Exec

func (_c *SessionCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*SessionCreate) ExecX

func (_c *SessionCreate) ExecX(ctx context.Context)

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

func (*SessionCreate) Mutation

func (_c *SessionCreate) Mutation() *SessionMutation

Mutation returns the SessionMutation object of the builder.

func (*SessionCreate) Save

func (_c *SessionCreate) Save(ctx context.Context) (*Session, error)

Save creates the Session in the database.

func (*SessionCreate) SaveX

func (_c *SessionCreate) SaveX(ctx context.Context) *Session

SaveX calls Save and panics if Save returns an error.

func (*SessionCreate) SetAgentID

func (_c *SessionCreate) SetAgentID(v string) *SessionCreate

SetAgentID sets the "agent_id" field.

func (*SessionCreate) SetCreatedAt

func (_c *SessionCreate) SetCreatedAt(v time.Time) *SessionCreate

SetCreatedAt sets the "created_at" field.

func (*SessionCreate) SetDomain

func (_c *SessionCreate) SetDomain(v string) *SessionCreate

SetDomain sets the "domain" field.

func (*SessionCreate) SetExtra

func (_c *SessionCreate) SetExtra(v string) *SessionCreate

SetExtra sets the "extra" field.

func (*SessionCreate) SetHostname

func (_c *SessionCreate) SetHostname(v string) *SessionCreate

SetHostname sets the "hostname" field.

func (*SessionCreate) SetID

func (_c *SessionCreate) SetID(v string) *SessionCreate

SetID sets the "id" field.

func (*SessionCreate) SetIps

func (_c *SessionCreate) SetIps(v []string) *SessionCreate

SetIps sets the "ips" field.

func (*SessionCreate) SetIsPriv

func (_c *SessionCreate) SetIsPriv(v bool) *SessionCreate

SetIsPriv sets the "is_priv" field.

func (*SessionCreate) SetNillableCreatedAt

func (_c *SessionCreate) SetNillableCreatedAt(v *time.Time) *SessionCreate

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

func (*SessionCreate) SetNillableDomain

func (_c *SessionCreate) SetNillableDomain(v *string) *SessionCreate

SetNillableDomain sets the "domain" field if the given value is not nil.

func (*SessionCreate) SetNillableExtra

func (_c *SessionCreate) SetNillableExtra(v *string) *SessionCreate

SetNillableExtra sets the "extra" field if the given value is not nil.

func (*SessionCreate) SetNillableID

func (_c *SessionCreate) SetNillableID(v *string) *SessionCreate

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

func (*SessionCreate) SetNillableIsPriv

func (_c *SessionCreate) SetNillableIsPriv(v *bool) *SessionCreate

SetNillableIsPriv sets the "is_priv" field if the given value is not nil.

func (*SessionCreate) SetNillableOsMeta

func (_c *SessionCreate) SetNillableOsMeta(v *string) *SessionCreate

SetNillableOsMeta sets the "os_meta" field if the given value is not nil.

func (*SessionCreate) SetNillableProcName

func (_c *SessionCreate) SetNillableProcName(v *string) *SessionCreate

SetNillableProcName sets the "proc_name" field if the given value is not nil.

func (*SessionCreate) SetOsMeta

func (_c *SessionCreate) SetOsMeta(v string) *SessionCreate

SetOsMeta sets the "os_meta" field.

func (*SessionCreate) SetProcName

func (_c *SessionCreate) SetProcName(v string) *SessionCreate

SetProcName sets the "proc_name" field.

func (*SessionCreate) SetUsername

func (_c *SessionCreate) SetUsername(v string) *SessionCreate

SetUsername sets the "username" field.

type SessionCreateBulk

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

SessionCreateBulk is the builder for creating many Session entities in bulk.

func (*SessionCreateBulk) Exec

func (_c *SessionCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*SessionCreateBulk) ExecX

func (_c *SessionCreateBulk) ExecX(ctx context.Context)

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

func (*SessionCreateBulk) Save

func (_c *SessionCreateBulk) Save(ctx context.Context) ([]*Session, error)

Save creates the Session entities in the database.

func (*SessionCreateBulk) SaveX

func (_c *SessionCreateBulk) SaveX(ctx context.Context) []*Session

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

type SessionDelete

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

SessionDelete is the builder for deleting a Session entity.

func (*SessionDelete) Exec

func (_d *SessionDelete) Exec(ctx context.Context) (int, error)

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

func (*SessionDelete) ExecX

func (_d *SessionDelete) ExecX(ctx context.Context) int

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

func (*SessionDelete) Where

func (_d *SessionDelete) Where(ps ...predicate.Session) *SessionDelete

Where appends a list predicates to the SessionDelete builder.

type SessionDeleteOne

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

SessionDeleteOne is the builder for deleting a single Session entity.

func (*SessionDeleteOne) Exec

func (_d *SessionDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*SessionDeleteOne) ExecX

func (_d *SessionDeleteOne) ExecX(ctx context.Context)

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

func (*SessionDeleteOne) Where

Where appends a list predicates to the SessionDelete builder.

type SessionGroupBy

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

SessionGroupBy is the group-by builder for Session entities.

func (*SessionGroupBy) Aggregate

func (_g *SessionGroupBy) Aggregate(fns ...AggregateFunc) *SessionGroupBy

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

func (*SessionGroupBy) Bool

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

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

func (*SessionGroupBy) BoolX

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

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

func (*SessionGroupBy) Bools

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

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

func (*SessionGroupBy) BoolsX

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

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

func (*SessionGroupBy) Float64

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

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

func (*SessionGroupBy) Float64X

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

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

func (*SessionGroupBy) Float64s

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

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

func (*SessionGroupBy) Float64sX

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

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

func (*SessionGroupBy) Int

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

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

func (*SessionGroupBy) IntX

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

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

func (*SessionGroupBy) Ints

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

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

func (*SessionGroupBy) IntsX

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

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

func (*SessionGroupBy) Scan

func (_g *SessionGroupBy) Scan(ctx context.Context, v any) error

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

func (*SessionGroupBy) ScanX

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

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

func (*SessionGroupBy) String

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

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

func (*SessionGroupBy) StringX

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

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

func (*SessionGroupBy) Strings

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

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

func (*SessionGroupBy) StringsX

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

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

type SessionMutation

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

SessionMutation represents an operation that mutates the Session nodes in the graph.

func (*SessionMutation) AddField

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

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

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

func (*SessionMutation) AddedField

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

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

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

func (*SessionMutation) AddedIDs

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

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

func (*SessionMutation) AgentID

func (m *SessionMutation) AgentID() (r string, exists bool)

AgentID returns the value of the "agent_id" field in the mutation.

func (*SessionMutation) AppendIps

func (m *SessionMutation) AppendIps(s []string)

AppendIps adds s to the "ips" field.

func (*SessionMutation) AppendedIps

func (m *SessionMutation) AppendedIps() ([]string, bool)

AppendedIps returns the list of values that were appended to the "ips" field in this mutation.

func (*SessionMutation) ClearEdge

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

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

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

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

func (*SessionMutation) ClearedFields

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

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

func (SessionMutation) Client

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

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

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

func (*SessionMutation) Domain

func (m *SessionMutation) Domain() (r string, exists bool)

Domain returns the value of the "domain" field in the mutation.

func (*SessionMutation) EdgeCleared

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

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

func (*SessionMutation) Extra

func (m *SessionMutation) Extra() (r string, exists bool)

Extra returns the value of the "extra" field in the mutation.

func (*SessionMutation) Field

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

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

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

func (*SessionMutation) Fields

func (m *SessionMutation) 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 (*SessionMutation) Hostname

func (m *SessionMutation) Hostname() (r string, exists bool)

Hostname returns the value of the "hostname" field in the mutation.

func (*SessionMutation) ID

func (m *SessionMutation) ID() (id string, exists bool)

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

func (*SessionMutation) IDs

func (m *SessionMutation) IDs(ctx context.Context) ([]string, error)

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

func (*SessionMutation) Ips

func (m *SessionMutation) Ips() (r []string, exists bool)

Ips returns the value of the "ips" field in the mutation.

func (*SessionMutation) IsPriv

func (m *SessionMutation) IsPriv() (r bool, exists bool)

IsPriv returns the value of the "is_priv" field in the mutation.

func (*SessionMutation) OldAgentID

func (m *SessionMutation) OldAgentID(ctx context.Context) (v string, err error)

OldAgentID returns the old "agent_id" field's value of the Session entity. If the Session 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 (*SessionMutation) OldCreatedAt

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

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

func (m *SessionMutation) OldDomain(ctx context.Context) (v string, err error)

OldDomain returns the old "domain" field's value of the Session entity. If the Session 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 (*SessionMutation) OldExtra

func (m *SessionMutation) OldExtra(ctx context.Context) (v string, err error)

OldExtra returns the old "extra" field's value of the Session entity. If the Session 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 (*SessionMutation) OldField

func (m *SessionMutation) 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 (*SessionMutation) OldHostname

func (m *SessionMutation) OldHostname(ctx context.Context) (v string, err error)

OldHostname returns the old "hostname" field's value of the Session entity. If the Session 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 (*SessionMutation) OldIps

func (m *SessionMutation) OldIps(ctx context.Context) (v []string, err error)

OldIps returns the old "ips" field's value of the Session entity. If the Session 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 (*SessionMutation) OldIsPriv

func (m *SessionMutation) OldIsPriv(ctx context.Context) (v bool, err error)

OldIsPriv returns the old "is_priv" field's value of the Session entity. If the Session 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 (*SessionMutation) OldOsMeta

func (m *SessionMutation) OldOsMeta(ctx context.Context) (v string, err error)

OldOsMeta returns the old "os_meta" field's value of the Session entity. If the Session 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 (*SessionMutation) OldProcName

func (m *SessionMutation) OldProcName(ctx context.Context) (v string, err error)

OldProcName returns the old "proc_name" field's value of the Session entity. If the Session 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 (*SessionMutation) OldUsername

func (m *SessionMutation) OldUsername(ctx context.Context) (v string, err error)

OldUsername returns the old "username" field's value of the Session entity. If the Session 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 (*SessionMutation) Op

func (m *SessionMutation) Op() Op

Op returns the operation name.

func (*SessionMutation) OsMeta

func (m *SessionMutation) OsMeta() (r string, exists bool)

OsMeta returns the value of the "os_meta" field in the mutation.

func (*SessionMutation) ProcName

func (m *SessionMutation) ProcName() (r string, exists bool)

ProcName returns the value of the "proc_name" field in the mutation.

func (*SessionMutation) RemovedEdges

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

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

func (*SessionMutation) RemovedIDs

func (m *SessionMutation) 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 (*SessionMutation) ResetAgentID

func (m *SessionMutation) ResetAgentID()

ResetAgentID resets all changes to the "agent_id" field.

func (*SessionMutation) ResetCreatedAt

func (m *SessionMutation) ResetCreatedAt()

ResetCreatedAt resets all changes to the "created_at" field.

func (*SessionMutation) ResetDomain

func (m *SessionMutation) ResetDomain()

ResetDomain resets all changes to the "domain" field.

func (*SessionMutation) ResetEdge

func (m *SessionMutation) 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 (*SessionMutation) ResetExtra

func (m *SessionMutation) ResetExtra()

ResetExtra resets all changes to the "extra" field.

func (*SessionMutation) ResetField

func (m *SessionMutation) 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 (*SessionMutation) ResetHostname

func (m *SessionMutation) ResetHostname()

ResetHostname resets all changes to the "hostname" field.

func (*SessionMutation) ResetIps

func (m *SessionMutation) ResetIps()

ResetIps resets all changes to the "ips" field.

func (*SessionMutation) ResetIsPriv

func (m *SessionMutation) ResetIsPriv()

ResetIsPriv resets all changes to the "is_priv" field.

func (*SessionMutation) ResetOsMeta

func (m *SessionMutation) ResetOsMeta()

ResetOsMeta resets all changes to the "os_meta" field.

func (*SessionMutation) ResetProcName

func (m *SessionMutation) ResetProcName()

ResetProcName resets all changes to the "proc_name" field.

func (*SessionMutation) ResetUsername

func (m *SessionMutation) ResetUsername()

ResetUsername resets all changes to the "username" field.

func (*SessionMutation) SetAgentID

func (m *SessionMutation) SetAgentID(s string)

SetAgentID sets the "agent_id" field.

func (*SessionMutation) SetCreatedAt

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

SetCreatedAt sets the "created_at" field.

func (*SessionMutation) SetDomain

func (m *SessionMutation) SetDomain(s string)

SetDomain sets the "domain" field.

func (*SessionMutation) SetExtra

func (m *SessionMutation) SetExtra(s string)

SetExtra sets the "extra" field.

func (*SessionMutation) SetField

func (m *SessionMutation) 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 (*SessionMutation) SetHostname

func (m *SessionMutation) SetHostname(s string)

SetHostname sets the "hostname" field.

func (*SessionMutation) SetID

func (m *SessionMutation) SetID(id string)

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

func (*SessionMutation) SetIps

func (m *SessionMutation) SetIps(s []string)

SetIps sets the "ips" field.

func (*SessionMutation) SetIsPriv

func (m *SessionMutation) SetIsPriv(b bool)

SetIsPriv sets the "is_priv" field.

func (*SessionMutation) SetOp

func (m *SessionMutation) SetOp(op Op)

SetOp allows setting the mutation operation.

func (*SessionMutation) SetOsMeta

func (m *SessionMutation) SetOsMeta(s string)

SetOsMeta sets the "os_meta" field.

func (*SessionMutation) SetProcName

func (m *SessionMutation) SetProcName(s string)

SetProcName sets the "proc_name" field.

func (*SessionMutation) SetUsername

func (m *SessionMutation) SetUsername(s string)

SetUsername sets the "username" field.

func (SessionMutation) Tx

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

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

func (*SessionMutation) Type

func (m *SessionMutation) Type() string

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

func (*SessionMutation) Username

func (m *SessionMutation) Username() (r string, exists bool)

Username returns the value of the "username" field in the mutation.

func (*SessionMutation) Where

func (m *SessionMutation) Where(ps ...predicate.Session)

Where appends a list predicates to the SessionMutation builder.

func (*SessionMutation) WhereP

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

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

type SessionQuery

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

SessionQuery is the builder for querying Session entities.

func (*SessionQuery) Aggregate

func (_q *SessionQuery) Aggregate(fns ...AggregateFunc) *SessionSelect

Aggregate returns a SessionSelect configured with the given aggregations.

func (*SessionQuery) All

func (_q *SessionQuery) All(ctx context.Context) ([]*Session, error)

All executes the query and returns a list of Sessions.

func (*SessionQuery) AllX

func (_q *SessionQuery) AllX(ctx context.Context) []*Session

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

func (*SessionQuery) Clone

func (_q *SessionQuery) Clone() *SessionQuery

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

func (*SessionQuery) Count

func (_q *SessionQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*SessionQuery) CountX

func (_q *SessionQuery) CountX(ctx context.Context) int

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

func (*SessionQuery) Exist

func (_q *SessionQuery) Exist(ctx context.Context) (bool, error)

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

func (*SessionQuery) ExistX

func (_q *SessionQuery) ExistX(ctx context.Context) bool

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

func (*SessionQuery) First

func (_q *SessionQuery) First(ctx context.Context) (*Session, error)

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

func (*SessionQuery) FirstID

func (_q *SessionQuery) FirstID(ctx context.Context) (id string, err error)

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

func (*SessionQuery) FirstIDX

func (_q *SessionQuery) FirstIDX(ctx context.Context) string

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

func (*SessionQuery) FirstX

func (_q *SessionQuery) FirstX(ctx context.Context) *Session

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

func (*SessionQuery) GroupBy

func (_q *SessionQuery) GroupBy(field string, fields ...string) *SessionGroupBy

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

client.Session.Query().
	GroupBy(session.FieldCreatedAt).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*SessionQuery) IDs

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

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

func (*SessionQuery) IDsX

func (_q *SessionQuery) IDsX(ctx context.Context) []string

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

func (*SessionQuery) Limit

func (_q *SessionQuery) Limit(limit int) *SessionQuery

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

func (*SessionQuery) Offset

func (_q *SessionQuery) Offset(offset int) *SessionQuery

Offset to start from.

func (*SessionQuery) Only

func (_q *SessionQuery) Only(ctx context.Context) (*Session, error)

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

func (*SessionQuery) OnlyID

func (_q *SessionQuery) OnlyID(ctx context.Context) (id string, err error)

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

func (*SessionQuery) OnlyIDX

func (_q *SessionQuery) OnlyIDX(ctx context.Context) string

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

func (*SessionQuery) OnlyX

func (_q *SessionQuery) OnlyX(ctx context.Context) *Session

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

func (*SessionQuery) Order

func (_q *SessionQuery) Order(o ...session.OrderOption) *SessionQuery

Order specifies how the records should be ordered.

func (*SessionQuery) Select

func (_q *SessionQuery) Select(fields ...string) *SessionSelect

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

client.Session.Query().
	Select(session.FieldCreatedAt).
	Scan(ctx, &v)

func (*SessionQuery) Unique

func (_q *SessionQuery) Unique(unique bool) *SessionQuery

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

func (_q *SessionQuery) Where(ps ...predicate.Session) *SessionQuery

Where adds a new predicate for the SessionQuery builder.

type SessionSelect

type SessionSelect struct {
	*SessionQuery
	// contains filtered or unexported fields
}

SessionSelect is the builder for selecting fields of Session entities.

func (*SessionSelect) Aggregate

func (_s *SessionSelect) Aggregate(fns ...AggregateFunc) *SessionSelect

Aggregate adds the given aggregation functions to the selector query.

func (*SessionSelect) Bool

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

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

func (*SessionSelect) BoolX

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

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

func (*SessionSelect) Bools

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

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

func (*SessionSelect) BoolsX

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

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

func (*SessionSelect) Float64

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

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

func (*SessionSelect) Float64X

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

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

func (*SessionSelect) Float64s

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

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

func (*SessionSelect) Float64sX

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

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

func (*SessionSelect) Int

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

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

func (*SessionSelect) IntX

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

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

func (*SessionSelect) Ints

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

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

func (*SessionSelect) IntsX

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

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

func (*SessionSelect) Scan

func (_s *SessionSelect) Scan(ctx context.Context, v any) error

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

func (*SessionSelect) ScanX

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

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

func (*SessionSelect) String

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

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

func (*SessionSelect) StringX

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

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

func (*SessionSelect) Strings

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

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

func (*SessionSelect) StringsX

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

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

type SessionUpdate

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

SessionUpdate is the builder for updating Session entities.

func (*SessionUpdate) Exec

func (_u *SessionUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*SessionUpdate) ExecX

func (_u *SessionUpdate) ExecX(ctx context.Context)

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

func (*SessionUpdate) Mutation

func (_u *SessionUpdate) Mutation() *SessionMutation

Mutation returns the SessionMutation object of the builder.

func (*SessionUpdate) Save

func (_u *SessionUpdate) Save(ctx context.Context) (int, error)

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

func (*SessionUpdate) SaveX

func (_u *SessionUpdate) SaveX(ctx context.Context) int

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

func (*SessionUpdate) Where

func (_u *SessionUpdate) Where(ps ...predicate.Session) *SessionUpdate

Where appends a list predicates to the SessionUpdate builder.

type SessionUpdateOne

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

SessionUpdateOne is the builder for updating a single Session entity.

func (*SessionUpdateOne) Exec

func (_u *SessionUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*SessionUpdateOne) ExecX

func (_u *SessionUpdateOne) ExecX(ctx context.Context)

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

func (*SessionUpdateOne) Mutation

func (_u *SessionUpdateOne) Mutation() *SessionMutation

Mutation returns the SessionMutation object of the builder.

func (*SessionUpdateOne) Save

func (_u *SessionUpdateOne) Save(ctx context.Context) (*Session, error)

Save executes the query and returns the updated Session entity.

func (*SessionUpdateOne) SaveX

func (_u *SessionUpdateOne) SaveX(ctx context.Context) *Session

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

func (*SessionUpdateOne) Select

func (_u *SessionUpdateOne) Select(field string, fields ...string) *SessionUpdateOne

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

func (*SessionUpdateOne) Where

Where appends a list predicates to the SessionUpdate builder.

type Sessions

type Sessions []*Session

Sessions is a parsable slice of Session.

type TraverseFunc

type TraverseFunc = ent.TraverseFunc

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

type Traverser

type Traverser = ent.Traverser

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

type Tx

type Tx struct {

	// Agent is the client for interacting with the Agent builders.
	Agent *AgentClient
	// Listener is the client for interacting with the Listener builders.
	Listener *ListenerClient
	// Session is the client for interacting with the Session builders.
	Session *SessionClient
	// contains filtered or unexported fields
}

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

func TxFromContext

func TxFromContext(ctx context.Context) *Tx

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

func (*Tx) Client

func (tx *Tx) Client() *Client

Client returns a Client that binds to current transaction.

func (*Tx) Commit

func (tx *Tx) Commit() error

Commit commits the transaction.

func (*Tx) OnCommit

func (tx *Tx) OnCommit(f CommitHook)

OnCommit adds a hook to call on commit.

func (*Tx) OnRollback

func (tx *Tx) OnRollback(f RollbackHook)

OnRollback adds a hook to call on rollback.

func (*Tx) Rollback

func (tx *Tx) Rollback() error

Rollback rollbacks the transaction.

type ValidationError

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

ValidationError returns when validating a field or edge fails.

func (*ValidationError) Error

func (e *ValidationError) Error() string

Error implements the error interface.

func (*ValidationError) Unwrap

func (e *ValidationError) Unwrap() error

Unwrap implements the errors.Wrapper interface.

type Value

type Value = ent.Value

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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