generated

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2024 License: Apache-2.0 Imports: 28 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.
	TypeTenant = "Tenant"
)

Variables

View Source
var (
	// TenantOrderFieldCreatedAt orders Tenant by created_at.
	TenantOrderFieldCreatedAt = &TenantOrderField{
		Value: func(t *Tenant) (ent.Value, error) {
			return t.CreatedAt, nil
		},
		column: tenant.FieldCreatedAt,
		toTerm: tenant.ByCreatedAt,
		toCursor: func(t *Tenant) Cursor {
			return Cursor{
				ID:    t.ID,
				Value: t.CreatedAt,
			}
		},
	}
	// TenantOrderFieldUpdatedAt orders Tenant by updated_at.
	TenantOrderFieldUpdatedAt = &TenantOrderField{
		Value: func(t *Tenant) (ent.Value, error) {
			return t.UpdatedAt, nil
		},
		column: tenant.FieldUpdatedAt,
		toTerm: tenant.ByUpdatedAt,
		toCursor: func(t *Tenant) Cursor {
			return Cursor{
				ID:    t.ID,
				Value: t.UpdatedAt,
			}
		},
	}
	// TenantOrderFieldName orders Tenant by name.
	TenantOrderFieldName = &TenantOrderField{
		Value: func(t *Tenant) (ent.Value, error) {
			return t.Name, nil
		},
		column: tenant.FieldName,
		toTerm: tenant.ByName,
		toCursor: func(t *Tenant) Cursor {
			return Cursor{
				ID:    t.ID,
				Value: t.Name,
			}
		},
	}
)
View Source
var DefaultTenantOrder = &TenantOrder{
	Direction: entgql.OrderDirectionAsc,
	Field: &TenantOrderField{
		Value: func(t *Tenant) (ent.Value, error) {
			return t.ID, nil
		},
		column: tenant.FieldID,
		toTerm: tenant.ByID,
		toCursor: func(t *Tenant) Cursor {
			return Cursor{ID: t.ID}
		},
	},
}

DefaultTenantOrder is the default ordering of Tenant.

View Source
var ErrEmptyTenantWhereInput = errors.New("generated: empty predicate TenantWhereInput")

ErrEmptyTenantWhereInput is returned in case the TenantWhereInput is empty.

View Source
var ErrTxStarted = errors.New("generated: 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.

func OpenTxFromContext

func OpenTxFromContext(ctx context.Context) (context.Context, driver.Tx, error)

OpenTxFromContext open transactions from client stored in context.

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(generated.As(generated.Sum(field1), "sum_field1"), (generated.As(generated.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
	// Tenant is the client for interacting with the Tenant builders.
	Tenant *TenantClient
	// 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().
	Tenant.
	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) Noder

func (c *Client) Noder(ctx context.Context, id gidx.PrefixedID, opts ...NodeOption) (_ Noder, err error)

Noder returns a Node by its id. If the NodeType was not provided, it will be derived from the id value according to the universal-id configuration.

c.Noder(ctx, id)
c.Noder(ctx, id, ent.WithNodeType(typeResolver))

func (*Client) Noders

func (c *Client) Noders(ctx context.Context, ids []gidx.PrefixedID, opts ...NodeOption) ([]Noder, error)

func (*Client) OpenTx

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

OpenTx opens a transaction and returns a transactional context along with the created transaction.

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 CreateTenantInput

type CreateTenantInput struct {
	Name        string
	Description *string
	ParentID    *gidx.PrefixedID
}

CreateTenantInput represents a mutation input for creating tenants.

func (*CreateTenantInput) Mutate

func (i *CreateTenantInput) Mutate(m *TenantMutation)

Mutate applies the CreateTenantInput on the TenantMutation builder.

type Cursor

type Cursor = entgql.Cursor[gidx.PrefixedID]

Common entgql types.

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 MetadataNode

type MetadataNode interface {
	IsMetadataNode()
	IsEntity()
}

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 NodeOption

type NodeOption func(*nodeOptions)

NodeOption allows configuring the Noder execution using functional options.

func WithFixedNodeType

func WithFixedNodeType(t string) NodeOption

WithFixedNodeType sets the Type of the node to a fixed value.

func WithNodeType

func WithNodeType(f func(context.Context, gidx.PrefixedID) (string, error)) NodeOption

WithNodeType sets the node Type resolver function (i.e. the table to query). If was not provided, the table will be derived from the universal-id configuration as described in: https://entgo.io/docs/migrate/#universal-ids.

type Noder

type Noder interface {
	IsNode()
}

Noder wraps the basic Node method.

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 EventsPublisher

func EventsPublisher(v events.Connection) Option

EventsPublisher configures the EventsPublisher.

func Log

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

Log sets the logging function for debug mode.

type OrderDirection

type OrderDirection = entgql.OrderDirection

Common entgql types.

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 PageInfo

type PageInfo = entgql.PageInfo[gidx.PrefixedID]

Common entgql types.

type Policy

type Policy = ent.Policy

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

type Querier

type Querier = ent.Querier

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

type QuerierFunc

type QuerierFunc = ent.QuerierFunc

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

type Query

type Query = ent.Query

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

type QueryContext

type QueryContext = ent.QueryContext

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

type ResourceOwner

type ResourceOwner interface {
	IsResourceOwner()
	IsEntity()
}

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 for the tenant.
	ID gidx.PrefixedID `json:"id,omitempty"`
	// CreatedAt holds the value of the "created_at" field.
	CreatedAt time.Time `json:"created_at,omitempty"`
	// UpdatedAt holds the value of the "updated_at" field.
	UpdatedAt time.Time `json:"updated_at,omitempty"`
	// The name of a tenant.
	Name string `json:"name,omitempty"`
	// An optional description of the tenant.
	Description string `json:"description,omitempty"`
	// The ID of the parent tenant for the tenant.
	ParentTenantID gidx.PrefixedID `json:"parent_tenant_id,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
}

Representation of a tenant.

func (*Tenant) Children

func (t *Tenant) Children(
	ctx context.Context, after *Cursor, first *int, before *Cursor, last *int, orderBy *TenantOrder, where *TenantWhereInput,
) (*TenantConnection, error)

func (Tenant) IsEntity

func (t Tenant) IsEntity()

IsEntity implement fedruntime.Entity

func (*Tenant) IsMetadataNode

func (*Tenant) IsMetadataNode()

IsMetadataNode implements the MetadataNode interface check for GQLGen.

func (*Tenant) IsNode

func (*Tenant) IsNode()

IsNode implements the Node interface check for GQLGen.

func (*Tenant) IsResourceOwner

func (*Tenant) IsResourceOwner()

IsResourceOwner implements the ResourceOwner interface check for GQLGen.

func (*Tenant) NamedChildren

func (t *Tenant) NamedChildren(name string) ([]*Tenant, error)

NamedChildren returns the Children named value or an error if the edge was not loaded in eager-loading with this name.

func (*Tenant) Parent

func (t *Tenant) Parent(ctx context.Context) (*Tenant, error)

func (*Tenant) QueryChildren

func (t *Tenant) QueryChildren() *TenantQuery

QueryChildren queries the "children" edge of the Tenant entity.

func (*Tenant) QueryParent

func (t *Tenant) QueryParent() *TenantQuery

QueryParent queries the "parent" edge of the Tenant entity.

func (*Tenant) String

func (t *Tenant) String() string

String implements the fmt.Stringer.

func (*Tenant) ToEdge

func (t *Tenant) ToEdge(order *TenantOrder) *TenantEdge

ToEdge converts Tenant into TenantEdge.

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 gidx.PrefixedID) *TenantDeleteOne

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

func (*TenantClient) Get

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

Get returns a Tenant entity by its id.

func (*TenantClient) GetX

func (c *TenantClient) GetX(ctx context.Context, id gidx.PrefixedID) *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 added in v0.2.2

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

func (c *TenantClient) QueryChildren(t *Tenant) *TenantQuery

QueryChildren queries the children edge of a Tenant.

func (*TenantClient) QueryParent

func (c *TenantClient) QueryParent(t *Tenant) *TenantQuery

QueryParent queries the parent 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 gidx.PrefixedID) *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 TenantConnection

type TenantConnection struct {
	Edges      []*TenantEdge `json:"edges"`
	PageInfo   PageInfo      `json:"pageInfo"`
	TotalCount int           `json:"totalCount"`
}

TenantConnection is the connection containing edges to Tenant.

type TenantCreate

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

TenantCreate is the builder for creating a Tenant entity.

func (*TenantCreate) AddChildIDs

func (tc *TenantCreate) AddChildIDs(ids ...gidx.PrefixedID) *TenantCreate

AddChildIDs adds the "children" edge to the Tenant entity by IDs.

func (*TenantCreate) AddChildren

func (tc *TenantCreate) AddChildren(t ...*Tenant) *TenantCreate

AddChildren adds the "children" edges to the Tenant entity.

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

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

SetCreatedAt sets the "created_at" field.

func (*TenantCreate) SetDescription

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

SetDescription sets the "description" field.

func (*TenantCreate) SetID

func (tc *TenantCreate) SetID(gi gidx.PrefixedID) *TenantCreate

SetID sets the "id" field.

func (*TenantCreate) SetInput

SetInput applies the change-set in the CreateTenantInput on the TenantCreate builder.

func (*TenantCreate) SetName

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

SetName sets the "name" field.

func (*TenantCreate) SetNillableCreatedAt

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

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

func (*TenantCreate) SetNillableDescription

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

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

func (*TenantCreate) SetNillableID

func (tc *TenantCreate) SetNillableID(gi *gidx.PrefixedID) *TenantCreate

SetNillableID sets the "id" field if the given value is not nil.

func (*TenantCreate) SetNillableParentID

func (tc *TenantCreate) SetNillableParentID(id *gidx.PrefixedID) *TenantCreate

SetNillableParentID sets the "parent" edge to the Tenant entity by ID if the given value is not nil.

func (*TenantCreate) SetNillableParentTenantID

func (tc *TenantCreate) SetNillableParentTenantID(gi *gidx.PrefixedID) *TenantCreate

SetNillableParentTenantID sets the "parent_tenant_id" field if the given value is not nil.

func (*TenantCreate) SetNillableUpdatedAt

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

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

func (*TenantCreate) SetParent

func (tc *TenantCreate) SetParent(t *Tenant) *TenantCreate

SetParent sets the "parent" edge to the Tenant entity.

func (*TenantCreate) SetParentID

func (tc *TenantCreate) SetParentID(id gidx.PrefixedID) *TenantCreate

SetParentID sets the "parent" edge to the Tenant entity by ID.

func (*TenantCreate) SetParentTenantID

func (tc *TenantCreate) SetParentTenantID(gi gidx.PrefixedID) *TenantCreate

SetParentTenantID sets the "parent_tenant_id" field.

func (*TenantCreate) SetUpdatedAt

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

SetUpdatedAt sets the "updated_at" 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) 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 TenantEdge

type TenantEdge struct {
	Node   *Tenant `json:"node"`
	Cursor Cursor  `json:"cursor"`
}

TenantEdge is the edge representation of Tenant.

type TenantEdges

type TenantEdges struct {
	// Parent holds the value of the parent edge.
	Parent *Tenant `json:"parent,omitempty"`
	// Children holds the value of the children edge.
	Children []*Tenant `json:"children,omitempty"`
	// contains filtered or unexported fields
}

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

func (TenantEdges) ChildrenOrErr

func (e TenantEdges) ChildrenOrErr() ([]*Tenant, error)

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

func (TenantEdges) ParentOrErr

func (e TenantEdges) ParentOrErr() (*Tenant, error)

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

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

func (m *TenantMutation) AddChildIDs(ids ...gidx.PrefixedID)

AddChildIDs adds the "children" edge to the Tenant 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) ChildrenCleared

func (m *TenantMutation) ChildrenCleared() bool

ChildrenCleared reports if the "children" edge to the Tenant entity was cleared.

func (*TenantMutation) ChildrenIDs

func (m *TenantMutation) ChildrenIDs() (ids []gidx.PrefixedID)

ChildrenIDs returns the "children" edge IDs in the mutation.

func (*TenantMutation) ClearChildren

func (m *TenantMutation) ClearChildren()

ClearChildren clears the "children" edge to the Tenant entity.

func (*TenantMutation) ClearDescription

func (m *TenantMutation) ClearDescription()

ClearDescription clears the value of the "description" 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) ClearParent

func (m *TenantMutation) ClearParent()

ClearParent clears the "parent" edge to the Tenant entity.

func (*TenantMutation) ClearParentTenantID

func (m *TenantMutation) ClearParentTenantID()

ClearParentTenantID clears the value of the "parent_tenant_id" 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) CreatedAt

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

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

func (*TenantMutation) Description

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

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

func (*TenantMutation) DescriptionCleared

func (m *TenantMutation) DescriptionCleared() bool

DescriptionCleared returns if the "description" 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 gidx.PrefixedID, 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

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

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

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

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

OldDescription returns the old "description" 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) OldParentTenantID

func (m *TenantMutation) OldParentTenantID(ctx context.Context) (v gidx.PrefixedID, err error)

OldParentTenantID returns the old "parent_tenant_id" 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) OldUpdatedAt

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

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

func (m *TenantMutation) ParentCleared() bool

ParentCleared reports if the "parent" edge to the Tenant entity was cleared.

func (*TenantMutation) ParentID

func (m *TenantMutation) ParentID() (id gidx.PrefixedID, exists bool)

ParentID returns the "parent" edge ID in the mutation.

func (*TenantMutation) ParentIDs

func (m *TenantMutation) ParentIDs() (ids []gidx.PrefixedID)

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

func (*TenantMutation) ParentTenantID

func (m *TenantMutation) ParentTenantID() (r gidx.PrefixedID, exists bool)

ParentTenantID returns the value of the "parent_tenant_id" field in the mutation.

func (*TenantMutation) ParentTenantIDCleared

func (m *TenantMutation) ParentTenantIDCleared() bool

ParentTenantIDCleared returns if the "parent_tenant_id" field was cleared in this mutation.

func (*TenantMutation) RemoveChildIDs

func (m *TenantMutation) RemoveChildIDs(ids ...gidx.PrefixedID)

RemoveChildIDs removes the "children" edge to the Tenant entity by IDs.

func (*TenantMutation) RemovedChildrenIDs

func (m *TenantMutation) RemovedChildrenIDs() (ids []gidx.PrefixedID)

RemovedChildren returns the removed IDs of the "children" edge to the Tenant 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) ResetChildren

func (m *TenantMutation) ResetChildren()

ResetChildren resets all changes to the "children" edge.

func (*TenantMutation) ResetCreatedAt

func (m *TenantMutation) ResetCreatedAt()

ResetCreatedAt resets all changes to the "created_at" field.

func (*TenantMutation) ResetDescription

func (m *TenantMutation) ResetDescription()

ResetDescription resets all changes to the "description" 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) ResetParent

func (m *TenantMutation) ResetParent()

ResetParent resets all changes to the "parent" edge.

func (*TenantMutation) ResetParentTenantID

func (m *TenantMutation) ResetParentTenantID()

ResetParentTenantID resets all changes to the "parent_tenant_id" field.

func (*TenantMutation) ResetUpdatedAt

func (m *TenantMutation) ResetUpdatedAt()

ResetUpdatedAt resets all changes to the "updated_at" field.

func (*TenantMutation) SetCreatedAt

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

SetCreatedAt sets the "created_at" field.

func (*TenantMutation) SetDescription

func (m *TenantMutation) SetDescription(s string)

SetDescription sets the "description" 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 gidx.PrefixedID)

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

func (m *TenantMutation) SetParentID(id gidx.PrefixedID)

SetParentID sets the "parent" edge to the Tenant entity by id.

func (*TenantMutation) SetParentTenantID

func (m *TenantMutation) SetParentTenantID(gi gidx.PrefixedID)

SetParentTenantID sets the "parent_tenant_id" field.

func (*TenantMutation) SetUpdatedAt

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

SetUpdatedAt sets the "updated_at" 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) UpdatedAt

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

UpdatedAt returns the value of the "updated_at" 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 TenantOrder

type TenantOrder struct {
	Direction OrderDirection    `json:"direction"`
	Field     *TenantOrderField `json:"field"`
}

TenantOrder defines the ordering of Tenant.

type TenantOrderField

type TenantOrderField struct {
	// Value extracts the ordering value from the given Tenant.
	Value func(*Tenant) (ent.Value, error)
	// contains filtered or unexported fields
}

TenantOrderField defines the ordering field of Tenant.

func (TenantOrderField) MarshalGQL

func (f TenantOrderField) MarshalGQL(w io.Writer)

MarshalGQL implements graphql.Marshaler interface.

func (TenantOrderField) String

func (f TenantOrderField) String() string

String implement fmt.Stringer interface.

func (*TenantOrderField) UnmarshalGQL

func (f *TenantOrderField) UnmarshalGQL(v interface{}) error

UnmarshalGQL implements graphql.Unmarshaler interface.

type TenantPaginateOption

type TenantPaginateOption func(*tenantPager) error

TenantPaginateOption enables pagination customization.

func WithTenantFilter

func WithTenantFilter(filter func(*TenantQuery) (*TenantQuery, error)) TenantPaginateOption

WithTenantFilter configures pagination filter.

func WithTenantOrder

func WithTenantOrder(order *TenantOrder) TenantPaginateOption

WithTenantOrder configures pagination ordering.

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

func (t *TenantQuery) CollectFields(ctx context.Context, satisfies ...string) (*TenantQuery, error)

CollectFields tells the query-builder to eagerly load connected nodes by resolver context.

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 gidx.PrefixedID, 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) gidx.PrefixedID

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

client.Tenant.Query().
	GroupBy(tenant.FieldCreatedAt).
	Aggregate(generated.Count()).
	Scan(ctx, &v)

func (*TenantQuery) IDs

func (tq *TenantQuery) IDs(ctx context.Context) (ids []gidx.PrefixedID, err error)

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

func (*TenantQuery) IDsX

func (tq *TenantQuery) IDsX(ctx context.Context) []gidx.PrefixedID

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 gidx.PrefixedID, 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) gidx.PrefixedID

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

func (t *TenantQuery) Paginate(
	ctx context.Context, after *Cursor, first *int,
	before *Cursor, last *int, opts ...TenantPaginateOption,
) (*TenantConnection, error)

Paginate executes the query and returns a relay based cursor connection to Tenant.

func (*TenantQuery) QueryChildren

func (tq *TenantQuery) QueryChildren() *TenantQuery

QueryChildren chains the current query on the "children" edge.

func (*TenantQuery) QueryParent

func (tq *TenantQuery) QueryParent() *TenantQuery

QueryParent chains the current query on the "parent" 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 {
	CreatedAt time.Time `json:"created_at,omitempty"`
}

client.Tenant.Query().
	Select(tenant.FieldCreatedAt).
	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) WithChildren

func (tq *TenantQuery) WithChildren(opts ...func(*TenantQuery)) *TenantQuery

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

func (*TenantQuery) WithNamedChildren

func (tq *TenantQuery) WithNamedChildren(name string, opts ...func(*TenantQuery)) *TenantQuery

WithNamedChildren tells the query-builder to eager-load the nodes that are connected to the "children" edge with the given name. The optional arguments are used to configure the query builder of the edge.

func (*TenantQuery) WithParent

func (tq *TenantQuery) WithParent(opts ...func(*TenantQuery)) *TenantQuery

WithParent tells the query-builder to eager-load the nodes that are connected to the "parent" 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) AddChildIDs

func (tu *TenantUpdate) AddChildIDs(ids ...gidx.PrefixedID) *TenantUpdate

AddChildIDs adds the "children" edge to the Tenant entity by IDs.

func (*TenantUpdate) AddChildren

func (tu *TenantUpdate) AddChildren(t ...*Tenant) *TenantUpdate

AddChildren adds the "children" edges to the Tenant entity.

func (*TenantUpdate) ClearChildren

func (tu *TenantUpdate) ClearChildren() *TenantUpdate

ClearChildren clears all "children" edges to the Tenant entity.

func (*TenantUpdate) ClearDescription

func (tu *TenantUpdate) ClearDescription() *TenantUpdate

ClearDescription clears the value of the "description" 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) RemoveChildIDs

func (tu *TenantUpdate) RemoveChildIDs(ids ...gidx.PrefixedID) *TenantUpdate

RemoveChildIDs removes the "children" edge to Tenant entities by IDs.

func (*TenantUpdate) RemoveChildren

func (tu *TenantUpdate) RemoveChildren(t ...*Tenant) *TenantUpdate

RemoveChildren removes "children" edges to Tenant entities.

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

func (tu *TenantUpdate) SetDescription(s string) *TenantUpdate

SetDescription sets the "description" field.

func (*TenantUpdate) SetInput

SetInput applies the change-set in the UpdateTenantInput on the TenantUpdate builder.

func (*TenantUpdate) SetName

func (tu *TenantUpdate) SetName(s string) *TenantUpdate

SetName sets the "name" field.

func (*TenantUpdate) SetNillableDescription

func (tu *TenantUpdate) SetNillableDescription(s *string) *TenantUpdate

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

func (*TenantUpdate) SetNillableName added in v0.2.2

func (tu *TenantUpdate) SetNillableName(s *string) *TenantUpdate

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

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

func (tuo *TenantUpdateOne) AddChildIDs(ids ...gidx.PrefixedID) *TenantUpdateOne

AddChildIDs adds the "children" edge to the Tenant entity by IDs.

func (*TenantUpdateOne) AddChildren

func (tuo *TenantUpdateOne) AddChildren(t ...*Tenant) *TenantUpdateOne

AddChildren adds the "children" edges to the Tenant entity.

func (*TenantUpdateOne) ClearChildren

func (tuo *TenantUpdateOne) ClearChildren() *TenantUpdateOne

ClearChildren clears all "children" edges to the Tenant entity.

func (*TenantUpdateOne) ClearDescription

func (tuo *TenantUpdateOne) ClearDescription() *TenantUpdateOne

ClearDescription clears the value of the "description" 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) RemoveChildIDs

func (tuo *TenantUpdateOne) RemoveChildIDs(ids ...gidx.PrefixedID) *TenantUpdateOne

RemoveChildIDs removes the "children" edge to Tenant entities by IDs.

func (*TenantUpdateOne) RemoveChildren

func (tuo *TenantUpdateOne) RemoveChildren(t ...*Tenant) *TenantUpdateOne

RemoveChildren removes "children" edges to Tenant entities.

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

func (tuo *TenantUpdateOne) SetDescription(s string) *TenantUpdateOne

SetDescription sets the "description" field.

func (*TenantUpdateOne) SetInput

SetInput applies the change-set in the UpdateTenantInput on the TenantUpdateOne builder.

func (*TenantUpdateOne) SetName

func (tuo *TenantUpdateOne) SetName(s string) *TenantUpdateOne

SetName sets the "name" field.

func (*TenantUpdateOne) SetNillableDescription

func (tuo *TenantUpdateOne) SetNillableDescription(s *string) *TenantUpdateOne

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

func (*TenantUpdateOne) SetNillableName added in v0.2.2

func (tuo *TenantUpdateOne) SetNillableName(s *string) *TenantUpdateOne

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

func (*TenantUpdateOne) Where

func (tuo *TenantUpdateOne) Where(ps ...predicate.Tenant) *TenantUpdateOne

Where appends a list predicates to the TenantUpdate builder.

type TenantWhereInput

type TenantWhereInput struct {
	Predicates []predicate.Tenant  `json:"-"`
	Not        *TenantWhereInput   `json:"not,omitempty"`
	Or         []*TenantWhereInput `json:"or,omitempty"`
	And        []*TenantWhereInput `json:"and,omitempty"`

	// "id" field predicates.
	ID      *gidx.PrefixedID  `json:"id,omitempty"`
	IDNEQ   *gidx.PrefixedID  `json:"idNEQ,omitempty"`
	IDIn    []gidx.PrefixedID `json:"idIn,omitempty"`
	IDNotIn []gidx.PrefixedID `json:"idNotIn,omitempty"`
	IDGT    *gidx.PrefixedID  `json:"idGT,omitempty"`
	IDGTE   *gidx.PrefixedID  `json:"idGTE,omitempty"`
	IDLT    *gidx.PrefixedID  `json:"idLT,omitempty"`
	IDLTE   *gidx.PrefixedID  `json:"idLTE,omitempty"`

	// "created_at" field predicates.
	CreatedAt      *time.Time  `json:"createdAt,omitempty"`
	CreatedAtNEQ   *time.Time  `json:"createdAtNEQ,omitempty"`
	CreatedAtIn    []time.Time `json:"createdAtIn,omitempty"`
	CreatedAtNotIn []time.Time `json:"createdAtNotIn,omitempty"`
	CreatedAtGT    *time.Time  `json:"createdAtGT,omitempty"`
	CreatedAtGTE   *time.Time  `json:"createdAtGTE,omitempty"`
	CreatedAtLT    *time.Time  `json:"createdAtLT,omitempty"`
	CreatedAtLTE   *time.Time  `json:"createdAtLTE,omitempty"`

	// "updated_at" field predicates.
	UpdatedAt      *time.Time  `json:"updatedAt,omitempty"`
	UpdatedAtNEQ   *time.Time  `json:"updatedAtNEQ,omitempty"`
	UpdatedAtIn    []time.Time `json:"updatedAtIn,omitempty"`
	UpdatedAtNotIn []time.Time `json:"updatedAtNotIn,omitempty"`
	UpdatedAtGT    *time.Time  `json:"updatedAtGT,omitempty"`
	UpdatedAtGTE   *time.Time  `json:"updatedAtGTE,omitempty"`
	UpdatedAtLT    *time.Time  `json:"updatedAtLT,omitempty"`
	UpdatedAtLTE   *time.Time  `json:"updatedAtLTE,omitempty"`

	// "parent" edge predicates.
	HasParent     *bool               `json:"hasParent,omitempty"`
	HasParentWith []*TenantWhereInput `json:"hasParentWith,omitempty"`

	// "children" edge predicates.
	HasChildren     *bool               `json:"hasChildren,omitempty"`
	HasChildrenWith []*TenantWhereInput `json:"hasChildrenWith,omitempty"`
}

TenantWhereInput represents a where input for filtering Tenant queries.

func (*TenantWhereInput) AddPredicates

func (i *TenantWhereInput) AddPredicates(predicates ...predicate.Tenant)

AddPredicates adds custom predicates to the where input to be used during the filtering phase.

func (*TenantWhereInput) Filter

func (i *TenantWhereInput) Filter(q *TenantQuery) (*TenantQuery, error)

Filter applies the TenantWhereInput filter on the TenantQuery builder.

func (*TenantWhereInput) P

P returns a predicate for filtering tenants. An error is returned if the input is empty or invalid.

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 {

	// Tenant is the client for interacting with the Tenant builders.
	Tenant *TenantClient
	// 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 UpdateTenantInput

type UpdateTenantInput struct {
	Name             *string
	ClearDescription bool
	Description      *string
}

UpdateTenantInput represents a mutation input for updating tenants.

func (*UpdateTenantInput) Mutate

func (i *UpdateTenantInput) Mutate(m *TenantMutation)

Mutate applies the UpdateTenantInput on the TenantMutation builder.

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