ent

package
v0.0.0-...-4cf218f Latest Latest
Warning

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

Go to latest
Published: May 20, 2023 License: MIT Imports: 21 Imported by: 0

README

ent

Overview

Sample code using ent to access database.

Getting Started

  1. Start mysql container
docker-compose up -d mysql
  1. Run the code
go run gorm/main.go
If you want to generate code
  1. Install packages
go install entgo.io/ent/cmd/ent@v0.12.3
  1. Create schemage
ent new Employee Department DeptManager
  1. Edit schemage
  2. Generate code
go generate ./ent
If you want to access database
  1. Run exec command
docker-compose exec mysql bash
  1. Connect to the server
mysql -h 127.0.0.1 -P 3306 -u root -p

Documentation

Index

Constants

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

	// Node types.
	TypeDepartment  = "Department"
	TypeDeptManager = "DeptManager"
	TypeEmployee    = "Employee"
)

Variables

This section is empty.

Functions

func Asc

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

Asc applies the given fields in ASC order.

func Desc

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

Desc applies the given fields in DESC order.

func IsConstraintError

func IsConstraintError(err error) bool

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

func IsNotFound

func IsNotFound(err error) bool

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

func IsNotLoaded

func IsNotLoaded(err error) bool

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

func IsNotSingular

func IsNotSingular(err error) bool

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

func IsValidationError

func IsValidationError(err error) bool

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

func MaskNotFound

func MaskNotFound(err error) error

MaskNotFound masks not found error.

func NewContext

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

NewContext returns a new context with the given Client attached.

func NewTxContext

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

NewTxContext returns a new context with the given Tx attached.

Types

type AggregateFunc

type AggregateFunc func(*sql.Selector) string

AggregateFunc applies an aggregation step on the group-by traversal/selector.

func As

As is a pseudo aggregation function for renaming another other functions with custom names. For example:

GroupBy(field1, field2).
Aggregate(ent.As(ent.Sum(field1), "sum_field1"), (ent.As(ent.Sum(field2), "sum_field2")).
Scan(ctx, &v)

func Count

func Count() AggregateFunc

Count applies the "count" aggregation function on each group.

func Max

func Max(field string) AggregateFunc

Max applies the "max" aggregation function on the given field of each group.

func Mean

func Mean(field string) AggregateFunc

Mean applies the "mean" aggregation function on the given field of each group.

func Min

func Min(field string) AggregateFunc

Min applies the "min" aggregation function on the given field of each group.

func Sum

func Sum(field string) AggregateFunc

Sum applies the "sum" aggregation function on the given field of each group.

type Client

type Client struct {

	// Schema is the client for creating, migrating and dropping schema.
	Schema *migrate.Schema
	// Department is the client for interacting with the Department builders.
	Department *DepartmentClient
	// DeptManager is the client for interacting with the DeptManager builders.
	DeptManager *DeptManagerClient
	// Employee is the client for interacting with the Employee builders.
	Employee *EmployeeClient
	// contains filtered or unexported fields
}

Client is the client that holds all ent builders.

func FromContext

func FromContext(ctx context.Context) *Client

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

func NewClient

func NewClient(opts ...Option) *Client

NewClient creates a new client configured with the given options.

func Open

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

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

func (*Client) BeginTx

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

BeginTx returns a transactional client with specified options.

func (*Client) Close

func (c *Client) Close() error

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

func (*Client) Debug

func (c *Client) Debug() *Client

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

client.Debug().
	Department.
	Query().
	Count(ctx)

func (*Client) Intercept

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

Intercept adds the query interceptors to all the entity clients. In order to add interceptors to a specific client, call: `client.Node.Intercept(...)`.

func (*Client) Mutate

func (c *Client) Mutate(ctx context.Context, m Mutation) (Value, error)

Mutate implements the ent.Mutator interface.

func (*Client) Tx

func (c *Client) Tx(ctx context.Context) (*Tx, error)

Tx returns a new transactional client. The provided context is used until the transaction is committed or rolled back.

func (*Client) Use

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

Use adds the mutation hooks to all the entity clients. In order to add hooks to a specific client, call: `client.Node.Use(...)`.

type CommitFunc

type CommitFunc func(context.Context, *Tx) error

The CommitFunc type is an adapter to allow the use of ordinary function as a Committer. If f is a function with the appropriate signature, CommitFunc(f) is a Committer that calls f.

func (CommitFunc) Commit

func (f CommitFunc) Commit(ctx context.Context, tx *Tx) error

Commit calls f(ctx, m).

type CommitHook

type CommitHook func(Committer) Committer

CommitHook defines the "commit middleware". A function that gets a Committer and returns a Committer. For example:

hook := func(next ent.Committer) ent.Committer {
	return ent.CommitFunc(func(ctx context.Context, tx *ent.Tx) error {
		// Do some stuff before.
		if err := next.Commit(ctx, tx); err != nil {
			return err
		}
		// Do some stuff after.
		return nil
	})
}

type Committer

type Committer interface {
	Commit(context.Context, *Tx) error
}

Committer is the interface that wraps the Commit method.

type ConstraintError

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

ConstraintError returns when trying to create/update one or more entities and one or more of their constraints failed. For example, violation of edge or field uniqueness.

func (ConstraintError) Error

func (e ConstraintError) Error() string

Error implements the error interface.

func (*ConstraintError) Unwrap

func (e *ConstraintError) Unwrap() error

Unwrap implements the errors.Wrapper interface.

type Department

type Department struct {

	// ID of the ent.
	ID int `json:"id,omitempty"`
	// DeptName holds the value of the "dept_name" field.
	DeptName string `json:"dept_name,omitempty"`
	// CreatedAt holds the value of the "created_at" field.
	CreatedAt time.Time `json:"created_at,omitempty"`
	// UpdatedAt holds the value of the "updated_at" field.
	UpdatedAt time.Time `json:"updated_at,omitempty"`
	// 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) QueryDeptManager

func (d *Department) QueryDeptManager() *DeptManagerQuery

QueryDeptManager queries the "dept_manager" edge of the Department entity.

func (*Department) String

func (d *Department) String() string

String implements the fmt.Stringer.

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.

func (*Department) Value

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

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

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 builder for creating a Department entity.

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

DeleteOne returns a builder for deleting the given entity.

func (*DepartmentClient) DeleteOneID

func (c *DepartmentClient) DeleteOneID(id int) *DepartmentDeleteOne

DeleteOneID returns a builder for deleting the given entity by its 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) Intercept

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

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

func (*DepartmentClient) Interceptors

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

Interceptors returns the client interceptors.

func (*DepartmentClient) Query

func (c *DepartmentClient) Query() *DepartmentQuery

Query returns a query builder for Department.

func (*DepartmentClient) QueryDeptManager

func (c *DepartmentClient) QueryDeptManager(d *Department) *DeptManagerQuery

QueryDeptManager queries the dept_manager edge of a Department.

func (*DepartmentClient) Update

func (c *DepartmentClient) Update() *DepartmentUpdate

Update returns an update builder for Department.

func (*DepartmentClient) UpdateOne

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 DepartmentCreate

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

DepartmentCreate is the builder for creating a Department entity.

func (*DepartmentCreate) AddDeptManager

func (dc *DepartmentCreate) AddDeptManager(d ...*DeptManager) *DepartmentCreate

AddDeptManager adds the "dept_manager" edges to the DeptManager entity.

func (*DepartmentCreate) AddDeptManagerIDs

func (dc *DepartmentCreate) AddDeptManagerIDs(ids ...int) *DepartmentCreate

AddDeptManagerIDs adds the "dept_manager" edge to the DeptManager entity by IDs.

func (*DepartmentCreate) Exec

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

Exec executes the query.

func (*DepartmentCreate) ExecX

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

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

func (*DepartmentCreate) Mutation

func (dc *DepartmentCreate) Mutation() *DepartmentMutation

Mutation returns the DepartmentMutation object of the builder.

func (*DepartmentCreate) OnConflict

func (dc *DepartmentCreate) OnConflict(opts ...sql.ConflictOption) *DepartmentUpsertOne

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

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

func (*DepartmentCreate) OnConflictColumns

func (dc *DepartmentCreate) OnConflictColumns(columns ...string) *DepartmentUpsertOne

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

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

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) SetCreatedAt

func (dc *DepartmentCreate) SetCreatedAt(t time.Time) *DepartmentCreate

SetCreatedAt sets the "created_at" field.

func (*DepartmentCreate) SetDeptName

func (dc *DepartmentCreate) SetDeptName(s string) *DepartmentCreate

SetDeptName sets the "dept_name" field.

func (*DepartmentCreate) SetNillableCreatedAt

func (dc *DepartmentCreate) SetNillableCreatedAt(t *time.Time) *DepartmentCreate

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

func (*DepartmentCreate) SetNillableUpdatedAt

func (dc *DepartmentCreate) SetNillableUpdatedAt(t *time.Time) *DepartmentCreate

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

func (*DepartmentCreate) SetUpdatedAt

func (dc *DepartmentCreate) SetUpdatedAt(t time.Time) *DepartmentCreate

SetUpdatedAt sets the "updated_at" field.

type DepartmentCreateBulk

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

DepartmentCreateBulk is the builder for creating many Department entities in bulk.

func (*DepartmentCreateBulk) Exec

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

Exec executes the query.

func (*DepartmentCreateBulk) ExecX

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

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

func (*DepartmentCreateBulk) OnConflict

func (dcb *DepartmentCreateBulk) OnConflict(opts ...sql.ConflictOption) *DepartmentUpsertBulk

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

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

func (*DepartmentCreateBulk) OnConflictColumns

func (dcb *DepartmentCreateBulk) OnConflictColumns(columns ...string) *DepartmentUpsertBulk

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

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

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

Where appends a list predicates 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.

func (*DepartmentDeleteOne) Where

Where appends a list predicates to the DepartmentDelete builder.

type DepartmentEdges

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

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

func (DepartmentEdges) DeptManagerOrErr

func (e DepartmentEdges) DeptManagerOrErr() ([]*DeptManager, error)

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

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 (s *DepartmentGroupBy) Bool(ctx context.Context) (_ bool, err error)

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

func (*DepartmentGroupBy) BoolX

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

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

func (*DepartmentGroupBy) Bools

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

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

func (*DepartmentGroupBy) BoolsX

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

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

func (*DepartmentGroupBy) Float64

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

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

func (*DepartmentGroupBy) Float64X

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

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

func (*DepartmentGroupBy) Float64s

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

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

func (*DepartmentGroupBy) Float64sX

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

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

func (*DepartmentGroupBy) Int

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

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

func (*DepartmentGroupBy) IntX

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

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

func (*DepartmentGroupBy) Ints

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

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

func (*DepartmentGroupBy) IntsX

func (s *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 any) error

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

func (*DepartmentGroupBy) ScanX

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

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

func (*DepartmentGroupBy) String

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

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

func (*DepartmentGroupBy) StringX

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

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

func (*DepartmentGroupBy) Strings

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

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

func (*DepartmentGroupBy) StringsX

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

StringsX is like Strings, 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) AddDeptManagerIDs

func (m *DepartmentMutation) AddDeptManagerIDs(ids ...int)

AddDeptManagerIDs adds the "dept_manager" edge to the DeptManager entity by ids.

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) 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) ClearDeptManager

func (m *DepartmentMutation) ClearDeptManager()

ClearDeptManager clears the "dept_manager" edge to the DeptManager entity.

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) 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) CreatedAt

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

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

func (*DepartmentMutation) DeptManagerCleared

func (m *DepartmentMutation) DeptManagerCleared() bool

DeptManagerCleared reports if the "dept_manager" edge to the DeptManager entity was cleared.

func (*DepartmentMutation) DeptManagerIDs

func (m *DepartmentMutation) DeptManagerIDs() (ids []int)

DeptManagerIDs returns the "dept_manager" edge IDs in the mutation.

func (*DepartmentMutation) DeptName

func (m *DepartmentMutation) DeptName() (r string, exists bool)

DeptName returns the value of the "dept_name" field in the mutation.

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 or after it was returned from the database.

func (*DepartmentMutation) IDs

func (m *DepartmentMutation) IDs(ctx context.Context) ([]int, error)

IDs queries the database and returns the entity ids that match the mutation's predicate. That means, if the mutation is applied within a transaction with an isolation level such as sql.LevelSerializable, the returned ids match the ids of the rows that will be updated or updated by the mutation.

func (*DepartmentMutation) OldCreatedAt

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

OldCreatedAt returns the old "created_at" 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) OldDeptName

func (m *DepartmentMutation) OldDeptName(ctx context.Context) (v string, err error)

OldDeptName returns the old "dept_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) OldField

func (m *DepartmentMutation) OldField(ctx context.Context, name string) (ent.Value, error)

OldField returns the old value of the field from the database. An error is returned if the mutation operation is not UpdateOne, or the query to the database failed.

func (*DepartmentMutation) OldUpdatedAt

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

OldUpdatedAt returns the old "updated_at" 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) Op

func (m *DepartmentMutation) Op() Op

Op returns the operation name.

func (*DepartmentMutation) RemoveDeptManagerIDs

func (m *DepartmentMutation) RemoveDeptManagerIDs(ids ...int)

RemoveDeptManagerIDs removes the "dept_manager" edge to the DeptManager entity by IDs.

func (*DepartmentMutation) RemovedDeptManagerIDs

func (m *DepartmentMutation) RemovedDeptManagerIDs() (ids []int)

RemovedDeptManager returns the removed IDs of the "dept_manager" edge to the DeptManager entity.

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) ResetCreatedAt

func (m *DepartmentMutation) ResetCreatedAt()

ResetCreatedAt resets all changes to the "created_at" field.

func (*DepartmentMutation) ResetDeptManager

func (m *DepartmentMutation) ResetDeptManager()

ResetDeptManager resets all changes to the "dept_manager" edge.

func (*DepartmentMutation) ResetDeptName

func (m *DepartmentMutation) ResetDeptName()

ResetDeptName resets all changes to the "dept_name" field.

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) ResetUpdatedAt

func (m *DepartmentMutation) ResetUpdatedAt()

ResetUpdatedAt resets all changes to the "updated_at" field.

func (*DepartmentMutation) SetCreatedAt

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

SetCreatedAt sets the "created_at" field.

func (*DepartmentMutation) SetDeptName

func (m *DepartmentMutation) SetDeptName(s string)

SetDeptName sets the "dept_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) SetOp

func (m *DepartmentMutation) SetOp(op Op)

SetOp allows setting the mutation operation.

func (*DepartmentMutation) SetUpdatedAt

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

SetUpdatedAt sets the "updated_at" 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).

func (*DepartmentMutation) UpdatedAt

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

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

func (*DepartmentMutation) Where

func (m *DepartmentMutation) Where(ps ...predicate.Department)

Where appends a list predicates to the DepartmentMutation builder.

func (*DepartmentMutation) WhereP

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

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

type DepartmentQuery

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

DepartmentQuery is the builder for querying Department entities.

func (*DepartmentQuery) Aggregate

func (dq *DepartmentQuery) Aggregate(fns ...AggregateFunc) *DepartmentSelect

Aggregate returns a DepartmentSelect configured with the given aggregations.

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

client.Department.Query().
	GroupBy(department.FieldDeptName).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*DepartmentQuery) IDs

func (dq *DepartmentQuery) IDs(ctx context.Context) (ids []int, err 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 the number of records to be returned by this query.

func (*DepartmentQuery) Offset

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

Offset to start from.

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 more than one Department entity is 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 more than one Department ID is 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

Order specifies how the records should be ordered.

func (*DepartmentQuery) QueryDeptManager

func (dq *DepartmentQuery) QueryDeptManager() *DeptManagerQuery

QueryDeptManager chains the current query on the "dept_manager" edge.

func (*DepartmentQuery) Select

func (dq *DepartmentQuery) Select(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 {
	DeptName string `json:"dept_name,omitempty"`
}

client.Department.Query().
	Select(department.FieldDeptName).
	Scan(ctx, &v)

func (*DepartmentQuery) Unique

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

Unique configures the query builder to filter duplicate records on query. By default, unique is set to true, and can be disabled using this method.

func (*DepartmentQuery) Where

Where adds a new predicate for the DepartmentQuery builder.

func (*DepartmentQuery) WithDeptManager

func (dq *DepartmentQuery) WithDeptManager(opts ...func(*DeptManagerQuery)) *DepartmentQuery

WithDeptManager tells the query-builder to eager-load the nodes that are connected to the "dept_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) Aggregate

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

Aggregate adds the given aggregation functions to the selector query.

func (*DepartmentSelect) Bool

func (s *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 (s *DepartmentSelect) BoolX(ctx context.Context) bool

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

func (*DepartmentSelect) Bools

func (s *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 (s *DepartmentSelect) BoolsX(ctx context.Context) []bool

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

func (*DepartmentSelect) Float64

func (s *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 (s *DepartmentSelect) Float64X(ctx context.Context) float64

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

func (*DepartmentSelect) Float64s

func (s *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 (s *DepartmentSelect) Float64sX(ctx context.Context) []float64

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

func (*DepartmentSelect) Int

func (s *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 (s *DepartmentSelect) IntX(ctx context.Context) int

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

func (*DepartmentSelect) Ints

func (s *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 (s *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 any) error

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

func (*DepartmentSelect) ScanX

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

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

func (*DepartmentSelect) String

func (s *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 (s *DepartmentSelect) StringX(ctx context.Context) string

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

func (*DepartmentSelect) Strings

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

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

func (*DepartmentSelect) StringsX

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

StringsX is like Strings, 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) AddDeptManager

func (du *DepartmentUpdate) AddDeptManager(d ...*DeptManager) *DepartmentUpdate

AddDeptManager adds the "dept_manager" edges to the DeptManager entity.

func (*DepartmentUpdate) AddDeptManagerIDs

func (du *DepartmentUpdate) AddDeptManagerIDs(ids ...int) *DepartmentUpdate

AddDeptManagerIDs adds the "dept_manager" edge to the DeptManager entity by IDs.

func (*DepartmentUpdate) ClearDeptManager

func (du *DepartmentUpdate) ClearDeptManager() *DepartmentUpdate

ClearDeptManager clears all "dept_manager" edges to the DeptManager 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) RemoveDeptManager

func (du *DepartmentUpdate) RemoveDeptManager(d ...*DeptManager) *DepartmentUpdate

RemoveDeptManager removes "dept_manager" edges to DeptManager entities.

func (*DepartmentUpdate) RemoveDeptManagerIDs

func (du *DepartmentUpdate) RemoveDeptManagerIDs(ids ...int) *DepartmentUpdate

RemoveDeptManagerIDs removes the "dept_manager" edge to DeptManager entities by IDs.

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) SetCreatedAt

func (du *DepartmentUpdate) SetCreatedAt(t time.Time) *DepartmentUpdate

SetCreatedAt sets the "created_at" field.

func (*DepartmentUpdate) SetDeptName

func (du *DepartmentUpdate) SetDeptName(s string) *DepartmentUpdate

SetDeptName sets the "dept_name" field.

func (*DepartmentUpdate) SetNillableCreatedAt

func (du *DepartmentUpdate) SetNillableCreatedAt(t *time.Time) *DepartmentUpdate

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

func (*DepartmentUpdate) SetNillableUpdatedAt

func (du *DepartmentUpdate) SetNillableUpdatedAt(t *time.Time) *DepartmentUpdate

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

func (*DepartmentUpdate) SetUpdatedAt

func (du *DepartmentUpdate) SetUpdatedAt(t time.Time) *DepartmentUpdate

SetUpdatedAt sets the "updated_at" field.

func (*DepartmentUpdate) Where

Where appends a list predicates to 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) AddDeptManager

func (duo *DepartmentUpdateOne) AddDeptManager(d ...*DeptManager) *DepartmentUpdateOne

AddDeptManager adds the "dept_manager" edges to the DeptManager entity.

func (*DepartmentUpdateOne) AddDeptManagerIDs

func (duo *DepartmentUpdateOne) AddDeptManagerIDs(ids ...int) *DepartmentUpdateOne

AddDeptManagerIDs adds the "dept_manager" edge to the DeptManager entity by IDs.

func (*DepartmentUpdateOne) ClearDeptManager

func (duo *DepartmentUpdateOne) ClearDeptManager() *DepartmentUpdateOne

ClearDeptManager clears all "dept_manager" edges to the DeptManager 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) RemoveDeptManager

func (duo *DepartmentUpdateOne) RemoveDeptManager(d ...*DeptManager) *DepartmentUpdateOne

RemoveDeptManager removes "dept_manager" edges to DeptManager entities.

func (*DepartmentUpdateOne) RemoveDeptManagerIDs

func (duo *DepartmentUpdateOne) RemoveDeptManagerIDs(ids ...int) *DepartmentUpdateOne

RemoveDeptManagerIDs removes the "dept_manager" edge to DeptManager entities by IDs.

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) Select

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

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

func (*DepartmentUpdateOne) SetCreatedAt

func (duo *DepartmentUpdateOne) SetCreatedAt(t time.Time) *DepartmentUpdateOne

SetCreatedAt sets the "created_at" field.

func (*DepartmentUpdateOne) SetDeptName

func (duo *DepartmentUpdateOne) SetDeptName(s string) *DepartmentUpdateOne

SetDeptName sets the "dept_name" field.

func (*DepartmentUpdateOne) SetNillableCreatedAt

func (duo *DepartmentUpdateOne) SetNillableCreatedAt(t *time.Time) *DepartmentUpdateOne

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

func (*DepartmentUpdateOne) SetNillableUpdatedAt

func (duo *DepartmentUpdateOne) SetNillableUpdatedAt(t *time.Time) *DepartmentUpdateOne

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

func (*DepartmentUpdateOne) SetUpdatedAt

func (duo *DepartmentUpdateOne) SetUpdatedAt(t time.Time) *DepartmentUpdateOne

SetUpdatedAt sets the "updated_at" field.

func (*DepartmentUpdateOne) Where

Where appends a list predicates to the DepartmentUpdate builder.

type DepartmentUpsert

type DepartmentUpsert struct {
	*sql.UpdateSet
}

DepartmentUpsert is the "OnConflict" setter.

func (*DepartmentUpsert) SetCreatedAt

func (u *DepartmentUpsert) SetCreatedAt(v time.Time) *DepartmentUpsert

SetCreatedAt sets the "created_at" field.

func (*DepartmentUpsert) SetDeptName

func (u *DepartmentUpsert) SetDeptName(v string) *DepartmentUpsert

SetDeptName sets the "dept_name" field.

func (*DepartmentUpsert) SetUpdatedAt

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

SetUpdatedAt sets the "updated_at" field.

func (*DepartmentUpsert) UpdateCreatedAt

func (u *DepartmentUpsert) UpdateCreatedAt() *DepartmentUpsert

UpdateCreatedAt sets the "created_at" field to the value that was provided on create.

func (*DepartmentUpsert) UpdateDeptName

func (u *DepartmentUpsert) UpdateDeptName() *DepartmentUpsert

UpdateDeptName sets the "dept_name" field to the value that was provided on create.

func (*DepartmentUpsert) UpdateUpdatedAt

func (u *DepartmentUpsert) UpdateUpdatedAt() *DepartmentUpsert

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

type DepartmentUpsertBulk

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

DepartmentUpsertBulk is the builder for "upsert"-ing a bulk of Department nodes.

func (*DepartmentUpsertBulk) DoNothing

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

func (*DepartmentUpsertBulk) Exec

Exec executes the query.

func (*DepartmentUpsertBulk) ExecX

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

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

func (*DepartmentUpsertBulk) Ignore

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

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

func (*DepartmentUpsertBulk) SetCreatedAt

func (u *DepartmentUpsertBulk) SetCreatedAt(v time.Time) *DepartmentUpsertBulk

SetCreatedAt sets the "created_at" field.

func (*DepartmentUpsertBulk) SetDeptName

SetDeptName sets the "dept_name" field.

func (*DepartmentUpsertBulk) SetUpdatedAt

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

SetUpdatedAt sets the "updated_at" field.

func (*DepartmentUpsertBulk) Update

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

func (*DepartmentUpsertBulk) UpdateCreatedAt

func (u *DepartmentUpsertBulk) UpdateCreatedAt() *DepartmentUpsertBulk

UpdateCreatedAt sets the "created_at" field to the value that was provided on create.

func (*DepartmentUpsertBulk) UpdateDeptName

func (u *DepartmentUpsertBulk) UpdateDeptName() *DepartmentUpsertBulk

UpdateDeptName sets the "dept_name" field to the value that was provided on create.

func (*DepartmentUpsertBulk) UpdateNewValues

func (u *DepartmentUpsertBulk) UpdateNewValues() *DepartmentUpsertBulk

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

client.Department.Create().
	OnConflict(
		sql.ResolveWithNewValues(),
	).
	Exec(ctx)

func (*DepartmentUpsertBulk) UpdateUpdatedAt

func (u *DepartmentUpsertBulk) UpdateUpdatedAt() *DepartmentUpsertBulk

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

type DepartmentUpsertOne

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

DepartmentUpsertOne is the builder for "upsert"-ing

one Department node.

func (*DepartmentUpsertOne) DoNothing

func (u *DepartmentUpsertOne) DoNothing() *DepartmentUpsertOne

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

func (*DepartmentUpsertOne) Exec

Exec executes the query.

func (*DepartmentUpsertOne) ExecX

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

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

func (*DepartmentUpsertOne) ID

func (u *DepartmentUpsertOne) ID(ctx context.Context) (id int, err error)

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

func (*DepartmentUpsertOne) IDX

func (u *DepartmentUpsertOne) IDX(ctx context.Context) int

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

func (*DepartmentUpsertOne) Ignore

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

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

func (*DepartmentUpsertOne) SetCreatedAt

func (u *DepartmentUpsertOne) SetCreatedAt(v time.Time) *DepartmentUpsertOne

SetCreatedAt sets the "created_at" field.

func (*DepartmentUpsertOne) SetDeptName

func (u *DepartmentUpsertOne) SetDeptName(v string) *DepartmentUpsertOne

SetDeptName sets the "dept_name" field.

func (*DepartmentUpsertOne) SetUpdatedAt

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

SetUpdatedAt sets the "updated_at" field.

func (*DepartmentUpsertOne) Update

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

func (*DepartmentUpsertOne) UpdateCreatedAt

func (u *DepartmentUpsertOne) UpdateCreatedAt() *DepartmentUpsertOne

UpdateCreatedAt sets the "created_at" field to the value that was provided on create.

func (*DepartmentUpsertOne) UpdateDeptName

func (u *DepartmentUpsertOne) UpdateDeptName() *DepartmentUpsertOne

UpdateDeptName sets the "dept_name" field to the value that was provided on create.

func (*DepartmentUpsertOne) UpdateNewValues

func (u *DepartmentUpsertOne) UpdateNewValues() *DepartmentUpsertOne

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

client.Department.Create().
	OnConflict(
		sql.ResolveWithNewValues(),
	).
	Exec(ctx)

func (*DepartmentUpsertOne) UpdateUpdatedAt

func (u *DepartmentUpsertOne) UpdateUpdatedAt() *DepartmentUpsertOne

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

type Departments

type Departments []*Department

Departments is a parsable slice of Department.

type DeptManager

type DeptManager struct {

	// ID of the ent.
	ID int `json:"id,omitempty"`
	// FromDate holds the value of the "from_date" field.
	FromDate time.Time `json:"from_date,omitempty"`
	// ToDate holds the value of the "to_date" field.
	ToDate time.Time `json:"to_date,omitempty"`
	// CreatedAt holds the value of the "created_at" field.
	CreatedAt time.Time `json:"created_at,omitempty"`
	// UpdatedAt holds the value of the "updated_at" field.
	UpdatedAt time.Time `json:"updated_at,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the DeptManagerQuery when eager-loading is set.
	Edges DeptManagerEdges `json:"edges"`
	// contains filtered or unexported fields
}

DeptManager is the model entity for the DeptManager schema.

func (*DeptManager) QueryDepartment

func (dm *DeptManager) QueryDepartment() *DepartmentQuery

QueryDepartment queries the "department" edge of the DeptManager entity.

func (*DeptManager) QueryEmployee

func (dm *DeptManager) QueryEmployee() *EmployeeQuery

QueryEmployee queries the "employee" edge of the DeptManager entity.

func (*DeptManager) String

func (dm *DeptManager) String() string

String implements the fmt.Stringer.

func (*DeptManager) Unwrap

func (dm *DeptManager) Unwrap() *DeptManager

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

func (dm *DeptManager) Update() *DeptManagerUpdateOne

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

func (*DeptManager) Value

func (dm *DeptManager) Value(name string) (ent.Value, error)

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

type DeptManagerClient

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

DeptManagerClient is a client for the DeptManager schema.

func NewDeptManagerClient

func NewDeptManagerClient(c config) *DeptManagerClient

NewDeptManagerClient returns a client for the DeptManager from the given config.

func (*DeptManagerClient) Create

func (c *DeptManagerClient) Create() *DeptManagerCreate

Create returns a builder for creating a DeptManager entity.

func (*DeptManagerClient) CreateBulk

func (c *DeptManagerClient) CreateBulk(builders ...*DeptManagerCreate) *DeptManagerCreateBulk

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

func (*DeptManagerClient) Delete

func (c *DeptManagerClient) Delete() *DeptManagerDelete

Delete returns a delete builder for DeptManager.

func (*DeptManagerClient) DeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*DeptManagerClient) DeleteOneID

func (c *DeptManagerClient) DeleteOneID(id int) *DeptManagerDeleteOne

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

func (*DeptManagerClient) Get

func (c *DeptManagerClient) Get(ctx context.Context, id int) (*DeptManager, error)

Get returns a DeptManager entity by its id.

func (*DeptManagerClient) GetX

func (c *DeptManagerClient) GetX(ctx context.Context, id int) *DeptManager

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

func (*DeptManagerClient) Hooks

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

Hooks returns the client hooks.

func (*DeptManagerClient) Intercept

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

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

func (*DeptManagerClient) Interceptors

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

Interceptors returns the client interceptors.

func (*DeptManagerClient) Query

func (c *DeptManagerClient) Query() *DeptManagerQuery

Query returns a query builder for DeptManager.

func (*DeptManagerClient) QueryDepartment

func (c *DeptManagerClient) QueryDepartment(dm *DeptManager) *DepartmentQuery

QueryDepartment queries the department edge of a DeptManager.

func (*DeptManagerClient) QueryEmployee

func (c *DeptManagerClient) QueryEmployee(dm *DeptManager) *EmployeeQuery

QueryEmployee queries the employee edge of a DeptManager.

func (*DeptManagerClient) Update

func (c *DeptManagerClient) Update() *DeptManagerUpdate

Update returns an update builder for DeptManager.

func (*DeptManagerClient) UpdateOne

UpdateOne returns an update builder for the given entity.

func (*DeptManagerClient) UpdateOneID

func (c *DeptManagerClient) UpdateOneID(id int) *DeptManagerUpdateOne

UpdateOneID returns an update builder for the given id.

func (*DeptManagerClient) Use

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

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

type DeptManagerCreate

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

DeptManagerCreate is the builder for creating a DeptManager entity.

func (*DeptManagerCreate) Exec

func (dmc *DeptManagerCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*DeptManagerCreate) ExecX

func (dmc *DeptManagerCreate) ExecX(ctx context.Context)

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

func (*DeptManagerCreate) Mutation

func (dmc *DeptManagerCreate) Mutation() *DeptManagerMutation

Mutation returns the DeptManagerMutation object of the builder.

func (*DeptManagerCreate) OnConflict

func (dmc *DeptManagerCreate) OnConflict(opts ...sql.ConflictOption) *DeptManagerUpsertOne

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

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

func (*DeptManagerCreate) OnConflictColumns

func (dmc *DeptManagerCreate) OnConflictColumns(columns ...string) *DeptManagerUpsertOne

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

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

func (*DeptManagerCreate) Save

func (dmc *DeptManagerCreate) Save(ctx context.Context) (*DeptManager, error)

Save creates the DeptManager in the database.

func (*DeptManagerCreate) SaveX

func (dmc *DeptManagerCreate) SaveX(ctx context.Context) *DeptManager

SaveX calls Save and panics if Save returns an error.

func (*DeptManagerCreate) SetCreatedAt

func (dmc *DeptManagerCreate) SetCreatedAt(t time.Time) *DeptManagerCreate

SetCreatedAt sets the "created_at" field.

func (*DeptManagerCreate) SetDepartment

func (dmc *DeptManagerCreate) SetDepartment(d *Department) *DeptManagerCreate

SetDepartment sets the "department" edge to the Department entity.

func (*DeptManagerCreate) SetDepartmentID

func (dmc *DeptManagerCreate) SetDepartmentID(id int) *DeptManagerCreate

SetDepartmentID sets the "department" edge to the Department entity by ID.

func (*DeptManagerCreate) SetEmployee

func (dmc *DeptManagerCreate) SetEmployee(e *Employee) *DeptManagerCreate

SetEmployee sets the "employee" edge to the Employee entity.

func (*DeptManagerCreate) SetEmployeeID

func (dmc *DeptManagerCreate) SetEmployeeID(id int) *DeptManagerCreate

SetEmployeeID sets the "employee" edge to the Employee entity by ID.

func (*DeptManagerCreate) SetFromDate

func (dmc *DeptManagerCreate) SetFromDate(t time.Time) *DeptManagerCreate

SetFromDate sets the "from_date" field.

func (*DeptManagerCreate) SetNillableCreatedAt

func (dmc *DeptManagerCreate) SetNillableCreatedAt(t *time.Time) *DeptManagerCreate

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

func (*DeptManagerCreate) SetNillableUpdatedAt

func (dmc *DeptManagerCreate) SetNillableUpdatedAt(t *time.Time) *DeptManagerCreate

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

func (*DeptManagerCreate) SetToDate

func (dmc *DeptManagerCreate) SetToDate(t time.Time) *DeptManagerCreate

SetToDate sets the "to_date" field.

func (*DeptManagerCreate) SetUpdatedAt

func (dmc *DeptManagerCreate) SetUpdatedAt(t time.Time) *DeptManagerCreate

SetUpdatedAt sets the "updated_at" field.

type DeptManagerCreateBulk

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

DeptManagerCreateBulk is the builder for creating many DeptManager entities in bulk.

func (*DeptManagerCreateBulk) Exec

func (dmcb *DeptManagerCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*DeptManagerCreateBulk) ExecX

func (dmcb *DeptManagerCreateBulk) ExecX(ctx context.Context)

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

func (*DeptManagerCreateBulk) OnConflict

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

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

func (*DeptManagerCreateBulk) OnConflictColumns

func (dmcb *DeptManagerCreateBulk) OnConflictColumns(columns ...string) *DeptManagerUpsertBulk

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

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

func (*DeptManagerCreateBulk) Save

func (dmcb *DeptManagerCreateBulk) Save(ctx context.Context) ([]*DeptManager, error)

Save creates the DeptManager entities in the database.

func (*DeptManagerCreateBulk) SaveX

func (dmcb *DeptManagerCreateBulk) SaveX(ctx context.Context) []*DeptManager

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

type DeptManagerDelete

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

DeptManagerDelete is the builder for deleting a DeptManager entity.

func (*DeptManagerDelete) Exec

func (dmd *DeptManagerDelete) Exec(ctx context.Context) (int, error)

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

func (*DeptManagerDelete) ExecX

func (dmd *DeptManagerDelete) ExecX(ctx context.Context) int

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

func (*DeptManagerDelete) Where

Where appends a list predicates to the DeptManagerDelete builder.

type DeptManagerDeleteOne

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

DeptManagerDeleteOne is the builder for deleting a single DeptManager entity.

func (*DeptManagerDeleteOne) Exec

func (dmdo *DeptManagerDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*DeptManagerDeleteOne) ExecX

func (dmdo *DeptManagerDeleteOne) ExecX(ctx context.Context)

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

func (*DeptManagerDeleteOne) Where

Where appends a list predicates to the DeptManagerDelete builder.

type DeptManagerEdges

type DeptManagerEdges struct {
	// Employee holds the value of the employee edge.
	Employee *Employee `json:"employee,omitempty"`
	// Department holds the value of the department edge.
	Department *Department `json:"department,omitempty"`
	// contains filtered or unexported fields
}

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

func (DeptManagerEdges) DepartmentOrErr

func (e DeptManagerEdges) 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.

func (DeptManagerEdges) EmployeeOrErr

func (e DeptManagerEdges) EmployeeOrErr() (*Employee, error)

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

type DeptManagerGroupBy

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

DeptManagerGroupBy is the group-by builder for DeptManager entities.

func (*DeptManagerGroupBy) Aggregate

func (dmgb *DeptManagerGroupBy) Aggregate(fns ...AggregateFunc) *DeptManagerGroupBy

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

func (*DeptManagerGroupBy) Bool

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

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

func (*DeptManagerGroupBy) BoolX

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

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

func (*DeptManagerGroupBy) Bools

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

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

func (*DeptManagerGroupBy) BoolsX

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

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

func (*DeptManagerGroupBy) Float64

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

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

func (*DeptManagerGroupBy) Float64X

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

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

func (*DeptManagerGroupBy) Float64s

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

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

func (*DeptManagerGroupBy) Float64sX

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

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

func (*DeptManagerGroupBy) Int

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

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

func (*DeptManagerGroupBy) IntX

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

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

func (*DeptManagerGroupBy) Ints

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

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

func (*DeptManagerGroupBy) IntsX

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

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

func (*DeptManagerGroupBy) Scan

func (dmgb *DeptManagerGroupBy) Scan(ctx context.Context, v any) error

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

func (*DeptManagerGroupBy) ScanX

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

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

func (*DeptManagerGroupBy) String

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

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

func (*DeptManagerGroupBy) StringX

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

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

func (*DeptManagerGroupBy) Strings

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

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

func (*DeptManagerGroupBy) StringsX

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

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

type DeptManagerMutation

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

DeptManagerMutation represents an operation that mutates the DeptManager nodes in the graph.

func (*DeptManagerMutation) AddField

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

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

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

func (*DeptManagerMutation) AddedField

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

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

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

func (*DeptManagerMutation) AddedIDs

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

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

func (*DeptManagerMutation) ClearDepartment

func (m *DeptManagerMutation) ClearDepartment()

ClearDepartment clears the "department" edge to the Department entity.

func (*DeptManagerMutation) ClearEdge

func (m *DeptManagerMutation) 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 (*DeptManagerMutation) ClearEmployee

func (m *DeptManagerMutation) ClearEmployee()

ClearEmployee clears the "employee" edge to the Employee entity.

func (*DeptManagerMutation) ClearField

func (m *DeptManagerMutation) 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 (*DeptManagerMutation) ClearedEdges

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

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

func (*DeptManagerMutation) ClearedFields

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

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

func (DeptManagerMutation) Client

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

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

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

func (*DeptManagerMutation) DepartmentCleared

func (m *DeptManagerMutation) DepartmentCleared() bool

DepartmentCleared reports if the "department" edge to the Department entity was cleared.

func (*DeptManagerMutation) DepartmentID

func (m *DeptManagerMutation) DepartmentID() (id int, exists bool)

DepartmentID returns the "department" edge ID in the mutation.

func (*DeptManagerMutation) DepartmentIDs

func (m *DeptManagerMutation) 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 (*DeptManagerMutation) EdgeCleared

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

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

func (*DeptManagerMutation) EmployeeCleared

func (m *DeptManagerMutation) EmployeeCleared() bool

EmployeeCleared reports if the "employee" edge to the Employee entity was cleared.

func (*DeptManagerMutation) EmployeeID

func (m *DeptManagerMutation) EmployeeID() (id int, exists bool)

EmployeeID returns the "employee" edge ID in the mutation.

func (*DeptManagerMutation) EmployeeIDs

func (m *DeptManagerMutation) EmployeeIDs() (ids []int)

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

func (*DeptManagerMutation) Field

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

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

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

func (*DeptManagerMutation) Fields

func (m *DeptManagerMutation) 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 (*DeptManagerMutation) FromDate

func (m *DeptManagerMutation) FromDate() (r time.Time, exists bool)

FromDate returns the value of the "from_date" field in the mutation.

func (*DeptManagerMutation) ID

func (m *DeptManagerMutation) 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 or after it was returned from the database.

func (*DeptManagerMutation) IDs

func (m *DeptManagerMutation) IDs(ctx context.Context) ([]int, error)

IDs queries the database and returns the entity ids that match the mutation's predicate. That means, if the mutation is applied within a transaction with an isolation level such as sql.LevelSerializable, the returned ids match the ids of the rows that will be updated or updated by the mutation.

func (*DeptManagerMutation) OldCreatedAt

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

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

func (m *DeptManagerMutation) OldField(ctx context.Context, name string) (ent.Value, error)

OldField returns the old value of the field from the database. An error is returned if the mutation operation is not UpdateOne, or the query to the database failed.

func (*DeptManagerMutation) OldFromDate

func (m *DeptManagerMutation) OldFromDate(ctx context.Context) (v time.Time, err error)

OldFromDate returns the old "from_date" field's value of the DeptManager entity. If the DeptManager 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 (*DeptManagerMutation) OldToDate

func (m *DeptManagerMutation) OldToDate(ctx context.Context) (v time.Time, err error)

OldToDate returns the old "to_date" field's value of the DeptManager entity. If the DeptManager 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 (*DeptManagerMutation) OldUpdatedAt

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

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

func (m *DeptManagerMutation) Op() Op

Op returns the operation name.

func (*DeptManagerMutation) RemovedEdges

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

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

func (*DeptManagerMutation) RemovedIDs

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

func (m *DeptManagerMutation) ResetCreatedAt()

ResetCreatedAt resets all changes to the "created_at" field.

func (*DeptManagerMutation) ResetDepartment

func (m *DeptManagerMutation) ResetDepartment()

ResetDepartment resets all changes to the "department" edge.

func (*DeptManagerMutation) ResetEdge

func (m *DeptManagerMutation) 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 (*DeptManagerMutation) ResetEmployee

func (m *DeptManagerMutation) ResetEmployee()

ResetEmployee resets all changes to the "employee" edge.

func (*DeptManagerMutation) ResetField

func (m *DeptManagerMutation) 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 (*DeptManagerMutation) ResetFromDate

func (m *DeptManagerMutation) ResetFromDate()

ResetFromDate resets all changes to the "from_date" field.

func (*DeptManagerMutation) ResetToDate

func (m *DeptManagerMutation) ResetToDate()

ResetToDate resets all changes to the "to_date" field.

func (*DeptManagerMutation) ResetUpdatedAt

func (m *DeptManagerMutation) ResetUpdatedAt()

ResetUpdatedAt resets all changes to the "updated_at" field.

func (*DeptManagerMutation) SetCreatedAt

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

SetCreatedAt sets the "created_at" field.

func (*DeptManagerMutation) SetDepartmentID

func (m *DeptManagerMutation) SetDepartmentID(id int)

SetDepartmentID sets the "department" edge to the Department entity by id.

func (*DeptManagerMutation) SetEmployeeID

func (m *DeptManagerMutation) SetEmployeeID(id int)

SetEmployeeID sets the "employee" edge to the Employee entity by id.

func (*DeptManagerMutation) SetField

func (m *DeptManagerMutation) 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 (*DeptManagerMutation) SetFromDate

func (m *DeptManagerMutation) SetFromDate(t time.Time)

SetFromDate sets the "from_date" field.

func (*DeptManagerMutation) SetOp

func (m *DeptManagerMutation) SetOp(op Op)

SetOp allows setting the mutation operation.

func (*DeptManagerMutation) SetToDate

func (m *DeptManagerMutation) SetToDate(t time.Time)

SetToDate sets the "to_date" field.

func (*DeptManagerMutation) SetUpdatedAt

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

SetUpdatedAt sets the "updated_at" field.

func (*DeptManagerMutation) ToDate

func (m *DeptManagerMutation) ToDate() (r time.Time, exists bool)

ToDate returns the value of the "to_date" field in the mutation.

func (DeptManagerMutation) Tx

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

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

func (*DeptManagerMutation) Type

func (m *DeptManagerMutation) Type() string

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

func (*DeptManagerMutation) UpdatedAt

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

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

func (*DeptManagerMutation) Where

func (m *DeptManagerMutation) Where(ps ...predicate.DeptManager)

Where appends a list predicates to the DeptManagerMutation builder.

func (*DeptManagerMutation) WhereP

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

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

type DeptManagerQuery

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

DeptManagerQuery is the builder for querying DeptManager entities.

func (*DeptManagerQuery) Aggregate

func (dmq *DeptManagerQuery) Aggregate(fns ...AggregateFunc) *DeptManagerSelect

Aggregate returns a DeptManagerSelect configured with the given aggregations.

func (*DeptManagerQuery) All

func (dmq *DeptManagerQuery) All(ctx context.Context) ([]*DeptManager, error)

All executes the query and returns a list of DeptManagers.

func (*DeptManagerQuery) AllX

func (dmq *DeptManagerQuery) AllX(ctx context.Context) []*DeptManager

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

func (*DeptManagerQuery) Clone

func (dmq *DeptManagerQuery) Clone() *DeptManagerQuery

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

func (*DeptManagerQuery) Count

func (dmq *DeptManagerQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*DeptManagerQuery) CountX

func (dmq *DeptManagerQuery) CountX(ctx context.Context) int

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

func (*DeptManagerQuery) Exist

func (dmq *DeptManagerQuery) Exist(ctx context.Context) (bool, error)

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

func (*DeptManagerQuery) ExistX

func (dmq *DeptManagerQuery) ExistX(ctx context.Context) bool

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

func (*DeptManagerQuery) First

func (dmq *DeptManagerQuery) First(ctx context.Context) (*DeptManager, error)

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

func (*DeptManagerQuery) FirstID

func (dmq *DeptManagerQuery) FirstID(ctx context.Context) (id int, err error)

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

func (*DeptManagerQuery) FirstIDX

func (dmq *DeptManagerQuery) FirstIDX(ctx context.Context) int

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

func (*DeptManagerQuery) FirstX

func (dmq *DeptManagerQuery) FirstX(ctx context.Context) *DeptManager

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

func (*DeptManagerQuery) GroupBy

func (dmq *DeptManagerQuery) GroupBy(field string, fields ...string) *DeptManagerGroupBy

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

client.DeptManager.Query().
	GroupBy(deptmanager.FieldFromDate).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*DeptManagerQuery) IDs

func (dmq *DeptManagerQuery) IDs(ctx context.Context) (ids []int, err error)

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

func (*DeptManagerQuery) IDsX

func (dmq *DeptManagerQuery) IDsX(ctx context.Context) []int

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

func (*DeptManagerQuery) Limit

func (dmq *DeptManagerQuery) Limit(limit int) *DeptManagerQuery

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

func (*DeptManagerQuery) Offset

func (dmq *DeptManagerQuery) Offset(offset int) *DeptManagerQuery

Offset to start from.

func (*DeptManagerQuery) Only

func (dmq *DeptManagerQuery) Only(ctx context.Context) (*DeptManager, error)

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

func (*DeptManagerQuery) OnlyID

func (dmq *DeptManagerQuery) OnlyID(ctx context.Context) (id int, err error)

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

func (*DeptManagerQuery) OnlyIDX

func (dmq *DeptManagerQuery) OnlyIDX(ctx context.Context) int

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

func (*DeptManagerQuery) OnlyX

func (dmq *DeptManagerQuery) OnlyX(ctx context.Context) *DeptManager

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

func (*DeptManagerQuery) Order

Order specifies how the records should be ordered.

func (*DeptManagerQuery) QueryDepartment

func (dmq *DeptManagerQuery) QueryDepartment() *DepartmentQuery

QueryDepartment chains the current query on the "department" edge.

func (*DeptManagerQuery) QueryEmployee

func (dmq *DeptManagerQuery) QueryEmployee() *EmployeeQuery

QueryEmployee chains the current query on the "employee" edge.

func (*DeptManagerQuery) Select

func (dmq *DeptManagerQuery) Select(fields ...string) *DeptManagerSelect

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

client.DeptManager.Query().
	Select(deptmanager.FieldFromDate).
	Scan(ctx, &v)

func (*DeptManagerQuery) Unique

func (dmq *DeptManagerQuery) Unique(unique bool) *DeptManagerQuery

Unique configures the query builder to filter duplicate records on query. By default, unique is set to true, and can be disabled using this method.

func (*DeptManagerQuery) Where

Where adds a new predicate for the DeptManagerQuery builder.

func (*DeptManagerQuery) WithDepartment

func (dmq *DeptManagerQuery) WithDepartment(opts ...func(*DepartmentQuery)) *DeptManagerQuery

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.

func (*DeptManagerQuery) WithEmployee

func (dmq *DeptManagerQuery) WithEmployee(opts ...func(*EmployeeQuery)) *DeptManagerQuery

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

type DeptManagerSelect

type DeptManagerSelect struct {
	*DeptManagerQuery
	// contains filtered or unexported fields
}

DeptManagerSelect is the builder for selecting fields of DeptManager entities.

func (*DeptManagerSelect) Aggregate

func (dms *DeptManagerSelect) Aggregate(fns ...AggregateFunc) *DeptManagerSelect

Aggregate adds the given aggregation functions to the selector query.

func (*DeptManagerSelect) Bool

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

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

func (*DeptManagerSelect) BoolX

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

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

func (*DeptManagerSelect) Bools

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

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

func (*DeptManagerSelect) BoolsX

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

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

func (*DeptManagerSelect) Float64

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

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

func (*DeptManagerSelect) Float64X

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

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

func (*DeptManagerSelect) Float64s

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

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

func (*DeptManagerSelect) Float64sX

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

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

func (*DeptManagerSelect) Int

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

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

func (*DeptManagerSelect) IntX

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

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

func (*DeptManagerSelect) Ints

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

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

func (*DeptManagerSelect) IntsX

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

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

func (*DeptManagerSelect) Scan

func (dms *DeptManagerSelect) Scan(ctx context.Context, v any) error

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

func (*DeptManagerSelect) ScanX

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

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

func (*DeptManagerSelect) String

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

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

func (*DeptManagerSelect) StringX

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

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

func (*DeptManagerSelect) Strings

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

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

func (*DeptManagerSelect) StringsX

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

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

type DeptManagerUpdate

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

DeptManagerUpdate is the builder for updating DeptManager entities.

func (*DeptManagerUpdate) ClearDepartment

func (dmu *DeptManagerUpdate) ClearDepartment() *DeptManagerUpdate

ClearDepartment clears the "department" edge to the Department entity.

func (*DeptManagerUpdate) ClearEmployee

func (dmu *DeptManagerUpdate) ClearEmployee() *DeptManagerUpdate

ClearEmployee clears the "employee" edge to the Employee entity.

func (*DeptManagerUpdate) Exec

func (dmu *DeptManagerUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*DeptManagerUpdate) ExecX

func (dmu *DeptManagerUpdate) ExecX(ctx context.Context)

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

func (*DeptManagerUpdate) Mutation

func (dmu *DeptManagerUpdate) Mutation() *DeptManagerMutation

Mutation returns the DeptManagerMutation object of the builder.

func (*DeptManagerUpdate) Save

func (dmu *DeptManagerUpdate) Save(ctx context.Context) (int, error)

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

func (*DeptManagerUpdate) SaveX

func (dmu *DeptManagerUpdate) SaveX(ctx context.Context) int

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

func (*DeptManagerUpdate) SetCreatedAt

func (dmu *DeptManagerUpdate) SetCreatedAt(t time.Time) *DeptManagerUpdate

SetCreatedAt sets the "created_at" field.

func (*DeptManagerUpdate) SetDepartment

func (dmu *DeptManagerUpdate) SetDepartment(d *Department) *DeptManagerUpdate

SetDepartment sets the "department" edge to the Department entity.

func (*DeptManagerUpdate) SetDepartmentID

func (dmu *DeptManagerUpdate) SetDepartmentID(id int) *DeptManagerUpdate

SetDepartmentID sets the "department" edge to the Department entity by ID.

func (*DeptManagerUpdate) SetEmployee

func (dmu *DeptManagerUpdate) SetEmployee(e *Employee) *DeptManagerUpdate

SetEmployee sets the "employee" edge to the Employee entity.

func (*DeptManagerUpdate) SetEmployeeID

func (dmu *DeptManagerUpdate) SetEmployeeID(id int) *DeptManagerUpdate

SetEmployeeID sets the "employee" edge to the Employee entity by ID.

func (*DeptManagerUpdate) SetFromDate

func (dmu *DeptManagerUpdate) SetFromDate(t time.Time) *DeptManagerUpdate

SetFromDate sets the "from_date" field.

func (*DeptManagerUpdate) SetNillableCreatedAt

func (dmu *DeptManagerUpdate) SetNillableCreatedAt(t *time.Time) *DeptManagerUpdate

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

func (*DeptManagerUpdate) SetNillableUpdatedAt

func (dmu *DeptManagerUpdate) SetNillableUpdatedAt(t *time.Time) *DeptManagerUpdate

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

func (*DeptManagerUpdate) SetToDate

func (dmu *DeptManagerUpdate) SetToDate(t time.Time) *DeptManagerUpdate

SetToDate sets the "to_date" field.

func (*DeptManagerUpdate) SetUpdatedAt

func (dmu *DeptManagerUpdate) SetUpdatedAt(t time.Time) *DeptManagerUpdate

SetUpdatedAt sets the "updated_at" field.

func (*DeptManagerUpdate) Where

Where appends a list predicates to the DeptManagerUpdate builder.

type DeptManagerUpdateOne

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

DeptManagerUpdateOne is the builder for updating a single DeptManager entity.

func (*DeptManagerUpdateOne) ClearDepartment

func (dmuo *DeptManagerUpdateOne) ClearDepartment() *DeptManagerUpdateOne

ClearDepartment clears the "department" edge to the Department entity.

func (*DeptManagerUpdateOne) ClearEmployee

func (dmuo *DeptManagerUpdateOne) ClearEmployee() *DeptManagerUpdateOne

ClearEmployee clears the "employee" edge to the Employee entity.

func (*DeptManagerUpdateOne) Exec

func (dmuo *DeptManagerUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*DeptManagerUpdateOne) ExecX

func (dmuo *DeptManagerUpdateOne) ExecX(ctx context.Context)

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

func (*DeptManagerUpdateOne) Mutation

func (dmuo *DeptManagerUpdateOne) Mutation() *DeptManagerMutation

Mutation returns the DeptManagerMutation object of the builder.

func (*DeptManagerUpdateOne) Save

Save executes the query and returns the updated DeptManager entity.

func (*DeptManagerUpdateOne) SaveX

func (dmuo *DeptManagerUpdateOne) SaveX(ctx context.Context) *DeptManager

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

func (*DeptManagerUpdateOne) Select

func (dmuo *DeptManagerUpdateOne) Select(field string, fields ...string) *DeptManagerUpdateOne

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

func (*DeptManagerUpdateOne) SetCreatedAt

func (dmuo *DeptManagerUpdateOne) SetCreatedAt(t time.Time) *DeptManagerUpdateOne

SetCreatedAt sets the "created_at" field.

func (*DeptManagerUpdateOne) SetDepartment

func (dmuo *DeptManagerUpdateOne) SetDepartment(d *Department) *DeptManagerUpdateOne

SetDepartment sets the "department" edge to the Department entity.

func (*DeptManagerUpdateOne) SetDepartmentID

func (dmuo *DeptManagerUpdateOne) SetDepartmentID(id int) *DeptManagerUpdateOne

SetDepartmentID sets the "department" edge to the Department entity by ID.

func (*DeptManagerUpdateOne) SetEmployee

func (dmuo *DeptManagerUpdateOne) SetEmployee(e *Employee) *DeptManagerUpdateOne

SetEmployee sets the "employee" edge to the Employee entity.

func (*DeptManagerUpdateOne) SetEmployeeID

func (dmuo *DeptManagerUpdateOne) SetEmployeeID(id int) *DeptManagerUpdateOne

SetEmployeeID sets the "employee" edge to the Employee entity by ID.

func (*DeptManagerUpdateOne) SetFromDate

func (dmuo *DeptManagerUpdateOne) SetFromDate(t time.Time) *DeptManagerUpdateOne

SetFromDate sets the "from_date" field.

func (*DeptManagerUpdateOne) SetNillableCreatedAt

func (dmuo *DeptManagerUpdateOne) SetNillableCreatedAt(t *time.Time) *DeptManagerUpdateOne

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

func (*DeptManagerUpdateOne) SetNillableUpdatedAt

func (dmuo *DeptManagerUpdateOne) SetNillableUpdatedAt(t *time.Time) *DeptManagerUpdateOne

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

func (*DeptManagerUpdateOne) SetToDate

func (dmuo *DeptManagerUpdateOne) SetToDate(t time.Time) *DeptManagerUpdateOne

SetToDate sets the "to_date" field.

func (*DeptManagerUpdateOne) SetUpdatedAt

func (dmuo *DeptManagerUpdateOne) SetUpdatedAt(t time.Time) *DeptManagerUpdateOne

SetUpdatedAt sets the "updated_at" field.

func (*DeptManagerUpdateOne) Where

Where appends a list predicates to the DeptManagerUpdate builder.

type DeptManagerUpsert

type DeptManagerUpsert struct {
	*sql.UpdateSet
}

DeptManagerUpsert is the "OnConflict" setter.

func (*DeptManagerUpsert) SetCreatedAt

func (u *DeptManagerUpsert) SetCreatedAt(v time.Time) *DeptManagerUpsert

SetCreatedAt sets the "created_at" field.

func (*DeptManagerUpsert) SetFromDate

func (u *DeptManagerUpsert) SetFromDate(v time.Time) *DeptManagerUpsert

SetFromDate sets the "from_date" field.

func (*DeptManagerUpsert) SetToDate

func (u *DeptManagerUpsert) SetToDate(v time.Time) *DeptManagerUpsert

SetToDate sets the "to_date" field.

func (*DeptManagerUpsert) SetUpdatedAt

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

SetUpdatedAt sets the "updated_at" field.

func (*DeptManagerUpsert) UpdateCreatedAt

func (u *DeptManagerUpsert) UpdateCreatedAt() *DeptManagerUpsert

UpdateCreatedAt sets the "created_at" field to the value that was provided on create.

func (*DeptManagerUpsert) UpdateFromDate

func (u *DeptManagerUpsert) UpdateFromDate() *DeptManagerUpsert

UpdateFromDate sets the "from_date" field to the value that was provided on create.

func (*DeptManagerUpsert) UpdateToDate

func (u *DeptManagerUpsert) UpdateToDate() *DeptManagerUpsert

UpdateToDate sets the "to_date" field to the value that was provided on create.

func (*DeptManagerUpsert) UpdateUpdatedAt

func (u *DeptManagerUpsert) UpdateUpdatedAt() *DeptManagerUpsert

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

type DeptManagerUpsertBulk

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

DeptManagerUpsertBulk is the builder for "upsert"-ing a bulk of DeptManager nodes.

func (*DeptManagerUpsertBulk) DoNothing

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

func (*DeptManagerUpsertBulk) Exec

Exec executes the query.

func (*DeptManagerUpsertBulk) ExecX

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

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

func (*DeptManagerUpsertBulk) Ignore

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

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

func (*DeptManagerUpsertBulk) SetCreatedAt

SetCreatedAt sets the "created_at" field.

func (*DeptManagerUpsertBulk) SetFromDate

SetFromDate sets the "from_date" field.

func (*DeptManagerUpsertBulk) SetToDate

SetToDate sets the "to_date" field.

func (*DeptManagerUpsertBulk) SetUpdatedAt

SetUpdatedAt sets the "updated_at" field.

func (*DeptManagerUpsertBulk) Update

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

func (*DeptManagerUpsertBulk) UpdateCreatedAt

func (u *DeptManagerUpsertBulk) UpdateCreatedAt() *DeptManagerUpsertBulk

UpdateCreatedAt sets the "created_at" field to the value that was provided on create.

func (*DeptManagerUpsertBulk) UpdateFromDate

func (u *DeptManagerUpsertBulk) UpdateFromDate() *DeptManagerUpsertBulk

UpdateFromDate sets the "from_date" field to the value that was provided on create.

func (*DeptManagerUpsertBulk) UpdateNewValues

func (u *DeptManagerUpsertBulk) UpdateNewValues() *DeptManagerUpsertBulk

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

client.DeptManager.Create().
	OnConflict(
		sql.ResolveWithNewValues(),
	).
	Exec(ctx)

func (*DeptManagerUpsertBulk) UpdateToDate

func (u *DeptManagerUpsertBulk) UpdateToDate() *DeptManagerUpsertBulk

UpdateToDate sets the "to_date" field to the value that was provided on create.

func (*DeptManagerUpsertBulk) UpdateUpdatedAt

func (u *DeptManagerUpsertBulk) UpdateUpdatedAt() *DeptManagerUpsertBulk

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

type DeptManagerUpsertOne

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

DeptManagerUpsertOne is the builder for "upsert"-ing

one DeptManager node.

func (*DeptManagerUpsertOne) DoNothing

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

func (*DeptManagerUpsertOne) Exec

Exec executes the query.

func (*DeptManagerUpsertOne) ExecX

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

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

func (*DeptManagerUpsertOne) ID

func (u *DeptManagerUpsertOne) ID(ctx context.Context) (id int, err error)

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

func (*DeptManagerUpsertOne) IDX

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

func (*DeptManagerUpsertOne) Ignore

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

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

func (*DeptManagerUpsertOne) SetCreatedAt

func (u *DeptManagerUpsertOne) SetCreatedAt(v time.Time) *DeptManagerUpsertOne

SetCreatedAt sets the "created_at" field.

func (*DeptManagerUpsertOne) SetFromDate

SetFromDate sets the "from_date" field.

func (*DeptManagerUpsertOne) SetToDate

SetToDate sets the "to_date" field.

func (*DeptManagerUpsertOne) SetUpdatedAt

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

SetUpdatedAt sets the "updated_at" field.

func (*DeptManagerUpsertOne) Update

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

func (*DeptManagerUpsertOne) UpdateCreatedAt

func (u *DeptManagerUpsertOne) UpdateCreatedAt() *DeptManagerUpsertOne

UpdateCreatedAt sets the "created_at" field to the value that was provided on create.

func (*DeptManagerUpsertOne) UpdateFromDate

func (u *DeptManagerUpsertOne) UpdateFromDate() *DeptManagerUpsertOne

UpdateFromDate sets the "from_date" field to the value that was provided on create.

func (*DeptManagerUpsertOne) UpdateNewValues

func (u *DeptManagerUpsertOne) UpdateNewValues() *DeptManagerUpsertOne

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

client.DeptManager.Create().
	OnConflict(
		sql.ResolveWithNewValues(),
	).
	Exec(ctx)

func (*DeptManagerUpsertOne) UpdateToDate

func (u *DeptManagerUpsertOne) UpdateToDate() *DeptManagerUpsertOne

UpdateToDate sets the "to_date" field to the value that was provided on create.

func (*DeptManagerUpsertOne) UpdateUpdatedAt

func (u *DeptManagerUpsertOne) UpdateUpdatedAt() *DeptManagerUpsertOne

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

type DeptManagers

type DeptManagers []*DeptManager

DeptManagers is a parsable slice of DeptManager.

type Employee

type Employee struct {

	// ID of the ent.
	ID int `json:"id,omitempty"`
	// BirthDate holds the value of the "birth_date" field.
	BirthDate time.Time `json:"birth_date,omitempty"`
	// FirstName holds the value of the "first_name" field.
	FirstName string `json:"first_name,omitempty"`
	// LastName holds the value of the "last_name" field.
	LastName string `json:"last_name,omitempty"`
	// Gender holds the value of the "gender" field.
	Gender employee.Gender `json:"gender,omitempty"`
	// HireDate holds the value of the "hire_date" field.
	HireDate time.Time `json:"hire_date,omitempty"`
	// CreatedAt holds the value of the "created_at" field.
	CreatedAt time.Time `json:"created_at,omitempty"`
	// UpdatedAt holds the value of the "updated_at" field.
	UpdatedAt time.Time `json:"updated_at,omitempty"`
	// DeletedAt holds the value of the "deleted_at" field.
	DeletedAt time.Time `json:"deleted_at,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the EmployeeQuery when eager-loading is set.
	Edges EmployeeEdges `json:"edges"`
	// contains filtered or unexported fields
}

Employee is the model entity for the Employee schema.

func (*Employee) QueryDeptManager

func (e *Employee) QueryDeptManager() *DeptManagerQuery

QueryDeptManager queries the "dept_manager" edge of the Employee entity.

func (*Employee) String

func (e *Employee) String() string

String implements the fmt.Stringer.

func (*Employee) Unwrap

func (e *Employee) Unwrap() *Employee

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

func (e *Employee) Update() *EmployeeUpdateOne

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

func (*Employee) Value

func (e *Employee) Value(name string) (ent.Value, error)

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

type EmployeeClient

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

EmployeeClient is a client for the Employee schema.

func NewEmployeeClient

func NewEmployeeClient(c config) *EmployeeClient

NewEmployeeClient returns a client for the Employee from the given config.

func (*EmployeeClient) Create

func (c *EmployeeClient) Create() *EmployeeCreate

Create returns a builder for creating a Employee entity.

func (*EmployeeClient) CreateBulk

func (c *EmployeeClient) CreateBulk(builders ...*EmployeeCreate) *EmployeeCreateBulk

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

func (*EmployeeClient) Delete

func (c *EmployeeClient) Delete() *EmployeeDelete

Delete returns a delete builder for Employee.

func (*EmployeeClient) DeleteOne

func (c *EmployeeClient) DeleteOne(e *Employee) *EmployeeDeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*EmployeeClient) DeleteOneID

func (c *EmployeeClient) DeleteOneID(id int) *EmployeeDeleteOne

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

func (*EmployeeClient) Get

func (c *EmployeeClient) Get(ctx context.Context, id int) (*Employee, error)

Get returns a Employee entity by its id.

func (*EmployeeClient) GetX

func (c *EmployeeClient) GetX(ctx context.Context, id int) *Employee

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

func (*EmployeeClient) Hooks

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

Hooks returns the client hooks.

func (*EmployeeClient) Intercept

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

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

func (*EmployeeClient) Interceptors

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

Interceptors returns the client interceptors.

func (*EmployeeClient) Query

func (c *EmployeeClient) Query() *EmployeeQuery

Query returns a query builder for Employee.

func (*EmployeeClient) QueryDeptManager

func (c *EmployeeClient) QueryDeptManager(e *Employee) *DeptManagerQuery

QueryDeptManager queries the dept_manager edge of a Employee.

func (*EmployeeClient) Update

func (c *EmployeeClient) Update() *EmployeeUpdate

Update returns an update builder for Employee.

func (*EmployeeClient) UpdateOne

func (c *EmployeeClient) UpdateOne(e *Employee) *EmployeeUpdateOne

UpdateOne returns an update builder for the given entity.

func (*EmployeeClient) UpdateOneID

func (c *EmployeeClient) UpdateOneID(id int) *EmployeeUpdateOne

UpdateOneID returns an update builder for the given id.

func (*EmployeeClient) Use

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

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

type EmployeeCreate

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

EmployeeCreate is the builder for creating a Employee entity.

func (*EmployeeCreate) AddDeptManager

func (ec *EmployeeCreate) AddDeptManager(d ...*DeptManager) *EmployeeCreate

AddDeptManager adds the "dept_manager" edges to the DeptManager entity.

func (*EmployeeCreate) AddDeptManagerIDs

func (ec *EmployeeCreate) AddDeptManagerIDs(ids ...int) *EmployeeCreate

AddDeptManagerIDs adds the "dept_manager" edge to the DeptManager entity by IDs.

func (*EmployeeCreate) Exec

func (ec *EmployeeCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*EmployeeCreate) ExecX

func (ec *EmployeeCreate) ExecX(ctx context.Context)

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

func (*EmployeeCreate) Mutation

func (ec *EmployeeCreate) Mutation() *EmployeeMutation

Mutation returns the EmployeeMutation object of the builder.

func (*EmployeeCreate) OnConflict

func (ec *EmployeeCreate) OnConflict(opts ...sql.ConflictOption) *EmployeeUpsertOne

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

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

func (*EmployeeCreate) OnConflictColumns

func (ec *EmployeeCreate) OnConflictColumns(columns ...string) *EmployeeUpsertOne

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

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

func (*EmployeeCreate) Save

func (ec *EmployeeCreate) Save(ctx context.Context) (*Employee, error)

Save creates the Employee in the database.

func (*EmployeeCreate) SaveX

func (ec *EmployeeCreate) SaveX(ctx context.Context) *Employee

SaveX calls Save and panics if Save returns an error.

func (*EmployeeCreate) SetBirthDate

func (ec *EmployeeCreate) SetBirthDate(t time.Time) *EmployeeCreate

SetBirthDate sets the "birth_date" field.

func (*EmployeeCreate) SetCreatedAt

func (ec *EmployeeCreate) SetCreatedAt(t time.Time) *EmployeeCreate

SetCreatedAt sets the "created_at" field.

func (*EmployeeCreate) SetDeletedAt

func (ec *EmployeeCreate) SetDeletedAt(t time.Time) *EmployeeCreate

SetDeletedAt sets the "deleted_at" field.

func (*EmployeeCreate) SetFirstName

func (ec *EmployeeCreate) SetFirstName(s string) *EmployeeCreate

SetFirstName sets the "first_name" field.

func (*EmployeeCreate) SetGender

func (ec *EmployeeCreate) SetGender(e employee.Gender) *EmployeeCreate

SetGender sets the "gender" field.

func (*EmployeeCreate) SetHireDate

func (ec *EmployeeCreate) SetHireDate(t time.Time) *EmployeeCreate

SetHireDate sets the "hire_date" field.

func (*EmployeeCreate) SetLastName

func (ec *EmployeeCreate) SetLastName(s string) *EmployeeCreate

SetLastName sets the "last_name" field.

func (*EmployeeCreate) SetNillableCreatedAt

func (ec *EmployeeCreate) SetNillableCreatedAt(t *time.Time) *EmployeeCreate

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

func (*EmployeeCreate) SetNillableDeletedAt

func (ec *EmployeeCreate) SetNillableDeletedAt(t *time.Time) *EmployeeCreate

SetNillableDeletedAt sets the "deleted_at" field if the given value is not nil.

func (*EmployeeCreate) SetNillableUpdatedAt

func (ec *EmployeeCreate) SetNillableUpdatedAt(t *time.Time) *EmployeeCreate

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

func (*EmployeeCreate) SetUpdatedAt

func (ec *EmployeeCreate) SetUpdatedAt(t time.Time) *EmployeeCreate

SetUpdatedAt sets the "updated_at" field.

type EmployeeCreateBulk

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

EmployeeCreateBulk is the builder for creating many Employee entities in bulk.

func (*EmployeeCreateBulk) Exec

func (ecb *EmployeeCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*EmployeeCreateBulk) ExecX

func (ecb *EmployeeCreateBulk) ExecX(ctx context.Context)

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

func (*EmployeeCreateBulk) OnConflict

func (ecb *EmployeeCreateBulk) OnConflict(opts ...sql.ConflictOption) *EmployeeUpsertBulk

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

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

func (*EmployeeCreateBulk) OnConflictColumns

func (ecb *EmployeeCreateBulk) OnConflictColumns(columns ...string) *EmployeeUpsertBulk

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

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

func (*EmployeeCreateBulk) Save

func (ecb *EmployeeCreateBulk) Save(ctx context.Context) ([]*Employee, error)

Save creates the Employee entities in the database.

func (*EmployeeCreateBulk) SaveX

func (ecb *EmployeeCreateBulk) SaveX(ctx context.Context) []*Employee

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

type EmployeeDelete

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

EmployeeDelete is the builder for deleting a Employee entity.

func (*EmployeeDelete) Exec

func (ed *EmployeeDelete) Exec(ctx context.Context) (int, error)

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

func (*EmployeeDelete) ExecX

func (ed *EmployeeDelete) ExecX(ctx context.Context) int

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

func (*EmployeeDelete) Where

func (ed *EmployeeDelete) Where(ps ...predicate.Employee) *EmployeeDelete

Where appends a list predicates to the EmployeeDelete builder.

type EmployeeDeleteOne

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

EmployeeDeleteOne is the builder for deleting a single Employee entity.

func (*EmployeeDeleteOne) Exec

func (edo *EmployeeDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*EmployeeDeleteOne) ExecX

func (edo *EmployeeDeleteOne) ExecX(ctx context.Context)

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

func (*EmployeeDeleteOne) Where

Where appends a list predicates to the EmployeeDelete builder.

type EmployeeEdges

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

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

func (EmployeeEdges) DeptManagerOrErr

func (e EmployeeEdges) DeptManagerOrErr() ([]*DeptManager, error)

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

type EmployeeGroupBy

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

EmployeeGroupBy is the group-by builder for Employee entities.

func (*EmployeeGroupBy) Aggregate

func (egb *EmployeeGroupBy) Aggregate(fns ...AggregateFunc) *EmployeeGroupBy

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

func (*EmployeeGroupBy) Bool

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

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

func (*EmployeeGroupBy) BoolX

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

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

func (*EmployeeGroupBy) Bools

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

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

func (*EmployeeGroupBy) BoolsX

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

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

func (*EmployeeGroupBy) Float64

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

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

func (*EmployeeGroupBy) Float64X

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

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

func (*EmployeeGroupBy) Float64s

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

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

func (*EmployeeGroupBy) Float64sX

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

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

func (*EmployeeGroupBy) Int

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

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

func (*EmployeeGroupBy) IntX

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

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

func (*EmployeeGroupBy) Ints

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

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

func (*EmployeeGroupBy) IntsX

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

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

func (*EmployeeGroupBy) Scan

func (egb *EmployeeGroupBy) Scan(ctx context.Context, v any) error

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

func (*EmployeeGroupBy) ScanX

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

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

func (*EmployeeGroupBy) String

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

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

func (*EmployeeGroupBy) StringX

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

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

func (*EmployeeGroupBy) Strings

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

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

func (*EmployeeGroupBy) StringsX

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

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

type EmployeeMutation

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

EmployeeMutation represents an operation that mutates the Employee nodes in the graph.

func (*EmployeeMutation) AddDeptManagerIDs

func (m *EmployeeMutation) AddDeptManagerIDs(ids ...int)

AddDeptManagerIDs adds the "dept_manager" edge to the DeptManager entity by ids.

func (*EmployeeMutation) AddField

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

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

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

func (*EmployeeMutation) AddedField

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

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

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

func (*EmployeeMutation) AddedIDs

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

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

func (*EmployeeMutation) BirthDate

func (m *EmployeeMutation) BirthDate() (r time.Time, exists bool)

BirthDate returns the value of the "birth_date" field in the mutation.

func (*EmployeeMutation) ClearDeletedAt

func (m *EmployeeMutation) ClearDeletedAt()

ClearDeletedAt clears the value of the "deleted_at" field.

func (*EmployeeMutation) ClearDeptManager

func (m *EmployeeMutation) ClearDeptManager()

ClearDeptManager clears the "dept_manager" edge to the DeptManager entity.

func (*EmployeeMutation) ClearEdge

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

func (m *EmployeeMutation) 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 (*EmployeeMutation) ClearedEdges

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

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

func (*EmployeeMutation) ClearedFields

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

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

func (EmployeeMutation) Client

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

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

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

func (*EmployeeMutation) DeletedAt

func (m *EmployeeMutation) DeletedAt() (r time.Time, exists bool)

DeletedAt returns the value of the "deleted_at" field in the mutation.

func (*EmployeeMutation) DeletedAtCleared

func (m *EmployeeMutation) DeletedAtCleared() bool

DeletedAtCleared returns if the "deleted_at" field was cleared in this mutation.

func (*EmployeeMutation) DeptManagerCleared

func (m *EmployeeMutation) DeptManagerCleared() bool

DeptManagerCleared reports if the "dept_manager" edge to the DeptManager entity was cleared.

func (*EmployeeMutation) DeptManagerIDs

func (m *EmployeeMutation) DeptManagerIDs() (ids []int)

DeptManagerIDs returns the "dept_manager" edge IDs in the mutation.

func (*EmployeeMutation) EdgeCleared

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

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

func (*EmployeeMutation) Field

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

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

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

func (*EmployeeMutation) Fields

func (m *EmployeeMutation) 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 (*EmployeeMutation) FirstName

func (m *EmployeeMutation) FirstName() (r string, exists bool)

FirstName returns the value of the "first_name" field in the mutation.

func (*EmployeeMutation) Gender

func (m *EmployeeMutation) Gender() (r employee.Gender, exists bool)

Gender returns the value of the "gender" field in the mutation.

func (*EmployeeMutation) HireDate

func (m *EmployeeMutation) HireDate() (r time.Time, exists bool)

HireDate returns the value of the "hire_date" field in the mutation.

func (*EmployeeMutation) ID

func (m *EmployeeMutation) 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 or after it was returned from the database.

func (*EmployeeMutation) IDs

func (m *EmployeeMutation) IDs(ctx context.Context) ([]int, error)

IDs queries the database and returns the entity ids that match the mutation's predicate. That means, if the mutation is applied within a transaction with an isolation level such as sql.LevelSerializable, the returned ids match the ids of the rows that will be updated or updated by the mutation.

func (*EmployeeMutation) LastName

func (m *EmployeeMutation) LastName() (r string, exists bool)

LastName returns the value of the "last_name" field in the mutation.

func (*EmployeeMutation) OldBirthDate

func (m *EmployeeMutation) OldBirthDate(ctx context.Context) (v time.Time, err error)

OldBirthDate returns the old "birth_date" field's value of the Employee entity. If the Employee 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 (*EmployeeMutation) OldCreatedAt

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

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

func (m *EmployeeMutation) OldDeletedAt(ctx context.Context) (v time.Time, err error)

OldDeletedAt returns the old "deleted_at" field's value of the Employee entity. If the Employee 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 (*EmployeeMutation) OldField

func (m *EmployeeMutation) OldField(ctx context.Context, name string) (ent.Value, error)

OldField returns the old value of the field from the database. An error is returned if the mutation operation is not UpdateOne, or the query to the database failed.

func (*EmployeeMutation) OldFirstName

func (m *EmployeeMutation) OldFirstName(ctx context.Context) (v string, err error)

OldFirstName returns the old "first_name" field's value of the Employee entity. If the Employee 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 (*EmployeeMutation) OldGender

func (m *EmployeeMutation) OldGender(ctx context.Context) (v employee.Gender, err error)

OldGender returns the old "gender" field's value of the Employee entity. If the Employee 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 (*EmployeeMutation) OldHireDate

func (m *EmployeeMutation) OldHireDate(ctx context.Context) (v time.Time, err error)

OldHireDate returns the old "hire_date" field's value of the Employee entity. If the Employee 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 (*EmployeeMutation) OldLastName

func (m *EmployeeMutation) OldLastName(ctx context.Context) (v string, err error)

OldLastName returns the old "last_name" field's value of the Employee entity. If the Employee 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 (*EmployeeMutation) OldUpdatedAt

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

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

func (m *EmployeeMutation) Op() Op

Op returns the operation name.

func (*EmployeeMutation) RemoveDeptManagerIDs

func (m *EmployeeMutation) RemoveDeptManagerIDs(ids ...int)

RemoveDeptManagerIDs removes the "dept_manager" edge to the DeptManager entity by IDs.

func (*EmployeeMutation) RemovedDeptManagerIDs

func (m *EmployeeMutation) RemovedDeptManagerIDs() (ids []int)

RemovedDeptManager returns the removed IDs of the "dept_manager" edge to the DeptManager entity.

func (*EmployeeMutation) RemovedEdges

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

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

func (*EmployeeMutation) RemovedIDs

func (m *EmployeeMutation) 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 (*EmployeeMutation) ResetBirthDate

func (m *EmployeeMutation) ResetBirthDate()

ResetBirthDate resets all changes to the "birth_date" field.

func (*EmployeeMutation) ResetCreatedAt

func (m *EmployeeMutation) ResetCreatedAt()

ResetCreatedAt resets all changes to the "created_at" field.

func (*EmployeeMutation) ResetDeletedAt

func (m *EmployeeMutation) ResetDeletedAt()

ResetDeletedAt resets all changes to the "deleted_at" field.

func (*EmployeeMutation) ResetDeptManager

func (m *EmployeeMutation) ResetDeptManager()

ResetDeptManager resets all changes to the "dept_manager" edge.

func (*EmployeeMutation) ResetEdge

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

func (m *EmployeeMutation) 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 (*EmployeeMutation) ResetFirstName

func (m *EmployeeMutation) ResetFirstName()

ResetFirstName resets all changes to the "first_name" field.

func (*EmployeeMutation) ResetGender

func (m *EmployeeMutation) ResetGender()

ResetGender resets all changes to the "gender" field.

func (*EmployeeMutation) ResetHireDate

func (m *EmployeeMutation) ResetHireDate()

ResetHireDate resets all changes to the "hire_date" field.

func (*EmployeeMutation) ResetLastName

func (m *EmployeeMutation) ResetLastName()

ResetLastName resets all changes to the "last_name" field.

func (*EmployeeMutation) ResetUpdatedAt

func (m *EmployeeMutation) ResetUpdatedAt()

ResetUpdatedAt resets all changes to the "updated_at" field.

func (*EmployeeMutation) SetBirthDate

func (m *EmployeeMutation) SetBirthDate(t time.Time)

SetBirthDate sets the "birth_date" field.

func (*EmployeeMutation) SetCreatedAt

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

SetCreatedAt sets the "created_at" field.

func (*EmployeeMutation) SetDeletedAt

func (m *EmployeeMutation) SetDeletedAt(t time.Time)

SetDeletedAt sets the "deleted_at" field.

func (*EmployeeMutation) SetField

func (m *EmployeeMutation) 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 (*EmployeeMutation) SetFirstName

func (m *EmployeeMutation) SetFirstName(s string)

SetFirstName sets the "first_name" field.

func (*EmployeeMutation) SetGender

func (m *EmployeeMutation) SetGender(e employee.Gender)

SetGender sets the "gender" field.

func (*EmployeeMutation) SetHireDate

func (m *EmployeeMutation) SetHireDate(t time.Time)

SetHireDate sets the "hire_date" field.

func (*EmployeeMutation) SetLastName

func (m *EmployeeMutation) SetLastName(s string)

SetLastName sets the "last_name" field.

func (*EmployeeMutation) SetOp

func (m *EmployeeMutation) SetOp(op Op)

SetOp allows setting the mutation operation.

func (*EmployeeMutation) SetUpdatedAt

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

SetUpdatedAt sets the "updated_at" field.

func (EmployeeMutation) Tx

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

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

func (*EmployeeMutation) Type

func (m *EmployeeMutation) Type() string

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

func (*EmployeeMutation) UpdatedAt

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

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

func (*EmployeeMutation) Where

func (m *EmployeeMutation) Where(ps ...predicate.Employee)

Where appends a list predicates to the EmployeeMutation builder.

func (*EmployeeMutation) WhereP

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

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

type EmployeeQuery

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

EmployeeQuery is the builder for querying Employee entities.

func (*EmployeeQuery) Aggregate

func (eq *EmployeeQuery) Aggregate(fns ...AggregateFunc) *EmployeeSelect

Aggregate returns a EmployeeSelect configured with the given aggregations.

func (*EmployeeQuery) All

func (eq *EmployeeQuery) All(ctx context.Context) ([]*Employee, error)

All executes the query and returns a list of Employees.

func (*EmployeeQuery) AllX

func (eq *EmployeeQuery) AllX(ctx context.Context) []*Employee

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

func (*EmployeeQuery) Clone

func (eq *EmployeeQuery) Clone() *EmployeeQuery

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

func (*EmployeeQuery) Count

func (eq *EmployeeQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*EmployeeQuery) CountX

func (eq *EmployeeQuery) CountX(ctx context.Context) int

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

func (*EmployeeQuery) Exist

func (eq *EmployeeQuery) Exist(ctx context.Context) (bool, error)

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

func (*EmployeeQuery) ExistX

func (eq *EmployeeQuery) ExistX(ctx context.Context) bool

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

func (*EmployeeQuery) First

func (eq *EmployeeQuery) First(ctx context.Context) (*Employee, error)

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

func (*EmployeeQuery) FirstID

func (eq *EmployeeQuery) FirstID(ctx context.Context) (id int, err error)

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

func (*EmployeeQuery) FirstIDX

func (eq *EmployeeQuery) FirstIDX(ctx context.Context) int

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

func (*EmployeeQuery) FirstX

func (eq *EmployeeQuery) FirstX(ctx context.Context) *Employee

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

func (*EmployeeQuery) GroupBy

func (eq *EmployeeQuery) GroupBy(field string, fields ...string) *EmployeeGroupBy

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

client.Employee.Query().
	GroupBy(employee.FieldBirthDate).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*EmployeeQuery) IDs

func (eq *EmployeeQuery) IDs(ctx context.Context) (ids []int, err error)

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

func (*EmployeeQuery) IDsX

func (eq *EmployeeQuery) IDsX(ctx context.Context) []int

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

func (*EmployeeQuery) Limit

func (eq *EmployeeQuery) Limit(limit int) *EmployeeQuery

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

func (*EmployeeQuery) Offset

func (eq *EmployeeQuery) Offset(offset int) *EmployeeQuery

Offset to start from.

func (*EmployeeQuery) Only

func (eq *EmployeeQuery) Only(ctx context.Context) (*Employee, error)

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

func (*EmployeeQuery) OnlyID

func (eq *EmployeeQuery) OnlyID(ctx context.Context) (id int, err error)

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

func (*EmployeeQuery) OnlyIDX

func (eq *EmployeeQuery) OnlyIDX(ctx context.Context) int

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

func (*EmployeeQuery) OnlyX

func (eq *EmployeeQuery) OnlyX(ctx context.Context) *Employee

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

func (*EmployeeQuery) Order

Order specifies how the records should be ordered.

func (*EmployeeQuery) QueryDeptManager

func (eq *EmployeeQuery) QueryDeptManager() *DeptManagerQuery

QueryDeptManager chains the current query on the "dept_manager" edge.

func (*EmployeeQuery) Select

func (eq *EmployeeQuery) Select(fields ...string) *EmployeeSelect

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

client.Employee.Query().
	Select(employee.FieldBirthDate).
	Scan(ctx, &v)

func (*EmployeeQuery) Unique

func (eq *EmployeeQuery) Unique(unique bool) *EmployeeQuery

Unique configures the query builder to filter duplicate records on query. By default, unique is set to true, and can be disabled using this method.

func (*EmployeeQuery) Where

func (eq *EmployeeQuery) Where(ps ...predicate.Employee) *EmployeeQuery

Where adds a new predicate for the EmployeeQuery builder.

func (*EmployeeQuery) WithDeptManager

func (eq *EmployeeQuery) WithDeptManager(opts ...func(*DeptManagerQuery)) *EmployeeQuery

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

type EmployeeSelect

type EmployeeSelect struct {
	*EmployeeQuery
	// contains filtered or unexported fields
}

EmployeeSelect is the builder for selecting fields of Employee entities.

func (*EmployeeSelect) Aggregate

func (es *EmployeeSelect) Aggregate(fns ...AggregateFunc) *EmployeeSelect

Aggregate adds the given aggregation functions to the selector query.

func (*EmployeeSelect) Bool

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

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

func (*EmployeeSelect) BoolX

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

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

func (*EmployeeSelect) Bools

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

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

func (*EmployeeSelect) BoolsX

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

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

func (*EmployeeSelect) Float64

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

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

func (*EmployeeSelect) Float64X

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

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

func (*EmployeeSelect) Float64s

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

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

func (*EmployeeSelect) Float64sX

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

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

func (*EmployeeSelect) Int

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

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

func (*EmployeeSelect) IntX

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

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

func (*EmployeeSelect) Ints

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

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

func (*EmployeeSelect) IntsX

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

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

func (*EmployeeSelect) Scan

func (es *EmployeeSelect) Scan(ctx context.Context, v any) error

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

func (*EmployeeSelect) ScanX

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

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

func (*EmployeeSelect) String

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

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

func (*EmployeeSelect) StringX

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

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

func (*EmployeeSelect) Strings

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

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

func (*EmployeeSelect) StringsX

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

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

type EmployeeUpdate

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

EmployeeUpdate is the builder for updating Employee entities.

func (*EmployeeUpdate) AddDeptManager

func (eu *EmployeeUpdate) AddDeptManager(d ...*DeptManager) *EmployeeUpdate

AddDeptManager adds the "dept_manager" edges to the DeptManager entity.

func (*EmployeeUpdate) AddDeptManagerIDs

func (eu *EmployeeUpdate) AddDeptManagerIDs(ids ...int) *EmployeeUpdate

AddDeptManagerIDs adds the "dept_manager" edge to the DeptManager entity by IDs.

func (*EmployeeUpdate) ClearDeletedAt

func (eu *EmployeeUpdate) ClearDeletedAt() *EmployeeUpdate

ClearDeletedAt clears the value of the "deleted_at" field.

func (*EmployeeUpdate) ClearDeptManager

func (eu *EmployeeUpdate) ClearDeptManager() *EmployeeUpdate

ClearDeptManager clears all "dept_manager" edges to the DeptManager entity.

func (*EmployeeUpdate) Exec

func (eu *EmployeeUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*EmployeeUpdate) ExecX

func (eu *EmployeeUpdate) ExecX(ctx context.Context)

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

func (*EmployeeUpdate) Mutation

func (eu *EmployeeUpdate) Mutation() *EmployeeMutation

Mutation returns the EmployeeMutation object of the builder.

func (*EmployeeUpdate) RemoveDeptManager

func (eu *EmployeeUpdate) RemoveDeptManager(d ...*DeptManager) *EmployeeUpdate

RemoveDeptManager removes "dept_manager" edges to DeptManager entities.

func (*EmployeeUpdate) RemoveDeptManagerIDs

func (eu *EmployeeUpdate) RemoveDeptManagerIDs(ids ...int) *EmployeeUpdate

RemoveDeptManagerIDs removes the "dept_manager" edge to DeptManager entities by IDs.

func (*EmployeeUpdate) Save

func (eu *EmployeeUpdate) Save(ctx context.Context) (int, error)

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

func (*EmployeeUpdate) SaveX

func (eu *EmployeeUpdate) SaveX(ctx context.Context) int

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

func (*EmployeeUpdate) SetBirthDate

func (eu *EmployeeUpdate) SetBirthDate(t time.Time) *EmployeeUpdate

SetBirthDate sets the "birth_date" field.

func (*EmployeeUpdate) SetCreatedAt

func (eu *EmployeeUpdate) SetCreatedAt(t time.Time) *EmployeeUpdate

SetCreatedAt sets the "created_at" field.

func (*EmployeeUpdate) SetDeletedAt

func (eu *EmployeeUpdate) SetDeletedAt(t time.Time) *EmployeeUpdate

SetDeletedAt sets the "deleted_at" field.

func (*EmployeeUpdate) SetFirstName

func (eu *EmployeeUpdate) SetFirstName(s string) *EmployeeUpdate

SetFirstName sets the "first_name" field.

func (*EmployeeUpdate) SetGender

func (eu *EmployeeUpdate) SetGender(e employee.Gender) *EmployeeUpdate

SetGender sets the "gender" field.

func (*EmployeeUpdate) SetHireDate

func (eu *EmployeeUpdate) SetHireDate(t time.Time) *EmployeeUpdate

SetHireDate sets the "hire_date" field.

func (*EmployeeUpdate) SetLastName

func (eu *EmployeeUpdate) SetLastName(s string) *EmployeeUpdate

SetLastName sets the "last_name" field.

func (*EmployeeUpdate) SetNillableCreatedAt

func (eu *EmployeeUpdate) SetNillableCreatedAt(t *time.Time) *EmployeeUpdate

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

func (*EmployeeUpdate) SetNillableDeletedAt

func (eu *EmployeeUpdate) SetNillableDeletedAt(t *time.Time) *EmployeeUpdate

SetNillableDeletedAt sets the "deleted_at" field if the given value is not nil.

func (*EmployeeUpdate) SetNillableUpdatedAt

func (eu *EmployeeUpdate) SetNillableUpdatedAt(t *time.Time) *EmployeeUpdate

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

func (*EmployeeUpdate) SetUpdatedAt

func (eu *EmployeeUpdate) SetUpdatedAt(t time.Time) *EmployeeUpdate

SetUpdatedAt sets the "updated_at" field.

func (*EmployeeUpdate) Where

func (eu *EmployeeUpdate) Where(ps ...predicate.Employee) *EmployeeUpdate

Where appends a list predicates to the EmployeeUpdate builder.

type EmployeeUpdateOne

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

EmployeeUpdateOne is the builder for updating a single Employee entity.

func (*EmployeeUpdateOne) AddDeptManager

func (euo *EmployeeUpdateOne) AddDeptManager(d ...*DeptManager) *EmployeeUpdateOne

AddDeptManager adds the "dept_manager" edges to the DeptManager entity.

func (*EmployeeUpdateOne) AddDeptManagerIDs

func (euo *EmployeeUpdateOne) AddDeptManagerIDs(ids ...int) *EmployeeUpdateOne

AddDeptManagerIDs adds the "dept_manager" edge to the DeptManager entity by IDs.

func (*EmployeeUpdateOne) ClearDeletedAt

func (euo *EmployeeUpdateOne) ClearDeletedAt() *EmployeeUpdateOne

ClearDeletedAt clears the value of the "deleted_at" field.

func (*EmployeeUpdateOne) ClearDeptManager

func (euo *EmployeeUpdateOne) ClearDeptManager() *EmployeeUpdateOne

ClearDeptManager clears all "dept_manager" edges to the DeptManager entity.

func (*EmployeeUpdateOne) Exec

func (euo *EmployeeUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*EmployeeUpdateOne) ExecX

func (euo *EmployeeUpdateOne) ExecX(ctx context.Context)

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

func (*EmployeeUpdateOne) Mutation

func (euo *EmployeeUpdateOne) Mutation() *EmployeeMutation

Mutation returns the EmployeeMutation object of the builder.

func (*EmployeeUpdateOne) RemoveDeptManager

func (euo *EmployeeUpdateOne) RemoveDeptManager(d ...*DeptManager) *EmployeeUpdateOne

RemoveDeptManager removes "dept_manager" edges to DeptManager entities.

func (*EmployeeUpdateOne) RemoveDeptManagerIDs

func (euo *EmployeeUpdateOne) RemoveDeptManagerIDs(ids ...int) *EmployeeUpdateOne

RemoveDeptManagerIDs removes the "dept_manager" edge to DeptManager entities by IDs.

func (*EmployeeUpdateOne) Save

func (euo *EmployeeUpdateOne) Save(ctx context.Context) (*Employee, error)

Save executes the query and returns the updated Employee entity.

func (*EmployeeUpdateOne) SaveX

func (euo *EmployeeUpdateOne) SaveX(ctx context.Context) *Employee

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

func (*EmployeeUpdateOne) Select

func (euo *EmployeeUpdateOne) Select(field string, fields ...string) *EmployeeUpdateOne

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

func (*EmployeeUpdateOne) SetBirthDate

func (euo *EmployeeUpdateOne) SetBirthDate(t time.Time) *EmployeeUpdateOne

SetBirthDate sets the "birth_date" field.

func (*EmployeeUpdateOne) SetCreatedAt

func (euo *EmployeeUpdateOne) SetCreatedAt(t time.Time) *EmployeeUpdateOne

SetCreatedAt sets the "created_at" field.

func (*EmployeeUpdateOne) SetDeletedAt

func (euo *EmployeeUpdateOne) SetDeletedAt(t time.Time) *EmployeeUpdateOne

SetDeletedAt sets the "deleted_at" field.

func (*EmployeeUpdateOne) SetFirstName

func (euo *EmployeeUpdateOne) SetFirstName(s string) *EmployeeUpdateOne

SetFirstName sets the "first_name" field.

func (*EmployeeUpdateOne) SetGender

SetGender sets the "gender" field.

func (*EmployeeUpdateOne) SetHireDate

func (euo *EmployeeUpdateOne) SetHireDate(t time.Time) *EmployeeUpdateOne

SetHireDate sets the "hire_date" field.

func (*EmployeeUpdateOne) SetLastName

func (euo *EmployeeUpdateOne) SetLastName(s string) *EmployeeUpdateOne

SetLastName sets the "last_name" field.

func (*EmployeeUpdateOne) SetNillableCreatedAt

func (euo *EmployeeUpdateOne) SetNillableCreatedAt(t *time.Time) *EmployeeUpdateOne

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

func (*EmployeeUpdateOne) SetNillableDeletedAt

func (euo *EmployeeUpdateOne) SetNillableDeletedAt(t *time.Time) *EmployeeUpdateOne

SetNillableDeletedAt sets the "deleted_at" field if the given value is not nil.

func (*EmployeeUpdateOne) SetNillableUpdatedAt

func (euo *EmployeeUpdateOne) SetNillableUpdatedAt(t *time.Time) *EmployeeUpdateOne

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

func (*EmployeeUpdateOne) SetUpdatedAt

func (euo *EmployeeUpdateOne) SetUpdatedAt(t time.Time) *EmployeeUpdateOne

SetUpdatedAt sets the "updated_at" field.

func (*EmployeeUpdateOne) Where

Where appends a list predicates to the EmployeeUpdate builder.

type EmployeeUpsert

type EmployeeUpsert struct {
	*sql.UpdateSet
}

EmployeeUpsert is the "OnConflict" setter.

func (*EmployeeUpsert) ClearDeletedAt

func (u *EmployeeUpsert) ClearDeletedAt() *EmployeeUpsert

ClearDeletedAt clears the value of the "deleted_at" field.

func (*EmployeeUpsert) SetBirthDate

func (u *EmployeeUpsert) SetBirthDate(v time.Time) *EmployeeUpsert

SetBirthDate sets the "birth_date" field.

func (*EmployeeUpsert) SetCreatedAt

func (u *EmployeeUpsert) SetCreatedAt(v time.Time) *EmployeeUpsert

SetCreatedAt sets the "created_at" field.

func (*EmployeeUpsert) SetDeletedAt

func (u *EmployeeUpsert) SetDeletedAt(v time.Time) *EmployeeUpsert

SetDeletedAt sets the "deleted_at" field.

func (*EmployeeUpsert) SetFirstName

func (u *EmployeeUpsert) SetFirstName(v string) *EmployeeUpsert

SetFirstName sets the "first_name" field.

func (*EmployeeUpsert) SetGender

func (u *EmployeeUpsert) SetGender(v employee.Gender) *EmployeeUpsert

SetGender sets the "gender" field.

func (*EmployeeUpsert) SetHireDate

func (u *EmployeeUpsert) SetHireDate(v time.Time) *EmployeeUpsert

SetHireDate sets the "hire_date" field.

func (*EmployeeUpsert) SetLastName

func (u *EmployeeUpsert) SetLastName(v string) *EmployeeUpsert

SetLastName sets the "last_name" field.

func (*EmployeeUpsert) SetUpdatedAt

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

SetUpdatedAt sets the "updated_at" field.

func (*EmployeeUpsert) UpdateBirthDate

func (u *EmployeeUpsert) UpdateBirthDate() *EmployeeUpsert

UpdateBirthDate sets the "birth_date" field to the value that was provided on create.

func (*EmployeeUpsert) UpdateCreatedAt

func (u *EmployeeUpsert) UpdateCreatedAt() *EmployeeUpsert

UpdateCreatedAt sets the "created_at" field to the value that was provided on create.

func (*EmployeeUpsert) UpdateDeletedAt

func (u *EmployeeUpsert) UpdateDeletedAt() *EmployeeUpsert

UpdateDeletedAt sets the "deleted_at" field to the value that was provided on create.

func (*EmployeeUpsert) UpdateFirstName

func (u *EmployeeUpsert) UpdateFirstName() *EmployeeUpsert

UpdateFirstName sets the "first_name" field to the value that was provided on create.

func (*EmployeeUpsert) UpdateGender

func (u *EmployeeUpsert) UpdateGender() *EmployeeUpsert

UpdateGender sets the "gender" field to the value that was provided on create.

func (*EmployeeUpsert) UpdateHireDate

func (u *EmployeeUpsert) UpdateHireDate() *EmployeeUpsert

UpdateHireDate sets the "hire_date" field to the value that was provided on create.

func (*EmployeeUpsert) UpdateLastName

func (u *EmployeeUpsert) UpdateLastName() *EmployeeUpsert

UpdateLastName sets the "last_name" field to the value that was provided on create.

func (*EmployeeUpsert) UpdateUpdatedAt

func (u *EmployeeUpsert) UpdateUpdatedAt() *EmployeeUpsert

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

type EmployeeUpsertBulk

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

EmployeeUpsertBulk is the builder for "upsert"-ing a bulk of Employee nodes.

func (*EmployeeUpsertBulk) ClearDeletedAt

func (u *EmployeeUpsertBulk) ClearDeletedAt() *EmployeeUpsertBulk

ClearDeletedAt clears the value of the "deleted_at" field.

func (*EmployeeUpsertBulk) DoNothing

func (u *EmployeeUpsertBulk) DoNothing() *EmployeeUpsertBulk

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

func (*EmployeeUpsertBulk) Exec

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

Exec executes the query.

func (*EmployeeUpsertBulk) ExecX

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

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

func (*EmployeeUpsertBulk) Ignore

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

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

func (*EmployeeUpsertBulk) SetBirthDate

func (u *EmployeeUpsertBulk) SetBirthDate(v time.Time) *EmployeeUpsertBulk

SetBirthDate sets the "birth_date" field.

func (*EmployeeUpsertBulk) SetCreatedAt

func (u *EmployeeUpsertBulk) SetCreatedAt(v time.Time) *EmployeeUpsertBulk

SetCreatedAt sets the "created_at" field.

func (*EmployeeUpsertBulk) SetDeletedAt

func (u *EmployeeUpsertBulk) SetDeletedAt(v time.Time) *EmployeeUpsertBulk

SetDeletedAt sets the "deleted_at" field.

func (*EmployeeUpsertBulk) SetFirstName

func (u *EmployeeUpsertBulk) SetFirstName(v string) *EmployeeUpsertBulk

SetFirstName sets the "first_name" field.

func (*EmployeeUpsertBulk) SetGender

SetGender sets the "gender" field.

func (*EmployeeUpsertBulk) SetHireDate

func (u *EmployeeUpsertBulk) SetHireDate(v time.Time) *EmployeeUpsertBulk

SetHireDate sets the "hire_date" field.

func (*EmployeeUpsertBulk) SetLastName

func (u *EmployeeUpsertBulk) SetLastName(v string) *EmployeeUpsertBulk

SetLastName sets the "last_name" field.

func (*EmployeeUpsertBulk) SetUpdatedAt

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

SetUpdatedAt sets the "updated_at" field.

func (*EmployeeUpsertBulk) Update

func (u *EmployeeUpsertBulk) Update(set func(*EmployeeUpsert)) *EmployeeUpsertBulk

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

func (*EmployeeUpsertBulk) UpdateBirthDate

func (u *EmployeeUpsertBulk) UpdateBirthDate() *EmployeeUpsertBulk

UpdateBirthDate sets the "birth_date" field to the value that was provided on create.

func (*EmployeeUpsertBulk) UpdateCreatedAt

func (u *EmployeeUpsertBulk) UpdateCreatedAt() *EmployeeUpsertBulk

UpdateCreatedAt sets the "created_at" field to the value that was provided on create.

func (*EmployeeUpsertBulk) UpdateDeletedAt

func (u *EmployeeUpsertBulk) UpdateDeletedAt() *EmployeeUpsertBulk

UpdateDeletedAt sets the "deleted_at" field to the value that was provided on create.

func (*EmployeeUpsertBulk) UpdateFirstName

func (u *EmployeeUpsertBulk) UpdateFirstName() *EmployeeUpsertBulk

UpdateFirstName sets the "first_name" field to the value that was provided on create.

func (*EmployeeUpsertBulk) UpdateGender

func (u *EmployeeUpsertBulk) UpdateGender() *EmployeeUpsertBulk

UpdateGender sets the "gender" field to the value that was provided on create.

func (*EmployeeUpsertBulk) UpdateHireDate

func (u *EmployeeUpsertBulk) UpdateHireDate() *EmployeeUpsertBulk

UpdateHireDate sets the "hire_date" field to the value that was provided on create.

func (*EmployeeUpsertBulk) UpdateLastName

func (u *EmployeeUpsertBulk) UpdateLastName() *EmployeeUpsertBulk

UpdateLastName sets the "last_name" field to the value that was provided on create.

func (*EmployeeUpsertBulk) UpdateNewValues

func (u *EmployeeUpsertBulk) UpdateNewValues() *EmployeeUpsertBulk

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

client.Employee.Create().
	OnConflict(
		sql.ResolveWithNewValues(),
	).
	Exec(ctx)

func (*EmployeeUpsertBulk) UpdateUpdatedAt

func (u *EmployeeUpsertBulk) UpdateUpdatedAt() *EmployeeUpsertBulk

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

type EmployeeUpsertOne

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

EmployeeUpsertOne is the builder for "upsert"-ing

one Employee node.

func (*EmployeeUpsertOne) ClearDeletedAt

func (u *EmployeeUpsertOne) ClearDeletedAt() *EmployeeUpsertOne

ClearDeletedAt clears the value of the "deleted_at" field.

func (*EmployeeUpsertOne) DoNothing

func (u *EmployeeUpsertOne) DoNothing() *EmployeeUpsertOne

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

func (*EmployeeUpsertOne) Exec

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

Exec executes the query.

func (*EmployeeUpsertOne) ExecX

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

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

func (*EmployeeUpsertOne) ID

func (u *EmployeeUpsertOne) ID(ctx context.Context) (id int, err error)

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

func (*EmployeeUpsertOne) IDX

func (u *EmployeeUpsertOne) IDX(ctx context.Context) int

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

func (*EmployeeUpsertOne) Ignore

func (u *EmployeeUpsertOne) Ignore() *EmployeeUpsertOne

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

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

func (*EmployeeUpsertOne) SetBirthDate

func (u *EmployeeUpsertOne) SetBirthDate(v time.Time) *EmployeeUpsertOne

SetBirthDate sets the "birth_date" field.

func (*EmployeeUpsertOne) SetCreatedAt

func (u *EmployeeUpsertOne) SetCreatedAt(v time.Time) *EmployeeUpsertOne

SetCreatedAt sets the "created_at" field.

func (*EmployeeUpsertOne) SetDeletedAt

func (u *EmployeeUpsertOne) SetDeletedAt(v time.Time) *EmployeeUpsertOne

SetDeletedAt sets the "deleted_at" field.

func (*EmployeeUpsertOne) SetFirstName

func (u *EmployeeUpsertOne) SetFirstName(v string) *EmployeeUpsertOne

SetFirstName sets the "first_name" field.

func (*EmployeeUpsertOne) SetGender

SetGender sets the "gender" field.

func (*EmployeeUpsertOne) SetHireDate

func (u *EmployeeUpsertOne) SetHireDate(v time.Time) *EmployeeUpsertOne

SetHireDate sets the "hire_date" field.

func (*EmployeeUpsertOne) SetLastName

func (u *EmployeeUpsertOne) SetLastName(v string) *EmployeeUpsertOne

SetLastName sets the "last_name" field.

func (*EmployeeUpsertOne) SetUpdatedAt

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

SetUpdatedAt sets the "updated_at" field.

func (*EmployeeUpsertOne) Update

func (u *EmployeeUpsertOne) Update(set func(*EmployeeUpsert)) *EmployeeUpsertOne

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

func (*EmployeeUpsertOne) UpdateBirthDate

func (u *EmployeeUpsertOne) UpdateBirthDate() *EmployeeUpsertOne

UpdateBirthDate sets the "birth_date" field to the value that was provided on create.

func (*EmployeeUpsertOne) UpdateCreatedAt

func (u *EmployeeUpsertOne) UpdateCreatedAt() *EmployeeUpsertOne

UpdateCreatedAt sets the "created_at" field to the value that was provided on create.

func (*EmployeeUpsertOne) UpdateDeletedAt

func (u *EmployeeUpsertOne) UpdateDeletedAt() *EmployeeUpsertOne

UpdateDeletedAt sets the "deleted_at" field to the value that was provided on create.

func (*EmployeeUpsertOne) UpdateFirstName

func (u *EmployeeUpsertOne) UpdateFirstName() *EmployeeUpsertOne

UpdateFirstName sets the "first_name" field to the value that was provided on create.

func (*EmployeeUpsertOne) UpdateGender

func (u *EmployeeUpsertOne) UpdateGender() *EmployeeUpsertOne

UpdateGender sets the "gender" field to the value that was provided on create.

func (*EmployeeUpsertOne) UpdateHireDate

func (u *EmployeeUpsertOne) UpdateHireDate() *EmployeeUpsertOne

UpdateHireDate sets the "hire_date" field to the value that was provided on create.

func (*EmployeeUpsertOne) UpdateLastName

func (u *EmployeeUpsertOne) UpdateLastName() *EmployeeUpsertOne

UpdateLastName sets the "last_name" field to the value that was provided on create.

func (*EmployeeUpsertOne) UpdateNewValues

func (u *EmployeeUpsertOne) UpdateNewValues() *EmployeeUpsertOne

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

client.Employee.Create().
	OnConflict(
		sql.ResolveWithNewValues(),
	).
	Exec(ctx)

func (*EmployeeUpsertOne) UpdateUpdatedAt

func (u *EmployeeUpsertOne) UpdateUpdatedAt() *EmployeeUpsertOne

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

type Employees

type Employees []*Employee

Employees is a parsable slice of Employee.

type Hook

type Hook = ent.Hook

ent aliases to avoid import conflicts in user's code.

type InterceptFunc

type InterceptFunc = ent.InterceptFunc

ent aliases to avoid import conflicts in user's code.

type Interceptor

type Interceptor = ent.Interceptor

ent aliases to avoid import conflicts in user's code.

type MutateFunc

type MutateFunc = ent.MutateFunc

ent aliases to avoid import conflicts in user's code.

type Mutation

type Mutation = ent.Mutation

ent aliases to avoid import conflicts in user's code.

type Mutator

type Mutator = ent.Mutator

ent aliases to avoid import conflicts in user's code.

type NotFoundError

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

NotFoundError returns when trying to fetch a specific entity and it was not found in the database.

func (*NotFoundError) Error

func (e *NotFoundError) Error() string

Error implements the error interface.

type NotLoadedError

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

NotLoadedError returns when trying to get a node that was not loaded by the query.

func (*NotLoadedError) Error

func (e *NotLoadedError) Error() string

Error implements the error interface.

type NotSingularError

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

NotSingularError returns when trying to fetch a singular entity and more then one was found in the database.

func (*NotSingularError) Error

func (e *NotSingularError) Error() string

Error implements the error interface.

type Op

type Op = ent.Op

ent aliases to avoid import conflicts in user's code.

type Option

type Option func(*config)

Option function to configure the client.

func Debug

func Debug() Option

Debug enables debug logging on the ent.Driver.

func Driver

func Driver(driver dialect.Driver) Option

Driver configures the client driver.

func Log

func Log(fn func(...any)) Option

Log sets the logging function for debug mode.

type OrderFunc

type OrderFunc func(*sql.Selector)

OrderFunc applies an ordering on the sql selector. Deprecated: Use Asc/Desc functions or the package builders instead.

type Policy

type Policy = ent.Policy

ent aliases to avoid import conflicts in user's code.

type Querier

type Querier = ent.Querier

ent aliases to avoid import conflicts in user's code.

type QuerierFunc

type QuerierFunc = ent.QuerierFunc

ent aliases to avoid import conflicts in user's code.

type Query

type Query = ent.Query

ent aliases to avoid import conflicts in user's code.

type QueryContext

type QueryContext = ent.QueryContext

ent aliases to avoid import conflicts in user's code.

type RollbackFunc

type RollbackFunc func(context.Context, *Tx) error

The RollbackFunc type is an adapter to allow the use of ordinary function as a Rollbacker. If f is a function with the appropriate signature, RollbackFunc(f) is a Rollbacker that calls f.

func (RollbackFunc) Rollback

func (f RollbackFunc) Rollback(ctx context.Context, tx *Tx) error

Rollback calls f(ctx, m).

type RollbackHook

type RollbackHook func(Rollbacker) Rollbacker

RollbackHook defines the "rollback middleware". A function that gets a Rollbacker and returns a Rollbacker. For example:

hook := func(next ent.Rollbacker) ent.Rollbacker {
	return ent.RollbackFunc(func(ctx context.Context, tx *ent.Tx) error {
		// Do some stuff before.
		if err := next.Rollback(ctx, tx); err != nil {
			return err
		}
		// Do some stuff after.
		return nil
	})
}

type Rollbacker

type Rollbacker interface {
	Rollback(context.Context, *Tx) error
}

Rollbacker is the interface that wraps the Rollback method.

type TraverseFunc

type TraverseFunc = ent.TraverseFunc

ent aliases to avoid import conflicts in user's code.

type Traverser

type Traverser = ent.Traverser

ent aliases to avoid import conflicts in user's code.

type Tx

type Tx struct {

	// Department is the client for interacting with the Department builders.
	Department *DepartmentClient
	// DeptManager is the client for interacting with the DeptManager builders.
	DeptManager *DeptManagerClient
	// Employee is the client for interacting with the Employee builders.
	Employee *EmployeeClient
	// contains filtered or unexported fields
}

Tx is a transactional client that is created by calling Client.Tx().

func TxFromContext

func TxFromContext(ctx context.Context) *Tx

TxFromContext returns a Tx stored inside a context, or nil if there isn't one.

func (*Tx) Client

func (tx *Tx) Client() *Client

Client returns a Client that binds to current transaction.

func (*Tx) Commit

func (tx *Tx) Commit() error

Commit commits the transaction.

func (*Tx) OnCommit

func (tx *Tx) OnCommit(f CommitHook)

OnCommit adds a hook to call on commit.

func (*Tx) OnRollback

func (tx *Tx) OnRollback(f RollbackHook)

OnRollback adds a hook to call on rollback.

func (*Tx) Rollback

func (tx *Tx) Rollback() error

Rollback rollbacks the transaction.

type ValidationError

type ValidationError struct {
	Name string // Field or edge name.
	// contains filtered or unexported fields
}

ValidationError returns when validating a field or edge fails.

func (*ValidationError) Error

func (e *ValidationError) Error() string

Error implements the error interface.

func (*ValidationError) Unwrap

func (e *ValidationError) Unwrap() error

Unwrap implements the errors.Wrapper interface.

type Value

type Value = ent.Value

ent aliases to avoid import conflicts in user's code.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL