ent

package
v0.0.0-...-23bdc36 Latest Latest
Warning

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

Go to latest
Published: Mar 17, 2024 License: MIT Imports: 18 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.
	TypeDbInstance = "DbInstance"
)

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 Client

type Client struct {

	// Schema is the client for creating, migrating and dropping schema.
	Schema *migrate.Schema
	// DbInstance is the client for interacting with the DbInstance builders.
	DbInstance *DbInstanceClient
	// 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().
	DbInstance.
	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 DbInstance

type DbInstance struct {

	// ID of the ent.
	ID int `json:"id,omitempty"`
	// CreateTime holds the value of the "create_time" field.
	CreateTime time.Time `json:"create_time,omitempty"`
	// UpdateTime holds the value of the "update_time" field.
	UpdateTime time.Time `json:"update_time,omitempty"`
	// 实例id
	InstanceID string `json:"instance_id,omitempty"`
	// 实例名
	InstanceName string `json:"instance_name,omitempty"`
	// 实例连接地址
	Host string `json:"host,omitempty"`
	// 环境
	Env string `json:"env,omitempty"`
	// 实例类型
	InstanceType string `json:"instance_type,omitempty"`
	// 引擎类型
	Engine string `json:"engine,omitempty"`
	// 版本
	EngineVersion string `json:"engine_version,omitempty"`
	// 配置规格
	Specification string `json:"specification,omitempty"`
	// 实例状态
	InstanceStatus string `json:"instance_status,omitempty"`
	// 实例创建时间
	InstanceCreateTime string `json:"instance_create_time,omitempty"`
	// 实例注释; kv json
	Annotations map[string]string `json:"annotations,omitempty"`
	// 实例标签; kv json
	Labels map[string]string `json:"labels,omitempty"`
	// contains filtered or unexported fields
}

DbInstance is the model entity for the DbInstance schema.

func (*DbInstance) String

func (di *DbInstance) String() string

String implements the fmt.Stringer.

func (*DbInstance) Unwrap

func (di *DbInstance) Unwrap() *DbInstance

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

func (di *DbInstance) Update() *DbInstanceUpdateOne

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

type DbInstanceClient

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

DbInstanceClient is a client for the DbInstance schema.

func NewDbInstanceClient

func NewDbInstanceClient(c config) *DbInstanceClient

NewDbInstanceClient returns a client for the DbInstance from the given config.

func (*DbInstanceClient) Create

func (c *DbInstanceClient) Create() *DbInstanceCreate

Create returns a builder for creating a DbInstance entity.

func (*DbInstanceClient) CreateBulk

func (c *DbInstanceClient) CreateBulk(builders ...*DbInstanceCreate) *DbInstanceCreateBulk

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

func (*DbInstanceClient) Delete

func (c *DbInstanceClient) Delete() *DbInstanceDelete

Delete returns a delete builder for DbInstance.

func (*DbInstanceClient) DeleteOne

func (c *DbInstanceClient) DeleteOne(di *DbInstance) *DbInstanceDeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*DbInstanceClient) DeleteOneID

func (c *DbInstanceClient) DeleteOneID(id int) *DbInstanceDeleteOne

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

func (*DbInstanceClient) Get

func (c *DbInstanceClient) Get(ctx context.Context, id int) (*DbInstance, error)

Get returns a DbInstance entity by its id.

func (*DbInstanceClient) GetX

func (c *DbInstanceClient) GetX(ctx context.Context, id int) *DbInstance

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

func (*DbInstanceClient) Hooks

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

Hooks returns the client hooks.

func (*DbInstanceClient) Query

func (c *DbInstanceClient) Query() *DbInstanceQuery

Query returns a query builder for DbInstance.

func (*DbInstanceClient) Update

func (c *DbInstanceClient) Update() *DbInstanceUpdate

Update returns an update builder for DbInstance.

func (*DbInstanceClient) UpdateOne

func (c *DbInstanceClient) UpdateOne(di *DbInstance) *DbInstanceUpdateOne

UpdateOne returns an update builder for the given entity.

func (*DbInstanceClient) UpdateOneID

func (c *DbInstanceClient) UpdateOneID(id int) *DbInstanceUpdateOne

UpdateOneID returns an update builder for the given id.

func (*DbInstanceClient) Use

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

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

type DbInstanceCreate

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

DbInstanceCreate is the builder for creating a DbInstance entity.

func (*DbInstanceCreate) Exec

func (dic *DbInstanceCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*DbInstanceCreate) ExecX

func (dic *DbInstanceCreate) ExecX(ctx context.Context)

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

func (*DbInstanceCreate) Mutation

func (dic *DbInstanceCreate) Mutation() *DbInstanceMutation

Mutation returns the DbInstanceMutation object of the builder.

func (*DbInstanceCreate) Save

func (dic *DbInstanceCreate) Save(ctx context.Context) (*DbInstance, error)

Save creates the DbInstance in the database.

func (*DbInstanceCreate) SaveX

func (dic *DbInstanceCreate) SaveX(ctx context.Context) *DbInstance

SaveX calls Save and panics if Save returns an error.

func (*DbInstanceCreate) SetAnnotations

func (dic *DbInstanceCreate) SetAnnotations(m map[string]string) *DbInstanceCreate

SetAnnotations sets the "annotations" field.

func (*DbInstanceCreate) SetCreateTime

func (dic *DbInstanceCreate) SetCreateTime(t time.Time) *DbInstanceCreate

SetCreateTime sets the "create_time" field.

func (*DbInstanceCreate) SetEngine

func (dic *DbInstanceCreate) SetEngine(s string) *DbInstanceCreate

SetEngine sets the "engine" field.

func (*DbInstanceCreate) SetEngineVersion

func (dic *DbInstanceCreate) SetEngineVersion(s string) *DbInstanceCreate

SetEngineVersion sets the "engine_version" field.

func (*DbInstanceCreate) SetEnv

func (dic *DbInstanceCreate) SetEnv(s string) *DbInstanceCreate

SetEnv sets the "env" field.

func (*DbInstanceCreate) SetHost

func (dic *DbInstanceCreate) SetHost(s string) *DbInstanceCreate

SetHost sets the "host" field.

func (*DbInstanceCreate) SetInstanceCreateTime

func (dic *DbInstanceCreate) SetInstanceCreateTime(s string) *DbInstanceCreate

SetInstanceCreateTime sets the "instance_create_time" field.

func (*DbInstanceCreate) SetInstanceID

func (dic *DbInstanceCreate) SetInstanceID(s string) *DbInstanceCreate

SetInstanceID sets the "instance_id" field.

func (*DbInstanceCreate) SetInstanceName

func (dic *DbInstanceCreate) SetInstanceName(s string) *DbInstanceCreate

SetInstanceName sets the "instance_name" field.

func (*DbInstanceCreate) SetInstanceStatus

func (dic *DbInstanceCreate) SetInstanceStatus(s string) *DbInstanceCreate

SetInstanceStatus sets the "instance_status" field.

func (*DbInstanceCreate) SetInstanceType

func (dic *DbInstanceCreate) SetInstanceType(s string) *DbInstanceCreate

SetInstanceType sets the "instance_type" field.

func (*DbInstanceCreate) SetLabels

func (dic *DbInstanceCreate) SetLabels(m map[string]string) *DbInstanceCreate

SetLabels sets the "labels" field.

func (*DbInstanceCreate) SetNillableCreateTime

func (dic *DbInstanceCreate) SetNillableCreateTime(t *time.Time) *DbInstanceCreate

SetNillableCreateTime sets the "create_time" field if the given value is not nil.

func (*DbInstanceCreate) SetNillableEngine

func (dic *DbInstanceCreate) SetNillableEngine(s *string) *DbInstanceCreate

SetNillableEngine sets the "engine" field if the given value is not nil.

func (*DbInstanceCreate) SetNillableEngineVersion

func (dic *DbInstanceCreate) SetNillableEngineVersion(s *string) *DbInstanceCreate

SetNillableEngineVersion sets the "engine_version" field if the given value is not nil.

func (*DbInstanceCreate) SetNillableHost

func (dic *DbInstanceCreate) SetNillableHost(s *string) *DbInstanceCreate

SetNillableHost sets the "host" field if the given value is not nil.

func (*DbInstanceCreate) SetNillableInstanceName

func (dic *DbInstanceCreate) SetNillableInstanceName(s *string) *DbInstanceCreate

SetNillableInstanceName sets the "instance_name" field if the given value is not nil.

func (*DbInstanceCreate) SetNillableInstanceStatus

func (dic *DbInstanceCreate) SetNillableInstanceStatus(s *string) *DbInstanceCreate

SetNillableInstanceStatus sets the "instance_status" field if the given value is not nil.

func (*DbInstanceCreate) SetNillableInstanceType

func (dic *DbInstanceCreate) SetNillableInstanceType(s *string) *DbInstanceCreate

SetNillableInstanceType sets the "instance_type" field if the given value is not nil.

func (*DbInstanceCreate) SetNillableSpecification

func (dic *DbInstanceCreate) SetNillableSpecification(s *string) *DbInstanceCreate

SetNillableSpecification sets the "specification" field if the given value is not nil.

func (*DbInstanceCreate) SetNillableUpdateTime

func (dic *DbInstanceCreate) SetNillableUpdateTime(t *time.Time) *DbInstanceCreate

SetNillableUpdateTime sets the "update_time" field if the given value is not nil.

func (*DbInstanceCreate) SetSpecification

func (dic *DbInstanceCreate) SetSpecification(s string) *DbInstanceCreate

SetSpecification sets the "specification" field.

func (*DbInstanceCreate) SetUpdateTime

func (dic *DbInstanceCreate) SetUpdateTime(t time.Time) *DbInstanceCreate

SetUpdateTime sets the "update_time" field.

type DbInstanceCreateBulk

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

DbInstanceCreateBulk is the builder for creating many DbInstance entities in bulk.

func (*DbInstanceCreateBulk) Exec

func (dicb *DbInstanceCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*DbInstanceCreateBulk) ExecX

func (dicb *DbInstanceCreateBulk) ExecX(ctx context.Context)

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

func (*DbInstanceCreateBulk) Save

func (dicb *DbInstanceCreateBulk) Save(ctx context.Context) ([]*DbInstance, error)

Save creates the DbInstance entities in the database.

func (*DbInstanceCreateBulk) SaveX

func (dicb *DbInstanceCreateBulk) SaveX(ctx context.Context) []*DbInstance

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

type DbInstanceDelete

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

DbInstanceDelete is the builder for deleting a DbInstance entity.

func (*DbInstanceDelete) Exec

func (did *DbInstanceDelete) Exec(ctx context.Context) (int, error)

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

func (*DbInstanceDelete) ExecX

func (did *DbInstanceDelete) ExecX(ctx context.Context) int

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

func (*DbInstanceDelete) Where

Where appends a list predicates to the DbInstanceDelete builder.

type DbInstanceDeleteOne

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

DbInstanceDeleteOne is the builder for deleting a single DbInstance entity.

func (*DbInstanceDeleteOne) Exec

func (dido *DbInstanceDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*DbInstanceDeleteOne) ExecX

func (dido *DbInstanceDeleteOne) ExecX(ctx context.Context)

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

type DbInstanceGroupBy

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

DbInstanceGroupBy is the group-by builder for DbInstance entities.

func (*DbInstanceGroupBy) Aggregate

func (digb *DbInstanceGroupBy) Aggregate(fns ...AggregateFunc) *DbInstanceGroupBy

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

func (*DbInstanceGroupBy) Bool

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

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

func (*DbInstanceGroupBy) BoolX

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

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

func (*DbInstanceGroupBy) Bools

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

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

func (*DbInstanceGroupBy) BoolsX

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

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

func (*DbInstanceGroupBy) Float64

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

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

func (*DbInstanceGroupBy) Float64X

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

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

func (*DbInstanceGroupBy) Float64s

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

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

func (*DbInstanceGroupBy) Float64sX

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

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

func (*DbInstanceGroupBy) Int

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

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

func (*DbInstanceGroupBy) IntX

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

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

func (*DbInstanceGroupBy) Ints

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

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

func (*DbInstanceGroupBy) IntsX

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

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

func (*DbInstanceGroupBy) Scan

func (digb *DbInstanceGroupBy) Scan(ctx context.Context, v any) error

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

func (*DbInstanceGroupBy) ScanX

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

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

func (*DbInstanceGroupBy) String

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

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

func (*DbInstanceGroupBy) StringX

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

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

func (*DbInstanceGroupBy) Strings

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

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

func (*DbInstanceGroupBy) StringsX

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

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

type DbInstanceMutation

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

DbInstanceMutation represents an operation that mutates the DbInstance nodes in the graph.

func (*DbInstanceMutation) AddField

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

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

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

func (*DbInstanceMutation) AddedField

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

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

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

func (*DbInstanceMutation) AddedIDs

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

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

func (*DbInstanceMutation) Annotations

func (m *DbInstanceMutation) Annotations() (r map[string]string, exists bool)

Annotations returns the value of the "annotations" field in the mutation.

func (*DbInstanceMutation) AnnotationsCleared

func (m *DbInstanceMutation) AnnotationsCleared() bool

AnnotationsCleared returns if the "annotations" field was cleared in this mutation.

func (*DbInstanceMutation) ClearAnnotations

func (m *DbInstanceMutation) ClearAnnotations()

ClearAnnotations clears the value of the "annotations" field.

func (*DbInstanceMutation) ClearEdge

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

func (m *DbInstanceMutation) 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 (*DbInstanceMutation) ClearLabels

func (m *DbInstanceMutation) ClearLabels()

ClearLabels clears the value of the "labels" field.

func (*DbInstanceMutation) ClearedEdges

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

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

func (*DbInstanceMutation) ClearedFields

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

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

func (DbInstanceMutation) Client

func (m DbInstanceMutation) 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 (*DbInstanceMutation) CreateTime

func (m *DbInstanceMutation) CreateTime() (r time.Time, exists bool)

CreateTime returns the value of the "create_time" field in the mutation.

func (*DbInstanceMutation) EdgeCleared

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

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

func (*DbInstanceMutation) Engine

func (m *DbInstanceMutation) Engine() (r string, exists bool)

Engine returns the value of the "engine" field in the mutation.

func (*DbInstanceMutation) EngineVersion

func (m *DbInstanceMutation) EngineVersion() (r string, exists bool)

EngineVersion returns the value of the "engine_version" field in the mutation.

func (*DbInstanceMutation) Env

func (m *DbInstanceMutation) Env() (r string, exists bool)

Env returns the value of the "env" field in the mutation.

func (*DbInstanceMutation) Field

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

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

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

func (*DbInstanceMutation) Fields

func (m *DbInstanceMutation) 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 (*DbInstanceMutation) Host

func (m *DbInstanceMutation) Host() (r string, exists bool)

Host returns the value of the "host" field in the mutation.

func (*DbInstanceMutation) ID

func (m *DbInstanceMutation) 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 (*DbInstanceMutation) IDs

func (m *DbInstanceMutation) 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 (*DbInstanceMutation) InstanceCreateTime

func (m *DbInstanceMutation) InstanceCreateTime() (r string, exists bool)

InstanceCreateTime returns the value of the "instance_create_time" field in the mutation.

func (*DbInstanceMutation) InstanceID

func (m *DbInstanceMutation) InstanceID() (r string, exists bool)

InstanceID returns the value of the "instance_id" field in the mutation.

func (*DbInstanceMutation) InstanceName

func (m *DbInstanceMutation) InstanceName() (r string, exists bool)

InstanceName returns the value of the "instance_name" field in the mutation.

func (*DbInstanceMutation) InstanceStatus

func (m *DbInstanceMutation) InstanceStatus() (r string, exists bool)

InstanceStatus returns the value of the "instance_status" field in the mutation.

func (*DbInstanceMutation) InstanceType

func (m *DbInstanceMutation) InstanceType() (r string, exists bool)

InstanceType returns the value of the "instance_type" field in the mutation.

func (*DbInstanceMutation) Labels

func (m *DbInstanceMutation) Labels() (r map[string]string, exists bool)

Labels returns the value of the "labels" field in the mutation.

func (*DbInstanceMutation) LabelsCleared

func (m *DbInstanceMutation) LabelsCleared() bool

LabelsCleared returns if the "labels" field was cleared in this mutation.

func (*DbInstanceMutation) OldAnnotations

func (m *DbInstanceMutation) OldAnnotations(ctx context.Context) (v map[string]string, err error)

OldAnnotations returns the old "annotations" field's value of the DbInstance entity. If the DbInstance 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 (*DbInstanceMutation) OldCreateTime

func (m *DbInstanceMutation) OldCreateTime(ctx context.Context) (v time.Time, err error)

OldCreateTime returns the old "create_time" field's value of the DbInstance entity. If the DbInstance 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 (*DbInstanceMutation) OldEngine

func (m *DbInstanceMutation) OldEngine(ctx context.Context) (v string, err error)

OldEngine returns the old "engine" field's value of the DbInstance entity. If the DbInstance 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 (*DbInstanceMutation) OldEngineVersion

func (m *DbInstanceMutation) OldEngineVersion(ctx context.Context) (v string, err error)

OldEngineVersion returns the old "engine_version" field's value of the DbInstance entity. If the DbInstance 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 (*DbInstanceMutation) OldEnv

func (m *DbInstanceMutation) OldEnv(ctx context.Context) (v string, err error)

OldEnv returns the old "env" field's value of the DbInstance entity. If the DbInstance 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 (*DbInstanceMutation) OldField

func (m *DbInstanceMutation) 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 (*DbInstanceMutation) OldHost

func (m *DbInstanceMutation) OldHost(ctx context.Context) (v string, err error)

OldHost returns the old "host" field's value of the DbInstance entity. If the DbInstance 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 (*DbInstanceMutation) OldInstanceCreateTime

func (m *DbInstanceMutation) OldInstanceCreateTime(ctx context.Context) (v string, err error)

OldInstanceCreateTime returns the old "instance_create_time" field's value of the DbInstance entity. If the DbInstance 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 (*DbInstanceMutation) OldInstanceID

func (m *DbInstanceMutation) OldInstanceID(ctx context.Context) (v string, err error)

OldInstanceID returns the old "instance_id" field's value of the DbInstance entity. If the DbInstance 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 (*DbInstanceMutation) OldInstanceName

func (m *DbInstanceMutation) OldInstanceName(ctx context.Context) (v string, err error)

OldInstanceName returns the old "instance_name" field's value of the DbInstance entity. If the DbInstance 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 (*DbInstanceMutation) OldInstanceStatus

func (m *DbInstanceMutation) OldInstanceStatus(ctx context.Context) (v string, err error)

OldInstanceStatus returns the old "instance_status" field's value of the DbInstance entity. If the DbInstance 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 (*DbInstanceMutation) OldInstanceType

func (m *DbInstanceMutation) OldInstanceType(ctx context.Context) (v string, err error)

OldInstanceType returns the old "instance_type" field's value of the DbInstance entity. If the DbInstance 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 (*DbInstanceMutation) OldLabels

func (m *DbInstanceMutation) OldLabels(ctx context.Context) (v map[string]string, err error)

OldLabels returns the old "labels" field's value of the DbInstance entity. If the DbInstance 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 (*DbInstanceMutation) OldSpecification

func (m *DbInstanceMutation) OldSpecification(ctx context.Context) (v string, err error)

OldSpecification returns the old "specification" field's value of the DbInstance entity. If the DbInstance 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 (*DbInstanceMutation) OldUpdateTime

func (m *DbInstanceMutation) OldUpdateTime(ctx context.Context) (v time.Time, err error)

OldUpdateTime returns the old "update_time" field's value of the DbInstance entity. If the DbInstance 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 (*DbInstanceMutation) Op

func (m *DbInstanceMutation) Op() Op

Op returns the operation name.

func (*DbInstanceMutation) RemovedEdges

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

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

func (*DbInstanceMutation) RemovedIDs

func (m *DbInstanceMutation) 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 (*DbInstanceMutation) ResetAnnotations

func (m *DbInstanceMutation) ResetAnnotations()

ResetAnnotations resets all changes to the "annotations" field.

func (*DbInstanceMutation) ResetCreateTime

func (m *DbInstanceMutation) ResetCreateTime()

ResetCreateTime resets all changes to the "create_time" field.

func (*DbInstanceMutation) ResetEdge

func (m *DbInstanceMutation) 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 (*DbInstanceMutation) ResetEngine

func (m *DbInstanceMutation) ResetEngine()

ResetEngine resets all changes to the "engine" field.

func (*DbInstanceMutation) ResetEngineVersion

func (m *DbInstanceMutation) ResetEngineVersion()

ResetEngineVersion resets all changes to the "engine_version" field.

func (*DbInstanceMutation) ResetEnv

func (m *DbInstanceMutation) ResetEnv()

ResetEnv resets all changes to the "env" field.

func (*DbInstanceMutation) ResetField

func (m *DbInstanceMutation) 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 (*DbInstanceMutation) ResetHost

func (m *DbInstanceMutation) ResetHost()

ResetHost resets all changes to the "host" field.

func (*DbInstanceMutation) ResetInstanceCreateTime

func (m *DbInstanceMutation) ResetInstanceCreateTime()

ResetInstanceCreateTime resets all changes to the "instance_create_time" field.

func (*DbInstanceMutation) ResetInstanceID

func (m *DbInstanceMutation) ResetInstanceID()

ResetInstanceID resets all changes to the "instance_id" field.

func (*DbInstanceMutation) ResetInstanceName

func (m *DbInstanceMutation) ResetInstanceName()

ResetInstanceName resets all changes to the "instance_name" field.

func (*DbInstanceMutation) ResetInstanceStatus

func (m *DbInstanceMutation) ResetInstanceStatus()

ResetInstanceStatus resets all changes to the "instance_status" field.

func (*DbInstanceMutation) ResetInstanceType

func (m *DbInstanceMutation) ResetInstanceType()

ResetInstanceType resets all changes to the "instance_type" field.

func (*DbInstanceMutation) ResetLabels

func (m *DbInstanceMutation) ResetLabels()

ResetLabels resets all changes to the "labels" field.

func (*DbInstanceMutation) ResetSpecification

func (m *DbInstanceMutation) ResetSpecification()

ResetSpecification resets all changes to the "specification" field.

func (*DbInstanceMutation) ResetUpdateTime

func (m *DbInstanceMutation) ResetUpdateTime()

ResetUpdateTime resets all changes to the "update_time" field.

func (*DbInstanceMutation) SetAnnotations

func (m *DbInstanceMutation) SetAnnotations(value map[string]string)

SetAnnotations sets the "annotations" field.

func (*DbInstanceMutation) SetCreateTime

func (m *DbInstanceMutation) SetCreateTime(t time.Time)

SetCreateTime sets the "create_time" field.

func (*DbInstanceMutation) SetEngine

func (m *DbInstanceMutation) SetEngine(s string)

SetEngine sets the "engine" field.

func (*DbInstanceMutation) SetEngineVersion

func (m *DbInstanceMutation) SetEngineVersion(s string)

SetEngineVersion sets the "engine_version" field.

func (*DbInstanceMutation) SetEnv

func (m *DbInstanceMutation) SetEnv(s string)

SetEnv sets the "env" field.

func (*DbInstanceMutation) SetField

func (m *DbInstanceMutation) 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 (*DbInstanceMutation) SetHost

func (m *DbInstanceMutation) SetHost(s string)

SetHost sets the "host" field.

func (*DbInstanceMutation) SetInstanceCreateTime

func (m *DbInstanceMutation) SetInstanceCreateTime(s string)

SetInstanceCreateTime sets the "instance_create_time" field.

func (*DbInstanceMutation) SetInstanceID

func (m *DbInstanceMutation) SetInstanceID(s string)

SetInstanceID sets the "instance_id" field.

func (*DbInstanceMutation) SetInstanceName

func (m *DbInstanceMutation) SetInstanceName(s string)

SetInstanceName sets the "instance_name" field.

func (*DbInstanceMutation) SetInstanceStatus

func (m *DbInstanceMutation) SetInstanceStatus(s string)

SetInstanceStatus sets the "instance_status" field.

func (*DbInstanceMutation) SetInstanceType

func (m *DbInstanceMutation) SetInstanceType(s string)

SetInstanceType sets the "instance_type" field.

func (*DbInstanceMutation) SetLabels

func (m *DbInstanceMutation) SetLabels(value map[string]string)

SetLabels sets the "labels" field.

func (*DbInstanceMutation) SetSpecification

func (m *DbInstanceMutation) SetSpecification(s string)

SetSpecification sets the "specification" field.

func (*DbInstanceMutation) SetUpdateTime

func (m *DbInstanceMutation) SetUpdateTime(t time.Time)

SetUpdateTime sets the "update_time" field.

func (*DbInstanceMutation) Specification

func (m *DbInstanceMutation) Specification() (r string, exists bool)

Specification returns the value of the "specification" field in the mutation.

func (DbInstanceMutation) Tx

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

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

func (*DbInstanceMutation) Type

func (m *DbInstanceMutation) Type() string

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

func (*DbInstanceMutation) UpdateTime

func (m *DbInstanceMutation) UpdateTime() (r time.Time, exists bool)

UpdateTime returns the value of the "update_time" field in the mutation.

func (*DbInstanceMutation) Where

func (m *DbInstanceMutation) Where(ps ...predicate.DbInstance)

Where appends a list predicates to the DbInstanceMutation builder.

type DbInstanceQuery

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

DbInstanceQuery is the builder for querying DbInstance entities.

func (*DbInstanceQuery) Aggregate

func (diq *DbInstanceQuery) Aggregate(fns ...AggregateFunc) *DbInstanceSelect

Aggregate returns a DbInstanceSelect configured with the given aggregations.

func (*DbInstanceQuery) All

func (diq *DbInstanceQuery) All(ctx context.Context) ([]*DbInstance, error)

All executes the query and returns a list of DbInstances.

func (*DbInstanceQuery) AllX

func (diq *DbInstanceQuery) AllX(ctx context.Context) []*DbInstance

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

func (*DbInstanceQuery) Clone

func (diq *DbInstanceQuery) Clone() *DbInstanceQuery

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

func (*DbInstanceQuery) Count

func (diq *DbInstanceQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*DbInstanceQuery) CountX

func (diq *DbInstanceQuery) CountX(ctx context.Context) int

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

func (*DbInstanceQuery) Exist

func (diq *DbInstanceQuery) Exist(ctx context.Context) (bool, error)

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

func (*DbInstanceQuery) ExistX

func (diq *DbInstanceQuery) ExistX(ctx context.Context) bool

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

func (*DbInstanceQuery) First

func (diq *DbInstanceQuery) First(ctx context.Context) (*DbInstance, error)

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

func (*DbInstanceQuery) FirstID

func (diq *DbInstanceQuery) FirstID(ctx context.Context) (id int, err error)

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

func (*DbInstanceQuery) FirstIDX

func (diq *DbInstanceQuery) FirstIDX(ctx context.Context) int

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

func (*DbInstanceQuery) FirstX

func (diq *DbInstanceQuery) FirstX(ctx context.Context) *DbInstance

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

func (*DbInstanceQuery) GroupBy

func (diq *DbInstanceQuery) GroupBy(field string, fields ...string) *DbInstanceGroupBy

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

client.DbInstance.Query().
	GroupBy(dbinstance.FieldCreateTime).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*DbInstanceQuery) IDs

func (diq *DbInstanceQuery) IDs(ctx context.Context) ([]int, error)

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

func (*DbInstanceQuery) IDsX

func (diq *DbInstanceQuery) IDsX(ctx context.Context) []int

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

func (*DbInstanceQuery) Limit

func (diq *DbInstanceQuery) Limit(limit int) *DbInstanceQuery

Limit adds a limit step to the query.

func (*DbInstanceQuery) Offset

func (diq *DbInstanceQuery) Offset(offset int) *DbInstanceQuery

Offset adds an offset step to the query.

func (*DbInstanceQuery) Only

func (diq *DbInstanceQuery) Only(ctx context.Context) (*DbInstance, error)

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

func (*DbInstanceQuery) OnlyID

func (diq *DbInstanceQuery) OnlyID(ctx context.Context) (id int, err error)

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

func (*DbInstanceQuery) OnlyIDX

func (diq *DbInstanceQuery) OnlyIDX(ctx context.Context) int

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

func (*DbInstanceQuery) OnlyX

func (diq *DbInstanceQuery) OnlyX(ctx context.Context) *DbInstance

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

func (*DbInstanceQuery) Order

func (diq *DbInstanceQuery) Order(o ...OrderFunc) *DbInstanceQuery

Order adds an order step to the query.

func (*DbInstanceQuery) Select

func (diq *DbInstanceQuery) Select(fields ...string) *DbInstanceSelect

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

client.DbInstance.Query().
	Select(dbinstance.FieldCreateTime).
	Scan(ctx, &v)

func (*DbInstanceQuery) Unique

func (diq *DbInstanceQuery) Unique(unique bool) *DbInstanceQuery

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

Where adds a new predicate for the DbInstanceQuery builder.

type DbInstanceSelect

type DbInstanceSelect struct {
	*DbInstanceQuery
	// contains filtered or unexported fields
}

DbInstanceSelect is the builder for selecting fields of DbInstance entities.

func (*DbInstanceSelect) Aggregate

func (dis *DbInstanceSelect) Aggregate(fns ...AggregateFunc) *DbInstanceSelect

Aggregate adds the given aggregation functions to the selector query.

func (*DbInstanceSelect) Bool

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

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

func (*DbInstanceSelect) BoolX

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

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

func (*DbInstanceSelect) Bools

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

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

func (*DbInstanceSelect) BoolsX

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

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

func (*DbInstanceSelect) Float64

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

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

func (*DbInstanceSelect) Float64X

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

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

func (*DbInstanceSelect) Float64s

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

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

func (*DbInstanceSelect) Float64sX

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

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

func (*DbInstanceSelect) Int

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

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

func (*DbInstanceSelect) IntX

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

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

func (*DbInstanceSelect) Ints

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

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

func (*DbInstanceSelect) IntsX

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

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

func (*DbInstanceSelect) Scan

func (dis *DbInstanceSelect) Scan(ctx context.Context, v any) error

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

func (*DbInstanceSelect) ScanX

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

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

func (*DbInstanceSelect) String

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

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

func (*DbInstanceSelect) StringX

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

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

func (*DbInstanceSelect) Strings

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

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

func (*DbInstanceSelect) StringsX

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

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

type DbInstanceUpdate

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

DbInstanceUpdate is the builder for updating DbInstance entities.

func (*DbInstanceUpdate) ClearAnnotations

func (diu *DbInstanceUpdate) ClearAnnotations() *DbInstanceUpdate

ClearAnnotations clears the value of the "annotations" field.

func (*DbInstanceUpdate) ClearLabels

func (diu *DbInstanceUpdate) ClearLabels() *DbInstanceUpdate

ClearLabels clears the value of the "labels" field.

func (*DbInstanceUpdate) Exec

func (diu *DbInstanceUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*DbInstanceUpdate) ExecX

func (diu *DbInstanceUpdate) ExecX(ctx context.Context)

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

func (*DbInstanceUpdate) Mutation

func (diu *DbInstanceUpdate) Mutation() *DbInstanceMutation

Mutation returns the DbInstanceMutation object of the builder.

func (*DbInstanceUpdate) Save

func (diu *DbInstanceUpdate) Save(ctx context.Context) (int, error)

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

func (*DbInstanceUpdate) SaveX

func (diu *DbInstanceUpdate) SaveX(ctx context.Context) int

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

func (*DbInstanceUpdate) SetAnnotations

func (diu *DbInstanceUpdate) SetAnnotations(m map[string]string) *DbInstanceUpdate

SetAnnotations sets the "annotations" field.

func (*DbInstanceUpdate) SetCreateTime

func (diu *DbInstanceUpdate) SetCreateTime(t time.Time) *DbInstanceUpdate

SetCreateTime sets the "create_time" field.

func (*DbInstanceUpdate) SetEngine

func (diu *DbInstanceUpdate) SetEngine(s string) *DbInstanceUpdate

SetEngine sets the "engine" field.

func (*DbInstanceUpdate) SetEngineVersion

func (diu *DbInstanceUpdate) SetEngineVersion(s string) *DbInstanceUpdate

SetEngineVersion sets the "engine_version" field.

func (*DbInstanceUpdate) SetEnv

func (diu *DbInstanceUpdate) SetEnv(s string) *DbInstanceUpdate

SetEnv sets the "env" field.

func (*DbInstanceUpdate) SetHost

func (diu *DbInstanceUpdate) SetHost(s string) *DbInstanceUpdate

SetHost sets the "host" field.

func (*DbInstanceUpdate) SetInstanceCreateTime

func (diu *DbInstanceUpdate) SetInstanceCreateTime(s string) *DbInstanceUpdate

SetInstanceCreateTime sets the "instance_create_time" field.

func (*DbInstanceUpdate) SetInstanceID

func (diu *DbInstanceUpdate) SetInstanceID(s string) *DbInstanceUpdate

SetInstanceID sets the "instance_id" field.

func (*DbInstanceUpdate) SetInstanceName

func (diu *DbInstanceUpdate) SetInstanceName(s string) *DbInstanceUpdate

SetInstanceName sets the "instance_name" field.

func (*DbInstanceUpdate) SetInstanceStatus

func (diu *DbInstanceUpdate) SetInstanceStatus(s string) *DbInstanceUpdate

SetInstanceStatus sets the "instance_status" field.

func (*DbInstanceUpdate) SetInstanceType

func (diu *DbInstanceUpdate) SetInstanceType(s string) *DbInstanceUpdate

SetInstanceType sets the "instance_type" field.

func (*DbInstanceUpdate) SetLabels

func (diu *DbInstanceUpdate) SetLabels(m map[string]string) *DbInstanceUpdate

SetLabels sets the "labels" field.

func (*DbInstanceUpdate) SetNillableCreateTime

func (diu *DbInstanceUpdate) SetNillableCreateTime(t *time.Time) *DbInstanceUpdate

SetNillableCreateTime sets the "create_time" field if the given value is not nil.

func (*DbInstanceUpdate) SetNillableEngine

func (diu *DbInstanceUpdate) SetNillableEngine(s *string) *DbInstanceUpdate

SetNillableEngine sets the "engine" field if the given value is not nil.

func (*DbInstanceUpdate) SetNillableEngineVersion

func (diu *DbInstanceUpdate) SetNillableEngineVersion(s *string) *DbInstanceUpdate

SetNillableEngineVersion sets the "engine_version" field if the given value is not nil.

func (*DbInstanceUpdate) SetNillableHost

func (diu *DbInstanceUpdate) SetNillableHost(s *string) *DbInstanceUpdate

SetNillableHost sets the "host" field if the given value is not nil.

func (*DbInstanceUpdate) SetNillableInstanceName

func (diu *DbInstanceUpdate) SetNillableInstanceName(s *string) *DbInstanceUpdate

SetNillableInstanceName sets the "instance_name" field if the given value is not nil.

func (*DbInstanceUpdate) SetNillableInstanceStatus

func (diu *DbInstanceUpdate) SetNillableInstanceStatus(s *string) *DbInstanceUpdate

SetNillableInstanceStatus sets the "instance_status" field if the given value is not nil.

func (*DbInstanceUpdate) SetNillableInstanceType

func (diu *DbInstanceUpdate) SetNillableInstanceType(s *string) *DbInstanceUpdate

SetNillableInstanceType sets the "instance_type" field if the given value is not nil.

func (*DbInstanceUpdate) SetNillableSpecification

func (diu *DbInstanceUpdate) SetNillableSpecification(s *string) *DbInstanceUpdate

SetNillableSpecification sets the "specification" field if the given value is not nil.

func (*DbInstanceUpdate) SetSpecification

func (diu *DbInstanceUpdate) SetSpecification(s string) *DbInstanceUpdate

SetSpecification sets the "specification" field.

func (*DbInstanceUpdate) SetUpdateTime

func (diu *DbInstanceUpdate) SetUpdateTime(t time.Time) *DbInstanceUpdate

SetUpdateTime sets the "update_time" field.

func (*DbInstanceUpdate) Where

Where appends a list predicates to the DbInstanceUpdate builder.

type DbInstanceUpdateOne

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

DbInstanceUpdateOne is the builder for updating a single DbInstance entity.

func (*DbInstanceUpdateOne) ClearAnnotations

func (diuo *DbInstanceUpdateOne) ClearAnnotations() *DbInstanceUpdateOne

ClearAnnotations clears the value of the "annotations" field.

func (*DbInstanceUpdateOne) ClearLabels

func (diuo *DbInstanceUpdateOne) ClearLabels() *DbInstanceUpdateOne

ClearLabels clears the value of the "labels" field.

func (*DbInstanceUpdateOne) Exec

func (diuo *DbInstanceUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*DbInstanceUpdateOne) ExecX

func (diuo *DbInstanceUpdateOne) ExecX(ctx context.Context)

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

func (*DbInstanceUpdateOne) Mutation

func (diuo *DbInstanceUpdateOne) Mutation() *DbInstanceMutation

Mutation returns the DbInstanceMutation object of the builder.

func (*DbInstanceUpdateOne) Save

func (diuo *DbInstanceUpdateOne) Save(ctx context.Context) (*DbInstance, error)

Save executes the query and returns the updated DbInstance entity.

func (*DbInstanceUpdateOne) SaveX

func (diuo *DbInstanceUpdateOne) SaveX(ctx context.Context) *DbInstance

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

func (*DbInstanceUpdateOne) Select

func (diuo *DbInstanceUpdateOne) Select(field string, fields ...string) *DbInstanceUpdateOne

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

func (*DbInstanceUpdateOne) SetAnnotations

func (diuo *DbInstanceUpdateOne) SetAnnotations(m map[string]string) *DbInstanceUpdateOne

SetAnnotations sets the "annotations" field.

func (*DbInstanceUpdateOne) SetCreateTime

func (diuo *DbInstanceUpdateOne) SetCreateTime(t time.Time) *DbInstanceUpdateOne

SetCreateTime sets the "create_time" field.

func (*DbInstanceUpdateOne) SetEngine

func (diuo *DbInstanceUpdateOne) SetEngine(s string) *DbInstanceUpdateOne

SetEngine sets the "engine" field.

func (*DbInstanceUpdateOne) SetEngineVersion

func (diuo *DbInstanceUpdateOne) SetEngineVersion(s string) *DbInstanceUpdateOne

SetEngineVersion sets the "engine_version" field.

func (*DbInstanceUpdateOne) SetEnv

SetEnv sets the "env" field.

func (*DbInstanceUpdateOne) SetHost

SetHost sets the "host" field.

func (*DbInstanceUpdateOne) SetInstanceCreateTime

func (diuo *DbInstanceUpdateOne) SetInstanceCreateTime(s string) *DbInstanceUpdateOne

SetInstanceCreateTime sets the "instance_create_time" field.

func (*DbInstanceUpdateOne) SetInstanceID

func (diuo *DbInstanceUpdateOne) SetInstanceID(s string) *DbInstanceUpdateOne

SetInstanceID sets the "instance_id" field.

func (*DbInstanceUpdateOne) SetInstanceName

func (diuo *DbInstanceUpdateOne) SetInstanceName(s string) *DbInstanceUpdateOne

SetInstanceName sets the "instance_name" field.

func (*DbInstanceUpdateOne) SetInstanceStatus

func (diuo *DbInstanceUpdateOne) SetInstanceStatus(s string) *DbInstanceUpdateOne

SetInstanceStatus sets the "instance_status" field.

func (*DbInstanceUpdateOne) SetInstanceType

func (diuo *DbInstanceUpdateOne) SetInstanceType(s string) *DbInstanceUpdateOne

SetInstanceType sets the "instance_type" field.

func (*DbInstanceUpdateOne) SetLabels

func (diuo *DbInstanceUpdateOne) SetLabels(m map[string]string) *DbInstanceUpdateOne

SetLabels sets the "labels" field.

func (*DbInstanceUpdateOne) SetNillableCreateTime

func (diuo *DbInstanceUpdateOne) SetNillableCreateTime(t *time.Time) *DbInstanceUpdateOne

SetNillableCreateTime sets the "create_time" field if the given value is not nil.

func (*DbInstanceUpdateOne) SetNillableEngine

func (diuo *DbInstanceUpdateOne) SetNillableEngine(s *string) *DbInstanceUpdateOne

SetNillableEngine sets the "engine" field if the given value is not nil.

func (*DbInstanceUpdateOne) SetNillableEngineVersion

func (diuo *DbInstanceUpdateOne) SetNillableEngineVersion(s *string) *DbInstanceUpdateOne

SetNillableEngineVersion sets the "engine_version" field if the given value is not nil.

func (*DbInstanceUpdateOne) SetNillableHost

func (diuo *DbInstanceUpdateOne) SetNillableHost(s *string) *DbInstanceUpdateOne

SetNillableHost sets the "host" field if the given value is not nil.

func (*DbInstanceUpdateOne) SetNillableInstanceName

func (diuo *DbInstanceUpdateOne) SetNillableInstanceName(s *string) *DbInstanceUpdateOne

SetNillableInstanceName sets the "instance_name" field if the given value is not nil.

func (*DbInstanceUpdateOne) SetNillableInstanceStatus

func (diuo *DbInstanceUpdateOne) SetNillableInstanceStatus(s *string) *DbInstanceUpdateOne

SetNillableInstanceStatus sets the "instance_status" field if the given value is not nil.

func (*DbInstanceUpdateOne) SetNillableInstanceType

func (diuo *DbInstanceUpdateOne) SetNillableInstanceType(s *string) *DbInstanceUpdateOne

SetNillableInstanceType sets the "instance_type" field if the given value is not nil.

func (*DbInstanceUpdateOne) SetNillableSpecification

func (diuo *DbInstanceUpdateOne) SetNillableSpecification(s *string) *DbInstanceUpdateOne

SetNillableSpecification sets the "specification" field if the given value is not nil.

func (*DbInstanceUpdateOne) SetSpecification

func (diuo *DbInstanceUpdateOne) SetSpecification(s string) *DbInstanceUpdateOne

SetSpecification sets the "specification" field.

func (*DbInstanceUpdateOne) SetUpdateTime

func (diuo *DbInstanceUpdateOne) SetUpdateTime(t time.Time) *DbInstanceUpdateOne

SetUpdateTime sets the "update_time" field.

type DbInstances

type DbInstances []*DbInstance

DbInstances is a parsable slice of DbInstance.

type Hook

type Hook = ent.Hook

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

type MutateFunc

type MutateFunc = ent.MutateFunc

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

type Mutation

type Mutation = ent.Mutation

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

type Mutator

type Mutator = ent.Mutator

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

type NotFoundError

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

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

func (*NotFoundError) Error

func (e *NotFoundError) Error() string

Error implements the error interface.

type NotLoadedError

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

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

func (*NotLoadedError) Error

func (e *NotLoadedError) Error() string

Error implements the error interface.

type NotSingularError

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

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

func (*NotSingularError) Error

func (e *NotSingularError) Error() string

Error implements the error interface.

type Op

type Op = ent.Op

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

type Option

type Option func(*config)

Option function to configure the client.

func Debug

func Debug() Option

Debug enables debug logging on the ent.Driver.

func Driver

func Driver(driver dialect.Driver) Option

Driver configures the client driver.

func Log

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

Log sets the logging function for debug mode.

type OrderFunc

type OrderFunc func(*sql.Selector)

OrderFunc applies an ordering on the sql selector.

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 {

	// DbInstance is the client for interacting with the DbInstance builders.
	DbInstance *DbInstanceClient
	// 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