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 int) (*Node, error)
- func (c *Client) Noder(ctx context.Context, id int, opts ...NodeOption) (_ Noder, err error)
- func (c *Client) Noders(ctx context.Context, ids []int, 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 Department
- func (d *Department) Jobs(ctx context.Context) ([]*Job, error)
- func (d *Department) Manager(ctx context.Context) (*User, error)
- func (d *Department) Node(ctx context.Context) (node *Node, err error)
- func (d *Department) QueryJobs() *JobQuery
- func (d *Department) QueryManager() *UserQuery
- func (d *Department) String() string
- func (d *Department) ToEdge(order *DepartmentOrder) *DepartmentEdge
- func (d *Department) Unwrap() *Department
- func (d *Department) Update() *DepartmentUpdateOne
- type DepartmentClient
- func (c *DepartmentClient) Create() *DepartmentCreate
- func (c *DepartmentClient) CreateBulk(builders ...*DepartmentCreate) *DepartmentCreateBulk
- func (c *DepartmentClient) Delete() *DepartmentDelete
- func (c *DepartmentClient) DeleteOne(d *Department) *DepartmentDeleteOne
- func (c *DepartmentClient) DeleteOneID(id int) *DepartmentDeleteOne
- func (c *DepartmentClient) Get(ctx context.Context, id int) (*Department, error)
- func (c *DepartmentClient) GetX(ctx context.Context, id int) *Department
- func (c *DepartmentClient) Hooks() []Hook
- func (c *DepartmentClient) Query() *DepartmentQuery
- func (c *DepartmentClient) QueryJobs(d *Department) *JobQuery
- func (c *DepartmentClient) QueryManager(d *Department) *UserQuery
- func (c *DepartmentClient) Update() *DepartmentUpdate
- func (c *DepartmentClient) UpdateOne(d *Department) *DepartmentUpdateOne
- func (c *DepartmentClient) UpdateOneID(id int) *DepartmentUpdateOne
- func (c *DepartmentClient) Use(hooks ...Hook)
- type DepartmentConnection
- type DepartmentCreate
- func (dc *DepartmentCreate) AddJobIDs(ids ...int) *DepartmentCreate
- func (dc *DepartmentCreate) AddJobs(j ...*Job) *DepartmentCreate
- func (dc *DepartmentCreate) Mutation() *DepartmentMutation
- func (dc *DepartmentCreate) Save(ctx context.Context) (*Department, error)
- func (dc *DepartmentCreate) SaveX(ctx context.Context) *Department
- func (dc *DepartmentCreate) SetManager(u *User) *DepartmentCreate
- func (dc *DepartmentCreate) SetManagerID(id int) *DepartmentCreate
- func (dc *DepartmentCreate) SetName(s string) *DepartmentCreate
- func (dc *DepartmentCreate) SetNillableManagerID(id *int) *DepartmentCreate
- type DepartmentCreateBulk
- type DepartmentDelete
- type DepartmentDeleteOne
- type DepartmentEdge
- type DepartmentEdges
- type DepartmentGroupBy
- func (dgb *DepartmentGroupBy) Aggregate(fns ...AggregateFunc) *DepartmentGroupBy
- func (dgb *DepartmentGroupBy) Bool(ctx context.Context) (_ bool, err error)
- func (dgb *DepartmentGroupBy) BoolX(ctx context.Context) bool
- func (dgb *DepartmentGroupBy) Bools(ctx context.Context) ([]bool, error)
- func (dgb *DepartmentGroupBy) BoolsX(ctx context.Context) []bool
- func (dgb *DepartmentGroupBy) Float64(ctx context.Context) (_ float64, err error)
- func (dgb *DepartmentGroupBy) Float64X(ctx context.Context) float64
- func (dgb *DepartmentGroupBy) Float64s(ctx context.Context) ([]float64, error)
- func (dgb *DepartmentGroupBy) Float64sX(ctx context.Context) []float64
- func (dgb *DepartmentGroupBy) Int(ctx context.Context) (_ int, err error)
- func (dgb *DepartmentGroupBy) IntX(ctx context.Context) int
- func (dgb *DepartmentGroupBy) Ints(ctx context.Context) ([]int, error)
- func (dgb *DepartmentGroupBy) IntsX(ctx context.Context) []int
- func (dgb *DepartmentGroupBy) Scan(ctx context.Context, v interface{}) error
- func (dgb *DepartmentGroupBy) ScanX(ctx context.Context, v interface{})
- func (dgb *DepartmentGroupBy) String(ctx context.Context) (_ string, err error)
- func (dgb *DepartmentGroupBy) StringX(ctx context.Context) string
- func (dgb *DepartmentGroupBy) Strings(ctx context.Context) ([]string, error)
- func (dgb *DepartmentGroupBy) StringsX(ctx context.Context) []string
- type DepartmentMutation
- func (m *DepartmentMutation) AddField(name string, value ent.Value) error
- func (m *DepartmentMutation) AddJobIDs(ids ...int)
- func (m *DepartmentMutation) AddedEdges() []string
- func (m *DepartmentMutation) AddedField(name string) (ent.Value, bool)
- func (m *DepartmentMutation) AddedFields() []string
- func (m *DepartmentMutation) AddedIDs(name string) []ent.Value
- func (m *DepartmentMutation) ClearEdge(name string) error
- func (m *DepartmentMutation) ClearField(name string) error
- func (m *DepartmentMutation) ClearJobs()
- func (m *DepartmentMutation) ClearManager()
- func (m *DepartmentMutation) ClearedEdges() []string
- func (m *DepartmentMutation) ClearedFields() []string
- func (m DepartmentMutation) Client() *Client
- func (m *DepartmentMutation) EdgeCleared(name string) bool
- func (m *DepartmentMutation) Field(name string) (ent.Value, bool)
- func (m *DepartmentMutation) FieldCleared(name string) bool
- func (m *DepartmentMutation) Fields() []string
- func (m *DepartmentMutation) ID() (id int, exists bool)
- func (m *DepartmentMutation) JobsCleared() bool
- func (m *DepartmentMutation) JobsIDs() (ids []int)
- func (m *DepartmentMutation) ManagerCleared() bool
- func (m *DepartmentMutation) ManagerID() (id int, exists bool)
- func (m *DepartmentMutation) ManagerIDs() (ids []int)
- func (m *DepartmentMutation) Name() (r string, exists bool)
- func (m *DepartmentMutation) OldField(ctx context.Context, name string) (ent.Value, error)
- func (m *DepartmentMutation) OldName(ctx context.Context) (v string, err error)
- func (m *DepartmentMutation) Op() Op
- func (m *DepartmentMutation) RemoveJobIDs(ids ...int)
- func (m *DepartmentMutation) RemovedEdges() []string
- func (m *DepartmentMutation) RemovedIDs(name string) []ent.Value
- func (m *DepartmentMutation) RemovedJobsIDs() (ids []int)
- func (m *DepartmentMutation) ResetEdge(name string) error
- func (m *DepartmentMutation) ResetField(name string) error
- func (m *DepartmentMutation) ResetJobs()
- func (m *DepartmentMutation) ResetManager()
- func (m *DepartmentMutation) ResetName()
- func (m *DepartmentMutation) SetField(name string, value ent.Value) error
- func (m *DepartmentMutation) SetManagerID(id int)
- func (m *DepartmentMutation) SetName(s string)
- func (m DepartmentMutation) Tx() (*Tx, error)
- func (m *DepartmentMutation) Type() string
- type DepartmentOrder
- type DepartmentOrderField
- type DepartmentPaginateOption
- type DepartmentQuery
- func (dq *DepartmentQuery) All(ctx context.Context) ([]*Department, error)
- func (dq *DepartmentQuery) AllX(ctx context.Context) []*Department
- func (dq *DepartmentQuery) Clone() *DepartmentQuery
- func (d *DepartmentQuery) CollectFields(ctx context.Context, satisfies ...string) *DepartmentQuery
- func (dq *DepartmentQuery) Count(ctx context.Context) (int, error)
- func (dq *DepartmentQuery) CountX(ctx context.Context) int
- func (dq *DepartmentQuery) Exist(ctx context.Context) (bool, error)
- func (dq *DepartmentQuery) ExistX(ctx context.Context) bool
- func (dq *DepartmentQuery) First(ctx context.Context) (*Department, error)
- func (dq *DepartmentQuery) FirstID(ctx context.Context) (id int, err error)
- func (dq *DepartmentQuery) FirstIDX(ctx context.Context) int
- func (dq *DepartmentQuery) FirstX(ctx context.Context) *Department
- func (dq *DepartmentQuery) GroupBy(field string, fields ...string) *DepartmentGroupBy
- func (dq *DepartmentQuery) IDs(ctx context.Context) ([]int, error)
- func (dq *DepartmentQuery) IDsX(ctx context.Context) []int
- func (dq *DepartmentQuery) Limit(limit int) *DepartmentQuery
- func (dq *DepartmentQuery) Offset(offset int) *DepartmentQuery
- func (dq *DepartmentQuery) Only(ctx context.Context) (*Department, error)
- func (dq *DepartmentQuery) OnlyID(ctx context.Context) (id int, err error)
- func (dq *DepartmentQuery) OnlyIDX(ctx context.Context) int
- func (dq *DepartmentQuery) OnlyX(ctx context.Context) *Department
- func (dq *DepartmentQuery) Order(o ...OrderFunc) *DepartmentQuery
- func (d *DepartmentQuery) Paginate(ctx context.Context, after *Cursor, first *int, before *Cursor, last *int, ...) (*DepartmentConnection, error)
- func (dq *DepartmentQuery) QueryJobs() *JobQuery
- func (dq *DepartmentQuery) QueryManager() *UserQuery
- func (dq *DepartmentQuery) Select(field string, fields ...string) *DepartmentSelect
- func (dq *DepartmentQuery) Where(ps ...predicate.Department) *DepartmentQuery
- func (dq *DepartmentQuery) WithJobs(opts ...func(*JobQuery)) *DepartmentQuery
- func (dq *DepartmentQuery) WithManager(opts ...func(*UserQuery)) *DepartmentQuery
- type DepartmentSelect
- func (ds *DepartmentSelect) Bool(ctx context.Context) (_ bool, err error)
- func (ds *DepartmentSelect) BoolX(ctx context.Context) bool
- func (ds *DepartmentSelect) Bools(ctx context.Context) ([]bool, error)
- func (ds *DepartmentSelect) BoolsX(ctx context.Context) []bool
- func (ds *DepartmentSelect) Float64(ctx context.Context) (_ float64, err error)
- func (ds *DepartmentSelect) Float64X(ctx context.Context) float64
- func (ds *DepartmentSelect) Float64s(ctx context.Context) ([]float64, error)
- func (ds *DepartmentSelect) Float64sX(ctx context.Context) []float64
- func (ds *DepartmentSelect) Int(ctx context.Context) (_ int, err error)
- func (ds *DepartmentSelect) IntX(ctx context.Context) int
- func (ds *DepartmentSelect) Ints(ctx context.Context) ([]int, error)
- func (ds *DepartmentSelect) IntsX(ctx context.Context) []int
- func (ds *DepartmentSelect) Scan(ctx context.Context, v interface{}) error
- func (ds *DepartmentSelect) ScanX(ctx context.Context, v interface{})
- func (ds *DepartmentSelect) String(ctx context.Context) (_ string, err error)
- func (ds *DepartmentSelect) StringX(ctx context.Context) string
- func (ds *DepartmentSelect) Strings(ctx context.Context) ([]string, error)
- func (ds *DepartmentSelect) StringsX(ctx context.Context) []string
- type DepartmentUpdate
- func (du *DepartmentUpdate) AddJobIDs(ids ...int) *DepartmentUpdate
- func (du *DepartmentUpdate) AddJobs(j ...*Job) *DepartmentUpdate
- func (du *DepartmentUpdate) ClearJobs() *DepartmentUpdate
- func (du *DepartmentUpdate) ClearManager() *DepartmentUpdate
- func (du *DepartmentUpdate) Exec(ctx context.Context) error
- func (du *DepartmentUpdate) ExecX(ctx context.Context)
- func (du *DepartmentUpdate) Mutation() *DepartmentMutation
- func (du *DepartmentUpdate) RemoveJobIDs(ids ...int) *DepartmentUpdate
- func (du *DepartmentUpdate) RemoveJobs(j ...*Job) *DepartmentUpdate
- func (du *DepartmentUpdate) Save(ctx context.Context) (int, error)
- func (du *DepartmentUpdate) SaveX(ctx context.Context) int
- func (du *DepartmentUpdate) SetManager(u *User) *DepartmentUpdate
- func (du *DepartmentUpdate) SetManagerID(id int) *DepartmentUpdate
- func (du *DepartmentUpdate) SetName(s string) *DepartmentUpdate
- func (du *DepartmentUpdate) SetNillableManagerID(id *int) *DepartmentUpdate
- func (du *DepartmentUpdate) Where(ps ...predicate.Department) *DepartmentUpdate
- type DepartmentUpdateOne
- func (duo *DepartmentUpdateOne) AddJobIDs(ids ...int) *DepartmentUpdateOne
- func (duo *DepartmentUpdateOne) AddJobs(j ...*Job) *DepartmentUpdateOne
- func (duo *DepartmentUpdateOne) ClearJobs() *DepartmentUpdateOne
- func (duo *DepartmentUpdateOne) ClearManager() *DepartmentUpdateOne
- func (duo *DepartmentUpdateOne) Exec(ctx context.Context) error
- func (duo *DepartmentUpdateOne) ExecX(ctx context.Context)
- func (duo *DepartmentUpdateOne) Mutation() *DepartmentMutation
- func (duo *DepartmentUpdateOne) RemoveJobIDs(ids ...int) *DepartmentUpdateOne
- func (duo *DepartmentUpdateOne) RemoveJobs(j ...*Job) *DepartmentUpdateOne
- func (duo *DepartmentUpdateOne) Save(ctx context.Context) (*Department, error)
- func (duo *DepartmentUpdateOne) SaveX(ctx context.Context) *Department
- func (duo *DepartmentUpdateOne) SetManager(u *User) *DepartmentUpdateOne
- func (duo *DepartmentUpdateOne) SetManagerID(id int) *DepartmentUpdateOne
- func (duo *DepartmentUpdateOne) SetName(s string) *DepartmentUpdateOne
- func (duo *DepartmentUpdateOne) SetNillableManagerID(id *int) *DepartmentUpdateOne
- type Departments
- type Edge
- type Field
- type Hook
- type Job
- func (j *Job) Department(ctx context.Context) (*Department, error)
- func (j *Job) Node(ctx context.Context) (node *Node, err error)
- func (j *Job) QueryDepartment() *DepartmentQuery
- func (j *Job) String() string
- func (j *Job) ToEdge(order *JobOrder) *JobEdge
- func (j *Job) Unwrap() *Job
- func (j *Job) Update() *JobUpdateOne
- type JobClient
- func (c *JobClient) Create() *JobCreate
- func (c *JobClient) CreateBulk(builders ...*JobCreate) *JobCreateBulk
- func (c *JobClient) Delete() *JobDelete
- func (c *JobClient) DeleteOne(j *Job) *JobDeleteOne
- func (c *JobClient) DeleteOneID(id int) *JobDeleteOne
- func (c *JobClient) Get(ctx context.Context, id int) (*Job, error)
- func (c *JobClient) GetX(ctx context.Context, id int) *Job
- func (c *JobClient) Hooks() []Hook
- func (c *JobClient) Query() *JobQuery
- func (c *JobClient) QueryDepartment(j *Job) *DepartmentQuery
- func (c *JobClient) Update() *JobUpdate
- func (c *JobClient) UpdateOne(j *Job) *JobUpdateOne
- func (c *JobClient) UpdateOneID(id int) *JobUpdateOne
- func (c *JobClient) Use(hooks ...Hook)
- type JobConnection
- type JobCreate
- func (jc *JobCreate) Mutation() *JobMutation
- func (jc *JobCreate) Save(ctx context.Context) (*Job, error)
- func (jc *JobCreate) SaveX(ctx context.Context) *Job
- func (jc *JobCreate) SetDepartment(d *Department) *JobCreate
- func (jc *JobCreate) SetDepartmentID(id int) *JobCreate
- func (jc *JobCreate) SetDescription(s string) *JobCreate
- func (jc *JobCreate) SetName(s string) *JobCreate
- func (jc *JobCreate) SetNillableDepartmentID(id *int) *JobCreate
- type JobCreateBulk
- type JobDelete
- type JobDeleteOne
- type JobEdge
- type JobEdges
- type JobGroupBy
- func (jgb *JobGroupBy) Aggregate(fns ...AggregateFunc) *JobGroupBy
- func (jgb *JobGroupBy) Bool(ctx context.Context) (_ bool, err error)
- func (jgb *JobGroupBy) BoolX(ctx context.Context) bool
- func (jgb *JobGroupBy) Bools(ctx context.Context) ([]bool, error)
- func (jgb *JobGroupBy) BoolsX(ctx context.Context) []bool
- func (jgb *JobGroupBy) Float64(ctx context.Context) (_ float64, err error)
- func (jgb *JobGroupBy) Float64X(ctx context.Context) float64
- func (jgb *JobGroupBy) Float64s(ctx context.Context) ([]float64, error)
- func (jgb *JobGroupBy) Float64sX(ctx context.Context) []float64
- func (jgb *JobGroupBy) Int(ctx context.Context) (_ int, err error)
- func (jgb *JobGroupBy) IntX(ctx context.Context) int
- func (jgb *JobGroupBy) Ints(ctx context.Context) ([]int, error)
- func (jgb *JobGroupBy) IntsX(ctx context.Context) []int
- func (jgb *JobGroupBy) Scan(ctx context.Context, v interface{}) error
- func (jgb *JobGroupBy) ScanX(ctx context.Context, v interface{})
- func (jgb *JobGroupBy) String(ctx context.Context) (_ string, err error)
- func (jgb *JobGroupBy) StringX(ctx context.Context) string
- func (jgb *JobGroupBy) Strings(ctx context.Context) ([]string, error)
- func (jgb *JobGroupBy) StringsX(ctx context.Context) []string
- type JobMutation
- func (m *JobMutation) AddField(name string, value ent.Value) error
- func (m *JobMutation) AddedEdges() []string
- func (m *JobMutation) AddedField(name string) (ent.Value, bool)
- func (m *JobMutation) AddedFields() []string
- func (m *JobMutation) AddedIDs(name string) []ent.Value
- func (m *JobMutation) ClearDepartment()
- func (m *JobMutation) ClearEdge(name string) error
- func (m *JobMutation) ClearField(name string) error
- func (m *JobMutation) ClearedEdges() []string
- func (m *JobMutation) ClearedFields() []string
- func (m JobMutation) Client() *Client
- func (m *JobMutation) DepartmentCleared() bool
- func (m *JobMutation) DepartmentID() (id int, exists bool)
- func (m *JobMutation) DepartmentIDs() (ids []int)
- func (m *JobMutation) Description() (r string, exists bool)
- func (m *JobMutation) EdgeCleared(name string) bool
- func (m *JobMutation) Field(name string) (ent.Value, bool)
- func (m *JobMutation) FieldCleared(name string) bool
- func (m *JobMutation) Fields() []string
- func (m *JobMutation) ID() (id int, exists bool)
- func (m *JobMutation) Name() (r string, exists bool)
- func (m *JobMutation) OldDescription(ctx context.Context) (v string, err error)
- func (m *JobMutation) OldField(ctx context.Context, name string) (ent.Value, error)
- func (m *JobMutation) OldName(ctx context.Context) (v string, err error)
- func (m *JobMutation) Op() Op
- func (m *JobMutation) RemovedEdges() []string
- func (m *JobMutation) RemovedIDs(name string) []ent.Value
- func (m *JobMutation) ResetDepartment()
- func (m *JobMutation) ResetDescription()
- func (m *JobMutation) ResetEdge(name string) error
- func (m *JobMutation) ResetField(name string) error
- func (m *JobMutation) ResetName()
- func (m *JobMutation) SetDepartmentID(id int)
- func (m *JobMutation) SetDescription(s string)
- func (m *JobMutation) SetField(name string, value ent.Value) error
- func (m *JobMutation) SetName(s string)
- func (m JobMutation) Tx() (*Tx, error)
- func (m *JobMutation) Type() string
- type JobOrder
- type JobOrderField
- type JobPaginateOption
- type JobQuery
- func (jq *JobQuery) All(ctx context.Context) ([]*Job, error)
- func (jq *JobQuery) AllX(ctx context.Context) []*Job
- func (jq *JobQuery) Clone() *JobQuery
- func (j *JobQuery) CollectFields(ctx context.Context, satisfies ...string) *JobQuery
- func (jq *JobQuery) Count(ctx context.Context) (int, error)
- func (jq *JobQuery) CountX(ctx context.Context) int
- func (jq *JobQuery) Exist(ctx context.Context) (bool, error)
- func (jq *JobQuery) ExistX(ctx context.Context) bool
- func (jq *JobQuery) First(ctx context.Context) (*Job, error)
- func (jq *JobQuery) FirstID(ctx context.Context) (id int, err error)
- func (jq *JobQuery) FirstIDX(ctx context.Context) int
- func (jq *JobQuery) FirstX(ctx context.Context) *Job
- func (jq *JobQuery) GroupBy(field string, fields ...string) *JobGroupBy
- func (jq *JobQuery) IDs(ctx context.Context) ([]int, error)
- func (jq *JobQuery) IDsX(ctx context.Context) []int
- func (jq *JobQuery) Limit(limit int) *JobQuery
- func (jq *JobQuery) Offset(offset int) *JobQuery
- func (jq *JobQuery) Only(ctx context.Context) (*Job, error)
- func (jq *JobQuery) OnlyID(ctx context.Context) (id int, err error)
- func (jq *JobQuery) OnlyIDX(ctx context.Context) int
- func (jq *JobQuery) OnlyX(ctx context.Context) *Job
- func (jq *JobQuery) Order(o ...OrderFunc) *JobQuery
- func (j *JobQuery) Paginate(ctx context.Context, after *Cursor, first *int, before *Cursor, last *int, ...) (*JobConnection, error)
- func (jq *JobQuery) QueryDepartment() *DepartmentQuery
- func (jq *JobQuery) Select(field string, fields ...string) *JobSelect
- func (jq *JobQuery) Where(ps ...predicate.Job) *JobQuery
- func (jq *JobQuery) WithDepartment(opts ...func(*DepartmentQuery)) *JobQuery
- type JobSelect
- func (js *JobSelect) Bool(ctx context.Context) (_ bool, err error)
- func (js *JobSelect) BoolX(ctx context.Context) bool
- func (js *JobSelect) Bools(ctx context.Context) ([]bool, error)
- func (js *JobSelect) BoolsX(ctx context.Context) []bool
- func (js *JobSelect) Float64(ctx context.Context) (_ float64, err error)
- func (js *JobSelect) Float64X(ctx context.Context) float64
- func (js *JobSelect) Float64s(ctx context.Context) ([]float64, error)
- func (js *JobSelect) Float64sX(ctx context.Context) []float64
- func (js *JobSelect) Int(ctx context.Context) (_ int, err error)
- func (js *JobSelect) IntX(ctx context.Context) int
- func (js *JobSelect) Ints(ctx context.Context) ([]int, error)
- func (js *JobSelect) IntsX(ctx context.Context) []int
- func (js *JobSelect) Scan(ctx context.Context, v interface{}) error
- func (js *JobSelect) ScanX(ctx context.Context, v interface{})
- func (js *JobSelect) String(ctx context.Context) (_ string, err error)
- func (js *JobSelect) StringX(ctx context.Context) string
- func (js *JobSelect) Strings(ctx context.Context) ([]string, error)
- func (js *JobSelect) StringsX(ctx context.Context) []string
- type JobUpdate
- func (ju *JobUpdate) ClearDepartment() *JobUpdate
- func (ju *JobUpdate) Exec(ctx context.Context) error
- func (ju *JobUpdate) ExecX(ctx context.Context)
- func (ju *JobUpdate) Mutation() *JobMutation
- func (ju *JobUpdate) Save(ctx context.Context) (int, error)
- func (ju *JobUpdate) SaveX(ctx context.Context) int
- func (ju *JobUpdate) SetDepartment(d *Department) *JobUpdate
- func (ju *JobUpdate) SetDepartmentID(id int) *JobUpdate
- func (ju *JobUpdate) SetDescription(s string) *JobUpdate
- func (ju *JobUpdate) SetName(s string) *JobUpdate
- func (ju *JobUpdate) SetNillableDepartmentID(id *int) *JobUpdate
- func (ju *JobUpdate) Where(ps ...predicate.Job) *JobUpdate
- type JobUpdateOne
- func (juo *JobUpdateOne) ClearDepartment() *JobUpdateOne
- func (juo *JobUpdateOne) Exec(ctx context.Context) error
- func (juo *JobUpdateOne) ExecX(ctx context.Context)
- func (juo *JobUpdateOne) Mutation() *JobMutation
- func (juo *JobUpdateOne) Save(ctx context.Context) (*Job, error)
- func (juo *JobUpdateOne) SaveX(ctx context.Context) *Job
- func (juo *JobUpdateOne) SetDepartment(d *Department) *JobUpdateOne
- func (juo *JobUpdateOne) SetDepartmentID(id int) *JobUpdateOne
- func (juo *JobUpdateOne) SetDescription(s string) *JobUpdateOne
- func (juo *JobUpdateOne) SetName(s string) *JobUpdateOne
- func (juo *JobUpdateOne) SetNillableDepartmentID(id *int) *JobUpdateOne
- type Jobs
- 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) Departments(ctx context.Context) ([]*Department, error)
- func (u *User) Node(ctx context.Context) (node *Node, err error)
- func (u *User) QueryDepartments() *DepartmentQuery
- 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 int) *UserDeleteOne
- func (c *UserClient) Get(ctx context.Context, id int) (*User, error)
- func (c *UserClient) GetX(ctx context.Context, id int) *User
- func (c *UserClient) Hooks() []Hook
- func (c *UserClient) Query() *UserQuery
- func (c *UserClient) QueryDepartments(u *User) *DepartmentQuery
- func (c *UserClient) Update() *UserUpdate
- func (c *UserClient) UpdateOne(u *User) *UserUpdateOne
- func (c *UserClient) UpdateOneID(id int) *UserUpdateOne
- func (c *UserClient) Use(hooks ...Hook)
- type UserConnection
- type UserCreate
- func (uc *UserCreate) AddDepartmentIDs(ids ...int) *UserCreate
- func (uc *UserCreate) AddDepartments(d ...*Department) *UserCreate
- 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) SetCreateTime(t time.Time) *UserCreate
- func (uc *UserCreate) SetEmail(s string) *UserCreate
- func (uc *UserCreate) SetName(s string) *UserCreate
- func (uc *UserCreate) SetNillableCreateTime(t *time.Time) *UserCreate
- func (uc *UserCreate) SetNillableUpdateTime(t *time.Time) *UserCreate
- func (uc *UserCreate) SetPassword(s string) *UserCreate
- func (uc *UserCreate) SetRole(u user.Role) *UserCreate
- func (uc *UserCreate) SetUpdateTime(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) AddDepartmentIDs(ids ...int)
- func (m *UserMutation) AddField(name string, value ent.Value) error
- 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) ClearDepartments()
- func (m *UserMutation) ClearEdge(name string) error
- func (m *UserMutation) ClearField(name string) error
- func (m *UserMutation) ClearedEdges() []string
- func (m *UserMutation) ClearedFields() []string
- func (m UserMutation) Client() *Client
- func (m *UserMutation) CreateTime() (r time.Time, exists bool)
- func (m *UserMutation) DepartmentsCleared() bool
- func (m *UserMutation) DepartmentsIDs() (ids []int)
- 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 int, exists bool)
- func (m *UserMutation) Name() (r string, exists bool)
- func (m *UserMutation) OldCreateTime(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) OldName(ctx context.Context) (v string, err error)
- func (m *UserMutation) OldPassword(ctx context.Context) (v string, err error)
- func (m *UserMutation) OldRole(ctx context.Context) (v user.Role, err error)
- func (m *UserMutation) OldUpdateTime(ctx context.Context) (v time.Time, err error)
- func (m *UserMutation) Op() Op
- func (m *UserMutation) Password() (r string, exists bool)
- func (m *UserMutation) RemoveDepartmentIDs(ids ...int)
- func (m *UserMutation) RemovedDepartmentsIDs() (ids []int)
- func (m *UserMutation) RemovedEdges() []string
- func (m *UserMutation) RemovedIDs(name string) []ent.Value
- func (m *UserMutation) ResetCreateTime()
- func (m *UserMutation) ResetDepartments()
- func (m *UserMutation) ResetEdge(name string) error
- func (m *UserMutation) ResetEmail()
- func (m *UserMutation) ResetField(name string) error
- func (m *UserMutation) ResetName()
- func (m *UserMutation) ResetPassword()
- func (m *UserMutation) ResetRole()
- func (m *UserMutation) ResetUpdateTime()
- func (m *UserMutation) Role() (r user.Role, exists bool)
- func (m *UserMutation) SetCreateTime(t time.Time)
- func (m *UserMutation) SetEmail(s string)
- func (m *UserMutation) SetField(name string, value ent.Value) error
- func (m *UserMutation) SetName(s string)
- func (m *UserMutation) SetPassword(s string)
- func (m *UserMutation) SetRole(u user.Role)
- func (m *UserMutation) SetUpdateTime(t time.Time)
- func (m UserMutation) Tx() (*Tx, error)
- func (m *UserMutation) Type() string
- func (m *UserMutation) UpdateTime() (r time.Time, exists bool)
- 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 int, err error)
- func (uq *UserQuery) FirstIDX(ctx context.Context) int
- func (uq *UserQuery) FirstX(ctx context.Context) *User
- func (uq *UserQuery) GroupBy(field string, fields ...string) *UserGroupBy
- func (uq *UserQuery) IDs(ctx context.Context) ([]int, error)
- func (uq *UserQuery) IDsX(ctx context.Context) []int
- func (uq *UserQuery) Limit(limit int) *UserQuery
- func (uq *UserQuery) Offset(offset int) *UserQuery
- func (uq *UserQuery) Only(ctx context.Context) (*User, error)
- func (uq *UserQuery) OnlyID(ctx context.Context) (id int, err error)
- func (uq *UserQuery) OnlyIDX(ctx context.Context) int
- 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) QueryDepartments() *DepartmentQuery
- func (uq *UserQuery) Select(field string, fields ...string) *UserSelect
- func (uq *UserQuery) Where(ps ...predicate.User) *UserQuery
- func (uq *UserQuery) WithDepartments(opts ...func(*DepartmentQuery)) *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) AddDepartmentIDs(ids ...int) *UserUpdate
- func (uu *UserUpdate) AddDepartments(d ...*Department) *UserUpdate
- func (uu *UserUpdate) ClearDepartments() *UserUpdate
- func (uu *UserUpdate) Exec(ctx context.Context) error
- func (uu *UserUpdate) ExecX(ctx context.Context)
- func (uu *UserUpdate) Mutation() *UserMutation
- func (uu *UserUpdate) RemoveDepartmentIDs(ids ...int) *UserUpdate
- func (uu *UserUpdate) RemoveDepartments(d ...*Department) *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) SetName(s string) *UserUpdate
- func (uu *UserUpdate) SetPassword(s string) *UserUpdate
- func (uu *UserUpdate) SetRole(u user.Role) *UserUpdate
- func (uu *UserUpdate) Where(ps ...predicate.User) *UserUpdate
- type UserUpdateOne
- func (uuo *UserUpdateOne) AddDepartmentIDs(ids ...int) *UserUpdateOne
- func (uuo *UserUpdateOne) AddDepartments(d ...*Department) *UserUpdateOne
- func (uuo *UserUpdateOne) ClearDepartments() *UserUpdateOne
- func (uuo *UserUpdateOne) Exec(ctx context.Context) error
- func (uuo *UserUpdateOne) ExecX(ctx context.Context)
- func (uuo *UserUpdateOne) Mutation() *UserMutation
- func (uuo *UserUpdateOne) RemoveDepartmentIDs(ids ...int) *UserUpdateOne
- func (uuo *UserUpdateOne) RemoveDepartments(d ...*Department) *UserUpdateOne
- func (uuo *UserUpdateOne) Save(ctx context.Context) (*User, error)
- func (uuo *UserUpdateOne) SaveX(ctx context.Context) *User
- func (uuo *UserUpdateOne) SetEmail(s string) *UserUpdateOne
- func (uuo *UserUpdateOne) SetName(s string) *UserUpdateOne
- func (uuo *UserUpdateOne) SetPassword(s string) *UserUpdateOne
- func (uuo *UserUpdateOne) SetRole(u user.Role) *UserUpdateOne
- 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. TypeDepartment = "Department" TypeJob = "Job" TypeUser = "User" )
Variables ¶
var ( // UserOrderFieldName orders User by name. UserOrderFieldName = &UserOrderField{ field: user.FieldName, toCursor: func(u *User) Cursor { return Cursor{ ID: u.ID, Value: u.Name, } }, } // UserOrderFieldEmail orders User by email. UserOrderFieldEmail = &UserOrderField{ field: user.FieldEmail, toCursor: func(u *User) Cursor { return Cursor{ ID: u.ID, Value: u.Email, } }, } // UserOrderFieldRole orders User by role. UserOrderFieldRole = &UserOrderField{ field: user.FieldRole, toCursor: func(u *User) Cursor { return Cursor{ ID: u.ID, Value: u.Role, } }, } )
var DefaultDepartmentOrder = &DepartmentOrder{ Direction: OrderDirectionAsc, Field: &DepartmentOrderField{ field: department.FieldID, toCursor: func(d *Department) Cursor { return Cursor{ID: d.ID} }, }, }
DefaultDepartmentOrder is the default ordering of Department.
var DefaultJobOrder = &JobOrder{ Direction: OrderDirectionAsc, Field: &JobOrderField{ field: job.FieldID, toCursor: func(j *Job) Cursor { return Cursor{ID: j.ID} }, }, }
DefaultJobOrder is the default ordering of Job.
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.
var ( // DepartmentOrderFieldName orders Department by name. DepartmentOrderFieldName = &DepartmentOrderField{ field: department.FieldName, toCursor: func(d *Department) Cursor { return Cursor{ ID: d.ID, Value: d.Name, } }, } )
var ( // JobOrderFieldName orders Job by name. JobOrderFieldName = &JobOrderField{ field: job.FieldName, toCursor: func(j *Job) Cursor { return Cursor{ ID: j.ID, Value: j.Name, } }, } )
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 validaton 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 // Department is the client for interacting with the Department builders. Department *DepartmentClient // Job is the client for interacting with the Job builders. Job *JobClient // 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(). Department. 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(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 Department ¶
type Department struct { // ID of the ent. ID int `json:"id,omitempty"` // Name holds the value of the "name" field. Name string `json:"name,omitempty"` // Edges holds the relations/edges for other nodes in the graph. // The values are being populated by the DepartmentQuery when eager-loading is set. Edges DepartmentEdges `json:"edges"` // contains filtered or unexported fields }
Department is the model entity for the Department schema.
func (*Department) QueryJobs ¶
func (d *Department) QueryJobs() *JobQuery
QueryJobs queries the "jobs" edge of the Department entity.
func (*Department) QueryManager ¶
func (d *Department) QueryManager() *UserQuery
QueryManager queries the "manager" edge of the Department entity.
func (*Department) String ¶
func (d *Department) String() string
String implements the fmt.Stringer.
func (*Department) ToEdge ¶
func (d *Department) ToEdge(order *DepartmentOrder) *DepartmentEdge
ToEdge converts Department into DepartmentEdge.
func (*Department) Unwrap ¶
func (d *Department) Unwrap() *Department
Unwrap unwraps the Department 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 (*Department) Update ¶
func (d *Department) Update() *DepartmentUpdateOne
Update returns a builder for updating this Department. Note that you need to call Department.Unwrap() before calling this method if this Department was returned from a transaction, and the transaction was committed or rolled back.
type DepartmentClient ¶
type DepartmentClient struct {
// contains filtered or unexported fields
}
DepartmentClient is a client for the Department schema.
func NewDepartmentClient ¶
func NewDepartmentClient(c config) *DepartmentClient
NewDepartmentClient returns a client for the Department from the given config.
func (*DepartmentClient) Create ¶
func (c *DepartmentClient) Create() *DepartmentCreate
Create returns a create builder for Department.
func (*DepartmentClient) CreateBulk ¶
func (c *DepartmentClient) CreateBulk(builders ...*DepartmentCreate) *DepartmentCreateBulk
CreateBulk returns a builder for creating a bulk of Department entities.
func (*DepartmentClient) Delete ¶
func (c *DepartmentClient) Delete() *DepartmentDelete
Delete returns a delete builder for Department.
func (*DepartmentClient) DeleteOne ¶
func (c *DepartmentClient) DeleteOne(d *Department) *DepartmentDeleteOne
DeleteOne returns a delete builder for the given entity.
func (*DepartmentClient) DeleteOneID ¶
func (c *DepartmentClient) DeleteOneID(id int) *DepartmentDeleteOne
DeleteOneID returns a delete builder for the given id.
func (*DepartmentClient) Get ¶
func (c *DepartmentClient) Get(ctx context.Context, id int) (*Department, error)
Get returns a Department entity by its id.
func (*DepartmentClient) GetX ¶
func (c *DepartmentClient) GetX(ctx context.Context, id int) *Department
GetX is like Get, but panics if an error occurs.
func (*DepartmentClient) Hooks ¶
func (c *DepartmentClient) Hooks() []Hook
Hooks returns the client hooks.
func (*DepartmentClient) Query ¶
func (c *DepartmentClient) Query() *DepartmentQuery
Query returns a query builder for Department.
func (*DepartmentClient) QueryJobs ¶
func (c *DepartmentClient) QueryJobs(d *Department) *JobQuery
QueryJobs queries the jobs edge of a Department.
func (*DepartmentClient) QueryManager ¶
func (c *DepartmentClient) QueryManager(d *Department) *UserQuery
QueryManager queries the manager edge of a Department.
func (*DepartmentClient) Update ¶
func (c *DepartmentClient) Update() *DepartmentUpdate
Update returns an update builder for Department.
func (*DepartmentClient) UpdateOne ¶
func (c *DepartmentClient) UpdateOne(d *Department) *DepartmentUpdateOne
UpdateOne returns an update builder for the given entity.
func (*DepartmentClient) UpdateOneID ¶
func (c *DepartmentClient) UpdateOneID(id int) *DepartmentUpdateOne
UpdateOneID returns an update builder for the given id.
func (*DepartmentClient) Use ¶
func (c *DepartmentClient) Use(hooks ...Hook)
Use adds a list of mutation hooks to the hooks stack. A call to `Use(f, g, h)` equals to `department.Hooks(f(g(h())))`.
type DepartmentConnection ¶
type DepartmentConnection struct { Edges []*DepartmentEdge `json:"edges"` PageInfo PageInfo `json:"pageInfo"` TotalCount int `json:"totalCount"` }
DepartmentConnection is the connection containing edges to Department.
type DepartmentCreate ¶
type DepartmentCreate struct {
// contains filtered or unexported fields
}
DepartmentCreate is the builder for creating a Department entity.
func (*DepartmentCreate) AddJobIDs ¶
func (dc *DepartmentCreate) AddJobIDs(ids ...int) *DepartmentCreate
AddJobIDs adds the "jobs" edge to the Job entity by IDs.
func (*DepartmentCreate) AddJobs ¶
func (dc *DepartmentCreate) AddJobs(j ...*Job) *DepartmentCreate
AddJobs adds the "jobs" edges to the Job entity.
func (*DepartmentCreate) Mutation ¶
func (dc *DepartmentCreate) Mutation() *DepartmentMutation
Mutation returns the DepartmentMutation object of the builder.
func (*DepartmentCreate) Save ¶
func (dc *DepartmentCreate) Save(ctx context.Context) (*Department, error)
Save creates the Department in the database.
func (*DepartmentCreate) SaveX ¶
func (dc *DepartmentCreate) SaveX(ctx context.Context) *Department
SaveX calls Save and panics if Save returns an error.
func (*DepartmentCreate) SetManager ¶
func (dc *DepartmentCreate) SetManager(u *User) *DepartmentCreate
SetManager sets the "manager" edge to the User entity.
func (*DepartmentCreate) SetManagerID ¶
func (dc *DepartmentCreate) SetManagerID(id int) *DepartmentCreate
SetManagerID sets the "manager" edge to the User entity by ID.
func (*DepartmentCreate) SetName ¶
func (dc *DepartmentCreate) SetName(s string) *DepartmentCreate
SetName sets the "name" field.
func (*DepartmentCreate) SetNillableManagerID ¶
func (dc *DepartmentCreate) SetNillableManagerID(id *int) *DepartmentCreate
SetNillableManagerID sets the "manager" edge to the User entity by ID if the given value is not nil.
type DepartmentCreateBulk ¶
type DepartmentCreateBulk struct {
// contains filtered or unexported fields
}
DepartmentCreateBulk is the builder for creating many Department entities in bulk.
func (*DepartmentCreateBulk) Save ¶
func (dcb *DepartmentCreateBulk) Save(ctx context.Context) ([]*Department, error)
Save creates the Department entities in the database.
func (*DepartmentCreateBulk) SaveX ¶
func (dcb *DepartmentCreateBulk) SaveX(ctx context.Context) []*Department
SaveX is like Save, but panics if an error occurs.
type DepartmentDelete ¶
type DepartmentDelete struct {
// contains filtered or unexported fields
}
DepartmentDelete is the builder for deleting a Department entity.
func (*DepartmentDelete) Exec ¶
func (dd *DepartmentDelete) Exec(ctx context.Context) (int, error)
Exec executes the deletion query and returns how many vertices were deleted.
func (*DepartmentDelete) ExecX ¶
func (dd *DepartmentDelete) ExecX(ctx context.Context) int
ExecX is like Exec, but panics if an error occurs.
func (*DepartmentDelete) Where ¶
func (dd *DepartmentDelete) Where(ps ...predicate.Department) *DepartmentDelete
Where adds a new predicate to the DepartmentDelete builder.
type DepartmentDeleteOne ¶
type DepartmentDeleteOne struct {
// contains filtered or unexported fields
}
DepartmentDeleteOne is the builder for deleting a single Department entity.
func (*DepartmentDeleteOne) Exec ¶
func (ddo *DepartmentDeleteOne) Exec(ctx context.Context) error
Exec executes the deletion query.
func (*DepartmentDeleteOne) ExecX ¶
func (ddo *DepartmentDeleteOne) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
type DepartmentEdge ¶
type DepartmentEdge struct { Node *Department `json:"node"` Cursor Cursor `json:"cursor"` }
DepartmentEdge is the edge representation of Department.
type DepartmentEdges ¶
type DepartmentEdges struct { // Jobs holds the value of the jobs edge. Jobs []*Job `json:"jobs,omitempty"` // Manager holds the value of the manager edge. Manager *User `json:"manager,omitempty"` // contains filtered or unexported fields }
DepartmentEdges holds the relations/edges for other nodes in the graph.
func (DepartmentEdges) JobsOrErr ¶
func (e DepartmentEdges) JobsOrErr() ([]*Job, error)
JobsOrErr returns the Jobs value or an error if the edge was not loaded in eager-loading.
func (DepartmentEdges) ManagerOrErr ¶
func (e DepartmentEdges) ManagerOrErr() (*User, error)
ManagerOrErr returns the Manager value or an error if the edge was not loaded in eager-loading, or loaded but was not found.
type DepartmentGroupBy ¶
type DepartmentGroupBy struct {
// contains filtered or unexported fields
}
DepartmentGroupBy is the group-by builder for Department entities.
func (*DepartmentGroupBy) Aggregate ¶
func (dgb *DepartmentGroupBy) Aggregate(fns ...AggregateFunc) *DepartmentGroupBy
Aggregate adds the given aggregation functions to the group-by query.
func (*DepartmentGroupBy) Bool ¶
func (dgb *DepartmentGroupBy) 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 (*DepartmentGroupBy) BoolX ¶
func (dgb *DepartmentGroupBy) BoolX(ctx context.Context) bool
BoolX is like Bool, but panics if an error occurs.
func (*DepartmentGroupBy) Bools ¶
func (dgb *DepartmentGroupBy) 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 (*DepartmentGroupBy) BoolsX ¶
func (dgb *DepartmentGroupBy) BoolsX(ctx context.Context) []bool
BoolsX is like Bools, but panics if an error occurs.
func (*DepartmentGroupBy) Float64 ¶
func (dgb *DepartmentGroupBy) 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 (*DepartmentGroupBy) Float64X ¶
func (dgb *DepartmentGroupBy) Float64X(ctx context.Context) float64
Float64X is like Float64, but panics if an error occurs.
func (*DepartmentGroupBy) Float64s ¶
func (dgb *DepartmentGroupBy) 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 (*DepartmentGroupBy) Float64sX ¶
func (dgb *DepartmentGroupBy) Float64sX(ctx context.Context) []float64
Float64sX is like Float64s, but panics if an error occurs.
func (*DepartmentGroupBy) Int ¶
func (dgb *DepartmentGroupBy) 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 (*DepartmentGroupBy) IntX ¶
func (dgb *DepartmentGroupBy) IntX(ctx context.Context) int
IntX is like Int, but panics if an error occurs.
func (*DepartmentGroupBy) Ints ¶
func (dgb *DepartmentGroupBy) 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 (*DepartmentGroupBy) IntsX ¶
func (dgb *DepartmentGroupBy) IntsX(ctx context.Context) []int
IntsX is like Ints, but panics if an error occurs.
func (*DepartmentGroupBy) Scan ¶
func (dgb *DepartmentGroupBy) Scan(ctx context.Context, v interface{}) error
Scan applies the group-by query and scans the result into the given value.
func (*DepartmentGroupBy) ScanX ¶
func (dgb *DepartmentGroupBy) ScanX(ctx context.Context, v interface{})
ScanX is like Scan, but panics if an error occurs.
func (*DepartmentGroupBy) String ¶
func (dgb *DepartmentGroupBy) 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 (*DepartmentGroupBy) StringX ¶
func (dgb *DepartmentGroupBy) StringX(ctx context.Context) string
StringX is like String, but panics if an error occurs.
type DepartmentMutation ¶
type DepartmentMutation struct {
// contains filtered or unexported fields
}
DepartmentMutation represents an operation that mutates the Department nodes in the graph.
func (*DepartmentMutation) AddField ¶
func (m *DepartmentMutation) 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 (*DepartmentMutation) AddJobIDs ¶
func (m *DepartmentMutation) AddJobIDs(ids ...int)
AddJobIDs adds the "jobs" edge to the Job entity by ids.
func (*DepartmentMutation) AddedEdges ¶
func (m *DepartmentMutation) AddedEdges() []string
AddedEdges returns all edge names that were set/added in this mutation.
func (*DepartmentMutation) AddedField ¶
func (m *DepartmentMutation) 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 (*DepartmentMutation) AddedFields ¶
func (m *DepartmentMutation) AddedFields() []string
AddedFields returns all numeric fields that were incremented/decremented during this mutation.
func (*DepartmentMutation) AddedIDs ¶
func (m *DepartmentMutation) AddedIDs(name string) []ent.Value
AddedIDs returns all IDs (to other nodes) that were added for the given edge name in this mutation.
func (*DepartmentMutation) ClearEdge ¶
func (m *DepartmentMutation) 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 (*DepartmentMutation) ClearField ¶
func (m *DepartmentMutation) 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 (*DepartmentMutation) ClearJobs ¶
func (m *DepartmentMutation) ClearJobs()
ClearJobs clears the "jobs" edge to the Job entity.
func (*DepartmentMutation) ClearManager ¶
func (m *DepartmentMutation) ClearManager()
ClearManager clears the "manager" edge to the User entity.
func (*DepartmentMutation) ClearedEdges ¶
func (m *DepartmentMutation) ClearedEdges() []string
ClearedEdges returns all edge names that were cleared in this mutation.
func (*DepartmentMutation) ClearedFields ¶
func (m *DepartmentMutation) ClearedFields() []string
ClearedFields returns all nullable fields that were cleared during this mutation.
func (DepartmentMutation) Client ¶
func (m DepartmentMutation) 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 (*DepartmentMutation) EdgeCleared ¶
func (m *DepartmentMutation) EdgeCleared(name string) bool
EdgeCleared returns a boolean which indicates if the edge with the given name was cleared in this mutation.
func (*DepartmentMutation) Field ¶
func (m *DepartmentMutation) 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 (*DepartmentMutation) FieldCleared ¶
func (m *DepartmentMutation) FieldCleared(name string) bool
FieldCleared returns a boolean indicating if a field with the given name was cleared in this mutation.
func (*DepartmentMutation) Fields ¶
func (m *DepartmentMutation) 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 (*DepartmentMutation) ID ¶
func (m *DepartmentMutation) ID() (id int, exists bool)
ID returns the ID value in the mutation. Note that the ID is only available if it was provided to the builder.
func (*DepartmentMutation) JobsCleared ¶
func (m *DepartmentMutation) JobsCleared() bool
JobsCleared returns if the "jobs" edge to the Job entity was cleared.
func (*DepartmentMutation) JobsIDs ¶
func (m *DepartmentMutation) JobsIDs() (ids []int)
JobsIDs returns the "jobs" edge IDs in the mutation.
func (*DepartmentMutation) ManagerCleared ¶
func (m *DepartmentMutation) ManagerCleared() bool
ManagerCleared returns if the "manager" edge to the User entity was cleared.
func (*DepartmentMutation) ManagerID ¶
func (m *DepartmentMutation) ManagerID() (id int, exists bool)
ManagerID returns the "manager" edge ID in the mutation.
func (*DepartmentMutation) ManagerIDs ¶
func (m *DepartmentMutation) ManagerIDs() (ids []int)
ManagerIDs returns the "manager" edge IDs in the mutation. Note that IDs always returns len(IDs) <= 1 for unique edges, and you should use ManagerID instead. It exists only for internal usage by the builders.
func (*DepartmentMutation) Name ¶
func (m *DepartmentMutation) Name() (r string, exists bool)
Name returns the value of the "name" field in the mutation.
func (*DepartmentMutation) 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 (*DepartmentMutation) OldName ¶
func (m *DepartmentMutation) OldName(ctx context.Context) (v string, err error)
OldName returns the old "name" field's value of the Department entity. If the Department 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 (*DepartmentMutation) RemoveJobIDs ¶
func (m *DepartmentMutation) RemoveJobIDs(ids ...int)
RemoveJobIDs removes the "jobs" edge to the Job entity by IDs.
func (*DepartmentMutation) RemovedEdges ¶
func (m *DepartmentMutation) RemovedEdges() []string
RemovedEdges returns all edge names that were removed in this mutation.
func (*DepartmentMutation) RemovedIDs ¶
func (m *DepartmentMutation) 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 (*DepartmentMutation) RemovedJobsIDs ¶
func (m *DepartmentMutation) RemovedJobsIDs() (ids []int)
RemovedJobs returns the removed IDs of the "jobs" edge to the Job entity.
func (*DepartmentMutation) ResetEdge ¶
func (m *DepartmentMutation) 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 (*DepartmentMutation) ResetField ¶
func (m *DepartmentMutation) 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 (*DepartmentMutation) ResetJobs ¶
func (m *DepartmentMutation) ResetJobs()
ResetJobs resets all changes to the "jobs" edge.
func (*DepartmentMutation) ResetManager ¶
func (m *DepartmentMutation) ResetManager()
ResetManager resets all changes to the "manager" edge.
func (*DepartmentMutation) ResetName ¶
func (m *DepartmentMutation) ResetName()
ResetName resets all changes to the "name" field.
func (*DepartmentMutation) SetField ¶
func (m *DepartmentMutation) 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 (*DepartmentMutation) SetManagerID ¶
func (m *DepartmentMutation) SetManagerID(id int)
SetManagerID sets the "manager" edge to the User entity by id.
func (*DepartmentMutation) SetName ¶
func (m *DepartmentMutation) SetName(s string)
SetName sets the "name" field.
func (DepartmentMutation) Tx ¶
func (m DepartmentMutation) Tx() (*Tx, error)
Tx returns an `ent.Tx` for mutations that were executed in transactions; it returns an error otherwise.
func (*DepartmentMutation) Type ¶
func (m *DepartmentMutation) Type() string
Type returns the node type of this mutation (Department).
type DepartmentOrder ¶
type DepartmentOrder struct { Direction OrderDirection `json:"direction"` Field *DepartmentOrderField `json:"field"` }
DepartmentOrder defines the ordering of Department.
type DepartmentOrderField ¶
type DepartmentOrderField struct {
// contains filtered or unexported fields
}
DepartmentOrderField defines the ordering field of Department.
func (DepartmentOrderField) MarshalGQL ¶
func (f DepartmentOrderField) MarshalGQL(w io.Writer)
MarshalGQL implements graphql.Marshaler interface.
func (DepartmentOrderField) String ¶
func (f DepartmentOrderField) String() string
String implement fmt.Stringer interface.
func (*DepartmentOrderField) UnmarshalGQL ¶
func (f *DepartmentOrderField) UnmarshalGQL(v interface{}) error
UnmarshalGQL implements graphql.Unmarshaler interface.
type DepartmentPaginateOption ¶
type DepartmentPaginateOption func(*departmentPager) error
DepartmentPaginateOption enables pagination customization.
func WithDepartmentFilter ¶
func WithDepartmentFilter(filter func(*DepartmentQuery) (*DepartmentQuery, error)) DepartmentPaginateOption
WithDepartmentFilter configures pagination filter.
func WithDepartmentOrder ¶
func WithDepartmentOrder(order *DepartmentOrder) DepartmentPaginateOption
WithDepartmentOrder configures pagination ordering.
type DepartmentQuery ¶
type DepartmentQuery struct {
// contains filtered or unexported fields
}
DepartmentQuery is the builder for querying Department entities.
func (*DepartmentQuery) All ¶
func (dq *DepartmentQuery) All(ctx context.Context) ([]*Department, error)
All executes the query and returns a list of Departments.
func (*DepartmentQuery) AllX ¶
func (dq *DepartmentQuery) AllX(ctx context.Context) []*Department
AllX is like All, but panics if an error occurs.
func (*DepartmentQuery) Clone ¶
func (dq *DepartmentQuery) Clone() *DepartmentQuery
Clone returns a duplicate of the DepartmentQuery builder, including all associated steps. It can be used to prepare common query builders and use them differently after the clone is made.
func (*DepartmentQuery) CollectFields ¶
func (d *DepartmentQuery) CollectFields(ctx context.Context, satisfies ...string) *DepartmentQuery
CollectFields tells the query-builder to eagerly load connected nodes by resolver context.
func (*DepartmentQuery) Count ¶
func (dq *DepartmentQuery) Count(ctx context.Context) (int, error)
Count returns the count of the given query.
func (*DepartmentQuery) CountX ¶
func (dq *DepartmentQuery) CountX(ctx context.Context) int
CountX is like Count, but panics if an error occurs.
func (*DepartmentQuery) Exist ¶
func (dq *DepartmentQuery) Exist(ctx context.Context) (bool, error)
Exist returns true if the query has elements in the graph.
func (*DepartmentQuery) ExistX ¶
func (dq *DepartmentQuery) ExistX(ctx context.Context) bool
ExistX is like Exist, but panics if an error occurs.
func (*DepartmentQuery) First ¶
func (dq *DepartmentQuery) First(ctx context.Context) (*Department, error)
First returns the first Department entity from the query. Returns a *NotFoundError when no Department was found.
func (*DepartmentQuery) FirstID ¶
func (dq *DepartmentQuery) FirstID(ctx context.Context) (id int, err error)
FirstID returns the first Department ID from the query. Returns a *NotFoundError when no Department ID was found.
func (*DepartmentQuery) FirstIDX ¶
func (dq *DepartmentQuery) FirstIDX(ctx context.Context) int
FirstIDX is like FirstID, but panics if an error occurs.
func (*DepartmentQuery) FirstX ¶
func (dq *DepartmentQuery) FirstX(ctx context.Context) *Department
FirstX is like First, but panics if an error occurs.
func (*DepartmentQuery) GroupBy ¶
func (dq *DepartmentQuery) GroupBy(field string, fields ...string) *DepartmentGroupBy
GroupBy is used to group vertices by one or more fields/columns. It is often used with aggregate functions, like: count, max, mean, min, sum.
Example:
var v []struct { Name string `json:"name,omitempty"` Count int `json:"count,omitempty"` } client.Department.Query(). GroupBy(department.FieldName). Aggregate(ent.Count()). Scan(ctx, &v)
func (*DepartmentQuery) IDs ¶
func (dq *DepartmentQuery) IDs(ctx context.Context) ([]int, error)
IDs executes the query and returns a list of Department IDs.
func (*DepartmentQuery) IDsX ¶
func (dq *DepartmentQuery) IDsX(ctx context.Context) []int
IDsX is like IDs, but panics if an error occurs.
func (*DepartmentQuery) Limit ¶
func (dq *DepartmentQuery) Limit(limit int) *DepartmentQuery
Limit adds a limit step to the query.
func (*DepartmentQuery) Offset ¶
func (dq *DepartmentQuery) Offset(offset int) *DepartmentQuery
Offset adds an offset step to the query.
func (*DepartmentQuery) Only ¶
func (dq *DepartmentQuery) Only(ctx context.Context) (*Department, error)
Only returns a single Department entity found by the query, ensuring it only returns one. Returns a *NotSingularError when exactly one Department entity is not found. Returns a *NotFoundError when no Department entities are found.
func (*DepartmentQuery) OnlyID ¶
func (dq *DepartmentQuery) OnlyID(ctx context.Context) (id int, err error)
OnlyID is like Only, but returns the only Department ID in the query. Returns a *NotSingularError when exactly one Department ID is not found. Returns a *NotFoundError when no entities are found.
func (*DepartmentQuery) OnlyIDX ¶
func (dq *DepartmentQuery) OnlyIDX(ctx context.Context) int
OnlyIDX is like OnlyID, but panics if an error occurs.
func (*DepartmentQuery) OnlyX ¶
func (dq *DepartmentQuery) OnlyX(ctx context.Context) *Department
OnlyX is like Only, but panics if an error occurs.
func (*DepartmentQuery) Order ¶
func (dq *DepartmentQuery) Order(o ...OrderFunc) *DepartmentQuery
Order adds an order step to the query.
func (*DepartmentQuery) Paginate ¶
func (d *DepartmentQuery) Paginate( ctx context.Context, after *Cursor, first *int, before *Cursor, last *int, opts ...DepartmentPaginateOption, ) (*DepartmentConnection, error)
Paginate executes the query and returns a relay based cursor connection to Department.
func (*DepartmentQuery) QueryJobs ¶
func (dq *DepartmentQuery) QueryJobs() *JobQuery
QueryJobs chains the current query on the "jobs" edge.
func (*DepartmentQuery) QueryManager ¶
func (dq *DepartmentQuery) QueryManager() *UserQuery
QueryManager chains the current query on the "manager" edge.
func (*DepartmentQuery) Select ¶
func (dq *DepartmentQuery) Select(field string, fields ...string) *DepartmentSelect
Select allows the selection one or more fields/columns for the given query, instead of selecting all fields in the entity.
Example:
var v []struct { Name string `json:"name,omitempty"` } client.Department.Query(). Select(department.FieldName). Scan(ctx, &v)
func (*DepartmentQuery) Where ¶
func (dq *DepartmentQuery) Where(ps ...predicate.Department) *DepartmentQuery
Where adds a new predicate for the DepartmentQuery builder.
func (*DepartmentQuery) WithJobs ¶
func (dq *DepartmentQuery) WithJobs(opts ...func(*JobQuery)) *DepartmentQuery
WithJobs tells the query-builder to eager-load the nodes that are connected to the "jobs" edge. The optional arguments are used to configure the query builder of the edge.
func (*DepartmentQuery) WithManager ¶
func (dq *DepartmentQuery) WithManager(opts ...func(*UserQuery)) *DepartmentQuery
WithManager tells the query-builder to eager-load the nodes that are connected to the "manager" edge. The optional arguments are used to configure the query builder of the edge.
type DepartmentSelect ¶
type DepartmentSelect struct { *DepartmentQuery // contains filtered or unexported fields }
DepartmentSelect is the builder for selecting fields of Department entities.
func (*DepartmentSelect) Bool ¶
func (ds *DepartmentSelect) Bool(ctx context.Context) (_ bool, err error)
Bool returns a single bool from a selector. It is only allowed when selecting one field.
func (*DepartmentSelect) BoolX ¶
func (ds *DepartmentSelect) BoolX(ctx context.Context) bool
BoolX is like Bool, but panics if an error occurs.
func (*DepartmentSelect) Bools ¶
func (ds *DepartmentSelect) Bools(ctx context.Context) ([]bool, error)
Bools returns list of bools from a selector. It is only allowed when selecting one field.
func (*DepartmentSelect) BoolsX ¶
func (ds *DepartmentSelect) BoolsX(ctx context.Context) []bool
BoolsX is like Bools, but panics if an error occurs.
func (*DepartmentSelect) Float64 ¶
func (ds *DepartmentSelect) Float64(ctx context.Context) (_ float64, err error)
Float64 returns a single float64 from a selector. It is only allowed when selecting one field.
func (*DepartmentSelect) Float64X ¶
func (ds *DepartmentSelect) Float64X(ctx context.Context) float64
Float64X is like Float64, but panics if an error occurs.
func (*DepartmentSelect) Float64s ¶
func (ds *DepartmentSelect) Float64s(ctx context.Context) ([]float64, error)
Float64s returns list of float64s from a selector. It is only allowed when selecting one field.
func (*DepartmentSelect) Float64sX ¶
func (ds *DepartmentSelect) Float64sX(ctx context.Context) []float64
Float64sX is like Float64s, but panics if an error occurs.
func (*DepartmentSelect) Int ¶
func (ds *DepartmentSelect) Int(ctx context.Context) (_ int, err error)
Int returns a single int from a selector. It is only allowed when selecting one field.
func (*DepartmentSelect) IntX ¶
func (ds *DepartmentSelect) IntX(ctx context.Context) int
IntX is like Int, but panics if an error occurs.
func (*DepartmentSelect) Ints ¶
func (ds *DepartmentSelect) Ints(ctx context.Context) ([]int, error)
Ints returns list of ints from a selector. It is only allowed when selecting one field.
func (*DepartmentSelect) IntsX ¶
func (ds *DepartmentSelect) IntsX(ctx context.Context) []int
IntsX is like Ints, but panics if an error occurs.
func (*DepartmentSelect) Scan ¶
func (ds *DepartmentSelect) Scan(ctx context.Context, v interface{}) error
Scan applies the selector query and scans the result into the given value.
func (*DepartmentSelect) ScanX ¶
func (ds *DepartmentSelect) ScanX(ctx context.Context, v interface{})
ScanX is like Scan, but panics if an error occurs.
func (*DepartmentSelect) String ¶
func (ds *DepartmentSelect) String(ctx context.Context) (_ string, err error)
String returns a single string from a selector. It is only allowed when selecting one field.
func (*DepartmentSelect) StringX ¶
func (ds *DepartmentSelect) StringX(ctx context.Context) string
StringX is like String, but panics if an error occurs.
type DepartmentUpdate ¶
type DepartmentUpdate struct {
// contains filtered or unexported fields
}
DepartmentUpdate is the builder for updating Department entities.
func (*DepartmentUpdate) AddJobIDs ¶
func (du *DepartmentUpdate) AddJobIDs(ids ...int) *DepartmentUpdate
AddJobIDs adds the "jobs" edge to the Job entity by IDs.
func (*DepartmentUpdate) AddJobs ¶
func (du *DepartmentUpdate) AddJobs(j ...*Job) *DepartmentUpdate
AddJobs adds the "jobs" edges to the Job entity.
func (*DepartmentUpdate) ClearJobs ¶
func (du *DepartmentUpdate) ClearJobs() *DepartmentUpdate
ClearJobs clears all "jobs" edges to the Job entity.
func (*DepartmentUpdate) ClearManager ¶
func (du *DepartmentUpdate) ClearManager() *DepartmentUpdate
ClearManager clears the "manager" edge to the User entity.
func (*DepartmentUpdate) Exec ¶
func (du *DepartmentUpdate) Exec(ctx context.Context) error
Exec executes the query.
func (*DepartmentUpdate) ExecX ¶
func (du *DepartmentUpdate) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*DepartmentUpdate) Mutation ¶
func (du *DepartmentUpdate) Mutation() *DepartmentMutation
Mutation returns the DepartmentMutation object of the builder.
func (*DepartmentUpdate) RemoveJobIDs ¶
func (du *DepartmentUpdate) RemoveJobIDs(ids ...int) *DepartmentUpdate
RemoveJobIDs removes the "jobs" edge to Job entities by IDs.
func (*DepartmentUpdate) RemoveJobs ¶
func (du *DepartmentUpdate) RemoveJobs(j ...*Job) *DepartmentUpdate
RemoveJobs removes "jobs" edges to Job entities.
func (*DepartmentUpdate) Save ¶
func (du *DepartmentUpdate) Save(ctx context.Context) (int, error)
Save executes the query and returns the number of nodes affected by the update operation.
func (*DepartmentUpdate) SaveX ¶
func (du *DepartmentUpdate) SaveX(ctx context.Context) int
SaveX is like Save, but panics if an error occurs.
func (*DepartmentUpdate) SetManager ¶
func (du *DepartmentUpdate) SetManager(u *User) *DepartmentUpdate
SetManager sets the "manager" edge to the User entity.
func (*DepartmentUpdate) SetManagerID ¶
func (du *DepartmentUpdate) SetManagerID(id int) *DepartmentUpdate
SetManagerID sets the "manager" edge to the User entity by ID.
func (*DepartmentUpdate) SetName ¶
func (du *DepartmentUpdate) SetName(s string) *DepartmentUpdate
SetName sets the "name" field.
func (*DepartmentUpdate) SetNillableManagerID ¶
func (du *DepartmentUpdate) SetNillableManagerID(id *int) *DepartmentUpdate
SetNillableManagerID sets the "manager" edge to the User entity by ID if the given value is not nil.
func (*DepartmentUpdate) Where ¶
func (du *DepartmentUpdate) Where(ps ...predicate.Department) *DepartmentUpdate
Where adds a new predicate for the DepartmentUpdate builder.
type DepartmentUpdateOne ¶
type DepartmentUpdateOne struct {
// contains filtered or unexported fields
}
DepartmentUpdateOne is the builder for updating a single Department entity.
func (*DepartmentUpdateOne) AddJobIDs ¶
func (duo *DepartmentUpdateOne) AddJobIDs(ids ...int) *DepartmentUpdateOne
AddJobIDs adds the "jobs" edge to the Job entity by IDs.
func (*DepartmentUpdateOne) AddJobs ¶
func (duo *DepartmentUpdateOne) AddJobs(j ...*Job) *DepartmentUpdateOne
AddJobs adds the "jobs" edges to the Job entity.
func (*DepartmentUpdateOne) ClearJobs ¶
func (duo *DepartmentUpdateOne) ClearJobs() *DepartmentUpdateOne
ClearJobs clears all "jobs" edges to the Job entity.
func (*DepartmentUpdateOne) ClearManager ¶
func (duo *DepartmentUpdateOne) ClearManager() *DepartmentUpdateOne
ClearManager clears the "manager" edge to the User entity.
func (*DepartmentUpdateOne) Exec ¶
func (duo *DepartmentUpdateOne) Exec(ctx context.Context) error
Exec executes the query on the entity.
func (*DepartmentUpdateOne) ExecX ¶
func (duo *DepartmentUpdateOne) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*DepartmentUpdateOne) Mutation ¶
func (duo *DepartmentUpdateOne) Mutation() *DepartmentMutation
Mutation returns the DepartmentMutation object of the builder.
func (*DepartmentUpdateOne) RemoveJobIDs ¶
func (duo *DepartmentUpdateOne) RemoveJobIDs(ids ...int) *DepartmentUpdateOne
RemoveJobIDs removes the "jobs" edge to Job entities by IDs.
func (*DepartmentUpdateOne) RemoveJobs ¶
func (duo *DepartmentUpdateOne) RemoveJobs(j ...*Job) *DepartmentUpdateOne
RemoveJobs removes "jobs" edges to Job entities.
func (*DepartmentUpdateOne) Save ¶
func (duo *DepartmentUpdateOne) Save(ctx context.Context) (*Department, error)
Save executes the query and returns the updated Department entity.
func (*DepartmentUpdateOne) SaveX ¶
func (duo *DepartmentUpdateOne) SaveX(ctx context.Context) *Department
SaveX is like Save, but panics if an error occurs.
func (*DepartmentUpdateOne) SetManager ¶
func (duo *DepartmentUpdateOne) SetManager(u *User) *DepartmentUpdateOne
SetManager sets the "manager" edge to the User entity.
func (*DepartmentUpdateOne) SetManagerID ¶
func (duo *DepartmentUpdateOne) SetManagerID(id int) *DepartmentUpdateOne
SetManagerID sets the "manager" edge to the User entity by ID.
func (*DepartmentUpdateOne) SetName ¶
func (duo *DepartmentUpdateOne) SetName(s string) *DepartmentUpdateOne
SetName sets the "name" field.
func (*DepartmentUpdateOne) SetNillableManagerID ¶
func (duo *DepartmentUpdateOne) SetNillableManagerID(id *int) *DepartmentUpdateOne
SetNillableManagerID sets the "manager" edge to the User entity by ID if the given value is not nil.
type Edge ¶
type Edge struct { Type string `json:"type,omitempty"` // edge type. Name string `json:"name,omitempty"` // edge name. IDs []int `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 Job ¶
type Job struct { // ID of the ent. ID int `json:"id,omitempty"` // Name holds the value of the "name" field. Name string `json:"name,omitempty"` // Description holds the value of the "description" field. Description string `json:"description,omitempty"` // Edges holds the relations/edges for other nodes in the graph. // The values are being populated by the JobQuery when eager-loading is set. Edges JobEdges `json:"edges"` // contains filtered or unexported fields }
Job is the model entity for the Job schema.
func (*Job) Department ¶
func (j *Job) Department(ctx context.Context) (*Department, error)
func (*Job) QueryDepartment ¶
func (j *Job) QueryDepartment() *DepartmentQuery
QueryDepartment queries the "department" edge of the Job entity.
func (*Job) Unwrap ¶
Unwrap unwraps the Job 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 (*Job) Update ¶
func (j *Job) Update() *JobUpdateOne
Update returns a builder for updating this Job. Note that you need to call Job.Unwrap() before calling this method if this Job was returned from a transaction, and the transaction was committed or rolled back.
type JobClient ¶
type JobClient struct {
// contains filtered or unexported fields
}
JobClient is a client for the Job schema.
func NewJobClient ¶
func NewJobClient(c config) *JobClient
NewJobClient returns a client for the Job from the given config.
func (*JobClient) CreateBulk ¶
func (c *JobClient) CreateBulk(builders ...*JobCreate) *JobCreateBulk
CreateBulk returns a builder for creating a bulk of Job entities.
func (*JobClient) DeleteOne ¶
func (c *JobClient) DeleteOne(j *Job) *JobDeleteOne
DeleteOne returns a delete builder for the given entity.
func (*JobClient) DeleteOneID ¶
func (c *JobClient) DeleteOneID(id int) *JobDeleteOne
DeleteOneID returns a delete builder for the given id.
func (*JobClient) QueryDepartment ¶
func (c *JobClient) QueryDepartment(j *Job) *DepartmentQuery
QueryDepartment queries the department edge of a Job.
func (*JobClient) UpdateOne ¶
func (c *JobClient) UpdateOne(j *Job) *JobUpdateOne
UpdateOne returns an update builder for the given entity.
func (*JobClient) UpdateOneID ¶
func (c *JobClient) UpdateOneID(id int) *JobUpdateOne
UpdateOneID returns an update builder for the given id.
type JobConnection ¶
type JobConnection struct { Edges []*JobEdge `json:"edges"` PageInfo PageInfo `json:"pageInfo"` TotalCount int `json:"totalCount"` }
JobConnection is the connection containing edges to Job.
type JobCreate ¶
type JobCreate struct {
// contains filtered or unexported fields
}
JobCreate is the builder for creating a Job entity.
func (*JobCreate) Mutation ¶
func (jc *JobCreate) Mutation() *JobMutation
Mutation returns the JobMutation object of the builder.
func (*JobCreate) SetDepartment ¶
func (jc *JobCreate) SetDepartment(d *Department) *JobCreate
SetDepartment sets the "department" edge to the Department entity.
func (*JobCreate) SetDepartmentID ¶
SetDepartmentID sets the "department" edge to the Department entity by ID.
func (*JobCreate) SetDescription ¶
SetDescription sets the "description" field.
func (*JobCreate) SetNillableDepartmentID ¶
SetNillableDepartmentID sets the "department" edge to the Department entity by ID if the given value is not nil.
type JobCreateBulk ¶
type JobCreateBulk struct {
// contains filtered or unexported fields
}
JobCreateBulk is the builder for creating many Job entities in bulk.
type JobDelete ¶
type JobDelete struct {
// contains filtered or unexported fields
}
JobDelete is the builder for deleting a Job entity.
func (*JobDelete) Exec ¶
Exec executes the deletion query and returns how many vertices were deleted.
type JobDeleteOne ¶
type JobDeleteOne struct {
// contains filtered or unexported fields
}
JobDeleteOne is the builder for deleting a single Job entity.
func (*JobDeleteOne) Exec ¶
func (jdo *JobDeleteOne) Exec(ctx context.Context) error
Exec executes the deletion query.
func (*JobDeleteOne) ExecX ¶
func (jdo *JobDeleteOne) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
type JobEdges ¶
type JobEdges struct { // Department holds the value of the department edge. Department *Department `json:"department,omitempty"` // contains filtered or unexported fields }
JobEdges holds the relations/edges for other nodes in the graph.
func (JobEdges) DepartmentOrErr ¶
func (e JobEdges) DepartmentOrErr() (*Department, error)
DepartmentOrErr returns the Department value or an error if the edge was not loaded in eager-loading, or loaded but was not found.
type JobGroupBy ¶
type JobGroupBy struct {
// contains filtered or unexported fields
}
JobGroupBy is the group-by builder for Job entities.
func (*JobGroupBy) Aggregate ¶
func (jgb *JobGroupBy) Aggregate(fns ...AggregateFunc) *JobGroupBy
Aggregate adds the given aggregation functions to the group-by query.
func (*JobGroupBy) Bool ¶
func (jgb *JobGroupBy) 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 (*JobGroupBy) BoolX ¶
func (jgb *JobGroupBy) BoolX(ctx context.Context) bool
BoolX is like Bool, but panics if an error occurs.
func (*JobGroupBy) Bools ¶
func (jgb *JobGroupBy) 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 (*JobGroupBy) BoolsX ¶
func (jgb *JobGroupBy) BoolsX(ctx context.Context) []bool
BoolsX is like Bools, but panics if an error occurs.
func (*JobGroupBy) Float64 ¶
func (jgb *JobGroupBy) 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 (*JobGroupBy) Float64X ¶
func (jgb *JobGroupBy) Float64X(ctx context.Context) float64
Float64X is like Float64, but panics if an error occurs.
func (*JobGroupBy) Float64s ¶
func (jgb *JobGroupBy) 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 (*JobGroupBy) Float64sX ¶
func (jgb *JobGroupBy) Float64sX(ctx context.Context) []float64
Float64sX is like Float64s, but panics if an error occurs.
func (*JobGroupBy) Int ¶
func (jgb *JobGroupBy) 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 (*JobGroupBy) IntX ¶
func (jgb *JobGroupBy) IntX(ctx context.Context) int
IntX is like Int, but panics if an error occurs.
func (*JobGroupBy) Ints ¶
func (jgb *JobGroupBy) 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 (*JobGroupBy) IntsX ¶
func (jgb *JobGroupBy) IntsX(ctx context.Context) []int
IntsX is like Ints, but panics if an error occurs.
func (*JobGroupBy) Scan ¶
func (jgb *JobGroupBy) Scan(ctx context.Context, v interface{}) error
Scan applies the group-by query and scans the result into the given value.
func (*JobGroupBy) ScanX ¶
func (jgb *JobGroupBy) ScanX(ctx context.Context, v interface{})
ScanX is like Scan, but panics if an error occurs.
func (*JobGroupBy) String ¶
func (jgb *JobGroupBy) 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 (*JobGroupBy) StringX ¶
func (jgb *JobGroupBy) StringX(ctx context.Context) string
StringX is like String, but panics if an error occurs.
type JobMutation ¶
type JobMutation struct {
// contains filtered or unexported fields
}
JobMutation represents an operation that mutates the Job nodes in the graph.
func (*JobMutation) AddField ¶
func (m *JobMutation) 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 (*JobMutation) AddedEdges ¶
func (m *JobMutation) AddedEdges() []string
AddedEdges returns all edge names that were set/added in this mutation.
func (*JobMutation) AddedField ¶
func (m *JobMutation) 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 (*JobMutation) AddedFields ¶
func (m *JobMutation) AddedFields() []string
AddedFields returns all numeric fields that were incremented/decremented during this mutation.
func (*JobMutation) AddedIDs ¶
func (m *JobMutation) AddedIDs(name string) []ent.Value
AddedIDs returns all IDs (to other nodes) that were added for the given edge name in this mutation.
func (*JobMutation) ClearDepartment ¶
func (m *JobMutation) ClearDepartment()
ClearDepartment clears the "department" edge to the Department entity.
func (*JobMutation) ClearEdge ¶
func (m *JobMutation) 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 (*JobMutation) ClearField ¶
func (m *JobMutation) 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 (*JobMutation) ClearedEdges ¶
func (m *JobMutation) ClearedEdges() []string
ClearedEdges returns all edge names that were cleared in this mutation.
func (*JobMutation) ClearedFields ¶
func (m *JobMutation) ClearedFields() []string
ClearedFields returns all nullable fields that were cleared during this mutation.
func (JobMutation) Client ¶
func (m JobMutation) 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 (*JobMutation) DepartmentCleared ¶
func (m *JobMutation) DepartmentCleared() bool
DepartmentCleared returns if the "department" edge to the Department entity was cleared.
func (*JobMutation) DepartmentID ¶
func (m *JobMutation) DepartmentID() (id int, exists bool)
DepartmentID returns the "department" edge ID in the mutation.
func (*JobMutation) DepartmentIDs ¶
func (m *JobMutation) DepartmentIDs() (ids []int)
DepartmentIDs returns the "department" edge IDs in the mutation. Note that IDs always returns len(IDs) <= 1 for unique edges, and you should use DepartmentID instead. It exists only for internal usage by the builders.
func (*JobMutation) Description ¶
func (m *JobMutation) Description() (r string, exists bool)
Description returns the value of the "description" field in the mutation.
func (*JobMutation) EdgeCleared ¶
func (m *JobMutation) EdgeCleared(name string) bool
EdgeCleared returns a boolean which indicates if the edge with the given name was cleared in this mutation.
func (*JobMutation) Field ¶
func (m *JobMutation) 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 (*JobMutation) FieldCleared ¶
func (m *JobMutation) FieldCleared(name string) bool
FieldCleared returns a boolean indicating if a field with the given name was cleared in this mutation.
func (*JobMutation) Fields ¶
func (m *JobMutation) 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 (*JobMutation) ID ¶
func (m *JobMutation) ID() (id int, exists bool)
ID returns the ID value in the mutation. Note that the ID is only available if it was provided to the builder.
func (*JobMutation) Name ¶
func (m *JobMutation) Name() (r string, exists bool)
Name returns the value of the "name" field in the mutation.
func (*JobMutation) OldDescription ¶
func (m *JobMutation) OldDescription(ctx context.Context) (v string, err error)
OldDescription returns the old "description" field's value of the Job entity. If the Job 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 (*JobMutation) 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 (*JobMutation) OldName ¶
func (m *JobMutation) OldName(ctx context.Context) (v string, err error)
OldName returns the old "name" field's value of the Job entity. If the Job 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 (*JobMutation) RemovedEdges ¶
func (m *JobMutation) RemovedEdges() []string
RemovedEdges returns all edge names that were removed in this mutation.
func (*JobMutation) RemovedIDs ¶
func (m *JobMutation) 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 (*JobMutation) ResetDepartment ¶
func (m *JobMutation) ResetDepartment()
ResetDepartment resets all changes to the "department" edge.
func (*JobMutation) ResetDescription ¶
func (m *JobMutation) ResetDescription()
ResetDescription resets all changes to the "description" field.
func (*JobMutation) ResetEdge ¶
func (m *JobMutation) 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 (*JobMutation) ResetField ¶
func (m *JobMutation) 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 (*JobMutation) ResetName ¶
func (m *JobMutation) ResetName()
ResetName resets all changes to the "name" field.
func (*JobMutation) SetDepartmentID ¶
func (m *JobMutation) SetDepartmentID(id int)
SetDepartmentID sets the "department" edge to the Department entity by id.
func (*JobMutation) SetDescription ¶
func (m *JobMutation) SetDescription(s string)
SetDescription sets the "description" field.
func (*JobMutation) SetField ¶
func (m *JobMutation) 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 (*JobMutation) SetName ¶
func (m *JobMutation) SetName(s string)
SetName sets the "name" field.
func (JobMutation) Tx ¶
func (m JobMutation) Tx() (*Tx, error)
Tx returns an `ent.Tx` for mutations that were executed in transactions; it returns an error otherwise.
func (*JobMutation) Type ¶
func (m *JobMutation) Type() string
Type returns the node type of this mutation (Job).
type JobOrder ¶
type JobOrder struct { Direction OrderDirection `json:"direction"` Field *JobOrderField `json:"field"` }
JobOrder defines the ordering of Job.
type JobOrderField ¶
type JobOrderField struct {
// contains filtered or unexported fields
}
JobOrderField defines the ordering field of Job.
func (JobOrderField) MarshalGQL ¶
func (f JobOrderField) MarshalGQL(w io.Writer)
MarshalGQL implements graphql.Marshaler interface.
func (JobOrderField) String ¶
func (f JobOrderField) String() string
String implement fmt.Stringer interface.
func (*JobOrderField) UnmarshalGQL ¶
func (f *JobOrderField) UnmarshalGQL(v interface{}) error
UnmarshalGQL implements graphql.Unmarshaler interface.
type JobPaginateOption ¶
type JobPaginateOption func(*jobPager) error
JobPaginateOption enables pagination customization.
func WithJobFilter ¶
func WithJobFilter(filter func(*JobQuery) (*JobQuery, error)) JobPaginateOption
WithJobFilter configures pagination filter.
func WithJobOrder ¶
func WithJobOrder(order *JobOrder) JobPaginateOption
WithJobOrder configures pagination ordering.
type JobQuery ¶
type JobQuery struct {
// contains filtered or unexported fields
}
JobQuery is the builder for querying Job entities.
func (*JobQuery) Clone ¶
Clone returns a duplicate of the JobQuery builder, including all associated steps. It can be used to prepare common query builders and use them differently after the clone is made.
func (*JobQuery) CollectFields ¶
CollectFields tells the query-builder to eagerly load connected nodes by resolver context.
func (*JobQuery) First ¶
First returns the first Job entity from the query. Returns a *NotFoundError when no Job was found.
func (*JobQuery) FirstID ¶
FirstID returns the first Job ID from the query. Returns a *NotFoundError when no Job ID was found.
func (*JobQuery) GroupBy ¶
func (jq *JobQuery) GroupBy(field string, fields ...string) *JobGroupBy
GroupBy is used to group vertices by one or more fields/columns. It is often used with aggregate functions, like: count, max, mean, min, sum.
Example:
var v []struct { Name string `json:"name,omitempty"` Count int `json:"count,omitempty"` } client.Job.Query(). GroupBy(job.FieldName). Aggregate(ent.Count()). Scan(ctx, &v)
func (*JobQuery) Only ¶
Only returns a single Job entity found by the query, ensuring it only returns one. Returns a *NotSingularError when exactly one Job entity is not found. Returns a *NotFoundError when no Job entities are found.
func (*JobQuery) OnlyID ¶
OnlyID is like Only, but returns the only Job ID in the query. Returns a *NotSingularError when exactly one Job ID is not found. Returns a *NotFoundError when no entities are found.
func (*JobQuery) Paginate ¶
func (j *JobQuery) Paginate( ctx context.Context, after *Cursor, first *int, before *Cursor, last *int, opts ...JobPaginateOption, ) (*JobConnection, error)
Paginate executes the query and returns a relay based cursor connection to Job.
func (*JobQuery) QueryDepartment ¶
func (jq *JobQuery) QueryDepartment() *DepartmentQuery
QueryDepartment chains the current query on the "department" edge.
func (*JobQuery) Select ¶
Select allows the selection one or more fields/columns for the given query, instead of selecting all fields in the entity.
Example:
var v []struct { Name string `json:"name,omitempty"` } client.Job.Query(). Select(job.FieldName). Scan(ctx, &v)
func (*JobQuery) WithDepartment ¶
func (jq *JobQuery) WithDepartment(opts ...func(*DepartmentQuery)) *JobQuery
WithDepartment tells the query-builder to eager-load the nodes that are connected to the "department" edge. The optional arguments are used to configure the query builder of the edge.
type JobSelect ¶
type JobSelect struct { *JobQuery // contains filtered or unexported fields }
JobSelect is the builder for selecting fields of Job entities.
func (*JobSelect) Bool ¶
Bool returns a single bool from a selector. It is only allowed when selecting one field.
func (*JobSelect) Bools ¶
Bools returns list of bools from a selector. It is only allowed when selecting one field.
func (*JobSelect) Float64 ¶
Float64 returns a single float64 from a selector. It is only allowed when selecting one field.
func (*JobSelect) Float64s ¶
Float64s returns list of float64s from a selector. It is only allowed when selecting one field.
func (*JobSelect) Int ¶
Int returns a single int from a selector. It is only allowed when selecting one field.
func (*JobSelect) Ints ¶
Ints returns list of ints from a selector. It is only allowed when selecting one field.
func (*JobSelect) String ¶
String returns a single string from a selector. It is only allowed when selecting one field.
type JobUpdate ¶
type JobUpdate struct {
// contains filtered or unexported fields
}
JobUpdate is the builder for updating Job entities.
func (*JobUpdate) ClearDepartment ¶
ClearDepartment clears the "department" edge to the Department entity.
func (*JobUpdate) Mutation ¶
func (ju *JobUpdate) Mutation() *JobMutation
Mutation returns the JobMutation object of the builder.
func (*JobUpdate) Save ¶
Save executes the query and returns the number of nodes affected by the update operation.
func (*JobUpdate) SetDepartment ¶
func (ju *JobUpdate) SetDepartment(d *Department) *JobUpdate
SetDepartment sets the "department" edge to the Department entity.
func (*JobUpdate) SetDepartmentID ¶
SetDepartmentID sets the "department" edge to the Department entity by ID.
func (*JobUpdate) SetDescription ¶
SetDescription sets the "description" field.
func (*JobUpdate) SetNillableDepartmentID ¶
SetNillableDepartmentID sets the "department" edge to the Department entity by ID if the given value is not nil.
type JobUpdateOne ¶
type JobUpdateOne struct {
// contains filtered or unexported fields
}
JobUpdateOne is the builder for updating a single Job entity.
func (*JobUpdateOne) ClearDepartment ¶
func (juo *JobUpdateOne) ClearDepartment() *JobUpdateOne
ClearDepartment clears the "department" edge to the Department entity.
func (*JobUpdateOne) Exec ¶
func (juo *JobUpdateOne) Exec(ctx context.Context) error
Exec executes the query on the entity.
func (*JobUpdateOne) ExecX ¶
func (juo *JobUpdateOne) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*JobUpdateOne) Mutation ¶
func (juo *JobUpdateOne) Mutation() *JobMutation
Mutation returns the JobMutation object of the builder.
func (*JobUpdateOne) Save ¶
func (juo *JobUpdateOne) Save(ctx context.Context) (*Job, error)
Save executes the query and returns the updated Job entity.
func (*JobUpdateOne) SaveX ¶
func (juo *JobUpdateOne) SaveX(ctx context.Context) *Job
SaveX is like Save, but panics if an error occurs.
func (*JobUpdateOne) SetDepartment ¶
func (juo *JobUpdateOne) SetDepartment(d *Department) *JobUpdateOne
SetDepartment sets the "department" edge to the Department entity.
func (*JobUpdateOne) SetDepartmentID ¶
func (juo *JobUpdateOne) SetDepartmentID(id int) *JobUpdateOne
SetDepartmentID sets the "department" edge to the Department entity by ID.
func (*JobUpdateOne) SetDescription ¶
func (juo *JobUpdateOne) SetDescription(s string) *JobUpdateOne
SetDescription sets the "description" field.
func (*JobUpdateOne) SetName ¶
func (juo *JobUpdateOne) SetName(s string) *JobUpdateOne
SetName sets the "name" field.
func (*JobUpdateOne) SetNillableDepartmentID ¶
func (juo *JobUpdateOne) SetNillableDepartmentID(id *int) *JobUpdateOne
SetNillableDepartmentID sets the "department" edge to the Department entity by ID if the given value is not nil.
type MutateFunc ¶
type MutateFunc = ent.MutateFunc
ent aliases to avoid import conflicts in user's code.
type Node ¶
type Node struct { ID int `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(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 Rollbacker method.
type Tx ¶
type Tx struct { // Department is the client for interacting with the Department builders. Department *DepartmentClient // Job is the client for interacting with the Job builders. Job *JobClient // 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 int `json:"id,omitempty"` // CreateTime holds the value of the "create_time" field. CreateTime time.Time `json:"create_time,omitempty"` // UpdateTime holds the value of the "update_time" field. UpdateTime time.Time `json:"update_time,omitempty"` // Name holds the value of the "name" field. Name string `json:"name,omitempty"` // Email holds the value of the "email" field. Email string `json:"email,omitempty"` // Password holds the value of the "password" field. Password string `json:"password,omitempty"` // Role holds the value of the "role" field. Role user.Role `json:"role,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) Departments ¶
func (u *User) Departments(ctx context.Context) ([]*Department, error)
func (*User) QueryDepartments ¶
func (u *User) QueryDepartments() *DepartmentQuery
QueryDepartments queries the "departments" 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 int) *UserDeleteOne
DeleteOneID returns a delete builder for the given id.
func (*UserClient) GetX ¶
func (c *UserClient) GetX(ctx context.Context, id int) *User
GetX is like Get, but panics if an error occurs.
func (*UserClient) Query ¶
func (c *UserClient) Query() *UserQuery
Query returns a query builder for User.
func (*UserClient) QueryDepartments ¶
func (c *UserClient) QueryDepartments(u *User) *DepartmentQuery
QueryDepartments queries the departments edge of a User.
func (*UserClient) Update ¶
func (c *UserClient) Update() *UserUpdate
Update returns an update builder for User.
func (*UserClient) UpdateOne ¶
func (c *UserClient) UpdateOne(u *User) *UserUpdateOne
UpdateOne returns an update builder for the given entity.
func (*UserClient) UpdateOneID ¶
func (c *UserClient) UpdateOneID(id int) *UserUpdateOne
UpdateOneID returns an update builder for the given id.
func (*UserClient) Use ¶
func (c *UserClient) Use(hooks ...Hook)
Use adds a list of mutation hooks to the hooks stack. A call to `Use(f, g, h)` equals to `user.Hooks(f(g(h())))`.
type 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) AddDepartmentIDs ¶
func (uc *UserCreate) AddDepartmentIDs(ids ...int) *UserCreate
AddDepartmentIDs adds the "departments" edge to the Department entity by IDs.
func (*UserCreate) AddDepartments ¶
func (uc *UserCreate) AddDepartments(d ...*Department) *UserCreate
AddDepartments adds the "departments" edges to the Department entity.
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) SetCreateTime ¶
func (uc *UserCreate) SetCreateTime(t time.Time) *UserCreate
SetCreateTime sets the "create_time" field.
func (*UserCreate) SetEmail ¶
func (uc *UserCreate) SetEmail(s string) *UserCreate
SetEmail sets the "email" field.
func (*UserCreate) SetName ¶
func (uc *UserCreate) SetName(s string) *UserCreate
SetName sets the "name" field.
func (*UserCreate) SetNillableCreateTime ¶
func (uc *UserCreate) SetNillableCreateTime(t *time.Time) *UserCreate
SetNillableCreateTime sets the "create_time" field if the given value is not nil.
func (*UserCreate) SetNillableUpdateTime ¶
func (uc *UserCreate) SetNillableUpdateTime(t *time.Time) *UserCreate
SetNillableUpdateTime sets the "update_time" 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) SetRole ¶
func (uc *UserCreate) SetRole(u user.Role) *UserCreate
SetRole sets the "role" field.
func (*UserCreate) SetUpdateTime ¶
func (uc *UserCreate) SetUpdateTime(t time.Time) *UserCreate
SetUpdateTime sets the "update_time" field.
type UserCreateBulk ¶
type UserCreateBulk struct {
// contains filtered or unexported fields
}
UserCreateBulk is the builder for creating many User entities in bulk.
type UserDelete ¶
type UserDelete struct {
// contains filtered or unexported fields
}
UserDelete is the builder for deleting a User entity.
func (*UserDelete) Exec ¶
func (ud *UserDelete) Exec(ctx context.Context) (int, error)
Exec executes the deletion query and returns how many vertices were deleted.
func (*UserDelete) ExecX ¶
func (ud *UserDelete) ExecX(ctx context.Context) int
ExecX is like Exec, but panics if an error occurs.
func (*UserDelete) Where ¶
func (ud *UserDelete) Where(ps ...predicate.User) *UserDelete
Where adds a new predicate to the 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 { // Departments holds the value of the departments edge. Departments []*Department `json:"departments,omitempty"` // contains filtered or unexported fields }
UserEdges holds the relations/edges for other nodes in the graph.
func (UserEdges) DepartmentsOrErr ¶
func (e UserEdges) DepartmentsOrErr() ([]*Department, error)
DepartmentsOrErr returns the Departments 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) AddDepartmentIDs ¶
func (m *UserMutation) AddDepartmentIDs(ids ...int)
AddDepartmentIDs adds the "departments" edge to the Department entity by ids.
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) 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) ClearDepartments ¶
func (m *UserMutation) ClearDepartments()
ClearDepartments clears the "departments" edge to the Department entity.
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) 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) CreateTime ¶
func (m *UserMutation) CreateTime() (r time.Time, exists bool)
CreateTime returns the value of the "create_time" field in the mutation.
func (*UserMutation) DepartmentsCleared ¶
func (m *UserMutation) DepartmentsCleared() bool
DepartmentsCleared returns if the "departments" edge to the Department entity was cleared.
func (*UserMutation) DepartmentsIDs ¶
func (m *UserMutation) DepartmentsIDs() (ids []int)
DepartmentsIDs returns the "departments" edge IDs 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 int, exists bool)
ID returns the ID value in the mutation. Note that the ID is only available if it was provided to the builder.
func (*UserMutation) Name ¶
func (m *UserMutation) Name() (r string, exists bool)
Name returns the value of the "name" field in the mutation.
func (*UserMutation) OldCreateTime ¶
OldCreateTime returns the old "create_time" 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) 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) OldRole ¶
OldRole returns the old "role" 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) OldUpdateTime ¶
OldUpdateTime returns the old "update_time" 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) RemoveDepartmentIDs ¶
func (m *UserMutation) RemoveDepartmentIDs(ids ...int)
RemoveDepartmentIDs removes the "departments" edge to the Department entity by IDs.
func (*UserMutation) RemovedDepartmentsIDs ¶
func (m *UserMutation) RemovedDepartmentsIDs() (ids []int)
RemovedDepartments returns the removed IDs of the "departments" edge to the Department entity.
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) ResetCreateTime ¶
func (m *UserMutation) ResetCreateTime()
ResetCreateTime resets all changes to the "create_time" field.
func (*UserMutation) ResetDepartments ¶
func (m *UserMutation) ResetDepartments()
ResetDepartments resets all changes to the "departments" edge.
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) 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) ResetRole ¶
func (m *UserMutation) ResetRole()
ResetRole resets all changes to the "role" field.
func (*UserMutation) ResetUpdateTime ¶
func (m *UserMutation) ResetUpdateTime()
ResetUpdateTime resets all changes to the "update_time" field.
func (*UserMutation) Role ¶
func (m *UserMutation) Role() (r user.Role, exists bool)
Role returns the value of the "role" field in the mutation.
func (*UserMutation) SetCreateTime ¶
func (m *UserMutation) SetCreateTime(t time.Time)
SetCreateTime sets the "create_time" 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) 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) SetRole ¶
func (m *UserMutation) SetRole(u user.Role)
SetRole sets the "role" field.
func (*UserMutation) SetUpdateTime ¶
func (m *UserMutation) SetUpdateTime(t time.Time)
SetUpdateTime sets the "update_time" 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) UpdateTime ¶
func (m *UserMutation) UpdateTime() (r time.Time, exists bool)
UpdateTime returns the value of the "update_time" field in the mutation.
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 { CreateTime time.Time `json:"create_time,omitempty"` Count int `json:"count,omitempty"` } client.User.Query(). GroupBy(user.FieldCreateTime). 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 exactly one User entity is not 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 exactly one User ID is not 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) QueryDepartments ¶
func (uq *UserQuery) QueryDepartments() *DepartmentQuery
QueryDepartments chains the current query on the "departments" edge.
func (*UserQuery) Select ¶
func (uq *UserQuery) Select(field string, 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 { CreateTime time.Time `json:"create_time,omitempty"` } client.User.Query(). Select(user.FieldCreateTime). Scan(ctx, &v)
func (*UserQuery) WithDepartments ¶
func (uq *UserQuery) WithDepartments(opts ...func(*DepartmentQuery)) *UserQuery
WithDepartments tells the query-builder to eager-load the nodes that are connected to the "departments" 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) AddDepartmentIDs ¶
func (uu *UserUpdate) AddDepartmentIDs(ids ...int) *UserUpdate
AddDepartmentIDs adds the "departments" edge to the Department entity by IDs.
func (*UserUpdate) AddDepartments ¶
func (uu *UserUpdate) AddDepartments(d ...*Department) *UserUpdate
AddDepartments adds the "departments" edges to the Department entity.
func (*UserUpdate) ClearDepartments ¶
func (uu *UserUpdate) ClearDepartments() *UserUpdate
ClearDepartments clears all "departments" edges to the Department 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) RemoveDepartmentIDs ¶
func (uu *UserUpdate) RemoveDepartmentIDs(ids ...int) *UserUpdate
RemoveDepartmentIDs removes the "departments" edge to Department entities by IDs.
func (*UserUpdate) RemoveDepartments ¶
func (uu *UserUpdate) RemoveDepartments(d ...*Department) *UserUpdate
RemoveDepartments removes "departments" edges to Department 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) SetName ¶
func (uu *UserUpdate) SetName(s string) *UserUpdate
SetName sets the "name" field.
func (*UserUpdate) SetPassword ¶
func (uu *UserUpdate) SetPassword(s string) *UserUpdate
SetPassword sets the "password" field.
func (*UserUpdate) SetRole ¶
func (uu *UserUpdate) SetRole(u user.Role) *UserUpdate
SetRole sets the "role" field.
func (*UserUpdate) Where ¶
func (uu *UserUpdate) Where(ps ...predicate.User) *UserUpdate
Where adds a new predicate for 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) AddDepartmentIDs ¶
func (uuo *UserUpdateOne) AddDepartmentIDs(ids ...int) *UserUpdateOne
AddDepartmentIDs adds the "departments" edge to the Department entity by IDs.
func (*UserUpdateOne) AddDepartments ¶
func (uuo *UserUpdateOne) AddDepartments(d ...*Department) *UserUpdateOne
AddDepartments adds the "departments" edges to the Department entity.
func (*UserUpdateOne) ClearDepartments ¶
func (uuo *UserUpdateOne) ClearDepartments() *UserUpdateOne
ClearDepartments clears all "departments" edges to the Department 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) RemoveDepartmentIDs ¶
func (uuo *UserUpdateOne) RemoveDepartmentIDs(ids ...int) *UserUpdateOne
RemoveDepartmentIDs removes the "departments" edge to Department entities by IDs.
func (*UserUpdateOne) RemoveDepartments ¶
func (uuo *UserUpdateOne) RemoveDepartments(d ...*Department) *UserUpdateOne
RemoveDepartments removes "departments" edges to Department 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) SetEmail ¶
func (uuo *UserUpdateOne) SetEmail(s string) *UserUpdateOne
SetEmail sets the "email" field.
func (*UserUpdateOne) SetName ¶
func (uuo *UserUpdateOne) SetName(s string) *UserUpdateOne
SetName sets the "name" field.
func (*UserUpdateOne) SetPassword ¶
func (uuo *UserUpdateOne) SetPassword(s string) *UserUpdateOne
SetPassword sets the "password" field.
func (*UserUpdateOne) SetRole ¶
func (uuo *UserUpdateOne) SetRole(u user.Role) *UserUpdateOne
SetRole sets the "role" field.
type ValidationError ¶
type ValidationError struct { Name string // Field or edge name. // contains filtered or unexported fields }
ValidationError returns when validating a field 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
- collection.go
- config.go
- context.go
- department.go
- department_create.go
- department_delete.go
- department_query.go
- department_update.go
- edge.go
- ent.go
- generate.go
- job.go
- job_create.go
- job_delete.go
- job_query.go
- job_update.go
- mutation.go
- node.go
- pagination.go
- runtime.go
- transaction.go
- tx.go
- user.go
- user_create.go
- user_delete.go
- user_query.go
- user_update.go