testschema

package
v0.0.0-...-c788970 Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2026 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const (
	OpCreate    = ent.OpCreate
	OpUpdate    = ent.OpUpdate
	OpUpdateOne = ent.OpUpdateOne
	OpDelete    = ent.OpDelete
	OpDeleteOne = ent.OpDeleteOne

	TypeGroup = "Group"

	TypePet = "Pet"

	TypeUser = "User"
)

Variables

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

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

Functions

func Avg

func Avg[E any, T ent.Number](column ent.ColumnOf[E, T]) ent.SelectionOf[float64]

func Count

func Count() ent.SelectionOf[int]

func CountColumn

func CountColumn[E, T any](column ent.ColumnOf[E, T]) ent.SelectionOf[int]

func ExprSelection

func ExprSelection[T any](expression ent.Expr[T], alias string) ent.SelectionOf[T]

func Get

func Get[T any](row *Row, selection ent.SelectionOf[T]) T

func GetNullable

func GetNullable[T any](row *Row, selection ent.SelectionOf[T]) (T, bool)

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 Max

func Max[E, T any](column ent.ColumnOf[E, T]) ent.SelectionOf[T]

func Min

func Min[E, T any](column ent.ColumnOf[E, T]) ent.SelectionOf[T]

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 Sum

func Sum[E any, T ent.Number](column ent.ColumnOf[E, T]) ent.SelectionOf[T]

func Values

func Values[T any](ctx context.Context, query ent.RowsQuerier, selection ent.SelectionOf[T]) ([]T, error)

func ValuesNullable

func ValuesNullable[T any](ctx context.Context, query ent.RowsQuerier, selection ent.SelectionOf[T]) ([]*T, error)

Types

type Client

type Client struct {

	// Schema is the client for creating, migrating and dropping schema.
	Schema *migrate.Schema
	// Group is the client for interacting with the Group builders.
	Group *GroupClient
	// Pet is the client for interacting with the Pet builders.
	Pet *PetClient
	// User is the client for interacting with the User builders.
	User *UserClient
	// 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 ...ClientOption) *Client

NewClient creates a new client configured with the given options.

func Open

func Open(driverName, dataSourceName string, options ...ClientOption) (*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. ClientOptional 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().
	Group.
	Query().
	Count(ctx)

func (*Client) Driver

func (c *Client) Driver() dialect.Driver

Driver returns the driver bound to this client or transaction.

func (*Client) Mutate

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

Mutate executes the given mutation.

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.

type ClientOption

type ClientOption func(*config)

ClientOption function to configure the client.

func Debug

func Debug() ClientOption

Debug enables debug logging on the ent.Driver.

func Driver

func Driver(driver dialect.Driver) ClientOption

Driver configures the client driver.

func Log

func Log(fn func(...any)) ClientOption

Log sets the logging function for debug mode.

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 Expr

type Expr[T any] = ent.Expr[T]

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

func Excluded

func Excluded[E, T any](column ent.ColumnOf[E, T]) Expr[T]

func Literal

func Literal[T any](value T) Expr[T]

type Group

type Group struct {

	// ID of the ent.
	ID int `json:"id,omitempty"`
	// Name holds the value of the "name" field.
	Name string `json:"name,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the GroupQuery when eager-loading is set.
	Edges GroupEdges `json:"edges"`
	// contains filtered or unexported fields
}

Group is the model entity for the Group schema.

func (*Group) QueryUsers

func (_m *Group) QueryUsers() *UserQuery

QueryUsers queries the "users" edge of the Group entity.

func (*Group) String

func (_m *Group) String() string

String implements the fmt.Stringer.

func (*Group) Unwrap

func (_m *Group) Unwrap() *Group

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

func (_m *Group) Update() *GroupUpdateOne

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

type GroupClient

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

GroupClient is a client for the Group schema.

func NewGroupClient

func NewGroupClient(c config) *GroupClient

NewGroupClient returns a client for the Group from the given config.

func (*GroupClient) Create

func (c *GroupClient) Create() *GroupCreate

Create returns a builder for creating a Group entity.

func (*GroupClient) CreateBulk

func (c *GroupClient) CreateBulk(builders ...*GroupCreate) *GroupCreateBulk

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

func (*GroupClient) Delete

func (c *GroupClient) Delete() *GroupDelete

Delete returns a delete builder for Group.

func (*GroupClient) DeleteOne

func (c *GroupClient) DeleteOne(_m *Group) *GroupDeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*GroupClient) DeleteOneID

func (c *GroupClient) DeleteOneID(id int) *GroupDeleteOne

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

func (*GroupClient) Get

func (c *GroupClient) Get(ctx context.Context, id int) (*Group, error)

Get returns a Group entity by its id.

func (*GroupClient) GetX

func (c *GroupClient) GetX(ctx context.Context, id int) *Group

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

func (*GroupClient) Insert

func (c *GroupClient) Insert(value GroupInsert) *GroupCreate

func (*GroupClient) InsertBulk

func (c *GroupClient) InsertBulk(values ...GroupInsert) *GroupCreateBulk

func (*GroupClient) MapCreateBulk

func (c *GroupClient) MapCreateBulk(slice any, setFunc func(*GroupCreate, int)) *GroupCreateBulk

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

func (c *GroupClient) Query() *GroupQuery

Query returns a query builder for Group.

func (*GroupClient) QueryUsers

func (c *GroupClient) QueryUsers(_m *Group) *UserQuery

QueryUsers queries the users edge of a Group.

func (*GroupClient) Update

func (c *GroupClient) Update() *GroupUpdate

Update returns an update builder for Group.

func (*GroupClient) UpdateOne

func (c *GroupClient) UpdateOne(_m *Group) *GroupUpdateOne

UpdateOne returns an update builder for the given entity.

func (*GroupClient) UpdateOneID

func (c *GroupClient) UpdateOneID(id int) *GroupUpdateOne

UpdateOneID returns an update builder for the given id.

type GroupCreate

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

func (*GroupCreate) AddIDs

func (b *GroupCreate) AddIDs[N, K any](edge ent.Relation[entity.Group, N, K], ids ...K) *GroupCreate

func (*GroupCreate) Exec

func (b *GroupCreate) Exec(ctx context.Context) error

func (*GroupCreate) ExecX

func (b *GroupCreate) ExecX(ctx context.Context)

func (*GroupCreate) Insert

func (b *GroupCreate) Insert() *GroupInsert

func (*GroupCreate) Mutation

func (b *GroupCreate) Mutation() *GroupMutation

func (*GroupCreate) OnConflict

func (b *GroupCreate) OnConflict(columns ...ent.EntityColumn[entity.Group]) *GroupUpsertOne

func (*GroupCreate) OnConflictConstraint

func (b *GroupCreate) OnConflictConstraint(name string) *GroupUpsertOne

func (*GroupCreate) OnConflictOptions

func (b *GroupCreate) OnConflictOptions(options ...sql.ConflictOption) *GroupUpsertOne

func (*GroupCreate) Save

func (b *GroupCreate) Save(ctx context.Context) (*Group, error)

func (*GroupCreate) SaveX

func (b *GroupCreate) SaveX(ctx context.Context) *Group

func (*GroupCreate) Set

func (b *GroupCreate) Set[T any](column ent.ColumnOf[entity.Group, T], value T) *GroupCreate

func (*GroupCreate) SetEdge

func (b *GroupCreate) SetEdge[N, K any](edge ent.UniqueRelation[entity.Group, N, K], id K) *GroupCreate

func (*GroupCreate) SetExpr

func (b *GroupCreate) SetExpr[T any](column ent.ColumnOf[entity.Group, T], value ent.Expr[T]) *GroupCreate

func (*GroupCreate) SetOptional

func (b *GroupCreate) SetOptional[T any](column ent.ColumnOf[entity.Group, T], value ent.Option[T]) *GroupCreate

type GroupCreateBulk

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

func (*GroupCreateBulk) Exec

func (b *GroupCreateBulk) Exec(ctx context.Context) error

func (*GroupCreateBulk) ExecX

func (b *GroupCreateBulk) ExecX(ctx context.Context)

func (*GroupCreateBulk) OnConflict

func (b *GroupCreateBulk) OnConflict(columns ...ent.EntityColumn[entity.Group]) *GroupUpsertBulk

func (*GroupCreateBulk) OnConflictConstraint

func (b *GroupCreateBulk) OnConflictConstraint(name string) *GroupUpsertBulk

func (*GroupCreateBulk) OnConflictOptions

func (b *GroupCreateBulk) OnConflictOptions(options ...sql.ConflictOption) *GroupUpsertBulk

func (*GroupCreateBulk) Save

func (_c *GroupCreateBulk) Save(ctx context.Context) ([]*Group, error)

func (*GroupCreateBulk) SaveX

func (b *GroupCreateBulk) SaveX(ctx context.Context) []*Group

type GroupDelete

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

GroupDelete is the builder for deleting a Group entity.

func (*GroupDelete) Exec

func (_d *GroupDelete) Exec(ctx context.Context) (int, error)

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

func (*GroupDelete) ExecX

func (_d *GroupDelete) ExecX(ctx context.Context) int

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

func (*GroupDelete) Returning

func (b *GroupDelete) Returning(ctx context.Context) ([]*Group, error)

func (*GroupDelete) Where

func (_d *GroupDelete) Where(predicates ...ent.Predicate[entity.Group]) *GroupDelete

Where appends a list predicates to the GroupDelete builder.

type GroupDeleteOne

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

GroupDeleteOne is the builder for deleting a single Group entity.

func (*GroupDeleteOne) Exec

func (_d *GroupDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*GroupDeleteOne) ExecX

func (_d *GroupDeleteOne) ExecX(ctx context.Context)

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

func (*GroupDeleteOne) Where

func (_d *GroupDeleteOne) Where(predicates ...ent.Predicate[entity.Group]) *GroupDeleteOne

Where appends a list predicates to the GroupDelete builder.

type GroupEdges

type GroupEdges struct {
	// Users holds the value of the users edge.
	Users []*User `json:"users,omitempty"`
	// contains filtered or unexported fields
}

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

func (GroupEdges) Count

func (e GroupEdges) Count[N, K any](edge ent.Relation[entity.Group, N, K]) (int, bool)

func (GroupEdges) Loaded

func (e GroupEdges) Loaded[N, K any](edge ent.RelationOf[entity.Group, N, K]) bool

func (*GroupEdges) SetLoaded

func (e *GroupEdges) SetLoaded[N, K any](edge ent.RelationOf[entity.Group, N, K], loaded bool)

func (GroupEdges) UsersOrErr

func (e GroupEdges) UsersOrErr() ([]*User, error)

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

type GroupGroupBy

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

GroupGroupBy is the group-by builder for Group entities.

func (*GroupGroupBy) Aggregate

func (_g *GroupGroupBy) Aggregate(selections ...ent.Selection) *GroupGroupBy

func (*GroupGroupBy) Rows

func (_g *GroupGroupBy) Rows(ctx context.Context) ([]*ent.Row, error)

func (*GroupGroupBy) Scan

func (_g *GroupGroupBy) Scan(ctx context.Context, v any) error

type GroupInsert

type GroupInsert struct {
	Name    string `json:"name"`
	UserIDs []int  `json:"user_ids,omitzero"`
	// contains filtered or unexported fields
}

GroupInsert is the write representation of a Group creation.

type GroupMutation

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

func (*GroupMutation) Client

func (m *GroupMutation) Client() *Client

func (*GroupMutation) ID

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

func (*GroupMutation) IDs

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

func (*GroupMutation) Insert

func (m *GroupMutation) Insert() *GroupInsert

func (*GroupMutation) Op

func (m *GroupMutation) Op() ent.Op

func (*GroupMutation) Patch

func (m *GroupMutation) Patch() *GroupPatch

func (*GroupMutation) Predicates

func (m *GroupMutation) Predicates() []ent.Predicate[entity.Group]

func (*GroupMutation) Tx

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

func (*GroupMutation) Type

func (m *GroupMutation) Type() string

func (*GroupMutation) Where

func (m *GroupMutation) Where(predicates ...ent.Predicate[entity.Group])

type GroupPatch

type GroupPatch struct {
	Name  ent.Option[string]     `json:"name,omitzero"`
	Users ent.RelationPatch[int] `json:"users,omitzero"`
	// contains filtered or unexported fields
}

GroupPatch is the write representation of a Group update.

type GroupQuery

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

GroupQuery is the builder for querying Group entities.

func (*GroupQuery) Aggregate

func (_q *GroupQuery) Aggregate(selections ...ent.Selection) *GroupSelect

Aggregate returns a GroupSelect configured with the given aggregations.

func (*GroupQuery) All

func (_q *GroupQuery) All(ctx context.Context) ([]*Group, error)

All executes the query and returns a list of Groups.

func (*GroupQuery) AllX

func (_q *GroupQuery) AllX(ctx context.Context) []*Group

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

func (*GroupQuery) Clone

func (_q *GroupQuery) Clone() *GroupQuery

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

func (*GroupQuery) Columns

func (_q *GroupQuery) Columns(columns ...ent.EntityColumn[entity.Group]) *GroupQuery

Columns narrows the entity columns loaded by this query, including when it is used as an eager-loading query. The ID and any columns required to bind loaded edges are always included.

func (*GroupQuery) Count

func (_q *GroupQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*GroupQuery) CountX

func (_q *GroupQuery) CountX(ctx context.Context) int

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

func (*GroupQuery) Exist

func (_q *GroupQuery) Exist(ctx context.Context) (bool, error)

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

func (*GroupQuery) ExistX

func (_q *GroupQuery) ExistX(ctx context.Context) bool

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

func (*GroupQuery) First

func (_q *GroupQuery) First(ctx context.Context) (*Group, error)

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

func (*GroupQuery) FirstID

func (_q *GroupQuery) FirstID(ctx context.Context) (id int, err error)

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

func (*GroupQuery) FirstIDX

func (_q *GroupQuery) FirstIDX(ctx context.Context) int

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

func (*GroupQuery) FirstX

func (_q *GroupQuery) FirstX(ctx context.Context) *Group

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

func (*GroupQuery) ForShare

func (_q *GroupQuery) ForShare(opts ...sql.LockOption) *GroupQuery

ForShare behaves similarly to ForUpdate, except that it acquires a shared mode lock on any rows that are read. Other sessions can read the rows, but cannot modify them until your transaction commits.

func (*GroupQuery) ForUpdate

func (_q *GroupQuery) ForUpdate(opts ...sql.LockOption) *GroupQuery

ForUpdate locks the selected rows against concurrent updates, and prevent them from being updated, deleted or "selected ... for update" by other sessions, until the transaction is either committed or rolled-back.

func (*GroupQuery) GroupBy

func (_q *GroupQuery) GroupBy(columns ...ent.EntityColumn[entity.Group]) *GroupGroupBy

GroupBy is used to group vertices by one or more fields/columns. It can be combined with typed aggregate selections.

Example:

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

client.Group.Query().
	GroupBy(group.Name).
	Aggregate(testschema.Count()).
	Scan(ctx, &v)

func (*GroupQuery) IDs

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

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

func (*GroupQuery) IDsX

func (_q *GroupQuery) IDsX(ctx context.Context) []int

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

func (*GroupQuery) Join

func (_q *GroupQuery) Join(table string, on ...func(*sql.Selector)) *GroupQuery

func (*GroupQuery) JoinAs

func (_q *GroupQuery) JoinAs(table, alias string, on ...func(*sql.Selector)) *GroupQuery

func (*GroupQuery) LeftJoin

func (_q *GroupQuery) LeftJoin(table string, on ...func(*sql.Selector)) *GroupQuery

func (*GroupQuery) LeftJoinAs

func (_q *GroupQuery) LeftJoinAs(table, alias string, on ...func(*sql.Selector)) *GroupQuery

func (*GroupQuery) Limit

func (_q *GroupQuery) Limit(limit int) *GroupQuery

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

func (*GroupQuery) Modify

func (_q *GroupQuery) Modify(modifiers ...func(s *sql.Selector)) *GroupQuery

Modify adds a query modifier for attaching custom logic to queries. It can be chained with the entity terminals (All, Count, ...) or with Select(...) for projections.

func (*GroupQuery) Offset

func (_q *GroupQuery) Offset(offset int) *GroupQuery

Offset to start from.

func (*GroupQuery) Only

func (_q *GroupQuery) Only(ctx context.Context) (*Group, error)

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

func (*GroupQuery) OnlyID

func (_q *GroupQuery) OnlyID(ctx context.Context) (id int, err error)

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

func (*GroupQuery) OnlyIDX

func (_q *GroupQuery) OnlyIDX(ctx context.Context) int

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

func (*GroupQuery) OnlyX

func (_q *GroupQuery) OnlyX(ctx context.Context) *Group

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

func (*GroupQuery) Order

func (_q *GroupQuery) Order(o ...ent.OrderOption[entity.Group]) *GroupQuery

Order specifies how the records should be ordered.

func (*GroupQuery) QueryUsers

func (_q *GroupQuery) QueryUsers() *UserQuery

QueryUsers chains the current query on the "users" edge.

func (*GroupQuery) Select

func (_q *GroupQuery) Select(selections ...ent.Selection) *GroupSelect

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

Example:

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

client.Group.Query().
	Select(group.Name).
	Scan(ctx, &v)

func (*GroupQuery) Unique

func (_q *GroupQuery) Unique(unique bool) *GroupQuery

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

func (_q *GroupQuery) Where(predicates ...ent.Predicate[entity.Group]) *GroupQuery

Where adds a new predicate for the GroupQuery builder.

func (*GroupQuery) WhereP

func (_q *GroupQuery) WhereP(predicates ...func(*sql.Selector)) *GroupQuery

func (*GroupQuery) WithCount

func (_q *GroupQuery) WithCount[N, K any](edge ent.Relation[entity.Group, N, K], predicates ...ent.Predicate[N]) *GroupQuery

WithCount loads the number of neighbors of a non-unique edge into each returned Group, readable with Edges.Count. Only neighbors matching all predicates are counted, and a parent with no matching neighbor reports a present count of zero. At most one count is kept per edge: a later call for the same edge is ignored.

func (*GroupQuery) WithUsers

func (_q *GroupQuery) WithUsers(opts ...func(*UserQuery)) *GroupQuery

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

type GroupSelect

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

GroupSelect is the builder for selecting fields of Group entities.

func (*GroupSelect) Aggregate

func (_s *GroupSelect) Aggregate(selections ...ent.Selection) *GroupSelect

func (*GroupSelect) Modify

func (_s *GroupSelect) Modify(modifiers ...func(s *sql.Selector)) *GroupSelect

Modify adds a query modifier for attaching custom logic to queries.

func (*GroupSelect) Row

func (_s *GroupSelect) Row(ctx context.Context) (*ent.Row, error)

func (*GroupSelect) Rows

func (_s *GroupSelect) Rows(ctx context.Context) ([]*ent.Row, error)

func (*GroupSelect) Scan

func (_s *GroupSelect) Scan(ctx context.Context, value any) error

type GroupUpdate

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

func (*GroupUpdate) Add

func (b *GroupUpdate) Add[T ent.Number](column ent.ColumnOf[entity.Group, T], delta T) *GroupUpdate

func (*GroupUpdate) AddIDs

func (b *GroupUpdate) AddIDs[N, K any](edge ent.Relation[entity.Group, N, K], ids ...K) *GroupUpdate

func (*GroupUpdate) Append

func (b *GroupUpdate) Append[T any](column ent.ColumnOf[entity.Group, T], values T) *GroupUpdate

func (*GroupUpdate) Apply

func (b *GroupUpdate) Apply(p GroupPatch) *GroupUpdate

func (*GroupUpdate) Clear

func (b *GroupUpdate) Clear[T any](column ent.ColumnOf[entity.Group, T]) *GroupUpdate

func (*GroupUpdate) ClearEdge

func (b *GroupUpdate) ClearEdge[N, K any](edge ent.RelationOf[entity.Group, N, K]) *GroupUpdate

func (*GroupUpdate) Exec

func (b *GroupUpdate) Exec(ctx context.Context) error

func (*GroupUpdate) ExecX

func (b *GroupUpdate) ExecX(ctx context.Context)

func (*GroupUpdate) Modify

func (_u *GroupUpdate) Modify(modifiers ...func(u *sql.UpdateBuilder)) *GroupUpdate

Modify adds a statement modifier for attaching custom logic to the UPDATE statement.

func (*GroupUpdate) Mutation

func (b *GroupUpdate) Mutation() *GroupMutation

func (*GroupUpdate) Patch

func (b *GroupUpdate) Patch() *GroupPatch

func (*GroupUpdate) RemoveIDs

func (b *GroupUpdate) RemoveIDs[N, K any](edge ent.Relation[entity.Group, N, K], ids ...K) *GroupUpdate

func (*GroupUpdate) Returning

func (b *GroupUpdate) Returning(ctx context.Context) ([]*Group, error)

func (*GroupUpdate) Save

func (b *GroupUpdate) Save(ctx context.Context) (int, error)

func (*GroupUpdate) SaveX

func (b *GroupUpdate) SaveX(ctx context.Context) int

func (*GroupUpdate) Set

func (b *GroupUpdate) Set[T any](column ent.ColumnOf[entity.Group, T], value T) *GroupUpdate

func (*GroupUpdate) SetEdge

func (b *GroupUpdate) SetEdge[N, K any](edge ent.UniqueRelation[entity.Group, N, K], id K) *GroupUpdate

func (*GroupUpdate) SetExpr

func (b *GroupUpdate) SetExpr[T any](column ent.ColumnOf[entity.Group, T], value ent.Expr[T]) *GroupUpdate

func (*GroupUpdate) SetOptional

func (b *GroupUpdate) SetOptional[T any](column ent.ColumnOf[entity.Group, T], value ent.Option[T]) *GroupUpdate

func (*GroupUpdate) Where

func (b *GroupUpdate) Where(predicates ...ent.Predicate[entity.Group]) *GroupUpdate

type GroupUpdateOne

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

func (*GroupUpdateOne) Add

func (b *GroupUpdateOne) Add[T ent.Number](column ent.ColumnOf[entity.Group, T], delta T) *GroupUpdateOne

func (*GroupUpdateOne) AddIDs

func (b *GroupUpdateOne) AddIDs[N, K any](edge ent.Relation[entity.Group, N, K], ids ...K) *GroupUpdateOne

func (*GroupUpdateOne) Append

func (b *GroupUpdateOne) Append[T any](column ent.ColumnOf[entity.Group, T], values T) *GroupUpdateOne

func (*GroupUpdateOne) Apply

func (*GroupUpdateOne) Clear

func (b *GroupUpdateOne) Clear[T any](column ent.ColumnOf[entity.Group, T]) *GroupUpdateOne

func (*GroupUpdateOne) ClearEdge

func (b *GroupUpdateOne) ClearEdge[N, K any](edge ent.RelationOf[entity.Group, N, K]) *GroupUpdateOne

func (*GroupUpdateOne) Columns

func (b *GroupUpdateOne) Columns(columns ...ent.EntityColumn[entity.Group]) *GroupUpdateOne

Columns narrows the entity columns returned by the update. The ID is always included.

func (*GroupUpdateOne) Exec

func (b *GroupUpdateOne) Exec(ctx context.Context) error

func (*GroupUpdateOne) ExecX

func (b *GroupUpdateOne) ExecX(ctx context.Context)

func (*GroupUpdateOne) Modify

func (_u *GroupUpdateOne) Modify(modifiers ...func(u *sql.UpdateBuilder)) *GroupUpdateOne

Modify adds a statement modifier for attaching custom logic to the UPDATE statement.

func (*GroupUpdateOne) Mutation

func (b *GroupUpdateOne) Mutation() *GroupMutation

func (*GroupUpdateOne) Patch

func (b *GroupUpdateOne) Patch() *GroupPatch

func (*GroupUpdateOne) RemoveIDs

func (b *GroupUpdateOne) RemoveIDs[N, K any](edge ent.Relation[entity.Group, N, K], ids ...K) *GroupUpdateOne

func (*GroupUpdateOne) Save

func (b *GroupUpdateOne) Save(ctx context.Context) (*Group, error)

func (*GroupUpdateOne) SaveOld

func (b *GroupUpdateOne) SaveOld(ctx context.Context) (old *Group, updated *Group, err error)

func (*GroupUpdateOne) SaveX

func (b *GroupUpdateOne) SaveX(ctx context.Context) *Group

func (*GroupUpdateOne) Set

func (b *GroupUpdateOne) Set[T any](column ent.ColumnOf[entity.Group, T], value T) *GroupUpdateOne

func (*GroupUpdateOne) SetEdge

func (b *GroupUpdateOne) SetEdge[N, K any](edge ent.UniqueRelation[entity.Group, N, K], id K) *GroupUpdateOne

func (*GroupUpdateOne) SetExpr

func (b *GroupUpdateOne) SetExpr[T any](column ent.ColumnOf[entity.Group, T], value ent.Expr[T]) *GroupUpdateOne

func (*GroupUpdateOne) SetOptional

func (b *GroupUpdateOne) SetOptional[T any](column ent.ColumnOf[entity.Group, T], value ent.Option[T]) *GroupUpdateOne

func (*GroupUpdateOne) Where

func (b *GroupUpdateOne) Where(predicates ...ent.Predicate[entity.Group]) *GroupUpdateOne

type GroupUpsert

type GroupUpsert struct{ *sql.UpdateSet }

func (*GroupUpsert) Add

func (u *GroupUpsert) Add[T ent.Number](column ent.ColumnOf[entity.Group, T], delta T) *GroupUpsert

func (*GroupUpsert) Clear

func (u *GroupUpsert) Clear[T any](column ent.ColumnOf[entity.Group, T]) *GroupUpsert

func (*GroupUpsert) Set

func (u *GroupUpsert) Set[T any](column ent.ColumnOf[entity.Group, T], value T) *GroupUpsert

func (*GroupUpsert) SetExpr

func (u *GroupUpsert) SetExpr[T any](column ent.ColumnOf[entity.Group, T], value ent.Expr[T]) *GroupUpsert

func (*GroupUpsert) UpdateNewValue

func (u *GroupUpsert) UpdateNewValue[T any](column ent.ColumnOf[entity.Group, T]) *GroupUpsert

type GroupUpsertBulk

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

func (*GroupUpsertBulk) DoNothing

func (u *GroupUpsertBulk) DoNothing() *GroupUpsertBulk

func (*GroupUpsertBulk) DoSelect

func (u *GroupUpsertBulk) DoSelect() *GroupUpsertBulk

func (*GroupUpsertBulk) DoUpdate

func (u *GroupUpsertBulk) DoUpdate(set func(*GroupUpsert)) *GroupUpsertBulk

func (*GroupUpsertBulk) Exec

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

func (*GroupUpsertBulk) ExecX

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

func (*GroupUpsertBulk) Ignore

func (u *GroupUpsertBulk) Ignore() *GroupUpsertBulk

func (*GroupUpsertBulk) Save

func (u *GroupUpsertBulk) Save(ctx context.Context) ([]*Group, error)

func (*GroupUpsertBulk) UpdateNewValues

func (u *GroupUpsertBulk) UpdateNewValues() *GroupUpsertBulk

func (*GroupUpsertBulk) UpdateWhere

func (u *GroupUpsertBulk) UpdateWhere(predicates ...ent.Predicate[entity.Group]) *GroupUpsertBulk

func (*GroupUpsertBulk) Where

func (u *GroupUpsertBulk) Where(predicates ...ent.Predicate[entity.Group]) *GroupUpsertBulk

type GroupUpsertOne

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

func (*GroupUpsertOne) DoNothing

func (u *GroupUpsertOne) DoNothing() *GroupUpsertOne

func (*GroupUpsertOne) DoSelect

func (u *GroupUpsertOne) DoSelect() *GroupUpsertOne

func (*GroupUpsertOne) DoUpdate

func (u *GroupUpsertOne) DoUpdate(set func(*GroupUpsert)) *GroupUpsertOne

func (*GroupUpsertOne) Exec

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

func (*GroupUpsertOne) ExecX

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

func (*GroupUpsertOne) ID

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

func (*GroupUpsertOne) IDX

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

func (*GroupUpsertOne) Ignore

func (u *GroupUpsertOne) Ignore() *GroupUpsertOne

func (*GroupUpsertOne) Save

func (u *GroupUpsertOne) Save(ctx context.Context) (*Group, error)

func (*GroupUpsertOne) UpdateNewValues

func (u *GroupUpsertOne) UpdateNewValues() *GroupUpsertOne

func (*GroupUpsertOne) UpdateWhere

func (u *GroupUpsertOne) UpdateWhere(predicates ...ent.Predicate[entity.Group]) *GroupUpsertOne

func (*GroupUpsertOne) Where

func (u *GroupUpsertOne) Where(predicates ...ent.Predicate[entity.Group]) *GroupUpsertOne

type Groups

type Groups []*Group

Groups is a parsable slice of Group.

type Mutation

type Mutation = ent.Mutation

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[T any] = ent.Option[T]

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

func FromPtr

func FromPtr[T any](value *T) Option[T]

func Null

func Null[T any]() Option[T]

func NullIfNil

func NullIfNil[T any](value *T) Option[T]

func Some

func Some[T any](value T) Option[T]

func Unset

func Unset[T any]() Option[T]

type Pet

type Pet struct {

	// ID of the ent.
	ID int `json:"id,omitempty"`
	// Name holds the value of the "name" field.
	Name string `json:"name,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the PetQuery when eager-loading is set.
	Edges PetEdges `json:"edges"`
	// contains filtered or unexported fields
}

Pet is the model entity for the Pet schema.

func (*Pet) QueryOwner

func (_m *Pet) QueryOwner() *UserQuery

QueryOwner queries the "owner" edge of the Pet entity.

func (*Pet) String

func (_m *Pet) String() string

String implements the fmt.Stringer.

func (*Pet) Unwrap

func (_m *Pet) Unwrap() *Pet

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

func (_m *Pet) Update() *PetUpdateOne

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

type PetClient

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

PetClient is a client for the Pet schema.

func NewPetClient

func NewPetClient(c config) *PetClient

NewPetClient returns a client for the Pet from the given config.

func (*PetClient) Create

func (c *PetClient) Create() *PetCreate

Create returns a builder for creating a Pet entity.

func (*PetClient) CreateBulk

func (c *PetClient) CreateBulk(builders ...*PetCreate) *PetCreateBulk

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

func (*PetClient) Delete

func (c *PetClient) Delete() *PetDelete

Delete returns a delete builder for Pet.

func (*PetClient) DeleteOne

func (c *PetClient) DeleteOne(_m *Pet) *PetDeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*PetClient) DeleteOneID

func (c *PetClient) DeleteOneID(id int) *PetDeleteOne

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

func (*PetClient) Get

func (c *PetClient) Get(ctx context.Context, id int) (*Pet, error)

Get returns a Pet entity by its id.

func (*PetClient) GetX

func (c *PetClient) GetX(ctx context.Context, id int) *Pet

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

func (*PetClient) Insert

func (c *PetClient) Insert(value PetInsert) *PetCreate

func (*PetClient) InsertBulk

func (c *PetClient) InsertBulk(values ...PetInsert) *PetCreateBulk

func (*PetClient) MapCreateBulk

func (c *PetClient) MapCreateBulk(slice any, setFunc func(*PetCreate, int)) *PetCreateBulk

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

func (c *PetClient) Query() *PetQuery

Query returns a query builder for Pet.

func (*PetClient) QueryOwner

func (c *PetClient) QueryOwner(_m *Pet) *UserQuery

QueryOwner queries the owner edge of a Pet.

func (*PetClient) Update

func (c *PetClient) Update() *PetUpdate

Update returns an update builder for Pet.

func (*PetClient) UpdateOne

func (c *PetClient) UpdateOne(_m *Pet) *PetUpdateOne

UpdateOne returns an update builder for the given entity.

func (*PetClient) UpdateOneID

func (c *PetClient) UpdateOneID(id int) *PetUpdateOne

UpdateOneID returns an update builder for the given id.

type PetCreate

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

func (*PetCreate) AddIDs

func (b *PetCreate) AddIDs[N, K any](edge ent.Relation[entity.Pet, N, K], ids ...K) *PetCreate

func (*PetCreate) Exec

func (b *PetCreate) Exec(ctx context.Context) error

func (*PetCreate) ExecX

func (b *PetCreate) ExecX(ctx context.Context)

func (*PetCreate) Insert

func (b *PetCreate) Insert() *PetInsert

func (*PetCreate) Mutation

func (b *PetCreate) Mutation() *PetMutation

func (*PetCreate) OnConflict

func (b *PetCreate) OnConflict(columns ...ent.EntityColumn[entity.Pet]) *PetUpsertOne

func (*PetCreate) OnConflictConstraint

func (b *PetCreate) OnConflictConstraint(name string) *PetUpsertOne

func (*PetCreate) OnConflictOptions

func (b *PetCreate) OnConflictOptions(options ...sql.ConflictOption) *PetUpsertOne

func (*PetCreate) Save

func (b *PetCreate) Save(ctx context.Context) (*Pet, error)

func (*PetCreate) SaveX

func (b *PetCreate) SaveX(ctx context.Context) *Pet

func (*PetCreate) Set

func (b *PetCreate) Set[T any](column ent.ColumnOf[entity.Pet, T], value T) *PetCreate

func (*PetCreate) SetEdge

func (b *PetCreate) SetEdge[N, K any](edge ent.UniqueRelation[entity.Pet, N, K], id K) *PetCreate

func (*PetCreate) SetExpr

func (b *PetCreate) SetExpr[T any](column ent.ColumnOf[entity.Pet, T], value ent.Expr[T]) *PetCreate

func (*PetCreate) SetOptional

func (b *PetCreate) SetOptional[T any](column ent.ColumnOf[entity.Pet, T], value ent.Option[T]) *PetCreate

type PetCreateBulk

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

func (*PetCreateBulk) Exec

func (b *PetCreateBulk) Exec(ctx context.Context) error

func (*PetCreateBulk) ExecX

func (b *PetCreateBulk) ExecX(ctx context.Context)

func (*PetCreateBulk) OnConflict

func (b *PetCreateBulk) OnConflict(columns ...ent.EntityColumn[entity.Pet]) *PetUpsertBulk

func (*PetCreateBulk) OnConflictConstraint

func (b *PetCreateBulk) OnConflictConstraint(name string) *PetUpsertBulk

func (*PetCreateBulk) OnConflictOptions

func (b *PetCreateBulk) OnConflictOptions(options ...sql.ConflictOption) *PetUpsertBulk

func (*PetCreateBulk) Save

func (_c *PetCreateBulk) Save(ctx context.Context) ([]*Pet, error)

func (*PetCreateBulk) SaveX

func (b *PetCreateBulk) SaveX(ctx context.Context) []*Pet

type PetDelete

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

PetDelete is the builder for deleting a Pet entity.

func (*PetDelete) Exec

func (_d *PetDelete) Exec(ctx context.Context) (int, error)

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

func (*PetDelete) ExecX

func (_d *PetDelete) ExecX(ctx context.Context) int

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

func (*PetDelete) Returning

func (b *PetDelete) Returning(ctx context.Context) ([]*Pet, error)

func (*PetDelete) Where

func (_d *PetDelete) Where(predicates ...ent.Predicate[entity.Pet]) *PetDelete

Where appends a list predicates to the PetDelete builder.

type PetDeleteOne

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

PetDeleteOne is the builder for deleting a single Pet entity.

func (*PetDeleteOne) Exec

func (_d *PetDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*PetDeleteOne) ExecX

func (_d *PetDeleteOne) ExecX(ctx context.Context)

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

func (*PetDeleteOne) Where

func (_d *PetDeleteOne) Where(predicates ...ent.Predicate[entity.Pet]) *PetDeleteOne

Where appends a list predicates to the PetDelete builder.

type PetEdges

type PetEdges struct {
	// Owner holds the value of the owner edge.
	Owner *User `json:"owner,omitempty"`
	// contains filtered or unexported fields
}

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

func (PetEdges) Count

func (e PetEdges) Count[N, K any](edge ent.Relation[entity.Pet, N, K]) (int, bool)

func (PetEdges) Loaded

func (e PetEdges) Loaded[N, K any](edge ent.RelationOf[entity.Pet, N, K]) bool

func (PetEdges) OwnerOrErr

func (e PetEdges) OwnerOrErr() (*User, error)

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

func (*PetEdges) SetLoaded

func (e *PetEdges) SetLoaded[N, K any](edge ent.RelationOf[entity.Pet, N, K], loaded bool)

type PetGroupBy

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

PetGroupBy is the group-by builder for Pet entities.

func (*PetGroupBy) Aggregate

func (_g *PetGroupBy) Aggregate(selections ...ent.Selection) *PetGroupBy

func (*PetGroupBy) Rows

func (_g *PetGroupBy) Rows(ctx context.Context) ([]*ent.Row, error)

func (*PetGroupBy) Scan

func (_g *PetGroupBy) Scan(ctx context.Context, v any) error

type PetInsert

type PetInsert struct {
	Name    string          `json:"name"`
	OwnerID ent.Option[int] `json:"owner_id,omitzero"`
	// contains filtered or unexported fields
}

PetInsert is the write representation of a Pet creation.

type PetMutation

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

func (*PetMutation) Client

func (m *PetMutation) Client() *Client

func (*PetMutation) ID

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

func (*PetMutation) IDs

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

func (*PetMutation) Insert

func (m *PetMutation) Insert() *PetInsert

func (*PetMutation) Op

func (m *PetMutation) Op() ent.Op

func (*PetMutation) Patch

func (m *PetMutation) Patch() *PetPatch

func (*PetMutation) Predicates

func (m *PetMutation) Predicates() []ent.Predicate[entity.Pet]

func (*PetMutation) Tx

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

func (*PetMutation) Type

func (m *PetMutation) Type() string

func (*PetMutation) Where

func (m *PetMutation) Where(predicates ...ent.Predicate[entity.Pet])

type PetPatch

type PetPatch struct {
	Name    ent.Option[string] `json:"name,omitzero"`
	OwnerID ent.Option[int]    `json:"owner_id,omitzero"`
	// contains filtered or unexported fields
}

PetPatch is the write representation of a Pet update.

type PetQuery

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

PetQuery is the builder for querying Pet entities.

func (*PetQuery) Aggregate

func (_q *PetQuery) Aggregate(selections ...ent.Selection) *PetSelect

Aggregate returns a PetSelect configured with the given aggregations.

func (*PetQuery) All

func (_q *PetQuery) All(ctx context.Context) ([]*Pet, error)

All executes the query and returns a list of Pets.

func (*PetQuery) AllX

func (_q *PetQuery) AllX(ctx context.Context) []*Pet

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

func (*PetQuery) Clone

func (_q *PetQuery) Clone() *PetQuery

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

func (*PetQuery) Columns

func (_q *PetQuery) Columns(columns ...ent.EntityColumn[entity.Pet]) *PetQuery

Columns narrows the entity columns loaded by this query, including when it is used as an eager-loading query. The ID and any columns required to bind loaded edges are always included.

func (*PetQuery) Count

func (_q *PetQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*PetQuery) CountX

func (_q *PetQuery) CountX(ctx context.Context) int

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

func (*PetQuery) Exist

func (_q *PetQuery) Exist(ctx context.Context) (bool, error)

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

func (*PetQuery) ExistX

func (_q *PetQuery) ExistX(ctx context.Context) bool

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

func (*PetQuery) First

func (_q *PetQuery) First(ctx context.Context) (*Pet, error)

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

func (*PetQuery) FirstID

func (_q *PetQuery) FirstID(ctx context.Context) (id int, err error)

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

func (*PetQuery) FirstIDX

func (_q *PetQuery) FirstIDX(ctx context.Context) int

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

func (*PetQuery) FirstX

func (_q *PetQuery) FirstX(ctx context.Context) *Pet

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

func (*PetQuery) ForShare

func (_q *PetQuery) ForShare(opts ...sql.LockOption) *PetQuery

ForShare behaves similarly to ForUpdate, except that it acquires a shared mode lock on any rows that are read. Other sessions can read the rows, but cannot modify them until your transaction commits.

func (*PetQuery) ForUpdate

func (_q *PetQuery) ForUpdate(opts ...sql.LockOption) *PetQuery

ForUpdate locks the selected rows against concurrent updates, and prevent them from being updated, deleted or "selected ... for update" by other sessions, until the transaction is either committed or rolled-back.

func (*PetQuery) GroupBy

func (_q *PetQuery) GroupBy(columns ...ent.EntityColumn[entity.Pet]) *PetGroupBy

GroupBy is used to group vertices by one or more fields/columns. It can be combined with typed aggregate selections.

Example:

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

client.Pet.Query().
	GroupBy(pet.Name).
	Aggregate(testschema.Count()).
	Scan(ctx, &v)

func (*PetQuery) IDs

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

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

func (*PetQuery) IDsX

func (_q *PetQuery) IDsX(ctx context.Context) []int

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

func (*PetQuery) Join

func (_q *PetQuery) Join(table string, on ...func(*sql.Selector)) *PetQuery

func (*PetQuery) JoinAs

func (_q *PetQuery) JoinAs(table, alias string, on ...func(*sql.Selector)) *PetQuery

func (*PetQuery) LeftJoin

func (_q *PetQuery) LeftJoin(table string, on ...func(*sql.Selector)) *PetQuery

func (*PetQuery) LeftJoinAs

func (_q *PetQuery) LeftJoinAs(table, alias string, on ...func(*sql.Selector)) *PetQuery

func (*PetQuery) Limit

func (_q *PetQuery) Limit(limit int) *PetQuery

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

func (*PetQuery) Modify

func (_q *PetQuery) Modify(modifiers ...func(s *sql.Selector)) *PetQuery

Modify adds a query modifier for attaching custom logic to queries. It can be chained with the entity terminals (All, Count, ...) or with Select(...) for projections.

func (*PetQuery) Offset

func (_q *PetQuery) Offset(offset int) *PetQuery

Offset to start from.

func (*PetQuery) Only

func (_q *PetQuery) Only(ctx context.Context) (*Pet, error)

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

func (*PetQuery) OnlyID

func (_q *PetQuery) OnlyID(ctx context.Context) (id int, err error)

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

func (*PetQuery) OnlyIDX

func (_q *PetQuery) OnlyIDX(ctx context.Context) int

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

func (*PetQuery) OnlyX

func (_q *PetQuery) OnlyX(ctx context.Context) *Pet

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

func (*PetQuery) Order

func (_q *PetQuery) Order(o ...ent.OrderOption[entity.Pet]) *PetQuery

Order specifies how the records should be ordered.

func (*PetQuery) QueryOwner

func (_q *PetQuery) QueryOwner() *UserQuery

QueryOwner chains the current query on the "owner" edge.

func (*PetQuery) Select

func (_q *PetQuery) Select(selections ...ent.Selection) *PetSelect

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

Example:

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

client.Pet.Query().
	Select(pet.Name).
	Scan(ctx, &v)

func (*PetQuery) Unique

func (_q *PetQuery) Unique(unique bool) *PetQuery

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

func (_q *PetQuery) Where(predicates ...ent.Predicate[entity.Pet]) *PetQuery

Where adds a new predicate for the PetQuery builder.

func (*PetQuery) WhereP

func (_q *PetQuery) WhereP(predicates ...func(*sql.Selector)) *PetQuery

func (*PetQuery) WithCount

func (_q *PetQuery) WithCount[N, K any](edge ent.Relation[entity.Pet, N, K], predicates ...ent.Predicate[N]) *PetQuery

WithCount loads the number of neighbors of a non-unique edge into each returned Pet, readable with Edges.Count. Only neighbors matching all predicates are counted, and a parent with no matching neighbor reports a present count of zero. At most one count is kept per edge: a later call for the same edge is ignored.

func (*PetQuery) WithOwner

func (_q *PetQuery) WithOwner(opts ...func(*UserQuery)) *PetQuery

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

type PetSelect

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

PetSelect is the builder for selecting fields of Pet entities.

func (*PetSelect) Aggregate

func (_s *PetSelect) Aggregate(selections ...ent.Selection) *PetSelect

func (*PetSelect) Modify

func (_s *PetSelect) Modify(modifiers ...func(s *sql.Selector)) *PetSelect

Modify adds a query modifier for attaching custom logic to queries.

func (*PetSelect) Row

func (_s *PetSelect) Row(ctx context.Context) (*ent.Row, error)

func (*PetSelect) Rows

func (_s *PetSelect) Rows(ctx context.Context) ([]*ent.Row, error)

func (*PetSelect) Scan

func (_s *PetSelect) Scan(ctx context.Context, value any) error

type PetUpdate

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

func (*PetUpdate) Add

func (b *PetUpdate) Add[T ent.Number](column ent.ColumnOf[entity.Pet, T], delta T) *PetUpdate

func (*PetUpdate) AddIDs

func (b *PetUpdate) AddIDs[N, K any](edge ent.Relation[entity.Pet, N, K], ids ...K) *PetUpdate

func (*PetUpdate) Append

func (b *PetUpdate) Append[T any](column ent.ColumnOf[entity.Pet, T], values T) *PetUpdate

func (*PetUpdate) Apply

func (b *PetUpdate) Apply(p PetPatch) *PetUpdate

func (*PetUpdate) Clear

func (b *PetUpdate) Clear[T any](column ent.ColumnOf[entity.Pet, T]) *PetUpdate

func (*PetUpdate) ClearEdge

func (b *PetUpdate) ClearEdge[N, K any](edge ent.RelationOf[entity.Pet, N, K]) *PetUpdate

func (*PetUpdate) Exec

func (b *PetUpdate) Exec(ctx context.Context) error

func (*PetUpdate) ExecX

func (b *PetUpdate) ExecX(ctx context.Context)

func (*PetUpdate) Modify

func (_u *PetUpdate) Modify(modifiers ...func(u *sql.UpdateBuilder)) *PetUpdate

Modify adds a statement modifier for attaching custom logic to the UPDATE statement.

func (*PetUpdate) Mutation

func (b *PetUpdate) Mutation() *PetMutation

func (*PetUpdate) Patch

func (b *PetUpdate) Patch() *PetPatch

func (*PetUpdate) RemoveIDs

func (b *PetUpdate) RemoveIDs[N, K any](edge ent.Relation[entity.Pet, N, K], ids ...K) *PetUpdate

func (*PetUpdate) Returning

func (b *PetUpdate) Returning(ctx context.Context) ([]*Pet, error)

func (*PetUpdate) Save

func (b *PetUpdate) Save(ctx context.Context) (int, error)

func (*PetUpdate) SaveX

func (b *PetUpdate) SaveX(ctx context.Context) int

func (*PetUpdate) Set

func (b *PetUpdate) Set[T any](column ent.ColumnOf[entity.Pet, T], value T) *PetUpdate

func (*PetUpdate) SetEdge

func (b *PetUpdate) SetEdge[N, K any](edge ent.UniqueRelation[entity.Pet, N, K], id K) *PetUpdate

func (*PetUpdate) SetExpr

func (b *PetUpdate) SetExpr[T any](column ent.ColumnOf[entity.Pet, T], value ent.Expr[T]) *PetUpdate

func (*PetUpdate) SetOptional

func (b *PetUpdate) SetOptional[T any](column ent.ColumnOf[entity.Pet, T], value ent.Option[T]) *PetUpdate

func (*PetUpdate) Where

func (b *PetUpdate) Where(predicates ...ent.Predicate[entity.Pet]) *PetUpdate

type PetUpdateOne

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

func (*PetUpdateOne) Add

func (b *PetUpdateOne) Add[T ent.Number](column ent.ColumnOf[entity.Pet, T], delta T) *PetUpdateOne

func (*PetUpdateOne) AddIDs

func (b *PetUpdateOne) AddIDs[N, K any](edge ent.Relation[entity.Pet, N, K], ids ...K) *PetUpdateOne

func (*PetUpdateOne) Append

func (b *PetUpdateOne) Append[T any](column ent.ColumnOf[entity.Pet, T], values T) *PetUpdateOne

func (*PetUpdateOne) Apply

func (b *PetUpdateOne) Apply(p PetPatch) *PetUpdateOne

func (*PetUpdateOne) Clear

func (b *PetUpdateOne) Clear[T any](column ent.ColumnOf[entity.Pet, T]) *PetUpdateOne

func (*PetUpdateOne) ClearEdge

func (b *PetUpdateOne) ClearEdge[N, K any](edge ent.RelationOf[entity.Pet, N, K]) *PetUpdateOne

func (*PetUpdateOne) Columns

func (b *PetUpdateOne) Columns(columns ...ent.EntityColumn[entity.Pet]) *PetUpdateOne

Columns narrows the entity columns returned by the update. The ID is always included.

func (*PetUpdateOne) Exec

func (b *PetUpdateOne) Exec(ctx context.Context) error

func (*PetUpdateOne) ExecX

func (b *PetUpdateOne) ExecX(ctx context.Context)

func (*PetUpdateOne) Modify

func (_u *PetUpdateOne) Modify(modifiers ...func(u *sql.UpdateBuilder)) *PetUpdateOne

Modify adds a statement modifier for attaching custom logic to the UPDATE statement.

func (*PetUpdateOne) Mutation

func (b *PetUpdateOne) Mutation() *PetMutation

func (*PetUpdateOne) Patch

func (b *PetUpdateOne) Patch() *PetPatch

func (*PetUpdateOne) RemoveIDs

func (b *PetUpdateOne) RemoveIDs[N, K any](edge ent.Relation[entity.Pet, N, K], ids ...K) *PetUpdateOne

func (*PetUpdateOne) Save

func (b *PetUpdateOne) Save(ctx context.Context) (*Pet, error)

func (*PetUpdateOne) SaveOld

func (b *PetUpdateOne) SaveOld(ctx context.Context) (old *Pet, updated *Pet, err error)

func (*PetUpdateOne) SaveX

func (b *PetUpdateOne) SaveX(ctx context.Context) *Pet

func (*PetUpdateOne) Set

func (b *PetUpdateOne) Set[T any](column ent.ColumnOf[entity.Pet, T], value T) *PetUpdateOne

func (*PetUpdateOne) SetEdge

func (b *PetUpdateOne) SetEdge[N, K any](edge ent.UniqueRelation[entity.Pet, N, K], id K) *PetUpdateOne

func (*PetUpdateOne) SetExpr

func (b *PetUpdateOne) SetExpr[T any](column ent.ColumnOf[entity.Pet, T], value ent.Expr[T]) *PetUpdateOne

func (*PetUpdateOne) SetOptional

func (b *PetUpdateOne) SetOptional[T any](column ent.ColumnOf[entity.Pet, T], value ent.Option[T]) *PetUpdateOne

func (*PetUpdateOne) Where

func (b *PetUpdateOne) Where(predicates ...ent.Predicate[entity.Pet]) *PetUpdateOne

type PetUpsert

type PetUpsert struct{ *sql.UpdateSet }

func (*PetUpsert) Add

func (u *PetUpsert) Add[T ent.Number](column ent.ColumnOf[entity.Pet, T], delta T) *PetUpsert

func (*PetUpsert) Clear

func (u *PetUpsert) Clear[T any](column ent.ColumnOf[entity.Pet, T]) *PetUpsert

func (*PetUpsert) Set

func (u *PetUpsert) Set[T any](column ent.ColumnOf[entity.Pet, T], value T) *PetUpsert

func (*PetUpsert) SetExpr

func (u *PetUpsert) SetExpr[T any](column ent.ColumnOf[entity.Pet, T], value ent.Expr[T]) *PetUpsert

func (*PetUpsert) UpdateNewValue

func (u *PetUpsert) UpdateNewValue[T any](column ent.ColumnOf[entity.Pet, T]) *PetUpsert

type PetUpsertBulk

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

func (*PetUpsertBulk) DoNothing

func (u *PetUpsertBulk) DoNothing() *PetUpsertBulk

func (*PetUpsertBulk) DoSelect

func (u *PetUpsertBulk) DoSelect() *PetUpsertBulk

func (*PetUpsertBulk) DoUpdate

func (u *PetUpsertBulk) DoUpdate(set func(*PetUpsert)) *PetUpsertBulk

func (*PetUpsertBulk) Exec

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

func (*PetUpsertBulk) ExecX

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

func (*PetUpsertBulk) Ignore

func (u *PetUpsertBulk) Ignore() *PetUpsertBulk

func (*PetUpsertBulk) Save

func (u *PetUpsertBulk) Save(ctx context.Context) ([]*Pet, error)

func (*PetUpsertBulk) UpdateNewValues

func (u *PetUpsertBulk) UpdateNewValues() *PetUpsertBulk

func (*PetUpsertBulk) UpdateWhere

func (u *PetUpsertBulk) UpdateWhere(predicates ...ent.Predicate[entity.Pet]) *PetUpsertBulk

func (*PetUpsertBulk) Where

func (u *PetUpsertBulk) Where(predicates ...ent.Predicate[entity.Pet]) *PetUpsertBulk

type PetUpsertOne

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

func (*PetUpsertOne) DoNothing

func (u *PetUpsertOne) DoNothing() *PetUpsertOne

func (*PetUpsertOne) DoSelect

func (u *PetUpsertOne) DoSelect() *PetUpsertOne

func (*PetUpsertOne) DoUpdate

func (u *PetUpsertOne) DoUpdate(set func(*PetUpsert)) *PetUpsertOne

func (*PetUpsertOne) Exec

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

func (*PetUpsertOne) ExecX

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

func (*PetUpsertOne) ID

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

func (*PetUpsertOne) IDX

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

func (*PetUpsertOne) Ignore

func (u *PetUpsertOne) Ignore() *PetUpsertOne

func (*PetUpsertOne) Save

func (u *PetUpsertOne) Save(ctx context.Context) (*Pet, error)

func (*PetUpsertOne) UpdateNewValues

func (u *PetUpsertOne) UpdateNewValues() *PetUpsertOne

func (*PetUpsertOne) UpdateWhere

func (u *PetUpsertOne) UpdateWhere(predicates ...ent.Predicate[entity.Pet]) *PetUpsertOne

func (*PetUpsertOne) Where

func (u *PetUpsertOne) Where(predicates ...ent.Predicate[entity.Pet]) *PetUpsertOne

type Pets

type Pets []*Pet

Pets is a parsable slice of Pet.

type Predicate

type Predicate[E any] = ent.Predicate[E]

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 RelationPatch

type RelationPatch[K comparable] = ent.RelationPatch[K]

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 Row

type Row = ent.Row

type Tx

type Tx struct {

	// Group is the client for interacting with the Group builders.
	Group *GroupClient
	// Pet is the client for interacting with the Pet builders.
	Pet *PetClient
	// User is the client for interacting with the User builders.
	User *UserClient
	// 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 User

type User struct {

	// ID of the ent.
	ID int `json:"id,omitempty"`
	// Name holds the value of the "name" field.
	Name string `json:"name,omitempty"`
	// Email holds the value of the "email" field.
	Email string `json:"email,omitempty"`
	// Age holds the value of the "age" field.
	Age int `json:"age,omitempty"`
	// Nickname holds the value of the "nickname" field.
	Nickname *string `json:"nickname,omitempty"`
	// Role holds the value of the "role" field.
	Role user.RoleValue `json:"role,omitempty"`
	// Tags holds the value of the "tags" field.
	Tags []string `json:"tags,omitempty"`
	// Profile holds the value of the "profile" field.
	Profile schema2.Profile `json:"profile,omitempty"`
	// CreatedAt holds the value of the "created_at" field.
	CreatedAt time2.Time `json:"created_at,omitempty"`
	// Avatar holds the value of the "avatar" field.
	Avatar []byte `json:"avatar,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the UserQuery when eager-loading is set.
	Edges UserEdges `json:"edges"`
	// contains filtered or unexported fields
}

User is the model entity for the User schema.

func (*User) QueryGroups

func (_m *User) QueryGroups() *GroupQuery

QueryGroups queries the "groups" edge of the User entity.

func (*User) QueryPets

func (_m *User) QueryPets() *PetQuery

QueryPets queries the "pets" edge of the User entity.

func (*User) String

func (_m *User) String() string

String implements the fmt.Stringer.

func (*User) Unwrap

func (_m *User) Unwrap() *User

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

func (_m *User) Update() *UserUpdateOne

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

type UserClient

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

UserClient is a client for the User schema.

func NewUserClient

func NewUserClient(c config) *UserClient

NewUserClient returns a client for the User from the given config.

func (*UserClient) Create

func (c *UserClient) Create() *UserCreate

Create returns a builder for creating a User entity.

func (*UserClient) CreateBulk

func (c *UserClient) CreateBulk(builders ...*UserCreate) *UserCreateBulk

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

func (*UserClient) Delete

func (c *UserClient) Delete() *UserDelete

Delete returns a delete builder for User.

func (*UserClient) DeleteOne

func (c *UserClient) DeleteOne(_m *User) *UserDeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*UserClient) DeleteOneID

func (c *UserClient) DeleteOneID(id int) *UserDeleteOne

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

func (*UserClient) Get

func (c *UserClient) Get(ctx context.Context, id int) (*User, error)

Get returns a User entity by its id.

func (*UserClient) GetX

func (c *UserClient) GetX(ctx context.Context, id int) *User

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

func (*UserClient) Insert

func (c *UserClient) Insert(value UserInsert) *UserCreate

func (*UserClient) InsertBulk

func (c *UserClient) InsertBulk(values ...UserInsert) *UserCreateBulk

func (*UserClient) MapCreateBulk

func (c *UserClient) MapCreateBulk(slice any, setFunc func(*UserCreate, int)) *UserCreateBulk

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

func (c *UserClient) Query() *UserQuery

Query returns a query builder for User.

func (*UserClient) QueryGroups

func (c *UserClient) QueryGroups(_m *User) *GroupQuery

QueryGroups queries the groups edge of a User.

func (*UserClient) QueryPets

func (c *UserClient) QueryPets(_m *User) *PetQuery

QueryPets queries the pets edge of a User.

func (*UserClient) Update

func (c *UserClient) Update() *UserUpdate

Update returns an update builder for User.

func (*UserClient) UpdateOne

func (c *UserClient) UpdateOne(_m *User) *UserUpdateOne

UpdateOne returns an update builder for the given entity.

func (*UserClient) UpdateOneID

func (c *UserClient) UpdateOneID(id int) *UserUpdateOne

UpdateOneID returns an update builder for the given id.

type UserCreate

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

func (*UserCreate) AddIDs

func (b *UserCreate) AddIDs[N, K any](edge ent.Relation[entity.User, N, K], ids ...K) *UserCreate

func (*UserCreate) Exec

func (b *UserCreate) Exec(ctx context.Context) error

func (*UserCreate) ExecX

func (b *UserCreate) ExecX(ctx context.Context)

func (*UserCreate) Insert

func (b *UserCreate) Insert() *UserInsert

func (*UserCreate) Mutation

func (b *UserCreate) Mutation() *UserMutation

func (*UserCreate) OnConflict

func (b *UserCreate) OnConflict(columns ...ent.EntityColumn[entity.User]) *UserUpsertOne

func (*UserCreate) OnConflictConstraint

func (b *UserCreate) OnConflictConstraint(name string) *UserUpsertOne

func (*UserCreate) OnConflictOptions

func (b *UserCreate) OnConflictOptions(options ...sql.ConflictOption) *UserUpsertOne

func (*UserCreate) Save

func (b *UserCreate) Save(ctx context.Context) (*User, error)

func (*UserCreate) SaveX

func (b *UserCreate) SaveX(ctx context.Context) *User

func (*UserCreate) Set

func (b *UserCreate) Set[T any](column ent.ColumnOf[entity.User, T], value T) *UserCreate

func (*UserCreate) SetEdge

func (b *UserCreate) SetEdge[N, K any](edge ent.UniqueRelation[entity.User, N, K], id K) *UserCreate

func (*UserCreate) SetExpr

func (b *UserCreate) SetExpr[T any](column ent.ColumnOf[entity.User, T], value ent.Expr[T]) *UserCreate

func (*UserCreate) SetOptional

func (b *UserCreate) SetOptional[T any](column ent.ColumnOf[entity.User, T], value ent.Option[T]) *UserCreate

type UserCreateBulk

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

func (*UserCreateBulk) Exec

func (b *UserCreateBulk) Exec(ctx context.Context) error

func (*UserCreateBulk) ExecX

func (b *UserCreateBulk) ExecX(ctx context.Context)

func (*UserCreateBulk) OnConflict

func (b *UserCreateBulk) OnConflict(columns ...ent.EntityColumn[entity.User]) *UserUpsertBulk

func (*UserCreateBulk) OnConflictConstraint

func (b *UserCreateBulk) OnConflictConstraint(name string) *UserUpsertBulk

func (*UserCreateBulk) OnConflictOptions

func (b *UserCreateBulk) OnConflictOptions(options ...sql.ConflictOption) *UserUpsertBulk

func (*UserCreateBulk) Save

func (_c *UserCreateBulk) Save(ctx context.Context) ([]*User, error)

func (*UserCreateBulk) SaveX

func (b *UserCreateBulk) SaveX(ctx context.Context) []*User

type UserDelete

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

UserDelete is the builder for deleting a User entity.

func (*UserDelete) Exec

func (_d *UserDelete) Exec(ctx context.Context) (int, error)

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

func (*UserDelete) ExecX

func (_d *UserDelete) ExecX(ctx context.Context) int

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

func (*UserDelete) Returning

func (b *UserDelete) Returning(ctx context.Context) ([]*User, error)

func (*UserDelete) Where

func (_d *UserDelete) Where(predicates ...ent.Predicate[entity.User]) *UserDelete

Where appends a list predicates to the UserDelete builder.

type UserDeleteOne

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

UserDeleteOne is the builder for deleting a single User entity.

func (*UserDeleteOne) Exec

func (_d *UserDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*UserDeleteOne) ExecX

func (_d *UserDeleteOne) ExecX(ctx context.Context)

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

func (*UserDeleteOne) Where

func (_d *UserDeleteOne) Where(predicates ...ent.Predicate[entity.User]) *UserDeleteOne

Where appends a list predicates to the UserDelete builder.

type UserEdges

type UserEdges struct {
	// Pets holds the value of the pets edge.
	Pets []*Pet `json:"pets,omitempty"`
	// Groups holds the value of the groups edge.
	Groups []*Group `json:"groups,omitempty"`
	// contains filtered or unexported fields
}

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

func (UserEdges) Count

func (e UserEdges) Count[N, K any](edge ent.Relation[entity.User, N, K]) (int, bool)

func (UserEdges) GroupsOrErr

func (e UserEdges) GroupsOrErr() ([]*Group, error)

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

func (UserEdges) Loaded

func (e UserEdges) Loaded[N, K any](edge ent.RelationOf[entity.User, N, K]) bool

func (UserEdges) PetsOrErr

func (e UserEdges) PetsOrErr() ([]*Pet, error)

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

func (*UserEdges) SetLoaded

func (e *UserEdges) SetLoaded[N, K any](edge ent.RelationOf[entity.User, N, K], loaded bool)

type UserGroupBy

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

UserGroupBy is the group-by builder for User entities.

func (*UserGroupBy) Aggregate

func (_g *UserGroupBy) Aggregate(selections ...ent.Selection) *UserGroupBy

func (*UserGroupBy) Rows

func (_g *UserGroupBy) Rows(ctx context.Context) ([]*ent.Row, error)

func (*UserGroupBy) Scan

func (_g *UserGroupBy) Scan(ctx context.Context, v any) error

type UserInsert

type UserInsert struct {
	Name      string                 `json:"name"`
	Email     string                 `json:"email"`
	Age       int                    `json:"age"`
	Nickname  ent.Option[string]     `json:"nickname,omitzero"`
	Role      user.RoleValue         `json:"role"`
	Tags      []string               `json:"tags"`
	Profile   schema2.Profile        `json:"profile"`
	CreatedAt ent.Option[time2.Time] `json:"created_at,omitzero"`
	Avatar    ent.Option[[]byte]     `json:"avatar,omitzero"`
	PetIDs    []int                  `json:"pet_ids,omitzero"`
	GroupIDs  []int                  `json:"group_ids,omitzero"`
	// contains filtered or unexported fields
}

UserInsert is the write representation of a User creation.

type UserMutation

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

func (*UserMutation) Client

func (m *UserMutation) Client() *Client

func (*UserMutation) ID

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

func (*UserMutation) IDs

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

func (*UserMutation) Insert

func (m *UserMutation) Insert() *UserInsert

func (*UserMutation) Op

func (m *UserMutation) Op() ent.Op

func (*UserMutation) Patch

func (m *UserMutation) Patch() *UserPatch

func (*UserMutation) Predicates

func (m *UserMutation) Predicates() []ent.Predicate[entity.User]

func (*UserMutation) Tx

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

func (*UserMutation) Type

func (m *UserMutation) Type() string

func (*UserMutation) Where

func (m *UserMutation) Where(predicates ...ent.Predicate[entity.User])

type UserPatch

type UserPatch struct {
	Name      ent.Option[string]          `json:"name,omitzero"`
	Email     ent.Option[string]          `json:"email,omitzero"`
	Age       ent.Option[int]             `json:"age,omitzero"`
	AgeAdd    ent.Option[int]             `json:"age_add,omitzero"`
	Nickname  ent.Option[string]          `json:"nickname,omitzero"`
	Role      ent.Option[user.RoleValue]  `json:"role,omitzero"`
	Tags      ent.Option[[]string]        `json:"tags,omitzero"`
	Profile   ent.Option[schema2.Profile] `json:"profile,omitzero"`
	CreatedAt ent.Option[time2.Time]      `json:"created_at,omitzero"`
	Avatar    ent.Option[[]byte]          `json:"avatar,omitzero"`
	Pets      ent.RelationPatch[int]      `json:"pets,omitzero"`
	Groups    ent.RelationPatch[int]      `json:"groups,omitzero"`
	// contains filtered or unexported fields
}

UserPatch is the write representation of a User update.

type UserQuery

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

UserQuery is the builder for querying User entities.

func (*UserQuery) Aggregate

func (_q *UserQuery) Aggregate(selections ...ent.Selection) *UserSelect

Aggregate returns a UserSelect configured with the given aggregations.

func (*UserQuery) All

func (_q *UserQuery) All(ctx context.Context) ([]*User, error)

All executes the query and returns a list of Users.

func (*UserQuery) AllX

func (_q *UserQuery) AllX(ctx context.Context) []*User

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

func (*UserQuery) Clone

func (_q *UserQuery) Clone() *UserQuery

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

func (*UserQuery) Columns

func (_q *UserQuery) Columns(columns ...ent.EntityColumn[entity.User]) *UserQuery

Columns narrows the entity columns loaded by this query, including when it is used as an eager-loading query. The ID and any columns required to bind loaded edges are always included.

func (*UserQuery) Count

func (_q *UserQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*UserQuery) CountX

func (_q *UserQuery) CountX(ctx context.Context) int

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

func (*UserQuery) Exist

func (_q *UserQuery) Exist(ctx context.Context) (bool, error)

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

func (*UserQuery) ExistX

func (_q *UserQuery) ExistX(ctx context.Context) bool

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

func (*UserQuery) First

func (_q *UserQuery) First(ctx context.Context) (*User, error)

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

func (*UserQuery) FirstID

func (_q *UserQuery) FirstID(ctx context.Context) (id int, err error)

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

func (*UserQuery) FirstIDX

func (_q *UserQuery) FirstIDX(ctx context.Context) int

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

func (*UserQuery) FirstX

func (_q *UserQuery) FirstX(ctx context.Context) *User

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

func (*UserQuery) ForShare

func (_q *UserQuery) ForShare(opts ...sql.LockOption) *UserQuery

ForShare behaves similarly to ForUpdate, except that it acquires a shared mode lock on any rows that are read. Other sessions can read the rows, but cannot modify them until your transaction commits.

func (*UserQuery) ForUpdate

func (_q *UserQuery) ForUpdate(opts ...sql.LockOption) *UserQuery

ForUpdate locks the selected rows against concurrent updates, and prevent them from being updated, deleted or "selected ... for update" by other sessions, until the transaction is either committed or rolled-back.

func (*UserQuery) GroupBy

func (_q *UserQuery) GroupBy(columns ...ent.EntityColumn[entity.User]) *UserGroupBy

GroupBy is used to group vertices by one or more fields/columns. It can be combined with typed aggregate selections.

Example:

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

client.User.Query().
	GroupBy(user.Name).
	Aggregate(testschema.Count()).
	Scan(ctx, &v)

func (*UserQuery) IDs

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

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

func (*UserQuery) IDsX

func (_q *UserQuery) IDsX(ctx context.Context) []int

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

func (*UserQuery) Join

func (_q *UserQuery) Join(table string, on ...func(*sql.Selector)) *UserQuery

func (*UserQuery) JoinAs

func (_q *UserQuery) JoinAs(table, alias string, on ...func(*sql.Selector)) *UserQuery

func (*UserQuery) LeftJoin

func (_q *UserQuery) LeftJoin(table string, on ...func(*sql.Selector)) *UserQuery

func (*UserQuery) LeftJoinAs

func (_q *UserQuery) LeftJoinAs(table, alias string, on ...func(*sql.Selector)) *UserQuery

func (*UserQuery) Limit

func (_q *UserQuery) Limit(limit int) *UserQuery

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

func (*UserQuery) Modify

func (_q *UserQuery) Modify(modifiers ...func(s *sql.Selector)) *UserQuery

Modify adds a query modifier for attaching custom logic to queries. It can be chained with the entity terminals (All, Count, ...) or with Select(...) for projections.

func (*UserQuery) Offset

func (_q *UserQuery) Offset(offset int) *UserQuery

Offset to start from.

func (*UserQuery) Only

func (_q *UserQuery) Only(ctx context.Context) (*User, error)

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

func (*UserQuery) OnlyID

func (_q *UserQuery) OnlyID(ctx context.Context) (id int, err error)

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

func (*UserQuery) OnlyIDX

func (_q *UserQuery) OnlyIDX(ctx context.Context) int

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

func (*UserQuery) OnlyX

func (_q *UserQuery) OnlyX(ctx context.Context) *User

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

func (*UserQuery) Order

func (_q *UserQuery) Order(o ...ent.OrderOption[entity.User]) *UserQuery

Order specifies how the records should be ordered.

func (*UserQuery) QueryGroups

func (_q *UserQuery) QueryGroups() *GroupQuery

QueryGroups chains the current query on the "groups" edge.

func (*UserQuery) QueryPets

func (_q *UserQuery) QueryPets() *PetQuery

QueryPets chains the current query on the "pets" edge.

func (*UserQuery) Select

func (_q *UserQuery) Select(selections ...ent.Selection) *UserSelect

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

Example:

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

client.User.Query().
	Select(user.Name).
	Scan(ctx, &v)

func (*UserQuery) Unique

func (_q *UserQuery) Unique(unique bool) *UserQuery

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

func (_q *UserQuery) Where(predicates ...ent.Predicate[entity.User]) *UserQuery

Where adds a new predicate for the UserQuery builder.

func (*UserQuery) WhereP

func (_q *UserQuery) WhereP(predicates ...func(*sql.Selector)) *UserQuery

func (*UserQuery) WithCount

func (_q *UserQuery) WithCount[N, K any](edge ent.Relation[entity.User, N, K], predicates ...ent.Predicate[N]) *UserQuery

WithCount loads the number of neighbors of a non-unique edge into each returned User, readable with Edges.Count. Only neighbors matching all predicates are counted, and a parent with no matching neighbor reports a present count of zero. At most one count is kept per edge: a later call for the same edge is ignored.

func (*UserQuery) WithGroups

func (_q *UserQuery) WithGroups(opts ...func(*GroupQuery)) *UserQuery

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

func (*UserQuery) WithPets

func (_q *UserQuery) WithPets(opts ...func(*PetQuery)) *UserQuery

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

type UserSelect

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

UserSelect is the builder for selecting fields of User entities.

func (*UserSelect) Aggregate

func (_s *UserSelect) Aggregate(selections ...ent.Selection) *UserSelect

func (*UserSelect) Modify

func (_s *UserSelect) Modify(modifiers ...func(s *sql.Selector)) *UserSelect

Modify adds a query modifier for attaching custom logic to queries.

func (*UserSelect) Row

func (_s *UserSelect) Row(ctx context.Context) (*ent.Row, error)

func (*UserSelect) Rows

func (_s *UserSelect) Rows(ctx context.Context) ([]*ent.Row, error)

func (*UserSelect) Scan

func (_s *UserSelect) Scan(ctx context.Context, value any) error

type UserUpdate

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

func (*UserUpdate) Add

func (b *UserUpdate) Add[T ent.Number](column ent.ColumnOf[entity.User, T], delta T) *UserUpdate

func (*UserUpdate) AddIDs

func (b *UserUpdate) AddIDs[N, K any](edge ent.Relation[entity.User, N, K], ids ...K) *UserUpdate

func (*UserUpdate) Append

func (b *UserUpdate) Append[T any](column ent.ColumnOf[entity.User, T], values T) *UserUpdate

func (*UserUpdate) Apply

func (b *UserUpdate) Apply(p UserPatch) *UserUpdate

func (*UserUpdate) Clear

func (b *UserUpdate) Clear[T any](column ent.ColumnOf[entity.User, T]) *UserUpdate

func (*UserUpdate) ClearEdge

func (b *UserUpdate) ClearEdge[N, K any](edge ent.RelationOf[entity.User, N, K]) *UserUpdate

func (*UserUpdate) Exec

func (b *UserUpdate) Exec(ctx context.Context) error

func (*UserUpdate) ExecX

func (b *UserUpdate) ExecX(ctx context.Context)

func (*UserUpdate) Modify

func (_u *UserUpdate) Modify(modifiers ...func(u *sql.UpdateBuilder)) *UserUpdate

Modify adds a statement modifier for attaching custom logic to the UPDATE statement.

func (*UserUpdate) Mutation

func (b *UserUpdate) Mutation() *UserMutation

func (*UserUpdate) Patch

func (b *UserUpdate) Patch() *UserPatch

func (*UserUpdate) RemoveIDs

func (b *UserUpdate) RemoveIDs[N, K any](edge ent.Relation[entity.User, N, K], ids ...K) *UserUpdate

func (*UserUpdate) Returning

func (b *UserUpdate) Returning(ctx context.Context) ([]*User, error)

func (*UserUpdate) Save

func (b *UserUpdate) Save(ctx context.Context) (int, error)

func (*UserUpdate) SaveX

func (b *UserUpdate) SaveX(ctx context.Context) int

func (*UserUpdate) Set

func (b *UserUpdate) Set[T any](column ent.ColumnOf[entity.User, T], value T) *UserUpdate

func (*UserUpdate) SetEdge

func (b *UserUpdate) SetEdge[N, K any](edge ent.UniqueRelation[entity.User, N, K], id K) *UserUpdate

func (*UserUpdate) SetExpr

func (b *UserUpdate) SetExpr[T any](column ent.ColumnOf[entity.User, T], value ent.Expr[T]) *UserUpdate

func (*UserUpdate) SetOptional

func (b *UserUpdate) SetOptional[T any](column ent.ColumnOf[entity.User, T], value ent.Option[T]) *UserUpdate

func (*UserUpdate) Where

func (b *UserUpdate) Where(predicates ...ent.Predicate[entity.User]) *UserUpdate

type UserUpdateOne

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

func (*UserUpdateOne) Add

func (b *UserUpdateOne) Add[T ent.Number](column ent.ColumnOf[entity.User, T], delta T) *UserUpdateOne

func (*UserUpdateOne) AddIDs

func (b *UserUpdateOne) AddIDs[N, K any](edge ent.Relation[entity.User, N, K], ids ...K) *UserUpdateOne

func (*UserUpdateOne) Append

func (b *UserUpdateOne) Append[T any](column ent.ColumnOf[entity.User, T], values T) *UserUpdateOne

func (*UserUpdateOne) Apply

func (b *UserUpdateOne) Apply(p UserPatch) *UserUpdateOne

func (*UserUpdateOne) Clear

func (b *UserUpdateOne) Clear[T any](column ent.ColumnOf[entity.User, T]) *UserUpdateOne

func (*UserUpdateOne) ClearEdge

func (b *UserUpdateOne) ClearEdge[N, K any](edge ent.RelationOf[entity.User, N, K]) *UserUpdateOne

func (*UserUpdateOne) Columns

func (b *UserUpdateOne) Columns(columns ...ent.EntityColumn[entity.User]) *UserUpdateOne

Columns narrows the entity columns returned by the update. The ID is always included.

func (*UserUpdateOne) Exec

func (b *UserUpdateOne) Exec(ctx context.Context) error

func (*UserUpdateOne) ExecX

func (b *UserUpdateOne) ExecX(ctx context.Context)

func (*UserUpdateOne) Modify

func (_u *UserUpdateOne) Modify(modifiers ...func(u *sql.UpdateBuilder)) *UserUpdateOne

Modify adds a statement modifier for attaching custom logic to the UPDATE statement.

func (*UserUpdateOne) Mutation

func (b *UserUpdateOne) Mutation() *UserMutation

func (*UserUpdateOne) Patch

func (b *UserUpdateOne) Patch() *UserPatch

func (*UserUpdateOne) RemoveIDs

func (b *UserUpdateOne) RemoveIDs[N, K any](edge ent.Relation[entity.User, N, K], ids ...K) *UserUpdateOne

func (*UserUpdateOne) Save

func (b *UserUpdateOne) Save(ctx context.Context) (*User, error)

func (*UserUpdateOne) SaveOld

func (b *UserUpdateOne) SaveOld(ctx context.Context) (old *User, updated *User, err error)

func (*UserUpdateOne) SaveX

func (b *UserUpdateOne) SaveX(ctx context.Context) *User

func (*UserUpdateOne) Set

func (b *UserUpdateOne) Set[T any](column ent.ColumnOf[entity.User, T], value T) *UserUpdateOne

func (*UserUpdateOne) SetEdge

func (b *UserUpdateOne) SetEdge[N, K any](edge ent.UniqueRelation[entity.User, N, K], id K) *UserUpdateOne

func (*UserUpdateOne) SetExpr

func (b *UserUpdateOne) SetExpr[T any](column ent.ColumnOf[entity.User, T], value ent.Expr[T]) *UserUpdateOne

func (*UserUpdateOne) SetOptional

func (b *UserUpdateOne) SetOptional[T any](column ent.ColumnOf[entity.User, T], value ent.Option[T]) *UserUpdateOne

func (*UserUpdateOne) Where

func (b *UserUpdateOne) Where(predicates ...ent.Predicate[entity.User]) *UserUpdateOne

type UserUpsert

type UserUpsert struct{ *sql.UpdateSet }

func (*UserUpsert) Add

func (u *UserUpsert) Add[T ent.Number](column ent.ColumnOf[entity.User, T], delta T) *UserUpsert

func (*UserUpsert) Clear

func (u *UserUpsert) Clear[T any](column ent.ColumnOf[entity.User, T]) *UserUpsert

func (*UserUpsert) Set

func (u *UserUpsert) Set[T any](column ent.ColumnOf[entity.User, T], value T) *UserUpsert

func (*UserUpsert) SetExpr

func (u *UserUpsert) SetExpr[T any](column ent.ColumnOf[entity.User, T], value ent.Expr[T]) *UserUpsert

func (*UserUpsert) UpdateNewValue

func (u *UserUpsert) UpdateNewValue[T any](column ent.ColumnOf[entity.User, T]) *UserUpsert

type UserUpsertBulk

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

func (*UserUpsertBulk) DoNothing

func (u *UserUpsertBulk) DoNothing() *UserUpsertBulk

func (*UserUpsertBulk) DoSelect

func (u *UserUpsertBulk) DoSelect() *UserUpsertBulk

func (*UserUpsertBulk) DoUpdate

func (u *UserUpsertBulk) DoUpdate(set func(*UserUpsert)) *UserUpsertBulk

func (*UserUpsertBulk) Exec

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

func (*UserUpsertBulk) ExecX

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

func (*UserUpsertBulk) Ignore

func (u *UserUpsertBulk) Ignore() *UserUpsertBulk

func (*UserUpsertBulk) Save

func (u *UserUpsertBulk) Save(ctx context.Context) ([]*User, error)

func (*UserUpsertBulk) UpdateNewValues

func (u *UserUpsertBulk) UpdateNewValues() *UserUpsertBulk

func (*UserUpsertBulk) UpdateWhere

func (u *UserUpsertBulk) UpdateWhere(predicates ...ent.Predicate[entity.User]) *UserUpsertBulk

func (*UserUpsertBulk) Where

func (u *UserUpsertBulk) Where(predicates ...ent.Predicate[entity.User]) *UserUpsertBulk

type UserUpsertOne

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

func (*UserUpsertOne) DoNothing

func (u *UserUpsertOne) DoNothing() *UserUpsertOne

func (*UserUpsertOne) DoSelect

func (u *UserUpsertOne) DoSelect() *UserUpsertOne

func (*UserUpsertOne) DoUpdate

func (u *UserUpsertOne) DoUpdate(set func(*UserUpsert)) *UserUpsertOne

func (*UserUpsertOne) Exec

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

func (*UserUpsertOne) ExecX

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

func (*UserUpsertOne) ID

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

func (*UserUpsertOne) IDX

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

func (*UserUpsertOne) Ignore

func (u *UserUpsertOne) Ignore() *UserUpsertOne

func (*UserUpsertOne) Save

func (u *UserUpsertOne) Save(ctx context.Context) (*User, error)

func (*UserUpsertOne) UpdateNewValues

func (u *UserUpsertOne) UpdateNewValues() *UserUpsertOne

func (*UserUpsertOne) UpdateWhere

func (u *UserUpsertOne) UpdateWhere(predicates ...ent.Predicate[entity.User]) *UserUpsertOne

func (*UserUpsertOne) Where

func (u *UserUpsertOne) Where(predicates ...ent.Predicate[entity.User]) *UserUpsertOne

type Users

type Users []*User

Users is a parsable slice of User.

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.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL