Documentation ¶
Index ¶
- Constants
- Variables
- func IsConstraintError(err error) bool
- func IsNotFound(err error) bool
- func IsNotLoaded(err error) bool
- func IsNotSingular(err error) bool
- func IsValidationError(err error) bool
- func MaskNotFound(err error) error
- func NewContext(parent context.Context, c *Client) context.Context
- func NewTxContext(parent context.Context, tx *Tx) context.Context
- func OpenTxFromContext(ctx context.Context) (context.Context, driver.Tx, error)
- type AggregateFunc
- type Client
- func (c *Client) BeginTx(ctx context.Context, opts *sql.TxOptions) (*Tx, error)
- func (c *Client) Close() error
- func (c *Client) Debug() *Client
- func (c *Client) Node(ctx context.Context, id int) (*Node, error)
- func (c *Client) Noder(ctx context.Context, id int, opts ...NodeOption) (_ Noder, err error)
- func (c *Client) Noders(ctx context.Context, ids []int, opts ...NodeOption) ([]Noder, error)
- func (c *Client) OpenTx(ctx context.Context) (context.Context, driver.Tx, error)
- func (c *Client) Tx(ctx context.Context) (*Tx, error)
- func (c *Client) Use(hooks ...Hook)
- type CommitFunc
- type CommitHook
- type Committer
- type ConstraintError
- type Cursor
- type Edge
- type Field
- type Hook
- type MutateFunc
- type Mutation
- type Mutator
- type Node
- type NodeOption
- type Noder
- type NotFoundError
- type NotLoadedError
- type NotSingularError
- type Op
- type Option
- type OrderDirection
- type OrderFunc
- type OtherTest
- type OtherTestClient
- func (c *OtherTestClient) Create() *OtherTestCreate
- func (c *OtherTestClient) CreateBulk(builders ...*OtherTestCreate) *OtherTestCreateBulk
- func (c *OtherTestClient) Delete() *OtherTestDelete
- func (c *OtherTestClient) DeleteOne(ot *OtherTest) *OtherTestDeleteOne
- func (c *OtherTestClient) DeleteOneID(id int) *OtherTestDeleteOne
- func (c *OtherTestClient) Get(ctx context.Context, id int) (*OtherTest, error)
- func (c *OtherTestClient) GetX(ctx context.Context, id int) *OtherTest
- func (c *OtherTestClient) Hooks() []Hook
- func (c *OtherTestClient) Query() *OtherTestQuery
- func (c *OtherTestClient) Update() *OtherTestUpdate
- func (c *OtherTestClient) UpdateOne(ot *OtherTest) *OtherTestUpdateOne
- func (c *OtherTestClient) UpdateOneID(id int) *OtherTestUpdateOne
- func (c *OtherTestClient) Use(hooks ...Hook)
- type OtherTestConnection
- type OtherTestCreate
- func (otc *OtherTestCreate) Exec(ctx context.Context) error
- func (otc *OtherTestCreate) ExecX(ctx context.Context)
- func (otc *OtherTestCreate) Mutation() *OtherTestMutation
- func (otc *OtherTestCreate) Save(ctx context.Context) (*OtherTest, error)
- func (otc *OtherTestCreate) SaveX(ctx context.Context) *OtherTest
- func (otc *OtherTestCreate) SetTest(o othertest.Test) *OtherTestCreate
- type OtherTestCreateBulk
- type OtherTestDelete
- type OtherTestDeleteOne
- type OtherTestEdge
- type OtherTestGroupBy
- func (otgb *OtherTestGroupBy) Aggregate(fns ...AggregateFunc) *OtherTestGroupBy
- func (otgb *OtherTestGroupBy) Bool(ctx context.Context) (_ bool, err error)
- func (otgb *OtherTestGroupBy) BoolX(ctx context.Context) bool
- func (otgb *OtherTestGroupBy) Bools(ctx context.Context) ([]bool, error)
- func (otgb *OtherTestGroupBy) BoolsX(ctx context.Context) []bool
- func (otgb *OtherTestGroupBy) Float64(ctx context.Context) (_ float64, err error)
- func (otgb *OtherTestGroupBy) Float64X(ctx context.Context) float64
- func (otgb *OtherTestGroupBy) Float64s(ctx context.Context) ([]float64, error)
- func (otgb *OtherTestGroupBy) Float64sX(ctx context.Context) []float64
- func (otgb *OtherTestGroupBy) Int(ctx context.Context) (_ int, err error)
- func (otgb *OtherTestGroupBy) IntX(ctx context.Context) int
- func (otgb *OtherTestGroupBy) Ints(ctx context.Context) ([]int, error)
- func (otgb *OtherTestGroupBy) IntsX(ctx context.Context) []int
- func (otgb *OtherTestGroupBy) Scan(ctx context.Context, v interface{}) error
- func (otgb *OtherTestGroupBy) ScanX(ctx context.Context, v interface{})
- func (otgb *OtherTestGroupBy) String(ctx context.Context) (_ string, err error)
- func (otgb *OtherTestGroupBy) StringX(ctx context.Context) string
- func (otgb *OtherTestGroupBy) Strings(ctx context.Context) ([]string, error)
- func (otgb *OtherTestGroupBy) StringsX(ctx context.Context) []string
- type OtherTestMutation
- func (m *OtherTestMutation) AddField(name string, value ent.Value) error
- func (m *OtherTestMutation) AddedEdges() []string
- func (m *OtherTestMutation) AddedField(name string) (ent.Value, bool)
- func (m *OtherTestMutation) AddedFields() []string
- func (m *OtherTestMutation) AddedIDs(name string) []ent.Value
- func (m *OtherTestMutation) ClearEdge(name string) error
- func (m *OtherTestMutation) ClearField(name string) error
- func (m *OtherTestMutation) ClearedEdges() []string
- func (m *OtherTestMutation) ClearedFields() []string
- func (m OtherTestMutation) Client() *Client
- func (m *OtherTestMutation) EdgeCleared(name string) bool
- func (m *OtherTestMutation) Field(name string) (ent.Value, bool)
- func (m *OtherTestMutation) FieldCleared(name string) bool
- func (m *OtherTestMutation) Fields() []string
- func (m *OtherTestMutation) ID() (id int, exists bool)
- func (m *OtherTestMutation) OldField(ctx context.Context, name string) (ent.Value, error)
- func (m *OtherTestMutation) OldTest(ctx context.Context) (v othertest.Test, err error)
- func (m *OtherTestMutation) Op() Op
- func (m *OtherTestMutation) RemovedEdges() []string
- func (m *OtherTestMutation) RemovedIDs(name string) []ent.Value
- func (m *OtherTestMutation) ResetEdge(name string) error
- func (m *OtherTestMutation) ResetField(name string) error
- func (m *OtherTestMutation) ResetTest()
- func (m *OtherTestMutation) SetField(name string, value ent.Value) error
- func (m *OtherTestMutation) SetTest(o othertest.Test)
- func (m *OtherTestMutation) Test() (r othertest.Test, exists bool)
- func (m OtherTestMutation) Tx() (*Tx, error)
- func (m *OtherTestMutation) Type() string
- func (m *OtherTestMutation) Where(ps ...predicate.OtherTest)
- type OtherTestOrder
- type OtherTestOrderField
- type OtherTestPaginateOption
- type OtherTestQuery
- func (otq *OtherTestQuery) All(ctx context.Context) ([]*OtherTest, error)
- func (otq *OtherTestQuery) AllX(ctx context.Context) []*OtherTest
- func (otq *OtherTestQuery) Clone() *OtherTestQuery
- func (ot *OtherTestQuery) CollectFields(ctx context.Context, satisfies ...string) *OtherTestQuery
- func (otq *OtherTestQuery) Count(ctx context.Context) (int, error)
- func (otq *OtherTestQuery) CountX(ctx context.Context) int
- func (otq *OtherTestQuery) Exist(ctx context.Context) (bool, error)
- func (otq *OtherTestQuery) ExistX(ctx context.Context) bool
- func (otq *OtherTestQuery) First(ctx context.Context) (*OtherTest, error)
- func (otq *OtherTestQuery) FirstID(ctx context.Context) (id int, err error)
- func (otq *OtherTestQuery) FirstIDX(ctx context.Context) int
- func (otq *OtherTestQuery) FirstX(ctx context.Context) *OtherTest
- func (otq *OtherTestQuery) GroupBy(field string, fields ...string) *OtherTestGroupBy
- func (otq *OtherTestQuery) IDs(ctx context.Context) ([]int, error)
- func (otq *OtherTestQuery) IDsX(ctx context.Context) []int
- func (otq *OtherTestQuery) Limit(limit int) *OtherTestQuery
- func (otq *OtherTestQuery) Offset(offset int) *OtherTestQuery
- func (otq *OtherTestQuery) Only(ctx context.Context) (*OtherTest, error)
- func (otq *OtherTestQuery) OnlyID(ctx context.Context) (id int, err error)
- func (otq *OtherTestQuery) OnlyIDX(ctx context.Context) int
- func (otq *OtherTestQuery) OnlyX(ctx context.Context) *OtherTest
- func (otq *OtherTestQuery) Order(o ...OrderFunc) *OtherTestQuery
- func (ot *OtherTestQuery) Paginate(ctx context.Context, after *Cursor, first *int, before *Cursor, last *int, ...) (*OtherTestConnection, error)
- func (otq *OtherTestQuery) Select(fields ...string) *OtherTestSelect
- func (otq *OtherTestQuery) Unique(unique bool) *OtherTestQuery
- func (otq *OtherTestQuery) Where(ps ...predicate.OtherTest) *OtherTestQuery
- type OtherTestSelect
- func (ots *OtherTestSelect) Bool(ctx context.Context) (_ bool, err error)
- func (ots *OtherTestSelect) BoolX(ctx context.Context) bool
- func (ots *OtherTestSelect) Bools(ctx context.Context) ([]bool, error)
- func (ots *OtherTestSelect) BoolsX(ctx context.Context) []bool
- func (ots *OtherTestSelect) Float64(ctx context.Context) (_ float64, err error)
- func (ots *OtherTestSelect) Float64X(ctx context.Context) float64
- func (ots *OtherTestSelect) Float64s(ctx context.Context) ([]float64, error)
- func (ots *OtherTestSelect) Float64sX(ctx context.Context) []float64
- func (ots *OtherTestSelect) Int(ctx context.Context) (_ int, err error)
- func (ots *OtherTestSelect) IntX(ctx context.Context) int
- func (ots *OtherTestSelect) Ints(ctx context.Context) ([]int, error)
- func (ots *OtherTestSelect) IntsX(ctx context.Context) []int
- func (ots *OtherTestSelect) Scan(ctx context.Context, v interface{}) error
- func (ots *OtherTestSelect) ScanX(ctx context.Context, v interface{})
- func (ots *OtherTestSelect) String(ctx context.Context) (_ string, err error)
- func (ots *OtherTestSelect) StringX(ctx context.Context) string
- func (ots *OtherTestSelect) Strings(ctx context.Context) ([]string, error)
- func (ots *OtherTestSelect) StringsX(ctx context.Context) []string
- type OtherTestUpdate
- func (otu *OtherTestUpdate) Exec(ctx context.Context) error
- func (otu *OtherTestUpdate) ExecX(ctx context.Context)
- func (otu *OtherTestUpdate) Mutation() *OtherTestMutation
- func (otu *OtherTestUpdate) Save(ctx context.Context) (int, error)
- func (otu *OtherTestUpdate) SaveX(ctx context.Context) int
- func (otu *OtherTestUpdate) SetTest(o othertest.Test) *OtherTestUpdate
- func (otu *OtherTestUpdate) Where(ps ...predicate.OtherTest) *OtherTestUpdate
- type OtherTestUpdateOne
- func (otuo *OtherTestUpdateOne) Exec(ctx context.Context) error
- func (otuo *OtherTestUpdateOne) ExecX(ctx context.Context)
- func (otuo *OtherTestUpdateOne) Mutation() *OtherTestMutation
- func (otuo *OtherTestUpdateOne) Save(ctx context.Context) (*OtherTest, error)
- func (otuo *OtherTestUpdateOne) SaveX(ctx context.Context) *OtherTest
- func (otuo *OtherTestUpdateOne) Select(field string, fields ...string) *OtherTestUpdateOne
- func (otuo *OtherTestUpdateOne) SetTest(o othertest.Test) *OtherTestUpdateOne
- type OtherTestWhereInput
- type OtherTests
- type PageInfo
- type Policy
- type Query
- type RollbackFunc
- type RollbackHook
- type Rollbacker
- type Test
- type TestClient
- func (c *TestClient) Create() *TestCreate
- func (c *TestClient) CreateBulk(builders ...*TestCreate) *TestCreateBulk
- func (c *TestClient) Delete() *TestDelete
- func (c *TestClient) DeleteOne(t *Test) *TestDeleteOne
- func (c *TestClient) DeleteOneID(id int) *TestDeleteOne
- func (c *TestClient) Get(ctx context.Context, id int) (*Test, error)
- func (c *TestClient) GetX(ctx context.Context, id int) *Test
- func (c *TestClient) Hooks() []Hook
- func (c *TestClient) Query() *TestQuery
- func (c *TestClient) Update() *TestUpdate
- func (c *TestClient) UpdateOne(t *Test) *TestUpdateOne
- func (c *TestClient) UpdateOneID(id int) *TestUpdateOne
- func (c *TestClient) Use(hooks ...Hook)
- type TestConnection
- type TestCreate
- func (tc *TestCreate) Exec(ctx context.Context) error
- func (tc *TestCreate) ExecX(ctx context.Context)
- func (tc *TestCreate) Mutation() *TestMutation
- func (tc *TestCreate) Save(ctx context.Context) (*Test, error)
- func (tc *TestCreate) SaveX(ctx context.Context) *Test
- func (tc *TestCreate) SetTest(t test.Test) *TestCreate
- type TestCreateBulk
- type TestDelete
- type TestDeleteOne
- type TestEdge
- type TestGroupBy
- func (tgb *TestGroupBy) Aggregate(fns ...AggregateFunc) *TestGroupBy
- func (tgb *TestGroupBy) Bool(ctx context.Context) (_ bool, err error)
- func (tgb *TestGroupBy) BoolX(ctx context.Context) bool
- func (tgb *TestGroupBy) Bools(ctx context.Context) ([]bool, error)
- func (tgb *TestGroupBy) BoolsX(ctx context.Context) []bool
- func (tgb *TestGroupBy) Float64(ctx context.Context) (_ float64, err error)
- func (tgb *TestGroupBy) Float64X(ctx context.Context) float64
- func (tgb *TestGroupBy) Float64s(ctx context.Context) ([]float64, error)
- func (tgb *TestGroupBy) Float64sX(ctx context.Context) []float64
- func (tgb *TestGroupBy) Int(ctx context.Context) (_ int, err error)
- func (tgb *TestGroupBy) IntX(ctx context.Context) int
- func (tgb *TestGroupBy) Ints(ctx context.Context) ([]int, error)
- func (tgb *TestGroupBy) IntsX(ctx context.Context) []int
- func (tgb *TestGroupBy) Scan(ctx context.Context, v interface{}) error
- func (tgb *TestGroupBy) ScanX(ctx context.Context, v interface{})
- func (tgb *TestGroupBy) String(ctx context.Context) (_ string, err error)
- func (tgb *TestGroupBy) StringX(ctx context.Context) string
- func (tgb *TestGroupBy) Strings(ctx context.Context) ([]string, error)
- func (tgb *TestGroupBy) StringsX(ctx context.Context) []string
- type TestMutation
- func (m *TestMutation) AddField(name string, value ent.Value) error
- func (m *TestMutation) AddedEdges() []string
- func (m *TestMutation) AddedField(name string) (ent.Value, bool)
- func (m *TestMutation) AddedFields() []string
- func (m *TestMutation) AddedIDs(name string) []ent.Value
- func (m *TestMutation) ClearEdge(name string) error
- func (m *TestMutation) ClearField(name string) error
- func (m *TestMutation) ClearedEdges() []string
- func (m *TestMutation) ClearedFields() []string
- func (m TestMutation) Client() *Client
- func (m *TestMutation) EdgeCleared(name string) bool
- func (m *TestMutation) Field(name string) (ent.Value, bool)
- func (m *TestMutation) FieldCleared(name string) bool
- func (m *TestMutation) Fields() []string
- func (m *TestMutation) ID() (id int, exists bool)
- func (m *TestMutation) OldField(ctx context.Context, name string) (ent.Value, error)
- func (m *TestMutation) OldTest(ctx context.Context) (v test.Test, err error)
- func (m *TestMutation) Op() Op
- func (m *TestMutation) RemovedEdges() []string
- func (m *TestMutation) RemovedIDs(name string) []ent.Value
- func (m *TestMutation) ResetEdge(name string) error
- func (m *TestMutation) ResetField(name string) error
- func (m *TestMutation) ResetTest()
- func (m *TestMutation) SetField(name string, value ent.Value) error
- func (m *TestMutation) SetTest(t test.Test)
- func (m *TestMutation) Test() (r test.Test, exists bool)
- func (m TestMutation) Tx() (*Tx, error)
- func (m *TestMutation) Type() string
- func (m *TestMutation) Where(ps ...predicate.Test)
- type TestOrder
- type TestOrderField
- type TestPaginateOption
- type TestQuery
- func (tq *TestQuery) All(ctx context.Context) ([]*Test, error)
- func (tq *TestQuery) AllX(ctx context.Context) []*Test
- func (tq *TestQuery) Clone() *TestQuery
- func (t *TestQuery) CollectFields(ctx context.Context, satisfies ...string) *TestQuery
- func (tq *TestQuery) Count(ctx context.Context) (int, error)
- func (tq *TestQuery) CountX(ctx context.Context) int
- func (tq *TestQuery) Exist(ctx context.Context) (bool, error)
- func (tq *TestQuery) ExistX(ctx context.Context) bool
- func (tq *TestQuery) First(ctx context.Context) (*Test, error)
- func (tq *TestQuery) FirstID(ctx context.Context) (id int, err error)
- func (tq *TestQuery) FirstIDX(ctx context.Context) int
- func (tq *TestQuery) FirstX(ctx context.Context) *Test
- func (tq *TestQuery) GroupBy(field string, fields ...string) *TestGroupBy
- func (tq *TestQuery) IDs(ctx context.Context) ([]int, error)
- func (tq *TestQuery) IDsX(ctx context.Context) []int
- func (tq *TestQuery) Limit(limit int) *TestQuery
- func (tq *TestQuery) Offset(offset int) *TestQuery
- func (tq *TestQuery) Only(ctx context.Context) (*Test, error)
- func (tq *TestQuery) OnlyID(ctx context.Context) (id int, err error)
- func (tq *TestQuery) OnlyIDX(ctx context.Context) int
- func (tq *TestQuery) OnlyX(ctx context.Context) *Test
- func (tq *TestQuery) Order(o ...OrderFunc) *TestQuery
- func (t *TestQuery) Paginate(ctx context.Context, after *Cursor, first *int, before *Cursor, last *int, ...) (*TestConnection, error)
- func (tq *TestQuery) Select(fields ...string) *TestSelect
- func (tq *TestQuery) Unique(unique bool) *TestQuery
- func (tq *TestQuery) Where(ps ...predicate.Test) *TestQuery
- type TestSelect
- func (ts *TestSelect) Bool(ctx context.Context) (_ bool, err error)
- func (ts *TestSelect) BoolX(ctx context.Context) bool
- func (ts *TestSelect) Bools(ctx context.Context) ([]bool, error)
- func (ts *TestSelect) BoolsX(ctx context.Context) []bool
- func (ts *TestSelect) Float64(ctx context.Context) (_ float64, err error)
- func (ts *TestSelect) Float64X(ctx context.Context) float64
- func (ts *TestSelect) Float64s(ctx context.Context) ([]float64, error)
- func (ts *TestSelect) Float64sX(ctx context.Context) []float64
- func (ts *TestSelect) Int(ctx context.Context) (_ int, err error)
- func (ts *TestSelect) IntX(ctx context.Context) int
- func (ts *TestSelect) Ints(ctx context.Context) ([]int, error)
- func (ts *TestSelect) IntsX(ctx context.Context) []int
- func (ts *TestSelect) Scan(ctx context.Context, v interface{}) error
- func (ts *TestSelect) ScanX(ctx context.Context, v interface{})
- func (ts *TestSelect) String(ctx context.Context) (_ string, err error)
- func (ts *TestSelect) StringX(ctx context.Context) string
- func (ts *TestSelect) Strings(ctx context.Context) ([]string, error)
- func (ts *TestSelect) StringsX(ctx context.Context) []string
- type TestUpdate
- func (tu *TestUpdate) Exec(ctx context.Context) error
- func (tu *TestUpdate) ExecX(ctx context.Context)
- func (tu *TestUpdate) Mutation() *TestMutation
- func (tu *TestUpdate) Save(ctx context.Context) (int, error)
- func (tu *TestUpdate) SaveX(ctx context.Context) int
- func (tu *TestUpdate) SetTest(t test.Test) *TestUpdate
- func (tu *TestUpdate) Where(ps ...predicate.Test) *TestUpdate
- type TestUpdateOne
- func (tuo *TestUpdateOne) Exec(ctx context.Context) error
- func (tuo *TestUpdateOne) ExecX(ctx context.Context)
- func (tuo *TestUpdateOne) Mutation() *TestMutation
- func (tuo *TestUpdateOne) Save(ctx context.Context) (*Test, error)
- func (tuo *TestUpdateOne) SaveX(ctx context.Context) *Test
- func (tuo *TestUpdateOne) Select(field string, fields ...string) *TestUpdateOne
- func (tuo *TestUpdateOne) SetTest(t test.Test) *TestUpdateOne
- type TestWhereInput
- type Tests
- type Tx
- type ValidationError
- type Value
Constants ¶
const ( // Operation types. OpCreate = ent.OpCreate OpDelete = ent.OpDelete OpDeleteOne = ent.OpDeleteOne OpUpdate = ent.OpUpdate OpUpdateOne = ent.OpUpdateOne // Node types. TypeOtherTest = "OtherTest" TypeTest = "Test" )
Variables ¶
var DefaultOtherTestOrder = &OtherTestOrder{ Direction: OrderDirectionAsc, Field: &OtherTestOrderField{ field: othertest.FieldID, toCursor: func(ot *OtherTest) Cursor { return Cursor{ID: ot.ID} }, }, }
DefaultOtherTestOrder is the default ordering of OtherTest.
var DefaultTestOrder = &TestOrder{ Direction: OrderDirectionAsc, Field: &TestOrderField{ field: test.FieldID, toCursor: func(t *Test) Cursor { return Cursor{ID: t.ID} }, }, }
DefaultTestOrder is the default ordering of Test.
Functions ¶
func IsConstraintError ¶
IsConstraintError returns a boolean indicating whether the error is a constraint failure.
func IsNotFound ¶
IsNotFound returns a boolean indicating whether the error is a not found error.
func IsNotLoaded ¶
IsNotLoaded returns a boolean indicating whether the error is a not loaded error.
func IsNotSingular ¶
IsNotSingular returns a boolean indicating whether the error is a not singular error.
func IsValidationError ¶
IsValidationError returns a boolean indicating whether the error is a validation error.
func NewContext ¶
NewContext returns a new context with the given Client attached.
func NewTxContext ¶
NewTxContext returns a new context with the given Tx attached.
Types ¶
type AggregateFunc ¶
AggregateFunc applies an aggregation step on the group-by traversal/selector.
func As ¶
func As(fn AggregateFunc, end string) AggregateFunc
As is a pseudo aggregation function for renaming another other functions with custom names. For example:
GroupBy(field1, field2). Aggregate(ent.As(ent.Sum(field1), "sum_field1"), (ent.As(ent.Sum(field2), "sum_field2")). Scan(ctx, &v)
func Count ¶
func Count() AggregateFunc
Count applies the "count" aggregation function on each group.
func Max ¶
func Max(field string) AggregateFunc
Max applies the "max" aggregation function on the given field of each group.
func Mean ¶
func Mean(field string) AggregateFunc
Mean applies the "mean" aggregation function on the given field of each group.
func Min ¶
func Min(field string) AggregateFunc
Min applies the "min" aggregation function on the given field of each group.
func Sum ¶
func Sum(field string) AggregateFunc
Sum applies the "sum" aggregation function on the given field of each group.
type Client ¶
type Client struct { // Schema is the client for creating, migrating and dropping schema. Schema *migrate.Schema // OtherTest is the client for interacting with the OtherTest builders. OtherTest *OtherTestClient // Test is the client for interacting with the Test builders. Test *TestClient // contains filtered or unexported fields }
Client is the client that holds all ent builders.
func FromContext ¶
FromContext returns a Client stored inside a context, or nil if there isn't one.
func Open ¶
Open opens a database/sql.DB specified by the driver name and the data source name, and returns a new client attached to it. Optional parameters can be added for configuring the client.
func (*Client) Debug ¶
Debug returns a new debug-client. It's used to get verbose logging on specific operations.
client.Debug(). OtherTest. Query(). Count(ctx)
func (*Client) Noder ¶
Noder returns a Node by its id. If the NodeType was not provided, it will be derived from the id value according to the universal-id configuration.
c.Noder(ctx, id) c.Noder(ctx, id, ent.WithNodeType(pet.Table))
func (*Client) OpenTx ¶
OpenTx opens a transaction and returns a transactional context along with the created transaction.
type CommitFunc ¶
The CommitFunc type is an adapter to allow the use of ordinary function as a Committer. If f is a function with the appropriate signature, CommitFunc(f) is a Committer that calls f.
type CommitHook ¶
CommitHook defines the "commit middleware". A function that gets a Committer and returns a Committer. For example:
hook := func(next ent.Committer) ent.Committer { return ent.CommitFunc(func(context.Context, tx *ent.Tx) error { // Do some stuff before. if err := next.Commit(ctx, tx); err != nil { return err } // Do some stuff after. return nil }) }
type ConstraintError ¶
type ConstraintError struct {
// contains filtered or unexported fields
}
ConstraintError returns when trying to create/update one or more entities and one or more of their constraints failed. For example, violation of edge or field uniqueness.
func (ConstraintError) Error ¶
func (e ConstraintError) Error() string
Error implements the error interface.
func (*ConstraintError) Unwrap ¶
func (e *ConstraintError) Unwrap() error
Unwrap implements the errors.Wrapper interface.
type Cursor ¶
Cursor of an edge type.
func (Cursor) MarshalGQL ¶
MarshalGQL implements graphql.Marshaler interface.
func (*Cursor) UnmarshalGQL ¶
UnmarshalGQL implements graphql.Unmarshaler interface.
type Edge ¶
type Edge struct { Type string `json:"type,omitempty"` // edge type. Name string `json:"name,omitempty"` // edge name. IDs []int `json:"ids,omitempty"` // node ids (where this edge point to). }
Edges between two nodes.
type Field ¶
type Field struct { Type string `json:"type,omitempty"` // field type. Name string `json:"name,omitempty"` // field name (as in struct). Value string `json:"value,omitempty"` // stringified value. }
Field of a node.
type MutateFunc ¶
type MutateFunc = ent.MutateFunc
ent aliases to avoid import conflicts in user's code.
type Node ¶
type Node struct { ID int `json:"id,omitempty"` // node id. Type string `json:"type,omitempty"` // node type. Fields []*Field `json:"fields,omitempty"` // node fields. Edges []*Edge `json:"edges,omitempty"` // node edges. }
Node in the graph.
type NodeOption ¶
type NodeOption func(*nodeOptions)
NodeOption allows configuring the Noder execution using functional options.
func WithFixedNodeType ¶
func WithFixedNodeType(t string) NodeOption
WithFixedNodeType sets the Type of the node to a fixed value.
func WithNodeType ¶
WithNodeType sets the node Type resolver function (i.e. the table to query). If was not provided, the table will be derived from the universal-id configuration as described in: https://entgo.io/docs/migrate/#universal-ids.
type NotFoundError ¶
type NotFoundError struct {
// contains filtered or unexported fields
}
NotFoundError returns when trying to fetch a specific entity and it was not found in the database.
func (*NotFoundError) Error ¶
func (e *NotFoundError) Error() string
Error implements the error interface.
type NotLoadedError ¶
type NotLoadedError struct {
// contains filtered or unexported fields
}
NotLoadedError returns when trying to get a node that was not loaded by the query.
func (*NotLoadedError) Error ¶
func (e *NotLoadedError) Error() string
Error implements the error interface.
type NotSingularError ¶
type NotSingularError struct {
// contains filtered or unexported fields
}
NotSingularError returns when trying to fetch a singular entity and more then one was found in the database.
func (*NotSingularError) Error ¶
func (e *NotSingularError) Error() string
Error implements the error interface.
type OrderDirection ¶
type OrderDirection string
OrderDirection defines the directions in which to order a list of items.
const ( // OrderDirectionAsc specifies an ascending order. OrderDirectionAsc OrderDirection = "ASC" // OrderDirectionDesc specifies a descending order. OrderDirectionDesc OrderDirection = "DESC" )
func (OrderDirection) MarshalGQL ¶
func (o OrderDirection) MarshalGQL(w io.Writer)
MarshalGQL implements graphql.Marshaler interface.
func (OrderDirection) String ¶
func (o OrderDirection) String() string
String implements fmt.Stringer interface.
func (*OrderDirection) UnmarshalGQL ¶
func (o *OrderDirection) UnmarshalGQL(val interface{}) error
UnmarshalGQL implements graphql.Unmarshaler interface.
func (OrderDirection) Validate ¶
func (o OrderDirection) Validate() error
Validate the order direction value.
type OtherTest ¶
type OtherTest struct { // ID of the ent. ID int `json:"id,omitempty"` // Test holds the value of the "test" field. Test othertest.Test `json:"test,omitempty"` // contains filtered or unexported fields }
OtherTest is the model entity for the OtherTest schema.
func (*OtherTest) ToEdge ¶
func (ot *OtherTest) ToEdge(order *OtherTestOrder) *OtherTestEdge
ToEdge converts OtherTest into OtherTestEdge.
func (*OtherTest) Unwrap ¶
Unwrap unwraps the OtherTest 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 (*OtherTest) Update ¶
func (ot *OtherTest) Update() *OtherTestUpdateOne
Update returns a builder for updating this OtherTest. Note that you need to call OtherTest.Unwrap() before calling this method if this OtherTest was returned from a transaction, and the transaction was committed or rolled back.
type OtherTestClient ¶
type OtherTestClient struct {
// contains filtered or unexported fields
}
OtherTestClient is a client for the OtherTest schema.
func NewOtherTestClient ¶
func NewOtherTestClient(c config) *OtherTestClient
NewOtherTestClient returns a client for the OtherTest from the given config.
func (*OtherTestClient) Create ¶
func (c *OtherTestClient) Create() *OtherTestCreate
Create returns a create builder for OtherTest.
func (*OtherTestClient) CreateBulk ¶
func (c *OtherTestClient) CreateBulk(builders ...*OtherTestCreate) *OtherTestCreateBulk
CreateBulk returns a builder for creating a bulk of OtherTest entities.
func (*OtherTestClient) Delete ¶
func (c *OtherTestClient) Delete() *OtherTestDelete
Delete returns a delete builder for OtherTest.
func (*OtherTestClient) DeleteOne ¶
func (c *OtherTestClient) DeleteOne(ot *OtherTest) *OtherTestDeleteOne
DeleteOne returns a delete builder for the given entity.
func (*OtherTestClient) DeleteOneID ¶
func (c *OtherTestClient) DeleteOneID(id int) *OtherTestDeleteOne
DeleteOneID returns a delete builder for the given id.
func (*OtherTestClient) GetX ¶
func (c *OtherTestClient) GetX(ctx context.Context, id int) *OtherTest
GetX is like Get, but panics if an error occurs.
func (*OtherTestClient) Hooks ¶
func (c *OtherTestClient) Hooks() []Hook
Hooks returns the client hooks.
func (*OtherTestClient) Query ¶
func (c *OtherTestClient) Query() *OtherTestQuery
Query returns a query builder for OtherTest.
func (*OtherTestClient) Update ¶
func (c *OtherTestClient) Update() *OtherTestUpdate
Update returns an update builder for OtherTest.
func (*OtherTestClient) UpdateOne ¶
func (c *OtherTestClient) UpdateOne(ot *OtherTest) *OtherTestUpdateOne
UpdateOne returns an update builder for the given entity.
func (*OtherTestClient) UpdateOneID ¶
func (c *OtherTestClient) UpdateOneID(id int) *OtherTestUpdateOne
UpdateOneID returns an update builder for the given id.
func (*OtherTestClient) Use ¶
func (c *OtherTestClient) Use(hooks ...Hook)
Use adds a list of mutation hooks to the hooks stack. A call to `Use(f, g, h)` equals to `othertest.Hooks(f(g(h())))`.
type OtherTestConnection ¶
type OtherTestConnection struct { Edges []*OtherTestEdge `json:"edges"` PageInfo PageInfo `json:"pageInfo"` TotalCount int `json:"totalCount"` }
OtherTestConnection is the connection containing edges to OtherTest.
type OtherTestCreate ¶
type OtherTestCreate struct {
// contains filtered or unexported fields
}
OtherTestCreate is the builder for creating a OtherTest entity.
func (*OtherTestCreate) Exec ¶
func (otc *OtherTestCreate) Exec(ctx context.Context) error
Exec executes the query.
func (*OtherTestCreate) ExecX ¶
func (otc *OtherTestCreate) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*OtherTestCreate) Mutation ¶
func (otc *OtherTestCreate) Mutation() *OtherTestMutation
Mutation returns the OtherTestMutation object of the builder.
func (*OtherTestCreate) Save ¶
func (otc *OtherTestCreate) Save(ctx context.Context) (*OtherTest, error)
Save creates the OtherTest in the database.
func (*OtherTestCreate) SaveX ¶
func (otc *OtherTestCreate) SaveX(ctx context.Context) *OtherTest
SaveX calls Save and panics if Save returns an error.
func (*OtherTestCreate) SetTest ¶
func (otc *OtherTestCreate) SetTest(o othertest.Test) *OtherTestCreate
SetTest sets the "test" field.
type OtherTestCreateBulk ¶
type OtherTestCreateBulk struct {
// contains filtered or unexported fields
}
OtherTestCreateBulk is the builder for creating many OtherTest entities in bulk.
func (*OtherTestCreateBulk) Exec ¶
func (otcb *OtherTestCreateBulk) Exec(ctx context.Context) error
Exec executes the query.
func (*OtherTestCreateBulk) ExecX ¶
func (otcb *OtherTestCreateBulk) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
type OtherTestDelete ¶
type OtherTestDelete struct {
// contains filtered or unexported fields
}
OtherTestDelete is the builder for deleting a OtherTest entity.
func (*OtherTestDelete) Exec ¶
func (otd *OtherTestDelete) Exec(ctx context.Context) (int, error)
Exec executes the deletion query and returns how many vertices were deleted.
func (*OtherTestDelete) ExecX ¶
func (otd *OtherTestDelete) ExecX(ctx context.Context) int
ExecX is like Exec, but panics if an error occurs.
func (*OtherTestDelete) Where ¶
func (otd *OtherTestDelete) Where(ps ...predicate.OtherTest) *OtherTestDelete
Where appends a list predicates to the OtherTestDelete builder.
type OtherTestDeleteOne ¶
type OtherTestDeleteOne struct {
// contains filtered or unexported fields
}
OtherTestDeleteOne is the builder for deleting a single OtherTest entity.
func (*OtherTestDeleteOne) Exec ¶
func (otdo *OtherTestDeleteOne) Exec(ctx context.Context) error
Exec executes the deletion query.
func (*OtherTestDeleteOne) ExecX ¶
func (otdo *OtherTestDeleteOne) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
type OtherTestEdge ¶
OtherTestEdge is the edge representation of OtherTest.
type OtherTestGroupBy ¶
type OtherTestGroupBy struct {
// contains filtered or unexported fields
}
OtherTestGroupBy is the group-by builder for OtherTest entities.
func (*OtherTestGroupBy) Aggregate ¶
func (otgb *OtherTestGroupBy) Aggregate(fns ...AggregateFunc) *OtherTestGroupBy
Aggregate adds the given aggregation functions to the group-by query.
func (*OtherTestGroupBy) Bool ¶
func (otgb *OtherTestGroupBy) Bool(ctx context.Context) (_ bool, err error)
Bool returns a single bool from a group-by query. It is only allowed when executing a group-by query with one field.
func (*OtherTestGroupBy) BoolX ¶
func (otgb *OtherTestGroupBy) BoolX(ctx context.Context) bool
BoolX is like Bool, but panics if an error occurs.
func (*OtherTestGroupBy) Bools ¶
func (otgb *OtherTestGroupBy) Bools(ctx context.Context) ([]bool, error)
Bools returns list of bools from group-by. It is only allowed when executing a group-by query with one field.
func (*OtherTestGroupBy) BoolsX ¶
func (otgb *OtherTestGroupBy) BoolsX(ctx context.Context) []bool
BoolsX is like Bools, but panics if an error occurs.
func (*OtherTestGroupBy) Float64 ¶
func (otgb *OtherTestGroupBy) Float64(ctx context.Context) (_ float64, err error)
Float64 returns a single float64 from a group-by query. It is only allowed when executing a group-by query with one field.
func (*OtherTestGroupBy) Float64X ¶
func (otgb *OtherTestGroupBy) Float64X(ctx context.Context) float64
Float64X is like Float64, but panics if an error occurs.
func (*OtherTestGroupBy) Float64s ¶
func (otgb *OtherTestGroupBy) Float64s(ctx context.Context) ([]float64, error)
Float64s returns list of float64s from group-by. It is only allowed when executing a group-by query with one field.
func (*OtherTestGroupBy) Float64sX ¶
func (otgb *OtherTestGroupBy) Float64sX(ctx context.Context) []float64
Float64sX is like Float64s, but panics if an error occurs.
func (*OtherTestGroupBy) Int ¶
func (otgb *OtherTestGroupBy) Int(ctx context.Context) (_ int, err error)
Int returns a single int from a group-by query. It is only allowed when executing a group-by query with one field.
func (*OtherTestGroupBy) IntX ¶
func (otgb *OtherTestGroupBy) IntX(ctx context.Context) int
IntX is like Int, but panics if an error occurs.
func (*OtherTestGroupBy) Ints ¶
func (otgb *OtherTestGroupBy) Ints(ctx context.Context) ([]int, error)
Ints returns list of ints from group-by. It is only allowed when executing a group-by query with one field.
func (*OtherTestGroupBy) IntsX ¶
func (otgb *OtherTestGroupBy) IntsX(ctx context.Context) []int
IntsX is like Ints, but panics if an error occurs.
func (*OtherTestGroupBy) Scan ¶
func (otgb *OtherTestGroupBy) Scan(ctx context.Context, v interface{}) error
Scan applies the group-by query and scans the result into the given value.
func (*OtherTestGroupBy) ScanX ¶
func (otgb *OtherTestGroupBy) ScanX(ctx context.Context, v interface{})
ScanX is like Scan, but panics if an error occurs.
func (*OtherTestGroupBy) String ¶
func (otgb *OtherTestGroupBy) String(ctx context.Context) (_ string, err error)
String returns a single string from a group-by query. It is only allowed when executing a group-by query with one field.
func (*OtherTestGroupBy) StringX ¶
func (otgb *OtherTestGroupBy) StringX(ctx context.Context) string
StringX is like String, but panics if an error occurs.
type OtherTestMutation ¶
type OtherTestMutation struct {
// contains filtered or unexported fields
}
OtherTestMutation represents an operation that mutates the OtherTest nodes in the graph.
func (*OtherTestMutation) AddField ¶
func (m *OtherTestMutation) 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 (*OtherTestMutation) AddedEdges ¶
func (m *OtherTestMutation) AddedEdges() []string
AddedEdges returns all edge names that were set/added in this mutation.
func (*OtherTestMutation) AddedField ¶
func (m *OtherTestMutation) 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 (*OtherTestMutation) AddedFields ¶
func (m *OtherTestMutation) AddedFields() []string
AddedFields returns all numeric fields that were incremented/decremented during this mutation.
func (*OtherTestMutation) AddedIDs ¶
func (m *OtherTestMutation) AddedIDs(name string) []ent.Value
AddedIDs returns all IDs (to other nodes) that were added for the given edge name in this mutation.
func (*OtherTestMutation) ClearEdge ¶
func (m *OtherTestMutation) 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 (*OtherTestMutation) ClearField ¶
func (m *OtherTestMutation) 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 (*OtherTestMutation) ClearedEdges ¶
func (m *OtherTestMutation) ClearedEdges() []string
ClearedEdges returns all edge names that were cleared in this mutation.
func (*OtherTestMutation) ClearedFields ¶
func (m *OtherTestMutation) ClearedFields() []string
ClearedFields returns all nullable fields that were cleared during this mutation.
func (OtherTestMutation) Client ¶
func (m OtherTestMutation) 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 (*OtherTestMutation) EdgeCleared ¶
func (m *OtherTestMutation) EdgeCleared(name string) bool
EdgeCleared returns a boolean which indicates if the edge with the given name was cleared in this mutation.
func (*OtherTestMutation) Field ¶
func (m *OtherTestMutation) 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 (*OtherTestMutation) FieldCleared ¶
func (m *OtherTestMutation) FieldCleared(name string) bool
FieldCleared returns a boolean indicating if a field with the given name was cleared in this mutation.
func (*OtherTestMutation) Fields ¶
func (m *OtherTestMutation) 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 (*OtherTestMutation) ID ¶
func (m *OtherTestMutation) 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 (*OtherTestMutation) OldField ¶
OldField returns the old value of the field from the database. An error is returned if the mutation operation is not UpdateOne, or the query to the database failed.
func (*OtherTestMutation) OldTest ¶
OldTest returns the old "test" field's value of the OtherTest entity. If the OtherTest 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 (*OtherTestMutation) RemovedEdges ¶
func (m *OtherTestMutation) RemovedEdges() []string
RemovedEdges returns all edge names that were removed in this mutation.
func (*OtherTestMutation) RemovedIDs ¶
func (m *OtherTestMutation) 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 (*OtherTestMutation) ResetEdge ¶
func (m *OtherTestMutation) 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 (*OtherTestMutation) ResetField ¶
func (m *OtherTestMutation) 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 (*OtherTestMutation) ResetTest ¶
func (m *OtherTestMutation) ResetTest()
ResetTest resets all changes to the "test" field.
func (*OtherTestMutation) SetField ¶
func (m *OtherTestMutation) 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 (*OtherTestMutation) SetTest ¶
func (m *OtherTestMutation) SetTest(o othertest.Test)
SetTest sets the "test" field.
func (*OtherTestMutation) Test ¶
func (m *OtherTestMutation) Test() (r othertest.Test, exists bool)
Test returns the value of the "test" field in the mutation.
func (OtherTestMutation) Tx ¶
func (m OtherTestMutation) Tx() (*Tx, error)
Tx returns an `ent.Tx` for mutations that were executed in transactions; it returns an error otherwise.
func (*OtherTestMutation) Type ¶
func (m *OtherTestMutation) Type() string
Type returns the node type of this mutation (OtherTest).
func (*OtherTestMutation) Where ¶
func (m *OtherTestMutation) Where(ps ...predicate.OtherTest)
Where appends a list predicates to the OtherTestMutation builder.
type OtherTestOrder ¶
type OtherTestOrder struct { Direction OrderDirection `json:"direction"` Field *OtherTestOrderField `json:"field"` }
OtherTestOrder defines the ordering of OtherTest.
type OtherTestOrderField ¶
type OtherTestOrderField struct {
// contains filtered or unexported fields
}
OtherTestOrderField defines the ordering field of OtherTest.
type OtherTestPaginateOption ¶
type OtherTestPaginateOption func(*otherTestPager) error
OtherTestPaginateOption enables pagination customization.
func WithOtherTestFilter ¶
func WithOtherTestFilter(filter func(*OtherTestQuery) (*OtherTestQuery, error)) OtherTestPaginateOption
WithOtherTestFilter configures pagination filter.
func WithOtherTestOrder ¶
func WithOtherTestOrder(order *OtherTestOrder) OtherTestPaginateOption
WithOtherTestOrder configures pagination ordering.
type OtherTestQuery ¶
type OtherTestQuery struct {
// contains filtered or unexported fields
}
OtherTestQuery is the builder for querying OtherTest entities.
func (*OtherTestQuery) All ¶
func (otq *OtherTestQuery) All(ctx context.Context) ([]*OtherTest, error)
All executes the query and returns a list of OtherTests.
func (*OtherTestQuery) AllX ¶
func (otq *OtherTestQuery) AllX(ctx context.Context) []*OtherTest
AllX is like All, but panics if an error occurs.
func (*OtherTestQuery) Clone ¶
func (otq *OtherTestQuery) Clone() *OtherTestQuery
Clone returns a duplicate of the OtherTestQuery builder, including all associated steps. It can be used to prepare common query builders and use them differently after the clone is made.
func (*OtherTestQuery) CollectFields ¶
func (ot *OtherTestQuery) CollectFields(ctx context.Context, satisfies ...string) *OtherTestQuery
CollectFields tells the query-builder to eagerly load connected nodes by resolver context.
func (*OtherTestQuery) Count ¶
func (otq *OtherTestQuery) Count(ctx context.Context) (int, error)
Count returns the count of the given query.
func (*OtherTestQuery) CountX ¶
func (otq *OtherTestQuery) CountX(ctx context.Context) int
CountX is like Count, but panics if an error occurs.
func (*OtherTestQuery) Exist ¶
func (otq *OtherTestQuery) Exist(ctx context.Context) (bool, error)
Exist returns true if the query has elements in the graph.
func (*OtherTestQuery) ExistX ¶
func (otq *OtherTestQuery) ExistX(ctx context.Context) bool
ExistX is like Exist, but panics if an error occurs.
func (*OtherTestQuery) First ¶
func (otq *OtherTestQuery) First(ctx context.Context) (*OtherTest, error)
First returns the first OtherTest entity from the query. Returns a *NotFoundError when no OtherTest was found.
func (*OtherTestQuery) FirstID ¶
func (otq *OtherTestQuery) FirstID(ctx context.Context) (id int, err error)
FirstID returns the first OtherTest ID from the query. Returns a *NotFoundError when no OtherTest ID was found.
func (*OtherTestQuery) FirstIDX ¶
func (otq *OtherTestQuery) FirstIDX(ctx context.Context) int
FirstIDX is like FirstID, but panics if an error occurs.
func (*OtherTestQuery) FirstX ¶
func (otq *OtherTestQuery) FirstX(ctx context.Context) *OtherTest
FirstX is like First, but panics if an error occurs.
func (*OtherTestQuery) GroupBy ¶
func (otq *OtherTestQuery) GroupBy(field string, fields ...string) *OtherTestGroupBy
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 { Test othertest.Test `json:"test,omitempty"` Count int `json:"count,omitempty"` } client.OtherTest.Query(). GroupBy(othertest.FieldTest). Aggregate(ent.Count()). Scan(ctx, &v)
func (*OtherTestQuery) IDs ¶
func (otq *OtherTestQuery) IDs(ctx context.Context) ([]int, error)
IDs executes the query and returns a list of OtherTest IDs.
func (*OtherTestQuery) IDsX ¶
func (otq *OtherTestQuery) IDsX(ctx context.Context) []int
IDsX is like IDs, but panics if an error occurs.
func (*OtherTestQuery) Limit ¶
func (otq *OtherTestQuery) Limit(limit int) *OtherTestQuery
Limit adds a limit step to the query.
func (*OtherTestQuery) Offset ¶
func (otq *OtherTestQuery) Offset(offset int) *OtherTestQuery
Offset adds an offset step to the query.
func (*OtherTestQuery) Only ¶
func (otq *OtherTestQuery) Only(ctx context.Context) (*OtherTest, error)
Only returns a single OtherTest entity found by the query, ensuring it only returns one. Returns a *NotSingularError when exactly one OtherTest entity is not found. Returns a *NotFoundError when no OtherTest entities are found.
func (*OtherTestQuery) OnlyID ¶
func (otq *OtherTestQuery) OnlyID(ctx context.Context) (id int, err error)
OnlyID is like Only, but returns the only OtherTest ID in the query. Returns a *NotSingularError when exactly one OtherTest ID is not found. Returns a *NotFoundError when no entities are found.
func (*OtherTestQuery) OnlyIDX ¶
func (otq *OtherTestQuery) OnlyIDX(ctx context.Context) int
OnlyIDX is like OnlyID, but panics if an error occurs.
func (*OtherTestQuery) OnlyX ¶
func (otq *OtherTestQuery) OnlyX(ctx context.Context) *OtherTest
OnlyX is like Only, but panics if an error occurs.
func (*OtherTestQuery) Order ¶
func (otq *OtherTestQuery) Order(o ...OrderFunc) *OtherTestQuery
Order adds an order step to the query.
func (*OtherTestQuery) Paginate ¶
func (ot *OtherTestQuery) Paginate( ctx context.Context, after *Cursor, first *int, before *Cursor, last *int, opts ...OtherTestPaginateOption, ) (*OtherTestConnection, error)
Paginate executes the query and returns a relay based cursor connection to OtherTest.
func (*OtherTestQuery) Select ¶
func (otq *OtherTestQuery) Select(fields ...string) *OtherTestSelect
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 { Test othertest.Test `json:"test,omitempty"` } client.OtherTest.Query(). Select(othertest.FieldTest). Scan(ctx, &v)
func (*OtherTestQuery) Unique ¶
func (otq *OtherTestQuery) Unique(unique bool) *OtherTestQuery
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 (*OtherTestQuery) Where ¶
func (otq *OtherTestQuery) Where(ps ...predicate.OtherTest) *OtherTestQuery
Where adds a new predicate for the OtherTestQuery builder.
type OtherTestSelect ¶
type OtherTestSelect struct { *OtherTestQuery // contains filtered or unexported fields }
OtherTestSelect is the builder for selecting fields of OtherTest entities.
func (*OtherTestSelect) Bool ¶
func (ots *OtherTestSelect) Bool(ctx context.Context) (_ bool, err error)
Bool returns a single bool from a selector. It is only allowed when selecting one field.
func (*OtherTestSelect) BoolX ¶
func (ots *OtherTestSelect) BoolX(ctx context.Context) bool
BoolX is like Bool, but panics if an error occurs.
func (*OtherTestSelect) Bools ¶
func (ots *OtherTestSelect) Bools(ctx context.Context) ([]bool, error)
Bools returns list of bools from a selector. It is only allowed when selecting one field.
func (*OtherTestSelect) BoolsX ¶
func (ots *OtherTestSelect) BoolsX(ctx context.Context) []bool
BoolsX is like Bools, but panics if an error occurs.
func (*OtherTestSelect) Float64 ¶
func (ots *OtherTestSelect) Float64(ctx context.Context) (_ float64, err error)
Float64 returns a single float64 from a selector. It is only allowed when selecting one field.
func (*OtherTestSelect) Float64X ¶
func (ots *OtherTestSelect) Float64X(ctx context.Context) float64
Float64X is like Float64, but panics if an error occurs.
func (*OtherTestSelect) Float64s ¶
func (ots *OtherTestSelect) Float64s(ctx context.Context) ([]float64, error)
Float64s returns list of float64s from a selector. It is only allowed when selecting one field.
func (*OtherTestSelect) Float64sX ¶
func (ots *OtherTestSelect) Float64sX(ctx context.Context) []float64
Float64sX is like Float64s, but panics if an error occurs.
func (*OtherTestSelect) Int ¶
func (ots *OtherTestSelect) Int(ctx context.Context) (_ int, err error)
Int returns a single int from a selector. It is only allowed when selecting one field.
func (*OtherTestSelect) IntX ¶
func (ots *OtherTestSelect) IntX(ctx context.Context) int
IntX is like Int, but panics if an error occurs.
func (*OtherTestSelect) Ints ¶
func (ots *OtherTestSelect) Ints(ctx context.Context) ([]int, error)
Ints returns list of ints from a selector. It is only allowed when selecting one field.
func (*OtherTestSelect) IntsX ¶
func (ots *OtherTestSelect) IntsX(ctx context.Context) []int
IntsX is like Ints, but panics if an error occurs.
func (*OtherTestSelect) Scan ¶
func (ots *OtherTestSelect) Scan(ctx context.Context, v interface{}) error
Scan applies the selector query and scans the result into the given value.
func (*OtherTestSelect) ScanX ¶
func (ots *OtherTestSelect) ScanX(ctx context.Context, v interface{})
ScanX is like Scan, but panics if an error occurs.
func (*OtherTestSelect) String ¶
func (ots *OtherTestSelect) String(ctx context.Context) (_ string, err error)
String returns a single string from a selector. It is only allowed when selecting one field.
func (*OtherTestSelect) StringX ¶
func (ots *OtherTestSelect) StringX(ctx context.Context) string
StringX is like String, but panics if an error occurs.
type OtherTestUpdate ¶
type OtherTestUpdate struct {
// contains filtered or unexported fields
}
OtherTestUpdate is the builder for updating OtherTest entities.
func (*OtherTestUpdate) Exec ¶
func (otu *OtherTestUpdate) Exec(ctx context.Context) error
Exec executes the query.
func (*OtherTestUpdate) ExecX ¶
func (otu *OtherTestUpdate) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*OtherTestUpdate) Mutation ¶
func (otu *OtherTestUpdate) Mutation() *OtherTestMutation
Mutation returns the OtherTestMutation object of the builder.
func (*OtherTestUpdate) Save ¶
func (otu *OtherTestUpdate) Save(ctx context.Context) (int, error)
Save executes the query and returns the number of nodes affected by the update operation.
func (*OtherTestUpdate) SaveX ¶
func (otu *OtherTestUpdate) SaveX(ctx context.Context) int
SaveX is like Save, but panics if an error occurs.
func (*OtherTestUpdate) SetTest ¶
func (otu *OtherTestUpdate) SetTest(o othertest.Test) *OtherTestUpdate
SetTest sets the "test" field.
func (*OtherTestUpdate) Where ¶
func (otu *OtherTestUpdate) Where(ps ...predicate.OtherTest) *OtherTestUpdate
Where appends a list predicates to the OtherTestUpdate builder.
type OtherTestUpdateOne ¶
type OtherTestUpdateOne struct {
// contains filtered or unexported fields
}
OtherTestUpdateOne is the builder for updating a single OtherTest entity.
func (*OtherTestUpdateOne) Exec ¶
func (otuo *OtherTestUpdateOne) Exec(ctx context.Context) error
Exec executes the query on the entity.
func (*OtherTestUpdateOne) ExecX ¶
func (otuo *OtherTestUpdateOne) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*OtherTestUpdateOne) Mutation ¶
func (otuo *OtherTestUpdateOne) Mutation() *OtherTestMutation
Mutation returns the OtherTestMutation object of the builder.
func (*OtherTestUpdateOne) Save ¶
func (otuo *OtherTestUpdateOne) Save(ctx context.Context) (*OtherTest, error)
Save executes the query and returns the updated OtherTest entity.
func (*OtherTestUpdateOne) SaveX ¶
func (otuo *OtherTestUpdateOne) SaveX(ctx context.Context) *OtherTest
SaveX is like Save, but panics if an error occurs.
func (*OtherTestUpdateOne) Select ¶
func (otuo *OtherTestUpdateOne) Select(field string, fields ...string) *OtherTestUpdateOne
Select allows selecting one or more fields (columns) of the returned entity. The default is selecting all fields defined in the entity schema.
func (*OtherTestUpdateOne) SetTest ¶
func (otuo *OtherTestUpdateOne) SetTest(o othertest.Test) *OtherTestUpdateOne
SetTest sets the "test" field.
type OtherTestWhereInput ¶
type OtherTestWhereInput struct { Not *OtherTestWhereInput `json:"not,omitempty"` Or []*OtherTestWhereInput `json:"or,omitempty"` And []*OtherTestWhereInput `json:"and,omitempty"` // "id" field predicates. ID *int `json:"id,omitempty"` IDNEQ *int `json:"idNEQ,omitempty"` IDIn []int `json:"idIn,omitempty"` IDNotIn []int `json:"idNotIn,omitempty"` IDGT *int `json:"idGT,omitempty"` IDGTE *int `json:"idGTE,omitempty"` IDLT *int `json:"idLT,omitempty"` IDLTE *int `json:"idLTE,omitempty"` // "test" field predicates. Test *othertest.Test `json:"test,omitempty"` TestNEQ *othertest.Test `json:"testNEQ,omitempty"` TestIn []othertest.Test `json:"testIn,omitempty"` TestNotIn []othertest.Test `json:"testNotIn,omitempty"` }
OtherTestWhereInput represents a where input for filtering OtherTest queries.
func (*OtherTestWhereInput) Filter ¶
func (i *OtherTestWhereInput) Filter(q *OtherTestQuery) (*OtherTestQuery, error)
Filter applies the OtherTestWhereInput filter on the OtherTestQuery builder.
type PageInfo ¶
type PageInfo struct { HasNextPage bool `json:"hasNextPage"` HasPreviousPage bool `json:"hasPreviousPage"` StartCursor *Cursor `json:"startCursor"` EndCursor *Cursor `json:"endCursor"` }
PageInfo of a connection type.
type RollbackFunc ¶
The RollbackFunc type is an adapter to allow the use of ordinary function as a Rollbacker. If f is a function with the appropriate signature, RollbackFunc(f) is a Rollbacker that calls f.
type RollbackHook ¶
type RollbackHook func(Rollbacker) Rollbacker
RollbackHook defines the "rollback middleware". A function that gets a Rollbacker and returns a Rollbacker. For example:
hook := func(next ent.Rollbacker) ent.Rollbacker { return ent.RollbackFunc(func(context.Context, tx *ent.Tx) error { // Do some stuff before. if err := next.Rollback(ctx, tx); err != nil { return err } // Do some stuff after. return nil }) }
type Rollbacker ¶
Rollbacker is the interface that wraps the Rollbacker method.
type Test ¶
type Test struct { // ID of the ent. ID int `json:"id,omitempty"` // Test holds the value of the "test" field. Test test.Test `json:"test,omitempty"` // contains filtered or unexported fields }
Test is the model entity for the Test schema.
func (*Test) Unwrap ¶
Unwrap unwraps the Test 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 (*Test) Update ¶
func (t *Test) Update() *TestUpdateOne
Update returns a builder for updating this Test. Note that you need to call Test.Unwrap() before calling this method if this Test was returned from a transaction, and the transaction was committed or rolled back.
type TestClient ¶
type TestClient struct {
// contains filtered or unexported fields
}
TestClient is a client for the Test schema.
func NewTestClient ¶
func NewTestClient(c config) *TestClient
NewTestClient returns a client for the Test from the given config.
func (*TestClient) Create ¶
func (c *TestClient) Create() *TestCreate
Create returns a create builder for Test.
func (*TestClient) CreateBulk ¶
func (c *TestClient) CreateBulk(builders ...*TestCreate) *TestCreateBulk
CreateBulk returns a builder for creating a bulk of Test entities.
func (*TestClient) Delete ¶
func (c *TestClient) Delete() *TestDelete
Delete returns a delete builder for Test.
func (*TestClient) DeleteOne ¶
func (c *TestClient) DeleteOne(t *Test) *TestDeleteOne
DeleteOne returns a delete builder for the given entity.
func (*TestClient) DeleteOneID ¶
func (c *TestClient) DeleteOneID(id int) *TestDeleteOne
DeleteOneID returns a delete builder for the given id.
func (*TestClient) GetX ¶
func (c *TestClient) GetX(ctx context.Context, id int) *Test
GetX is like Get, but panics if an error occurs.
func (*TestClient) Query ¶
func (c *TestClient) Query() *TestQuery
Query returns a query builder for Test.
func (*TestClient) Update ¶
func (c *TestClient) Update() *TestUpdate
Update returns an update builder for Test.
func (*TestClient) UpdateOne ¶
func (c *TestClient) UpdateOne(t *Test) *TestUpdateOne
UpdateOne returns an update builder for the given entity.
func (*TestClient) UpdateOneID ¶
func (c *TestClient) UpdateOneID(id int) *TestUpdateOne
UpdateOneID returns an update builder for the given id.
func (*TestClient) Use ¶
func (c *TestClient) Use(hooks ...Hook)
Use adds a list of mutation hooks to the hooks stack. A call to `Use(f, g, h)` equals to `test.Hooks(f(g(h())))`.
type TestConnection ¶
type TestConnection struct { Edges []*TestEdge `json:"edges"` PageInfo PageInfo `json:"pageInfo"` TotalCount int `json:"totalCount"` }
TestConnection is the connection containing edges to Test.
type TestCreate ¶
type TestCreate struct {
// contains filtered or unexported fields
}
TestCreate is the builder for creating a Test entity.
func (*TestCreate) Exec ¶
func (tc *TestCreate) Exec(ctx context.Context) error
Exec executes the query.
func (*TestCreate) ExecX ¶
func (tc *TestCreate) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*TestCreate) Mutation ¶
func (tc *TestCreate) Mutation() *TestMutation
Mutation returns the TestMutation object of the builder.
func (*TestCreate) Save ¶
func (tc *TestCreate) Save(ctx context.Context) (*Test, error)
Save creates the Test in the database.
func (*TestCreate) SaveX ¶
func (tc *TestCreate) SaveX(ctx context.Context) *Test
SaveX calls Save and panics if Save returns an error.
func (*TestCreate) SetTest ¶
func (tc *TestCreate) SetTest(t test.Test) *TestCreate
SetTest sets the "test" field.
type TestCreateBulk ¶
type TestCreateBulk struct {
// contains filtered or unexported fields
}
TestCreateBulk is the builder for creating many Test entities in bulk.
func (*TestCreateBulk) Exec ¶
func (tcb *TestCreateBulk) Exec(ctx context.Context) error
Exec executes the query.
func (*TestCreateBulk) ExecX ¶
func (tcb *TestCreateBulk) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
type TestDelete ¶
type TestDelete struct {
// contains filtered or unexported fields
}
TestDelete is the builder for deleting a Test entity.
func (*TestDelete) Exec ¶
func (td *TestDelete) Exec(ctx context.Context) (int, error)
Exec executes the deletion query and returns how many vertices were deleted.
func (*TestDelete) ExecX ¶
func (td *TestDelete) ExecX(ctx context.Context) int
ExecX is like Exec, but panics if an error occurs.
func (*TestDelete) Where ¶
func (td *TestDelete) Where(ps ...predicate.Test) *TestDelete
Where appends a list predicates to the TestDelete builder.
type TestDeleteOne ¶
type TestDeleteOne struct {
// contains filtered or unexported fields
}
TestDeleteOne is the builder for deleting a single Test entity.
func (*TestDeleteOne) Exec ¶
func (tdo *TestDeleteOne) Exec(ctx context.Context) error
Exec executes the deletion query.
func (*TestDeleteOne) ExecX ¶
func (tdo *TestDeleteOne) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
type TestGroupBy ¶
type TestGroupBy struct {
// contains filtered or unexported fields
}
TestGroupBy is the group-by builder for Test entities.
func (*TestGroupBy) Aggregate ¶
func (tgb *TestGroupBy) Aggregate(fns ...AggregateFunc) *TestGroupBy
Aggregate adds the given aggregation functions to the group-by query.
func (*TestGroupBy) Bool ¶
func (tgb *TestGroupBy) Bool(ctx context.Context) (_ bool, err error)
Bool returns a single bool from a group-by query. It is only allowed when executing a group-by query with one field.
func (*TestGroupBy) BoolX ¶
func (tgb *TestGroupBy) BoolX(ctx context.Context) bool
BoolX is like Bool, but panics if an error occurs.
func (*TestGroupBy) Bools ¶
func (tgb *TestGroupBy) Bools(ctx context.Context) ([]bool, error)
Bools returns list of bools from group-by. It is only allowed when executing a group-by query with one field.
func (*TestGroupBy) BoolsX ¶
func (tgb *TestGroupBy) BoolsX(ctx context.Context) []bool
BoolsX is like Bools, but panics if an error occurs.
func (*TestGroupBy) Float64 ¶
func (tgb *TestGroupBy) Float64(ctx context.Context) (_ float64, err error)
Float64 returns a single float64 from a group-by query. It is only allowed when executing a group-by query with one field.
func (*TestGroupBy) Float64X ¶
func (tgb *TestGroupBy) Float64X(ctx context.Context) float64
Float64X is like Float64, but panics if an error occurs.
func (*TestGroupBy) Float64s ¶
func (tgb *TestGroupBy) Float64s(ctx context.Context) ([]float64, error)
Float64s returns list of float64s from group-by. It is only allowed when executing a group-by query with one field.
func (*TestGroupBy) Float64sX ¶
func (tgb *TestGroupBy) Float64sX(ctx context.Context) []float64
Float64sX is like Float64s, but panics if an error occurs.
func (*TestGroupBy) Int ¶
func (tgb *TestGroupBy) Int(ctx context.Context) (_ int, err error)
Int returns a single int from a group-by query. It is only allowed when executing a group-by query with one field.
func (*TestGroupBy) IntX ¶
func (tgb *TestGroupBy) IntX(ctx context.Context) int
IntX is like Int, but panics if an error occurs.
func (*TestGroupBy) Ints ¶
func (tgb *TestGroupBy) Ints(ctx context.Context) ([]int, error)
Ints returns list of ints from group-by. It is only allowed when executing a group-by query with one field.
func (*TestGroupBy) IntsX ¶
func (tgb *TestGroupBy) IntsX(ctx context.Context) []int
IntsX is like Ints, but panics if an error occurs.
func (*TestGroupBy) Scan ¶
func (tgb *TestGroupBy) Scan(ctx context.Context, v interface{}) error
Scan applies the group-by query and scans the result into the given value.
func (*TestGroupBy) ScanX ¶
func (tgb *TestGroupBy) ScanX(ctx context.Context, v interface{})
ScanX is like Scan, but panics if an error occurs.
func (*TestGroupBy) String ¶
func (tgb *TestGroupBy) String(ctx context.Context) (_ string, err error)
String returns a single string from a group-by query. It is only allowed when executing a group-by query with one field.
func (*TestGroupBy) StringX ¶
func (tgb *TestGroupBy) StringX(ctx context.Context) string
StringX is like String, but panics if an error occurs.
type TestMutation ¶
type TestMutation struct {
// contains filtered or unexported fields
}
TestMutation represents an operation that mutates the Test nodes in the graph.
func (*TestMutation) AddField ¶
func (m *TestMutation) 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 (*TestMutation) AddedEdges ¶
func (m *TestMutation) AddedEdges() []string
AddedEdges returns all edge names that were set/added in this mutation.
func (*TestMutation) AddedField ¶
func (m *TestMutation) 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 (*TestMutation) AddedFields ¶
func (m *TestMutation) AddedFields() []string
AddedFields returns all numeric fields that were incremented/decremented during this mutation.
func (*TestMutation) AddedIDs ¶
func (m *TestMutation) AddedIDs(name string) []ent.Value
AddedIDs returns all IDs (to other nodes) that were added for the given edge name in this mutation.
func (*TestMutation) ClearEdge ¶
func (m *TestMutation) 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 (*TestMutation) ClearField ¶
func (m *TestMutation) 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 (*TestMutation) ClearedEdges ¶
func (m *TestMutation) ClearedEdges() []string
ClearedEdges returns all edge names that were cleared in this mutation.
func (*TestMutation) ClearedFields ¶
func (m *TestMutation) ClearedFields() []string
ClearedFields returns all nullable fields that were cleared during this mutation.
func (TestMutation) Client ¶
func (m TestMutation) 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 (*TestMutation) EdgeCleared ¶
func (m *TestMutation) EdgeCleared(name string) bool
EdgeCleared returns a boolean which indicates if the edge with the given name was cleared in this mutation.
func (*TestMutation) Field ¶
func (m *TestMutation) 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 (*TestMutation) FieldCleared ¶
func (m *TestMutation) FieldCleared(name string) bool
FieldCleared returns a boolean indicating if a field with the given name was cleared in this mutation.
func (*TestMutation) Fields ¶
func (m *TestMutation) 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 (*TestMutation) ID ¶
func (m *TestMutation) 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 (*TestMutation) OldField ¶
OldField returns the old value of the field from the database. An error is returned if the mutation operation is not UpdateOne, or the query to the database failed.
func (*TestMutation) OldTest ¶
OldTest returns the old "test" field's value of the Test entity. If the Test 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 (*TestMutation) RemovedEdges ¶
func (m *TestMutation) RemovedEdges() []string
RemovedEdges returns all edge names that were removed in this mutation.
func (*TestMutation) RemovedIDs ¶
func (m *TestMutation) 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 (*TestMutation) ResetEdge ¶
func (m *TestMutation) 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 (*TestMutation) ResetField ¶
func (m *TestMutation) 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 (*TestMutation) ResetTest ¶
func (m *TestMutation) ResetTest()
ResetTest resets all changes to the "test" field.
func (*TestMutation) SetField ¶
func (m *TestMutation) 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 (*TestMutation) SetTest ¶
func (m *TestMutation) SetTest(t test.Test)
SetTest sets the "test" field.
func (*TestMutation) Test ¶
func (m *TestMutation) Test() (r test.Test, exists bool)
Test returns the value of the "test" field in the mutation.
func (TestMutation) Tx ¶
func (m TestMutation) Tx() (*Tx, error)
Tx returns an `ent.Tx` for mutations that were executed in transactions; it returns an error otherwise.
func (*TestMutation) Type ¶
func (m *TestMutation) Type() string
Type returns the node type of this mutation (Test).
func (*TestMutation) Where ¶
func (m *TestMutation) Where(ps ...predicate.Test)
Where appends a list predicates to the TestMutation builder.
type TestOrder ¶
type TestOrder struct { Direction OrderDirection `json:"direction"` Field *TestOrderField `json:"field"` }
TestOrder defines the ordering of Test.
type TestOrderField ¶
type TestOrderField struct {
// contains filtered or unexported fields
}
TestOrderField defines the ordering field of Test.
type TestPaginateOption ¶
type TestPaginateOption func(*testPager) error
TestPaginateOption enables pagination customization.
func WithTestFilter ¶
func WithTestFilter(filter func(*TestQuery) (*TestQuery, error)) TestPaginateOption
WithTestFilter configures pagination filter.
func WithTestOrder ¶
func WithTestOrder(order *TestOrder) TestPaginateOption
WithTestOrder configures pagination ordering.
type TestQuery ¶
type TestQuery struct {
// contains filtered or unexported fields
}
TestQuery is the builder for querying Test entities.
func (*TestQuery) Clone ¶
Clone returns a duplicate of the TestQuery builder, including all associated steps. It can be used to prepare common query builders and use them differently after the clone is made.
func (*TestQuery) CollectFields ¶
CollectFields tells the query-builder to eagerly load connected nodes by resolver context.
func (*TestQuery) First ¶
First returns the first Test entity from the query. Returns a *NotFoundError when no Test was found.
func (*TestQuery) FirstID ¶
FirstID returns the first Test ID from the query. Returns a *NotFoundError when no Test ID was found.
func (*TestQuery) GroupBy ¶
func (tq *TestQuery) GroupBy(field string, fields ...string) *TestGroupBy
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 { Test test.Test `json:"test,omitempty"` Count int `json:"count,omitempty"` } client.Test.Query(). GroupBy(test.FieldTest). Aggregate(ent.Count()). Scan(ctx, &v)
func (*TestQuery) Only ¶
Only returns a single Test entity found by the query, ensuring it only returns one. Returns a *NotSingularError when exactly one Test entity is not found. Returns a *NotFoundError when no Test entities are found.
func (*TestQuery) OnlyID ¶
OnlyID is like Only, but returns the only Test ID in the query. Returns a *NotSingularError when exactly one Test ID is not found. Returns a *NotFoundError when no entities are found.
func (*TestQuery) Paginate ¶
func (t *TestQuery) Paginate( ctx context.Context, after *Cursor, first *int, before *Cursor, last *int, opts ...TestPaginateOption, ) (*TestConnection, error)
Paginate executes the query and returns a relay based cursor connection to Test.
func (*TestQuery) Select ¶
func (tq *TestQuery) Select(fields ...string) *TestSelect
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 { Test test.Test `json:"test,omitempty"` } client.Test.Query(). Select(test.FieldTest). Scan(ctx, &v)
type TestSelect ¶
type TestSelect struct { *TestQuery // contains filtered or unexported fields }
TestSelect is the builder for selecting fields of Test entities.
func (*TestSelect) Bool ¶
func (ts *TestSelect) Bool(ctx context.Context) (_ bool, err error)
Bool returns a single bool from a selector. It is only allowed when selecting one field.
func (*TestSelect) BoolX ¶
func (ts *TestSelect) BoolX(ctx context.Context) bool
BoolX is like Bool, but panics if an error occurs.
func (*TestSelect) Bools ¶
func (ts *TestSelect) Bools(ctx context.Context) ([]bool, error)
Bools returns list of bools from a selector. It is only allowed when selecting one field.
func (*TestSelect) BoolsX ¶
func (ts *TestSelect) BoolsX(ctx context.Context) []bool
BoolsX is like Bools, but panics if an error occurs.
func (*TestSelect) Float64 ¶
func (ts *TestSelect) Float64(ctx context.Context) (_ float64, err error)
Float64 returns a single float64 from a selector. It is only allowed when selecting one field.
func (*TestSelect) Float64X ¶
func (ts *TestSelect) Float64X(ctx context.Context) float64
Float64X is like Float64, but panics if an error occurs.
func (*TestSelect) Float64s ¶
func (ts *TestSelect) Float64s(ctx context.Context) ([]float64, error)
Float64s returns list of float64s from a selector. It is only allowed when selecting one field.
func (*TestSelect) Float64sX ¶
func (ts *TestSelect) Float64sX(ctx context.Context) []float64
Float64sX is like Float64s, but panics if an error occurs.
func (*TestSelect) Int ¶
func (ts *TestSelect) Int(ctx context.Context) (_ int, err error)
Int returns a single int from a selector. It is only allowed when selecting one field.
func (*TestSelect) IntX ¶
func (ts *TestSelect) IntX(ctx context.Context) int
IntX is like Int, but panics if an error occurs.
func (*TestSelect) Ints ¶
func (ts *TestSelect) Ints(ctx context.Context) ([]int, error)
Ints returns list of ints from a selector. It is only allowed when selecting one field.
func (*TestSelect) IntsX ¶
func (ts *TestSelect) IntsX(ctx context.Context) []int
IntsX is like Ints, but panics if an error occurs.
func (*TestSelect) Scan ¶
func (ts *TestSelect) Scan(ctx context.Context, v interface{}) error
Scan applies the selector query and scans the result into the given value.
func (*TestSelect) ScanX ¶
func (ts *TestSelect) ScanX(ctx context.Context, v interface{})
ScanX is like Scan, but panics if an error occurs.
func (*TestSelect) String ¶
func (ts *TestSelect) String(ctx context.Context) (_ string, err error)
String returns a single string from a selector. It is only allowed when selecting one field.
func (*TestSelect) StringX ¶
func (ts *TestSelect) StringX(ctx context.Context) string
StringX is like String, but panics if an error occurs.
type TestUpdate ¶
type TestUpdate struct {
// contains filtered or unexported fields
}
TestUpdate is the builder for updating Test entities.
func (*TestUpdate) Exec ¶
func (tu *TestUpdate) Exec(ctx context.Context) error
Exec executes the query.
func (*TestUpdate) ExecX ¶
func (tu *TestUpdate) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*TestUpdate) Mutation ¶
func (tu *TestUpdate) Mutation() *TestMutation
Mutation returns the TestMutation object of the builder.
func (*TestUpdate) Save ¶
func (tu *TestUpdate) Save(ctx context.Context) (int, error)
Save executes the query and returns the number of nodes affected by the update operation.
func (*TestUpdate) SaveX ¶
func (tu *TestUpdate) SaveX(ctx context.Context) int
SaveX is like Save, but panics if an error occurs.
func (*TestUpdate) SetTest ¶
func (tu *TestUpdate) SetTest(t test.Test) *TestUpdate
SetTest sets the "test" field.
func (*TestUpdate) Where ¶
func (tu *TestUpdate) Where(ps ...predicate.Test) *TestUpdate
Where appends a list predicates to the TestUpdate builder.
type TestUpdateOne ¶
type TestUpdateOne struct {
// contains filtered or unexported fields
}
TestUpdateOne is the builder for updating a single Test entity.
func (*TestUpdateOne) Exec ¶
func (tuo *TestUpdateOne) Exec(ctx context.Context) error
Exec executes the query on the entity.
func (*TestUpdateOne) ExecX ¶
func (tuo *TestUpdateOne) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*TestUpdateOne) Mutation ¶
func (tuo *TestUpdateOne) Mutation() *TestMutation
Mutation returns the TestMutation object of the builder.
func (*TestUpdateOne) Save ¶
func (tuo *TestUpdateOne) Save(ctx context.Context) (*Test, error)
Save executes the query and returns the updated Test entity.
func (*TestUpdateOne) SaveX ¶
func (tuo *TestUpdateOne) SaveX(ctx context.Context) *Test
SaveX is like Save, but panics if an error occurs.
func (*TestUpdateOne) Select ¶
func (tuo *TestUpdateOne) Select(field string, fields ...string) *TestUpdateOne
Select allows selecting one or more fields (columns) of the returned entity. The default is selecting all fields defined in the entity schema.
func (*TestUpdateOne) SetTest ¶
func (tuo *TestUpdateOne) SetTest(t test.Test) *TestUpdateOne
SetTest sets the "test" field.
type TestWhereInput ¶
type TestWhereInput struct { Not *TestWhereInput `json:"not,omitempty"` Or []*TestWhereInput `json:"or,omitempty"` And []*TestWhereInput `json:"and,omitempty"` // "id" field predicates. ID *int `json:"id,omitempty"` IDNEQ *int `json:"idNEQ,omitempty"` IDIn []int `json:"idIn,omitempty"` IDNotIn []int `json:"idNotIn,omitempty"` IDGT *int `json:"idGT,omitempty"` IDGTE *int `json:"idGTE,omitempty"` IDLT *int `json:"idLT,omitempty"` IDLTE *int `json:"idLTE,omitempty"` // "test" field predicates. Test *test.Test `json:"test,omitempty"` TestNEQ *test.Test `json:"testNEQ,omitempty"` TestIn []test.Test `json:"testIn,omitempty"` TestNotIn []test.Test `json:"testNotIn,omitempty"` }
TestWhereInput represents a where input for filtering Test queries.
type Tx ¶
type Tx struct { // OtherTest is the client for interacting with the OtherTest builders. OtherTest *OtherTestClient // Test is the client for interacting with the Test builders. Test *TestClient // contains filtered or unexported fields }
Tx is a transactional client that is created by calling Client.Tx().
func TxFromContext ¶
TxFromContext returns a Tx stored inside a context, or nil if there isn't one.
func (*Tx) OnRollback ¶
func (tx *Tx) OnRollback(f RollbackHook)
OnRollback adds a hook to call on rollback.
type ValidationError ¶
type ValidationError struct { Name string // Field or edge name. // contains filtered or unexported fields }
ValidationError returns when validating a field fails.
func (*ValidationError) Error ¶
func (e *ValidationError) Error() string
Error implements the error interface.
func (*ValidationError) Unwrap ¶
func (e *ValidationError) Unwrap() error
Unwrap implements the errors.Wrapper interface.
Source Files ¶
- client.go
- collection.go
- config.go
- context.go
- edge.go
- ent.go
- generate.go
- mutation.go
- node.go
- othertest.go
- othertest_create.go
- othertest_delete.go
- othertest_query.go
- othertest_update.go
- pagination.go
- runtime.go
- test.go
- test_create.go
- test_delete.go
- test_query.go
- test_update.go
- transaction.go
- tx.go
- where_input.go