Documentation
¶
Index ¶
- Constants
- func IsConstraintError(err error) bool
- func IsNotFound(err error) bool
- func IsNotLoaded(err error) bool
- func IsNotSingular(err error) bool
- func MaskNotFound(err error) error
- func NewContext(parent context.Context, c *Client) context.Context
- func NewTxContext(parent context.Context, tx *Tx) context.Context
- type Aggregate
- type Client
- type ConstraintError
- type File
- type FileClient
- func (c *FileClient) Create() *FileCreate
- func (c *FileClient) Delete() *FileDelete
- func (c *FileClient) DeleteOne(f *File) *FileDeleteOne
- func (c *FileClient) DeleteOneID(id uuid.UUID) *FileDeleteOne
- func (c *FileClient) Get(ctx context.Context, id uuid.UUID) (*File, error)
- func (c *FileClient) GetX(ctx context.Context, id uuid.UUID) *File
- func (c *FileClient) Hooks() []Hook
- func (c *FileClient) Query() *FileQuery
- func (c *FileClient) QueryUser(f *File) *UserQuery
- func (c *FileClient) Update() *FileUpdate
- func (c *FileClient) UpdateOne(f *File) *FileUpdateOne
- func (c *FileClient) UpdateOneID(id uuid.UUID) *FileUpdateOne
- func (c *FileClient) Use(hooks ...Hook)
- type FileCreate
- func (fc *FileCreate) Save(ctx context.Context) (*File, error)
- func (fc *FileCreate) SaveX(ctx context.Context) *File
- func (fc *FileCreate) SetHash(s string) *FileCreate
- func (fc *FileCreate) SetID(u uuid.UUID) *FileCreate
- func (fc *FileCreate) SetMetadata(m map[string]interface{}) *FileCreate
- func (fc *FileCreate) SetNillablePinnedAt(t *time.Time) *FileCreate
- func (fc *FileCreate) SetPinnedAt(t time.Time) *FileCreate
- func (fc *FileCreate) SetSize(i int64) *FileCreate
- func (fc *FileCreate) SetUnpinnedAt(t time.Time) *FileCreate
- func (fc *FileCreate) SetUser(u *User) *FileCreate
- func (fc *FileCreate) SetUserID(id int) *FileCreate
- type FileDelete
- type FileDeleteOne
- type FileEdges
- type FileGroupBy
- func (fgb *FileGroupBy) Aggregate(fns ...Aggregate) *FileGroupBy
- func (fgb *FileGroupBy) Bools(ctx context.Context) ([]bool, error)
- func (fgb *FileGroupBy) BoolsX(ctx context.Context) []bool
- func (fgb *FileGroupBy) Float64s(ctx context.Context) ([]float64, error)
- func (fgb *FileGroupBy) Float64sX(ctx context.Context) []float64
- func (fgb *FileGroupBy) Ints(ctx context.Context) ([]int, error)
- func (fgb *FileGroupBy) IntsX(ctx context.Context) []int
- func (fgb *FileGroupBy) Scan(ctx context.Context, v interface{}) error
- func (fgb *FileGroupBy) ScanX(ctx context.Context, v interface{})
- func (fgb *FileGroupBy) Strings(ctx context.Context) ([]string, error)
- func (fgb *FileGroupBy) StringsX(ctx context.Context) []string
- type FileMutation
- func (m *FileMutation) AddField(name string, value ent.Value) error
- func (m *FileMutation) AddSize(i int64)
- func (m *FileMutation) AddedEdges() []string
- func (m *FileMutation) AddedField(name string) (ent.Value, bool)
- func (m *FileMutation) AddedFields() []string
- func (m *FileMutation) AddedIDs(name string) []ent.Value
- func (m *FileMutation) AddedSize() (r int64, exists bool)
- func (m *FileMutation) ClearEdge(name string) error
- func (m *FileMutation) ClearField(name string) error
- func (m *FileMutation) ClearMetadata()
- func (m *FileMutation) ClearUser()
- func (m *FileMutation) ClearedEdges() []string
- func (m *FileMutation) ClearedFields() []string
- func (m FileMutation) Client() *Client
- func (m *FileMutation) EdgeCleared(name string) bool
- func (m *FileMutation) Field(name string) (ent.Value, bool)
- func (m *FileMutation) FieldCleared(name string) bool
- func (m *FileMutation) Fields() []string
- func (m *FileMutation) Hash() (r string, exists bool)
- func (m *FileMutation) ID() (id uuid.UUID, exists bool)
- func (m *FileMutation) Metadata() (r map[string]interface{}, exists bool)
- func (m *FileMutation) MetadataCleared() bool
- func (m *FileMutation) Op() Op
- func (m *FileMutation) PinnedAt() (r time.Time, exists bool)
- func (m *FileMutation) RemovedEdges() []string
- func (m *FileMutation) RemovedIDs(name string) []ent.Value
- func (m *FileMutation) ResetEdge(name string) error
- func (m *FileMutation) ResetField(name string) error
- func (m *FileMutation) ResetHash()
- func (m *FileMutation) ResetMetadata()
- func (m *FileMutation) ResetPinnedAt()
- func (m *FileMutation) ResetSize()
- func (m *FileMutation) ResetUnpinnedAt()
- func (m *FileMutation) ResetUser()
- func (m *FileMutation) SetField(name string, value ent.Value) error
- func (m *FileMutation) SetHash(s string)
- func (m *FileMutation) SetID(id uuid.UUID)
- func (m *FileMutation) SetMetadata(value map[string]interface{})
- func (m *FileMutation) SetPinnedAt(t time.Time)
- func (m *FileMutation) SetSize(i int64)
- func (m *FileMutation) SetUnpinnedAt(t time.Time)
- func (m *FileMutation) SetUserID(id int)
- func (m *FileMutation) Size() (r int64, exists bool)
- func (m FileMutation) Tx() (*Tx, error)
- func (m *FileMutation) Type() string
- func (m *FileMutation) UnpinnedAt() (r time.Time, exists bool)
- func (m *FileMutation) UserCleared() bool
- func (m *FileMutation) UserID() (id int, exists bool)
- func (m *FileMutation) UserIDs() (ids []int)
- type FileQuery
- func (fq *FileQuery) All(ctx context.Context) ([]*File, error)
- func (fq *FileQuery) AllX(ctx context.Context) []*File
- func (fq *FileQuery) Clone() *FileQuery
- func (fq *FileQuery) Count(ctx context.Context) (int, error)
- func (fq *FileQuery) CountX(ctx context.Context) int
- func (fq *FileQuery) Exist(ctx context.Context) (bool, error)
- func (fq *FileQuery) ExistX(ctx context.Context) bool
- func (fq *FileQuery) First(ctx context.Context) (*File, error)
- func (fq *FileQuery) FirstID(ctx context.Context) (id uuid.UUID, err error)
- func (fq *FileQuery) FirstX(ctx context.Context) *File
- func (fq *FileQuery) FirstXID(ctx context.Context) uuid.UUID
- func (fq *FileQuery) GroupBy(field string, fields ...string) *FileGroupBy
- func (fq *FileQuery) IDs(ctx context.Context) ([]uuid.UUID, error)
- func (fq *FileQuery) IDsX(ctx context.Context) []uuid.UUID
- func (fq *FileQuery) Limit(limit int) *FileQuery
- func (fq *FileQuery) Offset(offset int) *FileQuery
- func (fq *FileQuery) Only(ctx context.Context) (*File, error)
- func (fq *FileQuery) OnlyID(ctx context.Context) (id uuid.UUID, err error)
- func (fq *FileQuery) OnlyX(ctx context.Context) *File
- func (fq *FileQuery) OnlyXID(ctx context.Context) uuid.UUID
- func (fq *FileQuery) Order(o ...Order) *FileQuery
- func (fq *FileQuery) QueryUser() *UserQuery
- func (fq *FileQuery) Select(field string, fields ...string) *FileSelect
- func (fq *FileQuery) Where(ps ...predicate.File) *FileQuery
- func (fq *FileQuery) WithUser(opts ...func(*UserQuery)) *FileQuery
- type FileSelect
- func (fs *FileSelect) Bools(ctx context.Context) ([]bool, error)
- func (fs *FileSelect) BoolsX(ctx context.Context) []bool
- func (fs *FileSelect) Float64s(ctx context.Context) ([]float64, error)
- func (fs *FileSelect) Float64sX(ctx context.Context) []float64
- func (fs *FileSelect) Ints(ctx context.Context) ([]int, error)
- func (fs *FileSelect) IntsX(ctx context.Context) []int
- func (fs *FileSelect) Scan(ctx context.Context, v interface{}) error
- func (fs *FileSelect) ScanX(ctx context.Context, v interface{})
- func (fs *FileSelect) Strings(ctx context.Context) ([]string, error)
- func (fs *FileSelect) StringsX(ctx context.Context) []string
- type FileUpdate
- func (fu *FileUpdate) AddSize(i int64) *FileUpdate
- func (fu *FileUpdate) ClearMetadata() *FileUpdate
- func (fu *FileUpdate) ClearUser() *FileUpdate
- func (fu *FileUpdate) Exec(ctx context.Context) error
- func (fu *FileUpdate) ExecX(ctx context.Context)
- func (fu *FileUpdate) Save(ctx context.Context) (int, error)
- func (fu *FileUpdate) SaveX(ctx context.Context) int
- func (fu *FileUpdate) SetMetadata(m map[string]interface{}) *FileUpdate
- func (fu *FileUpdate) SetSize(i int64) *FileUpdate
- func (fu *FileUpdate) SetUnpinnedAt(t time.Time) *FileUpdate
- func (fu *FileUpdate) SetUser(u *User) *FileUpdate
- func (fu *FileUpdate) SetUserID(id int) *FileUpdate
- func (fu *FileUpdate) Where(ps ...predicate.File) *FileUpdate
- type FileUpdateOne
- func (fuo *FileUpdateOne) AddSize(i int64) *FileUpdateOne
- func (fuo *FileUpdateOne) ClearMetadata() *FileUpdateOne
- func (fuo *FileUpdateOne) ClearUser() *FileUpdateOne
- func (fuo *FileUpdateOne) Exec(ctx context.Context) error
- func (fuo *FileUpdateOne) ExecX(ctx context.Context)
- func (fuo *FileUpdateOne) Save(ctx context.Context) (*File, error)
- func (fuo *FileUpdateOne) SaveX(ctx context.Context) *File
- func (fuo *FileUpdateOne) SetMetadata(m map[string]interface{}) *FileUpdateOne
- func (fuo *FileUpdateOne) SetSize(i int64) *FileUpdateOne
- func (fuo *FileUpdateOne) SetUnpinnedAt(t time.Time) *FileUpdateOne
- func (fuo *FileUpdateOne) SetUser(u *User) *FileUpdateOne
- func (fuo *FileUpdateOne) SetUserID(id int) *FileUpdateOne
- type Files
- type Hook
- type MutateFunc
- type Mutation
- type Mutator
- type NotFoundError
- type NotLoadedError
- type NotSingularError
- type Op
- type Option
- type Order
- type Policy
- type Query
- type Token
- type TokenClient
- func (c *TokenClient) Create() *TokenCreate
- func (c *TokenClient) Delete() *TokenDelete
- func (c *TokenClient) DeleteOne(t *Token) *TokenDeleteOne
- func (c *TokenClient) DeleteOneID(id uuid.UUID) *TokenDeleteOne
- func (c *TokenClient) Get(ctx context.Context, id uuid.UUID) (*Token, error)
- func (c *TokenClient) GetX(ctx context.Context, id uuid.UUID) *Token
- func (c *TokenClient) Hooks() []Hook
- func (c *TokenClient) Query() *TokenQuery
- func (c *TokenClient) QueryUser(t *Token) *UserQuery
- func (c *TokenClient) Update() *TokenUpdate
- func (c *TokenClient) UpdateOne(t *Token) *TokenUpdateOne
- func (c *TokenClient) UpdateOneID(id uuid.UUID) *TokenUpdateOne
- func (c *TokenClient) Use(hooks ...Hook)
- type TokenCreate
- func (tc *TokenCreate) Save(ctx context.Context) (*Token, error)
- func (tc *TokenCreate) SaveX(ctx context.Context) *Token
- func (tc *TokenCreate) SetCreatedAt(t time.Time) *TokenCreate
- func (tc *TokenCreate) SetID(u uuid.UUID) *TokenCreate
- func (tc *TokenCreate) SetLastUsed(t time.Time) *TokenCreate
- func (tc *TokenCreate) SetName(s string) *TokenCreate
- func (tc *TokenCreate) SetNillableCreatedAt(t *time.Time) *TokenCreate
- func (tc *TokenCreate) SetNillableLastUsed(t *time.Time) *TokenCreate
- func (tc *TokenCreate) SetNillablePermissions(t *token.Permissions) *TokenCreate
- func (tc *TokenCreate) SetPermissions(t token.Permissions) *TokenCreate
- func (tc *TokenCreate) SetSecret(s string) *TokenCreate
- func (tc *TokenCreate) SetUser(u *User) *TokenCreate
- func (tc *TokenCreate) SetUserID(id int) *TokenCreate
- type TokenDelete
- type TokenDeleteOne
- type TokenEdges
- type TokenGroupBy
- func (tgb *TokenGroupBy) Aggregate(fns ...Aggregate) *TokenGroupBy
- func (tgb *TokenGroupBy) Bools(ctx context.Context) ([]bool, error)
- func (tgb *TokenGroupBy) BoolsX(ctx context.Context) []bool
- func (tgb *TokenGroupBy) Float64s(ctx context.Context) ([]float64, error)
- func (tgb *TokenGroupBy) Float64sX(ctx context.Context) []float64
- func (tgb *TokenGroupBy) Ints(ctx context.Context) ([]int, error)
- func (tgb *TokenGroupBy) IntsX(ctx context.Context) []int
- func (tgb *TokenGroupBy) Scan(ctx context.Context, v interface{}) error
- func (tgb *TokenGroupBy) ScanX(ctx context.Context, v interface{})
- func (tgb *TokenGroupBy) Strings(ctx context.Context) ([]string, error)
- func (tgb *TokenGroupBy) StringsX(ctx context.Context) []string
- type TokenMutation
- func (m *TokenMutation) AddField(name string, value ent.Value) error
- func (m *TokenMutation) AddedEdges() []string
- func (m *TokenMutation) AddedField(name string) (ent.Value, bool)
- func (m *TokenMutation) AddedFields() []string
- func (m *TokenMutation) AddedIDs(name string) []ent.Value
- func (m *TokenMutation) ClearEdge(name string) error
- func (m *TokenMutation) ClearField(name string) error
- func (m *TokenMutation) ClearLastUsed()
- func (m *TokenMutation) ClearUser()
- func (m *TokenMutation) ClearedEdges() []string
- func (m *TokenMutation) ClearedFields() []string
- func (m TokenMutation) Client() *Client
- func (m *TokenMutation) CreatedAt() (r time.Time, exists bool)
- func (m *TokenMutation) EdgeCleared(name string) bool
- func (m *TokenMutation) Field(name string) (ent.Value, bool)
- func (m *TokenMutation) FieldCleared(name string) bool
- func (m *TokenMutation) Fields() []string
- func (m *TokenMutation) ID() (id uuid.UUID, exists bool)
- func (m *TokenMutation) LastUsed() (r time.Time, exists bool)
- func (m *TokenMutation) LastUsedCleared() bool
- func (m *TokenMutation) Name() (r string, exists bool)
- func (m *TokenMutation) Op() Op
- func (m *TokenMutation) Permissions() (r token.Permissions, exists bool)
- func (m *TokenMutation) RemovedEdges() []string
- func (m *TokenMutation) RemovedIDs(name string) []ent.Value
- func (m *TokenMutation) ResetCreatedAt()
- func (m *TokenMutation) ResetEdge(name string) error
- func (m *TokenMutation) ResetField(name string) error
- func (m *TokenMutation) ResetLastUsed()
- func (m *TokenMutation) ResetName()
- func (m *TokenMutation) ResetPermissions()
- func (m *TokenMutation) ResetSecret()
- func (m *TokenMutation) ResetUser()
- func (m *TokenMutation) Secret() (r string, exists bool)
- func (m *TokenMutation) SetCreatedAt(t time.Time)
- func (m *TokenMutation) SetField(name string, value ent.Value) error
- func (m *TokenMutation) SetID(id uuid.UUID)
- func (m *TokenMutation) SetLastUsed(t time.Time)
- func (m *TokenMutation) SetName(s string)
- func (m *TokenMutation) SetPermissions(t token.Permissions)
- func (m *TokenMutation) SetSecret(s string)
- func (m *TokenMutation) SetUserID(id int)
- func (m TokenMutation) Tx() (*Tx, error)
- func (m *TokenMutation) Type() string
- func (m *TokenMutation) UserCleared() bool
- func (m *TokenMutation) UserID() (id int, exists bool)
- func (m *TokenMutation) UserIDs() (ids []int)
- type TokenQuery
- func (tq *TokenQuery) All(ctx context.Context) ([]*Token, error)
- func (tq *TokenQuery) AllX(ctx context.Context) []*Token
- func (tq *TokenQuery) Clone() *TokenQuery
- func (tq *TokenQuery) Count(ctx context.Context) (int, error)
- func (tq *TokenQuery) CountX(ctx context.Context) int
- func (tq *TokenQuery) Exist(ctx context.Context) (bool, error)
- func (tq *TokenQuery) ExistX(ctx context.Context) bool
- func (tq *TokenQuery) First(ctx context.Context) (*Token, error)
- func (tq *TokenQuery) FirstID(ctx context.Context) (id uuid.UUID, err error)
- func (tq *TokenQuery) FirstX(ctx context.Context) *Token
- func (tq *TokenQuery) FirstXID(ctx context.Context) uuid.UUID
- func (tq *TokenQuery) GroupBy(field string, fields ...string) *TokenGroupBy
- func (tq *TokenQuery) IDs(ctx context.Context) ([]uuid.UUID, error)
- func (tq *TokenQuery) IDsX(ctx context.Context) []uuid.UUID
- func (tq *TokenQuery) Limit(limit int) *TokenQuery
- func (tq *TokenQuery) Offset(offset int) *TokenQuery
- func (tq *TokenQuery) Only(ctx context.Context) (*Token, error)
- func (tq *TokenQuery) OnlyID(ctx context.Context) (id uuid.UUID, err error)
- func (tq *TokenQuery) OnlyX(ctx context.Context) *Token
- func (tq *TokenQuery) OnlyXID(ctx context.Context) uuid.UUID
- func (tq *TokenQuery) Order(o ...Order) *TokenQuery
- func (tq *TokenQuery) QueryUser() *UserQuery
- func (tq *TokenQuery) Select(field string, fields ...string) *TokenSelect
- func (tq *TokenQuery) Where(ps ...predicate.Token) *TokenQuery
- func (tq *TokenQuery) WithUser(opts ...func(*UserQuery)) *TokenQuery
- type TokenSelect
- func (ts *TokenSelect) Bools(ctx context.Context) ([]bool, error)
- func (ts *TokenSelect) BoolsX(ctx context.Context) []bool
- func (ts *TokenSelect) Float64s(ctx context.Context) ([]float64, error)
- func (ts *TokenSelect) Float64sX(ctx context.Context) []float64
- func (ts *TokenSelect) Ints(ctx context.Context) ([]int, error)
- func (ts *TokenSelect) IntsX(ctx context.Context) []int
- func (ts *TokenSelect) Scan(ctx context.Context, v interface{}) error
- func (ts *TokenSelect) ScanX(ctx context.Context, v interface{})
- func (ts *TokenSelect) Strings(ctx context.Context) ([]string, error)
- func (ts *TokenSelect) StringsX(ctx context.Context) []string
- type TokenUpdate
- func (tu *TokenUpdate) ClearLastUsed() *TokenUpdate
- func (tu *TokenUpdate) ClearUser() *TokenUpdate
- func (tu *TokenUpdate) Exec(ctx context.Context) error
- func (tu *TokenUpdate) ExecX(ctx context.Context)
- func (tu *TokenUpdate) Save(ctx context.Context) (int, error)
- func (tu *TokenUpdate) SaveX(ctx context.Context) int
- func (tu *TokenUpdate) SetLastUsed(t time.Time) *TokenUpdate
- func (tu *TokenUpdate) SetName(s string) *TokenUpdate
- func (tu *TokenUpdate) SetNillableLastUsed(t *time.Time) *TokenUpdate
- func (tu *TokenUpdate) SetSecret(s string) *TokenUpdate
- func (tu *TokenUpdate) SetUser(u *User) *TokenUpdate
- func (tu *TokenUpdate) SetUserID(id int) *TokenUpdate
- func (tu *TokenUpdate) Where(ps ...predicate.Token) *TokenUpdate
- type TokenUpdateOne
- func (tuo *TokenUpdateOne) ClearLastUsed() *TokenUpdateOne
- func (tuo *TokenUpdateOne) ClearUser() *TokenUpdateOne
- func (tuo *TokenUpdateOne) Exec(ctx context.Context) error
- func (tuo *TokenUpdateOne) ExecX(ctx context.Context)
- func (tuo *TokenUpdateOne) Save(ctx context.Context) (*Token, error)
- func (tuo *TokenUpdateOne) SaveX(ctx context.Context) *Token
- func (tuo *TokenUpdateOne) SetLastUsed(t time.Time) *TokenUpdateOne
- func (tuo *TokenUpdateOne) SetName(s string) *TokenUpdateOne
- func (tuo *TokenUpdateOne) SetNillableLastUsed(t *time.Time) *TokenUpdateOne
- func (tuo *TokenUpdateOne) SetSecret(s string) *TokenUpdateOne
- func (tuo *TokenUpdateOne) SetUser(u *User) *TokenUpdateOne
- func (tuo *TokenUpdateOne) SetUserID(id int) *TokenUpdateOne
- type Tokens
- type Tx
- type User
- type UserClient
- func (c *UserClient) Create() *UserCreate
- func (c *UserClient) Delete() *UserDelete
- func (c *UserClient) DeleteOne(u *User) *UserDeleteOne
- func (c *UserClient) DeleteOneID(id int) *UserDeleteOne
- func (c *UserClient) Get(ctx context.Context, id int) (*User, error)
- func (c *UserClient) GetX(ctx context.Context, id int) *User
- func (c *UserClient) Hooks() []Hook
- func (c *UserClient) Query() *UserQuery
- func (c *UserClient) QueryFiles(u *User) *FileQuery
- func (c *UserClient) QueryTokens(u *User) *TokenQuery
- func (c *UserClient) Update() *UserUpdate
- func (c *UserClient) UpdateOne(u *User) *UserUpdateOne
- func (c *UserClient) UpdateOneID(id int) *UserUpdateOne
- func (c *UserClient) Use(hooks ...Hook)
- type UserCreate
- func (uc *UserCreate) AddFileIDs(ids ...uuid.UUID) *UserCreate
- func (uc *UserCreate) AddFiles(f ...*File) *UserCreate
- func (uc *UserCreate) AddTokenIDs(ids ...uuid.UUID) *UserCreate
- func (uc *UserCreate) AddTokens(t ...*Token) *UserCreate
- func (uc *UserCreate) Save(ctx context.Context) (*User, error)
- func (uc *UserCreate) SaveX(ctx context.Context) *User
- func (uc *UserCreate) SetActive(b bool) *UserCreate
- func (uc *UserCreate) SetCreatedAt(t time.Time) *UserCreate
- func (uc *UserCreate) SetEmail(s string) *UserCreate
- func (uc *UserCreate) SetNillableActive(b *bool) *UserCreate
- func (uc *UserCreate) SetNillableCreatedAt(t *time.Time) *UserCreate
- func (uc *UserCreate) SetNillablePlan(u *user.Plan) *UserCreate
- func (uc *UserCreate) SetNillableUpdatedAt(t *time.Time) *UserCreate
- func (uc *UserCreate) SetPassword(s string) *UserCreate
- func (uc *UserCreate) SetPlan(u user.Plan) *UserCreate
- func (uc *UserCreate) SetUpdatedAt(t time.Time) *UserCreate
- type UserDelete
- type UserDeleteOne
- type UserEdges
- type UserGroupBy
- func (ugb *UserGroupBy) Aggregate(fns ...Aggregate) *UserGroupBy
- func (ugb *UserGroupBy) Bools(ctx context.Context) ([]bool, error)
- func (ugb *UserGroupBy) BoolsX(ctx context.Context) []bool
- func (ugb *UserGroupBy) Float64s(ctx context.Context) ([]float64, error)
- func (ugb *UserGroupBy) Float64sX(ctx context.Context) []float64
- func (ugb *UserGroupBy) Ints(ctx context.Context) ([]int, error)
- func (ugb *UserGroupBy) IntsX(ctx context.Context) []int
- func (ugb *UserGroupBy) Scan(ctx context.Context, v interface{}) error
- func (ugb *UserGroupBy) ScanX(ctx context.Context, v interface{})
- func (ugb *UserGroupBy) Strings(ctx context.Context) ([]string, error)
- func (ugb *UserGroupBy) StringsX(ctx context.Context) []string
- type UserMutation
- func (m *UserMutation) Active() (r bool, exists bool)
- func (m *UserMutation) AddField(name string, value ent.Value) error
- func (m *UserMutation) AddFileIDs(ids ...uuid.UUID)
- func (m *UserMutation) AddTokenIDs(ids ...uuid.UUID)
- func (m *UserMutation) AddedEdges() []string
- func (m *UserMutation) AddedField(name string) (ent.Value, bool)
- func (m *UserMutation) AddedFields() []string
- func (m *UserMutation) AddedIDs(name string) []ent.Value
- func (m *UserMutation) ClearEdge(name string) error
- func (m *UserMutation) ClearField(name string) error
- func (m *UserMutation) ClearedEdges() []string
- func (m *UserMutation) ClearedFields() []string
- func (m UserMutation) Client() *Client
- func (m *UserMutation) CreatedAt() (r time.Time, exists bool)
- func (m *UserMutation) EdgeCleared(name string) bool
- func (m *UserMutation) Email() (r string, exists bool)
- func (m *UserMutation) Field(name string) (ent.Value, bool)
- func (m *UserMutation) FieldCleared(name string) bool
- func (m *UserMutation) Fields() []string
- func (m *UserMutation) FilesIDs() (ids []uuid.UUID)
- func (m *UserMutation) ID() (id int, exists bool)
- func (m *UserMutation) Op() Op
- func (m *UserMutation) Password() (r string, exists bool)
- func (m *UserMutation) Plan() (r user.Plan, exists bool)
- func (m *UserMutation) RemoveFileIDs(ids ...uuid.UUID)
- func (m *UserMutation) RemoveTokenIDs(ids ...uuid.UUID)
- func (m *UserMutation) RemovedEdges() []string
- func (m *UserMutation) RemovedFilesIDs() (ids []uuid.UUID)
- func (m *UserMutation) RemovedIDs(name string) []ent.Value
- func (m *UserMutation) RemovedTokensIDs() (ids []uuid.UUID)
- func (m *UserMutation) ResetActive()
- func (m *UserMutation) ResetCreatedAt()
- func (m *UserMutation) ResetEdge(name string) error
- func (m *UserMutation) ResetEmail()
- func (m *UserMutation) ResetField(name string) error
- func (m *UserMutation) ResetFiles()
- func (m *UserMutation) ResetPassword()
- func (m *UserMutation) ResetPlan()
- func (m *UserMutation) ResetTokens()
- func (m *UserMutation) ResetUpdatedAt()
- func (m *UserMutation) SetActive(b bool)
- func (m *UserMutation) SetCreatedAt(t time.Time)
- func (m *UserMutation) SetEmail(s string)
- func (m *UserMutation) SetField(name string, value ent.Value) error
- func (m *UserMutation) SetPassword(s string)
- func (m *UserMutation) SetPlan(u user.Plan)
- func (m *UserMutation) SetUpdatedAt(t time.Time)
- func (m *UserMutation) TokensIDs() (ids []uuid.UUID)
- func (m UserMutation) Tx() (*Tx, error)
- func (m *UserMutation) Type() string
- func (m *UserMutation) UpdatedAt() (r time.Time, exists bool)
- type UserQuery
- func (uq *UserQuery) All(ctx context.Context) ([]*User, error)
- func (uq *UserQuery) AllX(ctx context.Context) []*User
- func (uq *UserQuery) Clone() *UserQuery
- func (uq *UserQuery) Count(ctx context.Context) (int, error)
- func (uq *UserQuery) CountX(ctx context.Context) int
- func (uq *UserQuery) Exist(ctx context.Context) (bool, error)
- func (uq *UserQuery) ExistX(ctx context.Context) bool
- func (uq *UserQuery) First(ctx context.Context) (*User, error)
- func (uq *UserQuery) FirstID(ctx context.Context) (id int, err error)
- func (uq *UserQuery) FirstX(ctx context.Context) *User
- func (uq *UserQuery) FirstXID(ctx context.Context) int
- func (uq *UserQuery) GroupBy(field string, fields ...string) *UserGroupBy
- func (uq *UserQuery) IDs(ctx context.Context) ([]int, error)
- func (uq *UserQuery) IDsX(ctx context.Context) []int
- func (uq *UserQuery) Limit(limit int) *UserQuery
- func (uq *UserQuery) Offset(offset int) *UserQuery
- func (uq *UserQuery) Only(ctx context.Context) (*User, error)
- func (uq *UserQuery) OnlyID(ctx context.Context) (id int, err error)
- func (uq *UserQuery) OnlyX(ctx context.Context) *User
- func (uq *UserQuery) OnlyXID(ctx context.Context) int
- func (uq *UserQuery) Order(o ...Order) *UserQuery
- func (uq *UserQuery) QueryFiles() *FileQuery
- func (uq *UserQuery) QueryTokens() *TokenQuery
- func (uq *UserQuery) Select(field string, fields ...string) *UserSelect
- func (uq *UserQuery) Where(ps ...predicate.User) *UserQuery
- func (uq *UserQuery) WithFiles(opts ...func(*FileQuery)) *UserQuery
- func (uq *UserQuery) WithTokens(opts ...func(*TokenQuery)) *UserQuery
- type UserSelect
- func (us *UserSelect) Bools(ctx context.Context) ([]bool, error)
- func (us *UserSelect) BoolsX(ctx context.Context) []bool
- func (us *UserSelect) Float64s(ctx context.Context) ([]float64, error)
- func (us *UserSelect) Float64sX(ctx context.Context) []float64
- func (us *UserSelect) Ints(ctx context.Context) ([]int, error)
- func (us *UserSelect) IntsX(ctx context.Context) []int
- func (us *UserSelect) Scan(ctx context.Context, v interface{}) error
- func (us *UserSelect) ScanX(ctx context.Context, v interface{})
- func (us *UserSelect) Strings(ctx context.Context) ([]string, error)
- func (us *UserSelect) StringsX(ctx context.Context) []string
- type UserUpdate
- func (uu *UserUpdate) AddFileIDs(ids ...uuid.UUID) *UserUpdate
- func (uu *UserUpdate) AddFiles(f ...*File) *UserUpdate
- func (uu *UserUpdate) AddTokenIDs(ids ...uuid.UUID) *UserUpdate
- func (uu *UserUpdate) AddTokens(t ...*Token) *UserUpdate
- func (uu *UserUpdate) Exec(ctx context.Context) error
- func (uu *UserUpdate) ExecX(ctx context.Context)
- func (uu *UserUpdate) RemoveFileIDs(ids ...uuid.UUID) *UserUpdate
- func (uu *UserUpdate) RemoveFiles(f ...*File) *UserUpdate
- func (uu *UserUpdate) RemoveTokenIDs(ids ...uuid.UUID) *UserUpdate
- func (uu *UserUpdate) RemoveTokens(t ...*Token) *UserUpdate
- func (uu *UserUpdate) Save(ctx context.Context) (int, error)
- func (uu *UserUpdate) SaveX(ctx context.Context) int
- func (uu *UserUpdate) SetActive(b bool) *UserUpdate
- func (uu *UserUpdate) SetEmail(s string) *UserUpdate
- func (uu *UserUpdate) SetNillableActive(b *bool) *UserUpdate
- func (uu *UserUpdate) SetNillablePlan(u *user.Plan) *UserUpdate
- func (uu *UserUpdate) SetPassword(s string) *UserUpdate
- func (uu *UserUpdate) SetPlan(u user.Plan) *UserUpdate
- func (uu *UserUpdate) SetUpdatedAt(t time.Time) *UserUpdate
- func (uu *UserUpdate) Where(ps ...predicate.User) *UserUpdate
- type UserUpdateOne
- func (uuo *UserUpdateOne) AddFileIDs(ids ...uuid.UUID) *UserUpdateOne
- func (uuo *UserUpdateOne) AddFiles(f ...*File) *UserUpdateOne
- func (uuo *UserUpdateOne) AddTokenIDs(ids ...uuid.UUID) *UserUpdateOne
- func (uuo *UserUpdateOne) AddTokens(t ...*Token) *UserUpdateOne
- func (uuo *UserUpdateOne) Exec(ctx context.Context) error
- func (uuo *UserUpdateOne) ExecX(ctx context.Context)
- func (uuo *UserUpdateOne) RemoveFileIDs(ids ...uuid.UUID) *UserUpdateOne
- func (uuo *UserUpdateOne) RemoveFiles(f ...*File) *UserUpdateOne
- func (uuo *UserUpdateOne) RemoveTokenIDs(ids ...uuid.UUID) *UserUpdateOne
- func (uuo *UserUpdateOne) RemoveTokens(t ...*Token) *UserUpdateOne
- func (uuo *UserUpdateOne) Save(ctx context.Context) (*User, error)
- func (uuo *UserUpdateOne) SaveX(ctx context.Context) *User
- func (uuo *UserUpdateOne) SetActive(b bool) *UserUpdateOne
- func (uuo *UserUpdateOne) SetEmail(s string) *UserUpdateOne
- func (uuo *UserUpdateOne) SetNillableActive(b *bool) *UserUpdateOne
- func (uuo *UserUpdateOne) SetNillablePlan(u *user.Plan) *UserUpdateOne
- func (uuo *UserUpdateOne) SetPassword(s string) *UserUpdateOne
- func (uuo *UserUpdateOne) SetPlan(u user.Plan) *UserUpdateOne
- func (uuo *UserUpdateOne) SetUpdatedAt(t time.Time) *UserUpdateOne
- type Users
- type Value
Constants ¶
const ( // Operation types. OpCreate = ent.OpCreate OpDelete = ent.OpDelete OpDeleteOne = ent.OpDeleteOne OpUpdate = ent.OpUpdate OpUpdateOne = ent.OpUpdateOne // Node types. TypeFile = "File" TypeToken = "Token" TypeUser = "User" )
Variables ¶
This section is empty.
Functions ¶
func IsConstraintError ¶
IsConstraintError returns a boolean indicating whether the error is a constraint failure.
func IsNotFound ¶
IsNotFound returns a boolean indicating whether the error is a not found error.
func IsNotLoaded ¶
IsNotLoaded returns a boolean indicating whether the error is a not loaded error.
func IsNotSingular ¶
IsNotSingular returns a boolean indicating whether the error is a not singular error.
func NewContext ¶
NewContext returns a new context with the given Client attached.
Types ¶
type Aggregate ¶
Aggregate 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)
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
// Token is the client for interacting with the Token builders.
Token *TokenClient
// 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 ¶
FromContext returns the Client stored in a context, or nil if there isn't one.
func Open ¶
Open opens a connection to the database specified by the driver name and a driver-specific data source name, and returns a new client attached to it. Optional parameters can be added for configuring the client.
func (*Client) Debug ¶
Debug returns a new debug-client. It's used to get verbose logging on specific operations.
client.Debug(). File. Query(). Count(ctx)
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 uuid.UUID `json:"id,omitempty"`
// Hash holds the value of the "hash" field.
Hash string `json:"hash,omitempty"`
// Size holds the value of the "size" field.
Size int64 `json:"size,omitempty"`
// PinnedAt holds the value of the "pinned_at" field.
PinnedAt time.Time `json:"pinned_at,omitempty"`
// UnpinnedAt holds the value of the "unpinned_at" field.
UnpinnedAt time.Time `json:"unpinned_at,omitempty"`
// Metadata holds the value of the "metadata" field.
Metadata map[string]interface{} `json:"metadata,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) Unwrap ¶
Unwrap unwraps the entity that was returned from a transaction after it was closed, so that all next 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.
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 create builder for File.
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 delete builder for the given entity.
func (*FileClient) DeleteOneID ¶
func (c *FileClient) DeleteOneID(id uuid.UUID) *FileDeleteOne
DeleteOneID returns a delete builder for the given id.
func (*FileClient) Query ¶
func (c *FileClient) Query() *FileQuery
Create returns a query builder for File.
func (*FileClient) QueryUser ¶
func (c *FileClient) QueryUser(f *File) *UserQuery
QueryUser queries the user 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 uuid.UUID) *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) 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) SetHash ¶
func (fc *FileCreate) SetHash(s string) *FileCreate
SetHash sets the hash field.
func (*FileCreate) SetID ¶
func (fc *FileCreate) SetID(u uuid.UUID) *FileCreate
SetID sets the id field.
func (*FileCreate) SetMetadata ¶
func (fc *FileCreate) SetMetadata(m map[string]interface{}) *FileCreate
SetMetadata sets the metadata field.
func (*FileCreate) SetNillablePinnedAt ¶
func (fc *FileCreate) SetNillablePinnedAt(t *time.Time) *FileCreate
SetNillablePinnedAt sets the pinned_at field if the given value is not nil.
func (*FileCreate) SetPinnedAt ¶
func (fc *FileCreate) SetPinnedAt(t time.Time) *FileCreate
SetPinnedAt sets the pinned_at field.
func (*FileCreate) SetSize ¶
func (fc *FileCreate) SetSize(i int64) *FileCreate
SetSize sets the size field.
func (*FileCreate) SetUnpinnedAt ¶
func (fc *FileCreate) SetUnpinnedAt(t time.Time) *FileCreate
SetUnpinnedAt sets the unpinned_at field.
func (*FileCreate) SetUser ¶
func (fc *FileCreate) SetUser(u *User) *FileCreate
SetUser sets the user edge to User.
func (*FileCreate) SetUserID ¶
func (fc *FileCreate) SetUserID(id int) *FileCreate
SetUserID sets the user edge to User by id.
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 adds a new predicate to the delete 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.
type FileEdges ¶
type FileEdges struct {
// User holds the value of the user edge.
User *User
// contains filtered or unexported fields
}
FileEdges holds the relations/edges for other nodes in the graph.
type FileGroupBy ¶
type FileGroupBy struct {
// contains filtered or unexported fields
}
FileGroupBy is the builder for group-by File entities.
func (*FileGroupBy) Aggregate ¶
func (fgb *FileGroupBy) Aggregate(fns ...Aggregate) *FileGroupBy
Aggregate adds the given aggregation functions to the group-by query.
func (*FileGroupBy) Bools ¶
func (fgb *FileGroupBy) Bools(ctx context.Context) ([]bool, error)
Bools returns list of bools from group-by. It is only allowed when querying group-by with one field.
func (*FileGroupBy) BoolsX ¶
func (fgb *FileGroupBy) BoolsX(ctx context.Context) []bool
BoolsX is like Bools, but panics if an error occurs.
func (*FileGroupBy) Float64s ¶
func (fgb *FileGroupBy) Float64s(ctx context.Context) ([]float64, error)
Float64s returns list of float64s from group-by. It is only allowed when querying group-by with one field.
func (*FileGroupBy) Float64sX ¶
func (fgb *FileGroupBy) Float64sX(ctx context.Context) []float64
Float64sX is like Float64s, but panics if an error occurs.
func (*FileGroupBy) Ints ¶
func (fgb *FileGroupBy) Ints(ctx context.Context) ([]int, error)
Ints returns list of ints from group-by. It is only allowed when querying group-by with one field.
func (*FileGroupBy) IntsX ¶
func (fgb *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 interface{}) error
Scan applies the group-by query and scan the result into the given value.
func (*FileGroupBy) ScanX ¶
func (fgb *FileGroupBy) ScanX(ctx context.Context, v interface{})
ScanX is like Scan, but panics if an error occurs.
type FileMutation ¶
type FileMutation struct {
// contains filtered or unexported fields
}
FileMutation represents an operation that mutate the Files nodes in the graph.
func (*FileMutation) AddField ¶
func (m *FileMutation) AddField(name string, value ent.Value) error
AddField adds the value for the given name. It returns an error if the field is not defined in the schema, or if the type mismatch the field type.
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 in/decremented from a field with the given name. The second value indicates that this field was not set, or was not define in the schema.
func (*FileMutation) AddedFields ¶
func (m *FileMutation) AddedFields() []string
AddedFields returns all numeric fields that were incremented or 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.
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 for the given name. It returns an error if the edge name is not defined in the schema.
func (*FileMutation) ClearField ¶
func (m *FileMutation) ClearField(name string) error
ClearField clears the value for the given name. It returns an error if the field is not defined in the schema.
func (*FileMutation) ClearMetadata ¶
func (m *FileMutation) ClearMetadata()
ClearMetadata clears the value of metadata.
func (*FileMutation) ClearUser ¶
func (m *FileMutation) ClearUser()
ClearUser clears the user edge to User.
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) EdgeCleared ¶
func (m *FileMutation) EdgeCleared(name string) bool
EdgeCleared returns a boolean indicates if this edge 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 value indicates that this field was not set, or was not define in the schema.
func (*FileMutation) FieldCleared ¶
func (m *FileMutation) FieldCleared(name string) bool
FieldCleared returns a boolean indicates if this field 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 in/decremented, call AddedFields().
func (*FileMutation) Hash ¶
func (m *FileMutation) Hash() (r string, exists bool)
Hash returns the hash value in the mutation.
func (*FileMutation) ID ¶
func (m *FileMutation) ID() (id uuid.UUID, exists bool)
ID returns the id value in the mutation. Note that, the id is available only if it was provided to the builder.
func (*FileMutation) Metadata ¶
func (m *FileMutation) Metadata() (r map[string]interface{}, exists bool)
Metadata returns the metadata value in the mutation.
func (*FileMutation) MetadataCleared ¶
func (m *FileMutation) MetadataCleared() bool
MetadataCleared returns if the field metadata was cleared in this mutation.
func (*FileMutation) PinnedAt ¶
func (m *FileMutation) PinnedAt() (r time.Time, exists bool)
PinnedAt returns the pinned_at value in the mutation.
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 given edge name.
func (*FileMutation) ResetEdge ¶
func (m *FileMutation) ResetEdge(name string) error
ResetEdge resets all changes in the mutation regarding the given edge name. 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 regarding the given field name. It returns an error if the field is not defined in the schema.
func (*FileMutation) ResetHash ¶
func (m *FileMutation) ResetHash()
ResetHash reset all changes of the hash field.
func (*FileMutation) ResetMetadata ¶
func (m *FileMutation) ResetMetadata()
ResetMetadata reset all changes of the metadata field.
func (*FileMutation) ResetPinnedAt ¶
func (m *FileMutation) ResetPinnedAt()
ResetPinnedAt reset all changes of the pinned_at field.
func (*FileMutation) ResetSize ¶
func (m *FileMutation) ResetSize()
ResetSize reset all changes of the size field.
func (*FileMutation) ResetUnpinnedAt ¶
func (m *FileMutation) ResetUnpinnedAt()
ResetUnpinnedAt reset all changes of the unpinned_at field.
func (*FileMutation) ResetUser ¶
func (m *FileMutation) ResetUser()
ResetUser reset all changes of the user edge.
func (*FileMutation) SetField ¶
func (m *FileMutation) SetField(name string, value ent.Value) error
SetField sets the value for the given name. It returns an error if the field is not defined in the schema, or if the type mismatch the field type.
func (*FileMutation) SetHash ¶
func (m *FileMutation) SetHash(s string)
SetHash sets the hash field.
func (*FileMutation) SetID ¶
func (m *FileMutation) SetID(id uuid.UUID)
SetID sets the value of the id field. Note that, this operation is accepted only on File creation.
func (*FileMutation) SetMetadata ¶
func (m *FileMutation) SetMetadata(value map[string]interface{})
SetMetadata sets the metadata field.
func (*FileMutation) SetPinnedAt ¶
func (m *FileMutation) SetPinnedAt(t time.Time)
SetPinnedAt sets the pinned_at field.
func (*FileMutation) SetUnpinnedAt ¶
func (m *FileMutation) SetUnpinnedAt(t time.Time)
SetUnpinnedAt sets the unpinned_at field.
func (*FileMutation) SetUserID ¶
func (m *FileMutation) SetUserID(id int)
SetUserID sets the user edge to User by id.
func (*FileMutation) Size ¶
func (m *FileMutation) Size() (r int64, exists bool)
Size returns the size value 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) UnpinnedAt ¶
func (m *FileMutation) UnpinnedAt() (r time.Time, exists bool)
UnpinnedAt returns the unpinned_at value in the mutation.
func (*FileMutation) UserCleared ¶
func (m *FileMutation) UserCleared() bool
UserCleared returns if the edge user was cleared.
func (*FileMutation) UserID ¶
func (m *FileMutation) UserID() (id int, exists bool)
UserID returns the user id in the mutation.
func (*FileMutation) UserIDs ¶
func (m *FileMutation) UserIDs() (ids []int)
UserIDs returns the user ids in the mutation. Note that ids always returns len(ids) <= 1 for unique edges, and you should use UserID instead. It exists only for internal usage by the builders.
type FileQuery ¶
type FileQuery struct {
// contains filtered or unexported fields
}
FileQuery is the builder for querying File entities.
func (*FileQuery) Clone ¶
Clone returns a duplicate of the query 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) First ¶
First returns the first File entity in the query. Returns *NotFoundError when no file was found.
func (*FileQuery) FirstID ¶
FirstID returns the first File id in the query. Returns *NotFoundError when no id was found.
func (*FileQuery) GroupBy ¶
func (fq *FileQuery) GroupBy(field string, fields ...string) *FileGroupBy
GroupBy used to group vertices by one or more fields/columns. It is often used with aggregate functions, like: count, max, mean, min, sum.
Example:
var v []struct {
Hash string `json:"hash,omitempty"`
Count int `json:"count,omitempty"`
}
client.File.Query().
GroupBy(file.FieldHash).
Aggregate(ent.Count()).
Scan(ctx, &v)
func (*FileQuery) Only ¶
Only returns the only File entity in the query, returns an error if not exactly one entity was returned.
func (*FileQuery) OnlyID ¶
OnlyID returns the only File id in the query, returns an error if not exactly one id was returned.
func (*FileQuery) Select ¶
func (fq *FileQuery) Select(field string, fields ...string) *FileSelect
Select one or more fields from the given query.
Example:
var v []struct {
Hash string `json:"hash,omitempty"`
}
client.File.Query().
Select(file.FieldHash).
Scan(ctx, &v)
type FileSelect ¶
type FileSelect struct {
// contains filtered or unexported fields
}
FileSelect is the builder for select fields of File entities.
func (*FileSelect) Bools ¶
func (fs *FileSelect) Bools(ctx context.Context) ([]bool, error)
Bools returns list of bools from selector. It is only allowed when selecting one field.
func (*FileSelect) BoolsX ¶
func (fs *FileSelect) BoolsX(ctx context.Context) []bool
BoolsX is like Bools, but panics if an error occurs.
func (*FileSelect) Float64s ¶
func (fs *FileSelect) Float64s(ctx context.Context) ([]float64, error)
Float64s returns list of float64s from selector. It is only allowed when selecting one field.
func (*FileSelect) Float64sX ¶
func (fs *FileSelect) Float64sX(ctx context.Context) []float64
Float64sX is like Float64s, but panics if an error occurs.
func (*FileSelect) Ints ¶
func (fs *FileSelect) Ints(ctx context.Context) ([]int, error)
Ints returns list of ints from selector. It is only allowed when selecting one field.
func (*FileSelect) IntsX ¶
func (fs *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 interface{}) error
Scan applies the selector query and scan the result into the given value.
func (*FileSelect) ScanX ¶
func (fs *FileSelect) ScanX(ctx context.Context, v interface{})
ScanX is like Scan, 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) AddSize ¶
func (fu *FileUpdate) AddSize(i int64) *FileUpdate
AddSize adds i to size.
func (*FileUpdate) ClearMetadata ¶
func (fu *FileUpdate) ClearMetadata() *FileUpdate
ClearMetadata clears the value of metadata.
func (*FileUpdate) ClearUser ¶
func (fu *FileUpdate) ClearUser() *FileUpdate
ClearUser clears the user edge to User.
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) Save ¶
func (fu *FileUpdate) Save(ctx context.Context) (int, error)
Save executes the query and returns the number of rows/vertices matched by this operation.
func (*FileUpdate) SaveX ¶
func (fu *FileUpdate) SaveX(ctx context.Context) int
SaveX is like Save, but panics if an error occurs.
func (*FileUpdate) SetMetadata ¶
func (fu *FileUpdate) SetMetadata(m map[string]interface{}) *FileUpdate
SetMetadata sets the metadata field.
func (*FileUpdate) SetSize ¶
func (fu *FileUpdate) SetSize(i int64) *FileUpdate
SetSize sets the size field.
func (*FileUpdate) SetUnpinnedAt ¶
func (fu *FileUpdate) SetUnpinnedAt(t time.Time) *FileUpdate
SetUnpinnedAt sets the unpinned_at field.
func (*FileUpdate) SetUser ¶
func (fu *FileUpdate) SetUser(u *User) *FileUpdate
SetUser sets the user edge to User.
func (*FileUpdate) SetUserID ¶
func (fu *FileUpdate) SetUserID(id int) *FileUpdate
SetUserID sets the user edge to User by id.
func (*FileUpdate) Where ¶
func (fu *FileUpdate) Where(ps ...predicate.File) *FileUpdate
Where adds a new predicate for the builder.
type FileUpdateOne ¶
type FileUpdateOne struct {
// contains filtered or unexported fields
}
FileUpdateOne is the builder for updating a single File entity.
func (*FileUpdateOne) AddSize ¶
func (fuo *FileUpdateOne) AddSize(i int64) *FileUpdateOne
AddSize adds i to size.
func (*FileUpdateOne) ClearMetadata ¶
func (fuo *FileUpdateOne) ClearMetadata() *FileUpdateOne
ClearMetadata clears the value of metadata.
func (*FileUpdateOne) ClearUser ¶
func (fuo *FileUpdateOne) ClearUser() *FileUpdateOne
ClearUser clears the user edge to User.
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) Save ¶
func (fuo *FileUpdateOne) Save(ctx context.Context) (*File, error)
Save executes the query and returns the updated entity.
func (*FileUpdateOne) SaveX ¶
func (fuo *FileUpdateOne) SaveX(ctx context.Context) *File
SaveX is like Save, but panics if an error occurs.
func (*FileUpdateOne) SetMetadata ¶
func (fuo *FileUpdateOne) SetMetadata(m map[string]interface{}) *FileUpdateOne
SetMetadata sets the metadata field.
func (*FileUpdateOne) SetSize ¶
func (fuo *FileUpdateOne) SetSize(i int64) *FileUpdateOne
SetSize sets the size field.
func (*FileUpdateOne) SetUnpinnedAt ¶
func (fuo *FileUpdateOne) SetUnpinnedAt(t time.Time) *FileUpdateOne
SetUnpinnedAt sets the unpinned_at field.
func (*FileUpdateOne) SetUser ¶
func (fuo *FileUpdateOne) SetUser(u *User) *FileUpdateOne
SetUser sets the user edge to User.
func (*FileUpdateOne) SetUserID ¶
func (fuo *FileUpdateOne) SetUserID(id int) *FileUpdateOne
SetUserID sets the user edge to User by id.
type MutateFunc ¶
type MutateFunc = ent.MutateFunc
ent aliases to avoid import conflict 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 Token ¶
type Token struct {
// ID of the ent.
ID uuid.UUID `json:"id,omitempty"`
// Name holds the value of the "name" field.
Name string `json:"name,omitempty"`
// Secret holds the value of the "secret" field.
Secret string `json:"-"`
// Permissions holds the value of the "permissions" field.
Permissions token.Permissions `json:"permissions,omitempty"`
// CreatedAt holds the value of the "created_at" field.
CreatedAt time.Time `json:"created_at,omitempty"`
// LastUsed holds the value of the "last_used" field.
LastUsed time.Time `json:"last_used,omitempty"`
// Edges holds the relations/edges for other nodes in the graph.
// The values are being populated by the TokenQuery when eager-loading is set.
Edges TokenEdges `json:"edges"`
// contains filtered or unexported fields
}
Token is the model entity for the Token schema.
func (*Token) Unwrap ¶
Unwrap unwraps the entity that was returned from a transaction after it was closed, so that all next queries will be executed through the driver which created the transaction.
func (*Token) Update ¶
func (t *Token) Update() *TokenUpdateOne
Update returns a builder for updating this Token. Note that, you need to call Token.Unwrap() before calling this method, if this Token was returned from a transaction, and the transaction was committed or rolled back.
type TokenClient ¶
type TokenClient struct {
// contains filtered or unexported fields
}
TokenClient is a client for the Token schema.
func NewTokenClient ¶
func NewTokenClient(c config) *TokenClient
NewTokenClient returns a client for the Token from the given config.
func (*TokenClient) Create ¶
func (c *TokenClient) Create() *TokenCreate
Create returns a create builder for Token.
func (*TokenClient) Delete ¶
func (c *TokenClient) Delete() *TokenDelete
Delete returns a delete builder for Token.
func (*TokenClient) DeleteOne ¶
func (c *TokenClient) DeleteOne(t *Token) *TokenDeleteOne
DeleteOne returns a delete builder for the given entity.
func (*TokenClient) DeleteOneID ¶
func (c *TokenClient) DeleteOneID(id uuid.UUID) *TokenDeleteOne
DeleteOneID returns a delete builder for the given id.
func (*TokenClient) Query ¶
func (c *TokenClient) Query() *TokenQuery
Create returns a query builder for Token.
func (*TokenClient) QueryUser ¶
func (c *TokenClient) QueryUser(t *Token) *UserQuery
QueryUser queries the user edge of a Token.
func (*TokenClient) Update ¶
func (c *TokenClient) Update() *TokenUpdate
Update returns an update builder for Token.
func (*TokenClient) UpdateOne ¶
func (c *TokenClient) UpdateOne(t *Token) *TokenUpdateOne
UpdateOne returns an update builder for the given entity.
func (*TokenClient) UpdateOneID ¶
func (c *TokenClient) UpdateOneID(id uuid.UUID) *TokenUpdateOne
UpdateOneID returns an update builder for the given id.
func (*TokenClient) Use ¶
func (c *TokenClient) Use(hooks ...Hook)
Use adds a list of mutation hooks to the hooks stack. A call to `Use(f, g, h)` equals to `token.Hooks(f(g(h())))`.
type TokenCreate ¶
type TokenCreate struct {
// contains filtered or unexported fields
}
TokenCreate is the builder for creating a Token entity.
func (*TokenCreate) Save ¶
func (tc *TokenCreate) Save(ctx context.Context) (*Token, error)
Save creates the Token in the database.
func (*TokenCreate) SaveX ¶
func (tc *TokenCreate) SaveX(ctx context.Context) *Token
SaveX calls Save and panics if Save returns an error.
func (*TokenCreate) SetCreatedAt ¶
func (tc *TokenCreate) SetCreatedAt(t time.Time) *TokenCreate
SetCreatedAt sets the created_at field.
func (*TokenCreate) SetID ¶
func (tc *TokenCreate) SetID(u uuid.UUID) *TokenCreate
SetID sets the id field.
func (*TokenCreate) SetLastUsed ¶
func (tc *TokenCreate) SetLastUsed(t time.Time) *TokenCreate
SetLastUsed sets the last_used field.
func (*TokenCreate) SetName ¶
func (tc *TokenCreate) SetName(s string) *TokenCreate
SetName sets the name field.
func (*TokenCreate) SetNillableCreatedAt ¶
func (tc *TokenCreate) SetNillableCreatedAt(t *time.Time) *TokenCreate
SetNillableCreatedAt sets the created_at field if the given value is not nil.
func (*TokenCreate) SetNillableLastUsed ¶
func (tc *TokenCreate) SetNillableLastUsed(t *time.Time) *TokenCreate
SetNillableLastUsed sets the last_used field if the given value is not nil.
func (*TokenCreate) SetNillablePermissions ¶
func (tc *TokenCreate) SetNillablePermissions(t *token.Permissions) *TokenCreate
SetNillablePermissions sets the permissions field if the given value is not nil.
func (*TokenCreate) SetPermissions ¶
func (tc *TokenCreate) SetPermissions(t token.Permissions) *TokenCreate
SetPermissions sets the permissions field.
func (*TokenCreate) SetSecret ¶
func (tc *TokenCreate) SetSecret(s string) *TokenCreate
SetSecret sets the secret field.
func (*TokenCreate) SetUser ¶
func (tc *TokenCreate) SetUser(u *User) *TokenCreate
SetUser sets the user edge to User.
func (*TokenCreate) SetUserID ¶
func (tc *TokenCreate) SetUserID(id int) *TokenCreate
SetUserID sets the user edge to User by id.
type TokenDelete ¶
type TokenDelete struct {
// contains filtered or unexported fields
}
TokenDelete is the builder for deleting a Token entity.
func (*TokenDelete) Exec ¶
func (td *TokenDelete) Exec(ctx context.Context) (int, error)
Exec executes the deletion query and returns how many vertices were deleted.
func (*TokenDelete) ExecX ¶
func (td *TokenDelete) ExecX(ctx context.Context) int
ExecX is like Exec, but panics if an error occurs.
func (*TokenDelete) Where ¶
func (td *TokenDelete) Where(ps ...predicate.Token) *TokenDelete
Where adds a new predicate to the delete builder.
type TokenDeleteOne ¶
type TokenDeleteOne struct {
// contains filtered or unexported fields
}
TokenDeleteOne is the builder for deleting a single Token entity.
func (*TokenDeleteOne) Exec ¶
func (tdo *TokenDeleteOne) Exec(ctx context.Context) error
Exec executes the deletion query.
func (*TokenDeleteOne) ExecX ¶
func (tdo *TokenDeleteOne) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
type TokenEdges ¶
type TokenEdges struct {
// User holds the value of the user edge.
User *User
// contains filtered or unexported fields
}
TokenEdges holds the relations/edges for other nodes in the graph.
func (TokenEdges) UserOrErr ¶
func (e TokenEdges) UserOrErr() (*User, error)
UserOrErr returns the User value or an error if the edge was not loaded in eager-loading, or loaded but was not found.
type TokenGroupBy ¶
type TokenGroupBy struct {
// contains filtered or unexported fields
}
TokenGroupBy is the builder for group-by Token entities.
func (*TokenGroupBy) Aggregate ¶
func (tgb *TokenGroupBy) Aggregate(fns ...Aggregate) *TokenGroupBy
Aggregate adds the given aggregation functions to the group-by query.
func (*TokenGroupBy) Bools ¶
func (tgb *TokenGroupBy) Bools(ctx context.Context) ([]bool, error)
Bools returns list of bools from group-by. It is only allowed when querying group-by with one field.
func (*TokenGroupBy) BoolsX ¶
func (tgb *TokenGroupBy) BoolsX(ctx context.Context) []bool
BoolsX is like Bools, but panics if an error occurs.
func (*TokenGroupBy) Float64s ¶
func (tgb *TokenGroupBy) Float64s(ctx context.Context) ([]float64, error)
Float64s returns list of float64s from group-by. It is only allowed when querying group-by with one field.
func (*TokenGroupBy) Float64sX ¶
func (tgb *TokenGroupBy) Float64sX(ctx context.Context) []float64
Float64sX is like Float64s, but panics if an error occurs.
func (*TokenGroupBy) Ints ¶
func (tgb *TokenGroupBy) Ints(ctx context.Context) ([]int, error)
Ints returns list of ints from group-by. It is only allowed when querying group-by with one field.
func (*TokenGroupBy) IntsX ¶
func (tgb *TokenGroupBy) IntsX(ctx context.Context) []int
IntsX is like Ints, but panics if an error occurs.
func (*TokenGroupBy) Scan ¶
func (tgb *TokenGroupBy) Scan(ctx context.Context, v interface{}) error
Scan applies the group-by query and scan the result into the given value.
func (*TokenGroupBy) ScanX ¶
func (tgb *TokenGroupBy) ScanX(ctx context.Context, v interface{})
ScanX is like Scan, but panics if an error occurs.
type TokenMutation ¶
type TokenMutation struct {
// contains filtered or unexported fields
}
TokenMutation represents an operation that mutate the Tokens nodes in the graph.
func (*TokenMutation) AddField ¶
func (m *TokenMutation) AddField(name string, value ent.Value) error
AddField adds the value for the given name. It returns an error if the field is not defined in the schema, or if the type mismatch the field type.
func (*TokenMutation) AddedEdges ¶
func (m *TokenMutation) AddedEdges() []string
AddedEdges returns all edge names that were set/added in this mutation.
func (*TokenMutation) AddedField ¶
func (m *TokenMutation) AddedField(name string) (ent.Value, bool)
AddedField returns the numeric value that was in/decremented from a field with the given name. The second value indicates that this field was not set, or was not define in the schema.
func (*TokenMutation) AddedFields ¶
func (m *TokenMutation) AddedFields() []string
AddedFields returns all numeric fields that were incremented or decremented during this mutation.
func (*TokenMutation) AddedIDs ¶
func (m *TokenMutation) AddedIDs(name string) []ent.Value
AddedIDs returns all ids (to other nodes) that were added for the given edge name.
func (*TokenMutation) ClearEdge ¶
func (m *TokenMutation) ClearEdge(name string) error
ClearEdge clears the value for the given name. It returns an error if the edge name is not defined in the schema.
func (*TokenMutation) ClearField ¶
func (m *TokenMutation) ClearField(name string) error
ClearField clears the value for the given name. It returns an error if the field is not defined in the schema.
func (*TokenMutation) ClearLastUsed ¶
func (m *TokenMutation) ClearLastUsed()
ClearLastUsed clears the value of last_used.
func (*TokenMutation) ClearUser ¶
func (m *TokenMutation) ClearUser()
ClearUser clears the user edge to User.
func (*TokenMutation) ClearedEdges ¶
func (m *TokenMutation) ClearedEdges() []string
ClearedEdges returns all edge names that were cleared in this mutation.
func (*TokenMutation) ClearedFields ¶
func (m *TokenMutation) ClearedFields() []string
ClearedFields returns all nullable fields that were cleared during this mutation.
func (TokenMutation) Client ¶
func (m TokenMutation) 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 (*TokenMutation) CreatedAt ¶
func (m *TokenMutation) CreatedAt() (r time.Time, exists bool)
CreatedAt returns the created_at value in the mutation.
func (*TokenMutation) EdgeCleared ¶
func (m *TokenMutation) EdgeCleared(name string) bool
EdgeCleared returns a boolean indicates if this edge was cleared in this mutation.
func (*TokenMutation) Field ¶
func (m *TokenMutation) Field(name string) (ent.Value, bool)
Field returns the value of a field with the given name. The second boolean value indicates that this field was not set, or was not define in the schema.
func (*TokenMutation) FieldCleared ¶
func (m *TokenMutation) FieldCleared(name string) bool
FieldCleared returns a boolean indicates if this field was cleared in this mutation.
func (*TokenMutation) Fields ¶
func (m *TokenMutation) Fields() []string
Fields returns all fields that were changed during this mutation. Note that, in order to get all numeric fields that were in/decremented, call AddedFields().
func (*TokenMutation) ID ¶
func (m *TokenMutation) ID() (id uuid.UUID, exists bool)
ID returns the id value in the mutation. Note that, the id is available only if it was provided to the builder.
func (*TokenMutation) LastUsed ¶
func (m *TokenMutation) LastUsed() (r time.Time, exists bool)
LastUsed returns the last_used value in the mutation.
func (*TokenMutation) LastUsedCleared ¶
func (m *TokenMutation) LastUsedCleared() bool
LastUsedCleared returns if the field last_used was cleared in this mutation.
func (*TokenMutation) Name ¶
func (m *TokenMutation) Name() (r string, exists bool)
Name returns the name value in the mutation.
func (*TokenMutation) Permissions ¶
func (m *TokenMutation) Permissions() (r token.Permissions, exists bool)
Permissions returns the permissions value in the mutation.
func (*TokenMutation) RemovedEdges ¶
func (m *TokenMutation) RemovedEdges() []string
RemovedEdges returns all edge names that were removed in this mutation.
func (*TokenMutation) RemovedIDs ¶
func (m *TokenMutation) RemovedIDs(name string) []ent.Value
RemovedIDs returns all ids (to other nodes) that were removed for the given edge name.
func (*TokenMutation) ResetCreatedAt ¶
func (m *TokenMutation) ResetCreatedAt()
ResetCreatedAt reset all changes of the created_at field.
func (*TokenMutation) ResetEdge ¶
func (m *TokenMutation) ResetEdge(name string) error
ResetEdge resets all changes in the mutation regarding the given edge name. It returns an error if the edge is not defined in the schema.
func (*TokenMutation) ResetField ¶
func (m *TokenMutation) ResetField(name string) error
ResetField resets all changes in the mutation regarding the given field name. It returns an error if the field is not defined in the schema.
func (*TokenMutation) ResetLastUsed ¶
func (m *TokenMutation) ResetLastUsed()
ResetLastUsed reset all changes of the last_used field.
func (*TokenMutation) ResetName ¶
func (m *TokenMutation) ResetName()
ResetName reset all changes of the name field.
func (*TokenMutation) ResetPermissions ¶
func (m *TokenMutation) ResetPermissions()
ResetPermissions reset all changes of the permissions field.
func (*TokenMutation) ResetSecret ¶
func (m *TokenMutation) ResetSecret()
ResetSecret reset all changes of the secret field.
func (*TokenMutation) ResetUser ¶
func (m *TokenMutation) ResetUser()
ResetUser reset all changes of the user edge.
func (*TokenMutation) Secret ¶
func (m *TokenMutation) Secret() (r string, exists bool)
Secret returns the secret value in the mutation.
func (*TokenMutation) SetCreatedAt ¶
func (m *TokenMutation) SetCreatedAt(t time.Time)
SetCreatedAt sets the created_at field.
func (*TokenMutation) SetField ¶
func (m *TokenMutation) SetField(name string, value ent.Value) error
SetField sets the value for the given name. It returns an error if the field is not defined in the schema, or if the type mismatch the field type.
func (*TokenMutation) SetID ¶
func (m *TokenMutation) SetID(id uuid.UUID)
SetID sets the value of the id field. Note that, this operation is accepted only on Token creation.
func (*TokenMutation) SetLastUsed ¶
func (m *TokenMutation) SetLastUsed(t time.Time)
SetLastUsed sets the last_used field.
func (*TokenMutation) SetName ¶
func (m *TokenMutation) SetName(s string)
SetName sets the name field.
func (*TokenMutation) SetPermissions ¶
func (m *TokenMutation) SetPermissions(t token.Permissions)
SetPermissions sets the permissions field.
func (*TokenMutation) SetSecret ¶
func (m *TokenMutation) SetSecret(s string)
SetSecret sets the secret field.
func (*TokenMutation) SetUserID ¶
func (m *TokenMutation) SetUserID(id int)
SetUserID sets the user edge to User by id.
func (TokenMutation) Tx ¶
func (m TokenMutation) Tx() (*Tx, error)
Tx returns an `ent.Tx` for mutations that were executed in transactions; it returns an error otherwise.
func (*TokenMutation) Type ¶
func (m *TokenMutation) Type() string
Type returns the node type of this mutation (Token).
func (*TokenMutation) UserCleared ¶
func (m *TokenMutation) UserCleared() bool
UserCleared returns if the edge user was cleared.
func (*TokenMutation) UserID ¶
func (m *TokenMutation) UserID() (id int, exists bool)
UserID returns the user id in the mutation.
func (*TokenMutation) UserIDs ¶
func (m *TokenMutation) UserIDs() (ids []int)
UserIDs returns the user ids in the mutation. Note that ids always returns len(ids) <= 1 for unique edges, and you should use UserID instead. It exists only for internal usage by the builders.
type TokenQuery ¶
type TokenQuery struct {
// contains filtered or unexported fields
}
TokenQuery is the builder for querying Token entities.
func (*TokenQuery) All ¶
func (tq *TokenQuery) All(ctx context.Context) ([]*Token, error)
All executes the query and returns a list of Tokens.
func (*TokenQuery) AllX ¶
func (tq *TokenQuery) AllX(ctx context.Context) []*Token
AllX is like All, but panics if an error occurs.
func (*TokenQuery) Clone ¶
func (tq *TokenQuery) Clone() *TokenQuery
Clone returns a duplicate of the query builder, including all associated steps. It can be used to prepare common query builders and use them differently after the clone is made.
func (*TokenQuery) Count ¶
func (tq *TokenQuery) Count(ctx context.Context) (int, error)
Count returns the count of the given query.
func (*TokenQuery) CountX ¶
func (tq *TokenQuery) CountX(ctx context.Context) int
CountX is like Count, but panics if an error occurs.
func (*TokenQuery) Exist ¶
func (tq *TokenQuery) Exist(ctx context.Context) (bool, error)
Exist returns true if the query has elements in the graph.
func (*TokenQuery) ExistX ¶
func (tq *TokenQuery) ExistX(ctx context.Context) bool
ExistX is like Exist, but panics if an error occurs.
func (*TokenQuery) First ¶
func (tq *TokenQuery) First(ctx context.Context) (*Token, error)
First returns the first Token entity in the query. Returns *NotFoundError when no token was found.
func (*TokenQuery) FirstID ¶
FirstID returns the first Token id in the query. Returns *NotFoundError when no id was found.
func (*TokenQuery) FirstX ¶
func (tq *TokenQuery) FirstX(ctx context.Context) *Token
FirstX is like First, but panics if an error occurs.
func (*TokenQuery) FirstXID ¶
func (tq *TokenQuery) FirstXID(ctx context.Context) uuid.UUID
FirstXID is like FirstID, but panics if an error occurs.
func (*TokenQuery) GroupBy ¶
func (tq *TokenQuery) GroupBy(field string, fields ...string) *TokenGroupBy
GroupBy 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.Token.Query().
GroupBy(token.FieldName).
Aggregate(ent.Count()).
Scan(ctx, &v)
func (*TokenQuery) IDsX ¶
func (tq *TokenQuery) IDsX(ctx context.Context) []uuid.UUID
IDsX is like IDs, but panics if an error occurs.
func (*TokenQuery) Limit ¶
func (tq *TokenQuery) Limit(limit int) *TokenQuery
Limit adds a limit step to the query.
func (*TokenQuery) Offset ¶
func (tq *TokenQuery) Offset(offset int) *TokenQuery
Offset adds an offset step to the query.
func (*TokenQuery) Only ¶
func (tq *TokenQuery) Only(ctx context.Context) (*Token, error)
Only returns the only Token entity in the query, returns an error if not exactly one entity was returned.
func (*TokenQuery) OnlyID ¶
OnlyID returns the only Token id in the query, returns an error if not exactly one id was returned.
func (*TokenQuery) OnlyX ¶
func (tq *TokenQuery) OnlyX(ctx context.Context) *Token
OnlyX is like Only, but panics if an error occurs.
func (*TokenQuery) OnlyXID ¶
func (tq *TokenQuery) OnlyXID(ctx context.Context) uuid.UUID
OnlyXID is like OnlyID, but panics if an error occurs.
func (*TokenQuery) Order ¶
func (tq *TokenQuery) Order(o ...Order) *TokenQuery
Order adds an order step to the query.
func (*TokenQuery) QueryUser ¶
func (tq *TokenQuery) QueryUser() *UserQuery
QueryUser chains the current query on the user edge.
func (*TokenQuery) Select ¶
func (tq *TokenQuery) Select(field string, fields ...string) *TokenSelect
Select one or more fields from the given query.
Example:
var v []struct {
Name string `json:"name,omitempty"`
}
client.Token.Query().
Select(token.FieldName).
Scan(ctx, &v)
func (*TokenQuery) Where ¶
func (tq *TokenQuery) Where(ps ...predicate.Token) *TokenQuery
Where adds a new predicate for the builder.
func (*TokenQuery) WithUser ¶
func (tq *TokenQuery) WithUser(opts ...func(*UserQuery)) *TokenQuery
WithUser tells the query-builder to eager-loads the nodes that are connected to
the "user" edge. The optional arguments used to configure the query builder of the edge.
type TokenSelect ¶
type TokenSelect struct {
// contains filtered or unexported fields
}
TokenSelect is the builder for select fields of Token entities.
func (*TokenSelect) Bools ¶
func (ts *TokenSelect) Bools(ctx context.Context) ([]bool, error)
Bools returns list of bools from selector. It is only allowed when selecting one field.
func (*TokenSelect) BoolsX ¶
func (ts *TokenSelect) BoolsX(ctx context.Context) []bool
BoolsX is like Bools, but panics if an error occurs.
func (*TokenSelect) Float64s ¶
func (ts *TokenSelect) Float64s(ctx context.Context) ([]float64, error)
Float64s returns list of float64s from selector. It is only allowed when selecting one field.
func (*TokenSelect) Float64sX ¶
func (ts *TokenSelect) Float64sX(ctx context.Context) []float64
Float64sX is like Float64s, but panics if an error occurs.
func (*TokenSelect) Ints ¶
func (ts *TokenSelect) Ints(ctx context.Context) ([]int, error)
Ints returns list of ints from selector. It is only allowed when selecting one field.
func (*TokenSelect) IntsX ¶
func (ts *TokenSelect) IntsX(ctx context.Context) []int
IntsX is like Ints, but panics if an error occurs.
func (*TokenSelect) Scan ¶
func (ts *TokenSelect) Scan(ctx context.Context, v interface{}) error
Scan applies the selector query and scan the result into the given value.
func (*TokenSelect) ScanX ¶
func (ts *TokenSelect) ScanX(ctx context.Context, v interface{})
ScanX is like Scan, but panics if an error occurs.
type TokenUpdate ¶
type TokenUpdate struct {
// contains filtered or unexported fields
}
TokenUpdate is the builder for updating Token entities.
func (*TokenUpdate) ClearLastUsed ¶
func (tu *TokenUpdate) ClearLastUsed() *TokenUpdate
ClearLastUsed clears the value of last_used.
func (*TokenUpdate) ClearUser ¶
func (tu *TokenUpdate) ClearUser() *TokenUpdate
ClearUser clears the user edge to User.
func (*TokenUpdate) Exec ¶
func (tu *TokenUpdate) Exec(ctx context.Context) error
Exec executes the query.
func (*TokenUpdate) ExecX ¶
func (tu *TokenUpdate) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*TokenUpdate) Save ¶
func (tu *TokenUpdate) Save(ctx context.Context) (int, error)
Save executes the query and returns the number of rows/vertices matched by this operation.
func (*TokenUpdate) SaveX ¶
func (tu *TokenUpdate) SaveX(ctx context.Context) int
SaveX is like Save, but panics if an error occurs.
func (*TokenUpdate) SetLastUsed ¶
func (tu *TokenUpdate) SetLastUsed(t time.Time) *TokenUpdate
SetLastUsed sets the last_used field.
func (*TokenUpdate) SetName ¶
func (tu *TokenUpdate) SetName(s string) *TokenUpdate
SetName sets the name field.
func (*TokenUpdate) SetNillableLastUsed ¶
func (tu *TokenUpdate) SetNillableLastUsed(t *time.Time) *TokenUpdate
SetNillableLastUsed sets the last_used field if the given value is not nil.
func (*TokenUpdate) SetSecret ¶
func (tu *TokenUpdate) SetSecret(s string) *TokenUpdate
SetSecret sets the secret field.
func (*TokenUpdate) SetUser ¶
func (tu *TokenUpdate) SetUser(u *User) *TokenUpdate
SetUser sets the user edge to User.
func (*TokenUpdate) SetUserID ¶
func (tu *TokenUpdate) SetUserID(id int) *TokenUpdate
SetUserID sets the user edge to User by id.
func (*TokenUpdate) Where ¶
func (tu *TokenUpdate) Where(ps ...predicate.Token) *TokenUpdate
Where adds a new predicate for the builder.
type TokenUpdateOne ¶
type TokenUpdateOne struct {
// contains filtered or unexported fields
}
TokenUpdateOne is the builder for updating a single Token entity.
func (*TokenUpdateOne) ClearLastUsed ¶
func (tuo *TokenUpdateOne) ClearLastUsed() *TokenUpdateOne
ClearLastUsed clears the value of last_used.
func (*TokenUpdateOne) ClearUser ¶
func (tuo *TokenUpdateOne) ClearUser() *TokenUpdateOne
ClearUser clears the user edge to User.
func (*TokenUpdateOne) Exec ¶
func (tuo *TokenUpdateOne) Exec(ctx context.Context) error
Exec executes the query on the entity.
func (*TokenUpdateOne) ExecX ¶
func (tuo *TokenUpdateOne) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*TokenUpdateOne) Save ¶
func (tuo *TokenUpdateOne) Save(ctx context.Context) (*Token, error)
Save executes the query and returns the updated entity.
func (*TokenUpdateOne) SaveX ¶
func (tuo *TokenUpdateOne) SaveX(ctx context.Context) *Token
SaveX is like Save, but panics if an error occurs.
func (*TokenUpdateOne) SetLastUsed ¶
func (tuo *TokenUpdateOne) SetLastUsed(t time.Time) *TokenUpdateOne
SetLastUsed sets the last_used field.
func (*TokenUpdateOne) SetName ¶
func (tuo *TokenUpdateOne) SetName(s string) *TokenUpdateOne
SetName sets the name field.
func (*TokenUpdateOne) SetNillableLastUsed ¶
func (tuo *TokenUpdateOne) SetNillableLastUsed(t *time.Time) *TokenUpdateOne
SetNillableLastUsed sets the last_used field if the given value is not nil.
func (*TokenUpdateOne) SetSecret ¶
func (tuo *TokenUpdateOne) SetSecret(s string) *TokenUpdateOne
SetSecret sets the secret field.
func (*TokenUpdateOne) SetUser ¶
func (tuo *TokenUpdateOne) SetUser(u *User) *TokenUpdateOne
SetUser sets the user edge to User.
func (*TokenUpdateOne) SetUserID ¶
func (tuo *TokenUpdateOne) SetUserID(id int) *TokenUpdateOne
SetUserID sets the user edge to User by id.
type Tx ¶
type Tx struct {
// File is the client for interacting with the File builders.
File *FileClient
// Token is the client for interacting with the Token builders.
Token *TokenClient
// 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 ¶
TxFromContext returns the Tx stored in a context, or nil if there isn't one.
func (*Tx) OnRollback ¶
OnRollback adds a function to call on rollback.
type User ¶
type User struct {
// ID of the ent.
ID int `json:"id,omitempty"`
// Email holds the value of the "email" field.
Email string `json:"email,omitempty"`
// Password holds the value of the "password" field.
Password string `json:"-"`
// Active holds the value of the "active" field.
Active bool `json:"active,omitempty"`
// UpdatedAt holds the value of the "updated_at" field.
UpdatedAt time.Time `json:"updated_at,omitempty"`
// CreatedAt holds the value of the "created_at" field.
CreatedAt time.Time `json:"created_at,omitempty"`
// Plan holds the value of the "plan" field.
Plan user.Plan `json:"plan,omitempty"`
// Edges holds the relations/edges for other nodes in the graph.
// The values are being populated by the UserQuery when eager-loading is set.
Edges UserEdges `json:"edges"`
// contains filtered or unexported fields
}
User is the model entity for the User schema.
func (*User) QueryFiles ¶
QueryFiles queries the files edge of the User.
func (*User) QueryTokens ¶
func (u *User) QueryTokens() *TokenQuery
QueryTokens queries the tokens edge of the User.
func (*User) Unwrap ¶
Unwrap unwraps the entity that was returned from a transaction after it was closed, so that all next queries will be executed through the driver which created the transaction.
func (*User) Update ¶
func (u *User) Update() *UserUpdateOne
Update returns a builder for updating this User. Note that, you need to call User.Unwrap() before calling this method, if this User was returned from a transaction, and the transaction was committed or rolled back.
type UserClient ¶
type UserClient struct {
// contains filtered or unexported fields
}
UserClient is a client for the User schema.
func NewUserClient ¶
func NewUserClient(c config) *UserClient
NewUserClient returns a client for the User from the given config.
func (*UserClient) Create ¶
func (c *UserClient) Create() *UserCreate
Create returns a create builder for User.
func (*UserClient) Delete ¶
func (c *UserClient) Delete() *UserDelete
Delete returns a delete builder for User.
func (*UserClient) DeleteOne ¶
func (c *UserClient) DeleteOne(u *User) *UserDeleteOne
DeleteOne returns a delete builder for the given entity.
func (*UserClient) DeleteOneID ¶
func (c *UserClient) DeleteOneID(id int) *UserDeleteOne
DeleteOneID returns a delete builder for the given id.
func (*UserClient) GetX ¶
func (c *UserClient) GetX(ctx context.Context, id int) *User
GetX is like Get, but panics if an error occurs.
func (*UserClient) Query ¶
func (c *UserClient) Query() *UserQuery
Create returns a query builder for User.
func (*UserClient) QueryFiles ¶
func (c *UserClient) QueryFiles(u *User) *FileQuery
QueryFiles queries the files edge of a User.
func (*UserClient) QueryTokens ¶
func (c *UserClient) QueryTokens(u *User) *TokenQuery
QueryTokens queries the tokens edge of a User.
func (*UserClient) Update ¶
func (c *UserClient) Update() *UserUpdate
Update returns an update builder for User.
func (*UserClient) UpdateOne ¶
func (c *UserClient) UpdateOne(u *User) *UserUpdateOne
UpdateOne returns an update builder for the given entity.
func (*UserClient) UpdateOneID ¶
func (c *UserClient) UpdateOneID(id int) *UserUpdateOne
UpdateOneID returns an update builder for the given id.
func (*UserClient) Use ¶
func (c *UserClient) Use(hooks ...Hook)
Use adds a list of mutation hooks to the hooks stack. A call to `Use(f, g, h)` equals to `user.Hooks(f(g(h())))`.
type UserCreate ¶
type UserCreate struct {
// contains filtered or unexported fields
}
UserCreate is the builder for creating a User entity.
func (*UserCreate) AddFileIDs ¶
func (uc *UserCreate) AddFileIDs(ids ...uuid.UUID) *UserCreate
AddFileIDs adds the files edge to File by ids.
func (*UserCreate) AddFiles ¶
func (uc *UserCreate) AddFiles(f ...*File) *UserCreate
AddFiles adds the files edges to File.
func (*UserCreate) AddTokenIDs ¶
func (uc *UserCreate) AddTokenIDs(ids ...uuid.UUID) *UserCreate
AddTokenIDs adds the tokens edge to Token by ids.
func (*UserCreate) AddTokens ¶
func (uc *UserCreate) AddTokens(t ...*Token) *UserCreate
AddTokens adds the tokens edges to Token.
func (*UserCreate) Save ¶
func (uc *UserCreate) Save(ctx context.Context) (*User, error)
Save creates the User in the database.
func (*UserCreate) SaveX ¶
func (uc *UserCreate) SaveX(ctx context.Context) *User
SaveX calls Save and panics if Save returns an error.
func (*UserCreate) SetActive ¶
func (uc *UserCreate) SetActive(b bool) *UserCreate
SetActive sets the active field.
func (*UserCreate) SetCreatedAt ¶
func (uc *UserCreate) SetCreatedAt(t time.Time) *UserCreate
SetCreatedAt sets the created_at field.
func (*UserCreate) SetEmail ¶
func (uc *UserCreate) SetEmail(s string) *UserCreate
SetEmail sets the email field.
func (*UserCreate) SetNillableActive ¶
func (uc *UserCreate) SetNillableActive(b *bool) *UserCreate
SetNillableActive sets the active field if the given value is not nil.
func (*UserCreate) SetNillableCreatedAt ¶
func (uc *UserCreate) SetNillableCreatedAt(t *time.Time) *UserCreate
SetNillableCreatedAt sets the created_at field if the given value is not nil.
func (*UserCreate) SetNillablePlan ¶
func (uc *UserCreate) SetNillablePlan(u *user.Plan) *UserCreate
SetNillablePlan sets the plan field if the given value is not nil.
func (*UserCreate) SetNillableUpdatedAt ¶
func (uc *UserCreate) SetNillableUpdatedAt(t *time.Time) *UserCreate
SetNillableUpdatedAt sets the updated_at field if the given value is not nil.
func (*UserCreate) SetPassword ¶
func (uc *UserCreate) SetPassword(s string) *UserCreate
SetPassword sets the password field.
func (*UserCreate) SetPlan ¶
func (uc *UserCreate) SetPlan(u user.Plan) *UserCreate
SetPlan sets the plan field.
func (*UserCreate) SetUpdatedAt ¶
func (uc *UserCreate) SetUpdatedAt(t time.Time) *UserCreate
SetUpdatedAt sets the updated_at field.
type UserDelete ¶
type UserDelete struct {
// contains filtered or unexported fields
}
UserDelete is the builder for deleting a User entity.
func (*UserDelete) Exec ¶
func (ud *UserDelete) Exec(ctx context.Context) (int, error)
Exec executes the deletion query and returns how many vertices were deleted.
func (*UserDelete) ExecX ¶
func (ud *UserDelete) ExecX(ctx context.Context) int
ExecX is like Exec, but panics if an error occurs.
func (*UserDelete) Where ¶
func (ud *UserDelete) Where(ps ...predicate.User) *UserDelete
Where adds a new predicate to the delete builder.
type UserDeleteOne ¶
type UserDeleteOne struct {
// contains filtered or unexported fields
}
UserDeleteOne is the builder for deleting a single User entity.
func (*UserDeleteOne) Exec ¶
func (udo *UserDeleteOne) Exec(ctx context.Context) error
Exec executes the deletion query.
func (*UserDeleteOne) ExecX ¶
func (udo *UserDeleteOne) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
type UserEdges ¶
type UserEdges struct {
// Tokens holds the value of the tokens edge.
Tokens []*Token
// Files holds the value of the files edge.
Files []*File
// contains filtered or unexported fields
}
UserEdges holds the relations/edges for other nodes in the graph.
func (UserEdges) FilesOrErr ¶
FilesOrErr returns the Files value or an error if the edge was not loaded in eager-loading.
func (UserEdges) TokensOrErr ¶
TokensOrErr returns the Tokens value or an error if the edge was not loaded in eager-loading.
type UserGroupBy ¶
type UserGroupBy struct {
// contains filtered or unexported fields
}
UserGroupBy is the builder for group-by User entities.
func (*UserGroupBy) Aggregate ¶
func (ugb *UserGroupBy) Aggregate(fns ...Aggregate) *UserGroupBy
Aggregate adds the given aggregation functions to the group-by query.
func (*UserGroupBy) Bools ¶
func (ugb *UserGroupBy) Bools(ctx context.Context) ([]bool, error)
Bools returns list of bools from group-by. It is only allowed when querying group-by with one field.
func (*UserGroupBy) BoolsX ¶
func (ugb *UserGroupBy) BoolsX(ctx context.Context) []bool
BoolsX is like Bools, but panics if an error occurs.
func (*UserGroupBy) Float64s ¶
func (ugb *UserGroupBy) Float64s(ctx context.Context) ([]float64, error)
Float64s returns list of float64s from group-by. It is only allowed when querying group-by with one field.
func (*UserGroupBy) Float64sX ¶
func (ugb *UserGroupBy) Float64sX(ctx context.Context) []float64
Float64sX is like Float64s, but panics if an error occurs.
func (*UserGroupBy) Ints ¶
func (ugb *UserGroupBy) Ints(ctx context.Context) ([]int, error)
Ints returns list of ints from group-by. It is only allowed when querying group-by with one field.
func (*UserGroupBy) IntsX ¶
func (ugb *UserGroupBy) IntsX(ctx context.Context) []int
IntsX is like Ints, but panics if an error occurs.
func (*UserGroupBy) Scan ¶
func (ugb *UserGroupBy) Scan(ctx context.Context, v interface{}) error
Scan applies the group-by query and scan the result into the given value.
func (*UserGroupBy) ScanX ¶
func (ugb *UserGroupBy) ScanX(ctx context.Context, v interface{})
ScanX is like Scan, but panics if an error occurs.
type UserMutation ¶
type UserMutation struct {
// contains filtered or unexported fields
}
UserMutation represents an operation that mutate the Users nodes in the graph.
func (*UserMutation) Active ¶
func (m *UserMutation) Active() (r bool, exists bool)
Active returns the active value in the mutation.
func (*UserMutation) AddField ¶
func (m *UserMutation) AddField(name string, value ent.Value) error
AddField adds the value for the given name. It returns an error if the field is not defined in the schema, or if the type mismatch the field type.
func (*UserMutation) AddFileIDs ¶
func (m *UserMutation) AddFileIDs(ids ...uuid.UUID)
AddFileIDs adds the files edge to File by ids.
func (*UserMutation) AddTokenIDs ¶
func (m *UserMutation) AddTokenIDs(ids ...uuid.UUID)
AddTokenIDs adds the tokens edge to Token by ids.
func (*UserMutation) AddedEdges ¶
func (m *UserMutation) AddedEdges() []string
AddedEdges returns all edge names that were set/added in this mutation.
func (*UserMutation) AddedField ¶
func (m *UserMutation) AddedField(name string) (ent.Value, bool)
AddedField returns the numeric value that was in/decremented from a field with the given name. The second value indicates that this field was not set, or was not define in the schema.
func (*UserMutation) AddedFields ¶
func (m *UserMutation) AddedFields() []string
AddedFields returns all numeric fields that were incremented or decremented during this mutation.
func (*UserMutation) AddedIDs ¶
func (m *UserMutation) AddedIDs(name string) []ent.Value
AddedIDs returns all ids (to other nodes) that were added for the given edge name.
func (*UserMutation) ClearEdge ¶
func (m *UserMutation) ClearEdge(name string) error
ClearEdge clears the value for the given name. It returns an error if the edge name is not defined in the schema.
func (*UserMutation) ClearField ¶
func (m *UserMutation) ClearField(name string) error
ClearField clears the value for the given name. It returns an error if the field is not defined in the schema.
func (*UserMutation) ClearedEdges ¶
func (m *UserMutation) ClearedEdges() []string
ClearedEdges returns all edge names that were cleared in this mutation.
func (*UserMutation) ClearedFields ¶
func (m *UserMutation) ClearedFields() []string
ClearedFields returns all nullable fields that were cleared during this mutation.
func (UserMutation) Client ¶
func (m UserMutation) Client() *Client
Client returns a new `ent.Client` from the mutation. If the mutation was executed in a transaction (ent.Tx), a transactional client is returned.
func (*UserMutation) CreatedAt ¶
func (m *UserMutation) CreatedAt() (r time.Time, exists bool)
CreatedAt returns the created_at value in the mutation.
func (*UserMutation) EdgeCleared ¶
func (m *UserMutation) EdgeCleared(name string) bool
EdgeCleared returns a boolean indicates if this edge was cleared in this mutation.
func (*UserMutation) Email ¶
func (m *UserMutation) Email() (r string, exists bool)
Email returns the email value in the mutation.
func (*UserMutation) Field ¶
func (m *UserMutation) Field(name string) (ent.Value, bool)
Field returns the value of a field with the given name. The second boolean value indicates that this field was not set, or was not define in the schema.
func (*UserMutation) FieldCleared ¶
func (m *UserMutation) FieldCleared(name string) bool
FieldCleared returns a boolean indicates if this field was cleared in this mutation.
func (*UserMutation) Fields ¶
func (m *UserMutation) Fields() []string
Fields returns all fields that were changed during this mutation. Note that, in order to get all numeric fields that were in/decremented, call AddedFields().
func (*UserMutation) FilesIDs ¶
func (m *UserMutation) FilesIDs() (ids []uuid.UUID)
FilesIDs returns the files ids in the mutation.
func (*UserMutation) ID ¶
func (m *UserMutation) ID() (id int, exists bool)
ID returns the id value in the mutation. Note that, the id is available only if it was provided to the builder.
func (*UserMutation) Password ¶
func (m *UserMutation) Password() (r string, exists bool)
Password returns the password value in the mutation.
func (*UserMutation) Plan ¶
func (m *UserMutation) Plan() (r user.Plan, exists bool)
Plan returns the plan value in the mutation.
func (*UserMutation) RemoveFileIDs ¶
func (m *UserMutation) RemoveFileIDs(ids ...uuid.UUID)
RemoveFileIDs removes the files edge to File by ids.
func (*UserMutation) RemoveTokenIDs ¶
func (m *UserMutation) RemoveTokenIDs(ids ...uuid.UUID)
RemoveTokenIDs removes the tokens edge to Token by ids.
func (*UserMutation) RemovedEdges ¶
func (m *UserMutation) RemovedEdges() []string
RemovedEdges returns all edge names that were removed in this mutation.
func (*UserMutation) RemovedFilesIDs ¶
func (m *UserMutation) RemovedFilesIDs() (ids []uuid.UUID)
RemovedFiles returns the removed ids of files.
func (*UserMutation) RemovedIDs ¶
func (m *UserMutation) RemovedIDs(name string) []ent.Value
RemovedIDs returns all ids (to other nodes) that were removed for the given edge name.
func (*UserMutation) RemovedTokensIDs ¶
func (m *UserMutation) RemovedTokensIDs() (ids []uuid.UUID)
RemovedTokens returns the removed ids of tokens.
func (*UserMutation) ResetActive ¶
func (m *UserMutation) ResetActive()
ResetActive reset all changes of the active field.
func (*UserMutation) ResetCreatedAt ¶
func (m *UserMutation) ResetCreatedAt()
ResetCreatedAt reset all changes of the created_at field.
func (*UserMutation) ResetEdge ¶
func (m *UserMutation) ResetEdge(name string) error
ResetEdge resets all changes in the mutation regarding the given edge name. It returns an error if the edge is not defined in the schema.
func (*UserMutation) ResetEmail ¶
func (m *UserMutation) ResetEmail()
ResetEmail reset all changes of the email field.
func (*UserMutation) ResetField ¶
func (m *UserMutation) ResetField(name string) error
ResetField resets all changes in the mutation regarding the given field name. It returns an error if the field is not defined in the schema.
func (*UserMutation) ResetFiles ¶
func (m *UserMutation) ResetFiles()
ResetFiles reset all changes of the files edge.
func (*UserMutation) ResetPassword ¶
func (m *UserMutation) ResetPassword()
ResetPassword reset all changes of the password field.
func (*UserMutation) ResetPlan ¶
func (m *UserMutation) ResetPlan()
ResetPlan reset all changes of the plan field.
func (*UserMutation) ResetTokens ¶
func (m *UserMutation) ResetTokens()
ResetTokens reset all changes of the tokens edge.
func (*UserMutation) ResetUpdatedAt ¶
func (m *UserMutation) ResetUpdatedAt()
ResetUpdatedAt reset all changes of the updated_at field.
func (*UserMutation) SetActive ¶
func (m *UserMutation) SetActive(b bool)
SetActive sets the active field.
func (*UserMutation) SetCreatedAt ¶
func (m *UserMutation) SetCreatedAt(t time.Time)
SetCreatedAt sets the created_at field.
func (*UserMutation) SetEmail ¶
func (m *UserMutation) SetEmail(s string)
SetEmail sets the email field.
func (*UserMutation) SetField ¶
func (m *UserMutation) SetField(name string, value ent.Value) error
SetField sets the value for the given name. It returns an error if the field is not defined in the schema, or if the type mismatch the field type.
func (*UserMutation) SetPassword ¶
func (m *UserMutation) SetPassword(s string)
SetPassword sets the password field.
func (*UserMutation) SetPlan ¶
func (m *UserMutation) SetPlan(u user.Plan)
SetPlan sets the plan field.
func (*UserMutation) SetUpdatedAt ¶
func (m *UserMutation) SetUpdatedAt(t time.Time)
SetUpdatedAt sets the updated_at field.
func (*UserMutation) TokensIDs ¶
func (m *UserMutation) TokensIDs() (ids []uuid.UUID)
TokensIDs returns the tokens ids in the mutation.
func (UserMutation) Tx ¶
func (m UserMutation) Tx() (*Tx, error)
Tx returns an `ent.Tx` for mutations that were executed in transactions; it returns an error otherwise.
func (*UserMutation) Type ¶
func (m *UserMutation) Type() string
Type returns the node type of this mutation (User).
type UserQuery ¶
type UserQuery struct {
// contains filtered or unexported fields
}
UserQuery is the builder for querying User entities.
func (*UserQuery) Clone ¶
Clone returns a duplicate of the query 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) First ¶
First returns the first User entity in the query. Returns *NotFoundError when no user was found.
func (*UserQuery) FirstID ¶
FirstID returns the first User id in the query. Returns *NotFoundError when no id was found.
func (*UserQuery) GroupBy ¶
func (uq *UserQuery) GroupBy(field string, fields ...string) *UserGroupBy
GroupBy 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 {
Email string `json:"email,omitempty"`
Count int `json:"count,omitempty"`
}
client.User.Query().
GroupBy(user.FieldEmail).
Aggregate(ent.Count()).
Scan(ctx, &v)
func (*UserQuery) Only ¶
Only returns the only User entity in the query, returns an error if not exactly one entity was returned.
func (*UserQuery) OnlyID ¶
OnlyID returns the only User id in the query, returns an error if not exactly one id was returned.
func (*UserQuery) QueryFiles ¶
QueryFiles chains the current query on the files edge.
func (*UserQuery) QueryTokens ¶
func (uq *UserQuery) QueryTokens() *TokenQuery
QueryTokens chains the current query on the tokens edge.
func (*UserQuery) Select ¶
func (uq *UserQuery) Select(field string, fields ...string) *UserSelect
Select one or more fields from the given query.
Example:
var v []struct {
Email string `json:"email,omitempty"`
}
client.User.Query().
Select(user.FieldEmail).
Scan(ctx, &v)
func (*UserQuery) WithFiles ¶
WithFiles tells the query-builder to eager-loads the nodes that are connected to
the "files" edge. The optional arguments used to configure the query builder of the edge.
func (*UserQuery) WithTokens ¶
func (uq *UserQuery) WithTokens(opts ...func(*TokenQuery)) *UserQuery
WithTokens tells the query-builder to eager-loads the nodes that are connected to
the "tokens" edge. The optional arguments used to configure the query builder of the edge.
type UserSelect ¶
type UserSelect struct {
// contains filtered or unexported fields
}
UserSelect is the builder for select fields of User entities.
func (*UserSelect) Bools ¶
func (us *UserSelect) Bools(ctx context.Context) ([]bool, error)
Bools returns list of bools from selector. It is only allowed when selecting one field.
func (*UserSelect) BoolsX ¶
func (us *UserSelect) BoolsX(ctx context.Context) []bool
BoolsX is like Bools, but panics if an error occurs.
func (*UserSelect) Float64s ¶
func (us *UserSelect) Float64s(ctx context.Context) ([]float64, error)
Float64s returns list of float64s from selector. It is only allowed when selecting one field.
func (*UserSelect) Float64sX ¶
func (us *UserSelect) Float64sX(ctx context.Context) []float64
Float64sX is like Float64s, but panics if an error occurs.
func (*UserSelect) Ints ¶
func (us *UserSelect) Ints(ctx context.Context) ([]int, error)
Ints returns list of ints from selector. It is only allowed when selecting one field.
func (*UserSelect) IntsX ¶
func (us *UserSelect) IntsX(ctx context.Context) []int
IntsX is like Ints, but panics if an error occurs.
func (*UserSelect) Scan ¶
func (us *UserSelect) Scan(ctx context.Context, v interface{}) error
Scan applies the selector query and scan the result into the given value.
func (*UserSelect) ScanX ¶
func (us *UserSelect) ScanX(ctx context.Context, v interface{})
ScanX is like Scan, but panics if an error occurs.
type UserUpdate ¶
type UserUpdate struct {
// contains filtered or unexported fields
}
UserUpdate is the builder for updating User entities.
func (*UserUpdate) AddFileIDs ¶
func (uu *UserUpdate) AddFileIDs(ids ...uuid.UUID) *UserUpdate
AddFileIDs adds the files edge to File by ids.
func (*UserUpdate) AddFiles ¶
func (uu *UserUpdate) AddFiles(f ...*File) *UserUpdate
AddFiles adds the files edges to File.
func (*UserUpdate) AddTokenIDs ¶
func (uu *UserUpdate) AddTokenIDs(ids ...uuid.UUID) *UserUpdate
AddTokenIDs adds the tokens edge to Token by ids.
func (*UserUpdate) AddTokens ¶
func (uu *UserUpdate) AddTokens(t ...*Token) *UserUpdate
AddTokens adds the tokens edges to Token.
func (*UserUpdate) Exec ¶
func (uu *UserUpdate) Exec(ctx context.Context) error
Exec executes the query.
func (*UserUpdate) ExecX ¶
func (uu *UserUpdate) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*UserUpdate) RemoveFileIDs ¶
func (uu *UserUpdate) RemoveFileIDs(ids ...uuid.UUID) *UserUpdate
RemoveFileIDs removes the files edge to File by ids.
func (*UserUpdate) RemoveFiles ¶
func (uu *UserUpdate) RemoveFiles(f ...*File) *UserUpdate
RemoveFiles removes files edges to File.
func (*UserUpdate) RemoveTokenIDs ¶
func (uu *UserUpdate) RemoveTokenIDs(ids ...uuid.UUID) *UserUpdate
RemoveTokenIDs removes the tokens edge to Token by ids.
func (*UserUpdate) RemoveTokens ¶
func (uu *UserUpdate) RemoveTokens(t ...*Token) *UserUpdate
RemoveTokens removes tokens edges to Token.
func (*UserUpdate) Save ¶
func (uu *UserUpdate) Save(ctx context.Context) (int, error)
Save executes the query and returns the number of rows/vertices matched by this operation.
func (*UserUpdate) SaveX ¶
func (uu *UserUpdate) SaveX(ctx context.Context) int
SaveX is like Save, but panics if an error occurs.
func (*UserUpdate) SetActive ¶
func (uu *UserUpdate) SetActive(b bool) *UserUpdate
SetActive sets the active field.
func (*UserUpdate) SetEmail ¶
func (uu *UserUpdate) SetEmail(s string) *UserUpdate
SetEmail sets the email field.
func (*UserUpdate) SetNillableActive ¶
func (uu *UserUpdate) SetNillableActive(b *bool) *UserUpdate
SetNillableActive sets the active field if the given value is not nil.
func (*UserUpdate) SetNillablePlan ¶
func (uu *UserUpdate) SetNillablePlan(u *user.Plan) *UserUpdate
SetNillablePlan sets the plan field if the given value is not nil.
func (*UserUpdate) SetPassword ¶
func (uu *UserUpdate) SetPassword(s string) *UserUpdate
SetPassword sets the password field.
func (*UserUpdate) SetPlan ¶
func (uu *UserUpdate) SetPlan(u user.Plan) *UserUpdate
SetPlan sets the plan field.
func (*UserUpdate) SetUpdatedAt ¶
func (uu *UserUpdate) SetUpdatedAt(t time.Time) *UserUpdate
SetUpdatedAt sets the updated_at field.
func (*UserUpdate) Where ¶
func (uu *UserUpdate) Where(ps ...predicate.User) *UserUpdate
Where adds a new predicate for the builder.
type UserUpdateOne ¶
type UserUpdateOne struct {
// contains filtered or unexported fields
}
UserUpdateOne is the builder for updating a single User entity.
func (*UserUpdateOne) AddFileIDs ¶
func (uuo *UserUpdateOne) AddFileIDs(ids ...uuid.UUID) *UserUpdateOne
AddFileIDs adds the files edge to File by ids.
func (*UserUpdateOne) AddFiles ¶
func (uuo *UserUpdateOne) AddFiles(f ...*File) *UserUpdateOne
AddFiles adds the files edges to File.
func (*UserUpdateOne) AddTokenIDs ¶
func (uuo *UserUpdateOne) AddTokenIDs(ids ...uuid.UUID) *UserUpdateOne
AddTokenIDs adds the tokens edge to Token by ids.
func (*UserUpdateOne) AddTokens ¶
func (uuo *UserUpdateOne) AddTokens(t ...*Token) *UserUpdateOne
AddTokens adds the tokens edges to Token.
func (*UserUpdateOne) Exec ¶
func (uuo *UserUpdateOne) Exec(ctx context.Context) error
Exec executes the query on the entity.
func (*UserUpdateOne) ExecX ¶
func (uuo *UserUpdateOne) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*UserUpdateOne) RemoveFileIDs ¶
func (uuo *UserUpdateOne) RemoveFileIDs(ids ...uuid.UUID) *UserUpdateOne
RemoveFileIDs removes the files edge to File by ids.
func (*UserUpdateOne) RemoveFiles ¶
func (uuo *UserUpdateOne) RemoveFiles(f ...*File) *UserUpdateOne
RemoveFiles removes files edges to File.
func (*UserUpdateOne) RemoveTokenIDs ¶
func (uuo *UserUpdateOne) RemoveTokenIDs(ids ...uuid.UUID) *UserUpdateOne
RemoveTokenIDs removes the tokens edge to Token by ids.
func (*UserUpdateOne) RemoveTokens ¶
func (uuo *UserUpdateOne) RemoveTokens(t ...*Token) *UserUpdateOne
RemoveTokens removes tokens edges to Token.
func (*UserUpdateOne) Save ¶
func (uuo *UserUpdateOne) Save(ctx context.Context) (*User, error)
Save executes the query and returns the updated entity.
func (*UserUpdateOne) SaveX ¶
func (uuo *UserUpdateOne) SaveX(ctx context.Context) *User
SaveX is like Save, but panics if an error occurs.
func (*UserUpdateOne) SetActive ¶
func (uuo *UserUpdateOne) SetActive(b bool) *UserUpdateOne
SetActive sets the active field.
func (*UserUpdateOne) SetEmail ¶
func (uuo *UserUpdateOne) SetEmail(s string) *UserUpdateOne
SetEmail sets the email field.
func (*UserUpdateOne) SetNillableActive ¶
func (uuo *UserUpdateOne) SetNillableActive(b *bool) *UserUpdateOne
SetNillableActive sets the active field if the given value is not nil.
func (*UserUpdateOne) SetNillablePlan ¶
func (uuo *UserUpdateOne) SetNillablePlan(u *user.Plan) *UserUpdateOne
SetNillablePlan sets the plan field if the given value is not nil.
func (*UserUpdateOne) SetPassword ¶
func (uuo *UserUpdateOne) SetPassword(s string) *UserUpdateOne
SetPassword sets the password field.
func (*UserUpdateOne) SetPlan ¶
func (uuo *UserUpdateOne) SetPlan(u user.Plan) *UserUpdateOne
SetPlan sets the plan field.
func (*UserUpdateOne) SetUpdatedAt ¶
func (uuo *UserUpdateOne) SetUpdatedAt(t time.Time) *UserUpdateOne
SetUpdatedAt sets the updated_at field.