ent

package
v0.0.0-...-64ba4e8 Latest Latest
Warning

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

Go to latest
Published: May 30, 2025 License: MIT Imports: 23 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.
	TypeAI            = "AI"
	TypeModelName     = "ModelName"
	TypePasswordToken = "PasswordToken"
	TypePrice         = "Price"
	TypeProduct       = "Product"
	TypeUser          = "User"
)

Variables

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

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

Functions

func Asc

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

Asc applies the given fields in ASC order.

func Desc

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

Desc applies the given fields in DESC order.

func IsConstraintError

func IsConstraintError(err error) bool

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

func IsNotFound

func IsNotFound(err error) bool

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

func IsNotLoaded

func IsNotLoaded(err error) bool

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

func IsNotSingular

func IsNotSingular(err error) bool

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

func IsValidationError

func IsValidationError(err error) bool

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

func MaskNotFound

func MaskNotFound(err error) error

MaskNotFound masks not found error.

func NewContext

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

NewContext returns a new context with the given Client attached.

func NewTxContext

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

NewTxContext returns a new context with the given Tx attached.

Types

type AI

type AI struct {

	// ID of the ent.
	ID int `json:"id,omitempty"`
	// AiClientName holds the value of the "ai_client_name" field.
	AiClientName string `json:"ai_client_name,omitempty"`
	// Prompt holds the value of the "prompt" field.
	Prompt string `json:"prompt,omitempty"`
	// Status holds the value of the "status" field.
	Status ai.Status `json:"status,omitempty"`
	// Result holds the value of the "result" field.
	Result []byte `json:"result,omitempty"`
	// CreatedAt holds the value of the "created_at" field.
	CreatedAt time.Time `json:"created_at,omitempty"`
	// CompletedAt holds the value of the "completed_at" field.
	CompletedAt time.Time `json:"completed_at,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the AIQuery when eager-loading is set.
	Edges AIEdges `json:"edges"`
	// contains filtered or unexported fields
}

AI is the model entity for the AI schema.

func (*AI) QueryUser

func (a *AI) QueryUser() *UserQuery

QueryUser queries the "user" edge of the AI entity.

func (*AI) String

func (a *AI) String() string

String implements the fmt.Stringer.

func (*AI) Unwrap

func (a *AI) Unwrap() *AI

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

func (a *AI) Update() *AIUpdateOne

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

func (*AI) Value

func (a *AI) Value(name string) (ent.Value, error)

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

type AIClient

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

AIClient is a client for the AI schema.

func NewAIClient

func NewAIClient(c config) *AIClient

NewAIClient returns a client for the AI from the given config.

func (*AIClient) Create

func (c *AIClient) Create() *AICreate

Create returns a builder for creating a AI entity.

func (*AIClient) CreateBulk

func (c *AIClient) CreateBulk(builders ...*AICreate) *AICreateBulk

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

func (*AIClient) Delete

func (c *AIClient) Delete() *AIDelete

Delete returns a delete builder for AI.

func (*AIClient) DeleteOne

func (c *AIClient) DeleteOne(a *AI) *AIDeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*AIClient) DeleteOneID

func (c *AIClient) DeleteOneID(id int) *AIDeleteOne

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

func (*AIClient) Get

func (c *AIClient) Get(ctx context.Context, id int) (*AI, error)

Get returns a AI entity by its id.

func (*AIClient) GetX

func (c *AIClient) GetX(ctx context.Context, id int) *AI

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

func (*AIClient) Hooks

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

Hooks returns the client hooks.

func (*AIClient) Intercept

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

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

func (*AIClient) Interceptors

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

Interceptors returns the client interceptors.

func (*AIClient) MapCreateBulk

func (c *AIClient) MapCreateBulk(slice any, setFunc func(*AICreate, int)) *AICreateBulk

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

func (c *AIClient) Query() *AIQuery

Query returns a query builder for AI.

func (*AIClient) QueryUser

func (c *AIClient) QueryUser(a *AI) *UserQuery

QueryUser queries the user edge of a AI.

func (*AIClient) Update

func (c *AIClient) Update() *AIUpdate

Update returns an update builder for AI.

func (*AIClient) UpdateOne

func (c *AIClient) UpdateOne(a *AI) *AIUpdateOne

UpdateOne returns an update builder for the given entity.

func (*AIClient) UpdateOneID

func (c *AIClient) UpdateOneID(id int) *AIUpdateOne

UpdateOneID returns an update builder for the given id.

func (*AIClient) Use

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

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

type AICreate

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

AICreate is the builder for creating a AI entity.

func (*AICreate) Exec

func (ac *AICreate) Exec(ctx context.Context) error

Exec executes the query.

func (*AICreate) ExecX

func (ac *AICreate) ExecX(ctx context.Context)

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

func (*AICreate) Mutation

func (ac *AICreate) Mutation() *AIMutation

Mutation returns the AIMutation object of the builder.

func (*AICreate) Save

func (ac *AICreate) Save(ctx context.Context) (*AI, error)

Save creates the AI in the database.

func (*AICreate) SaveX

func (ac *AICreate) SaveX(ctx context.Context) *AI

SaveX calls Save and panics if Save returns an error.

func (*AICreate) SetAiClientName

func (ac *AICreate) SetAiClientName(s string) *AICreate

SetAiClientName sets the "ai_client_name" field.

func (*AICreate) SetCompletedAt

func (ac *AICreate) SetCompletedAt(t time.Time) *AICreate

SetCompletedAt sets the "completed_at" field.

func (*AICreate) SetCreatedAt

func (ac *AICreate) SetCreatedAt(t time.Time) *AICreate

SetCreatedAt sets the "created_at" field.

func (*AICreate) SetNillableCompletedAt

func (ac *AICreate) SetNillableCompletedAt(t *time.Time) *AICreate

SetNillableCompletedAt sets the "completed_at" field if the given value is not nil.

func (*AICreate) SetNillableCreatedAt

func (ac *AICreate) SetNillableCreatedAt(t *time.Time) *AICreate

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

func (*AICreate) SetNillableStatus

func (ac *AICreate) SetNillableStatus(a *ai.Status) *AICreate

SetNillableStatus sets the "status" field if the given value is not nil.

func (*AICreate) SetPrompt

func (ac *AICreate) SetPrompt(s string) *AICreate

SetPrompt sets the "prompt" field.

func (*AICreate) SetResult

func (ac *AICreate) SetResult(b []byte) *AICreate

SetResult sets the "result" field.

func (*AICreate) SetStatus

func (ac *AICreate) SetStatus(a ai.Status) *AICreate

SetStatus sets the "status" field.

func (*AICreate) SetUser

func (ac *AICreate) SetUser(u *User) *AICreate

SetUser sets the "user" edge to the User entity.

func (*AICreate) SetUserID

func (ac *AICreate) SetUserID(id int) *AICreate

SetUserID sets the "user" edge to the User entity by ID.

type AICreateBulk

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

AICreateBulk is the builder for creating many AI entities in bulk.

func (*AICreateBulk) Exec

func (acb *AICreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*AICreateBulk) ExecX

func (acb *AICreateBulk) ExecX(ctx context.Context)

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

func (*AICreateBulk) Save

func (acb *AICreateBulk) Save(ctx context.Context) ([]*AI, error)

Save creates the AI entities in the database.

func (*AICreateBulk) SaveX

func (acb *AICreateBulk) SaveX(ctx context.Context) []*AI

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

type AIDelete

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

AIDelete is the builder for deleting a AI entity.

func (*AIDelete) Exec

func (ad *AIDelete) Exec(ctx context.Context) (int, error)

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

func (*AIDelete) ExecX

func (ad *AIDelete) ExecX(ctx context.Context) int

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

func (*AIDelete) Where

func (ad *AIDelete) Where(ps ...predicate.AI) *AIDelete

Where appends a list predicates to the AIDelete builder.

type AIDeleteOne

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

AIDeleteOne is the builder for deleting a single AI entity.

func (*AIDeleteOne) Exec

func (ado *AIDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*AIDeleteOne) ExecX

func (ado *AIDeleteOne) ExecX(ctx context.Context)

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

func (*AIDeleteOne) Where

func (ado *AIDeleteOne) Where(ps ...predicate.AI) *AIDeleteOne

Where appends a list predicates to the AIDelete builder.

type AIEdges

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

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

func (AIEdges) UserOrErr

func (e AIEdges) UserOrErr() (*User, error)

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

type AIGroupBy

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

AIGroupBy is the group-by builder for AI entities.

func (*AIGroupBy) Aggregate

func (agb *AIGroupBy) Aggregate(fns ...AggregateFunc) *AIGroupBy

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

func (*AIGroupBy) Bool

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

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

func (*AIGroupBy) BoolX

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

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

func (*AIGroupBy) Bools

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

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

func (*AIGroupBy) BoolsX

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

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

func (*AIGroupBy) Float64

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

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

func (*AIGroupBy) Float64X

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

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

func (*AIGroupBy) Float64s

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

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

func (*AIGroupBy) Float64sX

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

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

func (*AIGroupBy) Int

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

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

func (*AIGroupBy) IntX

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

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

func (*AIGroupBy) Ints

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

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

func (*AIGroupBy) IntsX

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

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

func (*AIGroupBy) Scan

func (agb *AIGroupBy) Scan(ctx context.Context, v any) error

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

func (*AIGroupBy) ScanX

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

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

func (*AIGroupBy) String

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

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

func (*AIGroupBy) StringX

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

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

func (*AIGroupBy) Strings

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

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

func (*AIGroupBy) StringsX

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

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

type AIMutation

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

AIMutation represents an operation that mutates the AI nodes in the graph.

func (*AIMutation) AddField

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

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

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

func (*AIMutation) AddedField

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

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

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

func (*AIMutation) AddedIDs

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

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

func (*AIMutation) AiClientName

func (m *AIMutation) AiClientName() (r string, exists bool)

AiClientName returns the value of the "ai_client_name" field in the mutation.

func (*AIMutation) ClearCompletedAt

func (m *AIMutation) ClearCompletedAt()

ClearCompletedAt clears the value of the "completed_at" field.

func (*AIMutation) ClearEdge

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

func (m *AIMutation) 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 (*AIMutation) ClearUser

func (m *AIMutation) ClearUser()

ClearUser clears the "user" edge to the User entity.

func (*AIMutation) ClearedEdges

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

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

func (*AIMutation) ClearedFields

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

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

func (AIMutation) Client

func (m AIMutation) 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 (*AIMutation) CompletedAt

func (m *AIMutation) CompletedAt() (r time.Time, exists bool)

CompletedAt returns the value of the "completed_at" field in the mutation.

func (*AIMutation) CompletedAtCleared

func (m *AIMutation) CompletedAtCleared() bool

CompletedAtCleared returns if the "completed_at" field was cleared in this mutation.

func (*AIMutation) CreatedAt

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

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

func (*AIMutation) EdgeCleared

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

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

func (*AIMutation) Field

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

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

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

func (*AIMutation) Fields

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

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

ID returns the ID value in the mutation. Note that the ID is only available if it was provided to the builder or after it was returned from the database.

func (*AIMutation) IDs

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

IDs queries the database and returns the entity ids that match the mutation's predicate. That means, if the mutation is applied within a transaction with an isolation level such as sql.LevelSerializable, the returned ids match the ids of the rows that will be updated or updated by the mutation.

func (*AIMutation) OldAiClientName

func (m *AIMutation) OldAiClientName(ctx context.Context) (v string, err error)

OldAiClientName returns the old "ai_client_name" field's value of the AI entity. If the AI 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 (*AIMutation) OldCompletedAt

func (m *AIMutation) OldCompletedAt(ctx context.Context) (v time.Time, err error)

OldCompletedAt returns the old "completed_at" field's value of the AI entity. If the AI 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 (*AIMutation) OldCreatedAt

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

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

func (m *AIMutation) 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 (*AIMutation) OldPrompt

func (m *AIMutation) OldPrompt(ctx context.Context) (v string, err error)

OldPrompt returns the old "prompt" field's value of the AI entity. If the AI 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 (*AIMutation) OldResult

func (m *AIMutation) OldResult(ctx context.Context) (v []byte, err error)

OldResult returns the old "result" field's value of the AI entity. If the AI 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 (*AIMutation) OldStatus

func (m *AIMutation) OldStatus(ctx context.Context) (v ai.Status, err error)

OldStatus returns the old "status" field's value of the AI entity. If the AI 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 (*AIMutation) Op

func (m *AIMutation) Op() Op

Op returns the operation name.

func (*AIMutation) Prompt

func (m *AIMutation) Prompt() (r string, exists bool)

Prompt returns the value of the "prompt" field in the mutation.

func (*AIMutation) RemovedEdges

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

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

func (*AIMutation) RemovedIDs

func (m *AIMutation) 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 (*AIMutation) ResetAiClientName

func (m *AIMutation) ResetAiClientName()

ResetAiClientName resets all changes to the "ai_client_name" field.

func (*AIMutation) ResetCompletedAt

func (m *AIMutation) ResetCompletedAt()

ResetCompletedAt resets all changes to the "completed_at" field.

func (*AIMutation) ResetCreatedAt

func (m *AIMutation) ResetCreatedAt()

ResetCreatedAt resets all changes to the "created_at" field.

func (*AIMutation) ResetEdge

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

func (m *AIMutation) 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 (*AIMutation) ResetPrompt

func (m *AIMutation) ResetPrompt()

ResetPrompt resets all changes to the "prompt" field.

func (*AIMutation) ResetResult

func (m *AIMutation) ResetResult()

ResetResult resets all changes to the "result" field.

func (*AIMutation) ResetStatus

func (m *AIMutation) ResetStatus()

ResetStatus resets all changes to the "status" field.

func (*AIMutation) ResetUser

func (m *AIMutation) ResetUser()

ResetUser resets all changes to the "user" edge.

func (*AIMutation) Result

func (m *AIMutation) Result() (r []byte, exists bool)

Result returns the value of the "result" field in the mutation.

func (*AIMutation) SetAiClientName

func (m *AIMutation) SetAiClientName(s string)

SetAiClientName sets the "ai_client_name" field.

func (*AIMutation) SetCompletedAt

func (m *AIMutation) SetCompletedAt(t time.Time)

SetCompletedAt sets the "completed_at" field.

func (*AIMutation) SetCreatedAt

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

SetCreatedAt sets the "created_at" field.

func (*AIMutation) SetField

func (m *AIMutation) 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 (*AIMutation) SetOp

func (m *AIMutation) SetOp(op Op)

SetOp allows setting the mutation operation.

func (*AIMutation) SetPrompt

func (m *AIMutation) SetPrompt(s string)

SetPrompt sets the "prompt" field.

func (*AIMutation) SetResult

func (m *AIMutation) SetResult(b []byte)

SetResult sets the "result" field.

func (*AIMutation) SetStatus

func (m *AIMutation) SetStatus(a ai.Status)

SetStatus sets the "status" field.

func (*AIMutation) SetUserID

func (m *AIMutation) SetUserID(id int)

SetUserID sets the "user" edge to the User entity by id.

func (*AIMutation) Status

func (m *AIMutation) Status() (r ai.Status, exists bool)

Status returns the value of the "status" field in the mutation.

func (AIMutation) Tx

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

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

func (*AIMutation) Type

func (m *AIMutation) Type() string

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

func (*AIMutation) UserCleared

func (m *AIMutation) UserCleared() bool

UserCleared reports if the "user" edge to the User entity was cleared.

func (*AIMutation) UserID

func (m *AIMutation) UserID() (id int, exists bool)

UserID returns the "user" edge ID in the mutation.

func (*AIMutation) UserIDs

func (m *AIMutation) UserIDs() (ids []int)

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

func (*AIMutation) Where

func (m *AIMutation) Where(ps ...predicate.AI)

Where appends a list predicates to the AIMutation builder.

func (*AIMutation) WhereP

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

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

type AIQuery

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

AIQuery is the builder for querying AI entities.

func (*AIQuery) Aggregate

func (aq *AIQuery) Aggregate(fns ...AggregateFunc) *AISelect

Aggregate returns a AISelect configured with the given aggregations.

func (*AIQuery) All

func (aq *AIQuery) All(ctx context.Context) ([]*AI, error)

All executes the query and returns a list of AIs.

func (*AIQuery) AllX

func (aq *AIQuery) AllX(ctx context.Context) []*AI

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

func (*AIQuery) Clone

func (aq *AIQuery) Clone() *AIQuery

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

func (*AIQuery) Count

func (aq *AIQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*AIQuery) CountX

func (aq *AIQuery) CountX(ctx context.Context) int

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

func (*AIQuery) Exist

func (aq *AIQuery) Exist(ctx context.Context) (bool, error)

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

func (*AIQuery) ExistX

func (aq *AIQuery) ExistX(ctx context.Context) bool

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

func (*AIQuery) First

func (aq *AIQuery) First(ctx context.Context) (*AI, error)

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

func (*AIQuery) FirstID

func (aq *AIQuery) FirstID(ctx context.Context) (id int, err error)

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

func (*AIQuery) FirstIDX

func (aq *AIQuery) FirstIDX(ctx context.Context) int

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

func (*AIQuery) FirstX

func (aq *AIQuery) FirstX(ctx context.Context) *AI

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

func (*AIQuery) GroupBy

func (aq *AIQuery) GroupBy(field string, fields ...string) *AIGroupBy

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 {
	AiClientName string `json:"ai_client_name,omitempty"`
	Count int `json:"count,omitempty"`
}

client.AI.Query().
	GroupBy(ai.FieldAiClientName).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*AIQuery) IDs

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

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

func (*AIQuery) IDsX

func (aq *AIQuery) IDsX(ctx context.Context) []int

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

func (*AIQuery) Limit

func (aq *AIQuery) Limit(limit int) *AIQuery

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

func (*AIQuery) Offset

func (aq *AIQuery) Offset(offset int) *AIQuery

Offset to start from.

func (*AIQuery) Only

func (aq *AIQuery) Only(ctx context.Context) (*AI, error)

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

func (*AIQuery) OnlyID

func (aq *AIQuery) OnlyID(ctx context.Context) (id int, err error)

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

func (*AIQuery) OnlyIDX

func (aq *AIQuery) OnlyIDX(ctx context.Context) int

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

func (*AIQuery) OnlyX

func (aq *AIQuery) OnlyX(ctx context.Context) *AI

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

func (*AIQuery) Order

func (aq *AIQuery) Order(o ...ai.OrderOption) *AIQuery

Order specifies how the records should be ordered.

func (*AIQuery) QueryUser

func (aq *AIQuery) QueryUser() *UserQuery

QueryUser chains the current query on the "user" edge.

func (*AIQuery) Select

func (aq *AIQuery) Select(fields ...string) *AISelect

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 {
	AiClientName string `json:"ai_client_name,omitempty"`
}

client.AI.Query().
	Select(ai.FieldAiClientName).
	Scan(ctx, &v)

func (*AIQuery) Unique

func (aq *AIQuery) Unique(unique bool) *AIQuery

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

func (aq *AIQuery) Where(ps ...predicate.AI) *AIQuery

Where adds a new predicate for the AIQuery builder.

func (*AIQuery) WithUser

func (aq *AIQuery) WithUser(opts ...func(*UserQuery)) *AIQuery

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

type AISelect

type AISelect struct {
	*AIQuery
	// contains filtered or unexported fields
}

AISelect is the builder for selecting fields of AI entities.

func (*AISelect) Aggregate

func (as *AISelect) Aggregate(fns ...AggregateFunc) *AISelect

Aggregate adds the given aggregation functions to the selector query.

func (*AISelect) Bool

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

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

func (*AISelect) BoolX

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

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

func (*AISelect) Bools

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

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

func (*AISelect) BoolsX

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

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

func (*AISelect) Float64

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

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

func (*AISelect) Float64X

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

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

func (*AISelect) Float64s

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

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

func (*AISelect) Float64sX

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

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

func (*AISelect) Int

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

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

func (*AISelect) IntX

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

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

func (*AISelect) Ints

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

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

func (*AISelect) IntsX

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

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

func (*AISelect) Scan

func (as *AISelect) Scan(ctx context.Context, v any) error

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

func (*AISelect) ScanX

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

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

func (*AISelect) String

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

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

func (*AISelect) StringX

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

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

func (*AISelect) Strings

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

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

func (*AISelect) StringsX

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

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

type AIUpdate

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

AIUpdate is the builder for updating AI entities.

func (*AIUpdate) ClearCompletedAt

func (au *AIUpdate) ClearCompletedAt() *AIUpdate

ClearCompletedAt clears the value of the "completed_at" field.

func (*AIUpdate) ClearUser

func (au *AIUpdate) ClearUser() *AIUpdate

ClearUser clears the "user" edge to the User entity.

func (*AIUpdate) Exec

func (au *AIUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*AIUpdate) ExecX

func (au *AIUpdate) ExecX(ctx context.Context)

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

func (*AIUpdate) Mutation

func (au *AIUpdate) Mutation() *AIMutation

Mutation returns the AIMutation object of the builder.

func (*AIUpdate) Save

func (au *AIUpdate) Save(ctx context.Context) (int, error)

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

func (*AIUpdate) SaveX

func (au *AIUpdate) SaveX(ctx context.Context) int

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

func (*AIUpdate) SetAiClientName

func (au *AIUpdate) SetAiClientName(s string) *AIUpdate

SetAiClientName sets the "ai_client_name" field.

func (*AIUpdate) SetCompletedAt

func (au *AIUpdate) SetCompletedAt(t time.Time) *AIUpdate

SetCompletedAt sets the "completed_at" field.

func (*AIUpdate) SetNillableAiClientName

func (au *AIUpdate) SetNillableAiClientName(s *string) *AIUpdate

SetNillableAiClientName sets the "ai_client_name" field if the given value is not nil.

func (*AIUpdate) SetNillableCompletedAt

func (au *AIUpdate) SetNillableCompletedAt(t *time.Time) *AIUpdate

SetNillableCompletedAt sets the "completed_at" field if the given value is not nil.

func (*AIUpdate) SetNillablePrompt

func (au *AIUpdate) SetNillablePrompt(s *string) *AIUpdate

SetNillablePrompt sets the "prompt" field if the given value is not nil.

func (*AIUpdate) SetNillableStatus

func (au *AIUpdate) SetNillableStatus(a *ai.Status) *AIUpdate

SetNillableStatus sets the "status" field if the given value is not nil.

func (*AIUpdate) SetPrompt

func (au *AIUpdate) SetPrompt(s string) *AIUpdate

SetPrompt sets the "prompt" field.

func (*AIUpdate) SetResult

func (au *AIUpdate) SetResult(b []byte) *AIUpdate

SetResult sets the "result" field.

func (*AIUpdate) SetStatus

func (au *AIUpdate) SetStatus(a ai.Status) *AIUpdate

SetStatus sets the "status" field.

func (*AIUpdate) SetUser

func (au *AIUpdate) SetUser(u *User) *AIUpdate

SetUser sets the "user" edge to the User entity.

func (*AIUpdate) SetUserID

func (au *AIUpdate) SetUserID(id int) *AIUpdate

SetUserID sets the "user" edge to the User entity by ID.

func (*AIUpdate) Where

func (au *AIUpdate) Where(ps ...predicate.AI) *AIUpdate

Where appends a list predicates to the AIUpdate builder.

type AIUpdateOne

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

AIUpdateOne is the builder for updating a single AI entity.

func (*AIUpdateOne) ClearCompletedAt

func (auo *AIUpdateOne) ClearCompletedAt() *AIUpdateOne

ClearCompletedAt clears the value of the "completed_at" field.

func (*AIUpdateOne) ClearUser

func (auo *AIUpdateOne) ClearUser() *AIUpdateOne

ClearUser clears the "user" edge to the User entity.

func (*AIUpdateOne) Exec

func (auo *AIUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*AIUpdateOne) ExecX

func (auo *AIUpdateOne) ExecX(ctx context.Context)

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

func (*AIUpdateOne) Mutation

func (auo *AIUpdateOne) Mutation() *AIMutation

Mutation returns the AIMutation object of the builder.

func (*AIUpdateOne) Save

func (auo *AIUpdateOne) Save(ctx context.Context) (*AI, error)

Save executes the query and returns the updated AI entity.

func (*AIUpdateOne) SaveX

func (auo *AIUpdateOne) SaveX(ctx context.Context) *AI

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

func (*AIUpdateOne) Select

func (auo *AIUpdateOne) Select(field string, fields ...string) *AIUpdateOne

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

func (*AIUpdateOne) SetAiClientName

func (auo *AIUpdateOne) SetAiClientName(s string) *AIUpdateOne

SetAiClientName sets the "ai_client_name" field.

func (*AIUpdateOne) SetCompletedAt

func (auo *AIUpdateOne) SetCompletedAt(t time.Time) *AIUpdateOne

SetCompletedAt sets the "completed_at" field.

func (*AIUpdateOne) SetNillableAiClientName

func (auo *AIUpdateOne) SetNillableAiClientName(s *string) *AIUpdateOne

SetNillableAiClientName sets the "ai_client_name" field if the given value is not nil.

func (*AIUpdateOne) SetNillableCompletedAt

func (auo *AIUpdateOne) SetNillableCompletedAt(t *time.Time) *AIUpdateOne

SetNillableCompletedAt sets the "completed_at" field if the given value is not nil.

func (*AIUpdateOne) SetNillablePrompt

func (auo *AIUpdateOne) SetNillablePrompt(s *string) *AIUpdateOne

SetNillablePrompt sets the "prompt" field if the given value is not nil.

func (*AIUpdateOne) SetNillableStatus

func (auo *AIUpdateOne) SetNillableStatus(a *ai.Status) *AIUpdateOne

SetNillableStatus sets the "status" field if the given value is not nil.

func (*AIUpdateOne) SetPrompt

func (auo *AIUpdateOne) SetPrompt(s string) *AIUpdateOne

SetPrompt sets the "prompt" field.

func (*AIUpdateOne) SetResult

func (auo *AIUpdateOne) SetResult(b []byte) *AIUpdateOne

SetResult sets the "result" field.

func (*AIUpdateOne) SetStatus

func (auo *AIUpdateOne) SetStatus(a ai.Status) *AIUpdateOne

SetStatus sets the "status" field.

func (*AIUpdateOne) SetUser

func (auo *AIUpdateOne) SetUser(u *User) *AIUpdateOne

SetUser sets the "user" edge to the User entity.

func (*AIUpdateOne) SetUserID

func (auo *AIUpdateOne) SetUserID(id int) *AIUpdateOne

SetUserID sets the "user" edge to the User entity by ID.

func (*AIUpdateOne) Where

func (auo *AIUpdateOne) Where(ps ...predicate.AI) *AIUpdateOne

Where appends a list predicates to the AIUpdate builder.

type AIs

type AIs []*AI

AIs is a parsable slice of AI.

type AggregateFunc

type AggregateFunc func(*sql.Selector) string

AggregateFunc applies an aggregation step on the group-by traversal/selector.

func As

As is a pseudo aggregation function for renaming another other functions with custom names. For example:

GroupBy(field1, field2).
Aggregate(ent.As(ent.Sum(field1), "sum_field1"), (ent.As(ent.Sum(field2), "sum_field2")).
Scan(ctx, &v)

func Count

func Count() AggregateFunc

Count applies the "count" aggregation function on each group.

func Max

func Max(field string) AggregateFunc

Max applies the "max" aggregation function on the given field of each group.

func Mean

func Mean(field string) AggregateFunc

Mean applies the "mean" aggregation function on the given field of each group.

func Min

func Min(field string) AggregateFunc

Min applies the "min" aggregation function on the given field of each group.

func Sum

func Sum(field string) AggregateFunc

Sum applies the "sum" aggregation function on the given field of each group.

type Client

type Client struct {

	// Schema is the client for creating, migrating and dropping schema.
	Schema *migrate.Schema
	// AI is the client for interacting with the AI builders.
	AI *AIClient
	// ModelName is the client for interacting with the ModelName builders.
	ModelName *ModelNameClient
	// PasswordToken is the client for interacting with the PasswordToken builders.
	PasswordToken *PasswordTokenClient
	// Price is the client for interacting with the Price builders.
	Price *PriceClient
	// Product is the client for interacting with the Product builders.
	Product *ProductClient
	// 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 ...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().
	AI.
	Query().
	Count(ctx)

func (*Client) Intercept

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

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

func (*Client) Mutate

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

Mutate implements the ent.Mutator interface.

func (*Client) Tx

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

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

func (*Client) Use

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

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

type CommitFunc

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

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

func (CommitFunc) Commit

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

Commit calls f(ctx, m).

type CommitHook

type CommitHook func(Committer) Committer

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

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

type Committer

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

Committer is the interface that wraps the Commit method.

type ConstraintError

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

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

func (ConstraintError) Error

func (e ConstraintError) Error() string

Error implements the error interface.

func (*ConstraintError) Unwrap

func (e *ConstraintError) Unwrap() error

Unwrap implements the errors.Wrapper interface.

type Hook

type Hook = ent.Hook

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

type InterceptFunc

type InterceptFunc = ent.InterceptFunc

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

type Interceptor

type Interceptor = ent.Interceptor

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

type ModelName

type ModelName struct {

	// ID of the ent.
	ID int `json:"id,omitempty"`
	// FieldName holds the value of the "field_name" field.
	FieldName string `json:"field_name,omitempty"`
	// CreatedAt holds the value of the "created_at" field.
	CreatedAt time.Time `json:"created_at,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the ModelNameQuery when eager-loading is set.
	Edges ModelNameEdges `json:"edges"`
	// contains filtered or unexported fields
}

ModelName is the model entity for the ModelName schema.

func (*ModelName) QueryUser

func (mn *ModelName) QueryUser() *UserQuery

QueryUser queries the "user" edge of the ModelName entity.

func (*ModelName) String

func (mn *ModelName) String() string

String implements the fmt.Stringer.

func (*ModelName) Unwrap

func (mn *ModelName) Unwrap() *ModelName

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

func (mn *ModelName) Update() *ModelNameUpdateOne

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

func (*ModelName) Value

func (mn *ModelName) Value(name string) (ent.Value, error)

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

type ModelNameClient

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

ModelNameClient is a client for the ModelName schema.

func NewModelNameClient

func NewModelNameClient(c config) *ModelNameClient

NewModelNameClient returns a client for the ModelName from the given config.

func (*ModelNameClient) Create

func (c *ModelNameClient) Create() *ModelNameCreate

Create returns a builder for creating a ModelName entity.

func (*ModelNameClient) CreateBulk

func (c *ModelNameClient) CreateBulk(builders ...*ModelNameCreate) *ModelNameCreateBulk

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

func (*ModelNameClient) Delete

func (c *ModelNameClient) Delete() *ModelNameDelete

Delete returns a delete builder for ModelName.

func (*ModelNameClient) DeleteOne

func (c *ModelNameClient) DeleteOne(mn *ModelName) *ModelNameDeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*ModelNameClient) DeleteOneID

func (c *ModelNameClient) DeleteOneID(id int) *ModelNameDeleteOne

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

func (*ModelNameClient) Get

func (c *ModelNameClient) Get(ctx context.Context, id int) (*ModelName, error)

Get returns a ModelName entity by its id.

func (*ModelNameClient) GetX

func (c *ModelNameClient) GetX(ctx context.Context, id int) *ModelName

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

func (*ModelNameClient) Hooks

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

Hooks returns the client hooks.

func (*ModelNameClient) Intercept

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

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

func (*ModelNameClient) Interceptors

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

Interceptors returns the client interceptors.

func (*ModelNameClient) MapCreateBulk

func (c *ModelNameClient) MapCreateBulk(slice any, setFunc func(*ModelNameCreate, int)) *ModelNameCreateBulk

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

func (c *ModelNameClient) Query() *ModelNameQuery

Query returns a query builder for ModelName.

func (*ModelNameClient) QueryUser

func (c *ModelNameClient) QueryUser(mn *ModelName) *UserQuery

QueryUser queries the user edge of a ModelName.

func (*ModelNameClient) Update

func (c *ModelNameClient) Update() *ModelNameUpdate

Update returns an update builder for ModelName.

func (*ModelNameClient) UpdateOne

func (c *ModelNameClient) UpdateOne(mn *ModelName) *ModelNameUpdateOne

UpdateOne returns an update builder for the given entity.

func (*ModelNameClient) UpdateOneID

func (c *ModelNameClient) UpdateOneID(id int) *ModelNameUpdateOne

UpdateOneID returns an update builder for the given id.

func (*ModelNameClient) Use

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

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

type ModelNameCreate

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

ModelNameCreate is the builder for creating a ModelName entity.

func (*ModelNameCreate) Exec

func (mnc *ModelNameCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*ModelNameCreate) ExecX

func (mnc *ModelNameCreate) ExecX(ctx context.Context)

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

func (*ModelNameCreate) Mutation

func (mnc *ModelNameCreate) Mutation() *ModelNameMutation

Mutation returns the ModelNameMutation object of the builder.

func (*ModelNameCreate) Save

func (mnc *ModelNameCreate) Save(ctx context.Context) (*ModelName, error)

Save creates the ModelName in the database.

func (*ModelNameCreate) SaveX

func (mnc *ModelNameCreate) SaveX(ctx context.Context) *ModelName

SaveX calls Save and panics if Save returns an error.

func (*ModelNameCreate) SetCreatedAt

func (mnc *ModelNameCreate) SetCreatedAt(t time.Time) *ModelNameCreate

SetCreatedAt sets the "created_at" field.

func (*ModelNameCreate) SetFieldName

func (mnc *ModelNameCreate) SetFieldName(s string) *ModelNameCreate

SetFieldName sets the "field_name" field.

func (*ModelNameCreate) SetNillableCreatedAt

func (mnc *ModelNameCreate) SetNillableCreatedAt(t *time.Time) *ModelNameCreate

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

func (*ModelNameCreate) SetUser

func (mnc *ModelNameCreate) SetUser(u *User) *ModelNameCreate

SetUser sets the "user" edge to the User entity.

func (*ModelNameCreate) SetUserID

func (mnc *ModelNameCreate) SetUserID(id int) *ModelNameCreate

SetUserID sets the "user" edge to the User entity by ID.

type ModelNameCreateBulk

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

ModelNameCreateBulk is the builder for creating many ModelName entities in bulk.

func (*ModelNameCreateBulk) Exec

func (mncb *ModelNameCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*ModelNameCreateBulk) ExecX

func (mncb *ModelNameCreateBulk) ExecX(ctx context.Context)

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

func (*ModelNameCreateBulk) Save

func (mncb *ModelNameCreateBulk) Save(ctx context.Context) ([]*ModelName, error)

Save creates the ModelName entities in the database.

func (*ModelNameCreateBulk) SaveX

func (mncb *ModelNameCreateBulk) SaveX(ctx context.Context) []*ModelName

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

type ModelNameDelete

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

ModelNameDelete is the builder for deleting a ModelName entity.

func (*ModelNameDelete) Exec

func (mnd *ModelNameDelete) Exec(ctx context.Context) (int, error)

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

func (*ModelNameDelete) ExecX

func (mnd *ModelNameDelete) ExecX(ctx context.Context) int

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

func (*ModelNameDelete) Where

Where appends a list predicates to the ModelNameDelete builder.

type ModelNameDeleteOne

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

ModelNameDeleteOne is the builder for deleting a single ModelName entity.

func (*ModelNameDeleteOne) Exec

func (mndo *ModelNameDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*ModelNameDeleteOne) ExecX

func (mndo *ModelNameDeleteOne) ExecX(ctx context.Context)

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

func (*ModelNameDeleteOne) Where

Where appends a list predicates to the ModelNameDelete builder.

type ModelNameEdges

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

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

func (ModelNameEdges) UserOrErr

func (e ModelNameEdges) UserOrErr() (*User, error)

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

type ModelNameGroupBy

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

ModelNameGroupBy is the group-by builder for ModelName entities.

func (*ModelNameGroupBy) Aggregate

func (mngb *ModelNameGroupBy) Aggregate(fns ...AggregateFunc) *ModelNameGroupBy

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

func (*ModelNameGroupBy) Bool

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

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

func (*ModelNameGroupBy) BoolX

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

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

func (*ModelNameGroupBy) Bools

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

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

func (*ModelNameGroupBy) BoolsX

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

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

func (*ModelNameGroupBy) Float64

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

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

func (*ModelNameGroupBy) Float64X

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

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

func (*ModelNameGroupBy) Float64s

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

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

func (*ModelNameGroupBy) Float64sX

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

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

func (*ModelNameGroupBy) Int

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

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

func (*ModelNameGroupBy) IntX

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

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

func (*ModelNameGroupBy) Ints

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

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

func (*ModelNameGroupBy) IntsX

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

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

func (*ModelNameGroupBy) Scan

func (mngb *ModelNameGroupBy) Scan(ctx context.Context, v any) error

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

func (*ModelNameGroupBy) ScanX

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

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

func (*ModelNameGroupBy) String

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

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

func (*ModelNameGroupBy) StringX

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

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

func (*ModelNameGroupBy) Strings

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

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

func (*ModelNameGroupBy) StringsX

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

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

type ModelNameMutation

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

ModelNameMutation represents an operation that mutates the ModelName nodes in the graph.

func (*ModelNameMutation) AddField

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

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

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

func (*ModelNameMutation) AddedField

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

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

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

func (*ModelNameMutation) AddedIDs

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

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

func (*ModelNameMutation) ClearEdge

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

func (m *ModelNameMutation) 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 (*ModelNameMutation) ClearUser

func (m *ModelNameMutation) ClearUser()

ClearUser clears the "user" edge to the User entity.

func (*ModelNameMutation) ClearedEdges

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

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

func (*ModelNameMutation) ClearedFields

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

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

func (ModelNameMutation) Client

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

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

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

func (*ModelNameMutation) EdgeCleared

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

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

func (*ModelNameMutation) Field

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

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

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

func (*ModelNameMutation) FieldName

func (m *ModelNameMutation) FieldName() (r string, exists bool)

FieldName returns the value of the "field_name" field in the mutation.

func (*ModelNameMutation) Fields

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

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

ID returns the ID value in the mutation. Note that the ID is only available if it was provided to the builder or after it was returned from the database.

func (*ModelNameMutation) IDs

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

IDs queries the database and returns the entity ids that match the mutation's predicate. That means, if the mutation is applied within a transaction with an isolation level such as sql.LevelSerializable, the returned ids match the ids of the rows that will be updated or updated by the mutation.

func (*ModelNameMutation) OldCreatedAt

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

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

func (m *ModelNameMutation) 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 (*ModelNameMutation) OldFieldName

func (m *ModelNameMutation) OldFieldName(ctx context.Context) (v string, err error)

OldFieldName returns the old "field_name" field's value of the ModelName entity. If the ModelName 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 (*ModelNameMutation) Op

func (m *ModelNameMutation) Op() Op

Op returns the operation name.

func (*ModelNameMutation) RemovedEdges

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

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

func (*ModelNameMutation) RemovedIDs

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

func (m *ModelNameMutation) ResetCreatedAt()

ResetCreatedAt resets all changes to the "created_at" field.

func (*ModelNameMutation) ResetEdge

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

func (m *ModelNameMutation) 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 (*ModelNameMutation) ResetFieldName

func (m *ModelNameMutation) ResetFieldName()

ResetFieldName resets all changes to the "field_name" field.

func (*ModelNameMutation) ResetUser

func (m *ModelNameMutation) ResetUser()

ResetUser resets all changes to the "user" edge.

func (*ModelNameMutation) SetCreatedAt

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

SetCreatedAt sets the "created_at" field.

func (*ModelNameMutation) SetField

func (m *ModelNameMutation) 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 (*ModelNameMutation) SetFieldName

func (m *ModelNameMutation) SetFieldName(s string)

SetFieldName sets the "field_name" field.

func (*ModelNameMutation) SetOp

func (m *ModelNameMutation) SetOp(op Op)

SetOp allows setting the mutation operation.

func (*ModelNameMutation) SetUserID

func (m *ModelNameMutation) SetUserID(id int)

SetUserID sets the "user" edge to the User entity by id.

func (ModelNameMutation) Tx

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

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

func (*ModelNameMutation) Type

func (m *ModelNameMutation) Type() string

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

func (*ModelNameMutation) UserCleared

func (m *ModelNameMutation) UserCleared() bool

UserCleared reports if the "user" edge to the User entity was cleared.

func (*ModelNameMutation) UserID

func (m *ModelNameMutation) UserID() (id int, exists bool)

UserID returns the "user" edge ID in the mutation.

func (*ModelNameMutation) UserIDs

func (m *ModelNameMutation) UserIDs() (ids []int)

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

func (*ModelNameMutation) Where

func (m *ModelNameMutation) Where(ps ...predicate.ModelName)

Where appends a list predicates to the ModelNameMutation builder.

func (*ModelNameMutation) WhereP

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

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

type ModelNameQuery

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

ModelNameQuery is the builder for querying ModelName entities.

func (*ModelNameQuery) Aggregate

func (mnq *ModelNameQuery) Aggregate(fns ...AggregateFunc) *ModelNameSelect

Aggregate returns a ModelNameSelect configured with the given aggregations.

func (*ModelNameQuery) All

func (mnq *ModelNameQuery) All(ctx context.Context) ([]*ModelName, error)

All executes the query and returns a list of ModelNames.

func (*ModelNameQuery) AllX

func (mnq *ModelNameQuery) AllX(ctx context.Context) []*ModelName

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

func (*ModelNameQuery) Clone

func (mnq *ModelNameQuery) Clone() *ModelNameQuery

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

func (*ModelNameQuery) Count

func (mnq *ModelNameQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*ModelNameQuery) CountX

func (mnq *ModelNameQuery) CountX(ctx context.Context) int

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

func (*ModelNameQuery) Exist

func (mnq *ModelNameQuery) Exist(ctx context.Context) (bool, error)

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

func (*ModelNameQuery) ExistX

func (mnq *ModelNameQuery) ExistX(ctx context.Context) bool

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

func (*ModelNameQuery) First

func (mnq *ModelNameQuery) First(ctx context.Context) (*ModelName, error)

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

func (*ModelNameQuery) FirstID

func (mnq *ModelNameQuery) FirstID(ctx context.Context) (id int, err error)

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

func (*ModelNameQuery) FirstIDX

func (mnq *ModelNameQuery) FirstIDX(ctx context.Context) int

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

func (*ModelNameQuery) FirstX

func (mnq *ModelNameQuery) FirstX(ctx context.Context) *ModelName

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

func (*ModelNameQuery) GroupBy

func (mnq *ModelNameQuery) GroupBy(field string, fields ...string) *ModelNameGroupBy

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 {
	FieldName string `json:"field_name,omitempty"`
	Count int `json:"count,omitempty"`
}

client.ModelName.Query().
	GroupBy(modelname.FieldFieldName).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*ModelNameQuery) IDs

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

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

func (*ModelNameQuery) IDsX

func (mnq *ModelNameQuery) IDsX(ctx context.Context) []int

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

func (*ModelNameQuery) Limit

func (mnq *ModelNameQuery) Limit(limit int) *ModelNameQuery

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

func (*ModelNameQuery) Offset

func (mnq *ModelNameQuery) Offset(offset int) *ModelNameQuery

Offset to start from.

func (*ModelNameQuery) Only

func (mnq *ModelNameQuery) Only(ctx context.Context) (*ModelName, error)

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

func (*ModelNameQuery) OnlyID

func (mnq *ModelNameQuery) OnlyID(ctx context.Context) (id int, err error)

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

func (*ModelNameQuery) OnlyIDX

func (mnq *ModelNameQuery) OnlyIDX(ctx context.Context) int

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

func (*ModelNameQuery) OnlyX

func (mnq *ModelNameQuery) OnlyX(ctx context.Context) *ModelName

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

func (*ModelNameQuery) Order

Order specifies how the records should be ordered.

func (*ModelNameQuery) QueryUser

func (mnq *ModelNameQuery) QueryUser() *UserQuery

QueryUser chains the current query on the "user" edge.

func (*ModelNameQuery) Select

func (mnq *ModelNameQuery) Select(fields ...string) *ModelNameSelect

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 {
	FieldName string `json:"field_name,omitempty"`
}

client.ModelName.Query().
	Select(modelname.FieldFieldName).
	Scan(ctx, &v)

func (*ModelNameQuery) Unique

func (mnq *ModelNameQuery) Unique(unique bool) *ModelNameQuery

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

func (mnq *ModelNameQuery) Where(ps ...predicate.ModelName) *ModelNameQuery

Where adds a new predicate for the ModelNameQuery builder.

func (*ModelNameQuery) WithUser

func (mnq *ModelNameQuery) WithUser(opts ...func(*UserQuery)) *ModelNameQuery

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

type ModelNameSelect

type ModelNameSelect struct {
	*ModelNameQuery
	// contains filtered or unexported fields
}

ModelNameSelect is the builder for selecting fields of ModelName entities.

func (*ModelNameSelect) Aggregate

func (mns *ModelNameSelect) Aggregate(fns ...AggregateFunc) *ModelNameSelect

Aggregate adds the given aggregation functions to the selector query.

func (*ModelNameSelect) Bool

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

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

func (*ModelNameSelect) BoolX

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

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

func (*ModelNameSelect) Bools

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

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

func (*ModelNameSelect) BoolsX

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

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

func (*ModelNameSelect) Float64

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

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

func (*ModelNameSelect) Float64X

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

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

func (*ModelNameSelect) Float64s

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

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

func (*ModelNameSelect) Float64sX

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

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

func (*ModelNameSelect) Int

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

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

func (*ModelNameSelect) IntX

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

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

func (*ModelNameSelect) Ints

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

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

func (*ModelNameSelect) IntsX

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

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

func (*ModelNameSelect) Scan

func (mns *ModelNameSelect) Scan(ctx context.Context, v any) error

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

func (*ModelNameSelect) ScanX

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

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

func (*ModelNameSelect) String

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

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

func (*ModelNameSelect) StringX

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

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

func (*ModelNameSelect) Strings

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

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

func (*ModelNameSelect) StringsX

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

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

type ModelNameUpdate

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

ModelNameUpdate is the builder for updating ModelName entities.

func (*ModelNameUpdate) ClearUser

func (mnu *ModelNameUpdate) ClearUser() *ModelNameUpdate

ClearUser clears the "user" edge to the User entity.

func (*ModelNameUpdate) Exec

func (mnu *ModelNameUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*ModelNameUpdate) ExecX

func (mnu *ModelNameUpdate) ExecX(ctx context.Context)

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

func (*ModelNameUpdate) Mutation

func (mnu *ModelNameUpdate) Mutation() *ModelNameMutation

Mutation returns the ModelNameMutation object of the builder.

func (*ModelNameUpdate) Save

func (mnu *ModelNameUpdate) Save(ctx context.Context) (int, error)

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

func (*ModelNameUpdate) SaveX

func (mnu *ModelNameUpdate) SaveX(ctx context.Context) int

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

func (*ModelNameUpdate) SetFieldName

func (mnu *ModelNameUpdate) SetFieldName(s string) *ModelNameUpdate

SetFieldName sets the "field_name" field.

func (*ModelNameUpdate) SetNillableFieldName

func (mnu *ModelNameUpdate) SetNillableFieldName(s *string) *ModelNameUpdate

SetNillableFieldName sets the "field_name" field if the given value is not nil.

func (*ModelNameUpdate) SetUser

func (mnu *ModelNameUpdate) SetUser(u *User) *ModelNameUpdate

SetUser sets the "user" edge to the User entity.

func (*ModelNameUpdate) SetUserID

func (mnu *ModelNameUpdate) SetUserID(id int) *ModelNameUpdate

SetUserID sets the "user" edge to the User entity by ID.

func (*ModelNameUpdate) Where

Where appends a list predicates to the ModelNameUpdate builder.

type ModelNameUpdateOne

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

ModelNameUpdateOne is the builder for updating a single ModelName entity.

func (*ModelNameUpdateOne) ClearUser

func (mnuo *ModelNameUpdateOne) ClearUser() *ModelNameUpdateOne

ClearUser clears the "user" edge to the User entity.

func (*ModelNameUpdateOne) Exec

func (mnuo *ModelNameUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*ModelNameUpdateOne) ExecX

func (mnuo *ModelNameUpdateOne) ExecX(ctx context.Context)

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

func (*ModelNameUpdateOne) Mutation

func (mnuo *ModelNameUpdateOne) Mutation() *ModelNameMutation

Mutation returns the ModelNameMutation object of the builder.

func (*ModelNameUpdateOne) Save

func (mnuo *ModelNameUpdateOne) Save(ctx context.Context) (*ModelName, error)

Save executes the query and returns the updated ModelName entity.

func (*ModelNameUpdateOne) SaveX

func (mnuo *ModelNameUpdateOne) SaveX(ctx context.Context) *ModelName

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

func (*ModelNameUpdateOne) Select

func (mnuo *ModelNameUpdateOne) Select(field string, fields ...string) *ModelNameUpdateOne

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

func (*ModelNameUpdateOne) SetFieldName

func (mnuo *ModelNameUpdateOne) SetFieldName(s string) *ModelNameUpdateOne

SetFieldName sets the "field_name" field.

func (*ModelNameUpdateOne) SetNillableFieldName

func (mnuo *ModelNameUpdateOne) SetNillableFieldName(s *string) *ModelNameUpdateOne

SetNillableFieldName sets the "field_name" field if the given value is not nil.

func (*ModelNameUpdateOne) SetUser

func (mnuo *ModelNameUpdateOne) SetUser(u *User) *ModelNameUpdateOne

SetUser sets the "user" edge to the User entity.

func (*ModelNameUpdateOne) SetUserID

func (mnuo *ModelNameUpdateOne) SetUserID(id int) *ModelNameUpdateOne

SetUserID sets the "user" edge to the User entity by ID.

func (*ModelNameUpdateOne) Where

Where appends a list predicates to the ModelNameUpdate builder.

type ModelNames

type ModelNames []*ModelName

ModelNames is a parsable slice of ModelName.

type MutateFunc

type MutateFunc = ent.MutateFunc

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

type Mutation

type Mutation = ent.Mutation

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

type Mutator

type Mutator = ent.Mutator

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

type NotFoundError

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

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

func (*NotFoundError) Error

func (e *NotFoundError) Error() string

Error implements the error interface.

type NotLoadedError

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

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

func (*NotLoadedError) Error

func (e *NotLoadedError) Error() string

Error implements the error interface.

type NotSingularError

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

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

func (*NotSingularError) Error

func (e *NotSingularError) Error() string

Error implements the error interface.

type Op

type Op = ent.Op

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

type Option

type Option func(*config)

Option function to configure the client.

func Debug

func Debug() Option

Debug enables debug logging on the ent.Driver.

func Driver

func Driver(driver dialect.Driver) Option

Driver configures the client driver.

func Log

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

Log sets the logging function for debug mode.

type OrderFunc

type OrderFunc func(*sql.Selector)

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

type PasswordToken

type PasswordToken struct {

	// ID of the ent.
	ID int `json:"id,omitempty"`
	// Hash holds the value of the "hash" field.
	Hash string `json:"-"`
	// CreatedAt holds the value of the "created_at" field.
	CreatedAt time.Time `json:"created_at,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the PasswordTokenQuery when eager-loading is set.
	Edges PasswordTokenEdges `json:"edges"`
	// contains filtered or unexported fields
}

PasswordToken is the model entity for the PasswordToken schema.

func (*PasswordToken) QueryUser

func (pt *PasswordToken) QueryUser() *UserQuery

QueryUser queries the "user" edge of the PasswordToken entity.

func (*PasswordToken) String

func (pt *PasswordToken) String() string

String implements the fmt.Stringer.

func (*PasswordToken) Unwrap

func (pt *PasswordToken) Unwrap() *PasswordToken

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

func (pt *PasswordToken) Update() *PasswordTokenUpdateOne

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

func (*PasswordToken) Value

func (pt *PasswordToken) Value(name string) (ent.Value, error)

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

type PasswordTokenClient

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

PasswordTokenClient is a client for the PasswordToken schema.

func NewPasswordTokenClient

func NewPasswordTokenClient(c config) *PasswordTokenClient

NewPasswordTokenClient returns a client for the PasswordToken from the given config.

func (*PasswordTokenClient) Create

Create returns a builder for creating a PasswordToken entity.

func (*PasswordTokenClient) CreateBulk

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

func (*PasswordTokenClient) Delete

Delete returns a delete builder for PasswordToken.

func (*PasswordTokenClient) DeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*PasswordTokenClient) DeleteOneID

func (c *PasswordTokenClient) DeleteOneID(id int) *PasswordTokenDeleteOne

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

func (*PasswordTokenClient) Get

Get returns a PasswordToken entity by its id.

func (*PasswordTokenClient) GetX

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

func (*PasswordTokenClient) Hooks

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

Hooks returns the client hooks.

func (*PasswordTokenClient) Intercept

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

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

func (*PasswordTokenClient) Interceptors

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

Interceptors returns the client interceptors.

func (*PasswordTokenClient) MapCreateBulk

func (c *PasswordTokenClient) MapCreateBulk(slice any, setFunc func(*PasswordTokenCreate, int)) *PasswordTokenCreateBulk

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

Query returns a query builder for PasswordToken.

func (*PasswordTokenClient) QueryUser

func (c *PasswordTokenClient) QueryUser(pt *PasswordToken) *UserQuery

QueryUser queries the user edge of a PasswordToken.

func (*PasswordTokenClient) Update

Update returns an update builder for PasswordToken.

func (*PasswordTokenClient) UpdateOne

UpdateOne returns an update builder for the given entity.

func (*PasswordTokenClient) UpdateOneID

func (c *PasswordTokenClient) UpdateOneID(id int) *PasswordTokenUpdateOne

UpdateOneID returns an update builder for the given id.

func (*PasswordTokenClient) Use

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

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

type PasswordTokenCreate

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

PasswordTokenCreate is the builder for creating a PasswordToken entity.

func (*PasswordTokenCreate) Exec

func (ptc *PasswordTokenCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*PasswordTokenCreate) ExecX

func (ptc *PasswordTokenCreate) ExecX(ctx context.Context)

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

func (*PasswordTokenCreate) Mutation

func (ptc *PasswordTokenCreate) Mutation() *PasswordTokenMutation

Mutation returns the PasswordTokenMutation object of the builder.

func (*PasswordTokenCreate) Save

Save creates the PasswordToken in the database.

func (*PasswordTokenCreate) SaveX

SaveX calls Save and panics if Save returns an error.

func (*PasswordTokenCreate) SetCreatedAt

func (ptc *PasswordTokenCreate) SetCreatedAt(t time.Time) *PasswordTokenCreate

SetCreatedAt sets the "created_at" field.

func (*PasswordTokenCreate) SetHash

SetHash sets the "hash" field.

func (*PasswordTokenCreate) SetNillableCreatedAt

func (ptc *PasswordTokenCreate) SetNillableCreatedAt(t *time.Time) *PasswordTokenCreate

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

func (*PasswordTokenCreate) SetUser

func (ptc *PasswordTokenCreate) SetUser(u *User) *PasswordTokenCreate

SetUser sets the "user" edge to the User entity.

func (*PasswordTokenCreate) SetUserID

func (ptc *PasswordTokenCreate) SetUserID(id int) *PasswordTokenCreate

SetUserID sets the "user" edge to the User entity by ID.

type PasswordTokenCreateBulk

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

PasswordTokenCreateBulk is the builder for creating many PasswordToken entities in bulk.

func (*PasswordTokenCreateBulk) Exec

func (ptcb *PasswordTokenCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*PasswordTokenCreateBulk) ExecX

func (ptcb *PasswordTokenCreateBulk) ExecX(ctx context.Context)

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

func (*PasswordTokenCreateBulk) Save

Save creates the PasswordToken entities in the database.

func (*PasswordTokenCreateBulk) SaveX

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

type PasswordTokenDelete

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

PasswordTokenDelete is the builder for deleting a PasswordToken entity.

func (*PasswordTokenDelete) Exec

func (ptd *PasswordTokenDelete) Exec(ctx context.Context) (int, error)

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

func (*PasswordTokenDelete) ExecX

func (ptd *PasswordTokenDelete) ExecX(ctx context.Context) int

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

func (*PasswordTokenDelete) Where

Where appends a list predicates to the PasswordTokenDelete builder.

type PasswordTokenDeleteOne

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

PasswordTokenDeleteOne is the builder for deleting a single PasswordToken entity.

func (*PasswordTokenDeleteOne) Exec

func (ptdo *PasswordTokenDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*PasswordTokenDeleteOne) ExecX

func (ptdo *PasswordTokenDeleteOne) ExecX(ctx context.Context)

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

func (*PasswordTokenDeleteOne) Where

Where appends a list predicates to the PasswordTokenDelete builder.

type PasswordTokenEdges

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

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

func (PasswordTokenEdges) UserOrErr

func (e PasswordTokenEdges) UserOrErr() (*User, error)

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

type PasswordTokenGroupBy

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

PasswordTokenGroupBy is the group-by builder for PasswordToken entities.

func (*PasswordTokenGroupBy) Aggregate

func (ptgb *PasswordTokenGroupBy) Aggregate(fns ...AggregateFunc) *PasswordTokenGroupBy

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

func (*PasswordTokenGroupBy) Bool

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

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

func (*PasswordTokenGroupBy) BoolX

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

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

func (*PasswordTokenGroupBy) Bools

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

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

func (*PasswordTokenGroupBy) BoolsX

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

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

func (*PasswordTokenGroupBy) Float64

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

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

func (*PasswordTokenGroupBy) Float64X

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

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

func (*PasswordTokenGroupBy) Float64s

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

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

func (*PasswordTokenGroupBy) Float64sX

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

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

func (*PasswordTokenGroupBy) Int

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

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

func (*PasswordTokenGroupBy) IntX

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

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

func (*PasswordTokenGroupBy) Ints

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

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

func (*PasswordTokenGroupBy) IntsX

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

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

func (*PasswordTokenGroupBy) Scan

func (ptgb *PasswordTokenGroupBy) Scan(ctx context.Context, v any) error

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

func (*PasswordTokenGroupBy) ScanX

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

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

func (*PasswordTokenGroupBy) String

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

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

func (*PasswordTokenGroupBy) StringX

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

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

func (*PasswordTokenGroupBy) Strings

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

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

func (*PasswordTokenGroupBy) StringsX

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

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

type PasswordTokenMutation

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

PasswordTokenMutation represents an operation that mutates the PasswordToken nodes in the graph.

func (*PasswordTokenMutation) AddField

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

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

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

func (*PasswordTokenMutation) AddedField

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

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

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

func (*PasswordTokenMutation) AddedIDs

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

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

func (*PasswordTokenMutation) ClearEdge

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

func (m *PasswordTokenMutation) 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 (*PasswordTokenMutation) ClearUser

func (m *PasswordTokenMutation) ClearUser()

ClearUser clears the "user" edge to the User entity.

func (*PasswordTokenMutation) ClearedEdges

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

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

func (*PasswordTokenMutation) ClearedFields

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

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

func (PasswordTokenMutation) Client

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

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

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

func (*PasswordTokenMutation) EdgeCleared

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

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

func (*PasswordTokenMutation) Field

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

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

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

func (*PasswordTokenMutation) Fields

func (m *PasswordTokenMutation) 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 (*PasswordTokenMutation) Hash

func (m *PasswordTokenMutation) Hash() (r string, exists bool)

Hash returns the value of the "hash" field in the mutation.

func (*PasswordTokenMutation) ID

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

ID returns the ID value in the mutation. Note that the ID is only available if it was provided to the builder or after it was returned from the database.

func (*PasswordTokenMutation) IDs

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

IDs queries the database and returns the entity ids that match the mutation's predicate. That means, if the mutation is applied within a transaction with an isolation level such as sql.LevelSerializable, the returned ids match the ids of the rows that will be updated or updated by the mutation.

func (*PasswordTokenMutation) OldCreatedAt

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

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

func (m *PasswordTokenMutation) 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 (*PasswordTokenMutation) OldHash

func (m *PasswordTokenMutation) OldHash(ctx context.Context) (v string, err error)

OldHash returns the old "hash" field's value of the PasswordToken entity. If the PasswordToken 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 (*PasswordTokenMutation) Op

func (m *PasswordTokenMutation) Op() Op

Op returns the operation name.

func (*PasswordTokenMutation) RemovedEdges

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

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

func (*PasswordTokenMutation) RemovedIDs

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

func (m *PasswordTokenMutation) ResetCreatedAt()

ResetCreatedAt resets all changes to the "created_at" field.

func (*PasswordTokenMutation) ResetEdge

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

func (m *PasswordTokenMutation) 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 (*PasswordTokenMutation) ResetHash

func (m *PasswordTokenMutation) ResetHash()

ResetHash resets all changes to the "hash" field.

func (*PasswordTokenMutation) ResetUser

func (m *PasswordTokenMutation) ResetUser()

ResetUser resets all changes to the "user" edge.

func (*PasswordTokenMutation) SetCreatedAt

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

SetCreatedAt sets the "created_at" field.

func (*PasswordTokenMutation) SetField

func (m *PasswordTokenMutation) 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 (*PasswordTokenMutation) SetHash

func (m *PasswordTokenMutation) SetHash(s string)

SetHash sets the "hash" field.

func (*PasswordTokenMutation) SetOp

func (m *PasswordTokenMutation) SetOp(op Op)

SetOp allows setting the mutation operation.

func (*PasswordTokenMutation) SetUserID

func (m *PasswordTokenMutation) SetUserID(id int)

SetUserID sets the "user" edge to the User entity by id.

func (PasswordTokenMutation) Tx

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

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

func (*PasswordTokenMutation) Type

func (m *PasswordTokenMutation) Type() string

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

func (*PasswordTokenMutation) UserCleared

func (m *PasswordTokenMutation) UserCleared() bool

UserCleared reports if the "user" edge to the User entity was cleared.

func (*PasswordTokenMutation) UserID

func (m *PasswordTokenMutation) UserID() (id int, exists bool)

UserID returns the "user" edge ID in the mutation.

func (*PasswordTokenMutation) UserIDs

func (m *PasswordTokenMutation) UserIDs() (ids []int)

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

func (*PasswordTokenMutation) Where

Where appends a list predicates to the PasswordTokenMutation builder.

func (*PasswordTokenMutation) WhereP

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

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

type PasswordTokenQuery

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

PasswordTokenQuery is the builder for querying PasswordToken entities.

func (*PasswordTokenQuery) Aggregate

func (ptq *PasswordTokenQuery) Aggregate(fns ...AggregateFunc) *PasswordTokenSelect

Aggregate returns a PasswordTokenSelect configured with the given aggregations.

func (*PasswordTokenQuery) All

All executes the query and returns a list of PasswordTokens.

func (*PasswordTokenQuery) AllX

func (ptq *PasswordTokenQuery) AllX(ctx context.Context) []*PasswordToken

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

func (*PasswordTokenQuery) Clone

func (ptq *PasswordTokenQuery) Clone() *PasswordTokenQuery

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

func (*PasswordTokenQuery) Count

func (ptq *PasswordTokenQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*PasswordTokenQuery) CountX

func (ptq *PasswordTokenQuery) CountX(ctx context.Context) int

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

func (*PasswordTokenQuery) Exist

func (ptq *PasswordTokenQuery) Exist(ctx context.Context) (bool, error)

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

func (*PasswordTokenQuery) ExistX

func (ptq *PasswordTokenQuery) ExistX(ctx context.Context) bool

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

func (*PasswordTokenQuery) First

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

func (*PasswordTokenQuery) FirstID

func (ptq *PasswordTokenQuery) FirstID(ctx context.Context) (id int, err error)

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

func (*PasswordTokenQuery) FirstIDX

func (ptq *PasswordTokenQuery) FirstIDX(ctx context.Context) int

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

func (*PasswordTokenQuery) FirstX

func (ptq *PasswordTokenQuery) FirstX(ctx context.Context) *PasswordToken

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

func (*PasswordTokenQuery) GroupBy

func (ptq *PasswordTokenQuery) GroupBy(field string, fields ...string) *PasswordTokenGroupBy

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 {
	Hash string `json:"hash,omitempty"`
	Count int `json:"count,omitempty"`
}

client.PasswordToken.Query().
	GroupBy(passwordtoken.FieldHash).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*PasswordTokenQuery) IDs

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

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

func (*PasswordTokenQuery) IDsX

func (ptq *PasswordTokenQuery) IDsX(ctx context.Context) []int

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

func (*PasswordTokenQuery) Limit

func (ptq *PasswordTokenQuery) Limit(limit int) *PasswordTokenQuery

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

func (*PasswordTokenQuery) Offset

func (ptq *PasswordTokenQuery) Offset(offset int) *PasswordTokenQuery

Offset to start from.

func (*PasswordTokenQuery) Only

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

func (*PasswordTokenQuery) OnlyID

func (ptq *PasswordTokenQuery) OnlyID(ctx context.Context) (id int, err error)

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

func (*PasswordTokenQuery) OnlyIDX

func (ptq *PasswordTokenQuery) OnlyIDX(ctx context.Context) int

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

func (*PasswordTokenQuery) OnlyX

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

func (*PasswordTokenQuery) Order

Order specifies how the records should be ordered.

func (*PasswordTokenQuery) QueryUser

func (ptq *PasswordTokenQuery) QueryUser() *UserQuery

QueryUser chains the current query on the "user" edge.

func (*PasswordTokenQuery) Select

func (ptq *PasswordTokenQuery) Select(fields ...string) *PasswordTokenSelect

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 {
	Hash string `json:"hash,omitempty"`
}

client.PasswordToken.Query().
	Select(passwordtoken.FieldHash).
	Scan(ctx, &v)

func (*PasswordTokenQuery) Unique

func (ptq *PasswordTokenQuery) Unique(unique bool) *PasswordTokenQuery

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

Where adds a new predicate for the PasswordTokenQuery builder.

func (*PasswordTokenQuery) WithUser

func (ptq *PasswordTokenQuery) WithUser(opts ...func(*UserQuery)) *PasswordTokenQuery

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

type PasswordTokenSelect

type PasswordTokenSelect struct {
	*PasswordTokenQuery
	// contains filtered or unexported fields
}

PasswordTokenSelect is the builder for selecting fields of PasswordToken entities.

func (*PasswordTokenSelect) Aggregate

func (pts *PasswordTokenSelect) Aggregate(fns ...AggregateFunc) *PasswordTokenSelect

Aggregate adds the given aggregation functions to the selector query.

func (*PasswordTokenSelect) Bool

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

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

func (*PasswordTokenSelect) BoolX

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

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

func (*PasswordTokenSelect) Bools

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

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

func (*PasswordTokenSelect) BoolsX

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

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

func (*PasswordTokenSelect) Float64

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

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

func (*PasswordTokenSelect) Float64X

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

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

func (*PasswordTokenSelect) Float64s

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

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

func (*PasswordTokenSelect) Float64sX

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

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

func (*PasswordTokenSelect) Int

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

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

func (*PasswordTokenSelect) IntX

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

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

func (*PasswordTokenSelect) Ints

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

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

func (*PasswordTokenSelect) IntsX

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

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

func (*PasswordTokenSelect) Scan

func (pts *PasswordTokenSelect) Scan(ctx context.Context, v any) error

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

func (*PasswordTokenSelect) ScanX

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

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

func (*PasswordTokenSelect) String

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

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

func (*PasswordTokenSelect) StringX

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

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

func (*PasswordTokenSelect) Strings

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

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

func (*PasswordTokenSelect) StringsX

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

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

type PasswordTokenUpdate

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

PasswordTokenUpdate is the builder for updating PasswordToken entities.

func (*PasswordTokenUpdate) ClearUser

func (ptu *PasswordTokenUpdate) ClearUser() *PasswordTokenUpdate

ClearUser clears the "user" edge to the User entity.

func (*PasswordTokenUpdate) Exec

func (ptu *PasswordTokenUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*PasswordTokenUpdate) ExecX

func (ptu *PasswordTokenUpdate) ExecX(ctx context.Context)

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

func (*PasswordTokenUpdate) Mutation

func (ptu *PasswordTokenUpdate) Mutation() *PasswordTokenMutation

Mutation returns the PasswordTokenMutation object of the builder.

func (*PasswordTokenUpdate) Save

func (ptu *PasswordTokenUpdate) Save(ctx context.Context) (int, error)

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

func (*PasswordTokenUpdate) SaveX

func (ptu *PasswordTokenUpdate) SaveX(ctx context.Context) int

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

func (*PasswordTokenUpdate) SetCreatedAt

func (ptu *PasswordTokenUpdate) SetCreatedAt(t time.Time) *PasswordTokenUpdate

SetCreatedAt sets the "created_at" field.

func (*PasswordTokenUpdate) SetHash

SetHash sets the "hash" field.

func (*PasswordTokenUpdate) SetNillableCreatedAt

func (ptu *PasswordTokenUpdate) SetNillableCreatedAt(t *time.Time) *PasswordTokenUpdate

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

func (*PasswordTokenUpdate) SetNillableHash

func (ptu *PasswordTokenUpdate) SetNillableHash(s *string) *PasswordTokenUpdate

SetNillableHash sets the "hash" field if the given value is not nil.

func (*PasswordTokenUpdate) SetUser

func (ptu *PasswordTokenUpdate) SetUser(u *User) *PasswordTokenUpdate

SetUser sets the "user" edge to the User entity.

func (*PasswordTokenUpdate) SetUserID

func (ptu *PasswordTokenUpdate) SetUserID(id int) *PasswordTokenUpdate

SetUserID sets the "user" edge to the User entity by ID.

func (*PasswordTokenUpdate) Where

Where appends a list predicates to the PasswordTokenUpdate builder.

type PasswordTokenUpdateOne

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

PasswordTokenUpdateOne is the builder for updating a single PasswordToken entity.

func (*PasswordTokenUpdateOne) ClearUser

ClearUser clears the "user" edge to the User entity.

func (*PasswordTokenUpdateOne) Exec

func (ptuo *PasswordTokenUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*PasswordTokenUpdateOne) ExecX

func (ptuo *PasswordTokenUpdateOne) ExecX(ctx context.Context)

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

func (*PasswordTokenUpdateOne) Mutation

Mutation returns the PasswordTokenMutation object of the builder.

func (*PasswordTokenUpdateOne) Save

Save executes the query and returns the updated PasswordToken entity.

func (*PasswordTokenUpdateOne) SaveX

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

func (*PasswordTokenUpdateOne) Select

func (ptuo *PasswordTokenUpdateOne) Select(field string, fields ...string) *PasswordTokenUpdateOne

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

func (*PasswordTokenUpdateOne) SetCreatedAt

func (ptuo *PasswordTokenUpdateOne) SetCreatedAt(t time.Time) *PasswordTokenUpdateOne

SetCreatedAt sets the "created_at" field.

func (*PasswordTokenUpdateOne) SetHash

SetHash sets the "hash" field.

func (*PasswordTokenUpdateOne) SetNillableCreatedAt

func (ptuo *PasswordTokenUpdateOne) SetNillableCreatedAt(t *time.Time) *PasswordTokenUpdateOne

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

func (*PasswordTokenUpdateOne) SetNillableHash

func (ptuo *PasswordTokenUpdateOne) SetNillableHash(s *string) *PasswordTokenUpdateOne

SetNillableHash sets the "hash" field if the given value is not nil.

func (*PasswordTokenUpdateOne) SetUser

SetUser sets the "user" edge to the User entity.

func (*PasswordTokenUpdateOne) SetUserID

func (ptuo *PasswordTokenUpdateOne) SetUserID(id int) *PasswordTokenUpdateOne

SetUserID sets the "user" edge to the User entity by ID.

func (*PasswordTokenUpdateOne) Where

Where appends a list predicates to the PasswordTokenUpdate builder.

type PasswordTokens

type PasswordTokens []*PasswordToken

PasswordTokens is a parsable slice of PasswordToken.

type Policy

type Policy = ent.Policy

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

type Price

type Price struct {

	// ID of the ent.
	ID int `json:"id,omitempty"`
	// StripeID holds the value of the "stripe_id" field.
	StripeID string `json:"stripe_id,omitempty"`
	// Amount holds the value of the "amount" field.
	Amount int `json:"amount,omitempty"`
	// Quantity holds the value of the "quantity" field.
	Quantity int `json:"quantity,omitempty"`
	// Type holds the value of the "type" field.
	Type price.Type `json:"type,omitempty"`
	// CreatedAt holds the value of the "created_at" field.
	CreatedAt time.Time `json:"created_at,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the PriceQuery when eager-loading is set.
	Edges PriceEdges `json:"edges"`
	// contains filtered or unexported fields
}

Price is the model entity for the Price schema.

func (*Price) QueryProduct

func (pr *Price) QueryProduct() *ProductQuery

QueryProduct queries the "product" edge of the Price entity.

func (*Price) QueryUser

func (pr *Price) QueryUser() *UserQuery

QueryUser queries the "user" edge of the Price entity.

func (*Price) String

func (pr *Price) String() string

String implements the fmt.Stringer.

func (*Price) Unwrap

func (pr *Price) Unwrap() *Price

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

func (pr *Price) Update() *PriceUpdateOne

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

func (*Price) Value

func (pr *Price) Value(name string) (ent.Value, error)

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

type PriceClient

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

PriceClient is a client for the Price schema.

func NewPriceClient

func NewPriceClient(c config) *PriceClient

NewPriceClient returns a client for the Price from the given config.

func (*PriceClient) Create

func (c *PriceClient) Create() *PriceCreate

Create returns a builder for creating a Price entity.

func (*PriceClient) CreateBulk

func (c *PriceClient) CreateBulk(builders ...*PriceCreate) *PriceCreateBulk

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

func (*PriceClient) Delete

func (c *PriceClient) Delete() *PriceDelete

Delete returns a delete builder for Price.

func (*PriceClient) DeleteOne

func (c *PriceClient) DeleteOne(pr *Price) *PriceDeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*PriceClient) DeleteOneID

func (c *PriceClient) DeleteOneID(id int) *PriceDeleteOne

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

func (*PriceClient) Get

func (c *PriceClient) Get(ctx context.Context, id int) (*Price, error)

Get returns a Price entity by its id.

func (*PriceClient) GetX

func (c *PriceClient) GetX(ctx context.Context, id int) *Price

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

func (*PriceClient) Hooks

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

Hooks returns the client hooks.

func (*PriceClient) Intercept

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

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

func (*PriceClient) Interceptors

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

Interceptors returns the client interceptors.

func (*PriceClient) MapCreateBulk

func (c *PriceClient) MapCreateBulk(slice any, setFunc func(*PriceCreate, int)) *PriceCreateBulk

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

func (c *PriceClient) Query() *PriceQuery

Query returns a query builder for Price.

func (*PriceClient) QueryProduct

func (c *PriceClient) QueryProduct(pr *Price) *ProductQuery

QueryProduct queries the product edge of a Price.

func (*PriceClient) QueryUser

func (c *PriceClient) QueryUser(pr *Price) *UserQuery

QueryUser queries the user edge of a Price.

func (*PriceClient) Update

func (c *PriceClient) Update() *PriceUpdate

Update returns an update builder for Price.

func (*PriceClient) UpdateOne

func (c *PriceClient) UpdateOne(pr *Price) *PriceUpdateOne

UpdateOne returns an update builder for the given entity.

func (*PriceClient) UpdateOneID

func (c *PriceClient) UpdateOneID(id int) *PriceUpdateOne

UpdateOneID returns an update builder for the given id.

func (*PriceClient) Use

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

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

type PriceCreate

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

PriceCreate is the builder for creating a Price entity.

func (*PriceCreate) Exec

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

Exec executes the query.

func (*PriceCreate) ExecX

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

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

func (*PriceCreate) Mutation

func (pc *PriceCreate) Mutation() *PriceMutation

Mutation returns the PriceMutation object of the builder.

func (*PriceCreate) Save

func (pc *PriceCreate) Save(ctx context.Context) (*Price, error)

Save creates the Price in the database.

func (*PriceCreate) SaveX

func (pc *PriceCreate) SaveX(ctx context.Context) *Price

SaveX calls Save and panics if Save returns an error.

func (*PriceCreate) SetAmount

func (pc *PriceCreate) SetAmount(i int) *PriceCreate

SetAmount sets the "amount" field.

func (*PriceCreate) SetCreatedAt

func (pc *PriceCreate) SetCreatedAt(t time.Time) *PriceCreate

SetCreatedAt sets the "created_at" field.

func (*PriceCreate) SetNillableCreatedAt

func (pc *PriceCreate) SetNillableCreatedAt(t *time.Time) *PriceCreate

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

func (*PriceCreate) SetNillableType

func (pc *PriceCreate) SetNillableType(pr *price.Type) *PriceCreate

SetNillableType sets the "type" field if the given value is not nil.

func (*PriceCreate) SetProduct

func (pc *PriceCreate) SetProduct(p *Product) *PriceCreate

SetProduct sets the "product" edge to the Product entity.

func (*PriceCreate) SetProductID

func (pc *PriceCreate) SetProductID(id int) *PriceCreate

SetProductID sets the "product" edge to the Product entity by ID.

func (*PriceCreate) SetQuantity

func (pc *PriceCreate) SetQuantity(i int) *PriceCreate

SetQuantity sets the "quantity" field.

func (*PriceCreate) SetStripeID

func (pc *PriceCreate) SetStripeID(s string) *PriceCreate

SetStripeID sets the "stripe_id" field.

func (*PriceCreate) SetType

func (pc *PriceCreate) SetType(pr price.Type) *PriceCreate

SetType sets the "type" field.

func (*PriceCreate) SetUser

func (pc *PriceCreate) SetUser(u *User) *PriceCreate

SetUser sets the "user" edge to the User entity.

func (*PriceCreate) SetUserID

func (pc *PriceCreate) SetUserID(id int) *PriceCreate

SetUserID sets the "user" edge to the User entity by ID.

type PriceCreateBulk

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

PriceCreateBulk is the builder for creating many Price entities in bulk.

func (*PriceCreateBulk) Exec

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

Exec executes the query.

func (*PriceCreateBulk) ExecX

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

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

func (*PriceCreateBulk) Save

func (pcb *PriceCreateBulk) Save(ctx context.Context) ([]*Price, error)

Save creates the Price entities in the database.

func (*PriceCreateBulk) SaveX

func (pcb *PriceCreateBulk) SaveX(ctx context.Context) []*Price

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

type PriceDelete

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

PriceDelete is the builder for deleting a Price entity.

func (*PriceDelete) Exec

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

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

func (*PriceDelete) ExecX

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

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

func (*PriceDelete) Where

func (pd *PriceDelete) Where(ps ...predicate.Price) *PriceDelete

Where appends a list predicates to the PriceDelete builder.

type PriceDeleteOne

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

PriceDeleteOne is the builder for deleting a single Price entity.

func (*PriceDeleteOne) Exec

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

Exec executes the deletion query.

func (*PriceDeleteOne) ExecX

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

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

func (*PriceDeleteOne) Where

func (pdo *PriceDeleteOne) Where(ps ...predicate.Price) *PriceDeleteOne

Where appends a list predicates to the PriceDelete builder.

type PriceEdges

type PriceEdges struct {
	// User holds the value of the user edge.
	User *User `json:"user,omitempty"`
	// Product holds the value of the product edge.
	Product *Product `json:"product,omitempty"`
	// contains filtered or unexported fields
}

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

func (PriceEdges) ProductOrErr

func (e PriceEdges) ProductOrErr() (*Product, error)

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

func (PriceEdges) UserOrErr

func (e PriceEdges) UserOrErr() (*User, error)

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

type PriceGroupBy

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

PriceGroupBy is the group-by builder for Price entities.

func (*PriceGroupBy) Aggregate

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

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

func (*PriceGroupBy) Bool

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

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

func (*PriceGroupBy) BoolX

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

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

func (*PriceGroupBy) Bools

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

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

func (*PriceGroupBy) BoolsX

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

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

func (*PriceGroupBy) Float64

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

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

func (*PriceGroupBy) Float64X

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

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

func (*PriceGroupBy) Float64s

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

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

func (*PriceGroupBy) Float64sX

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

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

func (*PriceGroupBy) Int

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

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

func (*PriceGroupBy) IntX

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

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

func (*PriceGroupBy) Ints

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

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

func (*PriceGroupBy) IntsX

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

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

func (*PriceGroupBy) Scan

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

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

func (*PriceGroupBy) ScanX

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

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

func (*PriceGroupBy) String

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

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

func (*PriceGroupBy) StringX

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

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

func (*PriceGroupBy) Strings

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

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

func (*PriceGroupBy) StringsX

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

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

type PriceMutation

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

PriceMutation represents an operation that mutates the Price nodes in the graph.

func (*PriceMutation) AddAmount

func (m *PriceMutation) AddAmount(i int)

AddAmount adds i to the "amount" field.

func (*PriceMutation) AddField

func (m *PriceMutation) 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 (*PriceMutation) AddQuantity

func (m *PriceMutation) AddQuantity(i int)

AddQuantity adds i to the "quantity" field.

func (*PriceMutation) AddedAmount

func (m *PriceMutation) AddedAmount() (r int, exists bool)

AddedAmount returns the value that was added to the "amount" field in this mutation.

func (*PriceMutation) AddedEdges

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

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

func (*PriceMutation) AddedField

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

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

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

func (*PriceMutation) AddedIDs

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

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

func (*PriceMutation) AddedQuantity

func (m *PriceMutation) AddedQuantity() (r int, exists bool)

AddedQuantity returns the value that was added to the "quantity" field in this mutation.

func (*PriceMutation) Amount

func (m *PriceMutation) Amount() (r int, exists bool)

Amount returns the value of the "amount" field in the mutation.

func (*PriceMutation) ClearEdge

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

func (m *PriceMutation) 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 (*PriceMutation) ClearProduct

func (m *PriceMutation) ClearProduct()

ClearProduct clears the "product" edge to the Product entity.

func (*PriceMutation) ClearUser

func (m *PriceMutation) ClearUser()

ClearUser clears the "user" edge to the User entity.

func (*PriceMutation) ClearedEdges

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

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

func (*PriceMutation) ClearedFields

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

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

func (PriceMutation) Client

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

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

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

func (*PriceMutation) EdgeCleared

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

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

func (*PriceMutation) Field

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

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

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

func (*PriceMutation) Fields

func (m *PriceMutation) 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 (*PriceMutation) GetType

func (m *PriceMutation) GetType() (r price.Type, exists bool)

GetType returns the value of the "type" field in the mutation.

func (*PriceMutation) ID

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

ID returns the ID value in the mutation. Note that the ID is only available if it was provided to the builder or after it was returned from the database.

func (*PriceMutation) IDs

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

IDs queries the database and returns the entity ids that match the mutation's predicate. That means, if the mutation is applied within a transaction with an isolation level such as sql.LevelSerializable, the returned ids match the ids of the rows that will be updated or updated by the mutation.

func (*PriceMutation) OldAmount

func (m *PriceMutation) OldAmount(ctx context.Context) (v int, err error)

OldAmount returns the old "amount" field's value of the Price entity. If the Price 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 (*PriceMutation) OldCreatedAt

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

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

func (m *PriceMutation) 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 (*PriceMutation) OldQuantity

func (m *PriceMutation) OldQuantity(ctx context.Context) (v int, err error)

OldQuantity returns the old "quantity" field's value of the Price entity. If the Price 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 (*PriceMutation) OldStripeID

func (m *PriceMutation) OldStripeID(ctx context.Context) (v string, err error)

OldStripeID returns the old "stripe_id" field's value of the Price entity. If the Price 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 (*PriceMutation) OldType

func (m *PriceMutation) OldType(ctx context.Context) (v price.Type, err error)

OldType returns the old "type" field's value of the Price entity. If the Price 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 (*PriceMutation) Op

func (m *PriceMutation) Op() Op

Op returns the operation name.

func (*PriceMutation) ProductCleared

func (m *PriceMutation) ProductCleared() bool

ProductCleared reports if the "product" edge to the Product entity was cleared.

func (*PriceMutation) ProductID

func (m *PriceMutation) ProductID() (id int, exists bool)

ProductID returns the "product" edge ID in the mutation.

func (*PriceMutation) ProductIDs

func (m *PriceMutation) ProductIDs() (ids []int)

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

func (*PriceMutation) Quantity

func (m *PriceMutation) Quantity() (r int, exists bool)

Quantity returns the value of the "quantity" field in the mutation.

func (*PriceMutation) RemovedEdges

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

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

func (*PriceMutation) RemovedIDs

func (m *PriceMutation) 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 (*PriceMutation) ResetAmount

func (m *PriceMutation) ResetAmount()

ResetAmount resets all changes to the "amount" field.

func (*PriceMutation) ResetCreatedAt

func (m *PriceMutation) ResetCreatedAt()

ResetCreatedAt resets all changes to the "created_at" field.

func (*PriceMutation) ResetEdge

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

func (m *PriceMutation) 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 (*PriceMutation) ResetProduct

func (m *PriceMutation) ResetProduct()

ResetProduct resets all changes to the "product" edge.

func (*PriceMutation) ResetQuantity

func (m *PriceMutation) ResetQuantity()

ResetQuantity resets all changes to the "quantity" field.

func (*PriceMutation) ResetStripeID

func (m *PriceMutation) ResetStripeID()

ResetStripeID resets all changes to the "stripe_id" field.

func (*PriceMutation) ResetType

func (m *PriceMutation) ResetType()

ResetType resets all changes to the "type" field.

func (*PriceMutation) ResetUser

func (m *PriceMutation) ResetUser()

ResetUser resets all changes to the "user" edge.

func (*PriceMutation) SetAmount

func (m *PriceMutation) SetAmount(i int)

SetAmount sets the "amount" field.

func (*PriceMutation) SetCreatedAt

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

SetCreatedAt sets the "created_at" field.

func (*PriceMutation) SetField

func (m *PriceMutation) 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 (*PriceMutation) SetOp

func (m *PriceMutation) SetOp(op Op)

SetOp allows setting the mutation operation.

func (*PriceMutation) SetProductID

func (m *PriceMutation) SetProductID(id int)

SetProductID sets the "product" edge to the Product entity by id.

func (*PriceMutation) SetQuantity

func (m *PriceMutation) SetQuantity(i int)

SetQuantity sets the "quantity" field.

func (*PriceMutation) SetStripeID

func (m *PriceMutation) SetStripeID(s string)

SetStripeID sets the "stripe_id" field.

func (*PriceMutation) SetType

func (m *PriceMutation) SetType(pr price.Type)

SetType sets the "type" field.

func (*PriceMutation) SetUserID

func (m *PriceMutation) SetUserID(id int)

SetUserID sets the "user" edge to the User entity by id.

func (*PriceMutation) StripeID

func (m *PriceMutation) StripeID() (r string, exists bool)

StripeID returns the value of the "stripe_id" field in the mutation.

func (PriceMutation) Tx

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

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

func (*PriceMutation) Type

func (m *PriceMutation) Type() string

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

func (*PriceMutation) UserCleared

func (m *PriceMutation) UserCleared() bool

UserCleared reports if the "user" edge to the User entity was cleared.

func (*PriceMutation) UserID

func (m *PriceMutation) UserID() (id int, exists bool)

UserID returns the "user" edge ID in the mutation.

func (*PriceMutation) UserIDs

func (m *PriceMutation) UserIDs() (ids []int)

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

func (*PriceMutation) Where

func (m *PriceMutation) Where(ps ...predicate.Price)

Where appends a list predicates to the PriceMutation builder.

func (*PriceMutation) WhereP

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

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

type PriceQuery

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

PriceQuery is the builder for querying Price entities.

func (*PriceQuery) Aggregate

func (pq *PriceQuery) Aggregate(fns ...AggregateFunc) *PriceSelect

Aggregate returns a PriceSelect configured with the given aggregations.

func (*PriceQuery) All

func (pq *PriceQuery) All(ctx context.Context) ([]*Price, error)

All executes the query and returns a list of Prices.

func (*PriceQuery) AllX

func (pq *PriceQuery) AllX(ctx context.Context) []*Price

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

func (*PriceQuery) Clone

func (pq *PriceQuery) Clone() *PriceQuery

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

func (*PriceQuery) Count

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

Count returns the count of the given query.

func (*PriceQuery) CountX

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

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

func (*PriceQuery) Exist

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

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

func (*PriceQuery) ExistX

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

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

func (*PriceQuery) First

func (pq *PriceQuery) First(ctx context.Context) (*Price, error)

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

func (*PriceQuery) FirstID

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

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

func (*PriceQuery) FirstIDX

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

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

func (*PriceQuery) FirstX

func (pq *PriceQuery) FirstX(ctx context.Context) *Price

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

func (*PriceQuery) GroupBy

func (pq *PriceQuery) GroupBy(field string, fields ...string) *PriceGroupBy

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 {
	StripeID string `json:"stripe_id,omitempty"`
	Count int `json:"count,omitempty"`
}

client.Price.Query().
	GroupBy(price.FieldStripeID).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*PriceQuery) IDs

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

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

func (*PriceQuery) IDsX

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

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

func (*PriceQuery) Limit

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

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

func (*PriceQuery) Offset

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

Offset to start from.

func (*PriceQuery) Only

func (pq *PriceQuery) Only(ctx context.Context) (*Price, error)

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

func (*PriceQuery) OnlyID

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

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

func (*PriceQuery) OnlyIDX

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

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

func (*PriceQuery) OnlyX

func (pq *PriceQuery) OnlyX(ctx context.Context) *Price

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

func (*PriceQuery) Order

func (pq *PriceQuery) Order(o ...price.OrderOption) *PriceQuery

Order specifies how the records should be ordered.

func (*PriceQuery) QueryProduct

func (pq *PriceQuery) QueryProduct() *ProductQuery

QueryProduct chains the current query on the "product" edge.

func (*PriceQuery) QueryUser

func (pq *PriceQuery) QueryUser() *UserQuery

QueryUser chains the current query on the "user" edge.

func (*PriceQuery) Select

func (pq *PriceQuery) Select(fields ...string) *PriceSelect

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 {
	StripeID string `json:"stripe_id,omitempty"`
}

client.Price.Query().
	Select(price.FieldStripeID).
	Scan(ctx, &v)

func (*PriceQuery) Unique

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

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

func (pq *PriceQuery) Where(ps ...predicate.Price) *PriceQuery

Where adds a new predicate for the PriceQuery builder.

func (*PriceQuery) WithProduct

func (pq *PriceQuery) WithProduct(opts ...func(*ProductQuery)) *PriceQuery

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

func (*PriceQuery) WithUser

func (pq *PriceQuery) WithUser(opts ...func(*UserQuery)) *PriceQuery

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

type PriceSelect

type PriceSelect struct {
	*PriceQuery
	// contains filtered or unexported fields
}

PriceSelect is the builder for selecting fields of Price entities.

func (*PriceSelect) Aggregate

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

Aggregate adds the given aggregation functions to the selector query.

func (*PriceSelect) Bool

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

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

func (*PriceSelect) BoolX

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

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

func (*PriceSelect) Bools

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

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

func (*PriceSelect) BoolsX

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

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

func (*PriceSelect) Float64

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

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

func (*PriceSelect) Float64X

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

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

func (*PriceSelect) Float64s

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

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

func (*PriceSelect) Float64sX

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

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

func (*PriceSelect) Int

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

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

func (*PriceSelect) IntX

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

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

func (*PriceSelect) Ints

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

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

func (*PriceSelect) IntsX

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

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

func (*PriceSelect) Scan

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

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

func (*PriceSelect) ScanX

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

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

func (*PriceSelect) String

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

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

func (*PriceSelect) StringX

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

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

func (*PriceSelect) Strings

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

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

func (*PriceSelect) StringsX

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

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

type PriceUpdate

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

PriceUpdate is the builder for updating Price entities.

func (*PriceUpdate) AddAmount

func (pu *PriceUpdate) AddAmount(i int) *PriceUpdate

AddAmount adds i to the "amount" field.

func (*PriceUpdate) AddQuantity

func (pu *PriceUpdate) AddQuantity(i int) *PriceUpdate

AddQuantity adds i to the "quantity" field.

func (*PriceUpdate) ClearProduct

func (pu *PriceUpdate) ClearProduct() *PriceUpdate

ClearProduct clears the "product" edge to the Product entity.

func (*PriceUpdate) ClearUser

func (pu *PriceUpdate) ClearUser() *PriceUpdate

ClearUser clears the "user" edge to the User entity.

func (*PriceUpdate) Exec

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

Exec executes the query.

func (*PriceUpdate) ExecX

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

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

func (*PriceUpdate) Mutation

func (pu *PriceUpdate) Mutation() *PriceMutation

Mutation returns the PriceMutation object of the builder.

func (*PriceUpdate) Save

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

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

func (*PriceUpdate) SaveX

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

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

func (*PriceUpdate) SetAmount

func (pu *PriceUpdate) SetAmount(i int) *PriceUpdate

SetAmount sets the "amount" field.

func (*PriceUpdate) SetNillableAmount

func (pu *PriceUpdate) SetNillableAmount(i *int) *PriceUpdate

SetNillableAmount sets the "amount" field if the given value is not nil.

func (*PriceUpdate) SetNillableQuantity

func (pu *PriceUpdate) SetNillableQuantity(i *int) *PriceUpdate

SetNillableQuantity sets the "quantity" field if the given value is not nil.

func (*PriceUpdate) SetNillableStripeID

func (pu *PriceUpdate) SetNillableStripeID(s *string) *PriceUpdate

SetNillableStripeID sets the "stripe_id" field if the given value is not nil.

func (*PriceUpdate) SetNillableType

func (pu *PriceUpdate) SetNillableType(pr *price.Type) *PriceUpdate

SetNillableType sets the "type" field if the given value is not nil.

func (*PriceUpdate) SetProduct

func (pu *PriceUpdate) SetProduct(p *Product) *PriceUpdate

SetProduct sets the "product" edge to the Product entity.

func (*PriceUpdate) SetProductID

func (pu *PriceUpdate) SetProductID(id int) *PriceUpdate

SetProductID sets the "product" edge to the Product entity by ID.

func (*PriceUpdate) SetQuantity

func (pu *PriceUpdate) SetQuantity(i int) *PriceUpdate

SetQuantity sets the "quantity" field.

func (*PriceUpdate) SetStripeID

func (pu *PriceUpdate) SetStripeID(s string) *PriceUpdate

SetStripeID sets the "stripe_id" field.

func (*PriceUpdate) SetType

func (pu *PriceUpdate) SetType(pr price.Type) *PriceUpdate

SetType sets the "type" field.

func (*PriceUpdate) SetUser

func (pu *PriceUpdate) SetUser(u *User) *PriceUpdate

SetUser sets the "user" edge to the User entity.

func (*PriceUpdate) SetUserID

func (pu *PriceUpdate) SetUserID(id int) *PriceUpdate

SetUserID sets the "user" edge to the User entity by ID.

func (*PriceUpdate) Where

func (pu *PriceUpdate) Where(ps ...predicate.Price) *PriceUpdate

Where appends a list predicates to the PriceUpdate builder.

type PriceUpdateOne

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

PriceUpdateOne is the builder for updating a single Price entity.

func (*PriceUpdateOne) AddAmount

func (puo *PriceUpdateOne) AddAmount(i int) *PriceUpdateOne

AddAmount adds i to the "amount" field.

func (*PriceUpdateOne) AddQuantity

func (puo *PriceUpdateOne) AddQuantity(i int) *PriceUpdateOne

AddQuantity adds i to the "quantity" field.

func (*PriceUpdateOne) ClearProduct

func (puo *PriceUpdateOne) ClearProduct() *PriceUpdateOne

ClearProduct clears the "product" edge to the Product entity.

func (*PriceUpdateOne) ClearUser

func (puo *PriceUpdateOne) ClearUser() *PriceUpdateOne

ClearUser clears the "user" edge to the User entity.

func (*PriceUpdateOne) Exec

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

Exec executes the query on the entity.

func (*PriceUpdateOne) ExecX

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

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

func (*PriceUpdateOne) Mutation

func (puo *PriceUpdateOne) Mutation() *PriceMutation

Mutation returns the PriceMutation object of the builder.

func (*PriceUpdateOne) Save

func (puo *PriceUpdateOne) Save(ctx context.Context) (*Price, error)

Save executes the query and returns the updated Price entity.

func (*PriceUpdateOne) SaveX

func (puo *PriceUpdateOne) SaveX(ctx context.Context) *Price

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

func (*PriceUpdateOne) Select

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

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

func (*PriceUpdateOne) SetAmount

func (puo *PriceUpdateOne) SetAmount(i int) *PriceUpdateOne

SetAmount sets the "amount" field.

func (*PriceUpdateOne) SetNillableAmount

func (puo *PriceUpdateOne) SetNillableAmount(i *int) *PriceUpdateOne

SetNillableAmount sets the "amount" field if the given value is not nil.

func (*PriceUpdateOne) SetNillableQuantity

func (puo *PriceUpdateOne) SetNillableQuantity(i *int) *PriceUpdateOne

SetNillableQuantity sets the "quantity" field if the given value is not nil.

func (*PriceUpdateOne) SetNillableStripeID

func (puo *PriceUpdateOne) SetNillableStripeID(s *string) *PriceUpdateOne

SetNillableStripeID sets the "stripe_id" field if the given value is not nil.

func (*PriceUpdateOne) SetNillableType

func (puo *PriceUpdateOne) SetNillableType(pr *price.Type) *PriceUpdateOne

SetNillableType sets the "type" field if the given value is not nil.

func (*PriceUpdateOne) SetProduct

func (puo *PriceUpdateOne) SetProduct(p *Product) *PriceUpdateOne

SetProduct sets the "product" edge to the Product entity.

func (*PriceUpdateOne) SetProductID

func (puo *PriceUpdateOne) SetProductID(id int) *PriceUpdateOne

SetProductID sets the "product" edge to the Product entity by ID.

func (*PriceUpdateOne) SetQuantity

func (puo *PriceUpdateOne) SetQuantity(i int) *PriceUpdateOne

SetQuantity sets the "quantity" field.

func (*PriceUpdateOne) SetStripeID

func (puo *PriceUpdateOne) SetStripeID(s string) *PriceUpdateOne

SetStripeID sets the "stripe_id" field.

func (*PriceUpdateOne) SetType

func (puo *PriceUpdateOne) SetType(pr price.Type) *PriceUpdateOne

SetType sets the "type" field.

func (*PriceUpdateOne) SetUser

func (puo *PriceUpdateOne) SetUser(u *User) *PriceUpdateOne

SetUser sets the "user" edge to the User entity.

func (*PriceUpdateOne) SetUserID

func (puo *PriceUpdateOne) SetUserID(id int) *PriceUpdateOne

SetUserID sets the "user" edge to the User entity by ID.

func (*PriceUpdateOne) Where

func (puo *PriceUpdateOne) Where(ps ...predicate.Price) *PriceUpdateOne

Where appends a list predicates to the PriceUpdate builder.

type Prices

type Prices []*Price

Prices is a parsable slice of Price.

type Product

type Product struct {

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

Product is the model entity for the Product schema.

func (*Product) QueryPrices

func (pr *Product) QueryPrices() *PriceQuery

QueryPrices queries the "prices" edge of the Product entity.

func (*Product) QueryUser

func (pr *Product) QueryUser() *UserQuery

QueryUser queries the "user" edge of the Product entity.

func (*Product) String

func (pr *Product) String() string

String implements the fmt.Stringer.

func (*Product) Unwrap

func (pr *Product) Unwrap() *Product

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

func (pr *Product) Update() *ProductUpdateOne

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

func (*Product) Value

func (pr *Product) Value(name string) (ent.Value, error)

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

type ProductClient

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

ProductClient is a client for the Product schema.

func NewProductClient

func NewProductClient(c config) *ProductClient

NewProductClient returns a client for the Product from the given config.

func (*ProductClient) Create

func (c *ProductClient) Create() *ProductCreate

Create returns a builder for creating a Product entity.

func (*ProductClient) CreateBulk

func (c *ProductClient) CreateBulk(builders ...*ProductCreate) *ProductCreateBulk

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

func (*ProductClient) Delete

func (c *ProductClient) Delete() *ProductDelete

Delete returns a delete builder for Product.

func (*ProductClient) DeleteOne

func (c *ProductClient) DeleteOne(pr *Product) *ProductDeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*ProductClient) DeleteOneID

func (c *ProductClient) DeleteOneID(id int) *ProductDeleteOne

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

func (*ProductClient) Get

func (c *ProductClient) Get(ctx context.Context, id int) (*Product, error)

Get returns a Product entity by its id.

func (*ProductClient) GetX

func (c *ProductClient) GetX(ctx context.Context, id int) *Product

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

func (*ProductClient) Hooks

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

Hooks returns the client hooks.

func (*ProductClient) Intercept

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

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

func (*ProductClient) Interceptors

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

Interceptors returns the client interceptors.

func (*ProductClient) MapCreateBulk

func (c *ProductClient) MapCreateBulk(slice any, setFunc func(*ProductCreate, int)) *ProductCreateBulk

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

func (c *ProductClient) Query() *ProductQuery

Query returns a query builder for Product.

func (*ProductClient) QueryPrices

func (c *ProductClient) QueryPrices(pr *Product) *PriceQuery

QueryPrices queries the prices edge of a Product.

func (*ProductClient) QueryUser

func (c *ProductClient) QueryUser(pr *Product) *UserQuery

QueryUser queries the user edge of a Product.

func (*ProductClient) Update

func (c *ProductClient) Update() *ProductUpdate

Update returns an update builder for Product.

func (*ProductClient) UpdateOne

func (c *ProductClient) UpdateOne(pr *Product) *ProductUpdateOne

UpdateOne returns an update builder for the given entity.

func (*ProductClient) UpdateOneID

func (c *ProductClient) UpdateOneID(id int) *ProductUpdateOne

UpdateOneID returns an update builder for the given id.

func (*ProductClient) Use

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

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

type ProductCreate

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

ProductCreate is the builder for creating a Product entity.

func (*ProductCreate) AddPriceIDs

func (pc *ProductCreate) AddPriceIDs(ids ...int) *ProductCreate

AddPriceIDs adds the "prices" edge to the Price entity by IDs.

func (*ProductCreate) AddPrices

func (pc *ProductCreate) AddPrices(p ...*Price) *ProductCreate

AddPrices adds the "prices" edges to the Price entity.

func (*ProductCreate) Exec

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

Exec executes the query.

func (*ProductCreate) ExecX

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

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

func (*ProductCreate) Mutation

func (pc *ProductCreate) Mutation() *ProductMutation

Mutation returns the ProductMutation object of the builder.

func (*ProductCreate) Save

func (pc *ProductCreate) Save(ctx context.Context) (*Product, error)

Save creates the Product in the database.

func (*ProductCreate) SaveX

func (pc *ProductCreate) SaveX(ctx context.Context) *Product

SaveX calls Save and panics if Save returns an error.

func (*ProductCreate) SetCreatedAt

func (pc *ProductCreate) SetCreatedAt(t time.Time) *ProductCreate

SetCreatedAt sets the "created_at" field.

func (*ProductCreate) SetName

func (pc *ProductCreate) SetName(s string) *ProductCreate

SetName sets the "name" field.

func (*ProductCreate) SetNillableCreatedAt

func (pc *ProductCreate) SetNillableCreatedAt(t *time.Time) *ProductCreate

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

func (*ProductCreate) SetStripeID

func (pc *ProductCreate) SetStripeID(s string) *ProductCreate

SetStripeID sets the "stripe_id" field.

func (*ProductCreate) SetUser

func (pc *ProductCreate) SetUser(u *User) *ProductCreate

SetUser sets the "user" edge to the User entity.

func (*ProductCreate) SetUserID

func (pc *ProductCreate) SetUserID(id int) *ProductCreate

SetUserID sets the "user" edge to the User entity by ID.

type ProductCreateBulk

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

ProductCreateBulk is the builder for creating many Product entities in bulk.

func (*ProductCreateBulk) Exec

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

Exec executes the query.

func (*ProductCreateBulk) ExecX

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

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

func (*ProductCreateBulk) Save

func (pcb *ProductCreateBulk) Save(ctx context.Context) ([]*Product, error)

Save creates the Product entities in the database.

func (*ProductCreateBulk) SaveX

func (pcb *ProductCreateBulk) SaveX(ctx context.Context) []*Product

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

type ProductDelete

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

ProductDelete is the builder for deleting a Product entity.

func (*ProductDelete) Exec

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

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

func (*ProductDelete) ExecX

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

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

func (*ProductDelete) Where

func (pd *ProductDelete) Where(ps ...predicate.Product) *ProductDelete

Where appends a list predicates to the ProductDelete builder.

type ProductDeleteOne

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

ProductDeleteOne is the builder for deleting a single Product entity.

func (*ProductDeleteOne) Exec

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

Exec executes the deletion query.

func (*ProductDeleteOne) ExecX

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

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

func (*ProductDeleteOne) Where

Where appends a list predicates to the ProductDelete builder.

type ProductEdges

type ProductEdges struct {
	// User holds the value of the user edge.
	User *User `json:"user,omitempty"`
	// Prices holds the value of the prices edge.
	Prices []*Price `json:"prices,omitempty"`
	// contains filtered or unexported fields
}

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

func (ProductEdges) PricesOrErr

func (e ProductEdges) PricesOrErr() ([]*Price, error)

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

func (ProductEdges) UserOrErr

func (e ProductEdges) UserOrErr() (*User, error)

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

type ProductGroupBy

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

ProductGroupBy is the group-by builder for Product entities.

func (*ProductGroupBy) Aggregate

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

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

func (*ProductGroupBy) Bool

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

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

func (*ProductGroupBy) BoolX

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

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

func (*ProductGroupBy) Bools

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

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

func (*ProductGroupBy) BoolsX

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

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

func (*ProductGroupBy) Float64

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

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

func (*ProductGroupBy) Float64X

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

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

func (*ProductGroupBy) Float64s

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

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

func (*ProductGroupBy) Float64sX

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

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

func (*ProductGroupBy) Int

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

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

func (*ProductGroupBy) IntX

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

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

func (*ProductGroupBy) Ints

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

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

func (*ProductGroupBy) IntsX

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

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

func (*ProductGroupBy) Scan

func (pgb *ProductGroupBy) Scan(ctx context.Context, v any) error

Scan applies the selector query and scans the result into the given value.

func (*ProductGroupBy) ScanX

func (s *ProductGroupBy) ScanX(ctx context.Context, v any)

ScanX is like Scan, but panics if an error occurs.

func (*ProductGroupBy) String

func (s *ProductGroupBy) String(ctx context.Context) (_ string, err error)

String returns a single string from a selector. It is only allowed when selecting one field.

func (*ProductGroupBy) StringX

func (s *ProductGroupBy) StringX(ctx context.Context) string

StringX is like String, but panics if an error occurs.

func (*ProductGroupBy) Strings

func (s *ProductGroupBy) Strings(ctx context.Context) ([]string, error)

Strings returns list of strings from a selector. It is only allowed when selecting one field.

func (*ProductGroupBy) StringsX

func (s *ProductGroupBy) StringsX(ctx context.Context) []string

StringsX is like Strings, but panics if an error occurs.

type ProductMutation

type ProductMutation struct {
	// contains filtered or unexported fields
}

ProductMutation represents an operation that mutates the Product nodes in the graph.

func (*ProductMutation) AddField

func (m *ProductMutation) 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 (*ProductMutation) AddPriceIDs

func (m *ProductMutation) AddPriceIDs(ids ...int)

AddPriceIDs adds the "prices" edge to the Price entity by ids.

func (*ProductMutation) AddedEdges

func (m *ProductMutation) AddedEdges() []string

AddedEdges returns all edge names that were set/added in this mutation.

func (*ProductMutation) AddedField

func (m *ProductMutation) 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 (*ProductMutation) AddedFields

func (m *ProductMutation) AddedFields() []string

AddedFields returns all numeric fields that were incremented/decremented during this mutation.

func (*ProductMutation) AddedIDs

func (m *ProductMutation) AddedIDs(name string) []ent.Value

AddedIDs returns all IDs (to other nodes) that were added for the given edge name in this mutation.

func (*ProductMutation) ClearEdge

func (m *ProductMutation) 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 (*ProductMutation) ClearField

func (m *ProductMutation) 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 (*ProductMutation) ClearPrices

func (m *ProductMutation) ClearPrices()

ClearPrices clears the "prices" edge to the Price entity.

func (*ProductMutation) ClearUser

func (m *ProductMutation) ClearUser()

ClearUser clears the "user" edge to the User entity.

func (*ProductMutation) ClearedEdges

func (m *ProductMutation) ClearedEdges() []string

ClearedEdges returns all edge names that were cleared in this mutation.

func (*ProductMutation) ClearedFields

func (m *ProductMutation) ClearedFields() []string

ClearedFields returns all nullable fields that were cleared during this mutation.

func (ProductMutation) Client

func (m ProductMutation) 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 (*ProductMutation) CreatedAt

func (m *ProductMutation) CreatedAt() (r time.Time, exists bool)

CreatedAt returns the value of the "created_at" field in the mutation.

func (*ProductMutation) EdgeCleared

func (m *ProductMutation) EdgeCleared(name string) bool

EdgeCleared returns a boolean which indicates if the edge with the given name was cleared in this mutation.

func (*ProductMutation) Field

func (m *ProductMutation) 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 (*ProductMutation) FieldCleared

func (m *ProductMutation) FieldCleared(name string) bool

FieldCleared returns a boolean indicating if a field with the given name was cleared in this mutation.

func (*ProductMutation) Fields

func (m *ProductMutation) 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 (*ProductMutation) ID

func (m *ProductMutation) ID() (id int, exists bool)

ID returns the ID value in the mutation. Note that the ID is only available if it was provided to the builder or after it was returned from the database.

func (*ProductMutation) IDs

func (m *ProductMutation) IDs(ctx context.Context) ([]int, error)

IDs queries the database and returns the entity ids that match the mutation's predicate. That means, if the mutation is applied within a transaction with an isolation level such as sql.LevelSerializable, the returned ids match the ids of the rows that will be updated or updated by the mutation.

func (*ProductMutation) Name

func (m *ProductMutation) Name() (r string, exists bool)

Name returns the value of the "name" field in the mutation.

func (*ProductMutation) OldCreatedAt

func (m *ProductMutation) OldCreatedAt(ctx context.Context) (v time.Time, err error)

OldCreatedAt returns the old "created_at" field's value of the Product entity. If the Product 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 (*ProductMutation) OldField

func (m *ProductMutation) 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 (*ProductMutation) OldName

func (m *ProductMutation) OldName(ctx context.Context) (v string, err error)

OldName returns the old "name" field's value of the Product entity. If the Product 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 (*ProductMutation) OldStripeID

func (m *ProductMutation) OldStripeID(ctx context.Context) (v string, err error)

OldStripeID returns the old "stripe_id" field's value of the Product entity. If the Product 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 (*ProductMutation) Op

func (m *ProductMutation) Op() Op

Op returns the operation name.

func (*ProductMutation) PricesCleared

func (m *ProductMutation) PricesCleared() bool

PricesCleared reports if the "prices" edge to the Price entity was cleared.

func (*ProductMutation) PricesIDs

func (m *ProductMutation) PricesIDs() (ids []int)

PricesIDs returns the "prices" edge IDs in the mutation.

func (*ProductMutation) RemovePriceIDs

func (m *ProductMutation) RemovePriceIDs(ids ...int)

RemovePriceIDs removes the "prices" edge to the Price entity by IDs.

func (*ProductMutation) RemovedEdges

func (m *ProductMutation) RemovedEdges() []string

RemovedEdges returns all edge names that were removed in this mutation.

func (*ProductMutation) RemovedIDs

func (m *ProductMutation) 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 (*ProductMutation) RemovedPricesIDs

func (m *ProductMutation) RemovedPricesIDs() (ids []int)

RemovedPrices returns the removed IDs of the "prices" edge to the Price entity.

func (*ProductMutation) ResetCreatedAt

func (m *ProductMutation) ResetCreatedAt()

ResetCreatedAt resets all changes to the "created_at" field.

func (*ProductMutation) ResetEdge

func (m *ProductMutation) 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 (*ProductMutation) ResetField

func (m *ProductMutation) 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 (*ProductMutation) ResetName

func (m *ProductMutation) ResetName()

ResetName resets all changes to the "name" field.

func (*ProductMutation) ResetPrices

func (m *ProductMutation) ResetPrices()

ResetPrices resets all changes to the "prices" edge.

func (*ProductMutation) ResetStripeID

func (m *ProductMutation) ResetStripeID()

ResetStripeID resets all changes to the "stripe_id" field.

func (*ProductMutation) ResetUser

func (m *ProductMutation) ResetUser()

ResetUser resets all changes to the "user" edge.

func (*ProductMutation) SetCreatedAt

func (m *ProductMutation) SetCreatedAt(t time.Time)

SetCreatedAt sets the "created_at" field.

func (*ProductMutation) SetField

func (m *ProductMutation) 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 (*ProductMutation) SetName

func (m *ProductMutation) SetName(s string)

SetName sets the "name" field.

func (*ProductMutation) SetOp

func (m *ProductMutation) SetOp(op Op)

SetOp allows setting the mutation operation.

func (*ProductMutation) SetStripeID

func (m *ProductMutation) SetStripeID(s string)

SetStripeID sets the "stripe_id" field.

func (*ProductMutation) SetUserID

func (m *ProductMutation) SetUserID(id int)

SetUserID sets the "user" edge to the User entity by id.

func (*ProductMutation) StripeID

func (m *ProductMutation) StripeID() (r string, exists bool)

StripeID returns the value of the "stripe_id" field in the mutation.

func (ProductMutation) Tx

func (m ProductMutation) Tx() (*Tx, error)

Tx returns an `ent.Tx` for mutations that were executed in transactions; it returns an error otherwise.

func (*ProductMutation) Type

func (m *ProductMutation) Type() string

Type returns the node type of this mutation (Product).

func (*ProductMutation) UserCleared

func (m *ProductMutation) UserCleared() bool

UserCleared reports if the "user" edge to the User entity was cleared.

func (*ProductMutation) UserID

func (m *ProductMutation) UserID() (id int, exists bool)

UserID returns the "user" edge ID in the mutation.

func (*ProductMutation) UserIDs

func (m *ProductMutation) UserIDs() (ids []int)

UserIDs returns the "user" edge IDs in the mutation. Note that IDs always returns len(IDs) <= 1 for unique edges, and you should use UserID instead. It exists only for internal usage by the builders.

func (*ProductMutation) Where

func (m *ProductMutation) Where(ps ...predicate.Product)

Where appends a list predicates to the ProductMutation builder.

func (*ProductMutation) WhereP

func (m *ProductMutation) WhereP(ps ...func(*sql.Selector))

WhereP appends storage-level predicates to the ProductMutation builder. Using this method, users can use type-assertion to append predicates that do not depend on any generated package.

type ProductQuery

type ProductQuery struct {
	// contains filtered or unexported fields
}

ProductQuery is the builder for querying Product entities.

func (*ProductQuery) Aggregate

func (pq *ProductQuery) Aggregate(fns ...AggregateFunc) *ProductSelect

Aggregate returns a ProductSelect configured with the given aggregations.

func (*ProductQuery) All

func (pq *ProductQuery) All(ctx context.Context) ([]*Product, error)

All executes the query and returns a list of Products.

func (*ProductQuery) AllX

func (pq *ProductQuery) AllX(ctx context.Context) []*Product

AllX is like All, but panics if an error occurs.

func (*ProductQuery) Clone

func (pq *ProductQuery) Clone() *ProductQuery

Clone returns a duplicate of the ProductQuery builder, including all associated steps. It can be used to prepare common query builders and use them differently after the clone is made.

func (*ProductQuery) Count

func (pq *ProductQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*ProductQuery) CountX

func (pq *ProductQuery) CountX(ctx context.Context) int

CountX is like Count, but panics if an error occurs.

func (*ProductQuery) Exist

func (pq *ProductQuery) Exist(ctx context.Context) (bool, error)

Exist returns true if the query has elements in the graph.

func (*ProductQuery) ExistX

func (pq *ProductQuery) ExistX(ctx context.Context) bool

ExistX is like Exist, but panics if an error occurs.

func (*ProductQuery) First

func (pq *ProductQuery) First(ctx context.Context) (*Product, error)

First returns the first Product entity from the query. Returns a *NotFoundError when no Product was found.

func (*ProductQuery) FirstID

func (pq *ProductQuery) FirstID(ctx context.Context) (id int, err error)

FirstID returns the first Product ID from the query. Returns a *NotFoundError when no Product ID was found.

func (*ProductQuery) FirstIDX

func (pq *ProductQuery) FirstIDX(ctx context.Context) int

FirstIDX is like FirstID, but panics if an error occurs.

func (*ProductQuery) FirstX

func (pq *ProductQuery) FirstX(ctx context.Context) *Product

FirstX is like First, but panics if an error occurs.

func (*ProductQuery) GroupBy

func (pq *ProductQuery) GroupBy(field string, fields ...string) *ProductGroupBy

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 {
	StripeID string `json:"stripe_id,omitempty"`
	Count int `json:"count,omitempty"`
}

client.Product.Query().
	GroupBy(product.FieldStripeID).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*ProductQuery) IDs

func (pq *ProductQuery) IDs(ctx context.Context) (ids []int, err error)

IDs executes the query and returns a list of Product IDs.

func (*ProductQuery) IDsX

func (pq *ProductQuery) IDsX(ctx context.Context) []int

IDsX is like IDs, but panics if an error occurs.

func (*ProductQuery) Limit

func (pq *ProductQuery) Limit(limit int) *ProductQuery

Limit the number of records to be returned by this query.

func (*ProductQuery) Offset

func (pq *ProductQuery) Offset(offset int) *ProductQuery

Offset to start from.

func (*ProductQuery) Only

func (pq *ProductQuery) Only(ctx context.Context) (*Product, error)

Only returns a single Product entity found by the query, ensuring it only returns one. Returns a *NotSingularError when more than one Product entity is found. Returns a *NotFoundError when no Product entities are found.

func (*ProductQuery) OnlyID

func (pq *ProductQuery) OnlyID(ctx context.Context) (id int, err error)

OnlyID is like Only, but returns the only Product ID in the query. Returns a *NotSingularError when more than one Product ID is found. Returns a *NotFoundError when no entities are found.

func (*ProductQuery) OnlyIDX

func (pq *ProductQuery) OnlyIDX(ctx context.Context) int

OnlyIDX is like OnlyID, but panics if an error occurs.

func (*ProductQuery) OnlyX

func (pq *ProductQuery) OnlyX(ctx context.Context) *Product

OnlyX is like Only, but panics if an error occurs.

func (*ProductQuery) Order

func (pq *ProductQuery) Order(o ...product.OrderOption) *ProductQuery

Order specifies how the records should be ordered.

func (*ProductQuery) QueryPrices

func (pq *ProductQuery) QueryPrices() *PriceQuery

QueryPrices chains the current query on the "prices" edge.

func (*ProductQuery) QueryUser

func (pq *ProductQuery) QueryUser() *UserQuery

QueryUser chains the current query on the "user" edge.

func (*ProductQuery) Select

func (pq *ProductQuery) Select(fields ...string) *ProductSelect

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 {
	StripeID string `json:"stripe_id,omitempty"`
}

client.Product.Query().
	Select(product.FieldStripeID).
	Scan(ctx, &v)

func (*ProductQuery) Unique

func (pq *ProductQuery) Unique(unique bool) *ProductQuery

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 (*ProductQuery) Where

func (pq *ProductQuery) Where(ps ...predicate.Product) *ProductQuery

Where adds a new predicate for the ProductQuery builder.

func (*ProductQuery) WithPrices

func (pq *ProductQuery) WithPrices(opts ...func(*PriceQuery)) *ProductQuery

WithPrices tells the query-builder to eager-load the nodes that are connected to the "prices" edge. The optional arguments are used to configure the query builder of the edge.

func (*ProductQuery) WithUser

func (pq *ProductQuery) WithUser(opts ...func(*UserQuery)) *ProductQuery

WithUser tells the query-builder to eager-load the nodes that are connected to the "user" edge. The optional arguments are used to configure the query builder of the edge.

type ProductSelect

type ProductSelect struct {
	*ProductQuery
	// contains filtered or unexported fields
}

ProductSelect is the builder for selecting fields of Product entities.

func (*ProductSelect) Aggregate

func (ps *ProductSelect) Aggregate(fns ...AggregateFunc) *ProductSelect

Aggregate adds the given aggregation functions to the selector query.

func (*ProductSelect) Bool

func (s *ProductSelect) Bool(ctx context.Context) (_ bool, err error)

Bool returns a single bool from a selector. It is only allowed when selecting one field.

func (*ProductSelect) BoolX

func (s *ProductSelect) BoolX(ctx context.Context) bool

BoolX is like Bool, but panics if an error occurs.

func (*ProductSelect) Bools

func (s *ProductSelect) Bools(ctx context.Context) ([]bool, error)

Bools returns list of bools from a selector. It is only allowed when selecting one field.

func (*ProductSelect) BoolsX

func (s *ProductSelect) BoolsX(ctx context.Context) []bool

BoolsX is like Bools, but panics if an error occurs.

func (*ProductSelect) Float64

func (s *ProductSelect) Float64(ctx context.Context) (_ float64, err error)

Float64 returns a single float64 from a selector. It is only allowed when selecting one field.

func (*ProductSelect) Float64X

func (s *ProductSelect) Float64X(ctx context.Context) float64

Float64X is like Float64, but panics if an error occurs.

func (*ProductSelect) Float64s

func (s *ProductSelect) Float64s(ctx context.Context) ([]float64, error)

Float64s returns list of float64s from a selector. It is only allowed when selecting one field.

func (*ProductSelect) Float64sX

func (s *ProductSelect) Float64sX(ctx context.Context) []float64

Float64sX is like Float64s, but panics if an error occurs.

func (*ProductSelect) Int

func (s *ProductSelect) Int(ctx context.Context) (_ int, err error)

Int returns a single int from a selector. It is only allowed when selecting one field.

func (*ProductSelect) IntX

func (s *ProductSelect) IntX(ctx context.Context) int

IntX is like Int, but panics if an error occurs.

func (*ProductSelect) Ints

func (s *ProductSelect) Ints(ctx context.Context) ([]int, error)

Ints returns list of ints from a selector. It is only allowed when selecting one field.

func (*ProductSelect) IntsX

func (s *ProductSelect) IntsX(ctx context.Context) []int

IntsX is like Ints, but panics if an error occurs.

func (*ProductSelect) Scan

func (ps *ProductSelect) Scan(ctx context.Context, v any) error

Scan applies the selector query and scans the result into the given value.

func (*ProductSelect) ScanX

func (s *ProductSelect) ScanX(ctx context.Context, v any)

ScanX is like Scan, but panics if an error occurs.

func (*ProductSelect) String

func (s *ProductSelect) String(ctx context.Context) (_ string, err error)

String returns a single string from a selector. It is only allowed when selecting one field.

func (*ProductSelect) StringX

func (s *ProductSelect) StringX(ctx context.Context) string

StringX is like String, but panics if an error occurs.

func (*ProductSelect) Strings

func (s *ProductSelect) Strings(ctx context.Context) ([]string, error)

Strings returns list of strings from a selector. It is only allowed when selecting one field.

func (*ProductSelect) StringsX

func (s *ProductSelect) StringsX(ctx context.Context) []string

StringsX is like Strings, but panics if an error occurs.

type ProductUpdate

type ProductUpdate struct {
	// contains filtered or unexported fields
}

ProductUpdate is the builder for updating Product entities.

func (*ProductUpdate) AddPriceIDs

func (pu *ProductUpdate) AddPriceIDs(ids ...int) *ProductUpdate

AddPriceIDs adds the "prices" edge to the Price entity by IDs.

func (*ProductUpdate) AddPrices

func (pu *ProductUpdate) AddPrices(p ...*Price) *ProductUpdate

AddPrices adds the "prices" edges to the Price entity.

func (*ProductUpdate) ClearPrices

func (pu *ProductUpdate) ClearPrices() *ProductUpdate

ClearPrices clears all "prices" edges to the Price entity.

func (*ProductUpdate) ClearUser

func (pu *ProductUpdate) ClearUser() *ProductUpdate

ClearUser clears the "user" edge to the User entity.

func (*ProductUpdate) Exec

func (pu *ProductUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*ProductUpdate) ExecX

func (pu *ProductUpdate) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*ProductUpdate) Mutation

func (pu *ProductUpdate) Mutation() *ProductMutation

Mutation returns the ProductMutation object of the builder.

func (*ProductUpdate) RemovePriceIDs

func (pu *ProductUpdate) RemovePriceIDs(ids ...int) *ProductUpdate

RemovePriceIDs removes the "prices" edge to Price entities by IDs.

func (*ProductUpdate) RemovePrices

func (pu *ProductUpdate) RemovePrices(p ...*Price) *ProductUpdate

RemovePrices removes "prices" edges to Price entities.

func (*ProductUpdate) Save

func (pu *ProductUpdate) Save(ctx context.Context) (int, error)

Save executes the query and returns the number of nodes affected by the update operation.

func (*ProductUpdate) SaveX

func (pu *ProductUpdate) SaveX(ctx context.Context) int

SaveX is like Save, but panics if an error occurs.

func (*ProductUpdate) SetName

func (pu *ProductUpdate) SetName(s string) *ProductUpdate

SetName sets the "name" field.

func (*ProductUpdate) SetNillableName

func (pu *ProductUpdate) SetNillableName(s *string) *ProductUpdate

SetNillableName sets the "name" field if the given value is not nil.

func (*ProductUpdate) SetNillableStripeID

func (pu *ProductUpdate) SetNillableStripeID(s *string) *ProductUpdate

SetNillableStripeID sets the "stripe_id" field if the given value is not nil.

func (*ProductUpdate) SetStripeID

func (pu *ProductUpdate) SetStripeID(s string) *ProductUpdate

SetStripeID sets the "stripe_id" field.

func (*ProductUpdate) SetUser

func (pu *ProductUpdate) SetUser(u *User) *ProductUpdate

SetUser sets the "user" edge to the User entity.

func (*ProductUpdate) SetUserID

func (pu *ProductUpdate) SetUserID(id int) *ProductUpdate

SetUserID sets the "user" edge to the User entity by ID.

func (*ProductUpdate) Where

func (pu *ProductUpdate) Where(ps ...predicate.Product) *ProductUpdate

Where appends a list predicates to the ProductUpdate builder.

type ProductUpdateOne

type ProductUpdateOne struct {
	// contains filtered or unexported fields
}

ProductUpdateOne is the builder for updating a single Product entity.

func (*ProductUpdateOne) AddPriceIDs

func (puo *ProductUpdateOne) AddPriceIDs(ids ...int) *ProductUpdateOne

AddPriceIDs adds the "prices" edge to the Price entity by IDs.

func (*ProductUpdateOne) AddPrices

func (puo *ProductUpdateOne) AddPrices(p ...*Price) *ProductUpdateOne

AddPrices adds the "prices" edges to the Price entity.

func (*ProductUpdateOne) ClearPrices

func (puo *ProductUpdateOne) ClearPrices() *ProductUpdateOne

ClearPrices clears all "prices" edges to the Price entity.

func (*ProductUpdateOne) ClearUser

func (puo *ProductUpdateOne) ClearUser() *ProductUpdateOne

ClearUser clears the "user" edge to the User entity.

func (*ProductUpdateOne) Exec

func (puo *ProductUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*ProductUpdateOne) ExecX

func (puo *ProductUpdateOne) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*ProductUpdateOne) Mutation

func (puo *ProductUpdateOne) Mutation() *ProductMutation

Mutation returns the ProductMutation object of the builder.

func (*ProductUpdateOne) RemovePriceIDs

func (puo *ProductUpdateOne) RemovePriceIDs(ids ...int) *ProductUpdateOne

RemovePriceIDs removes the "prices" edge to Price entities by IDs.

func (*ProductUpdateOne) RemovePrices

func (puo *ProductUpdateOne) RemovePrices(p ...*Price) *ProductUpdateOne

RemovePrices removes "prices" edges to Price entities.

func (*ProductUpdateOne) Save

func (puo *ProductUpdateOne) Save(ctx context.Context) (*Product, error)

Save executes the query and returns the updated Product entity.

func (*ProductUpdateOne) SaveX

func (puo *ProductUpdateOne) SaveX(ctx context.Context) *Product

SaveX is like Save, but panics if an error occurs.

func (*ProductUpdateOne) Select

func (puo *ProductUpdateOne) Select(field string, fields ...string) *ProductUpdateOne

Select allows selecting one or more fields (columns) of the returned entity. The default is selecting all fields defined in the entity schema.

func (*ProductUpdateOne) SetName

func (puo *ProductUpdateOne) SetName(s string) *ProductUpdateOne

SetName sets the "name" field.

func (*ProductUpdateOne) SetNillableName

func (puo *ProductUpdateOne) SetNillableName(s *string) *ProductUpdateOne

SetNillableName sets the "name" field if the given value is not nil.

func (*ProductUpdateOne) SetNillableStripeID

func (puo *ProductUpdateOne) SetNillableStripeID(s *string) *ProductUpdateOne

SetNillableStripeID sets the "stripe_id" field if the given value is not nil.

func (*ProductUpdateOne) SetStripeID

func (puo *ProductUpdateOne) SetStripeID(s string) *ProductUpdateOne

SetStripeID sets the "stripe_id" field.

func (*ProductUpdateOne) SetUser

func (puo *ProductUpdateOne) SetUser(u *User) *ProductUpdateOne

SetUser sets the "user" edge to the User entity.

func (*ProductUpdateOne) SetUserID

func (puo *ProductUpdateOne) SetUserID(id int) *ProductUpdateOne

SetUserID sets the "user" edge to the User entity by ID.

func (*ProductUpdateOne) Where

Where appends a list predicates to the ProductUpdate builder.

type Products

type Products []*Product

Products is a parsable slice of Product.

type Querier

type Querier = ent.Querier

ent aliases to avoid import conflicts in user's code.

type QuerierFunc

type QuerierFunc = ent.QuerierFunc

ent aliases to avoid import conflicts in user's code.

type Query

type Query = ent.Query

ent aliases to avoid import conflicts in user's code.

type QueryContext

type QueryContext = ent.QueryContext

ent aliases to avoid import conflicts in user's code.

type RollbackFunc

type RollbackFunc func(context.Context, *Tx) error

The RollbackFunc type is an adapter to allow the use of ordinary function as a Rollbacker. If f is a function with the appropriate signature, RollbackFunc(f) is a Rollbacker that calls f.

func (RollbackFunc) Rollback

func (f RollbackFunc) Rollback(ctx context.Context, tx *Tx) error

Rollback calls f(ctx, m).

type RollbackHook

type RollbackHook func(Rollbacker) Rollbacker

RollbackHook defines the "rollback middleware". A function that gets a Rollbacker and returns a Rollbacker. For example:

hook := func(next ent.Rollbacker) ent.Rollbacker {
	return ent.RollbackFunc(func(ctx context.Context, tx *ent.Tx) error {
		// Do some stuff before.
		if err := next.Rollback(ctx, tx); err != nil {
			return err
		}
		// Do some stuff after.
		return nil
	})
}

type Rollbacker

type Rollbacker interface {
	Rollback(context.Context, *Tx) error
}

Rollbacker is the interface that wraps the Rollback method.

type TraverseFunc

type TraverseFunc = ent.TraverseFunc

ent aliases to avoid import conflicts in user's code.

type Traverser

type Traverser = ent.Traverser

ent aliases to avoid import conflicts in user's code.

type Tx

type Tx struct {

	// AI is the client for interacting with the AI builders.
	AI *AIClient
	// ModelName is the client for interacting with the ModelName builders.
	ModelName *ModelNameClient
	// PasswordToken is the client for interacting with the PasswordToken builders.
	PasswordToken *PasswordTokenClient
	// Price is the client for interacting with the Price builders.
	Price *PriceClient
	// Product is the client for interacting with the Product builders.
	Product *ProductClient
	// 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"`
	// Password holds the value of the "password" field.
	Password string `json:"-"`
	// Verified holds the value of the "verified" field.
	Verified bool `json:"verified,omitempty"`
	// Role holds the value of the "role" field.
	Role user.Role `json:"role,omitempty"`
	// CreatedAt holds the value of the "created_at" field.
	CreatedAt time.Time `json:"created_at,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) QueryAIs

func (u *User) QueryAIs() *AIQuery

QueryAIs queries the "AIs" edge of the User entity.

func (*User) QueryModelNames

func (u *User) QueryModelNames() *ModelNameQuery

QueryModelNames queries the "ModelNames" edge of the User entity.

func (*User) QueryOwner

func (u *User) QueryOwner() *PasswordTokenQuery

QueryOwner queries the "owner" edge of the User entity.

func (*User) QueryPrices

func (u *User) QueryPrices() *PriceQuery

QueryPrices queries the "Prices" edge of the User entity.

func (*User) QueryProducts

func (u *User) QueryProducts() *ProductQuery

QueryProducts queries the "Products" edge of the User entity.

func (*User) String

func (u *User) String() string

String implements the fmt.Stringer.

func (*User) Unwrap

func (u *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 (u *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.

func (*User) Value

func (u *User) Value(name string) (ent.Value, error)

Value returns the ent.Value that was dynamically selected and assigned to the User. This includes values selected through modifiers, order, etc.

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(u *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) Hooks

func (c *UserClient) Hooks() []Hook

Hooks returns the client hooks.

func (*UserClient) Intercept

func (c *UserClient) Intercept(interceptors ...Interceptor)

Intercept adds a list of query interceptors to the interceptors stack. A call to `Intercept(f, g, h)` equals to `user.Intercept(f(g(h())))`.

func (*UserClient) Interceptors

func (c *UserClient) Interceptors() []Interceptor

Interceptors returns the client interceptors.

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) QueryAIs

func (c *UserClient) QueryAIs(u *User) *AIQuery

QueryAIs queries the AIs edge of a User.

func (*UserClient) QueryModelNames

func (c *UserClient) QueryModelNames(u *User) *ModelNameQuery

QueryModelNames queries the ModelNames edge of a User.

func (*UserClient) QueryOwner

func (c *UserClient) QueryOwner(u *User) *PasswordTokenQuery

QueryOwner queries the owner edge of a User.

func (*UserClient) QueryPrices

func (c *UserClient) QueryPrices(u *User) *PriceQuery

QueryPrices queries the Prices edge of a User.

func (*UserClient) QueryProducts

func (c *UserClient) QueryProducts(u *User) *ProductQuery

QueryProducts queries the Products 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(u *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.

func (*UserClient) Use

func (c *UserClient) Use(hooks ...Hook)

Use adds a list of mutation hooks to the hooks stack. A call to `Use(f, g, h)` equals to `user.Hooks(f(g(h())))`.

type UserCreate

type UserCreate struct {
	// contains filtered or unexported fields
}

UserCreate is the builder for creating a User entity.

func (*UserCreate) AddAIIDs

func (uc *UserCreate) AddAIIDs(ids ...int) *UserCreate

AddAIIDs adds the "AIs" edge to the AI entity by IDs.

func (*UserCreate) AddAIs

func (uc *UserCreate) AddAIs(a ...*AI) *UserCreate

AddAIs adds the "AIs" edges to the AI entity.

func (*UserCreate) AddModelNameIDs

func (uc *UserCreate) AddModelNameIDs(ids ...int) *UserCreate

AddModelNameIDs adds the "ModelNames" edge to the ModelName entity by IDs.

func (*UserCreate) AddModelNames

func (uc *UserCreate) AddModelNames(m ...*ModelName) *UserCreate

AddModelNames adds the "ModelNames" edges to the ModelName entity.

func (*UserCreate) AddOwner

func (uc *UserCreate) AddOwner(p ...*PasswordToken) *UserCreate

AddOwner adds the "owner" edges to the PasswordToken entity.

func (*UserCreate) AddOwnerIDs

func (uc *UserCreate) AddOwnerIDs(ids ...int) *UserCreate

AddOwnerIDs adds the "owner" edge to the PasswordToken entity by IDs.

func (*UserCreate) AddPriceIDs

func (uc *UserCreate) AddPriceIDs(ids ...int) *UserCreate

AddPriceIDs adds the "Prices" edge to the Price entity by IDs.

func (*UserCreate) AddPrices

func (uc *UserCreate) AddPrices(p ...*Price) *UserCreate

AddPrices adds the "Prices" edges to the Price entity.

func (*UserCreate) AddProductIDs

func (uc *UserCreate) AddProductIDs(ids ...int) *UserCreate

AddProductIDs adds the "Products" edge to the Product entity by IDs.

func (*UserCreate) AddProducts

func (uc *UserCreate) AddProducts(p ...*Product) *UserCreate

AddProducts adds the "Products" edges to the Product entity.

func (*UserCreate) Exec

func (uc *UserCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*UserCreate) ExecX

func (uc *UserCreate) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*UserCreate) Mutation

func (uc *UserCreate) Mutation() *UserMutation

Mutation returns the UserMutation object of the builder.

func (*UserCreate) Save

func (uc *UserCreate) Save(ctx context.Context) (*User, error)

Save creates the User in the database.

func (*UserCreate) SaveX

func (uc *UserCreate) SaveX(ctx context.Context) *User

SaveX calls Save and panics if Save returns an error.

func (*UserCreate) SetCreatedAt

func (uc *UserCreate) SetCreatedAt(t time.Time) *UserCreate

SetCreatedAt sets the "created_at" field.

func (*UserCreate) SetEmail

func (uc *UserCreate) SetEmail(s string) *UserCreate

SetEmail sets the "email" field.

func (*UserCreate) SetName

func (uc *UserCreate) SetName(s string) *UserCreate

SetName sets the "name" field.

func (*UserCreate) SetNillableCreatedAt

func (uc *UserCreate) SetNillableCreatedAt(t *time.Time) *UserCreate

SetNillableCreatedAt sets the "created_at" field if the given value is not nil.

func (*UserCreate) SetNillableRole

func (uc *UserCreate) SetNillableRole(u *user.Role) *UserCreate

SetNillableRole sets the "role" field if the given value is not nil.

func (*UserCreate) SetNillableVerified

func (uc *UserCreate) SetNillableVerified(b *bool) *UserCreate

SetNillableVerified sets the "verified" field if the given value is not nil.

func (*UserCreate) SetPassword

func (uc *UserCreate) SetPassword(s string) *UserCreate

SetPassword sets the "password" field.

func (*UserCreate) SetRole

func (uc *UserCreate) SetRole(u user.Role) *UserCreate

SetRole sets the "role" field.

func (*UserCreate) SetVerified

func (uc *UserCreate) SetVerified(b bool) *UserCreate

SetVerified sets the "verified" field.

type UserCreateBulk

type UserCreateBulk struct {
	// contains filtered or unexported fields
}

UserCreateBulk is the builder for creating many User entities in bulk.

func (*UserCreateBulk) Exec

func (ucb *UserCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*UserCreateBulk) ExecX

func (ucb *UserCreateBulk) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*UserCreateBulk) Save

func (ucb *UserCreateBulk) Save(ctx context.Context) ([]*User, error)

Save creates the User entities in the database.

func (*UserCreateBulk) SaveX

func (ucb *UserCreateBulk) SaveX(ctx context.Context) []*User

SaveX is like Save, but panics if an error occurs.

type UserDelete

type UserDelete struct {
	// contains filtered or unexported fields
}

UserDelete is the builder for deleting a User entity.

func (*UserDelete) Exec

func (ud *UserDelete) Exec(ctx context.Context) (int, error)

Exec executes the deletion query and returns how many vertices were deleted.

func (*UserDelete) ExecX

func (ud *UserDelete) ExecX(ctx context.Context) int

ExecX is like Exec, but panics if an error occurs.

func (*UserDelete) Where

func (ud *UserDelete) Where(ps ...predicate.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 (udo *UserDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*UserDeleteOne) ExecX

func (udo *UserDeleteOne) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*UserDeleteOne) Where

func (udo *UserDeleteOne) Where(ps ...predicate.User) *UserDeleteOne

Where appends a list predicates to the UserDelete builder.

type UserEdges

type UserEdges struct {
	// Prices holds the value of the Prices edge.
	Prices []*Price `json:"Prices,omitempty"`
	// Products holds the value of the Products edge.
	Products []*Product `json:"Products,omitempty"`
	// ModelNames holds the value of the ModelNames edge.
	ModelNames []*ModelName `json:"ModelNames,omitempty"`
	// AIs holds the value of the AIs edge.
	AIs []*AI `json:"AIs,omitempty"`
	// Owner holds the value of the owner edge.
	Owner []*PasswordToken `json:"owner,omitempty"`
	// contains filtered or unexported fields
}

UserEdges holds the relations/edges for other nodes in the graph.

func (UserEdges) AIsOrErr

func (e UserEdges) AIsOrErr() ([]*AI, error)

AIsOrErr returns the AIs value or an error if the edge was not loaded in eager-loading.

func (UserEdges) ModelNamesOrErr

func (e UserEdges) ModelNamesOrErr() ([]*ModelName, error)

ModelNamesOrErr returns the ModelNames value or an error if the edge was not loaded in eager-loading.

func (UserEdges) OwnerOrErr

func (e UserEdges) OwnerOrErr() ([]*PasswordToken, error)

OwnerOrErr returns the Owner value or an error if the edge was not loaded in eager-loading.

func (UserEdges) PricesOrErr

func (e UserEdges) PricesOrErr() ([]*Price, error)

PricesOrErr returns the Prices value or an error if the edge was not loaded in eager-loading.

func (UserEdges) ProductsOrErr

func (e UserEdges) ProductsOrErr() ([]*Product, error)

ProductsOrErr returns the Products value or an error if the edge was not loaded in eager-loading.

type UserGroupBy

type UserGroupBy struct {
	// contains filtered or unexported fields
}

UserGroupBy is the group-by builder for User entities.

func (*UserGroupBy) Aggregate

func (ugb *UserGroupBy) Aggregate(fns ...AggregateFunc) *UserGroupBy

Aggregate adds the given aggregation functions to the group-by query.

func (*UserGroupBy) Bool

func (s *UserGroupBy) Bool(ctx context.Context) (_ bool, err error)

Bool returns a single bool from a selector. It is only allowed when selecting one field.

func (*UserGroupBy) BoolX

func (s *UserGroupBy) BoolX(ctx context.Context) bool

BoolX is like Bool, but panics if an error occurs.

func (*UserGroupBy) Bools

func (s *UserGroupBy) Bools(ctx context.Context) ([]bool, error)

Bools returns list of bools from a selector. It is only allowed when selecting one field.

func (*UserGroupBy) BoolsX

func (s *UserGroupBy) BoolsX(ctx context.Context) []bool

BoolsX is like Bools, but panics if an error occurs.

func (*UserGroupBy) Float64

func (s *UserGroupBy) Float64(ctx context.Context) (_ float64, err error)

Float64 returns a single float64 from a selector. It is only allowed when selecting one field.

func (*UserGroupBy) Float64X

func (s *UserGroupBy) Float64X(ctx context.Context) float64

Float64X is like Float64, but panics if an error occurs.

func (*UserGroupBy) Float64s

func (s *UserGroupBy) Float64s(ctx context.Context) ([]float64, error)

Float64s returns list of float64s from a selector. It is only allowed when selecting one field.

func (*UserGroupBy) Float64sX

func (s *UserGroupBy) Float64sX(ctx context.Context) []float64

Float64sX is like Float64s, but panics if an error occurs.

func (*UserGroupBy) Int

func (s *UserGroupBy) Int(ctx context.Context) (_ int, err error)

Int returns a single int from a selector. It is only allowed when selecting one field.

func (*UserGroupBy) IntX

func (s *UserGroupBy) IntX(ctx context.Context) int

IntX is like Int, but panics if an error occurs.

func (*UserGroupBy) Ints

func (s *UserGroupBy) Ints(ctx context.Context) ([]int, error)

Ints returns list of ints from a selector. It is only allowed when selecting one field.

func (*UserGroupBy) IntsX

func (s *UserGroupBy) IntsX(ctx context.Context) []int

IntsX is like Ints, but panics if an error occurs.

func (*UserGroupBy) Scan

func (ugb *UserGroupBy) Scan(ctx context.Context, v any) error

Scan applies the selector query and scans the result into the given value.

func (*UserGroupBy) ScanX

func (s *UserGroupBy) ScanX(ctx context.Context, v any)

ScanX is like Scan, but panics if an error occurs.

func (*UserGroupBy) String

func (s *UserGroupBy) String(ctx context.Context) (_ string, err error)

String returns a single string from a selector. It is only allowed when selecting one field.

func (*UserGroupBy) StringX

func (s *UserGroupBy) StringX(ctx context.Context) string

StringX is like String, but panics if an error occurs.

func (*UserGroupBy) Strings

func (s *UserGroupBy) Strings(ctx context.Context) ([]string, error)

Strings returns list of strings from a selector. It is only allowed when selecting one field.

func (*UserGroupBy) StringsX

func (s *UserGroupBy) StringsX(ctx context.Context) []string

StringsX is like Strings, but panics if an error occurs.

type UserMutation

type UserMutation struct {
	// contains filtered or unexported fields
}

UserMutation represents an operation that mutates the User nodes in the graph.

func (*UserMutation) AIsCleared

func (m *UserMutation) AIsCleared() bool

AIsCleared reports if the "AIs" edge to the AI entity was cleared.

func (*UserMutation) AIsIDs

func (m *UserMutation) AIsIDs() (ids []int)

AIsIDs returns the "AIs" edge IDs in the mutation.

func (*UserMutation) AddAIIDs

func (m *UserMutation) AddAIIDs(ids ...int)

AddAIIDs adds the "AIs" edge to the AI entity by ids.

func (*UserMutation) AddField

func (m *UserMutation) 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 (*UserMutation) AddModelNameIDs

func (m *UserMutation) AddModelNameIDs(ids ...int)

AddModelNameIDs adds the "ModelNames" edge to the ModelName entity by ids.

func (*UserMutation) AddOwnerIDs

func (m *UserMutation) AddOwnerIDs(ids ...int)

AddOwnerIDs adds the "owner" edge to the PasswordToken entity by ids.

func (*UserMutation) AddPriceIDs

func (m *UserMutation) AddPriceIDs(ids ...int)

AddPriceIDs adds the "Prices" edge to the Price entity by ids.

func (*UserMutation) AddProductIDs

func (m *UserMutation) AddProductIDs(ids ...int)

AddProductIDs adds the "Products" edge to the Product entity by ids.

func (*UserMutation) AddedEdges

func (m *UserMutation) AddedEdges() []string

AddedEdges returns all edge names that were set/added in this mutation.

func (*UserMutation) AddedField

func (m *UserMutation) 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 (*UserMutation) AddedFields

func (m *UserMutation) AddedFields() []string

AddedFields returns all numeric fields that were incremented/decremented during this mutation.

func (*UserMutation) AddedIDs

func (m *UserMutation) AddedIDs(name string) []ent.Value

AddedIDs returns all IDs (to other nodes) that were added for the given edge name in this mutation.

func (*UserMutation) ClearAIs

func (m *UserMutation) ClearAIs()

ClearAIs clears the "AIs" edge to the AI entity.

func (*UserMutation) ClearEdge

func (m *UserMutation) 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 (*UserMutation) ClearField

func (m *UserMutation) 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 (*UserMutation) ClearModelNames

func (m *UserMutation) ClearModelNames()

ClearModelNames clears the "ModelNames" edge to the ModelName entity.

func (*UserMutation) ClearOwner

func (m *UserMutation) ClearOwner()

ClearOwner clears the "owner" edge to the PasswordToken entity.

func (*UserMutation) ClearPrices

func (m *UserMutation) ClearPrices()

ClearPrices clears the "Prices" edge to the Price entity.

func (*UserMutation) ClearProducts

func (m *UserMutation) ClearProducts()

ClearProducts clears the "Products" edge to the Product entity.

func (*UserMutation) ClearedEdges

func (m *UserMutation) ClearedEdges() []string

ClearedEdges returns all edge names that were cleared in this mutation.

func (*UserMutation) ClearedFields

func (m *UserMutation) ClearedFields() []string

ClearedFields returns all nullable fields that were cleared during this mutation.

func (UserMutation) Client

func (m UserMutation) 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 (*UserMutation) CreatedAt

func (m *UserMutation) CreatedAt() (r time.Time, exists bool)

CreatedAt returns the value of the "created_at" field in the mutation.

func (*UserMutation) EdgeCleared

func (m *UserMutation) EdgeCleared(name string) bool

EdgeCleared returns a boolean which indicates if the edge with the given name was cleared in this mutation.

func (*UserMutation) Email

func (m *UserMutation) Email() (r string, exists bool)

Email returns the value of the "email" field in the mutation.

func (*UserMutation) Field

func (m *UserMutation) 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 (*UserMutation) FieldCleared

func (m *UserMutation) FieldCleared(name string) bool

FieldCleared returns a boolean indicating if a field with the given name was cleared in this mutation.

func (*UserMutation) Fields

func (m *UserMutation) 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 (*UserMutation) ID

func (m *UserMutation) ID() (id int, exists bool)

ID returns the ID value in the mutation. Note that the ID is only available if it was provided to the builder or after it was returned from the database.

func (*UserMutation) IDs

func (m *UserMutation) IDs(ctx context.Context) ([]int, error)

IDs queries the database and returns the entity ids that match the mutation's predicate. That means, if the mutation is applied within a transaction with an isolation level such as sql.LevelSerializable, the returned ids match the ids of the rows that will be updated or updated by the mutation.

func (*UserMutation) ModelNamesCleared

func (m *UserMutation) ModelNamesCleared() bool

ModelNamesCleared reports if the "ModelNames" edge to the ModelName entity was cleared.

func (*UserMutation) ModelNamesIDs

func (m *UserMutation) ModelNamesIDs() (ids []int)

ModelNamesIDs returns the "ModelNames" edge IDs in the mutation.

func (*UserMutation) Name

func (m *UserMutation) Name() (r string, exists bool)

Name returns the value of the "name" field in the mutation.

func (*UserMutation) OldCreatedAt

func (m *UserMutation) OldCreatedAt(ctx context.Context) (v time.Time, err error)

OldCreatedAt returns the old "created_at" field's value of the User entity. If the User 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 (*UserMutation) OldEmail

func (m *UserMutation) OldEmail(ctx context.Context) (v string, err error)

OldEmail returns the old "email" field's value of the User entity. If the User 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 (*UserMutation) OldField

func (m *UserMutation) 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 (*UserMutation) OldName

func (m *UserMutation) OldName(ctx context.Context) (v string, err error)

OldName returns the old "name" field's value of the User entity. If the User 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 (*UserMutation) OldPassword

func (m *UserMutation) OldPassword(ctx context.Context) (v string, err error)

OldPassword returns the old "password" field's value of the User entity. If the User 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 (*UserMutation) OldRole

func (m *UserMutation) OldRole(ctx context.Context) (v user.Role, err error)

OldRole returns the old "role" field's value of the User entity. If the User 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 (*UserMutation) OldVerified

func (m *UserMutation) OldVerified(ctx context.Context) (v bool, err error)

OldVerified returns the old "verified" field's value of the User entity. If the User 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 (*UserMutation) Op

func (m *UserMutation) Op() Op

Op returns the operation name.

func (*UserMutation) OwnerCleared

func (m *UserMutation) OwnerCleared() bool

OwnerCleared reports if the "owner" edge to the PasswordToken entity was cleared.

func (*UserMutation) OwnerIDs

func (m *UserMutation) OwnerIDs() (ids []int)

OwnerIDs returns the "owner" edge IDs in the mutation.

func (*UserMutation) Password

func (m *UserMutation) Password() (r string, exists bool)

Password returns the value of the "password" field in the mutation.

func (*UserMutation) PricesCleared

func (m *UserMutation) PricesCleared() bool

PricesCleared reports if the "Prices" edge to the Price entity was cleared.

func (*UserMutation) PricesIDs

func (m *UserMutation) PricesIDs() (ids []int)

PricesIDs returns the "Prices" edge IDs in the mutation.

func (*UserMutation) ProductsCleared

func (m *UserMutation) ProductsCleared() bool

ProductsCleared reports if the "Products" edge to the Product entity was cleared.

func (*UserMutation) ProductsIDs

func (m *UserMutation) ProductsIDs() (ids []int)

ProductsIDs returns the "Products" edge IDs in the mutation.

func (*UserMutation) RemoveAIIDs

func (m *UserMutation) RemoveAIIDs(ids ...int)

RemoveAIIDs removes the "AIs" edge to the AI entity by IDs.

func (*UserMutation) RemoveModelNameIDs

func (m *UserMutation) RemoveModelNameIDs(ids ...int)

RemoveModelNameIDs removes the "ModelNames" edge to the ModelName entity by IDs.

func (*UserMutation) RemoveOwnerIDs

func (m *UserMutation) RemoveOwnerIDs(ids ...int)

RemoveOwnerIDs removes the "owner" edge to the PasswordToken entity by IDs.

func (*UserMutation) RemovePriceIDs

func (m *UserMutation) RemovePriceIDs(ids ...int)

RemovePriceIDs removes the "Prices" edge to the Price entity by IDs.

func (*UserMutation) RemoveProductIDs

func (m *UserMutation) RemoveProductIDs(ids ...int)

RemoveProductIDs removes the "Products" edge to the Product entity by IDs.

func (*UserMutation) RemovedAIsIDs

func (m *UserMutation) RemovedAIsIDs() (ids []int)

RemovedAIs returns the removed IDs of the "AIs" edge to the AI entity.

func (*UserMutation) RemovedEdges

func (m *UserMutation) RemovedEdges() []string

RemovedEdges returns all edge names that were removed in this mutation.

func (*UserMutation) RemovedIDs

func (m *UserMutation) 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 (*UserMutation) RemovedModelNamesIDs

func (m *UserMutation) RemovedModelNamesIDs() (ids []int)

RemovedModelNames returns the removed IDs of the "ModelNames" edge to the ModelName entity.

func (*UserMutation) RemovedOwnerIDs

func (m *UserMutation) RemovedOwnerIDs() (ids []int)

RemovedOwner returns the removed IDs of the "owner" edge to the PasswordToken entity.

func (*UserMutation) RemovedPricesIDs

func (m *UserMutation) RemovedPricesIDs() (ids []int)

RemovedPrices returns the removed IDs of the "Prices" edge to the Price entity.

func (*UserMutation) RemovedProductsIDs

func (m *UserMutation) RemovedProductsIDs() (ids []int)

RemovedProducts returns the removed IDs of the "Products" edge to the Product entity.

func (*UserMutation) ResetAIs

func (m *UserMutation) ResetAIs()

ResetAIs resets all changes to the "AIs" edge.

func (*UserMutation) ResetCreatedAt

func (m *UserMutation) ResetCreatedAt()

ResetCreatedAt resets all changes to the "created_at" field.

func (*UserMutation) ResetEdge

func (m *UserMutation) 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 (*UserMutation) ResetEmail

func (m *UserMutation) ResetEmail()

ResetEmail resets all changes to the "email" field.

func (*UserMutation) ResetField

func (m *UserMutation) 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 (*UserMutation) ResetModelNames

func (m *UserMutation) ResetModelNames()

ResetModelNames resets all changes to the "ModelNames" edge.

func (*UserMutation) ResetName

func (m *UserMutation) ResetName()

ResetName resets all changes to the "name" field.

func (*UserMutation) ResetOwner

func (m *UserMutation) ResetOwner()

ResetOwner resets all changes to the "owner" edge.

func (*UserMutation) ResetPassword

func (m *UserMutation) ResetPassword()

ResetPassword resets all changes to the "password" field.

func (*UserMutation) ResetPrices

func (m *UserMutation) ResetPrices()

ResetPrices resets all changes to the "Prices" edge.

func (*UserMutation) ResetProducts

func (m *UserMutation) ResetProducts()

ResetProducts resets all changes to the "Products" edge.

func (*UserMutation) ResetRole

func (m *UserMutation) ResetRole()

ResetRole resets all changes to the "role" field.

func (*UserMutation) ResetVerified

func (m *UserMutation) ResetVerified()

ResetVerified resets all changes to the "verified" field.

func (*UserMutation) Role

func (m *UserMutation) Role() (r user.Role, exists bool)

Role returns the value of the "role" field in the mutation.

func (*UserMutation) SetCreatedAt

func (m *UserMutation) SetCreatedAt(t time.Time)

SetCreatedAt sets the "created_at" field.

func (*UserMutation) SetEmail

func (m *UserMutation) SetEmail(s string)

SetEmail sets the "email" field.

func (*UserMutation) SetField

func (m *UserMutation) 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 (*UserMutation) SetName

func (m *UserMutation) SetName(s string)

SetName sets the "name" field.

func (*UserMutation) SetOp

func (m *UserMutation) SetOp(op Op)

SetOp allows setting the mutation operation.

func (*UserMutation) SetPassword

func (m *UserMutation) SetPassword(s string)

SetPassword sets the "password" field.

func (*UserMutation) SetRole

func (m *UserMutation) SetRole(u user.Role)

SetRole sets the "role" field.

func (*UserMutation) SetVerified

func (m *UserMutation) SetVerified(b bool)

SetVerified sets the "verified" field.

func (UserMutation) Tx

func (m UserMutation) Tx() (*Tx, error)

Tx returns an `ent.Tx` for mutations that were executed in transactions; it returns an error otherwise.

func (*UserMutation) Type

func (m *UserMutation) Type() string

Type returns the node type of this mutation (User).

func (*UserMutation) Verified

func (m *UserMutation) Verified() (r bool, exists bool)

Verified returns the value of the "verified" field in the mutation.

func (*UserMutation) Where

func (m *UserMutation) Where(ps ...predicate.User)

Where appends a list predicates to the UserMutation builder.

func (*UserMutation) WhereP

func (m *UserMutation) WhereP(ps ...func(*sql.Selector))

WhereP appends storage-level predicates to the UserMutation builder. Using this method, users can use type-assertion to append predicates that do not depend on any generated package.

type UserQuery

type UserQuery struct {
	// contains filtered or unexported fields
}

UserQuery is the builder for querying User entities.

func (*UserQuery) Aggregate

func (uq *UserQuery) Aggregate(fns ...AggregateFunc) *UserSelect

Aggregate returns a UserSelect configured with the given aggregations.

func (*UserQuery) All

func (uq *UserQuery) All(ctx context.Context) ([]*User, error)

All executes the query and returns a list of Users.

func (*UserQuery) AllX

func (uq *UserQuery) AllX(ctx context.Context) []*User

AllX is like All, but panics if an error occurs.

func (*UserQuery) Clone

func (uq *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) Count

func (uq *UserQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*UserQuery) CountX

func (uq *UserQuery) CountX(ctx context.Context) int

CountX is like Count, but panics if an error occurs.

func (*UserQuery) Exist

func (uq *UserQuery) Exist(ctx context.Context) (bool, error)

Exist returns true if the query has elements in the graph.

func (*UserQuery) ExistX

func (uq *UserQuery) ExistX(ctx context.Context) bool

ExistX is like Exist, but panics if an error occurs.

func (*UserQuery) First

func (uq *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 (uq *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 (uq *UserQuery) FirstIDX(ctx context.Context) int

FirstIDX is like FirstID, but panics if an error occurs.

func (*UserQuery) FirstX

func (uq *UserQuery) FirstX(ctx context.Context) *User

FirstX is like First, but panics if an error occurs.

func (*UserQuery) GroupBy

func (uq *UserQuery) GroupBy(field string, fields ...string) *UserGroupBy

GroupBy is used to group vertices by one or more fields/columns. It is often used with aggregate functions, like: count, max, mean, min, sum.

Example:

var v []struct {
	Name string `json:"name,omitempty"`
	Count int `json:"count,omitempty"`
}

client.User.Query().
	GroupBy(user.FieldName).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*UserQuery) IDs

func (uq *UserQuery) IDs(ctx context.Context) (ids []int, err error)

IDs executes the query and returns a list of User IDs.

func (*UserQuery) IDsX

func (uq *UserQuery) IDsX(ctx context.Context) []int

IDsX is like IDs, but panics if an error occurs.

func (*UserQuery) Limit

func (uq *UserQuery) Limit(limit int) *UserQuery

Limit the number of records to be returned by this query.

func (*UserQuery) Offset

func (uq *UserQuery) Offset(offset int) *UserQuery

Offset to start from.

func (*UserQuery) Only

func (uq *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 (uq *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 (uq *UserQuery) OnlyIDX(ctx context.Context) int

OnlyIDX is like OnlyID, but panics if an error occurs.

func (*UserQuery) OnlyX

func (uq *UserQuery) OnlyX(ctx context.Context) *User

OnlyX is like Only, but panics if an error occurs.

func (*UserQuery) Order

func (uq *UserQuery) Order(o ...user.OrderOption) *UserQuery

Order specifies how the records should be ordered.

func (*UserQuery) QueryAIs

func (uq *UserQuery) QueryAIs() *AIQuery

QueryAIs chains the current query on the "AIs" edge.

func (*UserQuery) QueryModelNames

func (uq *UserQuery) QueryModelNames() *ModelNameQuery

QueryModelNames chains the current query on the "ModelNames" edge.

func (*UserQuery) QueryOwner

func (uq *UserQuery) QueryOwner() *PasswordTokenQuery

QueryOwner chains the current query on the "owner" edge.

func (*UserQuery) QueryPrices

func (uq *UserQuery) QueryPrices() *PriceQuery

QueryPrices chains the current query on the "Prices" edge.

func (*UserQuery) QueryProducts

func (uq *UserQuery) QueryProducts() *ProductQuery

QueryProducts chains the current query on the "Products" edge.

func (*UserQuery) Select

func (uq *UserQuery) Select(fields ...string) *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.FieldName).
	Scan(ctx, &v)

func (*UserQuery) Unique

func (uq *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 (uq *UserQuery) Where(ps ...predicate.User) *UserQuery

Where adds a new predicate for the UserQuery builder.

func (*UserQuery) WithAIs

func (uq *UserQuery) WithAIs(opts ...func(*AIQuery)) *UserQuery

WithAIs tells the query-builder to eager-load the nodes that are connected to the "AIs" edge. The optional arguments are used to configure the query builder of the edge.

func (*UserQuery) WithModelNames

func (uq *UserQuery) WithModelNames(opts ...func(*ModelNameQuery)) *UserQuery

WithModelNames tells the query-builder to eager-load the nodes that are connected to the "ModelNames" edge. The optional arguments are used to configure the query builder of the edge.

func (*UserQuery) WithOwner

func (uq *UserQuery) WithOwner(opts ...func(*PasswordTokenQuery)) *UserQuery

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.

func (*UserQuery) WithPrices

func (uq *UserQuery) WithPrices(opts ...func(*PriceQuery)) *UserQuery

WithPrices tells the query-builder to eager-load the nodes that are connected to the "Prices" edge. The optional arguments are used to configure the query builder of the edge.

func (*UserQuery) WithProducts

func (uq *UserQuery) WithProducts(opts ...func(*ProductQuery)) *UserQuery

WithProducts tells the query-builder to eager-load the nodes that are connected to the "Products" edge. The optional arguments are used to configure the query builder of the edge.

type UserSelect

type UserSelect struct {
	*UserQuery
	// contains filtered or unexported fields
}

UserSelect is the builder for selecting fields of User entities.

func (*UserSelect) Aggregate

func (us *UserSelect) Aggregate(fns ...AggregateFunc) *UserSelect

Aggregate adds the given aggregation functions to the selector query.

func (*UserSelect) Bool

func (s *UserSelect) Bool(ctx context.Context) (_ bool, err error)

Bool returns a single bool from a selector. It is only allowed when selecting one field.

func (*UserSelect) BoolX

func (s *UserSelect) BoolX(ctx context.Context) bool

BoolX is like Bool, but panics if an error occurs.

func (*UserSelect) Bools

func (s *UserSelect) Bools(ctx context.Context) ([]bool, error)

Bools returns list of bools from a selector. It is only allowed when selecting one field.

func (*UserSelect) BoolsX

func (s *UserSelect) BoolsX(ctx context.Context) []bool

BoolsX is like Bools, but panics if an error occurs.

func (*UserSelect) Float64

func (s *UserSelect) Float64(ctx context.Context) (_ float64, err error)

Float64 returns a single float64 from a selector. It is only allowed when selecting one field.

func (*UserSelect) Float64X

func (s *UserSelect) Float64X(ctx context.Context) float64

Float64X is like Float64, but panics if an error occurs.

func (*UserSelect) Float64s

func (s *UserSelect) Float64s(ctx context.Context) ([]float64, error)

Float64s returns list of float64s from a selector. It is only allowed when selecting one field.

func (*UserSelect) Float64sX

func (s *UserSelect) Float64sX(ctx context.Context) []float64

Float64sX is like Float64s, but panics if an error occurs.

func (*UserSelect) Int

func (s *UserSelect) Int(ctx context.Context) (_ int, err error)

Int returns a single int from a selector. It is only allowed when selecting one field.

func (*UserSelect) IntX

func (s *UserSelect) IntX(ctx context.Context) int

IntX is like Int, but panics if an error occurs.

func (*UserSelect) Ints

func (s *UserSelect) Ints(ctx context.Context) ([]int, error)

Ints returns list of ints from a selector. It is only allowed when selecting one field.

func (*UserSelect) IntsX

func (s *UserSelect) IntsX(ctx context.Context) []int

IntsX is like Ints, but panics if an error occurs.

func (*UserSelect) Scan

func (us *UserSelect) Scan(ctx context.Context, v any) error

Scan applies the selector query and scans the result into the given value.

func (*UserSelect) ScanX

func (s *UserSelect) ScanX(ctx context.Context, v any)

ScanX is like Scan, but panics if an error occurs.

func (*UserSelect) String

func (s *UserSelect) String(ctx context.Context) (_ string, err error)

String returns a single string from a selector. It is only allowed when selecting one field.

func (*UserSelect) StringX

func (s *UserSelect) StringX(ctx context.Context) string

StringX is like String, but panics if an error occurs.

func (*UserSelect) Strings

func (s *UserSelect) Strings(ctx context.Context) ([]string, error)

Strings returns list of strings from a selector. It is only allowed when selecting one field.

func (*UserSelect) StringsX

func (s *UserSelect) StringsX(ctx context.Context) []string

StringsX is like Strings, but panics if an error occurs.

type UserUpdate

type UserUpdate struct {
	// contains filtered or unexported fields
}

UserUpdate is the builder for updating User entities.

func (*UserUpdate) AddAIIDs

func (uu *UserUpdate) AddAIIDs(ids ...int) *UserUpdate

AddAIIDs adds the "AIs" edge to the AI entity by IDs.

func (*UserUpdate) AddAIs

func (uu *UserUpdate) AddAIs(a ...*AI) *UserUpdate

AddAIs adds the "AIs" edges to the AI entity.

func (*UserUpdate) AddModelNameIDs

func (uu *UserUpdate) AddModelNameIDs(ids ...int) *UserUpdate

AddModelNameIDs adds the "ModelNames" edge to the ModelName entity by IDs.

func (*UserUpdate) AddModelNames

func (uu *UserUpdate) AddModelNames(m ...*ModelName) *UserUpdate

AddModelNames adds the "ModelNames" edges to the ModelName entity.

func (*UserUpdate) AddOwner

func (uu *UserUpdate) AddOwner(p ...*PasswordToken) *UserUpdate

AddOwner adds the "owner" edges to the PasswordToken entity.

func (*UserUpdate) AddOwnerIDs

func (uu *UserUpdate) AddOwnerIDs(ids ...int) *UserUpdate

AddOwnerIDs adds the "owner" edge to the PasswordToken entity by IDs.

func (*UserUpdate) AddPriceIDs

func (uu *UserUpdate) AddPriceIDs(ids ...int) *UserUpdate

AddPriceIDs adds the "Prices" edge to the Price entity by IDs.

func (*UserUpdate) AddPrices

func (uu *UserUpdate) AddPrices(p ...*Price) *UserUpdate

AddPrices adds the "Prices" edges to the Price entity.

func (*UserUpdate) AddProductIDs

func (uu *UserUpdate) AddProductIDs(ids ...int) *UserUpdate

AddProductIDs adds the "Products" edge to the Product entity by IDs.

func (*UserUpdate) AddProducts

func (uu *UserUpdate) AddProducts(p ...*Product) *UserUpdate

AddProducts adds the "Products" edges to the Product entity.

func (*UserUpdate) ClearAIs

func (uu *UserUpdate) ClearAIs() *UserUpdate

ClearAIs clears all "AIs" edges to the AI entity.

func (*UserUpdate) ClearModelNames

func (uu *UserUpdate) ClearModelNames() *UserUpdate

ClearModelNames clears all "ModelNames" edges to the ModelName entity.

func (*UserUpdate) ClearOwner

func (uu *UserUpdate) ClearOwner() *UserUpdate

ClearOwner clears all "owner" edges to the PasswordToken entity.

func (*UserUpdate) ClearPrices

func (uu *UserUpdate) ClearPrices() *UserUpdate

ClearPrices clears all "Prices" edges to the Price entity.

func (*UserUpdate) ClearProducts

func (uu *UserUpdate) ClearProducts() *UserUpdate

ClearProducts clears all "Products" edges to the Product entity.

func (*UserUpdate) Exec

func (uu *UserUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*UserUpdate) ExecX

func (uu *UserUpdate) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*UserUpdate) Mutation

func (uu *UserUpdate) Mutation() *UserMutation

Mutation returns the UserMutation object of the builder.

func (*UserUpdate) RemoveAIIDs

func (uu *UserUpdate) RemoveAIIDs(ids ...int) *UserUpdate

RemoveAIIDs removes the "AIs" edge to AI entities by IDs.

func (*UserUpdate) RemoveAIs

func (uu *UserUpdate) RemoveAIs(a ...*AI) *UserUpdate

RemoveAIs removes "AIs" edges to AI entities.

func (*UserUpdate) RemoveModelNameIDs

func (uu *UserUpdate) RemoveModelNameIDs(ids ...int) *UserUpdate

RemoveModelNameIDs removes the "ModelNames" edge to ModelName entities by IDs.

func (*UserUpdate) RemoveModelNames

func (uu *UserUpdate) RemoveModelNames(m ...*ModelName) *UserUpdate

RemoveModelNames removes "ModelNames" edges to ModelName entities.

func (*UserUpdate) RemoveOwner

func (uu *UserUpdate) RemoveOwner(p ...*PasswordToken) *UserUpdate

RemoveOwner removes "owner" edges to PasswordToken entities.

func (*UserUpdate) RemoveOwnerIDs

func (uu *UserUpdate) RemoveOwnerIDs(ids ...int) *UserUpdate

RemoveOwnerIDs removes the "owner" edge to PasswordToken entities by IDs.

func (*UserUpdate) RemovePriceIDs

func (uu *UserUpdate) RemovePriceIDs(ids ...int) *UserUpdate

RemovePriceIDs removes the "Prices" edge to Price entities by IDs.

func (*UserUpdate) RemovePrices

func (uu *UserUpdate) RemovePrices(p ...*Price) *UserUpdate

RemovePrices removes "Prices" edges to Price entities.

func (*UserUpdate) RemoveProductIDs

func (uu *UserUpdate) RemoveProductIDs(ids ...int) *UserUpdate

RemoveProductIDs removes the "Products" edge to Product entities by IDs.

func (*UserUpdate) RemoveProducts

func (uu *UserUpdate) RemoveProducts(p ...*Product) *UserUpdate

RemoveProducts removes "Products" edges to Product entities.

func (*UserUpdate) Save

func (uu *UserUpdate) Save(ctx context.Context) (int, error)

Save executes the query and returns the number of nodes affected by the update operation.

func (*UserUpdate) SaveX

func (uu *UserUpdate) SaveX(ctx context.Context) int

SaveX is like Save, but panics if an error occurs.

func (*UserUpdate) SetEmail

func (uu *UserUpdate) SetEmail(s string) *UserUpdate

SetEmail sets the "email" field.

func (*UserUpdate) SetName

func (uu *UserUpdate) SetName(s string) *UserUpdate

SetName sets the "name" field.

func (*UserUpdate) SetNillableEmail

func (uu *UserUpdate) SetNillableEmail(s *string) *UserUpdate

SetNillableEmail sets the "email" field if the given value is not nil.

func (*UserUpdate) SetNillableName

func (uu *UserUpdate) SetNillableName(s *string) *UserUpdate

SetNillableName sets the "name" field if the given value is not nil.

func (*UserUpdate) SetNillablePassword

func (uu *UserUpdate) SetNillablePassword(s *string) *UserUpdate

SetNillablePassword sets the "password" field if the given value is not nil.

func (*UserUpdate) SetNillableRole

func (uu *UserUpdate) SetNillableRole(u *user.Role) *UserUpdate

SetNillableRole sets the "role" field if the given value is not nil.

func (*UserUpdate) SetNillableVerified

func (uu *UserUpdate) SetNillableVerified(b *bool) *UserUpdate

SetNillableVerified sets the "verified" field if the given value is not nil.

func (*UserUpdate) SetPassword

func (uu *UserUpdate) SetPassword(s string) *UserUpdate

SetPassword sets the "password" field.

func (*UserUpdate) SetRole

func (uu *UserUpdate) SetRole(u user.Role) *UserUpdate

SetRole sets the "role" field.

func (*UserUpdate) SetVerified

func (uu *UserUpdate) SetVerified(b bool) *UserUpdate

SetVerified sets the "verified" field.

func (*UserUpdate) Where

func (uu *UserUpdate) Where(ps ...predicate.User) *UserUpdate

Where appends a list predicates to the UserUpdate builder.

type UserUpdateOne

type UserUpdateOne struct {
	// contains filtered or unexported fields
}

UserUpdateOne is the builder for updating a single User entity.

func (*UserUpdateOne) AddAIIDs

func (uuo *UserUpdateOne) AddAIIDs(ids ...int) *UserUpdateOne

AddAIIDs adds the "AIs" edge to the AI entity by IDs.

func (*UserUpdateOne) AddAIs

func (uuo *UserUpdateOne) AddAIs(a ...*AI) *UserUpdateOne

AddAIs adds the "AIs" edges to the AI entity.

func (*UserUpdateOne) AddModelNameIDs

func (uuo *UserUpdateOne) AddModelNameIDs(ids ...int) *UserUpdateOne

AddModelNameIDs adds the "ModelNames" edge to the ModelName entity by IDs.

func (*UserUpdateOne) AddModelNames

func (uuo *UserUpdateOne) AddModelNames(m ...*ModelName) *UserUpdateOne

AddModelNames adds the "ModelNames" edges to the ModelName entity.

func (*UserUpdateOne) AddOwner

func (uuo *UserUpdateOne) AddOwner(p ...*PasswordToken) *UserUpdateOne

AddOwner adds the "owner" edges to the PasswordToken entity.

func (*UserUpdateOne) AddOwnerIDs

func (uuo *UserUpdateOne) AddOwnerIDs(ids ...int) *UserUpdateOne

AddOwnerIDs adds the "owner" edge to the PasswordToken entity by IDs.

func (*UserUpdateOne) AddPriceIDs

func (uuo *UserUpdateOne) AddPriceIDs(ids ...int) *UserUpdateOne

AddPriceIDs adds the "Prices" edge to the Price entity by IDs.

func (*UserUpdateOne) AddPrices

func (uuo *UserUpdateOne) AddPrices(p ...*Price) *UserUpdateOne

AddPrices adds the "Prices" edges to the Price entity.

func (*UserUpdateOne) AddProductIDs

func (uuo *UserUpdateOne) AddProductIDs(ids ...int) *UserUpdateOne

AddProductIDs adds the "Products" edge to the Product entity by IDs.

func (*UserUpdateOne) AddProducts

func (uuo *UserUpdateOne) AddProducts(p ...*Product) *UserUpdateOne

AddProducts adds the "Products" edges to the Product entity.

func (*UserUpdateOne) ClearAIs

func (uuo *UserUpdateOne) ClearAIs() *UserUpdateOne

ClearAIs clears all "AIs" edges to the AI entity.

func (*UserUpdateOne) ClearModelNames

func (uuo *UserUpdateOne) ClearModelNames() *UserUpdateOne

ClearModelNames clears all "ModelNames" edges to the ModelName entity.

func (*UserUpdateOne) ClearOwner

func (uuo *UserUpdateOne) ClearOwner() *UserUpdateOne

ClearOwner clears all "owner" edges to the PasswordToken entity.

func (*UserUpdateOne) ClearPrices

func (uuo *UserUpdateOne) ClearPrices() *UserUpdateOne

ClearPrices clears all "Prices" edges to the Price entity.

func (*UserUpdateOne) ClearProducts

func (uuo *UserUpdateOne) ClearProducts() *UserUpdateOne

ClearProducts clears all "Products" edges to the Product entity.

func (*UserUpdateOne) Exec

func (uuo *UserUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*UserUpdateOne) ExecX

func (uuo *UserUpdateOne) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*UserUpdateOne) Mutation

func (uuo *UserUpdateOne) Mutation() *UserMutation

Mutation returns the UserMutation object of the builder.

func (*UserUpdateOne) RemoveAIIDs

func (uuo *UserUpdateOne) RemoveAIIDs(ids ...int) *UserUpdateOne

RemoveAIIDs removes the "AIs" edge to AI entities by IDs.

func (*UserUpdateOne) RemoveAIs

func (uuo *UserUpdateOne) RemoveAIs(a ...*AI) *UserUpdateOne

RemoveAIs removes "AIs" edges to AI entities.

func (*UserUpdateOne) RemoveModelNameIDs

func (uuo *UserUpdateOne) RemoveModelNameIDs(ids ...int) *UserUpdateOne

RemoveModelNameIDs removes the "ModelNames" edge to ModelName entities by IDs.

func (*UserUpdateOne) RemoveModelNames

func (uuo *UserUpdateOne) RemoveModelNames(m ...*ModelName) *UserUpdateOne

RemoveModelNames removes "ModelNames" edges to ModelName entities.

func (*UserUpdateOne) RemoveOwner

func (uuo *UserUpdateOne) RemoveOwner(p ...*PasswordToken) *UserUpdateOne

RemoveOwner removes "owner" edges to PasswordToken entities.

func (*UserUpdateOne) RemoveOwnerIDs

func (uuo *UserUpdateOne) RemoveOwnerIDs(ids ...int) *UserUpdateOne

RemoveOwnerIDs removes the "owner" edge to PasswordToken entities by IDs.

func (*UserUpdateOne) RemovePriceIDs

func (uuo *UserUpdateOne) RemovePriceIDs(ids ...int) *UserUpdateOne

RemovePriceIDs removes the "Prices" edge to Price entities by IDs.

func (*UserUpdateOne) RemovePrices

func (uuo *UserUpdateOne) RemovePrices(p ...*Price) *UserUpdateOne

RemovePrices removes "Prices" edges to Price entities.

func (*UserUpdateOne) RemoveProductIDs

func (uuo *UserUpdateOne) RemoveProductIDs(ids ...int) *UserUpdateOne

RemoveProductIDs removes the "Products" edge to Product entities by IDs.

func (*UserUpdateOne) RemoveProducts

func (uuo *UserUpdateOne) RemoveProducts(p ...*Product) *UserUpdateOne

RemoveProducts removes "Products" edges to Product entities.

func (*UserUpdateOne) Save

func (uuo *UserUpdateOne) Save(ctx context.Context) (*User, error)

Save executes the query and returns the updated User entity.

func (*UserUpdateOne) SaveX

func (uuo *UserUpdateOne) SaveX(ctx context.Context) *User

SaveX is like Save, but panics if an error occurs.

func (*UserUpdateOne) Select

func (uuo *UserUpdateOne) Select(field string, fields ...string) *UserUpdateOne

Select allows selecting one or more fields (columns) of the returned entity. The default is selecting all fields defined in the entity schema.

func (*UserUpdateOne) SetEmail

func (uuo *UserUpdateOne) SetEmail(s string) *UserUpdateOne

SetEmail sets the "email" field.

func (*UserUpdateOne) SetName

func (uuo *UserUpdateOne) SetName(s string) *UserUpdateOne

SetName sets the "name" field.

func (*UserUpdateOne) SetNillableEmail

func (uuo *UserUpdateOne) SetNillableEmail(s *string) *UserUpdateOne

SetNillableEmail sets the "email" field if the given value is not nil.

func (*UserUpdateOne) SetNillableName

func (uuo *UserUpdateOne) SetNillableName(s *string) *UserUpdateOne

SetNillableName sets the "name" field if the given value is not nil.

func (*UserUpdateOne) SetNillablePassword

func (uuo *UserUpdateOne) SetNillablePassword(s *string) *UserUpdateOne

SetNillablePassword sets the "password" field if the given value is not nil.

func (*UserUpdateOne) SetNillableRole

func (uuo *UserUpdateOne) SetNillableRole(u *user.Role) *UserUpdateOne

SetNillableRole sets the "role" field if the given value is not nil.

func (*UserUpdateOne) SetNillableVerified

func (uuo *UserUpdateOne) SetNillableVerified(b *bool) *UserUpdateOne

SetNillableVerified sets the "verified" field if the given value is not nil.

func (*UserUpdateOne) SetPassword

func (uuo *UserUpdateOne) SetPassword(s string) *UserUpdateOne

SetPassword sets the "password" field.

func (*UserUpdateOne) SetRole

func (uuo *UserUpdateOne) SetRole(u user.Role) *UserUpdateOne

SetRole sets the "role" field.

func (*UserUpdateOne) SetVerified

func (uuo *UserUpdateOne) SetVerified(b bool) *UserUpdateOne

SetVerified sets the "verified" field.

func (*UserUpdateOne) Where

func (uuo *UserUpdateOne) Where(ps ...predicate.User) *UserUpdateOne

Where appends a list predicates to the UserUpdate builder.

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.

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