Documentation ¶
Index ¶
- Constants
- Variables
- func IsConstraintError(err error) bool
- func IsNotFound(err error) bool
- func IsNotLoaded(err error) bool
- func IsNotSingular(err error) bool
- func IsValidationError(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
- func OpenTxFromContext(ctx context.Context) (context.Context, driver.Tx, error)
- type AggregateFunc
- type Client
- func (c *Client) BeginTx(ctx context.Context, opts *sql.TxOptions) (*Tx, error)
- func (c *Client) Close() error
- func (c *Client) Debug() *Client
- func (c *Client) Node(ctx context.Context, id ulid.ID) (*Node, error)
- func (c *Client) Noder(ctx context.Context, id ulid.ID, opts ...NodeOption) (_ Noder, err error)
- func (c *Client) Noders(ctx context.Context, ids []ulid.ID, opts ...NodeOption) ([]Noder, error)
- func (c *Client) OpenTx(ctx context.Context) (context.Context, driver.Tx, error)
- func (c *Client) Tx(ctx context.Context) (*Tx, error)
- func (c *Client) Use(hooks ...Hook)
- type CommitFunc
- type CommitHook
- type Committer
- type ConstraintError
- type Cursor
- type Edge
- type Field
- type Hook
- type Image
- func (i *Image) Node(ctx context.Context) (node *Node, err error)
- func (i *Image) QueryUser() *UserQuery
- func (i *Image) String() string
- func (i *Image) ToEdge(order *ImageOrder) *ImageEdge
- func (i *Image) Unwrap() *Image
- func (i *Image) Update() *ImageUpdateOne
- func (i *Image) User(ctx context.Context) (*User, error)
- type ImageClient
- func (c *ImageClient) Create() *ImageCreate
- func (c *ImageClient) CreateBulk(builders ...*ImageCreate) *ImageCreateBulk
- func (c *ImageClient) Delete() *ImageDelete
- func (c *ImageClient) DeleteOne(i *Image) *ImageDeleteOne
- func (c *ImageClient) DeleteOneID(id ulid.ID) *ImageDeleteOne
- func (c *ImageClient) Get(ctx context.Context, id ulid.ID) (*Image, error)
- func (c *ImageClient) GetX(ctx context.Context, id ulid.ID) *Image
- func (c *ImageClient) Hooks() []Hook
- func (c *ImageClient) Query() *ImageQuery
- func (c *ImageClient) QueryUser(i *Image) *UserQuery
- func (c *ImageClient) Update() *ImageUpdate
- func (c *ImageClient) UpdateOne(i *Image) *ImageUpdateOne
- func (c *ImageClient) UpdateOneID(id ulid.ID) *ImageUpdateOne
- func (c *ImageClient) Use(hooks ...Hook)
- type ImageConnection
- type ImageCreate
- func (ic *ImageCreate) Exec(ctx context.Context) error
- func (ic *ImageCreate) ExecX(ctx context.Context)
- func (ic *ImageCreate) Mutation() *ImageMutation
- func (ic *ImageCreate) Save(ctx context.Context) (*Image, error)
- func (ic *ImageCreate) SaveX(ctx context.Context) *Image
- func (ic *ImageCreate) SetContent(s string) *ImageCreate
- func (ic *ImageCreate) SetCreatedAt(t time.Time) *ImageCreate
- func (ic *ImageCreate) SetFileName(s string) *ImageCreate
- func (ic *ImageCreate) SetID(u ulid.ID) *ImageCreate
- func (ic *ImageCreate) SetNillableCreatedAt(t *time.Time) *ImageCreate
- func (ic *ImageCreate) SetNillableID(u *ulid.ID) *ImageCreate
- func (ic *ImageCreate) SetNillableUpdatedAt(t *time.Time) *ImageCreate
- func (ic *ImageCreate) SetNillableUserID(id *ulid.ID) *ImageCreate
- func (ic *ImageCreate) SetUpdatedAt(t time.Time) *ImageCreate
- func (ic *ImageCreate) SetUser(u *User) *ImageCreate
- func (ic *ImageCreate) SetUserID(id ulid.ID) *ImageCreate
- type ImageCreateBulk
- type ImageDelete
- type ImageDeleteOne
- type ImageEdge
- type ImageEdges
- type ImageGroupBy
- func (igb *ImageGroupBy) Aggregate(fns ...AggregateFunc) *ImageGroupBy
- func (igb *ImageGroupBy) Bool(ctx context.Context) (_ bool, err error)
- func (igb *ImageGroupBy) BoolX(ctx context.Context) bool
- func (igb *ImageGroupBy) Bools(ctx context.Context) ([]bool, error)
- func (igb *ImageGroupBy) BoolsX(ctx context.Context) []bool
- func (igb *ImageGroupBy) Float64(ctx context.Context) (_ float64, err error)
- func (igb *ImageGroupBy) Float64X(ctx context.Context) float64
- func (igb *ImageGroupBy) Float64s(ctx context.Context) ([]float64, error)
- func (igb *ImageGroupBy) Float64sX(ctx context.Context) []float64
- func (igb *ImageGroupBy) Int(ctx context.Context) (_ int, err error)
- func (igb *ImageGroupBy) IntX(ctx context.Context) int
- func (igb *ImageGroupBy) Ints(ctx context.Context) ([]int, error)
- func (igb *ImageGroupBy) IntsX(ctx context.Context) []int
- func (igb *ImageGroupBy) Scan(ctx context.Context, v interface{}) error
- func (igb *ImageGroupBy) ScanX(ctx context.Context, v interface{})
- func (igb *ImageGroupBy) String(ctx context.Context) (_ string, err error)
- func (igb *ImageGroupBy) StringX(ctx context.Context) string
- func (igb *ImageGroupBy) Strings(ctx context.Context) ([]string, error)
- func (igb *ImageGroupBy) StringsX(ctx context.Context) []string
- type ImageMutation
- func (m *ImageMutation) AddField(name string, value ent.Value) error
- func (m *ImageMutation) AddedEdges() []string
- func (m *ImageMutation) AddedField(name string) (ent.Value, bool)
- func (m *ImageMutation) AddedFields() []string
- func (m *ImageMutation) AddedIDs(name string) []ent.Value
- func (m *ImageMutation) ClearEdge(name string) error
- func (m *ImageMutation) ClearField(name string) error
- func (m *ImageMutation) ClearUser()
- func (m *ImageMutation) ClearedEdges() []string
- func (m *ImageMutation) ClearedFields() []string
- func (m ImageMutation) Client() *Client
- func (m *ImageMutation) Content() (r string, exists bool)
- func (m *ImageMutation) CreatedAt() (r time.Time, exists bool)
- func (m *ImageMutation) EdgeCleared(name string) bool
- func (m *ImageMutation) Field(name string) (ent.Value, bool)
- func (m *ImageMutation) FieldCleared(name string) bool
- func (m *ImageMutation) Fields() []string
- func (m *ImageMutation) FileName() (r string, exists bool)
- func (m *ImageMutation) ID() (id ulid.ID, exists bool)
- func (m *ImageMutation) IDs(ctx context.Context) ([]ulid.ID, error)
- func (m *ImageMutation) OldContent(ctx context.Context) (v string, err error)
- func (m *ImageMutation) OldCreatedAt(ctx context.Context) (v time.Time, err error)
- func (m *ImageMutation) OldField(ctx context.Context, name string) (ent.Value, error)
- func (m *ImageMutation) OldFileName(ctx context.Context) (v string, err error)
- func (m *ImageMutation) OldUpdatedAt(ctx context.Context) (v time.Time, err error)
- func (m *ImageMutation) Op() Op
- func (m *ImageMutation) RemovedEdges() []string
- func (m *ImageMutation) RemovedIDs(name string) []ent.Value
- func (m *ImageMutation) ResetContent()
- func (m *ImageMutation) ResetCreatedAt()
- func (m *ImageMutation) ResetEdge(name string) error
- func (m *ImageMutation) ResetField(name string) error
- func (m *ImageMutation) ResetFileName()
- func (m *ImageMutation) ResetUpdatedAt()
- func (m *ImageMutation) ResetUser()
- func (m *ImageMutation) SetContent(s string)
- func (m *ImageMutation) SetCreatedAt(t time.Time)
- func (m *ImageMutation) SetField(name string, value ent.Value) error
- func (m *ImageMutation) SetFileName(s string)
- func (m *ImageMutation) SetID(id ulid.ID)
- func (m *ImageMutation) SetUpdatedAt(t time.Time)
- func (m *ImageMutation) SetUserID(id ulid.ID)
- func (m ImageMutation) Tx() (*Tx, error)
- func (m *ImageMutation) Type() string
- func (m *ImageMutation) UpdatedAt() (r time.Time, exists bool)
- func (m *ImageMutation) UserCleared() bool
- func (m *ImageMutation) UserID() (id ulid.ID, exists bool)
- func (m *ImageMutation) UserIDs() (ids []ulid.ID)
- func (m *ImageMutation) Where(ps ...predicate.Image)
- type ImageOrder
- type ImageOrderField
- type ImagePaginateOption
- type ImageQuery
- func (iq *ImageQuery) All(ctx context.Context) ([]*Image, error)
- func (iq *ImageQuery) AllX(ctx context.Context) []*Image
- func (iq *ImageQuery) Clone() *ImageQuery
- func (i *ImageQuery) CollectFields(ctx context.Context, satisfies ...string) *ImageQuery
- func (iq *ImageQuery) Count(ctx context.Context) (int, error)
- func (iq *ImageQuery) CountX(ctx context.Context) int
- func (iq *ImageQuery) Exist(ctx context.Context) (bool, error)
- func (iq *ImageQuery) ExistX(ctx context.Context) bool
- func (iq *ImageQuery) First(ctx context.Context) (*Image, error)
- func (iq *ImageQuery) FirstID(ctx context.Context) (id ulid.ID, err error)
- func (iq *ImageQuery) FirstIDX(ctx context.Context) ulid.ID
- func (iq *ImageQuery) FirstX(ctx context.Context) *Image
- func (iq *ImageQuery) GroupBy(field string, fields ...string) *ImageGroupBy
- func (iq *ImageQuery) IDs(ctx context.Context) ([]ulid.ID, error)
- func (iq *ImageQuery) IDsX(ctx context.Context) []ulid.ID
- func (iq *ImageQuery) Limit(limit int) *ImageQuery
- func (iq *ImageQuery) Offset(offset int) *ImageQuery
- func (iq *ImageQuery) Only(ctx context.Context) (*Image, error)
- func (iq *ImageQuery) OnlyID(ctx context.Context) (id ulid.ID, err error)
- func (iq *ImageQuery) OnlyIDX(ctx context.Context) ulid.ID
- func (iq *ImageQuery) OnlyX(ctx context.Context) *Image
- func (iq *ImageQuery) Order(o ...OrderFunc) *ImageQuery
- func (i *ImageQuery) Paginate(ctx context.Context, after *Cursor, first *int, before *Cursor, last *int, ...) (*ImageConnection, error)
- func (iq *ImageQuery) QueryUser() *UserQuery
- func (iq *ImageQuery) Select(fields ...string) *ImageSelect
- func (iq *ImageQuery) Unique(unique bool) *ImageQuery
- func (iq *ImageQuery) Where(ps ...predicate.Image) *ImageQuery
- func (iq *ImageQuery) WithUser(opts ...func(*UserQuery)) *ImageQuery
- type ImageSelect
- func (is *ImageSelect) Bool(ctx context.Context) (_ bool, err error)
- func (is *ImageSelect) BoolX(ctx context.Context) bool
- func (is *ImageSelect) Bools(ctx context.Context) ([]bool, error)
- func (is *ImageSelect) BoolsX(ctx context.Context) []bool
- func (is *ImageSelect) Float64(ctx context.Context) (_ float64, err error)
- func (is *ImageSelect) Float64X(ctx context.Context) float64
- func (is *ImageSelect) Float64s(ctx context.Context) ([]float64, error)
- func (is *ImageSelect) Float64sX(ctx context.Context) []float64
- func (is *ImageSelect) Int(ctx context.Context) (_ int, err error)
- func (is *ImageSelect) IntX(ctx context.Context) int
- func (is *ImageSelect) Ints(ctx context.Context) ([]int, error)
- func (is *ImageSelect) IntsX(ctx context.Context) []int
- func (is *ImageSelect) Scan(ctx context.Context, v interface{}) error
- func (is *ImageSelect) ScanX(ctx context.Context, v interface{})
- func (is *ImageSelect) String(ctx context.Context) (_ string, err error)
- func (is *ImageSelect) StringX(ctx context.Context) string
- func (is *ImageSelect) Strings(ctx context.Context) ([]string, error)
- func (is *ImageSelect) StringsX(ctx context.Context) []string
- type ImageUpdate
- func (iu *ImageUpdate) ClearUser() *ImageUpdate
- func (iu *ImageUpdate) Exec(ctx context.Context) error
- func (iu *ImageUpdate) ExecX(ctx context.Context)
- func (iu *ImageUpdate) Mutation() *ImageMutation
- func (iu *ImageUpdate) Save(ctx context.Context) (int, error)
- func (iu *ImageUpdate) SaveX(ctx context.Context) int
- func (iu *ImageUpdate) SetContent(s string) *ImageUpdate
- func (iu *ImageUpdate) SetFileName(s string) *ImageUpdate
- func (iu *ImageUpdate) SetNillableUserID(id *ulid.ID) *ImageUpdate
- func (iu *ImageUpdate) SetUpdatedAt(t time.Time) *ImageUpdate
- func (iu *ImageUpdate) SetUser(u *User) *ImageUpdate
- func (iu *ImageUpdate) SetUserID(id ulid.ID) *ImageUpdate
- func (iu *ImageUpdate) Where(ps ...predicate.Image) *ImageUpdate
- type ImageUpdateOne
- func (iuo *ImageUpdateOne) ClearUser() *ImageUpdateOne
- func (iuo *ImageUpdateOne) Exec(ctx context.Context) error
- func (iuo *ImageUpdateOne) ExecX(ctx context.Context)
- func (iuo *ImageUpdateOne) Mutation() *ImageMutation
- func (iuo *ImageUpdateOne) Save(ctx context.Context) (*Image, error)
- func (iuo *ImageUpdateOne) SaveX(ctx context.Context) *Image
- func (iuo *ImageUpdateOne) Select(field string, fields ...string) *ImageUpdateOne
- func (iuo *ImageUpdateOne) SetContent(s string) *ImageUpdateOne
- func (iuo *ImageUpdateOne) SetFileName(s string) *ImageUpdateOne
- func (iuo *ImageUpdateOne) SetNillableUserID(id *ulid.ID) *ImageUpdateOne
- func (iuo *ImageUpdateOne) SetUpdatedAt(t time.Time) *ImageUpdateOne
- func (iuo *ImageUpdateOne) SetUser(u *User) *ImageUpdateOne
- func (iuo *ImageUpdateOne) SetUserID(id ulid.ID) *ImageUpdateOne
- type ImageWhereInput
- type Images
- type MutateFunc
- type Mutation
- type Mutator
- type Node
- type NodeOption
- type Noder
- type NotFoundError
- type NotLoadedError
- type NotSingularError
- type Op
- type Option
- type OrderDirection
- type OrderFunc
- type PageInfo
- type Policy
- type Query
- type RollbackFunc
- type RollbackHook
- type Rollbacker
- type Tx
- type User
- func (u *User) Images(ctx context.Context) ([]*Image, error)
- func (u *User) Node(ctx context.Context) (node *Node, err error)
- func (u *User) QueryImages() *ImageQuery
- func (u *User) String() string
- func (u *User) ToEdge(order *UserOrder) *UserEdge
- func (u *User) Unwrap() *User
- func (u *User) Update() *UserUpdateOne
- type UserClient
- func (c *UserClient) Create() *UserCreate
- func (c *UserClient) CreateBulk(builders ...*UserCreate) *UserCreateBulk
- func (c *UserClient) Delete() *UserDelete
- func (c *UserClient) DeleteOne(u *User) *UserDeleteOne
- func (c *UserClient) DeleteOneID(id ulid.ID) *UserDeleteOne
- func (c *UserClient) Get(ctx context.Context, id ulid.ID) (*User, error)
- func (c *UserClient) GetX(ctx context.Context, id ulid.ID) *User
- func (c *UserClient) Hooks() []Hook
- func (c *UserClient) Query() *UserQuery
- func (c *UserClient) QueryImages(u *User) *ImageQuery
- func (c *UserClient) Update() *UserUpdate
- func (c *UserClient) UpdateOne(u *User) *UserUpdateOne
- func (c *UserClient) UpdateOneID(id ulid.ID) *UserUpdateOne
- func (c *UserClient) Use(hooks ...Hook)
- type UserConnection
- type UserCreate
- func (uc *UserCreate) AddImageIDs(ids ...ulid.ID) *UserCreate
- func (uc *UserCreate) AddImages(i ...*Image) *UserCreate
- func (uc *UserCreate) Exec(ctx context.Context) error
- func (uc *UserCreate) ExecX(ctx context.Context)
- func (uc *UserCreate) Mutation() *UserMutation
- func (uc *UserCreate) Save(ctx context.Context) (*User, error)
- func (uc *UserCreate) SaveX(ctx context.Context) *User
- func (uc *UserCreate) SetCreatedAt(t time.Time) *UserCreate
- func (uc *UserCreate) SetEmail(s string) *UserCreate
- func (uc *UserCreate) SetID(u ulid.ID) *UserCreate
- func (uc *UserCreate) SetLastLogin(t time.Time) *UserCreate
- func (uc *UserCreate) SetName(s string) *UserCreate
- func (uc *UserCreate) SetNillableCreatedAt(t *time.Time) *UserCreate
- func (uc *UserCreate) SetNillableID(u *ulid.ID) *UserCreate
- func (uc *UserCreate) SetNillableLastLogin(t *time.Time) *UserCreate
- func (uc *UserCreate) SetNillableUpdatedAt(t *time.Time) *UserCreate
- func (uc *UserCreate) SetPassword(s string) *UserCreate
- func (uc *UserCreate) SetUpdatedAt(t time.Time) *UserCreate
- type UserCreateBulk
- type UserDelete
- type UserDeleteOne
- type UserEdge
- type UserEdges
- type UserGroupBy
- func (ugb *UserGroupBy) Aggregate(fns ...AggregateFunc) *UserGroupBy
- func (ugb *UserGroupBy) Bool(ctx context.Context) (_ bool, err error)
- func (ugb *UserGroupBy) BoolX(ctx context.Context) bool
- func (ugb *UserGroupBy) Bools(ctx context.Context) ([]bool, error)
- func (ugb *UserGroupBy) BoolsX(ctx context.Context) []bool
- func (ugb *UserGroupBy) Float64(ctx context.Context) (_ float64, err error)
- func (ugb *UserGroupBy) Float64X(ctx context.Context) float64
- func (ugb *UserGroupBy) Float64s(ctx context.Context) ([]float64, error)
- func (ugb *UserGroupBy) Float64sX(ctx context.Context) []float64
- func (ugb *UserGroupBy) Int(ctx context.Context) (_ int, err error)
- func (ugb *UserGroupBy) IntX(ctx context.Context) int
- 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) String(ctx context.Context) (_ string, err error)
- func (ugb *UserGroupBy) StringX(ctx context.Context) string
- func (ugb *UserGroupBy) Strings(ctx context.Context) ([]string, error)
- func (ugb *UserGroupBy) StringsX(ctx context.Context) []string
- type UserMutation
- func (m *UserMutation) AddField(name string, value ent.Value) error
- func (m *UserMutation) AddImageIDs(ids ...ulid.ID)
- 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) ClearImages()
- 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) ID() (id ulid.ID, exists bool)
- func (m *UserMutation) IDs(ctx context.Context) ([]ulid.ID, error)
- func (m *UserMutation) ImagesCleared() bool
- func (m *UserMutation) ImagesIDs() (ids []ulid.ID)
- func (m *UserMutation) LastLogin() (r time.Time, exists bool)
- func (m *UserMutation) Name() (r string, exists bool)
- func (m *UserMutation) OldCreatedAt(ctx context.Context) (v time.Time, err error)
- func (m *UserMutation) OldEmail(ctx context.Context) (v string, err error)
- func (m *UserMutation) OldField(ctx context.Context, name string) (ent.Value, error)
- func (m *UserMutation) OldLastLogin(ctx context.Context) (v time.Time, err error)
- func (m *UserMutation) OldName(ctx context.Context) (v string, err error)
- func (m *UserMutation) OldPassword(ctx context.Context) (v string, err error)
- func (m *UserMutation) OldUpdatedAt(ctx context.Context) (v time.Time, err error)
- func (m *UserMutation) Op() Op
- func (m *UserMutation) Password() (r string, exists bool)
- func (m *UserMutation) RemoveImageIDs(ids ...ulid.ID)
- func (m *UserMutation) RemovedEdges() []string
- func (m *UserMutation) RemovedIDs(name string) []ent.Value
- func (m *UserMutation) RemovedImagesIDs() (ids []ulid.ID)
- 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) ResetImages()
- func (m *UserMutation) ResetLastLogin()
- func (m *UserMutation) ResetName()
- func (m *UserMutation) ResetPassword()
- func (m *UserMutation) ResetUpdatedAt()
- 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) SetID(id ulid.ID)
- func (m *UserMutation) SetLastLogin(t time.Time)
- func (m *UserMutation) SetName(s string)
- func (m *UserMutation) SetPassword(s string)
- func (m *UserMutation) SetUpdatedAt(t time.Time)
- func (m UserMutation) Tx() (*Tx, error)
- func (m *UserMutation) Type() string
- func (m *UserMutation) UpdatedAt() (r time.Time, exists bool)
- func (m *UserMutation) Where(ps ...predicate.User)
- type UserOrder
- type UserOrderField
- type UserPaginateOption
- 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 (u *UserQuery) CollectFields(ctx context.Context, satisfies ...string) *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 ulid.ID, err error)
- func (uq *UserQuery) FirstIDX(ctx context.Context) ulid.ID
- func (uq *UserQuery) FirstX(ctx context.Context) *User
- func (uq *UserQuery) GroupBy(field string, fields ...string) *UserGroupBy
- func (uq *UserQuery) IDs(ctx context.Context) ([]ulid.ID, error)
- func (uq *UserQuery) IDsX(ctx context.Context) []ulid.ID
- 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 ulid.ID, err error)
- func (uq *UserQuery) OnlyIDX(ctx context.Context) ulid.ID
- func (uq *UserQuery) OnlyX(ctx context.Context) *User
- func (uq *UserQuery) Order(o ...OrderFunc) *UserQuery
- func (u *UserQuery) Paginate(ctx context.Context, after *Cursor, first *int, before *Cursor, last *int, ...) (*UserConnection, error)
- func (uq *UserQuery) QueryImages() *ImageQuery
- func (uq *UserQuery) Select(fields ...string) *UserSelect
- func (uq *UserQuery) Unique(unique bool) *UserQuery
- func (uq *UserQuery) Where(ps ...predicate.User) *UserQuery
- func (uq *UserQuery) WithImages(opts ...func(*ImageQuery)) *UserQuery
- type UserSelect
- func (us *UserSelect) Bool(ctx context.Context) (_ bool, err error)
- func (us *UserSelect) BoolX(ctx context.Context) bool
- func (us *UserSelect) Bools(ctx context.Context) ([]bool, error)
- func (us *UserSelect) BoolsX(ctx context.Context) []bool
- func (us *UserSelect) Float64(ctx context.Context) (_ float64, err error)
- func (us *UserSelect) Float64X(ctx context.Context) float64
- func (us *UserSelect) Float64s(ctx context.Context) ([]float64, error)
- func (us *UserSelect) Float64sX(ctx context.Context) []float64
- func (us *UserSelect) Int(ctx context.Context) (_ int, err error)
- func (us *UserSelect) IntX(ctx context.Context) int
- 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) String(ctx context.Context) (_ string, err error)
- func (us *UserSelect) StringX(ctx context.Context) string
- func (us *UserSelect) Strings(ctx context.Context) ([]string, error)
- func (us *UserSelect) StringsX(ctx context.Context) []string
- type UserUpdate
- func (uu *UserUpdate) AddImageIDs(ids ...ulid.ID) *UserUpdate
- func (uu *UserUpdate) AddImages(i ...*Image) *UserUpdate
- func (uu *UserUpdate) ClearImages() *UserUpdate
- func (uu *UserUpdate) Exec(ctx context.Context) error
- func (uu *UserUpdate) ExecX(ctx context.Context)
- func (uu *UserUpdate) Mutation() *UserMutation
- func (uu *UserUpdate) RemoveImageIDs(ids ...ulid.ID) *UserUpdate
- func (uu *UserUpdate) RemoveImages(i ...*Image) *UserUpdate
- func (uu *UserUpdate) Save(ctx context.Context) (int, error)
- func (uu *UserUpdate) SaveX(ctx context.Context) int
- func (uu *UserUpdate) SetEmail(s string) *UserUpdate
- func (uu *UserUpdate) SetLastLogin(t time.Time) *UserUpdate
- func (uu *UserUpdate) SetName(s string) *UserUpdate
- func (uu *UserUpdate) SetNillableLastLogin(t *time.Time) *UserUpdate
- func (uu *UserUpdate) SetPassword(s string) *UserUpdate
- func (uu *UserUpdate) SetUpdatedAt(t time.Time) *UserUpdate
- func (uu *UserUpdate) Where(ps ...predicate.User) *UserUpdate
- type UserUpdateOne
- func (uuo *UserUpdateOne) AddImageIDs(ids ...ulid.ID) *UserUpdateOne
- func (uuo *UserUpdateOne) AddImages(i ...*Image) *UserUpdateOne
- func (uuo *UserUpdateOne) ClearImages() *UserUpdateOne
- func (uuo *UserUpdateOne) Exec(ctx context.Context) error
- func (uuo *UserUpdateOne) ExecX(ctx context.Context)
- func (uuo *UserUpdateOne) Mutation() *UserMutation
- func (uuo *UserUpdateOne) RemoveImageIDs(ids ...ulid.ID) *UserUpdateOne
- func (uuo *UserUpdateOne) RemoveImages(i ...*Image) *UserUpdateOne
- func (uuo *UserUpdateOne) Save(ctx context.Context) (*User, error)
- func (uuo *UserUpdateOne) SaveX(ctx context.Context) *User
- func (uuo *UserUpdateOne) Select(field string, fields ...string) *UserUpdateOne
- func (uuo *UserUpdateOne) SetEmail(s string) *UserUpdateOne
- func (uuo *UserUpdateOne) SetLastLogin(t time.Time) *UserUpdateOne
- func (uuo *UserUpdateOne) SetName(s string) *UserUpdateOne
- func (uuo *UserUpdateOne) SetNillableLastLogin(t *time.Time) *UserUpdateOne
- func (uuo *UserUpdateOne) SetPassword(s string) *UserUpdateOne
- func (uuo *UserUpdateOne) SetUpdatedAt(t time.Time) *UserUpdateOne
- type UserWhereInput
- type Users
- type ValidationError
- type Value
Constants ¶
const ( // Operation types. OpCreate = ent.OpCreate OpDelete = ent.OpDelete OpDeleteOne = ent.OpDeleteOne OpUpdate = ent.OpUpdate OpUpdateOne = ent.OpUpdateOne // Node types. TypeImage = "Image" TypeUser = "User" )
Variables ¶
var ( // ImageOrderFieldCreatedAt orders Image by created_at. ImageOrderFieldCreatedAt = &ImageOrderField{ field: image.FieldCreatedAt, toCursor: func(i *Image) Cursor { return Cursor{ ID: i.ID, Value: i.CreatedAt, } }, } // ImageOrderFieldUpdatedAt orders Image by updated_at. ImageOrderFieldUpdatedAt = &ImageOrderField{ field: image.FieldUpdatedAt, toCursor: func(i *Image) Cursor { return Cursor{ ID: i.ID, Value: i.UpdatedAt, } }, } // ImageOrderFieldFileName orders Image by file_name. ImageOrderFieldFileName = &ImageOrderField{ field: image.FieldFileName, toCursor: func(i *Image) Cursor { return Cursor{ ID: i.ID, Value: i.FileName, } }, } // ImageOrderFieldContent orders Image by content. ImageOrderFieldContent = &ImageOrderField{ field: image.FieldContent, toCursor: func(i *Image) Cursor { return Cursor{ ID: i.ID, Value: i.Content, } }, } // ImageOrderFieldID orders Image by id. ImageOrderFieldID = &ImageOrderField{ field: image.FieldID, toCursor: func(i *Image) Cursor { return Cursor{ ID: i.ID, Value: i.ID, } }, } )
var ( // UserOrderFieldCreatedAt orders User by created_at. UserOrderFieldCreatedAt = &UserOrderField{ field: user.FieldCreatedAt, toCursor: func(u *User) Cursor { return Cursor{ ID: u.ID, Value: u.CreatedAt, } }, } // UserOrderFieldUpdatedAt orders User by updated_at. UserOrderFieldUpdatedAt = &UserOrderField{ field: user.FieldUpdatedAt, toCursor: func(u *User) Cursor { return Cursor{ ID: u.ID, Value: u.UpdatedAt, } }, } // UserOrderFieldLastLogin orders User by last_login. UserOrderFieldLastLogin = &UserOrderField{ field: user.FieldLastLogin, toCursor: func(u *User) Cursor { return Cursor{ ID: u.ID, Value: u.LastLogin, } }, } // UserOrderFieldID orders User by id. UserOrderFieldID = &UserOrderField{ field: user.FieldID, toCursor: func(u *User) Cursor { return Cursor{ ID: u.ID, Value: u.ID, } }, } )
var DefaultImageOrder = &ImageOrder{ Direction: OrderDirectionAsc, Field: &ImageOrderField{ field: image.FieldID, toCursor: func(i *Image) Cursor { return Cursor{ID: i.ID} }, }, }
DefaultImageOrder is the default ordering of Image.
var DefaultUserOrder = &UserOrder{ Direction: OrderDirectionAsc, Field: &UserOrderField{ field: user.FieldID, toCursor: func(u *User) Cursor { return Cursor{ID: u.ID} }, }, }
DefaultUserOrder is the default ordering of User.
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 IsValidationError ¶
IsValidationError returns a boolean indicating whether the error is a validation error.
func NewContext ¶
NewContext returns a new context with the given Client attached.
func NewTxContext ¶
NewTxContext returns a new context with the given Tx attached.
Types ¶
type AggregateFunc ¶
AggregateFunc applies an aggregation step on the group-by traversal/selector.
func As ¶
func As(fn AggregateFunc, end string) AggregateFunc
As is a pseudo aggregation function for renaming another other functions with custom names. For example:
GroupBy(field1, field2). Aggregate(ent.As(ent.Sum(field1), "sum_field1"), (ent.As(ent.Sum(field2), "sum_field2")). Scan(ctx, &v)
func Count ¶
func Count() AggregateFunc
Count applies the "count" aggregation function on each group.
func Max ¶
func Max(field string) AggregateFunc
Max applies the "max" aggregation function on the given field of each group.
func Mean ¶
func Mean(field string) AggregateFunc
Mean applies the "mean" aggregation function on the given field of each group.
func Min ¶
func Min(field string) AggregateFunc
Min applies the "min" aggregation function on the given field of each group.
func Sum ¶
func Sum(field string) AggregateFunc
Sum applies the "sum" aggregation function on the given field of each group.
type Client ¶
type Client struct { // Schema is the client for creating, migrating and dropping schema. Schema *migrate.Schema // Image is the client for interacting with the Image builders. Image *ImageClient // 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 a Client stored inside a context, or nil if there isn't one.
func Open ¶
Open opens a database/sql.DB specified by the driver name and the data source name, and returns a new client attached to it. Optional parameters can be added for configuring the client.
func (*Client) Debug ¶
Debug returns a new debug-client. It's used to get verbose logging on specific operations.
client.Debug(). Image. Query(). Count(ctx)
func (*Client) Noder ¶
Noder returns a Node by its id. If the NodeType was not provided, it will be derived from the id value according to the universal-id configuration.
c.Noder(ctx, id) c.Noder(ctx, id, ent.WithNodeType(pet.Table))
func (*Client) OpenTx ¶
OpenTx opens a transaction and returns a transactional context along with the created transaction.
type CommitFunc ¶
The CommitFunc type is an adapter to allow the use of ordinary function as a Committer. If f is a function with the appropriate signature, CommitFunc(f) is a Committer that calls f.
type CommitHook ¶
CommitHook defines the "commit middleware". A function that gets a Committer and returns a Committer. For example:
hook := func(next ent.Committer) ent.Committer { return ent.CommitFunc(func(ctx context.Context, tx *ent.Tx) error { // Do some stuff before. if err := next.Commit(ctx, tx); err != nil { return err } // Do some stuff after. return nil }) }
type 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 Cursor ¶
Cursor of an edge type.
func (Cursor) MarshalGQL ¶
MarshalGQL implements graphql.Marshaler interface.
func (*Cursor) UnmarshalGQL ¶
UnmarshalGQL implements graphql.Unmarshaler interface.
type Edge ¶
type Edge struct { Type string `json:"type,omitempty"` // edge type. Name string `json:"name,omitempty"` // edge name. IDs []ulid.ID `json:"ids,omitempty"` // node ids (where this edge point to). }
Edges between two nodes.
type Field ¶
type Field struct { Type string `json:"type,omitempty"` // field type. Name string `json:"name,omitempty"` // field name (as in struct). Value string `json:"value,omitempty"` // stringified value. }
Field of a node.
type Image ¶
type Image struct { // ID of the ent. ID ulid.ID `json:"id,omitempty"` // CreatedAt holds the value of the "created_at" field. CreatedAt time.Time `json:"created_at,omitempty"` // UpdatedAt holds the value of the "updated_at" field. UpdatedAt time.Time `json:"updated_at,omitempty"` // FileName holds the value of the "file_name" field. FileName string `json:"-"` // Content holds the value of the "content" field. Content string `json:"-"` // Edges holds the relations/edges for other nodes in the graph. // The values are being populated by the ImageQuery when eager-loading is set. Edges ImageEdges `json:"edges"` // contains filtered or unexported fields }
Image is the model entity for the Image schema.
func (*Image) ToEdge ¶
func (i *Image) ToEdge(order *ImageOrder) *ImageEdge
ToEdge converts Image into ImageEdge.
func (*Image) Unwrap ¶
Unwrap unwraps the Image entity that was returned from a transaction after it was closed, so that all future queries will be executed through the driver which created the transaction.
func (*Image) Update ¶
func (i *Image) Update() *ImageUpdateOne
Update returns a builder for updating this Image. Note that you need to call Image.Unwrap() before calling this method if this Image was returned from a transaction, and the transaction was committed or rolled back.
type ImageClient ¶
type ImageClient struct {
// contains filtered or unexported fields
}
ImageClient is a client for the Image schema.
func NewImageClient ¶
func NewImageClient(c config) *ImageClient
NewImageClient returns a client for the Image from the given config.
func (*ImageClient) Create ¶
func (c *ImageClient) Create() *ImageCreate
Create returns a create builder for Image.
func (*ImageClient) CreateBulk ¶
func (c *ImageClient) CreateBulk(builders ...*ImageCreate) *ImageCreateBulk
CreateBulk returns a builder for creating a bulk of Image entities.
func (*ImageClient) Delete ¶
func (c *ImageClient) Delete() *ImageDelete
Delete returns a delete builder for Image.
func (*ImageClient) DeleteOne ¶
func (c *ImageClient) DeleteOne(i *Image) *ImageDeleteOne
DeleteOne returns a delete builder for the given entity.
func (*ImageClient) DeleteOneID ¶
func (c *ImageClient) DeleteOneID(id ulid.ID) *ImageDeleteOne
DeleteOneID returns a delete builder for the given id.
func (*ImageClient) Query ¶
func (c *ImageClient) Query() *ImageQuery
Query returns a query builder for Image.
func (*ImageClient) QueryUser ¶
func (c *ImageClient) QueryUser(i *Image) *UserQuery
QueryUser queries the user edge of a Image.
func (*ImageClient) Update ¶
func (c *ImageClient) Update() *ImageUpdate
Update returns an update builder for Image.
func (*ImageClient) UpdateOne ¶
func (c *ImageClient) UpdateOne(i *Image) *ImageUpdateOne
UpdateOne returns an update builder for the given entity.
func (*ImageClient) UpdateOneID ¶
func (c *ImageClient) UpdateOneID(id ulid.ID) *ImageUpdateOne
UpdateOneID returns an update builder for the given id.
func (*ImageClient) Use ¶
func (c *ImageClient) Use(hooks ...Hook)
Use adds a list of mutation hooks to the hooks stack. A call to `Use(f, g, h)` equals to `image.Hooks(f(g(h())))`.
type ImageConnection ¶
type ImageConnection struct { Edges []*ImageEdge `json:"edges"` PageInfo PageInfo `json:"pageInfo"` TotalCount int `json:"totalCount"` }
ImageConnection is the connection containing edges to Image.
type ImageCreate ¶
type ImageCreate struct {
// contains filtered or unexported fields
}
ImageCreate is the builder for creating a Image entity.
func (*ImageCreate) Exec ¶
func (ic *ImageCreate) Exec(ctx context.Context) error
Exec executes the query.
func (*ImageCreate) ExecX ¶
func (ic *ImageCreate) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*ImageCreate) Mutation ¶
func (ic *ImageCreate) Mutation() *ImageMutation
Mutation returns the ImageMutation object of the builder.
func (*ImageCreate) Save ¶
func (ic *ImageCreate) Save(ctx context.Context) (*Image, error)
Save creates the Image in the database.
func (*ImageCreate) SaveX ¶
func (ic *ImageCreate) SaveX(ctx context.Context) *Image
SaveX calls Save and panics if Save returns an error.
func (*ImageCreate) SetContent ¶
func (ic *ImageCreate) SetContent(s string) *ImageCreate
SetContent sets the "content" field.
func (*ImageCreate) SetCreatedAt ¶
func (ic *ImageCreate) SetCreatedAt(t time.Time) *ImageCreate
SetCreatedAt sets the "created_at" field.
func (*ImageCreate) SetFileName ¶
func (ic *ImageCreate) SetFileName(s string) *ImageCreate
SetFileName sets the "file_name" field.
func (*ImageCreate) SetID ¶
func (ic *ImageCreate) SetID(u ulid.ID) *ImageCreate
SetID sets the "id" field.
func (*ImageCreate) SetNillableCreatedAt ¶
func (ic *ImageCreate) SetNillableCreatedAt(t *time.Time) *ImageCreate
SetNillableCreatedAt sets the "created_at" field if the given value is not nil.
func (*ImageCreate) SetNillableID ¶
func (ic *ImageCreate) SetNillableID(u *ulid.ID) *ImageCreate
SetNillableID sets the "id" field if the given value is not nil.
func (*ImageCreate) SetNillableUpdatedAt ¶
func (ic *ImageCreate) SetNillableUpdatedAt(t *time.Time) *ImageCreate
SetNillableUpdatedAt sets the "updated_at" field if the given value is not nil.
func (*ImageCreate) SetNillableUserID ¶
func (ic *ImageCreate) SetNillableUserID(id *ulid.ID) *ImageCreate
SetNillableUserID sets the "user" edge to the User entity by ID if the given value is not nil.
func (*ImageCreate) SetUpdatedAt ¶
func (ic *ImageCreate) SetUpdatedAt(t time.Time) *ImageCreate
SetUpdatedAt sets the "updated_at" field.
func (*ImageCreate) SetUser ¶
func (ic *ImageCreate) SetUser(u *User) *ImageCreate
SetUser sets the "user" edge to the User entity.
func (*ImageCreate) SetUserID ¶
func (ic *ImageCreate) SetUserID(id ulid.ID) *ImageCreate
SetUserID sets the "user" edge to the User entity by ID.
type ImageCreateBulk ¶
type ImageCreateBulk struct {
// contains filtered or unexported fields
}
ImageCreateBulk is the builder for creating many Image entities in bulk.
func (*ImageCreateBulk) Exec ¶
func (icb *ImageCreateBulk) Exec(ctx context.Context) error
Exec executes the query.
func (*ImageCreateBulk) ExecX ¶
func (icb *ImageCreateBulk) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
type ImageDelete ¶
type ImageDelete struct {
// contains filtered or unexported fields
}
ImageDelete is the builder for deleting a Image entity.
func (*ImageDelete) Exec ¶
func (id *ImageDelete) Exec(ctx context.Context) (int, error)
Exec executes the deletion query and returns how many vertices were deleted.
func (*ImageDelete) ExecX ¶
func (id *ImageDelete) ExecX(ctx context.Context) int
ExecX is like Exec, but panics if an error occurs.
func (*ImageDelete) Where ¶
func (id *ImageDelete) Where(ps ...predicate.Image) *ImageDelete
Where appends a list predicates to the ImageDelete builder.
type ImageDeleteOne ¶
type ImageDeleteOne struct {
// contains filtered or unexported fields
}
ImageDeleteOne is the builder for deleting a single Image entity.
func (*ImageDeleteOne) Exec ¶
func (ido *ImageDeleteOne) Exec(ctx context.Context) error
Exec executes the deletion query.
func (*ImageDeleteOne) ExecX ¶
func (ido *ImageDeleteOne) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
type ImageEdges ¶
type ImageEdges struct { // User holds the value of the user edge. User *User `json:"user,omitempty"` // contains filtered or unexported fields }
ImageEdges holds the relations/edges for other nodes in the graph.
func (ImageEdges) UserOrErr ¶
func (e ImageEdges) 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 ImageGroupBy ¶
type ImageGroupBy struct {
// contains filtered or unexported fields
}
ImageGroupBy is the group-by builder for Image entities.
func (*ImageGroupBy) Aggregate ¶
func (igb *ImageGroupBy) Aggregate(fns ...AggregateFunc) *ImageGroupBy
Aggregate adds the given aggregation functions to the group-by query.
func (*ImageGroupBy) Bool ¶
func (igb *ImageGroupBy) Bool(ctx context.Context) (_ bool, err error)
Bool returns a single bool from a group-by query. It is only allowed when executing a group-by query with one field.
func (*ImageGroupBy) BoolX ¶
func (igb *ImageGroupBy) BoolX(ctx context.Context) bool
BoolX is like Bool, but panics if an error occurs.
func (*ImageGroupBy) Bools ¶
func (igb *ImageGroupBy) Bools(ctx context.Context) ([]bool, error)
Bools returns list of bools from group-by. It is only allowed when executing a group-by query with one field.
func (*ImageGroupBy) BoolsX ¶
func (igb *ImageGroupBy) BoolsX(ctx context.Context) []bool
BoolsX is like Bools, but panics if an error occurs.
func (*ImageGroupBy) Float64 ¶
func (igb *ImageGroupBy) Float64(ctx context.Context) (_ float64, err error)
Float64 returns a single float64 from a group-by query. It is only allowed when executing a group-by query with one field.
func (*ImageGroupBy) Float64X ¶
func (igb *ImageGroupBy) Float64X(ctx context.Context) float64
Float64X is like Float64, but panics if an error occurs.
func (*ImageGroupBy) Float64s ¶
func (igb *ImageGroupBy) Float64s(ctx context.Context) ([]float64, error)
Float64s returns list of float64s from group-by. It is only allowed when executing a group-by query with one field.
func (*ImageGroupBy) Float64sX ¶
func (igb *ImageGroupBy) Float64sX(ctx context.Context) []float64
Float64sX is like Float64s, but panics if an error occurs.
func (*ImageGroupBy) Int ¶
func (igb *ImageGroupBy) Int(ctx context.Context) (_ int, err error)
Int returns a single int from a group-by query. It is only allowed when executing a group-by query with one field.
func (*ImageGroupBy) IntX ¶
func (igb *ImageGroupBy) IntX(ctx context.Context) int
IntX is like Int, but panics if an error occurs.
func (*ImageGroupBy) Ints ¶
func (igb *ImageGroupBy) Ints(ctx context.Context) ([]int, error)
Ints returns list of ints from group-by. It is only allowed when executing a group-by query with one field.
func (*ImageGroupBy) IntsX ¶
func (igb *ImageGroupBy) IntsX(ctx context.Context) []int
IntsX is like Ints, but panics if an error occurs.
func (*ImageGroupBy) Scan ¶
func (igb *ImageGroupBy) Scan(ctx context.Context, v interface{}) error
Scan applies the group-by query and scans the result into the given value.
func (*ImageGroupBy) ScanX ¶
func (igb *ImageGroupBy) ScanX(ctx context.Context, v interface{})
ScanX is like Scan, but panics if an error occurs.
func (*ImageGroupBy) String ¶
func (igb *ImageGroupBy) String(ctx context.Context) (_ string, err error)
String returns a single string from a group-by query. It is only allowed when executing a group-by query with one field.
func (*ImageGroupBy) StringX ¶
func (igb *ImageGroupBy) StringX(ctx context.Context) string
StringX is like String, but panics if an error occurs.
type ImageMutation ¶
type ImageMutation struct {
// contains filtered or unexported fields
}
ImageMutation represents an operation that mutates the Image nodes in the graph.
func (*ImageMutation) AddField ¶
func (m *ImageMutation) AddField(name string, value ent.Value) error
AddField adds the value to the field with the given name. It returns an error if the field is not defined in the schema, or if the type mismatched the field type.
func (*ImageMutation) AddedEdges ¶
func (m *ImageMutation) AddedEdges() []string
AddedEdges returns all edge names that were set/added in this mutation.
func (*ImageMutation) AddedField ¶
func (m *ImageMutation) AddedField(name string) (ent.Value, bool)
AddedField returns the numeric value that was incremented/decremented on a field with the given name. The second boolean return value indicates that this field was not set, or was not defined in the schema.
func (*ImageMutation) AddedFields ¶
func (m *ImageMutation) AddedFields() []string
AddedFields returns all numeric fields that were incremented/decremented during this mutation.
func (*ImageMutation) AddedIDs ¶
func (m *ImageMutation) AddedIDs(name string) []ent.Value
AddedIDs returns all IDs (to other nodes) that were added for the given edge name in this mutation.
func (*ImageMutation) ClearEdge ¶
func (m *ImageMutation) ClearEdge(name string) error
ClearEdge clears the value of the edge with the given name. It returns an error if that edge is not defined in the schema.
func (*ImageMutation) ClearField ¶
func (m *ImageMutation) ClearField(name string) error
ClearField clears the value of the field with the given name. It returns an error if the field is not defined in the schema.
func (*ImageMutation) ClearUser ¶
func (m *ImageMutation) ClearUser()
ClearUser clears the "user" edge to the User entity.
func (*ImageMutation) ClearedEdges ¶
func (m *ImageMutation) ClearedEdges() []string
ClearedEdges returns all edge names that were cleared in this mutation.
func (*ImageMutation) ClearedFields ¶
func (m *ImageMutation) ClearedFields() []string
ClearedFields returns all nullable fields that were cleared during this mutation.
func (ImageMutation) Client ¶
func (m ImageMutation) 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 (*ImageMutation) Content ¶
func (m *ImageMutation) Content() (r string, exists bool)
Content returns the value of the "content" field in the mutation.
func (*ImageMutation) CreatedAt ¶
func (m *ImageMutation) CreatedAt() (r time.Time, exists bool)
CreatedAt returns the value of the "created_at" field in the mutation.
func (*ImageMutation) EdgeCleared ¶
func (m *ImageMutation) EdgeCleared(name string) bool
EdgeCleared returns a boolean which indicates if the edge with the given name was cleared in this mutation.
func (*ImageMutation) Field ¶
func (m *ImageMutation) Field(name string) (ent.Value, bool)
Field returns the value of a field with the given name. The second boolean return value indicates that this field was not set, or was not defined in the schema.
func (*ImageMutation) FieldCleared ¶
func (m *ImageMutation) FieldCleared(name string) bool
FieldCleared returns a boolean indicating if a field with the given name was cleared in this mutation.
func (*ImageMutation) Fields ¶
func (m *ImageMutation) Fields() []string
Fields returns all fields that were changed during this mutation. Note that in order to get all numeric fields that were incremented/decremented, call AddedFields().
func (*ImageMutation) FileName ¶
func (m *ImageMutation) FileName() (r string, exists bool)
FileName returns the value of the "file_name" field in the mutation.
func (*ImageMutation) ID ¶
func (m *ImageMutation) ID() (id ulid.ID, exists bool)
ID returns the ID value in the mutation. Note that the ID is only available if it was provided to the builder or after it was returned from the database.
func (*ImageMutation) IDs ¶
IDs queries the database and returns the entity ids that match the mutation's predicate. That means, if the mutation is applied within a transaction with an isolation level such as sql.LevelSerializable, the returned ids match the ids of the rows that will be updated or updated by the mutation.
func (*ImageMutation) OldContent ¶
func (m *ImageMutation) OldContent(ctx context.Context) (v string, err error)
OldContent returns the old "content" field's value of the Image entity. If the Image object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (*ImageMutation) OldCreatedAt ¶
OldCreatedAt returns the old "created_at" field's value of the Image entity. If the Image object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (*ImageMutation) OldField ¶
OldField returns the old value of the field from the database. An error is returned if the mutation operation is not UpdateOne, or the query to the database failed.
func (*ImageMutation) OldFileName ¶
func (m *ImageMutation) OldFileName(ctx context.Context) (v string, err error)
OldFileName returns the old "file_name" field's value of the Image entity. If the Image object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (*ImageMutation) OldUpdatedAt ¶
OldUpdatedAt returns the old "updated_at" field's value of the Image entity. If the Image object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (*ImageMutation) RemovedEdges ¶
func (m *ImageMutation) RemovedEdges() []string
RemovedEdges returns all edge names that were removed in this mutation.
func (*ImageMutation) RemovedIDs ¶
func (m *ImageMutation) RemovedIDs(name string) []ent.Value
RemovedIDs returns all IDs (to other nodes) that were removed for the edge with the given name in this mutation.
func (*ImageMutation) ResetContent ¶
func (m *ImageMutation) ResetContent()
ResetContent resets all changes to the "content" field.
func (*ImageMutation) ResetCreatedAt ¶
func (m *ImageMutation) ResetCreatedAt()
ResetCreatedAt resets all changes to the "created_at" field.
func (*ImageMutation) ResetEdge ¶
func (m *ImageMutation) ResetEdge(name string) error
ResetEdge resets all changes to the edge with the given name in this mutation. It returns an error if the edge is not defined in the schema.
func (*ImageMutation) ResetField ¶
func (m *ImageMutation) ResetField(name string) error
ResetField resets all changes in the mutation for the field with the given name. It returns an error if the field is not defined in the schema.
func (*ImageMutation) ResetFileName ¶
func (m *ImageMutation) ResetFileName()
ResetFileName resets all changes to the "file_name" field.
func (*ImageMutation) ResetUpdatedAt ¶
func (m *ImageMutation) ResetUpdatedAt()
ResetUpdatedAt resets all changes to the "updated_at" field.
func (*ImageMutation) ResetUser ¶
func (m *ImageMutation) ResetUser()
ResetUser resets all changes to the "user" edge.
func (*ImageMutation) SetContent ¶
func (m *ImageMutation) SetContent(s string)
SetContent sets the "content" field.
func (*ImageMutation) SetCreatedAt ¶
func (m *ImageMutation) SetCreatedAt(t time.Time)
SetCreatedAt sets the "created_at" field.
func (*ImageMutation) SetField ¶
func (m *ImageMutation) SetField(name string, value ent.Value) error
SetField sets the value of a field with the given name. It returns an error if the field is not defined in the schema, or if the type mismatched the field type.
func (*ImageMutation) SetFileName ¶
func (m *ImageMutation) SetFileName(s string)
SetFileName sets the "file_name" field.
func (*ImageMutation) SetID ¶
func (m *ImageMutation) SetID(id ulid.ID)
SetID sets the value of the id field. Note that this operation is only accepted on creation of Image entities.
func (*ImageMutation) SetUpdatedAt ¶
func (m *ImageMutation) SetUpdatedAt(t time.Time)
SetUpdatedAt sets the "updated_at" field.
func (*ImageMutation) SetUserID ¶
func (m *ImageMutation) SetUserID(id ulid.ID)
SetUserID sets the "user" edge to the User entity by id.
func (ImageMutation) Tx ¶
func (m ImageMutation) Tx() (*Tx, error)
Tx returns an `ent.Tx` for mutations that were executed in transactions; it returns an error otherwise.
func (*ImageMutation) Type ¶
func (m *ImageMutation) Type() string
Type returns the node type of this mutation (Image).
func (*ImageMutation) UpdatedAt ¶
func (m *ImageMutation) UpdatedAt() (r time.Time, exists bool)
UpdatedAt returns the value of the "updated_at" field in the mutation.
func (*ImageMutation) UserCleared ¶
func (m *ImageMutation) UserCleared() bool
UserCleared reports if the "user" edge to the User entity was cleared.
func (*ImageMutation) UserID ¶
func (m *ImageMutation) UserID() (id ulid.ID, exists bool)
UserID returns the "user" edge ID in the mutation.
func (*ImageMutation) UserIDs ¶
func (m *ImageMutation) UserIDs() (ids []ulid.ID)
UserIDs returns the "user" edge IDs in the mutation. Note that IDs always returns len(IDs) <= 1 for unique edges, and you should use UserID instead. It exists only for internal usage by the builders.
func (*ImageMutation) Where ¶
func (m *ImageMutation) Where(ps ...predicate.Image)
Where appends a list predicates to the ImageMutation builder.
type ImageOrder ¶
type ImageOrder struct { Direction OrderDirection `json:"direction"` Field *ImageOrderField `json:"field"` }
ImageOrder defines the ordering of Image.
type ImageOrderField ¶
type ImageOrderField struct {
// contains filtered or unexported fields
}
ImageOrderField defines the ordering field of Image.
func (ImageOrderField) MarshalGQL ¶
func (f ImageOrderField) MarshalGQL(w io.Writer)
MarshalGQL implements graphql.Marshaler interface.
func (ImageOrderField) String ¶
func (f ImageOrderField) String() string
String implement fmt.Stringer interface.
func (*ImageOrderField) UnmarshalGQL ¶
func (f *ImageOrderField) UnmarshalGQL(v interface{}) error
UnmarshalGQL implements graphql.Unmarshaler interface.
type ImagePaginateOption ¶
type ImagePaginateOption func(*imagePager) error
ImagePaginateOption enables pagination customization.
func WithImageFilter ¶
func WithImageFilter(filter func(*ImageQuery) (*ImageQuery, error)) ImagePaginateOption
WithImageFilter configures pagination filter.
func WithImageOrder ¶
func WithImageOrder(order *ImageOrder) ImagePaginateOption
WithImageOrder configures pagination ordering.
type ImageQuery ¶
type ImageQuery struct {
// contains filtered or unexported fields
}
ImageQuery is the builder for querying Image entities.
func (*ImageQuery) All ¶
func (iq *ImageQuery) All(ctx context.Context) ([]*Image, error)
All executes the query and returns a list of Images.
func (*ImageQuery) AllX ¶
func (iq *ImageQuery) AllX(ctx context.Context) []*Image
AllX is like All, but panics if an error occurs.
func (*ImageQuery) Clone ¶
func (iq *ImageQuery) Clone() *ImageQuery
Clone returns a duplicate of the ImageQuery builder, including all associated steps. It can be used to prepare common query builders and use them differently after the clone is made.
func (*ImageQuery) CollectFields ¶
func (i *ImageQuery) CollectFields(ctx context.Context, satisfies ...string) *ImageQuery
CollectFields tells the query-builder to eagerly load connected nodes by resolver context.
func (*ImageQuery) Count ¶
func (iq *ImageQuery) Count(ctx context.Context) (int, error)
Count returns the count of the given query.
func (*ImageQuery) CountX ¶
func (iq *ImageQuery) CountX(ctx context.Context) int
CountX is like Count, but panics if an error occurs.
func (*ImageQuery) Exist ¶
func (iq *ImageQuery) Exist(ctx context.Context) (bool, error)
Exist returns true if the query has elements in the graph.
func (*ImageQuery) ExistX ¶
func (iq *ImageQuery) ExistX(ctx context.Context) bool
ExistX is like Exist, but panics if an error occurs.
func (*ImageQuery) First ¶
func (iq *ImageQuery) First(ctx context.Context) (*Image, error)
First returns the first Image entity from the query. Returns a *NotFoundError when no Image was found.
func (*ImageQuery) FirstID ¶
FirstID returns the first Image ID from the query. Returns a *NotFoundError when no Image ID was found.
func (*ImageQuery) FirstIDX ¶
func (iq *ImageQuery) FirstIDX(ctx context.Context) ulid.ID
FirstIDX is like FirstID, but panics if an error occurs.
func (*ImageQuery) FirstX ¶
func (iq *ImageQuery) FirstX(ctx context.Context) *Image
FirstX is like First, but panics if an error occurs.
func (*ImageQuery) GroupBy ¶
func (iq *ImageQuery) GroupBy(field string, fields ...string) *ImageGroupBy
GroupBy is used to group vertices by one or more fields/columns. It is often used with aggregate functions, like: count, max, mean, min, sum.
Example:
var v []struct { CreatedAt time.Time `json:"created_at,omitempty"` Count int `json:"count,omitempty"` } client.Image.Query(). GroupBy(image.FieldCreatedAt). Aggregate(ent.Count()). Scan(ctx, &v)
func (*ImageQuery) IDsX ¶
func (iq *ImageQuery) IDsX(ctx context.Context) []ulid.ID
IDsX is like IDs, but panics if an error occurs.
func (*ImageQuery) Limit ¶
func (iq *ImageQuery) Limit(limit int) *ImageQuery
Limit adds a limit step to the query.
func (*ImageQuery) Offset ¶
func (iq *ImageQuery) Offset(offset int) *ImageQuery
Offset adds an offset step to the query.
func (*ImageQuery) Only ¶
func (iq *ImageQuery) Only(ctx context.Context) (*Image, error)
Only returns a single Image entity found by the query, ensuring it only returns one. Returns a *NotSingularError when more than one Image entity is found. Returns a *NotFoundError when no Image entities are found.
func (*ImageQuery) OnlyID ¶
OnlyID is like Only, but returns the only Image ID in the query. Returns a *NotSingularError when more than one Image ID is found. Returns a *NotFoundError when no entities are found.
func (*ImageQuery) OnlyIDX ¶
func (iq *ImageQuery) OnlyIDX(ctx context.Context) ulid.ID
OnlyIDX is like OnlyID, but panics if an error occurs.
func (*ImageQuery) OnlyX ¶
func (iq *ImageQuery) OnlyX(ctx context.Context) *Image
OnlyX is like Only, but panics if an error occurs.
func (*ImageQuery) Order ¶
func (iq *ImageQuery) Order(o ...OrderFunc) *ImageQuery
Order adds an order step to the query.
func (*ImageQuery) Paginate ¶
func (i *ImageQuery) Paginate( ctx context.Context, after *Cursor, first *int, before *Cursor, last *int, opts ...ImagePaginateOption, ) (*ImageConnection, error)
Paginate executes the query and returns a relay based cursor connection to Image.
func (*ImageQuery) QueryUser ¶
func (iq *ImageQuery) QueryUser() *UserQuery
QueryUser chains the current query on the "user" edge.
func (*ImageQuery) Select ¶
func (iq *ImageQuery) Select(fields ...string) *ImageSelect
Select allows the selection one or more fields/columns for the given query, instead of selecting all fields in the entity.
Example:
var v []struct { CreatedAt time.Time `json:"created_at,omitempty"` } client.Image.Query(). Select(image.FieldCreatedAt). Scan(ctx, &v)
func (*ImageQuery) Unique ¶
func (iq *ImageQuery) Unique(unique bool) *ImageQuery
Unique configures the query builder to filter duplicate records on query. By default, unique is set to true, and can be disabled using this method.
func (*ImageQuery) Where ¶
func (iq *ImageQuery) Where(ps ...predicate.Image) *ImageQuery
Where adds a new predicate for the ImageQuery builder.
func (*ImageQuery) WithUser ¶
func (iq *ImageQuery) WithUser(opts ...func(*UserQuery)) *ImageQuery
WithUser tells the query-builder to eager-load the nodes that are connected to the "user" edge. The optional arguments are used to configure the query builder of the edge.
type ImageSelect ¶
type ImageSelect struct { *ImageQuery // contains filtered or unexported fields }
ImageSelect is the builder for selecting fields of Image entities.
func (*ImageSelect) Bool ¶
func (is *ImageSelect) Bool(ctx context.Context) (_ bool, err error)
Bool returns a single bool from a selector. It is only allowed when selecting one field.
func (*ImageSelect) BoolX ¶
func (is *ImageSelect) BoolX(ctx context.Context) bool
BoolX is like Bool, but panics if an error occurs.
func (*ImageSelect) Bools ¶
func (is *ImageSelect) Bools(ctx context.Context) ([]bool, error)
Bools returns list of bools from a selector. It is only allowed when selecting one field.
func (*ImageSelect) BoolsX ¶
func (is *ImageSelect) BoolsX(ctx context.Context) []bool
BoolsX is like Bools, but panics if an error occurs.
func (*ImageSelect) Float64 ¶
func (is *ImageSelect) Float64(ctx context.Context) (_ float64, err error)
Float64 returns a single float64 from a selector. It is only allowed when selecting one field.
func (*ImageSelect) Float64X ¶
func (is *ImageSelect) Float64X(ctx context.Context) float64
Float64X is like Float64, but panics if an error occurs.
func (*ImageSelect) Float64s ¶
func (is *ImageSelect) Float64s(ctx context.Context) ([]float64, error)
Float64s returns list of float64s from a selector. It is only allowed when selecting one field.
func (*ImageSelect) Float64sX ¶
func (is *ImageSelect) Float64sX(ctx context.Context) []float64
Float64sX is like Float64s, but panics if an error occurs.
func (*ImageSelect) Int ¶
func (is *ImageSelect) Int(ctx context.Context) (_ int, err error)
Int returns a single int from a selector. It is only allowed when selecting one field.
func (*ImageSelect) IntX ¶
func (is *ImageSelect) IntX(ctx context.Context) int
IntX is like Int, but panics if an error occurs.
func (*ImageSelect) Ints ¶
func (is *ImageSelect) Ints(ctx context.Context) ([]int, error)
Ints returns list of ints from a selector. It is only allowed when selecting one field.
func (*ImageSelect) IntsX ¶
func (is *ImageSelect) IntsX(ctx context.Context) []int
IntsX is like Ints, but panics if an error occurs.
func (*ImageSelect) Scan ¶
func (is *ImageSelect) Scan(ctx context.Context, v interface{}) error
Scan applies the selector query and scans the result into the given value.
func (*ImageSelect) ScanX ¶
func (is *ImageSelect) ScanX(ctx context.Context, v interface{})
ScanX is like Scan, but panics if an error occurs.
func (*ImageSelect) String ¶
func (is *ImageSelect) String(ctx context.Context) (_ string, err error)
String returns a single string from a selector. It is only allowed when selecting one field.
func (*ImageSelect) StringX ¶
func (is *ImageSelect) StringX(ctx context.Context) string
StringX is like String, but panics if an error occurs.
type ImageUpdate ¶
type ImageUpdate struct {
// contains filtered or unexported fields
}
ImageUpdate is the builder for updating Image entities.
func (*ImageUpdate) ClearUser ¶
func (iu *ImageUpdate) ClearUser() *ImageUpdate
ClearUser clears the "user" edge to the User entity.
func (*ImageUpdate) Exec ¶
func (iu *ImageUpdate) Exec(ctx context.Context) error
Exec executes the query.
func (*ImageUpdate) ExecX ¶
func (iu *ImageUpdate) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*ImageUpdate) Mutation ¶
func (iu *ImageUpdate) Mutation() *ImageMutation
Mutation returns the ImageMutation object of the builder.
func (*ImageUpdate) Save ¶
func (iu *ImageUpdate) Save(ctx context.Context) (int, error)
Save executes the query and returns the number of nodes affected by the update operation.
func (*ImageUpdate) SaveX ¶
func (iu *ImageUpdate) SaveX(ctx context.Context) int
SaveX is like Save, but panics if an error occurs.
func (*ImageUpdate) SetContent ¶
func (iu *ImageUpdate) SetContent(s string) *ImageUpdate
SetContent sets the "content" field.
func (*ImageUpdate) SetFileName ¶
func (iu *ImageUpdate) SetFileName(s string) *ImageUpdate
SetFileName sets the "file_name" field.
func (*ImageUpdate) SetNillableUserID ¶
func (iu *ImageUpdate) SetNillableUserID(id *ulid.ID) *ImageUpdate
SetNillableUserID sets the "user" edge to the User entity by ID if the given value is not nil.
func (*ImageUpdate) SetUpdatedAt ¶
func (iu *ImageUpdate) SetUpdatedAt(t time.Time) *ImageUpdate
SetUpdatedAt sets the "updated_at" field.
func (*ImageUpdate) SetUser ¶
func (iu *ImageUpdate) SetUser(u *User) *ImageUpdate
SetUser sets the "user" edge to the User entity.
func (*ImageUpdate) SetUserID ¶
func (iu *ImageUpdate) SetUserID(id ulid.ID) *ImageUpdate
SetUserID sets the "user" edge to the User entity by ID.
func (*ImageUpdate) Where ¶
func (iu *ImageUpdate) Where(ps ...predicate.Image) *ImageUpdate
Where appends a list predicates to the ImageUpdate builder.
type ImageUpdateOne ¶
type ImageUpdateOne struct {
// contains filtered or unexported fields
}
ImageUpdateOne is the builder for updating a single Image entity.
func (*ImageUpdateOne) ClearUser ¶
func (iuo *ImageUpdateOne) ClearUser() *ImageUpdateOne
ClearUser clears the "user" edge to the User entity.
func (*ImageUpdateOne) Exec ¶
func (iuo *ImageUpdateOne) Exec(ctx context.Context) error
Exec executes the query on the entity.
func (*ImageUpdateOne) ExecX ¶
func (iuo *ImageUpdateOne) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*ImageUpdateOne) Mutation ¶
func (iuo *ImageUpdateOne) Mutation() *ImageMutation
Mutation returns the ImageMutation object of the builder.
func (*ImageUpdateOne) Save ¶
func (iuo *ImageUpdateOne) Save(ctx context.Context) (*Image, error)
Save executes the query and returns the updated Image entity.
func (*ImageUpdateOne) SaveX ¶
func (iuo *ImageUpdateOne) SaveX(ctx context.Context) *Image
SaveX is like Save, but panics if an error occurs.
func (*ImageUpdateOne) Select ¶
func (iuo *ImageUpdateOne) Select(field string, fields ...string) *ImageUpdateOne
Select allows selecting one or more fields (columns) of the returned entity. The default is selecting all fields defined in the entity schema.
func (*ImageUpdateOne) SetContent ¶
func (iuo *ImageUpdateOne) SetContent(s string) *ImageUpdateOne
SetContent sets the "content" field.
func (*ImageUpdateOne) SetFileName ¶
func (iuo *ImageUpdateOne) SetFileName(s string) *ImageUpdateOne
SetFileName sets the "file_name" field.
func (*ImageUpdateOne) SetNillableUserID ¶
func (iuo *ImageUpdateOne) SetNillableUserID(id *ulid.ID) *ImageUpdateOne
SetNillableUserID sets the "user" edge to the User entity by ID if the given value is not nil.
func (*ImageUpdateOne) SetUpdatedAt ¶
func (iuo *ImageUpdateOne) SetUpdatedAt(t time.Time) *ImageUpdateOne
SetUpdatedAt sets the "updated_at" field.
func (*ImageUpdateOne) SetUser ¶
func (iuo *ImageUpdateOne) SetUser(u *User) *ImageUpdateOne
SetUser sets the "user" edge to the User entity.
func (*ImageUpdateOne) SetUserID ¶
func (iuo *ImageUpdateOne) SetUserID(id ulid.ID) *ImageUpdateOne
SetUserID sets the "user" edge to the User entity by ID.
type ImageWhereInput ¶
type ImageWhereInput struct { Not *ImageWhereInput `json:"not,omitempty"` Or []*ImageWhereInput `json:"or,omitempty"` And []*ImageWhereInput `json:"and,omitempty"` // "id" field predicates. ID *ulid.ID `json:"id,omitempty"` IDNEQ *ulid.ID `json:"idNEQ,omitempty"` IDIn []ulid.ID `json:"idIn,omitempty"` IDNotIn []ulid.ID `json:"idNotIn,omitempty"` IDGT *ulid.ID `json:"idGT,omitempty"` IDGTE *ulid.ID `json:"idGTE,omitempty"` IDLT *ulid.ID `json:"idLT,omitempty"` IDLTE *ulid.ID `json:"idLTE,omitempty"` // "created_at" field predicates. CreatedAt *time.Time `json:"createdAt,omitempty"` CreatedAtNEQ *time.Time `json:"createdAtNEQ,omitempty"` CreatedAtIn []time.Time `json:"createdAtIn,omitempty"` CreatedAtNotIn []time.Time `json:"createdAtNotIn,omitempty"` CreatedAtGT *time.Time `json:"createdAtGT,omitempty"` CreatedAtGTE *time.Time `json:"createdAtGTE,omitempty"` CreatedAtLT *time.Time `json:"createdAtLT,omitempty"` CreatedAtLTE *time.Time `json:"createdAtLTE,omitempty"` // "updated_at" field predicates. UpdatedAt *time.Time `json:"updatedAt,omitempty"` UpdatedAtNEQ *time.Time `json:"updatedAtNEQ,omitempty"` UpdatedAtIn []time.Time `json:"updatedAtIn,omitempty"` UpdatedAtNotIn []time.Time `json:"updatedAtNotIn,omitempty"` UpdatedAtGT *time.Time `json:"updatedAtGT,omitempty"` UpdatedAtGTE *time.Time `json:"updatedAtGTE,omitempty"` UpdatedAtLT *time.Time `json:"updatedAtLT,omitempty"` UpdatedAtLTE *time.Time `json:"updatedAtLTE,omitempty"` // "file_name" field predicates. FileName *string `json:"fileName,omitempty"` FileNameNEQ *string `json:"fileNameNEQ,omitempty"` FileNameIn []string `json:"fileNameIn,omitempty"` FileNameNotIn []string `json:"fileNameNotIn,omitempty"` FileNameGT *string `json:"fileNameGT,omitempty"` FileNameGTE *string `json:"fileNameGTE,omitempty"` FileNameLT *string `json:"fileNameLT,omitempty"` FileNameLTE *string `json:"fileNameLTE,omitempty"` FileNameContains *string `json:"fileNameContains,omitempty"` FileNameHasPrefix *string `json:"fileNameHasPrefix,omitempty"` FileNameHasSuffix *string `json:"fileNameHasSuffix,omitempty"` FileNameEqualFold *string `json:"fileNameEqualFold,omitempty"` FileNameContainsFold *string `json:"fileNameContainsFold,omitempty"` // "content" field predicates. Content *string `json:"content,omitempty"` ContentNEQ *string `json:"contentNEQ,omitempty"` ContentIn []string `json:"contentIn,omitempty"` ContentNotIn []string `json:"contentNotIn,omitempty"` ContentGT *string `json:"contentGT,omitempty"` ContentGTE *string `json:"contentGTE,omitempty"` ContentLT *string `json:"contentLT,omitempty"` ContentLTE *string `json:"contentLTE,omitempty"` ContentContains *string `json:"contentContains,omitempty"` ContentHasPrefix *string `json:"contentHasPrefix,omitempty"` ContentHasSuffix *string `json:"contentHasSuffix,omitempty"` ContentEqualFold *string `json:"contentEqualFold,omitempty"` ContentContainsFold *string `json:"contentContainsFold,omitempty"` // "user" edge predicates. HasUser *bool `json:"hasUser,omitempty"` HasUserWith []*UserWhereInput `json:"hasUserWith,omitempty"` }
ImageWhereInput represents a where input for filtering Image queries.
func (*ImageWhereInput) Filter ¶
func (i *ImageWhereInput) Filter(q *ImageQuery) (*ImageQuery, error)
Filter applies the ImageWhereInput filter on the ImageQuery builder.
type MutateFunc ¶
type MutateFunc = ent.MutateFunc
ent aliases to avoid import conflicts in user's code.
type Node ¶
type Node struct { ID ulid.ID `json:"id,omitempty"` // node id. Type string `json:"type,omitempty"` // node type. Fields []*Field `json:"fields,omitempty"` // node fields. Edges []*Edge `json:"edges,omitempty"` // node edges. }
Node in the graph.
type NodeOption ¶
type NodeOption func(*nodeOptions)
NodeOption allows configuring the Noder execution using functional options.
func WithFixedNodeType ¶
func WithFixedNodeType(t string) NodeOption
WithFixedNodeType sets the Type of the node to a fixed value.
func WithNodeType ¶
WithNodeType sets the node Type resolver function (i.e. the table to query). If was not provided, the table will be derived from the universal-id configuration as described in: https://entgo.io/docs/migrate/#universal-ids.
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 OrderDirection ¶
type OrderDirection string
OrderDirection defines the directions in which to order a list of items.
const ( // OrderDirectionAsc specifies an ascending order. OrderDirectionAsc OrderDirection = "ASC" // OrderDirectionDesc specifies a descending order. OrderDirectionDesc OrderDirection = "DESC" )
func (OrderDirection) MarshalGQL ¶
func (o OrderDirection) MarshalGQL(w io.Writer)
MarshalGQL implements graphql.Marshaler interface.
func (OrderDirection) String ¶
func (o OrderDirection) String() string
String implements fmt.Stringer interface.
func (*OrderDirection) UnmarshalGQL ¶
func (o *OrderDirection) UnmarshalGQL(val interface{}) error
UnmarshalGQL implements graphql.Unmarshaler interface.
func (OrderDirection) Validate ¶
func (o OrderDirection) Validate() error
Validate the order direction value.
type PageInfo ¶
type PageInfo struct { HasNextPage bool `json:"hasNextPage"` HasPreviousPage bool `json:"hasPreviousPage"` StartCursor *Cursor `json:"startCursor"` EndCursor *Cursor `json:"endCursor"` }
PageInfo of a connection type.
type RollbackFunc ¶
The RollbackFunc type is an adapter to allow the use of ordinary function as a Rollbacker. If f is a function with the appropriate signature, RollbackFunc(f) is a Rollbacker that calls f.
type RollbackHook ¶
type RollbackHook func(Rollbacker) Rollbacker
RollbackHook defines the "rollback middleware". A function that gets a Rollbacker and returns a Rollbacker. For example:
hook := func(next ent.Rollbacker) ent.Rollbacker { return ent.RollbackFunc(func(ctx context.Context, tx *ent.Tx) error { // Do some stuff before. if err := next.Rollback(ctx, tx); err != nil { return err } // Do some stuff after. return nil }) }
type Rollbacker ¶
Rollbacker is the interface that wraps the Rollback method.
type Tx ¶
type Tx struct { // Image is the client for interacting with the Image builders. Image *ImageClient // 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 a Tx stored inside a context, or nil if there isn't one.
func (*Tx) OnRollback ¶
func (tx *Tx) OnRollback(f RollbackHook)
OnRollback adds a hook to call on rollback.
type User ¶
type User struct { // ID of the ent. ID ulid.ID `json:"id,omitempty"` // CreatedAt holds the value of the "created_at" field. CreatedAt time.Time `json:"created_at,omitempty"` // UpdatedAt holds the value of the "updated_at" field. UpdatedAt time.Time `json:"updated_at,omitempty"` // Name holds the value of the "name" field. Name string `json:"name,omitempty"` // Email holds the value of the "email" field. Email string `json:"email,omitempty"` // Password holds the value of the "password" field. Password string `json:"-"` // LastLogin holds the value of the "last_login" field. LastLogin time.Time `json:"last_login,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) QueryImages ¶
func (u *User) QueryImages() *ImageQuery
QueryImages queries the "images" edge of the User entity.
func (*User) Unwrap ¶
Unwrap unwraps the User entity that was returned from a transaction after it was closed, so that all future queries will be executed through the driver which created the transaction.
func (*User) Update ¶
func (u *User) Update() *UserUpdateOne
Update returns a builder for updating this User. Note that you need to call User.Unwrap() before calling this method if this User was returned from a transaction, and the transaction was committed or rolled back.
type UserClient ¶
type UserClient struct {
// contains filtered or unexported fields
}
UserClient is a client for the User schema.
func NewUserClient ¶
func NewUserClient(c config) *UserClient
NewUserClient returns a client for the User from the given config.
func (*UserClient) Create ¶
func (c *UserClient) Create() *UserCreate
Create returns a create builder for User.
func (*UserClient) CreateBulk ¶
func (c *UserClient) CreateBulk(builders ...*UserCreate) *UserCreateBulk
CreateBulk returns a builder for creating a bulk of User entities.
func (*UserClient) Delete ¶
func (c *UserClient) Delete() *UserDelete
Delete returns a delete builder for User.
func (*UserClient) DeleteOne ¶
func (c *UserClient) DeleteOne(u *User) *UserDeleteOne
DeleteOne returns a delete builder for the given entity.
func (*UserClient) DeleteOneID ¶
func (c *UserClient) DeleteOneID(id ulid.ID) *UserDeleteOne
DeleteOneID returns a delete builder for the given id.
func (*UserClient) Query ¶
func (c *UserClient) Query() *UserQuery
Query returns a query builder for User.
func (*UserClient) QueryImages ¶
func (c *UserClient) QueryImages(u *User) *ImageQuery
QueryImages queries the images 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 ulid.ID) *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 UserConnection ¶
type UserConnection struct { Edges []*UserEdge `json:"edges"` PageInfo PageInfo `json:"pageInfo"` TotalCount int `json:"totalCount"` }
UserConnection is the connection containing edges to User.
type UserCreate ¶
type UserCreate struct {
// contains filtered or unexported fields
}
UserCreate is the builder for creating a User entity.
func (*UserCreate) AddImageIDs ¶
func (uc *UserCreate) AddImageIDs(ids ...ulid.ID) *UserCreate
AddImageIDs adds the "images" edge to the Image entity by IDs.
func (*UserCreate) AddImages ¶
func (uc *UserCreate) AddImages(i ...*Image) *UserCreate
AddImages adds the "images" edges to the Image entity.
func (*UserCreate) Exec ¶
func (uc *UserCreate) Exec(ctx context.Context) error
Exec executes the query.
func (*UserCreate) ExecX ¶
func (uc *UserCreate) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*UserCreate) Mutation ¶
func (uc *UserCreate) Mutation() *UserMutation
Mutation returns the UserMutation object of the builder.
func (*UserCreate) Save ¶
func (uc *UserCreate) Save(ctx context.Context) (*User, error)
Save creates the User in the database.
func (*UserCreate) SaveX ¶
func (uc *UserCreate) SaveX(ctx context.Context) *User
SaveX calls Save and panics if Save returns an error.
func (*UserCreate) 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) SetID ¶
func (uc *UserCreate) SetID(u ulid.ID) *UserCreate
SetID sets the "id" field.
func (*UserCreate) SetLastLogin ¶
func (uc *UserCreate) SetLastLogin(t time.Time) *UserCreate
SetLastLogin sets the "last_login" field.
func (*UserCreate) SetName ¶
func (uc *UserCreate) SetName(s string) *UserCreate
SetName sets the "name" field.
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) SetNillableID ¶
func (uc *UserCreate) SetNillableID(u *ulid.ID) *UserCreate
SetNillableID sets the "id" field if the given value is not nil.
func (*UserCreate) SetNillableLastLogin ¶
func (uc *UserCreate) SetNillableLastLogin(t *time.Time) *UserCreate
SetNillableLastLogin sets the "last_login" 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) SetUpdatedAt ¶
func (uc *UserCreate) SetUpdatedAt(t time.Time) *UserCreate
SetUpdatedAt sets the "updated_at" field.
type UserCreateBulk ¶
type UserCreateBulk struct {
// contains filtered or unexported fields
}
UserCreateBulk is the builder for creating many User entities in bulk.
func (*UserCreateBulk) Exec ¶
func (ucb *UserCreateBulk) Exec(ctx context.Context) error
Exec executes the query.
func (*UserCreateBulk) ExecX ¶
func (ucb *UserCreateBulk) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
type UserDelete ¶
type UserDelete struct {
// contains filtered or unexported fields
}
UserDelete is the builder for deleting a User entity.
func (*UserDelete) Exec ¶
func (ud *UserDelete) Exec(ctx context.Context) (int, error)
Exec executes the deletion query and returns how many vertices were deleted.
func (*UserDelete) ExecX ¶
func (ud *UserDelete) ExecX(ctx context.Context) int
ExecX is like Exec, but panics if an error occurs.
func (*UserDelete) Where ¶
func (ud *UserDelete) Where(ps ...predicate.User) *UserDelete
Where appends a list predicates to the UserDelete builder.
type UserDeleteOne ¶
type UserDeleteOne struct {
// contains filtered or unexported fields
}
UserDeleteOne is the builder for deleting a single User entity.
func (*UserDeleteOne) Exec ¶
func (udo *UserDeleteOne) Exec(ctx context.Context) error
Exec executes the deletion query.
func (*UserDeleteOne) ExecX ¶
func (udo *UserDeleteOne) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
type UserEdges ¶
type UserEdges struct { // Images holds the value of the images edge. Images []*Image `json:"images,omitempty"` // contains filtered or unexported fields }
UserEdges holds the relations/edges for other nodes in the graph.
func (UserEdges) ImagesOrErr ¶
ImagesOrErr returns the Images value or an error if the edge was not loaded in eager-loading.
type UserGroupBy ¶
type UserGroupBy struct {
// contains filtered or unexported fields
}
UserGroupBy is the group-by builder for User entities.
func (*UserGroupBy) Aggregate ¶
func (ugb *UserGroupBy) Aggregate(fns ...AggregateFunc) *UserGroupBy
Aggregate adds the given aggregation functions to the group-by query.
func (*UserGroupBy) Bool ¶
func (ugb *UserGroupBy) Bool(ctx context.Context) (_ bool, err error)
Bool returns a single bool from a group-by query. It is only allowed when executing a group-by query with one field.
func (*UserGroupBy) BoolX ¶
func (ugb *UserGroupBy) BoolX(ctx context.Context) bool
BoolX is like Bool, but panics if an error occurs.
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 executing a group-by query 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) Float64 ¶
func (ugb *UserGroupBy) Float64(ctx context.Context) (_ float64, err error)
Float64 returns a single float64 from a group-by query. It is only allowed when executing a group-by query with one field.
func (*UserGroupBy) Float64X ¶
func (ugb *UserGroupBy) Float64X(ctx context.Context) float64
Float64X is like Float64, 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 executing a group-by query 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) Int ¶
func (ugb *UserGroupBy) Int(ctx context.Context) (_ int, err error)
Int returns a single int from a group-by query. It is only allowed when executing a group-by query with one field.
func (*UserGroupBy) IntX ¶
func (ugb *UserGroupBy) IntX(ctx context.Context) int
IntX is like Int, 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 executing a group-by query 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 scans 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.
func (*UserGroupBy) String ¶
func (ugb *UserGroupBy) String(ctx context.Context) (_ string, err error)
String returns a single string from a group-by query. It is only allowed when executing a group-by query with one field.
func (*UserGroupBy) StringX ¶
func (ugb *UserGroupBy) StringX(ctx context.Context) string
StringX is like String, but panics if an error occurs.
type UserMutation ¶
type UserMutation struct {
// contains filtered or unexported fields
}
UserMutation represents an operation that mutates the User nodes in the graph.
func (*UserMutation) AddField ¶
func (m *UserMutation) AddField(name string, value ent.Value) error
AddField adds the value to the field with the given name. It returns an error if the field is not defined in the schema, or if the type mismatched the field type.
func (*UserMutation) AddImageIDs ¶
func (m *UserMutation) AddImageIDs(ids ...ulid.ID)
AddImageIDs adds the "images" edge to the Image entity by ids.
func (*UserMutation) AddedEdges ¶
func (m *UserMutation) AddedEdges() []string
AddedEdges returns all edge names that were set/added in this mutation.
func (*UserMutation) AddedField ¶
func (m *UserMutation) AddedField(name string) (ent.Value, bool)
AddedField returns the numeric value that was incremented/decremented on a field with the given name. The second boolean return value indicates that this field was not set, or was not defined in the schema.
func (*UserMutation) AddedFields ¶
func (m *UserMutation) AddedFields() []string
AddedFields returns all numeric fields that were incremented/decremented during this mutation.
func (*UserMutation) AddedIDs ¶
func (m *UserMutation) AddedIDs(name string) []ent.Value
AddedIDs returns all IDs (to other nodes) that were added for the given edge name in this mutation.
func (*UserMutation) ClearEdge ¶
func (m *UserMutation) ClearEdge(name string) error
ClearEdge clears the value of the edge with the given name. It returns an error if that edge is not defined in the schema.
func (*UserMutation) ClearField ¶
func (m *UserMutation) ClearField(name string) error
ClearField clears the value of the field with the given name. It returns an error if the field is not defined in the schema.
func (*UserMutation) ClearImages ¶
func (m *UserMutation) ClearImages()
ClearImages clears the "images" edge to the Image entity.
func (*UserMutation) ClearedEdges ¶
func (m *UserMutation) ClearedEdges() []string
ClearedEdges returns all edge names that were cleared in this mutation.
func (*UserMutation) ClearedFields ¶
func (m *UserMutation) ClearedFields() []string
ClearedFields returns all nullable fields that were cleared during this mutation.
func (UserMutation) Client ¶
func (m UserMutation) Client() *Client
Client returns a new `ent.Client` from the mutation. If the mutation was executed in a transaction (ent.Tx), a transactional client is returned.
func (*UserMutation) CreatedAt ¶
func (m *UserMutation) CreatedAt() (r time.Time, exists bool)
CreatedAt returns the value of the "created_at" field in the mutation.
func (*UserMutation) EdgeCleared ¶
func (m *UserMutation) EdgeCleared(name string) bool
EdgeCleared returns a boolean which indicates if the edge with the given name was cleared in this mutation.
func (*UserMutation) Email ¶
func (m *UserMutation) Email() (r string, exists bool)
Email returns the value of the "email" field 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 return value indicates that this field was not set, or was not defined in the schema.
func (*UserMutation) FieldCleared ¶
func (m *UserMutation) FieldCleared(name string) bool
FieldCleared returns a boolean indicating if a field with the given name was cleared in this mutation.
func (*UserMutation) Fields ¶
func (m *UserMutation) Fields() []string
Fields returns all fields that were changed during this mutation. Note that in order to get all numeric fields that were incremented/decremented, call AddedFields().
func (*UserMutation) ID ¶
func (m *UserMutation) ID() (id ulid.ID, exists bool)
ID returns the ID value in the mutation. Note that the ID is only available if it was provided to the builder or after it was returned from the database.
func (*UserMutation) IDs ¶
IDs queries the database and returns the entity ids that match the mutation's predicate. That means, if the mutation is applied within a transaction with an isolation level such as sql.LevelSerializable, the returned ids match the ids of the rows that will be updated or updated by the mutation.
func (*UserMutation) ImagesCleared ¶
func (m *UserMutation) ImagesCleared() bool
ImagesCleared reports if the "images" edge to the Image entity was cleared.
func (*UserMutation) ImagesIDs ¶
func (m *UserMutation) ImagesIDs() (ids []ulid.ID)
ImagesIDs returns the "images" edge IDs in the mutation.
func (*UserMutation) LastLogin ¶
func (m *UserMutation) LastLogin() (r time.Time, exists bool)
LastLogin returns the value of the "last_login" field in the mutation.
func (*UserMutation) Name ¶
func (m *UserMutation) Name() (r string, exists bool)
Name returns the value of the "name" field in the mutation.
func (*UserMutation) OldCreatedAt ¶
OldCreatedAt returns the old "created_at" field's value of the User entity. If the User object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (*UserMutation) OldEmail ¶
func (m *UserMutation) OldEmail(ctx context.Context) (v string, err error)
OldEmail returns the old "email" field's value of the User entity. If the User object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (*UserMutation) OldField ¶
OldField returns the old value of the field from the database. An error is returned if the mutation operation is not UpdateOne, or the query to the database failed.
func (*UserMutation) OldLastLogin ¶
OldLastLogin returns the old "last_login" field's value of the User entity. If the User object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (*UserMutation) OldName ¶
func (m *UserMutation) OldName(ctx context.Context) (v string, err error)
OldName returns the old "name" field's value of the User entity. If the User object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (*UserMutation) OldPassword ¶
func (m *UserMutation) OldPassword(ctx context.Context) (v string, err error)
OldPassword returns the old "password" field's value of the User entity. If the User object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (*UserMutation) OldUpdatedAt ¶
OldUpdatedAt returns the old "updated_at" field's value of the User entity. If the User object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (*UserMutation) Password ¶
func (m *UserMutation) Password() (r string, exists bool)
Password returns the value of the "password" field in the mutation.
func (*UserMutation) RemoveImageIDs ¶
func (m *UserMutation) RemoveImageIDs(ids ...ulid.ID)
RemoveImageIDs removes the "images" edge to the Image entity by IDs.
func (*UserMutation) RemovedEdges ¶
func (m *UserMutation) RemovedEdges() []string
RemovedEdges returns all edge names that were removed in this mutation.
func (*UserMutation) RemovedIDs ¶
func (m *UserMutation) RemovedIDs(name string) []ent.Value
RemovedIDs returns all IDs (to other nodes) that were removed for the edge with the given name in this mutation.
func (*UserMutation) RemovedImagesIDs ¶
func (m *UserMutation) RemovedImagesIDs() (ids []ulid.ID)
RemovedImages returns the removed IDs of the "images" edge to the Image entity.
func (*UserMutation) ResetCreatedAt ¶
func (m *UserMutation) ResetCreatedAt()
ResetCreatedAt resets all changes to the "created_at" field.
func (*UserMutation) ResetEdge ¶
func (m *UserMutation) ResetEdge(name string) error
ResetEdge resets all changes to the edge with the given name in this mutation. It returns an error if the edge is not defined in the schema.
func (*UserMutation) ResetEmail ¶
func (m *UserMutation) ResetEmail()
ResetEmail resets all changes to the "email" field.
func (*UserMutation) ResetField ¶
func (m *UserMutation) ResetField(name string) error
ResetField resets all changes in the mutation for the field with the given name. It returns an error if the field is not defined in the schema.
func (*UserMutation) ResetImages ¶
func (m *UserMutation) ResetImages()
ResetImages resets all changes to the "images" edge.
func (*UserMutation) ResetLastLogin ¶
func (m *UserMutation) ResetLastLogin()
ResetLastLogin resets all changes to the "last_login" field.
func (*UserMutation) ResetName ¶
func (m *UserMutation) ResetName()
ResetName resets all changes to the "name" field.
func (*UserMutation) ResetPassword ¶
func (m *UserMutation) ResetPassword()
ResetPassword resets all changes to the "password" field.
func (*UserMutation) ResetUpdatedAt ¶
func (m *UserMutation) ResetUpdatedAt()
ResetUpdatedAt resets all changes to the "updated_at" 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 of a field with the given name. It returns an error if the field is not defined in the schema, or if the type mismatched the field type.
func (*UserMutation) SetID ¶
func (m *UserMutation) SetID(id ulid.ID)
SetID sets the value of the id field. Note that this operation is only accepted on creation of User entities.
func (*UserMutation) SetLastLogin ¶
func (m *UserMutation) SetLastLogin(t time.Time)
SetLastLogin sets the "last_login" field.
func (*UserMutation) SetName ¶
func (m *UserMutation) SetName(s string)
SetName sets the "name" field.
func (*UserMutation) SetPassword ¶
func (m *UserMutation) SetPassword(s string)
SetPassword sets the "password" field.
func (*UserMutation) SetUpdatedAt ¶
func (m *UserMutation) SetUpdatedAt(t time.Time)
SetUpdatedAt sets the "updated_at" field.
func (UserMutation) Tx ¶
func (m UserMutation) Tx() (*Tx, error)
Tx returns an `ent.Tx` for mutations that were executed in transactions; it returns an error otherwise.
func (*UserMutation) Type ¶
func (m *UserMutation) Type() string
Type returns the node type of this mutation (User).
func (*UserMutation) UpdatedAt ¶
func (m *UserMutation) UpdatedAt() (r time.Time, exists bool)
UpdatedAt returns the value of the "updated_at" field in the mutation.
func (*UserMutation) Where ¶
func (m *UserMutation) Where(ps ...predicate.User)
Where appends a list predicates to the UserMutation builder.
type UserOrder ¶
type UserOrder struct { Direction OrderDirection `json:"direction"` Field *UserOrderField `json:"field"` }
UserOrder defines the ordering of User.
type UserOrderField ¶
type UserOrderField struct {
// contains filtered or unexported fields
}
UserOrderField defines the ordering field of User.
func (UserOrderField) MarshalGQL ¶
func (f UserOrderField) MarshalGQL(w io.Writer)
MarshalGQL implements graphql.Marshaler interface.
func (UserOrderField) String ¶
func (f UserOrderField) String() string
String implement fmt.Stringer interface.
func (*UserOrderField) UnmarshalGQL ¶
func (f *UserOrderField) UnmarshalGQL(v interface{}) error
UnmarshalGQL implements graphql.Unmarshaler interface.
type UserPaginateOption ¶
type UserPaginateOption func(*userPager) error
UserPaginateOption enables pagination customization.
func WithUserFilter ¶
func WithUserFilter(filter func(*UserQuery) (*UserQuery, error)) UserPaginateOption
WithUserFilter configures pagination filter.
func WithUserOrder ¶
func WithUserOrder(order *UserOrder) UserPaginateOption
WithUserOrder configures pagination ordering.
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 UserQuery builder, including all associated steps. It can be used to prepare common query builders and use them differently after the clone is made.
func (*UserQuery) CollectFields ¶
CollectFields tells the query-builder to eagerly load connected nodes by resolver context.
func (*UserQuery) First ¶
First returns the first User entity from the query. Returns a *NotFoundError when no User was found.
func (*UserQuery) FirstID ¶
FirstID returns the first User ID from the query. Returns a *NotFoundError when no User ID was found.
func (*UserQuery) GroupBy ¶
func (uq *UserQuery) GroupBy(field string, fields ...string) *UserGroupBy
GroupBy is used to group vertices by one or more fields/columns. It is often used with aggregate functions, like: count, max, mean, min, sum.
Example:
var v []struct { CreatedAt time.Time `json:"created_at,omitempty"` Count int `json:"count,omitempty"` } client.User.Query(). GroupBy(user.FieldCreatedAt). Aggregate(ent.Count()). Scan(ctx, &v)
func (*UserQuery) Only ¶
Only returns a single User entity found by the query, ensuring it only returns one. Returns a *NotSingularError when more than one User entity is found. Returns a *NotFoundError when no User entities are found.
func (*UserQuery) OnlyID ¶
OnlyID is like Only, but returns the only User ID in the query. Returns a *NotSingularError when more than one User ID is found. Returns a *NotFoundError when no entities are found.
func (*UserQuery) Paginate ¶
func (u *UserQuery) Paginate( ctx context.Context, after *Cursor, first *int, before *Cursor, last *int, opts ...UserPaginateOption, ) (*UserConnection, error)
Paginate executes the query and returns a relay based cursor connection to User.
func (*UserQuery) QueryImages ¶
func (uq *UserQuery) QueryImages() *ImageQuery
QueryImages chains the current query on the "images" edge.
func (*UserQuery) Select ¶
func (uq *UserQuery) Select(fields ...string) *UserSelect
Select allows the selection one or more fields/columns for the given query, instead of selecting all fields in the entity.
Example:
var v []struct { CreatedAt time.Time `json:"created_at,omitempty"` } client.User.Query(). Select(user.FieldCreatedAt). Scan(ctx, &v)
func (*UserQuery) Unique ¶
Unique configures the query builder to filter duplicate records on query. By default, unique is set to true, and can be disabled using this method.
func (*UserQuery) WithImages ¶
func (uq *UserQuery) WithImages(opts ...func(*ImageQuery)) *UserQuery
WithImages tells the query-builder to eager-load the nodes that are connected to the "images" edge. The optional arguments are used to configure the query builder of the edge.
type UserSelect ¶
type UserSelect struct { *UserQuery // contains filtered or unexported fields }
UserSelect is the builder for selecting fields of User entities.
func (*UserSelect) Bool ¶
func (us *UserSelect) Bool(ctx context.Context) (_ bool, err error)
Bool returns a single bool from a selector. It is only allowed when selecting one field.
func (*UserSelect) BoolX ¶
func (us *UserSelect) BoolX(ctx context.Context) bool
BoolX is like Bool, but panics if an error occurs.
func (*UserSelect) Bools ¶
func (us *UserSelect) Bools(ctx context.Context) ([]bool, error)
Bools returns list of bools from a selector. It is only allowed when selecting one field.
func (*UserSelect) BoolsX ¶
func (us *UserSelect) BoolsX(ctx context.Context) []bool
BoolsX is like Bools, but panics if an error occurs.
func (*UserSelect) Float64 ¶
func (us *UserSelect) Float64(ctx context.Context) (_ float64, err error)
Float64 returns a single float64 from a selector. It is only allowed when selecting one field.
func (*UserSelect) Float64X ¶
func (us *UserSelect) Float64X(ctx context.Context) float64
Float64X is like Float64, but panics if an error occurs.
func (*UserSelect) Float64s ¶
func (us *UserSelect) Float64s(ctx context.Context) ([]float64, error)
Float64s returns list of float64s from a selector. It is only allowed when selecting one field.
func (*UserSelect) Float64sX ¶
func (us *UserSelect) Float64sX(ctx context.Context) []float64
Float64sX is like Float64s, but panics if an error occurs.
func (*UserSelect) Int ¶
func (us *UserSelect) Int(ctx context.Context) (_ int, err error)
Int returns a single int from a selector. It is only allowed when selecting one field.
func (*UserSelect) IntX ¶
func (us *UserSelect) IntX(ctx context.Context) int
IntX is like Int, but panics if an error occurs.
func (*UserSelect) Ints ¶
func (us *UserSelect) Ints(ctx context.Context) ([]int, error)
Ints returns list of ints from a selector. It is only allowed when selecting one field.
func (*UserSelect) IntsX ¶
func (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 scans 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.
func (*UserSelect) String ¶
func (us *UserSelect) String(ctx context.Context) (_ string, err error)
String returns a single string from a selector. It is only allowed when selecting one field.
func (*UserSelect) StringX ¶
func (us *UserSelect) StringX(ctx context.Context) string
StringX is like String, 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) AddImageIDs ¶
func (uu *UserUpdate) AddImageIDs(ids ...ulid.ID) *UserUpdate
AddImageIDs adds the "images" edge to the Image entity by IDs.
func (*UserUpdate) AddImages ¶
func (uu *UserUpdate) AddImages(i ...*Image) *UserUpdate
AddImages adds the "images" edges to the Image entity.
func (*UserUpdate) ClearImages ¶
func (uu *UserUpdate) ClearImages() *UserUpdate
ClearImages clears all "images" edges to the Image entity.
func (*UserUpdate) Exec ¶
func (uu *UserUpdate) Exec(ctx context.Context) error
Exec executes the query.
func (*UserUpdate) ExecX ¶
func (uu *UserUpdate) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*UserUpdate) Mutation ¶
func (uu *UserUpdate) Mutation() *UserMutation
Mutation returns the UserMutation object of the builder.
func (*UserUpdate) RemoveImageIDs ¶
func (uu *UserUpdate) RemoveImageIDs(ids ...ulid.ID) *UserUpdate
RemoveImageIDs removes the "images" edge to Image entities by IDs.
func (*UserUpdate) RemoveImages ¶
func (uu *UserUpdate) RemoveImages(i ...*Image) *UserUpdate
RemoveImages removes "images" edges to Image entities.
func (*UserUpdate) Save ¶
func (uu *UserUpdate) Save(ctx context.Context) (int, error)
Save executes the query and returns the number of nodes affected by the update operation.
func (*UserUpdate) SaveX ¶
func (uu *UserUpdate) SaveX(ctx context.Context) int
SaveX is like Save, but panics if an error occurs.
func (*UserUpdate) SetEmail ¶
func (uu *UserUpdate) SetEmail(s string) *UserUpdate
SetEmail sets the "email" field.
func (*UserUpdate) SetLastLogin ¶
func (uu *UserUpdate) SetLastLogin(t time.Time) *UserUpdate
SetLastLogin sets the "last_login" field.
func (*UserUpdate) SetName ¶
func (uu *UserUpdate) SetName(s string) *UserUpdate
SetName sets the "name" field.
func (*UserUpdate) SetNillableLastLogin ¶
func (uu *UserUpdate) SetNillableLastLogin(t *time.Time) *UserUpdate
SetNillableLastLogin sets the "last_login" 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) 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 appends a list predicates to the UserUpdate builder.
type UserUpdateOne ¶
type UserUpdateOne struct {
// contains filtered or unexported fields
}
UserUpdateOne is the builder for updating a single User entity.
func (*UserUpdateOne) AddImageIDs ¶
func (uuo *UserUpdateOne) AddImageIDs(ids ...ulid.ID) *UserUpdateOne
AddImageIDs adds the "images" edge to the Image entity by IDs.
func (*UserUpdateOne) AddImages ¶
func (uuo *UserUpdateOne) AddImages(i ...*Image) *UserUpdateOne
AddImages adds the "images" edges to the Image entity.
func (*UserUpdateOne) ClearImages ¶
func (uuo *UserUpdateOne) ClearImages() *UserUpdateOne
ClearImages clears all "images" edges to the Image entity.
func (*UserUpdateOne) Exec ¶
func (uuo *UserUpdateOne) Exec(ctx context.Context) error
Exec executes the query on the entity.
func (*UserUpdateOne) ExecX ¶
func (uuo *UserUpdateOne) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*UserUpdateOne) Mutation ¶
func (uuo *UserUpdateOne) Mutation() *UserMutation
Mutation returns the UserMutation object of the builder.
func (*UserUpdateOne) RemoveImageIDs ¶
func (uuo *UserUpdateOne) RemoveImageIDs(ids ...ulid.ID) *UserUpdateOne
RemoveImageIDs removes the "images" edge to Image entities by IDs.
func (*UserUpdateOne) RemoveImages ¶
func (uuo *UserUpdateOne) RemoveImages(i ...*Image) *UserUpdateOne
RemoveImages removes "images" edges to Image entities.
func (*UserUpdateOne) Save ¶
func (uuo *UserUpdateOne) Save(ctx context.Context) (*User, error)
Save executes the query and returns the updated User entity.
func (*UserUpdateOne) SaveX ¶
func (uuo *UserUpdateOne) SaveX(ctx context.Context) *User
SaveX is like Save, but panics if an error occurs.
func (*UserUpdateOne) Select ¶
func (uuo *UserUpdateOne) Select(field string, fields ...string) *UserUpdateOne
Select allows selecting one or more fields (columns) of the returned entity. The default is selecting all fields defined in the entity schema.
func (*UserUpdateOne) SetEmail ¶
func (uuo *UserUpdateOne) SetEmail(s string) *UserUpdateOne
SetEmail sets the "email" field.
func (*UserUpdateOne) SetLastLogin ¶
func (uuo *UserUpdateOne) SetLastLogin(t time.Time) *UserUpdateOne
SetLastLogin sets the "last_login" field.
func (*UserUpdateOne) SetName ¶
func (uuo *UserUpdateOne) SetName(s string) *UserUpdateOne
SetName sets the "name" field.
func (*UserUpdateOne) SetNillableLastLogin ¶
func (uuo *UserUpdateOne) SetNillableLastLogin(t *time.Time) *UserUpdateOne
SetNillableLastLogin sets the "last_login" 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) SetUpdatedAt ¶
func (uuo *UserUpdateOne) SetUpdatedAt(t time.Time) *UserUpdateOne
SetUpdatedAt sets the "updated_at" field.
type UserWhereInput ¶
type UserWhereInput struct { Not *UserWhereInput `json:"not,omitempty"` Or []*UserWhereInput `json:"or,omitempty"` And []*UserWhereInput `json:"and,omitempty"` // "id" field predicates. ID *ulid.ID `json:"id,omitempty"` IDNEQ *ulid.ID `json:"idNEQ,omitempty"` IDIn []ulid.ID `json:"idIn,omitempty"` IDNotIn []ulid.ID `json:"idNotIn,omitempty"` IDGT *ulid.ID `json:"idGT,omitempty"` IDGTE *ulid.ID `json:"idGTE,omitempty"` IDLT *ulid.ID `json:"idLT,omitempty"` IDLTE *ulid.ID `json:"idLTE,omitempty"` // "created_at" field predicates. CreatedAt *time.Time `json:"createdAt,omitempty"` CreatedAtNEQ *time.Time `json:"createdAtNEQ,omitempty"` CreatedAtIn []time.Time `json:"createdAtIn,omitempty"` CreatedAtNotIn []time.Time `json:"createdAtNotIn,omitempty"` CreatedAtGT *time.Time `json:"createdAtGT,omitempty"` CreatedAtGTE *time.Time `json:"createdAtGTE,omitempty"` CreatedAtLT *time.Time `json:"createdAtLT,omitempty"` CreatedAtLTE *time.Time `json:"createdAtLTE,omitempty"` // "updated_at" field predicates. UpdatedAt *time.Time `json:"updatedAt,omitempty"` UpdatedAtNEQ *time.Time `json:"updatedAtNEQ,omitempty"` UpdatedAtIn []time.Time `json:"updatedAtIn,omitempty"` UpdatedAtNotIn []time.Time `json:"updatedAtNotIn,omitempty"` UpdatedAtGT *time.Time `json:"updatedAtGT,omitempty"` UpdatedAtGTE *time.Time `json:"updatedAtGTE,omitempty"` UpdatedAtLT *time.Time `json:"updatedAtLT,omitempty"` UpdatedAtLTE *time.Time `json:"updatedAtLTE,omitempty"` // "name" field predicates. Name *string `json:"name,omitempty"` NameNEQ *string `json:"nameNEQ,omitempty"` NameIn []string `json:"nameIn,omitempty"` NameNotIn []string `json:"nameNotIn,omitempty"` NameGT *string `json:"nameGT,omitempty"` NameGTE *string `json:"nameGTE,omitempty"` NameLT *string `json:"nameLT,omitempty"` NameLTE *string `json:"nameLTE,omitempty"` NameContains *string `json:"nameContains,omitempty"` NameHasPrefix *string `json:"nameHasPrefix,omitempty"` NameHasSuffix *string `json:"nameHasSuffix,omitempty"` NameEqualFold *string `json:"nameEqualFold,omitempty"` NameContainsFold *string `json:"nameContainsFold,omitempty"` // "email" field predicates. Email *string `json:"email,omitempty"` EmailNEQ *string `json:"emailNEQ,omitempty"` EmailIn []string `json:"emailIn,omitempty"` EmailNotIn []string `json:"emailNotIn,omitempty"` EmailGT *string `json:"emailGT,omitempty"` EmailGTE *string `json:"emailGTE,omitempty"` EmailLT *string `json:"emailLT,omitempty"` EmailLTE *string `json:"emailLTE,omitempty"` EmailContains *string `json:"emailContains,omitempty"` EmailHasPrefix *string `json:"emailHasPrefix,omitempty"` EmailHasSuffix *string `json:"emailHasSuffix,omitempty"` EmailEqualFold *string `json:"emailEqualFold,omitempty"` EmailContainsFold *string `json:"emailContainsFold,omitempty"` // "password" field predicates. Password *string `json:"password,omitempty"` PasswordNEQ *string `json:"passwordNEQ,omitempty"` PasswordIn []string `json:"passwordIn,omitempty"` PasswordNotIn []string `json:"passwordNotIn,omitempty"` PasswordGT *string `json:"passwordGT,omitempty"` PasswordGTE *string `json:"passwordGTE,omitempty"` PasswordLT *string `json:"passwordLT,omitempty"` PasswordLTE *string `json:"passwordLTE,omitempty"` PasswordContains *string `json:"passwordContains,omitempty"` PasswordHasPrefix *string `json:"passwordHasPrefix,omitempty"` PasswordHasSuffix *string `json:"passwordHasSuffix,omitempty"` PasswordEqualFold *string `json:"passwordEqualFold,omitempty"` PasswordContainsFold *string `json:"passwordContainsFold,omitempty"` // "last_login" field predicates. LastLogin *time.Time `json:"lastLogin,omitempty"` LastLoginNEQ *time.Time `json:"lastLoginNEQ,omitempty"` LastLoginIn []time.Time `json:"lastLoginIn,omitempty"` LastLoginNotIn []time.Time `json:"lastLoginNotIn,omitempty"` LastLoginGT *time.Time `json:"lastLoginGT,omitempty"` LastLoginGTE *time.Time `json:"lastLoginGTE,omitempty"` LastLoginLT *time.Time `json:"lastLoginLT,omitempty"` LastLoginLTE *time.Time `json:"lastLoginLTE,omitempty"` // "images" edge predicates. HasImages *bool `json:"hasImages,omitempty"` HasImagesWith []*ImageWhereInput `json:"hasImagesWith,omitempty"` }
UserWhereInput represents a where input for filtering User queries.
type ValidationError ¶
type ValidationError struct { Name string // Field or edge name. // contains filtered or unexported fields }
ValidationError returns when validating a field or edge fails.
func (*ValidationError) Error ¶
func (e *ValidationError) Error() string
Error implements the error interface.
func (*ValidationError) Unwrap ¶
func (e *ValidationError) Unwrap() error
Unwrap implements the errors.Wrapper interface.
Source Files ¶
- client.go
- config.go
- context.go
- ent.go
- generate.go
- gql_collection.go
- gql_edge.go
- gql_node.go
- gql_pagination.go
- gql_transaction.go
- gql_where_input.go
- image.go
- image_create.go
- image_delete.go
- image_query.go
- image_update.go
- mutation.go
- runtime.go
- tx.go
- user.go
- user_create.go
- user_delete.go
- user_query.go
- user_update.go