Documentation ¶
Index ¶
- Constants
- func IsConstraintError(err error) bool
- func IsNotFound(err error) bool
- func IsNotLoaded(err error) bool
- func IsNotSingular(err error) bool
- func MaskNotFound(err error) error
- func NewContext(parent context.Context, c *Client) context.Context
- func NewTxContext(parent context.Context, tx *Tx) context.Context
- type AggregateFunc
- type Client
- type ConstraintError
- type Galaxies
- type Galaxy
- type GalaxyClient
- func (c *GalaxyClient) Create() *GalaxyCreate
- func (c *GalaxyClient) Delete() *GalaxyDelete
- func (c *GalaxyClient) DeleteOne(ga *Galaxy) *GalaxyDeleteOne
- func (c *GalaxyClient) DeleteOneID(id int) *GalaxyDeleteOne
- func (c *GalaxyClient) Get(ctx context.Context, id int) (*Galaxy, error)
- func (c *GalaxyClient) GetX(ctx context.Context, id int) *Galaxy
- func (c *GalaxyClient) Hooks() []Hook
- func (c *GalaxyClient) Query() *GalaxyQuery
- func (c *GalaxyClient) QueryPlanets(ga *Galaxy) *PlanetQuery
- func (c *GalaxyClient) Update() *GalaxyUpdate
- func (c *GalaxyClient) UpdateOne(ga *Galaxy) *GalaxyUpdateOne
- func (c *GalaxyClient) UpdateOneID(id int) *GalaxyUpdateOne
- func (c *GalaxyClient) Use(hooks ...Hook)
- type GalaxyCreate
- func (gc *GalaxyCreate) AddPlanetIDs(ids ...int) *GalaxyCreate
- func (gc *GalaxyCreate) AddPlanets(p ...*Planet) *GalaxyCreate
- func (gc *GalaxyCreate) Mutation() *GalaxyMutation
- func (gc *GalaxyCreate) Save(ctx context.Context) (*Galaxy, error)
- func (gc *GalaxyCreate) SaveX(ctx context.Context) *Galaxy
- func (gc *GalaxyCreate) SetName(s string) *GalaxyCreate
- func (gc *GalaxyCreate) SetType(ga galaxy.Type) *GalaxyCreate
- type GalaxyDelete
- type GalaxyDeleteOne
- type GalaxyEdges
- type GalaxyGroupBy
- func (ggb *GalaxyGroupBy) Aggregate(fns ...AggregateFunc) *GalaxyGroupBy
- func (ggb *GalaxyGroupBy) Bools(ctx context.Context) ([]bool, error)
- func (ggb *GalaxyGroupBy) BoolsX(ctx context.Context) []bool
- func (ggb *GalaxyGroupBy) Float64s(ctx context.Context) ([]float64, error)
- func (ggb *GalaxyGroupBy) Float64sX(ctx context.Context) []float64
- func (ggb *GalaxyGroupBy) Ints(ctx context.Context) ([]int, error)
- func (ggb *GalaxyGroupBy) IntsX(ctx context.Context) []int
- func (ggb *GalaxyGroupBy) Scan(ctx context.Context, v interface{}) error
- func (ggb *GalaxyGroupBy) ScanX(ctx context.Context, v interface{})
- func (ggb *GalaxyGroupBy) Strings(ctx context.Context) ([]string, error)
- func (ggb *GalaxyGroupBy) StringsX(ctx context.Context) []string
- type GalaxyMutation
- func (m *GalaxyMutation) AddField(name string, value ent.Value) error
- func (m *GalaxyMutation) AddPlanetIDs(ids ...int)
- func (m *GalaxyMutation) AddedEdges() []string
- func (m *GalaxyMutation) AddedField(name string) (ent.Value, bool)
- func (m *GalaxyMutation) AddedFields() []string
- func (m *GalaxyMutation) AddedIDs(name string) []ent.Value
- func (m *GalaxyMutation) ClearEdge(name string) error
- func (m *GalaxyMutation) ClearField(name string) error
- func (m *GalaxyMutation) ClearedEdges() []string
- func (m *GalaxyMutation) ClearedFields() []string
- func (m GalaxyMutation) Client() *Client
- func (m *GalaxyMutation) EdgeCleared(name string) bool
- func (m *GalaxyMutation) Field(name string) (ent.Value, bool)
- func (m *GalaxyMutation) FieldCleared(name string) bool
- func (m *GalaxyMutation) Fields() []string
- func (m *GalaxyMutation) GetType() (r galaxy.Type, exists bool)
- func (m *GalaxyMutation) ID() (id int, exists bool)
- func (m *GalaxyMutation) Name() (r string, exists bool)
- func (m *GalaxyMutation) OldField(ctx context.Context, name string) (ent.Value, error)
- func (m *GalaxyMutation) OldName(ctx context.Context) (v string, err error)
- func (m *GalaxyMutation) OldType(ctx context.Context) (v galaxy.Type, err error)
- func (m *GalaxyMutation) Op() Op
- func (m *GalaxyMutation) PlanetsIDs() (ids []int)
- func (m *GalaxyMutation) RemovePlanetIDs(ids ...int)
- func (m *GalaxyMutation) RemovedEdges() []string
- func (m *GalaxyMutation) RemovedIDs(name string) []ent.Value
- func (m *GalaxyMutation) RemovedPlanetsIDs() (ids []int)
- func (m *GalaxyMutation) ResetEdge(name string) error
- func (m *GalaxyMutation) ResetField(name string) error
- func (m *GalaxyMutation) ResetName()
- func (m *GalaxyMutation) ResetPlanets()
- func (m *GalaxyMutation) ResetType()
- func (m *GalaxyMutation) SetField(name string, value ent.Value) error
- func (m *GalaxyMutation) SetName(s string)
- func (m *GalaxyMutation) SetType(ga galaxy.Type)
- func (m GalaxyMutation) Tx() (*Tx, error)
- func (m *GalaxyMutation) Type() string
- type GalaxyQuery
- func (gq *GalaxyQuery) All(ctx context.Context) ([]*Galaxy, error)
- func (gq *GalaxyQuery) AllX(ctx context.Context) []*Galaxy
- func (gq *GalaxyQuery) Clone() *GalaxyQuery
- func (gq *GalaxyQuery) Count(ctx context.Context) (int, error)
- func (gq *GalaxyQuery) CountX(ctx context.Context) int
- func (gq *GalaxyQuery) Exist(ctx context.Context) (bool, error)
- func (gq *GalaxyQuery) ExistX(ctx context.Context) bool
- func (gq *GalaxyQuery) First(ctx context.Context) (*Galaxy, error)
- func (gq *GalaxyQuery) FirstID(ctx context.Context) (id int, err error)
- func (gq *GalaxyQuery) FirstX(ctx context.Context) *Galaxy
- func (gq *GalaxyQuery) FirstXID(ctx context.Context) int
- func (gq *GalaxyQuery) GroupBy(field string, fields ...string) *GalaxyGroupBy
- func (gq *GalaxyQuery) IDs(ctx context.Context) ([]int, error)
- func (gq *GalaxyQuery) IDsX(ctx context.Context) []int
- func (gq *GalaxyQuery) Limit(limit int) *GalaxyQuery
- func (gq *GalaxyQuery) Offset(offset int) *GalaxyQuery
- func (gq *GalaxyQuery) Only(ctx context.Context) (*Galaxy, error)
- func (gq *GalaxyQuery) OnlyID(ctx context.Context) (id int, err error)
- func (gq *GalaxyQuery) OnlyX(ctx context.Context) *Galaxy
- func (gq *GalaxyQuery) OnlyXID(ctx context.Context) int
- func (gq *GalaxyQuery) Order(o ...OrderFunc) *GalaxyQuery
- func (gq *GalaxyQuery) QueryPlanets() *PlanetQuery
- func (gq *GalaxyQuery) Select(field string, fields ...string) *GalaxySelect
- func (gq *GalaxyQuery) Where(ps ...predicate.Galaxy) *GalaxyQuery
- func (gq *GalaxyQuery) WithPlanets(opts ...func(*PlanetQuery)) *GalaxyQuery
- type GalaxySelect
- func (gs *GalaxySelect) Bools(ctx context.Context) ([]bool, error)
- func (gs *GalaxySelect) BoolsX(ctx context.Context) []bool
- func (gs *GalaxySelect) Float64s(ctx context.Context) ([]float64, error)
- func (gs *GalaxySelect) Float64sX(ctx context.Context) []float64
- func (gs *GalaxySelect) Ints(ctx context.Context) ([]int, error)
- func (gs *GalaxySelect) IntsX(ctx context.Context) []int
- func (gs *GalaxySelect) Scan(ctx context.Context, v interface{}) error
- func (gs *GalaxySelect) ScanX(ctx context.Context, v interface{})
- func (gs *GalaxySelect) Strings(ctx context.Context) ([]string, error)
- func (gs *GalaxySelect) StringsX(ctx context.Context) []string
- type GalaxyUpdate
- func (gu *GalaxyUpdate) AddPlanetIDs(ids ...int) *GalaxyUpdate
- func (gu *GalaxyUpdate) AddPlanets(p ...*Planet) *GalaxyUpdate
- func (gu *GalaxyUpdate) Exec(ctx context.Context) error
- func (gu *GalaxyUpdate) ExecX(ctx context.Context)
- func (gu *GalaxyUpdate) Mutation() *GalaxyMutation
- func (gu *GalaxyUpdate) RemovePlanetIDs(ids ...int) *GalaxyUpdate
- func (gu *GalaxyUpdate) RemovePlanets(p ...*Planet) *GalaxyUpdate
- func (gu *GalaxyUpdate) Save(ctx context.Context) (int, error)
- func (gu *GalaxyUpdate) SaveX(ctx context.Context) int
- func (gu *GalaxyUpdate) SetName(s string) *GalaxyUpdate
- func (gu *GalaxyUpdate) SetType(ga galaxy.Type) *GalaxyUpdate
- func (gu *GalaxyUpdate) Where(ps ...predicate.Galaxy) *GalaxyUpdate
- type GalaxyUpdateOne
- func (guo *GalaxyUpdateOne) AddPlanetIDs(ids ...int) *GalaxyUpdateOne
- func (guo *GalaxyUpdateOne) AddPlanets(p ...*Planet) *GalaxyUpdateOne
- func (guo *GalaxyUpdateOne) Exec(ctx context.Context) error
- func (guo *GalaxyUpdateOne) ExecX(ctx context.Context)
- func (guo *GalaxyUpdateOne) Mutation() *GalaxyMutation
- func (guo *GalaxyUpdateOne) RemovePlanetIDs(ids ...int) *GalaxyUpdateOne
- func (guo *GalaxyUpdateOne) RemovePlanets(p ...*Planet) *GalaxyUpdateOne
- func (guo *GalaxyUpdateOne) Save(ctx context.Context) (*Galaxy, error)
- func (guo *GalaxyUpdateOne) SaveX(ctx context.Context) *Galaxy
- func (guo *GalaxyUpdateOne) SetName(s string) *GalaxyUpdateOne
- func (guo *GalaxyUpdateOne) SetType(ga galaxy.Type) *GalaxyUpdateOne
- type Hook
- type MutateFunc
- type Mutation
- type Mutator
- type NotFoundError
- type NotLoadedError
- type NotSingularError
- type Op
- type Option
- type OrderFunc
- type Planet
- type PlanetClient
- func (c *PlanetClient) Create() *PlanetCreate
- func (c *PlanetClient) Delete() *PlanetDelete
- func (c *PlanetClient) DeleteOne(pl *Planet) *PlanetDeleteOne
- func (c *PlanetClient) DeleteOneID(id int) *PlanetDeleteOne
- func (c *PlanetClient) Get(ctx context.Context, id int) (*Planet, error)
- func (c *PlanetClient) GetX(ctx context.Context, id int) *Planet
- func (c *PlanetClient) Hooks() []Hook
- func (c *PlanetClient) Query() *PlanetQuery
- func (c *PlanetClient) QueryNeighbors(pl *Planet) *PlanetQuery
- func (c *PlanetClient) Update() *PlanetUpdate
- func (c *PlanetClient) UpdateOne(pl *Planet) *PlanetUpdateOne
- func (c *PlanetClient) UpdateOneID(id int) *PlanetUpdateOne
- func (c *PlanetClient) Use(hooks ...Hook)
- type PlanetCreate
- func (pc *PlanetCreate) AddNeighborIDs(ids ...int) *PlanetCreate
- func (pc *PlanetCreate) AddNeighbors(p ...*Planet) *PlanetCreate
- func (pc *PlanetCreate) Mutation() *PlanetMutation
- func (pc *PlanetCreate) Save(ctx context.Context) (*Planet, error)
- func (pc *PlanetCreate) SaveX(ctx context.Context) *Planet
- func (pc *PlanetCreate) SetAge(u uint) *PlanetCreate
- func (pc *PlanetCreate) SetName(s string) *PlanetCreate
- func (pc *PlanetCreate) SetNillableAge(u *uint) *PlanetCreate
- type PlanetDelete
- type PlanetDeleteOne
- type PlanetEdges
- type PlanetGroupBy
- func (pgb *PlanetGroupBy) Aggregate(fns ...AggregateFunc) *PlanetGroupBy
- func (pgb *PlanetGroupBy) Bools(ctx context.Context) ([]bool, error)
- func (pgb *PlanetGroupBy) BoolsX(ctx context.Context) []bool
- func (pgb *PlanetGroupBy) Float64s(ctx context.Context) ([]float64, error)
- func (pgb *PlanetGroupBy) Float64sX(ctx context.Context) []float64
- func (pgb *PlanetGroupBy) Ints(ctx context.Context) ([]int, error)
- func (pgb *PlanetGroupBy) IntsX(ctx context.Context) []int
- func (pgb *PlanetGroupBy) Scan(ctx context.Context, v interface{}) error
- func (pgb *PlanetGroupBy) ScanX(ctx context.Context, v interface{})
- func (pgb *PlanetGroupBy) Strings(ctx context.Context) ([]string, error)
- func (pgb *PlanetGroupBy) StringsX(ctx context.Context) []string
- type PlanetMutation
- func (m *PlanetMutation) AddAge(u uint)
- func (m *PlanetMutation) AddField(name string, value ent.Value) error
- func (m *PlanetMutation) AddNeighborIDs(ids ...int)
- func (m *PlanetMutation) AddedAge() (r uint, exists bool)
- func (m *PlanetMutation) AddedEdges() []string
- func (m *PlanetMutation) AddedField(name string) (ent.Value, bool)
- func (m *PlanetMutation) AddedFields() []string
- func (m *PlanetMutation) AddedIDs(name string) []ent.Value
- func (m *PlanetMutation) Age() (r uint, exists bool)
- func (m *PlanetMutation) AgeCleared() bool
- func (m *PlanetMutation) ClearAge()
- func (m *PlanetMutation) ClearEdge(name string) error
- func (m *PlanetMutation) ClearField(name string) error
- func (m *PlanetMutation) ClearedEdges() []string
- func (m *PlanetMutation) ClearedFields() []string
- func (m PlanetMutation) Client() *Client
- func (m *PlanetMutation) EdgeCleared(name string) bool
- func (m *PlanetMutation) Field(name string) (ent.Value, bool)
- func (m *PlanetMutation) FieldCleared(name string) bool
- func (m *PlanetMutation) Fields() []string
- func (m *PlanetMutation) ID() (id int, exists bool)
- func (m *PlanetMutation) Name() (r string, exists bool)
- func (m *PlanetMutation) NeighborsIDs() (ids []int)
- func (m *PlanetMutation) OldAge(ctx context.Context) (v uint, err error)
- func (m *PlanetMutation) OldField(ctx context.Context, name string) (ent.Value, error)
- func (m *PlanetMutation) OldName(ctx context.Context) (v string, err error)
- func (m *PlanetMutation) Op() Op
- func (m *PlanetMutation) RemoveNeighborIDs(ids ...int)
- func (m *PlanetMutation) RemovedEdges() []string
- func (m *PlanetMutation) RemovedIDs(name string) []ent.Value
- func (m *PlanetMutation) RemovedNeighborsIDs() (ids []int)
- func (m *PlanetMutation) ResetAge()
- func (m *PlanetMutation) ResetEdge(name string) error
- func (m *PlanetMutation) ResetField(name string) error
- func (m *PlanetMutation) ResetName()
- func (m *PlanetMutation) ResetNeighbors()
- func (m *PlanetMutation) SetAge(u uint)
- func (m *PlanetMutation) SetField(name string, value ent.Value) error
- func (m *PlanetMutation) SetName(s string)
- func (m PlanetMutation) Tx() (*Tx, error)
- func (m *PlanetMutation) Type() string
- type PlanetQuery
- func (pq *PlanetQuery) All(ctx context.Context) ([]*Planet, error)
- func (pq *PlanetQuery) AllX(ctx context.Context) []*Planet
- func (pq *PlanetQuery) Clone() *PlanetQuery
- func (pq *PlanetQuery) Count(ctx context.Context) (int, error)
- func (pq *PlanetQuery) CountX(ctx context.Context) int
- func (pq *PlanetQuery) Exist(ctx context.Context) (bool, error)
- func (pq *PlanetQuery) ExistX(ctx context.Context) bool
- func (pq *PlanetQuery) First(ctx context.Context) (*Planet, error)
- func (pq *PlanetQuery) FirstID(ctx context.Context) (id int, err error)
- func (pq *PlanetQuery) FirstX(ctx context.Context) *Planet
- func (pq *PlanetQuery) FirstXID(ctx context.Context) int
- func (pq *PlanetQuery) GroupBy(field string, fields ...string) *PlanetGroupBy
- func (pq *PlanetQuery) IDs(ctx context.Context) ([]int, error)
- func (pq *PlanetQuery) IDsX(ctx context.Context) []int
- func (pq *PlanetQuery) Limit(limit int) *PlanetQuery
- func (pq *PlanetQuery) Offset(offset int) *PlanetQuery
- func (pq *PlanetQuery) Only(ctx context.Context) (*Planet, error)
- func (pq *PlanetQuery) OnlyID(ctx context.Context) (id int, err error)
- func (pq *PlanetQuery) OnlyX(ctx context.Context) *Planet
- func (pq *PlanetQuery) OnlyXID(ctx context.Context) int
- func (pq *PlanetQuery) Order(o ...OrderFunc) *PlanetQuery
- func (pq *PlanetQuery) QueryNeighbors() *PlanetQuery
- func (pq *PlanetQuery) Select(field string, fields ...string) *PlanetSelect
- func (pq *PlanetQuery) Where(ps ...predicate.Planet) *PlanetQuery
- func (pq *PlanetQuery) WithNeighbors(opts ...func(*PlanetQuery)) *PlanetQuery
- type PlanetSelect
- func (ps *PlanetSelect) Bools(ctx context.Context) ([]bool, error)
- func (ps *PlanetSelect) BoolsX(ctx context.Context) []bool
- func (ps *PlanetSelect) Float64s(ctx context.Context) ([]float64, error)
- func (ps *PlanetSelect) Float64sX(ctx context.Context) []float64
- func (ps *PlanetSelect) Ints(ctx context.Context) ([]int, error)
- func (ps *PlanetSelect) IntsX(ctx context.Context) []int
- func (ps *PlanetSelect) Scan(ctx context.Context, v interface{}) error
- func (ps *PlanetSelect) ScanX(ctx context.Context, v interface{})
- func (ps *PlanetSelect) Strings(ctx context.Context) ([]string, error)
- func (ps *PlanetSelect) StringsX(ctx context.Context) []string
- type PlanetUpdate
- func (pu *PlanetUpdate) AddAge(u uint) *PlanetUpdate
- func (pu *PlanetUpdate) AddNeighborIDs(ids ...int) *PlanetUpdate
- func (pu *PlanetUpdate) AddNeighbors(p ...*Planet) *PlanetUpdate
- func (pu *PlanetUpdate) ClearAge() *PlanetUpdate
- func (pu *PlanetUpdate) Exec(ctx context.Context) error
- func (pu *PlanetUpdate) ExecX(ctx context.Context)
- func (pu *PlanetUpdate) Mutation() *PlanetMutation
- func (pu *PlanetUpdate) RemoveNeighborIDs(ids ...int) *PlanetUpdate
- func (pu *PlanetUpdate) RemoveNeighbors(p ...*Planet) *PlanetUpdate
- func (pu *PlanetUpdate) Save(ctx context.Context) (int, error)
- func (pu *PlanetUpdate) SaveX(ctx context.Context) int
- func (pu *PlanetUpdate) SetAge(u uint) *PlanetUpdate
- func (pu *PlanetUpdate) SetNillableAge(u *uint) *PlanetUpdate
- func (pu *PlanetUpdate) Where(ps ...predicate.Planet) *PlanetUpdate
- type PlanetUpdateOne
- func (puo *PlanetUpdateOne) AddAge(u uint) *PlanetUpdateOne
- func (puo *PlanetUpdateOne) AddNeighborIDs(ids ...int) *PlanetUpdateOne
- func (puo *PlanetUpdateOne) AddNeighbors(p ...*Planet) *PlanetUpdateOne
- func (puo *PlanetUpdateOne) ClearAge() *PlanetUpdateOne
- func (puo *PlanetUpdateOne) Exec(ctx context.Context) error
- func (puo *PlanetUpdateOne) ExecX(ctx context.Context)
- func (puo *PlanetUpdateOne) Mutation() *PlanetMutation
- func (puo *PlanetUpdateOne) RemoveNeighborIDs(ids ...int) *PlanetUpdateOne
- func (puo *PlanetUpdateOne) RemoveNeighbors(p ...*Planet) *PlanetUpdateOne
- func (puo *PlanetUpdateOne) Save(ctx context.Context) (*Planet, error)
- func (puo *PlanetUpdateOne) SaveX(ctx context.Context) *Planet
- func (puo *PlanetUpdateOne) SetAge(u uint) *PlanetUpdateOne
- func (puo *PlanetUpdateOne) SetNillableAge(u *uint) *PlanetUpdateOne
- type Planets
- type Policy
- type Query
- type Tx
- type Value
Constants ¶
const ( // Operation types. OpCreate = ent.OpCreate OpDelete = ent.OpDelete OpDeleteOne = ent.OpDeleteOne OpUpdate = ent.OpUpdate OpUpdateOne = ent.OpUpdateOne // Node types. TypeGalaxy = "Galaxy" TypePlanet = "Planet" )
Variables ¶
This section is empty.
Functions ¶
func IsConstraintError ¶
IsConstraintError returns a boolean indicating whether the error is a constraint failure.
func IsNotFound ¶
IsNotFound returns a boolean indicating whether the error is a not found error.
func IsNotLoaded ¶
IsNotLoaded returns a boolean indicating whether the error is a not loaded error.
func IsNotSingular ¶
IsNotSingular returns a boolean indicating whether the error is a not singular error.
func NewContext ¶
NewContext returns a new context with the given Client attached.
Types ¶
type AggregateFunc ¶ added in v0.2.2
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 // Galaxy is the client for interacting with the Galaxy builders. Galaxy *GalaxyClient // Planet is the client for interacting with the Planet builders. Planet *PlanetClient // contains filtered or unexported fields }
Client is the client that holds all ent builders.
func FromContext ¶
FromContext returns the Client stored in a context, or nil if there isn't one.
func Open ¶
Open opens a 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(). Galaxy. Query(). Count(ctx)
type ConstraintError ¶
type ConstraintError struct {
// contains filtered or unexported fields
}
ConstraintError returns when trying to create/update one or more entities and one or more of their constraints failed. For example, violation of edge or field uniqueness.
func (ConstraintError) Error ¶
func (e ConstraintError) Error() string
Error implements the error interface.
func (*ConstraintError) Unwrap ¶
func (e *ConstraintError) Unwrap() error
Unwrap implements the errors.Wrapper interface.
type Galaxy ¶ added in v0.1.5
type Galaxy struct { // ID of the ent. ID int `json:"id,omitempty"` // Name holds the value of the "name" field. Name string `json:"name,omitempty"` // Type holds the value of the "type" field. Type galaxy.Type `json:"type,omitempty"` // Edges holds the relations/edges for other nodes in the graph. // The values are being populated by the GalaxyQuery when eager-loading is set. Edges GalaxyEdges `json:"edges"` // contains filtered or unexported fields }
Galaxy is the model entity for the Galaxy schema.
func (*Galaxy) QueryPlanets ¶ added in v0.1.5
func (ga *Galaxy) QueryPlanets() *PlanetQuery
QueryPlanets queries the planets edge of the Galaxy.
func (*Galaxy) Unwrap ¶ added in v0.1.5
Unwrap unwraps the entity that was returned from a transaction after it was closed, so that all next queries will be executed through the driver which created the transaction.
func (*Galaxy) Update ¶ added in v0.1.5
func (ga *Galaxy) Update() *GalaxyUpdateOne
Update returns a builder for updating this Galaxy. Note that, you need to call Galaxy.Unwrap() before calling this method, if this Galaxy was returned from a transaction, and the transaction was committed or rolled back.
type GalaxyClient ¶ added in v0.1.5
type GalaxyClient struct {
// contains filtered or unexported fields
}
GalaxyClient is a client for the Galaxy schema.
func NewGalaxyClient ¶ added in v0.1.5
func NewGalaxyClient(c config) *GalaxyClient
NewGalaxyClient returns a client for the Galaxy from the given config.
func (*GalaxyClient) Create ¶ added in v0.1.5
func (c *GalaxyClient) Create() *GalaxyCreate
Create returns a create builder for Galaxy.
func (*GalaxyClient) Delete ¶ added in v0.1.5
func (c *GalaxyClient) Delete() *GalaxyDelete
Delete returns a delete builder for Galaxy.
func (*GalaxyClient) DeleteOne ¶ added in v0.1.5
func (c *GalaxyClient) DeleteOne(ga *Galaxy) *GalaxyDeleteOne
DeleteOne returns a delete builder for the given entity.
func (*GalaxyClient) DeleteOneID ¶ added in v0.1.5
func (c *GalaxyClient) DeleteOneID(id int) *GalaxyDeleteOne
DeleteOneID returns a delete builder for the given id.
func (*GalaxyClient) GetX ¶ added in v0.1.5
func (c *GalaxyClient) GetX(ctx context.Context, id int) *Galaxy
GetX is like Get, but panics if an error occurs.
func (*GalaxyClient) Hooks ¶ added in v0.1.5
func (c *GalaxyClient) Hooks() []Hook
Hooks returns the client hooks.
func (*GalaxyClient) Query ¶ added in v0.1.5
func (c *GalaxyClient) Query() *GalaxyQuery
Create returns a query builder for Galaxy.
func (*GalaxyClient) QueryPlanets ¶ added in v0.1.5
func (c *GalaxyClient) QueryPlanets(ga *Galaxy) *PlanetQuery
QueryPlanets queries the planets edge of a Galaxy.
func (*GalaxyClient) Update ¶ added in v0.1.5
func (c *GalaxyClient) Update() *GalaxyUpdate
Update returns an update builder for Galaxy.
func (*GalaxyClient) UpdateOne ¶ added in v0.1.5
func (c *GalaxyClient) UpdateOne(ga *Galaxy) *GalaxyUpdateOne
UpdateOne returns an update builder for the given entity.
func (*GalaxyClient) UpdateOneID ¶ added in v0.1.5
func (c *GalaxyClient) UpdateOneID(id int) *GalaxyUpdateOne
UpdateOneID returns an update builder for the given id.
func (*GalaxyClient) Use ¶ added in v0.1.5
func (c *GalaxyClient) Use(hooks ...Hook)
Use adds a list of mutation hooks to the hooks stack. A call to `Use(f, g, h)` equals to `galaxy.Hooks(f(g(h())))`.
type GalaxyCreate ¶ added in v0.1.5
type GalaxyCreate struct {
// contains filtered or unexported fields
}
GalaxyCreate is the builder for creating a Galaxy entity.
func (*GalaxyCreate) AddPlanetIDs ¶ added in v0.1.5
func (gc *GalaxyCreate) AddPlanetIDs(ids ...int) *GalaxyCreate
AddPlanetIDs adds the planets edge to Planet by ids.
func (*GalaxyCreate) AddPlanets ¶ added in v0.1.5
func (gc *GalaxyCreate) AddPlanets(p ...*Planet) *GalaxyCreate
AddPlanets adds the planets edges to Planet.
func (*GalaxyCreate) Mutation ¶ added in v0.2.3
func (gc *GalaxyCreate) Mutation() *GalaxyMutation
Mutation returns the GalaxyMutation object of the builder.
func (*GalaxyCreate) Save ¶ added in v0.1.5
func (gc *GalaxyCreate) Save(ctx context.Context) (*Galaxy, error)
Save creates the Galaxy in the database.
func (*GalaxyCreate) SaveX ¶ added in v0.1.5
func (gc *GalaxyCreate) SaveX(ctx context.Context) *Galaxy
SaveX calls Save and panics if Save returns an error.
func (*GalaxyCreate) SetName ¶ added in v0.1.5
func (gc *GalaxyCreate) SetName(s string) *GalaxyCreate
SetName sets the name field.
func (*GalaxyCreate) SetType ¶ added in v0.1.5
func (gc *GalaxyCreate) SetType(ga galaxy.Type) *GalaxyCreate
SetType sets the type field.
type GalaxyDelete ¶ added in v0.1.5
type GalaxyDelete struct {
// contains filtered or unexported fields
}
GalaxyDelete is the builder for deleting a Galaxy entity.
func (*GalaxyDelete) Exec ¶ added in v0.1.5
func (gd *GalaxyDelete) Exec(ctx context.Context) (int, error)
Exec executes the deletion query and returns how many vertices were deleted.
func (*GalaxyDelete) ExecX ¶ added in v0.1.5
func (gd *GalaxyDelete) ExecX(ctx context.Context) int
ExecX is like Exec, but panics if an error occurs.
func (*GalaxyDelete) Where ¶ added in v0.1.5
func (gd *GalaxyDelete) Where(ps ...predicate.Galaxy) *GalaxyDelete
Where adds a new predicate to the delete builder.
type GalaxyDeleteOne ¶ added in v0.1.5
type GalaxyDeleteOne struct {
// contains filtered or unexported fields
}
GalaxyDeleteOne is the builder for deleting a single Galaxy entity.
func (*GalaxyDeleteOne) Exec ¶ added in v0.1.5
func (gdo *GalaxyDeleteOne) Exec(ctx context.Context) error
Exec executes the deletion query.
func (*GalaxyDeleteOne) ExecX ¶ added in v0.1.5
func (gdo *GalaxyDeleteOne) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
type GalaxyEdges ¶ added in v0.1.5
type GalaxyEdges struct { // Planets holds the value of the planets edge. Planets []*Planet // contains filtered or unexported fields }
GalaxyEdges holds the relations/edges for other nodes in the graph.
func (GalaxyEdges) PlanetsOrErr ¶ added in v0.1.5
func (e GalaxyEdges) PlanetsOrErr() ([]*Planet, error)
PlanetsOrErr returns the Planets value or an error if the edge was not loaded in eager-loading.
type GalaxyGroupBy ¶ added in v0.1.5
type GalaxyGroupBy struct {
// contains filtered or unexported fields
}
GalaxyGroupBy is the builder for group-by Galaxy entities.
func (*GalaxyGroupBy) Aggregate ¶ added in v0.1.5
func (ggb *GalaxyGroupBy) Aggregate(fns ...AggregateFunc) *GalaxyGroupBy
Aggregate adds the given aggregation functions to the group-by query.
func (*GalaxyGroupBy) Bools ¶ added in v0.1.5
func (ggb *GalaxyGroupBy) Bools(ctx context.Context) ([]bool, error)
Bools returns list of bools from group-by. It is only allowed when querying group-by with one field.
func (*GalaxyGroupBy) BoolsX ¶ added in v0.1.5
func (ggb *GalaxyGroupBy) BoolsX(ctx context.Context) []bool
BoolsX is like Bools, but panics if an error occurs.
func (*GalaxyGroupBy) Float64s ¶ added in v0.1.5
func (ggb *GalaxyGroupBy) Float64s(ctx context.Context) ([]float64, error)
Float64s returns list of float64s from group-by. It is only allowed when querying group-by with one field.
func (*GalaxyGroupBy) Float64sX ¶ added in v0.1.5
func (ggb *GalaxyGroupBy) Float64sX(ctx context.Context) []float64
Float64sX is like Float64s, but panics if an error occurs.
func (*GalaxyGroupBy) Ints ¶ added in v0.1.5
func (ggb *GalaxyGroupBy) Ints(ctx context.Context) ([]int, error)
Ints returns list of ints from group-by. It is only allowed when querying group-by with one field.
func (*GalaxyGroupBy) IntsX ¶ added in v0.1.5
func (ggb *GalaxyGroupBy) IntsX(ctx context.Context) []int
IntsX is like Ints, but panics if an error occurs.
func (*GalaxyGroupBy) Scan ¶ added in v0.1.5
func (ggb *GalaxyGroupBy) Scan(ctx context.Context, v interface{}) error
Scan applies the group-by query and scan the result into the given value.
func (*GalaxyGroupBy) ScanX ¶ added in v0.1.5
func (ggb *GalaxyGroupBy) ScanX(ctx context.Context, v interface{})
ScanX is like Scan, but panics if an error occurs.
type GalaxyMutation ¶ added in v0.1.5
type GalaxyMutation struct {
// contains filtered or unexported fields
}
GalaxyMutation represents an operation that mutate the Galaxies nodes in the graph.
func (*GalaxyMutation) AddField ¶ added in v0.1.5
func (m *GalaxyMutation) AddField(name string, value ent.Value) error
AddField adds the value for the given name. It returns an error if the field is not defined in the schema, or if the type mismatch the field type.
func (*GalaxyMutation) AddPlanetIDs ¶ added in v0.1.5
func (m *GalaxyMutation) AddPlanetIDs(ids ...int)
AddPlanetIDs adds the planets edge to Planet by ids.
func (*GalaxyMutation) AddedEdges ¶ added in v0.1.5
func (m *GalaxyMutation) AddedEdges() []string
AddedEdges returns all edge names that were set/added in this mutation.
func (*GalaxyMutation) AddedField ¶ added in v0.1.5
func (m *GalaxyMutation) AddedField(name string) (ent.Value, bool)
AddedField returns the numeric value that was in/decremented from a field with the given name. The second value indicates that this field was not set, or was not define in the schema.
func (*GalaxyMutation) AddedFields ¶ added in v0.1.5
func (m *GalaxyMutation) AddedFields() []string
AddedFields returns all numeric fields that were incremented or decremented during this mutation.
func (*GalaxyMutation) AddedIDs ¶ added in v0.1.5
func (m *GalaxyMutation) AddedIDs(name string) []ent.Value
AddedIDs returns all ids (to other nodes) that were added for the given edge name.
func (*GalaxyMutation) ClearEdge ¶ added in v0.1.5
func (m *GalaxyMutation) ClearEdge(name string) error
ClearEdge clears the value for the given name. It returns an error if the edge name is not defined in the schema.
func (*GalaxyMutation) ClearField ¶ added in v0.1.5
func (m *GalaxyMutation) ClearField(name string) error
ClearField clears the value for the given name. It returns an error if the field is not defined in the schema.
func (*GalaxyMutation) ClearedEdges ¶ added in v0.1.5
func (m *GalaxyMutation) ClearedEdges() []string
ClearedEdges returns all edge names that were cleared in this mutation.
func (*GalaxyMutation) ClearedFields ¶ added in v0.1.5
func (m *GalaxyMutation) ClearedFields() []string
ClearedFields returns all nullable fields that were cleared during this mutation.
func (GalaxyMutation) Client ¶ added in v0.1.5
func (m GalaxyMutation) 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 (*GalaxyMutation) EdgeCleared ¶ added in v0.1.5
func (m *GalaxyMutation) EdgeCleared(name string) bool
EdgeCleared returns a boolean indicates if this edge was cleared in this mutation.
func (*GalaxyMutation) Field ¶ added in v0.1.5
func (m *GalaxyMutation) Field(name string) (ent.Value, bool)
Field returns the value of a field with the given name. The second boolean value indicates that this field was not set, or was not define in the schema.
func (*GalaxyMutation) FieldCleared ¶ added in v0.1.5
func (m *GalaxyMutation) FieldCleared(name string) bool
FieldCleared returns a boolean indicates if this field was cleared in this mutation.
func (*GalaxyMutation) Fields ¶ added in v0.1.5
func (m *GalaxyMutation) Fields() []string
Fields returns all fields that were changed during this mutation. Note that, in order to get all numeric fields that were in/decremented, call AddedFields().
func (*GalaxyMutation) GetType ¶ added in v0.1.5
func (m *GalaxyMutation) GetType() (r galaxy.Type, exists bool)
GetType returns the type value in the mutation.
func (*GalaxyMutation) ID ¶ added in v0.1.5
func (m *GalaxyMutation) ID() (id int, exists bool)
ID returns the id value in the mutation. Note that, the id is available only if it was provided to the builder.
func (*GalaxyMutation) Name ¶ added in v0.1.5
func (m *GalaxyMutation) Name() (r string, exists bool)
Name returns the name value in the mutation.
func (*GalaxyMutation) OldField ¶ added in v0.2.2
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 was failed.
func (*GalaxyMutation) OldName ¶ added in v0.2.2
func (m *GalaxyMutation) OldName(ctx context.Context) (v string, err error)
OldName returns the old name value of the Galaxy. If the Galaxy 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 database query fails.
func (*GalaxyMutation) OldType ¶ added in v0.2.2
OldType returns the old type value of the Galaxy. If the Galaxy 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 database query fails.
func (*GalaxyMutation) Op ¶ added in v0.1.5
func (m *GalaxyMutation) Op() Op
Op returns the operation name.
func (*GalaxyMutation) PlanetsIDs ¶ added in v0.1.5
func (m *GalaxyMutation) PlanetsIDs() (ids []int)
PlanetsIDs returns the planets ids in the mutation.
func (*GalaxyMutation) RemovePlanetIDs ¶ added in v0.1.5
func (m *GalaxyMutation) RemovePlanetIDs(ids ...int)
RemovePlanetIDs removes the planets edge to Planet by ids.
func (*GalaxyMutation) RemovedEdges ¶ added in v0.1.5
func (m *GalaxyMutation) RemovedEdges() []string
RemovedEdges returns all edge names that were removed in this mutation.
func (*GalaxyMutation) RemovedIDs ¶ added in v0.1.5
func (m *GalaxyMutation) RemovedIDs(name string) []ent.Value
RemovedIDs returns all ids (to other nodes) that were removed for the given edge name.
func (*GalaxyMutation) RemovedPlanetsIDs ¶ added in v0.1.5
func (m *GalaxyMutation) RemovedPlanetsIDs() (ids []int)
RemovedPlanets returns the removed ids of planets.
func (*GalaxyMutation) ResetEdge ¶ added in v0.1.5
func (m *GalaxyMutation) ResetEdge(name string) error
ResetEdge resets all changes in the mutation regarding the given edge name. It returns an error if the edge is not defined in the schema.
func (*GalaxyMutation) ResetField ¶ added in v0.1.5
func (m *GalaxyMutation) ResetField(name string) error
ResetField resets all changes in the mutation regarding the given field name. It returns an error if the field is not defined in the schema.
func (*GalaxyMutation) ResetName ¶ added in v0.1.5
func (m *GalaxyMutation) ResetName()
ResetName reset all changes of the "name" field.
func (*GalaxyMutation) ResetPlanets ¶ added in v0.1.5
func (m *GalaxyMutation) ResetPlanets()
ResetPlanets reset all changes of the "planets" edge.
func (*GalaxyMutation) ResetType ¶ added in v0.1.5
func (m *GalaxyMutation) ResetType()
ResetType reset all changes of the "type" field.
func (*GalaxyMutation) SetField ¶ added in v0.1.5
func (m *GalaxyMutation) SetField(name string, value ent.Value) error
SetField sets the value for the given name. It returns an error if the field is not defined in the schema, or if the type mismatch the field type.
func (*GalaxyMutation) SetName ¶ added in v0.1.5
func (m *GalaxyMutation) SetName(s string)
SetName sets the name field.
func (*GalaxyMutation) SetType ¶ added in v0.1.5
func (m *GalaxyMutation) SetType(ga galaxy.Type)
SetType sets the type field.
func (GalaxyMutation) Tx ¶ added in v0.1.5
func (m GalaxyMutation) Tx() (*Tx, error)
Tx returns an `ent.Tx` for mutations that were executed in transactions; it returns an error otherwise.
func (*GalaxyMutation) Type ¶ added in v0.1.5
func (m *GalaxyMutation) Type() string
Type returns the node type of this mutation (Galaxy).
type GalaxyQuery ¶ added in v0.1.5
type GalaxyQuery struct {
// contains filtered or unexported fields
}
GalaxyQuery is the builder for querying Galaxy entities.
func (*GalaxyQuery) All ¶ added in v0.1.5
func (gq *GalaxyQuery) All(ctx context.Context) ([]*Galaxy, error)
All executes the query and returns a list of Galaxies.
func (*GalaxyQuery) AllX ¶ added in v0.1.5
func (gq *GalaxyQuery) AllX(ctx context.Context) []*Galaxy
AllX is like All, but panics if an error occurs.
func (*GalaxyQuery) Clone ¶ added in v0.1.5
func (gq *GalaxyQuery) Clone() *GalaxyQuery
Clone returns a duplicate of the query builder, including all associated steps. It can be used to prepare common query builders and use them differently after the clone is made.
func (*GalaxyQuery) Count ¶ added in v0.1.5
func (gq *GalaxyQuery) Count(ctx context.Context) (int, error)
Count returns the count of the given query.
func (*GalaxyQuery) CountX ¶ added in v0.1.5
func (gq *GalaxyQuery) CountX(ctx context.Context) int
CountX is like Count, but panics if an error occurs.
func (*GalaxyQuery) Exist ¶ added in v0.1.5
func (gq *GalaxyQuery) Exist(ctx context.Context) (bool, error)
Exist returns true if the query has elements in the graph.
func (*GalaxyQuery) ExistX ¶ added in v0.1.5
func (gq *GalaxyQuery) ExistX(ctx context.Context) bool
ExistX is like Exist, but panics if an error occurs.
func (*GalaxyQuery) First ¶ added in v0.1.5
func (gq *GalaxyQuery) First(ctx context.Context) (*Galaxy, error)
First returns the first Galaxy entity in the query. Returns *NotFoundError when no galaxy was found.
func (*GalaxyQuery) FirstID ¶ added in v0.1.5
func (gq *GalaxyQuery) FirstID(ctx context.Context) (id int, err error)
FirstID returns the first Galaxy id in the query. Returns *NotFoundError when no id was found.
func (*GalaxyQuery) FirstX ¶ added in v0.1.5
func (gq *GalaxyQuery) FirstX(ctx context.Context) *Galaxy
FirstX is like First, but panics if an error occurs.
func (*GalaxyQuery) FirstXID ¶ added in v0.1.5
func (gq *GalaxyQuery) FirstXID(ctx context.Context) int
FirstXID is like FirstID, but panics if an error occurs.
func (*GalaxyQuery) GroupBy ¶ added in v0.1.5
func (gq *GalaxyQuery) GroupBy(field string, fields ...string) *GalaxyGroupBy
GroupBy used to group vertices by one or more fields/columns. It is often used with aggregate functions, like: count, max, mean, min, sum.
Example:
var v []struct { Name string `json:"name,omitempty"` Count int `json:"count,omitempty"` } client.Galaxy.Query(). GroupBy(galaxy.FieldName). Aggregate(ent.Count()). Scan(ctx, &v)
func (*GalaxyQuery) IDs ¶ added in v0.1.5
func (gq *GalaxyQuery) IDs(ctx context.Context) ([]int, error)
IDs executes the query and returns a list of Galaxy ids.
func (*GalaxyQuery) IDsX ¶ added in v0.1.5
func (gq *GalaxyQuery) IDsX(ctx context.Context) []int
IDsX is like IDs, but panics if an error occurs.
func (*GalaxyQuery) Limit ¶ added in v0.1.5
func (gq *GalaxyQuery) Limit(limit int) *GalaxyQuery
Limit adds a limit step to the query.
func (*GalaxyQuery) Offset ¶ added in v0.1.5
func (gq *GalaxyQuery) Offset(offset int) *GalaxyQuery
Offset adds an offset step to the query.
func (*GalaxyQuery) Only ¶ added in v0.1.5
func (gq *GalaxyQuery) Only(ctx context.Context) (*Galaxy, error)
Only returns the only Galaxy entity in the query, returns an error if not exactly one entity was returned.
func (*GalaxyQuery) OnlyID ¶ added in v0.1.5
func (gq *GalaxyQuery) OnlyID(ctx context.Context) (id int, err error)
OnlyID returns the only Galaxy id in the query, returns an error if not exactly one id was returned.
func (*GalaxyQuery) OnlyX ¶ added in v0.1.5
func (gq *GalaxyQuery) OnlyX(ctx context.Context) *Galaxy
OnlyX is like Only, but panics if an error occurs.
func (*GalaxyQuery) OnlyXID ¶ added in v0.1.5
func (gq *GalaxyQuery) OnlyXID(ctx context.Context) int
OnlyXID is like OnlyID, but panics if an error occurs.
func (*GalaxyQuery) Order ¶ added in v0.1.5
func (gq *GalaxyQuery) Order(o ...OrderFunc) *GalaxyQuery
Order adds an order step to the query.
func (*GalaxyQuery) QueryPlanets ¶ added in v0.1.5
func (gq *GalaxyQuery) QueryPlanets() *PlanetQuery
QueryPlanets chains the current query on the planets edge.
func (*GalaxyQuery) Select ¶ added in v0.1.5
func (gq *GalaxyQuery) Select(field string, fields ...string) *GalaxySelect
Select one or more fields from the given query.
Example:
var v []struct { Name string `json:"name,omitempty"` } client.Galaxy.Query(). Select(galaxy.FieldName). Scan(ctx, &v)
func (*GalaxyQuery) Where ¶ added in v0.1.5
func (gq *GalaxyQuery) Where(ps ...predicate.Galaxy) *GalaxyQuery
Where adds a new predicate for the builder.
func (*GalaxyQuery) WithPlanets ¶ added in v0.1.5
func (gq *GalaxyQuery) WithPlanets(opts ...func(*PlanetQuery)) *GalaxyQuery
WithPlanets tells the query-builder to eager-loads the nodes that are connected to
the "planets" edge. The optional arguments used to configure the query builder of the edge.
type GalaxySelect ¶ added in v0.1.5
type GalaxySelect struct {
// contains filtered or unexported fields
}
GalaxySelect is the builder for select fields of Galaxy entities.
func (*GalaxySelect) Bools ¶ added in v0.1.5
func (gs *GalaxySelect) Bools(ctx context.Context) ([]bool, error)
Bools returns list of bools from selector. It is only allowed when selecting one field.
func (*GalaxySelect) BoolsX ¶ added in v0.1.5
func (gs *GalaxySelect) BoolsX(ctx context.Context) []bool
BoolsX is like Bools, but panics if an error occurs.
func (*GalaxySelect) Float64s ¶ added in v0.1.5
func (gs *GalaxySelect) Float64s(ctx context.Context) ([]float64, error)
Float64s returns list of float64s from selector. It is only allowed when selecting one field.
func (*GalaxySelect) Float64sX ¶ added in v0.1.5
func (gs *GalaxySelect) Float64sX(ctx context.Context) []float64
Float64sX is like Float64s, but panics if an error occurs.
func (*GalaxySelect) Ints ¶ added in v0.1.5
func (gs *GalaxySelect) Ints(ctx context.Context) ([]int, error)
Ints returns list of ints from selector. It is only allowed when selecting one field.
func (*GalaxySelect) IntsX ¶ added in v0.1.5
func (gs *GalaxySelect) IntsX(ctx context.Context) []int
IntsX is like Ints, but panics if an error occurs.
func (*GalaxySelect) Scan ¶ added in v0.1.5
func (gs *GalaxySelect) Scan(ctx context.Context, v interface{}) error
Scan applies the selector query and scan the result into the given value.
func (*GalaxySelect) ScanX ¶ added in v0.1.5
func (gs *GalaxySelect) ScanX(ctx context.Context, v interface{})
ScanX is like Scan, but panics if an error occurs.
type GalaxyUpdate ¶ added in v0.1.5
type GalaxyUpdate struct {
// contains filtered or unexported fields
}
GalaxyUpdate is the builder for updating Galaxy entities.
func (*GalaxyUpdate) AddPlanetIDs ¶ added in v0.1.5
func (gu *GalaxyUpdate) AddPlanetIDs(ids ...int) *GalaxyUpdate
AddPlanetIDs adds the planets edge to Planet by ids.
func (*GalaxyUpdate) AddPlanets ¶ added in v0.1.5
func (gu *GalaxyUpdate) AddPlanets(p ...*Planet) *GalaxyUpdate
AddPlanets adds the planets edges to Planet.
func (*GalaxyUpdate) Exec ¶ added in v0.1.5
func (gu *GalaxyUpdate) Exec(ctx context.Context) error
Exec executes the query.
func (*GalaxyUpdate) ExecX ¶ added in v0.1.5
func (gu *GalaxyUpdate) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*GalaxyUpdate) Mutation ¶ added in v0.2.3
func (gu *GalaxyUpdate) Mutation() *GalaxyMutation
Mutation returns the GalaxyMutation object of the builder.
func (*GalaxyUpdate) RemovePlanetIDs ¶ added in v0.1.5
func (gu *GalaxyUpdate) RemovePlanetIDs(ids ...int) *GalaxyUpdate
RemovePlanetIDs removes the planets edge to Planet by ids.
func (*GalaxyUpdate) RemovePlanets ¶ added in v0.1.5
func (gu *GalaxyUpdate) RemovePlanets(p ...*Planet) *GalaxyUpdate
RemovePlanets removes planets edges to Planet.
func (*GalaxyUpdate) Save ¶ added in v0.1.5
func (gu *GalaxyUpdate) Save(ctx context.Context) (int, error)
Save executes the query and returns the number of rows/vertices matched by this operation.
func (*GalaxyUpdate) SaveX ¶ added in v0.1.5
func (gu *GalaxyUpdate) SaveX(ctx context.Context) int
SaveX is like Save, but panics if an error occurs.
func (*GalaxyUpdate) SetName ¶ added in v0.1.5
func (gu *GalaxyUpdate) SetName(s string) *GalaxyUpdate
SetName sets the name field.
func (*GalaxyUpdate) SetType ¶ added in v0.1.5
func (gu *GalaxyUpdate) SetType(ga galaxy.Type) *GalaxyUpdate
SetType sets the type field.
func (*GalaxyUpdate) Where ¶ added in v0.1.5
func (gu *GalaxyUpdate) Where(ps ...predicate.Galaxy) *GalaxyUpdate
Where adds a new predicate for the builder.
type GalaxyUpdateOne ¶ added in v0.1.5
type GalaxyUpdateOne struct {
// contains filtered or unexported fields
}
GalaxyUpdateOne is the builder for updating a single Galaxy entity.
func (*GalaxyUpdateOne) AddPlanetIDs ¶ added in v0.1.5
func (guo *GalaxyUpdateOne) AddPlanetIDs(ids ...int) *GalaxyUpdateOne
AddPlanetIDs adds the planets edge to Planet by ids.
func (*GalaxyUpdateOne) AddPlanets ¶ added in v0.1.5
func (guo *GalaxyUpdateOne) AddPlanets(p ...*Planet) *GalaxyUpdateOne
AddPlanets adds the planets edges to Planet.
func (*GalaxyUpdateOne) Exec ¶ added in v0.1.5
func (guo *GalaxyUpdateOne) Exec(ctx context.Context) error
Exec executes the query on the entity.
func (*GalaxyUpdateOne) ExecX ¶ added in v0.1.5
func (guo *GalaxyUpdateOne) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*GalaxyUpdateOne) Mutation ¶ added in v0.2.3
func (guo *GalaxyUpdateOne) Mutation() *GalaxyMutation
Mutation returns the GalaxyMutation object of the builder.
func (*GalaxyUpdateOne) RemovePlanetIDs ¶ added in v0.1.5
func (guo *GalaxyUpdateOne) RemovePlanetIDs(ids ...int) *GalaxyUpdateOne
RemovePlanetIDs removes the planets edge to Planet by ids.
func (*GalaxyUpdateOne) RemovePlanets ¶ added in v0.1.5
func (guo *GalaxyUpdateOne) RemovePlanets(p ...*Planet) *GalaxyUpdateOne
RemovePlanets removes planets edges to Planet.
func (*GalaxyUpdateOne) Save ¶ added in v0.1.5
func (guo *GalaxyUpdateOne) Save(ctx context.Context) (*Galaxy, error)
Save executes the query and returns the updated entity.
func (*GalaxyUpdateOne) SaveX ¶ added in v0.1.5
func (guo *GalaxyUpdateOne) SaveX(ctx context.Context) *Galaxy
SaveX is like Save, but panics if an error occurs.
func (*GalaxyUpdateOne) SetName ¶ added in v0.1.5
func (guo *GalaxyUpdateOne) SetName(s string) *GalaxyUpdateOne
SetName sets the name field.
func (*GalaxyUpdateOne) SetType ¶ added in v0.1.5
func (guo *GalaxyUpdateOne) SetType(ga galaxy.Type) *GalaxyUpdateOne
SetType sets the type field.
type MutateFunc ¶
type MutateFunc = ent.MutateFunc
ent aliases to avoid import conflict in user's code.
type NotFoundError ¶
type NotFoundError struct {
// contains filtered or unexported fields
}
NotFoundError returns when trying to fetch a specific entity and it was not found in the database.
func (*NotFoundError) Error ¶
func (e *NotFoundError) Error() string
Error implements the error interface.
type NotLoadedError ¶
type NotLoadedError struct {
// contains filtered or unexported fields
}
NotLoadedError returns when trying to get a node that was not loaded by the query.
func (*NotLoadedError) Error ¶
func (e *NotLoadedError) Error() string
Error implements the error interface.
type NotSingularError ¶
type NotSingularError struct {
// contains filtered or unexported fields
}
NotSingularError returns when trying to fetch a singular entity and more then one was found in the database.
func (*NotSingularError) Error ¶
func (e *NotSingularError) Error() string
Error implements the error interface.
type OrderFunc ¶ added in v0.2.2
OrderFunc applies an ordering on either graph traversal or sql selector.
type Planet ¶
type Planet struct { // ID of the ent. ID int `json:"id,omitempty"` // Name holds the value of the "name" field. Name string `json:"name,omitempty"` // Age holds the value of the "age" field. Age uint `json:"age,omitempty"` // Edges holds the relations/edges for other nodes in the graph. // The values are being populated by the PlanetQuery when eager-loading is set. Edges PlanetEdges `json:"edges"` // contains filtered or unexported fields }
Planet is the model entity for the Planet schema.
func (*Planet) QueryNeighbors ¶
func (pl *Planet) QueryNeighbors() *PlanetQuery
QueryNeighbors queries the neighbors edge of the Planet.
func (*Planet) Unwrap ¶
Unwrap unwraps the entity that was returned from a transaction after it was closed, so that all next queries will be executed through the driver which created the transaction.
func (*Planet) Update ¶
func (pl *Planet) Update() *PlanetUpdateOne
Update returns a builder for updating this Planet. Note that, you need to call Planet.Unwrap() before calling this method, if this Planet was returned from a transaction, and the transaction was committed or rolled back.
type PlanetClient ¶
type PlanetClient struct {
// contains filtered or unexported fields
}
PlanetClient is a client for the Planet schema.
func NewPlanetClient ¶
func NewPlanetClient(c config) *PlanetClient
NewPlanetClient returns a client for the Planet from the given config.
func (*PlanetClient) Create ¶
func (c *PlanetClient) Create() *PlanetCreate
Create returns a create builder for Planet.
func (*PlanetClient) Delete ¶
func (c *PlanetClient) Delete() *PlanetDelete
Delete returns a delete builder for Planet.
func (*PlanetClient) DeleteOne ¶
func (c *PlanetClient) DeleteOne(pl *Planet) *PlanetDeleteOne
DeleteOne returns a delete builder for the given entity.
func (*PlanetClient) DeleteOneID ¶
func (c *PlanetClient) DeleteOneID(id int) *PlanetDeleteOne
DeleteOneID returns a delete builder for the given id.
func (*PlanetClient) GetX ¶
func (c *PlanetClient) GetX(ctx context.Context, id int) *Planet
GetX is like Get, but panics if an error occurs.
func (*PlanetClient) Query ¶
func (c *PlanetClient) Query() *PlanetQuery
Create returns a query builder for Planet.
func (*PlanetClient) QueryNeighbors ¶
func (c *PlanetClient) QueryNeighbors(pl *Planet) *PlanetQuery
QueryNeighbors queries the neighbors edge of a Planet.
func (*PlanetClient) Update ¶
func (c *PlanetClient) Update() *PlanetUpdate
Update returns an update builder for Planet.
func (*PlanetClient) UpdateOne ¶
func (c *PlanetClient) UpdateOne(pl *Planet) *PlanetUpdateOne
UpdateOne returns an update builder for the given entity.
func (*PlanetClient) UpdateOneID ¶
func (c *PlanetClient) UpdateOneID(id int) *PlanetUpdateOne
UpdateOneID returns an update builder for the given id.
func (*PlanetClient) Use ¶
func (c *PlanetClient) Use(hooks ...Hook)
Use adds a list of mutation hooks to the hooks stack. A call to `Use(f, g, h)` equals to `planet.Hooks(f(g(h())))`.
type PlanetCreate ¶
type PlanetCreate struct {
// contains filtered or unexported fields
}
PlanetCreate is the builder for creating a Planet entity.
func (*PlanetCreate) AddNeighborIDs ¶
func (pc *PlanetCreate) AddNeighborIDs(ids ...int) *PlanetCreate
AddNeighborIDs adds the neighbors edge to Planet by ids.
func (*PlanetCreate) AddNeighbors ¶
func (pc *PlanetCreate) AddNeighbors(p ...*Planet) *PlanetCreate
AddNeighbors adds the neighbors edges to Planet.
func (*PlanetCreate) Mutation ¶ added in v0.2.3
func (pc *PlanetCreate) Mutation() *PlanetMutation
Mutation returns the PlanetMutation object of the builder.
func (*PlanetCreate) Save ¶
func (pc *PlanetCreate) Save(ctx context.Context) (*Planet, error)
Save creates the Planet in the database.
func (*PlanetCreate) SaveX ¶
func (pc *PlanetCreate) SaveX(ctx context.Context) *Planet
SaveX calls Save and panics if Save returns an error.
func (*PlanetCreate) SetAge ¶
func (pc *PlanetCreate) SetAge(u uint) *PlanetCreate
SetAge sets the age field.
func (*PlanetCreate) SetName ¶
func (pc *PlanetCreate) SetName(s string) *PlanetCreate
SetName sets the name field.
func (*PlanetCreate) SetNillableAge ¶
func (pc *PlanetCreate) SetNillableAge(u *uint) *PlanetCreate
SetNillableAge sets the age field if the given value is not nil.
type PlanetDelete ¶
type PlanetDelete struct {
// contains filtered or unexported fields
}
PlanetDelete is the builder for deleting a Planet entity.
func (*PlanetDelete) Exec ¶
func (pd *PlanetDelete) Exec(ctx context.Context) (int, error)
Exec executes the deletion query and returns how many vertices were deleted.
func (*PlanetDelete) ExecX ¶
func (pd *PlanetDelete) ExecX(ctx context.Context) int
ExecX is like Exec, but panics if an error occurs.
func (*PlanetDelete) Where ¶
func (pd *PlanetDelete) Where(ps ...predicate.Planet) *PlanetDelete
Where adds a new predicate to the delete builder.
type PlanetDeleteOne ¶
type PlanetDeleteOne struct {
// contains filtered or unexported fields
}
PlanetDeleteOne is the builder for deleting a single Planet entity.
func (*PlanetDeleteOne) Exec ¶
func (pdo *PlanetDeleteOne) Exec(ctx context.Context) error
Exec executes the deletion query.
func (*PlanetDeleteOne) ExecX ¶
func (pdo *PlanetDeleteOne) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
type PlanetEdges ¶
type PlanetEdges struct { // Neighbors holds the value of the neighbors edge. Neighbors []*Planet // contains filtered or unexported fields }
PlanetEdges holds the relations/edges for other nodes in the graph.
func (PlanetEdges) NeighborsOrErr ¶
func (e PlanetEdges) NeighborsOrErr() ([]*Planet, error)
NeighborsOrErr returns the Neighbors value or an error if the edge was not loaded in eager-loading.
type PlanetGroupBy ¶
type PlanetGroupBy struct {
// contains filtered or unexported fields
}
PlanetGroupBy is the builder for group-by Planet entities.
func (*PlanetGroupBy) Aggregate ¶
func (pgb *PlanetGroupBy) Aggregate(fns ...AggregateFunc) *PlanetGroupBy
Aggregate adds the given aggregation functions to the group-by query.
func (*PlanetGroupBy) Bools ¶
func (pgb *PlanetGroupBy) Bools(ctx context.Context) ([]bool, error)
Bools returns list of bools from group-by. It is only allowed when querying group-by with one field.
func (*PlanetGroupBy) BoolsX ¶
func (pgb *PlanetGroupBy) BoolsX(ctx context.Context) []bool
BoolsX is like Bools, but panics if an error occurs.
func (*PlanetGroupBy) Float64s ¶
func (pgb *PlanetGroupBy) Float64s(ctx context.Context) ([]float64, error)
Float64s returns list of float64s from group-by. It is only allowed when querying group-by with one field.
func (*PlanetGroupBy) Float64sX ¶
func (pgb *PlanetGroupBy) Float64sX(ctx context.Context) []float64
Float64sX is like Float64s, but panics if an error occurs.
func (*PlanetGroupBy) Ints ¶
func (pgb *PlanetGroupBy) Ints(ctx context.Context) ([]int, error)
Ints returns list of ints from group-by. It is only allowed when querying group-by with one field.
func (*PlanetGroupBy) IntsX ¶
func (pgb *PlanetGroupBy) IntsX(ctx context.Context) []int
IntsX is like Ints, but panics if an error occurs.
func (*PlanetGroupBy) Scan ¶
func (pgb *PlanetGroupBy) Scan(ctx context.Context, v interface{}) error
Scan applies the group-by query and scan the result into the given value.
func (*PlanetGroupBy) ScanX ¶
func (pgb *PlanetGroupBy) ScanX(ctx context.Context, v interface{})
ScanX is like Scan, but panics if an error occurs.
type PlanetMutation ¶
type PlanetMutation struct {
// contains filtered or unexported fields
}
PlanetMutation represents an operation that mutate the Planets nodes in the graph.
func (*PlanetMutation) AddField ¶
func (m *PlanetMutation) AddField(name string, value ent.Value) error
AddField adds the value for the given name. It returns an error if the field is not defined in the schema, or if the type mismatch the field type.
func (*PlanetMutation) AddNeighborIDs ¶
func (m *PlanetMutation) AddNeighborIDs(ids ...int)
AddNeighborIDs adds the neighbors edge to Planet by ids.
func (*PlanetMutation) AddedAge ¶
func (m *PlanetMutation) AddedAge() (r uint, exists bool)
AddedAge returns the value that was added to the age field in this mutation.
func (*PlanetMutation) AddedEdges ¶
func (m *PlanetMutation) AddedEdges() []string
AddedEdges returns all edge names that were set/added in this mutation.
func (*PlanetMutation) AddedField ¶
func (m *PlanetMutation) AddedField(name string) (ent.Value, bool)
AddedField returns the numeric value that was in/decremented from a field with the given name. The second value indicates that this field was not set, or was not define in the schema.
func (*PlanetMutation) AddedFields ¶
func (m *PlanetMutation) AddedFields() []string
AddedFields returns all numeric fields that were incremented or decremented during this mutation.
func (*PlanetMutation) AddedIDs ¶
func (m *PlanetMutation) AddedIDs(name string) []ent.Value
AddedIDs returns all ids (to other nodes) that were added for the given edge name.
func (*PlanetMutation) Age ¶
func (m *PlanetMutation) Age() (r uint, exists bool)
Age returns the age value in the mutation.
func (*PlanetMutation) AgeCleared ¶
func (m *PlanetMutation) AgeCleared() bool
AgeCleared returns if the field age was cleared in this mutation.
func (*PlanetMutation) ClearAge ¶
func (m *PlanetMutation) ClearAge()
ClearAge clears the value of age.
func (*PlanetMutation) ClearEdge ¶
func (m *PlanetMutation) ClearEdge(name string) error
ClearEdge clears the value for the given name. It returns an error if the edge name is not defined in the schema.
func (*PlanetMutation) ClearField ¶
func (m *PlanetMutation) ClearField(name string) error
ClearField clears the value for the given name. It returns an error if the field is not defined in the schema.
func (*PlanetMutation) ClearedEdges ¶
func (m *PlanetMutation) ClearedEdges() []string
ClearedEdges returns all edge names that were cleared in this mutation.
func (*PlanetMutation) ClearedFields ¶
func (m *PlanetMutation) ClearedFields() []string
ClearedFields returns all nullable fields that were cleared during this mutation.
func (PlanetMutation) Client ¶
func (m PlanetMutation) 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 (*PlanetMutation) EdgeCleared ¶
func (m *PlanetMutation) EdgeCleared(name string) bool
EdgeCleared returns a boolean indicates if this edge was cleared in this mutation.
func (*PlanetMutation) Field ¶
func (m *PlanetMutation) Field(name string) (ent.Value, bool)
Field returns the value of a field with the given name. The second boolean value indicates that this field was not set, or was not define in the schema.
func (*PlanetMutation) FieldCleared ¶
func (m *PlanetMutation) FieldCleared(name string) bool
FieldCleared returns a boolean indicates if this field was cleared in this mutation.
func (*PlanetMutation) Fields ¶
func (m *PlanetMutation) Fields() []string
Fields returns all fields that were changed during this mutation. Note that, in order to get all numeric fields that were in/decremented, call AddedFields().
func (*PlanetMutation) ID ¶
func (m *PlanetMutation) ID() (id int, exists bool)
ID returns the id value in the mutation. Note that, the id is available only if it was provided to the builder.
func (*PlanetMutation) Name ¶
func (m *PlanetMutation) Name() (r string, exists bool)
Name returns the name value in the mutation.
func (*PlanetMutation) NeighborsIDs ¶
func (m *PlanetMutation) NeighborsIDs() (ids []int)
NeighborsIDs returns the neighbors ids in the mutation.
func (*PlanetMutation) OldAge ¶ added in v0.2.2
func (m *PlanetMutation) OldAge(ctx context.Context) (v uint, err error)
OldAge returns the old age value of the Planet. If the Planet 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 database query fails.
func (*PlanetMutation) OldField ¶ added in v0.2.2
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 was failed.
func (*PlanetMutation) OldName ¶ added in v0.2.2
func (m *PlanetMutation) OldName(ctx context.Context) (v string, err error)
OldName returns the old name value of the Planet. If the Planet 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 database query fails.
func (*PlanetMutation) RemoveNeighborIDs ¶
func (m *PlanetMutation) RemoveNeighborIDs(ids ...int)
RemoveNeighborIDs removes the neighbors edge to Planet by ids.
func (*PlanetMutation) RemovedEdges ¶
func (m *PlanetMutation) RemovedEdges() []string
RemovedEdges returns all edge names that were removed in this mutation.
func (*PlanetMutation) RemovedIDs ¶
func (m *PlanetMutation) RemovedIDs(name string) []ent.Value
RemovedIDs returns all ids (to other nodes) that were removed for the given edge name.
func (*PlanetMutation) RemovedNeighborsIDs ¶
func (m *PlanetMutation) RemovedNeighborsIDs() (ids []int)
RemovedNeighbors returns the removed ids of neighbors.
func (*PlanetMutation) ResetAge ¶
func (m *PlanetMutation) ResetAge()
ResetAge reset all changes of the "age" field.
func (*PlanetMutation) ResetEdge ¶
func (m *PlanetMutation) ResetEdge(name string) error
ResetEdge resets all changes in the mutation regarding the given edge name. It returns an error if the edge is not defined in the schema.
func (*PlanetMutation) ResetField ¶
func (m *PlanetMutation) ResetField(name string) error
ResetField resets all changes in the mutation regarding the given field name. It returns an error if the field is not defined in the schema.
func (*PlanetMutation) ResetName ¶
func (m *PlanetMutation) ResetName()
ResetName reset all changes of the "name" field.
func (*PlanetMutation) ResetNeighbors ¶
func (m *PlanetMutation) ResetNeighbors()
ResetNeighbors reset all changes of the "neighbors" edge.
func (*PlanetMutation) SetField ¶
func (m *PlanetMutation) SetField(name string, value ent.Value) error
SetField sets the value for the given name. It returns an error if the field is not defined in the schema, or if the type mismatch the field type.
func (*PlanetMutation) SetName ¶
func (m *PlanetMutation) SetName(s string)
SetName sets the name field.
func (PlanetMutation) Tx ¶
func (m PlanetMutation) Tx() (*Tx, error)
Tx returns an `ent.Tx` for mutations that were executed in transactions; it returns an error otherwise.
func (*PlanetMutation) Type ¶
func (m *PlanetMutation) Type() string
Type returns the node type of this mutation (Planet).
type PlanetQuery ¶
type PlanetQuery struct {
// contains filtered or unexported fields
}
PlanetQuery is the builder for querying Planet entities.
func (*PlanetQuery) All ¶
func (pq *PlanetQuery) All(ctx context.Context) ([]*Planet, error)
All executes the query and returns a list of Planets.
func (*PlanetQuery) AllX ¶
func (pq *PlanetQuery) AllX(ctx context.Context) []*Planet
AllX is like All, but panics if an error occurs.
func (*PlanetQuery) Clone ¶
func (pq *PlanetQuery) Clone() *PlanetQuery
Clone returns a duplicate of the query builder, including all associated steps. It can be used to prepare common query builders and use them differently after the clone is made.
func (*PlanetQuery) Count ¶
func (pq *PlanetQuery) Count(ctx context.Context) (int, error)
Count returns the count of the given query.
func (*PlanetQuery) CountX ¶
func (pq *PlanetQuery) CountX(ctx context.Context) int
CountX is like Count, but panics if an error occurs.
func (*PlanetQuery) Exist ¶
func (pq *PlanetQuery) Exist(ctx context.Context) (bool, error)
Exist returns true if the query has elements in the graph.
func (*PlanetQuery) ExistX ¶
func (pq *PlanetQuery) ExistX(ctx context.Context) bool
ExistX is like Exist, but panics if an error occurs.
func (*PlanetQuery) First ¶
func (pq *PlanetQuery) First(ctx context.Context) (*Planet, error)
First returns the first Planet entity in the query. Returns *NotFoundError when no planet was found.
func (*PlanetQuery) FirstID ¶
func (pq *PlanetQuery) FirstID(ctx context.Context) (id int, err error)
FirstID returns the first Planet id in the query. Returns *NotFoundError when no id was found.
func (*PlanetQuery) FirstX ¶
func (pq *PlanetQuery) FirstX(ctx context.Context) *Planet
FirstX is like First, but panics if an error occurs.
func (*PlanetQuery) FirstXID ¶
func (pq *PlanetQuery) FirstXID(ctx context.Context) int
FirstXID is like FirstID, but panics if an error occurs.
func (*PlanetQuery) GroupBy ¶
func (pq *PlanetQuery) GroupBy(field string, fields ...string) *PlanetGroupBy
GroupBy used to group vertices by one or more fields/columns. It is often used with aggregate functions, like: count, max, mean, min, sum.
Example:
var v []struct { Name string `json:"name,omitempty"` Count int `json:"count,omitempty"` } client.Planet.Query(). GroupBy(planet.FieldName). Aggregate(ent.Count()). Scan(ctx, &v)
func (*PlanetQuery) IDs ¶
func (pq *PlanetQuery) IDs(ctx context.Context) ([]int, error)
IDs executes the query and returns a list of Planet ids.
func (*PlanetQuery) IDsX ¶
func (pq *PlanetQuery) IDsX(ctx context.Context) []int
IDsX is like IDs, but panics if an error occurs.
func (*PlanetQuery) Limit ¶
func (pq *PlanetQuery) Limit(limit int) *PlanetQuery
Limit adds a limit step to the query.
func (*PlanetQuery) Offset ¶
func (pq *PlanetQuery) Offset(offset int) *PlanetQuery
Offset adds an offset step to the query.
func (*PlanetQuery) Only ¶
func (pq *PlanetQuery) Only(ctx context.Context) (*Planet, error)
Only returns the only Planet entity in the query, returns an error if not exactly one entity was returned.
func (*PlanetQuery) OnlyID ¶
func (pq *PlanetQuery) OnlyID(ctx context.Context) (id int, err error)
OnlyID returns the only Planet id in the query, returns an error if not exactly one id was returned.
func (*PlanetQuery) OnlyX ¶
func (pq *PlanetQuery) OnlyX(ctx context.Context) *Planet
OnlyX is like Only, but panics if an error occurs.
func (*PlanetQuery) OnlyXID ¶
func (pq *PlanetQuery) OnlyXID(ctx context.Context) int
OnlyXID is like OnlyID, but panics if an error occurs.
func (*PlanetQuery) Order ¶
func (pq *PlanetQuery) Order(o ...OrderFunc) *PlanetQuery
Order adds an order step to the query.
func (*PlanetQuery) QueryNeighbors ¶
func (pq *PlanetQuery) QueryNeighbors() *PlanetQuery
QueryNeighbors chains the current query on the neighbors edge.
func (*PlanetQuery) Select ¶
func (pq *PlanetQuery) Select(field string, fields ...string) *PlanetSelect
Select one or more fields from the given query.
Example:
var v []struct { Name string `json:"name,omitempty"` } client.Planet.Query(). Select(planet.FieldName). Scan(ctx, &v)
func (*PlanetQuery) Where ¶
func (pq *PlanetQuery) Where(ps ...predicate.Planet) *PlanetQuery
Where adds a new predicate for the builder.
func (*PlanetQuery) WithNeighbors ¶
func (pq *PlanetQuery) WithNeighbors(opts ...func(*PlanetQuery)) *PlanetQuery
WithNeighbors tells the query-builder to eager-loads the nodes that are connected to
the "neighbors" edge. The optional arguments used to configure the query builder of the edge.
type PlanetSelect ¶
type PlanetSelect struct {
// contains filtered or unexported fields
}
PlanetSelect is the builder for select fields of Planet entities.
func (*PlanetSelect) Bools ¶
func (ps *PlanetSelect) Bools(ctx context.Context) ([]bool, error)
Bools returns list of bools from selector. It is only allowed when selecting one field.
func (*PlanetSelect) BoolsX ¶
func (ps *PlanetSelect) BoolsX(ctx context.Context) []bool
BoolsX is like Bools, but panics if an error occurs.
func (*PlanetSelect) Float64s ¶
func (ps *PlanetSelect) Float64s(ctx context.Context) ([]float64, error)
Float64s returns list of float64s from selector. It is only allowed when selecting one field.
func (*PlanetSelect) Float64sX ¶
func (ps *PlanetSelect) Float64sX(ctx context.Context) []float64
Float64sX is like Float64s, but panics if an error occurs.
func (*PlanetSelect) Ints ¶
func (ps *PlanetSelect) Ints(ctx context.Context) ([]int, error)
Ints returns list of ints from selector. It is only allowed when selecting one field.
func (*PlanetSelect) IntsX ¶
func (ps *PlanetSelect) IntsX(ctx context.Context) []int
IntsX is like Ints, but panics if an error occurs.
func (*PlanetSelect) Scan ¶
func (ps *PlanetSelect) Scan(ctx context.Context, v interface{}) error
Scan applies the selector query and scan the result into the given value.
func (*PlanetSelect) ScanX ¶
func (ps *PlanetSelect) ScanX(ctx context.Context, v interface{})
ScanX is like Scan, but panics if an error occurs.
type PlanetUpdate ¶
type PlanetUpdate struct {
// contains filtered or unexported fields
}
PlanetUpdate is the builder for updating Planet entities.
func (*PlanetUpdate) AddAge ¶
func (pu *PlanetUpdate) AddAge(u uint) *PlanetUpdate
AddAge adds u to age.
func (*PlanetUpdate) AddNeighborIDs ¶
func (pu *PlanetUpdate) AddNeighborIDs(ids ...int) *PlanetUpdate
AddNeighborIDs adds the neighbors edge to Planet by ids.
func (*PlanetUpdate) AddNeighbors ¶
func (pu *PlanetUpdate) AddNeighbors(p ...*Planet) *PlanetUpdate
AddNeighbors adds the neighbors edges to Planet.
func (*PlanetUpdate) ClearAge ¶
func (pu *PlanetUpdate) ClearAge() *PlanetUpdate
ClearAge clears the value of age.
func (*PlanetUpdate) Exec ¶
func (pu *PlanetUpdate) Exec(ctx context.Context) error
Exec executes the query.
func (*PlanetUpdate) ExecX ¶
func (pu *PlanetUpdate) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*PlanetUpdate) Mutation ¶ added in v0.2.3
func (pu *PlanetUpdate) Mutation() *PlanetMutation
Mutation returns the PlanetMutation object of the builder.
func (*PlanetUpdate) RemoveNeighborIDs ¶
func (pu *PlanetUpdate) RemoveNeighborIDs(ids ...int) *PlanetUpdate
RemoveNeighborIDs removes the neighbors edge to Planet by ids.
func (*PlanetUpdate) RemoveNeighbors ¶
func (pu *PlanetUpdate) RemoveNeighbors(p ...*Planet) *PlanetUpdate
RemoveNeighbors removes neighbors edges to Planet.
func (*PlanetUpdate) Save ¶
func (pu *PlanetUpdate) Save(ctx context.Context) (int, error)
Save executes the query and returns the number of rows/vertices matched by this operation.
func (*PlanetUpdate) SaveX ¶
func (pu *PlanetUpdate) SaveX(ctx context.Context) int
SaveX is like Save, but panics if an error occurs.
func (*PlanetUpdate) SetAge ¶
func (pu *PlanetUpdate) SetAge(u uint) *PlanetUpdate
SetAge sets the age field.
func (*PlanetUpdate) SetNillableAge ¶
func (pu *PlanetUpdate) SetNillableAge(u *uint) *PlanetUpdate
SetNillableAge sets the age field if the given value is not nil.
func (*PlanetUpdate) Where ¶
func (pu *PlanetUpdate) Where(ps ...predicate.Planet) *PlanetUpdate
Where adds a new predicate for the builder.
type PlanetUpdateOne ¶
type PlanetUpdateOne struct {
// contains filtered or unexported fields
}
PlanetUpdateOne is the builder for updating a single Planet entity.
func (*PlanetUpdateOne) AddAge ¶
func (puo *PlanetUpdateOne) AddAge(u uint) *PlanetUpdateOne
AddAge adds u to age.
func (*PlanetUpdateOne) AddNeighborIDs ¶
func (puo *PlanetUpdateOne) AddNeighborIDs(ids ...int) *PlanetUpdateOne
AddNeighborIDs adds the neighbors edge to Planet by ids.
func (*PlanetUpdateOne) AddNeighbors ¶
func (puo *PlanetUpdateOne) AddNeighbors(p ...*Planet) *PlanetUpdateOne
AddNeighbors adds the neighbors edges to Planet.
func (*PlanetUpdateOne) ClearAge ¶
func (puo *PlanetUpdateOne) ClearAge() *PlanetUpdateOne
ClearAge clears the value of age.
func (*PlanetUpdateOne) Exec ¶
func (puo *PlanetUpdateOne) Exec(ctx context.Context) error
Exec executes the query on the entity.
func (*PlanetUpdateOne) ExecX ¶
func (puo *PlanetUpdateOne) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*PlanetUpdateOne) Mutation ¶ added in v0.2.3
func (puo *PlanetUpdateOne) Mutation() *PlanetMutation
Mutation returns the PlanetMutation object of the builder.
func (*PlanetUpdateOne) RemoveNeighborIDs ¶
func (puo *PlanetUpdateOne) RemoveNeighborIDs(ids ...int) *PlanetUpdateOne
RemoveNeighborIDs removes the neighbors edge to Planet by ids.
func (*PlanetUpdateOne) RemoveNeighbors ¶
func (puo *PlanetUpdateOne) RemoveNeighbors(p ...*Planet) *PlanetUpdateOne
RemoveNeighbors removes neighbors edges to Planet.
func (*PlanetUpdateOne) Save ¶
func (puo *PlanetUpdateOne) Save(ctx context.Context) (*Planet, error)
Save executes the query and returns the updated entity.
func (*PlanetUpdateOne) SaveX ¶
func (puo *PlanetUpdateOne) SaveX(ctx context.Context) *Planet
SaveX is like Save, but panics if an error occurs.
func (*PlanetUpdateOne) SetAge ¶
func (puo *PlanetUpdateOne) SetAge(u uint) *PlanetUpdateOne
SetAge sets the age field.
func (*PlanetUpdateOne) SetNillableAge ¶
func (puo *PlanetUpdateOne) SetNillableAge(u *uint) *PlanetUpdateOne
SetNillableAge sets the age field if the given value is not nil.
type Tx ¶
type Tx struct { // Galaxy is the client for interacting with the Galaxy builders. Galaxy *GalaxyClient // Planet is the client for interacting with the Planet builders. Planet *PlanetClient // contains filtered or unexported fields }
Tx is a transactional client that is created by calling Client.Tx().
func TxFromContext ¶ added in v0.1.5
TxFromContext returns the Tx stored in a context, or nil if there isn't one.
func (*Tx) OnRollback ¶ added in v0.1.5
OnRollback adds a function to call on rollback.