ent

package
v0.0.0-...-3b456d4 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2025 License: Apache-2.0 Imports: 20 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.
	TypeDomain = "Domain"
	TypeHello  = "Hello"
	TypeWorld  = "World"
)

Variables

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

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

Functions

func Asc

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

Asc applies the given fields in ASC order.

func Desc

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

Desc applies the given fields in DESC order.

func IsConstraintError

func IsConstraintError(err error) bool

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

func IsNotFound

func IsNotFound(err error) bool

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

func IsNotLoaded

func IsNotLoaded(err error) bool

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

func IsNotSingular

func IsNotSingular(err error) bool

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

func IsValidationError

func IsValidationError(err error) bool

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

func MaskNotFound

func MaskNotFound(err error) error

MaskNotFound masks not found error.

func NewContext

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

NewContext returns a new context with the given Client attached.

func NewTxContext

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

NewTxContext returns a new context with the given Tx attached.

Types

type 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
	// Domain is the client for interacting with the Domain builders.
	Domain *DomainClient
	// Hello is the client for interacting with the Hello builders.
	Hello *HelloClient
	// World is the client for interacting with the World builders.
	World *WorldClient
	// 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().
	Domain.
	Query().
	Count(ctx)

func (*Client) Intercept

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

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

func (*Client) Mutate

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

Mutate implements the ent.Mutator interface.

func (*Client) Tx

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

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

func (*Client) Use

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

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

type CommitFunc

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

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

func (CommitFunc) Commit

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

Commit calls f(ctx, m).

type CommitHook

type CommitHook func(Committer) Committer

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

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

type Committer

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

Committer is the interface that wraps the Commit method.

type ConstraintError

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

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

func (ConstraintError) Error

func (e ConstraintError) Error() string

Error implements the error interface.

func (*ConstraintError) Unwrap

func (e *ConstraintError) Unwrap() error

Unwrap implements the errors.Wrapper interface.

type Domain

type Domain struct {

	// ID of the ent.
	ID int `json:"id,omitempty"`
	// Name holds the value of the "name" field.
	Name string `json:"name,omitempty"`
	// TenantID holds the value of the "tenant_id" field.
	TenantID int `json:"tenant_id,omitempty"`
	// DomainID holds the value of the "domain_id" field.
	DomainID int `json:"domain_id,omitempty"`
	// contains filtered or unexported fields
}

Domain is the model entity for the Domain schema.

func (*Domain) String

func (d *Domain) String() string

String implements the fmt.Stringer.

func (*Domain) Unwrap

func (d *Domain) Unwrap() *Domain

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

func (d *Domain) Update() *DomainUpdateOne

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

func (*Domain) Value

func (d *Domain) Value(name string) (ent.Value, error)

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

type DomainClient

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

DomainClient is a client for the Domain schema.

func NewDomainClient

func NewDomainClient(c config) *DomainClient

NewDomainClient returns a client for the Domain from the given config.

func (*DomainClient) Create

func (c *DomainClient) Create() *DomainCreate

Create returns a builder for creating a Domain entity.

func (*DomainClient) CreateBulk

func (c *DomainClient) CreateBulk(builders ...*DomainCreate) *DomainCreateBulk

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

func (*DomainClient) Delete

func (c *DomainClient) Delete() *DomainDelete

Delete returns a delete builder for Domain.

func (*DomainClient) DeleteOne

func (c *DomainClient) DeleteOne(d *Domain) *DomainDeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*DomainClient) DeleteOneID

func (c *DomainClient) DeleteOneID(id int) *DomainDeleteOne

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

func (*DomainClient) Get

func (c *DomainClient) Get(ctx context.Context, id int) (*Domain, error)

Get returns a Domain entity by its id.

func (*DomainClient) GetX

func (c *DomainClient) GetX(ctx context.Context, id int) *Domain

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

func (*DomainClient) Hooks

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

Hooks returns the client hooks.

func (*DomainClient) Intercept

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

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

func (*DomainClient) Interceptors

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

Interceptors returns the client interceptors.

func (*DomainClient) MapCreateBulk

func (c *DomainClient) MapCreateBulk(slice any, setFunc func(*DomainCreate, int)) *DomainCreateBulk

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

func (*DomainClient) Query

func (c *DomainClient) Query() *DomainQuery

Query returns a query builder for Domain.

func (*DomainClient) Update

func (c *DomainClient) Update() *DomainUpdate

Update returns an update builder for Domain.

func (*DomainClient) UpdateOne

func (c *DomainClient) UpdateOne(d *Domain) *DomainUpdateOne

UpdateOne returns an update builder for the given entity.

func (*DomainClient) UpdateOneID

func (c *DomainClient) UpdateOneID(id int) *DomainUpdateOne

UpdateOneID returns an update builder for the given id.

func (*DomainClient) Use

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

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

type DomainCreate

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

DomainCreate is the builder for creating a Domain entity.

func (*DomainCreate) Exec

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

Exec executes the query.

func (*DomainCreate) ExecX

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

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

func (*DomainCreate) Mutation

func (dc *DomainCreate) Mutation() *DomainMutation

Mutation returns the DomainMutation object of the builder.

func (*DomainCreate) Save

func (dc *DomainCreate) Save(ctx context.Context) (*Domain, error)

Save creates the Domain in the database.

func (*DomainCreate) SaveX

func (dc *DomainCreate) SaveX(ctx context.Context) *Domain

SaveX calls Save and panics if Save returns an error.

func (*DomainCreate) SetDomainID

func (dc *DomainCreate) SetDomainID(i int) *DomainCreate

SetDomainID sets the "domain_id" field.

func (*DomainCreate) SetID

func (dc *DomainCreate) SetID(i int) *DomainCreate

SetID sets the "id" field.

func (*DomainCreate) SetName

func (dc *DomainCreate) SetName(s string) *DomainCreate

SetName sets the "name" field.

func (*DomainCreate) SetTenantID

func (dc *DomainCreate) SetTenantID(i int) *DomainCreate

SetTenantID sets the "tenant_id" field.

type DomainCreateBulk

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

DomainCreateBulk is the builder for creating many Domain entities in bulk.

func (*DomainCreateBulk) Exec

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

Exec executes the query.

func (*DomainCreateBulk) ExecX

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

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

func (*DomainCreateBulk) Save

func (dcb *DomainCreateBulk) Save(ctx context.Context) ([]*Domain, error)

Save creates the Domain entities in the database.

func (*DomainCreateBulk) SaveX

func (dcb *DomainCreateBulk) SaveX(ctx context.Context) []*Domain

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

type DomainDelete

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

DomainDelete is the builder for deleting a Domain entity.

func (*DomainDelete) Exec

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

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

func (*DomainDelete) ExecX

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

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

func (*DomainDelete) Where

func (dd *DomainDelete) Where(ps ...predicate.Domain) *DomainDelete

Where appends a list predicates to the DomainDelete builder.

type DomainDeleteOne

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

DomainDeleteOne is the builder for deleting a single Domain entity.

func (*DomainDeleteOne) Exec

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

Exec executes the deletion query.

func (*DomainDeleteOne) ExecX

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

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

func (*DomainDeleteOne) Where

func (ddo *DomainDeleteOne) Where(ps ...predicate.Domain) *DomainDeleteOne

Where appends a list predicates to the DomainDelete builder.

type DomainFilter

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

DomainFilter provides a generic filtering capability at runtime for DomainQuery.

func (*DomainFilter) Where

func (f *DomainFilter) Where(p entql.P)

Where applies the entql predicate on the query filter.

func (*DomainFilter) WhereDomainID

func (f *DomainFilter) WhereDomainID(p entql.IntP)

WhereDomainID applies the entql int predicate on the domain_id field.

func (*DomainFilter) WhereID

func (f *DomainFilter) WhereID(p entql.IntP)

WhereID applies the entql int predicate on the id field.

func (*DomainFilter) WhereName

func (f *DomainFilter) WhereName(p entql.StringP)

WhereName applies the entql string predicate on the name field.

func (*DomainFilter) WhereTenantID

func (f *DomainFilter) WhereTenantID(p entql.IntP)

WhereTenantID applies the entql int predicate on the tenant_id field.

type DomainGroupBy

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

DomainGroupBy is the group-by builder for Domain entities.

func (*DomainGroupBy) Aggregate

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

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

func (*DomainGroupBy) Bool

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

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

func (*DomainGroupBy) BoolX

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

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

func (*DomainGroupBy) Bools

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

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

func (*DomainGroupBy) BoolsX

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

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

func (*DomainGroupBy) Float64

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

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

func (*DomainGroupBy) Float64X

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

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

func (*DomainGroupBy) Float64s

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

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

func (*DomainGroupBy) Float64sX

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

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

func (*DomainGroupBy) Int

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

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

func (*DomainGroupBy) IntX

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

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

func (*DomainGroupBy) Ints

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

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

func (*DomainGroupBy) IntsX

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

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

func (*DomainGroupBy) Scan

func (dgb *DomainGroupBy) Scan(ctx context.Context, v any) error

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

func (*DomainGroupBy) ScanX

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

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

func (*DomainGroupBy) String

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

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

func (*DomainGroupBy) StringX

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

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

func (*DomainGroupBy) Strings

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

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

func (*DomainGroupBy) StringsX

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

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

type DomainMutation

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

DomainMutation represents an operation that mutates the Domain nodes in the graph.

func (*DomainMutation) AddDomainID

func (m *DomainMutation) AddDomainID(i int)

AddDomainID adds i to the "domain_id" field.

func (*DomainMutation) AddField

func (m *DomainMutation) 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 (*DomainMutation) AddTenantID

func (m *DomainMutation) AddTenantID(i int)

AddTenantID adds i to the "tenant_id" field.

func (*DomainMutation) AddedDomainID

func (m *DomainMutation) AddedDomainID() (r int, exists bool)

AddedDomainID returns the value that was added to the "domain_id" field in this mutation.

func (*DomainMutation) AddedEdges

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

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

func (*DomainMutation) AddedField

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

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

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

func (*DomainMutation) AddedIDs

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

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

func (*DomainMutation) AddedTenantID

func (m *DomainMutation) AddedTenantID() (r int, exists bool)

AddedTenantID returns the value that was added to the "tenant_id" field in this mutation.

func (*DomainMutation) ClearEdge

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

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

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

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

func (*DomainMutation) ClearedFields

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

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

func (DomainMutation) Client

func (m DomainMutation) 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 (*DomainMutation) DomainID

func (m *DomainMutation) DomainID() (r int, exists bool)

DomainID returns the value of the "domain_id" field in the mutation.

func (*DomainMutation) EdgeCleared

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

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

func (*DomainMutation) Field

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

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

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

func (*DomainMutation) Fields

func (m *DomainMutation) 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 (*DomainMutation) Filter

func (m *DomainMutation) Filter() *DomainFilter

Filter returns an entql.Where implementation to apply filters on the DomainMutation builder.

func (*DomainMutation) ID

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

func (m *DomainMutation) 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 (*DomainMutation) Name

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

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

func (*DomainMutation) OldDomainID

func (m *DomainMutation) OldDomainID(ctx context.Context) (v int, err error)

OldDomainID returns the old "domain_id" field's value of the Domain entity. If the Domain 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 (*DomainMutation) OldField

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

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

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

func (m *DomainMutation) OldTenantID(ctx context.Context) (v int, err error)

OldTenantID returns the old "tenant_id" field's value of the Domain entity. If the Domain 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 (*DomainMutation) Op

func (m *DomainMutation) Op() Op

Op returns the operation name.

func (*DomainMutation) RemovedEdges

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

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

func (*DomainMutation) RemovedIDs

func (m *DomainMutation) 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 (*DomainMutation) ResetDomainID

func (m *DomainMutation) ResetDomainID()

ResetDomainID resets all changes to the "domain_id" field.

func (*DomainMutation) ResetEdge

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

func (m *DomainMutation) 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 (*DomainMutation) ResetName

func (m *DomainMutation) ResetName()

ResetName resets all changes to the "name" field.

func (*DomainMutation) ResetTenantID

func (m *DomainMutation) ResetTenantID()

ResetTenantID resets all changes to the "tenant_id" field.

func (*DomainMutation) SetDomainID

func (m *DomainMutation) SetDomainID(i int)

SetDomainID sets the "domain_id" field.

func (*DomainMutation) SetField

func (m *DomainMutation) 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 (*DomainMutation) SetID

func (m *DomainMutation) SetID(id int)

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

func (*DomainMutation) SetName

func (m *DomainMutation) SetName(s string)

SetName sets the "name" field.

func (*DomainMutation) SetOp

func (m *DomainMutation) SetOp(op Op)

SetOp allows setting the mutation operation.

func (*DomainMutation) SetTenantID

func (m *DomainMutation) SetTenantID(i int)

SetTenantID sets the "tenant_id" field.

func (*DomainMutation) TenantID

func (m *DomainMutation) TenantID() (r int, exists bool)

TenantID returns the value of the "tenant_id" field in the mutation.

func (DomainMutation) Tx

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

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

func (*DomainMutation) Type

func (m *DomainMutation) Type() string

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

func (*DomainMutation) Where

func (m *DomainMutation) Where(ps ...predicate.Domain)

Where appends a list predicates to the DomainMutation builder.

func (*DomainMutation) WhereP

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

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

type DomainQuery

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

DomainQuery is the builder for querying Domain entities.

func (*DomainQuery) Aggregate

func (dq *DomainQuery) Aggregate(fns ...AggregateFunc) *DomainSelect

Aggregate returns a DomainSelect configured with the given aggregations.

func (*DomainQuery) All

func (dq *DomainQuery) All(ctx context.Context) ([]*Domain, error)

All executes the query and returns a list of Domains.

func (*DomainQuery) AllX

func (dq *DomainQuery) AllX(ctx context.Context) []*Domain

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

func (*DomainQuery) Clone

func (dq *DomainQuery) Clone() *DomainQuery

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

func (*DomainQuery) Count

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

Count returns the count of the given query.

func (*DomainQuery) CountX

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

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

func (*DomainQuery) Exist

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

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

func (*DomainQuery) ExistX

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

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

func (*DomainQuery) Filter

func (dq *DomainQuery) Filter() *DomainFilter

Filter returns a Filter implementation to apply filters on the DomainQuery builder.

func (*DomainQuery) First

func (dq *DomainQuery) First(ctx context.Context) (*Domain, error)

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

func (*DomainQuery) FirstID

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

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

func (*DomainQuery) FirstIDX

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

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

func (*DomainQuery) FirstX

func (dq *DomainQuery) FirstX(ctx context.Context) *Domain

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

func (*DomainQuery) GroupBy

func (dq *DomainQuery) GroupBy(field string, fields ...string) *DomainGroupBy

GroupBy is used to group vertices by one or more fields/columns. It is often used with aggregate functions, like: count, max, mean, min, sum.

Example:

var v []struct {
	Name string `json:"name,omitempty"`
	Count int `json:"count,omitempty"`
}

client.Domain.Query().
	GroupBy(domain.FieldName).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*DomainQuery) IDs

func (dq *DomainQuery) IDs(ctx context.Context) (ids []int, err error)

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

func (*DomainQuery) IDsX

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

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

func (*DomainQuery) Limit

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

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

func (*DomainQuery) Offset

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

Offset to start from.

func (*DomainQuery) Only

func (dq *DomainQuery) Only(ctx context.Context) (*Domain, error)

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

func (*DomainQuery) OnlyID

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

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

func (*DomainQuery) OnlyIDX

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

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

func (*DomainQuery) OnlyX

func (dq *DomainQuery) OnlyX(ctx context.Context) *Domain

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

func (*DomainQuery) Order

func (dq *DomainQuery) Order(o ...domain.OrderOption) *DomainQuery

Order specifies how the records should be ordered.

func (*DomainQuery) Select

func (dq *DomainQuery) Select(fields ...string) *DomainSelect

Select allows the selection one or more fields/columns for the given query, instead of selecting all fields in the entity.

Example:

var v []struct {
	Name string `json:"name,omitempty"`
}

client.Domain.Query().
	Select(domain.FieldName).
	Scan(ctx, &v)

func (*DomainQuery) Unique

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

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

func (dq *DomainQuery) Where(ps ...predicate.Domain) *DomainQuery

Where adds a new predicate for the DomainQuery builder.

type DomainSelect

type DomainSelect struct {
	*DomainQuery
	// contains filtered or unexported fields
}

DomainSelect is the builder for selecting fields of Domain entities.

func (*DomainSelect) Aggregate

func (ds *DomainSelect) Aggregate(fns ...AggregateFunc) *DomainSelect

Aggregate adds the given aggregation functions to the selector query.

func (*DomainSelect) Bool

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

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

func (*DomainSelect) BoolX

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

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

func (*DomainSelect) Bools

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

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

func (*DomainSelect) BoolsX

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

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

func (*DomainSelect) Float64

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

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

func (*DomainSelect) Float64X

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

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

func (*DomainSelect) Float64s

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

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

func (*DomainSelect) Float64sX

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

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

func (*DomainSelect) Int

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

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

func (*DomainSelect) IntX

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

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

func (*DomainSelect) Ints

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

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

func (*DomainSelect) IntsX

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

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

func (*DomainSelect) Scan

func (ds *DomainSelect) Scan(ctx context.Context, v any) error

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

func (*DomainSelect) ScanX

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

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

func (*DomainSelect) String

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

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

func (*DomainSelect) StringX

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

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

func (*DomainSelect) Strings

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

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

func (*DomainSelect) StringsX

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

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

type DomainUpdate

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

DomainUpdate is the builder for updating Domain entities.

func (*DomainUpdate) Exec

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

Exec executes the query.

func (*DomainUpdate) ExecX

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

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

func (*DomainUpdate) Mutation

func (du *DomainUpdate) Mutation() *DomainMutation

Mutation returns the DomainMutation object of the builder.

func (*DomainUpdate) Save

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

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

func (*DomainUpdate) SaveX

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

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

func (*DomainUpdate) SetName

func (du *DomainUpdate) SetName(s string) *DomainUpdate

SetName sets the "name" field.

func (*DomainUpdate) SetNillableName

func (du *DomainUpdate) SetNillableName(s *string) *DomainUpdate

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

func (*DomainUpdate) Where

func (du *DomainUpdate) Where(ps ...predicate.Domain) *DomainUpdate

Where appends a list predicates to the DomainUpdate builder.

type DomainUpdateOne

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

DomainUpdateOne is the builder for updating a single Domain entity.

func (*DomainUpdateOne) Exec

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

Exec executes the query on the entity.

func (*DomainUpdateOne) ExecX

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

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

func (*DomainUpdateOne) Mutation

func (duo *DomainUpdateOne) Mutation() *DomainMutation

Mutation returns the DomainMutation object of the builder.

func (*DomainUpdateOne) Save

func (duo *DomainUpdateOne) Save(ctx context.Context) (*Domain, error)

Save executes the query and returns the updated Domain entity.

func (*DomainUpdateOne) SaveX

func (duo *DomainUpdateOne) SaveX(ctx context.Context) *Domain

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

func (*DomainUpdateOne) Select

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

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

func (*DomainUpdateOne) SetName

func (duo *DomainUpdateOne) SetName(s string) *DomainUpdateOne

SetName sets the "name" field.

func (*DomainUpdateOne) SetNillableName

func (duo *DomainUpdateOne) SetNillableName(s *string) *DomainUpdateOne

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

func (*DomainUpdateOne) Where

func (duo *DomainUpdateOne) Where(ps ...predicate.Domain) *DomainUpdateOne

Where appends a list predicates to the DomainUpdate builder.

type Domains

type Domains []*Domain

Domains is a parsable slice of Domain.

type Hello

type Hello struct {

	// ID of the ent.
	ID int `json:"id,omitempty"`
	// Name holds the value of the "name" field.
	Name string `json:"name,omitempty"`
	// TenantID holds the value of the "tenant_id" field.
	TenantID int `json:"tenant_id,omitempty"`
	// contains filtered or unexported fields
}

Hello is the model entity for the Hello schema.

func (*Hello) String

func (h *Hello) String() string

String implements the fmt.Stringer.

func (*Hello) Unwrap

func (h *Hello) Unwrap() *Hello

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

func (h *Hello) Update() *HelloUpdateOne

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

func (*Hello) Value

func (h *Hello) Value(name string) (ent.Value, error)

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

type HelloClient

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

HelloClient is a client for the Hello schema.

func NewHelloClient

func NewHelloClient(c config) *HelloClient

NewHelloClient returns a client for the Hello from the given config.

func (*HelloClient) Create

func (c *HelloClient) Create() *HelloCreate

Create returns a builder for creating a Hello entity.

func (*HelloClient) CreateBulk

func (c *HelloClient) CreateBulk(builders ...*HelloCreate) *HelloCreateBulk

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

func (*HelloClient) Delete

func (c *HelloClient) Delete() *HelloDelete

Delete returns a delete builder for Hello.

func (*HelloClient) DeleteOne

func (c *HelloClient) DeleteOne(h *Hello) *HelloDeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*HelloClient) DeleteOneID

func (c *HelloClient) DeleteOneID(id int) *HelloDeleteOne

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

func (*HelloClient) Get

func (c *HelloClient) Get(ctx context.Context, id int) (*Hello, error)

Get returns a Hello entity by its id.

func (*HelloClient) GetX

func (c *HelloClient) GetX(ctx context.Context, id int) *Hello

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

func (*HelloClient) Hooks

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

Hooks returns the client hooks.

func (*HelloClient) Intercept

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

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

func (*HelloClient) Interceptors

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

Interceptors returns the client interceptors.

func (*HelloClient) MapCreateBulk

func (c *HelloClient) MapCreateBulk(slice any, setFunc func(*HelloCreate, int)) *HelloCreateBulk

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

func (*HelloClient) Query

func (c *HelloClient) Query() *HelloQuery

Query returns a query builder for Hello.

func (*HelloClient) Update

func (c *HelloClient) Update() *HelloUpdate

Update returns an update builder for Hello.

func (*HelloClient) UpdateOne

func (c *HelloClient) UpdateOne(h *Hello) *HelloUpdateOne

UpdateOne returns an update builder for the given entity.

func (*HelloClient) UpdateOneID

func (c *HelloClient) UpdateOneID(id int) *HelloUpdateOne

UpdateOneID returns an update builder for the given id.

func (*HelloClient) Use

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

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

type HelloCreate

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

HelloCreate is the builder for creating a Hello entity.

func (*HelloCreate) Exec

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

Exec executes the query.

func (*HelloCreate) ExecX

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

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

func (*HelloCreate) Mutation

func (hc *HelloCreate) Mutation() *HelloMutation

Mutation returns the HelloMutation object of the builder.

func (*HelloCreate) Save

func (hc *HelloCreate) Save(ctx context.Context) (*Hello, error)

Save creates the Hello in the database.

func (*HelloCreate) SaveX

func (hc *HelloCreate) SaveX(ctx context.Context) *Hello

SaveX calls Save and panics if Save returns an error.

func (*HelloCreate) SetID

func (hc *HelloCreate) SetID(i int) *HelloCreate

SetID sets the "id" field.

func (*HelloCreate) SetName

func (hc *HelloCreate) SetName(s string) *HelloCreate

SetName sets the "name" field.

func (*HelloCreate) SetTenantID

func (hc *HelloCreate) SetTenantID(i int) *HelloCreate

SetTenantID sets the "tenant_id" field.

type HelloCreateBulk

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

HelloCreateBulk is the builder for creating many Hello entities in bulk.

func (*HelloCreateBulk) Exec

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

Exec executes the query.

func (*HelloCreateBulk) ExecX

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

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

func (*HelloCreateBulk) Save

func (hcb *HelloCreateBulk) Save(ctx context.Context) ([]*Hello, error)

Save creates the Hello entities in the database.

func (*HelloCreateBulk) SaveX

func (hcb *HelloCreateBulk) SaveX(ctx context.Context) []*Hello

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

type HelloDelete

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

HelloDelete is the builder for deleting a Hello entity.

func (*HelloDelete) Exec

func (hd *HelloDelete) Exec(ctx context.Context) (int, error)

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

func (*HelloDelete) ExecX

func (hd *HelloDelete) ExecX(ctx context.Context) int

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

func (*HelloDelete) Where

func (hd *HelloDelete) Where(ps ...predicate.Hello) *HelloDelete

Where appends a list predicates to the HelloDelete builder.

type HelloDeleteOne

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

HelloDeleteOne is the builder for deleting a single Hello entity.

func (*HelloDeleteOne) Exec

func (hdo *HelloDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*HelloDeleteOne) ExecX

func (hdo *HelloDeleteOne) ExecX(ctx context.Context)

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

func (*HelloDeleteOne) Where

func (hdo *HelloDeleteOne) Where(ps ...predicate.Hello) *HelloDeleteOne

Where appends a list predicates to the HelloDelete builder.

type HelloFilter

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

HelloFilter provides a generic filtering capability at runtime for HelloQuery.

func (*HelloFilter) Where

func (f *HelloFilter) Where(p entql.P)

Where applies the entql predicate on the query filter.

func (*HelloFilter) WhereID

func (f *HelloFilter) WhereID(p entql.IntP)

WhereID applies the entql int predicate on the id field.

func (*HelloFilter) WhereName

func (f *HelloFilter) WhereName(p entql.StringP)

WhereName applies the entql string predicate on the name field.

func (*HelloFilter) WhereTenantID

func (f *HelloFilter) WhereTenantID(p entql.IntP)

WhereTenantID applies the entql int predicate on the tenant_id field.

type HelloGroupBy

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

HelloGroupBy is the group-by builder for Hello entities.

func (*HelloGroupBy) Aggregate

func (hgb *HelloGroupBy) Aggregate(fns ...AggregateFunc) *HelloGroupBy

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

func (*HelloGroupBy) Bool

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

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

func (*HelloGroupBy) BoolX

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

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

func (*HelloGroupBy) Bools

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

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

func (*HelloGroupBy) BoolsX

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

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

func (*HelloGroupBy) Float64

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

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

func (*HelloGroupBy) Float64X

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

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

func (*HelloGroupBy) Float64s

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

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

func (*HelloGroupBy) Float64sX

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

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

func (*HelloGroupBy) Int

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

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

func (*HelloGroupBy) IntX

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

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

func (*HelloGroupBy) Ints

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

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

func (*HelloGroupBy) IntsX

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

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

func (*HelloGroupBy) Scan

func (hgb *HelloGroupBy) Scan(ctx context.Context, v any) error

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

func (*HelloGroupBy) ScanX

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

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

func (*HelloGroupBy) String

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

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

func (*HelloGroupBy) StringX

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

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

func (*HelloGroupBy) Strings

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

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

func (*HelloGroupBy) StringsX

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

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

type HelloMutation

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

HelloMutation represents an operation that mutates the Hello nodes in the graph.

func (*HelloMutation) AddField

func (m *HelloMutation) 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 (*HelloMutation) AddTenantID

func (m *HelloMutation) AddTenantID(i int)

AddTenantID adds i to the "tenant_id" field.

func (*HelloMutation) AddedEdges

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

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

func (*HelloMutation) AddedField

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

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

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

func (*HelloMutation) AddedIDs

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

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

func (*HelloMutation) AddedTenantID

func (m *HelloMutation) AddedTenantID() (r int, exists bool)

AddedTenantID returns the value that was added to the "tenant_id" field in this mutation.

func (*HelloMutation) ClearEdge

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

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

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

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

func (*HelloMutation) ClearedFields

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

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

func (HelloMutation) Client

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

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

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

func (*HelloMutation) Field

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

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

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

func (*HelloMutation) Fields

func (m *HelloMutation) 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 (*HelloMutation) Filter

func (m *HelloMutation) Filter() *HelloFilter

Filter returns an entql.Where implementation to apply filters on the HelloMutation builder.

func (*HelloMutation) ID

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

func (m *HelloMutation) 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 (*HelloMutation) Name

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

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

func (*HelloMutation) OldField

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

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

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

func (m *HelloMutation) OldTenantID(ctx context.Context) (v int, err error)

OldTenantID returns the old "tenant_id" field's value of the Hello entity. If the Hello 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 (*HelloMutation) Op

func (m *HelloMutation) Op() Op

Op returns the operation name.

func (*HelloMutation) RemovedEdges

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

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

func (*HelloMutation) RemovedIDs

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

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

func (m *HelloMutation) 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 (*HelloMutation) ResetName

func (m *HelloMutation) ResetName()

ResetName resets all changes to the "name" field.

func (*HelloMutation) ResetTenantID

func (m *HelloMutation) ResetTenantID()

ResetTenantID resets all changes to the "tenant_id" field.

func (*HelloMutation) SetField

func (m *HelloMutation) 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 (*HelloMutation) SetID

func (m *HelloMutation) SetID(id int)

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

func (*HelloMutation) SetName

func (m *HelloMutation) SetName(s string)

SetName sets the "name" field.

func (*HelloMutation) SetOp

func (m *HelloMutation) SetOp(op Op)

SetOp allows setting the mutation operation.

func (*HelloMutation) SetTenantID

func (m *HelloMutation) SetTenantID(i int)

SetTenantID sets the "tenant_id" field.

func (*HelloMutation) TenantID

func (m *HelloMutation) TenantID() (r int, exists bool)

TenantID returns the value of the "tenant_id" field in the mutation.

func (HelloMutation) Tx

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

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

func (*HelloMutation) Type

func (m *HelloMutation) Type() string

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

func (*HelloMutation) Where

func (m *HelloMutation) Where(ps ...predicate.Hello)

Where appends a list predicates to the HelloMutation builder.

func (*HelloMutation) WhereP

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

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

type HelloQuery

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

HelloQuery is the builder for querying Hello entities.

func (*HelloQuery) Aggregate

func (hq *HelloQuery) Aggregate(fns ...AggregateFunc) *HelloSelect

Aggregate returns a HelloSelect configured with the given aggregations.

func (*HelloQuery) All

func (hq *HelloQuery) All(ctx context.Context) ([]*Hello, error)

All executes the query and returns a list of Hellos.

func (*HelloQuery) AllX

func (hq *HelloQuery) AllX(ctx context.Context) []*Hello

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

func (*HelloQuery) Clone

func (hq *HelloQuery) Clone() *HelloQuery

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

func (*HelloQuery) Count

func (hq *HelloQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*HelloQuery) CountX

func (hq *HelloQuery) CountX(ctx context.Context) int

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

func (*HelloQuery) Exist

func (hq *HelloQuery) Exist(ctx context.Context) (bool, error)

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

func (*HelloQuery) ExistX

func (hq *HelloQuery) ExistX(ctx context.Context) bool

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

func (*HelloQuery) Filter

func (hq *HelloQuery) Filter() *HelloFilter

Filter returns a Filter implementation to apply filters on the HelloQuery builder.

func (*HelloQuery) First

func (hq *HelloQuery) First(ctx context.Context) (*Hello, error)

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

func (*HelloQuery) FirstID

func (hq *HelloQuery) FirstID(ctx context.Context) (id int, err error)

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

func (*HelloQuery) FirstIDX

func (hq *HelloQuery) FirstIDX(ctx context.Context) int

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

func (*HelloQuery) FirstX

func (hq *HelloQuery) FirstX(ctx context.Context) *Hello

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

func (*HelloQuery) GroupBy

func (hq *HelloQuery) GroupBy(field string, fields ...string) *HelloGroupBy

GroupBy is used to group vertices by one or more fields/columns. It is often used with aggregate functions, like: count, max, mean, min, sum.

Example:

var v []struct {
	Name string `json:"name,omitempty"`
	Count int `json:"count,omitempty"`
}

client.Hello.Query().
	GroupBy(hello.FieldName).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*HelloQuery) IDs

func (hq *HelloQuery) IDs(ctx context.Context) (ids []int, err error)

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

func (*HelloQuery) IDsX

func (hq *HelloQuery) IDsX(ctx context.Context) []int

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

func (*HelloQuery) Limit

func (hq *HelloQuery) Limit(limit int) *HelloQuery

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

func (*HelloQuery) Offset

func (hq *HelloQuery) Offset(offset int) *HelloQuery

Offset to start from.

func (*HelloQuery) Only

func (hq *HelloQuery) Only(ctx context.Context) (*Hello, error)

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

func (*HelloQuery) OnlyID

func (hq *HelloQuery) OnlyID(ctx context.Context) (id int, err error)

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

func (*HelloQuery) OnlyIDX

func (hq *HelloQuery) OnlyIDX(ctx context.Context) int

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

func (*HelloQuery) OnlyX

func (hq *HelloQuery) OnlyX(ctx context.Context) *Hello

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

func (*HelloQuery) Order

func (hq *HelloQuery) Order(o ...hello.OrderOption) *HelloQuery

Order specifies how the records should be ordered.

func (*HelloQuery) Select

func (hq *HelloQuery) Select(fields ...string) *HelloSelect

Select allows the selection one or more fields/columns for the given query, instead of selecting all fields in the entity.

Example:

var v []struct {
	Name string `json:"name,omitempty"`
}

client.Hello.Query().
	Select(hello.FieldName).
	Scan(ctx, &v)

func (*HelloQuery) Unique

func (hq *HelloQuery) Unique(unique bool) *HelloQuery

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

func (hq *HelloQuery) Where(ps ...predicate.Hello) *HelloQuery

Where adds a new predicate for the HelloQuery builder.

type HelloSelect

type HelloSelect struct {
	*HelloQuery
	// contains filtered or unexported fields
}

HelloSelect is the builder for selecting fields of Hello entities.

func (*HelloSelect) Aggregate

func (hs *HelloSelect) Aggregate(fns ...AggregateFunc) *HelloSelect

Aggregate adds the given aggregation functions to the selector query.

func (*HelloSelect) Bool

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

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

func (*HelloSelect) BoolX

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

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

func (*HelloSelect) Bools

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

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

func (*HelloSelect) BoolsX

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

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

func (*HelloSelect) Float64

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

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

func (*HelloSelect) Float64X

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

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

func (*HelloSelect) Float64s

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

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

func (*HelloSelect) Float64sX

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

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

func (*HelloSelect) Int

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

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

func (*HelloSelect) IntX

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

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

func (*HelloSelect) Ints

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

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

func (*HelloSelect) IntsX

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

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

func (*HelloSelect) Scan

func (hs *HelloSelect) Scan(ctx context.Context, v any) error

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

func (*HelloSelect) ScanX

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

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

func (*HelloSelect) String

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

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

func (*HelloSelect) StringX

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

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

func (*HelloSelect) Strings

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

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

func (*HelloSelect) StringsX

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

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

type HelloUpdate

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

HelloUpdate is the builder for updating Hello entities.

func (*HelloUpdate) Exec

func (hu *HelloUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*HelloUpdate) ExecX

func (hu *HelloUpdate) ExecX(ctx context.Context)

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

func (*HelloUpdate) Mutation

func (hu *HelloUpdate) Mutation() *HelloMutation

Mutation returns the HelloMutation object of the builder.

func (*HelloUpdate) Save

func (hu *HelloUpdate) Save(ctx context.Context) (int, error)

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

func (*HelloUpdate) SaveX

func (hu *HelloUpdate) SaveX(ctx context.Context) int

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

func (*HelloUpdate) SetName

func (hu *HelloUpdate) SetName(s string) *HelloUpdate

SetName sets the "name" field.

func (*HelloUpdate) SetNillableName

func (hu *HelloUpdate) SetNillableName(s *string) *HelloUpdate

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

func (*HelloUpdate) Where

func (hu *HelloUpdate) Where(ps ...predicate.Hello) *HelloUpdate

Where appends a list predicates to the HelloUpdate builder.

type HelloUpdateOne

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

HelloUpdateOne is the builder for updating a single Hello entity.

func (*HelloUpdateOne) Exec

func (huo *HelloUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*HelloUpdateOne) ExecX

func (huo *HelloUpdateOne) ExecX(ctx context.Context)

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

func (*HelloUpdateOne) Mutation

func (huo *HelloUpdateOne) Mutation() *HelloMutation

Mutation returns the HelloMutation object of the builder.

func (*HelloUpdateOne) Save

func (huo *HelloUpdateOne) Save(ctx context.Context) (*Hello, error)

Save executes the query and returns the updated Hello entity.

func (*HelloUpdateOne) SaveX

func (huo *HelloUpdateOne) SaveX(ctx context.Context) *Hello

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

func (*HelloUpdateOne) Select

func (huo *HelloUpdateOne) Select(field string, fields ...string) *HelloUpdateOne

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

func (*HelloUpdateOne) SetName

func (huo *HelloUpdateOne) SetName(s string) *HelloUpdateOne

SetName sets the "name" field.

func (*HelloUpdateOne) SetNillableName

func (huo *HelloUpdateOne) SetNillableName(s *string) *HelloUpdateOne

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

func (*HelloUpdateOne) Where

func (huo *HelloUpdateOne) Where(ps ...predicate.Hello) *HelloUpdateOne

Where appends a list predicates to the HelloUpdate builder.

type Hellos

type Hellos []*Hello

Hellos is a parsable slice of Hello.

type Hook

type Hook = ent.Hook

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

type InterceptFunc

type InterceptFunc = ent.InterceptFunc

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

type Interceptor

type Interceptor = ent.Interceptor

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

type MutateFunc

type MutateFunc = ent.MutateFunc

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

type Mutation

type Mutation = ent.Mutation

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

type Mutator

type Mutator = ent.Mutator

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

type NotFoundError

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

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

func (*NotFoundError) Error

func (e *NotFoundError) Error() string

Error implements the error interface.

type NotLoadedError

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

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

func (*NotLoadedError) Error

func (e *NotLoadedError) Error() string

Error implements the error interface.

type NotSingularError

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

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

func (*NotSingularError) Error

func (e *NotSingularError) Error() string

Error implements the error interface.

type Op

type Op = ent.Op

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

type Option

type Option func(*config)

Option function to configure the client.

func Debug

func Debug() Option

Debug enables debug logging on the ent.Driver.

func Driver

func Driver(driver dialect.Driver) Option

Driver configures the client driver.

func Log

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

Log sets the logging function for debug mode.

type OrderFunc

type OrderFunc func(*sql.Selector)

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

type Policy

type Policy = ent.Policy

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

type Querier

type Querier = ent.Querier

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

type QuerierFunc

type QuerierFunc = ent.QuerierFunc

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

type Query

type Query = ent.Query

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

type QueryContext

type QueryContext = ent.QueryContext

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

type RollbackFunc

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

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

func (RollbackFunc) Rollback

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

Rollback calls f(ctx, m).

type RollbackHook

type RollbackHook func(Rollbacker) Rollbacker

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

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

type Rollbacker

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

Rollbacker is the interface that wraps the Rollback method.

type TraverseFunc

type TraverseFunc = ent.TraverseFunc

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

type Traverser

type Traverser = ent.Traverser

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

type Tx

type Tx struct {

	// Domain is the client for interacting with the Domain builders.
	Domain *DomainClient
	// Hello is the client for interacting with the Hello builders.
	Hello *HelloClient
	// World is the client for interacting with the World builders.
	World *WorldClient
	// 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.

type World

type World struct {

	// ID of the ent.
	ID int `json:"id,omitempty"`
	// CreatedBy holds the value of the "created_by" field.
	CreatedBy int `json:"created_by,omitempty"`
	// CreatedAt holds the value of the "created_at" field.
	CreatedAt time.Time `json:"created_at,omitempty"`
	// UpdatedBy holds the value of the "updated_by" field.
	UpdatedBy int `json:"updated_by,omitempty"`
	// UpdatedAt holds the value of the "updated_at" field.
	UpdatedAt time.Time `json:"updated_at,omitempty"`
	// DeletedAt holds the value of the "deleted_at" field.
	DeletedAt time.Time `json:"deleted_at,omitempty"`
	// TenantID holds the value of the "tenant_id" field.
	TenantID int `json:"tenant_id,omitempty"`
	// Name holds the value of the "name" field.
	Name string `json:"name,omitempty"`
	// PowerBy holds the value of the "power_by" field.
	PowerBy string `json:"power_by,omitempty"`
	// contains filtered or unexported fields
}

World is the model entity for the World schema.

func (*World) String

func (w *World) String() string

String implements the fmt.Stringer.

func (*World) Unwrap

func (w *World) Unwrap() *World

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

func (w *World) Update() *WorldUpdateOne

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

func (*World) Value

func (w *World) Value(name string) (ent.Value, error)

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

type WorldClient

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

WorldClient is a client for the World schema.

func NewWorldClient

func NewWorldClient(c config) *WorldClient

NewWorldClient returns a client for the World from the given config.

func (*WorldClient) Create

func (c *WorldClient) Create() *WorldCreate

Create returns a builder for creating a World entity.

func (*WorldClient) CreateBulk

func (c *WorldClient) CreateBulk(builders ...*WorldCreate) *WorldCreateBulk

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

func (*WorldClient) Delete

func (c *WorldClient) Delete() *WorldDelete

Delete returns a delete builder for World.

func (*WorldClient) DeleteOne

func (c *WorldClient) DeleteOne(w *World) *WorldDeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*WorldClient) DeleteOneID

func (c *WorldClient) DeleteOneID(id int) *WorldDeleteOne

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

func (*WorldClient) Get

func (c *WorldClient) Get(ctx context.Context, id int) (*World, error)

Get returns a World entity by its id.

func (*WorldClient) GetX

func (c *WorldClient) GetX(ctx context.Context, id int) *World

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

func (*WorldClient) Hooks

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

Hooks returns the client hooks.

func (*WorldClient) Intercept

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

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

func (*WorldClient) Interceptors

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

Interceptors returns the client interceptors.

func (*WorldClient) MapCreateBulk

func (c *WorldClient) MapCreateBulk(slice any, setFunc func(*WorldCreate, int)) *WorldCreateBulk

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

func (*WorldClient) Query

func (c *WorldClient) Query() *WorldQuery

Query returns a query builder for World.

func (*WorldClient) Update

func (c *WorldClient) Update() *WorldUpdate

Update returns an update builder for World.

func (*WorldClient) UpdateOne

func (c *WorldClient) UpdateOne(w *World) *WorldUpdateOne

UpdateOne returns an update builder for the given entity.

func (*WorldClient) UpdateOneID

func (c *WorldClient) UpdateOneID(id int) *WorldUpdateOne

UpdateOneID returns an update builder for the given id.

func (*WorldClient) Use

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

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

type WorldCreate

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

WorldCreate is the builder for creating a World entity.

func (*WorldCreate) Exec

func (wc *WorldCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*WorldCreate) ExecX

func (wc *WorldCreate) ExecX(ctx context.Context)

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

func (*WorldCreate) Mutation

func (wc *WorldCreate) Mutation() *WorldMutation

Mutation returns the WorldMutation object of the builder.

func (*WorldCreate) Save

func (wc *WorldCreate) Save(ctx context.Context) (*World, error)

Save creates the World in the database.

func (*WorldCreate) SaveX

func (wc *WorldCreate) SaveX(ctx context.Context) *World

SaveX calls Save and panics if Save returns an error.

func (*WorldCreate) SetCreatedAt

func (wc *WorldCreate) SetCreatedAt(t time.Time) *WorldCreate

SetCreatedAt sets the "created_at" field.

func (*WorldCreate) SetCreatedBy

func (wc *WorldCreate) SetCreatedBy(i int) *WorldCreate

SetCreatedBy sets the "created_by" field.

func (*WorldCreate) SetDeletedAt

func (wc *WorldCreate) SetDeletedAt(t time.Time) *WorldCreate

SetDeletedAt sets the "deleted_at" field.

func (*WorldCreate) SetID

func (wc *WorldCreate) SetID(i int) *WorldCreate

SetID sets the "id" field.

func (*WorldCreate) SetName

func (wc *WorldCreate) SetName(s string) *WorldCreate

SetName sets the "name" field.

func (*WorldCreate) SetNillableCreatedAt

func (wc *WorldCreate) SetNillableCreatedAt(t *time.Time) *WorldCreate

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

func (*WorldCreate) SetNillableDeletedAt

func (wc *WorldCreate) SetNillableDeletedAt(t *time.Time) *WorldCreate

SetNillableDeletedAt sets the "deleted_at" field if the given value is not nil.

func (*WorldCreate) SetNillablePowerBy

func (wc *WorldCreate) SetNillablePowerBy(s *string) *WorldCreate

SetNillablePowerBy sets the "power_by" field if the given value is not nil.

func (*WorldCreate) SetNillableUpdatedAt

func (wc *WorldCreate) SetNillableUpdatedAt(t *time.Time) *WorldCreate

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

func (*WorldCreate) SetNillableUpdatedBy

func (wc *WorldCreate) SetNillableUpdatedBy(i *int) *WorldCreate

SetNillableUpdatedBy sets the "updated_by" field if the given value is not nil.

func (*WorldCreate) SetPowerBy

func (wc *WorldCreate) SetPowerBy(s string) *WorldCreate

SetPowerBy sets the "power_by" field.

func (*WorldCreate) SetTenantID

func (wc *WorldCreate) SetTenantID(i int) *WorldCreate

SetTenantID sets the "tenant_id" field.

func (*WorldCreate) SetUpdatedAt

func (wc *WorldCreate) SetUpdatedAt(t time.Time) *WorldCreate

SetUpdatedAt sets the "updated_at" field.

func (*WorldCreate) SetUpdatedBy

func (wc *WorldCreate) SetUpdatedBy(i int) *WorldCreate

SetUpdatedBy sets the "updated_by" field.

type WorldCreateBulk

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

WorldCreateBulk is the builder for creating many World entities in bulk.

func (*WorldCreateBulk) Exec

func (wcb *WorldCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*WorldCreateBulk) ExecX

func (wcb *WorldCreateBulk) ExecX(ctx context.Context)

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

func (*WorldCreateBulk) Save

func (wcb *WorldCreateBulk) Save(ctx context.Context) ([]*World, error)

Save creates the World entities in the database.

func (*WorldCreateBulk) SaveX

func (wcb *WorldCreateBulk) SaveX(ctx context.Context) []*World

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

type WorldDelete

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

WorldDelete is the builder for deleting a World entity.

func (*WorldDelete) Exec

func (wd *WorldDelete) Exec(ctx context.Context) (int, error)

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

func (*WorldDelete) ExecX

func (wd *WorldDelete) ExecX(ctx context.Context) int

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

func (*WorldDelete) Where

func (wd *WorldDelete) Where(ps ...predicate.World) *WorldDelete

Where appends a list predicates to the WorldDelete builder.

type WorldDeleteOne

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

WorldDeleteOne is the builder for deleting a single World entity.

func (*WorldDeleteOne) Exec

func (wdo *WorldDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*WorldDeleteOne) ExecX

func (wdo *WorldDeleteOne) ExecX(ctx context.Context)

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

func (*WorldDeleteOne) Where

func (wdo *WorldDeleteOne) Where(ps ...predicate.World) *WorldDeleteOne

Where appends a list predicates to the WorldDelete builder.

type WorldFilter

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

WorldFilter provides a generic filtering capability at runtime for WorldQuery.

func (*WorldFilter) Where

func (f *WorldFilter) Where(p entql.P)

Where applies the entql predicate on the query filter.

func (*WorldFilter) WhereCreatedAt

func (f *WorldFilter) WhereCreatedAt(p entql.TimeP)

WhereCreatedAt applies the entql time.Time predicate on the created_at field.

func (*WorldFilter) WhereCreatedBy

func (f *WorldFilter) WhereCreatedBy(p entql.IntP)

WhereCreatedBy applies the entql int predicate on the created_by field.

func (*WorldFilter) WhereDeletedAt

func (f *WorldFilter) WhereDeletedAt(p entql.TimeP)

WhereDeletedAt applies the entql time.Time predicate on the deleted_at field.

func (*WorldFilter) WhereID

func (f *WorldFilter) WhereID(p entql.IntP)

WhereID applies the entql int predicate on the id field.

func (*WorldFilter) WhereName

func (f *WorldFilter) WhereName(p entql.StringP)

WhereName applies the entql string predicate on the name field.

func (*WorldFilter) WherePowerBy

func (f *WorldFilter) WherePowerBy(p entql.StringP)

WherePowerBy applies the entql string predicate on the power_by field.

func (*WorldFilter) WhereTenantID

func (f *WorldFilter) WhereTenantID(p entql.IntP)

WhereTenantID applies the entql int predicate on the tenant_id field.

func (*WorldFilter) WhereUpdatedAt

func (f *WorldFilter) WhereUpdatedAt(p entql.TimeP)

WhereUpdatedAt applies the entql time.Time predicate on the updated_at field.

func (*WorldFilter) WhereUpdatedBy

func (f *WorldFilter) WhereUpdatedBy(p entql.IntP)

WhereUpdatedBy applies the entql int predicate on the updated_by field.

type WorldGroupBy

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

WorldGroupBy is the group-by builder for World entities.

func (*WorldGroupBy) Aggregate

func (wgb *WorldGroupBy) Aggregate(fns ...AggregateFunc) *WorldGroupBy

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

func (*WorldGroupBy) Bool

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

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

func (*WorldGroupBy) BoolX

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

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

func (*WorldGroupBy) Bools

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

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

func (*WorldGroupBy) BoolsX

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

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

func (*WorldGroupBy) Float64

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

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

func (*WorldGroupBy) Float64X

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

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

func (*WorldGroupBy) Float64s

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

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

func (*WorldGroupBy) Float64sX

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

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

func (*WorldGroupBy) Int

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

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

func (*WorldGroupBy) IntX

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

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

func (*WorldGroupBy) Ints

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

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

func (*WorldGroupBy) IntsX

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

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

func (*WorldGroupBy) Scan

func (wgb *WorldGroupBy) Scan(ctx context.Context, v any) error

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

func (*WorldGroupBy) ScanX

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

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

func (*WorldGroupBy) String

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

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

func (*WorldGroupBy) StringX

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

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

func (*WorldGroupBy) Strings

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

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

func (*WorldGroupBy) StringsX

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

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

type WorldMutation

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

WorldMutation represents an operation that mutates the World nodes in the graph.

func (*WorldMutation) AddCreatedBy

func (m *WorldMutation) AddCreatedBy(i int)

AddCreatedBy adds i to the "created_by" field.

func (*WorldMutation) AddField

func (m *WorldMutation) 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 (*WorldMutation) AddTenantID

func (m *WorldMutation) AddTenantID(i int)

AddTenantID adds i to the "tenant_id" field.

func (*WorldMutation) AddUpdatedBy

func (m *WorldMutation) AddUpdatedBy(i int)

AddUpdatedBy adds i to the "updated_by" field.

func (*WorldMutation) AddedCreatedBy

func (m *WorldMutation) AddedCreatedBy() (r int, exists bool)

AddedCreatedBy returns the value that was added to the "created_by" field in this mutation.

func (*WorldMutation) AddedEdges

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

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

func (*WorldMutation) AddedField

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

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

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

func (*WorldMutation) AddedIDs

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

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

func (*WorldMutation) AddedTenantID

func (m *WorldMutation) AddedTenantID() (r int, exists bool)

AddedTenantID returns the value that was added to the "tenant_id" field in this mutation.

func (*WorldMutation) AddedUpdatedBy

func (m *WorldMutation) AddedUpdatedBy() (r int, exists bool)

AddedUpdatedBy returns the value that was added to the "updated_by" field in this mutation.

func (*WorldMutation) ClearDeletedAt

func (m *WorldMutation) ClearDeletedAt()

ClearDeletedAt clears the value of the "deleted_at" field.

func (*WorldMutation) ClearEdge

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

func (m *WorldMutation) 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 (*WorldMutation) ClearPowerBy

func (m *WorldMutation) ClearPowerBy()

ClearPowerBy clears the value of the "power_by" field.

func (*WorldMutation) ClearUpdatedAt

func (m *WorldMutation) ClearUpdatedAt()

ClearUpdatedAt clears the value of the "updated_at" field.

func (*WorldMutation) ClearUpdatedBy

func (m *WorldMutation) ClearUpdatedBy()

ClearUpdatedBy clears the value of the "updated_by" field.

func (*WorldMutation) ClearedEdges

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

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

func (*WorldMutation) ClearedFields

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

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

func (WorldMutation) Client

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

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

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

func (*WorldMutation) CreatedBy

func (m *WorldMutation) CreatedBy() (r int, exists bool)

CreatedBy returns the value of the "created_by" field in the mutation.

func (*WorldMutation) DeletedAt

func (m *WorldMutation) DeletedAt() (r time.Time, exists bool)

DeletedAt returns the value of the "deleted_at" field in the mutation.

func (*WorldMutation) DeletedAtCleared

func (m *WorldMutation) DeletedAtCleared() bool

DeletedAtCleared returns if the "deleted_at" field was cleared in this mutation.

func (*WorldMutation) EdgeCleared

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

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

func (*WorldMutation) Field

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

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

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

func (*WorldMutation) Fields

func (m *WorldMutation) 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 (*WorldMutation) Filter

func (m *WorldMutation) Filter() *WorldFilter

Filter returns an entql.Where implementation to apply filters on the WorldMutation builder.

func (*WorldMutation) ID

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

func (m *WorldMutation) 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 (*WorldMutation) Name

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

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

func (*WorldMutation) OldCreatedAt

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

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

func (m *WorldMutation) OldCreatedBy(ctx context.Context) (v int, err error)

OldCreatedBy returns the old "created_by" field's value of the World entity. If the World 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 (*WorldMutation) OldDeletedAt

func (m *WorldMutation) OldDeletedAt(ctx context.Context) (v time.Time, err error)

OldDeletedAt returns the old "deleted_at" field's value of the World entity. If the World 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 (*WorldMutation) OldField

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

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

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

func (m *WorldMutation) OldPowerBy(ctx context.Context) (v string, err error)

OldPowerBy returns the old "power_by" field's value of the World entity. If the World 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 (*WorldMutation) OldTenantID

func (m *WorldMutation) OldTenantID(ctx context.Context) (v int, err error)

OldTenantID returns the old "tenant_id" field's value of the World entity. If the World 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 (*WorldMutation) OldUpdatedAt

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

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

func (m *WorldMutation) OldUpdatedBy(ctx context.Context) (v int, err error)

OldUpdatedBy returns the old "updated_by" field's value of the World entity. If the World 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 (*WorldMutation) Op

func (m *WorldMutation) Op() Op

Op returns the operation name.

func (*WorldMutation) PowerBy

func (m *WorldMutation) PowerBy() (r string, exists bool)

PowerBy returns the value of the "power_by" field in the mutation.

func (*WorldMutation) PowerByCleared

func (m *WorldMutation) PowerByCleared() bool

PowerByCleared returns if the "power_by" field was cleared in this mutation.

func (*WorldMutation) RemovedEdges

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

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

func (*WorldMutation) RemovedIDs

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

func (m *WorldMutation) ResetCreatedAt()

ResetCreatedAt resets all changes to the "created_at" field.

func (*WorldMutation) ResetCreatedBy

func (m *WorldMutation) ResetCreatedBy()

ResetCreatedBy resets all changes to the "created_by" field.

func (*WorldMutation) ResetDeletedAt

func (m *WorldMutation) ResetDeletedAt()

ResetDeletedAt resets all changes to the "deleted_at" field.

func (*WorldMutation) ResetEdge

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

func (m *WorldMutation) 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 (*WorldMutation) ResetName

func (m *WorldMutation) ResetName()

ResetName resets all changes to the "name" field.

func (*WorldMutation) ResetPowerBy

func (m *WorldMutation) ResetPowerBy()

ResetPowerBy resets all changes to the "power_by" field.

func (*WorldMutation) ResetTenantID

func (m *WorldMutation) ResetTenantID()

ResetTenantID resets all changes to the "tenant_id" field.

func (*WorldMutation) ResetUpdatedAt

func (m *WorldMutation) ResetUpdatedAt()

ResetUpdatedAt resets all changes to the "updated_at" field.

func (*WorldMutation) ResetUpdatedBy

func (m *WorldMutation) ResetUpdatedBy()

ResetUpdatedBy resets all changes to the "updated_by" field.

func (*WorldMutation) SetCreatedAt

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

SetCreatedAt sets the "created_at" field.

func (*WorldMutation) SetCreatedBy

func (m *WorldMutation) SetCreatedBy(i int)

SetCreatedBy sets the "created_by" field.

func (*WorldMutation) SetDeletedAt

func (m *WorldMutation) SetDeletedAt(t time.Time)

SetDeletedAt sets the "deleted_at" field.

func (*WorldMutation) SetField

func (m *WorldMutation) 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 (*WorldMutation) SetID

func (m *WorldMutation) SetID(id int)

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

func (*WorldMutation) SetName

func (m *WorldMutation) SetName(s string)

SetName sets the "name" field.

func (*WorldMutation) SetOp

func (m *WorldMutation) SetOp(op Op)

SetOp allows setting the mutation operation.

func (*WorldMutation) SetPowerBy

func (m *WorldMutation) SetPowerBy(s string)

SetPowerBy sets the "power_by" field.

func (*WorldMutation) SetTenantID

func (m *WorldMutation) SetTenantID(i int)

SetTenantID sets the "tenant_id" field.

func (*WorldMutation) SetUpdatedAt

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

SetUpdatedAt sets the "updated_at" field.

func (*WorldMutation) SetUpdatedBy

func (m *WorldMutation) SetUpdatedBy(i int)

SetUpdatedBy sets the "updated_by" field.

func (*WorldMutation) TenantID

func (m *WorldMutation) TenantID() (r int, exists bool)

TenantID returns the value of the "tenant_id" field in the mutation.

func (WorldMutation) Tx

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

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

func (*WorldMutation) Type

func (m *WorldMutation) Type() string

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

func (*WorldMutation) UpdatedAt

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

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

func (*WorldMutation) UpdatedAtCleared

func (m *WorldMutation) UpdatedAtCleared() bool

UpdatedAtCleared returns if the "updated_at" field was cleared in this mutation.

func (*WorldMutation) UpdatedBy

func (m *WorldMutation) UpdatedBy() (r int, exists bool)

UpdatedBy returns the value of the "updated_by" field in the mutation.

func (*WorldMutation) UpdatedByCleared

func (m *WorldMutation) UpdatedByCleared() bool

UpdatedByCleared returns if the "updated_by" field was cleared in this mutation.

func (*WorldMutation) Where

func (m *WorldMutation) Where(ps ...predicate.World)

Where appends a list predicates to the WorldMutation builder.

func (*WorldMutation) WhereP

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

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

type WorldQuery

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

WorldQuery is the builder for querying World entities.

func (*WorldQuery) Aggregate

func (wq *WorldQuery) Aggregate(fns ...AggregateFunc) *WorldSelect

Aggregate returns a WorldSelect configured with the given aggregations.

func (*WorldQuery) All

func (wq *WorldQuery) All(ctx context.Context) ([]*World, error)

All executes the query and returns a list of Worlds.

func (*WorldQuery) AllX

func (wq *WorldQuery) AllX(ctx context.Context) []*World

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

func (*WorldQuery) Clone

func (wq *WorldQuery) Clone() *WorldQuery

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

func (*WorldQuery) Count

func (wq *WorldQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*WorldQuery) CountX

func (wq *WorldQuery) CountX(ctx context.Context) int

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

func (*WorldQuery) Exist

func (wq *WorldQuery) Exist(ctx context.Context) (bool, error)

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

func (*WorldQuery) ExistX

func (wq *WorldQuery) ExistX(ctx context.Context) bool

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

func (*WorldQuery) Filter

func (wq *WorldQuery) Filter() *WorldFilter

Filter returns a Filter implementation to apply filters on the WorldQuery builder.

func (*WorldQuery) First

func (wq *WorldQuery) First(ctx context.Context) (*World, error)

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

func (*WorldQuery) FirstID

func (wq *WorldQuery) FirstID(ctx context.Context) (id int, err error)

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

func (*WorldQuery) FirstIDX

func (wq *WorldQuery) FirstIDX(ctx context.Context) int

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

func (*WorldQuery) FirstX

func (wq *WorldQuery) FirstX(ctx context.Context) *World

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

func (*WorldQuery) GroupBy

func (wq *WorldQuery) GroupBy(field string, fields ...string) *WorldGroupBy

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

client.World.Query().
	GroupBy(world.FieldCreatedBy).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*WorldQuery) IDs

func (wq *WorldQuery) IDs(ctx context.Context) (ids []int, err error)

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

func (*WorldQuery) IDsX

func (wq *WorldQuery) IDsX(ctx context.Context) []int

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

func (*WorldQuery) Limit

func (wq *WorldQuery) Limit(limit int) *WorldQuery

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

func (*WorldQuery) Offset

func (wq *WorldQuery) Offset(offset int) *WorldQuery

Offset to start from.

func (*WorldQuery) Only

func (wq *WorldQuery) Only(ctx context.Context) (*World, error)

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

func (*WorldQuery) OnlyID

func (wq *WorldQuery) OnlyID(ctx context.Context) (id int, err error)

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

func (*WorldQuery) OnlyIDX

func (wq *WorldQuery) OnlyIDX(ctx context.Context) int

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

func (*WorldQuery) OnlyX

func (wq *WorldQuery) OnlyX(ctx context.Context) *World

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

func (*WorldQuery) Order

func (wq *WorldQuery) Order(o ...world.OrderOption) *WorldQuery

Order specifies how the records should be ordered.

func (*WorldQuery) Select

func (wq *WorldQuery) Select(fields ...string) *WorldSelect

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

client.World.Query().
	Select(world.FieldCreatedBy).
	Scan(ctx, &v)

func (*WorldQuery) Unique

func (wq *WorldQuery) Unique(unique bool) *WorldQuery

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

func (wq *WorldQuery) Where(ps ...predicate.World) *WorldQuery

Where adds a new predicate for the WorldQuery builder.

type WorldSelect

type WorldSelect struct {
	*WorldQuery
	// contains filtered or unexported fields
}

WorldSelect is the builder for selecting fields of World entities.

func (*WorldSelect) Aggregate

func (ws *WorldSelect) Aggregate(fns ...AggregateFunc) *WorldSelect

Aggregate adds the given aggregation functions to the selector query.

func (*WorldSelect) Bool

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

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

func (*WorldSelect) BoolX

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

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

func (*WorldSelect) Bools

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

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

func (*WorldSelect) BoolsX

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

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

func (*WorldSelect) Float64

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

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

func (*WorldSelect) Float64X

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

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

func (*WorldSelect) Float64s

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

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

func (*WorldSelect) Float64sX

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

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

func (*WorldSelect) Int

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

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

func (*WorldSelect) IntX

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

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

func (*WorldSelect) Ints

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

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

func (*WorldSelect) IntsX

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

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

func (*WorldSelect) Scan

func (ws *WorldSelect) Scan(ctx context.Context, v any) error

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

func (*WorldSelect) ScanX

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

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

func (*WorldSelect) String

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

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

func (*WorldSelect) StringX

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

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

func (*WorldSelect) Strings

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

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

func (*WorldSelect) StringsX

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

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

type WorldUpdate

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

WorldUpdate is the builder for updating World entities.

func (*WorldUpdate) AddUpdatedBy

func (wu *WorldUpdate) AddUpdatedBy(i int) *WorldUpdate

AddUpdatedBy adds i to the "updated_by" field.

func (*WorldUpdate) ClearDeletedAt

func (wu *WorldUpdate) ClearDeletedAt() *WorldUpdate

ClearDeletedAt clears the value of the "deleted_at" field.

func (*WorldUpdate) ClearPowerBy

func (wu *WorldUpdate) ClearPowerBy() *WorldUpdate

ClearPowerBy clears the value of the "power_by" field.

func (*WorldUpdate) ClearUpdatedAt

func (wu *WorldUpdate) ClearUpdatedAt() *WorldUpdate

ClearUpdatedAt clears the value of the "updated_at" field.

func (*WorldUpdate) ClearUpdatedBy

func (wu *WorldUpdate) ClearUpdatedBy() *WorldUpdate

ClearUpdatedBy clears the value of the "updated_by" field.

func (*WorldUpdate) Exec

func (wu *WorldUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*WorldUpdate) ExecX

func (wu *WorldUpdate) ExecX(ctx context.Context)

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

func (*WorldUpdate) Mutation

func (wu *WorldUpdate) Mutation() *WorldMutation

Mutation returns the WorldMutation object of the builder.

func (*WorldUpdate) Save

func (wu *WorldUpdate) Save(ctx context.Context) (int, error)

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

func (*WorldUpdate) SaveX

func (wu *WorldUpdate) SaveX(ctx context.Context) int

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

func (*WorldUpdate) SetDeletedAt

func (wu *WorldUpdate) SetDeletedAt(t time.Time) *WorldUpdate

SetDeletedAt sets the "deleted_at" field.

func (*WorldUpdate) SetName

func (wu *WorldUpdate) SetName(s string) *WorldUpdate

SetName sets the "name" field.

func (*WorldUpdate) SetNillableDeletedAt

func (wu *WorldUpdate) SetNillableDeletedAt(t *time.Time) *WorldUpdate

SetNillableDeletedAt sets the "deleted_at" field if the given value is not nil.

func (*WorldUpdate) SetNillableName

func (wu *WorldUpdate) SetNillableName(s *string) *WorldUpdate

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

func (*WorldUpdate) SetNillablePowerBy

func (wu *WorldUpdate) SetNillablePowerBy(s *string) *WorldUpdate

SetNillablePowerBy sets the "power_by" field if the given value is not nil.

func (*WorldUpdate) SetNillableUpdatedAt

func (wu *WorldUpdate) SetNillableUpdatedAt(t *time.Time) *WorldUpdate

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

func (*WorldUpdate) SetNillableUpdatedBy

func (wu *WorldUpdate) SetNillableUpdatedBy(i *int) *WorldUpdate

SetNillableUpdatedBy sets the "updated_by" field if the given value is not nil.

func (*WorldUpdate) SetPowerBy

func (wu *WorldUpdate) SetPowerBy(s string) *WorldUpdate

SetPowerBy sets the "power_by" field.

func (*WorldUpdate) SetUpdatedAt

func (wu *WorldUpdate) SetUpdatedAt(t time.Time) *WorldUpdate

SetUpdatedAt sets the "updated_at" field.

func (*WorldUpdate) SetUpdatedBy

func (wu *WorldUpdate) SetUpdatedBy(i int) *WorldUpdate

SetUpdatedBy sets the "updated_by" field.

func (*WorldUpdate) Where

func (wu *WorldUpdate) Where(ps ...predicate.World) *WorldUpdate

Where appends a list predicates to the WorldUpdate builder.

type WorldUpdateOne

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

WorldUpdateOne is the builder for updating a single World entity.

func (*WorldUpdateOne) AddUpdatedBy

func (wuo *WorldUpdateOne) AddUpdatedBy(i int) *WorldUpdateOne

AddUpdatedBy adds i to the "updated_by" field.

func (*WorldUpdateOne) ClearDeletedAt

func (wuo *WorldUpdateOne) ClearDeletedAt() *WorldUpdateOne

ClearDeletedAt clears the value of the "deleted_at" field.

func (*WorldUpdateOne) ClearPowerBy

func (wuo *WorldUpdateOne) ClearPowerBy() *WorldUpdateOne

ClearPowerBy clears the value of the "power_by" field.

func (*WorldUpdateOne) ClearUpdatedAt

func (wuo *WorldUpdateOne) ClearUpdatedAt() *WorldUpdateOne

ClearUpdatedAt clears the value of the "updated_at" field.

func (*WorldUpdateOne) ClearUpdatedBy

func (wuo *WorldUpdateOne) ClearUpdatedBy() *WorldUpdateOne

ClearUpdatedBy clears the value of the "updated_by" field.

func (*WorldUpdateOne) Exec

func (wuo *WorldUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*WorldUpdateOne) ExecX

func (wuo *WorldUpdateOne) ExecX(ctx context.Context)

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

func (*WorldUpdateOne) Mutation

func (wuo *WorldUpdateOne) Mutation() *WorldMutation

Mutation returns the WorldMutation object of the builder.

func (*WorldUpdateOne) Save

func (wuo *WorldUpdateOne) Save(ctx context.Context) (*World, error)

Save executes the query and returns the updated World entity.

func (*WorldUpdateOne) SaveX

func (wuo *WorldUpdateOne) SaveX(ctx context.Context) *World

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

func (*WorldUpdateOne) Select

func (wuo *WorldUpdateOne) Select(field string, fields ...string) *WorldUpdateOne

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

func (*WorldUpdateOne) SetDeletedAt

func (wuo *WorldUpdateOne) SetDeletedAt(t time.Time) *WorldUpdateOne

SetDeletedAt sets the "deleted_at" field.

func (*WorldUpdateOne) SetName

func (wuo *WorldUpdateOne) SetName(s string) *WorldUpdateOne

SetName sets the "name" field.

func (*WorldUpdateOne) SetNillableDeletedAt

func (wuo *WorldUpdateOne) SetNillableDeletedAt(t *time.Time) *WorldUpdateOne

SetNillableDeletedAt sets the "deleted_at" field if the given value is not nil.

func (*WorldUpdateOne) SetNillableName

func (wuo *WorldUpdateOne) SetNillableName(s *string) *WorldUpdateOne

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

func (*WorldUpdateOne) SetNillablePowerBy

func (wuo *WorldUpdateOne) SetNillablePowerBy(s *string) *WorldUpdateOne

SetNillablePowerBy sets the "power_by" field if the given value is not nil.

func (*WorldUpdateOne) SetNillableUpdatedAt

func (wuo *WorldUpdateOne) SetNillableUpdatedAt(t *time.Time) *WorldUpdateOne

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

func (*WorldUpdateOne) SetNillableUpdatedBy

func (wuo *WorldUpdateOne) SetNillableUpdatedBy(i *int) *WorldUpdateOne

SetNillableUpdatedBy sets the "updated_by" field if the given value is not nil.

func (*WorldUpdateOne) SetPowerBy

func (wuo *WorldUpdateOne) SetPowerBy(s string) *WorldUpdateOne

SetPowerBy sets the "power_by" field.

func (*WorldUpdateOne) SetUpdatedAt

func (wuo *WorldUpdateOne) SetUpdatedAt(t time.Time) *WorldUpdateOne

SetUpdatedAt sets the "updated_at" field.

func (*WorldUpdateOne) SetUpdatedBy

func (wuo *WorldUpdateOne) SetUpdatedBy(i int) *WorldUpdateOne

SetUpdatedBy sets the "updated_by" field.

func (*WorldUpdateOne) Where

func (wuo *WorldUpdateOne) Where(ps ...predicate.World) *WorldUpdateOne

Where appends a list predicates to the WorldUpdate builder.

type Worlds

type Worlds []*World

Worlds is a parsable slice of World.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL