ent

package
v0.0.0-...-aa40251 Latest Latest
Warning

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

Go to latest
Published: Jan 22, 2024 License: GPL-3.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

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

	// Node types.
	TypeDevices = "Devices"
	TypeDirs    = "Dirs"
	TypeFiles   = "Files"
	TypeSaves   = "Saves"
	TypeUsers   = "Users"
)

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
	// Devices is the client for interacting with the Devices builders.
	Devices *DevicesClient
	// Dirs is the client for interacting with the Dirs builders.
	Dirs *DirsClient
	// Files is the client for interacting with the Files builders.
	Files *FilesClient
	// Saves is the client for interacting with the Saves builders.
	Saves *SavesClient
	// Users is the client for interacting with the Users builders.
	Users *UsersClient
	// 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().
	Devices.
	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 Devices

type Devices struct {

	// ID of the ent.
	ID uint64 `json:"id,omitempty"`
	// CreateTime holds the value of the "create_time" field.
	CreateTime time.Time `json:"create_time,omitempty"`
	// UpdateTime holds the value of the "update_time" field.
	UpdateTime time.Time `json:"update_time,omitempty"`
	// IP holds the value of the "ip" field.
	IP string `json:"ip,omitempty"`
	// Device holds the value of the "device" field.
	Device string `json:"device,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the DevicesQuery when eager-loading is set.
	Edges DevicesEdges `json:"edges"`
	// contains filtered or unexported fields
}

Devices is the model entity for the Devices schema.

func (*Devices) QueryUser

func (d *Devices) QueryUser() *UsersQuery

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

func (*Devices) String

func (d *Devices) String() string

String implements the fmt.Stringer.

func (*Devices) Unwrap

func (d *Devices) Unwrap() *Devices

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

func (d *Devices) Update() *DevicesUpdateOne

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

func (*Devices) Value

func (d *Devices) Value(name string) (ent.Value, error)

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

type DevicesClient

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

DevicesClient is a client for the Devices schema.

func NewDevicesClient

func NewDevicesClient(c config) *DevicesClient

NewDevicesClient returns a client for the Devices from the given config.

func (*DevicesClient) Create

func (c *DevicesClient) Create() *DevicesCreate

Create returns a builder for creating a Devices entity.

func (*DevicesClient) CreateBulk

func (c *DevicesClient) CreateBulk(builders ...*DevicesCreate) *DevicesCreateBulk

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

func (*DevicesClient) Delete

func (c *DevicesClient) Delete() *DevicesDelete

Delete returns a delete builder for Devices.

func (*DevicesClient) DeleteOne

func (c *DevicesClient) DeleteOne(d *Devices) *DevicesDeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*DevicesClient) DeleteOneID

func (c *DevicesClient) DeleteOneID(id uint64) *DevicesDeleteOne

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

func (*DevicesClient) Get

func (c *DevicesClient) Get(ctx context.Context, id uint64) (*Devices, error)

Get returns a Devices entity by its id.

func (*DevicesClient) GetX

func (c *DevicesClient) GetX(ctx context.Context, id uint64) *Devices

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

func (*DevicesClient) Hooks

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

Hooks returns the client hooks.

func (*DevicesClient) Intercept

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

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

func (*DevicesClient) Interceptors

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

Interceptors returns the client interceptors.

func (*DevicesClient) MapCreateBulk

func (c *DevicesClient) MapCreateBulk(slice any, setFunc func(*DevicesCreate, int)) *DevicesCreateBulk

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

func (c *DevicesClient) Query() *DevicesQuery

Query returns a query builder for Devices.

func (*DevicesClient) QueryUser

func (c *DevicesClient) QueryUser(d *Devices) *UsersQuery

QueryUser queries the user edge of a Devices.

func (*DevicesClient) Update

func (c *DevicesClient) Update() *DevicesUpdate

Update returns an update builder for Devices.

func (*DevicesClient) UpdateOne

func (c *DevicesClient) UpdateOne(d *Devices) *DevicesUpdateOne

UpdateOne returns an update builder for the given entity.

func (*DevicesClient) UpdateOneID

func (c *DevicesClient) UpdateOneID(id uint64) *DevicesUpdateOne

UpdateOneID returns an update builder for the given id.

func (*DevicesClient) Use

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

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

type DevicesCreate

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

DevicesCreate is the builder for creating a Devices entity.

func (*DevicesCreate) Exec

func (dc *DevicesCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*DevicesCreate) ExecX

func (dc *DevicesCreate) ExecX(ctx context.Context)

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

func (*DevicesCreate) Mutation

func (dc *DevicesCreate) Mutation() *DevicesMutation

Mutation returns the DevicesMutation object of the builder.

func (*DevicesCreate) Save

func (dc *DevicesCreate) Save(ctx context.Context) (*Devices, error)

Save creates the Devices in the database.

func (*DevicesCreate) SaveX

func (dc *DevicesCreate) SaveX(ctx context.Context) *Devices

SaveX calls Save and panics if Save returns an error.

func (*DevicesCreate) SetCreateTime

func (dc *DevicesCreate) SetCreateTime(t time.Time) *DevicesCreate

SetCreateTime sets the "create_time" field.

func (*DevicesCreate) SetDevice

func (dc *DevicesCreate) SetDevice(s string) *DevicesCreate

SetDevice sets the "device" field.

func (*DevicesCreate) SetID

func (dc *DevicesCreate) SetID(u uint64) *DevicesCreate

SetID sets the "id" field.

func (*DevicesCreate) SetIP

func (dc *DevicesCreate) SetIP(s string) *DevicesCreate

SetIP sets the "ip" field.

func (*DevicesCreate) SetNillableCreateTime

func (dc *DevicesCreate) SetNillableCreateTime(t *time.Time) *DevicesCreate

SetNillableCreateTime sets the "create_time" field if the given value is not nil.

func (*DevicesCreate) SetNillableUpdateTime

func (dc *DevicesCreate) SetNillableUpdateTime(t *time.Time) *DevicesCreate

SetNillableUpdateTime sets the "update_time" field if the given value is not nil.

func (*DevicesCreate) SetNillableUserID

func (dc *DevicesCreate) SetNillableUserID(id *uint64) *DevicesCreate

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

func (*DevicesCreate) SetUpdateTime

func (dc *DevicesCreate) SetUpdateTime(t time.Time) *DevicesCreate

SetUpdateTime sets the "update_time" field.

func (*DevicesCreate) SetUser

func (dc *DevicesCreate) SetUser(u *Users) *DevicesCreate

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

func (*DevicesCreate) SetUserID

func (dc *DevicesCreate) SetUserID(id uint64) *DevicesCreate

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

type DevicesCreateBulk

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

DevicesCreateBulk is the builder for creating many Devices entities in bulk.

func (*DevicesCreateBulk) Exec

func (dcb *DevicesCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*DevicesCreateBulk) ExecX

func (dcb *DevicesCreateBulk) ExecX(ctx context.Context)

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

func (*DevicesCreateBulk) Save

func (dcb *DevicesCreateBulk) Save(ctx context.Context) ([]*Devices, error)

Save creates the Devices entities in the database.

func (*DevicesCreateBulk) SaveX

func (dcb *DevicesCreateBulk) SaveX(ctx context.Context) []*Devices

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

type DevicesDelete

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

DevicesDelete is the builder for deleting a Devices entity.

func (*DevicesDelete) Exec

func (dd *DevicesDelete) Exec(ctx context.Context) (int, error)

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

func (*DevicesDelete) ExecX

func (dd *DevicesDelete) ExecX(ctx context.Context) int

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

func (*DevicesDelete) Where

func (dd *DevicesDelete) Where(ps ...predicate.Devices) *DevicesDelete

Where appends a list predicates to the DevicesDelete builder.

type DevicesDeleteOne

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

DevicesDeleteOne is the builder for deleting a single Devices entity.

func (*DevicesDeleteOne) Exec

func (ddo *DevicesDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*DevicesDeleteOne) ExecX

func (ddo *DevicesDeleteOne) ExecX(ctx context.Context)

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

func (*DevicesDeleteOne) Where

Where appends a list predicates to the DevicesDelete builder.

type DevicesEdges

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

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

func (DevicesEdges) UserOrErr

func (e DevicesEdges) UserOrErr() (*Users, error)

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

type DevicesGroupBy

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

DevicesGroupBy is the group-by builder for Devices entities.

func (*DevicesGroupBy) Aggregate

func (dgb *DevicesGroupBy) Aggregate(fns ...AggregateFunc) *DevicesGroupBy

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

func (*DevicesGroupBy) Bool

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

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

func (*DevicesGroupBy) BoolX

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

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

func (*DevicesGroupBy) Bools

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

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

func (*DevicesGroupBy) BoolsX

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

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

func (*DevicesGroupBy) Float64

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

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

func (*DevicesGroupBy) Float64X

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

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

func (*DevicesGroupBy) Float64s

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

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

func (*DevicesGroupBy) Float64sX

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

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

func (*DevicesGroupBy) Int

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

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

func (*DevicesGroupBy) IntX

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

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

func (*DevicesGroupBy) Ints

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

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

func (*DevicesGroupBy) IntsX

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

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

func (*DevicesGroupBy) Scan

func (dgb *DevicesGroupBy) Scan(ctx context.Context, v any) error

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

func (*DevicesGroupBy) ScanX

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

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

func (*DevicesGroupBy) String

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

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

func (*DevicesGroupBy) StringX

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

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

func (*DevicesGroupBy) Strings

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

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

func (*DevicesGroupBy) StringsX

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

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

type DevicesMutation

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

DevicesMutation represents an operation that mutates the Devices nodes in the graph.

func (*DevicesMutation) AddField

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

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

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

func (*DevicesMutation) AddedField

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

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

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

func (*DevicesMutation) AddedIDs

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

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

func (*DevicesMutation) ClearEdge

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

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

func (m *DevicesMutation) ClearUser()

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

func (*DevicesMutation) ClearedEdges

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

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

func (*DevicesMutation) ClearedFields

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

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

func (DevicesMutation) Client

func (m DevicesMutation) 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 (*DevicesMutation) CreateTime

func (m *DevicesMutation) CreateTime() (r time.Time, exists bool)

CreateTime returns the value of the "create_time" field in the mutation.

func (*DevicesMutation) Device

func (m *DevicesMutation) Device() (r string, exists bool)

Device returns the value of the "device" field in the mutation.

func (*DevicesMutation) EdgeCleared

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

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

func (*DevicesMutation) Field

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

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

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

func (*DevicesMutation) Fields

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

func (m *DevicesMutation) ID() (id uint64, 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 (*DevicesMutation) IDs

func (m *DevicesMutation) IDs(ctx context.Context) ([]uint64, 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 (*DevicesMutation) IP

func (m *DevicesMutation) IP() (r string, exists bool)

IP returns the value of the "ip" field in the mutation.

func (*DevicesMutation) OldCreateTime

func (m *DevicesMutation) OldCreateTime(ctx context.Context) (v time.Time, err error)

OldCreateTime returns the old "create_time" field's value of the Devices entity. If the Devices 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 (*DevicesMutation) OldDevice

func (m *DevicesMutation) OldDevice(ctx context.Context) (v string, err error)

OldDevice returns the old "device" field's value of the Devices entity. If the Devices 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 (*DevicesMutation) OldField

func (m *DevicesMutation) 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 (*DevicesMutation) OldIP

func (m *DevicesMutation) OldIP(ctx context.Context) (v string, err error)

OldIP returns the old "ip" field's value of the Devices entity. If the Devices 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 (*DevicesMutation) OldUpdateTime

func (m *DevicesMutation) OldUpdateTime(ctx context.Context) (v time.Time, err error)

OldUpdateTime returns the old "update_time" field's value of the Devices entity. If the Devices 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 (*DevicesMutation) Op

func (m *DevicesMutation) Op() Op

Op returns the operation name.

func (*DevicesMutation) RemovedEdges

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

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

func (*DevicesMutation) RemovedIDs

func (m *DevicesMutation) 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 (*DevicesMutation) ResetCreateTime

func (m *DevicesMutation) ResetCreateTime()

ResetCreateTime resets all changes to the "create_time" field.

func (*DevicesMutation) ResetDevice

func (m *DevicesMutation) ResetDevice()

ResetDevice resets all changes to the "device" field.

func (*DevicesMutation) ResetEdge

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

func (m *DevicesMutation) 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 (*DevicesMutation) ResetIP

func (m *DevicesMutation) ResetIP()

ResetIP resets all changes to the "ip" field.

func (*DevicesMutation) ResetUpdateTime

func (m *DevicesMutation) ResetUpdateTime()

ResetUpdateTime resets all changes to the "update_time" field.

func (*DevicesMutation) ResetUser

func (m *DevicesMutation) ResetUser()

ResetUser resets all changes to the "user" edge.

func (*DevicesMutation) SetCreateTime

func (m *DevicesMutation) SetCreateTime(t time.Time)

SetCreateTime sets the "create_time" field.

func (*DevicesMutation) SetDevice

func (m *DevicesMutation) SetDevice(s string)

SetDevice sets the "device" field.

func (*DevicesMutation) SetField

func (m *DevicesMutation) 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 (*DevicesMutation) SetID

func (m *DevicesMutation) SetID(id uint64)

SetID sets the value of the id field. Note that this operation is only accepted on creation of Devices entities.

func (*DevicesMutation) SetIP

func (m *DevicesMutation) SetIP(s string)

SetIP sets the "ip" field.

func (*DevicesMutation) SetOp

func (m *DevicesMutation) SetOp(op Op)

SetOp allows setting the mutation operation.

func (*DevicesMutation) SetUpdateTime

func (m *DevicesMutation) SetUpdateTime(t time.Time)

SetUpdateTime sets the "update_time" field.

func (*DevicesMutation) SetUserID

func (m *DevicesMutation) SetUserID(id uint64)

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

func (DevicesMutation) Tx

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

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

func (*DevicesMutation) Type

func (m *DevicesMutation) Type() string

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

func (*DevicesMutation) UpdateTime

func (m *DevicesMutation) UpdateTime() (r time.Time, exists bool)

UpdateTime returns the value of the "update_time" field in the mutation.

func (*DevicesMutation) UserCleared

func (m *DevicesMutation) UserCleared() bool

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

func (*DevicesMutation) UserID

func (m *DevicesMutation) UserID() (id uint64, exists bool)

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

func (*DevicesMutation) UserIDs

func (m *DevicesMutation) UserIDs() (ids []uint64)

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

func (*DevicesMutation) Where

func (m *DevicesMutation) Where(ps ...predicate.Devices)

Where appends a list predicates to the DevicesMutation builder.

func (*DevicesMutation) WhereP

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

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

type DevicesQuery

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

DevicesQuery is the builder for querying Devices entities.

func (*DevicesQuery) Aggregate

func (dq *DevicesQuery) Aggregate(fns ...AggregateFunc) *DevicesSelect

Aggregate returns a DevicesSelect configured with the given aggregations.

func (*DevicesQuery) All

func (dq *DevicesQuery) All(ctx context.Context) ([]*Devices, error)

All executes the query and returns a list of DevicesSlice.

func (*DevicesQuery) AllX

func (dq *DevicesQuery) AllX(ctx context.Context) []*Devices

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

func (*DevicesQuery) Clone

func (dq *DevicesQuery) Clone() *DevicesQuery

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

func (*DevicesQuery) Count

func (dq *DevicesQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*DevicesQuery) CountX

func (dq *DevicesQuery) CountX(ctx context.Context) int

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

func (*DevicesQuery) Exist

func (dq *DevicesQuery) Exist(ctx context.Context) (bool, error)

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

func (*DevicesQuery) ExistX

func (dq *DevicesQuery) ExistX(ctx context.Context) bool

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

func (*DevicesQuery) First

func (dq *DevicesQuery) First(ctx context.Context) (*Devices, error)

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

func (*DevicesQuery) FirstID

func (dq *DevicesQuery) FirstID(ctx context.Context) (id uint64, err error)

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

func (*DevicesQuery) FirstIDX

func (dq *DevicesQuery) FirstIDX(ctx context.Context) uint64

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

func (*DevicesQuery) FirstX

func (dq *DevicesQuery) FirstX(ctx context.Context) *Devices

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

func (*DevicesQuery) GroupBy

func (dq *DevicesQuery) GroupBy(field string, fields ...string) *DevicesGroupBy

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

client.Devices.Query().
	GroupBy(devices.FieldCreateTime).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*DevicesQuery) IDs

func (dq *DevicesQuery) IDs(ctx context.Context) (ids []uint64, err error)

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

func (*DevicesQuery) IDsX

func (dq *DevicesQuery) IDsX(ctx context.Context) []uint64

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

func (*DevicesQuery) Limit

func (dq *DevicesQuery) Limit(limit int) *DevicesQuery

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

func (*DevicesQuery) Offset

func (dq *DevicesQuery) Offset(offset int) *DevicesQuery

Offset to start from.

func (*DevicesQuery) Only

func (dq *DevicesQuery) Only(ctx context.Context) (*Devices, error)

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

func (*DevicesQuery) OnlyID

func (dq *DevicesQuery) OnlyID(ctx context.Context) (id uint64, err error)

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

func (*DevicesQuery) OnlyIDX

func (dq *DevicesQuery) OnlyIDX(ctx context.Context) uint64

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

func (*DevicesQuery) OnlyX

func (dq *DevicesQuery) OnlyX(ctx context.Context) *Devices

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

func (*DevicesQuery) Order

func (dq *DevicesQuery) Order(o ...devices.OrderOption) *DevicesQuery

Order specifies how the records should be ordered.

func (*DevicesQuery) QueryUser

func (dq *DevicesQuery) QueryUser() *UsersQuery

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

func (*DevicesQuery) Select

func (dq *DevicesQuery) Select(fields ...string) *DevicesSelect

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 {
	CreateTime time.Time `json:"create_time,omitempty"`
}

client.Devices.Query().
	Select(devices.FieldCreateTime).
	Scan(ctx, &v)

func (*DevicesQuery) Unique

func (dq *DevicesQuery) Unique(unique bool) *DevicesQuery

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

func (dq *DevicesQuery) Where(ps ...predicate.Devices) *DevicesQuery

Where adds a new predicate for the DevicesQuery builder.

func (*DevicesQuery) WithUser

func (dq *DevicesQuery) WithUser(opts ...func(*UsersQuery)) *DevicesQuery

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

type DevicesSelect

type DevicesSelect struct {
	*DevicesQuery
	// contains filtered or unexported fields
}

DevicesSelect is the builder for selecting fields of Devices entities.

func (*DevicesSelect) Aggregate

func (ds *DevicesSelect) Aggregate(fns ...AggregateFunc) *DevicesSelect

Aggregate adds the given aggregation functions to the selector query.

func (*DevicesSelect) Bool

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

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

func (*DevicesSelect) BoolX

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

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

func (*DevicesSelect) Bools

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

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

func (*DevicesSelect) BoolsX

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

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

func (*DevicesSelect) Float64

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

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

func (*DevicesSelect) Float64X

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

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

func (*DevicesSelect) Float64s

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

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

func (*DevicesSelect) Float64sX

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

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

func (*DevicesSelect) Int

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

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

func (*DevicesSelect) IntX

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

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

func (*DevicesSelect) Ints

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

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

func (*DevicesSelect) IntsX

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

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

func (*DevicesSelect) Scan

func (ds *DevicesSelect) Scan(ctx context.Context, v any) error

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

func (*DevicesSelect) ScanX

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

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

func (*DevicesSelect) String

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

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

func (*DevicesSelect) StringX

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

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

func (*DevicesSelect) Strings

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

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

func (*DevicesSelect) StringsX

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

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

type DevicesSlice

type DevicesSlice []*Devices

DevicesSlice is a parsable slice of Devices.

type DevicesUpdate

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

DevicesUpdate is the builder for updating Devices entities.

func (*DevicesUpdate) ClearUser

func (du *DevicesUpdate) ClearUser() *DevicesUpdate

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

func (*DevicesUpdate) Exec

func (du *DevicesUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*DevicesUpdate) ExecX

func (du *DevicesUpdate) ExecX(ctx context.Context)

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

func (*DevicesUpdate) Mutation

func (du *DevicesUpdate) Mutation() *DevicesMutation

Mutation returns the DevicesMutation object of the builder.

func (*DevicesUpdate) Save

func (du *DevicesUpdate) Save(ctx context.Context) (int, error)

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

func (*DevicesUpdate) SaveX

func (du *DevicesUpdate) SaveX(ctx context.Context) int

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

func (*DevicesUpdate) SetDevice

func (du *DevicesUpdate) SetDevice(s string) *DevicesUpdate

SetDevice sets the "device" field.

func (*DevicesUpdate) SetIP

func (du *DevicesUpdate) SetIP(s string) *DevicesUpdate

SetIP sets the "ip" field.

func (*DevicesUpdate) SetNillableDevice

func (du *DevicesUpdate) SetNillableDevice(s *string) *DevicesUpdate

SetNillableDevice sets the "device" field if the given value is not nil.

func (*DevicesUpdate) SetNillableIP

func (du *DevicesUpdate) SetNillableIP(s *string) *DevicesUpdate

SetNillableIP sets the "ip" field if the given value is not nil.

func (*DevicesUpdate) SetNillableUserID

func (du *DevicesUpdate) SetNillableUserID(id *uint64) *DevicesUpdate

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

func (*DevicesUpdate) SetUpdateTime

func (du *DevicesUpdate) SetUpdateTime(t time.Time) *DevicesUpdate

SetUpdateTime sets the "update_time" field.

func (*DevicesUpdate) SetUser

func (du *DevicesUpdate) SetUser(u *Users) *DevicesUpdate

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

func (*DevicesUpdate) SetUserID

func (du *DevicesUpdate) SetUserID(id uint64) *DevicesUpdate

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

func (*DevicesUpdate) Where

func (du *DevicesUpdate) Where(ps ...predicate.Devices) *DevicesUpdate

Where appends a list predicates to the DevicesUpdate builder.

type DevicesUpdateOne

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

DevicesUpdateOne is the builder for updating a single Devices entity.

func (*DevicesUpdateOne) ClearUser

func (duo *DevicesUpdateOne) ClearUser() *DevicesUpdateOne

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

func (*DevicesUpdateOne) Exec

func (duo *DevicesUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*DevicesUpdateOne) ExecX

func (duo *DevicesUpdateOne) ExecX(ctx context.Context)

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

func (*DevicesUpdateOne) Mutation

func (duo *DevicesUpdateOne) Mutation() *DevicesMutation

Mutation returns the DevicesMutation object of the builder.

func (*DevicesUpdateOne) Save

func (duo *DevicesUpdateOne) Save(ctx context.Context) (*Devices, error)

Save executes the query and returns the updated Devices entity.

func (*DevicesUpdateOne) SaveX

func (duo *DevicesUpdateOne) SaveX(ctx context.Context) *Devices

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

func (*DevicesUpdateOne) Select

func (duo *DevicesUpdateOne) Select(field string, fields ...string) *DevicesUpdateOne

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

func (*DevicesUpdateOne) SetDevice

func (duo *DevicesUpdateOne) SetDevice(s string) *DevicesUpdateOne

SetDevice sets the "device" field.

func (*DevicesUpdateOne) SetIP

func (duo *DevicesUpdateOne) SetIP(s string) *DevicesUpdateOne

SetIP sets the "ip" field.

func (*DevicesUpdateOne) SetNillableDevice

func (duo *DevicesUpdateOne) SetNillableDevice(s *string) *DevicesUpdateOne

SetNillableDevice sets the "device" field if the given value is not nil.

func (*DevicesUpdateOne) SetNillableIP

func (duo *DevicesUpdateOne) SetNillableIP(s *string) *DevicesUpdateOne

SetNillableIP sets the "ip" field if the given value is not nil.

func (*DevicesUpdateOne) SetNillableUserID

func (duo *DevicesUpdateOne) SetNillableUserID(id *uint64) *DevicesUpdateOne

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

func (*DevicesUpdateOne) SetUpdateTime

func (duo *DevicesUpdateOne) SetUpdateTime(t time.Time) *DevicesUpdateOne

SetUpdateTime sets the "update_time" field.

func (*DevicesUpdateOne) SetUser

func (duo *DevicesUpdateOne) SetUser(u *Users) *DevicesUpdateOne

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

func (*DevicesUpdateOne) SetUserID

func (duo *DevicesUpdateOne) SetUserID(id uint64) *DevicesUpdateOne

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

func (*DevicesUpdateOne) Where

Where appends a list predicates to the DevicesUpdate builder.

type Dirs

type Dirs struct {

	// ID of the ent.
	ID uint64 `json:"id,omitempty"`
	// CreateTime holds the value of the "create_time" field.
	CreateTime time.Time `json:"create_time,omitempty"`
	// UpdateTime holds the value of the "update_time" field.
	UpdateTime time.Time `json:"update_time,omitempty"`
	// Name holds the value of the "name" field.
	Name string `json:"name,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the DirsQuery when eager-loading is set.
	Edges DirsEdges `json:"edges"`
	// contains filtered or unexported fields
}

Dirs is the model entity for the Dirs schema.

func (*Dirs) QueryOwner

func (d *Dirs) QueryOwner() *UsersQuery

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

func (*Dirs) QueryPdir

func (d *Dirs) QueryPdir() *DirsQuery

QueryPdir queries the "pdir" edge of the Dirs entity.

func (*Dirs) QuerySaves

func (d *Dirs) QuerySaves() *SavesQuery

QuerySaves queries the "saves" edge of the Dirs entity.

func (*Dirs) QuerySubdir

func (d *Dirs) QuerySubdir() *DirsQuery

QuerySubdir queries the "subdir" edge of the Dirs entity.

func (*Dirs) String

func (d *Dirs) String() string

String implements the fmt.Stringer.

func (*Dirs) Unwrap

func (d *Dirs) Unwrap() *Dirs

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

func (d *Dirs) Update() *DirsUpdateOne

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

func (*Dirs) Value

func (d *Dirs) Value(name string) (ent.Value, error)

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

type DirsClient

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

DirsClient is a client for the Dirs schema.

func NewDirsClient

func NewDirsClient(c config) *DirsClient

NewDirsClient returns a client for the Dirs from the given config.

func (*DirsClient) Create

func (c *DirsClient) Create() *DirsCreate

Create returns a builder for creating a Dirs entity.

func (*DirsClient) CreateBulk

func (c *DirsClient) CreateBulk(builders ...*DirsCreate) *DirsCreateBulk

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

func (*DirsClient) Delete

func (c *DirsClient) Delete() *DirsDelete

Delete returns a delete builder for Dirs.

func (*DirsClient) DeleteOne

func (c *DirsClient) DeleteOne(d *Dirs) *DirsDeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*DirsClient) DeleteOneID

func (c *DirsClient) DeleteOneID(id uint64) *DirsDeleteOne

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

func (*DirsClient) Get

func (c *DirsClient) Get(ctx context.Context, id uint64) (*Dirs, error)

Get returns a Dirs entity by its id.

func (*DirsClient) GetX

func (c *DirsClient) GetX(ctx context.Context, id uint64) *Dirs

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

func (*DirsClient) Hooks

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

Hooks returns the client hooks.

func (*DirsClient) Intercept

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

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

func (*DirsClient) Interceptors

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

Interceptors returns the client interceptors.

func (*DirsClient) MapCreateBulk

func (c *DirsClient) MapCreateBulk(slice any, setFunc func(*DirsCreate, int)) *DirsCreateBulk

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

func (c *DirsClient) Query() *DirsQuery

Query returns a query builder for Dirs.

func (*DirsClient) QueryOwner

func (c *DirsClient) QueryOwner(d *Dirs) *UsersQuery

QueryOwner queries the owner edge of a Dirs.

func (*DirsClient) QueryPdir

func (c *DirsClient) QueryPdir(d *Dirs) *DirsQuery

QueryPdir queries the pdir edge of a Dirs.

func (*DirsClient) QuerySaves

func (c *DirsClient) QuerySaves(d *Dirs) *SavesQuery

QuerySaves queries the saves edge of a Dirs.

func (*DirsClient) QuerySubdir

func (c *DirsClient) QuerySubdir(d *Dirs) *DirsQuery

QuerySubdir queries the subdir edge of a Dirs.

func (*DirsClient) Update

func (c *DirsClient) Update() *DirsUpdate

Update returns an update builder for Dirs.

func (*DirsClient) UpdateOne

func (c *DirsClient) UpdateOne(d *Dirs) *DirsUpdateOne

UpdateOne returns an update builder for the given entity.

func (*DirsClient) UpdateOneID

func (c *DirsClient) UpdateOneID(id uint64) *DirsUpdateOne

UpdateOneID returns an update builder for the given id.

func (*DirsClient) Use

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

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

type DirsCreate

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

DirsCreate is the builder for creating a Dirs entity.

func (*DirsCreate) AddPdir

func (dc *DirsCreate) AddPdir(d ...*Dirs) *DirsCreate

AddPdir adds the "pdir" edges to the Dirs entity.

func (*DirsCreate) AddPdirIDs

func (dc *DirsCreate) AddPdirIDs(ids ...uint64) *DirsCreate

AddPdirIDs adds the "pdir" edge to the Dirs entity by IDs.

func (*DirsCreate) AddSafeIDs

func (dc *DirsCreate) AddSafeIDs(ids ...uint64) *DirsCreate

AddSafeIDs adds the "saves" edge to the Saves entity by IDs.

func (*DirsCreate) AddSaves

func (dc *DirsCreate) AddSaves(s ...*Saves) *DirsCreate

AddSaves adds the "saves" edges to the Saves entity.

func (*DirsCreate) AddSubdir

func (dc *DirsCreate) AddSubdir(d ...*Dirs) *DirsCreate

AddSubdir adds the "subdir" edges to the Dirs entity.

func (*DirsCreate) AddSubdirIDs

func (dc *DirsCreate) AddSubdirIDs(ids ...uint64) *DirsCreate

AddSubdirIDs adds the "subdir" edge to the Dirs entity by IDs.

func (*DirsCreate) Exec

func (dc *DirsCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*DirsCreate) ExecX

func (dc *DirsCreate) ExecX(ctx context.Context)

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

func (*DirsCreate) Mutation

func (dc *DirsCreate) Mutation() *DirsMutation

Mutation returns the DirsMutation object of the builder.

func (*DirsCreate) Save

func (dc *DirsCreate) Save(ctx context.Context) (*Dirs, error)

Save creates the Dirs in the database.

func (*DirsCreate) SaveX

func (dc *DirsCreate) SaveX(ctx context.Context) *Dirs

SaveX calls Save and panics if Save returns an error.

func (*DirsCreate) SetCreateTime

func (dc *DirsCreate) SetCreateTime(t time.Time) *DirsCreate

SetCreateTime sets the "create_time" field.

func (*DirsCreate) SetID

func (dc *DirsCreate) SetID(u uint64) *DirsCreate

SetID sets the "id" field.

func (*DirsCreate) SetName

func (dc *DirsCreate) SetName(s string) *DirsCreate

SetName sets the "name" field.

func (*DirsCreate) SetNillableCreateTime

func (dc *DirsCreate) SetNillableCreateTime(t *time.Time) *DirsCreate

SetNillableCreateTime sets the "create_time" field if the given value is not nil.

func (*DirsCreate) SetNillableOwnerID

func (dc *DirsCreate) SetNillableOwnerID(id *uint64) *DirsCreate

SetNillableOwnerID sets the "owner" edge to the Users entity by ID if the given value is not nil.

func (*DirsCreate) SetNillableUpdateTime

func (dc *DirsCreate) SetNillableUpdateTime(t *time.Time) *DirsCreate

SetNillableUpdateTime sets the "update_time" field if the given value is not nil.

func (*DirsCreate) SetOwner

func (dc *DirsCreate) SetOwner(u *Users) *DirsCreate

SetOwner sets the "owner" edge to the Users entity.

func (*DirsCreate) SetOwnerID

func (dc *DirsCreate) SetOwnerID(id uint64) *DirsCreate

SetOwnerID sets the "owner" edge to the Users entity by ID.

func (*DirsCreate) SetUpdateTime

func (dc *DirsCreate) SetUpdateTime(t time.Time) *DirsCreate

SetUpdateTime sets the "update_time" field.

type DirsCreateBulk

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

DirsCreateBulk is the builder for creating many Dirs entities in bulk.

func (*DirsCreateBulk) Exec

func (dcb *DirsCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*DirsCreateBulk) ExecX

func (dcb *DirsCreateBulk) ExecX(ctx context.Context)

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

func (*DirsCreateBulk) Save

func (dcb *DirsCreateBulk) Save(ctx context.Context) ([]*Dirs, error)

Save creates the Dirs entities in the database.

func (*DirsCreateBulk) SaveX

func (dcb *DirsCreateBulk) SaveX(ctx context.Context) []*Dirs

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

type DirsDelete

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

DirsDelete is the builder for deleting a Dirs entity.

func (*DirsDelete) Exec

func (dd *DirsDelete) Exec(ctx context.Context) (int, error)

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

func (*DirsDelete) ExecX

func (dd *DirsDelete) ExecX(ctx context.Context) int

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

func (*DirsDelete) Where

func (dd *DirsDelete) Where(ps ...predicate.Dirs) *DirsDelete

Where appends a list predicates to the DirsDelete builder.

type DirsDeleteOne

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

DirsDeleteOne is the builder for deleting a single Dirs entity.

func (*DirsDeleteOne) Exec

func (ddo *DirsDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*DirsDeleteOne) ExecX

func (ddo *DirsDeleteOne) ExecX(ctx context.Context)

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

func (*DirsDeleteOne) Where

func (ddo *DirsDeleteOne) Where(ps ...predicate.Dirs) *DirsDeleteOne

Where appends a list predicates to the DirsDelete builder.

type DirsEdges

type DirsEdges struct {
	// Owner holds the value of the owner edge.
	Owner *Users `json:"owner,omitempty"`
	// Saves holds the value of the saves edge.
	Saves []*Saves `json:"saves,omitempty"`
	// Subdir holds the value of the subdir edge.
	Subdir []*Dirs `json:"subdir,omitempty"`
	// Pdir holds the value of the pdir edge.
	Pdir []*Dirs `json:"pdir,omitempty"`
	// contains filtered or unexported fields
}

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

func (DirsEdges) OwnerOrErr

func (e DirsEdges) OwnerOrErr() (*Users, error)

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

func (DirsEdges) PdirOrErr

func (e DirsEdges) PdirOrErr() ([]*Dirs, error)

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

func (DirsEdges) SavesOrErr

func (e DirsEdges) SavesOrErr() ([]*Saves, error)

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

func (DirsEdges) SubdirOrErr

func (e DirsEdges) SubdirOrErr() ([]*Dirs, error)

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

type DirsGroupBy

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

DirsGroupBy is the group-by builder for Dirs entities.

func (*DirsGroupBy) Aggregate

func (dgb *DirsGroupBy) Aggregate(fns ...AggregateFunc) *DirsGroupBy

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

func (*DirsGroupBy) Bool

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

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

func (*DirsGroupBy) BoolX

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

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

func (*DirsGroupBy) Bools

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

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

func (*DirsGroupBy) BoolsX

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

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

func (*DirsGroupBy) Float64

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

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

func (*DirsGroupBy) Float64X

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

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

func (*DirsGroupBy) Float64s

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

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

func (*DirsGroupBy) Float64sX

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

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

func (*DirsGroupBy) Int

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

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

func (*DirsGroupBy) IntX

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

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

func (*DirsGroupBy) Ints

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

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

func (*DirsGroupBy) IntsX

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

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

func (*DirsGroupBy) Scan

func (dgb *DirsGroupBy) Scan(ctx context.Context, v any) error

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

func (*DirsGroupBy) ScanX

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

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

func (*DirsGroupBy) String

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

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

func (*DirsGroupBy) StringX

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

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

func (*DirsGroupBy) Strings

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

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

func (*DirsGroupBy) StringsX

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

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

type DirsMutation

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

DirsMutation represents an operation that mutates the Dirs nodes in the graph.

func (*DirsMutation) AddField

func (m *DirsMutation) 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 (*DirsMutation) AddPdirIDs

func (m *DirsMutation) AddPdirIDs(ids ...uint64)

AddPdirIDs adds the "pdir" edge to the Dirs entity by ids.

func (*DirsMutation) AddSafeIDs

func (m *DirsMutation) AddSafeIDs(ids ...uint64)

AddSafeIDs adds the "saves" edge to the Saves entity by ids.

func (*DirsMutation) AddSubdirIDs

func (m *DirsMutation) AddSubdirIDs(ids ...uint64)

AddSubdirIDs adds the "subdir" edge to the Dirs entity by ids.

func (*DirsMutation) AddedEdges

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

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

func (*DirsMutation) AddedField

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

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

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

func (*DirsMutation) AddedIDs

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

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

func (*DirsMutation) ClearEdge

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

func (m *DirsMutation) 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 (*DirsMutation) ClearOwner

func (m *DirsMutation) ClearOwner()

ClearOwner clears the "owner" edge to the Users entity.

func (*DirsMutation) ClearPdir

func (m *DirsMutation) ClearPdir()

ClearPdir clears the "pdir" edge to the Dirs entity.

func (*DirsMutation) ClearSaves

func (m *DirsMutation) ClearSaves()

ClearSaves clears the "saves" edge to the Saves entity.

func (*DirsMutation) ClearSubdir

func (m *DirsMutation) ClearSubdir()

ClearSubdir clears the "subdir" edge to the Dirs entity.

func (*DirsMutation) ClearedEdges

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

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

func (*DirsMutation) ClearedFields

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

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

func (DirsMutation) Client

func (m DirsMutation) 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 (*DirsMutation) CreateTime

func (m *DirsMutation) CreateTime() (r time.Time, exists bool)

CreateTime returns the value of the "create_time" field in the mutation.

func (*DirsMutation) EdgeCleared

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

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

func (*DirsMutation) Field

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

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

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

func (*DirsMutation) Fields

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

func (m *DirsMutation) ID() (id uint64, 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 (*DirsMutation) IDs

func (m *DirsMutation) IDs(ctx context.Context) ([]uint64, 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 (*DirsMutation) Name

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

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

func (*DirsMutation) OldCreateTime

func (m *DirsMutation) OldCreateTime(ctx context.Context) (v time.Time, err error)

OldCreateTime returns the old "create_time" field's value of the Dirs entity. If the Dirs 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 (*DirsMutation) OldField

func (m *DirsMutation) 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 (*DirsMutation) OldName

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

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

func (m *DirsMutation) OldUpdateTime(ctx context.Context) (v time.Time, err error)

OldUpdateTime returns the old "update_time" field's value of the Dirs entity. If the Dirs 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 (*DirsMutation) Op

func (m *DirsMutation) Op() Op

Op returns the operation name.

func (*DirsMutation) OwnerCleared

func (m *DirsMutation) OwnerCleared() bool

OwnerCleared reports if the "owner" edge to the Users entity was cleared.

func (*DirsMutation) OwnerID

func (m *DirsMutation) OwnerID() (id uint64, exists bool)

OwnerID returns the "owner" edge ID in the mutation.

func (*DirsMutation) OwnerIDs

func (m *DirsMutation) OwnerIDs() (ids []uint64)

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

func (*DirsMutation) PdirCleared

func (m *DirsMutation) PdirCleared() bool

PdirCleared reports if the "pdir" edge to the Dirs entity was cleared.

func (*DirsMutation) PdirIDs

func (m *DirsMutation) PdirIDs() (ids []uint64)

PdirIDs returns the "pdir" edge IDs in the mutation.

func (*DirsMutation) RemovePdirIDs

func (m *DirsMutation) RemovePdirIDs(ids ...uint64)

RemovePdirIDs removes the "pdir" edge to the Dirs entity by IDs.

func (*DirsMutation) RemoveSafeIDs

func (m *DirsMutation) RemoveSafeIDs(ids ...uint64)

RemoveSafeIDs removes the "saves" edge to the Saves entity by IDs.

func (*DirsMutation) RemoveSubdirIDs

func (m *DirsMutation) RemoveSubdirIDs(ids ...uint64)

RemoveSubdirIDs removes the "subdir" edge to the Dirs entity by IDs.

func (*DirsMutation) RemovedEdges

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

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

func (*DirsMutation) RemovedIDs

func (m *DirsMutation) 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 (*DirsMutation) RemovedPdirIDs

func (m *DirsMutation) RemovedPdirIDs() (ids []uint64)

RemovedPdir returns the removed IDs of the "pdir" edge to the Dirs entity.

func (*DirsMutation) RemovedSavesIDs

func (m *DirsMutation) RemovedSavesIDs() (ids []uint64)

RemovedSaves returns the removed IDs of the "saves" edge to the Saves entity.

func (*DirsMutation) RemovedSubdirIDs

func (m *DirsMutation) RemovedSubdirIDs() (ids []uint64)

RemovedSubdir returns the removed IDs of the "subdir" edge to the Dirs entity.

func (*DirsMutation) ResetCreateTime

func (m *DirsMutation) ResetCreateTime()

ResetCreateTime resets all changes to the "create_time" field.

func (*DirsMutation) ResetEdge

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

func (m *DirsMutation) 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 (*DirsMutation) ResetName

func (m *DirsMutation) ResetName()

ResetName resets all changes to the "name" field.

func (*DirsMutation) ResetOwner

func (m *DirsMutation) ResetOwner()

ResetOwner resets all changes to the "owner" edge.

func (*DirsMutation) ResetPdir

func (m *DirsMutation) ResetPdir()

ResetPdir resets all changes to the "pdir" edge.

func (*DirsMutation) ResetSaves

func (m *DirsMutation) ResetSaves()

ResetSaves resets all changes to the "saves" edge.

func (*DirsMutation) ResetSubdir

func (m *DirsMutation) ResetSubdir()

ResetSubdir resets all changes to the "subdir" edge.

func (*DirsMutation) ResetUpdateTime

func (m *DirsMutation) ResetUpdateTime()

ResetUpdateTime resets all changes to the "update_time" field.

func (*DirsMutation) SavesCleared

func (m *DirsMutation) SavesCleared() bool

SavesCleared reports if the "saves" edge to the Saves entity was cleared.

func (*DirsMutation) SavesIDs

func (m *DirsMutation) SavesIDs() (ids []uint64)

SavesIDs returns the "saves" edge IDs in the mutation.

func (*DirsMutation) SetCreateTime

func (m *DirsMutation) SetCreateTime(t time.Time)

SetCreateTime sets the "create_time" field.

func (*DirsMutation) SetField

func (m *DirsMutation) 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 (*DirsMutation) SetID

func (m *DirsMutation) SetID(id uint64)

SetID sets the value of the id field. Note that this operation is only accepted on creation of Dirs entities.

func (*DirsMutation) SetName

func (m *DirsMutation) SetName(s string)

SetName sets the "name" field.

func (*DirsMutation) SetOp

func (m *DirsMutation) SetOp(op Op)

SetOp allows setting the mutation operation.

func (*DirsMutation) SetOwnerID

func (m *DirsMutation) SetOwnerID(id uint64)

SetOwnerID sets the "owner" edge to the Users entity by id.

func (*DirsMutation) SetUpdateTime

func (m *DirsMutation) SetUpdateTime(t time.Time)

SetUpdateTime sets the "update_time" field.

func (*DirsMutation) SubdirCleared

func (m *DirsMutation) SubdirCleared() bool

SubdirCleared reports if the "subdir" edge to the Dirs entity was cleared.

func (*DirsMutation) SubdirIDs

func (m *DirsMutation) SubdirIDs() (ids []uint64)

SubdirIDs returns the "subdir" edge IDs in the mutation.

func (DirsMutation) Tx

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

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

func (*DirsMutation) Type

func (m *DirsMutation) Type() string

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

func (*DirsMutation) UpdateTime

func (m *DirsMutation) UpdateTime() (r time.Time, exists bool)

UpdateTime returns the value of the "update_time" field in the mutation.

func (*DirsMutation) Where

func (m *DirsMutation) Where(ps ...predicate.Dirs)

Where appends a list predicates to the DirsMutation builder.

func (*DirsMutation) WhereP

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

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

type DirsQuery

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

DirsQuery is the builder for querying Dirs entities.

func (*DirsQuery) Aggregate

func (dq *DirsQuery) Aggregate(fns ...AggregateFunc) *DirsSelect

Aggregate returns a DirsSelect configured with the given aggregations.

func (*DirsQuery) All

func (dq *DirsQuery) All(ctx context.Context) ([]*Dirs, error)

All executes the query and returns a list of DirsSlice.

func (*DirsQuery) AllX

func (dq *DirsQuery) AllX(ctx context.Context) []*Dirs

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

func (*DirsQuery) Clone

func (dq *DirsQuery) Clone() *DirsQuery

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

func (*DirsQuery) Count

func (dq *DirsQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*DirsQuery) CountX

func (dq *DirsQuery) CountX(ctx context.Context) int

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

func (*DirsQuery) Exist

func (dq *DirsQuery) Exist(ctx context.Context) (bool, error)

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

func (*DirsQuery) ExistX

func (dq *DirsQuery) ExistX(ctx context.Context) bool

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

func (*DirsQuery) First

func (dq *DirsQuery) First(ctx context.Context) (*Dirs, error)

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

func (*DirsQuery) FirstID

func (dq *DirsQuery) FirstID(ctx context.Context) (id uint64, err error)

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

func (*DirsQuery) FirstIDX

func (dq *DirsQuery) FirstIDX(ctx context.Context) uint64

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

func (*DirsQuery) FirstX

func (dq *DirsQuery) FirstX(ctx context.Context) *Dirs

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

func (*DirsQuery) GroupBy

func (dq *DirsQuery) GroupBy(field string, fields ...string) *DirsGroupBy

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

client.Dirs.Query().
	GroupBy(dirs.FieldCreateTime).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*DirsQuery) IDs

func (dq *DirsQuery) IDs(ctx context.Context) (ids []uint64, err error)

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

func (*DirsQuery) IDsX

func (dq *DirsQuery) IDsX(ctx context.Context) []uint64

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

func (*DirsQuery) Limit

func (dq *DirsQuery) Limit(limit int) *DirsQuery

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

func (*DirsQuery) Offset

func (dq *DirsQuery) Offset(offset int) *DirsQuery

Offset to start from.

func (*DirsQuery) Only

func (dq *DirsQuery) Only(ctx context.Context) (*Dirs, error)

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

func (*DirsQuery) OnlyID

func (dq *DirsQuery) OnlyID(ctx context.Context) (id uint64, err error)

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

func (*DirsQuery) OnlyIDX

func (dq *DirsQuery) OnlyIDX(ctx context.Context) uint64

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

func (*DirsQuery) OnlyX

func (dq *DirsQuery) OnlyX(ctx context.Context) *Dirs

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

func (*DirsQuery) Order

func (dq *DirsQuery) Order(o ...dirs.OrderOption) *DirsQuery

Order specifies how the records should be ordered.

func (*DirsQuery) QueryOwner

func (dq *DirsQuery) QueryOwner() *UsersQuery

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

func (*DirsQuery) QueryPdir

func (dq *DirsQuery) QueryPdir() *DirsQuery

QueryPdir chains the current query on the "pdir" edge.

func (*DirsQuery) QuerySaves

func (dq *DirsQuery) QuerySaves() *SavesQuery

QuerySaves chains the current query on the "saves" edge.

func (*DirsQuery) QuerySubdir

func (dq *DirsQuery) QuerySubdir() *DirsQuery

QuerySubdir chains the current query on the "subdir" edge.

func (*DirsQuery) Select

func (dq *DirsQuery) Select(fields ...string) *DirsSelect

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 {
	CreateTime time.Time `json:"create_time,omitempty"`
}

client.Dirs.Query().
	Select(dirs.FieldCreateTime).
	Scan(ctx, &v)

func (*DirsQuery) Unique

func (dq *DirsQuery) Unique(unique bool) *DirsQuery

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

func (dq *DirsQuery) Where(ps ...predicate.Dirs) *DirsQuery

Where adds a new predicate for the DirsQuery builder.

func (*DirsQuery) WithOwner

func (dq *DirsQuery) WithOwner(opts ...func(*UsersQuery)) *DirsQuery

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

func (*DirsQuery) WithPdir

func (dq *DirsQuery) WithPdir(opts ...func(*DirsQuery)) *DirsQuery

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

func (*DirsQuery) WithSaves

func (dq *DirsQuery) WithSaves(opts ...func(*SavesQuery)) *DirsQuery

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

func (*DirsQuery) WithSubdir

func (dq *DirsQuery) WithSubdir(opts ...func(*DirsQuery)) *DirsQuery

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

type DirsSelect

type DirsSelect struct {
	*DirsQuery
	// contains filtered or unexported fields
}

DirsSelect is the builder for selecting fields of Dirs entities.

func (*DirsSelect) Aggregate

func (ds *DirsSelect) Aggregate(fns ...AggregateFunc) *DirsSelect

Aggregate adds the given aggregation functions to the selector query.

func (*DirsSelect) Bool

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

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

func (*DirsSelect) BoolX

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

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

func (*DirsSelect) Bools

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

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

func (*DirsSelect) BoolsX

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

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

func (*DirsSelect) Float64

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

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

func (*DirsSelect) Float64X

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

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

func (*DirsSelect) Float64s

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

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

func (*DirsSelect) Float64sX

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

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

func (*DirsSelect) Int

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

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

func (*DirsSelect) IntX

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

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

func (*DirsSelect) Ints

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

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

func (*DirsSelect) IntsX

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

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

func (*DirsSelect) Scan

func (ds *DirsSelect) Scan(ctx context.Context, v any) error

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

func (*DirsSelect) ScanX

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

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

func (*DirsSelect) String

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

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

func (*DirsSelect) StringX

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

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

func (*DirsSelect) Strings

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

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

func (*DirsSelect) StringsX

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

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

type DirsSlice

type DirsSlice []*Dirs

DirsSlice is a parsable slice of Dirs.

type DirsUpdate

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

DirsUpdate is the builder for updating Dirs entities.

func (*DirsUpdate) AddPdir

func (du *DirsUpdate) AddPdir(d ...*Dirs) *DirsUpdate

AddPdir adds the "pdir" edges to the Dirs entity.

func (*DirsUpdate) AddPdirIDs

func (du *DirsUpdate) AddPdirIDs(ids ...uint64) *DirsUpdate

AddPdirIDs adds the "pdir" edge to the Dirs entity by IDs.

func (*DirsUpdate) AddSafeIDs

func (du *DirsUpdate) AddSafeIDs(ids ...uint64) *DirsUpdate

AddSafeIDs adds the "saves" edge to the Saves entity by IDs.

func (*DirsUpdate) AddSaves

func (du *DirsUpdate) AddSaves(s ...*Saves) *DirsUpdate

AddSaves adds the "saves" edges to the Saves entity.

func (*DirsUpdate) AddSubdir

func (du *DirsUpdate) AddSubdir(d ...*Dirs) *DirsUpdate

AddSubdir adds the "subdir" edges to the Dirs entity.

func (*DirsUpdate) AddSubdirIDs

func (du *DirsUpdate) AddSubdirIDs(ids ...uint64) *DirsUpdate

AddSubdirIDs adds the "subdir" edge to the Dirs entity by IDs.

func (*DirsUpdate) ClearOwner

func (du *DirsUpdate) ClearOwner() *DirsUpdate

ClearOwner clears the "owner" edge to the Users entity.

func (*DirsUpdate) ClearPdir

func (du *DirsUpdate) ClearPdir() *DirsUpdate

ClearPdir clears all "pdir" edges to the Dirs entity.

func (*DirsUpdate) ClearSaves

func (du *DirsUpdate) ClearSaves() *DirsUpdate

ClearSaves clears all "saves" edges to the Saves entity.

func (*DirsUpdate) ClearSubdir

func (du *DirsUpdate) ClearSubdir() *DirsUpdate

ClearSubdir clears all "subdir" edges to the Dirs entity.

func (*DirsUpdate) Exec

func (du *DirsUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*DirsUpdate) ExecX

func (du *DirsUpdate) ExecX(ctx context.Context)

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

func (*DirsUpdate) Mutation

func (du *DirsUpdate) Mutation() *DirsMutation

Mutation returns the DirsMutation object of the builder.

func (*DirsUpdate) RemovePdir

func (du *DirsUpdate) RemovePdir(d ...*Dirs) *DirsUpdate

RemovePdir removes "pdir" edges to Dirs entities.

func (*DirsUpdate) RemovePdirIDs

func (du *DirsUpdate) RemovePdirIDs(ids ...uint64) *DirsUpdate

RemovePdirIDs removes the "pdir" edge to Dirs entities by IDs.

func (*DirsUpdate) RemoveSafeIDs

func (du *DirsUpdate) RemoveSafeIDs(ids ...uint64) *DirsUpdate

RemoveSafeIDs removes the "saves" edge to Saves entities by IDs.

func (*DirsUpdate) RemoveSaves

func (du *DirsUpdate) RemoveSaves(s ...*Saves) *DirsUpdate

RemoveSaves removes "saves" edges to Saves entities.

func (*DirsUpdate) RemoveSubdir

func (du *DirsUpdate) RemoveSubdir(d ...*Dirs) *DirsUpdate

RemoveSubdir removes "subdir" edges to Dirs entities.

func (*DirsUpdate) RemoveSubdirIDs

func (du *DirsUpdate) RemoveSubdirIDs(ids ...uint64) *DirsUpdate

RemoveSubdirIDs removes the "subdir" edge to Dirs entities by IDs.

func (*DirsUpdate) Save

func (du *DirsUpdate) Save(ctx context.Context) (int, error)

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

func (*DirsUpdate) SaveX

func (du *DirsUpdate) SaveX(ctx context.Context) int

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

func (*DirsUpdate) SetName

func (du *DirsUpdate) SetName(s string) *DirsUpdate

SetName sets the "name" field.

func (*DirsUpdate) SetNillableName

func (du *DirsUpdate) SetNillableName(s *string) *DirsUpdate

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

func (*DirsUpdate) SetNillableOwnerID

func (du *DirsUpdate) SetNillableOwnerID(id *uint64) *DirsUpdate

SetNillableOwnerID sets the "owner" edge to the Users entity by ID if the given value is not nil.

func (*DirsUpdate) SetOwner

func (du *DirsUpdate) SetOwner(u *Users) *DirsUpdate

SetOwner sets the "owner" edge to the Users entity.

func (*DirsUpdate) SetOwnerID

func (du *DirsUpdate) SetOwnerID(id uint64) *DirsUpdate

SetOwnerID sets the "owner" edge to the Users entity by ID.

func (*DirsUpdate) SetUpdateTime

func (du *DirsUpdate) SetUpdateTime(t time.Time) *DirsUpdate

SetUpdateTime sets the "update_time" field.

func (*DirsUpdate) Where

func (du *DirsUpdate) Where(ps ...predicate.Dirs) *DirsUpdate

Where appends a list predicates to the DirsUpdate builder.

type DirsUpdateOne

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

DirsUpdateOne is the builder for updating a single Dirs entity.

func (*DirsUpdateOne) AddPdir

func (duo *DirsUpdateOne) AddPdir(d ...*Dirs) *DirsUpdateOne

AddPdir adds the "pdir" edges to the Dirs entity.

func (*DirsUpdateOne) AddPdirIDs

func (duo *DirsUpdateOne) AddPdirIDs(ids ...uint64) *DirsUpdateOne

AddPdirIDs adds the "pdir" edge to the Dirs entity by IDs.

func (*DirsUpdateOne) AddSafeIDs

func (duo *DirsUpdateOne) AddSafeIDs(ids ...uint64) *DirsUpdateOne

AddSafeIDs adds the "saves" edge to the Saves entity by IDs.

func (*DirsUpdateOne) AddSaves

func (duo *DirsUpdateOne) AddSaves(s ...*Saves) *DirsUpdateOne

AddSaves adds the "saves" edges to the Saves entity.

func (*DirsUpdateOne) AddSubdir

func (duo *DirsUpdateOne) AddSubdir(d ...*Dirs) *DirsUpdateOne

AddSubdir adds the "subdir" edges to the Dirs entity.

func (*DirsUpdateOne) AddSubdirIDs

func (duo *DirsUpdateOne) AddSubdirIDs(ids ...uint64) *DirsUpdateOne

AddSubdirIDs adds the "subdir" edge to the Dirs entity by IDs.

func (*DirsUpdateOne) ClearOwner

func (duo *DirsUpdateOne) ClearOwner() *DirsUpdateOne

ClearOwner clears the "owner" edge to the Users entity.

func (*DirsUpdateOne) ClearPdir

func (duo *DirsUpdateOne) ClearPdir() *DirsUpdateOne

ClearPdir clears all "pdir" edges to the Dirs entity.

func (*DirsUpdateOne) ClearSaves

func (duo *DirsUpdateOne) ClearSaves() *DirsUpdateOne

ClearSaves clears all "saves" edges to the Saves entity.

func (*DirsUpdateOne) ClearSubdir

func (duo *DirsUpdateOne) ClearSubdir() *DirsUpdateOne

ClearSubdir clears all "subdir" edges to the Dirs entity.

func (*DirsUpdateOne) Exec

func (duo *DirsUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*DirsUpdateOne) ExecX

func (duo *DirsUpdateOne) ExecX(ctx context.Context)

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

func (*DirsUpdateOne) Mutation

func (duo *DirsUpdateOne) Mutation() *DirsMutation

Mutation returns the DirsMutation object of the builder.

func (*DirsUpdateOne) RemovePdir

func (duo *DirsUpdateOne) RemovePdir(d ...*Dirs) *DirsUpdateOne

RemovePdir removes "pdir" edges to Dirs entities.

func (*DirsUpdateOne) RemovePdirIDs

func (duo *DirsUpdateOne) RemovePdirIDs(ids ...uint64) *DirsUpdateOne

RemovePdirIDs removes the "pdir" edge to Dirs entities by IDs.

func (*DirsUpdateOne) RemoveSafeIDs

func (duo *DirsUpdateOne) RemoveSafeIDs(ids ...uint64) *DirsUpdateOne

RemoveSafeIDs removes the "saves" edge to Saves entities by IDs.

func (*DirsUpdateOne) RemoveSaves

func (duo *DirsUpdateOne) RemoveSaves(s ...*Saves) *DirsUpdateOne

RemoveSaves removes "saves" edges to Saves entities.

func (*DirsUpdateOne) RemoveSubdir

func (duo *DirsUpdateOne) RemoveSubdir(d ...*Dirs) *DirsUpdateOne

RemoveSubdir removes "subdir" edges to Dirs entities.

func (*DirsUpdateOne) RemoveSubdirIDs

func (duo *DirsUpdateOne) RemoveSubdirIDs(ids ...uint64) *DirsUpdateOne

RemoveSubdirIDs removes the "subdir" edge to Dirs entities by IDs.

func (*DirsUpdateOne) Save

func (duo *DirsUpdateOne) Save(ctx context.Context) (*Dirs, error)

Save executes the query and returns the updated Dirs entity.

func (*DirsUpdateOne) SaveX

func (duo *DirsUpdateOne) SaveX(ctx context.Context) *Dirs

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

func (*DirsUpdateOne) Select

func (duo *DirsUpdateOne) Select(field string, fields ...string) *DirsUpdateOne

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

func (*DirsUpdateOne) SetName

func (duo *DirsUpdateOne) SetName(s string) *DirsUpdateOne

SetName sets the "name" field.

func (*DirsUpdateOne) SetNillableName

func (duo *DirsUpdateOne) SetNillableName(s *string) *DirsUpdateOne

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

func (*DirsUpdateOne) SetNillableOwnerID

func (duo *DirsUpdateOne) SetNillableOwnerID(id *uint64) *DirsUpdateOne

SetNillableOwnerID sets the "owner" edge to the Users entity by ID if the given value is not nil.

func (*DirsUpdateOne) SetOwner

func (duo *DirsUpdateOne) SetOwner(u *Users) *DirsUpdateOne

SetOwner sets the "owner" edge to the Users entity.

func (*DirsUpdateOne) SetOwnerID

func (duo *DirsUpdateOne) SetOwnerID(id uint64) *DirsUpdateOne

SetOwnerID sets the "owner" edge to the Users entity by ID.

func (*DirsUpdateOne) SetUpdateTime

func (duo *DirsUpdateOne) SetUpdateTime(t time.Time) *DirsUpdateOne

SetUpdateTime sets the "update_time" field.

func (*DirsUpdateOne) Where

func (duo *DirsUpdateOne) Where(ps ...predicate.Dirs) *DirsUpdateOne

Where appends a list predicates to the DirsUpdate builder.

type Files

type Files struct {

	// ID of the ent.
	ID uint64 `json:"id,omitempty"`
	// ipfs hash
	Hash string `json:"hash,omitempty"`
	// file name
	Name string `json:"name,omitempty"`
	// file size, number of bytes in the stored file
	Size uint64 `json:"size,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the FilesQuery when eager-loading is set.
	Edges FilesEdges `json:"edges"`
	// contains filtered or unexported fields
}

Files is the model entity for the Files schema.

func (*Files) QuerySaves

func (f *Files) QuerySaves() *SavesQuery

QuerySaves queries the "saves" edge of the Files entity.

func (*Files) String

func (f *Files) String() string

String implements the fmt.Stringer.

func (*Files) Unwrap

func (f *Files) Unwrap() *Files

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

func (f *Files) Update() *FilesUpdateOne

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

func (*Files) Value

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

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

type FilesClient

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

FilesClient is a client for the Files schema.

func NewFilesClient

func NewFilesClient(c config) *FilesClient

NewFilesClient returns a client for the Files from the given config.

func (*FilesClient) Create

func (c *FilesClient) Create() *FilesCreate

Create returns a builder for creating a Files entity.

func (*FilesClient) CreateBulk

func (c *FilesClient) CreateBulk(builders ...*FilesCreate) *FilesCreateBulk

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

func (*FilesClient) Delete

func (c *FilesClient) Delete() *FilesDelete

Delete returns a delete builder for Files.

func (*FilesClient) DeleteOne

func (c *FilesClient) DeleteOne(f *Files) *FilesDeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*FilesClient) DeleteOneID

func (c *FilesClient) DeleteOneID(id uint64) *FilesDeleteOne

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

func (*FilesClient) Get

func (c *FilesClient) Get(ctx context.Context, id uint64) (*Files, error)

Get returns a Files entity by its id.

func (*FilesClient) GetX

func (c *FilesClient) GetX(ctx context.Context, id uint64) *Files

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

func (*FilesClient) Hooks

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

Hooks returns the client hooks.

func (*FilesClient) Intercept

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

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

func (*FilesClient) Interceptors

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

Interceptors returns the client interceptors.

func (*FilesClient) MapCreateBulk

func (c *FilesClient) MapCreateBulk(slice any, setFunc func(*FilesCreate, int)) *FilesCreateBulk

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

func (c *FilesClient) Query() *FilesQuery

Query returns a query builder for Files.

func (*FilesClient) QuerySaves

func (c *FilesClient) QuerySaves(f *Files) *SavesQuery

QuerySaves queries the saves edge of a Files.

func (*FilesClient) Update

func (c *FilesClient) Update() *FilesUpdate

Update returns an update builder for Files.

func (*FilesClient) UpdateOne

func (c *FilesClient) UpdateOne(f *Files) *FilesUpdateOne

UpdateOne returns an update builder for the given entity.

func (*FilesClient) UpdateOneID

func (c *FilesClient) UpdateOneID(id uint64) *FilesUpdateOne

UpdateOneID returns an update builder for the given id.

func (*FilesClient) Use

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

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

type FilesCreate

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

FilesCreate is the builder for creating a Files entity.

func (*FilesCreate) AddSafeIDs

func (fc *FilesCreate) AddSafeIDs(ids ...uint64) *FilesCreate

AddSafeIDs adds the "saves" edge to the Saves entity by IDs.

func (*FilesCreate) AddSaves

func (fc *FilesCreate) AddSaves(s ...*Saves) *FilesCreate

AddSaves adds the "saves" edges to the Saves entity.

func (*FilesCreate) Exec

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

Exec executes the query.

func (*FilesCreate) ExecX

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

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

func (*FilesCreate) Mutation

func (fc *FilesCreate) Mutation() *FilesMutation

Mutation returns the FilesMutation object of the builder.

func (*FilesCreate) Save

func (fc *FilesCreate) Save(ctx context.Context) (*Files, error)

Save creates the Files in the database.

func (*FilesCreate) SaveX

func (fc *FilesCreate) SaveX(ctx context.Context) *Files

SaveX calls Save and panics if Save returns an error.

func (*FilesCreate) SetHash

func (fc *FilesCreate) SetHash(s string) *FilesCreate

SetHash sets the "hash" field.

func (*FilesCreate) SetID

func (fc *FilesCreate) SetID(u uint64) *FilesCreate

SetID sets the "id" field.

func (*FilesCreate) SetName

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

SetName sets the "name" field.

func (*FilesCreate) SetSize

func (fc *FilesCreate) SetSize(u uint64) *FilesCreate

SetSize sets the "size" field.

type FilesCreateBulk

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

FilesCreateBulk is the builder for creating many Files entities in bulk.

func (*FilesCreateBulk) Exec

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

Exec executes the query.

func (*FilesCreateBulk) ExecX

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

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

func (*FilesCreateBulk) Save

func (fcb *FilesCreateBulk) Save(ctx context.Context) ([]*Files, error)

Save creates the Files entities in the database.

func (*FilesCreateBulk) SaveX

func (fcb *FilesCreateBulk) SaveX(ctx context.Context) []*Files

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

type FilesDelete

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

FilesDelete is the builder for deleting a Files entity.

func (*FilesDelete) Exec

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

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

func (*FilesDelete) ExecX

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

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

func (*FilesDelete) Where

func (fd *FilesDelete) Where(ps ...predicate.Files) *FilesDelete

Where appends a list predicates to the FilesDelete builder.

type FilesDeleteOne

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

FilesDeleteOne is the builder for deleting a single Files entity.

func (*FilesDeleteOne) Exec

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

Exec executes the deletion query.

func (*FilesDeleteOne) ExecX

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

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

func (*FilesDeleteOne) Where

func (fdo *FilesDeleteOne) Where(ps ...predicate.Files) *FilesDeleteOne

Where appends a list predicates to the FilesDelete builder.

type FilesEdges

type FilesEdges struct {
	// Saves holds the value of the saves edge.
	Saves []*Saves `json:"saves,omitempty"`
	// contains filtered or unexported fields
}

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

func (FilesEdges) SavesOrErr

func (e FilesEdges) SavesOrErr() ([]*Saves, error)

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

type FilesGroupBy

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

FilesGroupBy is the group-by builder for Files entities.

func (*FilesGroupBy) Aggregate

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

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

func (*FilesGroupBy) Bool

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

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

func (*FilesGroupBy) BoolX

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

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

func (*FilesGroupBy) Bools

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

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

func (*FilesGroupBy) BoolsX

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

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

func (*FilesGroupBy) Float64

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

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

func (*FilesGroupBy) Float64X

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

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

func (*FilesGroupBy) Float64s

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

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

func (*FilesGroupBy) Float64sX

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

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

func (*FilesGroupBy) Int

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

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

func (*FilesGroupBy) IntX

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

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

func (*FilesGroupBy) Ints

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

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

func (*FilesGroupBy) IntsX

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

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

func (*FilesGroupBy) Scan

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

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

func (*FilesGroupBy) ScanX

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

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

func (*FilesGroupBy) String

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

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

func (*FilesGroupBy) StringX

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

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

func (*FilesGroupBy) Strings

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

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

func (*FilesGroupBy) StringsX

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

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

type FilesMutation

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

FilesMutation represents an operation that mutates the Files nodes in the graph.

func (*FilesMutation) AddField

func (m *FilesMutation) 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 (*FilesMutation) AddSafeIDs

func (m *FilesMutation) AddSafeIDs(ids ...uint64)

AddSafeIDs adds the "saves" edge to the Saves entity by ids.

func (*FilesMutation) AddSize

func (m *FilesMutation) AddSize(u int64)

AddSize adds u to the "size" field.

func (*FilesMutation) AddedEdges

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

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

func (*FilesMutation) AddedField

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

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

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

func (*FilesMutation) AddedIDs

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

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

func (*FilesMutation) AddedSize

func (m *FilesMutation) AddedSize() (r int64, exists bool)

AddedSize returns the value that was added to the "size" field in this mutation.

func (*FilesMutation) ClearEdge

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

func (m *FilesMutation) 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 (*FilesMutation) ClearSaves

func (m *FilesMutation) ClearSaves()

ClearSaves clears the "saves" edge to the Saves entity.

func (*FilesMutation) ClearedEdges

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

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

func (*FilesMutation) ClearedFields

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

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

func (FilesMutation) Client

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

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

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

func (*FilesMutation) Field

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

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

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

func (*FilesMutation) Fields

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

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

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

func (*FilesMutation) ID

func (m *FilesMutation) ID() (id uint64, 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 (*FilesMutation) IDs

func (m *FilesMutation) IDs(ctx context.Context) ([]uint64, 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 (*FilesMutation) Name

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

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

func (*FilesMutation) OldField

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

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

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

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

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

func (m *FilesMutation) OldSize(ctx context.Context) (v uint64, err error)

OldSize returns the old "size" field's value of the Files entity. If the Files 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 (*FilesMutation) Op

func (m *FilesMutation) Op() Op

Op returns the operation name.

func (*FilesMutation) RemoveSafeIDs

func (m *FilesMutation) RemoveSafeIDs(ids ...uint64)

RemoveSafeIDs removes the "saves" edge to the Saves entity by IDs.

func (*FilesMutation) RemovedEdges

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

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

func (*FilesMutation) RemovedIDs

func (m *FilesMutation) 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 (*FilesMutation) RemovedSavesIDs

func (m *FilesMutation) RemovedSavesIDs() (ids []uint64)

RemovedSaves returns the removed IDs of the "saves" edge to the Saves entity.

func (*FilesMutation) ResetEdge

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

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

func (m *FilesMutation) ResetHash()

ResetHash resets all changes to the "hash" field.

func (*FilesMutation) ResetName

func (m *FilesMutation) ResetName()

ResetName resets all changes to the "name" field.

func (*FilesMutation) ResetSaves

func (m *FilesMutation) ResetSaves()

ResetSaves resets all changes to the "saves" edge.

func (*FilesMutation) ResetSize

func (m *FilesMutation) ResetSize()

ResetSize resets all changes to the "size" field.

func (*FilesMutation) SavesCleared

func (m *FilesMutation) SavesCleared() bool

SavesCleared reports if the "saves" edge to the Saves entity was cleared.

func (*FilesMutation) SavesIDs

func (m *FilesMutation) SavesIDs() (ids []uint64)

SavesIDs returns the "saves" edge IDs in the mutation.

func (*FilesMutation) SetField

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

func (m *FilesMutation) SetHash(s string)

SetHash sets the "hash" field.

func (*FilesMutation) SetID

func (m *FilesMutation) SetID(id uint64)

SetID sets the value of the id field. Note that this operation is only accepted on creation of Files entities.

func (*FilesMutation) SetName

func (m *FilesMutation) SetName(s string)

SetName sets the "name" field.

func (*FilesMutation) SetOp

func (m *FilesMutation) SetOp(op Op)

SetOp allows setting the mutation operation.

func (*FilesMutation) SetSize

func (m *FilesMutation) SetSize(u uint64)

SetSize sets the "size" field.

func (*FilesMutation) Size

func (m *FilesMutation) Size() (r uint64, exists bool)

Size returns the value of the "size" field in the mutation.

func (FilesMutation) Tx

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

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

func (*FilesMutation) Type

func (m *FilesMutation) Type() string

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

func (*FilesMutation) Where

func (m *FilesMutation) Where(ps ...predicate.Files)

Where appends a list predicates to the FilesMutation builder.

func (*FilesMutation) WhereP

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

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

type FilesQuery

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

FilesQuery is the builder for querying Files entities.

func (*FilesQuery) Aggregate

func (fq *FilesQuery) Aggregate(fns ...AggregateFunc) *FilesSelect

Aggregate returns a FilesSelect configured with the given aggregations.

func (*FilesQuery) All

func (fq *FilesQuery) All(ctx context.Context) ([]*Files, error)

All executes the query and returns a list of FilesSlice.

func (*FilesQuery) AllX

func (fq *FilesQuery) AllX(ctx context.Context) []*Files

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

func (*FilesQuery) Clone

func (fq *FilesQuery) Clone() *FilesQuery

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

func (*FilesQuery) Count

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

Count returns the count of the given query.

func (*FilesQuery) CountX

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

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

func (*FilesQuery) Exist

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

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

func (*FilesQuery) ExistX

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

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

func (*FilesQuery) First

func (fq *FilesQuery) First(ctx context.Context) (*Files, error)

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

func (*FilesQuery) FirstID

func (fq *FilesQuery) FirstID(ctx context.Context) (id uint64, err error)

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

func (*FilesQuery) FirstIDX

func (fq *FilesQuery) FirstIDX(ctx context.Context) uint64

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

func (*FilesQuery) FirstX

func (fq *FilesQuery) FirstX(ctx context.Context) *Files

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

func (*FilesQuery) GroupBy

func (fq *FilesQuery) GroupBy(field string, fields ...string) *FilesGroupBy

GroupBy is used to group vertices by one or more fields/columns. It is often used with aggregate functions, like: count, max, mean, min, sum.

Example:

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

client.Files.Query().
	GroupBy(files.FieldHash).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*FilesQuery) IDs

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

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

func (*FilesQuery) IDsX

func (fq *FilesQuery) IDsX(ctx context.Context) []uint64

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

func (*FilesQuery) Limit

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

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

func (*FilesQuery) Offset

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

Offset to start from.

func (*FilesQuery) Only

func (fq *FilesQuery) Only(ctx context.Context) (*Files, error)

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

func (*FilesQuery) OnlyID

func (fq *FilesQuery) OnlyID(ctx context.Context) (id uint64, err error)

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

func (*FilesQuery) OnlyIDX

func (fq *FilesQuery) OnlyIDX(ctx context.Context) uint64

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

func (*FilesQuery) OnlyX

func (fq *FilesQuery) OnlyX(ctx context.Context) *Files

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

func (*FilesQuery) Order

func (fq *FilesQuery) Order(o ...files.OrderOption) *FilesQuery

Order specifies how the records should be ordered.

func (*FilesQuery) QuerySaves

func (fq *FilesQuery) QuerySaves() *SavesQuery

QuerySaves chains the current query on the "saves" edge.

func (*FilesQuery) Select

func (fq *FilesQuery) Select(fields ...string) *FilesSelect

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

Example:

var v []struct {
	Hash string `json:"hash,omitempty"`
}

client.Files.Query().
	Select(files.FieldHash).
	Scan(ctx, &v)

func (*FilesQuery) Unique

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

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

func (fq *FilesQuery) Where(ps ...predicate.Files) *FilesQuery

Where adds a new predicate for the FilesQuery builder.

func (*FilesQuery) WithSaves

func (fq *FilesQuery) WithSaves(opts ...func(*SavesQuery)) *FilesQuery

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

type FilesSelect

type FilesSelect struct {
	*FilesQuery
	// contains filtered or unexported fields
}

FilesSelect is the builder for selecting fields of Files entities.

func (*FilesSelect) Aggregate

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

Aggregate adds the given aggregation functions to the selector query.

func (*FilesSelect) Bool

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

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

func (*FilesSelect) BoolX

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

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

func (*FilesSelect) Bools

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

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

func (*FilesSelect) BoolsX

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

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

func (*FilesSelect) Float64

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

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

func (*FilesSelect) Float64X

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

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

func (*FilesSelect) Float64s

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

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

func (*FilesSelect) Float64sX

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

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

func (*FilesSelect) Int

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

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

func (*FilesSelect) IntX

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

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

func (*FilesSelect) Ints

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

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

func (*FilesSelect) IntsX

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

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

func (*FilesSelect) Scan

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

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

func (*FilesSelect) ScanX

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

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

func (*FilesSelect) String

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

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

func (*FilesSelect) StringX

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

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

func (*FilesSelect) Strings

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

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

func (*FilesSelect) StringsX

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

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

type FilesSlice

type FilesSlice []*Files

FilesSlice is a parsable slice of Files.

type FilesUpdate

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

FilesUpdate is the builder for updating Files entities.

func (*FilesUpdate) AddSafeIDs

func (fu *FilesUpdate) AddSafeIDs(ids ...uint64) *FilesUpdate

AddSafeIDs adds the "saves" edge to the Saves entity by IDs.

func (*FilesUpdate) AddSaves

func (fu *FilesUpdate) AddSaves(s ...*Saves) *FilesUpdate

AddSaves adds the "saves" edges to the Saves entity.

func (*FilesUpdate) AddSize

func (fu *FilesUpdate) AddSize(u int64) *FilesUpdate

AddSize adds u to the "size" field.

func (*FilesUpdate) ClearSaves

func (fu *FilesUpdate) ClearSaves() *FilesUpdate

ClearSaves clears all "saves" edges to the Saves entity.

func (*FilesUpdate) Exec

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

Exec executes the query.

func (*FilesUpdate) ExecX

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

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

func (*FilesUpdate) Mutation

func (fu *FilesUpdate) Mutation() *FilesMutation

Mutation returns the FilesMutation object of the builder.

func (*FilesUpdate) RemoveSafeIDs

func (fu *FilesUpdate) RemoveSafeIDs(ids ...uint64) *FilesUpdate

RemoveSafeIDs removes the "saves" edge to Saves entities by IDs.

func (*FilesUpdate) RemoveSaves

func (fu *FilesUpdate) RemoveSaves(s ...*Saves) *FilesUpdate

RemoveSaves removes "saves" edges to Saves entities.

func (*FilesUpdate) Save

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

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

func (*FilesUpdate) SaveX

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

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

func (*FilesUpdate) SetHash

func (fu *FilesUpdate) SetHash(s string) *FilesUpdate

SetHash sets the "hash" field.

func (*FilesUpdate) SetName

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

SetName sets the "name" field.

func (*FilesUpdate) SetNillableHash

func (fu *FilesUpdate) SetNillableHash(s *string) *FilesUpdate

SetNillableHash sets the "hash" field if the given value is not nil.

func (*FilesUpdate) SetNillableName

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

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

func (*FilesUpdate) SetNillableSize

func (fu *FilesUpdate) SetNillableSize(u *uint64) *FilesUpdate

SetNillableSize sets the "size" field if the given value is not nil.

func (*FilesUpdate) SetSize

func (fu *FilesUpdate) SetSize(u uint64) *FilesUpdate

SetSize sets the "size" field.

func (*FilesUpdate) Where

func (fu *FilesUpdate) Where(ps ...predicate.Files) *FilesUpdate

Where appends a list predicates to the FilesUpdate builder.

type FilesUpdateOne

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

FilesUpdateOne is the builder for updating a single Files entity.

func (*FilesUpdateOne) AddSafeIDs

func (fuo *FilesUpdateOne) AddSafeIDs(ids ...uint64) *FilesUpdateOne

AddSafeIDs adds the "saves" edge to the Saves entity by IDs.

func (*FilesUpdateOne) AddSaves

func (fuo *FilesUpdateOne) AddSaves(s ...*Saves) *FilesUpdateOne

AddSaves adds the "saves" edges to the Saves entity.

func (*FilesUpdateOne) AddSize

func (fuo *FilesUpdateOne) AddSize(u int64) *FilesUpdateOne

AddSize adds u to the "size" field.

func (*FilesUpdateOne) ClearSaves

func (fuo *FilesUpdateOne) ClearSaves() *FilesUpdateOne

ClearSaves clears all "saves" edges to the Saves entity.

func (*FilesUpdateOne) Exec

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

Exec executes the query on the entity.

func (*FilesUpdateOne) ExecX

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

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

func (*FilesUpdateOne) Mutation

func (fuo *FilesUpdateOne) Mutation() *FilesMutation

Mutation returns the FilesMutation object of the builder.

func (*FilesUpdateOne) RemoveSafeIDs

func (fuo *FilesUpdateOne) RemoveSafeIDs(ids ...uint64) *FilesUpdateOne

RemoveSafeIDs removes the "saves" edge to Saves entities by IDs.

func (*FilesUpdateOne) RemoveSaves

func (fuo *FilesUpdateOne) RemoveSaves(s ...*Saves) *FilesUpdateOne

RemoveSaves removes "saves" edges to Saves entities.

func (*FilesUpdateOne) Save

func (fuo *FilesUpdateOne) Save(ctx context.Context) (*Files, error)

Save executes the query and returns the updated Files entity.

func (*FilesUpdateOne) SaveX

func (fuo *FilesUpdateOne) SaveX(ctx context.Context) *Files

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

func (*FilesUpdateOne) Select

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

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

func (*FilesUpdateOne) SetHash

func (fuo *FilesUpdateOne) SetHash(s string) *FilesUpdateOne

SetHash sets the "hash" field.

func (*FilesUpdateOne) SetName

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

SetName sets the "name" field.

func (*FilesUpdateOne) SetNillableHash

func (fuo *FilesUpdateOne) SetNillableHash(s *string) *FilesUpdateOne

SetNillableHash sets the "hash" field if the given value is not nil.

func (*FilesUpdateOne) SetNillableName

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

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

func (*FilesUpdateOne) SetNillableSize

func (fuo *FilesUpdateOne) SetNillableSize(u *uint64) *FilesUpdateOne

SetNillableSize sets the "size" field if the given value is not nil.

func (*FilesUpdateOne) SetSize

func (fuo *FilesUpdateOne) SetSize(u uint64) *FilesUpdateOne

SetSize sets the "size" field.

func (*FilesUpdateOne) Where

func (fuo *FilesUpdateOne) Where(ps ...predicate.Files) *FilesUpdateOne

Where appends a list predicates to the FilesUpdate builder.

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 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 Saves

type Saves struct {

	// ID of the ent.
	ID uint64 `json:"id,omitempty"`
	// CreateTime holds the value of the "create_time" field.
	CreateTime time.Time `json:"create_time,omitempty"`
	// UpdateTime holds the value of the "update_time" field.
	UpdateTime time.Time `json:"update_time,omitempty"`
	// Name holds the value of the "name" field.
	Name string `json:"name,omitempty"`
	// the descriptive text or title of a document, image, or other media element. It is used to provide a short description of the content, characteristics or context of a document.
	Caption string `json:"caption,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the SavesQuery when eager-loading is set.
	Edges SavesEdges `json:"edges"`
	// contains filtered or unexported fields
}

Saves is the model entity for the Saves schema.

func (*Saves) QueryDir

func (s *Saves) QueryDir() *DirsQuery

QueryDir queries the "dir" edge of the Saves entity.

func (*Saves) QueryFile

func (s *Saves) QueryFile() *FilesQuery

QueryFile queries the "file" edge of the Saves entity.

func (*Saves) QueryOwner

func (s *Saves) QueryOwner() *UsersQuery

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

func (*Saves) String

func (s *Saves) String() string

String implements the fmt.Stringer.

func (*Saves) Unwrap

func (s *Saves) Unwrap() *Saves

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

func (s *Saves) Update() *SavesUpdateOne

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

func (*Saves) Value

func (s *Saves) Value(name string) (ent.Value, error)

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

type SavesClient

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

SavesClient is a client for the Saves schema.

func NewSavesClient

func NewSavesClient(c config) *SavesClient

NewSavesClient returns a client for the Saves from the given config.

func (*SavesClient) Create

func (c *SavesClient) Create() *SavesCreate

Create returns a builder for creating a Saves entity.

func (*SavesClient) CreateBulk

func (c *SavesClient) CreateBulk(builders ...*SavesCreate) *SavesCreateBulk

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

func (*SavesClient) Delete

func (c *SavesClient) Delete() *SavesDelete

Delete returns a delete builder for Saves.

func (*SavesClient) DeleteOne

func (c *SavesClient) DeleteOne(s *Saves) *SavesDeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*SavesClient) DeleteOneID

func (c *SavesClient) DeleteOneID(id uint64) *SavesDeleteOne

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

func (*SavesClient) Get

func (c *SavesClient) Get(ctx context.Context, id uint64) (*Saves, error)

Get returns a Saves entity by its id.

func (*SavesClient) GetX

func (c *SavesClient) GetX(ctx context.Context, id uint64) *Saves

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

func (*SavesClient) Hooks

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

Hooks returns the client hooks.

func (*SavesClient) Intercept

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

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

func (*SavesClient) Interceptors

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

Interceptors returns the client interceptors.

func (*SavesClient) MapCreateBulk

func (c *SavesClient) MapCreateBulk(slice any, setFunc func(*SavesCreate, int)) *SavesCreateBulk

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

func (c *SavesClient) Query() *SavesQuery

Query returns a query builder for Saves.

func (*SavesClient) QueryDir

func (c *SavesClient) QueryDir(s *Saves) *DirsQuery

QueryDir queries the dir edge of a Saves.

func (*SavesClient) QueryFile

func (c *SavesClient) QueryFile(s *Saves) *FilesQuery

QueryFile queries the file edge of a Saves.

func (*SavesClient) QueryOwner

func (c *SavesClient) QueryOwner(s *Saves) *UsersQuery

QueryOwner queries the owner edge of a Saves.

func (*SavesClient) Update

func (c *SavesClient) Update() *SavesUpdate

Update returns an update builder for Saves.

func (*SavesClient) UpdateOne

func (c *SavesClient) UpdateOne(s *Saves) *SavesUpdateOne

UpdateOne returns an update builder for the given entity.

func (*SavesClient) UpdateOneID

func (c *SavesClient) UpdateOneID(id uint64) *SavesUpdateOne

UpdateOneID returns an update builder for the given id.

func (*SavesClient) Use

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

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

type SavesCreate

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

SavesCreate is the builder for creating a Saves entity.

func (*SavesCreate) AddDir

func (sc *SavesCreate) AddDir(d ...*Dirs) *SavesCreate

AddDir adds the "dir" edges to the Dirs entity.

func (*SavesCreate) AddDirIDs

func (sc *SavesCreate) AddDirIDs(ids ...uint64) *SavesCreate

AddDirIDs adds the "dir" edge to the Dirs entity by IDs.

func (*SavesCreate) Exec

func (sc *SavesCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*SavesCreate) ExecX

func (sc *SavesCreate) ExecX(ctx context.Context)

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

func (*SavesCreate) Mutation

func (sc *SavesCreate) Mutation() *SavesMutation

Mutation returns the SavesMutation object of the builder.

func (*SavesCreate) Save

func (sc *SavesCreate) Save(ctx context.Context) (*Saves, error)

Save creates the Saves in the database.

func (*SavesCreate) SaveX

func (sc *SavesCreate) SaveX(ctx context.Context) *Saves

SaveX calls Save and panics if Save returns an error.

func (*SavesCreate) SetCaption

func (sc *SavesCreate) SetCaption(s string) *SavesCreate

SetCaption sets the "caption" field.

func (*SavesCreate) SetCreateTime

func (sc *SavesCreate) SetCreateTime(t time.Time) *SavesCreate

SetCreateTime sets the "create_time" field.

func (*SavesCreate) SetFile

func (sc *SavesCreate) SetFile(f *Files) *SavesCreate

SetFile sets the "file" edge to the Files entity.

func (*SavesCreate) SetFileID

func (sc *SavesCreate) SetFileID(id uint64) *SavesCreate

SetFileID sets the "file" edge to the Files entity by ID.

func (*SavesCreate) SetID

func (sc *SavesCreate) SetID(u uint64) *SavesCreate

SetID sets the "id" field.

func (*SavesCreate) SetName

func (sc *SavesCreate) SetName(s string) *SavesCreate

SetName sets the "name" field.

func (*SavesCreate) SetNillableCaption

func (sc *SavesCreate) SetNillableCaption(s *string) *SavesCreate

SetNillableCaption sets the "caption" field if the given value is not nil.

func (*SavesCreate) SetNillableCreateTime

func (sc *SavesCreate) SetNillableCreateTime(t *time.Time) *SavesCreate

SetNillableCreateTime sets the "create_time" field if the given value is not nil.

func (*SavesCreate) SetNillableFileID

func (sc *SavesCreate) SetNillableFileID(id *uint64) *SavesCreate

SetNillableFileID sets the "file" edge to the Files entity by ID if the given value is not nil.

func (*SavesCreate) SetNillableOwnerID

func (sc *SavesCreate) SetNillableOwnerID(id *uint64) *SavesCreate

SetNillableOwnerID sets the "owner" edge to the Users entity by ID if the given value is not nil.

func (*SavesCreate) SetNillableUpdateTime

func (sc *SavesCreate) SetNillableUpdateTime(t *time.Time) *SavesCreate

SetNillableUpdateTime sets the "update_time" field if the given value is not nil.

func (*SavesCreate) SetOwner

func (sc *SavesCreate) SetOwner(u *Users) *SavesCreate

SetOwner sets the "owner" edge to the Users entity.

func (*SavesCreate) SetOwnerID

func (sc *SavesCreate) SetOwnerID(id uint64) *SavesCreate

SetOwnerID sets the "owner" edge to the Users entity by ID.

func (*SavesCreate) SetUpdateTime

func (sc *SavesCreate) SetUpdateTime(t time.Time) *SavesCreate

SetUpdateTime sets the "update_time" field.

type SavesCreateBulk

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

SavesCreateBulk is the builder for creating many Saves entities in bulk.

func (*SavesCreateBulk) Exec

func (scb *SavesCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*SavesCreateBulk) ExecX

func (scb *SavesCreateBulk) ExecX(ctx context.Context)

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

func (*SavesCreateBulk) Save

func (scb *SavesCreateBulk) Save(ctx context.Context) ([]*Saves, error)

Save creates the Saves entities in the database.

func (*SavesCreateBulk) SaveX

func (scb *SavesCreateBulk) SaveX(ctx context.Context) []*Saves

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

type SavesDelete

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

SavesDelete is the builder for deleting a Saves entity.

func (*SavesDelete) Exec

func (sd *SavesDelete) Exec(ctx context.Context) (int, error)

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

func (*SavesDelete) ExecX

func (sd *SavesDelete) ExecX(ctx context.Context) int

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

func (*SavesDelete) Where

func (sd *SavesDelete) Where(ps ...predicate.Saves) *SavesDelete

Where appends a list predicates to the SavesDelete builder.

type SavesDeleteOne

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

SavesDeleteOne is the builder for deleting a single Saves entity.

func (*SavesDeleteOne) Exec

func (sdo *SavesDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*SavesDeleteOne) ExecX

func (sdo *SavesDeleteOne) ExecX(ctx context.Context)

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

func (*SavesDeleteOne) Where

func (sdo *SavesDeleteOne) Where(ps ...predicate.Saves) *SavesDeleteOne

Where appends a list predicates to the SavesDelete builder.

type SavesEdges

type SavesEdges struct {
	// File holds the value of the file edge.
	File *Files `json:"file,omitempty"`
	// Owner holds the value of the owner edge.
	Owner *Users `json:"owner,omitempty"`
	// Dir holds the value of the dir edge.
	Dir []*Dirs `json:"dir,omitempty"`
	// contains filtered or unexported fields
}

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

func (SavesEdges) DirOrErr

func (e SavesEdges) DirOrErr() ([]*Dirs, error)

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

func (SavesEdges) FileOrErr

func (e SavesEdges) FileOrErr() (*Files, error)

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

func (SavesEdges) OwnerOrErr

func (e SavesEdges) OwnerOrErr() (*Users, error)

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

type SavesGroupBy

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

SavesGroupBy is the group-by builder for Saves entities.

func (*SavesGroupBy) Aggregate

func (sgb *SavesGroupBy) Aggregate(fns ...AggregateFunc) *SavesGroupBy

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

func (*SavesGroupBy) Bool

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

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

func (*SavesGroupBy) BoolX

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

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

func (*SavesGroupBy) Bools

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

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

func (*SavesGroupBy) BoolsX

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

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

func (*SavesGroupBy) Float64

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

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

func (*SavesGroupBy) Float64X

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

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

func (*SavesGroupBy) Float64s

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

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

func (*SavesGroupBy) Float64sX

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

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

func (*SavesGroupBy) Int

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

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

func (*SavesGroupBy) IntX

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

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

func (*SavesGroupBy) Ints

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

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

func (*SavesGroupBy) IntsX

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

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

func (*SavesGroupBy) Scan

func (sgb *SavesGroupBy) Scan(ctx context.Context, v any) error

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

func (*SavesGroupBy) ScanX

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

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

func (*SavesGroupBy) String

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

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

func (*SavesGroupBy) StringX

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

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

func (*SavesGroupBy) Strings

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

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

func (*SavesGroupBy) StringsX

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

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

type SavesMutation

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

SavesMutation represents an operation that mutates the Saves nodes in the graph.

func (*SavesMutation) AddDirIDs

func (m *SavesMutation) AddDirIDs(ids ...uint64)

AddDirIDs adds the "dir" edge to the Dirs entity by ids.

func (*SavesMutation) AddField

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

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

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

func (*SavesMutation) AddedField

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

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

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

func (*SavesMutation) AddedIDs

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

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

func (*SavesMutation) Caption

func (m *SavesMutation) Caption() (r string, exists bool)

Caption returns the value of the "caption" field in the mutation.

func (*SavesMutation) CaptionCleared

func (m *SavesMutation) CaptionCleared() bool

CaptionCleared returns if the "caption" field was cleared in this mutation.

func (*SavesMutation) ClearCaption

func (m *SavesMutation) ClearCaption()

ClearCaption clears the value of the "caption" field.

func (*SavesMutation) ClearDir

func (m *SavesMutation) ClearDir()

ClearDir clears the "dir" edge to the Dirs entity.

func (*SavesMutation) ClearEdge

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

func (m *SavesMutation) 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 (*SavesMutation) ClearFile

func (m *SavesMutation) ClearFile()

ClearFile clears the "file" edge to the Files entity.

func (*SavesMutation) ClearOwner

func (m *SavesMutation) ClearOwner()

ClearOwner clears the "owner" edge to the Users entity.

func (*SavesMutation) ClearedEdges

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

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

func (*SavesMutation) ClearedFields

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

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

func (SavesMutation) Client

func (m SavesMutation) 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 (*SavesMutation) CreateTime

func (m *SavesMutation) CreateTime() (r time.Time, exists bool)

CreateTime returns the value of the "create_time" field in the mutation.

func (*SavesMutation) DirCleared

func (m *SavesMutation) DirCleared() bool

DirCleared reports if the "dir" edge to the Dirs entity was cleared.

func (*SavesMutation) DirIDs

func (m *SavesMutation) DirIDs() (ids []uint64)

DirIDs returns the "dir" edge IDs in the mutation.

func (*SavesMutation) EdgeCleared

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

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

func (*SavesMutation) Field

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

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

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

func (*SavesMutation) Fields

func (m *SavesMutation) 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 (*SavesMutation) FileCleared

func (m *SavesMutation) FileCleared() bool

FileCleared reports if the "file" edge to the Files entity was cleared.

func (*SavesMutation) FileID

func (m *SavesMutation) FileID() (id uint64, exists bool)

FileID returns the "file" edge ID in the mutation.

func (*SavesMutation) FileIDs

func (m *SavesMutation) FileIDs() (ids []uint64)

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

func (*SavesMutation) ID

func (m *SavesMutation) ID() (id uint64, 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 (*SavesMutation) IDs

func (m *SavesMutation) IDs(ctx context.Context) ([]uint64, 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 (*SavesMutation) Name

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

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

func (*SavesMutation) OldCaption

func (m *SavesMutation) OldCaption(ctx context.Context) (v string, err error)

OldCaption returns the old "caption" field's value of the Saves entity. If the Saves 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 (*SavesMutation) OldCreateTime

func (m *SavesMutation) OldCreateTime(ctx context.Context) (v time.Time, err error)

OldCreateTime returns the old "create_time" field's value of the Saves entity. If the Saves 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 (*SavesMutation) OldField

func (m *SavesMutation) 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 (*SavesMutation) OldName

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

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

func (m *SavesMutation) OldUpdateTime(ctx context.Context) (v time.Time, err error)

OldUpdateTime returns the old "update_time" field's value of the Saves entity. If the Saves 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 (*SavesMutation) Op

func (m *SavesMutation) Op() Op

Op returns the operation name.

func (*SavesMutation) OwnerCleared

func (m *SavesMutation) OwnerCleared() bool

OwnerCleared reports if the "owner" edge to the Users entity was cleared.

func (*SavesMutation) OwnerID

func (m *SavesMutation) OwnerID() (id uint64, exists bool)

OwnerID returns the "owner" edge ID in the mutation.

func (*SavesMutation) OwnerIDs

func (m *SavesMutation) OwnerIDs() (ids []uint64)

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

func (*SavesMutation) RemoveDirIDs

func (m *SavesMutation) RemoveDirIDs(ids ...uint64)

RemoveDirIDs removes the "dir" edge to the Dirs entity by IDs.

func (*SavesMutation) RemovedDirIDs

func (m *SavesMutation) RemovedDirIDs() (ids []uint64)

RemovedDir returns the removed IDs of the "dir" edge to the Dirs entity.

func (*SavesMutation) RemovedEdges

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

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

func (*SavesMutation) RemovedIDs

func (m *SavesMutation) 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 (*SavesMutation) ResetCaption

func (m *SavesMutation) ResetCaption()

ResetCaption resets all changes to the "caption" field.

func (*SavesMutation) ResetCreateTime

func (m *SavesMutation) ResetCreateTime()

ResetCreateTime resets all changes to the "create_time" field.

func (*SavesMutation) ResetDir

func (m *SavesMutation) ResetDir()

ResetDir resets all changes to the "dir" edge.

func (*SavesMutation) ResetEdge

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

func (m *SavesMutation) 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 (*SavesMutation) ResetFile

func (m *SavesMutation) ResetFile()

ResetFile resets all changes to the "file" edge.

func (*SavesMutation) ResetName

func (m *SavesMutation) ResetName()

ResetName resets all changes to the "name" field.

func (*SavesMutation) ResetOwner

func (m *SavesMutation) ResetOwner()

ResetOwner resets all changes to the "owner" edge.

func (*SavesMutation) ResetUpdateTime

func (m *SavesMutation) ResetUpdateTime()

ResetUpdateTime resets all changes to the "update_time" field.

func (*SavesMutation) SetCaption

func (m *SavesMutation) SetCaption(s string)

SetCaption sets the "caption" field.

func (*SavesMutation) SetCreateTime

func (m *SavesMutation) SetCreateTime(t time.Time)

SetCreateTime sets the "create_time" field.

func (*SavesMutation) SetField

func (m *SavesMutation) 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 (*SavesMutation) SetFileID

func (m *SavesMutation) SetFileID(id uint64)

SetFileID sets the "file" edge to the Files entity by id.

func (*SavesMutation) SetID

func (m *SavesMutation) SetID(id uint64)

SetID sets the value of the id field. Note that this operation is only accepted on creation of Saves entities.

func (*SavesMutation) SetName

func (m *SavesMutation) SetName(s string)

SetName sets the "name" field.

func (*SavesMutation) SetOp

func (m *SavesMutation) SetOp(op Op)

SetOp allows setting the mutation operation.

func (*SavesMutation) SetOwnerID

func (m *SavesMutation) SetOwnerID(id uint64)

SetOwnerID sets the "owner" edge to the Users entity by id.

func (*SavesMutation) SetUpdateTime

func (m *SavesMutation) SetUpdateTime(t time.Time)

SetUpdateTime sets the "update_time" field.

func (SavesMutation) Tx

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

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

func (*SavesMutation) Type

func (m *SavesMutation) Type() string

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

func (*SavesMutation) UpdateTime

func (m *SavesMutation) UpdateTime() (r time.Time, exists bool)

UpdateTime returns the value of the "update_time" field in the mutation.

func (*SavesMutation) Where

func (m *SavesMutation) Where(ps ...predicate.Saves)

Where appends a list predicates to the SavesMutation builder.

func (*SavesMutation) WhereP

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

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

type SavesQuery

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

SavesQuery is the builder for querying Saves entities.

func (*SavesQuery) Aggregate

func (sq *SavesQuery) Aggregate(fns ...AggregateFunc) *SavesSelect

Aggregate returns a SavesSelect configured with the given aggregations.

func (*SavesQuery) All

func (sq *SavesQuery) All(ctx context.Context) ([]*Saves, error)

All executes the query and returns a list of SavesSlice.

func (*SavesQuery) AllX

func (sq *SavesQuery) AllX(ctx context.Context) []*Saves

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

func (*SavesQuery) Clone

func (sq *SavesQuery) Clone() *SavesQuery

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

func (*SavesQuery) Count

func (sq *SavesQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*SavesQuery) CountX

func (sq *SavesQuery) CountX(ctx context.Context) int

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

func (*SavesQuery) Exist

func (sq *SavesQuery) Exist(ctx context.Context) (bool, error)

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

func (*SavesQuery) ExistX

func (sq *SavesQuery) ExistX(ctx context.Context) bool

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

func (*SavesQuery) First

func (sq *SavesQuery) First(ctx context.Context) (*Saves, error)

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

func (*SavesQuery) FirstID

func (sq *SavesQuery) FirstID(ctx context.Context) (id uint64, err error)

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

func (*SavesQuery) FirstIDX

func (sq *SavesQuery) FirstIDX(ctx context.Context) uint64

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

func (*SavesQuery) FirstX

func (sq *SavesQuery) FirstX(ctx context.Context) *Saves

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

func (*SavesQuery) GroupBy

func (sq *SavesQuery) GroupBy(field string, fields ...string) *SavesGroupBy

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

client.Saves.Query().
	GroupBy(saves.FieldCreateTime).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*SavesQuery) IDs

func (sq *SavesQuery) IDs(ctx context.Context) (ids []uint64, err error)

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

func (*SavesQuery) IDsX

func (sq *SavesQuery) IDsX(ctx context.Context) []uint64

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

func (*SavesQuery) Limit

func (sq *SavesQuery) Limit(limit int) *SavesQuery

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

func (*SavesQuery) Offset

func (sq *SavesQuery) Offset(offset int) *SavesQuery

Offset to start from.

func (*SavesQuery) Only

func (sq *SavesQuery) Only(ctx context.Context) (*Saves, error)

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

func (*SavesQuery) OnlyID

func (sq *SavesQuery) OnlyID(ctx context.Context) (id uint64, err error)

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

func (*SavesQuery) OnlyIDX

func (sq *SavesQuery) OnlyIDX(ctx context.Context) uint64

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

func (*SavesQuery) OnlyX

func (sq *SavesQuery) OnlyX(ctx context.Context) *Saves

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

func (*SavesQuery) Order

func (sq *SavesQuery) Order(o ...saves.OrderOption) *SavesQuery

Order specifies how the records should be ordered.

func (*SavesQuery) QueryDir

func (sq *SavesQuery) QueryDir() *DirsQuery

QueryDir chains the current query on the "dir" edge.

func (*SavesQuery) QueryFile

func (sq *SavesQuery) QueryFile() *FilesQuery

QueryFile chains the current query on the "file" edge.

func (*SavesQuery) QueryOwner

func (sq *SavesQuery) QueryOwner() *UsersQuery

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

func (*SavesQuery) Select

func (sq *SavesQuery) Select(fields ...string) *SavesSelect

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 {
	CreateTime time.Time `json:"create_time,omitempty"`
}

client.Saves.Query().
	Select(saves.FieldCreateTime).
	Scan(ctx, &v)

func (*SavesQuery) Unique

func (sq *SavesQuery) Unique(unique bool) *SavesQuery

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

func (sq *SavesQuery) Where(ps ...predicate.Saves) *SavesQuery

Where adds a new predicate for the SavesQuery builder.

func (*SavesQuery) WithDir

func (sq *SavesQuery) WithDir(opts ...func(*DirsQuery)) *SavesQuery

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

func (*SavesQuery) WithFile

func (sq *SavesQuery) WithFile(opts ...func(*FilesQuery)) *SavesQuery

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

func (*SavesQuery) WithOwner

func (sq *SavesQuery) WithOwner(opts ...func(*UsersQuery)) *SavesQuery

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

type SavesSelect

type SavesSelect struct {
	*SavesQuery
	// contains filtered or unexported fields
}

SavesSelect is the builder for selecting fields of Saves entities.

func (*SavesSelect) Aggregate

func (ss *SavesSelect) Aggregate(fns ...AggregateFunc) *SavesSelect

Aggregate adds the given aggregation functions to the selector query.

func (*SavesSelect) Bool

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

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

func (*SavesSelect) BoolX

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

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

func (*SavesSelect) Bools

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

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

func (*SavesSelect) BoolsX

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

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

func (*SavesSelect) Float64

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

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

func (*SavesSelect) Float64X

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

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

func (*SavesSelect) Float64s

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

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

func (*SavesSelect) Float64sX

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

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

func (*SavesSelect) Int

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

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

func (*SavesSelect) IntX

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

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

func (*SavesSelect) Ints

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

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

func (*SavesSelect) IntsX

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

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

func (*SavesSelect) Scan

func (ss *SavesSelect) Scan(ctx context.Context, v any) error

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

func (*SavesSelect) ScanX

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

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

func (*SavesSelect) String

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

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

func (*SavesSelect) StringX

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

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

func (*SavesSelect) Strings

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

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

func (*SavesSelect) StringsX

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

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

type SavesSlice

type SavesSlice []*Saves

SavesSlice is a parsable slice of Saves.

type SavesUpdate

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

SavesUpdate is the builder for updating Saves entities.

func (*SavesUpdate) AddDir

func (su *SavesUpdate) AddDir(d ...*Dirs) *SavesUpdate

AddDir adds the "dir" edges to the Dirs entity.

func (*SavesUpdate) AddDirIDs

func (su *SavesUpdate) AddDirIDs(ids ...uint64) *SavesUpdate

AddDirIDs adds the "dir" edge to the Dirs entity by IDs.

func (*SavesUpdate) ClearCaption

func (su *SavesUpdate) ClearCaption() *SavesUpdate

ClearCaption clears the value of the "caption" field.

func (*SavesUpdate) ClearDir

func (su *SavesUpdate) ClearDir() *SavesUpdate

ClearDir clears all "dir" edges to the Dirs entity.

func (*SavesUpdate) ClearFile

func (su *SavesUpdate) ClearFile() *SavesUpdate

ClearFile clears the "file" edge to the Files entity.

func (*SavesUpdate) ClearOwner

func (su *SavesUpdate) ClearOwner() *SavesUpdate

ClearOwner clears the "owner" edge to the Users entity.

func (*SavesUpdate) Exec

func (su *SavesUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*SavesUpdate) ExecX

func (su *SavesUpdate) ExecX(ctx context.Context)

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

func (*SavesUpdate) Mutation

func (su *SavesUpdate) Mutation() *SavesMutation

Mutation returns the SavesMutation object of the builder.

func (*SavesUpdate) RemoveDir

func (su *SavesUpdate) RemoveDir(d ...*Dirs) *SavesUpdate

RemoveDir removes "dir" edges to Dirs entities.

func (*SavesUpdate) RemoveDirIDs

func (su *SavesUpdate) RemoveDirIDs(ids ...uint64) *SavesUpdate

RemoveDirIDs removes the "dir" edge to Dirs entities by IDs.

func (*SavesUpdate) Save

func (su *SavesUpdate) Save(ctx context.Context) (int, error)

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

func (*SavesUpdate) SaveX

func (su *SavesUpdate) SaveX(ctx context.Context) int

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

func (*SavesUpdate) SetCaption

func (su *SavesUpdate) SetCaption(s string) *SavesUpdate

SetCaption sets the "caption" field.

func (*SavesUpdate) SetFile

func (su *SavesUpdate) SetFile(f *Files) *SavesUpdate

SetFile sets the "file" edge to the Files entity.

func (*SavesUpdate) SetFileID

func (su *SavesUpdate) SetFileID(id uint64) *SavesUpdate

SetFileID sets the "file" edge to the Files entity by ID.

func (*SavesUpdate) SetName

func (su *SavesUpdate) SetName(s string) *SavesUpdate

SetName sets the "name" field.

func (*SavesUpdate) SetNillableCaption

func (su *SavesUpdate) SetNillableCaption(s *string) *SavesUpdate

SetNillableCaption sets the "caption" field if the given value is not nil.

func (*SavesUpdate) SetNillableFileID

func (su *SavesUpdate) SetNillableFileID(id *uint64) *SavesUpdate

SetNillableFileID sets the "file" edge to the Files entity by ID if the given value is not nil.

func (*SavesUpdate) SetNillableName

func (su *SavesUpdate) SetNillableName(s *string) *SavesUpdate

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

func (*SavesUpdate) SetNillableOwnerID

func (su *SavesUpdate) SetNillableOwnerID(id *uint64) *SavesUpdate

SetNillableOwnerID sets the "owner" edge to the Users entity by ID if the given value is not nil.

func (*SavesUpdate) SetOwner

func (su *SavesUpdate) SetOwner(u *Users) *SavesUpdate

SetOwner sets the "owner" edge to the Users entity.

func (*SavesUpdate) SetOwnerID

func (su *SavesUpdate) SetOwnerID(id uint64) *SavesUpdate

SetOwnerID sets the "owner" edge to the Users entity by ID.

func (*SavesUpdate) SetUpdateTime

func (su *SavesUpdate) SetUpdateTime(t time.Time) *SavesUpdate

SetUpdateTime sets the "update_time" field.

func (*SavesUpdate) Where

func (su *SavesUpdate) Where(ps ...predicate.Saves) *SavesUpdate

Where appends a list predicates to the SavesUpdate builder.

type SavesUpdateOne

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

SavesUpdateOne is the builder for updating a single Saves entity.

func (*SavesUpdateOne) AddDir

func (suo *SavesUpdateOne) AddDir(d ...*Dirs) *SavesUpdateOne

AddDir adds the "dir" edges to the Dirs entity.

func (*SavesUpdateOne) AddDirIDs

func (suo *SavesUpdateOne) AddDirIDs(ids ...uint64) *SavesUpdateOne

AddDirIDs adds the "dir" edge to the Dirs entity by IDs.

func (*SavesUpdateOne) ClearCaption

func (suo *SavesUpdateOne) ClearCaption() *SavesUpdateOne

ClearCaption clears the value of the "caption" field.

func (*SavesUpdateOne) ClearDir

func (suo *SavesUpdateOne) ClearDir() *SavesUpdateOne

ClearDir clears all "dir" edges to the Dirs entity.

func (*SavesUpdateOne) ClearFile

func (suo *SavesUpdateOne) ClearFile() *SavesUpdateOne

ClearFile clears the "file" edge to the Files entity.

func (*SavesUpdateOne) ClearOwner

func (suo *SavesUpdateOne) ClearOwner() *SavesUpdateOne

ClearOwner clears the "owner" edge to the Users entity.

func (*SavesUpdateOne) Exec

func (suo *SavesUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*SavesUpdateOne) ExecX

func (suo *SavesUpdateOne) ExecX(ctx context.Context)

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

func (*SavesUpdateOne) Mutation

func (suo *SavesUpdateOne) Mutation() *SavesMutation

Mutation returns the SavesMutation object of the builder.

func (*SavesUpdateOne) RemoveDir

func (suo *SavesUpdateOne) RemoveDir(d ...*Dirs) *SavesUpdateOne

RemoveDir removes "dir" edges to Dirs entities.

func (*SavesUpdateOne) RemoveDirIDs

func (suo *SavesUpdateOne) RemoveDirIDs(ids ...uint64) *SavesUpdateOne

RemoveDirIDs removes the "dir" edge to Dirs entities by IDs.

func (*SavesUpdateOne) Save

func (suo *SavesUpdateOne) Save(ctx context.Context) (*Saves, error)

Save executes the query and returns the updated Saves entity.

func (*SavesUpdateOne) SaveX

func (suo *SavesUpdateOne) SaveX(ctx context.Context) *Saves

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

func (*SavesUpdateOne) Select

func (suo *SavesUpdateOne) Select(field string, fields ...string) *SavesUpdateOne

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

func (*SavesUpdateOne) SetCaption

func (suo *SavesUpdateOne) SetCaption(s string) *SavesUpdateOne

SetCaption sets the "caption" field.

func (*SavesUpdateOne) SetFile

func (suo *SavesUpdateOne) SetFile(f *Files) *SavesUpdateOne

SetFile sets the "file" edge to the Files entity.

func (*SavesUpdateOne) SetFileID

func (suo *SavesUpdateOne) SetFileID(id uint64) *SavesUpdateOne

SetFileID sets the "file" edge to the Files entity by ID.

func (*SavesUpdateOne) SetName

func (suo *SavesUpdateOne) SetName(s string) *SavesUpdateOne

SetName sets the "name" field.

func (*SavesUpdateOne) SetNillableCaption

func (suo *SavesUpdateOne) SetNillableCaption(s *string) *SavesUpdateOne

SetNillableCaption sets the "caption" field if the given value is not nil.

func (*SavesUpdateOne) SetNillableFileID

func (suo *SavesUpdateOne) SetNillableFileID(id *uint64) *SavesUpdateOne

SetNillableFileID sets the "file" edge to the Files entity by ID if the given value is not nil.

func (*SavesUpdateOne) SetNillableName

func (suo *SavesUpdateOne) SetNillableName(s *string) *SavesUpdateOne

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

func (*SavesUpdateOne) SetNillableOwnerID

func (suo *SavesUpdateOne) SetNillableOwnerID(id *uint64) *SavesUpdateOne

SetNillableOwnerID sets the "owner" edge to the Users entity by ID if the given value is not nil.

func (*SavesUpdateOne) SetOwner

func (suo *SavesUpdateOne) SetOwner(u *Users) *SavesUpdateOne

SetOwner sets the "owner" edge to the Users entity.

func (*SavesUpdateOne) SetOwnerID

func (suo *SavesUpdateOne) SetOwnerID(id uint64) *SavesUpdateOne

SetOwnerID sets the "owner" edge to the Users entity by ID.

func (*SavesUpdateOne) SetUpdateTime

func (suo *SavesUpdateOne) SetUpdateTime(t time.Time) *SavesUpdateOne

SetUpdateTime sets the "update_time" field.

func (*SavesUpdateOne) Where

func (suo *SavesUpdateOne) Where(ps ...predicate.Saves) *SavesUpdateOne

Where appends a list predicates to the SavesUpdate builder.

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 {

	// Devices is the client for interacting with the Devices builders.
	Devices *DevicesClient
	// Dirs is the client for interacting with the Dirs builders.
	Dirs *DirsClient
	// Files is the client for interacting with the Files builders.
	Files *FilesClient
	// Saves is the client for interacting with the Saves builders.
	Saves *SavesClient
	// Users is the client for interacting with the Users builders.
	Users *UsersClient
	// 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 Users

type Users struct {

	// ID of the ent.
	ID uint64 `json:"id,omitempty"`
	// CreateTime holds the value of the "create_time" field.
	CreateTime time.Time `json:"create_time,omitempty"`
	// UpdateTime holds the value of the "update_time" field.
	UpdateTime time.Time `json:"update_time,omitempty"`
	// Username holds the value of the "username" field.
	Username string `json:"username,omitempty"`
	// Password holds the value of the "password" field.
	Password string `json:"password,omitempty"`
	// Email holds the value of the "email" field.
	Email string `json:"email,omitempty"`
	// Name holds the value of the "name" field.
	Name string `json:"name,omitempty"`
	// Bio holds the value of the "bio" field.
	Bio string `json:"bio,omitempty"`
	// Avatar holds the value of the "avatar" field.
	Avatar string `json:"avatar,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the UsersQuery when eager-loading is set.
	Edges UsersEdges `json:"edges"`
	// contains filtered or unexported fields
}

Users is the model entity for the Users schema.

func (*Users) QueryDevices

func (u *Users) QueryDevices() *DevicesQuery

QueryDevices queries the "devices" edge of the Users entity.

func (*Users) QueryDirs

func (u *Users) QueryDirs() *DirsQuery

QueryDirs queries the "dirs" edge of the Users entity.

func (*Users) QuerySaves

func (u *Users) QuerySaves() *SavesQuery

QuerySaves queries the "saves" edge of the Users entity.

func (*Users) String

func (u *Users) String() string

String implements the fmt.Stringer.

func (*Users) Unwrap

func (u *Users) Unwrap() *Users

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

func (u *Users) Update() *UsersUpdateOne

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

func (*Users) Value

func (u *Users) Value(name string) (ent.Value, error)

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

type UsersClient

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

UsersClient is a client for the Users schema.

func NewUsersClient

func NewUsersClient(c config) *UsersClient

NewUsersClient returns a client for the Users from the given config.

func (*UsersClient) Create

func (c *UsersClient) Create() *UsersCreate

Create returns a builder for creating a Users entity.

func (*UsersClient) CreateBulk

func (c *UsersClient) CreateBulk(builders ...*UsersCreate) *UsersCreateBulk

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

func (*UsersClient) Delete

func (c *UsersClient) Delete() *UsersDelete

Delete returns a delete builder for Users.

func (*UsersClient) DeleteOne

func (c *UsersClient) DeleteOne(u *Users) *UsersDeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*UsersClient) DeleteOneID

func (c *UsersClient) DeleteOneID(id uint64) *UsersDeleteOne

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

func (*UsersClient) Get

func (c *UsersClient) Get(ctx context.Context, id uint64) (*Users, error)

Get returns a Users entity by its id.

func (*UsersClient) GetX

func (c *UsersClient) GetX(ctx context.Context, id uint64) *Users

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

func (*UsersClient) Hooks

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

Hooks returns the client hooks.

func (*UsersClient) Intercept

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

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

func (*UsersClient) Interceptors

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

Interceptors returns the client interceptors.

func (*UsersClient) MapCreateBulk

func (c *UsersClient) MapCreateBulk(slice any, setFunc func(*UsersCreate, int)) *UsersCreateBulk

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

func (c *UsersClient) Query() *UsersQuery

Query returns a query builder for Users.

func (*UsersClient) QueryDevices

func (c *UsersClient) QueryDevices(u *Users) *DevicesQuery

QueryDevices queries the devices edge of a Users.

func (*UsersClient) QueryDirs

func (c *UsersClient) QueryDirs(u *Users) *DirsQuery

QueryDirs queries the dirs edge of a Users.

func (*UsersClient) QuerySaves

func (c *UsersClient) QuerySaves(u *Users) *SavesQuery

QuerySaves queries the saves edge of a Users.

func (*UsersClient) Update

func (c *UsersClient) Update() *UsersUpdate

Update returns an update builder for Users.

func (*UsersClient) UpdateOne

func (c *UsersClient) UpdateOne(u *Users) *UsersUpdateOne

UpdateOne returns an update builder for the given entity.

func (*UsersClient) UpdateOneID

func (c *UsersClient) UpdateOneID(id uint64) *UsersUpdateOne

UpdateOneID returns an update builder for the given id.

func (*UsersClient) Use

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

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

type UsersCreate

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

UsersCreate is the builder for creating a Users entity.

func (*UsersCreate) AddDeviceIDs

func (uc *UsersCreate) AddDeviceIDs(ids ...uint64) *UsersCreate

AddDeviceIDs adds the "devices" edge to the Devices entity by IDs.

func (*UsersCreate) AddDevices

func (uc *UsersCreate) AddDevices(d ...*Devices) *UsersCreate

AddDevices adds the "devices" edges to the Devices entity.

func (*UsersCreate) AddDirIDs

func (uc *UsersCreate) AddDirIDs(ids ...uint64) *UsersCreate

AddDirIDs adds the "dirs" edge to the Dirs entity by IDs.

func (*UsersCreate) AddDirs

func (uc *UsersCreate) AddDirs(d ...*Dirs) *UsersCreate

AddDirs adds the "dirs" edges to the Dirs entity.

func (*UsersCreate) AddSafeIDs

func (uc *UsersCreate) AddSafeIDs(ids ...uint64) *UsersCreate

AddSafeIDs adds the "saves" edge to the Saves entity by IDs.

func (*UsersCreate) AddSaves

func (uc *UsersCreate) AddSaves(s ...*Saves) *UsersCreate

AddSaves adds the "saves" edges to the Saves entity.

func (*UsersCreate) Exec

func (uc *UsersCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*UsersCreate) ExecX

func (uc *UsersCreate) ExecX(ctx context.Context)

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

func (*UsersCreate) Mutation

func (uc *UsersCreate) Mutation() *UsersMutation

Mutation returns the UsersMutation object of the builder.

func (*UsersCreate) Save

func (uc *UsersCreate) Save(ctx context.Context) (*Users, error)

Save creates the Users in the database.

func (*UsersCreate) SaveX

func (uc *UsersCreate) SaveX(ctx context.Context) *Users

SaveX calls Save and panics if Save returns an error.

func (*UsersCreate) SetAvatar

func (uc *UsersCreate) SetAvatar(s string) *UsersCreate

SetAvatar sets the "avatar" field.

func (*UsersCreate) SetBio

func (uc *UsersCreate) SetBio(s string) *UsersCreate

SetBio sets the "bio" field.

func (*UsersCreate) SetCreateTime

func (uc *UsersCreate) SetCreateTime(t time.Time) *UsersCreate

SetCreateTime sets the "create_time" field.

func (*UsersCreate) SetEmail

func (uc *UsersCreate) SetEmail(s string) *UsersCreate

SetEmail sets the "email" field.

func (*UsersCreate) SetID

func (uc *UsersCreate) SetID(u uint64) *UsersCreate

SetID sets the "id" field.

func (*UsersCreate) SetName

func (uc *UsersCreate) SetName(s string) *UsersCreate

SetName sets the "name" field.

func (*UsersCreate) SetNillableAvatar

func (uc *UsersCreate) SetNillableAvatar(s *string) *UsersCreate

SetNillableAvatar sets the "avatar" field if the given value is not nil.

func (*UsersCreate) SetNillableBio

func (uc *UsersCreate) SetNillableBio(s *string) *UsersCreate

SetNillableBio sets the "bio" field if the given value is not nil.

func (*UsersCreate) SetNillableCreateTime

func (uc *UsersCreate) SetNillableCreateTime(t *time.Time) *UsersCreate

SetNillableCreateTime sets the "create_time" field if the given value is not nil.

func (*UsersCreate) SetNillableEmail

func (uc *UsersCreate) SetNillableEmail(s *string) *UsersCreate

SetNillableEmail sets the "email" field if the given value is not nil.

func (*UsersCreate) SetNillableName

func (uc *UsersCreate) SetNillableName(s *string) *UsersCreate

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

func (*UsersCreate) SetNillablePassword

func (uc *UsersCreate) SetNillablePassword(s *string) *UsersCreate

SetNillablePassword sets the "password" field if the given value is not nil.

func (*UsersCreate) SetNillableUpdateTime

func (uc *UsersCreate) SetNillableUpdateTime(t *time.Time) *UsersCreate

SetNillableUpdateTime sets the "update_time" field if the given value is not nil.

func (*UsersCreate) SetPassword

func (uc *UsersCreate) SetPassword(s string) *UsersCreate

SetPassword sets the "password" field.

func (*UsersCreate) SetUpdateTime

func (uc *UsersCreate) SetUpdateTime(t time.Time) *UsersCreate

SetUpdateTime sets the "update_time" field.

func (*UsersCreate) SetUsername

func (uc *UsersCreate) SetUsername(s string) *UsersCreate

SetUsername sets the "username" field.

type UsersCreateBulk

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

UsersCreateBulk is the builder for creating many Users entities in bulk.

func (*UsersCreateBulk) Exec

func (ucb *UsersCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*UsersCreateBulk) ExecX

func (ucb *UsersCreateBulk) ExecX(ctx context.Context)

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

func (*UsersCreateBulk) Save

func (ucb *UsersCreateBulk) Save(ctx context.Context) ([]*Users, error)

Save creates the Users entities in the database.

func (*UsersCreateBulk) SaveX

func (ucb *UsersCreateBulk) SaveX(ctx context.Context) []*Users

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

type UsersDelete

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

UsersDelete is the builder for deleting a Users entity.

func (*UsersDelete) Exec

func (ud *UsersDelete) Exec(ctx context.Context) (int, error)

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

func (*UsersDelete) ExecX

func (ud *UsersDelete) ExecX(ctx context.Context) int

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

func (*UsersDelete) Where

func (ud *UsersDelete) Where(ps ...predicate.Users) *UsersDelete

Where appends a list predicates to the UsersDelete builder.

type UsersDeleteOne

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

UsersDeleteOne is the builder for deleting a single Users entity.

func (*UsersDeleteOne) Exec

func (udo *UsersDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*UsersDeleteOne) ExecX

func (udo *UsersDeleteOne) ExecX(ctx context.Context)

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

func (*UsersDeleteOne) Where

func (udo *UsersDeleteOne) Where(ps ...predicate.Users) *UsersDeleteOne

Where appends a list predicates to the UsersDelete builder.

type UsersEdges

type UsersEdges struct {
	// Devices holds the value of the devices edge.
	Devices []*Devices `json:"devices,omitempty"`
	// Dirs holds the value of the dirs edge.
	Dirs []*Dirs `json:"dirs,omitempty"`
	// Saves holds the value of the saves edge.
	Saves []*Saves `json:"saves,omitempty"`
	// contains filtered or unexported fields
}

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

func (UsersEdges) DevicesOrErr

func (e UsersEdges) DevicesOrErr() ([]*Devices, error)

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

func (UsersEdges) DirsOrErr

func (e UsersEdges) DirsOrErr() ([]*Dirs, error)

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

func (UsersEdges) SavesOrErr

func (e UsersEdges) SavesOrErr() ([]*Saves, error)

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

type UsersGroupBy

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

UsersGroupBy is the group-by builder for Users entities.

func (*UsersGroupBy) Aggregate

func (ugb *UsersGroupBy) Aggregate(fns ...AggregateFunc) *UsersGroupBy

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

func (*UsersGroupBy) Bool

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

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

func (*UsersGroupBy) BoolX

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

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

func (*UsersGroupBy) Bools

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

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

func (*UsersGroupBy) BoolsX

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

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

func (*UsersGroupBy) Float64

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

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

func (*UsersGroupBy) Float64X

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

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

func (*UsersGroupBy) Float64s

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

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

func (*UsersGroupBy) Float64sX

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

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

func (*UsersGroupBy) Int

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

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

func (*UsersGroupBy) IntX

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

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

func (*UsersGroupBy) Ints

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

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

func (*UsersGroupBy) IntsX

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

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

func (*UsersGroupBy) Scan

func (ugb *UsersGroupBy) Scan(ctx context.Context, v any) error

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

func (*UsersGroupBy) ScanX

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

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

func (*UsersGroupBy) String

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

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

func (*UsersGroupBy) StringX

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

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

func (*UsersGroupBy) Strings

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

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

func (*UsersGroupBy) StringsX

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

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

type UsersMutation

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

UsersMutation represents an operation that mutates the Users nodes in the graph.

func (*UsersMutation) AddDeviceIDs

func (m *UsersMutation) AddDeviceIDs(ids ...uint64)

AddDeviceIDs adds the "devices" edge to the Devices entity by ids.

func (*UsersMutation) AddDirIDs

func (m *UsersMutation) AddDirIDs(ids ...uint64)

AddDirIDs adds the "dirs" edge to the Dirs entity by ids.

func (*UsersMutation) AddField

func (m *UsersMutation) 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 (*UsersMutation) AddSafeIDs

func (m *UsersMutation) AddSafeIDs(ids ...uint64)

AddSafeIDs adds the "saves" edge to the Saves entity by ids.

func (*UsersMutation) AddedEdges

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

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

func (*UsersMutation) AddedField

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

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

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

func (*UsersMutation) AddedIDs

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

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

func (*UsersMutation) Avatar

func (m *UsersMutation) Avatar() (r string, exists bool)

Avatar returns the value of the "avatar" field in the mutation.

func (*UsersMutation) AvatarCleared

func (m *UsersMutation) AvatarCleared() bool

AvatarCleared returns if the "avatar" field was cleared in this mutation.

func (*UsersMutation) Bio

func (m *UsersMutation) Bio() (r string, exists bool)

Bio returns the value of the "bio" field in the mutation.

func (*UsersMutation) BioCleared

func (m *UsersMutation) BioCleared() bool

BioCleared returns if the "bio" field was cleared in this mutation.

func (*UsersMutation) ClearAvatar

func (m *UsersMutation) ClearAvatar()

ClearAvatar clears the value of the "avatar" field.

func (*UsersMutation) ClearBio

func (m *UsersMutation) ClearBio()

ClearBio clears the value of the "bio" field.

func (*UsersMutation) ClearDevices

func (m *UsersMutation) ClearDevices()

ClearDevices clears the "devices" edge to the Devices entity.

func (*UsersMutation) ClearDirs

func (m *UsersMutation) ClearDirs()

ClearDirs clears the "dirs" edge to the Dirs entity.

func (*UsersMutation) ClearEdge

func (m *UsersMutation) 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 (*UsersMutation) ClearEmail

func (m *UsersMutation) ClearEmail()

ClearEmail clears the value of the "email" field.

func (*UsersMutation) ClearField

func (m *UsersMutation) 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 (*UsersMutation) ClearName

func (m *UsersMutation) ClearName()

ClearName clears the value of the "name" field.

func (*UsersMutation) ClearPassword

func (m *UsersMutation) ClearPassword()

ClearPassword clears the value of the "password" field.

func (*UsersMutation) ClearSaves

func (m *UsersMutation) ClearSaves()

ClearSaves clears the "saves" edge to the Saves entity.

func (*UsersMutation) ClearedEdges

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

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

func (*UsersMutation) ClearedFields

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

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

func (UsersMutation) Client

func (m UsersMutation) 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 (*UsersMutation) CreateTime

func (m *UsersMutation) CreateTime() (r time.Time, exists bool)

CreateTime returns the value of the "create_time" field in the mutation.

func (*UsersMutation) DevicesCleared

func (m *UsersMutation) DevicesCleared() bool

DevicesCleared reports if the "devices" edge to the Devices entity was cleared.

func (*UsersMutation) DevicesIDs

func (m *UsersMutation) DevicesIDs() (ids []uint64)

DevicesIDs returns the "devices" edge IDs in the mutation.

func (*UsersMutation) DirsCleared

func (m *UsersMutation) DirsCleared() bool

DirsCleared reports if the "dirs" edge to the Dirs entity was cleared.

func (*UsersMutation) DirsIDs

func (m *UsersMutation) DirsIDs() (ids []uint64)

DirsIDs returns the "dirs" edge IDs in the mutation.

func (*UsersMutation) EdgeCleared

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

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

func (*UsersMutation) Email

func (m *UsersMutation) Email() (r string, exists bool)

Email returns the value of the "email" field in the mutation.

func (*UsersMutation) EmailCleared

func (m *UsersMutation) EmailCleared() bool

EmailCleared returns if the "email" field was cleared in this mutation.

func (*UsersMutation) Field

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

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

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

func (*UsersMutation) Fields

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

func (m *UsersMutation) ID() (id uint64, 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 (*UsersMutation) IDs

func (m *UsersMutation) IDs(ctx context.Context) ([]uint64, 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 (*UsersMutation) Name

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

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

func (*UsersMutation) NameCleared

func (m *UsersMutation) NameCleared() bool

NameCleared returns if the "name" field was cleared in this mutation.

func (*UsersMutation) OldAvatar

func (m *UsersMutation) OldAvatar(ctx context.Context) (v string, err error)

OldAvatar returns the old "avatar" field's value of the Users entity. If the Users 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 (*UsersMutation) OldBio

func (m *UsersMutation) OldBio(ctx context.Context) (v string, err error)

OldBio returns the old "bio" field's value of the Users entity. If the Users 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 (*UsersMutation) OldCreateTime

func (m *UsersMutation) OldCreateTime(ctx context.Context) (v time.Time, err error)

OldCreateTime returns the old "create_time" field's value of the Users entity. If the Users 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 (*UsersMutation) OldEmail

func (m *UsersMutation) OldEmail(ctx context.Context) (v string, err error)

OldEmail returns the old "email" field's value of the Users entity. If the Users 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 (*UsersMutation) OldField

func (m *UsersMutation) 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 (*UsersMutation) OldName

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

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

func (m *UsersMutation) OldPassword(ctx context.Context) (v string, err error)

OldPassword returns the old "password" field's value of the Users entity. If the Users 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 (*UsersMutation) OldUpdateTime

func (m *UsersMutation) OldUpdateTime(ctx context.Context) (v time.Time, err error)

OldUpdateTime returns the old "update_time" field's value of the Users entity. If the Users 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 (*UsersMutation) OldUsername

func (m *UsersMutation) OldUsername(ctx context.Context) (v string, err error)

OldUsername returns the old "username" field's value of the Users entity. If the Users 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 (*UsersMutation) Op

func (m *UsersMutation) Op() Op

Op returns the operation name.

func (*UsersMutation) Password

func (m *UsersMutation) Password() (r string, exists bool)

Password returns the value of the "password" field in the mutation.

func (*UsersMutation) PasswordCleared

func (m *UsersMutation) PasswordCleared() bool

PasswordCleared returns if the "password" field was cleared in this mutation.

func (*UsersMutation) RemoveDeviceIDs

func (m *UsersMutation) RemoveDeviceIDs(ids ...uint64)

RemoveDeviceIDs removes the "devices" edge to the Devices entity by IDs.

func (*UsersMutation) RemoveDirIDs

func (m *UsersMutation) RemoveDirIDs(ids ...uint64)

RemoveDirIDs removes the "dirs" edge to the Dirs entity by IDs.

func (*UsersMutation) RemoveSafeIDs

func (m *UsersMutation) RemoveSafeIDs(ids ...uint64)

RemoveSafeIDs removes the "saves" edge to the Saves entity by IDs.

func (*UsersMutation) RemovedDevicesIDs

func (m *UsersMutation) RemovedDevicesIDs() (ids []uint64)

RemovedDevices returns the removed IDs of the "devices" edge to the Devices entity.

func (*UsersMutation) RemovedDirsIDs

func (m *UsersMutation) RemovedDirsIDs() (ids []uint64)

RemovedDirs returns the removed IDs of the "dirs" edge to the Dirs entity.

func (*UsersMutation) RemovedEdges

func (m *UsersMutation) RemovedEdges() []string

RemovedEdges returns all edge names that were removed in this mutation.

func (*UsersMutation) RemovedIDs

func (m *UsersMutation) 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 (*UsersMutation) RemovedSavesIDs

func (m *UsersMutation) RemovedSavesIDs() (ids []uint64)

RemovedSaves returns the removed IDs of the "saves" edge to the Saves entity.

func (*UsersMutation) ResetAvatar

func (m *UsersMutation) ResetAvatar()

ResetAvatar resets all changes to the "avatar" field.

func (*UsersMutation) ResetBio

func (m *UsersMutation) ResetBio()

ResetBio resets all changes to the "bio" field.

func (*UsersMutation) ResetCreateTime

func (m *UsersMutation) ResetCreateTime()

ResetCreateTime resets all changes to the "create_time" field.

func (*UsersMutation) ResetDevices

func (m *UsersMutation) ResetDevices()

ResetDevices resets all changes to the "devices" edge.

func (*UsersMutation) ResetDirs

func (m *UsersMutation) ResetDirs()

ResetDirs resets all changes to the "dirs" edge.

func (*UsersMutation) ResetEdge

func (m *UsersMutation) 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 (*UsersMutation) ResetEmail

func (m *UsersMutation) ResetEmail()

ResetEmail resets all changes to the "email" field.

func (*UsersMutation) ResetField

func (m *UsersMutation) 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 (*UsersMutation) ResetName

func (m *UsersMutation) ResetName()

ResetName resets all changes to the "name" field.

func (*UsersMutation) ResetPassword

func (m *UsersMutation) ResetPassword()

ResetPassword resets all changes to the "password" field.

func (*UsersMutation) ResetSaves

func (m *UsersMutation) ResetSaves()

ResetSaves resets all changes to the "saves" edge.

func (*UsersMutation) ResetUpdateTime

func (m *UsersMutation) ResetUpdateTime()

ResetUpdateTime resets all changes to the "update_time" field.

func (*UsersMutation) ResetUsername

func (m *UsersMutation) ResetUsername()

ResetUsername resets all changes to the "username" field.

func (*UsersMutation) SavesCleared

func (m *UsersMutation) SavesCleared() bool

SavesCleared reports if the "saves" edge to the Saves entity was cleared.

func (*UsersMutation) SavesIDs

func (m *UsersMutation) SavesIDs() (ids []uint64)

SavesIDs returns the "saves" edge IDs in the mutation.

func (*UsersMutation) SetAvatar

func (m *UsersMutation) SetAvatar(s string)

SetAvatar sets the "avatar" field.

func (*UsersMutation) SetBio

func (m *UsersMutation) SetBio(s string)

SetBio sets the "bio" field.

func (*UsersMutation) SetCreateTime

func (m *UsersMutation) SetCreateTime(t time.Time)

SetCreateTime sets the "create_time" field.

func (*UsersMutation) SetEmail

func (m *UsersMutation) SetEmail(s string)

SetEmail sets the "email" field.

func (*UsersMutation) SetField

func (m *UsersMutation) 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 (*UsersMutation) SetID

func (m *UsersMutation) SetID(id uint64)

SetID sets the value of the id field. Note that this operation is only accepted on creation of Users entities.

func (*UsersMutation) SetName

func (m *UsersMutation) SetName(s string)

SetName sets the "name" field.

func (*UsersMutation) SetOp

func (m *UsersMutation) SetOp(op Op)

SetOp allows setting the mutation operation.

func (*UsersMutation) SetPassword

func (m *UsersMutation) SetPassword(s string)

SetPassword sets the "password" field.

func (*UsersMutation) SetUpdateTime

func (m *UsersMutation) SetUpdateTime(t time.Time)

SetUpdateTime sets the "update_time" field.

func (*UsersMutation) SetUsername

func (m *UsersMutation) SetUsername(s string)

SetUsername sets the "username" field.

func (UsersMutation) Tx

func (m UsersMutation) Tx() (*Tx, error)

Tx returns an `ent.Tx` for mutations that were executed in transactions; it returns an error otherwise.

func (*UsersMutation) Type

func (m *UsersMutation) Type() string

Type returns the node type of this mutation (Users).

func (*UsersMutation) UpdateTime

func (m *UsersMutation) UpdateTime() (r time.Time, exists bool)

UpdateTime returns the value of the "update_time" field in the mutation.

func (*UsersMutation) Username

func (m *UsersMutation) Username() (r string, exists bool)

Username returns the value of the "username" field in the mutation.

func (*UsersMutation) Where

func (m *UsersMutation) Where(ps ...predicate.Users)

Where appends a list predicates to the UsersMutation builder.

func (*UsersMutation) WhereP

func (m *UsersMutation) WhereP(ps ...func(*sql.Selector))

WhereP appends storage-level predicates to the UsersMutation builder. Using this method, users can use type-assertion to append predicates that do not depend on any generated package.

type UsersQuery

type UsersQuery struct {
	// contains filtered or unexported fields
}

UsersQuery is the builder for querying Users entities.

func (*UsersQuery) Aggregate

func (uq *UsersQuery) Aggregate(fns ...AggregateFunc) *UsersSelect

Aggregate returns a UsersSelect configured with the given aggregations.

func (*UsersQuery) All

func (uq *UsersQuery) All(ctx context.Context) ([]*Users, error)

All executes the query and returns a list of UsersSlice.

func (*UsersQuery) AllX

func (uq *UsersQuery) AllX(ctx context.Context) []*Users

AllX is like All, but panics if an error occurs.

func (*UsersQuery) Clone

func (uq *UsersQuery) Clone() *UsersQuery

Clone returns a duplicate of the UsersQuery builder, including all associated steps. It can be used to prepare common query builders and use them differently after the clone is made.

func (*UsersQuery) Count

func (uq *UsersQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*UsersQuery) CountX

func (uq *UsersQuery) CountX(ctx context.Context) int

CountX is like Count, but panics if an error occurs.

func (*UsersQuery) Exist

func (uq *UsersQuery) Exist(ctx context.Context) (bool, error)

Exist returns true if the query has elements in the graph.

func (*UsersQuery) ExistX

func (uq *UsersQuery) ExistX(ctx context.Context) bool

ExistX is like Exist, but panics if an error occurs.

func (*UsersQuery) First

func (uq *UsersQuery) First(ctx context.Context) (*Users, error)

First returns the first Users entity from the query. Returns a *NotFoundError when no Users was found.

func (*UsersQuery) FirstID

func (uq *UsersQuery) FirstID(ctx context.Context) (id uint64, err error)

FirstID returns the first Users ID from the query. Returns a *NotFoundError when no Users ID was found.

func (*UsersQuery) FirstIDX

func (uq *UsersQuery) FirstIDX(ctx context.Context) uint64

FirstIDX is like FirstID, but panics if an error occurs.

func (*UsersQuery) FirstX

func (uq *UsersQuery) FirstX(ctx context.Context) *Users

FirstX is like First, but panics if an error occurs.

func (*UsersQuery) GroupBy

func (uq *UsersQuery) GroupBy(field string, fields ...string) *UsersGroupBy

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 {
	CreateTime time.Time `json:"create_time,omitempty"`
	Count int `json:"count,omitempty"`
}

client.Users.Query().
	GroupBy(users.FieldCreateTime).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*UsersQuery) IDs

func (uq *UsersQuery) IDs(ctx context.Context) (ids []uint64, err error)

IDs executes the query and returns a list of Users IDs.

func (*UsersQuery) IDsX

func (uq *UsersQuery) IDsX(ctx context.Context) []uint64

IDsX is like IDs, but panics if an error occurs.

func (*UsersQuery) Limit

func (uq *UsersQuery) Limit(limit int) *UsersQuery

Limit the number of records to be returned by this query.

func (*UsersQuery) Offset

func (uq *UsersQuery) Offset(offset int) *UsersQuery

Offset to start from.

func (*UsersQuery) Only

func (uq *UsersQuery) Only(ctx context.Context) (*Users, error)

Only returns a single Users entity found by the query, ensuring it only returns one. Returns a *NotSingularError when more than one Users entity is found. Returns a *NotFoundError when no Users entities are found.

func (*UsersQuery) OnlyID

func (uq *UsersQuery) OnlyID(ctx context.Context) (id uint64, err error)

OnlyID is like Only, but returns the only Users ID in the query. Returns a *NotSingularError when more than one Users ID is found. Returns a *NotFoundError when no entities are found.

func (*UsersQuery) OnlyIDX

func (uq *UsersQuery) OnlyIDX(ctx context.Context) uint64

OnlyIDX is like OnlyID, but panics if an error occurs.

func (*UsersQuery) OnlyX

func (uq *UsersQuery) OnlyX(ctx context.Context) *Users

OnlyX is like Only, but panics if an error occurs.

func (*UsersQuery) Order

func (uq *UsersQuery) Order(o ...users.OrderOption) *UsersQuery

Order specifies how the records should be ordered.

func (*UsersQuery) QueryDevices

func (uq *UsersQuery) QueryDevices() *DevicesQuery

QueryDevices chains the current query on the "devices" edge.

func (*UsersQuery) QueryDirs

func (uq *UsersQuery) QueryDirs() *DirsQuery

QueryDirs chains the current query on the "dirs" edge.

func (*UsersQuery) QuerySaves

func (uq *UsersQuery) QuerySaves() *SavesQuery

QuerySaves chains the current query on the "saves" edge.

func (*UsersQuery) Select

func (uq *UsersQuery) Select(fields ...string) *UsersSelect

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 {
	CreateTime time.Time `json:"create_time,omitempty"`
}

client.Users.Query().
	Select(users.FieldCreateTime).
	Scan(ctx, &v)

func (*UsersQuery) Unique

func (uq *UsersQuery) Unique(unique bool) *UsersQuery

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 (*UsersQuery) Where

func (uq *UsersQuery) Where(ps ...predicate.Users) *UsersQuery

Where adds a new predicate for the UsersQuery builder.

func (*UsersQuery) WithDevices

func (uq *UsersQuery) WithDevices(opts ...func(*DevicesQuery)) *UsersQuery

WithDevices tells the query-builder to eager-load the nodes that are connected to the "devices" edge. The optional arguments are used to configure the query builder of the edge.

func (*UsersQuery) WithDirs

func (uq *UsersQuery) WithDirs(opts ...func(*DirsQuery)) *UsersQuery

WithDirs tells the query-builder to eager-load the nodes that are connected to the "dirs" edge. The optional arguments are used to configure the query builder of the edge.

func (*UsersQuery) WithSaves

func (uq *UsersQuery) WithSaves(opts ...func(*SavesQuery)) *UsersQuery

WithSaves tells the query-builder to eager-load the nodes that are connected to the "saves" edge. The optional arguments are used to configure the query builder of the edge.

type UsersSelect

type UsersSelect struct {
	*UsersQuery
	// contains filtered or unexported fields
}

UsersSelect is the builder for selecting fields of Users entities.

func (*UsersSelect) Aggregate

func (us *UsersSelect) Aggregate(fns ...AggregateFunc) *UsersSelect

Aggregate adds the given aggregation functions to the selector query.

func (*UsersSelect) Bool

func (s *UsersSelect) Bool(ctx context.Context) (_ bool, err error)

Bool returns a single bool from a selector. It is only allowed when selecting one field.

func (*UsersSelect) BoolX

func (s *UsersSelect) BoolX(ctx context.Context) bool

BoolX is like Bool, but panics if an error occurs.

func (*UsersSelect) Bools

func (s *UsersSelect) Bools(ctx context.Context) ([]bool, error)

Bools returns list of bools from a selector. It is only allowed when selecting one field.

func (*UsersSelect) BoolsX

func (s *UsersSelect) BoolsX(ctx context.Context) []bool

BoolsX is like Bools, but panics if an error occurs.

func (*UsersSelect) Float64

func (s *UsersSelect) Float64(ctx context.Context) (_ float64, err error)

Float64 returns a single float64 from a selector. It is only allowed when selecting one field.

func (*UsersSelect) Float64X

func (s *UsersSelect) Float64X(ctx context.Context) float64

Float64X is like Float64, but panics if an error occurs.

func (*UsersSelect) Float64s

func (s *UsersSelect) Float64s(ctx context.Context) ([]float64, error)

Float64s returns list of float64s from a selector. It is only allowed when selecting one field.

func (*UsersSelect) Float64sX

func (s *UsersSelect) Float64sX(ctx context.Context) []float64

Float64sX is like Float64s, but panics if an error occurs.

func (*UsersSelect) Int

func (s *UsersSelect) Int(ctx context.Context) (_ int, err error)

Int returns a single int from a selector. It is only allowed when selecting one field.

func (*UsersSelect) IntX

func (s *UsersSelect) IntX(ctx context.Context) int

IntX is like Int, but panics if an error occurs.

func (*UsersSelect) Ints

func (s *UsersSelect) Ints(ctx context.Context) ([]int, error)

Ints returns list of ints from a selector. It is only allowed when selecting one field.

func (*UsersSelect) IntsX

func (s *UsersSelect) IntsX(ctx context.Context) []int

IntsX is like Ints, but panics if an error occurs.

func (*UsersSelect) Scan

func (us *UsersSelect) Scan(ctx context.Context, v any) error

Scan applies the selector query and scans the result into the given value.

func (*UsersSelect) ScanX

func (s *UsersSelect) ScanX(ctx context.Context, v any)

ScanX is like Scan, but panics if an error occurs.

func (*UsersSelect) String

func (s *UsersSelect) String(ctx context.Context) (_ string, err error)

String returns a single string from a selector. It is only allowed when selecting one field.

func (*UsersSelect) StringX

func (s *UsersSelect) StringX(ctx context.Context) string

StringX is like String, but panics if an error occurs.

func (*UsersSelect) Strings

func (s *UsersSelect) Strings(ctx context.Context) ([]string, error)

Strings returns list of strings from a selector. It is only allowed when selecting one field.

func (*UsersSelect) StringsX

func (s *UsersSelect) StringsX(ctx context.Context) []string

StringsX is like Strings, but panics if an error occurs.

type UsersSlice

type UsersSlice []*Users

UsersSlice is a parsable slice of Users.

type UsersUpdate

type UsersUpdate struct {
	// contains filtered or unexported fields
}

UsersUpdate is the builder for updating Users entities.

func (*UsersUpdate) AddDeviceIDs

func (uu *UsersUpdate) AddDeviceIDs(ids ...uint64) *UsersUpdate

AddDeviceIDs adds the "devices" edge to the Devices entity by IDs.

func (*UsersUpdate) AddDevices

func (uu *UsersUpdate) AddDevices(d ...*Devices) *UsersUpdate

AddDevices adds the "devices" edges to the Devices entity.

func (*UsersUpdate) AddDirIDs

func (uu *UsersUpdate) AddDirIDs(ids ...uint64) *UsersUpdate

AddDirIDs adds the "dirs" edge to the Dirs entity by IDs.

func (*UsersUpdate) AddDirs

func (uu *UsersUpdate) AddDirs(d ...*Dirs) *UsersUpdate

AddDirs adds the "dirs" edges to the Dirs entity.

func (*UsersUpdate) AddSafeIDs

func (uu *UsersUpdate) AddSafeIDs(ids ...uint64) *UsersUpdate

AddSafeIDs adds the "saves" edge to the Saves entity by IDs.

func (*UsersUpdate) AddSaves

func (uu *UsersUpdate) AddSaves(s ...*Saves) *UsersUpdate

AddSaves adds the "saves" edges to the Saves entity.

func (*UsersUpdate) ClearAvatar

func (uu *UsersUpdate) ClearAvatar() *UsersUpdate

ClearAvatar clears the value of the "avatar" field.

func (*UsersUpdate) ClearBio

func (uu *UsersUpdate) ClearBio() *UsersUpdate

ClearBio clears the value of the "bio" field.

func (*UsersUpdate) ClearDevices

func (uu *UsersUpdate) ClearDevices() *UsersUpdate

ClearDevices clears all "devices" edges to the Devices entity.

func (*UsersUpdate) ClearDirs

func (uu *UsersUpdate) ClearDirs() *UsersUpdate

ClearDirs clears all "dirs" edges to the Dirs entity.

func (*UsersUpdate) ClearEmail

func (uu *UsersUpdate) ClearEmail() *UsersUpdate

ClearEmail clears the value of the "email" field.

func (*UsersUpdate) ClearName

func (uu *UsersUpdate) ClearName() *UsersUpdate

ClearName clears the value of the "name" field.

func (*UsersUpdate) ClearPassword

func (uu *UsersUpdate) ClearPassword() *UsersUpdate

ClearPassword clears the value of the "password" field.

func (*UsersUpdate) ClearSaves

func (uu *UsersUpdate) ClearSaves() *UsersUpdate

ClearSaves clears all "saves" edges to the Saves entity.

func (*UsersUpdate) Exec

func (uu *UsersUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*UsersUpdate) ExecX

func (uu *UsersUpdate) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*UsersUpdate) Mutation

func (uu *UsersUpdate) Mutation() *UsersMutation

Mutation returns the UsersMutation object of the builder.

func (*UsersUpdate) RemoveDeviceIDs

func (uu *UsersUpdate) RemoveDeviceIDs(ids ...uint64) *UsersUpdate

RemoveDeviceIDs removes the "devices" edge to Devices entities by IDs.

func (*UsersUpdate) RemoveDevices

func (uu *UsersUpdate) RemoveDevices(d ...*Devices) *UsersUpdate

RemoveDevices removes "devices" edges to Devices entities.

func (*UsersUpdate) RemoveDirIDs

func (uu *UsersUpdate) RemoveDirIDs(ids ...uint64) *UsersUpdate

RemoveDirIDs removes the "dirs" edge to Dirs entities by IDs.

func (*UsersUpdate) RemoveDirs

func (uu *UsersUpdate) RemoveDirs(d ...*Dirs) *UsersUpdate

RemoveDirs removes "dirs" edges to Dirs entities.

func (*UsersUpdate) RemoveSafeIDs

func (uu *UsersUpdate) RemoveSafeIDs(ids ...uint64) *UsersUpdate

RemoveSafeIDs removes the "saves" edge to Saves entities by IDs.

func (*UsersUpdate) RemoveSaves

func (uu *UsersUpdate) RemoveSaves(s ...*Saves) *UsersUpdate

RemoveSaves removes "saves" edges to Saves entities.

func (*UsersUpdate) Save

func (uu *UsersUpdate) Save(ctx context.Context) (int, error)

Save executes the query and returns the number of nodes affected by the update operation.

func (*UsersUpdate) SaveX

func (uu *UsersUpdate) SaveX(ctx context.Context) int

SaveX is like Save, but panics if an error occurs.

func (*UsersUpdate) SetAvatar

func (uu *UsersUpdate) SetAvatar(s string) *UsersUpdate

SetAvatar sets the "avatar" field.

func (*UsersUpdate) SetBio

func (uu *UsersUpdate) SetBio(s string) *UsersUpdate

SetBio sets the "bio" field.

func (*UsersUpdate) SetEmail

func (uu *UsersUpdate) SetEmail(s string) *UsersUpdate

SetEmail sets the "email" field.

func (*UsersUpdate) SetName

func (uu *UsersUpdate) SetName(s string) *UsersUpdate

SetName sets the "name" field.

func (*UsersUpdate) SetNillableAvatar

func (uu *UsersUpdate) SetNillableAvatar(s *string) *UsersUpdate

SetNillableAvatar sets the "avatar" field if the given value is not nil.

func (*UsersUpdate) SetNillableBio

func (uu *UsersUpdate) SetNillableBio(s *string) *UsersUpdate

SetNillableBio sets the "bio" field if the given value is not nil.

func (*UsersUpdate) SetNillableEmail

func (uu *UsersUpdate) SetNillableEmail(s *string) *UsersUpdate

SetNillableEmail sets the "email" field if the given value is not nil.

func (*UsersUpdate) SetNillableName

func (uu *UsersUpdate) SetNillableName(s *string) *UsersUpdate

SetNillableName sets the "name" field if the given value is not nil.

func (*UsersUpdate) SetNillablePassword

func (uu *UsersUpdate) SetNillablePassword(s *string) *UsersUpdate

SetNillablePassword sets the "password" field if the given value is not nil.

func (*UsersUpdate) SetNillableUsername

func (uu *UsersUpdate) SetNillableUsername(s *string) *UsersUpdate

SetNillableUsername sets the "username" field if the given value is not nil.

func (*UsersUpdate) SetPassword

func (uu *UsersUpdate) SetPassword(s string) *UsersUpdate

SetPassword sets the "password" field.

func (*UsersUpdate) SetUpdateTime

func (uu *UsersUpdate) SetUpdateTime(t time.Time) *UsersUpdate

SetUpdateTime sets the "update_time" field.

func (*UsersUpdate) SetUsername

func (uu *UsersUpdate) SetUsername(s string) *UsersUpdate

SetUsername sets the "username" field.

func (*UsersUpdate) Where

func (uu *UsersUpdate) Where(ps ...predicate.Users) *UsersUpdate

Where appends a list predicates to the UsersUpdate builder.

type UsersUpdateOne

type UsersUpdateOne struct {
	// contains filtered or unexported fields
}

UsersUpdateOne is the builder for updating a single Users entity.

func (*UsersUpdateOne) AddDeviceIDs

func (uuo *UsersUpdateOne) AddDeviceIDs(ids ...uint64) *UsersUpdateOne

AddDeviceIDs adds the "devices" edge to the Devices entity by IDs.

func (*UsersUpdateOne) AddDevices

func (uuo *UsersUpdateOne) AddDevices(d ...*Devices) *UsersUpdateOne

AddDevices adds the "devices" edges to the Devices entity.

func (*UsersUpdateOne) AddDirIDs

func (uuo *UsersUpdateOne) AddDirIDs(ids ...uint64) *UsersUpdateOne

AddDirIDs adds the "dirs" edge to the Dirs entity by IDs.

func (*UsersUpdateOne) AddDirs

func (uuo *UsersUpdateOne) AddDirs(d ...*Dirs) *UsersUpdateOne

AddDirs adds the "dirs" edges to the Dirs entity.

func (*UsersUpdateOne) AddSafeIDs

func (uuo *UsersUpdateOne) AddSafeIDs(ids ...uint64) *UsersUpdateOne

AddSafeIDs adds the "saves" edge to the Saves entity by IDs.

func (*UsersUpdateOne) AddSaves

func (uuo *UsersUpdateOne) AddSaves(s ...*Saves) *UsersUpdateOne

AddSaves adds the "saves" edges to the Saves entity.

func (*UsersUpdateOne) ClearAvatar

func (uuo *UsersUpdateOne) ClearAvatar() *UsersUpdateOne

ClearAvatar clears the value of the "avatar" field.

func (*UsersUpdateOne) ClearBio

func (uuo *UsersUpdateOne) ClearBio() *UsersUpdateOne

ClearBio clears the value of the "bio" field.

func (*UsersUpdateOne) ClearDevices

func (uuo *UsersUpdateOne) ClearDevices() *UsersUpdateOne

ClearDevices clears all "devices" edges to the Devices entity.

func (*UsersUpdateOne) ClearDirs

func (uuo *UsersUpdateOne) ClearDirs() *UsersUpdateOne

ClearDirs clears all "dirs" edges to the Dirs entity.

func (*UsersUpdateOne) ClearEmail

func (uuo *UsersUpdateOne) ClearEmail() *UsersUpdateOne

ClearEmail clears the value of the "email" field.

func (*UsersUpdateOne) ClearName

func (uuo *UsersUpdateOne) ClearName() *UsersUpdateOne

ClearName clears the value of the "name" field.

func (*UsersUpdateOne) ClearPassword

func (uuo *UsersUpdateOne) ClearPassword() *UsersUpdateOne

ClearPassword clears the value of the "password" field.

func (*UsersUpdateOne) ClearSaves

func (uuo *UsersUpdateOne) ClearSaves() *UsersUpdateOne

ClearSaves clears all "saves" edges to the Saves entity.

func (*UsersUpdateOne) Exec

func (uuo *UsersUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*UsersUpdateOne) ExecX

func (uuo *UsersUpdateOne) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*UsersUpdateOne) Mutation

func (uuo *UsersUpdateOne) Mutation() *UsersMutation

Mutation returns the UsersMutation object of the builder.

func (*UsersUpdateOne) RemoveDeviceIDs

func (uuo *UsersUpdateOne) RemoveDeviceIDs(ids ...uint64) *UsersUpdateOne

RemoveDeviceIDs removes the "devices" edge to Devices entities by IDs.

func (*UsersUpdateOne) RemoveDevices

func (uuo *UsersUpdateOne) RemoveDevices(d ...*Devices) *UsersUpdateOne

RemoveDevices removes "devices" edges to Devices entities.

func (*UsersUpdateOne) RemoveDirIDs

func (uuo *UsersUpdateOne) RemoveDirIDs(ids ...uint64) *UsersUpdateOne

RemoveDirIDs removes the "dirs" edge to Dirs entities by IDs.

func (*UsersUpdateOne) RemoveDirs

func (uuo *UsersUpdateOne) RemoveDirs(d ...*Dirs) *UsersUpdateOne

RemoveDirs removes "dirs" edges to Dirs entities.

func (*UsersUpdateOne) RemoveSafeIDs

func (uuo *UsersUpdateOne) RemoveSafeIDs(ids ...uint64) *UsersUpdateOne

RemoveSafeIDs removes the "saves" edge to Saves entities by IDs.

func (*UsersUpdateOne) RemoveSaves

func (uuo *UsersUpdateOne) RemoveSaves(s ...*Saves) *UsersUpdateOne

RemoveSaves removes "saves" edges to Saves entities.

func (*UsersUpdateOne) Save

func (uuo *UsersUpdateOne) Save(ctx context.Context) (*Users, error)

Save executes the query and returns the updated Users entity.

func (*UsersUpdateOne) SaveX

func (uuo *UsersUpdateOne) SaveX(ctx context.Context) *Users

SaveX is like Save, but panics if an error occurs.

func (*UsersUpdateOne) Select

func (uuo *UsersUpdateOne) Select(field string, fields ...string) *UsersUpdateOne

Select allows selecting one or more fields (columns) of the returned entity. The default is selecting all fields defined in the entity schema.

func (*UsersUpdateOne) SetAvatar

func (uuo *UsersUpdateOne) SetAvatar(s string) *UsersUpdateOne

SetAvatar sets the "avatar" field.

func (*UsersUpdateOne) SetBio

func (uuo *UsersUpdateOne) SetBio(s string) *UsersUpdateOne

SetBio sets the "bio" field.

func (*UsersUpdateOne) SetEmail

func (uuo *UsersUpdateOne) SetEmail(s string) *UsersUpdateOne

SetEmail sets the "email" field.

func (*UsersUpdateOne) SetName

func (uuo *UsersUpdateOne) SetName(s string) *UsersUpdateOne

SetName sets the "name" field.

func (*UsersUpdateOne) SetNillableAvatar

func (uuo *UsersUpdateOne) SetNillableAvatar(s *string) *UsersUpdateOne

SetNillableAvatar sets the "avatar" field if the given value is not nil.

func (*UsersUpdateOne) SetNillableBio

func (uuo *UsersUpdateOne) SetNillableBio(s *string) *UsersUpdateOne

SetNillableBio sets the "bio" field if the given value is not nil.

func (*UsersUpdateOne) SetNillableEmail

func (uuo *UsersUpdateOne) SetNillableEmail(s *string) *UsersUpdateOne

SetNillableEmail sets the "email" field if the given value is not nil.

func (*UsersUpdateOne) SetNillableName

func (uuo *UsersUpdateOne) SetNillableName(s *string) *UsersUpdateOne

SetNillableName sets the "name" field if the given value is not nil.

func (*UsersUpdateOne) SetNillablePassword

func (uuo *UsersUpdateOne) SetNillablePassword(s *string) *UsersUpdateOne

SetNillablePassword sets the "password" field if the given value is not nil.

func (*UsersUpdateOne) SetNillableUsername

func (uuo *UsersUpdateOne) SetNillableUsername(s *string) *UsersUpdateOne

SetNillableUsername sets the "username" field if the given value is not nil.

func (*UsersUpdateOne) SetPassword

func (uuo *UsersUpdateOne) SetPassword(s string) *UsersUpdateOne

SetPassword sets the "password" field.

func (*UsersUpdateOne) SetUpdateTime

func (uuo *UsersUpdateOne) SetUpdateTime(t time.Time) *UsersUpdateOne

SetUpdateTime sets the "update_time" field.

func (*UsersUpdateOne) SetUsername

func (uuo *UsersUpdateOne) SetUsername(s string) *UsersUpdateOne

SetUsername sets the "username" field.

func (*UsersUpdateOne) Where

func (uuo *UsersUpdateOne) Where(ps ...predicate.Users) *UsersUpdateOne

Where appends a list predicates to the UsersUpdate builder.

type ValidationError

type ValidationError struct {
	Name string // Field or edge name.
	// contains filtered or unexported fields
}

ValidationError returns when validating a field or edge fails.

func (*ValidationError) Error

func (e *ValidationError) Error() string

Error implements the error interface.

func (*ValidationError) Unwrap

func (e *ValidationError) Unwrap() error

Unwrap implements the errors.Wrapper interface.

type Value

type Value = ent.Value

ent aliases to avoid import conflicts in user's code.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL