ent

package
v0.0.0-...-ce38df1 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2024 License: MIT Imports: 22 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.
	TypeFood         = "Food"
	TypeJournal      = "Journal"
	TypeUserSettings = "UserSettings"
	TypeWeight       = "Weight"
)

Variables

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

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

Functions

func Asc

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

Asc applies the given fields in ASC order.

func Desc

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

Desc applies the given fields in DESC order.

func IsConstraintError

func IsConstraintError(err error) bool

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

func IsNotFound

func IsNotFound(err error) bool

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

func IsNotLoaded

func IsNotLoaded(err error) bool

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

func IsNotSingular

func IsNotSingular(err error) bool

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

func IsValidationError

func IsValidationError(err error) bool

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

func MaskNotFound

func MaskNotFound(err error) error

MaskNotFound masks not found error.

func NewContext

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

NewContext returns a new context with the given Client attached.

func NewTxContext

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

NewTxContext returns a new context with the given Tx attached.

Types

type AggregateFunc

type AggregateFunc func(*sql.Selector) string

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

func As

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

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

func Count

func Count() AggregateFunc

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

func Max

func Max(field string) AggregateFunc

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

func Mean

func Mean(field string) AggregateFunc

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

func Min

func Min(field string) AggregateFunc

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

func Sum

func Sum(field string) AggregateFunc

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

type Client

type Client struct {

	// Schema is the client for creating, migrating and dropping schema.
	Schema *migrate.Schema
	// Food is the client for interacting with the Food builders.
	Food *FoodClient
	// Journal is the client for interacting with the Journal builders.
	Journal *JournalClient
	// UserSettings is the client for interacting with the UserSettings builders.
	UserSettings *UserSettingsClient
	// Weight is the client for interacting with the Weight builders.
	Weight *WeightClient
	// 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().
	Food.
	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 Food

type Food struct {

	// ID of the ent.
	ID int `json:"id,omitempty"`
	// Key holds the value of the "key" field.
	Key string `json:"key,omitempty"`
	// Name holds the value of the "name" field.
	Name string `json:"name,omitempty"`
	// Brand holds the value of the "brand" field.
	Brand string `json:"brand,omitempty"`
	// Cal100 holds the value of the "cal100" field.
	Cal100 float64 `json:"cal100,omitempty"`
	// Prot100 holds the value of the "prot100" field.
	Prot100 float64 `json:"prot100,omitempty"`
	// Fat100 holds the value of the "fat100" field.
	Fat100 float64 `json:"fat100,omitempty"`
	// Carb100 holds the value of the "carb100" field.
	Carb100 float64 `json:"carb100,omitempty"`
	// Comment holds the value of the "comment" field.
	Comment string `json:"comment,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the FoodQuery when eager-loading is set.
	Edges FoodEdges `json:"edges"`
	// contains filtered or unexported fields
}

Food is the model entity for the Food schema.

func (*Food) QueryJournals

func (f *Food) QueryJournals() *JournalQuery

QueryJournals queries the "journals" edge of the Food entity.

func (*Food) String

func (f *Food) String() string

String implements the fmt.Stringer.

func (*Food) Unwrap

func (f *Food) Unwrap() *Food

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

func (f *Food) Update() *FoodUpdateOne

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

func (*Food) Value

func (f *Food) Value(name string) (ent.Value, error)

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

type FoodClient

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

FoodClient is a client for the Food schema.

func NewFoodClient

func NewFoodClient(c config) *FoodClient

NewFoodClient returns a client for the Food from the given config.

func (*FoodClient) Create

func (c *FoodClient) Create() *FoodCreate

Create returns a builder for creating a Food entity.

func (*FoodClient) CreateBulk

func (c *FoodClient) CreateBulk(builders ...*FoodCreate) *FoodCreateBulk

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

func (*FoodClient) Delete

func (c *FoodClient) Delete() *FoodDelete

Delete returns a delete builder for Food.

func (*FoodClient) DeleteOne

func (c *FoodClient) DeleteOne(f *Food) *FoodDeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*FoodClient) DeleteOneID

func (c *FoodClient) DeleteOneID(id int) *FoodDeleteOne

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

func (*FoodClient) Get

func (c *FoodClient) Get(ctx context.Context, id int) (*Food, error)

Get returns a Food entity by its id.

func (*FoodClient) GetX

func (c *FoodClient) GetX(ctx context.Context, id int) *Food

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

func (*FoodClient) Hooks

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

Hooks returns the client hooks.

func (*FoodClient) Intercept

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

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

func (*FoodClient) Interceptors

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

Interceptors returns the client interceptors.

func (*FoodClient) MapCreateBulk

func (c *FoodClient) MapCreateBulk(slice any, setFunc func(*FoodCreate, int)) *FoodCreateBulk

MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates a builder and applies setFunc on it.

func (*FoodClient) Query

func (c *FoodClient) Query() *FoodQuery

Query returns a query builder for Food.

func (*FoodClient) QueryJournals

func (c *FoodClient) QueryJournals(f *Food) *JournalQuery

QueryJournals queries the journals edge of a Food.

func (*FoodClient) Update

func (c *FoodClient) Update() *FoodUpdate

Update returns an update builder for Food.

func (*FoodClient) UpdateOne

func (c *FoodClient) UpdateOne(f *Food) *FoodUpdateOne

UpdateOne returns an update builder for the given entity.

func (*FoodClient) UpdateOneID

func (c *FoodClient) UpdateOneID(id int) *FoodUpdateOne

UpdateOneID returns an update builder for the given id.

func (*FoodClient) Use

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

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

type FoodCreate

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

FoodCreate is the builder for creating a Food entity.

func (*FoodCreate) AddJournalIDs

func (fc *FoodCreate) AddJournalIDs(ids ...int) *FoodCreate

AddJournalIDs adds the "journals" edge to the Journal entity by IDs.

func (*FoodCreate) AddJournals

func (fc *FoodCreate) AddJournals(j ...*Journal) *FoodCreate

AddJournals adds the "journals" edges to the Journal entity.

func (*FoodCreate) Exec

func (fc *FoodCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*FoodCreate) ExecX

func (fc *FoodCreate) ExecX(ctx context.Context)

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

func (*FoodCreate) Mutation

func (fc *FoodCreate) Mutation() *FoodMutation

Mutation returns the FoodMutation object of the builder.

func (*FoodCreate) OnConflict

func (fc *FoodCreate) OnConflict(opts ...sql.ConflictOption) *FoodUpsertOne

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

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

func (*FoodCreate) OnConflictColumns

func (fc *FoodCreate) OnConflictColumns(columns ...string) *FoodUpsertOne

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

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

func (*FoodCreate) Save

func (fc *FoodCreate) Save(ctx context.Context) (*Food, error)

Save creates the Food in the database.

func (*FoodCreate) SaveX

func (fc *FoodCreate) SaveX(ctx context.Context) *Food

SaveX calls Save and panics if Save returns an error.

func (*FoodCreate) SetBrand

func (fc *FoodCreate) SetBrand(s string) *FoodCreate

SetBrand sets the "brand" field.

func (*FoodCreate) SetCal100

func (fc *FoodCreate) SetCal100(f float64) *FoodCreate

SetCal100 sets the "cal100" field.

func (*FoodCreate) SetCarb100

func (fc *FoodCreate) SetCarb100(f float64) *FoodCreate

SetCarb100 sets the "carb100" field.

func (*FoodCreate) SetComment

func (fc *FoodCreate) SetComment(s string) *FoodCreate

SetComment sets the "comment" field.

func (*FoodCreate) SetFat100

func (fc *FoodCreate) SetFat100(f float64) *FoodCreate

SetFat100 sets the "fat100" field.

func (*FoodCreate) SetKey

func (fc *FoodCreate) SetKey(s string) *FoodCreate

SetKey sets the "key" field.

func (*FoodCreate) SetName

func (fc *FoodCreate) SetName(s string) *FoodCreate

SetName sets the "name" field.

func (*FoodCreate) SetNillableBrand

func (fc *FoodCreate) SetNillableBrand(s *string) *FoodCreate

SetNillableBrand sets the "brand" field if the given value is not nil.

func (*FoodCreate) SetNillableComment

func (fc *FoodCreate) SetNillableComment(s *string) *FoodCreate

SetNillableComment sets the "comment" field if the given value is not nil.

func (*FoodCreate) SetProt100

func (fc *FoodCreate) SetProt100(f float64) *FoodCreate

SetProt100 sets the "prot100" field.

type FoodCreateBulk

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

FoodCreateBulk is the builder for creating many Food entities in bulk.

func (*FoodCreateBulk) Exec

func (fcb *FoodCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*FoodCreateBulk) ExecX

func (fcb *FoodCreateBulk) ExecX(ctx context.Context)

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

func (*FoodCreateBulk) OnConflict

func (fcb *FoodCreateBulk) OnConflict(opts ...sql.ConflictOption) *FoodUpsertBulk

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

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

func (*FoodCreateBulk) OnConflictColumns

func (fcb *FoodCreateBulk) OnConflictColumns(columns ...string) *FoodUpsertBulk

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

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

func (*FoodCreateBulk) Save

func (fcb *FoodCreateBulk) Save(ctx context.Context) ([]*Food, error)

Save creates the Food entities in the database.

func (*FoodCreateBulk) SaveX

func (fcb *FoodCreateBulk) SaveX(ctx context.Context) []*Food

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

type FoodDelete

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

FoodDelete is the builder for deleting a Food entity.

func (*FoodDelete) Exec

func (fd *FoodDelete) Exec(ctx context.Context) (int, error)

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

func (*FoodDelete) ExecX

func (fd *FoodDelete) ExecX(ctx context.Context) int

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

func (*FoodDelete) Where

func (fd *FoodDelete) Where(ps ...predicate.Food) *FoodDelete

Where appends a list predicates to the FoodDelete builder.

type FoodDeleteOne

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

FoodDeleteOne is the builder for deleting a single Food entity.

func (*FoodDeleteOne) Exec

func (fdo *FoodDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*FoodDeleteOne) ExecX

func (fdo *FoodDeleteOne) ExecX(ctx context.Context)

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

func (*FoodDeleteOne) Where

func (fdo *FoodDeleteOne) Where(ps ...predicate.Food) *FoodDeleteOne

Where appends a list predicates to the FoodDelete builder.

type FoodEdges

type FoodEdges struct {
	// Journals holds the value of the journals edge.
	Journals []*Journal `json:"journals,omitempty"`
	// contains filtered or unexported fields
}

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

func (FoodEdges) JournalsOrErr

func (e FoodEdges) JournalsOrErr() ([]*Journal, error)

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

type FoodGroupBy

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

FoodGroupBy is the group-by builder for Food entities.

func (*FoodGroupBy) Aggregate

func (fgb *FoodGroupBy) Aggregate(fns ...AggregateFunc) *FoodGroupBy

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

func (*FoodGroupBy) Bool

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

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

func (*FoodGroupBy) BoolX

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

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

func (*FoodGroupBy) Bools

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

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

func (*FoodGroupBy) BoolsX

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

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

func (*FoodGroupBy) Float64

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

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

func (*FoodGroupBy) Float64X

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

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

func (*FoodGroupBy) Float64s

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

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

func (*FoodGroupBy) Float64sX

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

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

func (*FoodGroupBy) Int

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

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

func (*FoodGroupBy) IntX

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

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

func (*FoodGroupBy) Ints

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

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

func (*FoodGroupBy) IntsX

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

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

func (*FoodGroupBy) Scan

func (fgb *FoodGroupBy) Scan(ctx context.Context, v any) error

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

func (*FoodGroupBy) ScanX

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

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

func (*FoodGroupBy) String

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

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

func (*FoodGroupBy) StringX

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

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

func (*FoodGroupBy) Strings

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

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

func (*FoodGroupBy) StringsX

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

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

type FoodMutation

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

FoodMutation represents an operation that mutates the Food nodes in the graph.

func (*FoodMutation) AddCal100

func (m *FoodMutation) AddCal100(f float64)

AddCal100 adds f to the "cal100" field.

func (*FoodMutation) AddCarb100

func (m *FoodMutation) AddCarb100(f float64)

AddCarb100 adds f to the "carb100" field.

func (*FoodMutation) AddFat100

func (m *FoodMutation) AddFat100(f float64)

AddFat100 adds f to the "fat100" field.

func (*FoodMutation) AddField

func (m *FoodMutation) 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 (*FoodMutation) AddJournalIDs

func (m *FoodMutation) AddJournalIDs(ids ...int)

AddJournalIDs adds the "journals" edge to the Journal entity by ids.

func (*FoodMutation) AddProt100

func (m *FoodMutation) AddProt100(f float64)

AddProt100 adds f to the "prot100" field.

func (*FoodMutation) AddedCal100

func (m *FoodMutation) AddedCal100() (r float64, exists bool)

AddedCal100 returns the value that was added to the "cal100" field in this mutation.

func (*FoodMutation) AddedCarb100

func (m *FoodMutation) AddedCarb100() (r float64, exists bool)

AddedCarb100 returns the value that was added to the "carb100" field in this mutation.

func (*FoodMutation) AddedEdges

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

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

func (*FoodMutation) AddedFat100

func (m *FoodMutation) AddedFat100() (r float64, exists bool)

AddedFat100 returns the value that was added to the "fat100" field in this mutation.

func (*FoodMutation) AddedField

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

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

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

func (*FoodMutation) AddedIDs

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

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

func (*FoodMutation) AddedProt100

func (m *FoodMutation) AddedProt100() (r float64, exists bool)

AddedProt100 returns the value that was added to the "prot100" field in this mutation.

func (*FoodMutation) Brand

func (m *FoodMutation) Brand() (r string, exists bool)

Brand returns the value of the "brand" field in the mutation.

func (*FoodMutation) BrandCleared

func (m *FoodMutation) BrandCleared() bool

BrandCleared returns if the "brand" field was cleared in this mutation.

func (*FoodMutation) Cal100

func (m *FoodMutation) Cal100() (r float64, exists bool)

Cal100 returns the value of the "cal100" field in the mutation.

func (*FoodMutation) Carb100

func (m *FoodMutation) Carb100() (r float64, exists bool)

Carb100 returns the value of the "carb100" field in the mutation.

func (*FoodMutation) ClearBrand

func (m *FoodMutation) ClearBrand()

ClearBrand clears the value of the "brand" field.

func (*FoodMutation) ClearComment

func (m *FoodMutation) ClearComment()

ClearComment clears the value of the "comment" field.

func (*FoodMutation) ClearEdge

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

func (m *FoodMutation) 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 (*FoodMutation) ClearJournals

func (m *FoodMutation) ClearJournals()

ClearJournals clears the "journals" edge to the Journal entity.

func (*FoodMutation) ClearedEdges

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

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

func (*FoodMutation) ClearedFields

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

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

func (FoodMutation) Client

func (m FoodMutation) 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 (*FoodMutation) Comment

func (m *FoodMutation) Comment() (r string, exists bool)

Comment returns the value of the "comment" field in the mutation.

func (*FoodMutation) CommentCleared

func (m *FoodMutation) CommentCleared() bool

CommentCleared returns if the "comment" field was cleared in this mutation.

func (*FoodMutation) EdgeCleared

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

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

func (*FoodMutation) Fat100

func (m *FoodMutation) Fat100() (r float64, exists bool)

Fat100 returns the value of the "fat100" field in the mutation.

func (*FoodMutation) Field

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

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

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

func (*FoodMutation) Fields

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

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

func (m *FoodMutation) 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 (*FoodMutation) JournalsCleared

func (m *FoodMutation) JournalsCleared() bool

JournalsCleared reports if the "journals" edge to the Journal entity was cleared.

func (*FoodMutation) JournalsIDs

func (m *FoodMutation) JournalsIDs() (ids []int)

JournalsIDs returns the "journals" edge IDs in the mutation.

func (*FoodMutation) Key

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

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

func (*FoodMutation) Name

func (m *FoodMutation) Name() (r string, exists bool)

Name returns the value of the "name" field in the mutation.

func (*FoodMutation) OldBrand

func (m *FoodMutation) OldBrand(ctx context.Context) (v string, err error)

OldBrand returns the old "brand" field's value of the Food entity. If the Food 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 (*FoodMutation) OldCal100

func (m *FoodMutation) OldCal100(ctx context.Context) (v float64, err error)

OldCal100 returns the old "cal100" field's value of the Food entity. If the Food 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 (*FoodMutation) OldCarb100

func (m *FoodMutation) OldCarb100(ctx context.Context) (v float64, err error)

OldCarb100 returns the old "carb100" field's value of the Food entity. If the Food 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 (*FoodMutation) OldComment

func (m *FoodMutation) OldComment(ctx context.Context) (v string, err error)

OldComment returns the old "comment" field's value of the Food entity. If the Food 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 (*FoodMutation) OldFat100

func (m *FoodMutation) OldFat100(ctx context.Context) (v float64, err error)

OldFat100 returns the old "fat100" field's value of the Food entity. If the Food 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 (*FoodMutation) OldField

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

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

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

func (m *FoodMutation) OldName(ctx context.Context) (v string, err error)

OldName returns the old "name" field's value of the Food entity. If the Food 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 (*FoodMutation) OldProt100

func (m *FoodMutation) OldProt100(ctx context.Context) (v float64, err error)

OldProt100 returns the old "prot100" field's value of the Food entity. If the Food 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 (*FoodMutation) Op

func (m *FoodMutation) Op() Op

Op returns the operation name.

func (*FoodMutation) Prot100

func (m *FoodMutation) Prot100() (r float64, exists bool)

Prot100 returns the value of the "prot100" field in the mutation.

func (*FoodMutation) RemoveJournalIDs

func (m *FoodMutation) RemoveJournalIDs(ids ...int)

RemoveJournalIDs removes the "journals" edge to the Journal entity by IDs.

func (*FoodMutation) RemovedEdges

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

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

func (*FoodMutation) RemovedIDs

func (m *FoodMutation) 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 (*FoodMutation) RemovedJournalsIDs

func (m *FoodMutation) RemovedJournalsIDs() (ids []int)

RemovedJournals returns the removed IDs of the "journals" edge to the Journal entity.

func (*FoodMutation) ResetBrand

func (m *FoodMutation) ResetBrand()

ResetBrand resets all changes to the "brand" field.

func (*FoodMutation) ResetCal100

func (m *FoodMutation) ResetCal100()

ResetCal100 resets all changes to the "cal100" field.

func (*FoodMutation) ResetCarb100

func (m *FoodMutation) ResetCarb100()

ResetCarb100 resets all changes to the "carb100" field.

func (*FoodMutation) ResetComment

func (m *FoodMutation) ResetComment()

ResetComment resets all changes to the "comment" field.

func (*FoodMutation) ResetEdge

func (m *FoodMutation) 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 (*FoodMutation) ResetFat100

func (m *FoodMutation) ResetFat100()

ResetFat100 resets all changes to the "fat100" field.

func (*FoodMutation) ResetField

func (m *FoodMutation) 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 (*FoodMutation) ResetJournals

func (m *FoodMutation) ResetJournals()

ResetJournals resets all changes to the "journals" edge.

func (*FoodMutation) ResetKey

func (m *FoodMutation) ResetKey()

ResetKey resets all changes to the "key" field.

func (*FoodMutation) ResetName

func (m *FoodMutation) ResetName()

ResetName resets all changes to the "name" field.

func (*FoodMutation) ResetProt100

func (m *FoodMutation) ResetProt100()

ResetProt100 resets all changes to the "prot100" field.

func (*FoodMutation) SetBrand

func (m *FoodMutation) SetBrand(s string)

SetBrand sets the "brand" field.

func (*FoodMutation) SetCal100

func (m *FoodMutation) SetCal100(f float64)

SetCal100 sets the "cal100" field.

func (*FoodMutation) SetCarb100

func (m *FoodMutation) SetCarb100(f float64)

SetCarb100 sets the "carb100" field.

func (*FoodMutation) SetComment

func (m *FoodMutation) SetComment(s string)

SetComment sets the "comment" field.

func (*FoodMutation) SetFat100

func (m *FoodMutation) SetFat100(f float64)

SetFat100 sets the "fat100" field.

func (*FoodMutation) SetField

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

func (m *FoodMutation) SetKey(s string)

SetKey sets the "key" field.

func (*FoodMutation) SetName

func (m *FoodMutation) SetName(s string)

SetName sets the "name" field.

func (*FoodMutation) SetOp

func (m *FoodMutation) SetOp(op Op)

SetOp allows setting the mutation operation.

func (*FoodMutation) SetProt100

func (m *FoodMutation) SetProt100(f float64)

SetProt100 sets the "prot100" field.

func (FoodMutation) Tx

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

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

func (*FoodMutation) Type

func (m *FoodMutation) Type() string

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

func (*FoodMutation) Where

func (m *FoodMutation) Where(ps ...predicate.Food)

Where appends a list predicates to the FoodMutation builder.

func (*FoodMutation) WhereP

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

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

type FoodQuery

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

FoodQuery is the builder for querying Food entities.

func (*FoodQuery) Aggregate

func (fq *FoodQuery) Aggregate(fns ...AggregateFunc) *FoodSelect

Aggregate returns a FoodSelect configured with the given aggregations.

func (*FoodQuery) All

func (fq *FoodQuery) All(ctx context.Context) ([]*Food, error)

All executes the query and returns a list of Foods.

func (*FoodQuery) AllX

func (fq *FoodQuery) AllX(ctx context.Context) []*Food

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

func (*FoodQuery) Clone

func (fq *FoodQuery) Clone() *FoodQuery

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

func (*FoodQuery) Count

func (fq *FoodQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*FoodQuery) CountX

func (fq *FoodQuery) CountX(ctx context.Context) int

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

func (*FoodQuery) Exist

func (fq *FoodQuery) Exist(ctx context.Context) (bool, error)

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

func (*FoodQuery) ExistX

func (fq *FoodQuery) ExistX(ctx context.Context) bool

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

func (*FoodQuery) First

func (fq *FoodQuery) First(ctx context.Context) (*Food, error)

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

func (*FoodQuery) FirstID

func (fq *FoodQuery) FirstID(ctx context.Context) (id int, err error)

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

func (*FoodQuery) FirstIDX

func (fq *FoodQuery) FirstIDX(ctx context.Context) int

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

func (*FoodQuery) FirstX

func (fq *FoodQuery) FirstX(ctx context.Context) *Food

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

func (*FoodQuery) GroupBy

func (fq *FoodQuery) GroupBy(field string, fields ...string) *FoodGroupBy

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

client.Food.Query().
	GroupBy(food.FieldKey).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*FoodQuery) IDs

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

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

func (*FoodQuery) IDsX

func (fq *FoodQuery) IDsX(ctx context.Context) []int

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

func (*FoodQuery) Limit

func (fq *FoodQuery) Limit(limit int) *FoodQuery

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

func (*FoodQuery) Modify

func (fq *FoodQuery) Modify(modifiers ...func(s *sql.Selector)) *FoodSelect

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

func (*FoodQuery) Offset

func (fq *FoodQuery) Offset(offset int) *FoodQuery

Offset to start from.

func (*FoodQuery) Only

func (fq *FoodQuery) Only(ctx context.Context) (*Food, error)

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

func (*FoodQuery) OnlyID

func (fq *FoodQuery) OnlyID(ctx context.Context) (id int, err error)

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

func (*FoodQuery) OnlyIDX

func (fq *FoodQuery) OnlyIDX(ctx context.Context) int

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

func (*FoodQuery) OnlyX

func (fq *FoodQuery) OnlyX(ctx context.Context) *Food

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

func (*FoodQuery) Order

func (fq *FoodQuery) Order(o ...food.OrderOption) *FoodQuery

Order specifies how the records should be ordered.

func (*FoodQuery) QueryJournals

func (fq *FoodQuery) QueryJournals() *JournalQuery

QueryJournals chains the current query on the "journals" edge.

func (*FoodQuery) Select

func (fq *FoodQuery) Select(fields ...string) *FoodSelect

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

client.Food.Query().
	Select(food.FieldKey).
	Scan(ctx, &v)

func (*FoodQuery) Unique

func (fq *FoodQuery) Unique(unique bool) *FoodQuery

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

func (fq *FoodQuery) Where(ps ...predicate.Food) *FoodQuery

Where adds a new predicate for the FoodQuery builder.

func (*FoodQuery) WithJournals

func (fq *FoodQuery) WithJournals(opts ...func(*JournalQuery)) *FoodQuery

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

type FoodSelect

type FoodSelect struct {
	*FoodQuery
	// contains filtered or unexported fields
}

FoodSelect is the builder for selecting fields of Food entities.

func (*FoodSelect) Aggregate

func (fs *FoodSelect) Aggregate(fns ...AggregateFunc) *FoodSelect

Aggregate adds the given aggregation functions to the selector query.

func (*FoodSelect) Bool

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

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

func (*FoodSelect) BoolX

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

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

func (*FoodSelect) Bools

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

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

func (*FoodSelect) BoolsX

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

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

func (*FoodSelect) Float64

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

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

func (*FoodSelect) Float64X

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

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

func (*FoodSelect) Float64s

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

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

func (*FoodSelect) Float64sX

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

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

func (*FoodSelect) Int

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

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

func (*FoodSelect) IntX

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

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

func (*FoodSelect) Ints

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

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

func (*FoodSelect) IntsX

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

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

func (*FoodSelect) Modify

func (fs *FoodSelect) Modify(modifiers ...func(s *sql.Selector)) *FoodSelect

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

func (*FoodSelect) Scan

func (fs *FoodSelect) Scan(ctx context.Context, v any) error

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

func (*FoodSelect) ScanX

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

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

func (*FoodSelect) String

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

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

func (*FoodSelect) StringX

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

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

func (*FoodSelect) Strings

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

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

func (*FoodSelect) StringsX

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

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

type FoodUpdate

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

FoodUpdate is the builder for updating Food entities.

func (*FoodUpdate) AddCal100

func (fu *FoodUpdate) AddCal100(f float64) *FoodUpdate

AddCal100 adds f to the "cal100" field.

func (*FoodUpdate) AddCarb100

func (fu *FoodUpdate) AddCarb100(f float64) *FoodUpdate

AddCarb100 adds f to the "carb100" field.

func (*FoodUpdate) AddFat100

func (fu *FoodUpdate) AddFat100(f float64) *FoodUpdate

AddFat100 adds f to the "fat100" field.

func (*FoodUpdate) AddJournalIDs

func (fu *FoodUpdate) AddJournalIDs(ids ...int) *FoodUpdate

AddJournalIDs adds the "journals" edge to the Journal entity by IDs.

func (*FoodUpdate) AddJournals

func (fu *FoodUpdate) AddJournals(j ...*Journal) *FoodUpdate

AddJournals adds the "journals" edges to the Journal entity.

func (*FoodUpdate) AddProt100

func (fu *FoodUpdate) AddProt100(f float64) *FoodUpdate

AddProt100 adds f to the "prot100" field.

func (*FoodUpdate) ClearBrand

func (fu *FoodUpdate) ClearBrand() *FoodUpdate

ClearBrand clears the value of the "brand" field.

func (*FoodUpdate) ClearComment

func (fu *FoodUpdate) ClearComment() *FoodUpdate

ClearComment clears the value of the "comment" field.

func (*FoodUpdate) ClearJournals

func (fu *FoodUpdate) ClearJournals() *FoodUpdate

ClearJournals clears all "journals" edges to the Journal entity.

func (*FoodUpdate) Exec

func (fu *FoodUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*FoodUpdate) ExecX

func (fu *FoodUpdate) ExecX(ctx context.Context)

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

func (*FoodUpdate) Modify

func (fu *FoodUpdate) Modify(modifiers ...func(u *sql.UpdateBuilder)) *FoodUpdate

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

func (*FoodUpdate) Mutation

func (fu *FoodUpdate) Mutation() *FoodMutation

Mutation returns the FoodMutation object of the builder.

func (*FoodUpdate) RemoveJournalIDs

func (fu *FoodUpdate) RemoveJournalIDs(ids ...int) *FoodUpdate

RemoveJournalIDs removes the "journals" edge to Journal entities by IDs.

func (*FoodUpdate) RemoveJournals

func (fu *FoodUpdate) RemoveJournals(j ...*Journal) *FoodUpdate

RemoveJournals removes "journals" edges to Journal entities.

func (*FoodUpdate) Save

func (fu *FoodUpdate) Save(ctx context.Context) (int, error)

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

func (*FoodUpdate) SaveX

func (fu *FoodUpdate) SaveX(ctx context.Context) int

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

func (*FoodUpdate) SetBrand

func (fu *FoodUpdate) SetBrand(s string) *FoodUpdate

SetBrand sets the "brand" field.

func (*FoodUpdate) SetCal100

func (fu *FoodUpdate) SetCal100(f float64) *FoodUpdate

SetCal100 sets the "cal100" field.

func (*FoodUpdate) SetCarb100

func (fu *FoodUpdate) SetCarb100(f float64) *FoodUpdate

SetCarb100 sets the "carb100" field.

func (*FoodUpdate) SetComment

func (fu *FoodUpdate) SetComment(s string) *FoodUpdate

SetComment sets the "comment" field.

func (*FoodUpdate) SetFat100

func (fu *FoodUpdate) SetFat100(f float64) *FoodUpdate

SetFat100 sets the "fat100" field.

func (*FoodUpdate) SetKey

func (fu *FoodUpdate) SetKey(s string) *FoodUpdate

SetKey sets the "key" field.

func (*FoodUpdate) SetName

func (fu *FoodUpdate) SetName(s string) *FoodUpdate

SetName sets the "name" field.

func (*FoodUpdate) SetNillableBrand

func (fu *FoodUpdate) SetNillableBrand(s *string) *FoodUpdate

SetNillableBrand sets the "brand" field if the given value is not nil.

func (*FoodUpdate) SetNillableCal100

func (fu *FoodUpdate) SetNillableCal100(f *float64) *FoodUpdate

SetNillableCal100 sets the "cal100" field if the given value is not nil.

func (*FoodUpdate) SetNillableCarb100

func (fu *FoodUpdate) SetNillableCarb100(f *float64) *FoodUpdate

SetNillableCarb100 sets the "carb100" field if the given value is not nil.

func (*FoodUpdate) SetNillableComment

func (fu *FoodUpdate) SetNillableComment(s *string) *FoodUpdate

SetNillableComment sets the "comment" field if the given value is not nil.

func (*FoodUpdate) SetNillableFat100

func (fu *FoodUpdate) SetNillableFat100(f *float64) *FoodUpdate

SetNillableFat100 sets the "fat100" field if the given value is not nil.

func (*FoodUpdate) SetNillableKey

func (fu *FoodUpdate) SetNillableKey(s *string) *FoodUpdate

SetNillableKey sets the "key" field if the given value is not nil.

func (*FoodUpdate) SetNillableName

func (fu *FoodUpdate) SetNillableName(s *string) *FoodUpdate

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

func (*FoodUpdate) SetNillableProt100

func (fu *FoodUpdate) SetNillableProt100(f *float64) *FoodUpdate

SetNillableProt100 sets the "prot100" field if the given value is not nil.

func (*FoodUpdate) SetProt100

func (fu *FoodUpdate) SetProt100(f float64) *FoodUpdate

SetProt100 sets the "prot100" field.

func (*FoodUpdate) Where

func (fu *FoodUpdate) Where(ps ...predicate.Food) *FoodUpdate

Where appends a list predicates to the FoodUpdate builder.

type FoodUpdateOne

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

FoodUpdateOne is the builder for updating a single Food entity.

func (*FoodUpdateOne) AddCal100

func (fuo *FoodUpdateOne) AddCal100(f float64) *FoodUpdateOne

AddCal100 adds f to the "cal100" field.

func (*FoodUpdateOne) AddCarb100

func (fuo *FoodUpdateOne) AddCarb100(f float64) *FoodUpdateOne

AddCarb100 adds f to the "carb100" field.

func (*FoodUpdateOne) AddFat100

func (fuo *FoodUpdateOne) AddFat100(f float64) *FoodUpdateOne

AddFat100 adds f to the "fat100" field.

func (*FoodUpdateOne) AddJournalIDs

func (fuo *FoodUpdateOne) AddJournalIDs(ids ...int) *FoodUpdateOne

AddJournalIDs adds the "journals" edge to the Journal entity by IDs.

func (*FoodUpdateOne) AddJournals

func (fuo *FoodUpdateOne) AddJournals(j ...*Journal) *FoodUpdateOne

AddJournals adds the "journals" edges to the Journal entity.

func (*FoodUpdateOne) AddProt100

func (fuo *FoodUpdateOne) AddProt100(f float64) *FoodUpdateOne

AddProt100 adds f to the "prot100" field.

func (*FoodUpdateOne) ClearBrand

func (fuo *FoodUpdateOne) ClearBrand() *FoodUpdateOne

ClearBrand clears the value of the "brand" field.

func (*FoodUpdateOne) ClearComment

func (fuo *FoodUpdateOne) ClearComment() *FoodUpdateOne

ClearComment clears the value of the "comment" field.

func (*FoodUpdateOne) ClearJournals

func (fuo *FoodUpdateOne) ClearJournals() *FoodUpdateOne

ClearJournals clears all "journals" edges to the Journal entity.

func (*FoodUpdateOne) Exec

func (fuo *FoodUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*FoodUpdateOne) ExecX

func (fuo *FoodUpdateOne) ExecX(ctx context.Context)

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

func (*FoodUpdateOne) Modify

func (fuo *FoodUpdateOne) Modify(modifiers ...func(u *sql.UpdateBuilder)) *FoodUpdateOne

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

func (*FoodUpdateOne) Mutation

func (fuo *FoodUpdateOne) Mutation() *FoodMutation

Mutation returns the FoodMutation object of the builder.

func (*FoodUpdateOne) RemoveJournalIDs

func (fuo *FoodUpdateOne) RemoveJournalIDs(ids ...int) *FoodUpdateOne

RemoveJournalIDs removes the "journals" edge to Journal entities by IDs.

func (*FoodUpdateOne) RemoveJournals

func (fuo *FoodUpdateOne) RemoveJournals(j ...*Journal) *FoodUpdateOne

RemoveJournals removes "journals" edges to Journal entities.

func (*FoodUpdateOne) Save

func (fuo *FoodUpdateOne) Save(ctx context.Context) (*Food, error)

Save executes the query and returns the updated Food entity.

func (*FoodUpdateOne) SaveX

func (fuo *FoodUpdateOne) SaveX(ctx context.Context) *Food

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

func (*FoodUpdateOne) Select

func (fuo *FoodUpdateOne) Select(field string, fields ...string) *FoodUpdateOne

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

func (*FoodUpdateOne) SetBrand

func (fuo *FoodUpdateOne) SetBrand(s string) *FoodUpdateOne

SetBrand sets the "brand" field.

func (*FoodUpdateOne) SetCal100

func (fuo *FoodUpdateOne) SetCal100(f float64) *FoodUpdateOne

SetCal100 sets the "cal100" field.

func (*FoodUpdateOne) SetCarb100

func (fuo *FoodUpdateOne) SetCarb100(f float64) *FoodUpdateOne

SetCarb100 sets the "carb100" field.

func (*FoodUpdateOne) SetComment

func (fuo *FoodUpdateOne) SetComment(s string) *FoodUpdateOne

SetComment sets the "comment" field.

func (*FoodUpdateOne) SetFat100

func (fuo *FoodUpdateOne) SetFat100(f float64) *FoodUpdateOne

SetFat100 sets the "fat100" field.

func (*FoodUpdateOne) SetKey

func (fuo *FoodUpdateOne) SetKey(s string) *FoodUpdateOne

SetKey sets the "key" field.

func (*FoodUpdateOne) SetName

func (fuo *FoodUpdateOne) SetName(s string) *FoodUpdateOne

SetName sets the "name" field.

func (*FoodUpdateOne) SetNillableBrand

func (fuo *FoodUpdateOne) SetNillableBrand(s *string) *FoodUpdateOne

SetNillableBrand sets the "brand" field if the given value is not nil.

func (*FoodUpdateOne) SetNillableCal100

func (fuo *FoodUpdateOne) SetNillableCal100(f *float64) *FoodUpdateOne

SetNillableCal100 sets the "cal100" field if the given value is not nil.

func (*FoodUpdateOne) SetNillableCarb100

func (fuo *FoodUpdateOne) SetNillableCarb100(f *float64) *FoodUpdateOne

SetNillableCarb100 sets the "carb100" field if the given value is not nil.

func (*FoodUpdateOne) SetNillableComment

func (fuo *FoodUpdateOne) SetNillableComment(s *string) *FoodUpdateOne

SetNillableComment sets the "comment" field if the given value is not nil.

func (*FoodUpdateOne) SetNillableFat100

func (fuo *FoodUpdateOne) SetNillableFat100(f *float64) *FoodUpdateOne

SetNillableFat100 sets the "fat100" field if the given value is not nil.

func (*FoodUpdateOne) SetNillableKey

func (fuo *FoodUpdateOne) SetNillableKey(s *string) *FoodUpdateOne

SetNillableKey sets the "key" field if the given value is not nil.

func (*FoodUpdateOne) SetNillableName

func (fuo *FoodUpdateOne) SetNillableName(s *string) *FoodUpdateOne

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

func (*FoodUpdateOne) SetNillableProt100

func (fuo *FoodUpdateOne) SetNillableProt100(f *float64) *FoodUpdateOne

SetNillableProt100 sets the "prot100" field if the given value is not nil.

func (*FoodUpdateOne) SetProt100

func (fuo *FoodUpdateOne) SetProt100(f float64) *FoodUpdateOne

SetProt100 sets the "prot100" field.

func (*FoodUpdateOne) Where

func (fuo *FoodUpdateOne) Where(ps ...predicate.Food) *FoodUpdateOne

Where appends a list predicates to the FoodUpdate builder.

type FoodUpsert

type FoodUpsert struct {
	*sql.UpdateSet
}

FoodUpsert is the "OnConflict" setter.

func (*FoodUpsert) AddCal100

func (u *FoodUpsert) AddCal100(v float64) *FoodUpsert

AddCal100 adds v to the "cal100" field.

func (*FoodUpsert) AddCarb100

func (u *FoodUpsert) AddCarb100(v float64) *FoodUpsert

AddCarb100 adds v to the "carb100" field.

func (*FoodUpsert) AddFat100

func (u *FoodUpsert) AddFat100(v float64) *FoodUpsert

AddFat100 adds v to the "fat100" field.

func (*FoodUpsert) AddProt100

func (u *FoodUpsert) AddProt100(v float64) *FoodUpsert

AddProt100 adds v to the "prot100" field.

func (*FoodUpsert) ClearBrand

func (u *FoodUpsert) ClearBrand() *FoodUpsert

ClearBrand clears the value of the "brand" field.

func (*FoodUpsert) ClearComment

func (u *FoodUpsert) ClearComment() *FoodUpsert

ClearComment clears the value of the "comment" field.

func (*FoodUpsert) SetBrand

func (u *FoodUpsert) SetBrand(v string) *FoodUpsert

SetBrand sets the "brand" field.

func (*FoodUpsert) SetCal100

func (u *FoodUpsert) SetCal100(v float64) *FoodUpsert

SetCal100 sets the "cal100" field.

func (*FoodUpsert) SetCarb100

func (u *FoodUpsert) SetCarb100(v float64) *FoodUpsert

SetCarb100 sets the "carb100" field.

func (*FoodUpsert) SetComment

func (u *FoodUpsert) SetComment(v string) *FoodUpsert

SetComment sets the "comment" field.

func (*FoodUpsert) SetFat100

func (u *FoodUpsert) SetFat100(v float64) *FoodUpsert

SetFat100 sets the "fat100" field.

func (*FoodUpsert) SetKey

func (u *FoodUpsert) SetKey(v string) *FoodUpsert

SetKey sets the "key" field.

func (*FoodUpsert) SetName

func (u *FoodUpsert) SetName(v string) *FoodUpsert

SetName sets the "name" field.

func (*FoodUpsert) SetProt100

func (u *FoodUpsert) SetProt100(v float64) *FoodUpsert

SetProt100 sets the "prot100" field.

func (*FoodUpsert) UpdateBrand

func (u *FoodUpsert) UpdateBrand() *FoodUpsert

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

func (*FoodUpsert) UpdateCal100

func (u *FoodUpsert) UpdateCal100() *FoodUpsert

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

func (*FoodUpsert) UpdateCarb100

func (u *FoodUpsert) UpdateCarb100() *FoodUpsert

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

func (*FoodUpsert) UpdateComment

func (u *FoodUpsert) UpdateComment() *FoodUpsert

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

func (*FoodUpsert) UpdateFat100

func (u *FoodUpsert) UpdateFat100() *FoodUpsert

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

func (*FoodUpsert) UpdateKey

func (u *FoodUpsert) UpdateKey() *FoodUpsert

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

func (*FoodUpsert) UpdateName

func (u *FoodUpsert) UpdateName() *FoodUpsert

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

func (*FoodUpsert) UpdateProt100

func (u *FoodUpsert) UpdateProt100() *FoodUpsert

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

type FoodUpsertBulk

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

FoodUpsertBulk is the builder for "upsert"-ing a bulk of Food nodes.

func (*FoodUpsertBulk) AddCal100

func (u *FoodUpsertBulk) AddCal100(v float64) *FoodUpsertBulk

AddCal100 adds v to the "cal100" field.

func (*FoodUpsertBulk) AddCarb100

func (u *FoodUpsertBulk) AddCarb100(v float64) *FoodUpsertBulk

AddCarb100 adds v to the "carb100" field.

func (*FoodUpsertBulk) AddFat100

func (u *FoodUpsertBulk) AddFat100(v float64) *FoodUpsertBulk

AddFat100 adds v to the "fat100" field.

func (*FoodUpsertBulk) AddProt100

func (u *FoodUpsertBulk) AddProt100(v float64) *FoodUpsertBulk

AddProt100 adds v to the "prot100" field.

func (*FoodUpsertBulk) ClearBrand

func (u *FoodUpsertBulk) ClearBrand() *FoodUpsertBulk

ClearBrand clears the value of the "brand" field.

func (*FoodUpsertBulk) ClearComment

func (u *FoodUpsertBulk) ClearComment() *FoodUpsertBulk

ClearComment clears the value of the "comment" field.

func (*FoodUpsertBulk) DoNothing

func (u *FoodUpsertBulk) DoNothing() *FoodUpsertBulk

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

func (*FoodUpsertBulk) Exec

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

Exec executes the query.

func (*FoodUpsertBulk) ExecX

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

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

func (*FoodUpsertBulk) Ignore

func (u *FoodUpsertBulk) Ignore() *FoodUpsertBulk

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

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

func (*FoodUpsertBulk) SetBrand

func (u *FoodUpsertBulk) SetBrand(v string) *FoodUpsertBulk

SetBrand sets the "brand" field.

func (*FoodUpsertBulk) SetCal100

func (u *FoodUpsertBulk) SetCal100(v float64) *FoodUpsertBulk

SetCal100 sets the "cal100" field.

func (*FoodUpsertBulk) SetCarb100

func (u *FoodUpsertBulk) SetCarb100(v float64) *FoodUpsertBulk

SetCarb100 sets the "carb100" field.

func (*FoodUpsertBulk) SetComment

func (u *FoodUpsertBulk) SetComment(v string) *FoodUpsertBulk

SetComment sets the "comment" field.

func (*FoodUpsertBulk) SetFat100

func (u *FoodUpsertBulk) SetFat100(v float64) *FoodUpsertBulk

SetFat100 sets the "fat100" field.

func (*FoodUpsertBulk) SetKey

func (u *FoodUpsertBulk) SetKey(v string) *FoodUpsertBulk

SetKey sets the "key" field.

func (*FoodUpsertBulk) SetName

func (u *FoodUpsertBulk) SetName(v string) *FoodUpsertBulk

SetName sets the "name" field.

func (*FoodUpsertBulk) SetProt100

func (u *FoodUpsertBulk) SetProt100(v float64) *FoodUpsertBulk

SetProt100 sets the "prot100" field.

func (*FoodUpsertBulk) Update

func (u *FoodUpsertBulk) Update(set func(*FoodUpsert)) *FoodUpsertBulk

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

func (*FoodUpsertBulk) UpdateBrand

func (u *FoodUpsertBulk) UpdateBrand() *FoodUpsertBulk

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

func (*FoodUpsertBulk) UpdateCal100

func (u *FoodUpsertBulk) UpdateCal100() *FoodUpsertBulk

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

func (*FoodUpsertBulk) UpdateCarb100

func (u *FoodUpsertBulk) UpdateCarb100() *FoodUpsertBulk

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

func (*FoodUpsertBulk) UpdateComment

func (u *FoodUpsertBulk) UpdateComment() *FoodUpsertBulk

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

func (*FoodUpsertBulk) UpdateFat100

func (u *FoodUpsertBulk) UpdateFat100() *FoodUpsertBulk

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

func (*FoodUpsertBulk) UpdateKey

func (u *FoodUpsertBulk) UpdateKey() *FoodUpsertBulk

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

func (*FoodUpsertBulk) UpdateName

func (u *FoodUpsertBulk) UpdateName() *FoodUpsertBulk

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

func (*FoodUpsertBulk) UpdateNewValues

func (u *FoodUpsertBulk) UpdateNewValues() *FoodUpsertBulk

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

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

func (*FoodUpsertBulk) UpdateProt100

func (u *FoodUpsertBulk) UpdateProt100() *FoodUpsertBulk

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

type FoodUpsertOne

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

FoodUpsertOne is the builder for "upsert"-ing

one Food node.

func (*FoodUpsertOne) AddCal100

func (u *FoodUpsertOne) AddCal100(v float64) *FoodUpsertOne

AddCal100 adds v to the "cal100" field.

func (*FoodUpsertOne) AddCarb100

func (u *FoodUpsertOne) AddCarb100(v float64) *FoodUpsertOne

AddCarb100 adds v to the "carb100" field.

func (*FoodUpsertOne) AddFat100

func (u *FoodUpsertOne) AddFat100(v float64) *FoodUpsertOne

AddFat100 adds v to the "fat100" field.

func (*FoodUpsertOne) AddProt100

func (u *FoodUpsertOne) AddProt100(v float64) *FoodUpsertOne

AddProt100 adds v to the "prot100" field.

func (*FoodUpsertOne) ClearBrand

func (u *FoodUpsertOne) ClearBrand() *FoodUpsertOne

ClearBrand clears the value of the "brand" field.

func (*FoodUpsertOne) ClearComment

func (u *FoodUpsertOne) ClearComment() *FoodUpsertOne

ClearComment clears the value of the "comment" field.

func (*FoodUpsertOne) DoNothing

func (u *FoodUpsertOne) DoNothing() *FoodUpsertOne

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

func (*FoodUpsertOne) Exec

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

Exec executes the query.

func (*FoodUpsertOne) ExecX

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

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

func (*FoodUpsertOne) ID

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

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

func (*FoodUpsertOne) IDX

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

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

func (*FoodUpsertOne) Ignore

func (u *FoodUpsertOne) Ignore() *FoodUpsertOne

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

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

func (*FoodUpsertOne) SetBrand

func (u *FoodUpsertOne) SetBrand(v string) *FoodUpsertOne

SetBrand sets the "brand" field.

func (*FoodUpsertOne) SetCal100

func (u *FoodUpsertOne) SetCal100(v float64) *FoodUpsertOne

SetCal100 sets the "cal100" field.

func (*FoodUpsertOne) SetCarb100

func (u *FoodUpsertOne) SetCarb100(v float64) *FoodUpsertOne

SetCarb100 sets the "carb100" field.

func (*FoodUpsertOne) SetComment

func (u *FoodUpsertOne) SetComment(v string) *FoodUpsertOne

SetComment sets the "comment" field.

func (*FoodUpsertOne) SetFat100

func (u *FoodUpsertOne) SetFat100(v float64) *FoodUpsertOne

SetFat100 sets the "fat100" field.

func (*FoodUpsertOne) SetKey

func (u *FoodUpsertOne) SetKey(v string) *FoodUpsertOne

SetKey sets the "key" field.

func (*FoodUpsertOne) SetName

func (u *FoodUpsertOne) SetName(v string) *FoodUpsertOne

SetName sets the "name" field.

func (*FoodUpsertOne) SetProt100

func (u *FoodUpsertOne) SetProt100(v float64) *FoodUpsertOne

SetProt100 sets the "prot100" field.

func (*FoodUpsertOne) Update

func (u *FoodUpsertOne) Update(set func(*FoodUpsert)) *FoodUpsertOne

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

func (*FoodUpsertOne) UpdateBrand

func (u *FoodUpsertOne) UpdateBrand() *FoodUpsertOne

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

func (*FoodUpsertOne) UpdateCal100

func (u *FoodUpsertOne) UpdateCal100() *FoodUpsertOne

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

func (*FoodUpsertOne) UpdateCarb100

func (u *FoodUpsertOne) UpdateCarb100() *FoodUpsertOne

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

func (*FoodUpsertOne) UpdateComment

func (u *FoodUpsertOne) UpdateComment() *FoodUpsertOne

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

func (*FoodUpsertOne) UpdateFat100

func (u *FoodUpsertOne) UpdateFat100() *FoodUpsertOne

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

func (*FoodUpsertOne) UpdateKey

func (u *FoodUpsertOne) UpdateKey() *FoodUpsertOne

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

func (*FoodUpsertOne) UpdateName

func (u *FoodUpsertOne) UpdateName() *FoodUpsertOne

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

func (*FoodUpsertOne) UpdateNewValues

func (u *FoodUpsertOne) UpdateNewValues() *FoodUpsertOne

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

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

func (*FoodUpsertOne) UpdateProt100

func (u *FoodUpsertOne) UpdateProt100() *FoodUpsertOne

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

type Foods

type Foods []*Food

Foods is a parsable slice of Food.

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 Journal

type Journal struct {

	// ID of the ent.
	ID int `json:"id,omitempty"`
	// Userid holds the value of the "userid" field.
	Userid int64 `json:"userid,omitempty"`
	// Timestamp holds the value of the "timestamp" field.
	Timestamp time.Time `json:"timestamp,omitempty"`
	// Meal holds the value of the "meal" field.
	Meal int64 `json:"meal,omitempty"`
	// Foodweight holds the value of the "foodweight" field.
	Foodweight float64 `json:"foodweight,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the JournalQuery when eager-loading is set.
	Edges JournalEdges `json:"edges"`
	// contains filtered or unexported fields
}

Journal is the model entity for the Journal schema.

func (*Journal) QueryFood

func (j *Journal) QueryFood() *FoodQuery

QueryFood queries the "food" edge of the Journal entity.

func (*Journal) String

func (j *Journal) String() string

String implements the fmt.Stringer.

func (*Journal) Unwrap

func (j *Journal) Unwrap() *Journal

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

func (j *Journal) Update() *JournalUpdateOne

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

func (*Journal) Value

func (j *Journal) Value(name string) (ent.Value, error)

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

type JournalClient

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

JournalClient is a client for the Journal schema.

func NewJournalClient

func NewJournalClient(c config) *JournalClient

NewJournalClient returns a client for the Journal from the given config.

func (*JournalClient) Create

func (c *JournalClient) Create() *JournalCreate

Create returns a builder for creating a Journal entity.

func (*JournalClient) CreateBulk

func (c *JournalClient) CreateBulk(builders ...*JournalCreate) *JournalCreateBulk

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

func (*JournalClient) Delete

func (c *JournalClient) Delete() *JournalDelete

Delete returns a delete builder for Journal.

func (*JournalClient) DeleteOne

func (c *JournalClient) DeleteOne(j *Journal) *JournalDeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*JournalClient) DeleteOneID

func (c *JournalClient) DeleteOneID(id int) *JournalDeleteOne

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

func (*JournalClient) Get

func (c *JournalClient) Get(ctx context.Context, id int) (*Journal, error)

Get returns a Journal entity by its id.

func (*JournalClient) GetX

func (c *JournalClient) GetX(ctx context.Context, id int) *Journal

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

func (*JournalClient) Hooks

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

Hooks returns the client hooks.

func (*JournalClient) Intercept

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

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

func (*JournalClient) Interceptors

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

Interceptors returns the client interceptors.

func (*JournalClient) MapCreateBulk

func (c *JournalClient) MapCreateBulk(slice any, setFunc func(*JournalCreate, int)) *JournalCreateBulk

MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates a builder and applies setFunc on it.

func (*JournalClient) Query

func (c *JournalClient) Query() *JournalQuery

Query returns a query builder for Journal.

func (*JournalClient) QueryFood

func (c *JournalClient) QueryFood(j *Journal) *FoodQuery

QueryFood queries the food edge of a Journal.

func (*JournalClient) Update

func (c *JournalClient) Update() *JournalUpdate

Update returns an update builder for Journal.

func (*JournalClient) UpdateOne

func (c *JournalClient) UpdateOne(j *Journal) *JournalUpdateOne

UpdateOne returns an update builder for the given entity.

func (*JournalClient) UpdateOneID

func (c *JournalClient) UpdateOneID(id int) *JournalUpdateOne

UpdateOneID returns an update builder for the given id.

func (*JournalClient) Use

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

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

type JournalCreate

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

JournalCreate is the builder for creating a Journal entity.

func (*JournalCreate) Exec

func (jc *JournalCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*JournalCreate) ExecX

func (jc *JournalCreate) ExecX(ctx context.Context)

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

func (*JournalCreate) Mutation

func (jc *JournalCreate) Mutation() *JournalMutation

Mutation returns the JournalMutation object of the builder.

func (*JournalCreate) OnConflict

func (jc *JournalCreate) OnConflict(opts ...sql.ConflictOption) *JournalUpsertOne

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

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

func (*JournalCreate) OnConflictColumns

func (jc *JournalCreate) OnConflictColumns(columns ...string) *JournalUpsertOne

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

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

func (*JournalCreate) Save

func (jc *JournalCreate) Save(ctx context.Context) (*Journal, error)

Save creates the Journal in the database.

func (*JournalCreate) SaveX

func (jc *JournalCreate) SaveX(ctx context.Context) *Journal

SaveX calls Save and panics if Save returns an error.

func (*JournalCreate) SetFood

func (jc *JournalCreate) SetFood(f *Food) *JournalCreate

SetFood sets the "food" edge to the Food entity.

func (*JournalCreate) SetFoodID

func (jc *JournalCreate) SetFoodID(id int) *JournalCreate

SetFoodID sets the "food" edge to the Food entity by ID.

func (*JournalCreate) SetFoodweight

func (jc *JournalCreate) SetFoodweight(f float64) *JournalCreate

SetFoodweight sets the "foodweight" field.

func (*JournalCreate) SetMeal

func (jc *JournalCreate) SetMeal(i int64) *JournalCreate

SetMeal sets the "meal" field.

func (*JournalCreate) SetTimestamp

func (jc *JournalCreate) SetTimestamp(t time.Time) *JournalCreate

SetTimestamp sets the "timestamp" field.

func (*JournalCreate) SetUserid

func (jc *JournalCreate) SetUserid(i int64) *JournalCreate

SetUserid sets the "userid" field.

type JournalCreateBulk

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

JournalCreateBulk is the builder for creating many Journal entities in bulk.

func (*JournalCreateBulk) Exec

func (jcb *JournalCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*JournalCreateBulk) ExecX

func (jcb *JournalCreateBulk) ExecX(ctx context.Context)

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

func (*JournalCreateBulk) OnConflict

func (jcb *JournalCreateBulk) OnConflict(opts ...sql.ConflictOption) *JournalUpsertBulk

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

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

func (*JournalCreateBulk) OnConflictColumns

func (jcb *JournalCreateBulk) OnConflictColumns(columns ...string) *JournalUpsertBulk

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

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

func (*JournalCreateBulk) Save

func (jcb *JournalCreateBulk) Save(ctx context.Context) ([]*Journal, error)

Save creates the Journal entities in the database.

func (*JournalCreateBulk) SaveX

func (jcb *JournalCreateBulk) SaveX(ctx context.Context) []*Journal

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

type JournalDelete

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

JournalDelete is the builder for deleting a Journal entity.

func (*JournalDelete) Exec

func (jd *JournalDelete) Exec(ctx context.Context) (int, error)

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

func (*JournalDelete) ExecX

func (jd *JournalDelete) ExecX(ctx context.Context) int

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

func (*JournalDelete) Where

func (jd *JournalDelete) Where(ps ...predicate.Journal) *JournalDelete

Where appends a list predicates to the JournalDelete builder.

type JournalDeleteOne

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

JournalDeleteOne is the builder for deleting a single Journal entity.

func (*JournalDeleteOne) Exec

func (jdo *JournalDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*JournalDeleteOne) ExecX

func (jdo *JournalDeleteOne) ExecX(ctx context.Context)

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

func (*JournalDeleteOne) Where

Where appends a list predicates to the JournalDelete builder.

type JournalEdges

type JournalEdges struct {
	// Food holds the value of the food edge.
	Food *Food `json:"food,omitempty"`
	// contains filtered or unexported fields
}

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

func (JournalEdges) FoodOrErr

func (e JournalEdges) FoodOrErr() (*Food, error)

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

type JournalGroupBy

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

JournalGroupBy is the group-by builder for Journal entities.

func (*JournalGroupBy) Aggregate

func (jgb *JournalGroupBy) Aggregate(fns ...AggregateFunc) *JournalGroupBy

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

func (*JournalGroupBy) Bool

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

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

func (*JournalGroupBy) BoolX

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

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

func (*JournalGroupBy) Bools

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

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

func (*JournalGroupBy) BoolsX

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

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

func (*JournalGroupBy) Float64

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

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

func (*JournalGroupBy) Float64X

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

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

func (*JournalGroupBy) Float64s

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

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

func (*JournalGroupBy) Float64sX

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

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

func (*JournalGroupBy) Int

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

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

func (*JournalGroupBy) IntX

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

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

func (*JournalGroupBy) Ints

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

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

func (*JournalGroupBy) IntsX

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

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

func (*JournalGroupBy) Scan

func (jgb *JournalGroupBy) Scan(ctx context.Context, v any) error

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

func (*JournalGroupBy) ScanX

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

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

func (*JournalGroupBy) String

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

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

func (*JournalGroupBy) StringX

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

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

func (*JournalGroupBy) Strings

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

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

func (*JournalGroupBy) StringsX

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

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

type JournalMutation

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

JournalMutation represents an operation that mutates the Journal nodes in the graph.

func (*JournalMutation) AddField

func (m *JournalMutation) 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 (*JournalMutation) AddFoodweight

func (m *JournalMutation) AddFoodweight(f float64)

AddFoodweight adds f to the "foodweight" field.

func (*JournalMutation) AddMeal

func (m *JournalMutation) AddMeal(i int64)

AddMeal adds i to the "meal" field.

func (*JournalMutation) AddUserid

func (m *JournalMutation) AddUserid(i int64)

AddUserid adds i to the "userid" field.

func (*JournalMutation) AddedEdges

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

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

func (*JournalMutation) AddedField

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

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

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

func (*JournalMutation) AddedFoodweight

func (m *JournalMutation) AddedFoodweight() (r float64, exists bool)

AddedFoodweight returns the value that was added to the "foodweight" field in this mutation.

func (*JournalMutation) AddedIDs

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

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

func (*JournalMutation) AddedMeal

func (m *JournalMutation) AddedMeal() (r int64, exists bool)

AddedMeal returns the value that was added to the "meal" field in this mutation.

func (*JournalMutation) AddedUserid

func (m *JournalMutation) AddedUserid() (r int64, exists bool)

AddedUserid returns the value that was added to the "userid" field in this mutation.

func (*JournalMutation) ClearEdge

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

func (m *JournalMutation) 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 (*JournalMutation) ClearFood

func (m *JournalMutation) ClearFood()

ClearFood clears the "food" edge to the Food entity.

func (*JournalMutation) ClearedEdges

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

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

func (*JournalMutation) ClearedFields

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

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

func (JournalMutation) Client

func (m JournalMutation) 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 (*JournalMutation) EdgeCleared

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

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

func (*JournalMutation) Field

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

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

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

func (*JournalMutation) Fields

func (m *JournalMutation) 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 (*JournalMutation) FoodCleared

func (m *JournalMutation) FoodCleared() bool

FoodCleared reports if the "food" edge to the Food entity was cleared.

func (*JournalMutation) FoodID

func (m *JournalMutation) FoodID() (id int, exists bool)

FoodID returns the "food" edge ID in the mutation.

func (*JournalMutation) FoodIDs

func (m *JournalMutation) FoodIDs() (ids []int)

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

func (*JournalMutation) Foodweight

func (m *JournalMutation) Foodweight() (r float64, exists bool)

Foodweight returns the value of the "foodweight" field in the mutation.

func (*JournalMutation) ID

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

func (m *JournalMutation) 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 (*JournalMutation) Meal

func (m *JournalMutation) Meal() (r int64, exists bool)

Meal returns the value of the "meal" field in the mutation.

func (*JournalMutation) OldField

func (m *JournalMutation) 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 (*JournalMutation) OldFoodweight

func (m *JournalMutation) OldFoodweight(ctx context.Context) (v float64, err error)

OldFoodweight returns the old "foodweight" field's value of the Journal entity. If the Journal 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 (*JournalMutation) OldMeal

func (m *JournalMutation) OldMeal(ctx context.Context) (v int64, err error)

OldMeal returns the old "meal" field's value of the Journal entity. If the Journal 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 (*JournalMutation) OldTimestamp

func (m *JournalMutation) OldTimestamp(ctx context.Context) (v time.Time, err error)

OldTimestamp returns the old "timestamp" field's value of the Journal entity. If the Journal 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 (*JournalMutation) OldUserid

func (m *JournalMutation) OldUserid(ctx context.Context) (v int64, err error)

OldUserid returns the old "userid" field's value of the Journal entity. If the Journal 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 (*JournalMutation) Op

func (m *JournalMutation) Op() Op

Op returns the operation name.

func (*JournalMutation) RemovedEdges

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

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

func (*JournalMutation) RemovedIDs

func (m *JournalMutation) 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 (*JournalMutation) ResetEdge

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

func (m *JournalMutation) 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 (*JournalMutation) ResetFood

func (m *JournalMutation) ResetFood()

ResetFood resets all changes to the "food" edge.

func (*JournalMutation) ResetFoodweight

func (m *JournalMutation) ResetFoodweight()

ResetFoodweight resets all changes to the "foodweight" field.

func (*JournalMutation) ResetMeal

func (m *JournalMutation) ResetMeal()

ResetMeal resets all changes to the "meal" field.

func (*JournalMutation) ResetTimestamp

func (m *JournalMutation) ResetTimestamp()

ResetTimestamp resets all changes to the "timestamp" field.

func (*JournalMutation) ResetUserid

func (m *JournalMutation) ResetUserid()

ResetUserid resets all changes to the "userid" field.

func (*JournalMutation) SetField

func (m *JournalMutation) 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 (*JournalMutation) SetFoodID

func (m *JournalMutation) SetFoodID(id int)

SetFoodID sets the "food" edge to the Food entity by id.

func (*JournalMutation) SetFoodweight

func (m *JournalMutation) SetFoodweight(f float64)

SetFoodweight sets the "foodweight" field.

func (*JournalMutation) SetMeal

func (m *JournalMutation) SetMeal(i int64)

SetMeal sets the "meal" field.

func (*JournalMutation) SetOp

func (m *JournalMutation) SetOp(op Op)

SetOp allows setting the mutation operation.

func (*JournalMutation) SetTimestamp

func (m *JournalMutation) SetTimestamp(t time.Time)

SetTimestamp sets the "timestamp" field.

func (*JournalMutation) SetUserid

func (m *JournalMutation) SetUserid(i int64)

SetUserid sets the "userid" field.

func (*JournalMutation) Timestamp

func (m *JournalMutation) Timestamp() (r time.Time, exists bool)

Timestamp returns the value of the "timestamp" field in the mutation.

func (JournalMutation) Tx

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

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

func (*JournalMutation) Type

func (m *JournalMutation) Type() string

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

func (*JournalMutation) Userid

func (m *JournalMutation) Userid() (r int64, exists bool)

Userid returns the value of the "userid" field in the mutation.

func (*JournalMutation) Where

func (m *JournalMutation) Where(ps ...predicate.Journal)

Where appends a list predicates to the JournalMutation builder.

func (*JournalMutation) WhereP

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

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

type JournalQuery

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

JournalQuery is the builder for querying Journal entities.

func (*JournalQuery) Aggregate

func (jq *JournalQuery) Aggregate(fns ...AggregateFunc) *JournalSelect

Aggregate returns a JournalSelect configured with the given aggregations.

func (*JournalQuery) All

func (jq *JournalQuery) All(ctx context.Context) ([]*Journal, error)

All executes the query and returns a list of Journals.

func (*JournalQuery) AllX

func (jq *JournalQuery) AllX(ctx context.Context) []*Journal

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

func (*JournalQuery) Clone

func (jq *JournalQuery) Clone() *JournalQuery

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

func (*JournalQuery) Count

func (jq *JournalQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*JournalQuery) CountX

func (jq *JournalQuery) CountX(ctx context.Context) int

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

func (*JournalQuery) Exist

func (jq *JournalQuery) Exist(ctx context.Context) (bool, error)

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

func (*JournalQuery) ExistX

func (jq *JournalQuery) ExistX(ctx context.Context) bool

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

func (*JournalQuery) First

func (jq *JournalQuery) First(ctx context.Context) (*Journal, error)

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

func (*JournalQuery) FirstID

func (jq *JournalQuery) FirstID(ctx context.Context) (id int, err error)

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

func (*JournalQuery) FirstIDX

func (jq *JournalQuery) FirstIDX(ctx context.Context) int

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

func (*JournalQuery) FirstX

func (jq *JournalQuery) FirstX(ctx context.Context) *Journal

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

func (*JournalQuery) GroupBy

func (jq *JournalQuery) GroupBy(field string, fields ...string) *JournalGroupBy

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 {
	Userid int64 `json:"userid,omitempty"`
	Count int `json:"count,omitempty"`
}

client.Journal.Query().
	GroupBy(journal.FieldUserid).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*JournalQuery) IDs

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

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

func (*JournalQuery) IDsX

func (jq *JournalQuery) IDsX(ctx context.Context) []int

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

func (*JournalQuery) Limit

func (jq *JournalQuery) Limit(limit int) *JournalQuery

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

func (*JournalQuery) Modify

func (jq *JournalQuery) Modify(modifiers ...func(s *sql.Selector)) *JournalSelect

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

func (*JournalQuery) Offset

func (jq *JournalQuery) Offset(offset int) *JournalQuery

Offset to start from.

func (*JournalQuery) Only

func (jq *JournalQuery) Only(ctx context.Context) (*Journal, error)

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

func (*JournalQuery) OnlyID

func (jq *JournalQuery) OnlyID(ctx context.Context) (id int, err error)

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

func (*JournalQuery) OnlyIDX

func (jq *JournalQuery) OnlyIDX(ctx context.Context) int

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

func (*JournalQuery) OnlyX

func (jq *JournalQuery) OnlyX(ctx context.Context) *Journal

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

func (*JournalQuery) Order

func (jq *JournalQuery) Order(o ...journal.OrderOption) *JournalQuery

Order specifies how the records should be ordered.

func (*JournalQuery) QueryFood

func (jq *JournalQuery) QueryFood() *FoodQuery

QueryFood chains the current query on the "food" edge.

func (*JournalQuery) Select

func (jq *JournalQuery) Select(fields ...string) *JournalSelect

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 {
	Userid int64 `json:"userid,omitempty"`
}

client.Journal.Query().
	Select(journal.FieldUserid).
	Scan(ctx, &v)

func (*JournalQuery) Unique

func (jq *JournalQuery) Unique(unique bool) *JournalQuery

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

func (jq *JournalQuery) Where(ps ...predicate.Journal) *JournalQuery

Where adds a new predicate for the JournalQuery builder.

func (*JournalQuery) WithFood

func (jq *JournalQuery) WithFood(opts ...func(*FoodQuery)) *JournalQuery

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

type JournalSelect

type JournalSelect struct {
	*JournalQuery
	// contains filtered or unexported fields
}

JournalSelect is the builder for selecting fields of Journal entities.

func (*JournalSelect) Aggregate

func (js *JournalSelect) Aggregate(fns ...AggregateFunc) *JournalSelect

Aggregate adds the given aggregation functions to the selector query.

func (*JournalSelect) Bool

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

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

func (*JournalSelect) BoolX

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

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

func (*JournalSelect) Bools

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

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

func (*JournalSelect) BoolsX

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

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

func (*JournalSelect) Float64

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

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

func (*JournalSelect) Float64X

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

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

func (*JournalSelect) Float64s

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

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

func (*JournalSelect) Float64sX

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

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

func (*JournalSelect) Int

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

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

func (*JournalSelect) IntX

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

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

func (*JournalSelect) Ints

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

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

func (*JournalSelect) IntsX

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

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

func (*JournalSelect) Modify

func (js *JournalSelect) Modify(modifiers ...func(s *sql.Selector)) *JournalSelect

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

func (*JournalSelect) Scan

func (js *JournalSelect) Scan(ctx context.Context, v any) error

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

func (*JournalSelect) ScanX

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

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

func (*JournalSelect) String

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

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

func (*JournalSelect) StringX

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

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

func (*JournalSelect) Strings

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

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

func (*JournalSelect) StringsX

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

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

type JournalUpdate

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

JournalUpdate is the builder for updating Journal entities.

func (*JournalUpdate) AddFoodweight

func (ju *JournalUpdate) AddFoodweight(f float64) *JournalUpdate

AddFoodweight adds f to the "foodweight" field.

func (*JournalUpdate) AddMeal

func (ju *JournalUpdate) AddMeal(i int64) *JournalUpdate

AddMeal adds i to the "meal" field.

func (*JournalUpdate) AddUserid

func (ju *JournalUpdate) AddUserid(i int64) *JournalUpdate

AddUserid adds i to the "userid" field.

func (*JournalUpdate) ClearFood

func (ju *JournalUpdate) ClearFood() *JournalUpdate

ClearFood clears the "food" edge to the Food entity.

func (*JournalUpdate) Exec

func (ju *JournalUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*JournalUpdate) ExecX

func (ju *JournalUpdate) ExecX(ctx context.Context)

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

func (*JournalUpdate) Modify

func (ju *JournalUpdate) Modify(modifiers ...func(u *sql.UpdateBuilder)) *JournalUpdate

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

func (*JournalUpdate) Mutation

func (ju *JournalUpdate) Mutation() *JournalMutation

Mutation returns the JournalMutation object of the builder.

func (*JournalUpdate) Save

func (ju *JournalUpdate) Save(ctx context.Context) (int, error)

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

func (*JournalUpdate) SaveX

func (ju *JournalUpdate) SaveX(ctx context.Context) int

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

func (*JournalUpdate) SetFood

func (ju *JournalUpdate) SetFood(f *Food) *JournalUpdate

SetFood sets the "food" edge to the Food entity.

func (*JournalUpdate) SetFoodID

func (ju *JournalUpdate) SetFoodID(id int) *JournalUpdate

SetFoodID sets the "food" edge to the Food entity by ID.

func (*JournalUpdate) SetFoodweight

func (ju *JournalUpdate) SetFoodweight(f float64) *JournalUpdate

SetFoodweight sets the "foodweight" field.

func (*JournalUpdate) SetMeal

func (ju *JournalUpdate) SetMeal(i int64) *JournalUpdate

SetMeal sets the "meal" field.

func (*JournalUpdate) SetNillableFoodweight

func (ju *JournalUpdate) SetNillableFoodweight(f *float64) *JournalUpdate

SetNillableFoodweight sets the "foodweight" field if the given value is not nil.

func (*JournalUpdate) SetNillableMeal

func (ju *JournalUpdate) SetNillableMeal(i *int64) *JournalUpdate

SetNillableMeal sets the "meal" field if the given value is not nil.

func (*JournalUpdate) SetNillableTimestamp

func (ju *JournalUpdate) SetNillableTimestamp(t *time.Time) *JournalUpdate

SetNillableTimestamp sets the "timestamp" field if the given value is not nil.

func (*JournalUpdate) SetNillableUserid

func (ju *JournalUpdate) SetNillableUserid(i *int64) *JournalUpdate

SetNillableUserid sets the "userid" field if the given value is not nil.

func (*JournalUpdate) SetTimestamp

func (ju *JournalUpdate) SetTimestamp(t time.Time) *JournalUpdate

SetTimestamp sets the "timestamp" field.

func (*JournalUpdate) SetUserid

func (ju *JournalUpdate) SetUserid(i int64) *JournalUpdate

SetUserid sets the "userid" field.

func (*JournalUpdate) Where

func (ju *JournalUpdate) Where(ps ...predicate.Journal) *JournalUpdate

Where appends a list predicates to the JournalUpdate builder.

type JournalUpdateOne

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

JournalUpdateOne is the builder for updating a single Journal entity.

func (*JournalUpdateOne) AddFoodweight

func (juo *JournalUpdateOne) AddFoodweight(f float64) *JournalUpdateOne

AddFoodweight adds f to the "foodweight" field.

func (*JournalUpdateOne) AddMeal

func (juo *JournalUpdateOne) AddMeal(i int64) *JournalUpdateOne

AddMeal adds i to the "meal" field.

func (*JournalUpdateOne) AddUserid

func (juo *JournalUpdateOne) AddUserid(i int64) *JournalUpdateOne

AddUserid adds i to the "userid" field.

func (*JournalUpdateOne) ClearFood

func (juo *JournalUpdateOne) ClearFood() *JournalUpdateOne

ClearFood clears the "food" edge to the Food entity.

func (*JournalUpdateOne) Exec

func (juo *JournalUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*JournalUpdateOne) ExecX

func (juo *JournalUpdateOne) ExecX(ctx context.Context)

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

func (*JournalUpdateOne) Modify

func (juo *JournalUpdateOne) Modify(modifiers ...func(u *sql.UpdateBuilder)) *JournalUpdateOne

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

func (*JournalUpdateOne) Mutation

func (juo *JournalUpdateOne) Mutation() *JournalMutation

Mutation returns the JournalMutation object of the builder.

func (*JournalUpdateOne) Save

func (juo *JournalUpdateOne) Save(ctx context.Context) (*Journal, error)

Save executes the query and returns the updated Journal entity.

func (*JournalUpdateOne) SaveX

func (juo *JournalUpdateOne) SaveX(ctx context.Context) *Journal

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

func (*JournalUpdateOne) Select

func (juo *JournalUpdateOne) Select(field string, fields ...string) *JournalUpdateOne

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

func (*JournalUpdateOne) SetFood

func (juo *JournalUpdateOne) SetFood(f *Food) *JournalUpdateOne

SetFood sets the "food" edge to the Food entity.

func (*JournalUpdateOne) SetFoodID

func (juo *JournalUpdateOne) SetFoodID(id int) *JournalUpdateOne

SetFoodID sets the "food" edge to the Food entity by ID.

func (*JournalUpdateOne) SetFoodweight

func (juo *JournalUpdateOne) SetFoodweight(f float64) *JournalUpdateOne

SetFoodweight sets the "foodweight" field.

func (*JournalUpdateOne) SetMeal

func (juo *JournalUpdateOne) SetMeal(i int64) *JournalUpdateOne

SetMeal sets the "meal" field.

func (*JournalUpdateOne) SetNillableFoodweight

func (juo *JournalUpdateOne) SetNillableFoodweight(f *float64) *JournalUpdateOne

SetNillableFoodweight sets the "foodweight" field if the given value is not nil.

func (*JournalUpdateOne) SetNillableMeal

func (juo *JournalUpdateOne) SetNillableMeal(i *int64) *JournalUpdateOne

SetNillableMeal sets the "meal" field if the given value is not nil.

func (*JournalUpdateOne) SetNillableTimestamp

func (juo *JournalUpdateOne) SetNillableTimestamp(t *time.Time) *JournalUpdateOne

SetNillableTimestamp sets the "timestamp" field if the given value is not nil.

func (*JournalUpdateOne) SetNillableUserid

func (juo *JournalUpdateOne) SetNillableUserid(i *int64) *JournalUpdateOne

SetNillableUserid sets the "userid" field if the given value is not nil.

func (*JournalUpdateOne) SetTimestamp

func (juo *JournalUpdateOne) SetTimestamp(t time.Time) *JournalUpdateOne

SetTimestamp sets the "timestamp" field.

func (*JournalUpdateOne) SetUserid

func (juo *JournalUpdateOne) SetUserid(i int64) *JournalUpdateOne

SetUserid sets the "userid" field.

func (*JournalUpdateOne) Where

Where appends a list predicates to the JournalUpdate builder.

type JournalUpsert

type JournalUpsert struct {
	*sql.UpdateSet
}

JournalUpsert is the "OnConflict" setter.

func (*JournalUpsert) AddFoodweight

func (u *JournalUpsert) AddFoodweight(v float64) *JournalUpsert

AddFoodweight adds v to the "foodweight" field.

func (*JournalUpsert) AddMeal

func (u *JournalUpsert) AddMeal(v int64) *JournalUpsert

AddMeal adds v to the "meal" field.

func (*JournalUpsert) AddUserid

func (u *JournalUpsert) AddUserid(v int64) *JournalUpsert

AddUserid adds v to the "userid" field.

func (*JournalUpsert) SetFoodweight

func (u *JournalUpsert) SetFoodweight(v float64) *JournalUpsert

SetFoodweight sets the "foodweight" field.

func (*JournalUpsert) SetMeal

func (u *JournalUpsert) SetMeal(v int64) *JournalUpsert

SetMeal sets the "meal" field.

func (*JournalUpsert) SetTimestamp

func (u *JournalUpsert) SetTimestamp(v time.Time) *JournalUpsert

SetTimestamp sets the "timestamp" field.

func (*JournalUpsert) SetUserid

func (u *JournalUpsert) SetUserid(v int64) *JournalUpsert

SetUserid sets the "userid" field.

func (*JournalUpsert) UpdateFoodweight

func (u *JournalUpsert) UpdateFoodweight() *JournalUpsert

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

func (*JournalUpsert) UpdateMeal

func (u *JournalUpsert) UpdateMeal() *JournalUpsert

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

func (*JournalUpsert) UpdateTimestamp

func (u *JournalUpsert) UpdateTimestamp() *JournalUpsert

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

func (*JournalUpsert) UpdateUserid

func (u *JournalUpsert) UpdateUserid() *JournalUpsert

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

type JournalUpsertBulk

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

JournalUpsertBulk is the builder for "upsert"-ing a bulk of Journal nodes.

func (*JournalUpsertBulk) AddFoodweight

func (u *JournalUpsertBulk) AddFoodweight(v float64) *JournalUpsertBulk

AddFoodweight adds v to the "foodweight" field.

func (*JournalUpsertBulk) AddMeal

func (u *JournalUpsertBulk) AddMeal(v int64) *JournalUpsertBulk

AddMeal adds v to the "meal" field.

func (*JournalUpsertBulk) AddUserid

func (u *JournalUpsertBulk) AddUserid(v int64) *JournalUpsertBulk

AddUserid adds v to the "userid" field.

func (*JournalUpsertBulk) DoNothing

func (u *JournalUpsertBulk) DoNothing() *JournalUpsertBulk

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

func (*JournalUpsertBulk) Exec

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

Exec executes the query.

func (*JournalUpsertBulk) ExecX

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

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

func (*JournalUpsertBulk) Ignore

func (u *JournalUpsertBulk) Ignore() *JournalUpsertBulk

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

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

func (*JournalUpsertBulk) SetFoodweight

func (u *JournalUpsertBulk) SetFoodweight(v float64) *JournalUpsertBulk

SetFoodweight sets the "foodweight" field.

func (*JournalUpsertBulk) SetMeal

func (u *JournalUpsertBulk) SetMeal(v int64) *JournalUpsertBulk

SetMeal sets the "meal" field.

func (*JournalUpsertBulk) SetTimestamp

func (u *JournalUpsertBulk) SetTimestamp(v time.Time) *JournalUpsertBulk

SetTimestamp sets the "timestamp" field.

func (*JournalUpsertBulk) SetUserid

func (u *JournalUpsertBulk) SetUserid(v int64) *JournalUpsertBulk

SetUserid sets the "userid" field.

func (*JournalUpsertBulk) Update

func (u *JournalUpsertBulk) Update(set func(*JournalUpsert)) *JournalUpsertBulk

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

func (*JournalUpsertBulk) UpdateFoodweight

func (u *JournalUpsertBulk) UpdateFoodweight() *JournalUpsertBulk

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

func (*JournalUpsertBulk) UpdateMeal

func (u *JournalUpsertBulk) UpdateMeal() *JournalUpsertBulk

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

func (*JournalUpsertBulk) UpdateNewValues

func (u *JournalUpsertBulk) UpdateNewValues() *JournalUpsertBulk

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

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

func (*JournalUpsertBulk) UpdateTimestamp

func (u *JournalUpsertBulk) UpdateTimestamp() *JournalUpsertBulk

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

func (*JournalUpsertBulk) UpdateUserid

func (u *JournalUpsertBulk) UpdateUserid() *JournalUpsertBulk

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

type JournalUpsertOne

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

JournalUpsertOne is the builder for "upsert"-ing

one Journal node.

func (*JournalUpsertOne) AddFoodweight

func (u *JournalUpsertOne) AddFoodweight(v float64) *JournalUpsertOne

AddFoodweight adds v to the "foodweight" field.

func (*JournalUpsertOne) AddMeal

func (u *JournalUpsertOne) AddMeal(v int64) *JournalUpsertOne

AddMeal adds v to the "meal" field.

func (*JournalUpsertOne) AddUserid

func (u *JournalUpsertOne) AddUserid(v int64) *JournalUpsertOne

AddUserid adds v to the "userid" field.

func (*JournalUpsertOne) DoNothing

func (u *JournalUpsertOne) DoNothing() *JournalUpsertOne

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

func (*JournalUpsertOne) Exec

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

Exec executes the query.

func (*JournalUpsertOne) ExecX

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

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

func (*JournalUpsertOne) ID

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

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

func (*JournalUpsertOne) IDX

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

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

func (*JournalUpsertOne) Ignore

func (u *JournalUpsertOne) Ignore() *JournalUpsertOne

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

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

func (*JournalUpsertOne) SetFoodweight

func (u *JournalUpsertOne) SetFoodweight(v float64) *JournalUpsertOne

SetFoodweight sets the "foodweight" field.

func (*JournalUpsertOne) SetMeal

func (u *JournalUpsertOne) SetMeal(v int64) *JournalUpsertOne

SetMeal sets the "meal" field.

func (*JournalUpsertOne) SetTimestamp

func (u *JournalUpsertOne) SetTimestamp(v time.Time) *JournalUpsertOne

SetTimestamp sets the "timestamp" field.

func (*JournalUpsertOne) SetUserid

func (u *JournalUpsertOne) SetUserid(v int64) *JournalUpsertOne

SetUserid sets the "userid" field.

func (*JournalUpsertOne) Update

func (u *JournalUpsertOne) Update(set func(*JournalUpsert)) *JournalUpsertOne

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

func (*JournalUpsertOne) UpdateFoodweight

func (u *JournalUpsertOne) UpdateFoodweight() *JournalUpsertOne

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

func (*JournalUpsertOne) UpdateMeal

func (u *JournalUpsertOne) UpdateMeal() *JournalUpsertOne

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

func (*JournalUpsertOne) UpdateNewValues

func (u *JournalUpsertOne) UpdateNewValues() *JournalUpsertOne

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

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

func (*JournalUpsertOne) UpdateTimestamp

func (u *JournalUpsertOne) UpdateTimestamp() *JournalUpsertOne

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

func (*JournalUpsertOne) UpdateUserid

func (u *JournalUpsertOne) UpdateUserid() *JournalUpsertOne

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

type Journals

type Journals []*Journal

Journals is a parsable slice of Journal.

type MutateFunc

type MutateFunc = ent.MutateFunc

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

type Mutation

type Mutation = ent.Mutation

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

type Mutator

type Mutator = ent.Mutator

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

type NotFoundError

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

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

func (*NotFoundError) Error

func (e *NotFoundError) Error() string

Error implements the error interface.

type NotLoadedError

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

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

func (*NotLoadedError) Error

func (e *NotLoadedError) Error() string

Error implements the error interface.

type NotSingularError

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

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

func (*NotSingularError) Error

func (e *NotSingularError) Error() string

Error implements the error interface.

type Op

type Op = ent.Op

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

type Option

type Option func(*config)

Option function to configure the client.

func Debug

func Debug() Option

Debug enables debug logging on the ent.Driver.

func Driver

func Driver(driver dialect.Driver) Option

Driver configures the client driver.

func Log

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

Log sets the logging function for debug mode.

type OrderFunc

type OrderFunc func(*sql.Selector)

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

type Policy

type Policy = ent.Policy

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

type Querier

type Querier = ent.Querier

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

type QuerierFunc

type QuerierFunc = ent.QuerierFunc

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

type Query

type Query = ent.Query

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

type QueryContext

type QueryContext = ent.QueryContext

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

type RollbackFunc

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

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

func (RollbackFunc) Rollback

func (f RollbackFunc) Rollback(ctx context.Context, tx *Tx) error

Rollback calls f(ctx, m).

type RollbackHook

type RollbackHook func(Rollbacker) Rollbacker

RollbackHook defines the "rollback middleware". A function that gets a Rollbacker and returns a Rollbacker. For example:

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

type Rollbacker

type Rollbacker interface {
	Rollback(context.Context, *Tx) error
}

Rollbacker is the interface that wraps the Rollback method.

type TraverseFunc

type TraverseFunc = ent.TraverseFunc

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

type Traverser

type Traverser = ent.Traverser

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

type Tx

type Tx struct {

	// Food is the client for interacting with the Food builders.
	Food *FoodClient
	// Journal is the client for interacting with the Journal builders.
	Journal *JournalClient
	// UserSettings is the client for interacting with the UserSettings builders.
	UserSettings *UserSettingsClient
	// Weight is the client for interacting with the Weight builders.
	Weight *WeightClient
	// 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 UserSettings

type UserSettings struct {

	// ID of the ent.
	ID int `json:"id,omitempty"`
	// Userid holds the value of the "userid" field.
	Userid int64 `json:"userid,omitempty"`
	// CalLimit holds the value of the "cal_limit" field.
	CalLimit float64 `json:"cal_limit,omitempty"`
	// contains filtered or unexported fields
}

UserSettings is the model entity for the UserSettings schema.

func (*UserSettings) String

func (us *UserSettings) String() string

String implements the fmt.Stringer.

func (*UserSettings) Unwrap

func (us *UserSettings) Unwrap() *UserSettings

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

func (us *UserSettings) Update() *UserSettingsUpdateOne

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

func (*UserSettings) Value

func (us *UserSettings) Value(name string) (ent.Value, error)

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

type UserSettingsClient

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

UserSettingsClient is a client for the UserSettings schema.

func NewUserSettingsClient

func NewUserSettingsClient(c config) *UserSettingsClient

NewUserSettingsClient returns a client for the UserSettings from the given config.

func (*UserSettingsClient) Create

Create returns a builder for creating a UserSettings entity.

func (*UserSettingsClient) CreateBulk

func (c *UserSettingsClient) CreateBulk(builders ...*UserSettingsCreate) *UserSettingsCreateBulk

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

func (*UserSettingsClient) Delete

Delete returns a delete builder for UserSettings.

func (*UserSettingsClient) DeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*UserSettingsClient) DeleteOneID

func (c *UserSettingsClient) DeleteOneID(id int) *UserSettingsDeleteOne

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

func (*UserSettingsClient) Get

Get returns a UserSettings entity by its id.

func (*UserSettingsClient) GetX

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

func (*UserSettingsClient) Hooks

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

Hooks returns the client hooks.

func (*UserSettingsClient) Intercept

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

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

func (*UserSettingsClient) Interceptors

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

Interceptors returns the client interceptors.

func (*UserSettingsClient) MapCreateBulk

func (c *UserSettingsClient) MapCreateBulk(slice any, setFunc func(*UserSettingsCreate, int)) *UserSettingsCreateBulk

MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates a builder and applies setFunc on it.

func (*UserSettingsClient) Query

Query returns a query builder for UserSettings.

func (*UserSettingsClient) Update

Update returns an update builder for UserSettings.

func (*UserSettingsClient) UpdateOne

UpdateOne returns an update builder for the given entity.

func (*UserSettingsClient) UpdateOneID

func (c *UserSettingsClient) UpdateOneID(id int) *UserSettingsUpdateOne

UpdateOneID returns an update builder for the given id.

func (*UserSettingsClient) Use

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

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

type UserSettingsCreate

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

UserSettingsCreate is the builder for creating a UserSettings entity.

func (*UserSettingsCreate) Exec

func (usc *UserSettingsCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*UserSettingsCreate) ExecX

func (usc *UserSettingsCreate) ExecX(ctx context.Context)

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

func (*UserSettingsCreate) Mutation

func (usc *UserSettingsCreate) Mutation() *UserSettingsMutation

Mutation returns the UserSettingsMutation object of the builder.

func (*UserSettingsCreate) OnConflict

func (usc *UserSettingsCreate) OnConflict(opts ...sql.ConflictOption) *UserSettingsUpsertOne

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

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

func (*UserSettingsCreate) OnConflictColumns

func (usc *UserSettingsCreate) OnConflictColumns(columns ...string) *UserSettingsUpsertOne

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

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

func (*UserSettingsCreate) Save

Save creates the UserSettings in the database.

func (*UserSettingsCreate) SaveX

SaveX calls Save and panics if Save returns an error.

func (*UserSettingsCreate) SetCalLimit

func (usc *UserSettingsCreate) SetCalLimit(f float64) *UserSettingsCreate

SetCalLimit sets the "cal_limit" field.

func (*UserSettingsCreate) SetUserid

func (usc *UserSettingsCreate) SetUserid(i int64) *UserSettingsCreate

SetUserid sets the "userid" field.

type UserSettingsCreateBulk

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

UserSettingsCreateBulk is the builder for creating many UserSettings entities in bulk.

func (*UserSettingsCreateBulk) Exec

func (uscb *UserSettingsCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*UserSettingsCreateBulk) ExecX

func (uscb *UserSettingsCreateBulk) ExecX(ctx context.Context)

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

func (*UserSettingsCreateBulk) OnConflict

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

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

func (*UserSettingsCreateBulk) OnConflictColumns

func (uscb *UserSettingsCreateBulk) OnConflictColumns(columns ...string) *UserSettingsUpsertBulk

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

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

func (*UserSettingsCreateBulk) Save

Save creates the UserSettings entities in the database.

func (*UserSettingsCreateBulk) SaveX

func (uscb *UserSettingsCreateBulk) SaveX(ctx context.Context) []*UserSettings

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

type UserSettingsDelete

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

UserSettingsDelete is the builder for deleting a UserSettings entity.

func (*UserSettingsDelete) Exec

func (usd *UserSettingsDelete) Exec(ctx context.Context) (int, error)

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

func (*UserSettingsDelete) ExecX

func (usd *UserSettingsDelete) ExecX(ctx context.Context) int

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

func (*UserSettingsDelete) Where

Where appends a list predicates to the UserSettingsDelete builder.

type UserSettingsDeleteOne

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

UserSettingsDeleteOne is the builder for deleting a single UserSettings entity.

func (*UserSettingsDeleteOne) Exec

func (usdo *UserSettingsDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*UserSettingsDeleteOne) ExecX

func (usdo *UserSettingsDeleteOne) ExecX(ctx context.Context)

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

func (*UserSettingsDeleteOne) Where

Where appends a list predicates to the UserSettingsDelete builder.

type UserSettingsGroupBy

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

UserSettingsGroupBy is the group-by builder for UserSettings entities.

func (*UserSettingsGroupBy) Aggregate

func (usgb *UserSettingsGroupBy) Aggregate(fns ...AggregateFunc) *UserSettingsGroupBy

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

func (*UserSettingsGroupBy) Bool

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

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

func (*UserSettingsGroupBy) BoolX

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

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

func (*UserSettingsGroupBy) Bools

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

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

func (*UserSettingsGroupBy) BoolsX

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

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

func (*UserSettingsGroupBy) Float64

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

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

func (*UserSettingsGroupBy) Float64X

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

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

func (*UserSettingsGroupBy) Float64s

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

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

func (*UserSettingsGroupBy) Float64sX

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

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

func (*UserSettingsGroupBy) Int

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

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

func (*UserSettingsGroupBy) IntX

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

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

func (*UserSettingsGroupBy) Ints

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

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

func (*UserSettingsGroupBy) IntsX

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

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

func (*UserSettingsGroupBy) Scan

func (usgb *UserSettingsGroupBy) Scan(ctx context.Context, v any) error

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

func (*UserSettingsGroupBy) ScanX

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

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

func (*UserSettingsGroupBy) String

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

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

func (*UserSettingsGroupBy) StringX

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

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

func (*UserSettingsGroupBy) Strings

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

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

func (*UserSettingsGroupBy) StringsX

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

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

type UserSettingsMutation

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

UserSettingsMutation represents an operation that mutates the UserSettings nodes in the graph.

func (*UserSettingsMutation) AddCalLimit

func (m *UserSettingsMutation) AddCalLimit(f float64)

AddCalLimit adds f to the "cal_limit" field.

func (*UserSettingsMutation) AddField

func (m *UserSettingsMutation) 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 (*UserSettingsMutation) AddUserid

func (m *UserSettingsMutation) AddUserid(i int64)

AddUserid adds i to the "userid" field.

func (*UserSettingsMutation) AddedCalLimit

func (m *UserSettingsMutation) AddedCalLimit() (r float64, exists bool)

AddedCalLimit returns the value that was added to the "cal_limit" field in this mutation.

func (*UserSettingsMutation) AddedEdges

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

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

func (*UserSettingsMutation) AddedField

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

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

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

func (*UserSettingsMutation) AddedIDs

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

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

func (*UserSettingsMutation) AddedUserid

func (m *UserSettingsMutation) AddedUserid() (r int64, exists bool)

AddedUserid returns the value that was added to the "userid" field in this mutation.

func (*UserSettingsMutation) CalLimit

func (m *UserSettingsMutation) CalLimit() (r float64, exists bool)

CalLimit returns the value of the "cal_limit" field in the mutation.

func (*UserSettingsMutation) ClearEdge

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

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

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

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

func (*UserSettingsMutation) ClearedFields

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

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

func (UserSettingsMutation) Client

func (m UserSettingsMutation) 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 (*UserSettingsMutation) EdgeCleared

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

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

func (*UserSettingsMutation) Field

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

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

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

func (*UserSettingsMutation) Fields

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

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

func (m *UserSettingsMutation) 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 (*UserSettingsMutation) OldCalLimit

func (m *UserSettingsMutation) OldCalLimit(ctx context.Context) (v float64, err error)

OldCalLimit returns the old "cal_limit" field's value of the UserSettings entity. If the UserSettings 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 (*UserSettingsMutation) OldField

func (m *UserSettingsMutation) 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 (*UserSettingsMutation) OldUserid

func (m *UserSettingsMutation) OldUserid(ctx context.Context) (v int64, err error)

OldUserid returns the old "userid" field's value of the UserSettings entity. If the UserSettings 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 (*UserSettingsMutation) Op

func (m *UserSettingsMutation) Op() Op

Op returns the operation name.

func (*UserSettingsMutation) RemovedEdges

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

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

func (*UserSettingsMutation) RemovedIDs

func (m *UserSettingsMutation) 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 (*UserSettingsMutation) ResetCalLimit

func (m *UserSettingsMutation) ResetCalLimit()

ResetCalLimit resets all changes to the "cal_limit" field.

func (*UserSettingsMutation) ResetEdge

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

func (m *UserSettingsMutation) 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 (*UserSettingsMutation) ResetUserid

func (m *UserSettingsMutation) ResetUserid()

ResetUserid resets all changes to the "userid" field.

func (*UserSettingsMutation) SetCalLimit

func (m *UserSettingsMutation) SetCalLimit(f float64)

SetCalLimit sets the "cal_limit" field.

func (*UserSettingsMutation) SetField

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

func (m *UserSettingsMutation) SetOp(op Op)

SetOp allows setting the mutation operation.

func (*UserSettingsMutation) SetUserid

func (m *UserSettingsMutation) SetUserid(i int64)

SetUserid sets the "userid" field.

func (UserSettingsMutation) Tx

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

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

func (*UserSettingsMutation) Type

func (m *UserSettingsMutation) Type() string

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

func (*UserSettingsMutation) Userid

func (m *UserSettingsMutation) Userid() (r int64, exists bool)

Userid returns the value of the "userid" field in the mutation.

func (*UserSettingsMutation) Where

Where appends a list predicates to the UserSettingsMutation builder.

func (*UserSettingsMutation) WhereP

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

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

type UserSettingsQuery

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

UserSettingsQuery is the builder for querying UserSettings entities.

func (*UserSettingsQuery) Aggregate

func (usq *UserSettingsQuery) Aggregate(fns ...AggregateFunc) *UserSettingsSelect

Aggregate returns a UserSettingsSelect configured with the given aggregations.

func (*UserSettingsQuery) All

func (usq *UserSettingsQuery) All(ctx context.Context) ([]*UserSettings, error)

All executes the query and returns a list of UserSettingsSlice.

func (*UserSettingsQuery) AllX

func (usq *UserSettingsQuery) AllX(ctx context.Context) []*UserSettings

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

func (*UserSettingsQuery) Clone

func (usq *UserSettingsQuery) Clone() *UserSettingsQuery

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

func (*UserSettingsQuery) Count

func (usq *UserSettingsQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*UserSettingsQuery) CountX

func (usq *UserSettingsQuery) CountX(ctx context.Context) int

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

func (*UserSettingsQuery) Exist

func (usq *UserSettingsQuery) Exist(ctx context.Context) (bool, error)

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

func (*UserSettingsQuery) ExistX

func (usq *UserSettingsQuery) ExistX(ctx context.Context) bool

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

func (*UserSettingsQuery) First

func (usq *UserSettingsQuery) First(ctx context.Context) (*UserSettings, error)

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

func (*UserSettingsQuery) FirstID

func (usq *UserSettingsQuery) FirstID(ctx context.Context) (id int, err error)

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

func (*UserSettingsQuery) FirstIDX

func (usq *UserSettingsQuery) FirstIDX(ctx context.Context) int

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

func (*UserSettingsQuery) FirstX

func (usq *UserSettingsQuery) FirstX(ctx context.Context) *UserSettings

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

func (*UserSettingsQuery) GroupBy

func (usq *UserSettingsQuery) GroupBy(field string, fields ...string) *UserSettingsGroupBy

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 {
	Userid int64 `json:"userid,omitempty"`
	Count int `json:"count,omitempty"`
}

client.UserSettings.Query().
	GroupBy(usersettings.FieldUserid).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*UserSettingsQuery) IDs

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

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

func (*UserSettingsQuery) IDsX

func (usq *UserSettingsQuery) IDsX(ctx context.Context) []int

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

func (*UserSettingsQuery) Limit

func (usq *UserSettingsQuery) Limit(limit int) *UserSettingsQuery

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

func (*UserSettingsQuery) Modify

func (usq *UserSettingsQuery) Modify(modifiers ...func(s *sql.Selector)) *UserSettingsSelect

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

func (*UserSettingsQuery) Offset

func (usq *UserSettingsQuery) Offset(offset int) *UserSettingsQuery

Offset to start from.

func (*UserSettingsQuery) Only

func (usq *UserSettingsQuery) Only(ctx context.Context) (*UserSettings, error)

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

func (*UserSettingsQuery) OnlyID

func (usq *UserSettingsQuery) OnlyID(ctx context.Context) (id int, err error)

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

func (*UserSettingsQuery) OnlyIDX

func (usq *UserSettingsQuery) OnlyIDX(ctx context.Context) int

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

func (*UserSettingsQuery) OnlyX

func (usq *UserSettingsQuery) OnlyX(ctx context.Context) *UserSettings

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

func (*UserSettingsQuery) Order

Order specifies how the records should be ordered.

func (*UserSettingsQuery) Select

func (usq *UserSettingsQuery) Select(fields ...string) *UserSettingsSelect

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 {
	Userid int64 `json:"userid,omitempty"`
}

client.UserSettings.Query().
	Select(usersettings.FieldUserid).
	Scan(ctx, &v)

func (*UserSettingsQuery) Unique

func (usq *UserSettingsQuery) Unique(unique bool) *UserSettingsQuery

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

Where adds a new predicate for the UserSettingsQuery builder.

type UserSettingsSelect

type UserSettingsSelect struct {
	*UserSettingsQuery
	// contains filtered or unexported fields
}

UserSettingsSelect is the builder for selecting fields of UserSettings entities.

func (*UserSettingsSelect) Aggregate

func (uss *UserSettingsSelect) Aggregate(fns ...AggregateFunc) *UserSettingsSelect

Aggregate adds the given aggregation functions to the selector query.

func (*UserSettingsSelect) Bool

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

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

func (*UserSettingsSelect) BoolX

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

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

func (*UserSettingsSelect) Bools

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

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

func (*UserSettingsSelect) BoolsX

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

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

func (*UserSettingsSelect) Float64

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

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

func (*UserSettingsSelect) Float64X

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

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

func (*UserSettingsSelect) Float64s

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

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

func (*UserSettingsSelect) Float64sX

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

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

func (*UserSettingsSelect) Int

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

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

func (*UserSettingsSelect) IntX

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

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

func (*UserSettingsSelect) Ints

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

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

func (*UserSettingsSelect) IntsX

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

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

func (*UserSettingsSelect) Modify

func (uss *UserSettingsSelect) Modify(modifiers ...func(s *sql.Selector)) *UserSettingsSelect

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

func (*UserSettingsSelect) Scan

func (uss *UserSettingsSelect) Scan(ctx context.Context, v any) error

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

func (*UserSettingsSelect) ScanX

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

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

func (*UserSettingsSelect) String

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

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

func (*UserSettingsSelect) StringX

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

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

func (*UserSettingsSelect) Strings

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

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

func (*UserSettingsSelect) StringsX

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

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

type UserSettingsSlice

type UserSettingsSlice []*UserSettings

UserSettingsSlice is a parsable slice of UserSettings.

type UserSettingsUpdate

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

UserSettingsUpdate is the builder for updating UserSettings entities.

func (*UserSettingsUpdate) AddCalLimit

func (usu *UserSettingsUpdate) AddCalLimit(f float64) *UserSettingsUpdate

AddCalLimit adds f to the "cal_limit" field.

func (*UserSettingsUpdate) AddUserid

func (usu *UserSettingsUpdate) AddUserid(i int64) *UserSettingsUpdate

AddUserid adds i to the "userid" field.

func (*UserSettingsUpdate) Exec

func (usu *UserSettingsUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*UserSettingsUpdate) ExecX

func (usu *UserSettingsUpdate) ExecX(ctx context.Context)

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

func (*UserSettingsUpdate) Modify

func (usu *UserSettingsUpdate) Modify(modifiers ...func(u *sql.UpdateBuilder)) *UserSettingsUpdate

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

func (*UserSettingsUpdate) Mutation

func (usu *UserSettingsUpdate) Mutation() *UserSettingsMutation

Mutation returns the UserSettingsMutation object of the builder.

func (*UserSettingsUpdate) Save

func (usu *UserSettingsUpdate) Save(ctx context.Context) (int, error)

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

func (*UserSettingsUpdate) SaveX

func (usu *UserSettingsUpdate) SaveX(ctx context.Context) int

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

func (*UserSettingsUpdate) SetCalLimit

func (usu *UserSettingsUpdate) SetCalLimit(f float64) *UserSettingsUpdate

SetCalLimit sets the "cal_limit" field.

func (*UserSettingsUpdate) SetNillableCalLimit

func (usu *UserSettingsUpdate) SetNillableCalLimit(f *float64) *UserSettingsUpdate

SetNillableCalLimit sets the "cal_limit" field if the given value is not nil.

func (*UserSettingsUpdate) SetNillableUserid

func (usu *UserSettingsUpdate) SetNillableUserid(i *int64) *UserSettingsUpdate

SetNillableUserid sets the "userid" field if the given value is not nil.

func (*UserSettingsUpdate) SetUserid

func (usu *UserSettingsUpdate) SetUserid(i int64) *UserSettingsUpdate

SetUserid sets the "userid" field.

func (*UserSettingsUpdate) Where

Where appends a list predicates to the UserSettingsUpdate builder.

type UserSettingsUpdateOne

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

UserSettingsUpdateOne is the builder for updating a single UserSettings entity.

func (*UserSettingsUpdateOne) AddCalLimit

func (usuo *UserSettingsUpdateOne) AddCalLimit(f float64) *UserSettingsUpdateOne

AddCalLimit adds f to the "cal_limit" field.

func (*UserSettingsUpdateOne) AddUserid

AddUserid adds i to the "userid" field.

func (*UserSettingsUpdateOne) Exec

func (usuo *UserSettingsUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*UserSettingsUpdateOne) ExecX

func (usuo *UserSettingsUpdateOne) ExecX(ctx context.Context)

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

func (*UserSettingsUpdateOne) Modify

func (usuo *UserSettingsUpdateOne) Modify(modifiers ...func(u *sql.UpdateBuilder)) *UserSettingsUpdateOne

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

func (*UserSettingsUpdateOne) Mutation

func (usuo *UserSettingsUpdateOne) Mutation() *UserSettingsMutation

Mutation returns the UserSettingsMutation object of the builder.

func (*UserSettingsUpdateOne) Save

Save executes the query and returns the updated UserSettings entity.

func (*UserSettingsUpdateOne) SaveX

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

func (*UserSettingsUpdateOne) Select

func (usuo *UserSettingsUpdateOne) Select(field string, fields ...string) *UserSettingsUpdateOne

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

func (*UserSettingsUpdateOne) SetCalLimit

func (usuo *UserSettingsUpdateOne) SetCalLimit(f float64) *UserSettingsUpdateOne

SetCalLimit sets the "cal_limit" field.

func (*UserSettingsUpdateOne) SetNillableCalLimit

func (usuo *UserSettingsUpdateOne) SetNillableCalLimit(f *float64) *UserSettingsUpdateOne

SetNillableCalLimit sets the "cal_limit" field if the given value is not nil.

func (*UserSettingsUpdateOne) SetNillableUserid

func (usuo *UserSettingsUpdateOne) SetNillableUserid(i *int64) *UserSettingsUpdateOne

SetNillableUserid sets the "userid" field if the given value is not nil.

func (*UserSettingsUpdateOne) SetUserid

SetUserid sets the "userid" field.

func (*UserSettingsUpdateOne) Where

Where appends a list predicates to the UserSettingsUpdate builder.

type UserSettingsUpsert

type UserSettingsUpsert struct {
	*sql.UpdateSet
}

UserSettingsUpsert is the "OnConflict" setter.

func (*UserSettingsUpsert) AddCalLimit

func (u *UserSettingsUpsert) AddCalLimit(v float64) *UserSettingsUpsert

AddCalLimit adds v to the "cal_limit" field.

func (*UserSettingsUpsert) AddUserid

func (u *UserSettingsUpsert) AddUserid(v int64) *UserSettingsUpsert

AddUserid adds v to the "userid" field.

func (*UserSettingsUpsert) SetCalLimit

func (u *UserSettingsUpsert) SetCalLimit(v float64) *UserSettingsUpsert

SetCalLimit sets the "cal_limit" field.

func (*UserSettingsUpsert) SetUserid

func (u *UserSettingsUpsert) SetUserid(v int64) *UserSettingsUpsert

SetUserid sets the "userid" field.

func (*UserSettingsUpsert) UpdateCalLimit

func (u *UserSettingsUpsert) UpdateCalLimit() *UserSettingsUpsert

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

func (*UserSettingsUpsert) UpdateUserid

func (u *UserSettingsUpsert) UpdateUserid() *UserSettingsUpsert

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

type UserSettingsUpsertBulk

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

UserSettingsUpsertBulk is the builder for "upsert"-ing a bulk of UserSettings nodes.

func (*UserSettingsUpsertBulk) AddCalLimit

AddCalLimit adds v to the "cal_limit" field.

func (*UserSettingsUpsertBulk) AddUserid

AddUserid adds v to the "userid" field.

func (*UserSettingsUpsertBulk) DoNothing

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

func (*UserSettingsUpsertBulk) Exec

Exec executes the query.

func (*UserSettingsUpsertBulk) ExecX

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

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

func (*UserSettingsUpsertBulk) Ignore

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

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

func (*UserSettingsUpsertBulk) SetCalLimit

SetCalLimit sets the "cal_limit" field.

func (*UserSettingsUpsertBulk) SetUserid

SetUserid sets the "userid" field.

func (*UserSettingsUpsertBulk) Update

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

func (*UserSettingsUpsertBulk) UpdateCalLimit

func (u *UserSettingsUpsertBulk) UpdateCalLimit() *UserSettingsUpsertBulk

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

func (*UserSettingsUpsertBulk) UpdateNewValues

func (u *UserSettingsUpsertBulk) UpdateNewValues() *UserSettingsUpsertBulk

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

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

func (*UserSettingsUpsertBulk) UpdateUserid

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

type UserSettingsUpsertOne

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

UserSettingsUpsertOne is the builder for "upsert"-ing

one UserSettings node.

func (*UserSettingsUpsertOne) AddCalLimit

AddCalLimit adds v to the "cal_limit" field.

func (*UserSettingsUpsertOne) AddUserid

AddUserid adds v to the "userid" field.

func (*UserSettingsUpsertOne) DoNothing

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

func (*UserSettingsUpsertOne) Exec

Exec executes the query.

func (*UserSettingsUpsertOne) ExecX

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

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

func (*UserSettingsUpsertOne) ID

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

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

func (*UserSettingsUpsertOne) IDX

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

func (*UserSettingsUpsertOne) Ignore

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

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

func (*UserSettingsUpsertOne) SetCalLimit

SetCalLimit sets the "cal_limit" field.

func (*UserSettingsUpsertOne) SetUserid

SetUserid sets the "userid" field.

func (*UserSettingsUpsertOne) Update

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

func (*UserSettingsUpsertOne) UpdateCalLimit

func (u *UserSettingsUpsertOne) UpdateCalLimit() *UserSettingsUpsertOne

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

func (*UserSettingsUpsertOne) UpdateNewValues

func (u *UserSettingsUpsertOne) UpdateNewValues() *UserSettingsUpsertOne

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

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

func (*UserSettingsUpsertOne) UpdateUserid

func (u *UserSettingsUpsertOne) UpdateUserid() *UserSettingsUpsertOne

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

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.

type Weight

type Weight struct {

	// ID of the ent.
	ID int `json:"id,omitempty"`
	// Userid holds the value of the "userid" field.
	Userid int64 `json:"userid,omitempty"`
	// Timestamp holds the value of the "timestamp" field.
	Timestamp time.Time `json:"timestamp,omitempty"`
	// Value holds the value of the "value" field.
	Value float64 `json:"value,omitempty"`
	// contains filtered or unexported fields
}

Weight is the model entity for the Weight schema.

func (*Weight) GetValue

func (w *Weight) GetValue(name string) (ent.Value, error)

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

func (*Weight) String

func (w *Weight) String() string

String implements the fmt.Stringer.

func (*Weight) Unwrap

func (w *Weight) Unwrap() *Weight

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

func (w *Weight) Update() *WeightUpdateOne

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

type WeightClient

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

WeightClient is a client for the Weight schema.

func NewWeightClient

func NewWeightClient(c config) *WeightClient

NewWeightClient returns a client for the Weight from the given config.

func (*WeightClient) Create

func (c *WeightClient) Create() *WeightCreate

Create returns a builder for creating a Weight entity.

func (*WeightClient) CreateBulk

func (c *WeightClient) CreateBulk(builders ...*WeightCreate) *WeightCreateBulk

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

func (*WeightClient) Delete

func (c *WeightClient) Delete() *WeightDelete

Delete returns a delete builder for Weight.

func (*WeightClient) DeleteOne

func (c *WeightClient) DeleteOne(w *Weight) *WeightDeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*WeightClient) DeleteOneID

func (c *WeightClient) DeleteOneID(id int) *WeightDeleteOne

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

func (*WeightClient) Get

func (c *WeightClient) Get(ctx context.Context, id int) (*Weight, error)

Get returns a Weight entity by its id.

func (*WeightClient) GetX

func (c *WeightClient) GetX(ctx context.Context, id int) *Weight

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

func (*WeightClient) Hooks

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

Hooks returns the client hooks.

func (*WeightClient) Intercept

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

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

func (*WeightClient) Interceptors

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

Interceptors returns the client interceptors.

func (*WeightClient) MapCreateBulk

func (c *WeightClient) MapCreateBulk(slice any, setFunc func(*WeightCreate, int)) *WeightCreateBulk

MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates a builder and applies setFunc on it.

func (*WeightClient) Query

func (c *WeightClient) Query() *WeightQuery

Query returns a query builder for Weight.

func (*WeightClient) Update

func (c *WeightClient) Update() *WeightUpdate

Update returns an update builder for Weight.

func (*WeightClient) UpdateOne

func (c *WeightClient) UpdateOne(w *Weight) *WeightUpdateOne

UpdateOne returns an update builder for the given entity.

func (*WeightClient) UpdateOneID

func (c *WeightClient) UpdateOneID(id int) *WeightUpdateOne

UpdateOneID returns an update builder for the given id.

func (*WeightClient) Use

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

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

type WeightCreate

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

WeightCreate is the builder for creating a Weight entity.

func (*WeightCreate) Exec

func (wc *WeightCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*WeightCreate) ExecX

func (wc *WeightCreate) ExecX(ctx context.Context)

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

func (*WeightCreate) Mutation

func (wc *WeightCreate) Mutation() *WeightMutation

Mutation returns the WeightMutation object of the builder.

func (*WeightCreate) OnConflict

func (wc *WeightCreate) OnConflict(opts ...sql.ConflictOption) *WeightUpsertOne

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

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

func (*WeightCreate) OnConflictColumns

func (wc *WeightCreate) OnConflictColumns(columns ...string) *WeightUpsertOne

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

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

func (*WeightCreate) Save

func (wc *WeightCreate) Save(ctx context.Context) (*Weight, error)

Save creates the Weight in the database.

func (*WeightCreate) SaveX

func (wc *WeightCreate) SaveX(ctx context.Context) *Weight

SaveX calls Save and panics if Save returns an error.

func (*WeightCreate) SetTimestamp

func (wc *WeightCreate) SetTimestamp(t time.Time) *WeightCreate

SetTimestamp sets the "timestamp" field.

func (*WeightCreate) SetUserid

func (wc *WeightCreate) SetUserid(i int64) *WeightCreate

SetUserid sets the "userid" field.

func (*WeightCreate) SetValue

func (wc *WeightCreate) SetValue(f float64) *WeightCreate

SetValue sets the "value" field.

type WeightCreateBulk

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

WeightCreateBulk is the builder for creating many Weight entities in bulk.

func (*WeightCreateBulk) Exec

func (wcb *WeightCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*WeightCreateBulk) ExecX

func (wcb *WeightCreateBulk) ExecX(ctx context.Context)

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

func (*WeightCreateBulk) OnConflict

func (wcb *WeightCreateBulk) OnConflict(opts ...sql.ConflictOption) *WeightUpsertBulk

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

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

func (*WeightCreateBulk) OnConflictColumns

func (wcb *WeightCreateBulk) OnConflictColumns(columns ...string) *WeightUpsertBulk

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

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

func (*WeightCreateBulk) Save

func (wcb *WeightCreateBulk) Save(ctx context.Context) ([]*Weight, error)

Save creates the Weight entities in the database.

func (*WeightCreateBulk) SaveX

func (wcb *WeightCreateBulk) SaveX(ctx context.Context) []*Weight

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

type WeightDelete

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

WeightDelete is the builder for deleting a Weight entity.

func (*WeightDelete) Exec

func (wd *WeightDelete) Exec(ctx context.Context) (int, error)

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

func (*WeightDelete) ExecX

func (wd *WeightDelete) ExecX(ctx context.Context) int

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

func (*WeightDelete) Where

func (wd *WeightDelete) Where(ps ...predicate.Weight) *WeightDelete

Where appends a list predicates to the WeightDelete builder.

type WeightDeleteOne

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

WeightDeleteOne is the builder for deleting a single Weight entity.

func (*WeightDeleteOne) Exec

func (wdo *WeightDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*WeightDeleteOne) ExecX

func (wdo *WeightDeleteOne) ExecX(ctx context.Context)

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

func (*WeightDeleteOne) Where

func (wdo *WeightDeleteOne) Where(ps ...predicate.Weight) *WeightDeleteOne

Where appends a list predicates to the WeightDelete builder.

type WeightGroupBy

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

WeightGroupBy is the group-by builder for Weight entities.

func (*WeightGroupBy) Aggregate

func (wgb *WeightGroupBy) Aggregate(fns ...AggregateFunc) *WeightGroupBy

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

func (*WeightGroupBy) Bool

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

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

func (*WeightGroupBy) BoolX

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

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

func (*WeightGroupBy) Bools

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

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

func (*WeightGroupBy) BoolsX

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

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

func (*WeightGroupBy) Float64

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

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

func (*WeightGroupBy) Float64X

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

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

func (*WeightGroupBy) Float64s

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

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

func (*WeightGroupBy) Float64sX

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

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

func (*WeightGroupBy) Int

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

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

func (*WeightGroupBy) IntX

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

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

func (*WeightGroupBy) Ints

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

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

func (*WeightGroupBy) IntsX

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

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

func (*WeightGroupBy) Scan

func (wgb *WeightGroupBy) Scan(ctx context.Context, v any) error

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

func (*WeightGroupBy) ScanX

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

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

func (*WeightGroupBy) String

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

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

func (*WeightGroupBy) StringX

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

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

func (*WeightGroupBy) Strings

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

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

func (*WeightGroupBy) StringsX

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

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

type WeightMutation

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

WeightMutation represents an operation that mutates the Weight nodes in the graph.

func (*WeightMutation) AddField

func (m *WeightMutation) 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 (*WeightMutation) AddUserid

func (m *WeightMutation) AddUserid(i int64)

AddUserid adds i to the "userid" field.

func (*WeightMutation) AddValue

func (m *WeightMutation) AddValue(f float64)

AddValue adds f to the "value" field.

func (*WeightMutation) AddedEdges

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

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

func (*WeightMutation) AddedField

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

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

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

func (*WeightMutation) AddedIDs

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

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

func (*WeightMutation) AddedUserid

func (m *WeightMutation) AddedUserid() (r int64, exists bool)

AddedUserid returns the value that was added to the "userid" field in this mutation.

func (*WeightMutation) AddedValue

func (m *WeightMutation) AddedValue() (r float64, exists bool)

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

func (*WeightMutation) ClearEdge

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

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

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

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

func (*WeightMutation) ClearedFields

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

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

func (WeightMutation) Client

func (m WeightMutation) 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 (*WeightMutation) EdgeCleared

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

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

func (*WeightMutation) Field

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

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

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

func (*WeightMutation) Fields

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

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

func (m *WeightMutation) 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 (*WeightMutation) OldField

func (m *WeightMutation) 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 (*WeightMutation) OldTimestamp

func (m *WeightMutation) OldTimestamp(ctx context.Context) (v time.Time, err error)

OldTimestamp returns the old "timestamp" field's value of the Weight entity. If the Weight 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 (*WeightMutation) OldUserid

func (m *WeightMutation) OldUserid(ctx context.Context) (v int64, err error)

OldUserid returns the old "userid" field's value of the Weight entity. If the Weight 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 (*WeightMutation) OldValue

func (m *WeightMutation) OldValue(ctx context.Context) (v float64, err error)

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

func (m *WeightMutation) Op() Op

Op returns the operation name.

func (*WeightMutation) RemovedEdges

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

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

func (*WeightMutation) RemovedIDs

func (m *WeightMutation) 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 (*WeightMutation) ResetEdge

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

func (m *WeightMutation) 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 (*WeightMutation) ResetTimestamp

func (m *WeightMutation) ResetTimestamp()

ResetTimestamp resets all changes to the "timestamp" field.

func (*WeightMutation) ResetUserid

func (m *WeightMutation) ResetUserid()

ResetUserid resets all changes to the "userid" field.

func (*WeightMutation) ResetValue

func (m *WeightMutation) ResetValue()

ResetValue resets all changes to the "value" field.

func (*WeightMutation) SetField

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

func (m *WeightMutation) SetOp(op Op)

SetOp allows setting the mutation operation.

func (*WeightMutation) SetTimestamp

func (m *WeightMutation) SetTimestamp(t time.Time)

SetTimestamp sets the "timestamp" field.

func (*WeightMutation) SetUserid

func (m *WeightMutation) SetUserid(i int64)

SetUserid sets the "userid" field.

func (*WeightMutation) SetValue

func (m *WeightMutation) SetValue(f float64)

SetValue sets the "value" field.

func (*WeightMutation) Timestamp

func (m *WeightMutation) Timestamp() (r time.Time, exists bool)

Timestamp returns the value of the "timestamp" field in the mutation.

func (WeightMutation) Tx

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

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

func (*WeightMutation) Type

func (m *WeightMutation) Type() string

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

func (*WeightMutation) Userid

func (m *WeightMutation) Userid() (r int64, exists bool)

Userid returns the value of the "userid" field in the mutation.

func (*WeightMutation) Value

func (m *WeightMutation) Value() (r float64, exists bool)

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

func (*WeightMutation) Where

func (m *WeightMutation) Where(ps ...predicate.Weight)

Where appends a list predicates to the WeightMutation builder.

func (*WeightMutation) WhereP

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

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

type WeightQuery

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

WeightQuery is the builder for querying Weight entities.

func (*WeightQuery) Aggregate

func (wq *WeightQuery) Aggregate(fns ...AggregateFunc) *WeightSelect

Aggregate returns a WeightSelect configured with the given aggregations.

func (*WeightQuery) All

func (wq *WeightQuery) All(ctx context.Context) ([]*Weight, error)

All executes the query and returns a list of Weights.

func (*WeightQuery) AllX

func (wq *WeightQuery) AllX(ctx context.Context) []*Weight

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

func (*WeightQuery) Clone

func (wq *WeightQuery) Clone() *WeightQuery

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

func (*WeightQuery) Count

func (wq *WeightQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*WeightQuery) CountX

func (wq *WeightQuery) CountX(ctx context.Context) int

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

func (*WeightQuery) Exist

func (wq *WeightQuery) Exist(ctx context.Context) (bool, error)

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

func (*WeightQuery) ExistX

func (wq *WeightQuery) ExistX(ctx context.Context) bool

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

func (*WeightQuery) First

func (wq *WeightQuery) First(ctx context.Context) (*Weight, error)

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

func (*WeightQuery) FirstID

func (wq *WeightQuery) FirstID(ctx context.Context) (id int, err error)

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

func (*WeightQuery) FirstIDX

func (wq *WeightQuery) FirstIDX(ctx context.Context) int

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

func (*WeightQuery) FirstX

func (wq *WeightQuery) FirstX(ctx context.Context) *Weight

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

func (*WeightQuery) GroupBy

func (wq *WeightQuery) GroupBy(field string, fields ...string) *WeightGroupBy

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 {
	Userid int64 `json:"userid,omitempty"`
	Count int `json:"count,omitempty"`
}

client.Weight.Query().
	GroupBy(weight.FieldUserid).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*WeightQuery) IDs

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

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

func (*WeightQuery) IDsX

func (wq *WeightQuery) IDsX(ctx context.Context) []int

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

func (*WeightQuery) Limit

func (wq *WeightQuery) Limit(limit int) *WeightQuery

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

func (*WeightQuery) Modify

func (wq *WeightQuery) Modify(modifiers ...func(s *sql.Selector)) *WeightSelect

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

func (*WeightQuery) Offset

func (wq *WeightQuery) Offset(offset int) *WeightQuery

Offset to start from.

func (*WeightQuery) Only

func (wq *WeightQuery) Only(ctx context.Context) (*Weight, error)

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

func (*WeightQuery) OnlyID

func (wq *WeightQuery) OnlyID(ctx context.Context) (id int, err error)

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

func (*WeightQuery) OnlyIDX

func (wq *WeightQuery) OnlyIDX(ctx context.Context) int

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

func (*WeightQuery) OnlyX

func (wq *WeightQuery) OnlyX(ctx context.Context) *Weight

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

func (*WeightQuery) Order

func (wq *WeightQuery) Order(o ...weight.OrderOption) *WeightQuery

Order specifies how the records should be ordered.

func (*WeightQuery) Select

func (wq *WeightQuery) Select(fields ...string) *WeightSelect

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 {
	Userid int64 `json:"userid,omitempty"`
}

client.Weight.Query().
	Select(weight.FieldUserid).
	Scan(ctx, &v)

func (*WeightQuery) Unique

func (wq *WeightQuery) Unique(unique bool) *WeightQuery

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

func (wq *WeightQuery) Where(ps ...predicate.Weight) *WeightQuery

Where adds a new predicate for the WeightQuery builder.

type WeightSelect

type WeightSelect struct {
	*WeightQuery
	// contains filtered or unexported fields
}

WeightSelect is the builder for selecting fields of Weight entities.

func (*WeightSelect) Aggregate

func (ws *WeightSelect) Aggregate(fns ...AggregateFunc) *WeightSelect

Aggregate adds the given aggregation functions to the selector query.

func (*WeightSelect) Bool

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

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

func (*WeightSelect) BoolX

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

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

func (*WeightSelect) Bools

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

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

func (*WeightSelect) BoolsX

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

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

func (*WeightSelect) Float64

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

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

func (*WeightSelect) Float64X

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

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

func (*WeightSelect) Float64s

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

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

func (*WeightSelect) Float64sX

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

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

func (*WeightSelect) Int

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

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

func (*WeightSelect) IntX

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

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

func (*WeightSelect) Ints

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

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

func (*WeightSelect) IntsX

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

IntsX is like Ints, but panics if an error occurs.

func (*WeightSelect) Modify

func (ws *WeightSelect) Modify(modifiers ...func(s *sql.Selector)) *WeightSelect

Modify adds a query modifier for attaching custom logic to queries.

func (*WeightSelect) Scan

func (ws *WeightSelect) Scan(ctx context.Context, v any) error

Scan applies the selector query and scans the result into the given value.

func (*WeightSelect) ScanX

func (s *WeightSelect) ScanX(ctx context.Context, v any)

ScanX is like Scan, but panics if an error occurs.

func (*WeightSelect) String

func (s *WeightSelect) String(ctx context.Context) (_ string, err error)

String returns a single string from a selector. It is only allowed when selecting one field.

func (*WeightSelect) StringX

func (s *WeightSelect) StringX(ctx context.Context) string

StringX is like String, but panics if an error occurs.

func (*WeightSelect) Strings

func (s *WeightSelect) Strings(ctx context.Context) ([]string, error)

Strings returns list of strings from a selector. It is only allowed when selecting one field.

func (*WeightSelect) StringsX

func (s *WeightSelect) StringsX(ctx context.Context) []string

StringsX is like Strings, but panics if an error occurs.

type WeightUpdate

type WeightUpdate struct {
	// contains filtered or unexported fields
}

WeightUpdate is the builder for updating Weight entities.

func (*WeightUpdate) AddUserid

func (wu *WeightUpdate) AddUserid(i int64) *WeightUpdate

AddUserid adds i to the "userid" field.

func (*WeightUpdate) AddValue

func (wu *WeightUpdate) AddValue(f float64) *WeightUpdate

AddValue adds f to the "value" field.

func (*WeightUpdate) Exec

func (wu *WeightUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*WeightUpdate) ExecX

func (wu *WeightUpdate) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*WeightUpdate) Modify

func (wu *WeightUpdate) Modify(modifiers ...func(u *sql.UpdateBuilder)) *WeightUpdate

Modify adds a statement modifier for attaching custom logic to the UPDATE statement.

func (*WeightUpdate) Mutation

func (wu *WeightUpdate) Mutation() *WeightMutation

Mutation returns the WeightMutation object of the builder.

func (*WeightUpdate) Save

func (wu *WeightUpdate) Save(ctx context.Context) (int, error)

Save executes the query and returns the number of nodes affected by the update operation.

func (*WeightUpdate) SaveX

func (wu *WeightUpdate) SaveX(ctx context.Context) int

SaveX is like Save, but panics if an error occurs.

func (*WeightUpdate) SetNillableTimestamp

func (wu *WeightUpdate) SetNillableTimestamp(t *time.Time) *WeightUpdate

SetNillableTimestamp sets the "timestamp" field if the given value is not nil.

func (*WeightUpdate) SetNillableUserid

func (wu *WeightUpdate) SetNillableUserid(i *int64) *WeightUpdate

SetNillableUserid sets the "userid" field if the given value is not nil.

func (*WeightUpdate) SetNillableValue

func (wu *WeightUpdate) SetNillableValue(f *float64) *WeightUpdate

SetNillableValue sets the "value" field if the given value is not nil.

func (*WeightUpdate) SetTimestamp

func (wu *WeightUpdate) SetTimestamp(t time.Time) *WeightUpdate

SetTimestamp sets the "timestamp" field.

func (*WeightUpdate) SetUserid

func (wu *WeightUpdate) SetUserid(i int64) *WeightUpdate

SetUserid sets the "userid" field.

func (*WeightUpdate) SetValue

func (wu *WeightUpdate) SetValue(f float64) *WeightUpdate

SetValue sets the "value" field.

func (*WeightUpdate) Where

func (wu *WeightUpdate) Where(ps ...predicate.Weight) *WeightUpdate

Where appends a list predicates to the WeightUpdate builder.

type WeightUpdateOne

type WeightUpdateOne struct {
	// contains filtered or unexported fields
}

WeightUpdateOne is the builder for updating a single Weight entity.

func (*WeightUpdateOne) AddUserid

func (wuo *WeightUpdateOne) AddUserid(i int64) *WeightUpdateOne

AddUserid adds i to the "userid" field.

func (*WeightUpdateOne) AddValue

func (wuo *WeightUpdateOne) AddValue(f float64) *WeightUpdateOne

AddValue adds f to the "value" field.

func (*WeightUpdateOne) Exec

func (wuo *WeightUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*WeightUpdateOne) ExecX

func (wuo *WeightUpdateOne) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*WeightUpdateOne) Modify

func (wuo *WeightUpdateOne) Modify(modifiers ...func(u *sql.UpdateBuilder)) *WeightUpdateOne

Modify adds a statement modifier for attaching custom logic to the UPDATE statement.

func (*WeightUpdateOne) Mutation

func (wuo *WeightUpdateOne) Mutation() *WeightMutation

Mutation returns the WeightMutation object of the builder.

func (*WeightUpdateOne) Save

func (wuo *WeightUpdateOne) Save(ctx context.Context) (*Weight, error)

Save executes the query and returns the updated Weight entity.

func (*WeightUpdateOne) SaveX

func (wuo *WeightUpdateOne) SaveX(ctx context.Context) *Weight

SaveX is like Save, but panics if an error occurs.

func (*WeightUpdateOne) Select

func (wuo *WeightUpdateOne) Select(field string, fields ...string) *WeightUpdateOne

Select allows selecting one or more fields (columns) of the returned entity. The default is selecting all fields defined in the entity schema.

func (*WeightUpdateOne) SetNillableTimestamp

func (wuo *WeightUpdateOne) SetNillableTimestamp(t *time.Time) *WeightUpdateOne

SetNillableTimestamp sets the "timestamp" field if the given value is not nil.

func (*WeightUpdateOne) SetNillableUserid

func (wuo *WeightUpdateOne) SetNillableUserid(i *int64) *WeightUpdateOne

SetNillableUserid sets the "userid" field if the given value is not nil.

func (*WeightUpdateOne) SetNillableValue

func (wuo *WeightUpdateOne) SetNillableValue(f *float64) *WeightUpdateOne

SetNillableValue sets the "value" field if the given value is not nil.

func (*WeightUpdateOne) SetTimestamp

func (wuo *WeightUpdateOne) SetTimestamp(t time.Time) *WeightUpdateOne

SetTimestamp sets the "timestamp" field.

func (*WeightUpdateOne) SetUserid

func (wuo *WeightUpdateOne) SetUserid(i int64) *WeightUpdateOne

SetUserid sets the "userid" field.

func (*WeightUpdateOne) SetValue

func (wuo *WeightUpdateOne) SetValue(f float64) *WeightUpdateOne

SetValue sets the "value" field.

func (*WeightUpdateOne) Where

func (wuo *WeightUpdateOne) Where(ps ...predicate.Weight) *WeightUpdateOne

Where appends a list predicates to the WeightUpdate builder.

type WeightUpsert

type WeightUpsert struct {
	*sql.UpdateSet
}

WeightUpsert is the "OnConflict" setter.

func (*WeightUpsert) AddUserid

func (u *WeightUpsert) AddUserid(v int64) *WeightUpsert

AddUserid adds v to the "userid" field.

func (*WeightUpsert) AddValue

func (u *WeightUpsert) AddValue(v float64) *WeightUpsert

AddValue adds v to the "value" field.

func (*WeightUpsert) SetTimestamp

func (u *WeightUpsert) SetTimestamp(v time.Time) *WeightUpsert

SetTimestamp sets the "timestamp" field.

func (*WeightUpsert) SetUserid

func (u *WeightUpsert) SetUserid(v int64) *WeightUpsert

SetUserid sets the "userid" field.

func (*WeightUpsert) SetValue

func (u *WeightUpsert) SetValue(v float64) *WeightUpsert

SetValue sets the "value" field.

func (*WeightUpsert) UpdateTimestamp

func (u *WeightUpsert) UpdateTimestamp() *WeightUpsert

UpdateTimestamp sets the "timestamp" field to the value that was provided on create.

func (*WeightUpsert) UpdateUserid

func (u *WeightUpsert) UpdateUserid() *WeightUpsert

UpdateUserid sets the "userid" field to the value that was provided on create.

func (*WeightUpsert) UpdateValue

func (u *WeightUpsert) UpdateValue() *WeightUpsert

UpdateValue sets the "value" field to the value that was provided on create.

type WeightUpsertBulk

type WeightUpsertBulk struct {
	// contains filtered or unexported fields
}

WeightUpsertBulk is the builder for "upsert"-ing a bulk of Weight nodes.

func (*WeightUpsertBulk) AddUserid

func (u *WeightUpsertBulk) AddUserid(v int64) *WeightUpsertBulk

AddUserid adds v to the "userid" field.

func (*WeightUpsertBulk) AddValue

func (u *WeightUpsertBulk) AddValue(v float64) *WeightUpsertBulk

AddValue adds v to the "value" field.

func (*WeightUpsertBulk) DoNothing

func (u *WeightUpsertBulk) DoNothing() *WeightUpsertBulk

DoNothing configures the conflict_action to `DO NOTHING`. Supported only by SQLite and PostgreSQL.

func (*WeightUpsertBulk) Exec

func (u *WeightUpsertBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*WeightUpsertBulk) ExecX

func (u *WeightUpsertBulk) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*WeightUpsertBulk) Ignore

func (u *WeightUpsertBulk) Ignore() *WeightUpsertBulk

Ignore sets each column to itself in case of conflict. Using this option is equivalent to using:

client.Weight.Create().
	OnConflict(sql.ResolveWithIgnore()).
	Exec(ctx)

func (*WeightUpsertBulk) SetTimestamp

func (u *WeightUpsertBulk) SetTimestamp(v time.Time) *WeightUpsertBulk

SetTimestamp sets the "timestamp" field.

func (*WeightUpsertBulk) SetUserid

func (u *WeightUpsertBulk) SetUserid(v int64) *WeightUpsertBulk

SetUserid sets the "userid" field.

func (*WeightUpsertBulk) SetValue

func (u *WeightUpsertBulk) SetValue(v float64) *WeightUpsertBulk

SetValue sets the "value" field.

func (*WeightUpsertBulk) Update

func (u *WeightUpsertBulk) Update(set func(*WeightUpsert)) *WeightUpsertBulk

Update allows overriding fields `UPDATE` values. See the WeightCreateBulk.OnConflict documentation for more info.

func (*WeightUpsertBulk) UpdateNewValues

func (u *WeightUpsertBulk) UpdateNewValues() *WeightUpsertBulk

UpdateNewValues updates the mutable fields using the new values that were set on create. Using this option is equivalent to using:

client.Weight.Create().
	OnConflict(
		sql.ResolveWithNewValues(),
	).
	Exec(ctx)

func (*WeightUpsertBulk) UpdateTimestamp

func (u *WeightUpsertBulk) UpdateTimestamp() *WeightUpsertBulk

UpdateTimestamp sets the "timestamp" field to the value that was provided on create.

func (*WeightUpsertBulk) UpdateUserid

func (u *WeightUpsertBulk) UpdateUserid() *WeightUpsertBulk

UpdateUserid sets the "userid" field to the value that was provided on create.

func (*WeightUpsertBulk) UpdateValue

func (u *WeightUpsertBulk) UpdateValue() *WeightUpsertBulk

UpdateValue sets the "value" field to the value that was provided on create.

type WeightUpsertOne

type WeightUpsertOne struct {
	// contains filtered or unexported fields
}

WeightUpsertOne is the builder for "upsert"-ing

one Weight node.

func (*WeightUpsertOne) AddUserid

func (u *WeightUpsertOne) AddUserid(v int64) *WeightUpsertOne

AddUserid adds v to the "userid" field.

func (*WeightUpsertOne) AddValue

func (u *WeightUpsertOne) AddValue(v float64) *WeightUpsertOne

AddValue adds v to the "value" field.

func (*WeightUpsertOne) DoNothing

func (u *WeightUpsertOne) DoNothing() *WeightUpsertOne

DoNothing configures the conflict_action to `DO NOTHING`. Supported only by SQLite and PostgreSQL.

func (*WeightUpsertOne) Exec

func (u *WeightUpsertOne) Exec(ctx context.Context) error

Exec executes the query.

func (*WeightUpsertOne) ExecX

func (u *WeightUpsertOne) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*WeightUpsertOne) ID

func (u *WeightUpsertOne) ID(ctx context.Context) (id int, err error)

Exec executes the UPSERT query and returns the inserted/updated ID.

func (*WeightUpsertOne) IDX

func (u *WeightUpsertOne) IDX(ctx context.Context) int

IDX is like ID, but panics if an error occurs.

func (*WeightUpsertOne) Ignore

func (u *WeightUpsertOne) Ignore() *WeightUpsertOne

Ignore sets each column to itself in case of conflict. Using this option is equivalent to using:

client.Weight.Create().
    OnConflict(sql.ResolveWithIgnore()).
    Exec(ctx)

func (*WeightUpsertOne) SetTimestamp

func (u *WeightUpsertOne) SetTimestamp(v time.Time) *WeightUpsertOne

SetTimestamp sets the "timestamp" field.

func (*WeightUpsertOne) SetUserid

func (u *WeightUpsertOne) SetUserid(v int64) *WeightUpsertOne

SetUserid sets the "userid" field.

func (*WeightUpsertOne) SetValue

func (u *WeightUpsertOne) SetValue(v float64) *WeightUpsertOne

SetValue sets the "value" field.

func (*WeightUpsertOne) Update

func (u *WeightUpsertOne) Update(set func(*WeightUpsert)) *WeightUpsertOne

Update allows overriding fields `UPDATE` values. See the WeightCreate.OnConflict documentation for more info.

func (*WeightUpsertOne) UpdateNewValues

func (u *WeightUpsertOne) UpdateNewValues() *WeightUpsertOne

UpdateNewValues updates the mutable fields using the new values that were set on create. Using this option is equivalent to using:

client.Weight.Create().
	OnConflict(
		sql.ResolveWithNewValues(),
	).
	Exec(ctx)

func (*WeightUpsertOne) UpdateTimestamp

func (u *WeightUpsertOne) UpdateTimestamp() *WeightUpsertOne

UpdateTimestamp sets the "timestamp" field to the value that was provided on create.

func (*WeightUpsertOne) UpdateUserid

func (u *WeightUpsertOne) UpdateUserid() *WeightUpsertOne

UpdateUserid sets the "userid" field to the value that was provided on create.

func (*WeightUpsertOne) UpdateValue

func (u *WeightUpsertOne) UpdateValue() *WeightUpsertOne

UpdateValue sets the "value" field to the value that was provided on create.

type Weights

type Weights []*Weight

Weights is a parsable slice of Weight.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL