ent

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2021 License: GPL-3.0 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.
	TypeAction = "Action"
	TypeBot    = "Bot"
	TypeGroup  = "Group"
	TypeHost   = "Host"
	TypeUser   = "User"
)

Variables

This section is empty.

Functions

func IsConstraintError

func IsConstraintError(err error) bool

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

func IsNotFound

func IsNotFound(err error) bool

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

func IsNotLoaded

func IsNotLoaded(err error) bool

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

func IsNotSingular

func IsNotSingular(err error) bool

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

func IsValidationError

func IsValidationError(err error) bool

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

func MaskNotFound

func MaskNotFound(err error) error

MaskNotFound masks not found error.

func NewContext

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

NewContext returns a new context with the given Client attached.

func NewTxContext

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

NewTxContext returns a new context with the given Tx attached.

Types

type Action

type Action struct {

	// ID of the ent.
	ID int `json:"id,omitempty"`
	// UUID holds the value of the "uuid" field.
	UUID string `json:"uuid,omitempty"`
	// Mode holds the value of the "mode" field.
	Mode string `json:"mode,omitempty"`
	// Args holds the value of the "args" field.
	Args string `json:"args,omitempty"`
	// Queued holds the value of the "queued" field.
	Queued bool `json:"queued,omitempty"`
	// Responded holds the value of the "responded" field.
	Responded bool `json:"responded,omitempty"`
	// Result holds the value of the "result" field.
	Result string `json:"result,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the ActionQuery when eager-loading is set.
	Edges ActionEdges `json:"edges"`
	// contains filtered or unexported fields
}

Action is the model entity for the Action schema.

func (*Action) QueryTargeting

func (a *Action) QueryTargeting() *HostQuery

QueryTargeting queries the "targeting" edge of the Action entity.

func (*Action) String

func (a *Action) String() string

String implements the fmt.Stringer.

func (*Action) Unwrap

func (a *Action) Unwrap() *Action

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

func (a *Action) Update() *ActionUpdateOne

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

type ActionClient

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

ActionClient is a client for the Action schema.

func NewActionClient

func NewActionClient(c config) *ActionClient

NewActionClient returns a client for the Action from the given config.

func (*ActionClient) Create

func (c *ActionClient) Create() *ActionCreate

Create returns a create builder for Action.

func (*ActionClient) CreateBulk

func (c *ActionClient) CreateBulk(builders ...*ActionCreate) *ActionCreateBulk

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

func (*ActionClient) Delete

func (c *ActionClient) Delete() *ActionDelete

Delete returns a delete builder for Action.

func (*ActionClient) DeleteOne

func (c *ActionClient) DeleteOne(a *Action) *ActionDeleteOne

DeleteOne returns a delete builder for the given entity.

func (*ActionClient) DeleteOneID

func (c *ActionClient) DeleteOneID(id int) *ActionDeleteOne

DeleteOneID returns a delete builder for the given id.

func (*ActionClient) Get

func (c *ActionClient) Get(ctx context.Context, id int) (*Action, error)

Get returns a Action entity by its id.

func (*ActionClient) GetX

func (c *ActionClient) GetX(ctx context.Context, id int) *Action

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

func (*ActionClient) Hooks

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

Hooks returns the client hooks.

func (*ActionClient) Query

func (c *ActionClient) Query() *ActionQuery

Query returns a query builder for Action.

func (*ActionClient) QueryTargeting

func (c *ActionClient) QueryTargeting(a *Action) *HostQuery

QueryTargeting queries the targeting edge of a Action.

func (*ActionClient) Update

func (c *ActionClient) Update() *ActionUpdate

Update returns an update builder for Action.

func (*ActionClient) UpdateOne

func (c *ActionClient) UpdateOne(a *Action) *ActionUpdateOne

UpdateOne returns an update builder for the given entity.

func (*ActionClient) UpdateOneID

func (c *ActionClient) UpdateOneID(id int) *ActionUpdateOne

UpdateOneID returns an update builder for the given id.

func (*ActionClient) Use

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

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

type ActionCreate

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

ActionCreate is the builder for creating a Action entity.

func (*ActionCreate) Mutation

func (ac *ActionCreate) Mutation() *ActionMutation

Mutation returns the ActionMutation object of the builder.

func (*ActionCreate) Save

func (ac *ActionCreate) Save(ctx context.Context) (*Action, error)

Save creates the Action in the database.

func (*ActionCreate) SaveX

func (ac *ActionCreate) SaveX(ctx context.Context) *Action

SaveX calls Save and panics if Save returns an error.

func (*ActionCreate) SetArgs

func (ac *ActionCreate) SetArgs(s string) *ActionCreate

SetArgs sets the "args" field.

func (*ActionCreate) SetMode

func (ac *ActionCreate) SetMode(s string) *ActionCreate

SetMode sets the "mode" field.

func (*ActionCreate) SetNillableQueued

func (ac *ActionCreate) SetNillableQueued(b *bool) *ActionCreate

SetNillableQueued sets the "queued" field if the given value is not nil.

func (*ActionCreate) SetNillableResponded

func (ac *ActionCreate) SetNillableResponded(b *bool) *ActionCreate

SetNillableResponded sets the "responded" field if the given value is not nil.

func (*ActionCreate) SetNillableResult

func (ac *ActionCreate) SetNillableResult(s *string) *ActionCreate

SetNillableResult sets the "result" field if the given value is not nil.

func (*ActionCreate) SetNillableTargetingID

func (ac *ActionCreate) SetNillableTargetingID(id *int) *ActionCreate

SetNillableTargetingID sets the "targeting" edge to the Host entity by ID if the given value is not nil.

func (*ActionCreate) SetQueued

func (ac *ActionCreate) SetQueued(b bool) *ActionCreate

SetQueued sets the "queued" field.

func (*ActionCreate) SetResponded

func (ac *ActionCreate) SetResponded(b bool) *ActionCreate

SetResponded sets the "responded" field.

func (*ActionCreate) SetResult

func (ac *ActionCreate) SetResult(s string) *ActionCreate

SetResult sets the "result" field.

func (*ActionCreate) SetTargeting

func (ac *ActionCreate) SetTargeting(h *Host) *ActionCreate

SetTargeting sets the "targeting" edge to the Host entity.

func (*ActionCreate) SetTargetingID

func (ac *ActionCreate) SetTargetingID(id int) *ActionCreate

SetTargetingID sets the "targeting" edge to the Host entity by ID.

func (*ActionCreate) SetUUID

func (ac *ActionCreate) SetUUID(s string) *ActionCreate

SetUUID sets the "uuid" field.

type ActionCreateBulk

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

ActionCreateBulk is the builder for creating many Action entities in bulk.

func (*ActionCreateBulk) Save

func (acb *ActionCreateBulk) Save(ctx context.Context) ([]*Action, error)

Save creates the Action entities in the database.

func (*ActionCreateBulk) SaveX

func (acb *ActionCreateBulk) SaveX(ctx context.Context) []*Action

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

type ActionDelete

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

ActionDelete is the builder for deleting a Action entity.

func (*ActionDelete) Exec

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

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

func (*ActionDelete) ExecX

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

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

func (*ActionDelete) Where

func (ad *ActionDelete) Where(ps ...predicate.Action) *ActionDelete

Where adds a new predicate to the ActionDelete builder.

type ActionDeleteOne

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

ActionDeleteOne is the builder for deleting a single Action entity.

func (*ActionDeleteOne) Exec

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

Exec executes the deletion query.

func (*ActionDeleteOne) ExecX

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

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

type ActionEdges

type ActionEdges struct {
	// Targeting holds the value of the targeting edge.
	Targeting *Host `json:"targeting,omitempty"`
	// contains filtered or unexported fields
}

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

func (ActionEdges) TargetingOrErr

func (e ActionEdges) TargetingOrErr() (*Host, error)

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

type ActionGroupBy

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

ActionGroupBy is the group-by builder for Action entities.

func (*ActionGroupBy) Aggregate

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

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

func (*ActionGroupBy) Bool

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

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

func (*ActionGroupBy) BoolX

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

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

func (*ActionGroupBy) Bools

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

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

func (*ActionGroupBy) BoolsX

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

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

func (*ActionGroupBy) Float64

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

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

func (*ActionGroupBy) Float64X

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

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

func (*ActionGroupBy) Float64s

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

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

func (*ActionGroupBy) Float64sX

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

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

func (*ActionGroupBy) Int

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

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

func (*ActionGroupBy) IntX

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

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

func (*ActionGroupBy) Ints

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

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

func (*ActionGroupBy) IntsX

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

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

func (*ActionGroupBy) Scan

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

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

func (*ActionGroupBy) ScanX

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

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

func (*ActionGroupBy) String

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

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

func (*ActionGroupBy) StringX

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

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

func (*ActionGroupBy) Strings

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

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

func (*ActionGroupBy) StringsX

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

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

type ActionMutation

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

ActionMutation represents an operation that mutates the Action nodes in the graph.

func (*ActionMutation) AddField

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

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

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

func (*ActionMutation) AddedField

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

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

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

func (*ActionMutation) AddedIDs

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

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

func (*ActionMutation) Args

func (m *ActionMutation) Args() (r string, exists bool)

Args returns the value of the "args" field in the mutation.

func (*ActionMutation) ClearEdge

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

func (m *ActionMutation) 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 (*ActionMutation) ClearTargeting

func (m *ActionMutation) ClearTargeting()

ClearTargeting clears the "targeting" edge to the Host entity.

func (*ActionMutation) ClearedEdges

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

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

func (*ActionMutation) ClearedFields

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

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

func (ActionMutation) Client

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

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

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

func (*ActionMutation) Field

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

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

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

func (*ActionMutation) Fields

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

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

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

func (*ActionMutation) Mode

func (m *ActionMutation) Mode() (r string, exists bool)

Mode returns the value of the "mode" field in the mutation.

func (*ActionMutation) OldArgs

func (m *ActionMutation) OldArgs(ctx context.Context) (v string, err error)

OldArgs returns the old "args" field's value of the Action entity. If the Action 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 (*ActionMutation) OldField

func (m *ActionMutation) 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 (*ActionMutation) OldMode

func (m *ActionMutation) OldMode(ctx context.Context) (v string, err error)

OldMode returns the old "mode" field's value of the Action entity. If the Action 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 (*ActionMutation) OldQueued

func (m *ActionMutation) OldQueued(ctx context.Context) (v bool, err error)

OldQueued returns the old "queued" field's value of the Action entity. If the Action 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 (*ActionMutation) OldResponded

func (m *ActionMutation) OldResponded(ctx context.Context) (v bool, err error)

OldResponded returns the old "responded" field's value of the Action entity. If the Action 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 (*ActionMutation) OldResult

func (m *ActionMutation) OldResult(ctx context.Context) (v string, err error)

OldResult returns the old "result" field's value of the Action entity. If the Action 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 (*ActionMutation) OldUUID

func (m *ActionMutation) OldUUID(ctx context.Context) (v string, err error)

OldUUID returns the old "uuid" field's value of the Action entity. If the Action 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 (*ActionMutation) Op

func (m *ActionMutation) Op() Op

Op returns the operation name.

func (*ActionMutation) Queued

func (m *ActionMutation) Queued() (r bool, exists bool)

Queued returns the value of the "queued" field in the mutation.

func (*ActionMutation) RemovedEdges

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

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

func (*ActionMutation) RemovedIDs

func (m *ActionMutation) 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 (*ActionMutation) ResetArgs

func (m *ActionMutation) ResetArgs()

ResetArgs resets all changes to the "args" field.

func (*ActionMutation) ResetEdge

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

func (m *ActionMutation) 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 (*ActionMutation) ResetMode

func (m *ActionMutation) ResetMode()

ResetMode resets all changes to the "mode" field.

func (*ActionMutation) ResetQueued

func (m *ActionMutation) ResetQueued()

ResetQueued resets all changes to the "queued" field.

func (*ActionMutation) ResetResponded

func (m *ActionMutation) ResetResponded()

ResetResponded resets all changes to the "responded" field.

func (*ActionMutation) ResetResult

func (m *ActionMutation) ResetResult()

ResetResult resets all changes to the "result" field.

func (*ActionMutation) ResetTargeting

func (m *ActionMutation) ResetTargeting()

ResetTargeting resets all changes to the "targeting" edge.

func (*ActionMutation) ResetUUID

func (m *ActionMutation) ResetUUID()

ResetUUID resets all changes to the "uuid" field.

func (*ActionMutation) Responded

func (m *ActionMutation) Responded() (r bool, exists bool)

Responded returns the value of the "responded" field in the mutation.

func (*ActionMutation) Result

func (m *ActionMutation) Result() (r string, exists bool)

Result returns the value of the "result" field in the mutation.

func (*ActionMutation) SetArgs

func (m *ActionMutation) SetArgs(s string)

SetArgs sets the "args" field.

func (*ActionMutation) SetField

func (m *ActionMutation) 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 (*ActionMutation) SetMode

func (m *ActionMutation) SetMode(s string)

SetMode sets the "mode" field.

func (*ActionMutation) SetQueued

func (m *ActionMutation) SetQueued(b bool)

SetQueued sets the "queued" field.

func (*ActionMutation) SetResponded

func (m *ActionMutation) SetResponded(b bool)

SetResponded sets the "responded" field.

func (*ActionMutation) SetResult

func (m *ActionMutation) SetResult(s string)

SetResult sets the "result" field.

func (*ActionMutation) SetTargetingID

func (m *ActionMutation) SetTargetingID(id int)

SetTargetingID sets the "targeting" edge to the Host entity by id.

func (*ActionMutation) SetUUID

func (m *ActionMutation) SetUUID(s string)

SetUUID sets the "uuid" field.

func (*ActionMutation) TargetingCleared

func (m *ActionMutation) TargetingCleared() bool

TargetingCleared returns if the "targeting" edge to the Host entity was cleared.

func (*ActionMutation) TargetingID

func (m *ActionMutation) TargetingID() (id int, exists bool)

TargetingID returns the "targeting" edge ID in the mutation.

func (*ActionMutation) TargetingIDs

func (m *ActionMutation) TargetingIDs() (ids []int)

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

func (ActionMutation) Tx

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

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

func (*ActionMutation) Type

func (m *ActionMutation) Type() string

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

func (*ActionMutation) UUID

func (m *ActionMutation) UUID() (r string, exists bool)

UUID returns the value of the "uuid" field in the mutation.

type ActionQuery

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

ActionQuery is the builder for querying Action entities.

func (*ActionQuery) All

func (aq *ActionQuery) All(ctx context.Context) ([]*Action, error)

All executes the query and returns a list of Actions.

func (*ActionQuery) AllX

func (aq *ActionQuery) AllX(ctx context.Context) []*Action

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

func (*ActionQuery) Clone

func (aq *ActionQuery) Clone() *ActionQuery

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

func (*ActionQuery) Count

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

Count returns the count of the given query.

func (*ActionQuery) CountX

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

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

func (*ActionQuery) Exist

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

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

func (*ActionQuery) ExistX

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

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

func (*ActionQuery) First

func (aq *ActionQuery) First(ctx context.Context) (*Action, error)

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

func (*ActionQuery) FirstID

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

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

func (*ActionQuery) FirstIDX

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

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

func (*ActionQuery) FirstX

func (aq *ActionQuery) FirstX(ctx context.Context) *Action

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

func (*ActionQuery) GroupBy

func (aq *ActionQuery) GroupBy(field string, fields ...string) *ActionGroupBy

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

client.Action.Query().
	GroupBy(action.FieldUUID).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*ActionQuery) IDs

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

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

func (*ActionQuery) IDsX

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

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

func (*ActionQuery) Limit

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

Limit adds a limit step to the query.

func (*ActionQuery) Offset

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

Offset adds an offset step to the query.

func (*ActionQuery) Only

func (aq *ActionQuery) Only(ctx context.Context) (*Action, error)

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

func (*ActionQuery) OnlyID

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

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

func (*ActionQuery) OnlyIDX

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

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

func (*ActionQuery) OnlyX

func (aq *ActionQuery) OnlyX(ctx context.Context) *Action

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

func (*ActionQuery) Order

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

Order adds an order step to the query.

func (*ActionQuery) QueryTargeting

func (aq *ActionQuery) QueryTargeting() *HostQuery

QueryTargeting chains the current query on the "targeting" edge.

func (*ActionQuery) Select

func (aq *ActionQuery) Select(field string, fields ...string) *ActionSelect

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

client.Action.Query().
	Select(action.FieldUUID).
	Scan(ctx, &v)

func (*ActionQuery) Where

func (aq *ActionQuery) Where(ps ...predicate.Action) *ActionQuery

Where adds a new predicate for the ActionQuery builder.

func (*ActionQuery) WithTargeting

func (aq *ActionQuery) WithTargeting(opts ...func(*HostQuery)) *ActionQuery

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

type ActionSelect

type ActionSelect struct {
	*ActionQuery
	// contains filtered or unexported fields
}

ActionSelect is the builder for selecting fields of Action entities.

func (*ActionSelect) Bool

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

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

func (*ActionSelect) BoolX

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

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

func (*ActionSelect) Bools

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

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

func (*ActionSelect) BoolsX

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

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

func (*ActionSelect) Float64

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

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

func (*ActionSelect) Float64X

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

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

func (*ActionSelect) Float64s

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

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

func (*ActionSelect) Float64sX

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

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

func (*ActionSelect) Int

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

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

func (*ActionSelect) IntX

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

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

func (*ActionSelect) Ints

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

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

func (*ActionSelect) IntsX

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

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

func (*ActionSelect) Scan

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

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

func (*ActionSelect) ScanX

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

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

func (*ActionSelect) String

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

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

func (*ActionSelect) StringX

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

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

func (*ActionSelect) Strings

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

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

func (*ActionSelect) StringsX

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

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

type ActionUpdate

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

ActionUpdate is the builder for updating Action entities.

func (*ActionUpdate) ClearTargeting

func (au *ActionUpdate) ClearTargeting() *ActionUpdate

ClearTargeting clears the "targeting" edge to the Host entity.

func (*ActionUpdate) Exec

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

Exec executes the query.

func (*ActionUpdate) ExecX

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

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

func (*ActionUpdate) Mutation

func (au *ActionUpdate) Mutation() *ActionMutation

Mutation returns the ActionMutation object of the builder.

func (*ActionUpdate) Save

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

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

func (*ActionUpdate) SaveX

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

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

func (*ActionUpdate) SetArgs

func (au *ActionUpdate) SetArgs(s string) *ActionUpdate

SetArgs sets the "args" field.

func (*ActionUpdate) SetMode

func (au *ActionUpdate) SetMode(s string) *ActionUpdate

SetMode sets the "mode" field.

func (*ActionUpdate) SetNillableQueued

func (au *ActionUpdate) SetNillableQueued(b *bool) *ActionUpdate

SetNillableQueued sets the "queued" field if the given value is not nil.

func (*ActionUpdate) SetNillableResponded

func (au *ActionUpdate) SetNillableResponded(b *bool) *ActionUpdate

SetNillableResponded sets the "responded" field if the given value is not nil.

func (*ActionUpdate) SetNillableResult

func (au *ActionUpdate) SetNillableResult(s *string) *ActionUpdate

SetNillableResult sets the "result" field if the given value is not nil.

func (*ActionUpdate) SetNillableTargetingID

func (au *ActionUpdate) SetNillableTargetingID(id *int) *ActionUpdate

SetNillableTargetingID sets the "targeting" edge to the Host entity by ID if the given value is not nil.

func (*ActionUpdate) SetQueued

func (au *ActionUpdate) SetQueued(b bool) *ActionUpdate

SetQueued sets the "queued" field.

func (*ActionUpdate) SetResponded

func (au *ActionUpdate) SetResponded(b bool) *ActionUpdate

SetResponded sets the "responded" field.

func (*ActionUpdate) SetResult

func (au *ActionUpdate) SetResult(s string) *ActionUpdate

SetResult sets the "result" field.

func (*ActionUpdate) SetTargeting

func (au *ActionUpdate) SetTargeting(h *Host) *ActionUpdate

SetTargeting sets the "targeting" edge to the Host entity.

func (*ActionUpdate) SetTargetingID

func (au *ActionUpdate) SetTargetingID(id int) *ActionUpdate

SetTargetingID sets the "targeting" edge to the Host entity by ID.

func (*ActionUpdate) SetUUID

func (au *ActionUpdate) SetUUID(s string) *ActionUpdate

SetUUID sets the "uuid" field.

func (*ActionUpdate) Where

func (au *ActionUpdate) Where(ps ...predicate.Action) *ActionUpdate

Where adds a new predicate for the ActionUpdate builder.

type ActionUpdateOne

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

ActionUpdateOne is the builder for updating a single Action entity.

func (*ActionUpdateOne) ClearTargeting

func (auo *ActionUpdateOne) ClearTargeting() *ActionUpdateOne

ClearTargeting clears the "targeting" edge to the Host entity.

func (*ActionUpdateOne) Exec

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

Exec executes the query on the entity.

func (*ActionUpdateOne) ExecX

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

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

func (*ActionUpdateOne) Mutation

func (auo *ActionUpdateOne) Mutation() *ActionMutation

Mutation returns the ActionMutation object of the builder.

func (*ActionUpdateOne) Save

func (auo *ActionUpdateOne) Save(ctx context.Context) (*Action, error)

Save executes the query and returns the updated Action entity.

func (*ActionUpdateOne) SaveX

func (auo *ActionUpdateOne) SaveX(ctx context.Context) *Action

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

func (*ActionUpdateOne) SetArgs

func (auo *ActionUpdateOne) SetArgs(s string) *ActionUpdateOne

SetArgs sets the "args" field.

func (*ActionUpdateOne) SetMode

func (auo *ActionUpdateOne) SetMode(s string) *ActionUpdateOne

SetMode sets the "mode" field.

func (*ActionUpdateOne) SetNillableQueued

func (auo *ActionUpdateOne) SetNillableQueued(b *bool) *ActionUpdateOne

SetNillableQueued sets the "queued" field if the given value is not nil.

func (*ActionUpdateOne) SetNillableResponded

func (auo *ActionUpdateOne) SetNillableResponded(b *bool) *ActionUpdateOne

SetNillableResponded sets the "responded" field if the given value is not nil.

func (*ActionUpdateOne) SetNillableResult

func (auo *ActionUpdateOne) SetNillableResult(s *string) *ActionUpdateOne

SetNillableResult sets the "result" field if the given value is not nil.

func (*ActionUpdateOne) SetNillableTargetingID

func (auo *ActionUpdateOne) SetNillableTargetingID(id *int) *ActionUpdateOne

SetNillableTargetingID sets the "targeting" edge to the Host entity by ID if the given value is not nil.

func (*ActionUpdateOne) SetQueued

func (auo *ActionUpdateOne) SetQueued(b bool) *ActionUpdateOne

SetQueued sets the "queued" field.

func (*ActionUpdateOne) SetResponded

func (auo *ActionUpdateOne) SetResponded(b bool) *ActionUpdateOne

SetResponded sets the "responded" field.

func (*ActionUpdateOne) SetResult

func (auo *ActionUpdateOne) SetResult(s string) *ActionUpdateOne

SetResult sets the "result" field.

func (*ActionUpdateOne) SetTargeting

func (auo *ActionUpdateOne) SetTargeting(h *Host) *ActionUpdateOne

SetTargeting sets the "targeting" edge to the Host entity.

func (*ActionUpdateOne) SetTargetingID

func (auo *ActionUpdateOne) SetTargetingID(id int) *ActionUpdateOne

SetTargetingID sets the "targeting" edge to the Host entity by ID.

func (*ActionUpdateOne) SetUUID

func (auo *ActionUpdateOne) SetUUID(s string) *ActionUpdateOne

SetUUID sets the "uuid" field.

type Actions

type Actions []*Action

Actions is a parsable slice of Action.

type AggregateFunc

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

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

func As

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

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

func Count

func Count() AggregateFunc

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

func Max

func Max(field string) AggregateFunc

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

func Mean

func Mean(field string) AggregateFunc

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

func Min

func Min(field string) AggregateFunc

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

func Sum

func Sum(field string) AggregateFunc

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

type Bot

type Bot struct {

	// ID of the ent.
	ID int `json:"id,omitempty"`
	// UUID holds the value of the "uuid" field.
	UUID string `json:"uuid,omitempty"`
	// Interval holds the value of the "interval" field.
	Interval int `json:"interval,omitempty"`
	// Delta holds the value of the "delta" field.
	Delta int `json:"delta,omitempty"`
	// LastSeen holds the value of the "lastSeen" field.
	LastSeen int `json:"lastSeen,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the BotQuery when eager-loading is set.
	Edges BotEdges `json:"edges"`
	// contains filtered or unexported fields
}

Bot is the model entity for the Bot schema.

func (*Bot) QueryInfecting

func (b *Bot) QueryInfecting() *HostQuery

QueryInfecting queries the "infecting" edge of the Bot entity.

func (*Bot) String

func (b *Bot) String() string

String implements the fmt.Stringer.

func (*Bot) Unwrap

func (b *Bot) Unwrap() *Bot

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

func (b *Bot) Update() *BotUpdateOne

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

type BotClient

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

BotClient is a client for the Bot schema.

func NewBotClient

func NewBotClient(c config) *BotClient

NewBotClient returns a client for the Bot from the given config.

func (*BotClient) Create

func (c *BotClient) Create() *BotCreate

Create returns a create builder for Bot.

func (*BotClient) CreateBulk

func (c *BotClient) CreateBulk(builders ...*BotCreate) *BotCreateBulk

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

func (*BotClient) Delete

func (c *BotClient) Delete() *BotDelete

Delete returns a delete builder for Bot.

func (*BotClient) DeleteOne

func (c *BotClient) DeleteOne(b *Bot) *BotDeleteOne

DeleteOne returns a delete builder for the given entity.

func (*BotClient) DeleteOneID

func (c *BotClient) DeleteOneID(id int) *BotDeleteOne

DeleteOneID returns a delete builder for the given id.

func (*BotClient) Get

func (c *BotClient) Get(ctx context.Context, id int) (*Bot, error)

Get returns a Bot entity by its id.

func (*BotClient) GetX

func (c *BotClient) GetX(ctx context.Context, id int) *Bot

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

func (*BotClient) Hooks

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

Hooks returns the client hooks.

func (*BotClient) Query

func (c *BotClient) Query() *BotQuery

Query returns a query builder for Bot.

func (*BotClient) QueryInfecting

func (c *BotClient) QueryInfecting(b *Bot) *HostQuery

QueryInfecting queries the infecting edge of a Bot.

func (*BotClient) Update

func (c *BotClient) Update() *BotUpdate

Update returns an update builder for Bot.

func (*BotClient) UpdateOne

func (c *BotClient) UpdateOne(b *Bot) *BotUpdateOne

UpdateOne returns an update builder for the given entity.

func (*BotClient) UpdateOneID

func (c *BotClient) UpdateOneID(id int) *BotUpdateOne

UpdateOneID returns an update builder for the given id.

func (*BotClient) Use

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

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

type BotCreate

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

BotCreate is the builder for creating a Bot entity.

func (*BotCreate) Mutation

func (bc *BotCreate) Mutation() *BotMutation

Mutation returns the BotMutation object of the builder.

func (*BotCreate) Save

func (bc *BotCreate) Save(ctx context.Context) (*Bot, error)

Save creates the Bot in the database.

func (*BotCreate) SaveX

func (bc *BotCreate) SaveX(ctx context.Context) *Bot

SaveX calls Save and panics if Save returns an error.

func (*BotCreate) SetDelta

func (bc *BotCreate) SetDelta(i int) *BotCreate

SetDelta sets the "delta" field.

func (*BotCreate) SetInfecting

func (bc *BotCreate) SetInfecting(h *Host) *BotCreate

SetInfecting sets the "infecting" edge to the Host entity.

func (*BotCreate) SetInfectingID

func (bc *BotCreate) SetInfectingID(id int) *BotCreate

SetInfectingID sets the "infecting" edge to the Host entity by ID.

func (*BotCreate) SetInterval

func (bc *BotCreate) SetInterval(i int) *BotCreate

SetInterval sets the "interval" field.

func (*BotCreate) SetLastSeen

func (bc *BotCreate) SetLastSeen(i int) *BotCreate

SetLastSeen sets the "lastSeen" field.

func (*BotCreate) SetNillableInfectingID

func (bc *BotCreate) SetNillableInfectingID(id *int) *BotCreate

SetNillableInfectingID sets the "infecting" edge to the Host entity by ID if the given value is not nil.

func (*BotCreate) SetNillableLastSeen

func (bc *BotCreate) SetNillableLastSeen(i *int) *BotCreate

SetNillableLastSeen sets the "lastSeen" field if the given value is not nil.

func (*BotCreate) SetUUID

func (bc *BotCreate) SetUUID(s string) *BotCreate

SetUUID sets the "uuid" field.

type BotCreateBulk

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

BotCreateBulk is the builder for creating many Bot entities in bulk.

func (*BotCreateBulk) Save

func (bcb *BotCreateBulk) Save(ctx context.Context) ([]*Bot, error)

Save creates the Bot entities in the database.

func (*BotCreateBulk) SaveX

func (bcb *BotCreateBulk) SaveX(ctx context.Context) []*Bot

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

type BotDelete

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

BotDelete is the builder for deleting a Bot entity.

func (*BotDelete) Exec

func (bd *BotDelete) Exec(ctx context.Context) (int, error)

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

func (*BotDelete) ExecX

func (bd *BotDelete) ExecX(ctx context.Context) int

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

func (*BotDelete) Where

func (bd *BotDelete) Where(ps ...predicate.Bot) *BotDelete

Where adds a new predicate to the BotDelete builder.

type BotDeleteOne

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

BotDeleteOne is the builder for deleting a single Bot entity.

func (*BotDeleteOne) Exec

func (bdo *BotDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*BotDeleteOne) ExecX

func (bdo *BotDeleteOne) ExecX(ctx context.Context)

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

type BotEdges

type BotEdges struct {
	// Infecting holds the value of the infecting edge.
	Infecting *Host `json:"infecting,omitempty"`
	// contains filtered or unexported fields
}

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

func (BotEdges) InfectingOrErr

func (e BotEdges) InfectingOrErr() (*Host, error)

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

type BotGroupBy

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

BotGroupBy is the group-by builder for Bot entities.

func (*BotGroupBy) Aggregate

func (bgb *BotGroupBy) Aggregate(fns ...AggregateFunc) *BotGroupBy

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

func (*BotGroupBy) Bool

func (bgb *BotGroupBy) Bool(ctx context.Context) (_ bool, err error)

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

func (*BotGroupBy) BoolX

func (bgb *BotGroupBy) BoolX(ctx context.Context) bool

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

func (*BotGroupBy) Bools

func (bgb *BotGroupBy) Bools(ctx context.Context) ([]bool, error)

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

func (*BotGroupBy) BoolsX

func (bgb *BotGroupBy) BoolsX(ctx context.Context) []bool

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

func (*BotGroupBy) Float64

func (bgb *BotGroupBy) Float64(ctx context.Context) (_ float64, err error)

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

func (*BotGroupBy) Float64X

func (bgb *BotGroupBy) Float64X(ctx context.Context) float64

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

func (*BotGroupBy) Float64s

func (bgb *BotGroupBy) Float64s(ctx context.Context) ([]float64, error)

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

func (*BotGroupBy) Float64sX

func (bgb *BotGroupBy) Float64sX(ctx context.Context) []float64

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

func (*BotGroupBy) Int

func (bgb *BotGroupBy) Int(ctx context.Context) (_ int, err error)

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

func (*BotGroupBy) IntX

func (bgb *BotGroupBy) IntX(ctx context.Context) int

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

func (*BotGroupBy) Ints

func (bgb *BotGroupBy) Ints(ctx context.Context) ([]int, error)

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

func (*BotGroupBy) IntsX

func (bgb *BotGroupBy) IntsX(ctx context.Context) []int

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

func (*BotGroupBy) Scan

func (bgb *BotGroupBy) Scan(ctx context.Context, v interface{}) error

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

func (*BotGroupBy) ScanX

func (bgb *BotGroupBy) ScanX(ctx context.Context, v interface{})

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

func (*BotGroupBy) String

func (bgb *BotGroupBy) String(ctx context.Context) (_ string, err error)

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

func (*BotGroupBy) StringX

func (bgb *BotGroupBy) StringX(ctx context.Context) string

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

func (*BotGroupBy) Strings

func (bgb *BotGroupBy) Strings(ctx context.Context) ([]string, error)

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

func (*BotGroupBy) StringsX

func (bgb *BotGroupBy) StringsX(ctx context.Context) []string

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

type BotMutation

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

BotMutation represents an operation that mutates the Bot nodes in the graph.

func (*BotMutation) AddDelta

func (m *BotMutation) AddDelta(i int)

AddDelta adds i to the "delta" field.

func (*BotMutation) AddField

func (m *BotMutation) 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 (*BotMutation) AddInterval

func (m *BotMutation) AddInterval(i int)

AddInterval adds i to the "interval" field.

func (*BotMutation) AddLastSeen

func (m *BotMutation) AddLastSeen(i int)

AddLastSeen adds i to the "lastSeen" field.

func (*BotMutation) AddedDelta

func (m *BotMutation) AddedDelta() (r int, exists bool)

AddedDelta returns the value that was added to the "delta" field in this mutation.

func (*BotMutation) AddedEdges

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

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

func (*BotMutation) AddedField

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

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

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

func (*BotMutation) AddedIDs

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

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

func (*BotMutation) AddedInterval

func (m *BotMutation) AddedInterval() (r int, exists bool)

AddedInterval returns the value that was added to the "interval" field in this mutation.

func (*BotMutation) AddedLastSeen

func (m *BotMutation) AddedLastSeen() (r int, exists bool)

AddedLastSeen returns the value that was added to the "lastSeen" field in this mutation.

func (*BotMutation) ClearEdge

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

func (m *BotMutation) 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 (*BotMutation) ClearInfecting

func (m *BotMutation) ClearInfecting()

ClearInfecting clears the "infecting" edge to the Host entity.

func (*BotMutation) ClearedEdges

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

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

func (*BotMutation) ClearedFields

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

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

func (BotMutation) Client

func (m BotMutation) 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 (*BotMutation) Delta

func (m *BotMutation) Delta() (r int, exists bool)

Delta returns the value of the "delta" field in the mutation.

func (*BotMutation) EdgeCleared

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

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

func (*BotMutation) Field

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

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

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

func (*BotMutation) Fields

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

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

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

func (*BotMutation) InfectingCleared

func (m *BotMutation) InfectingCleared() bool

InfectingCleared returns if the "infecting" edge to the Host entity was cleared.

func (*BotMutation) InfectingID

func (m *BotMutation) InfectingID() (id int, exists bool)

InfectingID returns the "infecting" edge ID in the mutation.

func (*BotMutation) InfectingIDs

func (m *BotMutation) InfectingIDs() (ids []int)

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

func (*BotMutation) Interval

func (m *BotMutation) Interval() (r int, exists bool)

Interval returns the value of the "interval" field in the mutation.

func (*BotMutation) LastSeen

func (m *BotMutation) LastSeen() (r int, exists bool)

LastSeen returns the value of the "lastSeen" field in the mutation.

func (*BotMutation) OldDelta

func (m *BotMutation) OldDelta(ctx context.Context) (v int, err error)

OldDelta returns the old "delta" field's value of the Bot entity. If the Bot 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 (*BotMutation) OldField

func (m *BotMutation) 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 (*BotMutation) OldInterval

func (m *BotMutation) OldInterval(ctx context.Context) (v int, err error)

OldInterval returns the old "interval" field's value of the Bot entity. If the Bot 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 (*BotMutation) OldLastSeen

func (m *BotMutation) OldLastSeen(ctx context.Context) (v int, err error)

OldLastSeen returns the old "lastSeen" field's value of the Bot entity. If the Bot 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 (*BotMutation) OldUUID

func (m *BotMutation) OldUUID(ctx context.Context) (v string, err error)

OldUUID returns the old "uuid" field's value of the Bot entity. If the Bot 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 (*BotMutation) Op

func (m *BotMutation) Op() Op

Op returns the operation name.

func (*BotMutation) RemovedEdges

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

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

func (*BotMutation) RemovedIDs

func (m *BotMutation) 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 (*BotMutation) ResetDelta

func (m *BotMutation) ResetDelta()

ResetDelta resets all changes to the "delta" field.

func (*BotMutation) ResetEdge

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

func (m *BotMutation) 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 (*BotMutation) ResetInfecting

func (m *BotMutation) ResetInfecting()

ResetInfecting resets all changes to the "infecting" edge.

func (*BotMutation) ResetInterval

func (m *BotMutation) ResetInterval()

ResetInterval resets all changes to the "interval" field.

func (*BotMutation) ResetLastSeen

func (m *BotMutation) ResetLastSeen()

ResetLastSeen resets all changes to the "lastSeen" field.

func (*BotMutation) ResetUUID

func (m *BotMutation) ResetUUID()

ResetUUID resets all changes to the "uuid" field.

func (*BotMutation) SetDelta

func (m *BotMutation) SetDelta(i int)

SetDelta sets the "delta" field.

func (*BotMutation) SetField

func (m *BotMutation) 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 (*BotMutation) SetInfectingID

func (m *BotMutation) SetInfectingID(id int)

SetInfectingID sets the "infecting" edge to the Host entity by id.

func (*BotMutation) SetInterval

func (m *BotMutation) SetInterval(i int)

SetInterval sets the "interval" field.

func (*BotMutation) SetLastSeen

func (m *BotMutation) SetLastSeen(i int)

SetLastSeen sets the "lastSeen" field.

func (*BotMutation) SetUUID

func (m *BotMutation) SetUUID(s string)

SetUUID sets the "uuid" field.

func (BotMutation) Tx

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

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

func (*BotMutation) Type

func (m *BotMutation) Type() string

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

func (*BotMutation) UUID

func (m *BotMutation) UUID() (r string, exists bool)

UUID returns the value of the "uuid" field in the mutation.

type BotQuery

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

BotQuery is the builder for querying Bot entities.

func (*BotQuery) All

func (bq *BotQuery) All(ctx context.Context) ([]*Bot, error)

All executes the query and returns a list of Bots.

func (*BotQuery) AllX

func (bq *BotQuery) AllX(ctx context.Context) []*Bot

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

func (*BotQuery) Clone

func (bq *BotQuery) Clone() *BotQuery

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

func (*BotQuery) Count

func (bq *BotQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*BotQuery) CountX

func (bq *BotQuery) CountX(ctx context.Context) int

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

func (*BotQuery) Exist

func (bq *BotQuery) Exist(ctx context.Context) (bool, error)

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

func (*BotQuery) ExistX

func (bq *BotQuery) ExistX(ctx context.Context) bool

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

func (*BotQuery) First

func (bq *BotQuery) First(ctx context.Context) (*Bot, error)

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

func (*BotQuery) FirstID

func (bq *BotQuery) FirstID(ctx context.Context) (id int, err error)

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

func (*BotQuery) FirstIDX

func (bq *BotQuery) FirstIDX(ctx context.Context) int

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

func (*BotQuery) FirstX

func (bq *BotQuery) FirstX(ctx context.Context) *Bot

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

func (*BotQuery) GroupBy

func (bq *BotQuery) GroupBy(field string, fields ...string) *BotGroupBy

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

client.Bot.Query().
	GroupBy(bot.FieldUUID).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*BotQuery) IDs

func (bq *BotQuery) IDs(ctx context.Context) ([]int, error)

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

func (*BotQuery) IDsX

func (bq *BotQuery) IDsX(ctx context.Context) []int

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

func (*BotQuery) Limit

func (bq *BotQuery) Limit(limit int) *BotQuery

Limit adds a limit step to the query.

func (*BotQuery) Offset

func (bq *BotQuery) Offset(offset int) *BotQuery

Offset adds an offset step to the query.

func (*BotQuery) Only

func (bq *BotQuery) Only(ctx context.Context) (*Bot, error)

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

func (*BotQuery) OnlyID

func (bq *BotQuery) OnlyID(ctx context.Context) (id int, err error)

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

func (*BotQuery) OnlyIDX

func (bq *BotQuery) OnlyIDX(ctx context.Context) int

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

func (*BotQuery) OnlyX

func (bq *BotQuery) OnlyX(ctx context.Context) *Bot

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

func (*BotQuery) Order

func (bq *BotQuery) Order(o ...OrderFunc) *BotQuery

Order adds an order step to the query.

func (*BotQuery) QueryInfecting

func (bq *BotQuery) QueryInfecting() *HostQuery

QueryInfecting chains the current query on the "infecting" edge.

func (*BotQuery) Select

func (bq *BotQuery) Select(field string, fields ...string) *BotSelect

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

client.Bot.Query().
	Select(bot.FieldUUID).
	Scan(ctx, &v)

func (*BotQuery) Where

func (bq *BotQuery) Where(ps ...predicate.Bot) *BotQuery

Where adds a new predicate for the BotQuery builder.

func (*BotQuery) WithInfecting

func (bq *BotQuery) WithInfecting(opts ...func(*HostQuery)) *BotQuery

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

type BotSelect

type BotSelect struct {
	*BotQuery
	// contains filtered or unexported fields
}

BotSelect is the builder for selecting fields of Bot entities.

func (*BotSelect) Bool

func (bs *BotSelect) Bool(ctx context.Context) (_ bool, err error)

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

func (*BotSelect) BoolX

func (bs *BotSelect) BoolX(ctx context.Context) bool

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

func (*BotSelect) Bools

func (bs *BotSelect) Bools(ctx context.Context) ([]bool, error)

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

func (*BotSelect) BoolsX

func (bs *BotSelect) BoolsX(ctx context.Context) []bool

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

func (*BotSelect) Float64

func (bs *BotSelect) Float64(ctx context.Context) (_ float64, err error)

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

func (*BotSelect) Float64X

func (bs *BotSelect) Float64X(ctx context.Context) float64

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

func (*BotSelect) Float64s

func (bs *BotSelect) Float64s(ctx context.Context) ([]float64, error)

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

func (*BotSelect) Float64sX

func (bs *BotSelect) Float64sX(ctx context.Context) []float64

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

func (*BotSelect) Int

func (bs *BotSelect) Int(ctx context.Context) (_ int, err error)

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

func (*BotSelect) IntX

func (bs *BotSelect) IntX(ctx context.Context) int

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

func (*BotSelect) Ints

func (bs *BotSelect) Ints(ctx context.Context) ([]int, error)

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

func (*BotSelect) IntsX

func (bs *BotSelect) IntsX(ctx context.Context) []int

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

func (*BotSelect) Scan

func (bs *BotSelect) Scan(ctx context.Context, v interface{}) error

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

func (*BotSelect) ScanX

func (bs *BotSelect) ScanX(ctx context.Context, v interface{})

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

func (*BotSelect) String

func (bs *BotSelect) String(ctx context.Context) (_ string, err error)

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

func (*BotSelect) StringX

func (bs *BotSelect) StringX(ctx context.Context) string

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

func (*BotSelect) Strings

func (bs *BotSelect) Strings(ctx context.Context) ([]string, error)

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

func (*BotSelect) StringsX

func (bs *BotSelect) StringsX(ctx context.Context) []string

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

type BotUpdate

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

BotUpdate is the builder for updating Bot entities.

func (*BotUpdate) AddDelta

func (bu *BotUpdate) AddDelta(i int) *BotUpdate

AddDelta adds i to the "delta" field.

func (*BotUpdate) AddInterval

func (bu *BotUpdate) AddInterval(i int) *BotUpdate

AddInterval adds i to the "interval" field.

func (*BotUpdate) AddLastSeen

func (bu *BotUpdate) AddLastSeen(i int) *BotUpdate

AddLastSeen adds i to the "lastSeen" field.

func (*BotUpdate) ClearInfecting

func (bu *BotUpdate) ClearInfecting() *BotUpdate

ClearInfecting clears the "infecting" edge to the Host entity.

func (*BotUpdate) Exec

func (bu *BotUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*BotUpdate) ExecX

func (bu *BotUpdate) ExecX(ctx context.Context)

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

func (*BotUpdate) Mutation

func (bu *BotUpdate) Mutation() *BotMutation

Mutation returns the BotMutation object of the builder.

func (*BotUpdate) Save

func (bu *BotUpdate) Save(ctx context.Context) (int, error)

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

func (*BotUpdate) SaveX

func (bu *BotUpdate) SaveX(ctx context.Context) int

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

func (*BotUpdate) SetDelta

func (bu *BotUpdate) SetDelta(i int) *BotUpdate

SetDelta sets the "delta" field.

func (*BotUpdate) SetInfecting

func (bu *BotUpdate) SetInfecting(h *Host) *BotUpdate

SetInfecting sets the "infecting" edge to the Host entity.

func (*BotUpdate) SetInfectingID

func (bu *BotUpdate) SetInfectingID(id int) *BotUpdate

SetInfectingID sets the "infecting" edge to the Host entity by ID.

func (*BotUpdate) SetInterval

func (bu *BotUpdate) SetInterval(i int) *BotUpdate

SetInterval sets the "interval" field.

func (*BotUpdate) SetLastSeen

func (bu *BotUpdate) SetLastSeen(i int) *BotUpdate

SetLastSeen sets the "lastSeen" field.

func (*BotUpdate) SetNillableInfectingID

func (bu *BotUpdate) SetNillableInfectingID(id *int) *BotUpdate

SetNillableInfectingID sets the "infecting" edge to the Host entity by ID if the given value is not nil.

func (*BotUpdate) SetNillableLastSeen

func (bu *BotUpdate) SetNillableLastSeen(i *int) *BotUpdate

SetNillableLastSeen sets the "lastSeen" field if the given value is not nil.

func (*BotUpdate) SetUUID

func (bu *BotUpdate) SetUUID(s string) *BotUpdate

SetUUID sets the "uuid" field.

func (*BotUpdate) Where

func (bu *BotUpdate) Where(ps ...predicate.Bot) *BotUpdate

Where adds a new predicate for the BotUpdate builder.

type BotUpdateOne

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

BotUpdateOne is the builder for updating a single Bot entity.

func (*BotUpdateOne) AddDelta

func (buo *BotUpdateOne) AddDelta(i int) *BotUpdateOne

AddDelta adds i to the "delta" field.

func (*BotUpdateOne) AddInterval

func (buo *BotUpdateOne) AddInterval(i int) *BotUpdateOne

AddInterval adds i to the "interval" field.

func (*BotUpdateOne) AddLastSeen

func (buo *BotUpdateOne) AddLastSeen(i int) *BotUpdateOne

AddLastSeen adds i to the "lastSeen" field.

func (*BotUpdateOne) ClearInfecting

func (buo *BotUpdateOne) ClearInfecting() *BotUpdateOne

ClearInfecting clears the "infecting" edge to the Host entity.

func (*BotUpdateOne) Exec

func (buo *BotUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*BotUpdateOne) ExecX

func (buo *BotUpdateOne) ExecX(ctx context.Context)

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

func (*BotUpdateOne) Mutation

func (buo *BotUpdateOne) Mutation() *BotMutation

Mutation returns the BotMutation object of the builder.

func (*BotUpdateOne) Save

func (buo *BotUpdateOne) Save(ctx context.Context) (*Bot, error)

Save executes the query and returns the updated Bot entity.

func (*BotUpdateOne) SaveX

func (buo *BotUpdateOne) SaveX(ctx context.Context) *Bot

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

func (*BotUpdateOne) SetDelta

func (buo *BotUpdateOne) SetDelta(i int) *BotUpdateOne

SetDelta sets the "delta" field.

func (*BotUpdateOne) SetInfecting

func (buo *BotUpdateOne) SetInfecting(h *Host) *BotUpdateOne

SetInfecting sets the "infecting" edge to the Host entity.

func (*BotUpdateOne) SetInfectingID

func (buo *BotUpdateOne) SetInfectingID(id int) *BotUpdateOne

SetInfectingID sets the "infecting" edge to the Host entity by ID.

func (*BotUpdateOne) SetInterval

func (buo *BotUpdateOne) SetInterval(i int) *BotUpdateOne

SetInterval sets the "interval" field.

func (*BotUpdateOne) SetLastSeen

func (buo *BotUpdateOne) SetLastSeen(i int) *BotUpdateOne

SetLastSeen sets the "lastSeen" field.

func (*BotUpdateOne) SetNillableInfectingID

func (buo *BotUpdateOne) SetNillableInfectingID(id *int) *BotUpdateOne

SetNillableInfectingID sets the "infecting" edge to the Host entity by ID if the given value is not nil.

func (*BotUpdateOne) SetNillableLastSeen

func (buo *BotUpdateOne) SetNillableLastSeen(i *int) *BotUpdateOne

SetNillableLastSeen sets the "lastSeen" field if the given value is not nil.

func (*BotUpdateOne) SetUUID

func (buo *BotUpdateOne) SetUUID(s string) *BotUpdateOne

SetUUID sets the "uuid" field.

type Bots

type Bots []*Bot

Bots is a parsable slice of Bot.

type Client

type Client struct {

	// Schema is the client for creating, migrating and dropping schema.
	Schema *migrate.Schema
	// Action is the client for interacting with the Action builders.
	Action *ActionClient
	// Bot is the client for interacting with the Bot builders.
	Bot *BotClient
	// Group is the client for interacting with the Group builders.
	Group *GroupClient
	// Host is the client for interacting with the Host builders.
	Host *HostClient
	// User is the client for interacting with the User builders.
	User *UserClient
	// contains filtered or unexported fields
}

Client is the client that holds all ent builders.

func FromContext

func FromContext(ctx context.Context) *Client

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

func NewClient

func NewClient(opts ...Option) *Client

NewClient creates a new client configured with the given options.

func Open

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

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

func (*Client) BeginTx

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().
	Action.
	Query().
	Count(ctx)

func (*Client) Tx

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

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

func (*Client) Use

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

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

type CommitFunc

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

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

func (CommitFunc) Commit

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

Commit calls f(ctx, m).

type CommitHook

type CommitHook func(Committer) Committer

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

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

type Committer

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

Committer is the interface that wraps the Committer method.

type ConstraintError

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

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

func (ConstraintError) Error

func (e ConstraintError) Error() string

Error implements the error interface.

func (*ConstraintError) Unwrap

func (e *ConstraintError) Unwrap() error

Unwrap implements the errors.Wrapper interface.

type Group

type Group struct {

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

Group is the model entity for the Group schema.

func (*Group) QueryMembers

func (gr *Group) QueryMembers() *HostQuery

QueryMembers queries the "members" edge of the Group entity.

func (*Group) String

func (gr *Group) String() string

String implements the fmt.Stringer.

func (*Group) Unwrap

func (gr *Group) Unwrap() *Group

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

func (gr *Group) Update() *GroupUpdateOne

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

type GroupClient

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

GroupClient is a client for the Group schema.

func NewGroupClient

func NewGroupClient(c config) *GroupClient

NewGroupClient returns a client for the Group from the given config.

func (*GroupClient) Create

func (c *GroupClient) Create() *GroupCreate

Create returns a create builder for Group.

func (*GroupClient) CreateBulk

func (c *GroupClient) CreateBulk(builders ...*GroupCreate) *GroupCreateBulk

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

func (*GroupClient) Delete

func (c *GroupClient) Delete() *GroupDelete

Delete returns a delete builder for Group.

func (*GroupClient) DeleteOne

func (c *GroupClient) DeleteOne(gr *Group) *GroupDeleteOne

DeleteOne returns a delete builder for the given entity.

func (*GroupClient) DeleteOneID

func (c *GroupClient) DeleteOneID(id int) *GroupDeleteOne

DeleteOneID returns a delete builder for the given id.

func (*GroupClient) Get

func (c *GroupClient) Get(ctx context.Context, id int) (*Group, error)

Get returns a Group entity by its id.

func (*GroupClient) GetX

func (c *GroupClient) GetX(ctx context.Context, id int) *Group

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

func (*GroupClient) Hooks

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

Hooks returns the client hooks.

func (*GroupClient) Query

func (c *GroupClient) Query() *GroupQuery

Query returns a query builder for Group.

func (*GroupClient) QueryMembers

func (c *GroupClient) QueryMembers(gr *Group) *HostQuery

QueryMembers queries the members edge of a Group.

func (*GroupClient) Update

func (c *GroupClient) Update() *GroupUpdate

Update returns an update builder for Group.

func (*GroupClient) UpdateOne

func (c *GroupClient) UpdateOne(gr *Group) *GroupUpdateOne

UpdateOne returns an update builder for the given entity.

func (*GroupClient) UpdateOneID

func (c *GroupClient) UpdateOneID(id int) *GroupUpdateOne

UpdateOneID returns an update builder for the given id.

func (*GroupClient) Use

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

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

type GroupCreate

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

GroupCreate is the builder for creating a Group entity.

func (*GroupCreate) AddMemberIDs

func (gc *GroupCreate) AddMemberIDs(ids ...int) *GroupCreate

AddMemberIDs adds the "members" edge to the Host entity by IDs.

func (*GroupCreate) AddMembers

func (gc *GroupCreate) AddMembers(h ...*Host) *GroupCreate

AddMembers adds the "members" edges to the Host entity.

func (*GroupCreate) Mutation

func (gc *GroupCreate) Mutation() *GroupMutation

Mutation returns the GroupMutation object of the builder.

func (*GroupCreate) Save

func (gc *GroupCreate) Save(ctx context.Context) (*Group, error)

Save creates the Group in the database.

func (*GroupCreate) SaveX

func (gc *GroupCreate) SaveX(ctx context.Context) *Group

SaveX calls Save and panics if Save returns an error.

func (*GroupCreate) SetDesc

func (gc *GroupCreate) SetDesc(s string) *GroupCreate

SetDesc sets the "desc" field.

func (*GroupCreate) SetName

func (gc *GroupCreate) SetName(s string) *GroupCreate

SetName sets the "name" field.

type GroupCreateBulk

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

GroupCreateBulk is the builder for creating many Group entities in bulk.

func (*GroupCreateBulk) Save

func (gcb *GroupCreateBulk) Save(ctx context.Context) ([]*Group, error)

Save creates the Group entities in the database.

func (*GroupCreateBulk) SaveX

func (gcb *GroupCreateBulk) SaveX(ctx context.Context) []*Group

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

type GroupDelete

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

GroupDelete is the builder for deleting a Group entity.

func (*GroupDelete) Exec

func (gd *GroupDelete) Exec(ctx context.Context) (int, error)

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

func (*GroupDelete) ExecX

func (gd *GroupDelete) ExecX(ctx context.Context) int

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

func (*GroupDelete) Where

func (gd *GroupDelete) Where(ps ...predicate.Group) *GroupDelete

Where adds a new predicate to the GroupDelete builder.

type GroupDeleteOne

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

GroupDeleteOne is the builder for deleting a single Group entity.

func (*GroupDeleteOne) Exec

func (gdo *GroupDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*GroupDeleteOne) ExecX

func (gdo *GroupDeleteOne) ExecX(ctx context.Context)

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

type GroupEdges

type GroupEdges struct {
	// Members holds the value of the members edge.
	Members []*Host `json:"members,omitempty"`
	// contains filtered or unexported fields
}

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

func (GroupEdges) MembersOrErr

func (e GroupEdges) MembersOrErr() ([]*Host, error)

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

type GroupGroupBy

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

GroupGroupBy is the group-by builder for Group entities.

func (*GroupGroupBy) Aggregate

func (ggb *GroupGroupBy) Aggregate(fns ...AggregateFunc) *GroupGroupBy

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

func (*GroupGroupBy) Bool

func (ggb *GroupGroupBy) Bool(ctx context.Context) (_ bool, err error)

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

func (*GroupGroupBy) BoolX

func (ggb *GroupGroupBy) BoolX(ctx context.Context) bool

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

func (*GroupGroupBy) Bools

func (ggb *GroupGroupBy) Bools(ctx context.Context) ([]bool, error)

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

func (*GroupGroupBy) BoolsX

func (ggb *GroupGroupBy) BoolsX(ctx context.Context) []bool

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

func (*GroupGroupBy) Float64

func (ggb *GroupGroupBy) Float64(ctx context.Context) (_ float64, err error)

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

func (*GroupGroupBy) Float64X

func (ggb *GroupGroupBy) Float64X(ctx context.Context) float64

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

func (*GroupGroupBy) Float64s

func (ggb *GroupGroupBy) Float64s(ctx context.Context) ([]float64, error)

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

func (*GroupGroupBy) Float64sX

func (ggb *GroupGroupBy) Float64sX(ctx context.Context) []float64

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

func (*GroupGroupBy) Int

func (ggb *GroupGroupBy) Int(ctx context.Context) (_ int, err error)

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

func (*GroupGroupBy) IntX

func (ggb *GroupGroupBy) IntX(ctx context.Context) int

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

func (*GroupGroupBy) Ints

func (ggb *GroupGroupBy) Ints(ctx context.Context) ([]int, error)

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

func (*GroupGroupBy) IntsX

func (ggb *GroupGroupBy) IntsX(ctx context.Context) []int

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

func (*GroupGroupBy) Scan

func (ggb *GroupGroupBy) Scan(ctx context.Context, v interface{}) error

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

func (*GroupGroupBy) ScanX

func (ggb *GroupGroupBy) ScanX(ctx context.Context, v interface{})

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

func (*GroupGroupBy) String

func (ggb *GroupGroupBy) String(ctx context.Context) (_ string, err error)

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

func (*GroupGroupBy) StringX

func (ggb *GroupGroupBy) StringX(ctx context.Context) string

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

func (*GroupGroupBy) Strings

func (ggb *GroupGroupBy) Strings(ctx context.Context) ([]string, error)

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

func (*GroupGroupBy) StringsX

func (ggb *GroupGroupBy) StringsX(ctx context.Context) []string

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

type GroupMutation

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

GroupMutation represents an operation that mutates the Group nodes in the graph.

func (*GroupMutation) AddField

func (m *GroupMutation) 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 (*GroupMutation) AddMemberIDs

func (m *GroupMutation) AddMemberIDs(ids ...int)

AddMemberIDs adds the "members" edge to the Host entity by ids.

func (*GroupMutation) AddedEdges

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

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

func (*GroupMutation) AddedField

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

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

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

func (*GroupMutation) AddedIDs

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

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

func (*GroupMutation) ClearEdge

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

func (m *GroupMutation) 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 (*GroupMutation) ClearMembers

func (m *GroupMutation) ClearMembers()

ClearMembers clears the "members" edge to the Host entity.

func (*GroupMutation) ClearedEdges

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

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

func (*GroupMutation) ClearedFields

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

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

func (GroupMutation) Client

func (m GroupMutation) 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 (*GroupMutation) Desc

func (m *GroupMutation) Desc() (r string, exists bool)

Desc returns the value of the "desc" field in the mutation.

func (*GroupMutation) EdgeCleared

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

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

func (*GroupMutation) Field

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

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

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

func (*GroupMutation) Fields

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

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

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

func (*GroupMutation) MembersCleared

func (m *GroupMutation) MembersCleared() bool

MembersCleared returns if the "members" edge to the Host entity was cleared.

func (*GroupMutation) MembersIDs

func (m *GroupMutation) MembersIDs() (ids []int)

MembersIDs returns the "members" edge IDs in the mutation.

func (*GroupMutation) Name

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

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

func (*GroupMutation) OldDesc

func (m *GroupMutation) OldDesc(ctx context.Context) (v string, err error)

OldDesc returns the old "desc" field's value of the Group entity. If the Group 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 (*GroupMutation) OldField

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

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

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

func (m *GroupMutation) Op() Op

Op returns the operation name.

func (*GroupMutation) RemoveMemberIDs

func (m *GroupMutation) RemoveMemberIDs(ids ...int)

RemoveMemberIDs removes the "members" edge to the Host entity by IDs.

func (*GroupMutation) RemovedEdges

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

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

func (*GroupMutation) RemovedIDs

func (m *GroupMutation) 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 (*GroupMutation) RemovedMembersIDs

func (m *GroupMutation) RemovedMembersIDs() (ids []int)

RemovedMembers returns the removed IDs of the "members" edge to the Host entity.

func (*GroupMutation) ResetDesc

func (m *GroupMutation) ResetDesc()

ResetDesc resets all changes to the "desc" field.

func (*GroupMutation) ResetEdge

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

func (m *GroupMutation) 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 (*GroupMutation) ResetMembers

func (m *GroupMutation) ResetMembers()

ResetMembers resets all changes to the "members" edge.

func (*GroupMutation) ResetName

func (m *GroupMutation) ResetName()

ResetName resets all changes to the "name" field.

func (*GroupMutation) SetDesc

func (m *GroupMutation) SetDesc(s string)

SetDesc sets the "desc" field.

func (*GroupMutation) SetField

func (m *GroupMutation) 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 (*GroupMutation) SetName

func (m *GroupMutation) SetName(s string)

SetName sets the "name" field.

func (GroupMutation) Tx

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

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

func (*GroupMutation) Type

func (m *GroupMutation) Type() string

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

type GroupQuery

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

GroupQuery is the builder for querying Group entities.

func (*GroupQuery) All

func (gq *GroupQuery) All(ctx context.Context) ([]*Group, error)

All executes the query and returns a list of Groups.

func (*GroupQuery) AllX

func (gq *GroupQuery) AllX(ctx context.Context) []*Group

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

func (*GroupQuery) Clone

func (gq *GroupQuery) Clone() *GroupQuery

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

func (*GroupQuery) Count

func (gq *GroupQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*GroupQuery) CountX

func (gq *GroupQuery) CountX(ctx context.Context) int

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

func (*GroupQuery) Exist

func (gq *GroupQuery) Exist(ctx context.Context) (bool, error)

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

func (*GroupQuery) ExistX

func (gq *GroupQuery) ExistX(ctx context.Context) bool

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

func (*GroupQuery) First

func (gq *GroupQuery) First(ctx context.Context) (*Group, error)

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

func (*GroupQuery) FirstID

func (gq *GroupQuery) FirstID(ctx context.Context) (id int, err error)

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

func (*GroupQuery) FirstIDX

func (gq *GroupQuery) FirstIDX(ctx context.Context) int

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

func (*GroupQuery) FirstX

func (gq *GroupQuery) FirstX(ctx context.Context) *Group

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

func (*GroupQuery) GroupBy

func (gq *GroupQuery) GroupBy(field string, fields ...string) *GroupGroupBy

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

func (*GroupQuery) IDs

func (gq *GroupQuery) IDs(ctx context.Context) ([]int, error)

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

func (*GroupQuery) IDsX

func (gq *GroupQuery) IDsX(ctx context.Context) []int

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

func (*GroupQuery) Limit

func (gq *GroupQuery) Limit(limit int) *GroupQuery

Limit adds a limit step to the query.

func (*GroupQuery) Offset

func (gq *GroupQuery) Offset(offset int) *GroupQuery

Offset adds an offset step to the query.

func (*GroupQuery) Only

func (gq *GroupQuery) Only(ctx context.Context) (*Group, error)

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

func (*GroupQuery) OnlyID

func (gq *GroupQuery) OnlyID(ctx context.Context) (id int, err error)

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

func (*GroupQuery) OnlyIDX

func (gq *GroupQuery) OnlyIDX(ctx context.Context) int

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

func (*GroupQuery) OnlyX

func (gq *GroupQuery) OnlyX(ctx context.Context) *Group

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

func (*GroupQuery) Order

func (gq *GroupQuery) Order(o ...OrderFunc) *GroupQuery

Order adds an order step to the query.

func (*GroupQuery) QueryMembers

func (gq *GroupQuery) QueryMembers() *HostQuery

QueryMembers chains the current query on the "members" edge.

func (*GroupQuery) Select

func (gq *GroupQuery) Select(field string, fields ...string) *GroupSelect

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

func (*GroupQuery) Where

func (gq *GroupQuery) Where(ps ...predicate.Group) *GroupQuery

Where adds a new predicate for the GroupQuery builder.

func (*GroupQuery) WithMembers

func (gq *GroupQuery) WithMembers(opts ...func(*HostQuery)) *GroupQuery

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

type GroupSelect

type GroupSelect struct {
	*GroupQuery
	// contains filtered or unexported fields
}

GroupSelect is the builder for selecting fields of Group entities.

func (*GroupSelect) Bool

func (gs *GroupSelect) Bool(ctx context.Context) (_ bool, err error)

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

func (*GroupSelect) BoolX

func (gs *GroupSelect) BoolX(ctx context.Context) bool

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

func (*GroupSelect) Bools

func (gs *GroupSelect) Bools(ctx context.Context) ([]bool, error)

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

func (*GroupSelect) BoolsX

func (gs *GroupSelect) BoolsX(ctx context.Context) []bool

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

func (*GroupSelect) Float64

func (gs *GroupSelect) Float64(ctx context.Context) (_ float64, err error)

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

func (*GroupSelect) Float64X

func (gs *GroupSelect) Float64X(ctx context.Context) float64

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

func (*GroupSelect) Float64s

func (gs *GroupSelect) Float64s(ctx context.Context) ([]float64, error)

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

func (*GroupSelect) Float64sX

func (gs *GroupSelect) Float64sX(ctx context.Context) []float64

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

func (*GroupSelect) Int

func (gs *GroupSelect) Int(ctx context.Context) (_ int, err error)

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

func (*GroupSelect) IntX

func (gs *GroupSelect) IntX(ctx context.Context) int

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

func (*GroupSelect) Ints

func (gs *GroupSelect) Ints(ctx context.Context) ([]int, error)

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

func (*GroupSelect) IntsX

func (gs *GroupSelect) IntsX(ctx context.Context) []int

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

func (*GroupSelect) Scan

func (gs *GroupSelect) Scan(ctx context.Context, v interface{}) error

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

func (*GroupSelect) ScanX

func (gs *GroupSelect) ScanX(ctx context.Context, v interface{})

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

func (*GroupSelect) String

func (gs *GroupSelect) String(ctx context.Context) (_ string, err error)

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

func (*GroupSelect) StringX

func (gs *GroupSelect) StringX(ctx context.Context) string

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

func (*GroupSelect) Strings

func (gs *GroupSelect) Strings(ctx context.Context) ([]string, error)

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

func (*GroupSelect) StringsX

func (gs *GroupSelect) StringsX(ctx context.Context) []string

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

type GroupUpdate

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

GroupUpdate is the builder for updating Group entities.

func (*GroupUpdate) AddMemberIDs

func (gu *GroupUpdate) AddMemberIDs(ids ...int) *GroupUpdate

AddMemberIDs adds the "members" edge to the Host entity by IDs.

func (*GroupUpdate) AddMembers

func (gu *GroupUpdate) AddMembers(h ...*Host) *GroupUpdate

AddMembers adds the "members" edges to the Host entity.

func (*GroupUpdate) ClearMembers

func (gu *GroupUpdate) ClearMembers() *GroupUpdate

ClearMembers clears all "members" edges to the Host entity.

func (*GroupUpdate) Exec

func (gu *GroupUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*GroupUpdate) ExecX

func (gu *GroupUpdate) ExecX(ctx context.Context)

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

func (*GroupUpdate) Mutation

func (gu *GroupUpdate) Mutation() *GroupMutation

Mutation returns the GroupMutation object of the builder.

func (*GroupUpdate) RemoveMemberIDs

func (gu *GroupUpdate) RemoveMemberIDs(ids ...int) *GroupUpdate

RemoveMemberIDs removes the "members" edge to Host entities by IDs.

func (*GroupUpdate) RemoveMembers

func (gu *GroupUpdate) RemoveMembers(h ...*Host) *GroupUpdate

RemoveMembers removes "members" edges to Host entities.

func (*GroupUpdate) Save

func (gu *GroupUpdate) Save(ctx context.Context) (int, error)

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

func (*GroupUpdate) SaveX

func (gu *GroupUpdate) SaveX(ctx context.Context) int

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

func (*GroupUpdate) SetDesc

func (gu *GroupUpdate) SetDesc(s string) *GroupUpdate

SetDesc sets the "desc" field.

func (*GroupUpdate) SetName

func (gu *GroupUpdate) SetName(s string) *GroupUpdate

SetName sets the "name" field.

func (*GroupUpdate) Where

func (gu *GroupUpdate) Where(ps ...predicate.Group) *GroupUpdate

Where adds a new predicate for the GroupUpdate builder.

type GroupUpdateOne

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

GroupUpdateOne is the builder for updating a single Group entity.

func (*GroupUpdateOne) AddMemberIDs

func (guo *GroupUpdateOne) AddMemberIDs(ids ...int) *GroupUpdateOne

AddMemberIDs adds the "members" edge to the Host entity by IDs.

func (*GroupUpdateOne) AddMembers

func (guo *GroupUpdateOne) AddMembers(h ...*Host) *GroupUpdateOne

AddMembers adds the "members" edges to the Host entity.

func (*GroupUpdateOne) ClearMembers

func (guo *GroupUpdateOne) ClearMembers() *GroupUpdateOne

ClearMembers clears all "members" edges to the Host entity.

func (*GroupUpdateOne) Exec

func (guo *GroupUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*GroupUpdateOne) ExecX

func (guo *GroupUpdateOne) ExecX(ctx context.Context)

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

func (*GroupUpdateOne) Mutation

func (guo *GroupUpdateOne) Mutation() *GroupMutation

Mutation returns the GroupMutation object of the builder.

func (*GroupUpdateOne) RemoveMemberIDs

func (guo *GroupUpdateOne) RemoveMemberIDs(ids ...int) *GroupUpdateOne

RemoveMemberIDs removes the "members" edge to Host entities by IDs.

func (*GroupUpdateOne) RemoveMembers

func (guo *GroupUpdateOne) RemoveMembers(h ...*Host) *GroupUpdateOne

RemoveMembers removes "members" edges to Host entities.

func (*GroupUpdateOne) Save

func (guo *GroupUpdateOne) Save(ctx context.Context) (*Group, error)

Save executes the query and returns the updated Group entity.

func (*GroupUpdateOne) SaveX

func (guo *GroupUpdateOne) SaveX(ctx context.Context) *Group

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

func (*GroupUpdateOne) SetDesc

func (guo *GroupUpdateOne) SetDesc(s string) *GroupUpdateOne

SetDesc sets the "desc" field.

func (*GroupUpdateOne) SetName

func (guo *GroupUpdateOne) SetName(s string) *GroupUpdateOne

SetName sets the "name" field.

type Groups

type Groups []*Group

Groups is a parsable slice of Group.

type Hook

type Hook = ent.Hook

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

type Host

type Host struct {

	// ID of the ent.
	ID int `json:"id,omitempty"`
	// Hostname holds the value of the "hostname" field.
	Hostname string `json:"hostname,omitempty"`
	// Interface holds the value of the "interface" field.
	Interface string `json:"interface,omitempty"`
	// LastSeen holds the value of the "lastSeen" field.
	LastSeen int `json:"lastSeen,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the HostQuery when eager-loading is set.
	Edges HostEdges `json:"edges"`
	// contains filtered or unexported fields
}

Host is the model entity for the Host schema.

func (*Host) QueryActions

func (h *Host) QueryActions() *ActionQuery

QueryActions queries the "actions" edge of the Host entity.

func (*Host) QueryBots

func (h *Host) QueryBots() *BotQuery

QueryBots queries the "bots" edge of the Host entity.

func (*Host) QueryMember

func (h *Host) QueryMember() *GroupQuery

QueryMember queries the "member" edge of the Host entity.

func (*Host) String

func (h *Host) String() string

String implements the fmt.Stringer.

func (*Host) Unwrap

func (h *Host) Unwrap() *Host

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

func (h *Host) Update() *HostUpdateOne

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

type HostClient

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

HostClient is a client for the Host schema.

func NewHostClient

func NewHostClient(c config) *HostClient

NewHostClient returns a client for the Host from the given config.

func (*HostClient) Create

func (c *HostClient) Create() *HostCreate

Create returns a create builder for Host.

func (*HostClient) CreateBulk

func (c *HostClient) CreateBulk(builders ...*HostCreate) *HostCreateBulk

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

func (*HostClient) Delete

func (c *HostClient) Delete() *HostDelete

Delete returns a delete builder for Host.

func (*HostClient) DeleteOne

func (c *HostClient) DeleteOne(h *Host) *HostDeleteOne

DeleteOne returns a delete builder for the given entity.

func (*HostClient) DeleteOneID

func (c *HostClient) DeleteOneID(id int) *HostDeleteOne

DeleteOneID returns a delete builder for the given id.

func (*HostClient) Get

func (c *HostClient) Get(ctx context.Context, id int) (*Host, error)

Get returns a Host entity by its id.

func (*HostClient) GetX

func (c *HostClient) GetX(ctx context.Context, id int) *Host

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

func (*HostClient) Hooks

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

Hooks returns the client hooks.

func (*HostClient) Query

func (c *HostClient) Query() *HostQuery

Query returns a query builder for Host.

func (*HostClient) QueryActions

func (c *HostClient) QueryActions(h *Host) *ActionQuery

QueryActions queries the actions edge of a Host.

func (*HostClient) QueryBots

func (c *HostClient) QueryBots(h *Host) *BotQuery

QueryBots queries the bots edge of a Host.

func (*HostClient) QueryMember

func (c *HostClient) QueryMember(h *Host) *GroupQuery

QueryMember queries the member edge of a Host.

func (*HostClient) Update

func (c *HostClient) Update() *HostUpdate

Update returns an update builder for Host.

func (*HostClient) UpdateOne

func (c *HostClient) UpdateOne(h *Host) *HostUpdateOne

UpdateOne returns an update builder for the given entity.

func (*HostClient) UpdateOneID

func (c *HostClient) UpdateOneID(id int) *HostUpdateOne

UpdateOneID returns an update builder for the given id.

func (*HostClient) Use

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

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

type HostCreate

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

HostCreate is the builder for creating a Host entity.

func (*HostCreate) AddActionIDs

func (hc *HostCreate) AddActionIDs(ids ...int) *HostCreate

AddActionIDs adds the "actions" edge to the Action entity by IDs.

func (*HostCreate) AddActions

func (hc *HostCreate) AddActions(a ...*Action) *HostCreate

AddActions adds the "actions" edges to the Action entity.

func (*HostCreate) AddBotIDs

func (hc *HostCreate) AddBotIDs(ids ...int) *HostCreate

AddBotIDs adds the "bots" edge to the Bot entity by IDs.

func (*HostCreate) AddBots

func (hc *HostCreate) AddBots(b ...*Bot) *HostCreate

AddBots adds the "bots" edges to the Bot entity.

func (*HostCreate) AddMember

func (hc *HostCreate) AddMember(g ...*Group) *HostCreate

AddMember adds the "member" edges to the Group entity.

func (*HostCreate) AddMemberIDs

func (hc *HostCreate) AddMemberIDs(ids ...int) *HostCreate

AddMemberIDs adds the "member" edge to the Group entity by IDs.

func (*HostCreate) Mutation

func (hc *HostCreate) Mutation() *HostMutation

Mutation returns the HostMutation object of the builder.

func (*HostCreate) Save

func (hc *HostCreate) Save(ctx context.Context) (*Host, error)

Save creates the Host in the database.

func (*HostCreate) SaveX

func (hc *HostCreate) SaveX(ctx context.Context) *Host

SaveX calls Save and panics if Save returns an error.

func (*HostCreate) SetHostname

func (hc *HostCreate) SetHostname(s string) *HostCreate

SetHostname sets the "hostname" field.

func (*HostCreate) SetInterface

func (hc *HostCreate) SetInterface(s string) *HostCreate

SetInterface sets the "interface" field.

func (*HostCreate) SetLastSeen

func (hc *HostCreate) SetLastSeen(i int) *HostCreate

SetLastSeen sets the "lastSeen" field.

func (*HostCreate) SetNillableLastSeen

func (hc *HostCreate) SetNillableLastSeen(i *int) *HostCreate

SetNillableLastSeen sets the "lastSeen" field if the given value is not nil.

type HostCreateBulk

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

HostCreateBulk is the builder for creating many Host entities in bulk.

func (*HostCreateBulk) Save

func (hcb *HostCreateBulk) Save(ctx context.Context) ([]*Host, error)

Save creates the Host entities in the database.

func (*HostCreateBulk) SaveX

func (hcb *HostCreateBulk) SaveX(ctx context.Context) []*Host

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

type HostDelete

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

HostDelete is the builder for deleting a Host entity.

func (*HostDelete) Exec

func (hd *HostDelete) Exec(ctx context.Context) (int, error)

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

func (*HostDelete) ExecX

func (hd *HostDelete) ExecX(ctx context.Context) int

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

func (*HostDelete) Where

func (hd *HostDelete) Where(ps ...predicate.Host) *HostDelete

Where adds a new predicate to the HostDelete builder.

type HostDeleteOne

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

HostDeleteOne is the builder for deleting a single Host entity.

func (*HostDeleteOne) Exec

func (hdo *HostDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*HostDeleteOne) ExecX

func (hdo *HostDeleteOne) ExecX(ctx context.Context)

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

type HostEdges

type HostEdges struct {
	// Bots holds the value of the bots edge.
	Bots []*Bot `json:"bots,omitempty"`
	// Actions holds the value of the actions edge.
	Actions []*Action `json:"actions,omitempty"`
	// Member holds the value of the member edge.
	Member []*Group `json:"member,omitempty"`
	// contains filtered or unexported fields
}

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

func (HostEdges) ActionsOrErr

func (e HostEdges) ActionsOrErr() ([]*Action, error)

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

func (HostEdges) BotsOrErr

func (e HostEdges) BotsOrErr() ([]*Bot, error)

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

func (HostEdges) MemberOrErr

func (e HostEdges) MemberOrErr() ([]*Group, error)

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

type HostGroupBy

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

HostGroupBy is the group-by builder for Host entities.

func (*HostGroupBy) Aggregate

func (hgb *HostGroupBy) Aggregate(fns ...AggregateFunc) *HostGroupBy

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

func (*HostGroupBy) Bool

func (hgb *HostGroupBy) Bool(ctx context.Context) (_ bool, err error)

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

func (*HostGroupBy) BoolX

func (hgb *HostGroupBy) BoolX(ctx context.Context) bool

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

func (*HostGroupBy) Bools

func (hgb *HostGroupBy) Bools(ctx context.Context) ([]bool, error)

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

func (*HostGroupBy) BoolsX

func (hgb *HostGroupBy) BoolsX(ctx context.Context) []bool

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

func (*HostGroupBy) Float64

func (hgb *HostGroupBy) Float64(ctx context.Context) (_ float64, err error)

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

func (*HostGroupBy) Float64X

func (hgb *HostGroupBy) Float64X(ctx context.Context) float64

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

func (*HostGroupBy) Float64s

func (hgb *HostGroupBy) Float64s(ctx context.Context) ([]float64, error)

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

func (*HostGroupBy) Float64sX

func (hgb *HostGroupBy) Float64sX(ctx context.Context) []float64

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

func (*HostGroupBy) Int

func (hgb *HostGroupBy) Int(ctx context.Context) (_ int, err error)

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

func (*HostGroupBy) IntX

func (hgb *HostGroupBy) IntX(ctx context.Context) int

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

func (*HostGroupBy) Ints

func (hgb *HostGroupBy) Ints(ctx context.Context) ([]int, error)

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

func (*HostGroupBy) IntsX

func (hgb *HostGroupBy) IntsX(ctx context.Context) []int

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

func (*HostGroupBy) Scan

func (hgb *HostGroupBy) Scan(ctx context.Context, v interface{}) error

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

func (*HostGroupBy) ScanX

func (hgb *HostGroupBy) ScanX(ctx context.Context, v interface{})

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

func (*HostGroupBy) String

func (hgb *HostGroupBy) String(ctx context.Context) (_ string, err error)

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

func (*HostGroupBy) StringX

func (hgb *HostGroupBy) StringX(ctx context.Context) string

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

func (*HostGroupBy) Strings

func (hgb *HostGroupBy) Strings(ctx context.Context) ([]string, error)

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

func (*HostGroupBy) StringsX

func (hgb *HostGroupBy) StringsX(ctx context.Context) []string

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

type HostMutation

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

HostMutation represents an operation that mutates the Host nodes in the graph.

func (*HostMutation) ActionsCleared

func (m *HostMutation) ActionsCleared() bool

ActionsCleared returns if the "actions" edge to the Action entity was cleared.

func (*HostMutation) ActionsIDs

func (m *HostMutation) ActionsIDs() (ids []int)

ActionsIDs returns the "actions" edge IDs in the mutation.

func (*HostMutation) AddActionIDs

func (m *HostMutation) AddActionIDs(ids ...int)

AddActionIDs adds the "actions" edge to the Action entity by ids.

func (*HostMutation) AddBotIDs

func (m *HostMutation) AddBotIDs(ids ...int)

AddBotIDs adds the "bots" edge to the Bot entity by ids.

func (*HostMutation) AddField

func (m *HostMutation) 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 (*HostMutation) AddLastSeen

func (m *HostMutation) AddLastSeen(i int)

AddLastSeen adds i to the "lastSeen" field.

func (*HostMutation) AddMemberIDs

func (m *HostMutation) AddMemberIDs(ids ...int)

AddMemberIDs adds the "member" edge to the Group entity by ids.

func (*HostMutation) AddedEdges

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

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

func (*HostMutation) AddedField

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

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

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

func (*HostMutation) AddedIDs

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

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

func (*HostMutation) AddedLastSeen

func (m *HostMutation) AddedLastSeen() (r int, exists bool)

AddedLastSeen returns the value that was added to the "lastSeen" field in this mutation.

func (*HostMutation) BotsCleared

func (m *HostMutation) BotsCleared() bool

BotsCleared returns if the "bots" edge to the Bot entity was cleared.

func (*HostMutation) BotsIDs

func (m *HostMutation) BotsIDs() (ids []int)

BotsIDs returns the "bots" edge IDs in the mutation.

func (*HostMutation) ClearActions

func (m *HostMutation) ClearActions()

ClearActions clears the "actions" edge to the Action entity.

func (*HostMutation) ClearBots

func (m *HostMutation) ClearBots()

ClearBots clears the "bots" edge to the Bot entity.

func (*HostMutation) ClearEdge

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

func (m *HostMutation) 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 (*HostMutation) ClearMember

func (m *HostMutation) ClearMember()

ClearMember clears the "member" edge to the Group entity.

func (*HostMutation) ClearedEdges

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

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

func (*HostMutation) ClearedFields

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

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

func (HostMutation) Client

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

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

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

func (*HostMutation) Field

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

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

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

func (*HostMutation) Fields

func (m *HostMutation) 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 (*HostMutation) Hostname

func (m *HostMutation) Hostname() (r string, exists bool)

Hostname returns the value of the "hostname" field in the mutation.

func (*HostMutation) ID

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

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

func (*HostMutation) Interface

func (m *HostMutation) Interface() (r string, exists bool)

Interface returns the value of the "interface" field in the mutation.

func (*HostMutation) LastSeen

func (m *HostMutation) LastSeen() (r int, exists bool)

LastSeen returns the value of the "lastSeen" field in the mutation.

func (*HostMutation) MemberCleared

func (m *HostMutation) MemberCleared() bool

MemberCleared returns if the "member" edge to the Group entity was cleared.

func (*HostMutation) MemberIDs

func (m *HostMutation) MemberIDs() (ids []int)

MemberIDs returns the "member" edge IDs in the mutation.

func (*HostMutation) OldField

func (m *HostMutation) 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 (*HostMutation) OldHostname

func (m *HostMutation) OldHostname(ctx context.Context) (v string, err error)

OldHostname returns the old "hostname" field's value of the Host entity. If the Host 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 (*HostMutation) OldInterface

func (m *HostMutation) OldInterface(ctx context.Context) (v string, err error)

OldInterface returns the old "interface" field's value of the Host entity. If the Host 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 (*HostMutation) OldLastSeen

func (m *HostMutation) OldLastSeen(ctx context.Context) (v int, err error)

OldLastSeen returns the old "lastSeen" field's value of the Host entity. If the Host 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 (*HostMutation) Op

func (m *HostMutation) Op() Op

Op returns the operation name.

func (*HostMutation) RemoveActionIDs

func (m *HostMutation) RemoveActionIDs(ids ...int)

RemoveActionIDs removes the "actions" edge to the Action entity by IDs.

func (*HostMutation) RemoveBotIDs

func (m *HostMutation) RemoveBotIDs(ids ...int)

RemoveBotIDs removes the "bots" edge to the Bot entity by IDs.

func (*HostMutation) RemoveMemberIDs

func (m *HostMutation) RemoveMemberIDs(ids ...int)

RemoveMemberIDs removes the "member" edge to the Group entity by IDs.

func (*HostMutation) RemovedActionsIDs

func (m *HostMutation) RemovedActionsIDs() (ids []int)

RemovedActions returns the removed IDs of the "actions" edge to the Action entity.

func (*HostMutation) RemovedBotsIDs

func (m *HostMutation) RemovedBotsIDs() (ids []int)

RemovedBots returns the removed IDs of the "bots" edge to the Bot entity.

func (*HostMutation) RemovedEdges

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

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

func (*HostMutation) RemovedIDs

func (m *HostMutation) 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 (*HostMutation) RemovedMemberIDs

func (m *HostMutation) RemovedMemberIDs() (ids []int)

RemovedMember returns the removed IDs of the "member" edge to the Group entity.

func (*HostMutation) ResetActions

func (m *HostMutation) ResetActions()

ResetActions resets all changes to the "actions" edge.

func (*HostMutation) ResetBots

func (m *HostMutation) ResetBots()

ResetBots resets all changes to the "bots" edge.

func (*HostMutation) ResetEdge

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

func (m *HostMutation) 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 (*HostMutation) ResetHostname

func (m *HostMutation) ResetHostname()

ResetHostname resets all changes to the "hostname" field.

func (*HostMutation) ResetInterface

func (m *HostMutation) ResetInterface()

ResetInterface resets all changes to the "interface" field.

func (*HostMutation) ResetLastSeen

func (m *HostMutation) ResetLastSeen()

ResetLastSeen resets all changes to the "lastSeen" field.

func (*HostMutation) ResetMember

func (m *HostMutation) ResetMember()

ResetMember resets all changes to the "member" edge.

func (*HostMutation) SetField

func (m *HostMutation) 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 (*HostMutation) SetHostname

func (m *HostMutation) SetHostname(s string)

SetHostname sets the "hostname" field.

func (*HostMutation) SetInterface

func (m *HostMutation) SetInterface(s string)

SetInterface sets the "interface" field.

func (*HostMutation) SetLastSeen

func (m *HostMutation) SetLastSeen(i int)

SetLastSeen sets the "lastSeen" field.

func (HostMutation) Tx

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

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

func (*HostMutation) Type

func (m *HostMutation) Type() string

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

type HostQuery

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

HostQuery is the builder for querying Host entities.

func (*HostQuery) All

func (hq *HostQuery) All(ctx context.Context) ([]*Host, error)

All executes the query and returns a list of Hosts.

func (*HostQuery) AllX

func (hq *HostQuery) AllX(ctx context.Context) []*Host

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

func (*HostQuery) Clone

func (hq *HostQuery) Clone() *HostQuery

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

func (*HostQuery) Count

func (hq *HostQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*HostQuery) CountX

func (hq *HostQuery) CountX(ctx context.Context) int

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

func (*HostQuery) Exist

func (hq *HostQuery) Exist(ctx context.Context) (bool, error)

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

func (*HostQuery) ExistX

func (hq *HostQuery) ExistX(ctx context.Context) bool

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

func (*HostQuery) First

func (hq *HostQuery) First(ctx context.Context) (*Host, error)

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

func (*HostQuery) FirstID

func (hq *HostQuery) FirstID(ctx context.Context) (id int, err error)

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

func (*HostQuery) FirstIDX

func (hq *HostQuery) FirstIDX(ctx context.Context) int

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

func (*HostQuery) FirstX

func (hq *HostQuery) FirstX(ctx context.Context) *Host

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

func (*HostQuery) GroupBy

func (hq *HostQuery) GroupBy(field string, fields ...string) *HostGroupBy

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

client.Host.Query().
	GroupBy(host.FieldHostname).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*HostQuery) IDs

func (hq *HostQuery) IDs(ctx context.Context) ([]int, error)

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

func (*HostQuery) IDsX

func (hq *HostQuery) IDsX(ctx context.Context) []int

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

func (*HostQuery) Limit

func (hq *HostQuery) Limit(limit int) *HostQuery

Limit adds a limit step to the query.

func (*HostQuery) Offset

func (hq *HostQuery) Offset(offset int) *HostQuery

Offset adds an offset step to the query.

func (*HostQuery) Only

func (hq *HostQuery) Only(ctx context.Context) (*Host, error)

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

func (*HostQuery) OnlyID

func (hq *HostQuery) OnlyID(ctx context.Context) (id int, err error)

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

func (*HostQuery) OnlyIDX

func (hq *HostQuery) OnlyIDX(ctx context.Context) int

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

func (*HostQuery) OnlyX

func (hq *HostQuery) OnlyX(ctx context.Context) *Host

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

func (*HostQuery) Order

func (hq *HostQuery) Order(o ...OrderFunc) *HostQuery

Order adds an order step to the query.

func (*HostQuery) QueryActions

func (hq *HostQuery) QueryActions() *ActionQuery

QueryActions chains the current query on the "actions" edge.

func (*HostQuery) QueryBots

func (hq *HostQuery) QueryBots() *BotQuery

QueryBots chains the current query on the "bots" edge.

func (*HostQuery) QueryMember

func (hq *HostQuery) QueryMember() *GroupQuery

QueryMember chains the current query on the "member" edge.

func (*HostQuery) Select

func (hq *HostQuery) Select(field string, fields ...string) *HostSelect

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

client.Host.Query().
	Select(host.FieldHostname).
	Scan(ctx, &v)

func (*HostQuery) Where

func (hq *HostQuery) Where(ps ...predicate.Host) *HostQuery

Where adds a new predicate for the HostQuery builder.

func (*HostQuery) WithActions

func (hq *HostQuery) WithActions(opts ...func(*ActionQuery)) *HostQuery

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

func (*HostQuery) WithBots

func (hq *HostQuery) WithBots(opts ...func(*BotQuery)) *HostQuery

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

func (*HostQuery) WithMember

func (hq *HostQuery) WithMember(opts ...func(*GroupQuery)) *HostQuery

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

type HostSelect

type HostSelect struct {
	*HostQuery
	// contains filtered or unexported fields
}

HostSelect is the builder for selecting fields of Host entities.

func (*HostSelect) Bool

func (hs *HostSelect) Bool(ctx context.Context) (_ bool, err error)

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

func (*HostSelect) BoolX

func (hs *HostSelect) BoolX(ctx context.Context) bool

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

func (*HostSelect) Bools

func (hs *HostSelect) Bools(ctx context.Context) ([]bool, error)

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

func (*HostSelect) BoolsX

func (hs *HostSelect) BoolsX(ctx context.Context) []bool

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

func (*HostSelect) Float64

func (hs *HostSelect) Float64(ctx context.Context) (_ float64, err error)

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

func (*HostSelect) Float64X

func (hs *HostSelect) Float64X(ctx context.Context) float64

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

func (*HostSelect) Float64s

func (hs *HostSelect) Float64s(ctx context.Context) ([]float64, error)

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

func (*HostSelect) Float64sX

func (hs *HostSelect) Float64sX(ctx context.Context) []float64

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

func (*HostSelect) Int

func (hs *HostSelect) Int(ctx context.Context) (_ int, err error)

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

func (*HostSelect) IntX

func (hs *HostSelect) IntX(ctx context.Context) int

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

func (*HostSelect) Ints

func (hs *HostSelect) Ints(ctx context.Context) ([]int, error)

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

func (*HostSelect) IntsX

func (hs *HostSelect) IntsX(ctx context.Context) []int

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

func (*HostSelect) Scan

func (hs *HostSelect) Scan(ctx context.Context, v interface{}) error

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

func (*HostSelect) ScanX

func (hs *HostSelect) ScanX(ctx context.Context, v interface{})

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

func (*HostSelect) String

func (hs *HostSelect) String(ctx context.Context) (_ string, err error)

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

func (*HostSelect) StringX

func (hs *HostSelect) StringX(ctx context.Context) string

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

func (*HostSelect) Strings

func (hs *HostSelect) Strings(ctx context.Context) ([]string, error)

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

func (*HostSelect) StringsX

func (hs *HostSelect) StringsX(ctx context.Context) []string

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

type HostUpdate

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

HostUpdate is the builder for updating Host entities.

func (*HostUpdate) AddActionIDs

func (hu *HostUpdate) AddActionIDs(ids ...int) *HostUpdate

AddActionIDs adds the "actions" edge to the Action entity by IDs.

func (*HostUpdate) AddActions

func (hu *HostUpdate) AddActions(a ...*Action) *HostUpdate

AddActions adds the "actions" edges to the Action entity.

func (*HostUpdate) AddBotIDs

func (hu *HostUpdate) AddBotIDs(ids ...int) *HostUpdate

AddBotIDs adds the "bots" edge to the Bot entity by IDs.

func (*HostUpdate) AddBots

func (hu *HostUpdate) AddBots(b ...*Bot) *HostUpdate

AddBots adds the "bots" edges to the Bot entity.

func (*HostUpdate) AddLastSeen

func (hu *HostUpdate) AddLastSeen(i int) *HostUpdate

AddLastSeen adds i to the "lastSeen" field.

func (*HostUpdate) AddMember

func (hu *HostUpdate) AddMember(g ...*Group) *HostUpdate

AddMember adds the "member" edges to the Group entity.

func (*HostUpdate) AddMemberIDs

func (hu *HostUpdate) AddMemberIDs(ids ...int) *HostUpdate

AddMemberIDs adds the "member" edge to the Group entity by IDs.

func (*HostUpdate) ClearActions

func (hu *HostUpdate) ClearActions() *HostUpdate

ClearActions clears all "actions" edges to the Action entity.

func (*HostUpdate) ClearBots

func (hu *HostUpdate) ClearBots() *HostUpdate

ClearBots clears all "bots" edges to the Bot entity.

func (*HostUpdate) ClearMember

func (hu *HostUpdate) ClearMember() *HostUpdate

ClearMember clears all "member" edges to the Group entity.

func (*HostUpdate) Exec

func (hu *HostUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*HostUpdate) ExecX

func (hu *HostUpdate) ExecX(ctx context.Context)

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

func (*HostUpdate) Mutation

func (hu *HostUpdate) Mutation() *HostMutation

Mutation returns the HostMutation object of the builder.

func (*HostUpdate) RemoveActionIDs

func (hu *HostUpdate) RemoveActionIDs(ids ...int) *HostUpdate

RemoveActionIDs removes the "actions" edge to Action entities by IDs.

func (*HostUpdate) RemoveActions

func (hu *HostUpdate) RemoveActions(a ...*Action) *HostUpdate

RemoveActions removes "actions" edges to Action entities.

func (*HostUpdate) RemoveBotIDs

func (hu *HostUpdate) RemoveBotIDs(ids ...int) *HostUpdate

RemoveBotIDs removes the "bots" edge to Bot entities by IDs.

func (*HostUpdate) RemoveBots

func (hu *HostUpdate) RemoveBots(b ...*Bot) *HostUpdate

RemoveBots removes "bots" edges to Bot entities.

func (*HostUpdate) RemoveMember

func (hu *HostUpdate) RemoveMember(g ...*Group) *HostUpdate

RemoveMember removes "member" edges to Group entities.

func (*HostUpdate) RemoveMemberIDs

func (hu *HostUpdate) RemoveMemberIDs(ids ...int) *HostUpdate

RemoveMemberIDs removes the "member" edge to Group entities by IDs.

func (*HostUpdate) Save

func (hu *HostUpdate) Save(ctx context.Context) (int, error)

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

func (*HostUpdate) SaveX

func (hu *HostUpdate) SaveX(ctx context.Context) int

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

func (*HostUpdate) SetHostname

func (hu *HostUpdate) SetHostname(s string) *HostUpdate

SetHostname sets the "hostname" field.

func (*HostUpdate) SetInterface

func (hu *HostUpdate) SetInterface(s string) *HostUpdate

SetInterface sets the "interface" field.

func (*HostUpdate) SetLastSeen

func (hu *HostUpdate) SetLastSeen(i int) *HostUpdate

SetLastSeen sets the "lastSeen" field.

func (*HostUpdate) SetNillableLastSeen

func (hu *HostUpdate) SetNillableLastSeen(i *int) *HostUpdate

SetNillableLastSeen sets the "lastSeen" field if the given value is not nil.

func (*HostUpdate) Where

func (hu *HostUpdate) Where(ps ...predicate.Host) *HostUpdate

Where adds a new predicate for the HostUpdate builder.

type HostUpdateOne

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

HostUpdateOne is the builder for updating a single Host entity.

func (*HostUpdateOne) AddActionIDs

func (huo *HostUpdateOne) AddActionIDs(ids ...int) *HostUpdateOne

AddActionIDs adds the "actions" edge to the Action entity by IDs.

func (*HostUpdateOne) AddActions

func (huo *HostUpdateOne) AddActions(a ...*Action) *HostUpdateOne

AddActions adds the "actions" edges to the Action entity.

func (*HostUpdateOne) AddBotIDs

func (huo *HostUpdateOne) AddBotIDs(ids ...int) *HostUpdateOne

AddBotIDs adds the "bots" edge to the Bot entity by IDs.

func (*HostUpdateOne) AddBots

func (huo *HostUpdateOne) AddBots(b ...*Bot) *HostUpdateOne

AddBots adds the "bots" edges to the Bot entity.

func (*HostUpdateOne) AddLastSeen

func (huo *HostUpdateOne) AddLastSeen(i int) *HostUpdateOne

AddLastSeen adds i to the "lastSeen" field.

func (*HostUpdateOne) AddMember

func (huo *HostUpdateOne) AddMember(g ...*Group) *HostUpdateOne

AddMember adds the "member" edges to the Group entity.

func (*HostUpdateOne) AddMemberIDs

func (huo *HostUpdateOne) AddMemberIDs(ids ...int) *HostUpdateOne

AddMemberIDs adds the "member" edge to the Group entity by IDs.

func (*HostUpdateOne) ClearActions

func (huo *HostUpdateOne) ClearActions() *HostUpdateOne

ClearActions clears all "actions" edges to the Action entity.

func (*HostUpdateOne) ClearBots

func (huo *HostUpdateOne) ClearBots() *HostUpdateOne

ClearBots clears all "bots" edges to the Bot entity.

func (*HostUpdateOne) ClearMember

func (huo *HostUpdateOne) ClearMember() *HostUpdateOne

ClearMember clears all "member" edges to the Group entity.

func (*HostUpdateOne) Exec

func (huo *HostUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*HostUpdateOne) ExecX

func (huo *HostUpdateOne) ExecX(ctx context.Context)

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

func (*HostUpdateOne) Mutation

func (huo *HostUpdateOne) Mutation() *HostMutation

Mutation returns the HostMutation object of the builder.

func (*HostUpdateOne) RemoveActionIDs

func (huo *HostUpdateOne) RemoveActionIDs(ids ...int) *HostUpdateOne

RemoveActionIDs removes the "actions" edge to Action entities by IDs.

func (*HostUpdateOne) RemoveActions

func (huo *HostUpdateOne) RemoveActions(a ...*Action) *HostUpdateOne

RemoveActions removes "actions" edges to Action entities.

func (*HostUpdateOne) RemoveBotIDs

func (huo *HostUpdateOne) RemoveBotIDs(ids ...int) *HostUpdateOne

RemoveBotIDs removes the "bots" edge to Bot entities by IDs.

func (*HostUpdateOne) RemoveBots

func (huo *HostUpdateOne) RemoveBots(b ...*Bot) *HostUpdateOne

RemoveBots removes "bots" edges to Bot entities.

func (*HostUpdateOne) RemoveMember

func (huo *HostUpdateOne) RemoveMember(g ...*Group) *HostUpdateOne

RemoveMember removes "member" edges to Group entities.

func (*HostUpdateOne) RemoveMemberIDs

func (huo *HostUpdateOne) RemoveMemberIDs(ids ...int) *HostUpdateOne

RemoveMemberIDs removes the "member" edge to Group entities by IDs.

func (*HostUpdateOne) Save

func (huo *HostUpdateOne) Save(ctx context.Context) (*Host, error)

Save executes the query and returns the updated Host entity.

func (*HostUpdateOne) SaveX

func (huo *HostUpdateOne) SaveX(ctx context.Context) *Host

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

func (*HostUpdateOne) SetHostname

func (huo *HostUpdateOne) SetHostname(s string) *HostUpdateOne

SetHostname sets the "hostname" field.

func (*HostUpdateOne) SetInterface

func (huo *HostUpdateOne) SetInterface(s string) *HostUpdateOne

SetInterface sets the "interface" field.

func (*HostUpdateOne) SetLastSeen

func (huo *HostUpdateOne) SetLastSeen(i int) *HostUpdateOne

SetLastSeen sets the "lastSeen" field.

func (*HostUpdateOne) SetNillableLastSeen

func (huo *HostUpdateOne) SetNillableLastSeen(i *int) *HostUpdateOne

SetNillableLastSeen sets the "lastSeen" field if the given value is not nil.

type Hosts

type Hosts []*Host

Hosts is a parsable slice of Host.

type MutateFunc

type MutateFunc = ent.MutateFunc

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

type Mutation

type Mutation = ent.Mutation

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

type Mutator

type Mutator = ent.Mutator

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

type NotFoundError

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

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

func (*NotFoundError) Error

func (e *NotFoundError) Error() string

Error implements the error interface.

type NotLoadedError

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

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

func (*NotLoadedError) Error

func (e *NotLoadedError) Error() string

Error implements the error interface.

type NotSingularError

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

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

func (*NotSingularError) Error

func (e *NotSingularError) Error() string

Error implements the error interface.

type Op

type Op = ent.Op

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

type Option

type Option func(*config)

Option function to configure the client.

func Debug

func Debug() Option

Debug enables debug logging on the ent.Driver.

func Driver

func Driver(driver dialect.Driver) Option

Driver configures the client driver.

func Log

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

Log sets the logging function for debug mode.

type OrderFunc

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

OrderFunc applies an ordering on the sql selector.

func Asc

func Asc(fields ...string) OrderFunc

Asc applies the given fields in ASC order.

func Desc

func Desc(fields ...string) OrderFunc

Desc applies the given fields in DESC order.

type Policy

type Policy = ent.Policy

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

type Query

type Query = ent.Query

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

type RollbackFunc

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

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

func (RollbackFunc) Rollback

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

Rollback calls f(ctx, m).

type RollbackHook

type RollbackHook func(Rollbacker) Rollbacker

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

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

type Rollbacker

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

Rollbacker is the interface that wraps the Rollbacker method.

type Tx

type Tx struct {

	// Action is the client for interacting with the Action builders.
	Action *ActionClient
	// Bot is the client for interacting with the Bot builders.
	Bot *BotClient
	// Group is the client for interacting with the Group builders.
	Group *GroupClient
	// Host is the client for interacting with the Host builders.
	Host *HostClient
	// User is the client for interacting with the User builders.
	User *UserClient
	// contains filtered or unexported fields
}

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

func TxFromContext

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 User

type User struct {

	// ID of the ent.
	ID int `json:"id,omitempty"`
	// Username holds the value of the "username" field.
	Username string `json:"username,omitempty"`
	// Password holds the value of the "password" field.
	Password string `json:"password,omitempty"`
	// contains filtered or unexported fields
}

User is the model entity for the User schema.

func (*User) String

func (u *User) String() string

String implements the fmt.Stringer.

func (*User) Unwrap

func (u *User) Unwrap() *User

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

func (*User) Update

func (u *User) Update() *UserUpdateOne

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

type UserClient

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

UserClient is a client for the User schema.

func NewUserClient

func NewUserClient(c config) *UserClient

NewUserClient returns a client for the User from the given config.

func (*UserClient) Create

func (c *UserClient) Create() *UserCreate

Create returns a create builder for User.

func (*UserClient) CreateBulk

func (c *UserClient) CreateBulk(builders ...*UserCreate) *UserCreateBulk

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

func (*UserClient) Delete

func (c *UserClient) Delete() *UserDelete

Delete returns a delete builder for User.

func (*UserClient) DeleteOne

func (c *UserClient) DeleteOne(u *User) *UserDeleteOne

DeleteOne returns a delete builder for the given entity.

func (*UserClient) DeleteOneID

func (c *UserClient) DeleteOneID(id int) *UserDeleteOne

DeleteOneID returns a delete builder for the given id.

func (*UserClient) Get

func (c *UserClient) Get(ctx context.Context, id int) (*User, error)

Get returns a User entity by its id.

func (*UserClient) GetX

func (c *UserClient) GetX(ctx context.Context, id int) *User

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

func (*UserClient) Hooks

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

Hooks returns the client hooks.

func (*UserClient) Query

func (c *UserClient) Query() *UserQuery

Query returns a query builder for User.

func (*UserClient) Update

func (c *UserClient) Update() *UserUpdate

Update returns an update builder for User.

func (*UserClient) UpdateOne

func (c *UserClient) UpdateOne(u *User) *UserUpdateOne

UpdateOne returns an update builder for the given entity.

func (*UserClient) UpdateOneID

func (c *UserClient) UpdateOneID(id int) *UserUpdateOne

UpdateOneID returns an update builder for the given id.

func (*UserClient) Use

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

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

type UserCreate

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

UserCreate is the builder for creating a User entity.

func (*UserCreate) Mutation

func (uc *UserCreate) Mutation() *UserMutation

Mutation returns the UserMutation object of the builder.

func (*UserCreate) Save

func (uc *UserCreate) Save(ctx context.Context) (*User, error)

Save creates the User in the database.

func (*UserCreate) SaveX

func (uc *UserCreate) SaveX(ctx context.Context) *User

SaveX calls Save and panics if Save returns an error.

func (*UserCreate) SetPassword

func (uc *UserCreate) SetPassword(s string) *UserCreate

SetPassword sets the "password" field.

func (*UserCreate) SetUsername

func (uc *UserCreate) SetUsername(s string) *UserCreate

SetUsername sets the "username" field.

type UserCreateBulk

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

UserCreateBulk is the builder for creating many User entities in bulk.

func (*UserCreateBulk) Save

func (ucb *UserCreateBulk) Save(ctx context.Context) ([]*User, error)

Save creates the User entities in the database.

func (*UserCreateBulk) SaveX

func (ucb *UserCreateBulk) SaveX(ctx context.Context) []*User

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

type UserDelete

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

UserDelete is the builder for deleting a User entity.

func (*UserDelete) Exec

func (ud *UserDelete) Exec(ctx context.Context) (int, error)

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

func (*UserDelete) ExecX

func (ud *UserDelete) ExecX(ctx context.Context) int

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

func (*UserDelete) Where

func (ud *UserDelete) Where(ps ...predicate.User) *UserDelete

Where adds a new predicate to the UserDelete builder.

type UserDeleteOne

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

UserDeleteOne is the builder for deleting a single User entity.

func (*UserDeleteOne) Exec

func (udo *UserDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*UserDeleteOne) ExecX

func (udo *UserDeleteOne) ExecX(ctx context.Context)

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

type UserGroupBy

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

UserGroupBy is the group-by builder for User entities.

func (*UserGroupBy) Aggregate

func (ugb *UserGroupBy) Aggregate(fns ...AggregateFunc) *UserGroupBy

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

func (*UserGroupBy) Bool

func (ugb *UserGroupBy) Bool(ctx context.Context) (_ bool, err error)

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

func (*UserGroupBy) BoolX

func (ugb *UserGroupBy) BoolX(ctx context.Context) bool

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

func (*UserGroupBy) Bools

func (ugb *UserGroupBy) Bools(ctx context.Context) ([]bool, error)

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

func (*UserGroupBy) BoolsX

func (ugb *UserGroupBy) BoolsX(ctx context.Context) []bool

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

func (*UserGroupBy) Float64

func (ugb *UserGroupBy) Float64(ctx context.Context) (_ float64, err error)

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

func (*UserGroupBy) Float64X

func (ugb *UserGroupBy) Float64X(ctx context.Context) float64

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

func (*UserGroupBy) Float64s

func (ugb *UserGroupBy) Float64s(ctx context.Context) ([]float64, error)

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

func (*UserGroupBy) Float64sX

func (ugb *UserGroupBy) Float64sX(ctx context.Context) []float64

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

func (*UserGroupBy) Int

func (ugb *UserGroupBy) Int(ctx context.Context) (_ int, err error)

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

func (*UserGroupBy) IntX

func (ugb *UserGroupBy) IntX(ctx context.Context) int

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

func (*UserGroupBy) Ints

func (ugb *UserGroupBy) Ints(ctx context.Context) ([]int, error)

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

func (*UserGroupBy) IntsX

func (ugb *UserGroupBy) IntsX(ctx context.Context) []int

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

func (*UserGroupBy) Scan

func (ugb *UserGroupBy) Scan(ctx context.Context, v interface{}) error

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

func (*UserGroupBy) ScanX

func (ugb *UserGroupBy) ScanX(ctx context.Context, v interface{})

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

func (*UserGroupBy) String

func (ugb *UserGroupBy) String(ctx context.Context) (_ string, err error)

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

func (*UserGroupBy) StringX

func (ugb *UserGroupBy) StringX(ctx context.Context) string

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

func (*UserGroupBy) Strings

func (ugb *UserGroupBy) Strings(ctx context.Context) ([]string, error)

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

func (*UserGroupBy) StringsX

func (ugb *UserGroupBy) StringsX(ctx context.Context) []string

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

type UserMutation

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

UserMutation represents an operation that mutates the User nodes in the graph.

func (*UserMutation) AddField

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

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

func (*UserMutation) AddedEdges

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

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

func (*UserMutation) AddedField

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

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

func (*UserMutation) AddedFields

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

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

func (*UserMutation) AddedIDs

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

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

func (*UserMutation) ClearEdge

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

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

func (*UserMutation) ClearField

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

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

func (*UserMutation) ClearedEdges

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

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

func (*UserMutation) ClearedFields

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

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

func (UserMutation) Client

func (m UserMutation) Client() *Client

Client returns a new `ent.Client` from the mutation. If the mutation was executed in a transaction (ent.Tx), a transactional client is returned.

func (*UserMutation) EdgeCleared

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

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

func (*UserMutation) Field

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

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

func (*UserMutation) FieldCleared

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

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

func (*UserMutation) Fields

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

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

func (*UserMutation) ID

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

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

func (*UserMutation) OldField

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

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

func (*UserMutation) OldPassword

func (m *UserMutation) OldPassword(ctx context.Context) (v string, err error)

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

func (*UserMutation) OldUsername

func (m *UserMutation) OldUsername(ctx context.Context) (v string, err error)

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

func (*UserMutation) Op

func (m *UserMutation) Op() Op

Op returns the operation name.

func (*UserMutation) Password

func (m *UserMutation) Password() (r string, exists bool)

Password returns the value of the "password" field in the mutation.

func (*UserMutation) RemovedEdges

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

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

func (*UserMutation) RemovedIDs

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

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

func (*UserMutation) ResetEdge

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

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

func (*UserMutation) ResetField

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

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

func (*UserMutation) ResetPassword

func (m *UserMutation) ResetPassword()

ResetPassword resets all changes to the "password" field.

func (*UserMutation) ResetUsername

func (m *UserMutation) ResetUsername()

ResetUsername resets all changes to the "username" field.

func (*UserMutation) SetField

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

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

func (*UserMutation) SetPassword

func (m *UserMutation) SetPassword(s string)

SetPassword sets the "password" field.

func (*UserMutation) SetUsername

func (m *UserMutation) SetUsername(s string)

SetUsername sets the "username" field.

func (UserMutation) Tx

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

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

func (*UserMutation) Type

func (m *UserMutation) Type() string

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

func (*UserMutation) Username

func (m *UserMutation) Username() (r string, exists bool)

Username returns the value of the "username" field in the mutation.

type UserQuery

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

UserQuery is the builder for querying User entities.

func (*UserQuery) All

func (uq *UserQuery) All(ctx context.Context) ([]*User, error)

All executes the query and returns a list of Users.

func (*UserQuery) AllX

func (uq *UserQuery) AllX(ctx context.Context) []*User

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

func (*UserQuery) Clone

func (uq *UserQuery) Clone() *UserQuery

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

func (*UserQuery) Count

func (uq *UserQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*UserQuery) CountX

func (uq *UserQuery) CountX(ctx context.Context) int

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

func (*UserQuery) Exist

func (uq *UserQuery) Exist(ctx context.Context) (bool, error)

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

func (*UserQuery) ExistX

func (uq *UserQuery) ExistX(ctx context.Context) bool

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

func (*UserQuery) First

func (uq *UserQuery) First(ctx context.Context) (*User, error)

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

func (*UserQuery) FirstID

func (uq *UserQuery) FirstID(ctx context.Context) (id int, err error)

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

func (*UserQuery) FirstIDX

func (uq *UserQuery) FirstIDX(ctx context.Context) int

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

func (*UserQuery) FirstX

func (uq *UserQuery) FirstX(ctx context.Context) *User

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

func (*UserQuery) GroupBy

func (uq *UserQuery) GroupBy(field string, fields ...string) *UserGroupBy

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

Example:

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

client.User.Query().
	GroupBy(user.FieldUsername).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*UserQuery) IDs

func (uq *UserQuery) IDs(ctx context.Context) ([]int, error)

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

func (*UserQuery) IDsX

func (uq *UserQuery) IDsX(ctx context.Context) []int

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

func (*UserQuery) Limit

func (uq *UserQuery) Limit(limit int) *UserQuery

Limit adds a limit step to the query.

func (*UserQuery) Offset

func (uq *UserQuery) Offset(offset int) *UserQuery

Offset adds an offset step to the query.

func (*UserQuery) Only

func (uq *UserQuery) Only(ctx context.Context) (*User, error)

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

func (*UserQuery) OnlyID

func (uq *UserQuery) OnlyID(ctx context.Context) (id int, err error)

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

func (*UserQuery) OnlyIDX

func (uq *UserQuery) OnlyIDX(ctx context.Context) int

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

func (*UserQuery) OnlyX

func (uq *UserQuery) OnlyX(ctx context.Context) *User

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

func (*UserQuery) Order

func (uq *UserQuery) Order(o ...OrderFunc) *UserQuery

Order adds an order step to the query.

func (*UserQuery) Select

func (uq *UserQuery) Select(field string, fields ...string) *UserSelect

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

Example:

var v []struct {
	Username string `json:"username,omitempty"`
}

client.User.Query().
	Select(user.FieldUsername).
	Scan(ctx, &v)

func (*UserQuery) Where

func (uq *UserQuery) Where(ps ...predicate.User) *UserQuery

Where adds a new predicate for the UserQuery builder.

type UserSelect

type UserSelect struct {
	*UserQuery
	// contains filtered or unexported fields
}

UserSelect is the builder for selecting fields of User entities.

func (*UserSelect) Bool

func (us *UserSelect) Bool(ctx context.Context) (_ bool, err error)

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

func (*UserSelect) BoolX

func (us *UserSelect) BoolX(ctx context.Context) bool

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

func (*UserSelect) Bools

func (us *UserSelect) Bools(ctx context.Context) ([]bool, error)

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

func (*UserSelect) BoolsX

func (us *UserSelect) BoolsX(ctx context.Context) []bool

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

func (*UserSelect) Float64

func (us *UserSelect) Float64(ctx context.Context) (_ float64, err error)

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

func (*UserSelect) Float64X

func (us *UserSelect) Float64X(ctx context.Context) float64

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

func (*UserSelect) Float64s

func (us *UserSelect) Float64s(ctx context.Context) ([]float64, error)

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

func (*UserSelect) Float64sX

func (us *UserSelect) Float64sX(ctx context.Context) []float64

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

func (*UserSelect) Int

func (us *UserSelect) Int(ctx context.Context) (_ int, err error)

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

func (*UserSelect) IntX

func (us *UserSelect) IntX(ctx context.Context) int

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

func (*UserSelect) Ints

func (us *UserSelect) Ints(ctx context.Context) ([]int, error)

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

func (*UserSelect) IntsX

func (us *UserSelect) IntsX(ctx context.Context) []int

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

func (*UserSelect) Scan

func (us *UserSelect) Scan(ctx context.Context, v interface{}) error

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

func (*UserSelect) ScanX

func (us *UserSelect) ScanX(ctx context.Context, v interface{})

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

func (*UserSelect) String

func (us *UserSelect) String(ctx context.Context) (_ string, err error)

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

func (*UserSelect) StringX

func (us *UserSelect) StringX(ctx context.Context) string

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

func (*UserSelect) Strings

func (us *UserSelect) Strings(ctx context.Context) ([]string, error)

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

func (*UserSelect) StringsX

func (us *UserSelect) StringsX(ctx context.Context) []string

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

type UserUpdate

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

UserUpdate is the builder for updating User entities.

func (*UserUpdate) Exec

func (uu *UserUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*UserUpdate) ExecX

func (uu *UserUpdate) ExecX(ctx context.Context)

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

func (*UserUpdate) Mutation

func (uu *UserUpdate) Mutation() *UserMutation

Mutation returns the UserMutation object of the builder.

func (*UserUpdate) Save

func (uu *UserUpdate) Save(ctx context.Context) (int, error)

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

func (*UserUpdate) SaveX

func (uu *UserUpdate) SaveX(ctx context.Context) int

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

func (*UserUpdate) SetPassword

func (uu *UserUpdate) SetPassword(s string) *UserUpdate

SetPassword sets the "password" field.

func (*UserUpdate) SetUsername

func (uu *UserUpdate) SetUsername(s string) *UserUpdate

SetUsername sets the "username" field.

func (*UserUpdate) Where

func (uu *UserUpdate) Where(ps ...predicate.User) *UserUpdate

Where adds a new predicate for the UserUpdate builder.

type UserUpdateOne

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

UserUpdateOne is the builder for updating a single User entity.

func (*UserUpdateOne) Exec

func (uuo *UserUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*UserUpdateOne) ExecX

func (uuo *UserUpdateOne) ExecX(ctx context.Context)

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

func (*UserUpdateOne) Mutation

func (uuo *UserUpdateOne) Mutation() *UserMutation

Mutation returns the UserMutation object of the builder.

func (*UserUpdateOne) Save

func (uuo *UserUpdateOne) Save(ctx context.Context) (*User, error)

Save executes the query and returns the updated User entity.

func (*UserUpdateOne) SaveX

func (uuo *UserUpdateOne) SaveX(ctx context.Context) *User

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

func (*UserUpdateOne) SetPassword

func (uuo *UserUpdateOne) SetPassword(s string) *UserUpdateOne

SetPassword sets the "password" field.

func (*UserUpdateOne) SetUsername

func (uuo *UserUpdateOne) SetUsername(s string) *UserUpdateOne

SetUsername sets the "username" field.

type Users

type Users []*User

Users is a parsable slice of User.

type ValidationError

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

ValidationError returns when validating a field fails.

func (*ValidationError) Error

func (e *ValidationError) Error() string

Error implements the error interface.

func (*ValidationError) Unwrap

func (e *ValidationError) Unwrap() error

Unwrap implements the errors.Wrapper interface.

type Value

type Value = ent.Value

ent aliases to avoid import 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