ent

package
v1.1.4 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2024 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

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

	// Node types.
	TypeFile   = "File"
	TypeFolder = "Folder"
	TypeSpace  = "Space"
	TypeUser   = "User"
)

Variables

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

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

Functions

func Asc

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

Asc applies the given fields in ASC order.

func Desc

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

Desc applies the given fields in DESC order.

func IsConstraintError

func IsConstraintError(err error) bool

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

func IsNotFound

func IsNotFound(err error) bool

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

func IsNotLoaded

func IsNotLoaded(err error) bool

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

func IsNotSingular

func IsNotSingular(err error) bool

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

func IsValidationError

func IsValidationError(err error) bool

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

func MaskNotFound

func MaskNotFound(err error) error

MaskNotFound masks not found error.

func NewContext

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

NewContext returns a new context with the given Client attached.

func NewTxContext

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

NewTxContext returns a new context with the given Tx attached.

Types

type 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
	// File is the client for interacting with the File builders.
	File *FileClient
	// Folder is the client for interacting with the Folder builders.
	Folder *FolderClient
	// Space is the client for interacting with the Space builders.
	Space *SpaceClient
	// User is the client for interacting with the User builders.
	User *UserClient
	// contains filtered or unexported fields
}

Client is the client that holds all ent builders.

func FromContext

func FromContext(ctx context.Context) *Client

FromContext returns a Client stored inside a context, or nil if there isn't one.

func NewClient

func NewClient(opts ...Option) *Client

NewClient creates a new client configured with the given options.

func Open

func Open(driverName, dataSourceName string, options ...Option) (*Client, error)

Open opens a database/sql.DB specified by the driver name and the data source name, and returns a new client attached to it. Optional parameters can be added for configuring the client.

func (*Client) BeginTx

func (c *Client) BeginTx(ctx context.Context, opts *sql.TxOptions) (*Tx, error)

BeginTx returns a transactional client with specified options.

func (*Client) Close

func (c *Client) Close() error

Close closes the database connection and prevents new queries from starting.

func (*Client) Debug

func (c *Client) Debug() *Client

Debug returns a new debug-client. It's used to get verbose logging on specific operations.

client.Debug().
	File.
	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 File

type File struct {

	// ID of the ent.
	ID string `json:"id,omitempty"`
	// FolderID holds the value of the "folder_id" field.
	FolderID string `json:"folder_id,omitempty"`
	// Md5 holds the value of the "md5" field.
	Md5 string `json:"md5,omitempty"`
	// Name holds the value of the "name" field.
	Name string `json:"name,omitempty"`
	// Size holds the value of the "size" field.
	Size int64 `json:"size,omitempty"`
	// ContentType holds the value of the "content_type" field.
	ContentType string `json:"content_type,omitempty"`
	// Downloads holds the value of the "downloads" field.
	Downloads int64 `json:"downloads,omitempty"`
	// CreatedAt holds the value of the "created_at" field.
	CreatedAt time.Time `json:"created_at,omitempty"`
	// UpdatedAt holds the value of the "updated_at" field.
	UpdatedAt time.Time `json:"updated_at,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the FileQuery when eager-loading is set.
	Edges FileEdges `json:"edges"`
	// contains filtered or unexported fields
}

File is the model entity for the File schema.

func (*File) QueryFolder

func (f *File) QueryFolder() *FolderQuery

QueryFolder queries the "folder" edge of the File entity.

func (*File) String

func (f *File) String() string

String implements the fmt.Stringer.

func (*File) Unwrap

func (f *File) Unwrap() *File

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

func (f *File) Update() *FileUpdateOne

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

func (*File) Value added in v1.1.1

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

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

type FileClient

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

FileClient is a client for the File schema.

func NewFileClient

func NewFileClient(c config) *FileClient

NewFileClient returns a client for the File from the given config.

func (*FileClient) Create

func (c *FileClient) Create() *FileCreate

Create returns a builder for creating a File entity.

func (*FileClient) CreateBulk

func (c *FileClient) CreateBulk(builders ...*FileCreate) *FileCreateBulk

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

func (*FileClient) Delete

func (c *FileClient) Delete() *FileDelete

Delete returns a delete builder for File.

func (*FileClient) DeleteOne

func (c *FileClient) DeleteOne(f *File) *FileDeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*FileClient) DeleteOneID

func (c *FileClient) DeleteOneID(id string) *FileDeleteOne

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

func (*FileClient) Get

func (c *FileClient) Get(ctx context.Context, id string) (*File, error)

Get returns a File entity by its id.

func (*FileClient) GetX

func (c *FileClient) GetX(ctx context.Context, id string) *File

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

func (*FileClient) Hooks

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

Hooks returns the client hooks.

func (*FileClient) Intercept

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

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

func (*FileClient) Interceptors

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

Interceptors returns the client interceptors.

func (*FileClient) MapCreateBulk added in v1.1.4

func (c *FileClient) MapCreateBulk(slice any, setFunc func(*FileCreate, int)) *FileCreateBulk

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

func (c *FileClient) Query() *FileQuery

Query returns a query builder for File.

func (*FileClient) QueryFolder

func (c *FileClient) QueryFolder(f *File) *FolderQuery

QueryFolder queries the folder edge of a File.

func (*FileClient) Update

func (c *FileClient) Update() *FileUpdate

Update returns an update builder for File.

func (*FileClient) UpdateOne

func (c *FileClient) UpdateOne(f *File) *FileUpdateOne

UpdateOne returns an update builder for the given entity.

func (*FileClient) UpdateOneID

func (c *FileClient) UpdateOneID(id string) *FileUpdateOne

UpdateOneID returns an update builder for the given id.

func (*FileClient) Use

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

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

type FileCreate

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

FileCreate is the builder for creating a File entity.

func (*FileCreate) Exec

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

Exec executes the query.

func (*FileCreate) ExecX

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

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

func (*FileCreate) Mutation

func (fc *FileCreate) Mutation() *FileMutation

Mutation returns the FileMutation object of the builder.

func (*FileCreate) OnConflict added in v1.1.0

func (fc *FileCreate) OnConflict(opts ...sql.ConflictOption) *FileUpsertOne

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

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

func (*FileCreate) OnConflictColumns added in v1.1.0

func (fc *FileCreate) OnConflictColumns(columns ...string) *FileUpsertOne

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

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

func (*FileCreate) Save

func (fc *FileCreate) Save(ctx context.Context) (*File, error)

Save creates the File in the database.

func (*FileCreate) SaveX

func (fc *FileCreate) SaveX(ctx context.Context) *File

SaveX calls Save and panics if Save returns an error.

func (*FileCreate) SetContentType

func (fc *FileCreate) SetContentType(s string) *FileCreate

SetContentType sets the "content_type" field.

func (*FileCreate) SetCreatedAt

func (fc *FileCreate) SetCreatedAt(t time.Time) *FileCreate

SetCreatedAt sets the "created_at" field.

func (*FileCreate) SetDownloads

func (fc *FileCreate) SetDownloads(i int64) *FileCreate

SetDownloads sets the "downloads" field.

func (*FileCreate) SetFolder

func (fc *FileCreate) SetFolder(f *Folder) *FileCreate

SetFolder sets the "folder" edge to the Folder entity.

func (*FileCreate) SetFolderID

func (fc *FileCreate) SetFolderID(s string) *FileCreate

SetFolderID sets the "folder_id" field.

func (*FileCreate) SetID

func (fc *FileCreate) SetID(s string) *FileCreate

SetID sets the "id" field.

func (*FileCreate) SetMd5

func (fc *FileCreate) SetMd5(s string) *FileCreate

SetMd5 sets the "md5" field.

func (*FileCreate) SetName

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

SetName sets the "name" field.

func (*FileCreate) SetNillableCreatedAt

func (fc *FileCreate) SetNillableCreatedAt(t *time.Time) *FileCreate

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

func (*FileCreate) SetNillableDownloads

func (fc *FileCreate) SetNillableDownloads(i *int64) *FileCreate

SetNillableDownloads sets the "downloads" field if the given value is not nil.

func (*FileCreate) SetNillableID

func (fc *FileCreate) SetNillableID(s *string) *FileCreate

SetNillableID sets the "id" field if the given value is not nil.

func (*FileCreate) SetNillableUpdatedAt

func (fc *FileCreate) SetNillableUpdatedAt(t *time.Time) *FileCreate

SetNillableUpdatedAt sets the "updated_at" field if the given value is not nil.

func (*FileCreate) SetSize

func (fc *FileCreate) SetSize(i int64) *FileCreate

SetSize sets the "size" field.

func (*FileCreate) SetUpdatedAt

func (fc *FileCreate) SetUpdatedAt(t time.Time) *FileCreate

SetUpdatedAt sets the "updated_at" field.

type FileCreateBulk

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

FileCreateBulk is the builder for creating many File entities in bulk.

func (*FileCreateBulk) Exec

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

Exec executes the query.

func (*FileCreateBulk) ExecX

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

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

func (*FileCreateBulk) OnConflict added in v1.1.0

func (fcb *FileCreateBulk) OnConflict(opts ...sql.ConflictOption) *FileUpsertBulk

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

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

func (*FileCreateBulk) OnConflictColumns added in v1.1.0

func (fcb *FileCreateBulk) OnConflictColumns(columns ...string) *FileUpsertBulk

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

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

func (*FileCreateBulk) Save

func (fcb *FileCreateBulk) Save(ctx context.Context) ([]*File, error)

Save creates the File entities in the database.

func (*FileCreateBulk) SaveX

func (fcb *FileCreateBulk) SaveX(ctx context.Context) []*File

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

type FileDelete

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

FileDelete is the builder for deleting a File entity.

func (*FileDelete) Exec

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

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

func (*FileDelete) ExecX

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

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

func (*FileDelete) Where

func (fd *FileDelete) Where(ps ...predicate.File) *FileDelete

Where appends a list predicates to the FileDelete builder.

type FileDeleteOne

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

FileDeleteOne is the builder for deleting a single File entity.

func (*FileDeleteOne) Exec

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

Exec executes the deletion query.

func (*FileDeleteOne) ExecX

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

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

func (*FileDeleteOne) Where added in v1.1.0

func (fdo *FileDeleteOne) Where(ps ...predicate.File) *FileDeleteOne

Where appends a list predicates to the FileDelete builder.

type FileEdges

type FileEdges struct {
	// Folder holds the value of the folder edge.
	Folder *Folder `json:"folder,omitempty"`
	// contains filtered or unexported fields
}

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

func (FileEdges) FolderOrErr

func (e FileEdges) FolderOrErr() (*Folder, error)

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

type FileGroupBy

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

FileGroupBy is the group-by builder for File entities.

func (*FileGroupBy) Aggregate

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

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

func (*FileGroupBy) Bool

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

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

func (*FileGroupBy) BoolX

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

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

func (*FileGroupBy) Bools

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

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

func (*FileGroupBy) BoolsX

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

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

func (*FileGroupBy) Float64

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

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

func (*FileGroupBy) Float64X

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

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

func (*FileGroupBy) Float64s

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

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

func (*FileGroupBy) Float64sX

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

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

func (*FileGroupBy) Int

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

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

func (*FileGroupBy) IntX

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

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

func (*FileGroupBy) Ints

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

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

func (*FileGroupBy) IntsX

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

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

func (*FileGroupBy) Scan

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

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

func (*FileGroupBy) ScanX

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

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

func (*FileGroupBy) String

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

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

func (*FileGroupBy) StringX

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

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

func (*FileGroupBy) Strings

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

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

func (*FileGroupBy) StringsX

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

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

type FileMutation

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

FileMutation represents an operation that mutates the File nodes in the graph.

func (*FileMutation) AddDownloads

func (m *FileMutation) AddDownloads(i int64)

AddDownloads adds i to the "downloads" field.

func (*FileMutation) AddField

func (m *FileMutation) 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 (*FileMutation) AddSize

func (m *FileMutation) AddSize(i int64)

AddSize adds i to the "size" field.

func (*FileMutation) AddedDownloads

func (m *FileMutation) AddedDownloads() (r int64, exists bool)

AddedDownloads returns the value that was added to the "downloads" field in this mutation.

func (*FileMutation) AddedEdges

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

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

func (*FileMutation) AddedField

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

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

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

func (*FileMutation) AddedIDs

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

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

func (*FileMutation) AddedSize

func (m *FileMutation) AddedSize() (r int64, exists bool)

AddedSize returns the value that was added to the "size" field in this mutation.

func (*FileMutation) ClearEdge

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

func (m *FileMutation) 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 (*FileMutation) ClearFolder

func (m *FileMutation) ClearFolder()

ClearFolder clears the "folder" edge to the Folder entity.

func (*FileMutation) ClearedEdges

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

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

func (*FileMutation) ClearedFields

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

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

func (FileMutation) Client

func (m FileMutation) 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 (*FileMutation) ContentType

func (m *FileMutation) ContentType() (r string, exists bool)

ContentType returns the value of the "content_type" field in the mutation.

func (*FileMutation) CreatedAt

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

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

func (*FileMutation) Downloads

func (m *FileMutation) Downloads() (r int64, exists bool)

Downloads returns the value of the "downloads" field in the mutation.

func (*FileMutation) EdgeCleared

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

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

func (*FileMutation) Field

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

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

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

func (*FileMutation) Fields

func (m *FileMutation) 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 (*FileMutation) FolderCleared

func (m *FileMutation) FolderCleared() bool

FolderCleared reports if the "folder" edge to the Folder entity was cleared.

func (*FileMutation) FolderID

func (m *FileMutation) FolderID() (r string, exists bool)

FolderID returns the value of the "folder_id" field in the mutation.

func (*FileMutation) FolderIDs

func (m *FileMutation) FolderIDs() (ids []string)

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

func (*FileMutation) ID

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

func (m *FileMutation) IDs(ctx context.Context) ([]string, 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 (*FileMutation) Md5

func (m *FileMutation) Md5() (r string, exists bool)

Md5 returns the value of the "md5" field in the mutation.

func (*FileMutation) Name

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

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

func (*FileMutation) OldContentType

func (m *FileMutation) OldContentType(ctx context.Context) (v string, err error)

OldContentType returns the old "content_type" field's value of the File entity. If the File 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 (*FileMutation) OldCreatedAt

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

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

func (m *FileMutation) OldDownloads(ctx context.Context) (v int64, err error)

OldDownloads returns the old "downloads" field's value of the File entity. If the File 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 (*FileMutation) OldField

func (m *FileMutation) 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 (*FileMutation) OldFolderID

func (m *FileMutation) OldFolderID(ctx context.Context) (v string, err error)

OldFolderID returns the old "folder_id" field's value of the File entity. If the File 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 (*FileMutation) OldMd5

func (m *FileMutation) OldMd5(ctx context.Context) (v string, err error)

OldMd5 returns the old "md5" field's value of the File entity. If the File 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 (*FileMutation) OldName

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

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

func (m *FileMutation) OldSize(ctx context.Context) (v int64, err error)

OldSize returns the old "size" field's value of the File entity. If the File 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 (*FileMutation) OldUpdatedAt

func (m *FileMutation) OldUpdatedAt(ctx context.Context) (v time.Time, err error)

OldUpdatedAt returns the old "updated_at" field's value of the File entity. If the File 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 (*FileMutation) Op

func (m *FileMutation) Op() Op

Op returns the operation name.

func (*FileMutation) RemovedEdges

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

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

func (*FileMutation) RemovedIDs

func (m *FileMutation) 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 (*FileMutation) ResetContentType

func (m *FileMutation) ResetContentType()

ResetContentType resets all changes to the "content_type" field.

func (*FileMutation) ResetCreatedAt

func (m *FileMutation) ResetCreatedAt()

ResetCreatedAt resets all changes to the "created_at" field.

func (*FileMutation) ResetDownloads

func (m *FileMutation) ResetDownloads()

ResetDownloads resets all changes to the "downloads" field.

func (*FileMutation) ResetEdge

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

func (m *FileMutation) 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 (*FileMutation) ResetFolder

func (m *FileMutation) ResetFolder()

ResetFolder resets all changes to the "folder" edge.

func (*FileMutation) ResetFolderID

func (m *FileMutation) ResetFolderID()

ResetFolderID resets all changes to the "folder_id" field.

func (*FileMutation) ResetMd5

func (m *FileMutation) ResetMd5()

ResetMd5 resets all changes to the "md5" field.

func (*FileMutation) ResetName

func (m *FileMutation) ResetName()

ResetName resets all changes to the "name" field.

func (*FileMutation) ResetSize

func (m *FileMutation) ResetSize()

ResetSize resets all changes to the "size" field.

func (*FileMutation) ResetUpdatedAt

func (m *FileMutation) ResetUpdatedAt()

ResetUpdatedAt resets all changes to the "updated_at" field.

func (*FileMutation) SetContentType

func (m *FileMutation) SetContentType(s string)

SetContentType sets the "content_type" field.

func (*FileMutation) SetCreatedAt

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

SetCreatedAt sets the "created_at" field.

func (*FileMutation) SetDownloads

func (m *FileMutation) SetDownloads(i int64)

SetDownloads sets the "downloads" field.

func (*FileMutation) SetField

func (m *FileMutation) 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 (*FileMutation) SetFolderID

func (m *FileMutation) SetFolderID(s string)

SetFolderID sets the "folder_id" field.

func (*FileMutation) SetID

func (m *FileMutation) SetID(id string)

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

func (*FileMutation) SetMd5

func (m *FileMutation) SetMd5(s string)

SetMd5 sets the "md5" field.

func (*FileMutation) SetName

func (m *FileMutation) SetName(s string)

SetName sets the "name" field.

func (*FileMutation) SetOp

func (m *FileMutation) SetOp(op Op)

SetOp allows setting the mutation operation.

func (*FileMutation) SetSize

func (m *FileMutation) SetSize(i int64)

SetSize sets the "size" field.

func (*FileMutation) SetUpdatedAt

func (m *FileMutation) SetUpdatedAt(t time.Time)

SetUpdatedAt sets the "updated_at" field.

func (*FileMutation) Size

func (m *FileMutation) Size() (r int64, exists bool)

Size returns the value of the "size" field in the mutation.

func (FileMutation) Tx

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

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

func (*FileMutation) Type

func (m *FileMutation) Type() string

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

func (*FileMutation) UpdatedAt

func (m *FileMutation) UpdatedAt() (r time.Time, exists bool)

UpdatedAt returns the value of the "updated_at" field in the mutation.

func (*FileMutation) Where

func (m *FileMutation) Where(ps ...predicate.File)

Where appends a list predicates to the FileMutation builder.

func (*FileMutation) WhereP

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

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

type FileQuery

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

FileQuery is the builder for querying File entities.

func (*FileQuery) Aggregate

func (fq *FileQuery) Aggregate(fns ...AggregateFunc) *FileSelect

Aggregate returns a FileSelect configured with the given aggregations.

func (*FileQuery) All

func (fq *FileQuery) All(ctx context.Context) ([]*File, error)

All executes the query and returns a list of Files.

func (*FileQuery) AllX

func (fq *FileQuery) AllX(ctx context.Context) []*File

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

func (*FileQuery) Clone

func (fq *FileQuery) Clone() *FileQuery

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

func (*FileQuery) Count

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

Count returns the count of the given query.

func (*FileQuery) CountX

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

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

func (*FileQuery) Exist

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

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

func (*FileQuery) ExistX

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

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

func (*FileQuery) First

func (fq *FileQuery) First(ctx context.Context) (*File, error)

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

func (*FileQuery) FirstID

func (fq *FileQuery) FirstID(ctx context.Context) (id string, err error)

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

func (*FileQuery) FirstIDX

func (fq *FileQuery) FirstIDX(ctx context.Context) string

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

func (*FileQuery) FirstX

func (fq *FileQuery) FirstX(ctx context.Context) *File

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

func (*FileQuery) GroupBy

func (fq *FileQuery) GroupBy(field string, fields ...string) *FileGroupBy

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

client.File.Query().
	GroupBy(file.FieldFolderID).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*FileQuery) IDs

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

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

func (*FileQuery) IDsX

func (fq *FileQuery) IDsX(ctx context.Context) []string

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

func (*FileQuery) Limit

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

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

func (*FileQuery) Offset

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

Offset to start from.

func (*FileQuery) Only

func (fq *FileQuery) Only(ctx context.Context) (*File, error)

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

func (*FileQuery) OnlyID

func (fq *FileQuery) OnlyID(ctx context.Context) (id string, err error)

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

func (*FileQuery) OnlyIDX

func (fq *FileQuery) OnlyIDX(ctx context.Context) string

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

func (*FileQuery) OnlyX

func (fq *FileQuery) OnlyX(ctx context.Context) *File

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

func (*FileQuery) Order

func (fq *FileQuery) Order(o ...file.OrderOption) *FileQuery

Order specifies how the records should be ordered.

func (*FileQuery) QueryFolder

func (fq *FileQuery) QueryFolder() *FolderQuery

QueryFolder chains the current query on the "folder" edge.

func (*FileQuery) Select

func (fq *FileQuery) Select(fields ...string) *FileSelect

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

client.File.Query().
	Select(file.FieldFolderID).
	Scan(ctx, &v)

func (*FileQuery) Unique

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

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

func (fq *FileQuery) Where(ps ...predicate.File) *FileQuery

Where adds a new predicate for the FileQuery builder.

func (*FileQuery) WithFolder

func (fq *FileQuery) WithFolder(opts ...func(*FolderQuery)) *FileQuery

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

type FileSelect

type FileSelect struct {
	*FileQuery
	// contains filtered or unexported fields
}

FileSelect is the builder for selecting fields of File entities.

func (*FileSelect) Aggregate

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

Aggregate adds the given aggregation functions to the selector query.

func (*FileSelect) Bool

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

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

func (*FileSelect) BoolX

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

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

func (*FileSelect) Bools

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

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

func (*FileSelect) BoolsX

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

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

func (*FileSelect) Float64

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

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

func (*FileSelect) Float64X

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

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

func (*FileSelect) Float64s

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

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

func (*FileSelect) Float64sX

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

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

func (*FileSelect) Int

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

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

func (*FileSelect) IntX

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

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

func (*FileSelect) Ints

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

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

func (*FileSelect) IntsX

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

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

func (*FileSelect) Scan

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

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

func (*FileSelect) ScanX

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

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

func (*FileSelect) String

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

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

func (*FileSelect) StringX

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

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

func (*FileSelect) Strings

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

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

func (*FileSelect) StringsX

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

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

type FileUpdate

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

FileUpdate is the builder for updating File entities.

func (*FileUpdate) AddDownloads

func (fu *FileUpdate) AddDownloads(i int64) *FileUpdate

AddDownloads adds i to the "downloads" field.

func (*FileUpdate) AddSize

func (fu *FileUpdate) AddSize(i int64) *FileUpdate

AddSize adds i to the "size" field.

func (*FileUpdate) ClearFolder

func (fu *FileUpdate) ClearFolder() *FileUpdate

ClearFolder clears the "folder" edge to the Folder entity.

func (*FileUpdate) Exec

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

Exec executes the query.

func (*FileUpdate) ExecX

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

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

func (*FileUpdate) Mutation

func (fu *FileUpdate) Mutation() *FileMutation

Mutation returns the FileMutation object of the builder.

func (*FileUpdate) Save

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

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

func (*FileUpdate) SaveX

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

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

func (*FileUpdate) SetContentType

func (fu *FileUpdate) SetContentType(s string) *FileUpdate

SetContentType sets the "content_type" field.

func (*FileUpdate) SetDownloads

func (fu *FileUpdate) SetDownloads(i int64) *FileUpdate

SetDownloads sets the "downloads" field.

func (*FileUpdate) SetFolder

func (fu *FileUpdate) SetFolder(f *Folder) *FileUpdate

SetFolder sets the "folder" edge to the Folder entity.

func (*FileUpdate) SetFolderID

func (fu *FileUpdate) SetFolderID(s string) *FileUpdate

SetFolderID sets the "folder_id" field.

func (*FileUpdate) SetMd5

func (fu *FileUpdate) SetMd5(s string) *FileUpdate

SetMd5 sets the "md5" field.

func (*FileUpdate) SetName

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

SetName sets the "name" field.

func (*FileUpdate) SetNillableContentType added in v1.1.4

func (fu *FileUpdate) SetNillableContentType(s *string) *FileUpdate

SetNillableContentType sets the "content_type" field if the given value is not nil.

func (*FileUpdate) SetNillableDownloads

func (fu *FileUpdate) SetNillableDownloads(i *int64) *FileUpdate

SetNillableDownloads sets the "downloads" field if the given value is not nil.

func (*FileUpdate) SetNillableFolderID added in v1.1.4

func (fu *FileUpdate) SetNillableFolderID(s *string) *FileUpdate

SetNillableFolderID sets the "folder_id" field if the given value is not nil.

func (*FileUpdate) SetNillableMd5 added in v1.1.4

func (fu *FileUpdate) SetNillableMd5(s *string) *FileUpdate

SetNillableMd5 sets the "md5" field if the given value is not nil.

func (*FileUpdate) SetNillableName added in v1.1.4

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

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

func (*FileUpdate) SetNillableSize added in v1.1.4

func (fu *FileUpdate) SetNillableSize(i *int64) *FileUpdate

SetNillableSize sets the "size" field if the given value is not nil.

func (*FileUpdate) SetSize

func (fu *FileUpdate) SetSize(i int64) *FileUpdate

SetSize sets the "size" field.

func (*FileUpdate) SetUpdatedAt

func (fu *FileUpdate) SetUpdatedAt(t time.Time) *FileUpdate

SetUpdatedAt sets the "updated_at" field.

func (*FileUpdate) Where

func (fu *FileUpdate) Where(ps ...predicate.File) *FileUpdate

Where appends a list predicates to the FileUpdate builder.

type FileUpdateOne

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

FileUpdateOne is the builder for updating a single File entity.

func (*FileUpdateOne) AddDownloads

func (fuo *FileUpdateOne) AddDownloads(i int64) *FileUpdateOne

AddDownloads adds i to the "downloads" field.

func (*FileUpdateOne) AddSize

func (fuo *FileUpdateOne) AddSize(i int64) *FileUpdateOne

AddSize adds i to the "size" field.

func (*FileUpdateOne) ClearFolder

func (fuo *FileUpdateOne) ClearFolder() *FileUpdateOne

ClearFolder clears the "folder" edge to the Folder entity.

func (*FileUpdateOne) Exec

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

Exec executes the query on the entity.

func (*FileUpdateOne) ExecX

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

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

func (*FileUpdateOne) Mutation

func (fuo *FileUpdateOne) Mutation() *FileMutation

Mutation returns the FileMutation object of the builder.

func (*FileUpdateOne) Save

func (fuo *FileUpdateOne) Save(ctx context.Context) (*File, error)

Save executes the query and returns the updated File entity.

func (*FileUpdateOne) SaveX

func (fuo *FileUpdateOne) SaveX(ctx context.Context) *File

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

func (*FileUpdateOne) Select

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

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

func (*FileUpdateOne) SetContentType

func (fuo *FileUpdateOne) SetContentType(s string) *FileUpdateOne

SetContentType sets the "content_type" field.

func (*FileUpdateOne) SetDownloads

func (fuo *FileUpdateOne) SetDownloads(i int64) *FileUpdateOne

SetDownloads sets the "downloads" field.

func (*FileUpdateOne) SetFolder

func (fuo *FileUpdateOne) SetFolder(f *Folder) *FileUpdateOne

SetFolder sets the "folder" edge to the Folder entity.

func (*FileUpdateOne) SetFolderID

func (fuo *FileUpdateOne) SetFolderID(s string) *FileUpdateOne

SetFolderID sets the "folder_id" field.

func (*FileUpdateOne) SetMd5

func (fuo *FileUpdateOne) SetMd5(s string) *FileUpdateOne

SetMd5 sets the "md5" field.

func (*FileUpdateOne) SetName

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

SetName sets the "name" field.

func (*FileUpdateOne) SetNillableContentType added in v1.1.4

func (fuo *FileUpdateOne) SetNillableContentType(s *string) *FileUpdateOne

SetNillableContentType sets the "content_type" field if the given value is not nil.

func (*FileUpdateOne) SetNillableDownloads

func (fuo *FileUpdateOne) SetNillableDownloads(i *int64) *FileUpdateOne

SetNillableDownloads sets the "downloads" field if the given value is not nil.

func (*FileUpdateOne) SetNillableFolderID added in v1.1.4

func (fuo *FileUpdateOne) SetNillableFolderID(s *string) *FileUpdateOne

SetNillableFolderID sets the "folder_id" field if the given value is not nil.

func (*FileUpdateOne) SetNillableMd5 added in v1.1.4

func (fuo *FileUpdateOne) SetNillableMd5(s *string) *FileUpdateOne

SetNillableMd5 sets the "md5" field if the given value is not nil.

func (*FileUpdateOne) SetNillableName added in v1.1.4

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

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

func (*FileUpdateOne) SetNillableSize added in v1.1.4

func (fuo *FileUpdateOne) SetNillableSize(i *int64) *FileUpdateOne

SetNillableSize sets the "size" field if the given value is not nil.

func (*FileUpdateOne) SetSize

func (fuo *FileUpdateOne) SetSize(i int64) *FileUpdateOne

SetSize sets the "size" field.

func (*FileUpdateOne) SetUpdatedAt

func (fuo *FileUpdateOne) SetUpdatedAt(t time.Time) *FileUpdateOne

SetUpdatedAt sets the "updated_at" field.

func (*FileUpdateOne) Where added in v1.1.0

func (fuo *FileUpdateOne) Where(ps ...predicate.File) *FileUpdateOne

Where appends a list predicates to the FileUpdate builder.

type FileUpsert added in v1.1.0

type FileUpsert struct {
	*sql.UpdateSet
}

FileUpsert is the "OnConflict" setter.

func (*FileUpsert) AddDownloads added in v1.1.0

func (u *FileUpsert) AddDownloads(v int64) *FileUpsert

AddDownloads adds v to the "downloads" field.

func (*FileUpsert) AddSize added in v1.1.0

func (u *FileUpsert) AddSize(v int64) *FileUpsert

AddSize adds v to the "size" field.

func (*FileUpsert) SetContentType added in v1.1.0

func (u *FileUpsert) SetContentType(v string) *FileUpsert

SetContentType sets the "content_type" field.

func (*FileUpsert) SetDownloads added in v1.1.0

func (u *FileUpsert) SetDownloads(v int64) *FileUpsert

SetDownloads sets the "downloads" field.

func (*FileUpsert) SetFolderID added in v1.1.0

func (u *FileUpsert) SetFolderID(v string) *FileUpsert

SetFolderID sets the "folder_id" field.

func (*FileUpsert) SetMd5 added in v1.1.0

func (u *FileUpsert) SetMd5(v string) *FileUpsert

SetMd5 sets the "md5" field.

func (*FileUpsert) SetName added in v1.1.0

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

SetName sets the "name" field.

func (*FileUpsert) SetSize added in v1.1.0

func (u *FileUpsert) SetSize(v int64) *FileUpsert

SetSize sets the "size" field.

func (*FileUpsert) SetUpdatedAt added in v1.1.0

func (u *FileUpsert) SetUpdatedAt(v time.Time) *FileUpsert

SetUpdatedAt sets the "updated_at" field.

func (*FileUpsert) UpdateContentType added in v1.1.0

func (u *FileUpsert) UpdateContentType() *FileUpsert

UpdateContentType sets the "content_type" field to the value that was provided on create.

func (*FileUpsert) UpdateDownloads added in v1.1.0

func (u *FileUpsert) UpdateDownloads() *FileUpsert

UpdateDownloads sets the "downloads" field to the value that was provided on create.

func (*FileUpsert) UpdateFolderID added in v1.1.0

func (u *FileUpsert) UpdateFolderID() *FileUpsert

UpdateFolderID sets the "folder_id" field to the value that was provided on create.

func (*FileUpsert) UpdateMd5 added in v1.1.0

func (u *FileUpsert) UpdateMd5() *FileUpsert

UpdateMd5 sets the "md5" field to the value that was provided on create.

func (*FileUpsert) UpdateName added in v1.1.0

func (u *FileUpsert) UpdateName() *FileUpsert

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

func (*FileUpsert) UpdateSize added in v1.1.0

func (u *FileUpsert) UpdateSize() *FileUpsert

UpdateSize sets the "size" field to the value that was provided on create.

func (*FileUpsert) UpdateUpdatedAt added in v1.1.0

func (u *FileUpsert) UpdateUpdatedAt() *FileUpsert

UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create.

type FileUpsertBulk added in v1.1.0

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

FileUpsertBulk is the builder for "upsert"-ing a bulk of File nodes.

func (*FileUpsertBulk) AddDownloads added in v1.1.0

func (u *FileUpsertBulk) AddDownloads(v int64) *FileUpsertBulk

AddDownloads adds v to the "downloads" field.

func (*FileUpsertBulk) AddSize added in v1.1.0

func (u *FileUpsertBulk) AddSize(v int64) *FileUpsertBulk

AddSize adds v to the "size" field.

func (*FileUpsertBulk) DoNothing added in v1.1.0

func (u *FileUpsertBulk) DoNothing() *FileUpsertBulk

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

func (*FileUpsertBulk) Exec added in v1.1.0

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

Exec executes the query.

func (*FileUpsertBulk) ExecX added in v1.1.0

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

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

func (*FileUpsertBulk) Ignore added in v1.1.0

func (u *FileUpsertBulk) Ignore() *FileUpsertBulk

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

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

func (*FileUpsertBulk) SetContentType added in v1.1.0

func (u *FileUpsertBulk) SetContentType(v string) *FileUpsertBulk

SetContentType sets the "content_type" field.

func (*FileUpsertBulk) SetDownloads added in v1.1.0

func (u *FileUpsertBulk) SetDownloads(v int64) *FileUpsertBulk

SetDownloads sets the "downloads" field.

func (*FileUpsertBulk) SetFolderID added in v1.1.0

func (u *FileUpsertBulk) SetFolderID(v string) *FileUpsertBulk

SetFolderID sets the "folder_id" field.

func (*FileUpsertBulk) SetMd5 added in v1.1.0

func (u *FileUpsertBulk) SetMd5(v string) *FileUpsertBulk

SetMd5 sets the "md5" field.

func (*FileUpsertBulk) SetName added in v1.1.0

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

SetName sets the "name" field.

func (*FileUpsertBulk) SetSize added in v1.1.0

func (u *FileUpsertBulk) SetSize(v int64) *FileUpsertBulk

SetSize sets the "size" field.

func (*FileUpsertBulk) SetUpdatedAt added in v1.1.0

func (u *FileUpsertBulk) SetUpdatedAt(v time.Time) *FileUpsertBulk

SetUpdatedAt sets the "updated_at" field.

func (*FileUpsertBulk) Update added in v1.1.0

func (u *FileUpsertBulk) Update(set func(*FileUpsert)) *FileUpsertBulk

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

func (*FileUpsertBulk) UpdateContentType added in v1.1.0

func (u *FileUpsertBulk) UpdateContentType() *FileUpsertBulk

UpdateContentType sets the "content_type" field to the value that was provided on create.

func (*FileUpsertBulk) UpdateDownloads added in v1.1.0

func (u *FileUpsertBulk) UpdateDownloads() *FileUpsertBulk

UpdateDownloads sets the "downloads" field to the value that was provided on create.

func (*FileUpsertBulk) UpdateFolderID added in v1.1.0

func (u *FileUpsertBulk) UpdateFolderID() *FileUpsertBulk

UpdateFolderID sets the "folder_id" field to the value that was provided on create.

func (*FileUpsertBulk) UpdateMd5 added in v1.1.0

func (u *FileUpsertBulk) UpdateMd5() *FileUpsertBulk

UpdateMd5 sets the "md5" field to the value that was provided on create.

func (*FileUpsertBulk) UpdateName added in v1.1.0

func (u *FileUpsertBulk) UpdateName() *FileUpsertBulk

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

func (*FileUpsertBulk) UpdateNewValues added in v1.1.0

func (u *FileUpsertBulk) UpdateNewValues() *FileUpsertBulk

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

client.File.Create().
	OnConflict(
		sql.ResolveWithNewValues(),
		sql.ResolveWith(func(u *sql.UpdateSet) {
			u.SetIgnore(file.FieldID)
		}),
	).
	Exec(ctx)

func (*FileUpsertBulk) UpdateSize added in v1.1.0

func (u *FileUpsertBulk) UpdateSize() *FileUpsertBulk

UpdateSize sets the "size" field to the value that was provided on create.

func (*FileUpsertBulk) UpdateUpdatedAt added in v1.1.0

func (u *FileUpsertBulk) UpdateUpdatedAt() *FileUpsertBulk

UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create.

type FileUpsertOne added in v1.1.0

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

FileUpsertOne is the builder for "upsert"-ing

one File node.

func (*FileUpsertOne) AddDownloads added in v1.1.0

func (u *FileUpsertOne) AddDownloads(v int64) *FileUpsertOne

AddDownloads adds v to the "downloads" field.

func (*FileUpsertOne) AddSize added in v1.1.0

func (u *FileUpsertOne) AddSize(v int64) *FileUpsertOne

AddSize adds v to the "size" field.

func (*FileUpsertOne) DoNothing added in v1.1.0

func (u *FileUpsertOne) DoNothing() *FileUpsertOne

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

func (*FileUpsertOne) Exec added in v1.1.0

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

Exec executes the query.

func (*FileUpsertOne) ExecX added in v1.1.0

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

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

func (*FileUpsertOne) ID added in v1.1.0

func (u *FileUpsertOne) ID(ctx context.Context) (id string, err error)

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

func (*FileUpsertOne) IDX added in v1.1.0

func (u *FileUpsertOne) IDX(ctx context.Context) string

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

func (*FileUpsertOne) Ignore added in v1.1.0

func (u *FileUpsertOne) Ignore() *FileUpsertOne

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

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

func (*FileUpsertOne) SetContentType added in v1.1.0

func (u *FileUpsertOne) SetContentType(v string) *FileUpsertOne

SetContentType sets the "content_type" field.

func (*FileUpsertOne) SetDownloads added in v1.1.0

func (u *FileUpsertOne) SetDownloads(v int64) *FileUpsertOne

SetDownloads sets the "downloads" field.

func (*FileUpsertOne) SetFolderID added in v1.1.0

func (u *FileUpsertOne) SetFolderID(v string) *FileUpsertOne

SetFolderID sets the "folder_id" field.

func (*FileUpsertOne) SetMd5 added in v1.1.0

func (u *FileUpsertOne) SetMd5(v string) *FileUpsertOne

SetMd5 sets the "md5" field.

func (*FileUpsertOne) SetName added in v1.1.0

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

SetName sets the "name" field.

func (*FileUpsertOne) SetSize added in v1.1.0

func (u *FileUpsertOne) SetSize(v int64) *FileUpsertOne

SetSize sets the "size" field.

func (*FileUpsertOne) SetUpdatedAt added in v1.1.0

func (u *FileUpsertOne) SetUpdatedAt(v time.Time) *FileUpsertOne

SetUpdatedAt sets the "updated_at" field.

func (*FileUpsertOne) Update added in v1.1.0

func (u *FileUpsertOne) Update(set func(*FileUpsert)) *FileUpsertOne

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

func (*FileUpsertOne) UpdateContentType added in v1.1.0

func (u *FileUpsertOne) UpdateContentType() *FileUpsertOne

UpdateContentType sets the "content_type" field to the value that was provided on create.

func (*FileUpsertOne) UpdateDownloads added in v1.1.0

func (u *FileUpsertOne) UpdateDownloads() *FileUpsertOne

UpdateDownloads sets the "downloads" field to the value that was provided on create.

func (*FileUpsertOne) UpdateFolderID added in v1.1.0

func (u *FileUpsertOne) UpdateFolderID() *FileUpsertOne

UpdateFolderID sets the "folder_id" field to the value that was provided on create.

func (*FileUpsertOne) UpdateMd5 added in v1.1.0

func (u *FileUpsertOne) UpdateMd5() *FileUpsertOne

UpdateMd5 sets the "md5" field to the value that was provided on create.

func (*FileUpsertOne) UpdateName added in v1.1.0

func (u *FileUpsertOne) UpdateName() *FileUpsertOne

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

func (*FileUpsertOne) UpdateNewValues added in v1.1.0

func (u *FileUpsertOne) UpdateNewValues() *FileUpsertOne

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

client.File.Create().
	OnConflict(
		sql.ResolveWithNewValues(),
		sql.ResolveWith(func(u *sql.UpdateSet) {
			u.SetIgnore(file.FieldID)
		}),
	).
	Exec(ctx)

func (*FileUpsertOne) UpdateSize added in v1.1.0

func (u *FileUpsertOne) UpdateSize() *FileUpsertOne

UpdateSize sets the "size" field to the value that was provided on create.

func (*FileUpsertOne) UpdateUpdatedAt added in v1.1.0

func (u *FileUpsertOne) UpdateUpdatedAt() *FileUpsertOne

UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create.

type Files

type Files []*File

Files is a parsable slice of File.

type Folder

type Folder struct {

	// ID of the ent.
	ID string `json:"id,omitempty"`
	// SpaceID holds the value of the "space_id" field.
	SpaceID string `json:"space_id,omitempty"`
	// Name holds the value of the "name" field.
	Name string `json:"name,omitempty"`
	// CreatedAt holds the value of the "created_at" field.
	CreatedAt time.Time `json:"created_at,omitempty"`
	// UpdatedAt holds the value of the "updated_at" field.
	UpdatedAt time.Time `json:"updated_at,omitempty"`
	// ExpiresAt holds the value of the "expires_at" field.
	ExpiresAt time.Time `json:"expires_at,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the FolderQuery when eager-loading is set.
	Edges FolderEdges `json:"edges"`
	// contains filtered or unexported fields
}

Folder is the model entity for the Folder schema.

func (*Folder) QueryFiles

func (f *Folder) QueryFiles() *FileQuery

QueryFiles queries the "files" edge of the Folder entity.

func (*Folder) QuerySpace

func (f *Folder) QuerySpace() *SpaceQuery

QuerySpace queries the "space" edge of the Folder entity.

func (*Folder) String

func (f *Folder) String() string

String implements the fmt.Stringer.

func (*Folder) Unwrap

func (f *Folder) Unwrap() *Folder

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

func (f *Folder) Update() *FolderUpdateOne

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

func (*Folder) Value added in v1.1.1

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

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

type FolderClient

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

FolderClient is a client for the Folder schema.

func NewFolderClient

func NewFolderClient(c config) *FolderClient

NewFolderClient returns a client for the Folder from the given config.

func (*FolderClient) Create

func (c *FolderClient) Create() *FolderCreate

Create returns a builder for creating a Folder entity.

func (*FolderClient) CreateBulk

func (c *FolderClient) CreateBulk(builders ...*FolderCreate) *FolderCreateBulk

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

func (*FolderClient) Delete

func (c *FolderClient) Delete() *FolderDelete

Delete returns a delete builder for Folder.

func (*FolderClient) DeleteOne

func (c *FolderClient) DeleteOne(f *Folder) *FolderDeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*FolderClient) DeleteOneID

func (c *FolderClient) DeleteOneID(id string) *FolderDeleteOne

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

func (*FolderClient) Get

func (c *FolderClient) Get(ctx context.Context, id string) (*Folder, error)

Get returns a Folder entity by its id.

func (*FolderClient) GetX

func (c *FolderClient) GetX(ctx context.Context, id string) *Folder

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

func (*FolderClient) Hooks

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

Hooks returns the client hooks.

func (*FolderClient) Intercept

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

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

func (*FolderClient) Interceptors

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

Interceptors returns the client interceptors.

func (*FolderClient) MapCreateBulk added in v1.1.4

func (c *FolderClient) MapCreateBulk(slice any, setFunc func(*FolderCreate, int)) *FolderCreateBulk

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

func (c *FolderClient) Query() *FolderQuery

Query returns a query builder for Folder.

func (*FolderClient) QueryFiles

func (c *FolderClient) QueryFiles(f *Folder) *FileQuery

QueryFiles queries the files edge of a Folder.

func (*FolderClient) QuerySpace

func (c *FolderClient) QuerySpace(f *Folder) *SpaceQuery

QuerySpace queries the space edge of a Folder.

func (*FolderClient) Update

func (c *FolderClient) Update() *FolderUpdate

Update returns an update builder for Folder.

func (*FolderClient) UpdateOne

func (c *FolderClient) UpdateOne(f *Folder) *FolderUpdateOne

UpdateOne returns an update builder for the given entity.

func (*FolderClient) UpdateOneID

func (c *FolderClient) UpdateOneID(id string) *FolderUpdateOne

UpdateOneID returns an update builder for the given id.

func (*FolderClient) Use

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

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

type FolderCreate

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

FolderCreate is the builder for creating a Folder entity.

func (*FolderCreate) AddFileIDs

func (fc *FolderCreate) AddFileIDs(ids ...string) *FolderCreate

AddFileIDs adds the "files" edge to the File entity by IDs.

func (*FolderCreate) AddFiles

func (fc *FolderCreate) AddFiles(f ...*File) *FolderCreate

AddFiles adds the "files" edges to the File entity.

func (*FolderCreate) Exec

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

Exec executes the query.

func (*FolderCreate) ExecX

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

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

func (*FolderCreate) Mutation

func (fc *FolderCreate) Mutation() *FolderMutation

Mutation returns the FolderMutation object of the builder.

func (*FolderCreate) OnConflict added in v1.1.0

func (fc *FolderCreate) OnConflict(opts ...sql.ConflictOption) *FolderUpsertOne

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

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

func (*FolderCreate) OnConflictColumns added in v1.1.0

func (fc *FolderCreate) OnConflictColumns(columns ...string) *FolderUpsertOne

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

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

func (*FolderCreate) Save

func (fc *FolderCreate) Save(ctx context.Context) (*Folder, error)

Save creates the Folder in the database.

func (*FolderCreate) SaveX

func (fc *FolderCreate) SaveX(ctx context.Context) *Folder

SaveX calls Save and panics if Save returns an error.

func (*FolderCreate) SetCreatedAt

func (fc *FolderCreate) SetCreatedAt(t time.Time) *FolderCreate

SetCreatedAt sets the "created_at" field.

func (*FolderCreate) SetExpiresAt

func (fc *FolderCreate) SetExpiresAt(t time.Time) *FolderCreate

SetExpiresAt sets the "expires_at" field.

func (*FolderCreate) SetID

func (fc *FolderCreate) SetID(s string) *FolderCreate

SetID sets the "id" field.

func (*FolderCreate) SetName

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

SetName sets the "name" field.

func (*FolderCreate) SetNillableCreatedAt

func (fc *FolderCreate) SetNillableCreatedAt(t *time.Time) *FolderCreate

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

func (*FolderCreate) SetNillableExpiresAt

func (fc *FolderCreate) SetNillableExpiresAt(t *time.Time) *FolderCreate

SetNillableExpiresAt sets the "expires_at" field if the given value is not nil.

func (*FolderCreate) SetNillableID

func (fc *FolderCreate) SetNillableID(s *string) *FolderCreate

SetNillableID sets the "id" field if the given value is not nil.

func (*FolderCreate) SetNillableUpdatedAt

func (fc *FolderCreate) SetNillableUpdatedAt(t *time.Time) *FolderCreate

SetNillableUpdatedAt sets the "updated_at" field if the given value is not nil.

func (*FolderCreate) SetSpace

func (fc *FolderCreate) SetSpace(s *Space) *FolderCreate

SetSpace sets the "space" edge to the Space entity.

func (*FolderCreate) SetSpaceID

func (fc *FolderCreate) SetSpaceID(s string) *FolderCreate

SetSpaceID sets the "space_id" field.

func (*FolderCreate) SetUpdatedAt

func (fc *FolderCreate) SetUpdatedAt(t time.Time) *FolderCreate

SetUpdatedAt sets the "updated_at" field.

type FolderCreateBulk

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

FolderCreateBulk is the builder for creating many Folder entities in bulk.

func (*FolderCreateBulk) Exec

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

Exec executes the query.

func (*FolderCreateBulk) ExecX

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

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

func (*FolderCreateBulk) OnConflict added in v1.1.0

func (fcb *FolderCreateBulk) OnConflict(opts ...sql.ConflictOption) *FolderUpsertBulk

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

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

func (*FolderCreateBulk) OnConflictColumns added in v1.1.0

func (fcb *FolderCreateBulk) OnConflictColumns(columns ...string) *FolderUpsertBulk

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

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

func (*FolderCreateBulk) Save

func (fcb *FolderCreateBulk) Save(ctx context.Context) ([]*Folder, error)

Save creates the Folder entities in the database.

func (*FolderCreateBulk) SaveX

func (fcb *FolderCreateBulk) SaveX(ctx context.Context) []*Folder

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

type FolderDelete

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

FolderDelete is the builder for deleting a Folder entity.

func (*FolderDelete) Exec

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

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

func (*FolderDelete) ExecX

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

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

func (*FolderDelete) Where

func (fd *FolderDelete) Where(ps ...predicate.Folder) *FolderDelete

Where appends a list predicates to the FolderDelete builder.

type FolderDeleteOne

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

FolderDeleteOne is the builder for deleting a single Folder entity.

func (*FolderDeleteOne) Exec

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

Exec executes the deletion query.

func (*FolderDeleteOne) ExecX

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

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

func (*FolderDeleteOne) Where added in v1.1.0

func (fdo *FolderDeleteOne) Where(ps ...predicate.Folder) *FolderDeleteOne

Where appends a list predicates to the FolderDelete builder.

type FolderEdges

type FolderEdges struct {
	// Space holds the value of the space edge.
	Space *Space `json:"space,omitempty"`
	// Files holds the value of the files edge.
	Files []*File `json:"files,omitempty"`
	// contains filtered or unexported fields
}

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

func (FolderEdges) FilesOrErr

func (e FolderEdges) FilesOrErr() ([]*File, error)

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

func (FolderEdges) SpaceOrErr

func (e FolderEdges) SpaceOrErr() (*Space, error)

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

type FolderGroupBy

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

FolderGroupBy is the group-by builder for Folder entities.

func (*FolderGroupBy) Aggregate

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

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

func (*FolderGroupBy) Bool

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

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

func (*FolderGroupBy) BoolX

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

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

func (*FolderGroupBy) Bools

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

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

func (*FolderGroupBy) BoolsX

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

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

func (*FolderGroupBy) Float64

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

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

func (*FolderGroupBy) Float64X

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

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

func (*FolderGroupBy) Float64s

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

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

func (*FolderGroupBy) Float64sX

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

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

func (*FolderGroupBy) Int

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

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

func (*FolderGroupBy) IntX

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

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

func (*FolderGroupBy) Ints

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

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

func (*FolderGroupBy) IntsX

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

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

func (*FolderGroupBy) Scan

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

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

func (*FolderGroupBy) ScanX

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

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

func (*FolderGroupBy) String

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

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

func (*FolderGroupBy) StringX

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

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

func (*FolderGroupBy) Strings

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

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

func (*FolderGroupBy) StringsX

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

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

type FolderMutation

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

FolderMutation represents an operation that mutates the Folder nodes in the graph.

func (*FolderMutation) AddField

func (m *FolderMutation) 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 (*FolderMutation) AddFileIDs

func (m *FolderMutation) AddFileIDs(ids ...string)

AddFileIDs adds the "files" edge to the File entity by ids.

func (*FolderMutation) AddedEdges

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

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

func (*FolderMutation) AddedField

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

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

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

func (*FolderMutation) AddedIDs

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

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

func (*FolderMutation) ClearEdge

func (m *FolderMutation) 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 (*FolderMutation) ClearExpiresAt

func (m *FolderMutation) ClearExpiresAt()

ClearExpiresAt clears the value of the "expires_at" field.

func (*FolderMutation) ClearField

func (m *FolderMutation) 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 (*FolderMutation) ClearFiles

func (m *FolderMutation) ClearFiles()

ClearFiles clears the "files" edge to the File entity.

func (*FolderMutation) ClearSpace

func (m *FolderMutation) ClearSpace()

ClearSpace clears the "space" edge to the Space entity.

func (*FolderMutation) ClearedEdges

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

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

func (*FolderMutation) ClearedFields

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

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

func (FolderMutation) Client

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

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

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

func (*FolderMutation) EdgeCleared

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

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

func (*FolderMutation) ExpiresAt

func (m *FolderMutation) ExpiresAt() (r time.Time, exists bool)

ExpiresAt returns the value of the "expires_at" field in the mutation.

func (*FolderMutation) ExpiresAtCleared

func (m *FolderMutation) ExpiresAtCleared() bool

ExpiresAtCleared returns if the "expires_at" field was cleared in this mutation.

func (*FolderMutation) Field

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

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

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

func (*FolderMutation) Fields

func (m *FolderMutation) 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 (*FolderMutation) FilesCleared

func (m *FolderMutation) FilesCleared() bool

FilesCleared reports if the "files" edge to the File entity was cleared.

func (*FolderMutation) FilesIDs

func (m *FolderMutation) FilesIDs() (ids []string)

FilesIDs returns the "files" edge IDs in the mutation.

func (*FolderMutation) ID

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

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

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

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

func (*FolderMutation) OldCreatedAt

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

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

func (m *FolderMutation) OldExpiresAt(ctx context.Context) (v time.Time, err error)

OldExpiresAt returns the old "expires_at" field's value of the Folder entity. If the Folder 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 (*FolderMutation) OldField

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

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

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

func (m *FolderMutation) OldSpaceID(ctx context.Context) (v string, err error)

OldSpaceID returns the old "space_id" field's value of the Folder entity. If the Folder 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 (*FolderMutation) OldUpdatedAt

func (m *FolderMutation) OldUpdatedAt(ctx context.Context) (v time.Time, err error)

OldUpdatedAt returns the old "updated_at" field's value of the Folder entity. If the Folder 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 (*FolderMutation) Op

func (m *FolderMutation) Op() Op

Op returns the operation name.

func (*FolderMutation) RemoveFileIDs

func (m *FolderMutation) RemoveFileIDs(ids ...string)

RemoveFileIDs removes the "files" edge to the File entity by IDs.

func (*FolderMutation) RemovedEdges

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

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

func (*FolderMutation) RemovedFilesIDs

func (m *FolderMutation) RemovedFilesIDs() (ids []string)

RemovedFiles returns the removed IDs of the "files" edge to the File entity.

func (*FolderMutation) RemovedIDs

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

func (m *FolderMutation) ResetCreatedAt()

ResetCreatedAt resets all changes to the "created_at" field.

func (*FolderMutation) ResetEdge

func (m *FolderMutation) 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 (*FolderMutation) ResetExpiresAt

func (m *FolderMutation) ResetExpiresAt()

ResetExpiresAt resets all changes to the "expires_at" field.

func (*FolderMutation) ResetField

func (m *FolderMutation) 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 (*FolderMutation) ResetFiles

func (m *FolderMutation) ResetFiles()

ResetFiles resets all changes to the "files" edge.

func (*FolderMutation) ResetName

func (m *FolderMutation) ResetName()

ResetName resets all changes to the "name" field.

func (*FolderMutation) ResetSpace

func (m *FolderMutation) ResetSpace()

ResetSpace resets all changes to the "space" edge.

func (*FolderMutation) ResetSpaceID

func (m *FolderMutation) ResetSpaceID()

ResetSpaceID resets all changes to the "space_id" field.

func (*FolderMutation) ResetUpdatedAt

func (m *FolderMutation) ResetUpdatedAt()

ResetUpdatedAt resets all changes to the "updated_at" field.

func (*FolderMutation) SetCreatedAt

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

SetCreatedAt sets the "created_at" field.

func (*FolderMutation) SetExpiresAt

func (m *FolderMutation) SetExpiresAt(t time.Time)

SetExpiresAt sets the "expires_at" field.

func (*FolderMutation) SetField

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

func (m *FolderMutation) SetID(id string)

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

func (*FolderMutation) SetName

func (m *FolderMutation) SetName(s string)

SetName sets the "name" field.

func (*FolderMutation) SetOp

func (m *FolderMutation) SetOp(op Op)

SetOp allows setting the mutation operation.

func (*FolderMutation) SetSpaceID

func (m *FolderMutation) SetSpaceID(s string)

SetSpaceID sets the "space_id" field.

func (*FolderMutation) SetUpdatedAt

func (m *FolderMutation) SetUpdatedAt(t time.Time)

SetUpdatedAt sets the "updated_at" field.

func (*FolderMutation) SpaceCleared

func (m *FolderMutation) SpaceCleared() bool

SpaceCleared reports if the "space" edge to the Space entity was cleared.

func (*FolderMutation) SpaceID

func (m *FolderMutation) SpaceID() (r string, exists bool)

SpaceID returns the value of the "space_id" field in the mutation.

func (*FolderMutation) SpaceIDs

func (m *FolderMutation) SpaceIDs() (ids []string)

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

func (FolderMutation) Tx

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

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

func (*FolderMutation) Type

func (m *FolderMutation) Type() string

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

func (*FolderMutation) UpdatedAt

func (m *FolderMutation) UpdatedAt() (r time.Time, exists bool)

UpdatedAt returns the value of the "updated_at" field in the mutation.

func (*FolderMutation) Where

func (m *FolderMutation) Where(ps ...predicate.Folder)

Where appends a list predicates to the FolderMutation builder.

func (*FolderMutation) WhereP

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

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

type FolderQuery

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

FolderQuery is the builder for querying Folder entities.

func (*FolderQuery) Aggregate

func (fq *FolderQuery) Aggregate(fns ...AggregateFunc) *FolderSelect

Aggregate returns a FolderSelect configured with the given aggregations.

func (*FolderQuery) All

func (fq *FolderQuery) All(ctx context.Context) ([]*Folder, error)

All executes the query and returns a list of Folders.

func (*FolderQuery) AllX

func (fq *FolderQuery) AllX(ctx context.Context) []*Folder

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

func (*FolderQuery) Clone

func (fq *FolderQuery) Clone() *FolderQuery

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

func (*FolderQuery) Count

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

Count returns the count of the given query.

func (*FolderQuery) CountX

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

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

func (*FolderQuery) Exist

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

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

func (*FolderQuery) ExistX

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

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

func (*FolderQuery) First

func (fq *FolderQuery) First(ctx context.Context) (*Folder, error)

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

func (*FolderQuery) FirstID

func (fq *FolderQuery) FirstID(ctx context.Context) (id string, err error)

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

func (*FolderQuery) FirstIDX

func (fq *FolderQuery) FirstIDX(ctx context.Context) string

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

func (*FolderQuery) FirstX

func (fq *FolderQuery) FirstX(ctx context.Context) *Folder

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

func (*FolderQuery) GroupBy

func (fq *FolderQuery) GroupBy(field string, fields ...string) *FolderGroupBy

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

client.Folder.Query().
	GroupBy(folder.FieldSpaceID).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*FolderQuery) IDs

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

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

func (*FolderQuery) IDsX

func (fq *FolderQuery) IDsX(ctx context.Context) []string

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

func (*FolderQuery) Limit

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

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

func (*FolderQuery) Offset

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

Offset to start from.

func (*FolderQuery) Only

func (fq *FolderQuery) Only(ctx context.Context) (*Folder, error)

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

func (*FolderQuery) OnlyID

func (fq *FolderQuery) OnlyID(ctx context.Context) (id string, err error)

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

func (*FolderQuery) OnlyIDX

func (fq *FolderQuery) OnlyIDX(ctx context.Context) string

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

func (*FolderQuery) OnlyX

func (fq *FolderQuery) OnlyX(ctx context.Context) *Folder

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

func (*FolderQuery) Order

func (fq *FolderQuery) Order(o ...folder.OrderOption) *FolderQuery

Order specifies how the records should be ordered.

func (*FolderQuery) QueryFiles

func (fq *FolderQuery) QueryFiles() *FileQuery

QueryFiles chains the current query on the "files" edge.

func (*FolderQuery) QuerySpace

func (fq *FolderQuery) QuerySpace() *SpaceQuery

QuerySpace chains the current query on the "space" edge.

func (*FolderQuery) Select

func (fq *FolderQuery) Select(fields ...string) *FolderSelect

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

client.Folder.Query().
	Select(folder.FieldSpaceID).
	Scan(ctx, &v)

func (*FolderQuery) Unique

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

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

func (fq *FolderQuery) Where(ps ...predicate.Folder) *FolderQuery

Where adds a new predicate for the FolderQuery builder.

func (*FolderQuery) WithFiles

func (fq *FolderQuery) WithFiles(opts ...func(*FileQuery)) *FolderQuery

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

func (*FolderQuery) WithSpace

func (fq *FolderQuery) WithSpace(opts ...func(*SpaceQuery)) *FolderQuery

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

type FolderSelect

type FolderSelect struct {
	*FolderQuery
	// contains filtered or unexported fields
}

FolderSelect is the builder for selecting fields of Folder entities.

func (*FolderSelect) Aggregate

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

Aggregate adds the given aggregation functions to the selector query.

func (*FolderSelect) Bool

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

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

func (*FolderSelect) BoolX

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

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

func (*FolderSelect) Bools

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

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

func (*FolderSelect) BoolsX

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

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

func (*FolderSelect) Float64

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

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

func (*FolderSelect) Float64X

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

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

func (*FolderSelect) Float64s

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

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

func (*FolderSelect) Float64sX

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

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

func (*FolderSelect) Int

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

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

func (*FolderSelect) IntX

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

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

func (*FolderSelect) Ints

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

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

func (*FolderSelect) IntsX

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

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

func (*FolderSelect) Scan

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

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

func (*FolderSelect) ScanX

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

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

func (*FolderSelect) String

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

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

func (*FolderSelect) StringX

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

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

func (*FolderSelect) Strings

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

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

func (*FolderSelect) StringsX

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

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

type FolderUpdate

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

FolderUpdate is the builder for updating Folder entities.

func (*FolderUpdate) AddFileIDs

func (fu *FolderUpdate) AddFileIDs(ids ...string) *FolderUpdate

AddFileIDs adds the "files" edge to the File entity by IDs.

func (*FolderUpdate) AddFiles

func (fu *FolderUpdate) AddFiles(f ...*File) *FolderUpdate

AddFiles adds the "files" edges to the File entity.

func (*FolderUpdate) ClearExpiresAt

func (fu *FolderUpdate) ClearExpiresAt() *FolderUpdate

ClearExpiresAt clears the value of the "expires_at" field.

func (*FolderUpdate) ClearFiles

func (fu *FolderUpdate) ClearFiles() *FolderUpdate

ClearFiles clears all "files" edges to the File entity.

func (*FolderUpdate) ClearSpace

func (fu *FolderUpdate) ClearSpace() *FolderUpdate

ClearSpace clears the "space" edge to the Space entity.

func (*FolderUpdate) Exec

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

Exec executes the query.

func (*FolderUpdate) ExecX

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

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

func (*FolderUpdate) Mutation

func (fu *FolderUpdate) Mutation() *FolderMutation

Mutation returns the FolderMutation object of the builder.

func (*FolderUpdate) RemoveFileIDs

func (fu *FolderUpdate) RemoveFileIDs(ids ...string) *FolderUpdate

RemoveFileIDs removes the "files" edge to File entities by IDs.

func (*FolderUpdate) RemoveFiles

func (fu *FolderUpdate) RemoveFiles(f ...*File) *FolderUpdate

RemoveFiles removes "files" edges to File entities.

func (*FolderUpdate) Save

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

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

func (*FolderUpdate) SaveX

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

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

func (*FolderUpdate) SetExpiresAt

func (fu *FolderUpdate) SetExpiresAt(t time.Time) *FolderUpdate

SetExpiresAt sets the "expires_at" field.

func (*FolderUpdate) SetName

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

SetName sets the "name" field.

func (*FolderUpdate) SetNillableExpiresAt

func (fu *FolderUpdate) SetNillableExpiresAt(t *time.Time) *FolderUpdate

SetNillableExpiresAt sets the "expires_at" field if the given value is not nil.

func (*FolderUpdate) SetNillableName added in v1.1.4

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

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

func (*FolderUpdate) SetNillableSpaceID added in v1.1.4

func (fu *FolderUpdate) SetNillableSpaceID(s *string) *FolderUpdate

SetNillableSpaceID sets the "space_id" field if the given value is not nil.

func (*FolderUpdate) SetSpace

func (fu *FolderUpdate) SetSpace(s *Space) *FolderUpdate

SetSpace sets the "space" edge to the Space entity.

func (*FolderUpdate) SetSpaceID

func (fu *FolderUpdate) SetSpaceID(s string) *FolderUpdate

SetSpaceID sets the "space_id" field.

func (*FolderUpdate) SetUpdatedAt

func (fu *FolderUpdate) SetUpdatedAt(t time.Time) *FolderUpdate

SetUpdatedAt sets the "updated_at" field.

func (*FolderUpdate) Where

func (fu *FolderUpdate) Where(ps ...predicate.Folder) *FolderUpdate

Where appends a list predicates to the FolderUpdate builder.

type FolderUpdateOne

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

FolderUpdateOne is the builder for updating a single Folder entity.

func (*FolderUpdateOne) AddFileIDs

func (fuo *FolderUpdateOne) AddFileIDs(ids ...string) *FolderUpdateOne

AddFileIDs adds the "files" edge to the File entity by IDs.

func (*FolderUpdateOne) AddFiles

func (fuo *FolderUpdateOne) AddFiles(f ...*File) *FolderUpdateOne

AddFiles adds the "files" edges to the File entity.

func (*FolderUpdateOne) ClearExpiresAt

func (fuo *FolderUpdateOne) ClearExpiresAt() *FolderUpdateOne

ClearExpiresAt clears the value of the "expires_at" field.

func (*FolderUpdateOne) ClearFiles

func (fuo *FolderUpdateOne) ClearFiles() *FolderUpdateOne

ClearFiles clears all "files" edges to the File entity.

func (*FolderUpdateOne) ClearSpace

func (fuo *FolderUpdateOne) ClearSpace() *FolderUpdateOne

ClearSpace clears the "space" edge to the Space entity.

func (*FolderUpdateOne) Exec

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

Exec executes the query on the entity.

func (*FolderUpdateOne) ExecX

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

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

func (*FolderUpdateOne) Mutation

func (fuo *FolderUpdateOne) Mutation() *FolderMutation

Mutation returns the FolderMutation object of the builder.

func (*FolderUpdateOne) RemoveFileIDs

func (fuo *FolderUpdateOne) RemoveFileIDs(ids ...string) *FolderUpdateOne

RemoveFileIDs removes the "files" edge to File entities by IDs.

func (*FolderUpdateOne) RemoveFiles

func (fuo *FolderUpdateOne) RemoveFiles(f ...*File) *FolderUpdateOne

RemoveFiles removes "files" edges to File entities.

func (*FolderUpdateOne) Save

func (fuo *FolderUpdateOne) Save(ctx context.Context) (*Folder, error)

Save executes the query and returns the updated Folder entity.

func (*FolderUpdateOne) SaveX

func (fuo *FolderUpdateOne) SaveX(ctx context.Context) *Folder

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

func (*FolderUpdateOne) Select

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

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

func (*FolderUpdateOne) SetExpiresAt

func (fuo *FolderUpdateOne) SetExpiresAt(t time.Time) *FolderUpdateOne

SetExpiresAt sets the "expires_at" field.

func (*FolderUpdateOne) SetName

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

SetName sets the "name" field.

func (*FolderUpdateOne) SetNillableExpiresAt

func (fuo *FolderUpdateOne) SetNillableExpiresAt(t *time.Time) *FolderUpdateOne

SetNillableExpiresAt sets the "expires_at" field if the given value is not nil.

func (*FolderUpdateOne) SetNillableName added in v1.1.4

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

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

func (*FolderUpdateOne) SetNillableSpaceID added in v1.1.4

func (fuo *FolderUpdateOne) SetNillableSpaceID(s *string) *FolderUpdateOne

SetNillableSpaceID sets the "space_id" field if the given value is not nil.

func (*FolderUpdateOne) SetSpace

func (fuo *FolderUpdateOne) SetSpace(s *Space) *FolderUpdateOne

SetSpace sets the "space" edge to the Space entity.

func (*FolderUpdateOne) SetSpaceID

func (fuo *FolderUpdateOne) SetSpaceID(s string) *FolderUpdateOne

SetSpaceID sets the "space_id" field.

func (*FolderUpdateOne) SetUpdatedAt

func (fuo *FolderUpdateOne) SetUpdatedAt(t time.Time) *FolderUpdateOne

SetUpdatedAt sets the "updated_at" field.

func (*FolderUpdateOne) Where added in v1.1.0

func (fuo *FolderUpdateOne) Where(ps ...predicate.Folder) *FolderUpdateOne

Where appends a list predicates to the FolderUpdate builder.

type FolderUpsert added in v1.1.0

type FolderUpsert struct {
	*sql.UpdateSet
}

FolderUpsert is the "OnConflict" setter.

func (*FolderUpsert) ClearExpiresAt added in v1.1.0

func (u *FolderUpsert) ClearExpiresAt() *FolderUpsert

ClearExpiresAt clears the value of the "expires_at" field.

func (*FolderUpsert) SetExpiresAt added in v1.1.0

func (u *FolderUpsert) SetExpiresAt(v time.Time) *FolderUpsert

SetExpiresAt sets the "expires_at" field.

func (*FolderUpsert) SetName added in v1.1.0

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

SetName sets the "name" field.

func (*FolderUpsert) SetSpaceID added in v1.1.0

func (u *FolderUpsert) SetSpaceID(v string) *FolderUpsert

SetSpaceID sets the "space_id" field.

func (*FolderUpsert) SetUpdatedAt added in v1.1.0

func (u *FolderUpsert) SetUpdatedAt(v time.Time) *FolderUpsert

SetUpdatedAt sets the "updated_at" field.

func (*FolderUpsert) UpdateExpiresAt added in v1.1.0

func (u *FolderUpsert) UpdateExpiresAt() *FolderUpsert

UpdateExpiresAt sets the "expires_at" field to the value that was provided on create.

func (*FolderUpsert) UpdateName added in v1.1.0

func (u *FolderUpsert) UpdateName() *FolderUpsert

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

func (*FolderUpsert) UpdateSpaceID added in v1.1.0

func (u *FolderUpsert) UpdateSpaceID() *FolderUpsert

UpdateSpaceID sets the "space_id" field to the value that was provided on create.

func (*FolderUpsert) UpdateUpdatedAt added in v1.1.0

func (u *FolderUpsert) UpdateUpdatedAt() *FolderUpsert

UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create.

type FolderUpsertBulk added in v1.1.0

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

FolderUpsertBulk is the builder for "upsert"-ing a bulk of Folder nodes.

func (*FolderUpsertBulk) ClearExpiresAt added in v1.1.0

func (u *FolderUpsertBulk) ClearExpiresAt() *FolderUpsertBulk

ClearExpiresAt clears the value of the "expires_at" field.

func (*FolderUpsertBulk) DoNothing added in v1.1.0

func (u *FolderUpsertBulk) DoNothing() *FolderUpsertBulk

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

func (*FolderUpsertBulk) Exec added in v1.1.0

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

Exec executes the query.

func (*FolderUpsertBulk) ExecX added in v1.1.0

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

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

func (*FolderUpsertBulk) Ignore added in v1.1.0

func (u *FolderUpsertBulk) Ignore() *FolderUpsertBulk

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

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

func (*FolderUpsertBulk) SetExpiresAt added in v1.1.0

func (u *FolderUpsertBulk) SetExpiresAt(v time.Time) *FolderUpsertBulk

SetExpiresAt sets the "expires_at" field.

func (*FolderUpsertBulk) SetName added in v1.1.0

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

SetName sets the "name" field.

func (*FolderUpsertBulk) SetSpaceID added in v1.1.0

func (u *FolderUpsertBulk) SetSpaceID(v string) *FolderUpsertBulk

SetSpaceID sets the "space_id" field.

func (*FolderUpsertBulk) SetUpdatedAt added in v1.1.0

func (u *FolderUpsertBulk) SetUpdatedAt(v time.Time) *FolderUpsertBulk

SetUpdatedAt sets the "updated_at" field.

func (*FolderUpsertBulk) Update added in v1.1.0

func (u *FolderUpsertBulk) Update(set func(*FolderUpsert)) *FolderUpsertBulk

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

func (*FolderUpsertBulk) UpdateExpiresAt added in v1.1.0

func (u *FolderUpsertBulk) UpdateExpiresAt() *FolderUpsertBulk

UpdateExpiresAt sets the "expires_at" field to the value that was provided on create.

func (*FolderUpsertBulk) UpdateName added in v1.1.0

func (u *FolderUpsertBulk) UpdateName() *FolderUpsertBulk

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

func (*FolderUpsertBulk) UpdateNewValues added in v1.1.0

func (u *FolderUpsertBulk) UpdateNewValues() *FolderUpsertBulk

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

client.Folder.Create().
	OnConflict(
		sql.ResolveWithNewValues(),
		sql.ResolveWith(func(u *sql.UpdateSet) {
			u.SetIgnore(folder.FieldID)
		}),
	).
	Exec(ctx)

func (*FolderUpsertBulk) UpdateSpaceID added in v1.1.0

func (u *FolderUpsertBulk) UpdateSpaceID() *FolderUpsertBulk

UpdateSpaceID sets the "space_id" field to the value that was provided on create.

func (*FolderUpsertBulk) UpdateUpdatedAt added in v1.1.0

func (u *FolderUpsertBulk) UpdateUpdatedAt() *FolderUpsertBulk

UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create.

type FolderUpsertOne added in v1.1.0

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

FolderUpsertOne is the builder for "upsert"-ing

one Folder node.

func (*FolderUpsertOne) ClearExpiresAt added in v1.1.0

func (u *FolderUpsertOne) ClearExpiresAt() *FolderUpsertOne

ClearExpiresAt clears the value of the "expires_at" field.

func (*FolderUpsertOne) DoNothing added in v1.1.0

func (u *FolderUpsertOne) DoNothing() *FolderUpsertOne

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

func (*FolderUpsertOne) Exec added in v1.1.0

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

Exec executes the query.

func (*FolderUpsertOne) ExecX added in v1.1.0

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

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

func (*FolderUpsertOne) ID added in v1.1.0

func (u *FolderUpsertOne) ID(ctx context.Context) (id string, err error)

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

func (*FolderUpsertOne) IDX added in v1.1.0

func (u *FolderUpsertOne) IDX(ctx context.Context) string

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

func (*FolderUpsertOne) Ignore added in v1.1.0

func (u *FolderUpsertOne) Ignore() *FolderUpsertOne

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

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

func (*FolderUpsertOne) SetExpiresAt added in v1.1.0

func (u *FolderUpsertOne) SetExpiresAt(v time.Time) *FolderUpsertOne

SetExpiresAt sets the "expires_at" field.

func (*FolderUpsertOne) SetName added in v1.1.0

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

SetName sets the "name" field.

func (*FolderUpsertOne) SetSpaceID added in v1.1.0

func (u *FolderUpsertOne) SetSpaceID(v string) *FolderUpsertOne

SetSpaceID sets the "space_id" field.

func (*FolderUpsertOne) SetUpdatedAt added in v1.1.0

func (u *FolderUpsertOne) SetUpdatedAt(v time.Time) *FolderUpsertOne

SetUpdatedAt sets the "updated_at" field.

func (*FolderUpsertOne) Update added in v1.1.0

func (u *FolderUpsertOne) Update(set func(*FolderUpsert)) *FolderUpsertOne

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

func (*FolderUpsertOne) UpdateExpiresAt added in v1.1.0

func (u *FolderUpsertOne) UpdateExpiresAt() *FolderUpsertOne

UpdateExpiresAt sets the "expires_at" field to the value that was provided on create.

func (*FolderUpsertOne) UpdateName added in v1.1.0

func (u *FolderUpsertOne) UpdateName() *FolderUpsertOne

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

func (*FolderUpsertOne) UpdateNewValues added in v1.1.0

func (u *FolderUpsertOne) UpdateNewValues() *FolderUpsertOne

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

client.Folder.Create().
	OnConflict(
		sql.ResolveWithNewValues(),
		sql.ResolveWith(func(u *sql.UpdateSet) {
			u.SetIgnore(folder.FieldID)
		}),
	).
	Exec(ctx)

func (*FolderUpsertOne) UpdateSpaceID added in v1.1.0

func (u *FolderUpsertOne) UpdateSpaceID() *FolderUpsertOne

UpdateSpaceID sets the "space_id" field to the value that was provided on create.

func (*FolderUpsertOne) UpdateUpdatedAt added in v1.1.0

func (u *FolderUpsertOne) UpdateUpdatedAt() *FolderUpsertOne

UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create.

type Folders

type Folders []*Folder

Folders is a parsable slice of Folder.

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 Space

type Space struct {

	// ID of the ent.
	ID string `json:"id,omitempty"`
	// Name holds the value of the "name" field.
	Name string `json:"name,omitempty"`
	// Admins holds the value of the "admins" field.
	Admins []string `json:"admins,omitempty"`
	// CreatedAt holds the value of the "created_at" field.
	CreatedAt time.Time `json:"created_at,omitempty"`
	// UpdatedAt holds the value of the "updated_at" field.
	UpdatedAt time.Time `json:"updated_at,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the SpaceQuery when eager-loading is set.
	Edges SpaceEdges `json:"edges"`
	// contains filtered or unexported fields
}

Space is the model entity for the Space schema.

func (*Space) QueryFolders

func (s *Space) QueryFolders() *FolderQuery

QueryFolders queries the "folders" edge of the Space entity.

func (*Space) String

func (s *Space) String() string

String implements the fmt.Stringer.

func (*Space) Unwrap

func (s *Space) Unwrap() *Space

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

func (s *Space) Update() *SpaceUpdateOne

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

func (*Space) Value added in v1.1.1

func (s *Space) Value(name string) (ent.Value, error)

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

type SpaceClient

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

SpaceClient is a client for the Space schema.

func NewSpaceClient

func NewSpaceClient(c config) *SpaceClient

NewSpaceClient returns a client for the Space from the given config.

func (*SpaceClient) Create

func (c *SpaceClient) Create() *SpaceCreate

Create returns a builder for creating a Space entity.

func (*SpaceClient) CreateBulk

func (c *SpaceClient) CreateBulk(builders ...*SpaceCreate) *SpaceCreateBulk

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

func (*SpaceClient) Delete

func (c *SpaceClient) Delete() *SpaceDelete

Delete returns a delete builder for Space.

func (*SpaceClient) DeleteOne

func (c *SpaceClient) DeleteOne(s *Space) *SpaceDeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*SpaceClient) DeleteOneID

func (c *SpaceClient) DeleteOneID(id string) *SpaceDeleteOne

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

func (*SpaceClient) Get

func (c *SpaceClient) Get(ctx context.Context, id string) (*Space, error)

Get returns a Space entity by its id.

func (*SpaceClient) GetX

func (c *SpaceClient) GetX(ctx context.Context, id string) *Space

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

func (*SpaceClient) Hooks

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

Hooks returns the client hooks.

func (*SpaceClient) Intercept

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

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

func (*SpaceClient) Interceptors

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

Interceptors returns the client interceptors.

func (*SpaceClient) MapCreateBulk added in v1.1.4

func (c *SpaceClient) MapCreateBulk(slice any, setFunc func(*SpaceCreate, int)) *SpaceCreateBulk

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

func (c *SpaceClient) Query() *SpaceQuery

Query returns a query builder for Space.

func (*SpaceClient) QueryFolders

func (c *SpaceClient) QueryFolders(s *Space) *FolderQuery

QueryFolders queries the folders edge of a Space.

func (*SpaceClient) Update

func (c *SpaceClient) Update() *SpaceUpdate

Update returns an update builder for Space.

func (*SpaceClient) UpdateOne

func (c *SpaceClient) UpdateOne(s *Space) *SpaceUpdateOne

UpdateOne returns an update builder for the given entity.

func (*SpaceClient) UpdateOneID

func (c *SpaceClient) UpdateOneID(id string) *SpaceUpdateOne

UpdateOneID returns an update builder for the given id.

func (*SpaceClient) Use

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

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

type SpaceCreate

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

SpaceCreate is the builder for creating a Space entity.

func (*SpaceCreate) AddFolderIDs

func (sc *SpaceCreate) AddFolderIDs(ids ...string) *SpaceCreate

AddFolderIDs adds the "folders" edge to the Folder entity by IDs.

func (*SpaceCreate) AddFolders

func (sc *SpaceCreate) AddFolders(f ...*Folder) *SpaceCreate

AddFolders adds the "folders" edges to the Folder entity.

func (*SpaceCreate) Exec

func (sc *SpaceCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*SpaceCreate) ExecX

func (sc *SpaceCreate) ExecX(ctx context.Context)

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

func (*SpaceCreate) Mutation

func (sc *SpaceCreate) Mutation() *SpaceMutation

Mutation returns the SpaceMutation object of the builder.

func (*SpaceCreate) OnConflict added in v1.1.0

func (sc *SpaceCreate) OnConflict(opts ...sql.ConflictOption) *SpaceUpsertOne

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

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

func (*SpaceCreate) OnConflictColumns added in v1.1.0

func (sc *SpaceCreate) OnConflictColumns(columns ...string) *SpaceUpsertOne

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

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

func (*SpaceCreate) Save

func (sc *SpaceCreate) Save(ctx context.Context) (*Space, error)

Save creates the Space in the database.

func (*SpaceCreate) SaveX

func (sc *SpaceCreate) SaveX(ctx context.Context) *Space

SaveX calls Save and panics if Save returns an error.

func (*SpaceCreate) SetAdmins

func (sc *SpaceCreate) SetAdmins(s []string) *SpaceCreate

SetAdmins sets the "admins" field.

func (*SpaceCreate) SetCreatedAt

func (sc *SpaceCreate) SetCreatedAt(t time.Time) *SpaceCreate

SetCreatedAt sets the "created_at" field.

func (*SpaceCreate) SetID

func (sc *SpaceCreate) SetID(s string) *SpaceCreate

SetID sets the "id" field.

func (*SpaceCreate) SetName

func (sc *SpaceCreate) SetName(s string) *SpaceCreate

SetName sets the "name" field.

func (*SpaceCreate) SetNillableCreatedAt

func (sc *SpaceCreate) SetNillableCreatedAt(t *time.Time) *SpaceCreate

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

func (*SpaceCreate) SetNillableID

func (sc *SpaceCreate) SetNillableID(s *string) *SpaceCreate

SetNillableID sets the "id" field if the given value is not nil.

func (*SpaceCreate) SetNillableUpdatedAt

func (sc *SpaceCreate) SetNillableUpdatedAt(t *time.Time) *SpaceCreate

SetNillableUpdatedAt sets the "updated_at" field if the given value is not nil.

func (*SpaceCreate) SetUpdatedAt

func (sc *SpaceCreate) SetUpdatedAt(t time.Time) *SpaceCreate

SetUpdatedAt sets the "updated_at" field.

type SpaceCreateBulk

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

SpaceCreateBulk is the builder for creating many Space entities in bulk.

func (*SpaceCreateBulk) Exec

func (scb *SpaceCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*SpaceCreateBulk) ExecX

func (scb *SpaceCreateBulk) ExecX(ctx context.Context)

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

func (*SpaceCreateBulk) OnConflict added in v1.1.0

func (scb *SpaceCreateBulk) OnConflict(opts ...sql.ConflictOption) *SpaceUpsertBulk

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

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

func (*SpaceCreateBulk) OnConflictColumns added in v1.1.0

func (scb *SpaceCreateBulk) OnConflictColumns(columns ...string) *SpaceUpsertBulk

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

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

func (*SpaceCreateBulk) Save

func (scb *SpaceCreateBulk) Save(ctx context.Context) ([]*Space, error)

Save creates the Space entities in the database.

func (*SpaceCreateBulk) SaveX

func (scb *SpaceCreateBulk) SaveX(ctx context.Context) []*Space

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

type SpaceDelete

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

SpaceDelete is the builder for deleting a Space entity.

func (*SpaceDelete) Exec

func (sd *SpaceDelete) Exec(ctx context.Context) (int, error)

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

func (*SpaceDelete) ExecX

func (sd *SpaceDelete) ExecX(ctx context.Context) int

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

func (*SpaceDelete) Where

func (sd *SpaceDelete) Where(ps ...predicate.Space) *SpaceDelete

Where appends a list predicates to the SpaceDelete builder.

type SpaceDeleteOne

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

SpaceDeleteOne is the builder for deleting a single Space entity.

func (*SpaceDeleteOne) Exec

func (sdo *SpaceDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*SpaceDeleteOne) ExecX

func (sdo *SpaceDeleteOne) ExecX(ctx context.Context)

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

func (*SpaceDeleteOne) Where added in v1.1.0

func (sdo *SpaceDeleteOne) Where(ps ...predicate.Space) *SpaceDeleteOne

Where appends a list predicates to the SpaceDelete builder.

type SpaceEdges

type SpaceEdges struct {
	// Folders holds the value of the folders edge.
	Folders []*Folder `json:"folders,omitempty"`
	// contains filtered or unexported fields
}

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

func (SpaceEdges) FoldersOrErr

func (e SpaceEdges) FoldersOrErr() ([]*Folder, error)

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

type SpaceGroupBy

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

SpaceGroupBy is the group-by builder for Space entities.

func (*SpaceGroupBy) Aggregate

func (sgb *SpaceGroupBy) Aggregate(fns ...AggregateFunc) *SpaceGroupBy

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

func (*SpaceGroupBy) Bool

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

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

func (*SpaceGroupBy) BoolX

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

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

func (*SpaceGroupBy) Bools

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

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

func (*SpaceGroupBy) BoolsX

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

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

func (*SpaceGroupBy) Float64

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

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

func (*SpaceGroupBy) Float64X

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

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

func (*SpaceGroupBy) Float64s

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

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

func (*SpaceGroupBy) Float64sX

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

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

func (*SpaceGroupBy) Int

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

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

func (*SpaceGroupBy) IntX

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

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

func (*SpaceGroupBy) Ints

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

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

func (*SpaceGroupBy) IntsX

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

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

func (*SpaceGroupBy) Scan

func (sgb *SpaceGroupBy) Scan(ctx context.Context, v any) error

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

func (*SpaceGroupBy) ScanX

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

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

func (*SpaceGroupBy) String

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

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

func (*SpaceGroupBy) StringX

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

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

func (*SpaceGroupBy) Strings

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

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

func (*SpaceGroupBy) StringsX

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

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

type SpaceMutation

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

SpaceMutation represents an operation that mutates the Space nodes in the graph.

func (*SpaceMutation) AddField

func (m *SpaceMutation) 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 (*SpaceMutation) AddFolderIDs

func (m *SpaceMutation) AddFolderIDs(ids ...string)

AddFolderIDs adds the "folders" edge to the Folder entity by ids.

func (*SpaceMutation) AddedEdges

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

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

func (*SpaceMutation) AddedField

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

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

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

func (*SpaceMutation) AddedIDs

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

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

func (*SpaceMutation) Admins

func (m *SpaceMutation) Admins() (r []string, exists bool)

Admins returns the value of the "admins" field in the mutation.

func (*SpaceMutation) AdminsCleared

func (m *SpaceMutation) AdminsCleared() bool

AdminsCleared returns if the "admins" field was cleared in this mutation.

func (*SpaceMutation) AppendAdmins

func (m *SpaceMutation) AppendAdmins(s []string)

AppendAdmins adds s to the "admins" field.

func (*SpaceMutation) AppendedAdmins

func (m *SpaceMutation) AppendedAdmins() ([]string, bool)

AppendedAdmins returns the list of values that were appended to the "admins" field in this mutation.

func (*SpaceMutation) ClearAdmins

func (m *SpaceMutation) ClearAdmins()

ClearAdmins clears the value of the "admins" field.

func (*SpaceMutation) ClearEdge

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

func (m *SpaceMutation) 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 (*SpaceMutation) ClearFolders

func (m *SpaceMutation) ClearFolders()

ClearFolders clears the "folders" edge to the Folder entity.

func (*SpaceMutation) ClearedEdges

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

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

func (*SpaceMutation) ClearedFields

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

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

func (SpaceMutation) Client

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

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

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

func (*SpaceMutation) EdgeCleared

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

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

func (*SpaceMutation) Field

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

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

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

func (*SpaceMutation) Fields

func (m *SpaceMutation) 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 (*SpaceMutation) FoldersCleared

func (m *SpaceMutation) FoldersCleared() bool

FoldersCleared reports if the "folders" edge to the Folder entity was cleared.

func (*SpaceMutation) FoldersIDs

func (m *SpaceMutation) FoldersIDs() (ids []string)

FoldersIDs returns the "folders" edge IDs in the mutation.

func (*SpaceMutation) ID

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

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

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

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

func (*SpaceMutation) OldAdmins

func (m *SpaceMutation) OldAdmins(ctx context.Context) (v []string, err error)

OldAdmins returns the old "admins" field's value of the Space entity. If the Space 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 (*SpaceMutation) OldCreatedAt

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

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

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

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

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

func (m *SpaceMutation) OldUpdatedAt(ctx context.Context) (v time.Time, err error)

OldUpdatedAt returns the old "updated_at" field's value of the Space entity. If the Space 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 (*SpaceMutation) Op

func (m *SpaceMutation) Op() Op

Op returns the operation name.

func (*SpaceMutation) RemoveFolderIDs

func (m *SpaceMutation) RemoveFolderIDs(ids ...string)

RemoveFolderIDs removes the "folders" edge to the Folder entity by IDs.

func (*SpaceMutation) RemovedEdges

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

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

func (*SpaceMutation) RemovedFoldersIDs

func (m *SpaceMutation) RemovedFoldersIDs() (ids []string)

RemovedFolders returns the removed IDs of the "folders" edge to the Folder entity.

func (*SpaceMutation) RemovedIDs

func (m *SpaceMutation) 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 (*SpaceMutation) ResetAdmins

func (m *SpaceMutation) ResetAdmins()

ResetAdmins resets all changes to the "admins" field.

func (*SpaceMutation) ResetCreatedAt

func (m *SpaceMutation) ResetCreatedAt()

ResetCreatedAt resets all changes to the "created_at" field.

func (*SpaceMutation) ResetEdge

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

func (m *SpaceMutation) 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 (*SpaceMutation) ResetFolders

func (m *SpaceMutation) ResetFolders()

ResetFolders resets all changes to the "folders" edge.

func (*SpaceMutation) ResetName

func (m *SpaceMutation) ResetName()

ResetName resets all changes to the "name" field.

func (*SpaceMutation) ResetUpdatedAt

func (m *SpaceMutation) ResetUpdatedAt()

ResetUpdatedAt resets all changes to the "updated_at" field.

func (*SpaceMutation) SetAdmins

func (m *SpaceMutation) SetAdmins(s []string)

SetAdmins sets the "admins" field.

func (*SpaceMutation) SetCreatedAt

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

SetCreatedAt sets the "created_at" field.

func (*SpaceMutation) SetField

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

func (m *SpaceMutation) SetID(id string)

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

func (*SpaceMutation) SetName

func (m *SpaceMutation) SetName(s string)

SetName sets the "name" field.

func (*SpaceMutation) SetOp

func (m *SpaceMutation) SetOp(op Op)

SetOp allows setting the mutation operation.

func (*SpaceMutation) SetUpdatedAt

func (m *SpaceMutation) SetUpdatedAt(t time.Time)

SetUpdatedAt sets the "updated_at" field.

func (SpaceMutation) Tx

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

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

func (*SpaceMutation) Type

func (m *SpaceMutation) Type() string

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

func (*SpaceMutation) UpdatedAt

func (m *SpaceMutation) UpdatedAt() (r time.Time, exists bool)

UpdatedAt returns the value of the "updated_at" field in the mutation.

func (*SpaceMutation) Where

func (m *SpaceMutation) Where(ps ...predicate.Space)

Where appends a list predicates to the SpaceMutation builder.

func (*SpaceMutation) WhereP

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

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

type SpaceQuery

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

SpaceQuery is the builder for querying Space entities.

func (*SpaceQuery) Aggregate

func (sq *SpaceQuery) Aggregate(fns ...AggregateFunc) *SpaceSelect

Aggregate returns a SpaceSelect configured with the given aggregations.

func (*SpaceQuery) All

func (sq *SpaceQuery) All(ctx context.Context) ([]*Space, error)

All executes the query and returns a list of Spaces.

func (*SpaceQuery) AllX

func (sq *SpaceQuery) AllX(ctx context.Context) []*Space

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

func (*SpaceQuery) Clone

func (sq *SpaceQuery) Clone() *SpaceQuery

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

func (*SpaceQuery) Count

func (sq *SpaceQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*SpaceQuery) CountX

func (sq *SpaceQuery) CountX(ctx context.Context) int

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

func (*SpaceQuery) Exist

func (sq *SpaceQuery) Exist(ctx context.Context) (bool, error)

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

func (*SpaceQuery) ExistX

func (sq *SpaceQuery) ExistX(ctx context.Context) bool

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

func (*SpaceQuery) First

func (sq *SpaceQuery) First(ctx context.Context) (*Space, error)

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

func (*SpaceQuery) FirstID

func (sq *SpaceQuery) FirstID(ctx context.Context) (id string, err error)

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

func (*SpaceQuery) FirstIDX

func (sq *SpaceQuery) FirstIDX(ctx context.Context) string

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

func (*SpaceQuery) FirstX

func (sq *SpaceQuery) FirstX(ctx context.Context) *Space

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

func (*SpaceQuery) GroupBy

func (sq *SpaceQuery) GroupBy(field string, fields ...string) *SpaceGroupBy

GroupBy is used to group vertices by one or more fields/columns. It is often used with aggregate functions, like: count, max, mean, min, sum.

Example:

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

client.Space.Query().
	GroupBy(space.FieldName).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*SpaceQuery) IDs

func (sq *SpaceQuery) IDs(ctx context.Context) (ids []string, err error)

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

func (*SpaceQuery) IDsX

func (sq *SpaceQuery) IDsX(ctx context.Context) []string

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

func (*SpaceQuery) Limit

func (sq *SpaceQuery) Limit(limit int) *SpaceQuery

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

func (*SpaceQuery) Offset

func (sq *SpaceQuery) Offset(offset int) *SpaceQuery

Offset to start from.

func (*SpaceQuery) Only

func (sq *SpaceQuery) Only(ctx context.Context) (*Space, error)

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

func (*SpaceQuery) OnlyID

func (sq *SpaceQuery) OnlyID(ctx context.Context) (id string, err error)

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

func (*SpaceQuery) OnlyIDX

func (sq *SpaceQuery) OnlyIDX(ctx context.Context) string

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

func (*SpaceQuery) OnlyX

func (sq *SpaceQuery) OnlyX(ctx context.Context) *Space

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

func (*SpaceQuery) Order

func (sq *SpaceQuery) Order(o ...space.OrderOption) *SpaceQuery

Order specifies how the records should be ordered.

func (*SpaceQuery) QueryFolders

func (sq *SpaceQuery) QueryFolders() *FolderQuery

QueryFolders chains the current query on the "folders" edge.

func (*SpaceQuery) Select

func (sq *SpaceQuery) Select(fields ...string) *SpaceSelect

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

Example:

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

client.Space.Query().
	Select(space.FieldName).
	Scan(ctx, &v)

func (*SpaceQuery) Unique

func (sq *SpaceQuery) Unique(unique bool) *SpaceQuery

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

func (sq *SpaceQuery) Where(ps ...predicate.Space) *SpaceQuery

Where adds a new predicate for the SpaceQuery builder.

func (*SpaceQuery) WithFolders

func (sq *SpaceQuery) WithFolders(opts ...func(*FolderQuery)) *SpaceQuery

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

type SpaceSelect

type SpaceSelect struct {
	*SpaceQuery
	// contains filtered or unexported fields
}

SpaceSelect is the builder for selecting fields of Space entities.

func (*SpaceSelect) Aggregate

func (ss *SpaceSelect) Aggregate(fns ...AggregateFunc) *SpaceSelect

Aggregate adds the given aggregation functions to the selector query.

func (*SpaceSelect) Bool

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

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

func (*SpaceSelect) BoolX

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

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

func (*SpaceSelect) Bools

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

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

func (*SpaceSelect) BoolsX

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

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

func (*SpaceSelect) Float64

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

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

func (*SpaceSelect) Float64X

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

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

func (*SpaceSelect) Float64s

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

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

func (*SpaceSelect) Float64sX

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

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

func (*SpaceSelect) Int

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

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

func (*SpaceSelect) IntX

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

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

func (*SpaceSelect) Ints

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

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

func (*SpaceSelect) IntsX

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

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

func (*SpaceSelect) Scan

func (ss *SpaceSelect) Scan(ctx context.Context, v any) error

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

func (*SpaceSelect) ScanX

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

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

func (*SpaceSelect) String

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

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

func (*SpaceSelect) StringX

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

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

func (*SpaceSelect) Strings

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

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

func (*SpaceSelect) StringsX

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

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

type SpaceUpdate

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

SpaceUpdate is the builder for updating Space entities.

func (*SpaceUpdate) AddFolderIDs

func (su *SpaceUpdate) AddFolderIDs(ids ...string) *SpaceUpdate

AddFolderIDs adds the "folders" edge to the Folder entity by IDs.

func (*SpaceUpdate) AddFolders

func (su *SpaceUpdate) AddFolders(f ...*Folder) *SpaceUpdate

AddFolders adds the "folders" edges to the Folder entity.

func (*SpaceUpdate) AppendAdmins

func (su *SpaceUpdate) AppendAdmins(s []string) *SpaceUpdate

AppendAdmins appends s to the "admins" field.

func (*SpaceUpdate) ClearAdmins

func (su *SpaceUpdate) ClearAdmins() *SpaceUpdate

ClearAdmins clears the value of the "admins" field.

func (*SpaceUpdate) ClearFolders

func (su *SpaceUpdate) ClearFolders() *SpaceUpdate

ClearFolders clears all "folders" edges to the Folder entity.

func (*SpaceUpdate) Exec

func (su *SpaceUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*SpaceUpdate) ExecX

func (su *SpaceUpdate) ExecX(ctx context.Context)

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

func (*SpaceUpdate) Mutation

func (su *SpaceUpdate) Mutation() *SpaceMutation

Mutation returns the SpaceMutation object of the builder.

func (*SpaceUpdate) RemoveFolderIDs

func (su *SpaceUpdate) RemoveFolderIDs(ids ...string) *SpaceUpdate

RemoveFolderIDs removes the "folders" edge to Folder entities by IDs.

func (*SpaceUpdate) RemoveFolders

func (su *SpaceUpdate) RemoveFolders(f ...*Folder) *SpaceUpdate

RemoveFolders removes "folders" edges to Folder entities.

func (*SpaceUpdate) Save

func (su *SpaceUpdate) Save(ctx context.Context) (int, error)

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

func (*SpaceUpdate) SaveX

func (su *SpaceUpdate) SaveX(ctx context.Context) int

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

func (*SpaceUpdate) SetAdmins

func (su *SpaceUpdate) SetAdmins(s []string) *SpaceUpdate

SetAdmins sets the "admins" field.

func (*SpaceUpdate) SetName

func (su *SpaceUpdate) SetName(s string) *SpaceUpdate

SetName sets the "name" field.

func (*SpaceUpdate) SetNillableName added in v1.1.4

func (su *SpaceUpdate) SetNillableName(s *string) *SpaceUpdate

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

func (*SpaceUpdate) SetUpdatedAt

func (su *SpaceUpdate) SetUpdatedAt(t time.Time) *SpaceUpdate

SetUpdatedAt sets the "updated_at" field.

func (*SpaceUpdate) Where

func (su *SpaceUpdate) Where(ps ...predicate.Space) *SpaceUpdate

Where appends a list predicates to the SpaceUpdate builder.

type SpaceUpdateOne

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

SpaceUpdateOne is the builder for updating a single Space entity.

func (*SpaceUpdateOne) AddFolderIDs

func (suo *SpaceUpdateOne) AddFolderIDs(ids ...string) *SpaceUpdateOne

AddFolderIDs adds the "folders" edge to the Folder entity by IDs.

func (*SpaceUpdateOne) AddFolders

func (suo *SpaceUpdateOne) AddFolders(f ...*Folder) *SpaceUpdateOne

AddFolders adds the "folders" edges to the Folder entity.

func (*SpaceUpdateOne) AppendAdmins

func (suo *SpaceUpdateOne) AppendAdmins(s []string) *SpaceUpdateOne

AppendAdmins appends s to the "admins" field.

func (*SpaceUpdateOne) ClearAdmins

func (suo *SpaceUpdateOne) ClearAdmins() *SpaceUpdateOne

ClearAdmins clears the value of the "admins" field.

func (*SpaceUpdateOne) ClearFolders

func (suo *SpaceUpdateOne) ClearFolders() *SpaceUpdateOne

ClearFolders clears all "folders" edges to the Folder entity.

func (*SpaceUpdateOne) Exec

func (suo *SpaceUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*SpaceUpdateOne) ExecX

func (suo *SpaceUpdateOne) ExecX(ctx context.Context)

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

func (*SpaceUpdateOne) Mutation

func (suo *SpaceUpdateOne) Mutation() *SpaceMutation

Mutation returns the SpaceMutation object of the builder.

func (*SpaceUpdateOne) RemoveFolderIDs

func (suo *SpaceUpdateOne) RemoveFolderIDs(ids ...string) *SpaceUpdateOne

RemoveFolderIDs removes the "folders" edge to Folder entities by IDs.

func (*SpaceUpdateOne) RemoveFolders

func (suo *SpaceUpdateOne) RemoveFolders(f ...*Folder) *SpaceUpdateOne

RemoveFolders removes "folders" edges to Folder entities.

func (*SpaceUpdateOne) Save

func (suo *SpaceUpdateOne) Save(ctx context.Context) (*Space, error)

Save executes the query and returns the updated Space entity.

func (*SpaceUpdateOne) SaveX

func (suo *SpaceUpdateOne) SaveX(ctx context.Context) *Space

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

func (*SpaceUpdateOne) Select

func (suo *SpaceUpdateOne) Select(field string, fields ...string) *SpaceUpdateOne

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

func (*SpaceUpdateOne) SetAdmins

func (suo *SpaceUpdateOne) SetAdmins(s []string) *SpaceUpdateOne

SetAdmins sets the "admins" field.

func (*SpaceUpdateOne) SetName

func (suo *SpaceUpdateOne) SetName(s string) *SpaceUpdateOne

SetName sets the "name" field.

func (*SpaceUpdateOne) SetNillableName added in v1.1.4

func (suo *SpaceUpdateOne) SetNillableName(s *string) *SpaceUpdateOne

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

func (*SpaceUpdateOne) SetUpdatedAt

func (suo *SpaceUpdateOne) SetUpdatedAt(t time.Time) *SpaceUpdateOne

SetUpdatedAt sets the "updated_at" field.

func (*SpaceUpdateOne) Where added in v1.1.0

func (suo *SpaceUpdateOne) Where(ps ...predicate.Space) *SpaceUpdateOne

Where appends a list predicates to the SpaceUpdate builder.

type SpaceUpsert added in v1.1.0

type SpaceUpsert struct {
	*sql.UpdateSet
}

SpaceUpsert is the "OnConflict" setter.

func (*SpaceUpsert) ClearAdmins added in v1.1.0

func (u *SpaceUpsert) ClearAdmins() *SpaceUpsert

ClearAdmins clears the value of the "admins" field.

func (*SpaceUpsert) SetAdmins added in v1.1.0

func (u *SpaceUpsert) SetAdmins(v []string) *SpaceUpsert

SetAdmins sets the "admins" field.

func (*SpaceUpsert) SetName added in v1.1.0

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

SetName sets the "name" field.

func (*SpaceUpsert) SetUpdatedAt added in v1.1.0

func (u *SpaceUpsert) SetUpdatedAt(v time.Time) *SpaceUpsert

SetUpdatedAt sets the "updated_at" field.

func (*SpaceUpsert) UpdateAdmins added in v1.1.0

func (u *SpaceUpsert) UpdateAdmins() *SpaceUpsert

UpdateAdmins sets the "admins" field to the value that was provided on create.

func (*SpaceUpsert) UpdateName added in v1.1.0

func (u *SpaceUpsert) UpdateName() *SpaceUpsert

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

func (*SpaceUpsert) UpdateUpdatedAt added in v1.1.0

func (u *SpaceUpsert) UpdateUpdatedAt() *SpaceUpsert

UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create.

type SpaceUpsertBulk added in v1.1.0

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

SpaceUpsertBulk is the builder for "upsert"-ing a bulk of Space nodes.

func (*SpaceUpsertBulk) ClearAdmins added in v1.1.0

func (u *SpaceUpsertBulk) ClearAdmins() *SpaceUpsertBulk

ClearAdmins clears the value of the "admins" field.

func (*SpaceUpsertBulk) DoNothing added in v1.1.0

func (u *SpaceUpsertBulk) DoNothing() *SpaceUpsertBulk

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

func (*SpaceUpsertBulk) Exec added in v1.1.0

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

Exec executes the query.

func (*SpaceUpsertBulk) ExecX added in v1.1.0

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

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

func (*SpaceUpsertBulk) Ignore added in v1.1.0

func (u *SpaceUpsertBulk) Ignore() *SpaceUpsertBulk

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

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

func (*SpaceUpsertBulk) SetAdmins added in v1.1.0

func (u *SpaceUpsertBulk) SetAdmins(v []string) *SpaceUpsertBulk

SetAdmins sets the "admins" field.

func (*SpaceUpsertBulk) SetName added in v1.1.0

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

SetName sets the "name" field.

func (*SpaceUpsertBulk) SetUpdatedAt added in v1.1.0

func (u *SpaceUpsertBulk) SetUpdatedAt(v time.Time) *SpaceUpsertBulk

SetUpdatedAt sets the "updated_at" field.

func (*SpaceUpsertBulk) Update added in v1.1.0

func (u *SpaceUpsertBulk) Update(set func(*SpaceUpsert)) *SpaceUpsertBulk

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

func (*SpaceUpsertBulk) UpdateAdmins added in v1.1.0

func (u *SpaceUpsertBulk) UpdateAdmins() *SpaceUpsertBulk

UpdateAdmins sets the "admins" field to the value that was provided on create.

func (*SpaceUpsertBulk) UpdateName added in v1.1.0

func (u *SpaceUpsertBulk) UpdateName() *SpaceUpsertBulk

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

func (*SpaceUpsertBulk) UpdateNewValues added in v1.1.0

func (u *SpaceUpsertBulk) UpdateNewValues() *SpaceUpsertBulk

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

client.Space.Create().
	OnConflict(
		sql.ResolveWithNewValues(),
		sql.ResolveWith(func(u *sql.UpdateSet) {
			u.SetIgnore(space.FieldID)
		}),
	).
	Exec(ctx)

func (*SpaceUpsertBulk) UpdateUpdatedAt added in v1.1.0

func (u *SpaceUpsertBulk) UpdateUpdatedAt() *SpaceUpsertBulk

UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create.

type SpaceUpsertOne added in v1.1.0

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

SpaceUpsertOne is the builder for "upsert"-ing

one Space node.

func (*SpaceUpsertOne) ClearAdmins added in v1.1.0

func (u *SpaceUpsertOne) ClearAdmins() *SpaceUpsertOne

ClearAdmins clears the value of the "admins" field.

func (*SpaceUpsertOne) DoNothing added in v1.1.0

func (u *SpaceUpsertOne) DoNothing() *SpaceUpsertOne

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

func (*SpaceUpsertOne) Exec added in v1.1.0

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

Exec executes the query.

func (*SpaceUpsertOne) ExecX added in v1.1.0

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

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

func (*SpaceUpsertOne) ID added in v1.1.0

func (u *SpaceUpsertOne) ID(ctx context.Context) (id string, err error)

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

func (*SpaceUpsertOne) IDX added in v1.1.0

func (u *SpaceUpsertOne) IDX(ctx context.Context) string

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

func (*SpaceUpsertOne) Ignore added in v1.1.0

func (u *SpaceUpsertOne) Ignore() *SpaceUpsertOne

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

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

func (*SpaceUpsertOne) SetAdmins added in v1.1.0

func (u *SpaceUpsertOne) SetAdmins(v []string) *SpaceUpsertOne

SetAdmins sets the "admins" field.

func (*SpaceUpsertOne) SetName added in v1.1.0

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

SetName sets the "name" field.

func (*SpaceUpsertOne) SetUpdatedAt added in v1.1.0

func (u *SpaceUpsertOne) SetUpdatedAt(v time.Time) *SpaceUpsertOne

SetUpdatedAt sets the "updated_at" field.

func (*SpaceUpsertOne) Update added in v1.1.0

func (u *SpaceUpsertOne) Update(set func(*SpaceUpsert)) *SpaceUpsertOne

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

func (*SpaceUpsertOne) UpdateAdmins added in v1.1.0

func (u *SpaceUpsertOne) UpdateAdmins() *SpaceUpsertOne

UpdateAdmins sets the "admins" field to the value that was provided on create.

func (*SpaceUpsertOne) UpdateName added in v1.1.0

func (u *SpaceUpsertOne) UpdateName() *SpaceUpsertOne

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

func (*SpaceUpsertOne) UpdateNewValues added in v1.1.0

func (u *SpaceUpsertOne) UpdateNewValues() *SpaceUpsertOne

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

client.Space.Create().
	OnConflict(
		sql.ResolveWithNewValues(),
		sql.ResolveWith(func(u *sql.UpdateSet) {
			u.SetIgnore(space.FieldID)
		}),
	).
	Exec(ctx)

func (*SpaceUpsertOne) UpdateUpdatedAt added in v1.1.0

func (u *SpaceUpsertOne) UpdateUpdatedAt() *SpaceUpsertOne

UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create.

type Spaces

type Spaces []*Space

Spaces is a parsable slice of Space.

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 {

	// File is the client for interacting with the File builders.
	File *FileClient
	// Folder is the client for interacting with the Folder builders.
	Folder *FolderClient
	// Space is the client for interacting with the Space builders.
	Space *SpaceClient
	// User is the client for interacting with the User builders.
	User *UserClient
	// contains filtered or unexported fields
}

Tx is a transactional client that is created by calling Client.Tx().

func TxFromContext

func TxFromContext(ctx context.Context) *Tx

TxFromContext returns a Tx stored inside a context, or nil if there isn't one.

func (*Tx) Client

func (tx *Tx) Client() *Client

Client returns a Client that binds to current transaction.

func (*Tx) Commit

func (tx *Tx) Commit() error

Commit commits the transaction.

func (*Tx) OnCommit

func (tx *Tx) OnCommit(f CommitHook)

OnCommit adds a hook to call on commit.

func (*Tx) OnRollback

func (tx *Tx) OnRollback(f RollbackHook)

OnRollback adds a hook to call on rollback.

func (*Tx) Rollback

func (tx *Tx) Rollback() error

Rollback rollbacks the transaction.

type User added in v1.1.0

type User struct {

	// ID of the ent.
	ID string `json:"id,omitempty"`
	// Username holds the value of the "username" field.
	Username string `json:"username,omitempty"`
	// Name holds the value of the "name" field.
	Name string `json:"name,omitempty"`
	// Email holds the value of the "email" field.
	Email string `json:"email,omitempty"`
	// RememberToken holds the value of the "remember_token" field.
	RememberToken string `json:"remember_token,omitempty"`
	// CreatedAt holds the value of the "created_at" field.
	CreatedAt time.Time `json:"created_at,omitempty"`
	// UpdatedAt holds the value of the "updated_at" field.
	UpdatedAt time.Time `json:"updated_at,omitempty"`
	// contains filtered or unexported fields
}

User is the model entity for the User schema.

func (*User) String added in v1.1.0

func (u *User) String() string

String implements the fmt.Stringer.

func (*User) Unwrap added in v1.1.0

func (u *User) Unwrap() *User

Unwrap unwraps the User entity that was returned from a transaction after it was closed, so that all future queries will be executed through the driver which created the transaction.

func (*User) Update added in v1.1.0

func (u *User) Update() *UserUpdateOne

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

func (*User) Value added in v1.1.1

func (u *User) Value(name string) (ent.Value, error)

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

type UserClient added in v1.1.0

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

UserClient is a client for the User schema.

func NewUserClient added in v1.1.0

func NewUserClient(c config) *UserClient

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

func (*UserClient) Create added in v1.1.0

func (c *UserClient) Create() *UserCreate

Create returns a builder for creating a User entity.

func (*UserClient) CreateBulk added in v1.1.0

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

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

func (*UserClient) Delete added in v1.1.0

func (c *UserClient) Delete() *UserDelete

Delete returns a delete builder for User.

func (*UserClient) DeleteOne added in v1.1.0

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

DeleteOne returns a builder for deleting the given entity.

func (*UserClient) DeleteOneID added in v1.1.0

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

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

func (*UserClient) Get added in v1.1.0

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

Get returns a User entity by its id.

func (*UserClient) GetX added in v1.1.0

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

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

func (*UserClient) Hooks added in v1.1.0

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

Hooks returns the client hooks.

func (*UserClient) Intercept added in v1.1.0

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

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

func (*UserClient) Interceptors added in v1.1.0

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

Interceptors returns the client interceptors.

func (*UserClient) MapCreateBulk added in v1.1.4

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

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

func (*UserClient) Query added in v1.1.0

func (c *UserClient) Query() *UserQuery

Query returns a query builder for User.

func (*UserClient) Update added in v1.1.0

func (c *UserClient) Update() *UserUpdate

Update returns an update builder for User.

func (*UserClient) UpdateOne added in v1.1.0

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

UpdateOne returns an update builder for the given entity.

func (*UserClient) UpdateOneID added in v1.1.0

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

UpdateOneID returns an update builder for the given id.

func (*UserClient) Use added in v1.1.0

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

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

type UserCreate added in v1.1.0

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

UserCreate is the builder for creating a User entity.

func (*UserCreate) Exec added in v1.1.0

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

Exec executes the query.

func (*UserCreate) ExecX added in v1.1.0

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

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

func (*UserCreate) Mutation added in v1.1.0

func (uc *UserCreate) Mutation() *UserMutation

Mutation returns the UserMutation object of the builder.

func (*UserCreate) OnConflict added in v1.1.0

func (uc *UserCreate) OnConflict(opts ...sql.ConflictOption) *UserUpsertOne

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

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

func (*UserCreate) OnConflictColumns added in v1.1.0

func (uc *UserCreate) OnConflictColumns(columns ...string) *UserUpsertOne

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

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

func (*UserCreate) Save added in v1.1.0

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

Save creates the User in the database.

func (*UserCreate) SaveX added in v1.1.0

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

SaveX calls Save and panics if Save returns an error.

func (*UserCreate) SetCreatedAt added in v1.1.0

func (uc *UserCreate) SetCreatedAt(t time.Time) *UserCreate

SetCreatedAt sets the "created_at" field.

func (*UserCreate) SetEmail added in v1.1.0

func (uc *UserCreate) SetEmail(s string) *UserCreate

SetEmail sets the "email" field.

func (*UserCreate) SetID added in v1.1.0

func (uc *UserCreate) SetID(s string) *UserCreate

SetID sets the "id" field.

func (*UserCreate) SetName added in v1.1.0

func (uc *UserCreate) SetName(s string) *UserCreate

SetName sets the "name" field.

func (*UserCreate) SetNillableCreatedAt added in v1.1.0

func (uc *UserCreate) SetNillableCreatedAt(t *time.Time) *UserCreate

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

func (*UserCreate) SetNillableID added in v1.1.0

func (uc *UserCreate) SetNillableID(s *string) *UserCreate

SetNillableID sets the "id" field if the given value is not nil.

func (*UserCreate) SetNillableUpdatedAt added in v1.1.0

func (uc *UserCreate) SetNillableUpdatedAt(t *time.Time) *UserCreate

SetNillableUpdatedAt sets the "updated_at" field if the given value is not nil.

func (*UserCreate) SetRememberToken added in v1.1.0

func (uc *UserCreate) SetRememberToken(s string) *UserCreate

SetRememberToken sets the "remember_token" field.

func (*UserCreate) SetUpdatedAt added in v1.1.0

func (uc *UserCreate) SetUpdatedAt(t time.Time) *UserCreate

SetUpdatedAt sets the "updated_at" field.

func (*UserCreate) SetUsername added in v1.1.0

func (uc *UserCreate) SetUsername(s string) *UserCreate

SetUsername sets the "username" field.

type UserCreateBulk added in v1.1.0

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

UserCreateBulk is the builder for creating many User entities in bulk.

func (*UserCreateBulk) Exec added in v1.1.0

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

Exec executes the query.

func (*UserCreateBulk) ExecX added in v1.1.0

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

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

func (*UserCreateBulk) OnConflict added in v1.1.0

func (ucb *UserCreateBulk) OnConflict(opts ...sql.ConflictOption) *UserUpsertBulk

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

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

func (*UserCreateBulk) OnConflictColumns added in v1.1.0

func (ucb *UserCreateBulk) OnConflictColumns(columns ...string) *UserUpsertBulk

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

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

func (*UserCreateBulk) Save added in v1.1.0

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

Save creates the User entities in the database.

func (*UserCreateBulk) SaveX added in v1.1.0

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

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

type UserDelete added in v1.1.0

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

UserDelete is the builder for deleting a User entity.

func (*UserDelete) Exec added in v1.1.0

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

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

func (*UserDelete) ExecX added in v1.1.0

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

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

func (*UserDelete) Where added in v1.1.0

func (ud *UserDelete) Where(ps ...predicate.User) *UserDelete

Where appends a list predicates to the UserDelete builder.

type UserDeleteOne added in v1.1.0

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

UserDeleteOne is the builder for deleting a single User entity.

func (*UserDeleteOne) Exec added in v1.1.0

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

Exec executes the deletion query.

func (*UserDeleteOne) ExecX added in v1.1.0

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

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

func (*UserDeleteOne) Where added in v1.1.0

func (udo *UserDeleteOne) Where(ps ...predicate.User) *UserDeleteOne

Where appends a list predicates to the UserDelete builder.

type UserGroupBy added in v1.1.0

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

UserGroupBy is the group-by builder for User entities.

func (*UserGroupBy) Aggregate added in v1.1.0

func (ugb *UserGroupBy) Aggregate(fns ...AggregateFunc) *UserGroupBy

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

func (*UserGroupBy) Bool added in v1.1.0

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

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

func (*UserGroupBy) BoolX added in v1.1.0

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

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

func (*UserGroupBy) Bools added in v1.1.0

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

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

func (*UserGroupBy) BoolsX added in v1.1.0

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

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

func (*UserGroupBy) Float64 added in v1.1.0

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

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

func (*UserGroupBy) Float64X added in v1.1.0

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

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

func (*UserGroupBy) Float64s added in v1.1.0

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

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

func (*UserGroupBy) Float64sX added in v1.1.0

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

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

func (*UserGroupBy) Int added in v1.1.0

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

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

func (*UserGroupBy) IntX added in v1.1.0

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

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

func (*UserGroupBy) Ints added in v1.1.0

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

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

func (*UserGroupBy) IntsX added in v1.1.0

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

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

func (*UserGroupBy) Scan added in v1.1.0

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

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

func (*UserGroupBy) ScanX added in v1.1.0

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

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

func (*UserGroupBy) String added in v1.1.0

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

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

func (*UserGroupBy) StringX added in v1.1.0

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

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

func (*UserGroupBy) Strings added in v1.1.0

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

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

func (*UserGroupBy) StringsX added in v1.1.0

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

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

type UserMutation added in v1.1.0

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

UserMutation represents an operation that mutates the User nodes in the graph.

func (*UserMutation) AddField added in v1.1.0

func (m *UserMutation) AddField(name string, value ent.Value) error

AddField adds the value to the field with the given name. It returns an error if the field is not defined in the schema, or if the type mismatched the field type.

func (*UserMutation) AddedEdges added in v1.1.0

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

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

func (*UserMutation) AddedField added in v1.1.0

func (m *UserMutation) AddedField(name string) (ent.Value, bool)

AddedField returns the numeric value that was incremented/decremented on a field with the given name. The second boolean return value indicates that this field was not set, or was not defined in the schema.

func (*UserMutation) AddedFields added in v1.1.0

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

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

func (*UserMutation) AddedIDs added in v1.1.0

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

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

func (*UserMutation) ClearEdge added in v1.1.0

func (m *UserMutation) ClearEdge(name string) error

ClearEdge clears the value of the edge with the given name. It returns an error if that edge is not defined in the schema.

func (*UserMutation) ClearField added in v1.1.0

func (m *UserMutation) ClearField(name string) error

ClearField clears the value of the field with the given name. It returns an error if the field is not defined in the schema.

func (*UserMutation) ClearedEdges added in v1.1.0

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

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

func (*UserMutation) ClearedFields added in v1.1.0

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

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

func (UserMutation) Client added in v1.1.0

func (m UserMutation) Client() *Client

Client returns a new `ent.Client` from the mutation. If the mutation was executed in a transaction (ent.Tx), a transactional client is returned.

func (*UserMutation) CreatedAt added in v1.1.0

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

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

func (*UserMutation) EdgeCleared added in v1.1.0

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

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

func (*UserMutation) Email added in v1.1.0

func (m *UserMutation) Email() (r string, exists bool)

Email returns the value of the "email" field in the mutation.

func (*UserMutation) Field added in v1.1.0

func (m *UserMutation) Field(name string) (ent.Value, bool)

Field returns the value of a field with the given name. The second boolean return value indicates that this field was not set, or was not defined in the schema.

func (*UserMutation) FieldCleared added in v1.1.0

func (m *UserMutation) FieldCleared(name string) bool

FieldCleared returns a boolean indicating if a field with the given name was cleared in this mutation.

func (*UserMutation) Fields added in v1.1.0

func (m *UserMutation) Fields() []string

Fields returns all fields that were changed during this mutation. Note that in order to get all numeric fields that were incremented/decremented, call AddedFields().

func (*UserMutation) ID added in v1.1.0

func (m *UserMutation) ID() (id string, exists bool)

ID returns the ID value in the mutation. Note that the ID is only available if it was provided to the builder or after it was returned from the database.

func (*UserMutation) IDs added in v1.1.0

func (m *UserMutation) IDs(ctx context.Context) ([]string, error)

IDs queries the database and returns the entity ids that match the mutation's predicate. That means, if the mutation is applied within a transaction with an isolation level such as sql.LevelSerializable, the returned ids match the ids of the rows that will be updated or updated by the mutation.

func (*UserMutation) Name added in v1.1.0

func (m *UserMutation) Name() (r string, exists bool)

Name returns the value of the "name" field in the mutation.

func (*UserMutation) OldCreatedAt added in v1.1.0

func (m *UserMutation) OldCreatedAt(ctx context.Context) (v time.Time, err error)

OldCreatedAt returns the old "created_at" field's value of the User entity. If the User object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.

func (*UserMutation) OldEmail added in v1.1.0

func (m *UserMutation) OldEmail(ctx context.Context) (v string, err error)

OldEmail returns the old "email" field's value of the User entity. If the User object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.

func (*UserMutation) OldField added in v1.1.0

func (m *UserMutation) OldField(ctx context.Context, name string) (ent.Value, error)

OldField returns the old value of the field from the database. An error is returned if the mutation operation is not UpdateOne, or the query to the database failed.

func (*UserMutation) OldName added in v1.1.0

func (m *UserMutation) OldName(ctx context.Context) (v string, err error)

OldName returns the old "name" field's value of the User entity. If the User object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.

func (*UserMutation) OldRememberToken added in v1.1.0

func (m *UserMutation) OldRememberToken(ctx context.Context) (v string, err error)

OldRememberToken returns the old "remember_token" field's value of the User entity. If the User object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.

func (*UserMutation) OldUpdatedAt added in v1.1.0

func (m *UserMutation) OldUpdatedAt(ctx context.Context) (v time.Time, err error)

OldUpdatedAt returns the old "updated_at" field's value of the User entity. If the User object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.

func (*UserMutation) OldUsername added in v1.1.0

func (m *UserMutation) OldUsername(ctx context.Context) (v string, err error)

OldUsername returns the old "username" field's value of the User entity. If the User object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.

func (*UserMutation) Op added in v1.1.0

func (m *UserMutation) Op() Op

Op returns the operation name.

func (*UserMutation) RememberToken added in v1.1.0

func (m *UserMutation) RememberToken() (r string, exists bool)

RememberToken returns the value of the "remember_token" field in the mutation.

func (*UserMutation) RemovedEdges added in v1.1.0

func (m *UserMutation) RemovedEdges() []string

RemovedEdges returns all edge names that were removed in this mutation.

func (*UserMutation) RemovedIDs added in v1.1.0

func (m *UserMutation) RemovedIDs(name string) []ent.Value

RemovedIDs returns all IDs (to other nodes) that were removed for the edge with the given name in this mutation.

func (*UserMutation) ResetCreatedAt added in v1.1.0

func (m *UserMutation) ResetCreatedAt()

ResetCreatedAt resets all changes to the "created_at" field.

func (*UserMutation) ResetEdge added in v1.1.0

func (m *UserMutation) ResetEdge(name string) error

ResetEdge resets all changes to the edge with the given name in this mutation. It returns an error if the edge is not defined in the schema.

func (*UserMutation) ResetEmail added in v1.1.0

func (m *UserMutation) ResetEmail()

ResetEmail resets all changes to the "email" field.

func (*UserMutation) ResetField added in v1.1.0

func (m *UserMutation) ResetField(name string) error

ResetField resets all changes in the mutation for the field with the given name. It returns an error if the field is not defined in the schema.

func (*UserMutation) ResetName added in v1.1.0

func (m *UserMutation) ResetName()

ResetName resets all changes to the "name" field.

func (*UserMutation) ResetRememberToken added in v1.1.0

func (m *UserMutation) ResetRememberToken()

ResetRememberToken resets all changes to the "remember_token" field.

func (*UserMutation) ResetUpdatedAt added in v1.1.0

func (m *UserMutation) ResetUpdatedAt()

ResetUpdatedAt resets all changes to the "updated_at" field.

func (*UserMutation) ResetUsername added in v1.1.0

func (m *UserMutation) ResetUsername()

ResetUsername resets all changes to the "username" field.

func (*UserMutation) SetCreatedAt added in v1.1.0

func (m *UserMutation) SetCreatedAt(t time.Time)

SetCreatedAt sets the "created_at" field.

func (*UserMutation) SetEmail added in v1.1.0

func (m *UserMutation) SetEmail(s string)

SetEmail sets the "email" field.

func (*UserMutation) SetField added in v1.1.0

func (m *UserMutation) SetField(name string, value ent.Value) error

SetField sets the value of a field with the given name. It returns an error if the field is not defined in the schema, or if the type mismatched the field type.

func (*UserMutation) SetID added in v1.1.0

func (m *UserMutation) SetID(id string)

SetID sets the value of the id field. Note that this operation is only accepted on creation of User entities.

func (*UserMutation) SetName added in v1.1.0

func (m *UserMutation) SetName(s string)

SetName sets the "name" field.

func (*UserMutation) SetOp added in v1.1.0

func (m *UserMutation) SetOp(op Op)

SetOp allows setting the mutation operation.

func (*UserMutation) SetRememberToken added in v1.1.0

func (m *UserMutation) SetRememberToken(s string)

SetRememberToken sets the "remember_token" field.

func (*UserMutation) SetUpdatedAt added in v1.1.0

func (m *UserMutation) SetUpdatedAt(t time.Time)

SetUpdatedAt sets the "updated_at" field.

func (*UserMutation) SetUsername added in v1.1.0

func (m *UserMutation) SetUsername(s string)

SetUsername sets the "username" field.

func (UserMutation) Tx added in v1.1.0

func (m UserMutation) Tx() (*Tx, error)

Tx returns an `ent.Tx` for mutations that were executed in transactions; it returns an error otherwise.

func (*UserMutation) Type added in v1.1.0

func (m *UserMutation) Type() string

Type returns the node type of this mutation (User).

func (*UserMutation) UpdatedAt added in v1.1.0

func (m *UserMutation) UpdatedAt() (r time.Time, exists bool)

UpdatedAt returns the value of the "updated_at" field in the mutation.

func (*UserMutation) Username added in v1.1.0

func (m *UserMutation) Username() (r string, exists bool)

Username returns the value of the "username" field in the mutation.

func (*UserMutation) Where added in v1.1.0

func (m *UserMutation) Where(ps ...predicate.User)

Where appends a list predicates to the UserMutation builder.

func (*UserMutation) WhereP added in v1.1.0

func (m *UserMutation) WhereP(ps ...func(*sql.Selector))

WhereP appends storage-level predicates to the UserMutation builder. Using this method, users can use type-assertion to append predicates that do not depend on any generated package.

type UserQuery added in v1.1.0

type UserQuery struct {
	// contains filtered or unexported fields
}

UserQuery is the builder for querying User entities.

func (*UserQuery) Aggregate added in v1.1.0

func (uq *UserQuery) Aggregate(fns ...AggregateFunc) *UserSelect

Aggregate returns a UserSelect configured with the given aggregations.

func (*UserQuery) All added in v1.1.0

func (uq *UserQuery) All(ctx context.Context) ([]*User, error)

All executes the query and returns a list of Users.

func (*UserQuery) AllX added in v1.1.0

func (uq *UserQuery) AllX(ctx context.Context) []*User

AllX is like All, but panics if an error occurs.

func (*UserQuery) Clone added in v1.1.0

func (uq *UserQuery) Clone() *UserQuery

Clone returns a duplicate of the UserQuery builder, including all associated steps. It can be used to prepare common query builders and use them differently after the clone is made.

func (*UserQuery) Count added in v1.1.0

func (uq *UserQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*UserQuery) CountX added in v1.1.0

func (uq *UserQuery) CountX(ctx context.Context) int

CountX is like Count, but panics if an error occurs.

func (*UserQuery) Exist added in v1.1.0

func (uq *UserQuery) Exist(ctx context.Context) (bool, error)

Exist returns true if the query has elements in the graph.

func (*UserQuery) ExistX added in v1.1.0

func (uq *UserQuery) ExistX(ctx context.Context) bool

ExistX is like Exist, but panics if an error occurs.

func (*UserQuery) First added in v1.1.0

func (uq *UserQuery) First(ctx context.Context) (*User, error)

First returns the first User entity from the query. Returns a *NotFoundError when no User was found.

func (*UserQuery) FirstID added in v1.1.0

func (uq *UserQuery) FirstID(ctx context.Context) (id string, err error)

FirstID returns the first User ID from the query. Returns a *NotFoundError when no User ID was found.

func (*UserQuery) FirstIDX added in v1.1.0

func (uq *UserQuery) FirstIDX(ctx context.Context) string

FirstIDX is like FirstID, but panics if an error occurs.

func (*UserQuery) FirstX added in v1.1.0

func (uq *UserQuery) FirstX(ctx context.Context) *User

FirstX is like First, but panics if an error occurs.

func (*UserQuery) GroupBy added in v1.1.0

func (uq *UserQuery) GroupBy(field string, fields ...string) *UserGroupBy

GroupBy is used to group vertices by one or more fields/columns. It is often used with aggregate functions, like: count, max, mean, min, sum.

Example:

var v []struct {
	Username string `json:"username,omitempty"`
	Count int `json:"count,omitempty"`
}

client.User.Query().
	GroupBy(user.FieldUsername).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*UserQuery) IDs added in v1.1.0

func (uq *UserQuery) IDs(ctx context.Context) (ids []string, err error)

IDs executes the query and returns a list of User IDs.

func (*UserQuery) IDsX added in v1.1.0

func (uq *UserQuery) IDsX(ctx context.Context) []string

IDsX is like IDs, but panics if an error occurs.

func (*UserQuery) Limit added in v1.1.0

func (uq *UserQuery) Limit(limit int) *UserQuery

Limit the number of records to be returned by this query.

func (*UserQuery) Offset added in v1.1.0

func (uq *UserQuery) Offset(offset int) *UserQuery

Offset to start from.

func (*UserQuery) Only added in v1.1.0

func (uq *UserQuery) Only(ctx context.Context) (*User, error)

Only returns a single User entity found by the query, ensuring it only returns one. Returns a *NotSingularError when more than one User entity is found. Returns a *NotFoundError when no User entities are found.

func (*UserQuery) OnlyID added in v1.1.0

func (uq *UserQuery) OnlyID(ctx context.Context) (id string, err error)

OnlyID is like Only, but returns the only User ID in the query. Returns a *NotSingularError when more than one User ID is found. Returns a *NotFoundError when no entities are found.

func (*UserQuery) OnlyIDX added in v1.1.0

func (uq *UserQuery) OnlyIDX(ctx context.Context) string

OnlyIDX is like OnlyID, but panics if an error occurs.

func (*UserQuery) OnlyX added in v1.1.0

func (uq *UserQuery) OnlyX(ctx context.Context) *User

OnlyX is like Only, but panics if an error occurs.

func (*UserQuery) Order added in v1.1.0

func (uq *UserQuery) Order(o ...user.OrderOption) *UserQuery

Order specifies how the records should be ordered.

func (*UserQuery) Select added in v1.1.0

func (uq *UserQuery) Select(fields ...string) *UserSelect

Select allows the selection one or more fields/columns for the given query, instead of selecting all fields in the entity.

Example:

var v []struct {
	Username string `json:"username,omitempty"`
}

client.User.Query().
	Select(user.FieldUsername).
	Scan(ctx, &v)

func (*UserQuery) Unique added in v1.1.0

func (uq *UserQuery) Unique(unique bool) *UserQuery

Unique configures the query builder to filter duplicate records on query. By default, unique is set to true, and can be disabled using this method.

func (*UserQuery) Where added in v1.1.0

func (uq *UserQuery) Where(ps ...predicate.User) *UserQuery

Where adds a new predicate for the UserQuery builder.

type UserSelect added in v1.1.0

type UserSelect struct {
	*UserQuery
	// contains filtered or unexported fields
}

UserSelect is the builder for selecting fields of User entities.

func (*UserSelect) Aggregate added in v1.1.0

func (us *UserSelect) Aggregate(fns ...AggregateFunc) *UserSelect

Aggregate adds the given aggregation functions to the selector query.

func (*UserSelect) Bool added in v1.1.0

func (s *UserSelect) Bool(ctx context.Context) (_ bool, err error)

Bool returns a single bool from a selector. It is only allowed when selecting one field.

func (*UserSelect) BoolX added in v1.1.0

func (s *UserSelect) BoolX(ctx context.Context) bool

BoolX is like Bool, but panics if an error occurs.

func (*UserSelect) Bools added in v1.1.0

func (s *UserSelect) Bools(ctx context.Context) ([]bool, error)

Bools returns list of bools from a selector. It is only allowed when selecting one field.

func (*UserSelect) BoolsX added in v1.1.0

func (s *UserSelect) BoolsX(ctx context.Context) []bool

BoolsX is like Bools, but panics if an error occurs.

func (*UserSelect) Float64 added in v1.1.0

func (s *UserSelect) Float64(ctx context.Context) (_ float64, err error)

Float64 returns a single float64 from a selector. It is only allowed when selecting one field.

func (*UserSelect) Float64X added in v1.1.0

func (s *UserSelect) Float64X(ctx context.Context) float64

Float64X is like Float64, but panics if an error occurs.

func (*UserSelect) Float64s added in v1.1.0

func (s *UserSelect) Float64s(ctx context.Context) ([]float64, error)

Float64s returns list of float64s from a selector. It is only allowed when selecting one field.

func (*UserSelect) Float64sX added in v1.1.0

func (s *UserSelect) Float64sX(ctx context.Context) []float64

Float64sX is like Float64s, but panics if an error occurs.

func (*UserSelect) Int added in v1.1.0

func (s *UserSelect) Int(ctx context.Context) (_ int, err error)

Int returns a single int from a selector. It is only allowed when selecting one field.

func (*UserSelect) IntX added in v1.1.0

func (s *UserSelect) IntX(ctx context.Context) int

IntX is like Int, but panics if an error occurs.

func (*UserSelect) Ints added in v1.1.0

func (s *UserSelect) Ints(ctx context.Context) ([]int, error)

Ints returns list of ints from a selector. It is only allowed when selecting one field.

func (*UserSelect) IntsX added in v1.1.0

func (s *UserSelect) IntsX(ctx context.Context) []int

IntsX is like Ints, but panics if an error occurs.

func (*UserSelect) Scan added in v1.1.0

func (us *UserSelect) Scan(ctx context.Context, v any) error

Scan applies the selector query and scans the result into the given value.

func (*UserSelect) ScanX added in v1.1.0

func (s *UserSelect) ScanX(ctx context.Context, v any)

ScanX is like Scan, but panics if an error occurs.

func (*UserSelect) String added in v1.1.0

func (s *UserSelect) String(ctx context.Context) (_ string, err error)

String returns a single string from a selector. It is only allowed when selecting one field.

func (*UserSelect) StringX added in v1.1.0

func (s *UserSelect) StringX(ctx context.Context) string

StringX is like String, but panics if an error occurs.

func (*UserSelect) Strings added in v1.1.0

func (s *UserSelect) Strings(ctx context.Context) ([]string, error)

Strings returns list of strings from a selector. It is only allowed when selecting one field.

func (*UserSelect) StringsX added in v1.1.0

func (s *UserSelect) StringsX(ctx context.Context) []string

StringsX is like Strings, but panics if an error occurs.

type UserUpdate added in v1.1.0

type UserUpdate struct {
	// contains filtered or unexported fields
}

UserUpdate is the builder for updating User entities.

func (*UserUpdate) Exec added in v1.1.0

func (uu *UserUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*UserUpdate) ExecX added in v1.1.0

func (uu *UserUpdate) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*UserUpdate) Mutation added in v1.1.0

func (uu *UserUpdate) Mutation() *UserMutation

Mutation returns the UserMutation object of the builder.

func (*UserUpdate) Save added in v1.1.0

func (uu *UserUpdate) Save(ctx context.Context) (int, error)

Save executes the query and returns the number of nodes affected by the update operation.

func (*UserUpdate) SaveX added in v1.1.0

func (uu *UserUpdate) SaveX(ctx context.Context) int

SaveX is like Save, but panics if an error occurs.

func (*UserUpdate) SetEmail added in v1.1.0

func (uu *UserUpdate) SetEmail(s string) *UserUpdate

SetEmail sets the "email" field.

func (*UserUpdate) SetName added in v1.1.0

func (uu *UserUpdate) SetName(s string) *UserUpdate

SetName sets the "name" field.

func (*UserUpdate) SetNillableEmail added in v1.1.4

func (uu *UserUpdate) SetNillableEmail(s *string) *UserUpdate

SetNillableEmail sets the "email" field if the given value is not nil.

func (*UserUpdate) SetNillableName added in v1.1.4

func (uu *UserUpdate) SetNillableName(s *string) *UserUpdate

SetNillableName sets the "name" field if the given value is not nil.

func (*UserUpdate) SetNillableRememberToken added in v1.1.4

func (uu *UserUpdate) SetNillableRememberToken(s *string) *UserUpdate

SetNillableRememberToken sets the "remember_token" field if the given value is not nil.

func (*UserUpdate) SetNillableUsername added in v1.1.4

func (uu *UserUpdate) SetNillableUsername(s *string) *UserUpdate

SetNillableUsername sets the "username" field if the given value is not nil.

func (*UserUpdate) SetRememberToken added in v1.1.0

func (uu *UserUpdate) SetRememberToken(s string) *UserUpdate

SetRememberToken sets the "remember_token" field.

func (*UserUpdate) SetUpdatedAt added in v1.1.0

func (uu *UserUpdate) SetUpdatedAt(t time.Time) *UserUpdate

SetUpdatedAt sets the "updated_at" field.

func (*UserUpdate) SetUsername added in v1.1.0

func (uu *UserUpdate) SetUsername(s string) *UserUpdate

SetUsername sets the "username" field.

func (*UserUpdate) Where added in v1.1.0

func (uu *UserUpdate) Where(ps ...predicate.User) *UserUpdate

Where appends a list predicates to the UserUpdate builder.

type UserUpdateOne added in v1.1.0

type UserUpdateOne struct {
	// contains filtered or unexported fields
}

UserUpdateOne is the builder for updating a single User entity.

func (*UserUpdateOne) Exec added in v1.1.0

func (uuo *UserUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*UserUpdateOne) ExecX added in v1.1.0

func (uuo *UserUpdateOne) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*UserUpdateOne) Mutation added in v1.1.0

func (uuo *UserUpdateOne) Mutation() *UserMutation

Mutation returns the UserMutation object of the builder.

func (*UserUpdateOne) Save added in v1.1.0

func (uuo *UserUpdateOne) Save(ctx context.Context) (*User, error)

Save executes the query and returns the updated User entity.

func (*UserUpdateOne) SaveX added in v1.1.0

func (uuo *UserUpdateOne) SaveX(ctx context.Context) *User

SaveX is like Save, but panics if an error occurs.

func (*UserUpdateOne) Select added in v1.1.0

func (uuo *UserUpdateOne) Select(field string, fields ...string) *UserUpdateOne

Select allows selecting one or more fields (columns) of the returned entity. The default is selecting all fields defined in the entity schema.

func (*UserUpdateOne) SetEmail added in v1.1.0

func (uuo *UserUpdateOne) SetEmail(s string) *UserUpdateOne

SetEmail sets the "email" field.

func (*UserUpdateOne) SetName added in v1.1.0

func (uuo *UserUpdateOne) SetName(s string) *UserUpdateOne

SetName sets the "name" field.

func (*UserUpdateOne) SetNillableEmail added in v1.1.4

func (uuo *UserUpdateOne) SetNillableEmail(s *string) *UserUpdateOne

SetNillableEmail sets the "email" field if the given value is not nil.

func (*UserUpdateOne) SetNillableName added in v1.1.4

func (uuo *UserUpdateOne) SetNillableName(s *string) *UserUpdateOne

SetNillableName sets the "name" field if the given value is not nil.

func (*UserUpdateOne) SetNillableRememberToken added in v1.1.4

func (uuo *UserUpdateOne) SetNillableRememberToken(s *string) *UserUpdateOne

SetNillableRememberToken sets the "remember_token" field if the given value is not nil.

func (*UserUpdateOne) SetNillableUsername added in v1.1.4

func (uuo *UserUpdateOne) SetNillableUsername(s *string) *UserUpdateOne

SetNillableUsername sets the "username" field if the given value is not nil.

func (*UserUpdateOne) SetRememberToken added in v1.1.0

func (uuo *UserUpdateOne) SetRememberToken(s string) *UserUpdateOne

SetRememberToken sets the "remember_token" field.

func (*UserUpdateOne) SetUpdatedAt added in v1.1.0

func (uuo *UserUpdateOne) SetUpdatedAt(t time.Time) *UserUpdateOne

SetUpdatedAt sets the "updated_at" field.

func (*UserUpdateOne) SetUsername added in v1.1.0

func (uuo *UserUpdateOne) SetUsername(s string) *UserUpdateOne

SetUsername sets the "username" field.

func (*UserUpdateOne) Where added in v1.1.0

func (uuo *UserUpdateOne) Where(ps ...predicate.User) *UserUpdateOne

Where appends a list predicates to the UserUpdate builder.

type UserUpsert added in v1.1.0

type UserUpsert struct {
	*sql.UpdateSet
}

UserUpsert is the "OnConflict" setter.

func (*UserUpsert) SetEmail added in v1.1.0

func (u *UserUpsert) SetEmail(v string) *UserUpsert

SetEmail sets the "email" field.

func (*UserUpsert) SetName added in v1.1.0

func (u *UserUpsert) SetName(v string) *UserUpsert

SetName sets the "name" field.

func (*UserUpsert) SetRememberToken added in v1.1.0

func (u *UserUpsert) SetRememberToken(v string) *UserUpsert

SetRememberToken sets the "remember_token" field.

func (*UserUpsert) SetUpdatedAt added in v1.1.0

func (u *UserUpsert) SetUpdatedAt(v time.Time) *UserUpsert

SetUpdatedAt sets the "updated_at" field.

func (*UserUpsert) SetUsername added in v1.1.0

func (u *UserUpsert) SetUsername(v string) *UserUpsert

SetUsername sets the "username" field.

func (*UserUpsert) UpdateEmail added in v1.1.0

func (u *UserUpsert) UpdateEmail() *UserUpsert

UpdateEmail sets the "email" field to the value that was provided on create.

func (*UserUpsert) UpdateName added in v1.1.0

func (u *UserUpsert) UpdateName() *UserUpsert

UpdateName sets the "name" field to the value that was provided on create.

func (*UserUpsert) UpdateRememberToken added in v1.1.0

func (u *UserUpsert) UpdateRememberToken() *UserUpsert

UpdateRememberToken sets the "remember_token" field to the value that was provided on create.

func (*UserUpsert) UpdateUpdatedAt added in v1.1.0

func (u *UserUpsert) UpdateUpdatedAt() *UserUpsert

UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create.

func (*UserUpsert) UpdateUsername added in v1.1.0

func (u *UserUpsert) UpdateUsername() *UserUpsert

UpdateUsername sets the "username" field to the value that was provided on create.

type UserUpsertBulk added in v1.1.0

type UserUpsertBulk struct {
	// contains filtered or unexported fields
}

UserUpsertBulk is the builder for "upsert"-ing a bulk of User nodes.

func (*UserUpsertBulk) DoNothing added in v1.1.0

func (u *UserUpsertBulk) DoNothing() *UserUpsertBulk

DoNothing configures the conflict_action to `DO NOTHING`. Supported only by SQLite and PostgreSQL.

func (*UserUpsertBulk) Exec added in v1.1.0

func (u *UserUpsertBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*UserUpsertBulk) ExecX added in v1.1.0

func (u *UserUpsertBulk) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*UserUpsertBulk) Ignore added in v1.1.0

func (u *UserUpsertBulk) Ignore() *UserUpsertBulk

Ignore sets each column to itself in case of conflict. Using this option is equivalent to using:

client.User.Create().
	OnConflict(sql.ResolveWithIgnore()).
	Exec(ctx)

func (*UserUpsertBulk) SetEmail added in v1.1.0

func (u *UserUpsertBulk) SetEmail(v string) *UserUpsertBulk

SetEmail sets the "email" field.

func (*UserUpsertBulk) SetName added in v1.1.0

func (u *UserUpsertBulk) SetName(v string) *UserUpsertBulk

SetName sets the "name" field.

func (*UserUpsertBulk) SetRememberToken added in v1.1.0

func (u *UserUpsertBulk) SetRememberToken(v string) *UserUpsertBulk

SetRememberToken sets the "remember_token" field.

func (*UserUpsertBulk) SetUpdatedAt added in v1.1.0

func (u *UserUpsertBulk) SetUpdatedAt(v time.Time) *UserUpsertBulk

SetUpdatedAt sets the "updated_at" field.

func (*UserUpsertBulk) SetUsername added in v1.1.0

func (u *UserUpsertBulk) SetUsername(v string) *UserUpsertBulk

SetUsername sets the "username" field.

func (*UserUpsertBulk) Update added in v1.1.0

func (u *UserUpsertBulk) Update(set func(*UserUpsert)) *UserUpsertBulk

Update allows overriding fields `UPDATE` values. See the UserCreateBulk.OnConflict documentation for more info.

func (*UserUpsertBulk) UpdateEmail added in v1.1.0

func (u *UserUpsertBulk) UpdateEmail() *UserUpsertBulk

UpdateEmail sets the "email" field to the value that was provided on create.

func (*UserUpsertBulk) UpdateName added in v1.1.0

func (u *UserUpsertBulk) UpdateName() *UserUpsertBulk

UpdateName sets the "name" field to the value that was provided on create.

func (*UserUpsertBulk) UpdateNewValues added in v1.1.0

func (u *UserUpsertBulk) UpdateNewValues() *UserUpsertBulk

UpdateNewValues updates the mutable fields using the new values that were set on create. Using this option is equivalent to using:

client.User.Create().
	OnConflict(
		sql.ResolveWithNewValues(),
		sql.ResolveWith(func(u *sql.UpdateSet) {
			u.SetIgnore(user.FieldID)
		}),
	).
	Exec(ctx)

func (*UserUpsertBulk) UpdateRememberToken added in v1.1.0

func (u *UserUpsertBulk) UpdateRememberToken() *UserUpsertBulk

UpdateRememberToken sets the "remember_token" field to the value that was provided on create.

func (*UserUpsertBulk) UpdateUpdatedAt added in v1.1.0

func (u *UserUpsertBulk) UpdateUpdatedAt() *UserUpsertBulk

UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create.

func (*UserUpsertBulk) UpdateUsername added in v1.1.0

func (u *UserUpsertBulk) UpdateUsername() *UserUpsertBulk

UpdateUsername sets the "username" field to the value that was provided on create.

type UserUpsertOne added in v1.1.0

type UserUpsertOne struct {
	// contains filtered or unexported fields
}

UserUpsertOne is the builder for "upsert"-ing

one User node.

func (*UserUpsertOne) DoNothing added in v1.1.0

func (u *UserUpsertOne) DoNothing() *UserUpsertOne

DoNothing configures the conflict_action to `DO NOTHING`. Supported only by SQLite and PostgreSQL.

func (*UserUpsertOne) Exec added in v1.1.0

func (u *UserUpsertOne) Exec(ctx context.Context) error

Exec executes the query.

func (*UserUpsertOne) ExecX added in v1.1.0

func (u *UserUpsertOne) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*UserUpsertOne) ID added in v1.1.0

func (u *UserUpsertOne) ID(ctx context.Context) (id string, err error)

Exec executes the UPSERT query and returns the inserted/updated ID.

func (*UserUpsertOne) IDX added in v1.1.0

func (u *UserUpsertOne) IDX(ctx context.Context) string

IDX is like ID, but panics if an error occurs.

func (*UserUpsertOne) Ignore added in v1.1.0

func (u *UserUpsertOne) Ignore() *UserUpsertOne

Ignore sets each column to itself in case of conflict. Using this option is equivalent to using:

client.User.Create().
    OnConflict(sql.ResolveWithIgnore()).
    Exec(ctx)

func (*UserUpsertOne) SetEmail added in v1.1.0

func (u *UserUpsertOne) SetEmail(v string) *UserUpsertOne

SetEmail sets the "email" field.

func (*UserUpsertOne) SetName added in v1.1.0

func (u *UserUpsertOne) SetName(v string) *UserUpsertOne

SetName sets the "name" field.

func (*UserUpsertOne) SetRememberToken added in v1.1.0

func (u *UserUpsertOne) SetRememberToken(v string) *UserUpsertOne

SetRememberToken sets the "remember_token" field.

func (*UserUpsertOne) SetUpdatedAt added in v1.1.0

func (u *UserUpsertOne) SetUpdatedAt(v time.Time) *UserUpsertOne

SetUpdatedAt sets the "updated_at" field.

func (*UserUpsertOne) SetUsername added in v1.1.0

func (u *UserUpsertOne) SetUsername(v string) *UserUpsertOne

SetUsername sets the "username" field.

func (*UserUpsertOne) Update added in v1.1.0

func (u *UserUpsertOne) Update(set func(*UserUpsert)) *UserUpsertOne

Update allows overriding fields `UPDATE` values. See the UserCreate.OnConflict documentation for more info.

func (*UserUpsertOne) UpdateEmail added in v1.1.0

func (u *UserUpsertOne) UpdateEmail() *UserUpsertOne

UpdateEmail sets the "email" field to the value that was provided on create.

func (*UserUpsertOne) UpdateName added in v1.1.0

func (u *UserUpsertOne) UpdateName() *UserUpsertOne

UpdateName sets the "name" field to the value that was provided on create.

func (*UserUpsertOne) UpdateNewValues added in v1.1.0

func (u *UserUpsertOne) UpdateNewValues() *UserUpsertOne

UpdateNewValues updates the mutable fields using the new values that were set on create except the ID field. Using this option is equivalent to using:

client.User.Create().
	OnConflict(
		sql.ResolveWithNewValues(),
		sql.ResolveWith(func(u *sql.UpdateSet) {
			u.SetIgnore(user.FieldID)
		}),
	).
	Exec(ctx)

func (*UserUpsertOne) UpdateRememberToken added in v1.1.0

func (u *UserUpsertOne) UpdateRememberToken() *UserUpsertOne

UpdateRememberToken sets the "remember_token" field to the value that was provided on create.

func (*UserUpsertOne) UpdateUpdatedAt added in v1.1.0

func (u *UserUpsertOne) UpdateUpdatedAt() *UserUpsertOne

UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create.

func (*UserUpsertOne) UpdateUsername added in v1.1.0

func (u *UserUpsertOne) UpdateUsername() *UserUpsertOne

UpdateUsername sets the "username" field to the value that was provided on create.

type Users added in v1.1.0

type Users []*User

Users is a parsable slice of User.

type ValidationError

type ValidationError struct {
	Name string // Field or edge name.
	// contains filtered or unexported fields
}

ValidationError returns when validating a field or edge fails.

func (*ValidationError) Error

func (e *ValidationError) Error() string

Error implements the error interface.

func (*ValidationError) Unwrap

func (e *ValidationError) Unwrap() error

Unwrap implements the errors.Wrapper interface.

type Value

type Value = ent.Value

ent aliases to avoid import conflicts in user's code.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL