ent

package
v0.0.0-...-ad56753 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2024 License: MIT 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.
	TypePost       = "Post"
	TypeTenant     = "Tenant"
	TypeTenantConn = "TenantConn"
)

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
	// Post is the client for interacting with the Post builders.
	Post *PostClient
	// Tenant is the client for interacting with the Tenant builders.
	Tenant *TenantClient
	// TenantConn is the client for interacting with the TenantConn builders.
	TenantConn *TenantConnClient
	// 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().
	Post.
	Query().
	Count(ctx)

func (*Client) Intercept

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

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

func (*Client) Mutate

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

Mutate implements the ent.Mutator interface.

func (*Client) Tx

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

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

func (*Client) Use

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

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

type CommitFunc

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

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

func (CommitFunc) Commit

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

Commit calls f(ctx, m).

type CommitHook

type CommitHook func(Committer) Committer

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

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

type Committer

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

Committer is the interface that wraps the Commit method.

type ConstraintError

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

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

func (ConstraintError) Error

func (e ConstraintError) Error() string

Error implements the error interface.

func (*ConstraintError) Unwrap

func (e *ConstraintError) Unwrap() error

Unwrap implements the errors.Wrapper interface.

type Hook

type Hook = ent.Hook

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

type InterceptFunc

type InterceptFunc = ent.InterceptFunc

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

type Interceptor

type Interceptor = ent.Interceptor

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

type 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 Post

type Post struct {

	// ID of the ent.
	ID int `json:"id,omitempty"`
	// TenantID holds the value of the "tenant_id" field.
	TenantID *sql.NullString `json:"tenant_id,omitempty"`
	// Title holds the value of the "title" field.
	Title string `json:"title,omitempty"`
	// Description holds the value of the "description" field.
	Description string `json:"description,omitempty"`
	// Dsn holds the value of the "dsn" field.
	Dsn string `json:"dsn,omitempty"`
	// contains filtered or unexported fields
}

Post is the model entity for the Post schema.

func (*Post) String

func (po *Post) String() string

String implements the fmt.Stringer.

func (*Post) Unwrap

func (po *Post) Unwrap() *Post

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

func (po *Post) Update() *PostUpdateOne

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

func (*Post) Value

func (po *Post) Value(name string) (ent.Value, error)

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

type PostClient

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

PostClient is a client for the Post schema.

func NewPostClient

func NewPostClient(c config) *PostClient

NewPostClient returns a client for the Post from the given config.

func (*PostClient) Create

func (c *PostClient) Create() *PostCreate

Create returns a builder for creating a Post entity.

func (*PostClient) CreateBulk

func (c *PostClient) CreateBulk(builders ...*PostCreate) *PostCreateBulk

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

func (*PostClient) Delete

func (c *PostClient) Delete() *PostDelete

Delete returns a delete builder for Post.

func (*PostClient) DeleteOne

func (c *PostClient) DeleteOne(po *Post) *PostDeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*PostClient) DeleteOneID

func (c *PostClient) DeleteOneID(id int) *PostDeleteOne

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

func (*PostClient) Get

func (c *PostClient) Get(ctx context.Context, id int) (*Post, error)

Get returns a Post entity by its id.

func (*PostClient) GetX

func (c *PostClient) GetX(ctx context.Context, id int) *Post

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

func (*PostClient) Hooks

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

Hooks returns the client hooks.

func (*PostClient) Intercept

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

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

func (*PostClient) Interceptors

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

Interceptors returns the client interceptors.

func (*PostClient) MapCreateBulk

func (c *PostClient) MapCreateBulk(slice any, setFunc func(*PostCreate, int)) *PostCreateBulk

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 (*PostClient) Query

func (c *PostClient) Query() *PostQuery

Query returns a query builder for Post.

func (*PostClient) Update

func (c *PostClient) Update() *PostUpdate

Update returns an update builder for Post.

func (*PostClient) UpdateOne

func (c *PostClient) UpdateOne(po *Post) *PostUpdateOne

UpdateOne returns an update builder for the given entity.

func (*PostClient) UpdateOneID

func (c *PostClient) UpdateOneID(id int) *PostUpdateOne

UpdateOneID returns an update builder for the given id.

func (*PostClient) Use

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

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

type PostCreate

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

PostCreate is the builder for creating a Post entity.

func (*PostCreate) Exec

func (pc *PostCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*PostCreate) ExecX

func (pc *PostCreate) ExecX(ctx context.Context)

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

func (*PostCreate) Mutation

func (pc *PostCreate) Mutation() *PostMutation

Mutation returns the PostMutation object of the builder.

func (*PostCreate) OnConflict

func (pc *PostCreate) OnConflict(opts ...sql.ConflictOption) *PostUpsertOne

OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause of the `INSERT` statement. For example:

client.Post.Create().
	SetTenantID(v).
	OnConflict(
		// Update the row with the new values
		// the was proposed for insertion.
		sql.ResolveWithNewValues(),
	).
	// Override some of the fields with custom
	// update values.
	Update(func(u *ent.PostUpsert) {
		SetTenantID(v+v).
	}).
	Exec(ctx)

func (*PostCreate) OnConflictColumns

func (pc *PostCreate) OnConflictColumns(columns ...string) *PostUpsertOne

OnConflictColumns calls `OnConflict` and configures the columns as conflict target. Using this option is equivalent to using:

client.Post.Create().
	OnConflict(sql.ConflictColumns(columns...)).
	Exec(ctx)

func (*PostCreate) Save

func (pc *PostCreate) Save(ctx context.Context) (*Post, error)

Save creates the Post in the database.

func (*PostCreate) SaveX

func (pc *PostCreate) SaveX(ctx context.Context) *Post

SaveX calls Save and panics if Save returns an error.

func (*PostCreate) SetDescription

func (pc *PostCreate) SetDescription(s string) *PostCreate

SetDescription sets the "description" field.

func (*PostCreate) SetDsn

func (pc *PostCreate) SetDsn(s string) *PostCreate

SetDsn sets the "dsn" field.

func (*PostCreate) SetID

func (pc *PostCreate) SetID(i int) *PostCreate

SetID sets the "id" field.

func (*PostCreate) SetNillableDescription

func (pc *PostCreate) SetNillableDescription(s *string) *PostCreate

SetNillableDescription sets the "description" field if the given value is not nil.

func (*PostCreate) SetNillableDsn

func (pc *PostCreate) SetNillableDsn(s *string) *PostCreate

SetNillableDsn sets the "dsn" field if the given value is not nil.

func (*PostCreate) SetTenantID

func (pc *PostCreate) SetTenantID(ss *sql.NullString) *PostCreate

SetTenantID sets the "tenant_id" field.

func (*PostCreate) SetTitle

func (pc *PostCreate) SetTitle(s string) *PostCreate

SetTitle sets the "title" field.

type PostCreateBulk

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

PostCreateBulk is the builder for creating many Post entities in bulk.

func (*PostCreateBulk) Exec

func (pcb *PostCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*PostCreateBulk) ExecX

func (pcb *PostCreateBulk) ExecX(ctx context.Context)

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

func (*PostCreateBulk) OnConflict

func (pcb *PostCreateBulk) OnConflict(opts ...sql.ConflictOption) *PostUpsertBulk

OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause of the `INSERT` statement. For example:

client.Post.CreateBulk(builders...).
	OnConflict(
		// Update the row with the new values
		// the was proposed for insertion.
		sql.ResolveWithNewValues(),
	).
	// Override some of the fields with custom
	// update values.
	Update(func(u *ent.PostUpsert) {
		SetTenantID(v+v).
	}).
	Exec(ctx)

func (*PostCreateBulk) OnConflictColumns

func (pcb *PostCreateBulk) OnConflictColumns(columns ...string) *PostUpsertBulk

OnConflictColumns calls `OnConflict` and configures the columns as conflict target. Using this option is equivalent to using:

client.Post.Create().
	OnConflict(sql.ConflictColumns(columns...)).
	Exec(ctx)

func (*PostCreateBulk) Save

func (pcb *PostCreateBulk) Save(ctx context.Context) ([]*Post, error)

Save creates the Post entities in the database.

func (*PostCreateBulk) SaveX

func (pcb *PostCreateBulk) SaveX(ctx context.Context) []*Post

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

type PostDelete

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

PostDelete is the builder for deleting a Post entity.

func (*PostDelete) Exec

func (pd *PostDelete) Exec(ctx context.Context) (int, error)

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

func (*PostDelete) ExecX

func (pd *PostDelete) ExecX(ctx context.Context) int

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

func (*PostDelete) Where

func (pd *PostDelete) Where(ps ...predicate.Post) *PostDelete

Where appends a list predicates to the PostDelete builder.

type PostDeleteOne

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

PostDeleteOne is the builder for deleting a single Post entity.

func (*PostDeleteOne) Exec

func (pdo *PostDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*PostDeleteOne) ExecX

func (pdo *PostDeleteOne) ExecX(ctx context.Context)

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

func (*PostDeleteOne) Where

func (pdo *PostDeleteOne) Where(ps ...predicate.Post) *PostDeleteOne

Where appends a list predicates to the PostDelete builder.

type PostGroupBy

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

PostGroupBy is the group-by builder for Post entities.

func (*PostGroupBy) Aggregate

func (pgb *PostGroupBy) Aggregate(fns ...AggregateFunc) *PostGroupBy

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

func (*PostGroupBy) Bool

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

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

func (*PostGroupBy) BoolX

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

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

func (*PostGroupBy) Bools

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

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

func (*PostGroupBy) BoolsX

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

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

func (*PostGroupBy) Float64

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

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

func (*PostGroupBy) Float64X

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

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

func (*PostGroupBy) Float64s

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

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

func (*PostGroupBy) Float64sX

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

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

func (*PostGroupBy) Int

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

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

func (*PostGroupBy) IntX

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

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

func (*PostGroupBy) Ints

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

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

func (*PostGroupBy) IntsX

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

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

func (*PostGroupBy) Scan

func (pgb *PostGroupBy) Scan(ctx context.Context, v any) error

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

func (*PostGroupBy) ScanX

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

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

func (*PostGroupBy) String

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

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

func (*PostGroupBy) StringX

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

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

func (*PostGroupBy) Strings

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

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

func (*PostGroupBy) StringsX

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

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

type PostMutation

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

PostMutation represents an operation that mutates the Post nodes in the graph.

func (*PostMutation) AddField

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

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

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

func (*PostMutation) AddedField

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

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

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

func (*PostMutation) AddedIDs

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

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

func (*PostMutation) ClearDescription

func (m *PostMutation) ClearDescription()

ClearDescription clears the value of the "description" field.

func (*PostMutation) ClearDsn

func (m *PostMutation) ClearDsn()

ClearDsn clears the value of the "dsn" field.

func (*PostMutation) ClearEdge

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

func (m *PostMutation) 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 (*PostMutation) ClearTenantID

func (m *PostMutation) ClearTenantID()

ClearTenantID clears the value of the "tenant_id" field.

func (*PostMutation) ClearedEdges

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

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

func (*PostMutation) ClearedFields

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

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

func (PostMutation) Client

func (m PostMutation) 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 (*PostMutation) Description

func (m *PostMutation) Description() (r string, exists bool)

Description returns the value of the "description" field in the mutation.

func (*PostMutation) DescriptionCleared

func (m *PostMutation) DescriptionCleared() bool

DescriptionCleared returns if the "description" field was cleared in this mutation.

func (*PostMutation) Dsn

func (m *PostMutation) Dsn() (r string, exists bool)

Dsn returns the value of the "dsn" field in the mutation.

func (*PostMutation) DsnCleared

func (m *PostMutation) DsnCleared() bool

DsnCleared returns if the "dsn" field was cleared in this mutation.

func (*PostMutation) EdgeCleared

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

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

func (*PostMutation) Field

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

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

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

func (*PostMutation) Fields

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

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

func (m *PostMutation) 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 (*PostMutation) OldDescription

func (m *PostMutation) OldDescription(ctx context.Context) (v string, err error)

OldDescription returns the old "description" field's value of the Post entity. If the Post 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 (*PostMutation) OldDsn

func (m *PostMutation) OldDsn(ctx context.Context) (v string, err error)

OldDsn returns the old "dsn" field's value of the Post entity. If the Post 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 (*PostMutation) OldField

func (m *PostMutation) 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 (*PostMutation) OldTenantID

func (m *PostMutation) OldTenantID(ctx context.Context) (v *sql.NullString, err error)

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

func (m *PostMutation) OldTitle(ctx context.Context) (v string, err error)

OldTitle returns the old "title" field's value of the Post entity. If the Post 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 (*PostMutation) Op

func (m *PostMutation) Op() Op

Op returns the operation name.

func (*PostMutation) RemovedEdges

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

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

func (*PostMutation) RemovedIDs

func (m *PostMutation) 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 (*PostMutation) ResetDescription

func (m *PostMutation) ResetDescription()

ResetDescription resets all changes to the "description" field.

func (*PostMutation) ResetDsn

func (m *PostMutation) ResetDsn()

ResetDsn resets all changes to the "dsn" field.

func (*PostMutation) ResetEdge

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

func (m *PostMutation) 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 (*PostMutation) ResetTenantID

func (m *PostMutation) ResetTenantID()

ResetTenantID resets all changes to the "tenant_id" field.

func (*PostMutation) ResetTitle

func (m *PostMutation) ResetTitle()

ResetTitle resets all changes to the "title" field.

func (*PostMutation) SetDescription

func (m *PostMutation) SetDescription(s string)

SetDescription sets the "description" field.

func (*PostMutation) SetDsn

func (m *PostMutation) SetDsn(s string)

SetDsn sets the "dsn" field.

func (*PostMutation) SetField

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

func (m *PostMutation) SetID(id int)

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

func (*PostMutation) SetOp

func (m *PostMutation) SetOp(op Op)

SetOp allows setting the mutation operation.

func (*PostMutation) SetTenantID

func (m *PostMutation) SetTenantID(ss *sql.NullString)

SetTenantID sets the "tenant_id" field.

func (*PostMutation) SetTitle

func (m *PostMutation) SetTitle(s string)

SetTitle sets the "title" field.

func (*PostMutation) TenantID

func (m *PostMutation) TenantID() (r *sql.NullString, exists bool)

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

func (*PostMutation) TenantIDCleared

func (m *PostMutation) TenantIDCleared() bool

TenantIDCleared returns if the "tenant_id" field was cleared in this mutation.

func (*PostMutation) Title

func (m *PostMutation) Title() (r string, exists bool)

Title returns the value of the "title" field in the mutation.

func (PostMutation) Tx

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

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

func (*PostMutation) Type

func (m *PostMutation) Type() string

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

func (*PostMutation) Where

func (m *PostMutation) Where(ps ...predicate.Post)

Where appends a list predicates to the PostMutation builder.

func (*PostMutation) WhereP

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

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

type PostQuery

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

PostQuery is the builder for querying Post entities.

func (*PostQuery) Aggregate

func (pq *PostQuery) Aggregate(fns ...AggregateFunc) *PostSelect

Aggregate returns a PostSelect configured with the given aggregations.

func (*PostQuery) All

func (pq *PostQuery) All(ctx context.Context) ([]*Post, error)

All executes the query and returns a list of Posts.

func (*PostQuery) AllX

func (pq *PostQuery) AllX(ctx context.Context) []*Post

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

func (*PostQuery) Clone

func (pq *PostQuery) Clone() *PostQuery

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

func (*PostQuery) Count

func (pq *PostQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*PostQuery) CountX

func (pq *PostQuery) CountX(ctx context.Context) int

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

func (*PostQuery) Exist

func (pq *PostQuery) Exist(ctx context.Context) (bool, error)

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

func (*PostQuery) ExistX

func (pq *PostQuery) ExistX(ctx context.Context) bool

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

func (*PostQuery) First

func (pq *PostQuery) First(ctx context.Context) (*Post, error)

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

func (*PostQuery) FirstID

func (pq *PostQuery) FirstID(ctx context.Context) (id int, err error)

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

func (*PostQuery) FirstIDX

func (pq *PostQuery) FirstIDX(ctx context.Context) int

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

func (*PostQuery) FirstX

func (pq *PostQuery) FirstX(ctx context.Context) *Post

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

func (*PostQuery) GroupBy

func (pq *PostQuery) GroupBy(field string, fields ...string) *PostGroupBy

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 {
	TenantID *sql.NullString `json:"tenant_id,omitempty"`
	Count int `json:"count,omitempty"`
}

client.Post.Query().
	GroupBy(post.FieldTenantID).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*PostQuery) IDs

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

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

func (*PostQuery) IDsX

func (pq *PostQuery) IDsX(ctx context.Context) []int

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

func (*PostQuery) Limit

func (pq *PostQuery) Limit(limit int) *PostQuery

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

func (*PostQuery) Offset

func (pq *PostQuery) Offset(offset int) *PostQuery

Offset to start from.

func (*PostQuery) Only

func (pq *PostQuery) Only(ctx context.Context) (*Post, error)

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

func (*PostQuery) OnlyID

func (pq *PostQuery) OnlyID(ctx context.Context) (id int, err error)

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

func (*PostQuery) OnlyIDX

func (pq *PostQuery) OnlyIDX(ctx context.Context) int

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

func (*PostQuery) OnlyX

func (pq *PostQuery) OnlyX(ctx context.Context) *Post

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

func (*PostQuery) Order

func (pq *PostQuery) Order(o ...post.OrderOption) *PostQuery

Order specifies how the records should be ordered.

func (*PostQuery) Select

func (pq *PostQuery) Select(fields ...string) *PostSelect

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 {
	TenantID *sql.NullString `json:"tenant_id,omitempty"`
}

client.Post.Query().
	Select(post.FieldTenantID).
	Scan(ctx, &v)

func (*PostQuery) Unique

func (pq *PostQuery) Unique(unique bool) *PostQuery

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

func (pq *PostQuery) Where(ps ...predicate.Post) *PostQuery

Where adds a new predicate for the PostQuery builder.

type PostSelect

type PostSelect struct {
	*PostQuery
	// contains filtered or unexported fields
}

PostSelect is the builder for selecting fields of Post entities.

func (*PostSelect) Aggregate

func (ps *PostSelect) Aggregate(fns ...AggregateFunc) *PostSelect

Aggregate adds the given aggregation functions to the selector query.

func (*PostSelect) Bool

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

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

func (*PostSelect) BoolX

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

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

func (*PostSelect) Bools

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

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

func (*PostSelect) BoolsX

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

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

func (*PostSelect) Float64

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

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

func (*PostSelect) Float64X

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

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

func (*PostSelect) Float64s

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

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

func (*PostSelect) Float64sX

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

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

func (*PostSelect) Int

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

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

func (*PostSelect) IntX

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

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

func (*PostSelect) Ints

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

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

func (*PostSelect) IntsX

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

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

func (*PostSelect) Scan

func (ps *PostSelect) Scan(ctx context.Context, v any) error

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

func (*PostSelect) ScanX

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

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

func (*PostSelect) String

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

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

func (*PostSelect) StringX

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

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

func (*PostSelect) Strings

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

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

func (*PostSelect) StringsX

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

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

type PostUpdate

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

PostUpdate is the builder for updating Post entities.

func (*PostUpdate) ClearDescription

func (pu *PostUpdate) ClearDescription() *PostUpdate

ClearDescription clears the value of the "description" field.

func (*PostUpdate) ClearDsn

func (pu *PostUpdate) ClearDsn() *PostUpdate

ClearDsn clears the value of the "dsn" field.

func (*PostUpdate) ClearTenantID

func (pu *PostUpdate) ClearTenantID() *PostUpdate

ClearTenantID clears the value of the "tenant_id" field.

func (*PostUpdate) Exec

func (pu *PostUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*PostUpdate) ExecX

func (pu *PostUpdate) ExecX(ctx context.Context)

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

func (*PostUpdate) Mutation

func (pu *PostUpdate) Mutation() *PostMutation

Mutation returns the PostMutation object of the builder.

func (*PostUpdate) Save

func (pu *PostUpdate) Save(ctx context.Context) (int, error)

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

func (*PostUpdate) SaveX

func (pu *PostUpdate) SaveX(ctx context.Context) int

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

func (*PostUpdate) SetDescription

func (pu *PostUpdate) SetDescription(s string) *PostUpdate

SetDescription sets the "description" field.

func (*PostUpdate) SetDsn

func (pu *PostUpdate) SetDsn(s string) *PostUpdate

SetDsn sets the "dsn" field.

func (*PostUpdate) SetNillableDescription

func (pu *PostUpdate) SetNillableDescription(s *string) *PostUpdate

SetNillableDescription sets the "description" field if the given value is not nil.

func (*PostUpdate) SetNillableDsn

func (pu *PostUpdate) SetNillableDsn(s *string) *PostUpdate

SetNillableDsn sets the "dsn" field if the given value is not nil.

func (*PostUpdate) SetTenantID

func (pu *PostUpdate) SetTenantID(ss *sql.NullString) *PostUpdate

SetTenantID sets the "tenant_id" field.

func (*PostUpdate) SetTitle

func (pu *PostUpdate) SetTitle(s string) *PostUpdate

SetTitle sets the "title" field.

func (*PostUpdate) Where

func (pu *PostUpdate) Where(ps ...predicate.Post) *PostUpdate

Where appends a list predicates to the PostUpdate builder.

type PostUpdateOne

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

PostUpdateOne is the builder for updating a single Post entity.

func (*PostUpdateOne) ClearDescription

func (puo *PostUpdateOne) ClearDescription() *PostUpdateOne

ClearDescription clears the value of the "description" field.

func (*PostUpdateOne) ClearDsn

func (puo *PostUpdateOne) ClearDsn() *PostUpdateOne

ClearDsn clears the value of the "dsn" field.

func (*PostUpdateOne) ClearTenantID

func (puo *PostUpdateOne) ClearTenantID() *PostUpdateOne

ClearTenantID clears the value of the "tenant_id" field.

func (*PostUpdateOne) Exec

func (puo *PostUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*PostUpdateOne) ExecX

func (puo *PostUpdateOne) ExecX(ctx context.Context)

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

func (*PostUpdateOne) Mutation

func (puo *PostUpdateOne) Mutation() *PostMutation

Mutation returns the PostMutation object of the builder.

func (*PostUpdateOne) Save

func (puo *PostUpdateOne) Save(ctx context.Context) (*Post, error)

Save executes the query and returns the updated Post entity.

func (*PostUpdateOne) SaveX

func (puo *PostUpdateOne) SaveX(ctx context.Context) *Post

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

func (*PostUpdateOne) Select

func (puo *PostUpdateOne) Select(field string, fields ...string) *PostUpdateOne

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

func (*PostUpdateOne) SetDescription

func (puo *PostUpdateOne) SetDescription(s string) *PostUpdateOne

SetDescription sets the "description" field.

func (*PostUpdateOne) SetDsn

func (puo *PostUpdateOne) SetDsn(s string) *PostUpdateOne

SetDsn sets the "dsn" field.

func (*PostUpdateOne) SetNillableDescription

func (puo *PostUpdateOne) SetNillableDescription(s *string) *PostUpdateOne

SetNillableDescription sets the "description" field if the given value is not nil.

func (*PostUpdateOne) SetNillableDsn

func (puo *PostUpdateOne) SetNillableDsn(s *string) *PostUpdateOne

SetNillableDsn sets the "dsn" field if the given value is not nil.

func (*PostUpdateOne) SetTenantID

func (puo *PostUpdateOne) SetTenantID(ss *sql.NullString) *PostUpdateOne

SetTenantID sets the "tenant_id" field.

func (*PostUpdateOne) SetTitle

func (puo *PostUpdateOne) SetTitle(s string) *PostUpdateOne

SetTitle sets the "title" field.

func (*PostUpdateOne) Where

func (puo *PostUpdateOne) Where(ps ...predicate.Post) *PostUpdateOne

Where appends a list predicates to the PostUpdate builder.

type PostUpsert

type PostUpsert struct {
	*sql.UpdateSet
}

PostUpsert is the "OnConflict" setter.

func (*PostUpsert) ClearDescription

func (u *PostUpsert) ClearDescription() *PostUpsert

ClearDescription clears the value of the "description" field.

func (*PostUpsert) ClearDsn

func (u *PostUpsert) ClearDsn() *PostUpsert

ClearDsn clears the value of the "dsn" field.

func (*PostUpsert) ClearTenantID

func (u *PostUpsert) ClearTenantID() *PostUpsert

ClearTenantID clears the value of the "tenant_id" field.

func (*PostUpsert) SetDescription

func (u *PostUpsert) SetDescription(v string) *PostUpsert

SetDescription sets the "description" field.

func (*PostUpsert) SetDsn

func (u *PostUpsert) SetDsn(v string) *PostUpsert

SetDsn sets the "dsn" field.

func (*PostUpsert) SetTenantID

func (u *PostUpsert) SetTenantID(v *sql.NullString) *PostUpsert

SetTenantID sets the "tenant_id" field.

func (*PostUpsert) SetTitle

func (u *PostUpsert) SetTitle(v string) *PostUpsert

SetTitle sets the "title" field.

func (*PostUpsert) UpdateDescription

func (u *PostUpsert) UpdateDescription() *PostUpsert

UpdateDescription sets the "description" field to the value that was provided on create.

func (*PostUpsert) UpdateDsn

func (u *PostUpsert) UpdateDsn() *PostUpsert

UpdateDsn sets the "dsn" field to the value that was provided on create.

func (*PostUpsert) UpdateTenantID

func (u *PostUpsert) UpdateTenantID() *PostUpsert

UpdateTenantID sets the "tenant_id" field to the value that was provided on create.

func (*PostUpsert) UpdateTitle

func (u *PostUpsert) UpdateTitle() *PostUpsert

UpdateTitle sets the "title" field to the value that was provided on create.

type PostUpsertBulk

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

PostUpsertBulk is the builder for "upsert"-ing a bulk of Post nodes.

func (*PostUpsertBulk) ClearDescription

func (u *PostUpsertBulk) ClearDescription() *PostUpsertBulk

ClearDescription clears the value of the "description" field.

func (*PostUpsertBulk) ClearDsn

func (u *PostUpsertBulk) ClearDsn() *PostUpsertBulk

ClearDsn clears the value of the "dsn" field.

func (*PostUpsertBulk) ClearTenantID

func (u *PostUpsertBulk) ClearTenantID() *PostUpsertBulk

ClearTenantID clears the value of the "tenant_id" field.

func (*PostUpsertBulk) DoNothing

func (u *PostUpsertBulk) DoNothing() *PostUpsertBulk

DoNothing configures the conflict_action to `DO NOTHING`. Supported only by SQLite and PostgreSQL.

func (*PostUpsertBulk) Exec

func (u *PostUpsertBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*PostUpsertBulk) ExecX

func (u *PostUpsertBulk) ExecX(ctx context.Context)

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

func (*PostUpsertBulk) Ignore

func (u *PostUpsertBulk) Ignore() *PostUpsertBulk

Ignore sets each column to itself in case of conflict. Using this option is equivalent to using:

client.Post.Create().
	OnConflict(sql.ResolveWithIgnore()).
	Exec(ctx)

func (*PostUpsertBulk) SetDescription

func (u *PostUpsertBulk) SetDescription(v string) *PostUpsertBulk

SetDescription sets the "description" field.

func (*PostUpsertBulk) SetDsn

func (u *PostUpsertBulk) SetDsn(v string) *PostUpsertBulk

SetDsn sets the "dsn" field.

func (*PostUpsertBulk) SetTenantID

func (u *PostUpsertBulk) SetTenantID(v *sql.NullString) *PostUpsertBulk

SetTenantID sets the "tenant_id" field.

func (*PostUpsertBulk) SetTitle

func (u *PostUpsertBulk) SetTitle(v string) *PostUpsertBulk

SetTitle sets the "title" field.

func (*PostUpsertBulk) Update

func (u *PostUpsertBulk) Update(set func(*PostUpsert)) *PostUpsertBulk

Update allows overriding fields `UPDATE` values. See the PostCreateBulk.OnConflict documentation for more info.

func (*PostUpsertBulk) UpdateDescription

func (u *PostUpsertBulk) UpdateDescription() *PostUpsertBulk

UpdateDescription sets the "description" field to the value that was provided on create.

func (*PostUpsertBulk) UpdateDsn

func (u *PostUpsertBulk) UpdateDsn() *PostUpsertBulk

UpdateDsn sets the "dsn" field to the value that was provided on create.

func (*PostUpsertBulk) UpdateNewValues

func (u *PostUpsertBulk) UpdateNewValues() *PostUpsertBulk

UpdateNewValues updates the mutable fields using the new values that were set on create. Using this option is equivalent to using:

client.Post.Create().
	OnConflict(
		sql.ResolveWithNewValues(),
		sql.ResolveWith(func(u *sql.UpdateSet) {
			u.SetIgnore(post.FieldID)
		}),
	).
	Exec(ctx)

func (*PostUpsertBulk) UpdateTenantID

func (u *PostUpsertBulk) UpdateTenantID() *PostUpsertBulk

UpdateTenantID sets the "tenant_id" field to the value that was provided on create.

func (*PostUpsertBulk) UpdateTitle

func (u *PostUpsertBulk) UpdateTitle() *PostUpsertBulk

UpdateTitle sets the "title" field to the value that was provided on create.

type PostUpsertOne

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

PostUpsertOne is the builder for "upsert"-ing

one Post node.

func (*PostUpsertOne) ClearDescription

func (u *PostUpsertOne) ClearDescription() *PostUpsertOne

ClearDescription clears the value of the "description" field.

func (*PostUpsertOne) ClearDsn

func (u *PostUpsertOne) ClearDsn() *PostUpsertOne

ClearDsn clears the value of the "dsn" field.

func (*PostUpsertOne) ClearTenantID

func (u *PostUpsertOne) ClearTenantID() *PostUpsertOne

ClearTenantID clears the value of the "tenant_id" field.

func (*PostUpsertOne) DoNothing

func (u *PostUpsertOne) DoNothing() *PostUpsertOne

DoNothing configures the conflict_action to `DO NOTHING`. Supported only by SQLite and PostgreSQL.

func (*PostUpsertOne) Exec

func (u *PostUpsertOne) Exec(ctx context.Context) error

Exec executes the query.

func (*PostUpsertOne) ExecX

func (u *PostUpsertOne) ExecX(ctx context.Context)

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

func (*PostUpsertOne) ID

func (u *PostUpsertOne) ID(ctx context.Context) (id int, err error)

Exec executes the UPSERT query and returns the inserted/updated ID.

func (*PostUpsertOne) IDX

func (u *PostUpsertOne) IDX(ctx context.Context) int

IDX is like ID, but panics if an error occurs.

func (*PostUpsertOne) Ignore

func (u *PostUpsertOne) Ignore() *PostUpsertOne

Ignore sets each column to itself in case of conflict. Using this option is equivalent to using:

client.Post.Create().
    OnConflict(sql.ResolveWithIgnore()).
    Exec(ctx)

func (*PostUpsertOne) SetDescription

func (u *PostUpsertOne) SetDescription(v string) *PostUpsertOne

SetDescription sets the "description" field.

func (*PostUpsertOne) SetDsn

func (u *PostUpsertOne) SetDsn(v string) *PostUpsertOne

SetDsn sets the "dsn" field.

func (*PostUpsertOne) SetTenantID

func (u *PostUpsertOne) SetTenantID(v *sql.NullString) *PostUpsertOne

SetTenantID sets the "tenant_id" field.

func (*PostUpsertOne) SetTitle

func (u *PostUpsertOne) SetTitle(v string) *PostUpsertOne

SetTitle sets the "title" field.

func (*PostUpsertOne) Update

func (u *PostUpsertOne) Update(set func(*PostUpsert)) *PostUpsertOne

Update allows overriding fields `UPDATE` values. See the PostCreate.OnConflict documentation for more info.

func (*PostUpsertOne) UpdateDescription

func (u *PostUpsertOne) UpdateDescription() *PostUpsertOne

UpdateDescription sets the "description" field to the value that was provided on create.

func (*PostUpsertOne) UpdateDsn

func (u *PostUpsertOne) UpdateDsn() *PostUpsertOne

UpdateDsn sets the "dsn" field to the value that was provided on create.

func (*PostUpsertOne) UpdateNewValues

func (u *PostUpsertOne) UpdateNewValues() *PostUpsertOne

UpdateNewValues updates the mutable fields using the new values that were set on create except the ID field. Using this option is equivalent to using:

client.Post.Create().
	OnConflict(
		sql.ResolveWithNewValues(),
		sql.ResolveWith(func(u *sql.UpdateSet) {
			u.SetIgnore(post.FieldID)
		}),
	).
	Exec(ctx)

func (*PostUpsertOne) UpdateTenantID

func (u *PostUpsertOne) UpdateTenantID() *PostUpsertOne

UpdateTenantID sets the "tenant_id" field to the value that was provided on create.

func (*PostUpsertOne) UpdateTitle

func (u *PostUpsertOne) UpdateTitle() *PostUpsertOne

UpdateTitle sets the "title" field to the value that was provided on create.

type Posts

type Posts []*Post

Posts is a parsable slice of Post.

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 Tenant

type Tenant struct {

	// ID of the ent.
	ID int `json:"id,omitempty"`
	// CreateTime holds the value of the "create_time" field.
	CreateTime time.Time `json:"create_time,omitempty"`
	// UpdateTime holds the value of the "update_time" field.
	UpdateTime time.Time `json:"update_time,omitempty"`
	// Name holds the value of the "name" field.
	Name string `json:"name,omitempty"`
	// DisplayName holds the value of the "display_name" field.
	DisplayName string `json:"display_name,omitempty"`
	// Region holds the value of the "region" field.
	Region string `json:"region,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the TenantQuery when eager-loading is set.
	Edges TenantEdges `json:"edges"`
	// contains filtered or unexported fields
}

Tenant is the model entity for the Tenant schema.

func (*Tenant) QueryConn

func (t *Tenant) QueryConn() *TenantConnQuery

QueryConn queries the "conn" edge of the Tenant entity.

func (*Tenant) String

func (t *Tenant) String() string

String implements the fmt.Stringer.

func (*Tenant) Unwrap

func (t *Tenant) Unwrap() *Tenant

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

func (t *Tenant) Update() *TenantUpdateOne

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

func (*Tenant) Value

func (t *Tenant) Value(name string) (ent.Value, error)

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

type TenantClient

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

TenantClient is a client for the Tenant schema.

func NewTenantClient

func NewTenantClient(c config) *TenantClient

NewTenantClient returns a client for the Tenant from the given config.

func (*TenantClient) Create

func (c *TenantClient) Create() *TenantCreate

Create returns a builder for creating a Tenant entity.

func (*TenantClient) CreateBulk

func (c *TenantClient) CreateBulk(builders ...*TenantCreate) *TenantCreateBulk

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

func (*TenantClient) Delete

func (c *TenantClient) Delete() *TenantDelete

Delete returns a delete builder for Tenant.

func (*TenantClient) DeleteOne

func (c *TenantClient) DeleteOne(t *Tenant) *TenantDeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*TenantClient) DeleteOneID

func (c *TenantClient) DeleteOneID(id int) *TenantDeleteOne

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

func (*TenantClient) Get

func (c *TenantClient) Get(ctx context.Context, id int) (*Tenant, error)

Get returns a Tenant entity by its id.

func (*TenantClient) GetX

func (c *TenantClient) GetX(ctx context.Context, id int) *Tenant

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

func (*TenantClient) Hooks

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

Hooks returns the client hooks.

func (*TenantClient) Intercept

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

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

func (*TenantClient) Interceptors

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

Interceptors returns the client interceptors.

func (*TenantClient) MapCreateBulk

func (c *TenantClient) MapCreateBulk(slice any, setFunc func(*TenantCreate, int)) *TenantCreateBulk

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 (*TenantClient) Query

func (c *TenantClient) Query() *TenantQuery

Query returns a query builder for Tenant.

func (*TenantClient) QueryConn

func (c *TenantClient) QueryConn(t *Tenant) *TenantConnQuery

QueryConn queries the conn edge of a Tenant.

func (*TenantClient) Update

func (c *TenantClient) Update() *TenantUpdate

Update returns an update builder for Tenant.

func (*TenantClient) UpdateOne

func (c *TenantClient) UpdateOne(t *Tenant) *TenantUpdateOne

UpdateOne returns an update builder for the given entity.

func (*TenantClient) UpdateOneID

func (c *TenantClient) UpdateOneID(id int) *TenantUpdateOne

UpdateOneID returns an update builder for the given id.

func (*TenantClient) Use

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

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

type TenantConn

type TenantConn struct {

	// ID of the ent.
	ID int `json:"id,omitempty"`
	// CreateTime holds the value of the "create_time" field.
	CreateTime time.Time `json:"create_time,omitempty"`
	// UpdateTime holds the value of the "update_time" field.
	UpdateTime time.Time `json:"update_time,omitempty"`
	// Key holds the value of the "key" field.
	Key string `json:"key,omitempty"`
	// Value holds the value of the "value" field.
	Value string `json:"value,omitempty"`
	// contains filtered or unexported fields
}

TenantConn is the model entity for the TenantConn schema.

func (*TenantConn) GetValue

func (tc *TenantConn) GetValue(name string) (ent.Value, error)

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

func (*TenantConn) String

func (tc *TenantConn) String() string

String implements the fmt.Stringer.

func (*TenantConn) Unwrap

func (tc *TenantConn) Unwrap() *TenantConn

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

func (tc *TenantConn) Update() *TenantConnUpdateOne

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

type TenantConnClient

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

TenantConnClient is a client for the TenantConn schema.

func NewTenantConnClient

func NewTenantConnClient(c config) *TenantConnClient

NewTenantConnClient returns a client for the TenantConn from the given config.

func (*TenantConnClient) Create

func (c *TenantConnClient) Create() *TenantConnCreate

Create returns a builder for creating a TenantConn entity.

func (*TenantConnClient) CreateBulk

func (c *TenantConnClient) CreateBulk(builders ...*TenantConnCreate) *TenantConnCreateBulk

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

func (*TenantConnClient) Delete

func (c *TenantConnClient) Delete() *TenantConnDelete

Delete returns a delete builder for TenantConn.

func (*TenantConnClient) DeleteOne

func (c *TenantConnClient) DeleteOne(tc *TenantConn) *TenantConnDeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*TenantConnClient) DeleteOneID

func (c *TenantConnClient) DeleteOneID(id int) *TenantConnDeleteOne

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

func (*TenantConnClient) Get

func (c *TenantConnClient) Get(ctx context.Context, id int) (*TenantConn, error)

Get returns a TenantConn entity by its id.

func (*TenantConnClient) GetX

func (c *TenantConnClient) GetX(ctx context.Context, id int) *TenantConn

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

func (*TenantConnClient) Hooks

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

Hooks returns the client hooks.

func (*TenantConnClient) Intercept

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

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

func (*TenantConnClient) Interceptors

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

Interceptors returns the client interceptors.

func (*TenantConnClient) MapCreateBulk

func (c *TenantConnClient) MapCreateBulk(slice any, setFunc func(*TenantConnCreate, int)) *TenantConnCreateBulk

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 (*TenantConnClient) Query

func (c *TenantConnClient) Query() *TenantConnQuery

Query returns a query builder for TenantConn.

func (*TenantConnClient) Update

func (c *TenantConnClient) Update() *TenantConnUpdate

Update returns an update builder for TenantConn.

func (*TenantConnClient) UpdateOne

func (c *TenantConnClient) UpdateOne(tc *TenantConn) *TenantConnUpdateOne

UpdateOne returns an update builder for the given entity.

func (*TenantConnClient) UpdateOneID

func (c *TenantConnClient) UpdateOneID(id int) *TenantConnUpdateOne

UpdateOneID returns an update builder for the given id.

func (*TenantConnClient) Use

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

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

type TenantConnCreate

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

TenantConnCreate is the builder for creating a TenantConn entity.

func (*TenantConnCreate) Exec

func (tcc *TenantConnCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*TenantConnCreate) ExecX

func (tcc *TenantConnCreate) ExecX(ctx context.Context)

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

func (*TenantConnCreate) Mutation

func (tcc *TenantConnCreate) Mutation() *TenantConnMutation

Mutation returns the TenantConnMutation object of the builder.

func (*TenantConnCreate) OnConflict

func (tcc *TenantConnCreate) OnConflict(opts ...sql.ConflictOption) *TenantConnUpsertOne

OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause of the `INSERT` statement. For example:

client.TenantConn.Create().
	SetCreateTime(v).
	OnConflict(
		// Update the row with the new values
		// the was proposed for insertion.
		sql.ResolveWithNewValues(),
	).
	// Override some of the fields with custom
	// update values.
	Update(func(u *ent.TenantConnUpsert) {
		SetCreateTime(v+v).
	}).
	Exec(ctx)

func (*TenantConnCreate) OnConflictColumns

func (tcc *TenantConnCreate) OnConflictColumns(columns ...string) *TenantConnUpsertOne

OnConflictColumns calls `OnConflict` and configures the columns as conflict target. Using this option is equivalent to using:

client.TenantConn.Create().
	OnConflict(sql.ConflictColumns(columns...)).
	Exec(ctx)

func (*TenantConnCreate) Save

func (tcc *TenantConnCreate) Save(ctx context.Context) (*TenantConn, error)

Save creates the TenantConn in the database.

func (*TenantConnCreate) SaveX

func (tcc *TenantConnCreate) SaveX(ctx context.Context) *TenantConn

SaveX calls Save and panics if Save returns an error.

func (*TenantConnCreate) SetCreateTime

func (tcc *TenantConnCreate) SetCreateTime(t time.Time) *TenantConnCreate

SetCreateTime sets the "create_time" field.

func (*TenantConnCreate) SetKey

func (tcc *TenantConnCreate) SetKey(s string) *TenantConnCreate

SetKey sets the "key" field.

func (*TenantConnCreate) SetNillableCreateTime

func (tcc *TenantConnCreate) SetNillableCreateTime(t *time.Time) *TenantConnCreate

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

func (*TenantConnCreate) SetNillableUpdateTime

func (tcc *TenantConnCreate) SetNillableUpdateTime(t *time.Time) *TenantConnCreate

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

func (*TenantConnCreate) SetUpdateTime

func (tcc *TenantConnCreate) SetUpdateTime(t time.Time) *TenantConnCreate

SetUpdateTime sets the "update_time" field.

func (*TenantConnCreate) SetValue

func (tcc *TenantConnCreate) SetValue(s string) *TenantConnCreate

SetValue sets the "value" field.

type TenantConnCreateBulk

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

TenantConnCreateBulk is the builder for creating many TenantConn entities in bulk.

func (*TenantConnCreateBulk) Exec

func (tccb *TenantConnCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*TenantConnCreateBulk) ExecX

func (tccb *TenantConnCreateBulk) ExecX(ctx context.Context)

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

func (*TenantConnCreateBulk) OnConflict

func (tccb *TenantConnCreateBulk) OnConflict(opts ...sql.ConflictOption) *TenantConnUpsertBulk

OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause of the `INSERT` statement. For example:

client.TenantConn.CreateBulk(builders...).
	OnConflict(
		// Update the row with the new values
		// the was proposed for insertion.
		sql.ResolveWithNewValues(),
	).
	// Override some of the fields with custom
	// update values.
	Update(func(u *ent.TenantConnUpsert) {
		SetCreateTime(v+v).
	}).
	Exec(ctx)

func (*TenantConnCreateBulk) OnConflictColumns

func (tccb *TenantConnCreateBulk) OnConflictColumns(columns ...string) *TenantConnUpsertBulk

OnConflictColumns calls `OnConflict` and configures the columns as conflict target. Using this option is equivalent to using:

client.TenantConn.Create().
	OnConflict(sql.ConflictColumns(columns...)).
	Exec(ctx)

func (*TenantConnCreateBulk) Save

func (tccb *TenantConnCreateBulk) Save(ctx context.Context) ([]*TenantConn, error)

Save creates the TenantConn entities in the database.

func (*TenantConnCreateBulk) SaveX

func (tccb *TenantConnCreateBulk) SaveX(ctx context.Context) []*TenantConn

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

type TenantConnDelete

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

TenantConnDelete is the builder for deleting a TenantConn entity.

func (*TenantConnDelete) Exec

func (tcd *TenantConnDelete) Exec(ctx context.Context) (int, error)

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

func (*TenantConnDelete) ExecX

func (tcd *TenantConnDelete) ExecX(ctx context.Context) int

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

func (*TenantConnDelete) Where

Where appends a list predicates to the TenantConnDelete builder.

type TenantConnDeleteOne

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

TenantConnDeleteOne is the builder for deleting a single TenantConn entity.

func (*TenantConnDeleteOne) Exec

func (tcdo *TenantConnDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*TenantConnDeleteOne) ExecX

func (tcdo *TenantConnDeleteOne) ExecX(ctx context.Context)

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

func (*TenantConnDeleteOne) Where

Where appends a list predicates to the TenantConnDelete builder.

type TenantConnGroupBy

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

TenantConnGroupBy is the group-by builder for TenantConn entities.

func (*TenantConnGroupBy) Aggregate

func (tcgb *TenantConnGroupBy) Aggregate(fns ...AggregateFunc) *TenantConnGroupBy

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

func (*TenantConnGroupBy) Bool

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

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

func (*TenantConnGroupBy) BoolX

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

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

func (*TenantConnGroupBy) Bools

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

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

func (*TenantConnGroupBy) BoolsX

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

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

func (*TenantConnGroupBy) Float64

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

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

func (*TenantConnGroupBy) Float64X

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

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

func (*TenantConnGroupBy) Float64s

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

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

func (*TenantConnGroupBy) Float64sX

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

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

func (*TenantConnGroupBy) Int

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

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

func (*TenantConnGroupBy) IntX

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

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

func (*TenantConnGroupBy) Ints

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

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

func (*TenantConnGroupBy) IntsX

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

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

func (*TenantConnGroupBy) Scan

func (tcgb *TenantConnGroupBy) Scan(ctx context.Context, v any) error

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

func (*TenantConnGroupBy) ScanX

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

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

func (*TenantConnGroupBy) String

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

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

func (*TenantConnGroupBy) StringX

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

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

func (*TenantConnGroupBy) Strings

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

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

func (*TenantConnGroupBy) StringsX

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

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

type TenantConnMutation

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

TenantConnMutation represents an operation that mutates the TenantConn nodes in the graph.

func (*TenantConnMutation) AddField

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

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

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

func (*TenantConnMutation) AddedField

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

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

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

func (*TenantConnMutation) AddedIDs

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

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

func (*TenantConnMutation) ClearEdge

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

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

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

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

func (*TenantConnMutation) ClearedFields

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

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

func (TenantConnMutation) Client

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

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

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

func (*TenantConnMutation) EdgeCleared

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

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

func (*TenantConnMutation) Field

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

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

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

func (*TenantConnMutation) Fields

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

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

func (m *TenantConnMutation) 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 (*TenantConnMutation) Key

func (m *TenantConnMutation) Key() (r string, exists bool)

Key returns the value of the "key" field in the mutation.

func (*TenantConnMutation) OldCreateTime

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

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

func (m *TenantConnMutation) 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 (*TenantConnMutation) OldKey

func (m *TenantConnMutation) OldKey(ctx context.Context) (v string, err error)

OldKey returns the old "key" field's value of the TenantConn entity. If the TenantConn 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 (*TenantConnMutation) OldUpdateTime

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

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

func (m *TenantConnMutation) OldValue(ctx context.Context) (v string, err error)

OldValue returns the old "value" field's value of the TenantConn entity. If the TenantConn 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 (*TenantConnMutation) Op

func (m *TenantConnMutation) Op() Op

Op returns the operation name.

func (*TenantConnMutation) RemovedEdges

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

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

func (*TenantConnMutation) RemovedIDs

func (m *TenantConnMutation) 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 (*TenantConnMutation) ResetCreateTime

func (m *TenantConnMutation) ResetCreateTime()

ResetCreateTime resets all changes to the "create_time" field.

func (*TenantConnMutation) ResetEdge

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

func (m *TenantConnMutation) 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 (*TenantConnMutation) ResetKey

func (m *TenantConnMutation) ResetKey()

ResetKey resets all changes to the "key" field.

func (*TenantConnMutation) ResetUpdateTime

func (m *TenantConnMutation) ResetUpdateTime()

ResetUpdateTime resets all changes to the "update_time" field.

func (*TenantConnMutation) ResetValue

func (m *TenantConnMutation) ResetValue()

ResetValue resets all changes to the "value" field.

func (*TenantConnMutation) SetCreateTime

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

SetCreateTime sets the "create_time" field.

func (*TenantConnMutation) SetField

func (m *TenantConnMutation) 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 (*TenantConnMutation) SetKey

func (m *TenantConnMutation) SetKey(s string)

SetKey sets the "key" field.

func (*TenantConnMutation) SetOp

func (m *TenantConnMutation) SetOp(op Op)

SetOp allows setting the mutation operation.

func (*TenantConnMutation) SetUpdateTime

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

SetUpdateTime sets the "update_time" field.

func (*TenantConnMutation) SetValue

func (m *TenantConnMutation) SetValue(s string)

SetValue sets the "value" field.

func (TenantConnMutation) Tx

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

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

func (*TenantConnMutation) Type

func (m *TenantConnMutation) Type() string

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

func (*TenantConnMutation) UpdateTime

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

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

func (*TenantConnMutation) Value

func (m *TenantConnMutation) Value() (r string, exists bool)

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

func (*TenantConnMutation) Where

func (m *TenantConnMutation) Where(ps ...predicate.TenantConn)

Where appends a list predicates to the TenantConnMutation builder.

func (*TenantConnMutation) WhereP

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

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

type TenantConnQuery

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

TenantConnQuery is the builder for querying TenantConn entities.

func (*TenantConnQuery) Aggregate

func (tcq *TenantConnQuery) Aggregate(fns ...AggregateFunc) *TenantConnSelect

Aggregate returns a TenantConnSelect configured with the given aggregations.

func (*TenantConnQuery) All

func (tcq *TenantConnQuery) All(ctx context.Context) ([]*TenantConn, error)

All executes the query and returns a list of TenantConns.

func (*TenantConnQuery) AllX

func (tcq *TenantConnQuery) AllX(ctx context.Context) []*TenantConn

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

func (*TenantConnQuery) Clone

func (tcq *TenantConnQuery) Clone() *TenantConnQuery

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

func (*TenantConnQuery) Count

func (tcq *TenantConnQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*TenantConnQuery) CountX

func (tcq *TenantConnQuery) CountX(ctx context.Context) int

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

func (*TenantConnQuery) Exist

func (tcq *TenantConnQuery) Exist(ctx context.Context) (bool, error)

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

func (*TenantConnQuery) ExistX

func (tcq *TenantConnQuery) ExistX(ctx context.Context) bool

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

func (*TenantConnQuery) First

func (tcq *TenantConnQuery) First(ctx context.Context) (*TenantConn, error)

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

func (*TenantConnQuery) FirstID

func (tcq *TenantConnQuery) FirstID(ctx context.Context) (id int, err error)

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

func (*TenantConnQuery) FirstIDX

func (tcq *TenantConnQuery) FirstIDX(ctx context.Context) int

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

func (*TenantConnQuery) FirstX

func (tcq *TenantConnQuery) FirstX(ctx context.Context) *TenantConn

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

func (*TenantConnQuery) GroupBy

func (tcq *TenantConnQuery) GroupBy(field string, fields ...string) *TenantConnGroupBy

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

Example:

var v []struct {
	CreateTime time.Time `json:"create_time,omitempty"`
	Count int `json:"count,omitempty"`
}

client.TenantConn.Query().
	GroupBy(tenantconn.FieldCreateTime).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*TenantConnQuery) IDs

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

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

func (*TenantConnQuery) IDsX

func (tcq *TenantConnQuery) IDsX(ctx context.Context) []int

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

func (*TenantConnQuery) Limit

func (tcq *TenantConnQuery) Limit(limit int) *TenantConnQuery

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

func (*TenantConnQuery) Offset

func (tcq *TenantConnQuery) Offset(offset int) *TenantConnQuery

Offset to start from.

func (*TenantConnQuery) Only

func (tcq *TenantConnQuery) Only(ctx context.Context) (*TenantConn, error)

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

func (*TenantConnQuery) OnlyID

func (tcq *TenantConnQuery) OnlyID(ctx context.Context) (id int, err error)

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

func (*TenantConnQuery) OnlyIDX

func (tcq *TenantConnQuery) OnlyIDX(ctx context.Context) int

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

func (*TenantConnQuery) OnlyX

func (tcq *TenantConnQuery) OnlyX(ctx context.Context) *TenantConn

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

func (*TenantConnQuery) Order

Order specifies how the records should be ordered.

func (*TenantConnQuery) Select

func (tcq *TenantConnQuery) Select(fields ...string) *TenantConnSelect

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

Example:

var v []struct {
	CreateTime time.Time `json:"create_time,omitempty"`
}

client.TenantConn.Query().
	Select(tenantconn.FieldCreateTime).
	Scan(ctx, &v)

func (*TenantConnQuery) Unique

func (tcq *TenantConnQuery) Unique(unique bool) *TenantConnQuery

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

Where adds a new predicate for the TenantConnQuery builder.

type TenantConnSelect

type TenantConnSelect struct {
	*TenantConnQuery
	// contains filtered or unexported fields
}

TenantConnSelect is the builder for selecting fields of TenantConn entities.

func (*TenantConnSelect) Aggregate

func (tcs *TenantConnSelect) Aggregate(fns ...AggregateFunc) *TenantConnSelect

Aggregate adds the given aggregation functions to the selector query.

func (*TenantConnSelect) Bool

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

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

func (*TenantConnSelect) BoolX

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

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

func (*TenantConnSelect) Bools

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

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

func (*TenantConnSelect) BoolsX

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

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

func (*TenantConnSelect) Float64

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

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

func (*TenantConnSelect) Float64X

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

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

func (*TenantConnSelect) Float64s

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

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

func (*TenantConnSelect) Float64sX

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

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

func (*TenantConnSelect) Int

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

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

func (*TenantConnSelect) IntX

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

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

func (*TenantConnSelect) Ints

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

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

func (*TenantConnSelect) IntsX

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

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

func (*TenantConnSelect) Scan

func (tcs *TenantConnSelect) Scan(ctx context.Context, v any) error

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

func (*TenantConnSelect) ScanX

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

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

func (*TenantConnSelect) String

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

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

func (*TenantConnSelect) StringX

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

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

func (*TenantConnSelect) Strings

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

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

func (*TenantConnSelect) StringsX

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

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

type TenantConnUpdate

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

TenantConnUpdate is the builder for updating TenantConn entities.

func (*TenantConnUpdate) Exec

func (tcu *TenantConnUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*TenantConnUpdate) ExecX

func (tcu *TenantConnUpdate) ExecX(ctx context.Context)

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

func (*TenantConnUpdate) Mutation

func (tcu *TenantConnUpdate) Mutation() *TenantConnMutation

Mutation returns the TenantConnMutation object of the builder.

func (*TenantConnUpdate) Save

func (tcu *TenantConnUpdate) Save(ctx context.Context) (int, error)

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

func (*TenantConnUpdate) SaveX

func (tcu *TenantConnUpdate) SaveX(ctx context.Context) int

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

func (*TenantConnUpdate) SetKey

func (tcu *TenantConnUpdate) SetKey(s string) *TenantConnUpdate

SetKey sets the "key" field.

func (*TenantConnUpdate) SetUpdateTime

func (tcu *TenantConnUpdate) SetUpdateTime(t time.Time) *TenantConnUpdate

SetUpdateTime sets the "update_time" field.

func (*TenantConnUpdate) SetValue

func (tcu *TenantConnUpdate) SetValue(s string) *TenantConnUpdate

SetValue sets the "value" field.

func (*TenantConnUpdate) Where

Where appends a list predicates to the TenantConnUpdate builder.

type TenantConnUpdateOne

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

TenantConnUpdateOne is the builder for updating a single TenantConn entity.

func (*TenantConnUpdateOne) Exec

func (tcuo *TenantConnUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*TenantConnUpdateOne) ExecX

func (tcuo *TenantConnUpdateOne) ExecX(ctx context.Context)

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

func (*TenantConnUpdateOne) Mutation

func (tcuo *TenantConnUpdateOne) Mutation() *TenantConnMutation

Mutation returns the TenantConnMutation object of the builder.

func (*TenantConnUpdateOne) Save

func (tcuo *TenantConnUpdateOne) Save(ctx context.Context) (*TenantConn, error)

Save executes the query and returns the updated TenantConn entity.

func (*TenantConnUpdateOne) SaveX

func (tcuo *TenantConnUpdateOne) SaveX(ctx context.Context) *TenantConn

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

func (*TenantConnUpdateOne) Select

func (tcuo *TenantConnUpdateOne) Select(field string, fields ...string) *TenantConnUpdateOne

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

func (*TenantConnUpdateOne) SetKey

SetKey sets the "key" field.

func (*TenantConnUpdateOne) SetUpdateTime

func (tcuo *TenantConnUpdateOne) SetUpdateTime(t time.Time) *TenantConnUpdateOne

SetUpdateTime sets the "update_time" field.

func (*TenantConnUpdateOne) SetValue

func (tcuo *TenantConnUpdateOne) SetValue(s string) *TenantConnUpdateOne

SetValue sets the "value" field.

func (*TenantConnUpdateOne) Where

Where appends a list predicates to the TenantConnUpdate builder.

type TenantConnUpsert

type TenantConnUpsert struct {
	*sql.UpdateSet
}

TenantConnUpsert is the "OnConflict" setter.

func (*TenantConnUpsert) SetKey

SetKey sets the "key" field.

func (*TenantConnUpsert) SetUpdateTime

func (u *TenantConnUpsert) SetUpdateTime(v time.Time) *TenantConnUpsert

SetUpdateTime sets the "update_time" field.

func (*TenantConnUpsert) SetValue

func (u *TenantConnUpsert) SetValue(v string) *TenantConnUpsert

SetValue sets the "value" field.

func (*TenantConnUpsert) UpdateKey

func (u *TenantConnUpsert) UpdateKey() *TenantConnUpsert

UpdateKey sets the "key" field to the value that was provided on create.

func (*TenantConnUpsert) UpdateUpdateTime

func (u *TenantConnUpsert) UpdateUpdateTime() *TenantConnUpsert

UpdateUpdateTime sets the "update_time" field to the value that was provided on create.

func (*TenantConnUpsert) UpdateValue

func (u *TenantConnUpsert) UpdateValue() *TenantConnUpsert

UpdateValue sets the "value" field to the value that was provided on create.

type TenantConnUpsertBulk

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

TenantConnUpsertBulk is the builder for "upsert"-ing a bulk of TenantConn nodes.

func (*TenantConnUpsertBulk) DoNothing

DoNothing configures the conflict_action to `DO NOTHING`. Supported only by SQLite and PostgreSQL.

func (*TenantConnUpsertBulk) Exec

Exec executes the query.

func (*TenantConnUpsertBulk) ExecX

func (u *TenantConnUpsertBulk) ExecX(ctx context.Context)

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

func (*TenantConnUpsertBulk) Ignore

Ignore sets each column to itself in case of conflict. Using this option is equivalent to using:

client.TenantConn.Create().
	OnConflict(sql.ResolveWithIgnore()).
	Exec(ctx)

func (*TenantConnUpsertBulk) SetKey

SetKey sets the "key" field.

func (*TenantConnUpsertBulk) SetUpdateTime

func (u *TenantConnUpsertBulk) SetUpdateTime(v time.Time) *TenantConnUpsertBulk

SetUpdateTime sets the "update_time" field.

func (*TenantConnUpsertBulk) SetValue

SetValue sets the "value" field.

func (*TenantConnUpsertBulk) Update

Update allows overriding fields `UPDATE` values. See the TenantConnCreateBulk.OnConflict documentation for more info.

func (*TenantConnUpsertBulk) UpdateKey

UpdateKey sets the "key" field to the value that was provided on create.

func (*TenantConnUpsertBulk) UpdateNewValues

func (u *TenantConnUpsertBulk) UpdateNewValues() *TenantConnUpsertBulk

UpdateNewValues updates the mutable fields using the new values that were set on create. Using this option is equivalent to using:

client.TenantConn.Create().
	OnConflict(
		sql.ResolveWithNewValues(),
	).
	Exec(ctx)

func (*TenantConnUpsertBulk) UpdateUpdateTime

func (u *TenantConnUpsertBulk) UpdateUpdateTime() *TenantConnUpsertBulk

UpdateUpdateTime sets the "update_time" field to the value that was provided on create.

func (*TenantConnUpsertBulk) UpdateValue

func (u *TenantConnUpsertBulk) UpdateValue() *TenantConnUpsertBulk

UpdateValue sets the "value" field to the value that was provided on create.

type TenantConnUpsertOne

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

TenantConnUpsertOne is the builder for "upsert"-ing

one TenantConn node.

func (*TenantConnUpsertOne) DoNothing

func (u *TenantConnUpsertOne) DoNothing() *TenantConnUpsertOne

DoNothing configures the conflict_action to `DO NOTHING`. Supported only by SQLite and PostgreSQL.

func (*TenantConnUpsertOne) Exec

Exec executes the query.

func (*TenantConnUpsertOne) ExecX

func (u *TenantConnUpsertOne) ExecX(ctx context.Context)

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

func (*TenantConnUpsertOne) ID

func (u *TenantConnUpsertOne) ID(ctx context.Context) (id int, err error)

Exec executes the UPSERT query and returns the inserted/updated ID.

func (*TenantConnUpsertOne) IDX

func (u *TenantConnUpsertOne) IDX(ctx context.Context) int

IDX is like ID, but panics if an error occurs.

func (*TenantConnUpsertOne) Ignore

Ignore sets each column to itself in case of conflict. Using this option is equivalent to using:

client.TenantConn.Create().
    OnConflict(sql.ResolveWithIgnore()).
    Exec(ctx)

func (*TenantConnUpsertOne) SetKey

SetKey sets the "key" field.

func (*TenantConnUpsertOne) SetUpdateTime

func (u *TenantConnUpsertOne) SetUpdateTime(v time.Time) *TenantConnUpsertOne

SetUpdateTime sets the "update_time" field.

func (*TenantConnUpsertOne) SetValue

SetValue sets the "value" field.

func (*TenantConnUpsertOne) Update

Update allows overriding fields `UPDATE` values. See the TenantConnCreate.OnConflict documentation for more info.

func (*TenantConnUpsertOne) UpdateKey

func (u *TenantConnUpsertOne) UpdateKey() *TenantConnUpsertOne

UpdateKey sets the "key" field to the value that was provided on create.

func (*TenantConnUpsertOne) UpdateNewValues

func (u *TenantConnUpsertOne) UpdateNewValues() *TenantConnUpsertOne

UpdateNewValues updates the mutable fields using the new values that were set on create. Using this option is equivalent to using:

client.TenantConn.Create().
	OnConflict(
		sql.ResolveWithNewValues(),
	).
	Exec(ctx)

func (*TenantConnUpsertOne) UpdateUpdateTime

func (u *TenantConnUpsertOne) UpdateUpdateTime() *TenantConnUpsertOne

UpdateUpdateTime sets the "update_time" field to the value that was provided on create.

func (*TenantConnUpsertOne) UpdateValue

func (u *TenantConnUpsertOne) UpdateValue() *TenantConnUpsertOne

UpdateValue sets the "value" field to the value that was provided on create.

type TenantConns

type TenantConns []*TenantConn

TenantConns is a parsable slice of TenantConn.

type TenantCreate

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

TenantCreate is the builder for creating a Tenant entity.

func (*TenantCreate) AddConn

func (tc *TenantCreate) AddConn(t ...*TenantConn) *TenantCreate

AddConn adds the "conn" edges to the TenantConn entity.

func (*TenantCreate) AddConnIDs

func (tc *TenantCreate) AddConnIDs(ids ...int) *TenantCreate

AddConnIDs adds the "conn" edge to the TenantConn entity by IDs.

func (*TenantCreate) Exec

func (tc *TenantCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*TenantCreate) ExecX

func (tc *TenantCreate) ExecX(ctx context.Context)

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

func (*TenantCreate) Mutation

func (tc *TenantCreate) Mutation() *TenantMutation

Mutation returns the TenantMutation object of the builder.

func (*TenantCreate) OnConflict

func (tc *TenantCreate) OnConflict(opts ...sql.ConflictOption) *TenantUpsertOne

OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause of the `INSERT` statement. For example:

client.Tenant.Create().
	SetCreateTime(v).
	OnConflict(
		// Update the row with the new values
		// the was proposed for insertion.
		sql.ResolveWithNewValues(),
	).
	// Override some of the fields with custom
	// update values.
	Update(func(u *ent.TenantUpsert) {
		SetCreateTime(v+v).
	}).
	Exec(ctx)

func (*TenantCreate) OnConflictColumns

func (tc *TenantCreate) OnConflictColumns(columns ...string) *TenantUpsertOne

OnConflictColumns calls `OnConflict` and configures the columns as conflict target. Using this option is equivalent to using:

client.Tenant.Create().
	OnConflict(sql.ConflictColumns(columns...)).
	Exec(ctx)

func (*TenantCreate) Save

func (tc *TenantCreate) Save(ctx context.Context) (*Tenant, error)

Save creates the Tenant in the database.

func (*TenantCreate) SaveX

func (tc *TenantCreate) SaveX(ctx context.Context) *Tenant

SaveX calls Save and panics if Save returns an error.

func (*TenantCreate) SetCreateTime

func (tc *TenantCreate) SetCreateTime(t time.Time) *TenantCreate

SetCreateTime sets the "create_time" field.

func (*TenantCreate) SetDisplayName

func (tc *TenantCreate) SetDisplayName(s string) *TenantCreate

SetDisplayName sets the "display_name" field.

func (*TenantCreate) SetID

func (tc *TenantCreate) SetID(i int) *TenantCreate

SetID sets the "id" field.

func (*TenantCreate) SetName

func (tc *TenantCreate) SetName(s string) *TenantCreate

SetName sets the "name" field.

func (*TenantCreate) SetNillableCreateTime

func (tc *TenantCreate) SetNillableCreateTime(t *time.Time) *TenantCreate

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

func (*TenantCreate) SetNillableDisplayName

func (tc *TenantCreate) SetNillableDisplayName(s *string) *TenantCreate

SetNillableDisplayName sets the "display_name" field if the given value is not nil.

func (*TenantCreate) SetNillableRegion

func (tc *TenantCreate) SetNillableRegion(s *string) *TenantCreate

SetNillableRegion sets the "region" field if the given value is not nil.

func (*TenantCreate) SetNillableUpdateTime

func (tc *TenantCreate) SetNillableUpdateTime(t *time.Time) *TenantCreate

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

func (*TenantCreate) SetRegion

func (tc *TenantCreate) SetRegion(s string) *TenantCreate

SetRegion sets the "region" field.

func (*TenantCreate) SetUpdateTime

func (tc *TenantCreate) SetUpdateTime(t time.Time) *TenantCreate

SetUpdateTime sets the "update_time" field.

type TenantCreateBulk

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

TenantCreateBulk is the builder for creating many Tenant entities in bulk.

func (*TenantCreateBulk) Exec

func (tcb *TenantCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*TenantCreateBulk) ExecX

func (tcb *TenantCreateBulk) ExecX(ctx context.Context)

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

func (*TenantCreateBulk) OnConflict

func (tcb *TenantCreateBulk) OnConflict(opts ...sql.ConflictOption) *TenantUpsertBulk

OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause of the `INSERT` statement. For example:

client.Tenant.CreateBulk(builders...).
	OnConflict(
		// Update the row with the new values
		// the was proposed for insertion.
		sql.ResolveWithNewValues(),
	).
	// Override some of the fields with custom
	// update values.
	Update(func(u *ent.TenantUpsert) {
		SetCreateTime(v+v).
	}).
	Exec(ctx)

func (*TenantCreateBulk) OnConflictColumns

func (tcb *TenantCreateBulk) OnConflictColumns(columns ...string) *TenantUpsertBulk

OnConflictColumns calls `OnConflict` and configures the columns as conflict target. Using this option is equivalent to using:

client.Tenant.Create().
	OnConflict(sql.ConflictColumns(columns...)).
	Exec(ctx)

func (*TenantCreateBulk) Save

func (tcb *TenantCreateBulk) Save(ctx context.Context) ([]*Tenant, error)

Save creates the Tenant entities in the database.

func (*TenantCreateBulk) SaveX

func (tcb *TenantCreateBulk) SaveX(ctx context.Context) []*Tenant

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

type TenantDelete

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

TenantDelete is the builder for deleting a Tenant entity.

func (*TenantDelete) Exec

func (td *TenantDelete) Exec(ctx context.Context) (int, error)

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

func (*TenantDelete) ExecX

func (td *TenantDelete) ExecX(ctx context.Context) int

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

func (*TenantDelete) Where

func (td *TenantDelete) Where(ps ...predicate.Tenant) *TenantDelete

Where appends a list predicates to the TenantDelete builder.

type TenantDeleteOne

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

TenantDeleteOne is the builder for deleting a single Tenant entity.

func (*TenantDeleteOne) Exec

func (tdo *TenantDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*TenantDeleteOne) ExecX

func (tdo *TenantDeleteOne) ExecX(ctx context.Context)

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

func (*TenantDeleteOne) Where

func (tdo *TenantDeleteOne) Where(ps ...predicate.Tenant) *TenantDeleteOne

Where appends a list predicates to the TenantDelete builder.

type TenantEdges

type TenantEdges struct {
	// Conn holds the value of the conn edge.
	Conn []*TenantConn `json:"conn,omitempty"`
	// contains filtered or unexported fields
}

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

func (TenantEdges) ConnOrErr

func (e TenantEdges) ConnOrErr() ([]*TenantConn, error)

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

type TenantGroupBy

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

TenantGroupBy is the group-by builder for Tenant entities.

func (*TenantGroupBy) Aggregate

func (tgb *TenantGroupBy) Aggregate(fns ...AggregateFunc) *TenantGroupBy

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

func (*TenantGroupBy) Bool

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

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

func (*TenantGroupBy) BoolX

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

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

func (*TenantGroupBy) Bools

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

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

func (*TenantGroupBy) BoolsX

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

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

func (*TenantGroupBy) Float64

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

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

func (*TenantGroupBy) Float64X

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

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

func (*TenantGroupBy) Float64s

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

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

func (*TenantGroupBy) Float64sX

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

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

func (*TenantGroupBy) Int

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

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

func (*TenantGroupBy) IntX

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

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

func (*TenantGroupBy) Ints

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

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

func (*TenantGroupBy) IntsX

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

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

func (*TenantGroupBy) Scan

func (tgb *TenantGroupBy) Scan(ctx context.Context, v any) error

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

func (*TenantGroupBy) ScanX

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

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

func (*TenantGroupBy) String

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

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

func (*TenantGroupBy) StringX

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

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

func (*TenantGroupBy) Strings

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

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

func (*TenantGroupBy) StringsX

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

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

type TenantMutation

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

TenantMutation represents an operation that mutates the Tenant nodes in the graph.

func (*TenantMutation) AddConnIDs

func (m *TenantMutation) AddConnIDs(ids ...int)

AddConnIDs adds the "conn" edge to the TenantConn entity by ids.

func (*TenantMutation) AddField

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

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

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

func (*TenantMutation) AddedField

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

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

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

func (*TenantMutation) AddedIDs

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

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

func (*TenantMutation) ClearConn

func (m *TenantMutation) ClearConn()

ClearConn clears the "conn" edge to the TenantConn entity.

func (*TenantMutation) ClearDisplayName

func (m *TenantMutation) ClearDisplayName()

ClearDisplayName clears the value of the "display_name" field.

func (*TenantMutation) ClearEdge

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

func (m *TenantMutation) 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 (*TenantMutation) ClearRegion

func (m *TenantMutation) ClearRegion()

ClearRegion clears the value of the "region" field.

func (*TenantMutation) ClearedEdges

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

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

func (*TenantMutation) ClearedFields

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

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

func (TenantMutation) Client

func (m TenantMutation) 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 (*TenantMutation) ConnCleared

func (m *TenantMutation) ConnCleared() bool

ConnCleared reports if the "conn" edge to the TenantConn entity was cleared.

func (*TenantMutation) ConnIDs

func (m *TenantMutation) ConnIDs() (ids []int)

ConnIDs returns the "conn" edge IDs in the mutation.

func (*TenantMutation) CreateTime

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

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

func (*TenantMutation) DisplayName

func (m *TenantMutation) DisplayName() (r string, exists bool)

DisplayName returns the value of the "display_name" field in the mutation.

func (*TenantMutation) DisplayNameCleared

func (m *TenantMutation) DisplayNameCleared() bool

DisplayNameCleared returns if the "display_name" field was cleared in this mutation.

func (*TenantMutation) EdgeCleared

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

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

func (*TenantMutation) Field

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

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

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

func (*TenantMutation) Fields

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

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

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

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

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

func (*TenantMutation) OldCreateTime

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

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

func (m *TenantMutation) OldDisplayName(ctx context.Context) (v string, err error)

OldDisplayName returns the old "display_name" field's value of the Tenant entity. If the Tenant 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 (*TenantMutation) OldField

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

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

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

func (m *TenantMutation) OldRegion(ctx context.Context) (v string, err error)

OldRegion returns the old "region" field's value of the Tenant entity. If the Tenant 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 (*TenantMutation) OldUpdateTime

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

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

func (m *TenantMutation) Op() Op

Op returns the operation name.

func (*TenantMutation) Region

func (m *TenantMutation) Region() (r string, exists bool)

Region returns the value of the "region" field in the mutation.

func (*TenantMutation) RegionCleared

func (m *TenantMutation) RegionCleared() bool

RegionCleared returns if the "region" field was cleared in this mutation.

func (*TenantMutation) RemoveConnIDs

func (m *TenantMutation) RemoveConnIDs(ids ...int)

RemoveConnIDs removes the "conn" edge to the TenantConn entity by IDs.

func (*TenantMutation) RemovedConnIDs

func (m *TenantMutation) RemovedConnIDs() (ids []int)

RemovedConn returns the removed IDs of the "conn" edge to the TenantConn entity.

func (*TenantMutation) RemovedEdges

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

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

func (*TenantMutation) RemovedIDs

func (m *TenantMutation) 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 (*TenantMutation) ResetConn

func (m *TenantMutation) ResetConn()

ResetConn resets all changes to the "conn" edge.

func (*TenantMutation) ResetCreateTime

func (m *TenantMutation) ResetCreateTime()

ResetCreateTime resets all changes to the "create_time" field.

func (*TenantMutation) ResetDisplayName

func (m *TenantMutation) ResetDisplayName()

ResetDisplayName resets all changes to the "display_name" field.

func (*TenantMutation) ResetEdge

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

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

func (m *TenantMutation) ResetName()

ResetName resets all changes to the "name" field.

func (*TenantMutation) ResetRegion

func (m *TenantMutation) ResetRegion()

ResetRegion resets all changes to the "region" field.

func (*TenantMutation) ResetUpdateTime

func (m *TenantMutation) ResetUpdateTime()

ResetUpdateTime resets all changes to the "update_time" field.

func (*TenantMutation) SetCreateTime

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

SetCreateTime sets the "create_time" field.

func (*TenantMutation) SetDisplayName

func (m *TenantMutation) SetDisplayName(s string)

SetDisplayName sets the "display_name" field.

func (*TenantMutation) SetField

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

func (m *TenantMutation) SetID(id int)

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

func (*TenantMutation) SetName

func (m *TenantMutation) SetName(s string)

SetName sets the "name" field.

func (*TenantMutation) SetOp

func (m *TenantMutation) SetOp(op Op)

SetOp allows setting the mutation operation.

func (*TenantMutation) SetRegion

func (m *TenantMutation) SetRegion(s string)

SetRegion sets the "region" field.

func (*TenantMutation) SetUpdateTime

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

SetUpdateTime sets the "update_time" field.

func (TenantMutation) Tx

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

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

func (*TenantMutation) Type

func (m *TenantMutation) Type() string

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

func (*TenantMutation) UpdateTime

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

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

func (*TenantMutation) Where

func (m *TenantMutation) Where(ps ...predicate.Tenant)

Where appends a list predicates to the TenantMutation builder.

func (*TenantMutation) WhereP

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

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

type TenantQuery

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

TenantQuery is the builder for querying Tenant entities.

func (*TenantQuery) Aggregate

func (tq *TenantQuery) Aggregate(fns ...AggregateFunc) *TenantSelect

Aggregate returns a TenantSelect configured with the given aggregations.

func (*TenantQuery) All

func (tq *TenantQuery) All(ctx context.Context) ([]*Tenant, error)

All executes the query and returns a list of Tenants.

func (*TenantQuery) AllX

func (tq *TenantQuery) AllX(ctx context.Context) []*Tenant

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

func (*TenantQuery) Clone

func (tq *TenantQuery) Clone() *TenantQuery

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

func (*TenantQuery) Count

func (tq *TenantQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*TenantQuery) CountX

func (tq *TenantQuery) CountX(ctx context.Context) int

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

func (*TenantQuery) Exist

func (tq *TenantQuery) Exist(ctx context.Context) (bool, error)

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

func (*TenantQuery) ExistX

func (tq *TenantQuery) ExistX(ctx context.Context) bool

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

func (*TenantQuery) First

func (tq *TenantQuery) First(ctx context.Context) (*Tenant, error)

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

func (*TenantQuery) FirstID

func (tq *TenantQuery) FirstID(ctx context.Context) (id int, err error)

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

func (*TenantQuery) FirstIDX

func (tq *TenantQuery) FirstIDX(ctx context.Context) int

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

func (*TenantQuery) FirstX

func (tq *TenantQuery) FirstX(ctx context.Context) *Tenant

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

func (*TenantQuery) GroupBy

func (tq *TenantQuery) GroupBy(field string, fields ...string) *TenantGroupBy

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

Example:

var v []struct {
	CreateTime time.Time `json:"create_time,omitempty"`
	Count int `json:"count,omitempty"`
}

client.Tenant.Query().
	GroupBy(tenant.FieldCreateTime).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*TenantQuery) IDs

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

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

func (*TenantQuery) IDsX

func (tq *TenantQuery) IDsX(ctx context.Context) []int

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

func (*TenantQuery) Limit

func (tq *TenantQuery) Limit(limit int) *TenantQuery

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

func (*TenantQuery) Offset

func (tq *TenantQuery) Offset(offset int) *TenantQuery

Offset to start from.

func (*TenantQuery) Only

func (tq *TenantQuery) Only(ctx context.Context) (*Tenant, error)

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

func (*TenantQuery) OnlyID

func (tq *TenantQuery) OnlyID(ctx context.Context) (id int, err error)

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

func (*TenantQuery) OnlyIDX

func (tq *TenantQuery) OnlyIDX(ctx context.Context) int

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

func (*TenantQuery) OnlyX

func (tq *TenantQuery) OnlyX(ctx context.Context) *Tenant

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

func (*TenantQuery) Order

func (tq *TenantQuery) Order(o ...tenant.OrderOption) *TenantQuery

Order specifies how the records should be ordered.

func (*TenantQuery) QueryConn

func (tq *TenantQuery) QueryConn() *TenantConnQuery

QueryConn chains the current query on the "conn" edge.

func (*TenantQuery) Select

func (tq *TenantQuery) Select(fields ...string) *TenantSelect

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

Example:

var v []struct {
	CreateTime time.Time `json:"create_time,omitempty"`
}

client.Tenant.Query().
	Select(tenant.FieldCreateTime).
	Scan(ctx, &v)

func (*TenantQuery) Unique

func (tq *TenantQuery) Unique(unique bool) *TenantQuery

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

func (tq *TenantQuery) Where(ps ...predicate.Tenant) *TenantQuery

Where adds a new predicate for the TenantQuery builder.

func (*TenantQuery) WithConn

func (tq *TenantQuery) WithConn(opts ...func(*TenantConnQuery)) *TenantQuery

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

type TenantSelect

type TenantSelect struct {
	*TenantQuery
	// contains filtered or unexported fields
}

TenantSelect is the builder for selecting fields of Tenant entities.

func (*TenantSelect) Aggregate

func (ts *TenantSelect) Aggregate(fns ...AggregateFunc) *TenantSelect

Aggregate adds the given aggregation functions to the selector query.

func (*TenantSelect) Bool

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

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

func (*TenantSelect) BoolX

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

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

func (*TenantSelect) Bools

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

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

func (*TenantSelect) BoolsX

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

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

func (*TenantSelect) Float64

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

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

func (*TenantSelect) Float64X

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

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

func (*TenantSelect) Float64s

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

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

func (*TenantSelect) Float64sX

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

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

func (*TenantSelect) Int

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

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

func (*TenantSelect) IntX

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

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

func (*TenantSelect) Ints

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

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

func (*TenantSelect) IntsX

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

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

func (*TenantSelect) Scan

func (ts *TenantSelect) Scan(ctx context.Context, v any) error

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

func (*TenantSelect) ScanX

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

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

func (*TenantSelect) String

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

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

func (*TenantSelect) StringX

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

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

func (*TenantSelect) Strings

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

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

func (*TenantSelect) StringsX

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

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

type TenantUpdate

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

TenantUpdate is the builder for updating Tenant entities.

func (*TenantUpdate) AddConn

func (tu *TenantUpdate) AddConn(t ...*TenantConn) *TenantUpdate

AddConn adds the "conn" edges to the TenantConn entity.

func (*TenantUpdate) AddConnIDs

func (tu *TenantUpdate) AddConnIDs(ids ...int) *TenantUpdate

AddConnIDs adds the "conn" edge to the TenantConn entity by IDs.

func (*TenantUpdate) ClearConn

func (tu *TenantUpdate) ClearConn() *TenantUpdate

ClearConn clears all "conn" edges to the TenantConn entity.

func (*TenantUpdate) ClearDisplayName

func (tu *TenantUpdate) ClearDisplayName() *TenantUpdate

ClearDisplayName clears the value of the "display_name" field.

func (*TenantUpdate) ClearRegion

func (tu *TenantUpdate) ClearRegion() *TenantUpdate

ClearRegion clears the value of the "region" field.

func (*TenantUpdate) Exec

func (tu *TenantUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*TenantUpdate) ExecX

func (tu *TenantUpdate) ExecX(ctx context.Context)

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

func (*TenantUpdate) Mutation

func (tu *TenantUpdate) Mutation() *TenantMutation

Mutation returns the TenantMutation object of the builder.

func (*TenantUpdate) RemoveConn

func (tu *TenantUpdate) RemoveConn(t ...*TenantConn) *TenantUpdate

RemoveConn removes "conn" edges to TenantConn entities.

func (*TenantUpdate) RemoveConnIDs

func (tu *TenantUpdate) RemoveConnIDs(ids ...int) *TenantUpdate

RemoveConnIDs removes the "conn" edge to TenantConn entities by IDs.

func (*TenantUpdate) Save

func (tu *TenantUpdate) Save(ctx context.Context) (int, error)

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

func (*TenantUpdate) SaveX

func (tu *TenantUpdate) SaveX(ctx context.Context) int

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

func (*TenantUpdate) SetDisplayName

func (tu *TenantUpdate) SetDisplayName(s string) *TenantUpdate

SetDisplayName sets the "display_name" field.

func (*TenantUpdate) SetName

func (tu *TenantUpdate) SetName(s string) *TenantUpdate

SetName sets the "name" field.

func (*TenantUpdate) SetNillableDisplayName

func (tu *TenantUpdate) SetNillableDisplayName(s *string) *TenantUpdate

SetNillableDisplayName sets the "display_name" field if the given value is not nil.

func (*TenantUpdate) SetNillableRegion

func (tu *TenantUpdate) SetNillableRegion(s *string) *TenantUpdate

SetNillableRegion sets the "region" field if the given value is not nil.

func (*TenantUpdate) SetRegion

func (tu *TenantUpdate) SetRegion(s string) *TenantUpdate

SetRegion sets the "region" field.

func (*TenantUpdate) SetUpdateTime

func (tu *TenantUpdate) SetUpdateTime(t time.Time) *TenantUpdate

SetUpdateTime sets the "update_time" field.

func (*TenantUpdate) Where

func (tu *TenantUpdate) Where(ps ...predicate.Tenant) *TenantUpdate

Where appends a list predicates to the TenantUpdate builder.

type TenantUpdateOne

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

TenantUpdateOne is the builder for updating a single Tenant entity.

func (*TenantUpdateOne) AddConn

func (tuo *TenantUpdateOne) AddConn(t ...*TenantConn) *TenantUpdateOne

AddConn adds the "conn" edges to the TenantConn entity.

func (*TenantUpdateOne) AddConnIDs

func (tuo *TenantUpdateOne) AddConnIDs(ids ...int) *TenantUpdateOne

AddConnIDs adds the "conn" edge to the TenantConn entity by IDs.

func (*TenantUpdateOne) ClearConn

func (tuo *TenantUpdateOne) ClearConn() *TenantUpdateOne

ClearConn clears all "conn" edges to the TenantConn entity.

func (*TenantUpdateOne) ClearDisplayName

func (tuo *TenantUpdateOne) ClearDisplayName() *TenantUpdateOne

ClearDisplayName clears the value of the "display_name" field.

func (*TenantUpdateOne) ClearRegion

func (tuo *TenantUpdateOne) ClearRegion() *TenantUpdateOne

ClearRegion clears the value of the "region" field.

func (*TenantUpdateOne) Exec

func (tuo *TenantUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*TenantUpdateOne) ExecX

func (tuo *TenantUpdateOne) ExecX(ctx context.Context)

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

func (*TenantUpdateOne) Mutation

func (tuo *TenantUpdateOne) Mutation() *TenantMutation

Mutation returns the TenantMutation object of the builder.

func (*TenantUpdateOne) RemoveConn

func (tuo *TenantUpdateOne) RemoveConn(t ...*TenantConn) *TenantUpdateOne

RemoveConn removes "conn" edges to TenantConn entities.

func (*TenantUpdateOne) RemoveConnIDs

func (tuo *TenantUpdateOne) RemoveConnIDs(ids ...int) *TenantUpdateOne

RemoveConnIDs removes the "conn" edge to TenantConn entities by IDs.

func (*TenantUpdateOne) Save

func (tuo *TenantUpdateOne) Save(ctx context.Context) (*Tenant, error)

Save executes the query and returns the updated Tenant entity.

func (*TenantUpdateOne) SaveX

func (tuo *TenantUpdateOne) SaveX(ctx context.Context) *Tenant

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

func (*TenantUpdateOne) Select

func (tuo *TenantUpdateOne) Select(field string, fields ...string) *TenantUpdateOne

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

func (*TenantUpdateOne) SetDisplayName

func (tuo *TenantUpdateOne) SetDisplayName(s string) *TenantUpdateOne

SetDisplayName sets the "display_name" field.

func (*TenantUpdateOne) SetName

func (tuo *TenantUpdateOne) SetName(s string) *TenantUpdateOne

SetName sets the "name" field.

func (*TenantUpdateOne) SetNillableDisplayName

func (tuo *TenantUpdateOne) SetNillableDisplayName(s *string) *TenantUpdateOne

SetNillableDisplayName sets the "display_name" field if the given value is not nil.

func (*TenantUpdateOne) SetNillableRegion

func (tuo *TenantUpdateOne) SetNillableRegion(s *string) *TenantUpdateOne

SetNillableRegion sets the "region" field if the given value is not nil.

func (*TenantUpdateOne) SetRegion

func (tuo *TenantUpdateOne) SetRegion(s string) *TenantUpdateOne

SetRegion sets the "region" field.

func (*TenantUpdateOne) SetUpdateTime

func (tuo *TenantUpdateOne) SetUpdateTime(t time.Time) *TenantUpdateOne

SetUpdateTime sets the "update_time" field.

func (*TenantUpdateOne) Where

func (tuo *TenantUpdateOne) Where(ps ...predicate.Tenant) *TenantUpdateOne

Where appends a list predicates to the TenantUpdate builder.

type TenantUpsert

type TenantUpsert struct {
	*sql.UpdateSet
}

TenantUpsert is the "OnConflict" setter.

func (*TenantUpsert) ClearDisplayName

func (u *TenantUpsert) ClearDisplayName() *TenantUpsert

ClearDisplayName clears the value of the "display_name" field.

func (*TenantUpsert) ClearRegion

func (u *TenantUpsert) ClearRegion() *TenantUpsert

ClearRegion clears the value of the "region" field.

func (*TenantUpsert) SetDisplayName

func (u *TenantUpsert) SetDisplayName(v string) *TenantUpsert

SetDisplayName sets the "display_name" field.

func (*TenantUpsert) SetName

func (u *TenantUpsert) SetName(v string) *TenantUpsert

SetName sets the "name" field.

func (*TenantUpsert) SetRegion

func (u *TenantUpsert) SetRegion(v string) *TenantUpsert

SetRegion sets the "region" field.

func (*TenantUpsert) SetUpdateTime

func (u *TenantUpsert) SetUpdateTime(v time.Time) *TenantUpsert

SetUpdateTime sets the "update_time" field.

func (*TenantUpsert) UpdateDisplayName

func (u *TenantUpsert) UpdateDisplayName() *TenantUpsert

UpdateDisplayName sets the "display_name" field to the value that was provided on create.

func (*TenantUpsert) UpdateName

func (u *TenantUpsert) UpdateName() *TenantUpsert

UpdateName sets the "name" field to the value that was provided on create.

func (*TenantUpsert) UpdateRegion

func (u *TenantUpsert) UpdateRegion() *TenantUpsert

UpdateRegion sets the "region" field to the value that was provided on create.

func (*TenantUpsert) UpdateUpdateTime

func (u *TenantUpsert) UpdateUpdateTime() *TenantUpsert

UpdateUpdateTime sets the "update_time" field to the value that was provided on create.

type TenantUpsertBulk

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

TenantUpsertBulk is the builder for "upsert"-ing a bulk of Tenant nodes.

func (*TenantUpsertBulk) ClearDisplayName

func (u *TenantUpsertBulk) ClearDisplayName() *TenantUpsertBulk

ClearDisplayName clears the value of the "display_name" field.

func (*TenantUpsertBulk) ClearRegion

func (u *TenantUpsertBulk) ClearRegion() *TenantUpsertBulk

ClearRegion clears the value of the "region" field.

func (*TenantUpsertBulk) DoNothing

func (u *TenantUpsertBulk) DoNothing() *TenantUpsertBulk

DoNothing configures the conflict_action to `DO NOTHING`. Supported only by SQLite and PostgreSQL.

func (*TenantUpsertBulk) Exec

func (u *TenantUpsertBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*TenantUpsertBulk) ExecX

func (u *TenantUpsertBulk) ExecX(ctx context.Context)

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

func (*TenantUpsertBulk) Ignore

func (u *TenantUpsertBulk) Ignore() *TenantUpsertBulk

Ignore sets each column to itself in case of conflict. Using this option is equivalent to using:

client.Tenant.Create().
	OnConflict(sql.ResolveWithIgnore()).
	Exec(ctx)

func (*TenantUpsertBulk) SetDisplayName

func (u *TenantUpsertBulk) SetDisplayName(v string) *TenantUpsertBulk

SetDisplayName sets the "display_name" field.

func (*TenantUpsertBulk) SetName

func (u *TenantUpsertBulk) SetName(v string) *TenantUpsertBulk

SetName sets the "name" field.

func (*TenantUpsertBulk) SetRegion

func (u *TenantUpsertBulk) SetRegion(v string) *TenantUpsertBulk

SetRegion sets the "region" field.

func (*TenantUpsertBulk) SetUpdateTime

func (u *TenantUpsertBulk) SetUpdateTime(v time.Time) *TenantUpsertBulk

SetUpdateTime sets the "update_time" field.

func (*TenantUpsertBulk) Update

func (u *TenantUpsertBulk) Update(set func(*TenantUpsert)) *TenantUpsertBulk

Update allows overriding fields `UPDATE` values. See the TenantCreateBulk.OnConflict documentation for more info.

func (*TenantUpsertBulk) UpdateDisplayName

func (u *TenantUpsertBulk) UpdateDisplayName() *TenantUpsertBulk

UpdateDisplayName sets the "display_name" field to the value that was provided on create.

func (*TenantUpsertBulk) UpdateName

func (u *TenantUpsertBulk) UpdateName() *TenantUpsertBulk

UpdateName sets the "name" field to the value that was provided on create.

func (*TenantUpsertBulk) UpdateNewValues

func (u *TenantUpsertBulk) UpdateNewValues() *TenantUpsertBulk

UpdateNewValues updates the mutable fields using the new values that were set on create. Using this option is equivalent to using:

client.Tenant.Create().
	OnConflict(
		sql.ResolveWithNewValues(),
		sql.ResolveWith(func(u *sql.UpdateSet) {
			u.SetIgnore(tenant.FieldID)
		}),
	).
	Exec(ctx)

func (*TenantUpsertBulk) UpdateRegion

func (u *TenantUpsertBulk) UpdateRegion() *TenantUpsertBulk

UpdateRegion sets the "region" field to the value that was provided on create.

func (*TenantUpsertBulk) UpdateUpdateTime

func (u *TenantUpsertBulk) UpdateUpdateTime() *TenantUpsertBulk

UpdateUpdateTime sets the "update_time" field to the value that was provided on create.

type TenantUpsertOne

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

TenantUpsertOne is the builder for "upsert"-ing

one Tenant node.

func (*TenantUpsertOne) ClearDisplayName

func (u *TenantUpsertOne) ClearDisplayName() *TenantUpsertOne

ClearDisplayName clears the value of the "display_name" field.

func (*TenantUpsertOne) ClearRegion

func (u *TenantUpsertOne) ClearRegion() *TenantUpsertOne

ClearRegion clears the value of the "region" field.

func (*TenantUpsertOne) DoNothing

func (u *TenantUpsertOne) DoNothing() *TenantUpsertOne

DoNothing configures the conflict_action to `DO NOTHING`. Supported only by SQLite and PostgreSQL.

func (*TenantUpsertOne) Exec

func (u *TenantUpsertOne) Exec(ctx context.Context) error

Exec executes the query.

func (*TenantUpsertOne) ExecX

func (u *TenantUpsertOne) ExecX(ctx context.Context)

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

func (*TenantUpsertOne) ID

func (u *TenantUpsertOne) ID(ctx context.Context) (id int, err error)

Exec executes the UPSERT query and returns the inserted/updated ID.

func (*TenantUpsertOne) IDX

func (u *TenantUpsertOne) IDX(ctx context.Context) int

IDX is like ID, but panics if an error occurs.

func (*TenantUpsertOne) Ignore

func (u *TenantUpsertOne) Ignore() *TenantUpsertOne

Ignore sets each column to itself in case of conflict. Using this option is equivalent to using:

client.Tenant.Create().
    OnConflict(sql.ResolveWithIgnore()).
    Exec(ctx)

func (*TenantUpsertOne) SetDisplayName

func (u *TenantUpsertOne) SetDisplayName(v string) *TenantUpsertOne

SetDisplayName sets the "display_name" field.

func (*TenantUpsertOne) SetName

func (u *TenantUpsertOne) SetName(v string) *TenantUpsertOne

SetName sets the "name" field.

func (*TenantUpsertOne) SetRegion

func (u *TenantUpsertOne) SetRegion(v string) *TenantUpsertOne

SetRegion sets the "region" field.

func (*TenantUpsertOne) SetUpdateTime

func (u *TenantUpsertOne) SetUpdateTime(v time.Time) *TenantUpsertOne

SetUpdateTime sets the "update_time" field.

func (*TenantUpsertOne) Update

func (u *TenantUpsertOne) Update(set func(*TenantUpsert)) *TenantUpsertOne

Update allows overriding fields `UPDATE` values. See the TenantCreate.OnConflict documentation for more info.

func (*TenantUpsertOne) UpdateDisplayName

func (u *TenantUpsertOne) UpdateDisplayName() *TenantUpsertOne

UpdateDisplayName sets the "display_name" field to the value that was provided on create.

func (*TenantUpsertOne) UpdateName

func (u *TenantUpsertOne) UpdateName() *TenantUpsertOne

UpdateName sets the "name" field to the value that was provided on create.

func (*TenantUpsertOne) UpdateNewValues

func (u *TenantUpsertOne) UpdateNewValues() *TenantUpsertOne

UpdateNewValues updates the mutable fields using the new values that were set on create except the ID field. Using this option is equivalent to using:

client.Tenant.Create().
	OnConflict(
		sql.ResolveWithNewValues(),
		sql.ResolveWith(func(u *sql.UpdateSet) {
			u.SetIgnore(tenant.FieldID)
		}),
	).
	Exec(ctx)

func (*TenantUpsertOne) UpdateRegion

func (u *TenantUpsertOne) UpdateRegion() *TenantUpsertOne

UpdateRegion sets the "region" field to the value that was provided on create.

func (*TenantUpsertOne) UpdateUpdateTime

func (u *TenantUpsertOne) UpdateUpdateTime() *TenantUpsertOne

UpdateUpdateTime sets the "update_time" field to the value that was provided on create.

type Tenants

type Tenants []*Tenant

Tenants is a parsable slice of Tenant.

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 {

	// Post is the client for interacting with the Post builders.
	Post *PostClient
	// Tenant is the client for interacting with the Tenant builders.
	Tenant *TenantClient
	// TenantConn is the client for interacting with the TenantConn builders.
	TenantConn *TenantConnClient
	// contains filtered or unexported fields
}

Tx is a transactional client that is created by calling Client.Tx().

func TxFromContext

func TxFromContext(ctx context.Context) *Tx

TxFromContext returns a Tx stored inside a context, or nil if there isn't one.

func (*Tx) Client

func (tx *Tx) Client() *Client

Client returns a Client that binds to current transaction.

func (*Tx) Commit

func (tx *Tx) Commit() error

Commit commits the transaction.

func (*Tx) OnCommit

func (tx *Tx) OnCommit(f CommitHook)

OnCommit adds a hook to call on commit.

func (*Tx) OnRollback

func (tx *Tx) OnRollback(f RollbackHook)

OnRollback adds a hook to call on rollback.

func (*Tx) Rollback

func (tx *Tx) Rollback() error

Rollback rollbacks the transaction.

type ValidationError

type ValidationError struct {
	Name string // Field or edge name.
	// contains filtered or unexported fields
}

ValidationError returns when validating a field or edge fails.

func (*ValidationError) Error

func (e *ValidationError) Error() string

Error implements the error interface.

func (*ValidationError) Unwrap

func (e *ValidationError) Unwrap() error

Unwrap implements the errors.Wrapper interface.

type Value

type Value = ent.Value

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL