ent

package
v0.0.0-...-e544f65 Latest Latest
Warning

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

Go to latest
Published: Jun 24, 2022 License: MIT Imports: 23 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.
	TypeCpu     = "Cpu"
	TypeDisk    = "Disk"
	TypeHost    = "Host"
	TypeNetstat = "Netstat"
	TypeNetwork = "Network"
)

Variables

This section is empty.

Functions

func IsConstraintError

func IsConstraintError(err error) bool

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

func IsNotFound

func IsNotFound(err error) bool

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

func IsNotLoaded

func IsNotLoaded(err error) bool

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

func IsNotSingular

func IsNotSingular(err error) bool

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

func IsValidationError

func IsValidationError(err error) bool

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

func MaskNotFound

func MaskNotFound(err error) error

MaskNotFound masks not found error.

func NewContext

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

NewContext returns a new context with the given Client attached.

func NewTxContext

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

NewTxContext returns a new context with the given Tx attached.

Types

type AggregateFunc

type AggregateFunc func(*sql.Selector) string

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

func As

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

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

func Count

func Count() AggregateFunc

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

func Max

func Max(field string) AggregateFunc

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

func Mean

func Mean(field string) AggregateFunc

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

func Min

func Min(field string) AggregateFunc

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

func Sum

func Sum(field string) AggregateFunc

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

type CPUCreate

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

CPUCreate is the builder for creating a Cpu entity.

func (*CPUCreate) Exec

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

Exec executes the query.

func (*CPUCreate) ExecX

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

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

func (*CPUCreate) Mutation

func (cc *CPUCreate) Mutation() *CPUMutation

Mutation returns the CPUMutation object of the builder.

func (*CPUCreate) Save

func (cc *CPUCreate) Save(ctx context.Context) (*Cpu, error)

Save creates the Cpu in the database.

func (*CPUCreate) SaveX

func (cc *CPUCreate) SaveX(ctx context.Context) *Cpu

SaveX calls Save and panics if Save returns an error.

func (*CPUCreate) SetCPU

func (cc *CPUCreate) SetCPU(i int) *CPUCreate

SetCPU sets the "CPU" field.

func (*CPUCreate) SetCreatedAt

func (cc *CPUCreate) SetCreatedAt(t time.Time) *CPUCreate

SetCreatedAt sets the "created_at" field.

func (*CPUCreate) SetFamily

func (cc *CPUCreate) SetFamily(s string) *CPUCreate

SetFamily sets the "family" field.

func (*CPUCreate) SetHostID

func (cc *CPUCreate) SetHostID(h *Host) *CPUCreate

SetHostID sets the "host_id" edge to the Host entity.

func (*CPUCreate) SetHostIDID

func (cc *CPUCreate) SetHostIDID(id string) *CPUCreate

SetHostIDID sets the "host_id" edge to the Host entity by ID.

func (*CPUCreate) SetModel

func (cc *CPUCreate) SetModel(s string) *CPUCreate

SetModel sets the "model" field.

func (*CPUCreate) SetModelName

func (cc *CPUCreate) SetModelName(s string) *CPUCreate

SetModelName sets the "model_name" field.

func (*CPUCreate) SetNillableCreatedAt

func (cc *CPUCreate) SetNillableCreatedAt(t *time.Time) *CPUCreate

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

func (*CPUCreate) SetNillableHostIDID

func (cc *CPUCreate) SetNillableHostIDID(id *string) *CPUCreate

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

func (*CPUCreate) SetNillableUpdatedAt

func (cc *CPUCreate) SetNillableUpdatedAt(t *time.Time) *CPUCreate

SetNillableUpdatedAt sets the "updated_at" field if the given value is not nil.

func (*CPUCreate) SetUpdatedAt

func (cc *CPUCreate) SetUpdatedAt(t time.Time) *CPUCreate

SetUpdatedAt sets the "updated_at" field.

func (*CPUCreate) SetVendorID

func (cc *CPUCreate) SetVendorID(s string) *CPUCreate

SetVendorID sets the "vendor_id" field.

type CPUCreateBulk

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

CPUCreateBulk is the builder for creating many Cpu entities in bulk.

func (*CPUCreateBulk) Exec

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

Exec executes the query.

func (*CPUCreateBulk) ExecX

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

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

func (*CPUCreateBulk) Save

func (ccb *CPUCreateBulk) Save(ctx context.Context) ([]*Cpu, error)

Save creates the Cpu entities in the database.

func (*CPUCreateBulk) SaveX

func (ccb *CPUCreateBulk) SaveX(ctx context.Context) []*Cpu

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

type CPUDelete

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

CPUDelete is the builder for deleting a Cpu entity.

func (*CPUDelete) Exec

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

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

func (*CPUDelete) ExecX

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

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

func (*CPUDelete) Where

func (cd *CPUDelete) Where(ps ...predicate.Cpu) *CPUDelete

Where appends a list predicates to the CPUDelete builder.

type CPUDeleteOne

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

CPUDeleteOne is the builder for deleting a single Cpu entity.

func (*CPUDeleteOne) Exec

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

Exec executes the deletion query.

func (*CPUDeleteOne) ExecX

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

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

type CPUGroupBy

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

CPUGroupBy is the group-by builder for Cpu entities.

func (*CPUGroupBy) Aggregate

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

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

func (*CPUGroupBy) Bool

func (cgb *CPUGroupBy) 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 (*CPUGroupBy) BoolX

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

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

func (*CPUGroupBy) Bools

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

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

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

func (*CPUGroupBy) Float64

func (cgb *CPUGroupBy) 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 (*CPUGroupBy) Float64X

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

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

func (*CPUGroupBy) Float64s

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

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

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

func (*CPUGroupBy) Int

func (cgb *CPUGroupBy) 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 (*CPUGroupBy) IntX

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

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

func (*CPUGroupBy) Ints

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

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

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

func (*CPUGroupBy) Scan

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

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

func (*CPUGroupBy) ScanX

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

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

func (*CPUGroupBy) String

func (cgb *CPUGroupBy) 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 (*CPUGroupBy) StringX

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

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

func (*CPUGroupBy) Strings

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

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

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

type CPUMutation

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

CPUMutation represents an operation that mutates the Cpu nodes in the graph.

func (*CPUMutation) AddCPU

func (m *CPUMutation) AddCPU(i int)

AddCPU adds i to the "CPU" field.

func (*CPUMutation) AddField

func (m *CPUMutation) 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 (*CPUMutation) AddedCPU

func (m *CPUMutation) AddedCPU() (r int, exists bool)

AddedCPU returns the value that was added to the "CPU" field in this mutation.

func (*CPUMutation) AddedEdges

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

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

func (*CPUMutation) AddedField

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

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

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

func (*CPUMutation) AddedIDs

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

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

func (*CPUMutation) CPU

func (m *CPUMutation) CPU() (r int, exists bool)

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

func (*CPUMutation) ClearEdge

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

func (m *CPUMutation) 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 (*CPUMutation) ClearHostID

func (m *CPUMutation) ClearHostID()

ClearHostID clears the "host_id" edge to the Host entity.

func (*CPUMutation) ClearedEdges

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

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

func (*CPUMutation) ClearedFields

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

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

func (CPUMutation) Client

func (m CPUMutation) 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 (*CPUMutation) CreatedAt

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

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

func (*CPUMutation) EdgeCleared

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

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

func (*CPUMutation) Family

func (m *CPUMutation) Family() (r string, exists bool)

Family returns the value of the "family" field in the mutation.

func (*CPUMutation) Field

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

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

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

func (*CPUMutation) Fields

func (m *CPUMutation) 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 (*CPUMutation) HostIDCleared

func (m *CPUMutation) HostIDCleared() bool

HostIDCleared reports if the "host_id" edge to the Host entity was cleared.

func (*CPUMutation) HostIDID

func (m *CPUMutation) HostIDID() (id string, exists bool)

HostIDID returns the "host_id" edge ID in the mutation.

func (*CPUMutation) HostIDIDs

func (m *CPUMutation) HostIDIDs() (ids []string)

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

func (*CPUMutation) ID

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

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

func (*CPUMutation) IDs

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

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

func (*CPUMutation) Model

func (m *CPUMutation) Model() (r string, exists bool)

Model returns the value of the "model" field in the mutation.

func (*CPUMutation) ModelName

func (m *CPUMutation) ModelName() (r string, exists bool)

ModelName returns the value of the "model_name" field in the mutation.

func (*CPUMutation) OldCPU

func (m *CPUMutation) OldCPU(ctx context.Context) (v int, err error)

OldCPU returns the old "CPU" field's value of the Cpu entity. If the Cpu 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 (*CPUMutation) OldCreatedAt

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

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

func (m *CPUMutation) OldFamily(ctx context.Context) (v string, err error)

OldFamily returns the old "family" field's value of the Cpu entity. If the Cpu 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 (*CPUMutation) OldField

func (m *CPUMutation) 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 (*CPUMutation) OldModel

func (m *CPUMutation) OldModel(ctx context.Context) (v string, err error)

OldModel returns the old "model" field's value of the Cpu entity. If the Cpu 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 (*CPUMutation) OldModelName

func (m *CPUMutation) OldModelName(ctx context.Context) (v string, err error)

OldModelName returns the old "model_name" field's value of the Cpu entity. If the Cpu 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 (*CPUMutation) OldUpdatedAt

func (m *CPUMutation) OldUpdatedAt(ctx context.Context) (v time.Time, err error)

OldUpdatedAt returns the old "updated_at" field's value of the Cpu entity. If the Cpu 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 (*CPUMutation) OldVendorID

func (m *CPUMutation) OldVendorID(ctx context.Context) (v string, err error)

OldVendorID returns the old "vendor_id" field's value of the Cpu entity. If the Cpu 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 (*CPUMutation) Op

func (m *CPUMutation) Op() Op

Op returns the operation name.

func (*CPUMutation) RemovedEdges

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

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

func (*CPUMutation) RemovedIDs

func (m *CPUMutation) 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 (*CPUMutation) ResetCPU

func (m *CPUMutation) ResetCPU()

ResetCPU resets all changes to the "CPU" field.

func (*CPUMutation) ResetCreatedAt

func (m *CPUMutation) ResetCreatedAt()

ResetCreatedAt resets all changes to the "created_at" field.

func (*CPUMutation) ResetEdge

func (m *CPUMutation) 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 (*CPUMutation) ResetFamily

func (m *CPUMutation) ResetFamily()

ResetFamily resets all changes to the "family" field.

func (*CPUMutation) ResetField

func (m *CPUMutation) 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 (*CPUMutation) ResetHostID

func (m *CPUMutation) ResetHostID()

ResetHostID resets all changes to the "host_id" edge.

func (*CPUMutation) ResetModel

func (m *CPUMutation) ResetModel()

ResetModel resets all changes to the "model" field.

func (*CPUMutation) ResetModelName

func (m *CPUMutation) ResetModelName()

ResetModelName resets all changes to the "model_name" field.

func (*CPUMutation) ResetUpdatedAt

func (m *CPUMutation) ResetUpdatedAt()

ResetUpdatedAt resets all changes to the "updated_at" field.

func (*CPUMutation) ResetVendorID

func (m *CPUMutation) ResetVendorID()

ResetVendorID resets all changes to the "vendor_id" field.

func (*CPUMutation) SetCPU

func (m *CPUMutation) SetCPU(i int)

SetCPU sets the "CPU" field.

func (*CPUMutation) SetCreatedAt

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

SetCreatedAt sets the "created_at" field.

func (*CPUMutation) SetFamily

func (m *CPUMutation) SetFamily(s string)

SetFamily sets the "family" field.

func (*CPUMutation) SetField

func (m *CPUMutation) 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 (*CPUMutation) SetHostIDID

func (m *CPUMutation) SetHostIDID(id string)

SetHostIDID sets the "host_id" edge to the Host entity by id.

func (*CPUMutation) SetModel

func (m *CPUMutation) SetModel(s string)

SetModel sets the "model" field.

func (*CPUMutation) SetModelName

func (m *CPUMutation) SetModelName(s string)

SetModelName sets the "model_name" field.

func (*CPUMutation) SetUpdatedAt

func (m *CPUMutation) SetUpdatedAt(t time.Time)

SetUpdatedAt sets the "updated_at" field.

func (*CPUMutation) SetVendorID

func (m *CPUMutation) SetVendorID(s string)

SetVendorID sets the "vendor_id" field.

func (CPUMutation) Tx

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

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

func (*CPUMutation) Type

func (m *CPUMutation) Type() string

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

func (*CPUMutation) UpdatedAt

func (m *CPUMutation) UpdatedAt() (r time.Time, exists bool)

UpdatedAt returns the value of the "updated_at" field in the mutation.

func (*CPUMutation) VendorID

func (m *CPUMutation) VendorID() (r string, exists bool)

VendorID returns the value of the "vendor_id" field in the mutation.

func (*CPUMutation) Where

func (m *CPUMutation) Where(ps ...predicate.Cpu)

Where appends a list predicates to the CPUMutation builder.

type CPUQuery

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

CPUQuery is the builder for querying Cpu entities.

func (*CPUQuery) All

func (cq *CPUQuery) All(ctx context.Context) ([]*Cpu, error)

All executes the query and returns a list of Cpus.

func (*CPUQuery) AllX

func (cq *CPUQuery) AllX(ctx context.Context) []*Cpu

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

func (*CPUQuery) Clone

func (cq *CPUQuery) Clone() *CPUQuery

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

func (*CPUQuery) Count

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

Count returns the count of the given query.

func (*CPUQuery) CountX

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

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

func (*CPUQuery) Exist

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

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

func (*CPUQuery) ExistX

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

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

func (*CPUQuery) First

func (cq *CPUQuery) First(ctx context.Context) (*Cpu, error)

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

func (*CPUQuery) FirstID

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

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

func (*CPUQuery) FirstIDX

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

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

func (*CPUQuery) FirstX

func (cq *CPUQuery) FirstX(ctx context.Context) *Cpu

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

func (*CPUQuery) GroupBy

func (cq *CPUQuery) GroupBy(field string, fields ...string) *CPUGroupBy

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

client.CPU.Query().
	GroupBy(cpu.FieldCPU).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*CPUQuery) IDs

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

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

func (*CPUQuery) IDsX

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

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

func (*CPUQuery) Limit

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

Limit adds a limit step to the query.

func (*CPUQuery) Offset

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

Offset adds an offset step to the query.

func (*CPUQuery) Only

func (cq *CPUQuery) Only(ctx context.Context) (*Cpu, error)

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

func (*CPUQuery) OnlyID

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

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

func (*CPUQuery) OnlyIDX

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

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

func (*CPUQuery) OnlyX

func (cq *CPUQuery) OnlyX(ctx context.Context) *Cpu

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

func (*CPUQuery) Order

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

Order adds an order step to the query.

func (*CPUQuery) QueryHostID

func (cq *CPUQuery) QueryHostID() *HostQuery

QueryHostID chains the current query on the "host_id" edge.

func (*CPUQuery) Select

func (cq *CPUQuery) Select(fields ...string) *CPUSelect

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 {
	CPU int `json:"CPU,omitempty"`
}

client.CPU.Query().
	Select(cpu.FieldCPU).
	Scan(ctx, &v)

func (*CPUQuery) Unique

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

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

func (*CPUQuery) Where

func (cq *CPUQuery) Where(ps ...predicate.Cpu) *CPUQuery

Where adds a new predicate for the CPUQuery builder.

func (*CPUQuery) WithHostID

func (cq *CPUQuery) WithHostID(opts ...func(*HostQuery)) *CPUQuery

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

type CPUSelect

type CPUSelect struct {
	*CPUQuery
	// contains filtered or unexported fields
}

CPUSelect is the builder for selecting fields of CPU entities.

func (*CPUSelect) Bool

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

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

func (*CPUSelect) BoolX

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

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

func (*CPUSelect) Bools

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

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

func (*CPUSelect) BoolsX

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

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

func (*CPUSelect) Float64

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

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

func (*CPUSelect) Float64X

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

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

func (*CPUSelect) Float64s

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

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

func (*CPUSelect) Float64sX

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

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

func (*CPUSelect) Int

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

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

func (*CPUSelect) IntX

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

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

func (*CPUSelect) Ints

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

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

func (*CPUSelect) IntsX

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

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

func (*CPUSelect) Scan

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

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

func (*CPUSelect) ScanX

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

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

func (*CPUSelect) String

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

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

func (*CPUSelect) StringX

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

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

func (*CPUSelect) Strings

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

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

func (*CPUSelect) StringsX

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

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

type CPUUpdate

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

CPUUpdate is the builder for updating Cpu entities.

func (*CPUUpdate) AddCPU

func (cu *CPUUpdate) AddCPU(i int) *CPUUpdate

AddCPU adds i to the "CPU" field.

func (*CPUUpdate) ClearHostID

func (cu *CPUUpdate) ClearHostID() *CPUUpdate

ClearHostID clears the "host_id" edge to the Host entity.

func (*CPUUpdate) Exec

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

Exec executes the query.

func (*CPUUpdate) ExecX

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

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

func (*CPUUpdate) Mutation

func (cu *CPUUpdate) Mutation() *CPUMutation

Mutation returns the CPUMutation object of the builder.

func (*CPUUpdate) Save

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

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

func (*CPUUpdate) SaveX

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

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

func (*CPUUpdate) SetCPU

func (cu *CPUUpdate) SetCPU(i int) *CPUUpdate

SetCPU sets the "CPU" field.

func (*CPUUpdate) SetCreatedAt

func (cu *CPUUpdate) SetCreatedAt(t time.Time) *CPUUpdate

SetCreatedAt sets the "created_at" field.

func (*CPUUpdate) SetFamily

func (cu *CPUUpdate) SetFamily(s string) *CPUUpdate

SetFamily sets the "family" field.

func (*CPUUpdate) SetHostID

func (cu *CPUUpdate) SetHostID(h *Host) *CPUUpdate

SetHostID sets the "host_id" edge to the Host entity.

func (*CPUUpdate) SetHostIDID

func (cu *CPUUpdate) SetHostIDID(id string) *CPUUpdate

SetHostIDID sets the "host_id" edge to the Host entity by ID.

func (*CPUUpdate) SetModel

func (cu *CPUUpdate) SetModel(s string) *CPUUpdate

SetModel sets the "model" field.

func (*CPUUpdate) SetModelName

func (cu *CPUUpdate) SetModelName(s string) *CPUUpdate

SetModelName sets the "model_name" field.

func (*CPUUpdate) SetNillableCreatedAt

func (cu *CPUUpdate) SetNillableCreatedAt(t *time.Time) *CPUUpdate

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

func (*CPUUpdate) SetNillableHostIDID

func (cu *CPUUpdate) SetNillableHostIDID(id *string) *CPUUpdate

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

func (*CPUUpdate) SetNillableUpdatedAt

func (cu *CPUUpdate) SetNillableUpdatedAt(t *time.Time) *CPUUpdate

SetNillableUpdatedAt sets the "updated_at" field if the given value is not nil.

func (*CPUUpdate) SetUpdatedAt

func (cu *CPUUpdate) SetUpdatedAt(t time.Time) *CPUUpdate

SetUpdatedAt sets the "updated_at" field.

func (*CPUUpdate) SetVendorID

func (cu *CPUUpdate) SetVendorID(s string) *CPUUpdate

SetVendorID sets the "vendor_id" field.

func (*CPUUpdate) Where

func (cu *CPUUpdate) Where(ps ...predicate.Cpu) *CPUUpdate

Where appends a list predicates to the CPUUpdate builder.

type CPUUpdateOne

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

CPUUpdateOne is the builder for updating a single Cpu entity.

func (*CPUUpdateOne) AddCPU

func (cuo *CPUUpdateOne) AddCPU(i int) *CPUUpdateOne

AddCPU adds i to the "CPU" field.

func (*CPUUpdateOne) ClearHostID

func (cuo *CPUUpdateOne) ClearHostID() *CPUUpdateOne

ClearHostID clears the "host_id" edge to the Host entity.

func (*CPUUpdateOne) Exec

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

Exec executes the query on the entity.

func (*CPUUpdateOne) ExecX

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

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

func (*CPUUpdateOne) Mutation

func (cuo *CPUUpdateOne) Mutation() *CPUMutation

Mutation returns the CPUMutation object of the builder.

func (*CPUUpdateOne) Save

func (cuo *CPUUpdateOne) Save(ctx context.Context) (*Cpu, error)

Save executes the query and returns the updated Cpu entity.

func (*CPUUpdateOne) SaveX

func (cuo *CPUUpdateOne) SaveX(ctx context.Context) *Cpu

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

func (*CPUUpdateOne) Select

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

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

func (*CPUUpdateOne) SetCPU

func (cuo *CPUUpdateOne) SetCPU(i int) *CPUUpdateOne

SetCPU sets the "CPU" field.

func (*CPUUpdateOne) SetCreatedAt

func (cuo *CPUUpdateOne) SetCreatedAt(t time.Time) *CPUUpdateOne

SetCreatedAt sets the "created_at" field.

func (*CPUUpdateOne) SetFamily

func (cuo *CPUUpdateOne) SetFamily(s string) *CPUUpdateOne

SetFamily sets the "family" field.

func (*CPUUpdateOne) SetHostID

func (cuo *CPUUpdateOne) SetHostID(h *Host) *CPUUpdateOne

SetHostID sets the "host_id" edge to the Host entity.

func (*CPUUpdateOne) SetHostIDID

func (cuo *CPUUpdateOne) SetHostIDID(id string) *CPUUpdateOne

SetHostIDID sets the "host_id" edge to the Host entity by ID.

func (*CPUUpdateOne) SetModel

func (cuo *CPUUpdateOne) SetModel(s string) *CPUUpdateOne

SetModel sets the "model" field.

func (*CPUUpdateOne) SetModelName

func (cuo *CPUUpdateOne) SetModelName(s string) *CPUUpdateOne

SetModelName sets the "model_name" field.

func (*CPUUpdateOne) SetNillableCreatedAt

func (cuo *CPUUpdateOne) SetNillableCreatedAt(t *time.Time) *CPUUpdateOne

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

func (*CPUUpdateOne) SetNillableHostIDID

func (cuo *CPUUpdateOne) SetNillableHostIDID(id *string) *CPUUpdateOne

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

func (*CPUUpdateOne) SetNillableUpdatedAt

func (cuo *CPUUpdateOne) SetNillableUpdatedAt(t *time.Time) *CPUUpdateOne

SetNillableUpdatedAt sets the "updated_at" field if the given value is not nil.

func (*CPUUpdateOne) SetUpdatedAt

func (cuo *CPUUpdateOne) SetUpdatedAt(t time.Time) *CPUUpdateOne

SetUpdatedAt sets the "updated_at" field.

func (*CPUUpdateOne) SetVendorID

func (cuo *CPUUpdateOne) SetVendorID(s string) *CPUUpdateOne

SetVendorID sets the "vendor_id" field.

type Client

type Client struct {

	// Schema is the client for creating, migrating and dropping schema.
	Schema *migrate.Schema
	// Cpu is the client for interacting with the Cpu builders.
	Cpu *CpuClient
	// Disk is the client for interacting with the Disk builders.
	Disk *DiskClient
	// Host is the client for interacting with the Host builders.
	Host *HostClient
	// Netstat is the client for interacting with the Netstat builders.
	Netstat *NetstatClient
	// Network is the client for interacting with the Network builders.
	Network *NetworkClient
	// 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().
	Cpu.
	Query().
	Count(ctx)

func (*Client) Tx

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

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

func (*Client) Use

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

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

type CommitFunc

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

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

func (CommitFunc) Commit

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

Commit calls f(ctx, m).

type CommitHook

type CommitHook func(Committer) Committer

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

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

type Committer

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

Committer is the interface that wraps the Commit method.

type ConstraintError

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

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

func (ConstraintError) Error

func (e ConstraintError) Error() string

Error implements the error interface.

func (*ConstraintError) Unwrap

func (e *ConstraintError) Unwrap() error

Unwrap implements the errors.Wrapper interface.

type Cpu

type Cpu struct {

	// ID of the ent.
	ID int `json:"id,omitempty"`
	// CPU holds the value of the "CPU" field.
	CPU int `json:"CPU,omitempty"`
	// VendorID holds the value of the "vendor_id" field.
	VendorID string `json:"vendor_id,omitempty"`
	// Family holds the value of the "family" field.
	Family string `json:"family,omitempty"`
	// Model holds the value of the "model" field.
	Model string `json:"model,omitempty"`
	// ModelName holds the value of the "model_name" field.
	ModelName string `json:"model_name,omitempty"`
	// CreatedAt holds the value of the "created_at" field.
	CreatedAt time.Time `json:"created_at,omitempty"`
	// UpdatedAt holds the value of the "updated_at" field.
	UpdatedAt time.Time `json:"updated_at,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the CpuQuery when eager-loading is set.
	Edges CpuEdges `json:"edges"`
	// contains filtered or unexported fields
}

Cpu is the model entity for the Cpu schema.

func (*Cpu) QueryHostID

func (c *Cpu) QueryHostID() *HostQuery

QueryHostID queries the "host_id" edge of the Cpu entity.

func (*Cpu) String

func (c *Cpu) String() string

String implements the fmt.Stringer.

func (*Cpu) Unwrap

func (c *Cpu) Unwrap() *Cpu

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

func (c *Cpu) Update() *CPUUpdateOne

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

type CpuClient

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

CpuClient is a client for the Cpu schema.

func NewCpuClient

func NewCpuClient(c config) *CpuClient

NewCpuClient returns a client for the Cpu from the given config.

func (*CpuClient) Create

func (c *CpuClient) Create() *CPUCreate

Create returns a create builder for Cpu.

func (*CpuClient) CreateBulk

func (c *CpuClient) CreateBulk(builders ...*CPUCreate) *CPUCreateBulk

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

func (*CpuClient) Delete

func (c *CpuClient) Delete() *CPUDelete

Delete returns a delete builder for Cpu.

func (*CpuClient) DeleteOne

func (c *CpuClient) DeleteOne(cp *Cpu) *CPUDeleteOne

DeleteOne returns a delete builder for the given entity.

func (*CpuClient) DeleteOneID

func (c *CpuClient) DeleteOneID(id int) *CPUDeleteOne

DeleteOneID returns a delete builder for the given id.

func (*CpuClient) Get

func (c *CpuClient) Get(ctx context.Context, id int) (*Cpu, error)

Get returns a Cpu entity by its id.

func (*CpuClient) GetX

func (c *CpuClient) GetX(ctx context.Context, id int) *Cpu

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

func (*CpuClient) Hooks

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

Hooks returns the client hooks.

func (*CpuClient) Query

func (c *CpuClient) Query() *CPUQuery

Query returns a query builder for Cpu.

func (*CpuClient) QueryHostID

func (c *CpuClient) QueryHostID(cp *Cpu) *HostQuery

QueryHostID queries the host_id edge of a Cpu.

func (*CpuClient) Update

func (c *CpuClient) Update() *CPUUpdate

Update returns an update builder for Cpu.

func (*CpuClient) UpdateOne

func (c *CpuClient) UpdateOne(cp *Cpu) *CPUUpdateOne

UpdateOne returns an update builder for the given entity.

func (*CpuClient) UpdateOneID

func (c *CpuClient) UpdateOneID(id int) *CPUUpdateOne

UpdateOneID returns an update builder for the given id.

func (*CpuClient) Use

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

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

type CpuEdges

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

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

func (CpuEdges) HostIDOrErr

func (e CpuEdges) HostIDOrErr() (*Host, error)

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

type Cpus

type Cpus []*Cpu

Cpus is a parsable slice of Cpu.

type Disk

type Disk struct {

	// ID of the ent.
	ID int `json:"id,omitempty"`
	// Device holds the value of the "device" field.
	Device string `json:"device,omitempty"`
	// Mountpoint holds the value of the "Mountpoint" field.
	Mountpoint string `json:"Mountpoint,omitempty"`
	// Fstype holds the value of the "Fstype" field.
	Fstype string `json:"Fstype,omitempty"`
	// Opts holds the value of the "opts" field.
	Opts []string `json:"opts,omitempty"`
	// CreatedAt holds the value of the "created_at" field.
	CreatedAt time.Time `json:"created_at,omitempty"`
	// UpdatedAt holds the value of the "updated_at" field.
	UpdatedAt time.Time `json:"updated_at,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the DiskQuery when eager-loading is set.
	Edges DiskEdges `json:"edges"`
	// contains filtered or unexported fields
}

Disk is the model entity for the Disk schema.

func (*Disk) QueryHostID

func (d *Disk) QueryHostID() *HostQuery

QueryHostID queries the "host_id" edge of the Disk entity.

func (*Disk) String

func (d *Disk) String() string

String implements the fmt.Stringer.

func (*Disk) Unwrap

func (d *Disk) Unwrap() *Disk

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

func (d *Disk) Update() *DiskUpdateOne

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

type DiskClient

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

DiskClient is a client for the Disk schema.

func NewDiskClient

func NewDiskClient(c config) *DiskClient

NewDiskClient returns a client for the Disk from the given config.

func (*DiskClient) Create

func (c *DiskClient) Create() *DiskCreate

Create returns a create builder for Disk.

func (*DiskClient) CreateBulk

func (c *DiskClient) CreateBulk(builders ...*DiskCreate) *DiskCreateBulk

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

func (*DiskClient) Delete

func (c *DiskClient) Delete() *DiskDelete

Delete returns a delete builder for Disk.

func (*DiskClient) DeleteOne

func (c *DiskClient) DeleteOne(d *Disk) *DiskDeleteOne

DeleteOne returns a delete builder for the given entity.

func (*DiskClient) DeleteOneID

func (c *DiskClient) DeleteOneID(id int) *DiskDeleteOne

DeleteOneID returns a delete builder for the given id.

func (*DiskClient) Get

func (c *DiskClient) Get(ctx context.Context, id int) (*Disk, error)

Get returns a Disk entity by its id.

func (*DiskClient) GetX

func (c *DiskClient) GetX(ctx context.Context, id int) *Disk

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

func (*DiskClient) Hooks

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

Hooks returns the client hooks.

func (*DiskClient) Query

func (c *DiskClient) Query() *DiskQuery

Query returns a query builder for Disk.

func (*DiskClient) QueryHostID

func (c *DiskClient) QueryHostID(d *Disk) *HostQuery

QueryHostID queries the host_id edge of a Disk.

func (*DiskClient) Update

func (c *DiskClient) Update() *DiskUpdate

Update returns an update builder for Disk.

func (*DiskClient) UpdateOne

func (c *DiskClient) UpdateOne(d *Disk) *DiskUpdateOne

UpdateOne returns an update builder for the given entity.

func (*DiskClient) UpdateOneID

func (c *DiskClient) UpdateOneID(id int) *DiskUpdateOne

UpdateOneID returns an update builder for the given id.

func (*DiskClient) Use

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

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

type DiskCreate

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

DiskCreate is the builder for creating a Disk entity.

func (*DiskCreate) Exec

func (dc *DiskCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*DiskCreate) ExecX

func (dc *DiskCreate) ExecX(ctx context.Context)

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

func (*DiskCreate) Mutation

func (dc *DiskCreate) Mutation() *DiskMutation

Mutation returns the DiskMutation object of the builder.

func (*DiskCreate) Save

func (dc *DiskCreate) Save(ctx context.Context) (*Disk, error)

Save creates the Disk in the database.

func (*DiskCreate) SaveX

func (dc *DiskCreate) SaveX(ctx context.Context) *Disk

SaveX calls Save and panics if Save returns an error.

func (*DiskCreate) SetCreatedAt

func (dc *DiskCreate) SetCreatedAt(t time.Time) *DiskCreate

SetCreatedAt sets the "created_at" field.

func (*DiskCreate) SetDevice

func (dc *DiskCreate) SetDevice(s string) *DiskCreate

SetDevice sets the "device" field.

func (*DiskCreate) SetFstype

func (dc *DiskCreate) SetFstype(s string) *DiskCreate

SetFstype sets the "Fstype" field.

func (*DiskCreate) SetHostID

func (dc *DiskCreate) SetHostID(h *Host) *DiskCreate

SetHostID sets the "host_id" edge to the Host entity.

func (*DiskCreate) SetHostIDID

func (dc *DiskCreate) SetHostIDID(id string) *DiskCreate

SetHostIDID sets the "host_id" edge to the Host entity by ID.

func (*DiskCreate) SetMountpoint

func (dc *DiskCreate) SetMountpoint(s string) *DiskCreate

SetMountpoint sets the "Mountpoint" field.

func (*DiskCreate) SetNillableCreatedAt

func (dc *DiskCreate) SetNillableCreatedAt(t *time.Time) *DiskCreate

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

func (*DiskCreate) SetNillableUpdatedAt

func (dc *DiskCreate) SetNillableUpdatedAt(t *time.Time) *DiskCreate

SetNillableUpdatedAt sets the "updated_at" field if the given value is not nil.

func (*DiskCreate) SetOpts

func (dc *DiskCreate) SetOpts(s []string) *DiskCreate

SetOpts sets the "opts" field.

func (*DiskCreate) SetUpdatedAt

func (dc *DiskCreate) SetUpdatedAt(t time.Time) *DiskCreate

SetUpdatedAt sets the "updated_at" field.

type DiskCreateBulk

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

DiskCreateBulk is the builder for creating many Disk entities in bulk.

func (*DiskCreateBulk) Exec

func (dcb *DiskCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*DiskCreateBulk) ExecX

func (dcb *DiskCreateBulk) ExecX(ctx context.Context)

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

func (*DiskCreateBulk) Save

func (dcb *DiskCreateBulk) Save(ctx context.Context) ([]*Disk, error)

Save creates the Disk entities in the database.

func (*DiskCreateBulk) SaveX

func (dcb *DiskCreateBulk) SaveX(ctx context.Context) []*Disk

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

type DiskDelete

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

DiskDelete is the builder for deleting a Disk entity.

func (*DiskDelete) Exec

func (dd *DiskDelete) Exec(ctx context.Context) (int, error)

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

func (*DiskDelete) ExecX

func (dd *DiskDelete) ExecX(ctx context.Context) int

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

func (*DiskDelete) Where

func (dd *DiskDelete) Where(ps ...predicate.Disk) *DiskDelete

Where appends a list predicates to the DiskDelete builder.

type DiskDeleteOne

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

DiskDeleteOne is the builder for deleting a single Disk entity.

func (*DiskDeleteOne) Exec

func (ddo *DiskDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*DiskDeleteOne) ExecX

func (ddo *DiskDeleteOne) ExecX(ctx context.Context)

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

type DiskEdges

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

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

func (DiskEdges) HostIDOrErr

func (e DiskEdges) HostIDOrErr() (*Host, error)

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

type DiskGroupBy

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

DiskGroupBy is the group-by builder for Disk entities.

func (*DiskGroupBy) Aggregate

func (dgb *DiskGroupBy) Aggregate(fns ...AggregateFunc) *DiskGroupBy

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

func (*DiskGroupBy) Bool

func (dgb *DiskGroupBy) 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 (*DiskGroupBy) BoolX

func (dgb *DiskGroupBy) BoolX(ctx context.Context) bool

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

func (*DiskGroupBy) Bools

func (dgb *DiskGroupBy) 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 (*DiskGroupBy) BoolsX

func (dgb *DiskGroupBy) BoolsX(ctx context.Context) []bool

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

func (*DiskGroupBy) Float64

func (dgb *DiskGroupBy) 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 (*DiskGroupBy) Float64X

func (dgb *DiskGroupBy) Float64X(ctx context.Context) float64

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

func (*DiskGroupBy) Float64s

func (dgb *DiskGroupBy) 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 (*DiskGroupBy) Float64sX

func (dgb *DiskGroupBy) Float64sX(ctx context.Context) []float64

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

func (*DiskGroupBy) Int

func (dgb *DiskGroupBy) 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 (*DiskGroupBy) IntX

func (dgb *DiskGroupBy) IntX(ctx context.Context) int

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

func (*DiskGroupBy) Ints

func (dgb *DiskGroupBy) 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 (*DiskGroupBy) IntsX

func (dgb *DiskGroupBy) IntsX(ctx context.Context) []int

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

func (*DiskGroupBy) Scan

func (dgb *DiskGroupBy) Scan(ctx context.Context, v interface{}) error

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

func (*DiskGroupBy) ScanX

func (dgb *DiskGroupBy) ScanX(ctx context.Context, v interface{})

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

func (*DiskGroupBy) String

func (dgb *DiskGroupBy) 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 (*DiskGroupBy) StringX

func (dgb *DiskGroupBy) StringX(ctx context.Context) string

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

func (*DiskGroupBy) Strings

func (dgb *DiskGroupBy) 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 (*DiskGroupBy) StringsX

func (dgb *DiskGroupBy) StringsX(ctx context.Context) []string

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

type DiskMutation

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

DiskMutation represents an operation that mutates the Disk nodes in the graph.

func (*DiskMutation) AddField

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

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

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

func (*DiskMutation) AddedField

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

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

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

func (*DiskMutation) AddedIDs

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

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

func (*DiskMutation) ClearEdge

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

func (m *DiskMutation) 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 (*DiskMutation) ClearHostID

func (m *DiskMutation) ClearHostID()

ClearHostID clears the "host_id" edge to the Host entity.

func (*DiskMutation) ClearOpts

func (m *DiskMutation) ClearOpts()

ClearOpts clears the value of the "opts" field.

func (*DiskMutation) ClearedEdges

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

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

func (*DiskMutation) ClearedFields

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

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

func (DiskMutation) Client

func (m DiskMutation) 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 (*DiskMutation) CreatedAt

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

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

func (*DiskMutation) Device

func (m *DiskMutation) Device() (r string, exists bool)

Device returns the value of the "device" field in the mutation.

func (*DiskMutation) EdgeCleared

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

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

func (*DiskMutation) Field

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

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

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

func (*DiskMutation) Fields

func (m *DiskMutation) 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 (*DiskMutation) Fstype

func (m *DiskMutation) Fstype() (r string, exists bool)

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

func (*DiskMutation) HostIDCleared

func (m *DiskMutation) HostIDCleared() bool

HostIDCleared reports if the "host_id" edge to the Host entity was cleared.

func (*DiskMutation) HostIDID

func (m *DiskMutation) HostIDID() (id string, exists bool)

HostIDID returns the "host_id" edge ID in the mutation.

func (*DiskMutation) HostIDIDs

func (m *DiskMutation) HostIDIDs() (ids []string)

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

func (*DiskMutation) ID

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

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

func (*DiskMutation) IDs

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

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

func (*DiskMutation) Mountpoint

func (m *DiskMutation) Mountpoint() (r string, exists bool)

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

func (*DiskMutation) OldCreatedAt

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

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

func (m *DiskMutation) OldDevice(ctx context.Context) (v string, err error)

OldDevice returns the old "device" field's value of the Disk entity. If the Disk 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 (*DiskMutation) OldField

func (m *DiskMutation) 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 (*DiskMutation) OldFstype

func (m *DiskMutation) OldFstype(ctx context.Context) (v string, err error)

OldFstype returns the old "Fstype" field's value of the Disk entity. If the Disk 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 (*DiskMutation) OldMountpoint

func (m *DiskMutation) OldMountpoint(ctx context.Context) (v string, err error)

OldMountpoint returns the old "Mountpoint" field's value of the Disk entity. If the Disk 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 (*DiskMutation) OldOpts

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

OldOpts returns the old "opts" field's value of the Disk entity. If the Disk 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 (*DiskMutation) OldUpdatedAt

func (m *DiskMutation) OldUpdatedAt(ctx context.Context) (v time.Time, err error)

OldUpdatedAt returns the old "updated_at" field's value of the Disk entity. If the Disk 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 (*DiskMutation) Op

func (m *DiskMutation) Op() Op

Op returns the operation name.

func (*DiskMutation) Opts

func (m *DiskMutation) Opts() (r []string, exists bool)

Opts returns the value of the "opts" field in the mutation.

func (*DiskMutation) OptsCleared

func (m *DiskMutation) OptsCleared() bool

OptsCleared returns if the "opts" field was cleared in this mutation.

func (*DiskMutation) RemovedEdges

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

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

func (*DiskMutation) RemovedIDs

func (m *DiskMutation) 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 (*DiskMutation) ResetCreatedAt

func (m *DiskMutation) ResetCreatedAt()

ResetCreatedAt resets all changes to the "created_at" field.

func (*DiskMutation) ResetDevice

func (m *DiskMutation) ResetDevice()

ResetDevice resets all changes to the "device" field.

func (*DiskMutation) ResetEdge

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

func (m *DiskMutation) 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 (*DiskMutation) ResetFstype

func (m *DiskMutation) ResetFstype()

ResetFstype resets all changes to the "Fstype" field.

func (*DiskMutation) ResetHostID

func (m *DiskMutation) ResetHostID()

ResetHostID resets all changes to the "host_id" edge.

func (*DiskMutation) ResetMountpoint

func (m *DiskMutation) ResetMountpoint()

ResetMountpoint resets all changes to the "Mountpoint" field.

func (*DiskMutation) ResetOpts

func (m *DiskMutation) ResetOpts()

ResetOpts resets all changes to the "opts" field.

func (*DiskMutation) ResetUpdatedAt

func (m *DiskMutation) ResetUpdatedAt()

ResetUpdatedAt resets all changes to the "updated_at" field.

func (*DiskMutation) SetCreatedAt

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

SetCreatedAt sets the "created_at" field.

func (*DiskMutation) SetDevice

func (m *DiskMutation) SetDevice(s string)

SetDevice sets the "device" field.

func (*DiskMutation) SetField

func (m *DiskMutation) 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 (*DiskMutation) SetFstype

func (m *DiskMutation) SetFstype(s string)

SetFstype sets the "Fstype" field.

func (*DiskMutation) SetHostIDID

func (m *DiskMutation) SetHostIDID(id string)

SetHostIDID sets the "host_id" edge to the Host entity by id.

func (*DiskMutation) SetMountpoint

func (m *DiskMutation) SetMountpoint(s string)

SetMountpoint sets the "Mountpoint" field.

func (*DiskMutation) SetOpts

func (m *DiskMutation) SetOpts(s []string)

SetOpts sets the "opts" field.

func (*DiskMutation) SetUpdatedAt

func (m *DiskMutation) SetUpdatedAt(t time.Time)

SetUpdatedAt sets the "updated_at" field.

func (DiskMutation) Tx

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

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

func (*DiskMutation) Type

func (m *DiskMutation) Type() string

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

func (*DiskMutation) UpdatedAt

func (m *DiskMutation) UpdatedAt() (r time.Time, exists bool)

UpdatedAt returns the value of the "updated_at" field in the mutation.

func (*DiskMutation) Where

func (m *DiskMutation) Where(ps ...predicate.Disk)

Where appends a list predicates to the DiskMutation builder.

type DiskQuery

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

DiskQuery is the builder for querying Disk entities.

func (*DiskQuery) All

func (dq *DiskQuery) All(ctx context.Context) ([]*Disk, error)

All executes the query and returns a list of Disks.

func (*DiskQuery) AllX

func (dq *DiskQuery) AllX(ctx context.Context) []*Disk

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

func (*DiskQuery) Clone

func (dq *DiskQuery) Clone() *DiskQuery

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

func (*DiskQuery) Count

func (dq *DiskQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*DiskQuery) CountX

func (dq *DiskQuery) CountX(ctx context.Context) int

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

func (*DiskQuery) Exist

func (dq *DiskQuery) Exist(ctx context.Context) (bool, error)

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

func (*DiskQuery) ExistX

func (dq *DiskQuery) ExistX(ctx context.Context) bool

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

func (*DiskQuery) First

func (dq *DiskQuery) First(ctx context.Context) (*Disk, error)

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

func (*DiskQuery) FirstID

func (dq *DiskQuery) FirstID(ctx context.Context) (id int, err error)

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

func (*DiskQuery) FirstIDX

func (dq *DiskQuery) FirstIDX(ctx context.Context) int

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

func (*DiskQuery) FirstX

func (dq *DiskQuery) FirstX(ctx context.Context) *Disk

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

func (*DiskQuery) GroupBy

func (dq *DiskQuery) GroupBy(field string, fields ...string) *DiskGroupBy

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

client.Disk.Query().
	GroupBy(disk.FieldDevice).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*DiskQuery) IDs

func (dq *DiskQuery) IDs(ctx context.Context) ([]int, error)

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

func (*DiskQuery) IDsX

func (dq *DiskQuery) IDsX(ctx context.Context) []int

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

func (*DiskQuery) Limit

func (dq *DiskQuery) Limit(limit int) *DiskQuery

Limit adds a limit step to the query.

func (*DiskQuery) Offset

func (dq *DiskQuery) Offset(offset int) *DiskQuery

Offset adds an offset step to the query.

func (*DiskQuery) Only

func (dq *DiskQuery) Only(ctx context.Context) (*Disk, error)

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

func (*DiskQuery) OnlyID

func (dq *DiskQuery) OnlyID(ctx context.Context) (id int, err error)

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

func (*DiskQuery) OnlyIDX

func (dq *DiskQuery) OnlyIDX(ctx context.Context) int

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

func (*DiskQuery) OnlyX

func (dq *DiskQuery) OnlyX(ctx context.Context) *Disk

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

func (*DiskQuery) Order

func (dq *DiskQuery) Order(o ...OrderFunc) *DiskQuery

Order adds an order step to the query.

func (*DiskQuery) QueryHostID

func (dq *DiskQuery) QueryHostID() *HostQuery

QueryHostID chains the current query on the "host_id" edge.

func (*DiskQuery) Select

func (dq *DiskQuery) Select(fields ...string) *DiskSelect

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

client.Disk.Query().
	Select(disk.FieldDevice).
	Scan(ctx, &v)

func (*DiskQuery) Unique

func (dq *DiskQuery) Unique(unique bool) *DiskQuery

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

func (*DiskQuery) Where

func (dq *DiskQuery) Where(ps ...predicate.Disk) *DiskQuery

Where adds a new predicate for the DiskQuery builder.

func (*DiskQuery) WithHostID

func (dq *DiskQuery) WithHostID(opts ...func(*HostQuery)) *DiskQuery

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

type DiskSelect

type DiskSelect struct {
	*DiskQuery
	// contains filtered or unexported fields
}

DiskSelect is the builder for selecting fields of Disk entities.

func (*DiskSelect) Bool

func (ds *DiskSelect) Bool(ctx context.Context) (_ bool, err error)

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

func (*DiskSelect) BoolX

func (ds *DiskSelect) BoolX(ctx context.Context) bool

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

func (*DiskSelect) Bools

func (ds *DiskSelect) Bools(ctx context.Context) ([]bool, error)

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

func (*DiskSelect) BoolsX

func (ds *DiskSelect) BoolsX(ctx context.Context) []bool

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

func (*DiskSelect) Float64

func (ds *DiskSelect) Float64(ctx context.Context) (_ float64, err error)

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

func (*DiskSelect) Float64X

func (ds *DiskSelect) Float64X(ctx context.Context) float64

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

func (*DiskSelect) Float64s

func (ds *DiskSelect) Float64s(ctx context.Context) ([]float64, error)

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

func (*DiskSelect) Float64sX

func (ds *DiskSelect) Float64sX(ctx context.Context) []float64

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

func (*DiskSelect) Int

func (ds *DiskSelect) Int(ctx context.Context) (_ int, err error)

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

func (*DiskSelect) IntX

func (ds *DiskSelect) IntX(ctx context.Context) int

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

func (*DiskSelect) Ints

func (ds *DiskSelect) Ints(ctx context.Context) ([]int, error)

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

func (*DiskSelect) IntsX

func (ds *DiskSelect) IntsX(ctx context.Context) []int

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

func (*DiskSelect) Scan

func (ds *DiskSelect) Scan(ctx context.Context, v interface{}) error

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

func (*DiskSelect) ScanX

func (ds *DiskSelect) ScanX(ctx context.Context, v interface{})

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

func (*DiskSelect) String

func (ds *DiskSelect) String(ctx context.Context) (_ string, err error)

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

func (*DiskSelect) StringX

func (ds *DiskSelect) StringX(ctx context.Context) string

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

func (*DiskSelect) Strings

func (ds *DiskSelect) Strings(ctx context.Context) ([]string, error)

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

func (*DiskSelect) StringsX

func (ds *DiskSelect) StringsX(ctx context.Context) []string

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

type DiskUpdate

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

DiskUpdate is the builder for updating Disk entities.

func (*DiskUpdate) ClearHostID

func (du *DiskUpdate) ClearHostID() *DiskUpdate

ClearHostID clears the "host_id" edge to the Host entity.

func (*DiskUpdate) ClearOpts

func (du *DiskUpdate) ClearOpts() *DiskUpdate

ClearOpts clears the value of the "opts" field.

func (*DiskUpdate) Exec

func (du *DiskUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*DiskUpdate) ExecX

func (du *DiskUpdate) ExecX(ctx context.Context)

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

func (*DiskUpdate) Mutation

func (du *DiskUpdate) Mutation() *DiskMutation

Mutation returns the DiskMutation object of the builder.

func (*DiskUpdate) Save

func (du *DiskUpdate) Save(ctx context.Context) (int, error)

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

func (*DiskUpdate) SaveX

func (du *DiskUpdate) SaveX(ctx context.Context) int

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

func (*DiskUpdate) SetCreatedAt

func (du *DiskUpdate) SetCreatedAt(t time.Time) *DiskUpdate

SetCreatedAt sets the "created_at" field.

func (*DiskUpdate) SetDevice

func (du *DiskUpdate) SetDevice(s string) *DiskUpdate

SetDevice sets the "device" field.

func (*DiskUpdate) SetFstype

func (du *DiskUpdate) SetFstype(s string) *DiskUpdate

SetFstype sets the "Fstype" field.

func (*DiskUpdate) SetHostID

func (du *DiskUpdate) SetHostID(h *Host) *DiskUpdate

SetHostID sets the "host_id" edge to the Host entity.

func (*DiskUpdate) SetHostIDID

func (du *DiskUpdate) SetHostIDID(id string) *DiskUpdate

SetHostIDID sets the "host_id" edge to the Host entity by ID.

func (*DiskUpdate) SetMountpoint

func (du *DiskUpdate) SetMountpoint(s string) *DiskUpdate

SetMountpoint sets the "Mountpoint" field.

func (*DiskUpdate) SetNillableCreatedAt

func (du *DiskUpdate) SetNillableCreatedAt(t *time.Time) *DiskUpdate

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

func (*DiskUpdate) SetNillableUpdatedAt

func (du *DiskUpdate) SetNillableUpdatedAt(t *time.Time) *DiskUpdate

SetNillableUpdatedAt sets the "updated_at" field if the given value is not nil.

func (*DiskUpdate) SetOpts

func (du *DiskUpdate) SetOpts(s []string) *DiskUpdate

SetOpts sets the "opts" field.

func (*DiskUpdate) SetUpdatedAt

func (du *DiskUpdate) SetUpdatedAt(t time.Time) *DiskUpdate

SetUpdatedAt sets the "updated_at" field.

func (*DiskUpdate) Where

func (du *DiskUpdate) Where(ps ...predicate.Disk) *DiskUpdate

Where appends a list predicates to the DiskUpdate builder.

type DiskUpdateOne

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

DiskUpdateOne is the builder for updating a single Disk entity.

func (*DiskUpdateOne) ClearHostID

func (duo *DiskUpdateOne) ClearHostID() *DiskUpdateOne

ClearHostID clears the "host_id" edge to the Host entity.

func (*DiskUpdateOne) ClearOpts

func (duo *DiskUpdateOne) ClearOpts() *DiskUpdateOne

ClearOpts clears the value of the "opts" field.

func (*DiskUpdateOne) Exec

func (duo *DiskUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*DiskUpdateOne) ExecX

func (duo *DiskUpdateOne) ExecX(ctx context.Context)

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

func (*DiskUpdateOne) Mutation

func (duo *DiskUpdateOne) Mutation() *DiskMutation

Mutation returns the DiskMutation object of the builder.

func (*DiskUpdateOne) Save

func (duo *DiskUpdateOne) Save(ctx context.Context) (*Disk, error)

Save executes the query and returns the updated Disk entity.

func (*DiskUpdateOne) SaveX

func (duo *DiskUpdateOne) SaveX(ctx context.Context) *Disk

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

func (*DiskUpdateOne) Select

func (duo *DiskUpdateOne) Select(field string, fields ...string) *DiskUpdateOne

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

func (*DiskUpdateOne) SetCreatedAt

func (duo *DiskUpdateOne) SetCreatedAt(t time.Time) *DiskUpdateOne

SetCreatedAt sets the "created_at" field.

func (*DiskUpdateOne) SetDevice

func (duo *DiskUpdateOne) SetDevice(s string) *DiskUpdateOne

SetDevice sets the "device" field.

func (*DiskUpdateOne) SetFstype

func (duo *DiskUpdateOne) SetFstype(s string) *DiskUpdateOne

SetFstype sets the "Fstype" field.

func (*DiskUpdateOne) SetHostID

func (duo *DiskUpdateOne) SetHostID(h *Host) *DiskUpdateOne

SetHostID sets the "host_id" edge to the Host entity.

func (*DiskUpdateOne) SetHostIDID

func (duo *DiskUpdateOne) SetHostIDID(id string) *DiskUpdateOne

SetHostIDID sets the "host_id" edge to the Host entity by ID.

func (*DiskUpdateOne) SetMountpoint

func (duo *DiskUpdateOne) SetMountpoint(s string) *DiskUpdateOne

SetMountpoint sets the "Mountpoint" field.

func (*DiskUpdateOne) SetNillableCreatedAt

func (duo *DiskUpdateOne) SetNillableCreatedAt(t *time.Time) *DiskUpdateOne

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

func (*DiskUpdateOne) SetNillableUpdatedAt

func (duo *DiskUpdateOne) SetNillableUpdatedAt(t *time.Time) *DiskUpdateOne

SetNillableUpdatedAt sets the "updated_at" field if the given value is not nil.

func (*DiskUpdateOne) SetOpts

func (duo *DiskUpdateOne) SetOpts(s []string) *DiskUpdateOne

SetOpts sets the "opts" field.

func (*DiskUpdateOne) SetUpdatedAt

func (duo *DiskUpdateOne) SetUpdatedAt(t time.Time) *DiskUpdateOne

SetUpdatedAt sets the "updated_at" field.

type Disks

type Disks []*Disk

Disks is a parsable slice of Disk.

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 string `json:"id,omitempty"`
	// Hostname holds the value of the "hostname" field.
	Hostname string `json:"hostname,omitempty"`
	// Os holds the value of the "os" field.
	Os string `json:"os,omitempty"`
	// Platform holds the value of the "platform" field.
	Platform string `json:"platform,omitempty"`
	// PlatformFamily holds the value of the "platform_family" field.
	PlatformFamily string `json:"platform_family,omitempty"`
	// PlatformVersion holds the value of the "platform_version" field.
	PlatformVersion string `json:"platform_version,omitempty"`
	// KernelVersion holds the value of the "kernel_version" field.
	KernelVersion string `json:"kernel_version,omitempty"`
	// KernelArch holds the value of the "kernel_arch" field.
	KernelArch string `json:"kernel_arch,omitempty"`
	// VirtualizationSystem holds the value of the "virtualization_system" field.
	VirtualizationSystem string `json:"virtualization_system,omitempty"`
	// VirtualizationRole holds the value of the "virtualization_role" field.
	VirtualizationRole string `json:"virtualization_role,omitempty"`
	// CreatedAt holds the value of the "created_at" field.
	CreatedAt time.Time `json:"created_at,omitempty"`
	// UpdatedAt holds the value of the "updated_at" field.
	UpdatedAt time.Time `json:"updated_at,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) QueryCPU

func (h *Host) QueryCPU() *CPUQuery

QueryCPU queries the "cpu" edge of the Host entity.

func (*Host) QueryDisk

func (h *Host) QueryDisk() *DiskQuery

QueryDisk queries the "disk" edge of the Host entity.

func (*Host) QueryNetstat

func (h *Host) QueryNetstat() *NetstatQuery

QueryNetstat queries the "netstat" edge of the Host entity.

func (*Host) QueryNetwork

func (h *Host) QueryNetwork() *NetworkQuery

QueryNetwork queries the "network" 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 string) *HostDeleteOne

DeleteOneID returns a delete builder for the given id.

func (*HostClient) Get

func (c *HostClient) Get(ctx context.Context, id string) (*Host, error)

Get returns a Host entity by its id.

func (*HostClient) GetX

func (c *HostClient) GetX(ctx context.Context, id string) *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) QueryCPU

func (c *HostClient) QueryCPU(h *Host) *CPUQuery

QueryCPU queries the cpu edge of a Host.

func (*HostClient) QueryDisk

func (c *HostClient) QueryDisk(h *Host) *DiskQuery

QueryDisk queries the disk edge of a Host.

func (*HostClient) QueryNetstat

func (c *HostClient) QueryNetstat(h *Host) *NetstatQuery

QueryNetstat queries the netstat edge of a Host.

func (*HostClient) QueryNetwork

func (c *HostClient) QueryNetwork(h *Host) *NetworkQuery

QueryNetwork queries the network 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 string) *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) AddCPU

func (hc *HostCreate) AddCPU(c ...*Cpu) *HostCreate

AddCPU adds the "cpu" edges to the Cpu entity.

func (*HostCreate) AddCPUIDs

func (hc *HostCreate) AddCPUIDs(ids ...int) *HostCreate

AddCPUIDs adds the "cpu" edge to the Cpu entity by IDs.

func (*HostCreate) AddDisk

func (hc *HostCreate) AddDisk(d ...*Disk) *HostCreate

AddDisk adds the "disk" edges to the Disk entity.

func (*HostCreate) AddDiskIDs

func (hc *HostCreate) AddDiskIDs(ids ...int) *HostCreate

AddDiskIDs adds the "disk" edge to the Disk entity by IDs.

func (*HostCreate) AddNetstat

func (hc *HostCreate) AddNetstat(n ...*Netstat) *HostCreate

AddNetstat adds the "netstat" edges to the Netstat entity.

func (*HostCreate) AddNetstatIDs

func (hc *HostCreate) AddNetstatIDs(ids ...int) *HostCreate

AddNetstatIDs adds the "netstat" edge to the Netstat entity by IDs.

func (*HostCreate) AddNetwork

func (hc *HostCreate) AddNetwork(n ...*Network) *HostCreate

AddNetwork adds the "network" edges to the Network entity.

func (*HostCreate) AddNetworkIDs

func (hc *HostCreate) AddNetworkIDs(ids ...int) *HostCreate

AddNetworkIDs adds the "network" edge to the Network entity by IDs.

func (*HostCreate) Exec

func (hc *HostCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*HostCreate) ExecX

func (hc *HostCreate) ExecX(ctx context.Context)

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

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) SetCreatedAt

func (hc *HostCreate) SetCreatedAt(t time.Time) *HostCreate

SetCreatedAt sets the "created_at" field.

func (*HostCreate) SetHostname

func (hc *HostCreate) SetHostname(s string) *HostCreate

SetHostname sets the "hostname" field.

func (*HostCreate) SetID

func (hc *HostCreate) SetID(s string) *HostCreate

SetID sets the "id" field.

func (*HostCreate) SetKernelArch

func (hc *HostCreate) SetKernelArch(s string) *HostCreate

SetKernelArch sets the "kernel_arch" field.

func (*HostCreate) SetKernelVersion

func (hc *HostCreate) SetKernelVersion(s string) *HostCreate

SetKernelVersion sets the "kernel_version" field.

func (*HostCreate) SetNillableCreatedAt

func (hc *HostCreate) SetNillableCreatedAt(t *time.Time) *HostCreate

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

func (*HostCreate) SetNillableUpdatedAt

func (hc *HostCreate) SetNillableUpdatedAt(t *time.Time) *HostCreate

SetNillableUpdatedAt sets the "updated_at" field if the given value is not nil.

func (*HostCreate) SetOs

func (hc *HostCreate) SetOs(s string) *HostCreate

SetOs sets the "os" field.

func (*HostCreate) SetPlatform

func (hc *HostCreate) SetPlatform(s string) *HostCreate

SetPlatform sets the "platform" field.

func (*HostCreate) SetPlatformFamily

func (hc *HostCreate) SetPlatformFamily(s string) *HostCreate

SetPlatformFamily sets the "platform_family" field.

func (*HostCreate) SetPlatformVersion

func (hc *HostCreate) SetPlatformVersion(s string) *HostCreate

SetPlatformVersion sets the "platform_version" field.

func (*HostCreate) SetUpdatedAt

func (hc *HostCreate) SetUpdatedAt(t time.Time) *HostCreate

SetUpdatedAt sets the "updated_at" field.

func (*HostCreate) SetVirtualizationRole

func (hc *HostCreate) SetVirtualizationRole(s string) *HostCreate

SetVirtualizationRole sets the "virtualization_role" field.

func (*HostCreate) SetVirtualizationSystem

func (hc *HostCreate) SetVirtualizationSystem(s string) *HostCreate

SetVirtualizationSystem sets the "virtualization_system" field.

type HostCreateBulk

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

HostCreateBulk is the builder for creating many Host entities in bulk.

func (*HostCreateBulk) Exec

func (hcb *HostCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*HostCreateBulk) ExecX

func (hcb *HostCreateBulk) ExecX(ctx context.Context)

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

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 appends a list predicates 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 {
	// CPU holds the value of the cpu edge.
	CPU []*Cpu `json:"cpu,omitempty"`
	// Network holds the value of the network edge.
	Network []*Network `json:"network,omitempty"`
	// Netstat holds the value of the netstat edge.
	Netstat []*Netstat `json:"netstat,omitempty"`
	// Disk holds the value of the disk edge.
	Disk []*Disk `json:"disk,omitempty"`
	// contains filtered or unexported fields
}

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

func (HostEdges) CPUOrErr

func (e HostEdges) CPUOrErr() ([]*Cpu, error)

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

func (HostEdges) DiskOrErr

func (e HostEdges) DiskOrErr() ([]*Disk, error)

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

func (HostEdges) NetstatOrErr

func (e HostEdges) NetstatOrErr() ([]*Netstat, error)

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

func (HostEdges) NetworkOrErr

func (e HostEdges) NetworkOrErr() ([]*Network, error)

NetworkOrErr returns the Network 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) AddCPUIDs

func (m *HostMutation) AddCPUIDs(ids ...int)

AddCPUIDs adds the "cpu" edge to the Cpu entity by ids.

func (*HostMutation) AddDiskIDs

func (m *HostMutation) AddDiskIDs(ids ...int)

AddDiskIDs adds the "disk" edge to the Disk 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) AddNetstatIDs

func (m *HostMutation) AddNetstatIDs(ids ...int)

AddNetstatIDs adds the "netstat" edge to the Netstat entity by ids.

func (*HostMutation) AddNetworkIDs

func (m *HostMutation) AddNetworkIDs(ids ...int)

AddNetworkIDs adds the "network" edge to the Network 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) CPUCleared

func (m *HostMutation) CPUCleared() bool

CPUCleared reports if the "cpu" edge to the Cpu entity was cleared.

func (*HostMutation) CPUIDs

func (m *HostMutation) CPUIDs() (ids []int)

CPUIDs returns the "cpu" edge IDs in the mutation.

func (*HostMutation) ClearCPU

func (m *HostMutation) ClearCPU()

ClearCPU clears the "cpu" edge to the Cpu entity.

func (*HostMutation) ClearDisk

func (m *HostMutation) ClearDisk()

ClearDisk clears the "disk" edge to the Disk 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) ClearNetstat

func (m *HostMutation) ClearNetstat()

ClearNetstat clears the "netstat" edge to the Netstat entity.

func (*HostMutation) ClearNetwork

func (m *HostMutation) ClearNetwork()

ClearNetwork clears the "network" edge to the Network 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) CreatedAt

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

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

func (*HostMutation) DiskCleared

func (m *HostMutation) DiskCleared() bool

DiskCleared reports if the "disk" edge to the Disk entity was cleared.

func (*HostMutation) DiskIDs

func (m *HostMutation) DiskIDs() (ids []int)

DiskIDs returns the "disk" edge IDs in the mutation.

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 string, exists bool)

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

func (*HostMutation) IDs

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

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

func (*HostMutation) KernelArch

func (m *HostMutation) KernelArch() (r string, exists bool)

KernelArch returns the value of the "kernel_arch" field in the mutation.

func (*HostMutation) KernelVersion

func (m *HostMutation) KernelVersion() (r string, exists bool)

KernelVersion returns the value of the "kernel_version" field in the mutation.

func (*HostMutation) NetstatCleared

func (m *HostMutation) NetstatCleared() bool

NetstatCleared reports if the "netstat" edge to the Netstat entity was cleared.

func (*HostMutation) NetstatIDs

func (m *HostMutation) NetstatIDs() (ids []int)

NetstatIDs returns the "netstat" edge IDs in the mutation.

func (*HostMutation) NetworkCleared

func (m *HostMutation) NetworkCleared() bool

NetworkCleared reports if the "network" edge to the Network entity was cleared.

func (*HostMutation) NetworkIDs

func (m *HostMutation) NetworkIDs() (ids []int)

NetworkIDs returns the "network" edge IDs in the mutation.

func (*HostMutation) OldCreatedAt

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

OldCreatedAt returns the old "created_at" 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) 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) OldKernelArch

func (m *HostMutation) OldKernelArch(ctx context.Context) (v string, err error)

OldKernelArch returns the old "kernel_arch" 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) OldKernelVersion

func (m *HostMutation) OldKernelVersion(ctx context.Context) (v string, err error)

OldKernelVersion returns the old "kernel_version" 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) OldOs

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

OldOs returns the old "os" 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) OldPlatform

func (m *HostMutation) OldPlatform(ctx context.Context) (v string, err error)

OldPlatform returns the old "platform" 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) OldPlatformFamily

func (m *HostMutation) OldPlatformFamily(ctx context.Context) (v string, err error)

OldPlatformFamily returns the old "platform_family" 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) OldPlatformVersion

func (m *HostMutation) OldPlatformVersion(ctx context.Context) (v string, err error)

OldPlatformVersion returns the old "platform_version" 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) OldUpdatedAt

func (m *HostMutation) OldUpdatedAt(ctx context.Context) (v time.Time, err error)

OldUpdatedAt returns the old "updated_at" 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) OldVirtualizationRole

func (m *HostMutation) OldVirtualizationRole(ctx context.Context) (v string, err error)

OldVirtualizationRole returns the old "virtualization_role" 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) OldVirtualizationSystem

func (m *HostMutation) OldVirtualizationSystem(ctx context.Context) (v string, err error)

OldVirtualizationSystem returns the old "virtualization_system" 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) Os

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

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

func (*HostMutation) Platform

func (m *HostMutation) Platform() (r string, exists bool)

Platform returns the value of the "platform" field in the mutation.

func (*HostMutation) PlatformFamily

func (m *HostMutation) PlatformFamily() (r string, exists bool)

PlatformFamily returns the value of the "platform_family" field in the mutation.

func (*HostMutation) PlatformVersion

func (m *HostMutation) PlatformVersion() (r string, exists bool)

PlatformVersion returns the value of the "platform_version" field in the mutation.

func (*HostMutation) RemoveCPUIDs

func (m *HostMutation) RemoveCPUIDs(ids ...int)

RemoveCPUIDs removes the "cpu" edge to the Cpu entity by IDs.

func (*HostMutation) RemoveDiskIDs

func (m *HostMutation) RemoveDiskIDs(ids ...int)

RemoveDiskIDs removes the "disk" edge to the Disk entity by IDs.

func (*HostMutation) RemoveNetstatIDs

func (m *HostMutation) RemoveNetstatIDs(ids ...int)

RemoveNetstatIDs removes the "netstat" edge to the Netstat entity by IDs.

func (*HostMutation) RemoveNetworkIDs

func (m *HostMutation) RemoveNetworkIDs(ids ...int)

RemoveNetworkIDs removes the "network" edge to the Network entity by IDs.

func (*HostMutation) RemovedCPUIDs

func (m *HostMutation) RemovedCPUIDs() (ids []int)

RemovedCPU returns the removed IDs of the "cpu" edge to the Cpu entity.

func (*HostMutation) RemovedDiskIDs

func (m *HostMutation) RemovedDiskIDs() (ids []int)

RemovedDisk returns the removed IDs of the "disk" edge to the Disk 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) RemovedNetstatIDs

func (m *HostMutation) RemovedNetstatIDs() (ids []int)

RemovedNetstat returns the removed IDs of the "netstat" edge to the Netstat entity.

func (*HostMutation) RemovedNetworkIDs

func (m *HostMutation) RemovedNetworkIDs() (ids []int)

RemovedNetwork returns the removed IDs of the "network" edge to the Network entity.

func (*HostMutation) ResetCPU

func (m *HostMutation) ResetCPU()

ResetCPU resets all changes to the "cpu" edge.

func (*HostMutation) ResetCreatedAt

func (m *HostMutation) ResetCreatedAt()

ResetCreatedAt resets all changes to the "created_at" field.

func (*HostMutation) ResetDisk

func (m *HostMutation) ResetDisk()

ResetDisk resets all changes to the "disk" 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) ResetKernelArch

func (m *HostMutation) ResetKernelArch()

ResetKernelArch resets all changes to the "kernel_arch" field.

func (*HostMutation) ResetKernelVersion

func (m *HostMutation) ResetKernelVersion()

ResetKernelVersion resets all changes to the "kernel_version" field.

func (*HostMutation) ResetNetstat

func (m *HostMutation) ResetNetstat()

ResetNetstat resets all changes to the "netstat" edge.

func (*HostMutation) ResetNetwork

func (m *HostMutation) ResetNetwork()

ResetNetwork resets all changes to the "network" edge.

func (*HostMutation) ResetOs

func (m *HostMutation) ResetOs()

ResetOs resets all changes to the "os" field.

func (*HostMutation) ResetPlatform

func (m *HostMutation) ResetPlatform()

ResetPlatform resets all changes to the "platform" field.

func (*HostMutation) ResetPlatformFamily

func (m *HostMutation) ResetPlatformFamily()

ResetPlatformFamily resets all changes to the "platform_family" field.

func (*HostMutation) ResetPlatformVersion

func (m *HostMutation) ResetPlatformVersion()

ResetPlatformVersion resets all changes to the "platform_version" field.

func (*HostMutation) ResetUpdatedAt

func (m *HostMutation) ResetUpdatedAt()

ResetUpdatedAt resets all changes to the "updated_at" field.

func (*HostMutation) ResetVirtualizationRole

func (m *HostMutation) ResetVirtualizationRole()

ResetVirtualizationRole resets all changes to the "virtualization_role" field.

func (*HostMutation) ResetVirtualizationSystem

func (m *HostMutation) ResetVirtualizationSystem()

ResetVirtualizationSystem resets all changes to the "virtualization_system" field.

func (*HostMutation) SetCreatedAt

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

SetCreatedAt sets the "created_at" field.

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) SetID

func (m *HostMutation) SetID(id string)

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

func (*HostMutation) SetKernelArch

func (m *HostMutation) SetKernelArch(s string)

SetKernelArch sets the "kernel_arch" field.

func (*HostMutation) SetKernelVersion

func (m *HostMutation) SetKernelVersion(s string)

SetKernelVersion sets the "kernel_version" field.

func (*HostMutation) SetOs

func (m *HostMutation) SetOs(s string)

SetOs sets the "os" field.

func (*HostMutation) SetPlatform

func (m *HostMutation) SetPlatform(s string)

SetPlatform sets the "platform" field.

func (*HostMutation) SetPlatformFamily

func (m *HostMutation) SetPlatformFamily(s string)

SetPlatformFamily sets the "platform_family" field.

func (*HostMutation) SetPlatformVersion

func (m *HostMutation) SetPlatformVersion(s string)

SetPlatformVersion sets the "platform_version" field.

func (*HostMutation) SetUpdatedAt

func (m *HostMutation) SetUpdatedAt(t time.Time)

SetUpdatedAt sets the "updated_at" field.

func (*HostMutation) SetVirtualizationRole

func (m *HostMutation) SetVirtualizationRole(s string)

SetVirtualizationRole sets the "virtualization_role" field.

func (*HostMutation) SetVirtualizationSystem

func (m *HostMutation) SetVirtualizationSystem(s string)

SetVirtualizationSystem sets the "virtualization_system" 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).

func (*HostMutation) UpdatedAt

func (m *HostMutation) UpdatedAt() (r time.Time, exists bool)

UpdatedAt returns the value of the "updated_at" field in the mutation.

func (*HostMutation) VirtualizationRole

func (m *HostMutation) VirtualizationRole() (r string, exists bool)

VirtualizationRole returns the value of the "virtualization_role" field in the mutation.

func (*HostMutation) VirtualizationSystem

func (m *HostMutation) VirtualizationSystem() (r string, exists bool)

VirtualizationSystem returns the value of the "virtualization_system" field in the mutation.

func (*HostMutation) Where

func (m *HostMutation) Where(ps ...predicate.Host)

Where appends a list predicates to the HostMutation builder.

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 string, 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) string

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) ([]string, error)

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

func (*HostQuery) IDsX

func (hq *HostQuery) IDsX(ctx context.Context) []string

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 more than one Host entity is found. Returns a *NotFoundError when no Host entities are found.

func (*HostQuery) OnlyID

func (hq *HostQuery) OnlyID(ctx context.Context) (id string, err error)

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

func (*HostQuery) OnlyIDX

func (hq *HostQuery) OnlyIDX(ctx context.Context) string

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) QueryCPU

func (hq *HostQuery) QueryCPU() *CPUQuery

QueryCPU chains the current query on the "cpu" edge.

func (*HostQuery) QueryDisk

func (hq *HostQuery) QueryDisk() *DiskQuery

QueryDisk chains the current query on the "disk" edge.

func (*HostQuery) QueryNetstat

func (hq *HostQuery) QueryNetstat() *NetstatQuery

QueryNetstat chains the current query on the "netstat" edge.

func (*HostQuery) QueryNetwork

func (hq *HostQuery) QueryNetwork() *NetworkQuery

QueryNetwork chains the current query on the "network" edge.

func (*HostQuery) Select

func (hq *HostQuery) Select(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) Unique

func (hq *HostQuery) Unique(unique bool) *HostQuery

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

func (*HostQuery) Where

func (hq *HostQuery) Where(ps ...predicate.Host) *HostQuery

Where adds a new predicate for the HostQuery builder.

func (*HostQuery) WithCPU

func (hq *HostQuery) WithCPU(opts ...func(*CPUQuery)) *HostQuery

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

func (*HostQuery) WithDisk

func (hq *HostQuery) WithDisk(opts ...func(*DiskQuery)) *HostQuery

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

func (*HostQuery) WithNetstat

func (hq *HostQuery) WithNetstat(opts ...func(*NetstatQuery)) *HostQuery

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

func (*HostQuery) WithNetwork

func (hq *HostQuery) WithNetwork(opts ...func(*NetworkQuery)) *HostQuery

WithNetwork tells the query-builder to eager-load the nodes that are connected to the "network" 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) AddCPU

func (hu *HostUpdate) AddCPU(c ...*Cpu) *HostUpdate

AddCPU adds the "cpu" edges to the Cpu entity.

func (*HostUpdate) AddCPUIDs

func (hu *HostUpdate) AddCPUIDs(ids ...int) *HostUpdate

AddCPUIDs adds the "cpu" edge to the Cpu entity by IDs.

func (*HostUpdate) AddDisk

func (hu *HostUpdate) AddDisk(d ...*Disk) *HostUpdate

AddDisk adds the "disk" edges to the Disk entity.

func (*HostUpdate) AddDiskIDs

func (hu *HostUpdate) AddDiskIDs(ids ...int) *HostUpdate

AddDiskIDs adds the "disk" edge to the Disk entity by IDs.

func (*HostUpdate) AddNetstat

func (hu *HostUpdate) AddNetstat(n ...*Netstat) *HostUpdate

AddNetstat adds the "netstat" edges to the Netstat entity.

func (*HostUpdate) AddNetstatIDs

func (hu *HostUpdate) AddNetstatIDs(ids ...int) *HostUpdate

AddNetstatIDs adds the "netstat" edge to the Netstat entity by IDs.

func (*HostUpdate) AddNetwork

func (hu *HostUpdate) AddNetwork(n ...*Network) *HostUpdate

AddNetwork adds the "network" edges to the Network entity.

func (*HostUpdate) AddNetworkIDs

func (hu *HostUpdate) AddNetworkIDs(ids ...int) *HostUpdate

AddNetworkIDs adds the "network" edge to the Network entity by IDs.

func (*HostUpdate) ClearCPU

func (hu *HostUpdate) ClearCPU() *HostUpdate

ClearCPU clears all "cpu" edges to the Cpu entity.

func (*HostUpdate) ClearDisk

func (hu *HostUpdate) ClearDisk() *HostUpdate

ClearDisk clears all "disk" edges to the Disk entity.

func (*HostUpdate) ClearNetstat

func (hu *HostUpdate) ClearNetstat() *HostUpdate

ClearNetstat clears all "netstat" edges to the Netstat entity.

func (*HostUpdate) ClearNetwork

func (hu *HostUpdate) ClearNetwork() *HostUpdate

ClearNetwork clears all "network" edges to the Network 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) RemoveCPU

func (hu *HostUpdate) RemoveCPU(c ...*Cpu) *HostUpdate

RemoveCPU removes "cpu" edges to Cpu entities.

func (*HostUpdate) RemoveCPUIDs

func (hu *HostUpdate) RemoveCPUIDs(ids ...int) *HostUpdate

RemoveCPUIDs removes the "cpu" edge to Cpu entities by IDs.

func (*HostUpdate) RemoveDisk

func (hu *HostUpdate) RemoveDisk(d ...*Disk) *HostUpdate

RemoveDisk removes "disk" edges to Disk entities.

func (*HostUpdate) RemoveDiskIDs

func (hu *HostUpdate) RemoveDiskIDs(ids ...int) *HostUpdate

RemoveDiskIDs removes the "disk" edge to Disk entities by IDs.

func (*HostUpdate) RemoveNetstat

func (hu *HostUpdate) RemoveNetstat(n ...*Netstat) *HostUpdate

RemoveNetstat removes "netstat" edges to Netstat entities.

func (*HostUpdate) RemoveNetstatIDs

func (hu *HostUpdate) RemoveNetstatIDs(ids ...int) *HostUpdate

RemoveNetstatIDs removes the "netstat" edge to Netstat entities by IDs.

func (*HostUpdate) RemoveNetwork

func (hu *HostUpdate) RemoveNetwork(n ...*Network) *HostUpdate

RemoveNetwork removes "network" edges to Network entities.

func (*HostUpdate) RemoveNetworkIDs

func (hu *HostUpdate) RemoveNetworkIDs(ids ...int) *HostUpdate

RemoveNetworkIDs removes the "network" edge to Network 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) SetCreatedAt

func (hu *HostUpdate) SetCreatedAt(t time.Time) *HostUpdate

SetCreatedAt sets the "created_at" field.

func (*HostUpdate) SetHostname

func (hu *HostUpdate) SetHostname(s string) *HostUpdate

SetHostname sets the "hostname" field.

func (*HostUpdate) SetKernelArch

func (hu *HostUpdate) SetKernelArch(s string) *HostUpdate

SetKernelArch sets the "kernel_arch" field.

func (*HostUpdate) SetKernelVersion

func (hu *HostUpdate) SetKernelVersion(s string) *HostUpdate

SetKernelVersion sets the "kernel_version" field.

func (*HostUpdate) SetNillableCreatedAt

func (hu *HostUpdate) SetNillableCreatedAt(t *time.Time) *HostUpdate

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

func (*HostUpdate) SetNillableUpdatedAt

func (hu *HostUpdate) SetNillableUpdatedAt(t *time.Time) *HostUpdate

SetNillableUpdatedAt sets the "updated_at" field if the given value is not nil.

func (*HostUpdate) SetOs

func (hu *HostUpdate) SetOs(s string) *HostUpdate

SetOs sets the "os" field.

func (*HostUpdate) SetPlatform

func (hu *HostUpdate) SetPlatform(s string) *HostUpdate

SetPlatform sets the "platform" field.

func (*HostUpdate) SetPlatformFamily

func (hu *HostUpdate) SetPlatformFamily(s string) *HostUpdate

SetPlatformFamily sets the "platform_family" field.

func (*HostUpdate) SetPlatformVersion

func (hu *HostUpdate) SetPlatformVersion(s string) *HostUpdate

SetPlatformVersion sets the "platform_version" field.

func (*HostUpdate) SetUpdatedAt

func (hu *HostUpdate) SetUpdatedAt(t time.Time) *HostUpdate

SetUpdatedAt sets the "updated_at" field.

func (*HostUpdate) SetVirtualizationRole

func (hu *HostUpdate) SetVirtualizationRole(s string) *HostUpdate

SetVirtualizationRole sets the "virtualization_role" field.

func (*HostUpdate) SetVirtualizationSystem

func (hu *HostUpdate) SetVirtualizationSystem(s string) *HostUpdate

SetVirtualizationSystem sets the "virtualization_system" field.

func (*HostUpdate) Where

func (hu *HostUpdate) Where(ps ...predicate.Host) *HostUpdate

Where appends a list predicates to 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) AddCPU

func (huo *HostUpdateOne) AddCPU(c ...*Cpu) *HostUpdateOne

AddCPU adds the "cpu" edges to the Cpu entity.

func (*HostUpdateOne) AddCPUIDs

func (huo *HostUpdateOne) AddCPUIDs(ids ...int) *HostUpdateOne

AddCPUIDs adds the "cpu" edge to the Cpu entity by IDs.

func (*HostUpdateOne) AddDisk

func (huo *HostUpdateOne) AddDisk(d ...*Disk) *HostUpdateOne

AddDisk adds the "disk" edges to the Disk entity.

func (*HostUpdateOne) AddDiskIDs

func (huo *HostUpdateOne) AddDiskIDs(ids ...int) *HostUpdateOne

AddDiskIDs adds the "disk" edge to the Disk entity by IDs.

func (*HostUpdateOne) AddNetstat

func (huo *HostUpdateOne) AddNetstat(n ...*Netstat) *HostUpdateOne

AddNetstat adds the "netstat" edges to the Netstat entity.

func (*HostUpdateOne) AddNetstatIDs

func (huo *HostUpdateOne) AddNetstatIDs(ids ...int) *HostUpdateOne

AddNetstatIDs adds the "netstat" edge to the Netstat entity by IDs.

func (*HostUpdateOne) AddNetwork

func (huo *HostUpdateOne) AddNetwork(n ...*Network) *HostUpdateOne

AddNetwork adds the "network" edges to the Network entity.

func (*HostUpdateOne) AddNetworkIDs

func (huo *HostUpdateOne) AddNetworkIDs(ids ...int) *HostUpdateOne

AddNetworkIDs adds the "network" edge to the Network entity by IDs.

func (*HostUpdateOne) ClearCPU

func (huo *HostUpdateOne) ClearCPU() *HostUpdateOne

ClearCPU clears all "cpu" edges to the Cpu entity.

func (*HostUpdateOne) ClearDisk

func (huo *HostUpdateOne) ClearDisk() *HostUpdateOne

ClearDisk clears all "disk" edges to the Disk entity.

func (*HostUpdateOne) ClearNetstat

func (huo *HostUpdateOne) ClearNetstat() *HostUpdateOne

ClearNetstat clears all "netstat" edges to the Netstat entity.

func (*HostUpdateOne) ClearNetwork

func (huo *HostUpdateOne) ClearNetwork() *HostUpdateOne

ClearNetwork clears all "network" edges to the Network 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) RemoveCPU

func (huo *HostUpdateOne) RemoveCPU(c ...*Cpu) *HostUpdateOne

RemoveCPU removes "cpu" edges to Cpu entities.

func (*HostUpdateOne) RemoveCPUIDs

func (huo *HostUpdateOne) RemoveCPUIDs(ids ...int) *HostUpdateOne

RemoveCPUIDs removes the "cpu" edge to Cpu entities by IDs.

func (*HostUpdateOne) RemoveDisk

func (huo *HostUpdateOne) RemoveDisk(d ...*Disk) *HostUpdateOne

RemoveDisk removes "disk" edges to Disk entities.

func (*HostUpdateOne) RemoveDiskIDs

func (huo *HostUpdateOne) RemoveDiskIDs(ids ...int) *HostUpdateOne

RemoveDiskIDs removes the "disk" edge to Disk entities by IDs.

func (*HostUpdateOne) RemoveNetstat

func (huo *HostUpdateOne) RemoveNetstat(n ...*Netstat) *HostUpdateOne

RemoveNetstat removes "netstat" edges to Netstat entities.

func (*HostUpdateOne) RemoveNetstatIDs

func (huo *HostUpdateOne) RemoveNetstatIDs(ids ...int) *HostUpdateOne

RemoveNetstatIDs removes the "netstat" edge to Netstat entities by IDs.

func (*HostUpdateOne) RemoveNetwork

func (huo *HostUpdateOne) RemoveNetwork(n ...*Network) *HostUpdateOne

RemoveNetwork removes "network" edges to Network entities.

func (*HostUpdateOne) RemoveNetworkIDs

func (huo *HostUpdateOne) RemoveNetworkIDs(ids ...int) *HostUpdateOne

RemoveNetworkIDs removes the "network" edge to Network 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) Select

func (huo *HostUpdateOne) Select(field string, fields ...string) *HostUpdateOne

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

func (*HostUpdateOne) SetCreatedAt

func (huo *HostUpdateOne) SetCreatedAt(t time.Time) *HostUpdateOne

SetCreatedAt sets the "created_at" field.

func (*HostUpdateOne) SetHostname

func (huo *HostUpdateOne) SetHostname(s string) *HostUpdateOne

SetHostname sets the "hostname" field.

func (*HostUpdateOne) SetKernelArch

func (huo *HostUpdateOne) SetKernelArch(s string) *HostUpdateOne

SetKernelArch sets the "kernel_arch" field.

func (*HostUpdateOne) SetKernelVersion

func (huo *HostUpdateOne) SetKernelVersion(s string) *HostUpdateOne

SetKernelVersion sets the "kernel_version" field.

func (*HostUpdateOne) SetNillableCreatedAt

func (huo *HostUpdateOne) SetNillableCreatedAt(t *time.Time) *HostUpdateOne

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

func (*HostUpdateOne) SetNillableUpdatedAt

func (huo *HostUpdateOne) SetNillableUpdatedAt(t *time.Time) *HostUpdateOne

SetNillableUpdatedAt sets the "updated_at" field if the given value is not nil.

func (*HostUpdateOne) SetOs

func (huo *HostUpdateOne) SetOs(s string) *HostUpdateOne

SetOs sets the "os" field.

func (*HostUpdateOne) SetPlatform

func (huo *HostUpdateOne) SetPlatform(s string) *HostUpdateOne

SetPlatform sets the "platform" field.

func (*HostUpdateOne) SetPlatformFamily

func (huo *HostUpdateOne) SetPlatformFamily(s string) *HostUpdateOne

SetPlatformFamily sets the "platform_family" field.

func (*HostUpdateOne) SetPlatformVersion

func (huo *HostUpdateOne) SetPlatformVersion(s string) *HostUpdateOne

SetPlatformVersion sets the "platform_version" field.

func (*HostUpdateOne) SetUpdatedAt

func (huo *HostUpdateOne) SetUpdatedAt(t time.Time) *HostUpdateOne

SetUpdatedAt sets the "updated_at" field.

func (*HostUpdateOne) SetVirtualizationRole

func (huo *HostUpdateOne) SetVirtualizationRole(s string) *HostUpdateOne

SetVirtualizationRole sets the "virtualization_role" field.

func (*HostUpdateOne) SetVirtualizationSystem

func (huo *HostUpdateOne) SetVirtualizationSystem(s string) *HostUpdateOne

SetVirtualizationSystem sets the "virtualization_system" field.

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 Netstat

type Netstat struct {

	// ID of the ent.
	ID int `json:"id,omitempty"`
	// Addr holds the value of the "addr" field.
	Addr string `json:"addr,omitempty"`
	// Port holds the value of the "port" field.
	Port uint64 `json:"port,omitempty"`
	// Proto holds the value of the "proto" field.
	Proto string `json:"proto,omitempty"`
	// Process holds the value of the "process" field.
	Process string `json:"process,omitempty"`
	// CreatedAt holds the value of the "created_at" field.
	CreatedAt time.Time `json:"created_at,omitempty"`
	// UpdatedAt holds the value of the "updated_at" field.
	UpdatedAt time.Time `json:"updated_at,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the NetstatQuery when eager-loading is set.
	Edges NetstatEdges `json:"edges"`
	// contains filtered or unexported fields
}

Netstat is the model entity for the Netstat schema.

func (*Netstat) QueryHostID

func (n *Netstat) QueryHostID() *HostQuery

QueryHostID queries the "host_id" edge of the Netstat entity.

func (*Netstat) String

func (n *Netstat) String() string

String implements the fmt.Stringer.

func (*Netstat) Unwrap

func (n *Netstat) Unwrap() *Netstat

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

func (n *Netstat) Update() *NetstatUpdateOne

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

type NetstatClient

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

NetstatClient is a client for the Netstat schema.

func NewNetstatClient

func NewNetstatClient(c config) *NetstatClient

NewNetstatClient returns a client for the Netstat from the given config.

func (*NetstatClient) Create

func (c *NetstatClient) Create() *NetstatCreate

Create returns a create builder for Netstat.

func (*NetstatClient) CreateBulk

func (c *NetstatClient) CreateBulk(builders ...*NetstatCreate) *NetstatCreateBulk

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

func (*NetstatClient) Delete

func (c *NetstatClient) Delete() *NetstatDelete

Delete returns a delete builder for Netstat.

func (*NetstatClient) DeleteOne

func (c *NetstatClient) DeleteOne(n *Netstat) *NetstatDeleteOne

DeleteOne returns a delete builder for the given entity.

func (*NetstatClient) DeleteOneID

func (c *NetstatClient) DeleteOneID(id int) *NetstatDeleteOne

DeleteOneID returns a delete builder for the given id.

func (*NetstatClient) Get

func (c *NetstatClient) Get(ctx context.Context, id int) (*Netstat, error)

Get returns a Netstat entity by its id.

func (*NetstatClient) GetX

func (c *NetstatClient) GetX(ctx context.Context, id int) *Netstat

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

func (*NetstatClient) Hooks

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

Hooks returns the client hooks.

func (*NetstatClient) Query

func (c *NetstatClient) Query() *NetstatQuery

Query returns a query builder for Netstat.

func (*NetstatClient) QueryHostID

func (c *NetstatClient) QueryHostID(n *Netstat) *HostQuery

QueryHostID queries the host_id edge of a Netstat.

func (*NetstatClient) Update

func (c *NetstatClient) Update() *NetstatUpdate

Update returns an update builder for Netstat.

func (*NetstatClient) UpdateOne

func (c *NetstatClient) UpdateOne(n *Netstat) *NetstatUpdateOne

UpdateOne returns an update builder for the given entity.

func (*NetstatClient) UpdateOneID

func (c *NetstatClient) UpdateOneID(id int) *NetstatUpdateOne

UpdateOneID returns an update builder for the given id.

func (*NetstatClient) Use

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

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

type NetstatCreate

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

NetstatCreate is the builder for creating a Netstat entity.

func (*NetstatCreate) Exec

func (nc *NetstatCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*NetstatCreate) ExecX

func (nc *NetstatCreate) ExecX(ctx context.Context)

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

func (*NetstatCreate) Mutation

func (nc *NetstatCreate) Mutation() *NetstatMutation

Mutation returns the NetstatMutation object of the builder.

func (*NetstatCreate) Save

func (nc *NetstatCreate) Save(ctx context.Context) (*Netstat, error)

Save creates the Netstat in the database.

func (*NetstatCreate) SaveX

func (nc *NetstatCreate) SaveX(ctx context.Context) *Netstat

SaveX calls Save and panics if Save returns an error.

func (*NetstatCreate) SetAddr

func (nc *NetstatCreate) SetAddr(s string) *NetstatCreate

SetAddr sets the "addr" field.

func (*NetstatCreate) SetCreatedAt

func (nc *NetstatCreate) SetCreatedAt(t time.Time) *NetstatCreate

SetCreatedAt sets the "created_at" field.

func (*NetstatCreate) SetHostID

func (nc *NetstatCreate) SetHostID(h *Host) *NetstatCreate

SetHostID sets the "host_id" edge to the Host entity.

func (*NetstatCreate) SetHostIDID

func (nc *NetstatCreate) SetHostIDID(id string) *NetstatCreate

SetHostIDID sets the "host_id" edge to the Host entity by ID.

func (*NetstatCreate) SetNillableCreatedAt

func (nc *NetstatCreate) SetNillableCreatedAt(t *time.Time) *NetstatCreate

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

func (*NetstatCreate) SetNillableUpdatedAt

func (nc *NetstatCreate) SetNillableUpdatedAt(t *time.Time) *NetstatCreate

SetNillableUpdatedAt sets the "updated_at" field if the given value is not nil.

func (*NetstatCreate) SetPort

func (nc *NetstatCreate) SetPort(u uint64) *NetstatCreate

SetPort sets the "port" field.

func (*NetstatCreate) SetProcess

func (nc *NetstatCreate) SetProcess(s string) *NetstatCreate

SetProcess sets the "process" field.

func (*NetstatCreate) SetProto

func (nc *NetstatCreate) SetProto(s string) *NetstatCreate

SetProto sets the "proto" field.

func (*NetstatCreate) SetUpdatedAt

func (nc *NetstatCreate) SetUpdatedAt(t time.Time) *NetstatCreate

SetUpdatedAt sets the "updated_at" field.

type NetstatCreateBulk

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

NetstatCreateBulk is the builder for creating many Netstat entities in bulk.

func (*NetstatCreateBulk) Exec

func (ncb *NetstatCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*NetstatCreateBulk) ExecX

func (ncb *NetstatCreateBulk) ExecX(ctx context.Context)

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

func (*NetstatCreateBulk) Save

func (ncb *NetstatCreateBulk) Save(ctx context.Context) ([]*Netstat, error)

Save creates the Netstat entities in the database.

func (*NetstatCreateBulk) SaveX

func (ncb *NetstatCreateBulk) SaveX(ctx context.Context) []*Netstat

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

type NetstatDelete

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

NetstatDelete is the builder for deleting a Netstat entity.

func (*NetstatDelete) Exec

func (nd *NetstatDelete) Exec(ctx context.Context) (int, error)

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

func (*NetstatDelete) ExecX

func (nd *NetstatDelete) ExecX(ctx context.Context) int

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

func (*NetstatDelete) Where

func (nd *NetstatDelete) Where(ps ...predicate.Netstat) *NetstatDelete

Where appends a list predicates to the NetstatDelete builder.

type NetstatDeleteOne

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

NetstatDeleteOne is the builder for deleting a single Netstat entity.

func (*NetstatDeleteOne) Exec

func (ndo *NetstatDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*NetstatDeleteOne) ExecX

func (ndo *NetstatDeleteOne) ExecX(ctx context.Context)

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

type NetstatEdges

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

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

func (NetstatEdges) HostIDOrErr

func (e NetstatEdges) HostIDOrErr() (*Host, error)

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

type NetstatGroupBy

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

NetstatGroupBy is the group-by builder for Netstat entities.

func (*NetstatGroupBy) Aggregate

func (ngb *NetstatGroupBy) Aggregate(fns ...AggregateFunc) *NetstatGroupBy

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

func (*NetstatGroupBy) Bool

func (ngb *NetstatGroupBy) 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 (*NetstatGroupBy) BoolX

func (ngb *NetstatGroupBy) BoolX(ctx context.Context) bool

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

func (*NetstatGroupBy) Bools

func (ngb *NetstatGroupBy) 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 (*NetstatGroupBy) BoolsX

func (ngb *NetstatGroupBy) BoolsX(ctx context.Context) []bool

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

func (*NetstatGroupBy) Float64

func (ngb *NetstatGroupBy) 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 (*NetstatGroupBy) Float64X

func (ngb *NetstatGroupBy) Float64X(ctx context.Context) float64

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

func (*NetstatGroupBy) Float64s

func (ngb *NetstatGroupBy) 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 (*NetstatGroupBy) Float64sX

func (ngb *NetstatGroupBy) Float64sX(ctx context.Context) []float64

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

func (*NetstatGroupBy) Int

func (ngb *NetstatGroupBy) 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 (*NetstatGroupBy) IntX

func (ngb *NetstatGroupBy) IntX(ctx context.Context) int

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

func (*NetstatGroupBy) Ints

func (ngb *NetstatGroupBy) 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 (*NetstatGroupBy) IntsX

func (ngb *NetstatGroupBy) IntsX(ctx context.Context) []int

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

func (*NetstatGroupBy) Scan

func (ngb *NetstatGroupBy) Scan(ctx context.Context, v interface{}) error

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

func (*NetstatGroupBy) ScanX

func (ngb *NetstatGroupBy) ScanX(ctx context.Context, v interface{})

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

func (*NetstatGroupBy) String

func (ngb *NetstatGroupBy) 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 (*NetstatGroupBy) StringX

func (ngb *NetstatGroupBy) StringX(ctx context.Context) string

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

func (*NetstatGroupBy) Strings

func (ngb *NetstatGroupBy) 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 (*NetstatGroupBy) StringsX

func (ngb *NetstatGroupBy) StringsX(ctx context.Context) []string

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

type NetstatMutation

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

NetstatMutation represents an operation that mutates the Netstat nodes in the graph.

func (*NetstatMutation) AddField

func (m *NetstatMutation) 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 (*NetstatMutation) AddPort

func (m *NetstatMutation) AddPort(u int64)

AddPort adds u to the "port" field.

func (*NetstatMutation) AddedEdges

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

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

func (*NetstatMutation) AddedField

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

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

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

func (*NetstatMutation) AddedIDs

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

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

func (*NetstatMutation) AddedPort

func (m *NetstatMutation) AddedPort() (r int64, exists bool)

AddedPort returns the value that was added to the "port" field in this mutation.

func (*NetstatMutation) Addr

func (m *NetstatMutation) Addr() (r string, exists bool)

Addr returns the value of the "addr" field in the mutation.

func (*NetstatMutation) ClearEdge

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

func (m *NetstatMutation) 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 (*NetstatMutation) ClearHostID

func (m *NetstatMutation) ClearHostID()

ClearHostID clears the "host_id" edge to the Host entity.

func (*NetstatMutation) ClearedEdges

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

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

func (*NetstatMutation) ClearedFields

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

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

func (NetstatMutation) Client

func (m NetstatMutation) 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 (*NetstatMutation) CreatedAt

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

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

func (*NetstatMutation) EdgeCleared

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

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

func (*NetstatMutation) Field

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

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

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

func (*NetstatMutation) Fields

func (m *NetstatMutation) 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 (*NetstatMutation) HostIDCleared

func (m *NetstatMutation) HostIDCleared() bool

HostIDCleared reports if the "host_id" edge to the Host entity was cleared.

func (*NetstatMutation) HostIDID

func (m *NetstatMutation) HostIDID() (id string, exists bool)

HostIDID returns the "host_id" edge ID in the mutation.

func (*NetstatMutation) HostIDIDs

func (m *NetstatMutation) HostIDIDs() (ids []string)

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

func (*NetstatMutation) ID

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

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

func (*NetstatMutation) IDs

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

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

func (*NetstatMutation) OldAddr

func (m *NetstatMutation) OldAddr(ctx context.Context) (v string, err error)

OldAddr returns the old "addr" field's value of the Netstat entity. If the Netstat 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 (*NetstatMutation) OldCreatedAt

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

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

func (m *NetstatMutation) 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 (*NetstatMutation) OldPort

func (m *NetstatMutation) OldPort(ctx context.Context) (v uint64, err error)

OldPort returns the old "port" field's value of the Netstat entity. If the Netstat 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 (*NetstatMutation) OldProcess

func (m *NetstatMutation) OldProcess(ctx context.Context) (v string, err error)

OldProcess returns the old "process" field's value of the Netstat entity. If the Netstat 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 (*NetstatMutation) OldProto

func (m *NetstatMutation) OldProto(ctx context.Context) (v string, err error)

OldProto returns the old "proto" field's value of the Netstat entity. If the Netstat 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 (*NetstatMutation) OldUpdatedAt

func (m *NetstatMutation) OldUpdatedAt(ctx context.Context) (v time.Time, err error)

OldUpdatedAt returns the old "updated_at" field's value of the Netstat entity. If the Netstat 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 (*NetstatMutation) Op

func (m *NetstatMutation) Op() Op

Op returns the operation name.

func (*NetstatMutation) Port

func (m *NetstatMutation) Port() (r uint64, exists bool)

Port returns the value of the "port" field in the mutation.

func (*NetstatMutation) Process

func (m *NetstatMutation) Process() (r string, exists bool)

Process returns the value of the "process" field in the mutation.

func (*NetstatMutation) Proto

func (m *NetstatMutation) Proto() (r string, exists bool)

Proto returns the value of the "proto" field in the mutation.

func (*NetstatMutation) RemovedEdges

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

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

func (*NetstatMutation) RemovedIDs

func (m *NetstatMutation) 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 (*NetstatMutation) ResetAddr

func (m *NetstatMutation) ResetAddr()

ResetAddr resets all changes to the "addr" field.

func (*NetstatMutation) ResetCreatedAt

func (m *NetstatMutation) ResetCreatedAt()

ResetCreatedAt resets all changes to the "created_at" field.

func (*NetstatMutation) ResetEdge

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

func (m *NetstatMutation) 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 (*NetstatMutation) ResetHostID

func (m *NetstatMutation) ResetHostID()

ResetHostID resets all changes to the "host_id" edge.

func (*NetstatMutation) ResetPort

func (m *NetstatMutation) ResetPort()

ResetPort resets all changes to the "port" field.

func (*NetstatMutation) ResetProcess

func (m *NetstatMutation) ResetProcess()

ResetProcess resets all changes to the "process" field.

func (*NetstatMutation) ResetProto

func (m *NetstatMutation) ResetProto()

ResetProto resets all changes to the "proto" field.

func (*NetstatMutation) ResetUpdatedAt

func (m *NetstatMutation) ResetUpdatedAt()

ResetUpdatedAt resets all changes to the "updated_at" field.

func (*NetstatMutation) SetAddr

func (m *NetstatMutation) SetAddr(s string)

SetAddr sets the "addr" field.

func (*NetstatMutation) SetCreatedAt

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

SetCreatedAt sets the "created_at" field.

func (*NetstatMutation) SetField

func (m *NetstatMutation) 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 (*NetstatMutation) SetHostIDID

func (m *NetstatMutation) SetHostIDID(id string)

SetHostIDID sets the "host_id" edge to the Host entity by id.

func (*NetstatMutation) SetPort

func (m *NetstatMutation) SetPort(u uint64)

SetPort sets the "port" field.

func (*NetstatMutation) SetProcess

func (m *NetstatMutation) SetProcess(s string)

SetProcess sets the "process" field.

func (*NetstatMutation) SetProto

func (m *NetstatMutation) SetProto(s string)

SetProto sets the "proto" field.

func (*NetstatMutation) SetUpdatedAt

func (m *NetstatMutation) SetUpdatedAt(t time.Time)

SetUpdatedAt sets the "updated_at" field.

func (NetstatMutation) Tx

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

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

func (*NetstatMutation) Type

func (m *NetstatMutation) Type() string

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

func (*NetstatMutation) UpdatedAt

func (m *NetstatMutation) UpdatedAt() (r time.Time, exists bool)

UpdatedAt returns the value of the "updated_at" field in the mutation.

func (*NetstatMutation) Where

func (m *NetstatMutation) Where(ps ...predicate.Netstat)

Where appends a list predicates to the NetstatMutation builder.

type NetstatQuery

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

NetstatQuery is the builder for querying Netstat entities.

func (*NetstatQuery) All

func (nq *NetstatQuery) All(ctx context.Context) ([]*Netstat, error)

All executes the query and returns a list of Netstats.

func (*NetstatQuery) AllX

func (nq *NetstatQuery) AllX(ctx context.Context) []*Netstat

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

func (*NetstatQuery) Clone

func (nq *NetstatQuery) Clone() *NetstatQuery

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

func (*NetstatQuery) Count

func (nq *NetstatQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*NetstatQuery) CountX

func (nq *NetstatQuery) CountX(ctx context.Context) int

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

func (*NetstatQuery) Exist

func (nq *NetstatQuery) Exist(ctx context.Context) (bool, error)

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

func (*NetstatQuery) ExistX

func (nq *NetstatQuery) ExistX(ctx context.Context) bool

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

func (*NetstatQuery) First

func (nq *NetstatQuery) First(ctx context.Context) (*Netstat, error)

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

func (*NetstatQuery) FirstID

func (nq *NetstatQuery) FirstID(ctx context.Context) (id int, err error)

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

func (*NetstatQuery) FirstIDX

func (nq *NetstatQuery) FirstIDX(ctx context.Context) int

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

func (*NetstatQuery) FirstX

func (nq *NetstatQuery) FirstX(ctx context.Context) *Netstat

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

func (*NetstatQuery) GroupBy

func (nq *NetstatQuery) GroupBy(field string, fields ...string) *NetstatGroupBy

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

client.Netstat.Query().
	GroupBy(netstat.FieldAddr).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*NetstatQuery) IDs

func (nq *NetstatQuery) IDs(ctx context.Context) ([]int, error)

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

func (*NetstatQuery) IDsX

func (nq *NetstatQuery) IDsX(ctx context.Context) []int

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

func (*NetstatQuery) Limit

func (nq *NetstatQuery) Limit(limit int) *NetstatQuery

Limit adds a limit step to the query.

func (*NetstatQuery) Offset

func (nq *NetstatQuery) Offset(offset int) *NetstatQuery

Offset adds an offset step to the query.

func (*NetstatQuery) Only

func (nq *NetstatQuery) Only(ctx context.Context) (*Netstat, error)

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

func (*NetstatQuery) OnlyID

func (nq *NetstatQuery) OnlyID(ctx context.Context) (id int, err error)

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

func (*NetstatQuery) OnlyIDX

func (nq *NetstatQuery) OnlyIDX(ctx context.Context) int

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

func (*NetstatQuery) OnlyX

func (nq *NetstatQuery) OnlyX(ctx context.Context) *Netstat

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

func (*NetstatQuery) Order

func (nq *NetstatQuery) Order(o ...OrderFunc) *NetstatQuery

Order adds an order step to the query.

func (*NetstatQuery) QueryHostID

func (nq *NetstatQuery) QueryHostID() *HostQuery

QueryHostID chains the current query on the "host_id" edge.

func (*NetstatQuery) Select

func (nq *NetstatQuery) Select(fields ...string) *NetstatSelect

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

client.Netstat.Query().
	Select(netstat.FieldAddr).
	Scan(ctx, &v)

func (*NetstatQuery) Unique

func (nq *NetstatQuery) Unique(unique bool) *NetstatQuery

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

func (*NetstatQuery) Where

func (nq *NetstatQuery) Where(ps ...predicate.Netstat) *NetstatQuery

Where adds a new predicate for the NetstatQuery builder.

func (*NetstatQuery) WithHostID

func (nq *NetstatQuery) WithHostID(opts ...func(*HostQuery)) *NetstatQuery

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

type NetstatSelect

type NetstatSelect struct {
	*NetstatQuery
	// contains filtered or unexported fields
}

NetstatSelect is the builder for selecting fields of Netstat entities.

func (*NetstatSelect) Bool

func (ns *NetstatSelect) Bool(ctx context.Context) (_ bool, err error)

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

func (*NetstatSelect) BoolX

func (ns *NetstatSelect) BoolX(ctx context.Context) bool

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

func (*NetstatSelect) Bools

func (ns *NetstatSelect) Bools(ctx context.Context) ([]bool, error)

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

func (*NetstatSelect) BoolsX

func (ns *NetstatSelect) BoolsX(ctx context.Context) []bool

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

func (*NetstatSelect) Float64

func (ns *NetstatSelect) Float64(ctx context.Context) (_ float64, err error)

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

func (*NetstatSelect) Float64X

func (ns *NetstatSelect) Float64X(ctx context.Context) float64

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

func (*NetstatSelect) Float64s

func (ns *NetstatSelect) Float64s(ctx context.Context) ([]float64, error)

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

func (*NetstatSelect) Float64sX

func (ns *NetstatSelect) Float64sX(ctx context.Context) []float64

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

func (*NetstatSelect) Int

func (ns *NetstatSelect) Int(ctx context.Context) (_ int, err error)

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

func (*NetstatSelect) IntX

func (ns *NetstatSelect) IntX(ctx context.Context) int

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

func (*NetstatSelect) Ints

func (ns *NetstatSelect) Ints(ctx context.Context) ([]int, error)

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

func (*NetstatSelect) IntsX

func (ns *NetstatSelect) IntsX(ctx context.Context) []int

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

func (*NetstatSelect) Scan

func (ns *NetstatSelect) Scan(ctx context.Context, v interface{}) error

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

func (*NetstatSelect) ScanX

func (ns *NetstatSelect) ScanX(ctx context.Context, v interface{})

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

func (*NetstatSelect) String

func (ns *NetstatSelect) String(ctx context.Context) (_ string, err error)

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

func (*NetstatSelect) StringX

func (ns *NetstatSelect) StringX(ctx context.Context) string

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

func (*NetstatSelect) Strings

func (ns *NetstatSelect) Strings(ctx context.Context) ([]string, error)

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

func (*NetstatSelect) StringsX

func (ns *NetstatSelect) StringsX(ctx context.Context) []string

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

type NetstatUpdate

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

NetstatUpdate is the builder for updating Netstat entities.

func (*NetstatUpdate) AddPort

func (nu *NetstatUpdate) AddPort(u int64) *NetstatUpdate

AddPort adds u to the "port" field.

func (*NetstatUpdate) ClearHostID

func (nu *NetstatUpdate) ClearHostID() *NetstatUpdate

ClearHostID clears the "host_id" edge to the Host entity.

func (*NetstatUpdate) Exec

func (nu *NetstatUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*NetstatUpdate) ExecX

func (nu *NetstatUpdate) ExecX(ctx context.Context)

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

func (*NetstatUpdate) Mutation

func (nu *NetstatUpdate) Mutation() *NetstatMutation

Mutation returns the NetstatMutation object of the builder.

func (*NetstatUpdate) Save

func (nu *NetstatUpdate) Save(ctx context.Context) (int, error)

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

func (*NetstatUpdate) SaveX

func (nu *NetstatUpdate) SaveX(ctx context.Context) int

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

func (*NetstatUpdate) SetAddr

func (nu *NetstatUpdate) SetAddr(s string) *NetstatUpdate

SetAddr sets the "addr" field.

func (*NetstatUpdate) SetCreatedAt

func (nu *NetstatUpdate) SetCreatedAt(t time.Time) *NetstatUpdate

SetCreatedAt sets the "created_at" field.

func (*NetstatUpdate) SetHostID

func (nu *NetstatUpdate) SetHostID(h *Host) *NetstatUpdate

SetHostID sets the "host_id" edge to the Host entity.

func (*NetstatUpdate) SetHostIDID

func (nu *NetstatUpdate) SetHostIDID(id string) *NetstatUpdate

SetHostIDID sets the "host_id" edge to the Host entity by ID.

func (*NetstatUpdate) SetNillableCreatedAt

func (nu *NetstatUpdate) SetNillableCreatedAt(t *time.Time) *NetstatUpdate

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

func (*NetstatUpdate) SetNillableUpdatedAt

func (nu *NetstatUpdate) SetNillableUpdatedAt(t *time.Time) *NetstatUpdate

SetNillableUpdatedAt sets the "updated_at" field if the given value is not nil.

func (*NetstatUpdate) SetPort

func (nu *NetstatUpdate) SetPort(u uint64) *NetstatUpdate

SetPort sets the "port" field.

func (*NetstatUpdate) SetProcess

func (nu *NetstatUpdate) SetProcess(s string) *NetstatUpdate

SetProcess sets the "process" field.

func (*NetstatUpdate) SetProto

func (nu *NetstatUpdate) SetProto(s string) *NetstatUpdate

SetProto sets the "proto" field.

func (*NetstatUpdate) SetUpdatedAt

func (nu *NetstatUpdate) SetUpdatedAt(t time.Time) *NetstatUpdate

SetUpdatedAt sets the "updated_at" field.

func (*NetstatUpdate) Where

func (nu *NetstatUpdate) Where(ps ...predicate.Netstat) *NetstatUpdate

Where appends a list predicates to the NetstatUpdate builder.

type NetstatUpdateOne

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

NetstatUpdateOne is the builder for updating a single Netstat entity.

func (*NetstatUpdateOne) AddPort

func (nuo *NetstatUpdateOne) AddPort(u int64) *NetstatUpdateOne

AddPort adds u to the "port" field.

func (*NetstatUpdateOne) ClearHostID

func (nuo *NetstatUpdateOne) ClearHostID() *NetstatUpdateOne

ClearHostID clears the "host_id" edge to the Host entity.

func (*NetstatUpdateOne) Exec

func (nuo *NetstatUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*NetstatUpdateOne) ExecX

func (nuo *NetstatUpdateOne) ExecX(ctx context.Context)

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

func (*NetstatUpdateOne) Mutation

func (nuo *NetstatUpdateOne) Mutation() *NetstatMutation

Mutation returns the NetstatMutation object of the builder.

func (*NetstatUpdateOne) Save

func (nuo *NetstatUpdateOne) Save(ctx context.Context) (*Netstat, error)

Save executes the query and returns the updated Netstat entity.

func (*NetstatUpdateOne) SaveX

func (nuo *NetstatUpdateOne) SaveX(ctx context.Context) *Netstat

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

func (*NetstatUpdateOne) Select

func (nuo *NetstatUpdateOne) Select(field string, fields ...string) *NetstatUpdateOne

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

func (*NetstatUpdateOne) SetAddr

func (nuo *NetstatUpdateOne) SetAddr(s string) *NetstatUpdateOne

SetAddr sets the "addr" field.

func (*NetstatUpdateOne) SetCreatedAt

func (nuo *NetstatUpdateOne) SetCreatedAt(t time.Time) *NetstatUpdateOne

SetCreatedAt sets the "created_at" field.

func (*NetstatUpdateOne) SetHostID

func (nuo *NetstatUpdateOne) SetHostID(h *Host) *NetstatUpdateOne

SetHostID sets the "host_id" edge to the Host entity.

func (*NetstatUpdateOne) SetHostIDID

func (nuo *NetstatUpdateOne) SetHostIDID(id string) *NetstatUpdateOne

SetHostIDID sets the "host_id" edge to the Host entity by ID.

func (*NetstatUpdateOne) SetNillableCreatedAt

func (nuo *NetstatUpdateOne) SetNillableCreatedAt(t *time.Time) *NetstatUpdateOne

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

func (*NetstatUpdateOne) SetNillableUpdatedAt

func (nuo *NetstatUpdateOne) SetNillableUpdatedAt(t *time.Time) *NetstatUpdateOne

SetNillableUpdatedAt sets the "updated_at" field if the given value is not nil.

func (*NetstatUpdateOne) SetPort

func (nuo *NetstatUpdateOne) SetPort(u uint64) *NetstatUpdateOne

SetPort sets the "port" field.

func (*NetstatUpdateOne) SetProcess

func (nuo *NetstatUpdateOne) SetProcess(s string) *NetstatUpdateOne

SetProcess sets the "process" field.

func (*NetstatUpdateOne) SetProto

func (nuo *NetstatUpdateOne) SetProto(s string) *NetstatUpdateOne

SetProto sets the "proto" field.

func (*NetstatUpdateOne) SetUpdatedAt

func (nuo *NetstatUpdateOne) SetUpdatedAt(t time.Time) *NetstatUpdateOne

SetUpdatedAt sets the "updated_at" field.

type Netstats

type Netstats []*Netstat

Netstats is a parsable slice of Netstat.

type Network

type Network struct {

	// ID of the ent.
	ID int `json:"id,omitempty"`
	// Index holds the value of the "Index" field.
	Index int `json:"Index,omitempty"`
	// MTU holds the value of the "MTU" field.
	MTU int `json:"MTU,omitempty"`
	// Name holds the value of the "name" field.
	Name string `json:"name,omitempty"`
	// HardwareAddr holds the value of the "HardwareAddr" field.
	HardwareAddr string `json:"HardwareAddr,omitempty"`
	// Flags holds the value of the "Flags" field.
	Flags []string `json:"Flags,omitempty"`
	// Addrs holds the value of the "addrs" field.
	Addrs []string `json:"addrs,omitempty"`
	// CreatedAt holds the value of the "created_at" field.
	CreatedAt time.Time `json:"created_at,omitempty"`
	// UpdatedAt holds the value of the "updated_at" field.
	UpdatedAt time.Time `json:"updated_at,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the NetworkQuery when eager-loading is set.
	Edges NetworkEdges `json:"edges"`
	// contains filtered or unexported fields
}

Network is the model entity for the Network schema.

func (*Network) QueryHostID

func (n *Network) QueryHostID() *HostQuery

QueryHostID queries the "host_id" edge of the Network entity.

func (*Network) String

func (n *Network) String() string

String implements the fmt.Stringer.

func (*Network) Unwrap

func (n *Network) Unwrap() *Network

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

func (n *Network) Update() *NetworkUpdateOne

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

type NetworkClient

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

NetworkClient is a client for the Network schema.

func NewNetworkClient

func NewNetworkClient(c config) *NetworkClient

NewNetworkClient returns a client for the Network from the given config.

func (*NetworkClient) Create

func (c *NetworkClient) Create() *NetworkCreate

Create returns a create builder for Network.

func (*NetworkClient) CreateBulk

func (c *NetworkClient) CreateBulk(builders ...*NetworkCreate) *NetworkCreateBulk

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

func (*NetworkClient) Delete

func (c *NetworkClient) Delete() *NetworkDelete

Delete returns a delete builder for Network.

func (*NetworkClient) DeleteOne

func (c *NetworkClient) DeleteOne(n *Network) *NetworkDeleteOne

DeleteOne returns a delete builder for the given entity.

func (*NetworkClient) DeleteOneID

func (c *NetworkClient) DeleteOneID(id int) *NetworkDeleteOne

DeleteOneID returns a delete builder for the given id.

func (*NetworkClient) Get

func (c *NetworkClient) Get(ctx context.Context, id int) (*Network, error)

Get returns a Network entity by its id.

func (*NetworkClient) GetX

func (c *NetworkClient) GetX(ctx context.Context, id int) *Network

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

func (*NetworkClient) Hooks

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

Hooks returns the client hooks.

func (*NetworkClient) Query

func (c *NetworkClient) Query() *NetworkQuery

Query returns a query builder for Network.

func (*NetworkClient) QueryHostID

func (c *NetworkClient) QueryHostID(n *Network) *HostQuery

QueryHostID queries the host_id edge of a Network.

func (*NetworkClient) Update

func (c *NetworkClient) Update() *NetworkUpdate

Update returns an update builder for Network.

func (*NetworkClient) UpdateOne

func (c *NetworkClient) UpdateOne(n *Network) *NetworkUpdateOne

UpdateOne returns an update builder for the given entity.

func (*NetworkClient) UpdateOneID

func (c *NetworkClient) UpdateOneID(id int) *NetworkUpdateOne

UpdateOneID returns an update builder for the given id.

func (*NetworkClient) Use

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

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

type NetworkCreate

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

NetworkCreate is the builder for creating a Network entity.

func (*NetworkCreate) Exec

func (nc *NetworkCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*NetworkCreate) ExecX

func (nc *NetworkCreate) ExecX(ctx context.Context)

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

func (*NetworkCreate) Mutation

func (nc *NetworkCreate) Mutation() *NetworkMutation

Mutation returns the NetworkMutation object of the builder.

func (*NetworkCreate) Save

func (nc *NetworkCreate) Save(ctx context.Context) (*Network, error)

Save creates the Network in the database.

func (*NetworkCreate) SaveX

func (nc *NetworkCreate) SaveX(ctx context.Context) *Network

SaveX calls Save and panics if Save returns an error.

func (*NetworkCreate) SetAddrs

func (nc *NetworkCreate) SetAddrs(s []string) *NetworkCreate

SetAddrs sets the "addrs" field.

func (*NetworkCreate) SetCreatedAt

func (nc *NetworkCreate) SetCreatedAt(t time.Time) *NetworkCreate

SetCreatedAt sets the "created_at" field.

func (*NetworkCreate) SetFlags

func (nc *NetworkCreate) SetFlags(s []string) *NetworkCreate

SetFlags sets the "Flags" field.

func (*NetworkCreate) SetHardwareAddr

func (nc *NetworkCreate) SetHardwareAddr(s string) *NetworkCreate

SetHardwareAddr sets the "HardwareAddr" field.

func (*NetworkCreate) SetHostID

func (nc *NetworkCreate) SetHostID(h *Host) *NetworkCreate

SetHostID sets the "host_id" edge to the Host entity.

func (*NetworkCreate) SetHostIDID

func (nc *NetworkCreate) SetHostIDID(id string) *NetworkCreate

SetHostIDID sets the "host_id" edge to the Host entity by ID.

func (*NetworkCreate) SetIndex

func (nc *NetworkCreate) SetIndex(i int) *NetworkCreate

SetIndex sets the "Index" field.

func (*NetworkCreate) SetMTU

func (nc *NetworkCreate) SetMTU(i int) *NetworkCreate

SetMTU sets the "MTU" field.

func (*NetworkCreate) SetName

func (nc *NetworkCreate) SetName(s string) *NetworkCreate

SetName sets the "name" field.

func (*NetworkCreate) SetNillableCreatedAt

func (nc *NetworkCreate) SetNillableCreatedAt(t *time.Time) *NetworkCreate

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

func (*NetworkCreate) SetNillableUpdatedAt

func (nc *NetworkCreate) SetNillableUpdatedAt(t *time.Time) *NetworkCreate

SetNillableUpdatedAt sets the "updated_at" field if the given value is not nil.

func (*NetworkCreate) SetUpdatedAt

func (nc *NetworkCreate) SetUpdatedAt(t time.Time) *NetworkCreate

SetUpdatedAt sets the "updated_at" field.

type NetworkCreateBulk

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

NetworkCreateBulk is the builder for creating many Network entities in bulk.

func (*NetworkCreateBulk) Exec

func (ncb *NetworkCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*NetworkCreateBulk) ExecX

func (ncb *NetworkCreateBulk) ExecX(ctx context.Context)

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

func (*NetworkCreateBulk) Save

func (ncb *NetworkCreateBulk) Save(ctx context.Context) ([]*Network, error)

Save creates the Network entities in the database.

func (*NetworkCreateBulk) SaveX

func (ncb *NetworkCreateBulk) SaveX(ctx context.Context) []*Network

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

type NetworkDelete

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

NetworkDelete is the builder for deleting a Network entity.

func (*NetworkDelete) Exec

func (nd *NetworkDelete) Exec(ctx context.Context) (int, error)

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

func (*NetworkDelete) ExecX

func (nd *NetworkDelete) ExecX(ctx context.Context) int

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

func (*NetworkDelete) Where

func (nd *NetworkDelete) Where(ps ...predicate.Network) *NetworkDelete

Where appends a list predicates to the NetworkDelete builder.

type NetworkDeleteOne

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

NetworkDeleteOne is the builder for deleting a single Network entity.

func (*NetworkDeleteOne) Exec

func (ndo *NetworkDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*NetworkDeleteOne) ExecX

func (ndo *NetworkDeleteOne) ExecX(ctx context.Context)

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

type NetworkEdges

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

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

func (NetworkEdges) HostIDOrErr

func (e NetworkEdges) HostIDOrErr() (*Host, error)

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

type NetworkGroupBy

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

NetworkGroupBy is the group-by builder for Network entities.

func (*NetworkGroupBy) Aggregate

func (ngb *NetworkGroupBy) Aggregate(fns ...AggregateFunc) *NetworkGroupBy

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

func (*NetworkGroupBy) Bool

func (ngb *NetworkGroupBy) 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 (*NetworkGroupBy) BoolX

func (ngb *NetworkGroupBy) BoolX(ctx context.Context) bool

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

func (*NetworkGroupBy) Bools

func (ngb *NetworkGroupBy) 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 (*NetworkGroupBy) BoolsX

func (ngb *NetworkGroupBy) BoolsX(ctx context.Context) []bool

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

func (*NetworkGroupBy) Float64

func (ngb *NetworkGroupBy) 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 (*NetworkGroupBy) Float64X

func (ngb *NetworkGroupBy) Float64X(ctx context.Context) float64

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

func (*NetworkGroupBy) Float64s

func (ngb *NetworkGroupBy) 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 (*NetworkGroupBy) Float64sX

func (ngb *NetworkGroupBy) Float64sX(ctx context.Context) []float64

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

func (*NetworkGroupBy) Int

func (ngb *NetworkGroupBy) 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 (*NetworkGroupBy) IntX

func (ngb *NetworkGroupBy) IntX(ctx context.Context) int

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

func (*NetworkGroupBy) Ints

func (ngb *NetworkGroupBy) 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 (*NetworkGroupBy) IntsX

func (ngb *NetworkGroupBy) IntsX(ctx context.Context) []int

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

func (*NetworkGroupBy) Scan

func (ngb *NetworkGroupBy) Scan(ctx context.Context, v interface{}) error

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

func (*NetworkGroupBy) ScanX

func (ngb *NetworkGroupBy) ScanX(ctx context.Context, v interface{})

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

func (*NetworkGroupBy) String

func (ngb *NetworkGroupBy) 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 (*NetworkGroupBy) StringX

func (ngb *NetworkGroupBy) StringX(ctx context.Context) string

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

func (*NetworkGroupBy) Strings

func (ngb *NetworkGroupBy) 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 (*NetworkGroupBy) StringsX

func (ngb *NetworkGroupBy) StringsX(ctx context.Context) []string

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

type NetworkMutation

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

NetworkMutation represents an operation that mutates the Network nodes in the graph.

func (*NetworkMutation) AddField

func (m *NetworkMutation) 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 (*NetworkMutation) AddIndex

func (m *NetworkMutation) AddIndex(i int)

AddIndex adds i to the "Index" field.

func (*NetworkMutation) AddMTU

func (m *NetworkMutation) AddMTU(i int)

AddMTU adds i to the "MTU" field.

func (*NetworkMutation) AddedEdges

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

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

func (*NetworkMutation) AddedField

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

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

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

func (*NetworkMutation) AddedIDs

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

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

func (*NetworkMutation) AddedIndex

func (m *NetworkMutation) AddedIndex() (r int, exists bool)

AddedIndex returns the value that was added to the "Index" field in this mutation.

func (*NetworkMutation) AddedMTU

func (m *NetworkMutation) AddedMTU() (r int, exists bool)

AddedMTU returns the value that was added to the "MTU" field in this mutation.

func (*NetworkMutation) Addrs

func (m *NetworkMutation) Addrs() (r []string, exists bool)

Addrs returns the value of the "addrs" field in the mutation.

func (*NetworkMutation) AddrsCleared

func (m *NetworkMutation) AddrsCleared() bool

AddrsCleared returns if the "addrs" field was cleared in this mutation.

func (*NetworkMutation) ClearAddrs

func (m *NetworkMutation) ClearAddrs()

ClearAddrs clears the value of the "addrs" field.

func (*NetworkMutation) ClearEdge

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

func (m *NetworkMutation) 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 (*NetworkMutation) ClearFlags

func (m *NetworkMutation) ClearFlags()

ClearFlags clears the value of the "Flags" field.

func (*NetworkMutation) ClearHostID

func (m *NetworkMutation) ClearHostID()

ClearHostID clears the "host_id" edge to the Host entity.

func (*NetworkMutation) ClearedEdges

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

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

func (*NetworkMutation) ClearedFields

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

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

func (NetworkMutation) Client

func (m NetworkMutation) 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 (*NetworkMutation) CreatedAt

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

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

func (*NetworkMutation) EdgeCleared

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

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

func (*NetworkMutation) Field

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

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

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

func (*NetworkMutation) Fields

func (m *NetworkMutation) 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 (*NetworkMutation) Flags

func (m *NetworkMutation) Flags() (r []string, exists bool)

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

func (*NetworkMutation) FlagsCleared

func (m *NetworkMutation) FlagsCleared() bool

FlagsCleared returns if the "Flags" field was cleared in this mutation.

func (*NetworkMutation) HardwareAddr

func (m *NetworkMutation) HardwareAddr() (r string, exists bool)

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

func (*NetworkMutation) HostIDCleared

func (m *NetworkMutation) HostIDCleared() bool

HostIDCleared reports if the "host_id" edge to the Host entity was cleared.

func (*NetworkMutation) HostIDID

func (m *NetworkMutation) HostIDID() (id string, exists bool)

HostIDID returns the "host_id" edge ID in the mutation.

func (*NetworkMutation) HostIDIDs

func (m *NetworkMutation) HostIDIDs() (ids []string)

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

func (*NetworkMutation) ID

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

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

func (*NetworkMutation) IDs

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

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

func (*NetworkMutation) Index

func (m *NetworkMutation) Index() (r int, exists bool)

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

func (*NetworkMutation) MTU

func (m *NetworkMutation) MTU() (r int, exists bool)

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

func (*NetworkMutation) Name

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

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

func (*NetworkMutation) OldAddrs

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

OldAddrs returns the old "addrs" field's value of the Network entity. If the Network 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 (*NetworkMutation) OldCreatedAt

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

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

func (m *NetworkMutation) 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 (*NetworkMutation) OldFlags

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

OldFlags returns the old "Flags" field's value of the Network entity. If the Network 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 (*NetworkMutation) OldHardwareAddr

func (m *NetworkMutation) OldHardwareAddr(ctx context.Context) (v string, err error)

OldHardwareAddr returns the old "HardwareAddr" field's value of the Network entity. If the Network 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 (*NetworkMutation) OldIndex

func (m *NetworkMutation) OldIndex(ctx context.Context) (v int, err error)

OldIndex returns the old "Index" field's value of the Network entity. If the Network 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 (*NetworkMutation) OldMTU

func (m *NetworkMutation) OldMTU(ctx context.Context) (v int, err error)

OldMTU returns the old "MTU" field's value of the Network entity. If the Network 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 (*NetworkMutation) OldName

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

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

func (m *NetworkMutation) OldUpdatedAt(ctx context.Context) (v time.Time, err error)

OldUpdatedAt returns the old "updated_at" field's value of the Network entity. If the Network 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 (*NetworkMutation) Op

func (m *NetworkMutation) Op() Op

Op returns the operation name.

func (*NetworkMutation) RemovedEdges

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

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

func (*NetworkMutation) RemovedIDs

func (m *NetworkMutation) 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 (*NetworkMutation) ResetAddrs

func (m *NetworkMutation) ResetAddrs()

ResetAddrs resets all changes to the "addrs" field.

func (*NetworkMutation) ResetCreatedAt

func (m *NetworkMutation) ResetCreatedAt()

ResetCreatedAt resets all changes to the "created_at" field.

func (*NetworkMutation) ResetEdge

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

func (m *NetworkMutation) 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 (*NetworkMutation) ResetFlags

func (m *NetworkMutation) ResetFlags()

ResetFlags resets all changes to the "Flags" field.

func (*NetworkMutation) ResetHardwareAddr

func (m *NetworkMutation) ResetHardwareAddr()

ResetHardwareAddr resets all changes to the "HardwareAddr" field.

func (*NetworkMutation) ResetHostID

func (m *NetworkMutation) ResetHostID()

ResetHostID resets all changes to the "host_id" edge.

func (*NetworkMutation) ResetIndex

func (m *NetworkMutation) ResetIndex()

ResetIndex resets all changes to the "Index" field.

func (*NetworkMutation) ResetMTU

func (m *NetworkMutation) ResetMTU()

ResetMTU resets all changes to the "MTU" field.

func (*NetworkMutation) ResetName

func (m *NetworkMutation) ResetName()

ResetName resets all changes to the "name" field.

func (*NetworkMutation) ResetUpdatedAt

func (m *NetworkMutation) ResetUpdatedAt()

ResetUpdatedAt resets all changes to the "updated_at" field.

func (*NetworkMutation) SetAddrs

func (m *NetworkMutation) SetAddrs(s []string)

SetAddrs sets the "addrs" field.

func (*NetworkMutation) SetCreatedAt

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

SetCreatedAt sets the "created_at" field.

func (*NetworkMutation) SetField

func (m *NetworkMutation) 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 (*NetworkMutation) SetFlags

func (m *NetworkMutation) SetFlags(s []string)

SetFlags sets the "Flags" field.

func (*NetworkMutation) SetHardwareAddr

func (m *NetworkMutation) SetHardwareAddr(s string)

SetHardwareAddr sets the "HardwareAddr" field.

func (*NetworkMutation) SetHostIDID

func (m *NetworkMutation) SetHostIDID(id string)

SetHostIDID sets the "host_id" edge to the Host entity by id.

func (*NetworkMutation) SetIndex

func (m *NetworkMutation) SetIndex(i int)

SetIndex sets the "Index" field.

func (*NetworkMutation) SetMTU

func (m *NetworkMutation) SetMTU(i int)

SetMTU sets the "MTU" field.

func (*NetworkMutation) SetName

func (m *NetworkMutation) SetName(s string)

SetName sets the "name" field.

func (*NetworkMutation) SetUpdatedAt

func (m *NetworkMutation) SetUpdatedAt(t time.Time)

SetUpdatedAt sets the "updated_at" field.

func (NetworkMutation) Tx

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

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

func (*NetworkMutation) Type

func (m *NetworkMutation) Type() string

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

func (*NetworkMutation) UpdatedAt

func (m *NetworkMutation) UpdatedAt() (r time.Time, exists bool)

UpdatedAt returns the value of the "updated_at" field in the mutation.

func (*NetworkMutation) Where

func (m *NetworkMutation) Where(ps ...predicate.Network)

Where appends a list predicates to the NetworkMutation builder.

type NetworkQuery

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

NetworkQuery is the builder for querying Network entities.

func (*NetworkQuery) All

func (nq *NetworkQuery) All(ctx context.Context) ([]*Network, error)

All executes the query and returns a list of Networks.

func (*NetworkQuery) AllX

func (nq *NetworkQuery) AllX(ctx context.Context) []*Network

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

func (*NetworkQuery) Clone

func (nq *NetworkQuery) Clone() *NetworkQuery

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

func (*NetworkQuery) Count

func (nq *NetworkQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*NetworkQuery) CountX

func (nq *NetworkQuery) CountX(ctx context.Context) int

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

func (*NetworkQuery) Exist

func (nq *NetworkQuery) Exist(ctx context.Context) (bool, error)

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

func (*NetworkQuery) ExistX

func (nq *NetworkQuery) ExistX(ctx context.Context) bool

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

func (*NetworkQuery) First

func (nq *NetworkQuery) First(ctx context.Context) (*Network, error)

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

func (*NetworkQuery) FirstID

func (nq *NetworkQuery) FirstID(ctx context.Context) (id int, err error)

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

func (*NetworkQuery) FirstIDX

func (nq *NetworkQuery) FirstIDX(ctx context.Context) int

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

func (*NetworkQuery) FirstX

func (nq *NetworkQuery) FirstX(ctx context.Context) *Network

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

func (*NetworkQuery) GroupBy

func (nq *NetworkQuery) GroupBy(field string, fields ...string) *NetworkGroupBy

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

client.Network.Query().
	GroupBy(network.FieldIndex).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*NetworkQuery) IDs

func (nq *NetworkQuery) IDs(ctx context.Context) ([]int, error)

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

func (*NetworkQuery) IDsX

func (nq *NetworkQuery) IDsX(ctx context.Context) []int

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

func (*NetworkQuery) Limit

func (nq *NetworkQuery) Limit(limit int) *NetworkQuery

Limit adds a limit step to the query.

func (*NetworkQuery) Offset

func (nq *NetworkQuery) Offset(offset int) *NetworkQuery

Offset adds an offset step to the query.

func (*NetworkQuery) Only

func (nq *NetworkQuery) Only(ctx context.Context) (*Network, error)

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

func (*NetworkQuery) OnlyID

func (nq *NetworkQuery) OnlyID(ctx context.Context) (id int, err error)

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

func (*NetworkQuery) OnlyIDX

func (nq *NetworkQuery) OnlyIDX(ctx context.Context) int

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

func (*NetworkQuery) OnlyX

func (nq *NetworkQuery) OnlyX(ctx context.Context) *Network

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

func (*NetworkQuery) Order

func (nq *NetworkQuery) Order(o ...OrderFunc) *NetworkQuery

Order adds an order step to the query.

func (*NetworkQuery) QueryHostID

func (nq *NetworkQuery) QueryHostID() *HostQuery

QueryHostID chains the current query on the "host_id" edge.

func (*NetworkQuery) Select

func (nq *NetworkQuery) Select(fields ...string) *NetworkSelect

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 {
	Index int `json:"Index,omitempty"`
}

client.Network.Query().
	Select(network.FieldIndex).
	Scan(ctx, &v)

func (*NetworkQuery) Unique

func (nq *NetworkQuery) Unique(unique bool) *NetworkQuery

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

func (*NetworkQuery) Where

func (nq *NetworkQuery) Where(ps ...predicate.Network) *NetworkQuery

Where adds a new predicate for the NetworkQuery builder.

func (*NetworkQuery) WithHostID

func (nq *NetworkQuery) WithHostID(opts ...func(*HostQuery)) *NetworkQuery

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

type NetworkSelect

type NetworkSelect struct {
	*NetworkQuery
	// contains filtered or unexported fields
}

NetworkSelect is the builder for selecting fields of Network entities.

func (*NetworkSelect) Bool

func (ns *NetworkSelect) Bool(ctx context.Context) (_ bool, err error)

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

func (*NetworkSelect) BoolX

func (ns *NetworkSelect) BoolX(ctx context.Context) bool

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

func (*NetworkSelect) Bools

func (ns *NetworkSelect) Bools(ctx context.Context) ([]bool, error)

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

func (*NetworkSelect) BoolsX

func (ns *NetworkSelect) BoolsX(ctx context.Context) []bool

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

func (*NetworkSelect) Float64

func (ns *NetworkSelect) Float64(ctx context.Context) (_ float64, err error)

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

func (*NetworkSelect) Float64X

func (ns *NetworkSelect) Float64X(ctx context.Context) float64

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

func (*NetworkSelect) Float64s

func (ns *NetworkSelect) Float64s(ctx context.Context) ([]float64, error)

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

func (*NetworkSelect) Float64sX

func (ns *NetworkSelect) Float64sX(ctx context.Context) []float64

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

func (*NetworkSelect) Int

func (ns *NetworkSelect) Int(ctx context.Context) (_ int, err error)

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

func (*NetworkSelect) IntX

func (ns *NetworkSelect) IntX(ctx context.Context) int

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

func (*NetworkSelect) Ints

func (ns *NetworkSelect) Ints(ctx context.Context) ([]int, error)

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

func (*NetworkSelect) IntsX

func (ns *NetworkSelect) IntsX(ctx context.Context) []int

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

func (*NetworkSelect) Scan

func (ns *NetworkSelect) Scan(ctx context.Context, v interface{}) error

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

func (*NetworkSelect) ScanX

func (ns *NetworkSelect) ScanX(ctx context.Context, v interface{})

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

func (*NetworkSelect) String

func (ns *NetworkSelect) String(ctx context.Context) (_ string, err error)

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

func (*NetworkSelect) StringX

func (ns *NetworkSelect) StringX(ctx context.Context) string

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

func (*NetworkSelect) Strings

func (ns *NetworkSelect) Strings(ctx context.Context) ([]string, error)

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

func (*NetworkSelect) StringsX

func (ns *NetworkSelect) StringsX(ctx context.Context) []string

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

type NetworkUpdate

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

NetworkUpdate is the builder for updating Network entities.

func (*NetworkUpdate) AddIndex

func (nu *NetworkUpdate) AddIndex(i int) *NetworkUpdate

AddIndex adds i to the "Index" field.

func (*NetworkUpdate) AddMTU

func (nu *NetworkUpdate) AddMTU(i int) *NetworkUpdate

AddMTU adds i to the "MTU" field.

func (*NetworkUpdate) ClearAddrs

func (nu *NetworkUpdate) ClearAddrs() *NetworkUpdate

ClearAddrs clears the value of the "addrs" field.

func (*NetworkUpdate) ClearFlags

func (nu *NetworkUpdate) ClearFlags() *NetworkUpdate

ClearFlags clears the value of the "Flags" field.

func (*NetworkUpdate) ClearHostID

func (nu *NetworkUpdate) ClearHostID() *NetworkUpdate

ClearHostID clears the "host_id" edge to the Host entity.

func (*NetworkUpdate) Exec

func (nu *NetworkUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*NetworkUpdate) ExecX

func (nu *NetworkUpdate) ExecX(ctx context.Context)

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

func (*NetworkUpdate) Mutation

func (nu *NetworkUpdate) Mutation() *NetworkMutation

Mutation returns the NetworkMutation object of the builder.

func (*NetworkUpdate) Save

func (nu *NetworkUpdate) Save(ctx context.Context) (int, error)

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

func (*NetworkUpdate) SaveX

func (nu *NetworkUpdate) SaveX(ctx context.Context) int

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

func (*NetworkUpdate) SetAddrs

func (nu *NetworkUpdate) SetAddrs(s []string) *NetworkUpdate

SetAddrs sets the "addrs" field.

func (*NetworkUpdate) SetCreatedAt

func (nu *NetworkUpdate) SetCreatedAt(t time.Time) *NetworkUpdate

SetCreatedAt sets the "created_at" field.

func (*NetworkUpdate) SetFlags

func (nu *NetworkUpdate) SetFlags(s []string) *NetworkUpdate

SetFlags sets the "Flags" field.

func (*NetworkUpdate) SetHardwareAddr

func (nu *NetworkUpdate) SetHardwareAddr(s string) *NetworkUpdate

SetHardwareAddr sets the "HardwareAddr" field.

func (*NetworkUpdate) SetHostID

func (nu *NetworkUpdate) SetHostID(h *Host) *NetworkUpdate

SetHostID sets the "host_id" edge to the Host entity.

func (*NetworkUpdate) SetHostIDID

func (nu *NetworkUpdate) SetHostIDID(id string) *NetworkUpdate

SetHostIDID sets the "host_id" edge to the Host entity by ID.

func (*NetworkUpdate) SetIndex

func (nu *NetworkUpdate) SetIndex(i int) *NetworkUpdate

SetIndex sets the "Index" field.

func (*NetworkUpdate) SetMTU

func (nu *NetworkUpdate) SetMTU(i int) *NetworkUpdate

SetMTU sets the "MTU" field.

func (*NetworkUpdate) SetName

func (nu *NetworkUpdate) SetName(s string) *NetworkUpdate

SetName sets the "name" field.

func (*NetworkUpdate) SetNillableCreatedAt

func (nu *NetworkUpdate) SetNillableCreatedAt(t *time.Time) *NetworkUpdate

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

func (*NetworkUpdate) SetNillableUpdatedAt

func (nu *NetworkUpdate) SetNillableUpdatedAt(t *time.Time) *NetworkUpdate

SetNillableUpdatedAt sets the "updated_at" field if the given value is not nil.

func (*NetworkUpdate) SetUpdatedAt

func (nu *NetworkUpdate) SetUpdatedAt(t time.Time) *NetworkUpdate

SetUpdatedAt sets the "updated_at" field.

func (*NetworkUpdate) Where

func (nu *NetworkUpdate) Where(ps ...predicate.Network) *NetworkUpdate

Where appends a list predicates to the NetworkUpdate builder.

type NetworkUpdateOne

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

NetworkUpdateOne is the builder for updating a single Network entity.

func (*NetworkUpdateOne) AddIndex

func (nuo *NetworkUpdateOne) AddIndex(i int) *NetworkUpdateOne

AddIndex adds i to the "Index" field.

func (*NetworkUpdateOne) AddMTU

func (nuo *NetworkUpdateOne) AddMTU(i int) *NetworkUpdateOne

AddMTU adds i to the "MTU" field.

func (*NetworkUpdateOne) ClearAddrs

func (nuo *NetworkUpdateOne) ClearAddrs() *NetworkUpdateOne

ClearAddrs clears the value of the "addrs" field.

func (*NetworkUpdateOne) ClearFlags

func (nuo *NetworkUpdateOne) ClearFlags() *NetworkUpdateOne

ClearFlags clears the value of the "Flags" field.

func (*NetworkUpdateOne) ClearHostID

func (nuo *NetworkUpdateOne) ClearHostID() *NetworkUpdateOne

ClearHostID clears the "host_id" edge to the Host entity.

func (*NetworkUpdateOne) Exec

func (nuo *NetworkUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*NetworkUpdateOne) ExecX

func (nuo *NetworkUpdateOne) ExecX(ctx context.Context)

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

func (*NetworkUpdateOne) Mutation

func (nuo *NetworkUpdateOne) Mutation() *NetworkMutation

Mutation returns the NetworkMutation object of the builder.

func (*NetworkUpdateOne) Save

func (nuo *NetworkUpdateOne) Save(ctx context.Context) (*Network, error)

Save executes the query and returns the updated Network entity.

func (*NetworkUpdateOne) SaveX

func (nuo *NetworkUpdateOne) SaveX(ctx context.Context) *Network

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

func (*NetworkUpdateOne) Select

func (nuo *NetworkUpdateOne) Select(field string, fields ...string) *NetworkUpdateOne

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

func (*NetworkUpdateOne) SetAddrs

func (nuo *NetworkUpdateOne) SetAddrs(s []string) *NetworkUpdateOne

SetAddrs sets the "addrs" field.

func (*NetworkUpdateOne) SetCreatedAt

func (nuo *NetworkUpdateOne) SetCreatedAt(t time.Time) *NetworkUpdateOne

SetCreatedAt sets the "created_at" field.

func (*NetworkUpdateOne) SetFlags

func (nuo *NetworkUpdateOne) SetFlags(s []string) *NetworkUpdateOne

SetFlags sets the "Flags" field.

func (*NetworkUpdateOne) SetHardwareAddr

func (nuo *NetworkUpdateOne) SetHardwareAddr(s string) *NetworkUpdateOne

SetHardwareAddr sets the "HardwareAddr" field.

func (*NetworkUpdateOne) SetHostID

func (nuo *NetworkUpdateOne) SetHostID(h *Host) *NetworkUpdateOne

SetHostID sets the "host_id" edge to the Host entity.

func (*NetworkUpdateOne) SetHostIDID

func (nuo *NetworkUpdateOne) SetHostIDID(id string) *NetworkUpdateOne

SetHostIDID sets the "host_id" edge to the Host entity by ID.

func (*NetworkUpdateOne) SetIndex

func (nuo *NetworkUpdateOne) SetIndex(i int) *NetworkUpdateOne

SetIndex sets the "Index" field.

func (*NetworkUpdateOne) SetMTU

func (nuo *NetworkUpdateOne) SetMTU(i int) *NetworkUpdateOne

SetMTU sets the "MTU" field.

func (*NetworkUpdateOne) SetName

func (nuo *NetworkUpdateOne) SetName(s string) *NetworkUpdateOne

SetName sets the "name" field.

func (*NetworkUpdateOne) SetNillableCreatedAt

func (nuo *NetworkUpdateOne) SetNillableCreatedAt(t *time.Time) *NetworkUpdateOne

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

func (*NetworkUpdateOne) SetNillableUpdatedAt

func (nuo *NetworkUpdateOne) SetNillableUpdatedAt(t *time.Time) *NetworkUpdateOne

SetNillableUpdatedAt sets the "updated_at" field if the given value is not nil.

func (*NetworkUpdateOne) SetUpdatedAt

func (nuo *NetworkUpdateOne) SetUpdatedAt(t time.Time) *NetworkUpdateOne

SetUpdatedAt sets the "updated_at" field.

type Networks

type Networks []*Network

Networks is a parsable slice of Network.

type NotFoundError

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

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

func (*NotFoundError) Error

func (e *NotFoundError) Error() string

Error implements the error interface.

type NotLoadedError

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

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

func (*NotLoadedError) Error

func (e *NotLoadedError) Error() string

Error implements the error interface.

type NotSingularError

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

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

func (*NotSingularError) Error

func (e *NotSingularError) Error() string

Error implements the error interface.

type Op

type Op = ent.Op

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

type Option

type Option func(*config)

Option function to configure the client.

func Debug

func Debug() Option

Debug enables debug logging on the ent.Driver.

func Driver

func Driver(driver dialect.Driver) Option

Driver configures the client driver.

func Log

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

Log sets the logging function for debug mode.

type OrderFunc

type OrderFunc func(*sql.Selector)

OrderFunc applies an ordering on the sql selector.

func Asc

func Asc(fields ...string) OrderFunc

Asc applies the given fields in ASC order.

func Desc

func Desc(fields ...string) OrderFunc

Desc applies the given fields in DESC order.

type Policy

type Policy = ent.Policy

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

type Query

type Query = ent.Query

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

type RollbackFunc

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

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

func (RollbackFunc) Rollback

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

Rollback calls f(ctx, m).

type RollbackHook

type RollbackHook func(Rollbacker) Rollbacker

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

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

type Rollbacker

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

Rollbacker is the interface that wraps the Rollback method.

type Tx

type Tx struct {

	// Cpu is the client for interacting with the Cpu builders.
	Cpu *CpuClient
	// Disk is the client for interacting with the Disk builders.
	Disk *DiskClient
	// Host is the client for interacting with the Host builders.
	Host *HostClient
	// Netstat is the client for interacting with the Netstat builders.
	Netstat *NetstatClient
	// Network is the client for interacting with the Network builders.
	Network *NetworkClient
	// contains filtered or unexported fields
}

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

func TxFromContext

func TxFromContext(ctx context.Context) *Tx

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

func (*Tx) Client

func (tx *Tx) Client() *Client

Client returns a Client that binds to current transaction.

func (*Tx) Commit

func (tx *Tx) Commit() error

Commit commits the transaction.

func (*Tx) OnCommit

func (tx *Tx) OnCommit(f CommitHook)

OnCommit adds a hook to call on commit.

func (*Tx) OnRollback

func (tx *Tx) OnRollback(f RollbackHook)

OnRollback adds a hook to call on rollback.

func (*Tx) Rollback

func (tx *Tx) Rollback() error

Rollback rollbacks the transaction.

type ValidationError

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

ValidationError returns when validating a field or edge fails.

func (*ValidationError) Error

func (e *ValidationError) Error() string

Error implements the error interface.

func (*ValidationError) Unwrap

func (e *ValidationError) Unwrap() error

Unwrap implements the errors.Wrapper interface.

type Value

type Value = ent.Value

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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