ent

package
v0.0.0-...-5d3e565 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2023 License: MIT Imports: 24 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.
	TypeAchievement  = "Achievement"
	TypeArticle      = "Article"
	TypeBFPDataPoint = "BFPDataPoint"
	TypeMeal         = "Meal"
	TypeTag          = "Tag"
	TypeUser         = "User"
)

Variables

This section is empty.

Functions

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 Achievement

type Achievement struct {

	// ID of the ent.
	ID int `json:"id,omitempty"`
	// Status holds the value of the "status" field.
	Status string `json:"status,omitempty"`
	// ThumbnailImgURL holds the value of the "thumbnail_img_url" field.
	ThumbnailImgURL string `json:"thumbnail_img_url,omitempty"`
	// BfpGoal holds the value of the "bfp_goal" field.
	BfpGoal float64 `json:"bfp_goal,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 AchievementQuery when eager-loading is set.
	Edges AchievementEdges `json:"edges"`
	// contains filtered or unexported fields
}

Achievement is the model entity for the Achievement schema.

func (*Achievement) QueryUser

func (a *Achievement) QueryUser() *UserQuery

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

func (*Achievement) String

func (a *Achievement) String() string

String implements the fmt.Stringer.

func (*Achievement) Unwrap

func (a *Achievement) Unwrap() *Achievement

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

func (a *Achievement) Update() *AchievementUpdateOne

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

type AchievementClient

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

AchievementClient is a client for the Achievement schema.

func NewAchievementClient

func NewAchievementClient(c config) *AchievementClient

NewAchievementClient returns a client for the Achievement from the given config.

func (*AchievementClient) Create

func (c *AchievementClient) Create() *AchievementCreate

Create returns a builder for creating a Achievement entity.

func (*AchievementClient) CreateBulk

func (c *AchievementClient) CreateBulk(builders ...*AchievementCreate) *AchievementCreateBulk

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

func (*AchievementClient) Delete

func (c *AchievementClient) Delete() *AchievementDelete

Delete returns a delete builder for Achievement.

func (*AchievementClient) DeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*AchievementClient) DeleteOneID

func (c *AchievementClient) DeleteOneID(id int) *AchievementDeleteOne

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

func (*AchievementClient) Get

func (c *AchievementClient) Get(ctx context.Context, id int) (*Achievement, error)

Get returns a Achievement entity by its id.

func (*AchievementClient) GetX

func (c *AchievementClient) GetX(ctx context.Context, id int) *Achievement

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

func (*AchievementClient) Hooks

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

Hooks returns the client hooks.

func (*AchievementClient) Intercept

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

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

func (*AchievementClient) Interceptors

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

Interceptors returns the client interceptors.

func (*AchievementClient) Query

func (c *AchievementClient) Query() *AchievementQuery

Query returns a query builder for Achievement.

func (*AchievementClient) QueryUser

func (c *AchievementClient) QueryUser(a *Achievement) *UserQuery

QueryUser queries the user edge of a Achievement.

func (*AchievementClient) Update

func (c *AchievementClient) Update() *AchievementUpdate

Update returns an update builder for Achievement.

func (*AchievementClient) UpdateOne

UpdateOne returns an update builder for the given entity.

func (*AchievementClient) UpdateOneID

func (c *AchievementClient) UpdateOneID(id int) *AchievementUpdateOne

UpdateOneID returns an update builder for the given id.

func (*AchievementClient) Use

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

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

type AchievementCreate

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

AchievementCreate is the builder for creating a Achievement entity.

func (*AchievementCreate) Exec

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

Exec executes the query.

func (*AchievementCreate) ExecX

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

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

func (*AchievementCreate) Mutation

func (ac *AchievementCreate) Mutation() *AchievementMutation

Mutation returns the AchievementMutation object of the builder.

func (*AchievementCreate) Save

Save creates the Achievement in the database.

func (*AchievementCreate) SaveX

func (ac *AchievementCreate) SaveX(ctx context.Context) *Achievement

SaveX calls Save and panics if Save returns an error.

func (*AchievementCreate) SetBfpGoal

func (ac *AchievementCreate) SetBfpGoal(f float64) *AchievementCreate

SetBfpGoal sets the "bfp_goal" field.

func (*AchievementCreate) SetCreatedAt

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

SetCreatedAt sets the "created_at" field.

func (*AchievementCreate) SetNillableCreatedAt

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

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

func (*AchievementCreate) SetNillableStatus

func (ac *AchievementCreate) SetNillableStatus(s *string) *AchievementCreate

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

func (*AchievementCreate) SetNillableThumbnailImgURL

func (ac *AchievementCreate) SetNillableThumbnailImgURL(s *string) *AchievementCreate

SetNillableThumbnailImgURL sets the "thumbnail_img_url" field if the given value is not nil.

func (*AchievementCreate) SetNillableUserID

func (ac *AchievementCreate) SetNillableUserID(id *int) *AchievementCreate

SetNillableUserID sets the "user" edge to the User entity by ID if the given value is not nil.

func (*AchievementCreate) SetStatus

func (ac *AchievementCreate) SetStatus(s string) *AchievementCreate

SetStatus sets the "status" field.

func (*AchievementCreate) SetThumbnailImgURL

func (ac *AchievementCreate) SetThumbnailImgURL(s string) *AchievementCreate

SetThumbnailImgURL sets the "thumbnail_img_url" field.

func (*AchievementCreate) SetUser

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

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

func (*AchievementCreate) SetUserID

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

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

type AchievementCreateBulk

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

AchievementCreateBulk is the builder for creating many Achievement entities in bulk.

func (*AchievementCreateBulk) Exec

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

Exec executes the query.

func (*AchievementCreateBulk) ExecX

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

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

func (*AchievementCreateBulk) Save

func (acb *AchievementCreateBulk) Save(ctx context.Context) ([]*Achievement, error)

Save creates the Achievement entities in the database.

func (*AchievementCreateBulk) SaveX

func (acb *AchievementCreateBulk) SaveX(ctx context.Context) []*Achievement

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

type AchievementDelete

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

AchievementDelete is the builder for deleting a Achievement entity.

func (*AchievementDelete) Exec

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

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

func (*AchievementDelete) ExecX

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

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

func (*AchievementDelete) Where

Where appends a list predicates to the AchievementDelete builder.

type AchievementDeleteOne

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

AchievementDeleteOne is the builder for deleting a single Achievement entity.

func (*AchievementDeleteOne) Exec

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

Exec executes the deletion query.

func (*AchievementDeleteOne) ExecX

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

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

func (*AchievementDeleteOne) Where

Where appends a list predicates to the AchievementDelete builder.

type AchievementEdges

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

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

func (AchievementEdges) UserOrErr

func (e AchievementEdges) 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 AchievementGroupBy

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

AchievementGroupBy is the group-by builder for Achievement entities.

func (*AchievementGroupBy) Aggregate

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

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

func (*AchievementGroupBy) Bool

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

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

func (*AchievementGroupBy) BoolX

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

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

func (*AchievementGroupBy) Bools

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

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

func (*AchievementGroupBy) BoolsX

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

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

func (*AchievementGroupBy) Float64

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

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

func (*AchievementGroupBy) Float64X

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

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

func (*AchievementGroupBy) Float64s

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

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

func (*AchievementGroupBy) Float64sX

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

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

func (*AchievementGroupBy) Int

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

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

func (*AchievementGroupBy) IntX

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

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

func (*AchievementGroupBy) Ints

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

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

func (*AchievementGroupBy) IntsX

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

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

func (*AchievementGroupBy) Scan

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

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

func (*AchievementGroupBy) ScanX

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

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

func (*AchievementGroupBy) String

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

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

func (*AchievementGroupBy) StringX

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

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

func (*AchievementGroupBy) Strings

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

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

func (*AchievementGroupBy) StringsX

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

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

type AchievementMutation

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

AchievementMutation represents an operation that mutates the Achievement nodes in the graph.

func (*AchievementMutation) AddBfpGoal

func (m *AchievementMutation) AddBfpGoal(f float64)

AddBfpGoal adds f to the "bfp_goal" field.

func (*AchievementMutation) AddField

func (m *AchievementMutation) 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 (*AchievementMutation) AddedBfpGoal

func (m *AchievementMutation) AddedBfpGoal() (r float64, exists bool)

AddedBfpGoal returns the value that was added to the "bfp_goal" field in this mutation.

func (*AchievementMutation) AddedEdges

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

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

func (*AchievementMutation) AddedField

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

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

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

func (*AchievementMutation) AddedIDs

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

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

func (*AchievementMutation) BfpGoal

func (m *AchievementMutation) BfpGoal() (r float64, exists bool)

BfpGoal returns the value of the "bfp_goal" field in the mutation.

func (*AchievementMutation) ClearEdge

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

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

func (m *AchievementMutation) ClearUser()

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

func (*AchievementMutation) ClearedEdges

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

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

func (*AchievementMutation) ClearedFields

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

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

func (AchievementMutation) Client

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

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

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

func (*AchievementMutation) EdgeCleared

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

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

func (*AchievementMutation) Field

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

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

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

func (*AchievementMutation) Fields

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

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

func (m *AchievementMutation) 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 (*AchievementMutation) OldBfpGoal

func (m *AchievementMutation) OldBfpGoal(ctx context.Context) (v float64, err error)

OldBfpGoal returns the old "bfp_goal" field's value of the Achievement entity. If the Achievement 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 (*AchievementMutation) OldCreatedAt

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

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

func (m *AchievementMutation) 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 (*AchievementMutation) OldStatus

func (m *AchievementMutation) OldStatus(ctx context.Context) (v string, err error)

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

func (m *AchievementMutation) OldThumbnailImgURL(ctx context.Context) (v string, err error)

OldThumbnailImgURL returns the old "thumbnail_img_url" field's value of the Achievement entity. If the Achievement 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 (*AchievementMutation) Op

func (m *AchievementMutation) Op() Op

Op returns the operation name.

func (*AchievementMutation) RemovedEdges

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

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

func (*AchievementMutation) RemovedIDs

func (m *AchievementMutation) 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 (*AchievementMutation) ResetBfpGoal

func (m *AchievementMutation) ResetBfpGoal()

ResetBfpGoal resets all changes to the "bfp_goal" field.

func (*AchievementMutation) ResetCreatedAt

func (m *AchievementMutation) ResetCreatedAt()

ResetCreatedAt resets all changes to the "created_at" field.

func (*AchievementMutation) ResetEdge

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

func (m *AchievementMutation) 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 (*AchievementMutation) ResetStatus

func (m *AchievementMutation) ResetStatus()

ResetStatus resets all changes to the "status" field.

func (*AchievementMutation) ResetThumbnailImgURL

func (m *AchievementMutation) ResetThumbnailImgURL()

ResetThumbnailImgURL resets all changes to the "thumbnail_img_url" field.

func (*AchievementMutation) ResetUser

func (m *AchievementMutation) ResetUser()

ResetUser resets all changes to the "user" edge.

func (*AchievementMutation) SetBfpGoal

func (m *AchievementMutation) SetBfpGoal(f float64)

SetBfpGoal sets the "bfp_goal" field.

func (*AchievementMutation) SetCreatedAt

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

SetCreatedAt sets the "created_at" field.

func (*AchievementMutation) SetField

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

func (m *AchievementMutation) SetOp(op Op)

SetOp allows setting the mutation operation.

func (*AchievementMutation) SetStatus

func (m *AchievementMutation) SetStatus(s string)

SetStatus sets the "status" field.

func (*AchievementMutation) SetThumbnailImgURL

func (m *AchievementMutation) SetThumbnailImgURL(s string)

SetThumbnailImgURL sets the "thumbnail_img_url" field.

func (*AchievementMutation) SetUserID

func (m *AchievementMutation) SetUserID(id int)

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

func (*AchievementMutation) Status

func (m *AchievementMutation) Status() (r string, exists bool)

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

func (*AchievementMutation) ThumbnailImgURL

func (m *AchievementMutation) ThumbnailImgURL() (r string, exists bool)

ThumbnailImgURL returns the value of the "thumbnail_img_url" field in the mutation.

func (AchievementMutation) Tx

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

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

func (*AchievementMutation) Type

func (m *AchievementMutation) Type() string

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

func (*AchievementMutation) UserCleared

func (m *AchievementMutation) UserCleared() bool

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

func (*AchievementMutation) UserID

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

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

func (*AchievementMutation) UserIDs

func (m *AchievementMutation) 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 (*AchievementMutation) Where

func (m *AchievementMutation) Where(ps ...predicate.Achievement)

Where appends a list predicates to the AchievementMutation builder.

func (*AchievementMutation) WhereP

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

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

type AchievementQuery

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

AchievementQuery is the builder for querying Achievement entities.

func (*AchievementQuery) Aggregate

func (aq *AchievementQuery) Aggregate(fns ...AggregateFunc) *AchievementSelect

Aggregate returns a AchievementSelect configured with the given aggregations.

func (*AchievementQuery) All

func (aq *AchievementQuery) All(ctx context.Context) ([]*Achievement, error)

All executes the query and returns a list of Achievements.

func (*AchievementQuery) AllX

func (aq *AchievementQuery) AllX(ctx context.Context) []*Achievement

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

func (*AchievementQuery) Clone

func (aq *AchievementQuery) Clone() *AchievementQuery

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

func (*AchievementQuery) Count

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

Count returns the count of the given query.

func (*AchievementQuery) CountX

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

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

func (*AchievementQuery) Exist

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

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

func (*AchievementQuery) ExistX

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

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

func (*AchievementQuery) First

func (aq *AchievementQuery) First(ctx context.Context) (*Achievement, error)

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

func (*AchievementQuery) FirstID

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

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

func (*AchievementQuery) FirstIDX

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

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

func (*AchievementQuery) FirstX

func (aq *AchievementQuery) FirstX(ctx context.Context) *Achievement

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

func (*AchievementQuery) GroupBy

func (aq *AchievementQuery) GroupBy(field string, fields ...string) *AchievementGroupBy

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

client.Achievement.Query().
	GroupBy(achievement.FieldStatus).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*AchievementQuery) IDs

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

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

func (*AchievementQuery) IDsX

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

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

func (*AchievementQuery) Limit

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

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

func (*AchievementQuery) Offset

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

Offset to start from.

func (*AchievementQuery) Only

func (aq *AchievementQuery) Only(ctx context.Context) (*Achievement, error)

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

func (*AchievementQuery) OnlyID

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

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

func (*AchievementQuery) OnlyIDX

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

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

func (*AchievementQuery) OnlyX

func (aq *AchievementQuery) OnlyX(ctx context.Context) *Achievement

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

func (*AchievementQuery) Order

func (aq *AchievementQuery) Order(o ...OrderFunc) *AchievementQuery

Order specifies how the records should be ordered.

func (*AchievementQuery) QueryUser

func (aq *AchievementQuery) QueryUser() *UserQuery

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

func (*AchievementQuery) Select

func (aq *AchievementQuery) Select(fields ...string) *AchievementSelect

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

client.Achievement.Query().
	Select(achievement.FieldStatus).
	Scan(ctx, &v)

func (*AchievementQuery) Unique

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

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

Where adds a new predicate for the AchievementQuery builder.

func (*AchievementQuery) WithUser

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

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 AchievementSelect

type AchievementSelect struct {
	*AchievementQuery
	// contains filtered or unexported fields
}

AchievementSelect is the builder for selecting fields of Achievement entities.

func (*AchievementSelect) Aggregate

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

Aggregate adds the given aggregation functions to the selector query.

func (*AchievementSelect) Bool

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

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

func (*AchievementSelect) BoolX

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

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

func (*AchievementSelect) Bools

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

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

func (*AchievementSelect) BoolsX

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

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

func (*AchievementSelect) Float64

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

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

func (*AchievementSelect) Float64X

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

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

func (*AchievementSelect) Float64s

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

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

func (*AchievementSelect) Float64sX

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

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

func (*AchievementSelect) Int

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

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

func (*AchievementSelect) IntX

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

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

func (*AchievementSelect) Ints

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

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

func (*AchievementSelect) IntsX

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

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

func (*AchievementSelect) Scan

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

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

func (*AchievementSelect) ScanX

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

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

func (*AchievementSelect) String

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

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

func (*AchievementSelect) StringX

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

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

func (*AchievementSelect) Strings

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

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

func (*AchievementSelect) StringsX

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

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

type AchievementUpdate

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

AchievementUpdate is the builder for updating Achievement entities.

func (*AchievementUpdate) AddBfpGoal

func (au *AchievementUpdate) AddBfpGoal(f float64) *AchievementUpdate

AddBfpGoal adds f to the "bfp_goal" field.

func (*AchievementUpdate) ClearUser

func (au *AchievementUpdate) ClearUser() *AchievementUpdate

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

func (*AchievementUpdate) Exec

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

Exec executes the query.

func (*AchievementUpdate) ExecX

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

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

func (*AchievementUpdate) Mutation

func (au *AchievementUpdate) Mutation() *AchievementMutation

Mutation returns the AchievementMutation object of the builder.

func (*AchievementUpdate) Save

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

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

func (*AchievementUpdate) SaveX

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

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

func (*AchievementUpdate) SetBfpGoal

func (au *AchievementUpdate) SetBfpGoal(f float64) *AchievementUpdate

SetBfpGoal sets the "bfp_goal" field.

func (*AchievementUpdate) SetCreatedAt

func (au *AchievementUpdate) SetCreatedAt(t time.Time) *AchievementUpdate

SetCreatedAt sets the "created_at" field.

func (*AchievementUpdate) SetNillableCreatedAt

func (au *AchievementUpdate) SetNillableCreatedAt(t *time.Time) *AchievementUpdate

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

func (*AchievementUpdate) SetNillableStatus

func (au *AchievementUpdate) SetNillableStatus(s *string) *AchievementUpdate

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

func (*AchievementUpdate) SetNillableThumbnailImgURL

func (au *AchievementUpdate) SetNillableThumbnailImgURL(s *string) *AchievementUpdate

SetNillableThumbnailImgURL sets the "thumbnail_img_url" field if the given value is not nil.

func (*AchievementUpdate) SetNillableUserID

func (au *AchievementUpdate) SetNillableUserID(id *int) *AchievementUpdate

SetNillableUserID sets the "user" edge to the User entity by ID if the given value is not nil.

func (*AchievementUpdate) SetStatus

func (au *AchievementUpdate) SetStatus(s string) *AchievementUpdate

SetStatus sets the "status" field.

func (*AchievementUpdate) SetThumbnailImgURL

func (au *AchievementUpdate) SetThumbnailImgURL(s string) *AchievementUpdate

SetThumbnailImgURL sets the "thumbnail_img_url" field.

func (*AchievementUpdate) SetUser

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

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

func (*AchievementUpdate) SetUserID

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

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

func (*AchievementUpdate) Where

Where appends a list predicates to the AchievementUpdate builder.

type AchievementUpdateOne

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

AchievementUpdateOne is the builder for updating a single Achievement entity.

func (*AchievementUpdateOne) AddBfpGoal

AddBfpGoal adds f to the "bfp_goal" field.

func (*AchievementUpdateOne) ClearUser

func (auo *AchievementUpdateOne) ClearUser() *AchievementUpdateOne

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

func (*AchievementUpdateOne) Exec

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

Exec executes the query on the entity.

func (*AchievementUpdateOne) ExecX

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

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

func (*AchievementUpdateOne) Mutation

func (auo *AchievementUpdateOne) Mutation() *AchievementMutation

Mutation returns the AchievementMutation object of the builder.

func (*AchievementUpdateOne) Save

Save executes the query and returns the updated Achievement entity.

func (*AchievementUpdateOne) SaveX

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

func (*AchievementUpdateOne) Select

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

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

func (*AchievementUpdateOne) SetBfpGoal

SetBfpGoal sets the "bfp_goal" field.

func (*AchievementUpdateOne) SetCreatedAt

func (auo *AchievementUpdateOne) SetCreatedAt(t time.Time) *AchievementUpdateOne

SetCreatedAt sets the "created_at" field.

func (*AchievementUpdateOne) SetNillableCreatedAt

func (auo *AchievementUpdateOne) SetNillableCreatedAt(t *time.Time) *AchievementUpdateOne

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

func (*AchievementUpdateOne) SetNillableStatus

func (auo *AchievementUpdateOne) SetNillableStatus(s *string) *AchievementUpdateOne

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

func (*AchievementUpdateOne) SetNillableThumbnailImgURL

func (auo *AchievementUpdateOne) SetNillableThumbnailImgURL(s *string) *AchievementUpdateOne

SetNillableThumbnailImgURL sets the "thumbnail_img_url" field if the given value is not nil.

func (*AchievementUpdateOne) SetNillableUserID

func (auo *AchievementUpdateOne) SetNillableUserID(id *int) *AchievementUpdateOne

SetNillableUserID sets the "user" edge to the User entity by ID if the given value is not nil.

func (*AchievementUpdateOne) SetStatus

SetStatus sets the "status" field.

func (*AchievementUpdateOne) SetThumbnailImgURL

func (auo *AchievementUpdateOne) SetThumbnailImgURL(s string) *AchievementUpdateOne

SetThumbnailImgURL sets the "thumbnail_img_url" field.

func (*AchievementUpdateOne) SetUser

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

func (*AchievementUpdateOne) SetUserID

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

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

func (*AchievementUpdateOne) Where

Where appends a list predicates to the AchievementUpdate builder.

type Achievements

type Achievements []*Achievement

Achievements is a parsable slice of Achievement.

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 Article

type Article struct {

	// ID of the ent.
	ID int `json:"id,omitempty"`
	// ThumbnailImgURL holds the value of the "thumbnail_img_url" field.
	ThumbnailImgURL string `json:"thumbnail_img_url,omitempty"`
	// Title holds the value of the "title" field.
	Title string `json:"title,omitempty"`
	// Content holds the value of the "content" field.
	Content string `json:"content,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 ArticleQuery when eager-loading is set.
	Edges ArticleEdges `json:"edges"`
	// contains filtered or unexported fields
}

Article is the model entity for the Article schema.

func (*Article) QueryTags

func (a *Article) QueryTags() *TagQuery

QueryTags queries the "tags" edge of the Article entity.

func (*Article) String

func (a *Article) String() string

String implements the fmt.Stringer.

func (*Article) Unwrap

func (a *Article) Unwrap() *Article

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

func (a *Article) Update() *ArticleUpdateOne

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

type ArticleClient

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

ArticleClient is a client for the Article schema.

func NewArticleClient

func NewArticleClient(c config) *ArticleClient

NewArticleClient returns a client for the Article from the given config.

func (*ArticleClient) Create

func (c *ArticleClient) Create() *ArticleCreate

Create returns a builder for creating a Article entity.

func (*ArticleClient) CreateBulk

func (c *ArticleClient) CreateBulk(builders ...*ArticleCreate) *ArticleCreateBulk

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

func (*ArticleClient) Delete

func (c *ArticleClient) Delete() *ArticleDelete

Delete returns a delete builder for Article.

func (*ArticleClient) DeleteOne

func (c *ArticleClient) DeleteOne(a *Article) *ArticleDeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*ArticleClient) DeleteOneID

func (c *ArticleClient) DeleteOneID(id int) *ArticleDeleteOne

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

func (*ArticleClient) Get

func (c *ArticleClient) Get(ctx context.Context, id int) (*Article, error)

Get returns a Article entity by its id.

func (*ArticleClient) GetX

func (c *ArticleClient) GetX(ctx context.Context, id int) *Article

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

func (*ArticleClient) Hooks

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

Hooks returns the client hooks.

func (*ArticleClient) Intercept

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

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

func (*ArticleClient) Interceptors

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

Interceptors returns the client interceptors.

func (*ArticleClient) Query

func (c *ArticleClient) Query() *ArticleQuery

Query returns a query builder for Article.

func (*ArticleClient) QueryTags

func (c *ArticleClient) QueryTags(a *Article) *TagQuery

QueryTags queries the tags edge of a Article.

func (*ArticleClient) Update

func (c *ArticleClient) Update() *ArticleUpdate

Update returns an update builder for Article.

func (*ArticleClient) UpdateOne

func (c *ArticleClient) UpdateOne(a *Article) *ArticleUpdateOne

UpdateOne returns an update builder for the given entity.

func (*ArticleClient) UpdateOneID

func (c *ArticleClient) UpdateOneID(id int) *ArticleUpdateOne

UpdateOneID returns an update builder for the given id.

func (*ArticleClient) Use

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

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

type ArticleCreate

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

ArticleCreate is the builder for creating a Article entity.

func (*ArticleCreate) AddTagIDs

func (ac *ArticleCreate) AddTagIDs(ids ...int) *ArticleCreate

AddTagIDs adds the "tags" edge to the Tag entity by IDs.

func (*ArticleCreate) AddTags

func (ac *ArticleCreate) AddTags(t ...*Tag) *ArticleCreate

AddTags adds the "tags" edges to the Tag entity.

func (*ArticleCreate) Exec

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

Exec executes the query.

func (*ArticleCreate) ExecX

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

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

func (*ArticleCreate) Mutation

func (ac *ArticleCreate) Mutation() *ArticleMutation

Mutation returns the ArticleMutation object of the builder.

func (*ArticleCreate) Save

func (ac *ArticleCreate) Save(ctx context.Context) (*Article, error)

Save creates the Article in the database.

func (*ArticleCreate) SaveX

func (ac *ArticleCreate) SaveX(ctx context.Context) *Article

SaveX calls Save and panics if Save returns an error.

func (*ArticleCreate) SetContent

func (ac *ArticleCreate) SetContent(s string) *ArticleCreate

SetContent sets the "content" field.

func (*ArticleCreate) SetCreatedAt

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

SetCreatedAt sets the "created_at" field.

func (*ArticleCreate) SetNillableCreatedAt

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

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

func (*ArticleCreate) SetNillableThumbnailImgURL

func (ac *ArticleCreate) SetNillableThumbnailImgURL(s *string) *ArticleCreate

SetNillableThumbnailImgURL sets the "thumbnail_img_url" field if the given value is not nil.

func (*ArticleCreate) SetThumbnailImgURL

func (ac *ArticleCreate) SetThumbnailImgURL(s string) *ArticleCreate

SetThumbnailImgURL sets the "thumbnail_img_url" field.

func (*ArticleCreate) SetTitle

func (ac *ArticleCreate) SetTitle(s string) *ArticleCreate

SetTitle sets the "title" field.

type ArticleCreateBulk

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

ArticleCreateBulk is the builder for creating many Article entities in bulk.

func (*ArticleCreateBulk) Exec

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

Exec executes the query.

func (*ArticleCreateBulk) ExecX

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

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

func (*ArticleCreateBulk) Save

func (acb *ArticleCreateBulk) Save(ctx context.Context) ([]*Article, error)

Save creates the Article entities in the database.

func (*ArticleCreateBulk) SaveX

func (acb *ArticleCreateBulk) SaveX(ctx context.Context) []*Article

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

type ArticleDelete

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

ArticleDelete is the builder for deleting a Article entity.

func (*ArticleDelete) Exec

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

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

func (*ArticleDelete) ExecX

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

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

func (*ArticleDelete) Where

func (ad *ArticleDelete) Where(ps ...predicate.Article) *ArticleDelete

Where appends a list predicates to the ArticleDelete builder.

type ArticleDeleteOne

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

ArticleDeleteOne is the builder for deleting a single Article entity.

func (*ArticleDeleteOne) Exec

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

Exec executes the deletion query.

func (*ArticleDeleteOne) ExecX

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

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

func (*ArticleDeleteOne) Where

Where appends a list predicates to the ArticleDelete builder.

type ArticleEdges

type ArticleEdges struct {
	// Tags holds the value of the tags edge.
	Tags []*Tag `json:"tags,omitempty"`
	// contains filtered or unexported fields
}

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

func (ArticleEdges) TagsOrErr

func (e ArticleEdges) TagsOrErr() ([]*Tag, error)

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

type ArticleGroupBy

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

ArticleGroupBy is the group-by builder for Article entities.

func (*ArticleGroupBy) Aggregate

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

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

func (*ArticleGroupBy) Bool

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

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

func (*ArticleGroupBy) BoolX

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

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

func (*ArticleGroupBy) Bools

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

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

func (*ArticleGroupBy) BoolsX

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

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

func (*ArticleGroupBy) Float64

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

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

func (*ArticleGroupBy) Float64X

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

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

func (*ArticleGroupBy) Float64s

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

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

func (*ArticleGroupBy) Float64sX

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

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

func (*ArticleGroupBy) Int

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

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

func (*ArticleGroupBy) IntX

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

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

func (*ArticleGroupBy) Ints

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

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

func (*ArticleGroupBy) IntsX

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

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

func (*ArticleGroupBy) Scan

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

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

func (*ArticleGroupBy) ScanX

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

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

func (*ArticleGroupBy) String

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

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

func (*ArticleGroupBy) StringX

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

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

func (*ArticleGroupBy) Strings

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

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

func (*ArticleGroupBy) StringsX

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

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

type ArticleMutation

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

ArticleMutation represents an operation that mutates the Article nodes in the graph.

func (*ArticleMutation) AddField

func (m *ArticleMutation) 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 (*ArticleMutation) AddTagIDs

func (m *ArticleMutation) AddTagIDs(ids ...int)

AddTagIDs adds the "tags" edge to the Tag entity by ids.

func (*ArticleMutation) AddedEdges

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

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

func (*ArticleMutation) AddedField

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

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

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

func (*ArticleMutation) AddedIDs

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

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

func (*ArticleMutation) ClearEdge

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

func (m *ArticleMutation) 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 (*ArticleMutation) ClearTags

func (m *ArticleMutation) ClearTags()

ClearTags clears the "tags" edge to the Tag entity.

func (*ArticleMutation) ClearedEdges

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

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

func (*ArticleMutation) ClearedFields

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

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

func (ArticleMutation) Client

func (m ArticleMutation) 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 (*ArticleMutation) Content

func (m *ArticleMutation) Content() (r string, exists bool)

Content returns the value of the "content" field in the mutation.

func (*ArticleMutation) CreatedAt

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

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

func (*ArticleMutation) EdgeCleared

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

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

func (*ArticleMutation) Field

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

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

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

func (*ArticleMutation) Fields

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

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

func (m *ArticleMutation) 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 (*ArticleMutation) OldContent

func (m *ArticleMutation) OldContent(ctx context.Context) (v string, err error)

OldContent returns the old "content" field's value of the Article entity. If the Article 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 (*ArticleMutation) OldCreatedAt

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

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

func (m *ArticleMutation) 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 (*ArticleMutation) OldThumbnailImgURL

func (m *ArticleMutation) OldThumbnailImgURL(ctx context.Context) (v string, err error)

OldThumbnailImgURL returns the old "thumbnail_img_url" field's value of the Article entity. If the Article 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 (*ArticleMutation) OldTitle

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

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

func (m *ArticleMutation) Op() Op

Op returns the operation name.

func (*ArticleMutation) RemoveTagIDs

func (m *ArticleMutation) RemoveTagIDs(ids ...int)

RemoveTagIDs removes the "tags" edge to the Tag entity by IDs.

func (*ArticleMutation) RemovedEdges

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

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

func (*ArticleMutation) RemovedIDs

func (m *ArticleMutation) 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 (*ArticleMutation) RemovedTagsIDs

func (m *ArticleMutation) RemovedTagsIDs() (ids []int)

RemovedTags returns the removed IDs of the "tags" edge to the Tag entity.

func (*ArticleMutation) ResetContent

func (m *ArticleMutation) ResetContent()

ResetContent resets all changes to the "content" field.

func (*ArticleMutation) ResetCreatedAt

func (m *ArticleMutation) ResetCreatedAt()

ResetCreatedAt resets all changes to the "created_at" field.

func (*ArticleMutation) ResetEdge

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

func (m *ArticleMutation) 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 (*ArticleMutation) ResetTags

func (m *ArticleMutation) ResetTags()

ResetTags resets all changes to the "tags" edge.

func (*ArticleMutation) ResetThumbnailImgURL

func (m *ArticleMutation) ResetThumbnailImgURL()

ResetThumbnailImgURL resets all changes to the "thumbnail_img_url" field.

func (*ArticleMutation) ResetTitle

func (m *ArticleMutation) ResetTitle()

ResetTitle resets all changes to the "title" field.

func (*ArticleMutation) SetContent

func (m *ArticleMutation) SetContent(s string)

SetContent sets the "content" field.

func (*ArticleMutation) SetCreatedAt

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

SetCreatedAt sets the "created_at" field.

func (*ArticleMutation) SetField

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

func (m *ArticleMutation) SetOp(op Op)

SetOp allows setting the mutation operation.

func (*ArticleMutation) SetThumbnailImgURL

func (m *ArticleMutation) SetThumbnailImgURL(s string)

SetThumbnailImgURL sets the "thumbnail_img_url" field.

func (*ArticleMutation) SetTitle

func (m *ArticleMutation) SetTitle(s string)

SetTitle sets the "title" field.

func (*ArticleMutation) TagsCleared

func (m *ArticleMutation) TagsCleared() bool

TagsCleared reports if the "tags" edge to the Tag entity was cleared.

func (*ArticleMutation) TagsIDs

func (m *ArticleMutation) TagsIDs() (ids []int)

TagsIDs returns the "tags" edge IDs in the mutation.

func (*ArticleMutation) ThumbnailImgURL

func (m *ArticleMutation) ThumbnailImgURL() (r string, exists bool)

ThumbnailImgURL returns the value of the "thumbnail_img_url" field in the mutation.

func (*ArticleMutation) Title

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

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

func (ArticleMutation) Tx

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

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

func (*ArticleMutation) Type

func (m *ArticleMutation) Type() string

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

func (*ArticleMutation) Where

func (m *ArticleMutation) Where(ps ...predicate.Article)

Where appends a list predicates to the ArticleMutation builder.

func (*ArticleMutation) WhereP

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

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

type ArticleQuery

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

ArticleQuery is the builder for querying Article entities.

func (*ArticleQuery) Aggregate

func (aq *ArticleQuery) Aggregate(fns ...AggregateFunc) *ArticleSelect

Aggregate returns a ArticleSelect configured with the given aggregations.

func (*ArticleQuery) All

func (aq *ArticleQuery) All(ctx context.Context) ([]*Article, error)

All executes the query and returns a list of Articles.

func (*ArticleQuery) AllX

func (aq *ArticleQuery) AllX(ctx context.Context) []*Article

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

func (*ArticleQuery) Clone

func (aq *ArticleQuery) Clone() *ArticleQuery

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

func (*ArticleQuery) Count

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

Count returns the count of the given query.

func (*ArticleQuery) CountX

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

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

func (*ArticleQuery) Exist

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

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

func (*ArticleQuery) ExistX

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

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

func (*ArticleQuery) First

func (aq *ArticleQuery) First(ctx context.Context) (*Article, error)

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

func (*ArticleQuery) FirstID

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

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

func (*ArticleQuery) FirstIDX

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

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

func (*ArticleQuery) FirstX

func (aq *ArticleQuery) FirstX(ctx context.Context) *Article

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

func (*ArticleQuery) GroupBy

func (aq *ArticleQuery) GroupBy(field string, fields ...string) *ArticleGroupBy

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

client.Article.Query().
	GroupBy(article.FieldThumbnailImgURL).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*ArticleQuery) IDs

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

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

func (*ArticleQuery) IDsX

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

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

func (*ArticleQuery) Limit

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

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

func (*ArticleQuery) Offset

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

Offset to start from.

func (*ArticleQuery) Only

func (aq *ArticleQuery) Only(ctx context.Context) (*Article, error)

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

func (*ArticleQuery) OnlyID

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

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

func (*ArticleQuery) OnlyIDX

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

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

func (*ArticleQuery) OnlyX

func (aq *ArticleQuery) OnlyX(ctx context.Context) *Article

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

func (*ArticleQuery) Order

func (aq *ArticleQuery) Order(o ...OrderFunc) *ArticleQuery

Order specifies how the records should be ordered.

func (*ArticleQuery) QueryTags

func (aq *ArticleQuery) QueryTags() *TagQuery

QueryTags chains the current query on the "tags" edge.

func (*ArticleQuery) Select

func (aq *ArticleQuery) Select(fields ...string) *ArticleSelect

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

client.Article.Query().
	Select(article.FieldThumbnailImgURL).
	Scan(ctx, &v)

func (*ArticleQuery) Unique

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

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

func (aq *ArticleQuery) Where(ps ...predicate.Article) *ArticleQuery

Where adds a new predicate for the ArticleQuery builder.

func (*ArticleQuery) WithTags

func (aq *ArticleQuery) WithTags(opts ...func(*TagQuery)) *ArticleQuery

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

type ArticleSelect

type ArticleSelect struct {
	*ArticleQuery
	// contains filtered or unexported fields
}

ArticleSelect is the builder for selecting fields of Article entities.

func (*ArticleSelect) Aggregate

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

Aggregate adds the given aggregation functions to the selector query.

func (*ArticleSelect) Bool

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

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

func (*ArticleSelect) BoolX

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

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

func (*ArticleSelect) Bools

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

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

func (*ArticleSelect) BoolsX

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

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

func (*ArticleSelect) Float64

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

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

func (*ArticleSelect) Float64X

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

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

func (*ArticleSelect) Float64s

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

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

func (*ArticleSelect) Float64sX

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

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

func (*ArticleSelect) Int

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

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

func (*ArticleSelect) IntX

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

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

func (*ArticleSelect) Ints

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

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

func (*ArticleSelect) IntsX

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

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

func (*ArticleSelect) Scan

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

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

func (*ArticleSelect) ScanX

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

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

func (*ArticleSelect) String

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

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

func (*ArticleSelect) StringX

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

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

func (*ArticleSelect) Strings

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

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

func (*ArticleSelect) StringsX

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

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

type ArticleUpdate

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

ArticleUpdate is the builder for updating Article entities.

func (*ArticleUpdate) AddTagIDs

func (au *ArticleUpdate) AddTagIDs(ids ...int) *ArticleUpdate

AddTagIDs adds the "tags" edge to the Tag entity by IDs.

func (*ArticleUpdate) AddTags

func (au *ArticleUpdate) AddTags(t ...*Tag) *ArticleUpdate

AddTags adds the "tags" edges to the Tag entity.

func (*ArticleUpdate) ClearTags

func (au *ArticleUpdate) ClearTags() *ArticleUpdate

ClearTags clears all "tags" edges to the Tag entity.

func (*ArticleUpdate) Exec

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

Exec executes the query.

func (*ArticleUpdate) ExecX

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

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

func (*ArticleUpdate) Mutation

func (au *ArticleUpdate) Mutation() *ArticleMutation

Mutation returns the ArticleMutation object of the builder.

func (*ArticleUpdate) RemoveTagIDs

func (au *ArticleUpdate) RemoveTagIDs(ids ...int) *ArticleUpdate

RemoveTagIDs removes the "tags" edge to Tag entities by IDs.

func (*ArticleUpdate) RemoveTags

func (au *ArticleUpdate) RemoveTags(t ...*Tag) *ArticleUpdate

RemoveTags removes "tags" edges to Tag entities.

func (*ArticleUpdate) Save

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

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

func (*ArticleUpdate) SaveX

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

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

func (*ArticleUpdate) SetContent

func (au *ArticleUpdate) SetContent(s string) *ArticleUpdate

SetContent sets the "content" field.

func (*ArticleUpdate) SetCreatedAt

func (au *ArticleUpdate) SetCreatedAt(t time.Time) *ArticleUpdate

SetCreatedAt sets the "created_at" field.

func (*ArticleUpdate) SetNillableCreatedAt

func (au *ArticleUpdate) SetNillableCreatedAt(t *time.Time) *ArticleUpdate

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

func (*ArticleUpdate) SetNillableThumbnailImgURL

func (au *ArticleUpdate) SetNillableThumbnailImgURL(s *string) *ArticleUpdate

SetNillableThumbnailImgURL sets the "thumbnail_img_url" field if the given value is not nil.

func (*ArticleUpdate) SetThumbnailImgURL

func (au *ArticleUpdate) SetThumbnailImgURL(s string) *ArticleUpdate

SetThumbnailImgURL sets the "thumbnail_img_url" field.

func (*ArticleUpdate) SetTitle

func (au *ArticleUpdate) SetTitle(s string) *ArticleUpdate

SetTitle sets the "title" field.

func (*ArticleUpdate) Where

func (au *ArticleUpdate) Where(ps ...predicate.Article) *ArticleUpdate

Where appends a list predicates to the ArticleUpdate builder.

type ArticleUpdateOne

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

ArticleUpdateOne is the builder for updating a single Article entity.

func (*ArticleUpdateOne) AddTagIDs

func (auo *ArticleUpdateOne) AddTagIDs(ids ...int) *ArticleUpdateOne

AddTagIDs adds the "tags" edge to the Tag entity by IDs.

func (*ArticleUpdateOne) AddTags

func (auo *ArticleUpdateOne) AddTags(t ...*Tag) *ArticleUpdateOne

AddTags adds the "tags" edges to the Tag entity.

func (*ArticleUpdateOne) ClearTags

func (auo *ArticleUpdateOne) ClearTags() *ArticleUpdateOne

ClearTags clears all "tags" edges to the Tag entity.

func (*ArticleUpdateOne) Exec

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

Exec executes the query on the entity.

func (*ArticleUpdateOne) ExecX

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

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

func (*ArticleUpdateOne) Mutation

func (auo *ArticleUpdateOne) Mutation() *ArticleMutation

Mutation returns the ArticleMutation object of the builder.

func (*ArticleUpdateOne) RemoveTagIDs

func (auo *ArticleUpdateOne) RemoveTagIDs(ids ...int) *ArticleUpdateOne

RemoveTagIDs removes the "tags" edge to Tag entities by IDs.

func (*ArticleUpdateOne) RemoveTags

func (auo *ArticleUpdateOne) RemoveTags(t ...*Tag) *ArticleUpdateOne

RemoveTags removes "tags" edges to Tag entities.

func (*ArticleUpdateOne) Save

func (auo *ArticleUpdateOne) Save(ctx context.Context) (*Article, error)

Save executes the query and returns the updated Article entity.

func (*ArticleUpdateOne) SaveX

func (auo *ArticleUpdateOne) SaveX(ctx context.Context) *Article

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

func (*ArticleUpdateOne) Select

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

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

func (*ArticleUpdateOne) SetContent

func (auo *ArticleUpdateOne) SetContent(s string) *ArticleUpdateOne

SetContent sets the "content" field.

func (*ArticleUpdateOne) SetCreatedAt

func (auo *ArticleUpdateOne) SetCreatedAt(t time.Time) *ArticleUpdateOne

SetCreatedAt sets the "created_at" field.

func (*ArticleUpdateOne) SetNillableCreatedAt

func (auo *ArticleUpdateOne) SetNillableCreatedAt(t *time.Time) *ArticleUpdateOne

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

func (*ArticleUpdateOne) SetNillableThumbnailImgURL

func (auo *ArticleUpdateOne) SetNillableThumbnailImgURL(s *string) *ArticleUpdateOne

SetNillableThumbnailImgURL sets the "thumbnail_img_url" field if the given value is not nil.

func (*ArticleUpdateOne) SetThumbnailImgURL

func (auo *ArticleUpdateOne) SetThumbnailImgURL(s string) *ArticleUpdateOne

SetThumbnailImgURL sets the "thumbnail_img_url" field.

func (*ArticleUpdateOne) SetTitle

func (auo *ArticleUpdateOne) SetTitle(s string) *ArticleUpdateOne

SetTitle sets the "title" field.

func (*ArticleUpdateOne) Where

Where appends a list predicates to the ArticleUpdate builder.

type Articles

type Articles []*Article

Articles is a parsable slice of Article.

type BFPDataPoint

type BFPDataPoint struct {

	// ID of the ent.
	ID int `json:"id,omitempty"`
	// FatPercentage holds the value of the "fat_percentage" field.
	FatPercentage float64 `json:"fat_percentage,omitempty"`
	// TotalWeight holds the value of the "total_weight" field.
	TotalWeight int `json:"total_weight,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 BFPDataPointQuery when eager-loading is set.
	Edges BFPDataPointEdges `json:"edges"`
	// contains filtered or unexported fields
}

BFPDataPoint is the model entity for the BFPDataPoint schema.

func (*BFPDataPoint) QueryUser

func (bdp *BFPDataPoint) QueryUser() *UserQuery

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

func (*BFPDataPoint) String

func (bdp *BFPDataPoint) String() string

String implements the fmt.Stringer.

func (*BFPDataPoint) Unwrap

func (bdp *BFPDataPoint) Unwrap() *BFPDataPoint

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

func (bdp *BFPDataPoint) Update() *BFPDataPointUpdateOne

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

type BFPDataPointClient

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

BFPDataPointClient is a client for the BFPDataPoint schema.

func NewBFPDataPointClient

func NewBFPDataPointClient(c config) *BFPDataPointClient

NewBFPDataPointClient returns a client for the BFPDataPoint from the given config.

func (*BFPDataPointClient) Create

Create returns a builder for creating a BFPDataPoint entity.

func (*BFPDataPointClient) CreateBulk

func (c *BFPDataPointClient) CreateBulk(builders ...*BFPDataPointCreate) *BFPDataPointCreateBulk

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

func (*BFPDataPointClient) Delete

Delete returns a delete builder for BFPDataPoint.

func (*BFPDataPointClient) DeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*BFPDataPointClient) DeleteOneID

func (c *BFPDataPointClient) DeleteOneID(id int) *BFPDataPointDeleteOne

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

func (*BFPDataPointClient) Get

Get returns a BFPDataPoint entity by its id.

func (*BFPDataPointClient) GetX

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

func (*BFPDataPointClient) Hooks

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

Hooks returns the client hooks.

func (*BFPDataPointClient) Intercept

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

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

func (*BFPDataPointClient) Interceptors

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

Interceptors returns the client interceptors.

func (*BFPDataPointClient) Query

Query returns a query builder for BFPDataPoint.

func (*BFPDataPointClient) QueryUser

func (c *BFPDataPointClient) QueryUser(bdp *BFPDataPoint) *UserQuery

QueryUser queries the user edge of a BFPDataPoint.

func (*BFPDataPointClient) Update

Update returns an update builder for BFPDataPoint.

func (*BFPDataPointClient) UpdateOne

UpdateOne returns an update builder for the given entity.

func (*BFPDataPointClient) UpdateOneID

func (c *BFPDataPointClient) UpdateOneID(id int) *BFPDataPointUpdateOne

UpdateOneID returns an update builder for the given id.

func (*BFPDataPointClient) Use

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

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

type BFPDataPointCreate

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

BFPDataPointCreate is the builder for creating a BFPDataPoint entity.

func (*BFPDataPointCreate) Exec

func (bdpc *BFPDataPointCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*BFPDataPointCreate) ExecX

func (bdpc *BFPDataPointCreate) ExecX(ctx context.Context)

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

func (*BFPDataPointCreate) Mutation

func (bdpc *BFPDataPointCreate) Mutation() *BFPDataPointMutation

Mutation returns the BFPDataPointMutation object of the builder.

func (*BFPDataPointCreate) Save

func (bdpc *BFPDataPointCreate) Save(ctx context.Context) (*BFPDataPoint, error)

Save creates the BFPDataPoint in the database.

func (*BFPDataPointCreate) SaveX

func (bdpc *BFPDataPointCreate) SaveX(ctx context.Context) *BFPDataPoint

SaveX calls Save and panics if Save returns an error.

func (*BFPDataPointCreate) SetCreatedAt

func (bdpc *BFPDataPointCreate) SetCreatedAt(t time.Time) *BFPDataPointCreate

SetCreatedAt sets the "created_at" field.

func (*BFPDataPointCreate) SetFatPercentage

func (bdpc *BFPDataPointCreate) SetFatPercentage(f float64) *BFPDataPointCreate

SetFatPercentage sets the "fat_percentage" field.

func (*BFPDataPointCreate) SetNillableCreatedAt

func (bdpc *BFPDataPointCreate) SetNillableCreatedAt(t *time.Time) *BFPDataPointCreate

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

func (*BFPDataPointCreate) SetNillableUserID

func (bdpc *BFPDataPointCreate) SetNillableUserID(id *int) *BFPDataPointCreate

SetNillableUserID sets the "user" edge to the User entity by ID if the given value is not nil.

func (*BFPDataPointCreate) SetTotalWeight

func (bdpc *BFPDataPointCreate) SetTotalWeight(i int) *BFPDataPointCreate

SetTotalWeight sets the "total_weight" field.

func (*BFPDataPointCreate) SetUser

func (bdpc *BFPDataPointCreate) SetUser(u *User) *BFPDataPointCreate

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

func (*BFPDataPointCreate) SetUserID

func (bdpc *BFPDataPointCreate) SetUserID(id int) *BFPDataPointCreate

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

type BFPDataPointCreateBulk

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

BFPDataPointCreateBulk is the builder for creating many BFPDataPoint entities in bulk.

func (*BFPDataPointCreateBulk) Exec

func (bdpcb *BFPDataPointCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*BFPDataPointCreateBulk) ExecX

func (bdpcb *BFPDataPointCreateBulk) ExecX(ctx context.Context)

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

func (*BFPDataPointCreateBulk) Save

func (bdpcb *BFPDataPointCreateBulk) Save(ctx context.Context) ([]*BFPDataPoint, error)

Save creates the BFPDataPoint entities in the database.

func (*BFPDataPointCreateBulk) SaveX

func (bdpcb *BFPDataPointCreateBulk) SaveX(ctx context.Context) []*BFPDataPoint

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

type BFPDataPointDelete

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

BFPDataPointDelete is the builder for deleting a BFPDataPoint entity.

func (*BFPDataPointDelete) Exec

func (bdpd *BFPDataPointDelete) Exec(ctx context.Context) (int, error)

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

func (*BFPDataPointDelete) ExecX

func (bdpd *BFPDataPointDelete) ExecX(ctx context.Context) int

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

func (*BFPDataPointDelete) Where

Where appends a list predicates to the BFPDataPointDelete builder.

type BFPDataPointDeleteOne

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

BFPDataPointDeleteOne is the builder for deleting a single BFPDataPoint entity.

func (*BFPDataPointDeleteOne) Exec

func (bdpdo *BFPDataPointDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*BFPDataPointDeleteOne) ExecX

func (bdpdo *BFPDataPointDeleteOne) ExecX(ctx context.Context)

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

func (*BFPDataPointDeleteOne) Where

Where appends a list predicates to the BFPDataPointDelete builder.

type BFPDataPointEdges

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

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

func (BFPDataPointEdges) UserOrErr

func (e BFPDataPointEdges) 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 BFPDataPointGroupBy

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

BFPDataPointGroupBy is the group-by builder for BFPDataPoint entities.

func (*BFPDataPointGroupBy) Aggregate

func (bdpgb *BFPDataPointGroupBy) Aggregate(fns ...AggregateFunc) *BFPDataPointGroupBy

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

func (*BFPDataPointGroupBy) Bool

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

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

func (*BFPDataPointGroupBy) BoolX

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

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

func (*BFPDataPointGroupBy) Bools

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

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

func (*BFPDataPointGroupBy) BoolsX

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

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

func (*BFPDataPointGroupBy) Float64

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

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

func (*BFPDataPointGroupBy) Float64X

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

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

func (*BFPDataPointGroupBy) Float64s

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

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

func (*BFPDataPointGroupBy) Float64sX

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

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

func (*BFPDataPointGroupBy) Int

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

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

func (*BFPDataPointGroupBy) IntX

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

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

func (*BFPDataPointGroupBy) Ints

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

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

func (*BFPDataPointGroupBy) IntsX

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

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

func (*BFPDataPointGroupBy) Scan

func (bdpgb *BFPDataPointGroupBy) Scan(ctx context.Context, v any) error

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

func (*BFPDataPointGroupBy) ScanX

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

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

func (*BFPDataPointGroupBy) String

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

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

func (*BFPDataPointGroupBy) StringX

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

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

func (*BFPDataPointGroupBy) Strings

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

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

func (*BFPDataPointGroupBy) StringsX

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

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

type BFPDataPointMutation

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

BFPDataPointMutation represents an operation that mutates the BFPDataPoint nodes in the graph.

func (*BFPDataPointMutation) AddFatPercentage

func (m *BFPDataPointMutation) AddFatPercentage(f float64)

AddFatPercentage adds f to the "fat_percentage" field.

func (*BFPDataPointMutation) AddField

func (m *BFPDataPointMutation) 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 (*BFPDataPointMutation) AddTotalWeight

func (m *BFPDataPointMutation) AddTotalWeight(i int)

AddTotalWeight adds i to the "total_weight" field.

func (*BFPDataPointMutation) AddedEdges

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

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

func (*BFPDataPointMutation) AddedFatPercentage

func (m *BFPDataPointMutation) AddedFatPercentage() (r float64, exists bool)

AddedFatPercentage returns the value that was added to the "fat_percentage" field in this mutation.

func (*BFPDataPointMutation) AddedField

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

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

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

func (*BFPDataPointMutation) AddedIDs

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

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

func (*BFPDataPointMutation) AddedTotalWeight

func (m *BFPDataPointMutation) AddedTotalWeight() (r int, exists bool)

AddedTotalWeight returns the value that was added to the "total_weight" field in this mutation.

func (*BFPDataPointMutation) ClearEdge

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

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

func (m *BFPDataPointMutation) ClearUser()

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

func (*BFPDataPointMutation) ClearedEdges

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

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

func (*BFPDataPointMutation) ClearedFields

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

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

func (BFPDataPointMutation) Client

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

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

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

func (*BFPDataPointMutation) EdgeCleared

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

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

func (*BFPDataPointMutation) FatPercentage

func (m *BFPDataPointMutation) FatPercentage() (r float64, exists bool)

FatPercentage returns the value of the "fat_percentage" field in the mutation.

func (*BFPDataPointMutation) Field

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

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

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

func (*BFPDataPointMutation) Fields

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

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

func (m *BFPDataPointMutation) 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 (*BFPDataPointMutation) OldCreatedAt

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

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

func (m *BFPDataPointMutation) OldFatPercentage(ctx context.Context) (v float64, err error)

OldFatPercentage returns the old "fat_percentage" field's value of the BFPDataPoint entity. If the BFPDataPoint 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 (*BFPDataPointMutation) OldField

func (m *BFPDataPointMutation) 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 (*BFPDataPointMutation) OldTotalWeight

func (m *BFPDataPointMutation) OldTotalWeight(ctx context.Context) (v int, err error)

OldTotalWeight returns the old "total_weight" field's value of the BFPDataPoint entity. If the BFPDataPoint 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 (*BFPDataPointMutation) Op

func (m *BFPDataPointMutation) Op() Op

Op returns the operation name.

func (*BFPDataPointMutation) RemovedEdges

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

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

func (*BFPDataPointMutation) RemovedIDs

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

func (m *BFPDataPointMutation) ResetCreatedAt()

ResetCreatedAt resets all changes to the "created_at" field.

func (*BFPDataPointMutation) ResetEdge

func (m *BFPDataPointMutation) 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 (*BFPDataPointMutation) ResetFatPercentage

func (m *BFPDataPointMutation) ResetFatPercentage()

ResetFatPercentage resets all changes to the "fat_percentage" field.

func (*BFPDataPointMutation) ResetField

func (m *BFPDataPointMutation) 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 (*BFPDataPointMutation) ResetTotalWeight

func (m *BFPDataPointMutation) ResetTotalWeight()

ResetTotalWeight resets all changes to the "total_weight" field.

func (*BFPDataPointMutation) ResetUser

func (m *BFPDataPointMutation) ResetUser()

ResetUser resets all changes to the "user" edge.

func (*BFPDataPointMutation) SetCreatedAt

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

SetCreatedAt sets the "created_at" field.

func (*BFPDataPointMutation) SetFatPercentage

func (m *BFPDataPointMutation) SetFatPercentage(f float64)

SetFatPercentage sets the "fat_percentage" field.

func (*BFPDataPointMutation) SetField

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

func (m *BFPDataPointMutation) SetOp(op Op)

SetOp allows setting the mutation operation.

func (*BFPDataPointMutation) SetTotalWeight

func (m *BFPDataPointMutation) SetTotalWeight(i int)

SetTotalWeight sets the "total_weight" field.

func (*BFPDataPointMutation) SetUserID

func (m *BFPDataPointMutation) SetUserID(id int)

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

func (*BFPDataPointMutation) TotalWeight

func (m *BFPDataPointMutation) TotalWeight() (r int, exists bool)

TotalWeight returns the value of the "total_weight" field in the mutation.

func (BFPDataPointMutation) Tx

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

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

func (*BFPDataPointMutation) Type

func (m *BFPDataPointMutation) Type() string

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

func (*BFPDataPointMutation) UserCleared

func (m *BFPDataPointMutation) UserCleared() bool

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

func (*BFPDataPointMutation) UserID

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

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

func (*BFPDataPointMutation) UserIDs

func (m *BFPDataPointMutation) 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 (*BFPDataPointMutation) Where

Where appends a list predicates to the BFPDataPointMutation builder.

func (*BFPDataPointMutation) WhereP

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

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

type BFPDataPointQuery

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

BFPDataPointQuery is the builder for querying BFPDataPoint entities.

func (*BFPDataPointQuery) Aggregate

func (bdpq *BFPDataPointQuery) Aggregate(fns ...AggregateFunc) *BFPDataPointSelect

Aggregate returns a BFPDataPointSelect configured with the given aggregations.

func (*BFPDataPointQuery) All

func (bdpq *BFPDataPointQuery) All(ctx context.Context) ([]*BFPDataPoint, error)

All executes the query and returns a list of BFPDataPoints.

func (*BFPDataPointQuery) AllX

func (bdpq *BFPDataPointQuery) AllX(ctx context.Context) []*BFPDataPoint

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

func (*BFPDataPointQuery) Clone

func (bdpq *BFPDataPointQuery) Clone() *BFPDataPointQuery

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

func (*BFPDataPointQuery) Count

func (bdpq *BFPDataPointQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*BFPDataPointQuery) CountX

func (bdpq *BFPDataPointQuery) CountX(ctx context.Context) int

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

func (*BFPDataPointQuery) Exist

func (bdpq *BFPDataPointQuery) Exist(ctx context.Context) (bool, error)

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

func (*BFPDataPointQuery) ExistX

func (bdpq *BFPDataPointQuery) ExistX(ctx context.Context) bool

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

func (*BFPDataPointQuery) First

func (bdpq *BFPDataPointQuery) First(ctx context.Context) (*BFPDataPoint, error)

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

func (*BFPDataPointQuery) FirstID

func (bdpq *BFPDataPointQuery) FirstID(ctx context.Context) (id int, err error)

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

func (*BFPDataPointQuery) FirstIDX

func (bdpq *BFPDataPointQuery) FirstIDX(ctx context.Context) int

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

func (*BFPDataPointQuery) FirstX

func (bdpq *BFPDataPointQuery) FirstX(ctx context.Context) *BFPDataPoint

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

func (*BFPDataPointQuery) GroupBy

func (bdpq *BFPDataPointQuery) GroupBy(field string, fields ...string) *BFPDataPointGroupBy

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 {
	FatPercentage float64 `json:"fat_percentage,omitempty"`
	Count int `json:"count,omitempty"`
}

client.BFPDataPoint.Query().
	GroupBy(bfpdatapoint.FieldFatPercentage).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*BFPDataPointQuery) IDs

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

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

func (*BFPDataPointQuery) IDsX

func (bdpq *BFPDataPointQuery) IDsX(ctx context.Context) []int

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

func (*BFPDataPointQuery) Limit

func (bdpq *BFPDataPointQuery) Limit(limit int) *BFPDataPointQuery

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

func (*BFPDataPointQuery) Offset

func (bdpq *BFPDataPointQuery) Offset(offset int) *BFPDataPointQuery

Offset to start from.

func (*BFPDataPointQuery) Only

func (bdpq *BFPDataPointQuery) Only(ctx context.Context) (*BFPDataPoint, error)

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

func (*BFPDataPointQuery) OnlyID

func (bdpq *BFPDataPointQuery) OnlyID(ctx context.Context) (id int, err error)

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

func (*BFPDataPointQuery) OnlyIDX

func (bdpq *BFPDataPointQuery) OnlyIDX(ctx context.Context) int

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

func (*BFPDataPointQuery) OnlyX

func (bdpq *BFPDataPointQuery) OnlyX(ctx context.Context) *BFPDataPoint

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

func (*BFPDataPointQuery) Order

func (bdpq *BFPDataPointQuery) Order(o ...OrderFunc) *BFPDataPointQuery

Order specifies how the records should be ordered.

func (*BFPDataPointQuery) QueryUser

func (bdpq *BFPDataPointQuery) QueryUser() *UserQuery

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

func (*BFPDataPointQuery) Select

func (bdpq *BFPDataPointQuery) Select(fields ...string) *BFPDataPointSelect

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 {
	FatPercentage float64 `json:"fat_percentage,omitempty"`
}

client.BFPDataPoint.Query().
	Select(bfpdatapoint.FieldFatPercentage).
	Scan(ctx, &v)

func (*BFPDataPointQuery) Unique

func (bdpq *BFPDataPointQuery) Unique(unique bool) *BFPDataPointQuery

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

Where adds a new predicate for the BFPDataPointQuery builder.

func (*BFPDataPointQuery) WithUser

func (bdpq *BFPDataPointQuery) WithUser(opts ...func(*UserQuery)) *BFPDataPointQuery

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 BFPDataPointSelect

type BFPDataPointSelect struct {
	*BFPDataPointQuery
	// contains filtered or unexported fields
}

BFPDataPointSelect is the builder for selecting fields of BFPDataPoint entities.

func (*BFPDataPointSelect) Aggregate

func (bdps *BFPDataPointSelect) Aggregate(fns ...AggregateFunc) *BFPDataPointSelect

Aggregate adds the given aggregation functions to the selector query.

func (*BFPDataPointSelect) Bool

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

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

func (*BFPDataPointSelect) BoolX

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

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

func (*BFPDataPointSelect) Bools

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

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

func (*BFPDataPointSelect) BoolsX

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

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

func (*BFPDataPointSelect) Float64

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

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

func (*BFPDataPointSelect) Float64X

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

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

func (*BFPDataPointSelect) Float64s

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

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

func (*BFPDataPointSelect) Float64sX

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

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

func (*BFPDataPointSelect) Int

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

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

func (*BFPDataPointSelect) IntX

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

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

func (*BFPDataPointSelect) Ints

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

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

func (*BFPDataPointSelect) IntsX

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

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

func (*BFPDataPointSelect) Scan

func (bdps *BFPDataPointSelect) Scan(ctx context.Context, v any) error

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

func (*BFPDataPointSelect) ScanX

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

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

func (*BFPDataPointSelect) String

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

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

func (*BFPDataPointSelect) StringX

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

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

func (*BFPDataPointSelect) Strings

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

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

func (*BFPDataPointSelect) StringsX

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

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

type BFPDataPointUpdate

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

BFPDataPointUpdate is the builder for updating BFPDataPoint entities.

func (*BFPDataPointUpdate) AddFatPercentage

func (bdpu *BFPDataPointUpdate) AddFatPercentage(f float64) *BFPDataPointUpdate

AddFatPercentage adds f to the "fat_percentage" field.

func (*BFPDataPointUpdate) AddTotalWeight

func (bdpu *BFPDataPointUpdate) AddTotalWeight(i int) *BFPDataPointUpdate

AddTotalWeight adds i to the "total_weight" field.

func (*BFPDataPointUpdate) ClearUser

func (bdpu *BFPDataPointUpdate) ClearUser() *BFPDataPointUpdate

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

func (*BFPDataPointUpdate) Exec

func (bdpu *BFPDataPointUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*BFPDataPointUpdate) ExecX

func (bdpu *BFPDataPointUpdate) ExecX(ctx context.Context)

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

func (*BFPDataPointUpdate) Mutation

func (bdpu *BFPDataPointUpdate) Mutation() *BFPDataPointMutation

Mutation returns the BFPDataPointMutation object of the builder.

func (*BFPDataPointUpdate) Save

func (bdpu *BFPDataPointUpdate) Save(ctx context.Context) (int, error)

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

func (*BFPDataPointUpdate) SaveX

func (bdpu *BFPDataPointUpdate) SaveX(ctx context.Context) int

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

func (*BFPDataPointUpdate) SetCreatedAt

func (bdpu *BFPDataPointUpdate) SetCreatedAt(t time.Time) *BFPDataPointUpdate

SetCreatedAt sets the "created_at" field.

func (*BFPDataPointUpdate) SetFatPercentage

func (bdpu *BFPDataPointUpdate) SetFatPercentage(f float64) *BFPDataPointUpdate

SetFatPercentage sets the "fat_percentage" field.

func (*BFPDataPointUpdate) SetNillableCreatedAt

func (bdpu *BFPDataPointUpdate) SetNillableCreatedAt(t *time.Time) *BFPDataPointUpdate

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

func (*BFPDataPointUpdate) SetNillableUserID

func (bdpu *BFPDataPointUpdate) SetNillableUserID(id *int) *BFPDataPointUpdate

SetNillableUserID sets the "user" edge to the User entity by ID if the given value is not nil.

func (*BFPDataPointUpdate) SetTotalWeight

func (bdpu *BFPDataPointUpdate) SetTotalWeight(i int) *BFPDataPointUpdate

SetTotalWeight sets the "total_weight" field.

func (*BFPDataPointUpdate) SetUser

func (bdpu *BFPDataPointUpdate) SetUser(u *User) *BFPDataPointUpdate

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

func (*BFPDataPointUpdate) SetUserID

func (bdpu *BFPDataPointUpdate) SetUserID(id int) *BFPDataPointUpdate

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

func (*BFPDataPointUpdate) Where

Where appends a list predicates to the BFPDataPointUpdate builder.

type BFPDataPointUpdateOne

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

BFPDataPointUpdateOne is the builder for updating a single BFPDataPoint entity.

func (*BFPDataPointUpdateOne) AddFatPercentage

func (bdpuo *BFPDataPointUpdateOne) AddFatPercentage(f float64) *BFPDataPointUpdateOne

AddFatPercentage adds f to the "fat_percentage" field.

func (*BFPDataPointUpdateOne) AddTotalWeight

func (bdpuo *BFPDataPointUpdateOne) AddTotalWeight(i int) *BFPDataPointUpdateOne

AddTotalWeight adds i to the "total_weight" field.

func (*BFPDataPointUpdateOne) ClearUser

func (bdpuo *BFPDataPointUpdateOne) ClearUser() *BFPDataPointUpdateOne

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

func (*BFPDataPointUpdateOne) Exec

func (bdpuo *BFPDataPointUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*BFPDataPointUpdateOne) ExecX

func (bdpuo *BFPDataPointUpdateOne) ExecX(ctx context.Context)

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

func (*BFPDataPointUpdateOne) Mutation

func (bdpuo *BFPDataPointUpdateOne) Mutation() *BFPDataPointMutation

Mutation returns the BFPDataPointMutation object of the builder.

func (*BFPDataPointUpdateOne) Save

Save executes the query and returns the updated BFPDataPoint entity.

func (*BFPDataPointUpdateOne) SaveX

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

func (*BFPDataPointUpdateOne) Select

func (bdpuo *BFPDataPointUpdateOne) Select(field string, fields ...string) *BFPDataPointUpdateOne

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

func (*BFPDataPointUpdateOne) SetCreatedAt

func (bdpuo *BFPDataPointUpdateOne) SetCreatedAt(t time.Time) *BFPDataPointUpdateOne

SetCreatedAt sets the "created_at" field.

func (*BFPDataPointUpdateOne) SetFatPercentage

func (bdpuo *BFPDataPointUpdateOne) SetFatPercentage(f float64) *BFPDataPointUpdateOne

SetFatPercentage sets the "fat_percentage" field.

func (*BFPDataPointUpdateOne) SetNillableCreatedAt

func (bdpuo *BFPDataPointUpdateOne) SetNillableCreatedAt(t *time.Time) *BFPDataPointUpdateOne

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

func (*BFPDataPointUpdateOne) SetNillableUserID

func (bdpuo *BFPDataPointUpdateOne) SetNillableUserID(id *int) *BFPDataPointUpdateOne

SetNillableUserID sets the "user" edge to the User entity by ID if the given value is not nil.

func (*BFPDataPointUpdateOne) SetTotalWeight

func (bdpuo *BFPDataPointUpdateOne) SetTotalWeight(i int) *BFPDataPointUpdateOne

SetTotalWeight sets the "total_weight" field.

func (*BFPDataPointUpdateOne) SetUser

func (bdpuo *BFPDataPointUpdateOne) SetUser(u *User) *BFPDataPointUpdateOne

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

func (*BFPDataPointUpdateOne) SetUserID

func (bdpuo *BFPDataPointUpdateOne) SetUserID(id int) *BFPDataPointUpdateOne

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

func (*BFPDataPointUpdateOne) Where

Where appends a list predicates to the BFPDataPointUpdate builder.

type BFPDataPoints

type BFPDataPoints []*BFPDataPoint

BFPDataPoints is a parsable slice of BFPDataPoint.

type Client

type Client struct {

	// Schema is the client for creating, migrating and dropping schema.
	Schema *migrate.Schema
	// Achievement is the client for interacting with the Achievement builders.
	Achievement *AchievementClient
	// Article is the client for interacting with the Article builders.
	Article *ArticleClient
	// BFPDataPoint is the client for interacting with the BFPDataPoint builders.
	BFPDataPoint *BFPDataPointClient
	// Meal is the client for interacting with the Meal builders.
	Meal *MealClient
	// Tag is the client for interacting with the Tag builders.
	Tag *TagClient
	// 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().
	Achievement.
	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 Meal

type Meal struct {

	// ID of the ent.
	ID int `json:"id,omitempty"`
	// MealType holds the value of the "meal_type" field.
	MealType string `json:"meal_type,omitempty"`
	// ImageURL holds the value of the "image_url" field.
	ImageURL string `json:"image_url,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 MealQuery when eager-loading is set.
	Edges MealEdges `json:"edges"`
	// contains filtered or unexported fields
}

Meal is the model entity for the Meal schema.

func (*Meal) QueryUser

func (m *Meal) QueryUser() *UserQuery

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

func (*Meal) String

func (m *Meal) String() string

String implements the fmt.Stringer.

func (*Meal) Unwrap

func (m *Meal) Unwrap() *Meal

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

func (m *Meal) Update() *MealUpdateOne

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

type MealClient

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

MealClient is a client for the Meal schema.

func NewMealClient

func NewMealClient(c config) *MealClient

NewMealClient returns a client for the Meal from the given config.

func (*MealClient) Create

func (c *MealClient) Create() *MealCreate

Create returns a builder for creating a Meal entity.

func (*MealClient) CreateBulk

func (c *MealClient) CreateBulk(builders ...*MealCreate) *MealCreateBulk

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

func (*MealClient) Delete

func (c *MealClient) Delete() *MealDelete

Delete returns a delete builder for Meal.

func (*MealClient) DeleteOne

func (c *MealClient) DeleteOne(m *Meal) *MealDeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*MealClient) DeleteOneID

func (c *MealClient) DeleteOneID(id int) *MealDeleteOne

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

func (*MealClient) Get

func (c *MealClient) Get(ctx context.Context, id int) (*Meal, error)

Get returns a Meal entity by its id.

func (*MealClient) GetX

func (c *MealClient) GetX(ctx context.Context, id int) *Meal

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

func (*MealClient) Hooks

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

Hooks returns the client hooks.

func (*MealClient) Intercept

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

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

func (*MealClient) Interceptors

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

Interceptors returns the client interceptors.

func (*MealClient) Query

func (c *MealClient) Query() *MealQuery

Query returns a query builder for Meal.

func (*MealClient) QueryUser

func (c *MealClient) QueryUser(m *Meal) *UserQuery

QueryUser queries the user edge of a Meal.

func (*MealClient) Update

func (c *MealClient) Update() *MealUpdate

Update returns an update builder for Meal.

func (*MealClient) UpdateOne

func (c *MealClient) UpdateOne(m *Meal) *MealUpdateOne

UpdateOne returns an update builder for the given entity.

func (*MealClient) UpdateOneID

func (c *MealClient) UpdateOneID(id int) *MealUpdateOne

UpdateOneID returns an update builder for the given id.

func (*MealClient) Use

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

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

type MealCreate

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

MealCreate is the builder for creating a Meal entity.

func (*MealCreate) Exec

func (mc *MealCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*MealCreate) ExecX

func (mc *MealCreate) ExecX(ctx context.Context)

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

func (*MealCreate) Mutation

func (mc *MealCreate) Mutation() *MealMutation

Mutation returns the MealMutation object of the builder.

func (*MealCreate) Save

func (mc *MealCreate) Save(ctx context.Context) (*Meal, error)

Save creates the Meal in the database.

func (*MealCreate) SaveX

func (mc *MealCreate) SaveX(ctx context.Context) *Meal

SaveX calls Save and panics if Save returns an error.

func (*MealCreate) SetCreatedAt

func (mc *MealCreate) SetCreatedAt(t time.Time) *MealCreate

SetCreatedAt sets the "created_at" field.

func (*MealCreate) SetImageURL

func (mc *MealCreate) SetImageURL(s string) *MealCreate

SetImageURL sets the "image_url" field.

func (*MealCreate) SetMealType

func (mc *MealCreate) SetMealType(s string) *MealCreate

SetMealType sets the "meal_type" field.

func (*MealCreate) SetNillableCreatedAt

func (mc *MealCreate) SetNillableCreatedAt(t *time.Time) *MealCreate

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

func (*MealCreate) SetNillableImageURL

func (mc *MealCreate) SetNillableImageURL(s *string) *MealCreate

SetNillableImageURL sets the "image_url" field if the given value is not nil.

func (*MealCreate) SetNillableUserID

func (mc *MealCreate) SetNillableUserID(id *int) *MealCreate

SetNillableUserID sets the "user" edge to the User entity by ID if the given value is not nil.

func (*MealCreate) SetUser

func (mc *MealCreate) SetUser(u *User) *MealCreate

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

func (*MealCreate) SetUserID

func (mc *MealCreate) SetUserID(id int) *MealCreate

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

type MealCreateBulk

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

MealCreateBulk is the builder for creating many Meal entities in bulk.

func (*MealCreateBulk) Exec

func (mcb *MealCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*MealCreateBulk) ExecX

func (mcb *MealCreateBulk) ExecX(ctx context.Context)

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

func (*MealCreateBulk) Save

func (mcb *MealCreateBulk) Save(ctx context.Context) ([]*Meal, error)

Save creates the Meal entities in the database.

func (*MealCreateBulk) SaveX

func (mcb *MealCreateBulk) SaveX(ctx context.Context) []*Meal

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

type MealDelete

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

MealDelete is the builder for deleting a Meal entity.

func (*MealDelete) Exec

func (md *MealDelete) Exec(ctx context.Context) (int, error)

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

func (*MealDelete) ExecX

func (md *MealDelete) ExecX(ctx context.Context) int

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

func (*MealDelete) Where

func (md *MealDelete) Where(ps ...predicate.Meal) *MealDelete

Where appends a list predicates to the MealDelete builder.

type MealDeleteOne

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

MealDeleteOne is the builder for deleting a single Meal entity.

func (*MealDeleteOne) Exec

func (mdo *MealDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*MealDeleteOne) ExecX

func (mdo *MealDeleteOne) ExecX(ctx context.Context)

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

func (*MealDeleteOne) Where

func (mdo *MealDeleteOne) Where(ps ...predicate.Meal) *MealDeleteOne

Where appends a list predicates to the MealDelete builder.

type MealEdges

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

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

func (MealEdges) UserOrErr

func (e MealEdges) 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 MealGroupBy

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

MealGroupBy is the group-by builder for Meal entities.

func (*MealGroupBy) Aggregate

func (mgb *MealGroupBy) Aggregate(fns ...AggregateFunc) *MealGroupBy

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

func (*MealGroupBy) Bool

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

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

func (*MealGroupBy) BoolX

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

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

func (*MealGroupBy) Bools

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

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

func (*MealGroupBy) BoolsX

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

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

func (*MealGroupBy) Float64

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

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

func (*MealGroupBy) Float64X

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

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

func (*MealGroupBy) Float64s

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

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

func (*MealGroupBy) Float64sX

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

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

func (*MealGroupBy) Int

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

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

func (*MealGroupBy) IntX

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

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

func (*MealGroupBy) Ints

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

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

func (*MealGroupBy) IntsX

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

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

func (*MealGroupBy) Scan

func (mgb *MealGroupBy) Scan(ctx context.Context, v any) error

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

func (*MealGroupBy) ScanX

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

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

func (*MealGroupBy) String

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

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

func (*MealGroupBy) StringX

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

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

func (*MealGroupBy) Strings

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

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

func (*MealGroupBy) StringsX

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

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

type MealMutation

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

MealMutation represents an operation that mutates the Meal nodes in the graph.

func (*MealMutation) AddField

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

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

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

func (*MealMutation) AddedField

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

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

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

func (*MealMutation) AddedIDs

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

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

func (*MealMutation) ClearEdge

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

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

func (m *MealMutation) ClearUser()

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

func (*MealMutation) ClearedEdges

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

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

func (*MealMutation) ClearedFields

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

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

func (MealMutation) Client

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

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

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

func (*MealMutation) EdgeCleared

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

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

func (*MealMutation) Field

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

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

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

func (*MealMutation) Fields

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

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

func (m *MealMutation) 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 (*MealMutation) ImageURL

func (m *MealMutation) ImageURL() (r string, exists bool)

ImageURL returns the value of the "image_url" field in the mutation.

func (*MealMutation) MealType

func (m *MealMutation) MealType() (r string, exists bool)

MealType returns the value of the "meal_type" field in the mutation.

func (*MealMutation) OldCreatedAt

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

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

func (m *MealMutation) 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 (*MealMutation) OldImageURL

func (m *MealMutation) OldImageURL(ctx context.Context) (v string, err error)

OldImageURL returns the old "image_url" field's value of the Meal entity. If the Meal 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 (*MealMutation) OldMealType

func (m *MealMutation) OldMealType(ctx context.Context) (v string, err error)

OldMealType returns the old "meal_type" field's value of the Meal entity. If the Meal 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 (*MealMutation) Op

func (m *MealMutation) Op() Op

Op returns the operation name.

func (*MealMutation) RemovedEdges

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

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

func (*MealMutation) RemovedIDs

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

func (m *MealMutation) ResetCreatedAt()

ResetCreatedAt resets all changes to the "created_at" field.

func (*MealMutation) ResetEdge

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

func (m *MealMutation) 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 (*MealMutation) ResetImageURL

func (m *MealMutation) ResetImageURL()

ResetImageURL resets all changes to the "image_url" field.

func (*MealMutation) ResetMealType

func (m *MealMutation) ResetMealType()

ResetMealType resets all changes to the "meal_type" field.

func (*MealMutation) ResetUser

func (m *MealMutation) ResetUser()

ResetUser resets all changes to the "user" edge.

func (*MealMutation) SetCreatedAt

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

SetCreatedAt sets the "created_at" field.

func (*MealMutation) SetField

func (m *MealMutation) 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 (*MealMutation) SetImageURL

func (m *MealMutation) SetImageURL(s string)

SetImageURL sets the "image_url" field.

func (*MealMutation) SetMealType

func (m *MealMutation) SetMealType(s string)

SetMealType sets the "meal_type" field.

func (*MealMutation) SetOp

func (m *MealMutation) SetOp(op Op)

SetOp allows setting the mutation operation.

func (*MealMutation) SetUserID

func (m *MealMutation) SetUserID(id int)

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

func (MealMutation) Tx

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

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

func (*MealMutation) Type

func (m *MealMutation) Type() string

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

func (*MealMutation) UserCleared

func (m *MealMutation) UserCleared() bool

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

func (*MealMutation) UserID

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

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

func (*MealMutation) UserIDs

func (m *MealMutation) 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 (*MealMutation) Where

func (m *MealMutation) Where(ps ...predicate.Meal)

Where appends a list predicates to the MealMutation builder.

func (*MealMutation) WhereP

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

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

type MealQuery

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

MealQuery is the builder for querying Meal entities.

func (*MealQuery) Aggregate

func (mq *MealQuery) Aggregate(fns ...AggregateFunc) *MealSelect

Aggregate returns a MealSelect configured with the given aggregations.

func (*MealQuery) All

func (mq *MealQuery) All(ctx context.Context) ([]*Meal, error)

All executes the query and returns a list of Meals.

func (*MealQuery) AllX

func (mq *MealQuery) AllX(ctx context.Context) []*Meal

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

func (*MealQuery) Clone

func (mq *MealQuery) Clone() *MealQuery

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

func (*MealQuery) Count

func (mq *MealQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*MealQuery) CountX

func (mq *MealQuery) CountX(ctx context.Context) int

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

func (*MealQuery) Exist

func (mq *MealQuery) Exist(ctx context.Context) (bool, error)

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

func (*MealQuery) ExistX

func (mq *MealQuery) ExistX(ctx context.Context) bool

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

func (*MealQuery) First

func (mq *MealQuery) First(ctx context.Context) (*Meal, error)

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

func (*MealQuery) FirstID

func (mq *MealQuery) FirstID(ctx context.Context) (id int, err error)

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

func (*MealQuery) FirstIDX

func (mq *MealQuery) FirstIDX(ctx context.Context) int

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

func (*MealQuery) FirstX

func (mq *MealQuery) FirstX(ctx context.Context) *Meal

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

func (*MealQuery) GroupBy

func (mq *MealQuery) GroupBy(field string, fields ...string) *MealGroupBy

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

client.Meal.Query().
	GroupBy(meal.FieldMealType).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*MealQuery) IDs

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

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

func (*MealQuery) IDsX

func (mq *MealQuery) IDsX(ctx context.Context) []int

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

func (*MealQuery) Limit

func (mq *MealQuery) Limit(limit int) *MealQuery

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

func (*MealQuery) Offset

func (mq *MealQuery) Offset(offset int) *MealQuery

Offset to start from.

func (*MealQuery) Only

func (mq *MealQuery) Only(ctx context.Context) (*Meal, error)

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

func (*MealQuery) OnlyID

func (mq *MealQuery) OnlyID(ctx context.Context) (id int, err error)

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

func (*MealQuery) OnlyIDX

func (mq *MealQuery) OnlyIDX(ctx context.Context) int

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

func (*MealQuery) OnlyX

func (mq *MealQuery) OnlyX(ctx context.Context) *Meal

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

func (*MealQuery) Order

func (mq *MealQuery) Order(o ...OrderFunc) *MealQuery

Order specifies how the records should be ordered.

func (*MealQuery) QueryUser

func (mq *MealQuery) QueryUser() *UserQuery

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

func (*MealQuery) Select

func (mq *MealQuery) Select(fields ...string) *MealSelect

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

client.Meal.Query().
	Select(meal.FieldMealType).
	Scan(ctx, &v)

func (*MealQuery) Unique

func (mq *MealQuery) Unique(unique bool) *MealQuery

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

func (mq *MealQuery) Where(ps ...predicate.Meal) *MealQuery

Where adds a new predicate for the MealQuery builder.

func (*MealQuery) WithUser

func (mq *MealQuery) WithUser(opts ...func(*UserQuery)) *MealQuery

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 MealSelect

type MealSelect struct {
	*MealQuery
	// contains filtered or unexported fields
}

MealSelect is the builder for selecting fields of Meal entities.

func (*MealSelect) Aggregate

func (ms *MealSelect) Aggregate(fns ...AggregateFunc) *MealSelect

Aggregate adds the given aggregation functions to the selector query.

func (*MealSelect) Bool

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

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

func (*MealSelect) BoolX

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

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

func (*MealSelect) Bools

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

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

func (*MealSelect) BoolsX

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

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

func (*MealSelect) Float64

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

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

func (*MealSelect) Float64X

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

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

func (*MealSelect) Float64s

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

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

func (*MealSelect) Float64sX

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

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

func (*MealSelect) Int

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

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

func (*MealSelect) IntX

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

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

func (*MealSelect) Ints

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

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

func (*MealSelect) IntsX

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

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

func (*MealSelect) Scan

func (ms *MealSelect) Scan(ctx context.Context, v any) error

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

func (*MealSelect) ScanX

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

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

func (*MealSelect) String

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

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

func (*MealSelect) StringX

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

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

func (*MealSelect) Strings

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

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

func (*MealSelect) StringsX

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

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

type MealUpdate

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

MealUpdate is the builder for updating Meal entities.

func (*MealUpdate) ClearUser

func (mu *MealUpdate) ClearUser() *MealUpdate

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

func (*MealUpdate) Exec

func (mu *MealUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*MealUpdate) ExecX

func (mu *MealUpdate) ExecX(ctx context.Context)

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

func (*MealUpdate) Mutation

func (mu *MealUpdate) Mutation() *MealMutation

Mutation returns the MealMutation object of the builder.

func (*MealUpdate) Save

func (mu *MealUpdate) Save(ctx context.Context) (int, error)

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

func (*MealUpdate) SaveX

func (mu *MealUpdate) SaveX(ctx context.Context) int

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

func (*MealUpdate) SetCreatedAt

func (mu *MealUpdate) SetCreatedAt(t time.Time) *MealUpdate

SetCreatedAt sets the "created_at" field.

func (*MealUpdate) SetImageURL

func (mu *MealUpdate) SetImageURL(s string) *MealUpdate

SetImageURL sets the "image_url" field.

func (*MealUpdate) SetMealType

func (mu *MealUpdate) SetMealType(s string) *MealUpdate

SetMealType sets the "meal_type" field.

func (*MealUpdate) SetNillableCreatedAt

func (mu *MealUpdate) SetNillableCreatedAt(t *time.Time) *MealUpdate

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

func (*MealUpdate) SetNillableImageURL

func (mu *MealUpdate) SetNillableImageURL(s *string) *MealUpdate

SetNillableImageURL sets the "image_url" field if the given value is not nil.

func (*MealUpdate) SetNillableUserID

func (mu *MealUpdate) SetNillableUserID(id *int) *MealUpdate

SetNillableUserID sets the "user" edge to the User entity by ID if the given value is not nil.

func (*MealUpdate) SetUser

func (mu *MealUpdate) SetUser(u *User) *MealUpdate

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

func (*MealUpdate) SetUserID

func (mu *MealUpdate) SetUserID(id int) *MealUpdate

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

func (*MealUpdate) Where

func (mu *MealUpdate) Where(ps ...predicate.Meal) *MealUpdate

Where appends a list predicates to the MealUpdate builder.

type MealUpdateOne

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

MealUpdateOne is the builder for updating a single Meal entity.

func (*MealUpdateOne) ClearUser

func (muo *MealUpdateOne) ClearUser() *MealUpdateOne

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

func (*MealUpdateOne) Exec

func (muo *MealUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*MealUpdateOne) ExecX

func (muo *MealUpdateOne) ExecX(ctx context.Context)

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

func (*MealUpdateOne) Mutation

func (muo *MealUpdateOne) Mutation() *MealMutation

Mutation returns the MealMutation object of the builder.

func (*MealUpdateOne) Save

func (muo *MealUpdateOne) Save(ctx context.Context) (*Meal, error)

Save executes the query and returns the updated Meal entity.

func (*MealUpdateOne) SaveX

func (muo *MealUpdateOne) SaveX(ctx context.Context) *Meal

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

func (*MealUpdateOne) Select

func (muo *MealUpdateOne) Select(field string, fields ...string) *MealUpdateOne

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

func (*MealUpdateOne) SetCreatedAt

func (muo *MealUpdateOne) SetCreatedAt(t time.Time) *MealUpdateOne

SetCreatedAt sets the "created_at" field.

func (*MealUpdateOne) SetImageURL

func (muo *MealUpdateOne) SetImageURL(s string) *MealUpdateOne

SetImageURL sets the "image_url" field.

func (*MealUpdateOne) SetMealType

func (muo *MealUpdateOne) SetMealType(s string) *MealUpdateOne

SetMealType sets the "meal_type" field.

func (*MealUpdateOne) SetNillableCreatedAt

func (muo *MealUpdateOne) SetNillableCreatedAt(t *time.Time) *MealUpdateOne

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

func (*MealUpdateOne) SetNillableImageURL

func (muo *MealUpdateOne) SetNillableImageURL(s *string) *MealUpdateOne

SetNillableImageURL sets the "image_url" field if the given value is not nil.

func (*MealUpdateOne) SetNillableUserID

func (muo *MealUpdateOne) SetNillableUserID(id *int) *MealUpdateOne

SetNillableUserID sets the "user" edge to the User entity by ID if the given value is not nil.

func (*MealUpdateOne) SetUser

func (muo *MealUpdateOne) SetUser(u *User) *MealUpdateOne

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

func (*MealUpdateOne) SetUserID

func (muo *MealUpdateOne) SetUserID(id int) *MealUpdateOne

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

func (*MealUpdateOne) Where

func (muo *MealUpdateOne) Where(ps ...predicate.Meal) *MealUpdateOne

Where appends a list predicates to the MealUpdate builder.

type Meals

type Meals []*Meal

Meals is a parsable slice of Meal.

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.

func Asc

func Asc(fields ...string) OrderFunc

Asc applies the given fields in ASC order.

func Desc

func Desc(fields ...string) OrderFunc

Desc applies the given fields in DESC order.

type Policy

type Policy = ent.Policy

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

type Querier

type Querier = ent.Querier

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

type QuerierFunc

type QuerierFunc = ent.QuerierFunc

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

type Query

type Query = ent.Query

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

type QueryContext

type QueryContext = ent.QueryContext

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

type RollbackFunc

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

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

func (RollbackFunc) Rollback

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

Rollback calls f(ctx, m).

type RollbackHook

type RollbackHook func(Rollbacker) Rollbacker

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

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

type Rollbacker

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

Rollbacker is the interface that wraps the Rollback method.

type Tag

type Tag struct {

	// ID of the ent.
	ID int `json:"id,omitempty"`
	// TagName holds the value of the "tag_name" field.
	TagName string `json:"tag_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 TagQuery when eager-loading is set.
	Edges TagEdges `json:"edges"`
	// contains filtered or unexported fields
}

Tag is the model entity for the Tag schema.

func (*Tag) QueryArticle

func (t *Tag) QueryArticle() *ArticleQuery

QueryArticle queries the "article" edge of the Tag entity.

func (*Tag) String

func (t *Tag) String() string

String implements the fmt.Stringer.

func (*Tag) Unwrap

func (t *Tag) Unwrap() *Tag

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

func (t *Tag) Update() *TagUpdateOne

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

type TagClient

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

TagClient is a client for the Tag schema.

func NewTagClient

func NewTagClient(c config) *TagClient

NewTagClient returns a client for the Tag from the given config.

func (*TagClient) Create

func (c *TagClient) Create() *TagCreate

Create returns a builder for creating a Tag entity.

func (*TagClient) CreateBulk

func (c *TagClient) CreateBulk(builders ...*TagCreate) *TagCreateBulk

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

func (*TagClient) Delete

func (c *TagClient) Delete() *TagDelete

Delete returns a delete builder for Tag.

func (*TagClient) DeleteOne

func (c *TagClient) DeleteOne(t *Tag) *TagDeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*TagClient) DeleteOneID

func (c *TagClient) DeleteOneID(id int) *TagDeleteOne

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

func (*TagClient) Get

func (c *TagClient) Get(ctx context.Context, id int) (*Tag, error)

Get returns a Tag entity by its id.

func (*TagClient) GetX

func (c *TagClient) GetX(ctx context.Context, id int) *Tag

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

func (*TagClient) Hooks

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

Hooks returns the client hooks.

func (*TagClient) Intercept

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

Intercept adds a list of query interceptors to the interceptors stack. A call to `Intercept(f, g, h)` equals to `tag.Intercept(f(g(h())))`.

func (*TagClient) Interceptors

func (c *TagClient) Interceptors() []Interceptor

Interceptors returns the client interceptors.

func (*TagClient) Query

func (c *TagClient) Query() *TagQuery

Query returns a query builder for Tag.

func (*TagClient) QueryArticle

func (c *TagClient) QueryArticle(t *Tag) *ArticleQuery

QueryArticle queries the article edge of a Tag.

func (*TagClient) Update

func (c *TagClient) Update() *TagUpdate

Update returns an update builder for Tag.

func (*TagClient) UpdateOne

func (c *TagClient) UpdateOne(t *Tag) *TagUpdateOne

UpdateOne returns an update builder for the given entity.

func (*TagClient) UpdateOneID

func (c *TagClient) UpdateOneID(id int) *TagUpdateOne

UpdateOneID returns an update builder for the given id.

func (*TagClient) Use

func (c *TagClient) Use(hooks ...Hook)

Use adds a list of mutation hooks to the hooks stack. A call to `Use(f, g, h)` equals to `tag.Hooks(f(g(h())))`.

type TagCreate

type TagCreate struct {
	// contains filtered or unexported fields
}

TagCreate is the builder for creating a Tag entity.

func (*TagCreate) Exec

func (tc *TagCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*TagCreate) ExecX

func (tc *TagCreate) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*TagCreate) Mutation

func (tc *TagCreate) Mutation() *TagMutation

Mutation returns the TagMutation object of the builder.

func (*TagCreate) Save

func (tc *TagCreate) Save(ctx context.Context) (*Tag, error)

Save creates the Tag in the database.

func (*TagCreate) SaveX

func (tc *TagCreate) SaveX(ctx context.Context) *Tag

SaveX calls Save and panics if Save returns an error.

func (*TagCreate) SetArticle

func (tc *TagCreate) SetArticle(a *Article) *TagCreate

SetArticle sets the "article" edge to the Article entity.

func (*TagCreate) SetArticleID

func (tc *TagCreate) SetArticleID(id int) *TagCreate

SetArticleID sets the "article" edge to the Article entity by ID.

func (*TagCreate) SetCreatedAt

func (tc *TagCreate) SetCreatedAt(t time.Time) *TagCreate

SetCreatedAt sets the "created_at" field.

func (*TagCreate) SetNillableArticleID

func (tc *TagCreate) SetNillableArticleID(id *int) *TagCreate

SetNillableArticleID sets the "article" edge to the Article entity by ID if the given value is not nil.

func (*TagCreate) SetNillableCreatedAt

func (tc *TagCreate) SetNillableCreatedAt(t *time.Time) *TagCreate

SetNillableCreatedAt sets the "created_at" field if the given value is not nil.

func (*TagCreate) SetTagName

func (tc *TagCreate) SetTagName(s string) *TagCreate

SetTagName sets the "tag_name" field.

type TagCreateBulk

type TagCreateBulk struct {
	// contains filtered or unexported fields
}

TagCreateBulk is the builder for creating many Tag entities in bulk.

func (*TagCreateBulk) Exec

func (tcb *TagCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*TagCreateBulk) ExecX

func (tcb *TagCreateBulk) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*TagCreateBulk) Save

func (tcb *TagCreateBulk) Save(ctx context.Context) ([]*Tag, error)

Save creates the Tag entities in the database.

func (*TagCreateBulk) SaveX

func (tcb *TagCreateBulk) SaveX(ctx context.Context) []*Tag

SaveX is like Save, but panics if an error occurs.

type TagDelete

type TagDelete struct {
	// contains filtered or unexported fields
}

TagDelete is the builder for deleting a Tag entity.

func (*TagDelete) Exec

func (td *TagDelete) Exec(ctx context.Context) (int, error)

Exec executes the deletion query and returns how many vertices were deleted.

func (*TagDelete) ExecX

func (td *TagDelete) ExecX(ctx context.Context) int

ExecX is like Exec, but panics if an error occurs.

func (*TagDelete) Where

func (td *TagDelete) Where(ps ...predicate.Tag) *TagDelete

Where appends a list predicates to the TagDelete builder.

type TagDeleteOne

type TagDeleteOne struct {
	// contains filtered or unexported fields
}

TagDeleteOne is the builder for deleting a single Tag entity.

func (*TagDeleteOne) Exec

func (tdo *TagDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*TagDeleteOne) ExecX

func (tdo *TagDeleteOne) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*TagDeleteOne) Where

func (tdo *TagDeleteOne) Where(ps ...predicate.Tag) *TagDeleteOne

Where appends a list predicates to the TagDelete builder.

type TagEdges

type TagEdges struct {
	// Article holds the value of the article edge.
	Article *Article `json:"article,omitempty"`
	// contains filtered or unexported fields
}

TagEdges holds the relations/edges for other nodes in the graph.

func (TagEdges) ArticleOrErr

func (e TagEdges) ArticleOrErr() (*Article, error)

ArticleOrErr returns the Article value or an error if the edge was not loaded in eager-loading, or loaded but was not found.

type TagGroupBy

type TagGroupBy struct {
	// contains filtered or unexported fields
}

TagGroupBy is the group-by builder for Tag entities.

func (*TagGroupBy) Aggregate

func (tgb *TagGroupBy) Aggregate(fns ...AggregateFunc) *TagGroupBy

Aggregate adds the given aggregation functions to the group-by query.

func (*TagGroupBy) Bool

func (s *TagGroupBy) Bool(ctx context.Context) (_ bool, err error)

Bool returns a single bool from a selector. It is only allowed when selecting one field.

func (*TagGroupBy) BoolX

func (s *TagGroupBy) BoolX(ctx context.Context) bool

BoolX is like Bool, but panics if an error occurs.

func (*TagGroupBy) Bools

func (s *TagGroupBy) Bools(ctx context.Context) ([]bool, error)

Bools returns list of bools from a selector. It is only allowed when selecting one field.

func (*TagGroupBy) BoolsX

func (s *TagGroupBy) BoolsX(ctx context.Context) []bool

BoolsX is like Bools, but panics if an error occurs.

func (*TagGroupBy) Float64

func (s *TagGroupBy) Float64(ctx context.Context) (_ float64, err error)

Float64 returns a single float64 from a selector. It is only allowed when selecting one field.

func (*TagGroupBy) Float64X

func (s *TagGroupBy) Float64X(ctx context.Context) float64

Float64X is like Float64, but panics if an error occurs.

func (*TagGroupBy) Float64s

func (s *TagGroupBy) Float64s(ctx context.Context) ([]float64, error)

Float64s returns list of float64s from a selector. It is only allowed when selecting one field.

func (*TagGroupBy) Float64sX

func (s *TagGroupBy) Float64sX(ctx context.Context) []float64

Float64sX is like Float64s, but panics if an error occurs.

func (*TagGroupBy) Int

func (s *TagGroupBy) Int(ctx context.Context) (_ int, err error)

Int returns a single int from a selector. It is only allowed when selecting one field.

func (*TagGroupBy) IntX

func (s *TagGroupBy) IntX(ctx context.Context) int

IntX is like Int, but panics if an error occurs.

func (*TagGroupBy) Ints

func (s *TagGroupBy) Ints(ctx context.Context) ([]int, error)

Ints returns list of ints from a selector. It is only allowed when selecting one field.

func (*TagGroupBy) IntsX

func (s *TagGroupBy) IntsX(ctx context.Context) []int

IntsX is like Ints, but panics if an error occurs.

func (*TagGroupBy) Scan

func (tgb *TagGroupBy) Scan(ctx context.Context, v any) error

Scan applies the selector query and scans the result into the given value.

func (*TagGroupBy) ScanX

func (s *TagGroupBy) ScanX(ctx context.Context, v any)

ScanX is like Scan, but panics if an error occurs.

func (*TagGroupBy) String

func (s *TagGroupBy) String(ctx context.Context) (_ string, err error)

String returns a single string from a selector. It is only allowed when selecting one field.

func (*TagGroupBy) StringX

func (s *TagGroupBy) StringX(ctx context.Context) string

StringX is like String, but panics if an error occurs.

func (*TagGroupBy) Strings

func (s *TagGroupBy) Strings(ctx context.Context) ([]string, error)

Strings returns list of strings from a selector. It is only allowed when selecting one field.

func (*TagGroupBy) StringsX

func (s *TagGroupBy) StringsX(ctx context.Context) []string

StringsX is like Strings, but panics if an error occurs.

type TagMutation

type TagMutation struct {
	// contains filtered or unexported fields
}

TagMutation represents an operation that mutates the Tag nodes in the graph.

func (*TagMutation) AddField

func (m *TagMutation) 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 (*TagMutation) AddedEdges

func (m *TagMutation) AddedEdges() []string

AddedEdges returns all edge names that were set/added in this mutation.

func (*TagMutation) AddedField

func (m *TagMutation) 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 (*TagMutation) AddedFields

func (m *TagMutation) AddedFields() []string

AddedFields returns all numeric fields that were incremented/decremented during this mutation.

func (*TagMutation) AddedIDs

func (m *TagMutation) AddedIDs(name string) []ent.Value

AddedIDs returns all IDs (to other nodes) that were added for the given edge name in this mutation.

func (*TagMutation) ArticleCleared

func (m *TagMutation) ArticleCleared() bool

ArticleCleared reports if the "article" edge to the Article entity was cleared.

func (*TagMutation) ArticleID

func (m *TagMutation) ArticleID() (id int, exists bool)

ArticleID returns the "article" edge ID in the mutation.

func (*TagMutation) ArticleIDs

func (m *TagMutation) ArticleIDs() (ids []int)

ArticleIDs returns the "article" edge IDs in the mutation. Note that IDs always returns len(IDs) <= 1 for unique edges, and you should use ArticleID instead. It exists only for internal usage by the builders.

func (*TagMutation) ClearArticle

func (m *TagMutation) ClearArticle()

ClearArticle clears the "article" edge to the Article entity.

func (*TagMutation) ClearEdge

func (m *TagMutation) 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 (*TagMutation) ClearField

func (m *TagMutation) 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 (*TagMutation) ClearedEdges

func (m *TagMutation) ClearedEdges() []string

ClearedEdges returns all edge names that were cleared in this mutation.

func (*TagMutation) ClearedFields

func (m *TagMutation) ClearedFields() []string

ClearedFields returns all nullable fields that were cleared during this mutation.

func (TagMutation) Client

func (m TagMutation) 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 (*TagMutation) CreatedAt

func (m *TagMutation) CreatedAt() (r time.Time, exists bool)

CreatedAt returns the value of the "created_at" field in the mutation.

func (*TagMutation) EdgeCleared

func (m *TagMutation) EdgeCleared(name string) bool

EdgeCleared returns a boolean which indicates if the edge with the given name was cleared in this mutation.

func (*TagMutation) Field

func (m *TagMutation) 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 (*TagMutation) FieldCleared

func (m *TagMutation) FieldCleared(name string) bool

FieldCleared returns a boolean indicating if a field with the given name was cleared in this mutation.

func (*TagMutation) Fields

func (m *TagMutation) 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 (*TagMutation) ID

func (m *TagMutation) 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 (*TagMutation) IDs

func (m *TagMutation) 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 (*TagMutation) OldCreatedAt

func (m *TagMutation) OldCreatedAt(ctx context.Context) (v time.Time, err error)

OldCreatedAt returns the old "created_at" field's value of the Tag entity. If the Tag 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 (*TagMutation) OldField

func (m *TagMutation) 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 (*TagMutation) OldTagName

func (m *TagMutation) OldTagName(ctx context.Context) (v string, err error)

OldTagName returns the old "tag_name" field's value of the Tag entity. If the Tag 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 (*TagMutation) Op

func (m *TagMutation) Op() Op

Op returns the operation name.

func (*TagMutation) RemovedEdges

func (m *TagMutation) RemovedEdges() []string

RemovedEdges returns all edge names that were removed in this mutation.

func (*TagMutation) RemovedIDs

func (m *TagMutation) 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 (*TagMutation) ResetArticle

func (m *TagMutation) ResetArticle()

ResetArticle resets all changes to the "article" edge.

func (*TagMutation) ResetCreatedAt

func (m *TagMutation) ResetCreatedAt()

ResetCreatedAt resets all changes to the "created_at" field.

func (*TagMutation) ResetEdge

func (m *TagMutation) 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 (*TagMutation) ResetField

func (m *TagMutation) 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 (*TagMutation) ResetTagName

func (m *TagMutation) ResetTagName()

ResetTagName resets all changes to the "tag_name" field.

func (*TagMutation) SetArticleID

func (m *TagMutation) SetArticleID(id int)

SetArticleID sets the "article" edge to the Article entity by id.

func (*TagMutation) SetCreatedAt

func (m *TagMutation) SetCreatedAt(t time.Time)

SetCreatedAt sets the "created_at" field.

func (*TagMutation) SetField

func (m *TagMutation) 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 (*TagMutation) SetOp

func (m *TagMutation) SetOp(op Op)

SetOp allows setting the mutation operation.

func (*TagMutation) SetTagName

func (m *TagMutation) SetTagName(s string)

SetTagName sets the "tag_name" field.

func (*TagMutation) TagName

func (m *TagMutation) TagName() (r string, exists bool)

TagName returns the value of the "tag_name" field in the mutation.

func (TagMutation) Tx

func (m TagMutation) Tx() (*Tx, error)

Tx returns an `ent.Tx` for mutations that were executed in transactions; it returns an error otherwise.

func (*TagMutation) Type

func (m *TagMutation) Type() string

Type returns the node type of this mutation (Tag).

func (*TagMutation) Where

func (m *TagMutation) Where(ps ...predicate.Tag)

Where appends a list predicates to the TagMutation builder.

func (*TagMutation) WhereP

func (m *TagMutation) WhereP(ps ...func(*sql.Selector))

WhereP appends storage-level predicates to the TagMutation builder. Using this method, users can use type-assertion to append predicates that do not depend on any generated package.

type TagQuery

type TagQuery struct {
	// contains filtered or unexported fields
}

TagQuery is the builder for querying Tag entities.

func (*TagQuery) Aggregate

func (tq *TagQuery) Aggregate(fns ...AggregateFunc) *TagSelect

Aggregate returns a TagSelect configured with the given aggregations.

func (*TagQuery) All

func (tq *TagQuery) All(ctx context.Context) ([]*Tag, error)

All executes the query and returns a list of Tags.

func (*TagQuery) AllX

func (tq *TagQuery) AllX(ctx context.Context) []*Tag

AllX is like All, but panics if an error occurs.

func (*TagQuery) Clone

func (tq *TagQuery) Clone() *TagQuery

Clone returns a duplicate of the TagQuery builder, including all associated steps. It can be used to prepare common query builders and use them differently after the clone is made.

func (*TagQuery) Count

func (tq *TagQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*TagQuery) CountX

func (tq *TagQuery) CountX(ctx context.Context) int

CountX is like Count, but panics if an error occurs.

func (*TagQuery) Exist

func (tq *TagQuery) Exist(ctx context.Context) (bool, error)

Exist returns true if the query has elements in the graph.

func (*TagQuery) ExistX

func (tq *TagQuery) ExistX(ctx context.Context) bool

ExistX is like Exist, but panics if an error occurs.

func (*TagQuery) First

func (tq *TagQuery) First(ctx context.Context) (*Tag, error)

First returns the first Tag entity from the query. Returns a *NotFoundError when no Tag was found.

func (*TagQuery) FirstID

func (tq *TagQuery) FirstID(ctx context.Context) (id int, err error)

FirstID returns the first Tag ID from the query. Returns a *NotFoundError when no Tag ID was found.

func (*TagQuery) FirstIDX

func (tq *TagQuery) FirstIDX(ctx context.Context) int

FirstIDX is like FirstID, but panics if an error occurs.

func (*TagQuery) FirstX

func (tq *TagQuery) FirstX(ctx context.Context) *Tag

FirstX is like First, but panics if an error occurs.

func (*TagQuery) GroupBy

func (tq *TagQuery) GroupBy(field string, fields ...string) *TagGroupBy

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 {
	TagName string `json:"tag_name,omitempty"`
	Count int `json:"count,omitempty"`
}

client.Tag.Query().
	GroupBy(tag.FieldTagName).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*TagQuery) IDs

func (tq *TagQuery) IDs(ctx context.Context) (ids []int, err error)

IDs executes the query and returns a list of Tag IDs.

func (*TagQuery) IDsX

func (tq *TagQuery) IDsX(ctx context.Context) []int

IDsX is like IDs, but panics if an error occurs.

func (*TagQuery) Limit

func (tq *TagQuery) Limit(limit int) *TagQuery

Limit the number of records to be returned by this query.

func (*TagQuery) Offset

func (tq *TagQuery) Offset(offset int) *TagQuery

Offset to start from.

func (*TagQuery) Only

func (tq *TagQuery) Only(ctx context.Context) (*Tag, error)

Only returns a single Tag entity found by the query, ensuring it only returns one. Returns a *NotSingularError when more than one Tag entity is found. Returns a *NotFoundError when no Tag entities are found.

func (*TagQuery) OnlyID

func (tq *TagQuery) OnlyID(ctx context.Context) (id int, err error)

OnlyID is like Only, but returns the only Tag ID in the query. Returns a *NotSingularError when more than one Tag ID is found. Returns a *NotFoundError when no entities are found.

func (*TagQuery) OnlyIDX

func (tq *TagQuery) OnlyIDX(ctx context.Context) int

OnlyIDX is like OnlyID, but panics if an error occurs.

func (*TagQuery) OnlyX

func (tq *TagQuery) OnlyX(ctx context.Context) *Tag

OnlyX is like Only, but panics if an error occurs.

func (*TagQuery) Order

func (tq *TagQuery) Order(o ...OrderFunc) *TagQuery

Order specifies how the records should be ordered.

func (*TagQuery) QueryArticle

func (tq *TagQuery) QueryArticle() *ArticleQuery

QueryArticle chains the current query on the "article" edge.

func (*TagQuery) Select

func (tq *TagQuery) Select(fields ...string) *TagSelect

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 {
	TagName string `json:"tag_name,omitempty"`
}

client.Tag.Query().
	Select(tag.FieldTagName).
	Scan(ctx, &v)

func (*TagQuery) Unique

func (tq *TagQuery) Unique(unique bool) *TagQuery

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 (*TagQuery) Where

func (tq *TagQuery) Where(ps ...predicate.Tag) *TagQuery

Where adds a new predicate for the TagQuery builder.

func (*TagQuery) WithArticle

func (tq *TagQuery) WithArticle(opts ...func(*ArticleQuery)) *TagQuery

WithArticle tells the query-builder to eager-load the nodes that are connected to the "article" edge. The optional arguments are used to configure the query builder of the edge.

type TagSelect

type TagSelect struct {
	*TagQuery
	// contains filtered or unexported fields
}

TagSelect is the builder for selecting fields of Tag entities.

func (*TagSelect) Aggregate

func (ts *TagSelect) Aggregate(fns ...AggregateFunc) *TagSelect

Aggregate adds the given aggregation functions to the selector query.

func (*TagSelect) Bool

func (s *TagSelect) Bool(ctx context.Context) (_ bool, err error)

Bool returns a single bool from a selector. It is only allowed when selecting one field.

func (*TagSelect) BoolX

func (s *TagSelect) BoolX(ctx context.Context) bool

BoolX is like Bool, but panics if an error occurs.

func (*TagSelect) Bools

func (s *TagSelect) Bools(ctx context.Context) ([]bool, error)

Bools returns list of bools from a selector. It is only allowed when selecting one field.

func (*TagSelect) BoolsX

func (s *TagSelect) BoolsX(ctx context.Context) []bool

BoolsX is like Bools, but panics if an error occurs.

func (*TagSelect) Float64

func (s *TagSelect) Float64(ctx context.Context) (_ float64, err error)

Float64 returns a single float64 from a selector. It is only allowed when selecting one field.

func (*TagSelect) Float64X

func (s *TagSelect) Float64X(ctx context.Context) float64

Float64X is like Float64, but panics if an error occurs.

func (*TagSelect) Float64s

func (s *TagSelect) Float64s(ctx context.Context) ([]float64, error)

Float64s returns list of float64s from a selector. It is only allowed when selecting one field.

func (*TagSelect) Float64sX

func (s *TagSelect) Float64sX(ctx context.Context) []float64

Float64sX is like Float64s, but panics if an error occurs.

func (*TagSelect) Int

func (s *TagSelect) Int(ctx context.Context) (_ int, err error)

Int returns a single int from a selector. It is only allowed when selecting one field.

func (*TagSelect) IntX

func (s *TagSelect) IntX(ctx context.Context) int

IntX is like Int, but panics if an error occurs.

func (*TagSelect) Ints

func (s *TagSelect) Ints(ctx context.Context) ([]int, error)

Ints returns list of ints from a selector. It is only allowed when selecting one field.

func (*TagSelect) IntsX

func (s *TagSelect) IntsX(ctx context.Context) []int

IntsX is like Ints, but panics if an error occurs.

func (*TagSelect) Scan

func (ts *TagSelect) Scan(ctx context.Context, v any) error

Scan applies the selector query and scans the result into the given value.

func (*TagSelect) ScanX

func (s *TagSelect) ScanX(ctx context.Context, v any)

ScanX is like Scan, but panics if an error occurs.

func (*TagSelect) String

func (s *TagSelect) String(ctx context.Context) (_ string, err error)

String returns a single string from a selector. It is only allowed when selecting one field.

func (*TagSelect) StringX

func (s *TagSelect) StringX(ctx context.Context) string

StringX is like String, but panics if an error occurs.

func (*TagSelect) Strings

func (s *TagSelect) Strings(ctx context.Context) ([]string, error)

Strings returns list of strings from a selector. It is only allowed when selecting one field.

func (*TagSelect) StringsX

func (s *TagSelect) StringsX(ctx context.Context) []string

StringsX is like Strings, but panics if an error occurs.

type TagUpdate

type TagUpdate struct {
	// contains filtered or unexported fields
}

TagUpdate is the builder for updating Tag entities.

func (*TagUpdate) ClearArticle

func (tu *TagUpdate) ClearArticle() *TagUpdate

ClearArticle clears the "article" edge to the Article entity.

func (*TagUpdate) Exec

func (tu *TagUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*TagUpdate) ExecX

func (tu *TagUpdate) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*TagUpdate) Mutation

func (tu *TagUpdate) Mutation() *TagMutation

Mutation returns the TagMutation object of the builder.

func (*TagUpdate) Save

func (tu *TagUpdate) Save(ctx context.Context) (int, error)

Save executes the query and returns the number of nodes affected by the update operation.

func (*TagUpdate) SaveX

func (tu *TagUpdate) SaveX(ctx context.Context) int

SaveX is like Save, but panics if an error occurs.

func (*TagUpdate) SetArticle

func (tu *TagUpdate) SetArticle(a *Article) *TagUpdate

SetArticle sets the "article" edge to the Article entity.

func (*TagUpdate) SetArticleID

func (tu *TagUpdate) SetArticleID(id int) *TagUpdate

SetArticleID sets the "article" edge to the Article entity by ID.

func (*TagUpdate) SetCreatedAt

func (tu *TagUpdate) SetCreatedAt(t time.Time) *TagUpdate

SetCreatedAt sets the "created_at" field.

func (*TagUpdate) SetNillableArticleID

func (tu *TagUpdate) SetNillableArticleID(id *int) *TagUpdate

SetNillableArticleID sets the "article" edge to the Article entity by ID if the given value is not nil.

func (*TagUpdate) SetNillableCreatedAt

func (tu *TagUpdate) SetNillableCreatedAt(t *time.Time) *TagUpdate

SetNillableCreatedAt sets the "created_at" field if the given value is not nil.

func (*TagUpdate) SetTagName

func (tu *TagUpdate) SetTagName(s string) *TagUpdate

SetTagName sets the "tag_name" field.

func (*TagUpdate) Where

func (tu *TagUpdate) Where(ps ...predicate.Tag) *TagUpdate

Where appends a list predicates to the TagUpdate builder.

type TagUpdateOne

type TagUpdateOne struct {
	// contains filtered or unexported fields
}

TagUpdateOne is the builder for updating a single Tag entity.

func (*TagUpdateOne) ClearArticle

func (tuo *TagUpdateOne) ClearArticle() *TagUpdateOne

ClearArticle clears the "article" edge to the Article entity.

func (*TagUpdateOne) Exec

func (tuo *TagUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*TagUpdateOne) ExecX

func (tuo *TagUpdateOne) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*TagUpdateOne) Mutation

func (tuo *TagUpdateOne) Mutation() *TagMutation

Mutation returns the TagMutation object of the builder.

func (*TagUpdateOne) Save

func (tuo *TagUpdateOne) Save(ctx context.Context) (*Tag, error)

Save executes the query and returns the updated Tag entity.

func (*TagUpdateOne) SaveX

func (tuo *TagUpdateOne) SaveX(ctx context.Context) *Tag

SaveX is like Save, but panics if an error occurs.

func (*TagUpdateOne) Select

func (tuo *TagUpdateOne) Select(field string, fields ...string) *TagUpdateOne

Select allows selecting one or more fields (columns) of the returned entity. The default is selecting all fields defined in the entity schema.

func (*TagUpdateOne) SetArticle

func (tuo *TagUpdateOne) SetArticle(a *Article) *TagUpdateOne

SetArticle sets the "article" edge to the Article entity.

func (*TagUpdateOne) SetArticleID

func (tuo *TagUpdateOne) SetArticleID(id int) *TagUpdateOne

SetArticleID sets the "article" edge to the Article entity by ID.

func (*TagUpdateOne) SetCreatedAt

func (tuo *TagUpdateOne) SetCreatedAt(t time.Time) *TagUpdateOne

SetCreatedAt sets the "created_at" field.

func (*TagUpdateOne) SetNillableArticleID

func (tuo *TagUpdateOne) SetNillableArticleID(id *int) *TagUpdateOne

SetNillableArticleID sets the "article" edge to the Article entity by ID if the given value is not nil.

func (*TagUpdateOne) SetNillableCreatedAt

func (tuo *TagUpdateOne) SetNillableCreatedAt(t *time.Time) *TagUpdateOne

SetNillableCreatedAt sets the "created_at" field if the given value is not nil.

func (*TagUpdateOne) SetTagName

func (tuo *TagUpdateOne) SetTagName(s string) *TagUpdateOne

SetTagName sets the "tag_name" field.

func (*TagUpdateOne) Where

func (tuo *TagUpdateOne) Where(ps ...predicate.Tag) *TagUpdateOne

Where appends a list predicates to the TagUpdate builder.

type Tags

type Tags []*Tag

Tags is a parsable slice of Tag.

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 {

	// Achievement is the client for interacting with the Achievement builders.
	Achievement *AchievementClient
	// Article is the client for interacting with the Article builders.
	Article *ArticleClient
	// BFPDataPoint is the client for interacting with the BFPDataPoint builders.
	BFPDataPoint *BFPDataPointClient
	// Meal is the client for interacting with the Meal builders.
	Meal *MealClient
	// Tag is the client for interacting with the Tag builders.
	Tag *TagClient
	// 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"`
	// UserName holds the value of the "user_name" field.
	UserName string `json:"user_name,omitempty"`
	// Password holds the value of the "password" field.
	Password string `json:"password,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) QueryAchievements

func (u *User) QueryAchievements() *AchievementQuery

QueryAchievements queries the "achievements" edge of the User entity.

func (*User) QueryBFPs

func (u *User) QueryBFPs() *BFPDataPointQuery

QueryBFPs queries the "BFPs" edge of the User entity.

func (*User) QueryMeals

func (u *User) QueryMeals() *MealQuery

QueryMeals queries the "meals" 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.

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) Query

func (c *UserClient) Query() *UserQuery

Query returns a query builder for User.

func (*UserClient) QueryAchievements

func (c *UserClient) QueryAchievements(u *User) *AchievementQuery

QueryAchievements queries the achievements edge of a User.

func (*UserClient) QueryBFPs

func (c *UserClient) QueryBFPs(u *User) *BFPDataPointQuery

QueryBFPs queries the BFPs edge of a User.

func (*UserClient) QueryMeals

func (c *UserClient) QueryMeals(u *User) *MealQuery

QueryMeals queries the meals 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) AddAchievementIDs

func (uc *UserCreate) AddAchievementIDs(ids ...int) *UserCreate

AddAchievementIDs adds the "achievements" edge to the Achievement entity by IDs.

func (*UserCreate) AddAchievements

func (uc *UserCreate) AddAchievements(a ...*Achievement) *UserCreate

AddAchievements adds the "achievements" edges to the Achievement entity.

func (*UserCreate) AddBFPIDs

func (uc *UserCreate) AddBFPIDs(ids ...int) *UserCreate

AddBFPIDs adds the "BFPs" edge to the BFPDataPoint entity by IDs.

func (*UserCreate) AddBFPs

func (uc *UserCreate) AddBFPs(b ...*BFPDataPoint) *UserCreate

AddBFPs adds the "BFPs" edges to the BFPDataPoint entity.

func (*UserCreate) AddMealIDs

func (uc *UserCreate) AddMealIDs(ids ...int) *UserCreate

AddMealIDs adds the "meals" edge to the Meal entity by IDs.

func (*UserCreate) AddMeals

func (uc *UserCreate) AddMeals(m ...*Meal) *UserCreate

AddMeals adds the "meals" edges to the Meal 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) SetPassword

func (uc *UserCreate) SetPassword(s string) *UserCreate

SetPassword sets the "password" field.

func (*UserCreate) SetUserName

func (uc *UserCreate) SetUserName(s string) *UserCreate

SetUserName sets the "user_name" 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 {
	// Meals holds the value of the meals edge.
	Meals []*Meal `json:"meals,omitempty"`
	// BFPs holds the value of the BFPs edge.
	BFPs []*BFPDataPoint `json:"BFPs,omitempty"`
	// Achievements holds the value of the achievements edge.
	Achievements []*Achievement `json:"achievements,omitempty"`
	// contains filtered or unexported fields
}

UserEdges holds the relations/edges for other nodes in the graph.

func (UserEdges) AchievementsOrErr

func (e UserEdges) AchievementsOrErr() ([]*Achievement, error)

AchievementsOrErr returns the Achievements value or an error if the edge was not loaded in eager-loading.

func (UserEdges) BFPsOrErr

func (e UserEdges) BFPsOrErr() ([]*BFPDataPoint, error)

BFPsOrErr returns the BFPs value or an error if the edge was not loaded in eager-loading.

func (UserEdges) MealsOrErr

func (e UserEdges) MealsOrErr() ([]*Meal, error)

MealsOrErr returns the Meals 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) AchievementsCleared

func (m *UserMutation) AchievementsCleared() bool

AchievementsCleared reports if the "achievements" edge to the Achievement entity was cleared.

func (*UserMutation) AchievementsIDs

func (m *UserMutation) AchievementsIDs() (ids []int)

AchievementsIDs returns the "achievements" edge IDs in the mutation.

func (*UserMutation) AddAchievementIDs

func (m *UserMutation) AddAchievementIDs(ids ...int)

AddAchievementIDs adds the "achievements" edge to the Achievement entity by ids.

func (*UserMutation) AddBFPIDs

func (m *UserMutation) AddBFPIDs(ids ...int)

AddBFPIDs adds the "BFPs" edge to the BFPDataPoint 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) AddMealIDs

func (m *UserMutation) AddMealIDs(ids ...int)

AddMealIDs adds the "meals" edge to the Meal 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) BFPsCleared

func (m *UserMutation) BFPsCleared() bool

BFPsCleared reports if the "BFPs" edge to the BFPDataPoint entity was cleared.

func (*UserMutation) BFPsIDs

func (m *UserMutation) BFPsIDs() (ids []int)

BFPsIDs returns the "BFPs" edge IDs in the mutation.

func (*UserMutation) ClearAchievements

func (m *UserMutation) ClearAchievements()

ClearAchievements clears the "achievements" edge to the Achievement entity.

func (*UserMutation) ClearBFPs

func (m *UserMutation) ClearBFPs()

ClearBFPs clears the "BFPs" edge to the BFPDataPoint 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) ClearMeals

func (m *UserMutation) ClearMeals()

ClearMeals clears the "meals" edge to the Meal 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) 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) 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) MealsCleared

func (m *UserMutation) MealsCleared() bool

MealsCleared reports if the "meals" edge to the Meal entity was cleared.

func (*UserMutation) MealsIDs

func (m *UserMutation) MealsIDs() (ids []int)

MealsIDs returns the "meals" edge IDs in the mutation.

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) 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) OldUserName

func (m *UserMutation) OldUserName(ctx context.Context) (v string, err error)

OldUserName returns the old "user_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) Op

func (m *UserMutation) Op() Op

Op returns the operation name.

func (*UserMutation) Password

func (m *UserMutation) Password() (r string, exists bool)

Password returns the value of the "password" field in the mutation.

func (*UserMutation) RemoveAchievementIDs

func (m *UserMutation) RemoveAchievementIDs(ids ...int)

RemoveAchievementIDs removes the "achievements" edge to the Achievement entity by IDs.

func (*UserMutation) RemoveBFPIDs

func (m *UserMutation) RemoveBFPIDs(ids ...int)

RemoveBFPIDs removes the "BFPs" edge to the BFPDataPoint entity by IDs.

func (*UserMutation) RemoveMealIDs

func (m *UserMutation) RemoveMealIDs(ids ...int)

RemoveMealIDs removes the "meals" edge to the Meal entity by IDs.

func (*UserMutation) RemovedAchievementsIDs

func (m *UserMutation) RemovedAchievementsIDs() (ids []int)

RemovedAchievements returns the removed IDs of the "achievements" edge to the Achievement entity.

func (*UserMutation) RemovedBFPsIDs

func (m *UserMutation) RemovedBFPsIDs() (ids []int)

RemovedBFPs returns the removed IDs of the "BFPs" edge to the BFPDataPoint 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) RemovedMealsIDs

func (m *UserMutation) RemovedMealsIDs() (ids []int)

RemovedMeals returns the removed IDs of the "meals" edge to the Meal entity.

func (*UserMutation) ResetAchievements

func (m *UserMutation) ResetAchievements()

ResetAchievements resets all changes to the "achievements" edge.

func (*UserMutation) ResetBFPs

func (m *UserMutation) ResetBFPs()

ResetBFPs resets all changes to the "BFPs" edge.

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) 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) ResetMeals

func (m *UserMutation) ResetMeals()

ResetMeals resets all changes to the "meals" edge.

func (*UserMutation) ResetPassword

func (m *UserMutation) ResetPassword()

ResetPassword resets all changes to the "password" field.

func (*UserMutation) ResetUserName

func (m *UserMutation) ResetUserName()

ResetUserName resets all changes to the "user_name" 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) 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) SetUserName

func (m *UserMutation) SetUserName(s string)

SetUserName sets the "user_name" 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) UserName

func (m *UserMutation) UserName() (r string, exists bool)

UserName returns the value of the "user_name" 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 {
	UserName string `json:"user_name,omitempty"`
	Count int `json:"count,omitempty"`
}

client.User.Query().
	GroupBy(user.FieldUserName).
	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 ...OrderFunc) *UserQuery

Order specifies how the records should be ordered.

func (*UserQuery) QueryAchievements

func (uq *UserQuery) QueryAchievements() *AchievementQuery

QueryAchievements chains the current query on the "achievements" edge.

func (*UserQuery) QueryBFPs

func (uq *UserQuery) QueryBFPs() *BFPDataPointQuery

QueryBFPs chains the current query on the "BFPs" edge.

func (*UserQuery) QueryMeals

func (uq *UserQuery) QueryMeals() *MealQuery

QueryMeals chains the current query on the "meals" 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 {
	UserName string `json:"user_name,omitempty"`
}

client.User.Query().
	Select(user.FieldUserName).
	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) WithAchievements

func (uq *UserQuery) WithAchievements(opts ...func(*AchievementQuery)) *UserQuery

WithAchievements tells the query-builder to eager-load the nodes that are connected to the "achievements" edge. The optional arguments are used to configure the query builder of the edge.

func (*UserQuery) WithBFPs

func (uq *UserQuery) WithBFPs(opts ...func(*BFPDataPointQuery)) *UserQuery

WithBFPs tells the query-builder to eager-load the nodes that are connected to the "BFPs" edge. The optional arguments are used to configure the query builder of the edge.

func (*UserQuery) WithMeals

func (uq *UserQuery) WithMeals(opts ...func(*MealQuery)) *UserQuery

WithMeals tells the query-builder to eager-load the nodes that are connected to the "meals" 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) AddAchievementIDs

func (uu *UserUpdate) AddAchievementIDs(ids ...int) *UserUpdate

AddAchievementIDs adds the "achievements" edge to the Achievement entity by IDs.

func (*UserUpdate) AddAchievements

func (uu *UserUpdate) AddAchievements(a ...*Achievement) *UserUpdate

AddAchievements adds the "achievements" edges to the Achievement entity.

func (*UserUpdate) AddBFPIDs

func (uu *UserUpdate) AddBFPIDs(ids ...int) *UserUpdate

AddBFPIDs adds the "BFPs" edge to the BFPDataPoint entity by IDs.

func (*UserUpdate) AddBFPs

func (uu *UserUpdate) AddBFPs(b ...*BFPDataPoint) *UserUpdate

AddBFPs adds the "BFPs" edges to the BFPDataPoint entity.

func (*UserUpdate) AddMealIDs

func (uu *UserUpdate) AddMealIDs(ids ...int) *UserUpdate

AddMealIDs adds the "meals" edge to the Meal entity by IDs.

func (*UserUpdate) AddMeals

func (uu *UserUpdate) AddMeals(m ...*Meal) *UserUpdate

AddMeals adds the "meals" edges to the Meal entity.

func (*UserUpdate) ClearAchievements

func (uu *UserUpdate) ClearAchievements() *UserUpdate

ClearAchievements clears all "achievements" edges to the Achievement entity.

func (*UserUpdate) ClearBFPs

func (uu *UserUpdate) ClearBFPs() *UserUpdate

ClearBFPs clears all "BFPs" edges to the BFPDataPoint entity.

func (*UserUpdate) ClearMeals

func (uu *UserUpdate) ClearMeals() *UserUpdate

ClearMeals clears all "meals" edges to the Meal 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) RemoveAchievementIDs

func (uu *UserUpdate) RemoveAchievementIDs(ids ...int) *UserUpdate

RemoveAchievementIDs removes the "achievements" edge to Achievement entities by IDs.

func (*UserUpdate) RemoveAchievements

func (uu *UserUpdate) RemoveAchievements(a ...*Achievement) *UserUpdate

RemoveAchievements removes "achievements" edges to Achievement entities.

func (*UserUpdate) RemoveBFPIDs

func (uu *UserUpdate) RemoveBFPIDs(ids ...int) *UserUpdate

RemoveBFPIDs removes the "BFPs" edge to BFPDataPoint entities by IDs.

func (*UserUpdate) RemoveBFPs

func (uu *UserUpdate) RemoveBFPs(b ...*BFPDataPoint) *UserUpdate

RemoveBFPs removes "BFPs" edges to BFPDataPoint entities.

func (*UserUpdate) RemoveMealIDs

func (uu *UserUpdate) RemoveMealIDs(ids ...int) *UserUpdate

RemoveMealIDs removes the "meals" edge to Meal entities by IDs.

func (*UserUpdate) RemoveMeals

func (uu *UserUpdate) RemoveMeals(m ...*Meal) *UserUpdate

RemoveMeals removes "meals" edges to Meal 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) SetPassword

func (uu *UserUpdate) SetPassword(s string) *UserUpdate

SetPassword sets the "password" field.

func (*UserUpdate) SetUserName

func (uu *UserUpdate) SetUserName(s string) *UserUpdate

SetUserName sets the "user_name" 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) AddAchievementIDs

func (uuo *UserUpdateOne) AddAchievementIDs(ids ...int) *UserUpdateOne

AddAchievementIDs adds the "achievements" edge to the Achievement entity by IDs.

func (*UserUpdateOne) AddAchievements

func (uuo *UserUpdateOne) AddAchievements(a ...*Achievement) *UserUpdateOne

AddAchievements adds the "achievements" edges to the Achievement entity.

func (*UserUpdateOne) AddBFPIDs

func (uuo *UserUpdateOne) AddBFPIDs(ids ...int) *UserUpdateOne

AddBFPIDs adds the "BFPs" edge to the BFPDataPoint entity by IDs.

func (*UserUpdateOne) AddBFPs

func (uuo *UserUpdateOne) AddBFPs(b ...*BFPDataPoint) *UserUpdateOne

AddBFPs adds the "BFPs" edges to the BFPDataPoint entity.

func (*UserUpdateOne) AddMealIDs

func (uuo *UserUpdateOne) AddMealIDs(ids ...int) *UserUpdateOne

AddMealIDs adds the "meals" edge to the Meal entity by IDs.

func (*UserUpdateOne) AddMeals

func (uuo *UserUpdateOne) AddMeals(m ...*Meal) *UserUpdateOne

AddMeals adds the "meals" edges to the Meal entity.

func (*UserUpdateOne) ClearAchievements

func (uuo *UserUpdateOne) ClearAchievements() *UserUpdateOne

ClearAchievements clears all "achievements" edges to the Achievement entity.

func (*UserUpdateOne) ClearBFPs

func (uuo *UserUpdateOne) ClearBFPs() *UserUpdateOne

ClearBFPs clears all "BFPs" edges to the BFPDataPoint entity.

func (*UserUpdateOne) ClearMeals

func (uuo *UserUpdateOne) ClearMeals() *UserUpdateOne

ClearMeals clears all "meals" edges to the Meal 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) RemoveAchievementIDs

func (uuo *UserUpdateOne) RemoveAchievementIDs(ids ...int) *UserUpdateOne

RemoveAchievementIDs removes the "achievements" edge to Achievement entities by IDs.

func (*UserUpdateOne) RemoveAchievements

func (uuo *UserUpdateOne) RemoveAchievements(a ...*Achievement) *UserUpdateOne

RemoveAchievements removes "achievements" edges to Achievement entities.

func (*UserUpdateOne) RemoveBFPIDs

func (uuo *UserUpdateOne) RemoveBFPIDs(ids ...int) *UserUpdateOne

RemoveBFPIDs removes the "BFPs" edge to BFPDataPoint entities by IDs.

func (*UserUpdateOne) RemoveBFPs

func (uuo *UserUpdateOne) RemoveBFPs(b ...*BFPDataPoint) *UserUpdateOne

RemoveBFPs removes "BFPs" edges to BFPDataPoint entities.

func (*UserUpdateOne) RemoveMealIDs

func (uuo *UserUpdateOne) RemoveMealIDs(ids ...int) *UserUpdateOne

RemoveMealIDs removes the "meals" edge to Meal entities by IDs.

func (*UserUpdateOne) RemoveMeals

func (uuo *UserUpdateOne) RemoveMeals(m ...*Meal) *UserUpdateOne

RemoveMeals removes "meals" edges to Meal 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) SetPassword

func (uuo *UserUpdateOne) SetPassword(s string) *UserUpdateOne

SetPassword sets the "password" field.

func (*UserUpdateOne) SetUserName

func (uuo *UserUpdateOne) SetUserName(s string) *UserUpdateOne

SetUserName sets the "user_name" 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