ent

package
v0.0.0-...-2a81287 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2023 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

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

	// Node types.
	TypeAirline = "Airline"
	TypeAirport = "Airport"
	TypePlane   = "Plane"
	TypeRoute   = "Route"
)

Variables

This section is empty.

Functions

func IsConstraintError

func IsConstraintError(err error) bool

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

func IsNotFound

func IsNotFound(err error) bool

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

func IsNotLoaded

func IsNotLoaded(err error) bool

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

func IsNotSingular

func IsNotSingular(err error) bool

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

func IsValidationError

func IsValidationError(err error) bool

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

func MaskNotFound

func MaskNotFound(err error) error

MaskNotFound masks not found error.

func NewContext

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

NewContext returns a new context with the given Client attached.

func NewTxContext

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

NewTxContext returns a new context with the given Tx attached.

Types

type AggregateFunc

type AggregateFunc func(*sql.Selector) string

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

func As

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

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

func Count

func Count() AggregateFunc

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

func Max

func Max(field string) AggregateFunc

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

func Mean

func Mean(field string) AggregateFunc

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

func Min

func Min(field string) AggregateFunc

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

func Sum

func Sum(field string) AggregateFunc

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

type Airline

type Airline struct {

	// ID of the ent.
	ID int `json:"id,omitempty"`
	// Name holds the value of the "name" field.
	Name string `json:"name,omitempty"`
	// Alias holds the value of the "alias" field.
	Alias string `json:"alias,omitempty"`
	// Country holds the value of the "country" field.
	Country string `json:"country,omitempty"`
	// Active holds the value of the "active" field.
	Active bool `json:"active,omitempty"`
	// contains filtered or unexported fields
}

Airline is the model entity for the Airline schema.

func (*Airline) String

func (a *Airline) String() string

String implements the fmt.Stringer.

func (*Airline) Unwrap

func (a *Airline) Unwrap() *Airline

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

func (a *Airline) Update() *AirlineUpdateOne

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

type AirlineClient

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

AirlineClient is a client for the Airline schema.

func NewAirlineClient

func NewAirlineClient(c config) *AirlineClient

NewAirlineClient returns a client for the Airline from the given config.

func (*AirlineClient) Create

func (c *AirlineClient) Create() *AirlineCreate

Create returns a builder for creating a Airline entity.

func (*AirlineClient) CreateBulk

func (c *AirlineClient) CreateBulk(builders ...*AirlineCreate) *AirlineCreateBulk

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

func (*AirlineClient) Delete

func (c *AirlineClient) Delete() *AirlineDelete

Delete returns a delete builder for Airline.

func (*AirlineClient) DeleteOne

func (c *AirlineClient) DeleteOne(a *Airline) *AirlineDeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*AirlineClient) DeleteOneID

func (c *AirlineClient) DeleteOneID(id int) *AirlineDeleteOne

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

func (*AirlineClient) Get

func (c *AirlineClient) Get(ctx context.Context, id int) (*Airline, error)

Get returns a Airline entity by its id.

func (*AirlineClient) GetX

func (c *AirlineClient) GetX(ctx context.Context, id int) *Airline

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

func (*AirlineClient) Hooks

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

Hooks returns the client hooks.

func (*AirlineClient) Intercept

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

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

func (*AirlineClient) Interceptors

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

Interceptors returns the client interceptors.

func (*AirlineClient) Query

func (c *AirlineClient) Query() *AirlineQuery

Query returns a query builder for Airline.

func (*AirlineClient) Update

func (c *AirlineClient) Update() *AirlineUpdate

Update returns an update builder for Airline.

func (*AirlineClient) UpdateOne

func (c *AirlineClient) UpdateOne(a *Airline) *AirlineUpdateOne

UpdateOne returns an update builder for the given entity.

func (*AirlineClient) UpdateOneID

func (c *AirlineClient) UpdateOneID(id int) *AirlineUpdateOne

UpdateOneID returns an update builder for the given id.

func (*AirlineClient) Use

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

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

type AirlineCreate

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

AirlineCreate is the builder for creating a Airline entity.

func (*AirlineCreate) Exec

func (ac *AirlineCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*AirlineCreate) ExecX

func (ac *AirlineCreate) ExecX(ctx context.Context)

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

func (*AirlineCreate) Mutation

func (ac *AirlineCreate) Mutation() *AirlineMutation

Mutation returns the AirlineMutation object of the builder.

func (*AirlineCreate) Save

func (ac *AirlineCreate) Save(ctx context.Context) (*Airline, error)

Save creates the Airline in the database.

func (*AirlineCreate) SaveX

func (ac *AirlineCreate) SaveX(ctx context.Context) *Airline

SaveX calls Save and panics if Save returns an error.

func (*AirlineCreate) SetActive

func (ac *AirlineCreate) SetActive(b bool) *AirlineCreate

SetActive sets the "active" field.

func (*AirlineCreate) SetAlias

func (ac *AirlineCreate) SetAlias(s string) *AirlineCreate

SetAlias sets the "alias" field.

func (*AirlineCreate) SetCountry

func (ac *AirlineCreate) SetCountry(s string) *AirlineCreate

SetCountry sets the "country" field.

func (*AirlineCreate) SetID

func (ac *AirlineCreate) SetID(i int) *AirlineCreate

SetID sets the "id" field.

func (*AirlineCreate) SetName

func (ac *AirlineCreate) SetName(s string) *AirlineCreate

SetName sets the "name" field.

type AirlineCreateBulk

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

AirlineCreateBulk is the builder for creating many Airline entities in bulk.

func (*AirlineCreateBulk) Exec

func (acb *AirlineCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*AirlineCreateBulk) ExecX

func (acb *AirlineCreateBulk) ExecX(ctx context.Context)

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

func (*AirlineCreateBulk) Save

func (acb *AirlineCreateBulk) Save(ctx context.Context) ([]*Airline, error)

Save creates the Airline entities in the database.

func (*AirlineCreateBulk) SaveX

func (acb *AirlineCreateBulk) SaveX(ctx context.Context) []*Airline

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

type AirlineDelete

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

AirlineDelete is the builder for deleting a Airline entity.

func (*AirlineDelete) Exec

func (ad *AirlineDelete) Exec(ctx context.Context) (int, error)

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

func (*AirlineDelete) ExecX

func (ad *AirlineDelete) ExecX(ctx context.Context) int

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

func (*AirlineDelete) Where

func (ad *AirlineDelete) Where(ps ...predicate.Airline) *AirlineDelete

Where appends a list predicates to the AirlineDelete builder.

type AirlineDeleteOne

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

AirlineDeleteOne is the builder for deleting a single Airline entity.

func (*AirlineDeleteOne) Exec

func (ado *AirlineDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*AirlineDeleteOne) ExecX

func (ado *AirlineDeleteOne) ExecX(ctx context.Context)

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

func (*AirlineDeleteOne) Where

Where appends a list predicates to the AirlineDelete builder.

type AirlineGroupBy

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

AirlineGroupBy is the group-by builder for Airline entities.

func (*AirlineGroupBy) Aggregate

func (agb *AirlineGroupBy) Aggregate(fns ...AggregateFunc) *AirlineGroupBy

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

func (*AirlineGroupBy) Bool

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

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

func (*AirlineGroupBy) BoolX

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

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

func (*AirlineGroupBy) Bools

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

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

func (*AirlineGroupBy) BoolsX

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

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

func (*AirlineGroupBy) Float64

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

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

func (*AirlineGroupBy) Float64X

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

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

func (*AirlineGroupBy) Float64s

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

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

func (*AirlineGroupBy) Float64sX

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

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

func (*AirlineGroupBy) Int

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

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

func (*AirlineGroupBy) IntX

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

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

func (*AirlineGroupBy) Ints

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

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

func (*AirlineGroupBy) IntsX

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

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

func (*AirlineGroupBy) Scan

func (agb *AirlineGroupBy) Scan(ctx context.Context, v any) error

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

func (*AirlineGroupBy) ScanX

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

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

func (*AirlineGroupBy) String

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

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

func (*AirlineGroupBy) StringX

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

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

func (*AirlineGroupBy) Strings

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

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

func (*AirlineGroupBy) StringsX

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

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

type AirlineMutation

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

AirlineMutation represents an operation that mutates the Airline nodes in the graph.

func (*AirlineMutation) Active

func (m *AirlineMutation) Active() (r bool, exists bool)

Active returns the value of the "active" field in the mutation.

func (*AirlineMutation) AddField

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

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

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

func (*AirlineMutation) AddedField

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

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

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

func (*AirlineMutation) AddedIDs

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

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

func (*AirlineMutation) Alias

func (m *AirlineMutation) Alias() (r string, exists bool)

Alias returns the value of the "alias" field in the mutation.

func (*AirlineMutation) ClearEdge

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

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

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

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

func (*AirlineMutation) ClearedFields

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

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

func (AirlineMutation) Client

func (m AirlineMutation) 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 (*AirlineMutation) Country

func (m *AirlineMutation) Country() (r string, exists bool)

Country returns the value of the "country" field in the mutation.

func (*AirlineMutation) EdgeCleared

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

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

func (*AirlineMutation) Field

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

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

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

func (*AirlineMutation) Fields

func (m *AirlineMutation) 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 (*AirlineMutation) ID

func (m *AirlineMutation) 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 (*AirlineMutation) IDs

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

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

func (*AirlineMutation) Name

func (m *AirlineMutation) Name() (r string, exists bool)

Name returns the value of the "name" field in the mutation.

func (*AirlineMutation) OldActive

func (m *AirlineMutation) OldActive(ctx context.Context) (v bool, err error)

OldActive returns the old "active" field's value of the Airline entity. If the Airline 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 (*AirlineMutation) OldAlias

func (m *AirlineMutation) OldAlias(ctx context.Context) (v string, err error)

OldAlias returns the old "alias" field's value of the Airline entity. If the Airline 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 (*AirlineMutation) OldCountry

func (m *AirlineMutation) OldCountry(ctx context.Context) (v string, err error)

OldCountry returns the old "country" field's value of the Airline entity. If the Airline 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 (*AirlineMutation) OldField

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

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

func (*AirlineMutation) OldName

func (m *AirlineMutation) OldName(ctx context.Context) (v string, err error)

OldName returns the old "name" field's value of the Airline entity. If the Airline 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 (*AirlineMutation) Op

func (m *AirlineMutation) Op() Op

Op returns the operation name.

func (*AirlineMutation) RemovedEdges

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

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

func (*AirlineMutation) RemovedIDs

func (m *AirlineMutation) 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 (*AirlineMutation) ResetActive

func (m *AirlineMutation) ResetActive()

ResetActive resets all changes to the "active" field.

func (*AirlineMutation) ResetAlias

func (m *AirlineMutation) ResetAlias()

ResetAlias resets all changes to the "alias" field.

func (*AirlineMutation) ResetCountry

func (m *AirlineMutation) ResetCountry()

ResetCountry resets all changes to the "country" field.

func (*AirlineMutation) ResetEdge

func (m *AirlineMutation) 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 (*AirlineMutation) ResetField

func (m *AirlineMutation) 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 (*AirlineMutation) ResetName

func (m *AirlineMutation) ResetName()

ResetName resets all changes to the "name" field.

func (*AirlineMutation) SetActive

func (m *AirlineMutation) SetActive(b bool)

SetActive sets the "active" field.

func (*AirlineMutation) SetAlias

func (m *AirlineMutation) SetAlias(s string)

SetAlias sets the "alias" field.

func (*AirlineMutation) SetCountry

func (m *AirlineMutation) SetCountry(s string)

SetCountry sets the "country" field.

func (*AirlineMutation) SetField

func (m *AirlineMutation) 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 (*AirlineMutation) SetID

func (m *AirlineMutation) SetID(id int)

SetID sets the value of the id field. Note that this operation is only accepted on creation of Airline entities.

func (*AirlineMutation) SetName

func (m *AirlineMutation) SetName(s string)

SetName sets the "name" field.

func (*AirlineMutation) SetOp

func (m *AirlineMutation) SetOp(op Op)

SetOp allows setting the mutation operation.

func (AirlineMutation) Tx

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

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

func (*AirlineMutation) Type

func (m *AirlineMutation) Type() string

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

func (*AirlineMutation) Where

func (m *AirlineMutation) Where(ps ...predicate.Airline)

Where appends a list predicates to the AirlineMutation builder.

func (*AirlineMutation) WhereP

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

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

type AirlineQuery

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

AirlineQuery is the builder for querying Airline entities.

func (*AirlineQuery) Aggregate

func (aq *AirlineQuery) Aggregate(fns ...AggregateFunc) *AirlineSelect

Aggregate returns a AirlineSelect configured with the given aggregations.

func (*AirlineQuery) All

func (aq *AirlineQuery) All(ctx context.Context) ([]*Airline, error)

All executes the query and returns a list of Airlines.

func (*AirlineQuery) AllX

func (aq *AirlineQuery) AllX(ctx context.Context) []*Airline

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

func (*AirlineQuery) Clone

func (aq *AirlineQuery) Clone() *AirlineQuery

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

func (*AirlineQuery) Count

func (aq *AirlineQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*AirlineQuery) CountX

func (aq *AirlineQuery) CountX(ctx context.Context) int

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

func (*AirlineQuery) Exist

func (aq *AirlineQuery) Exist(ctx context.Context) (bool, error)

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

func (*AirlineQuery) ExistX

func (aq *AirlineQuery) ExistX(ctx context.Context) bool

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

func (*AirlineQuery) First

func (aq *AirlineQuery) First(ctx context.Context) (*Airline, error)

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

func (*AirlineQuery) FirstID

func (aq *AirlineQuery) FirstID(ctx context.Context) (id int, err error)

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

func (*AirlineQuery) FirstIDX

func (aq *AirlineQuery) FirstIDX(ctx context.Context) int

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

func (*AirlineQuery) FirstX

func (aq *AirlineQuery) FirstX(ctx context.Context) *Airline

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

func (*AirlineQuery) GroupBy

func (aq *AirlineQuery) GroupBy(field string, fields ...string) *AirlineGroupBy

GroupBy is used to group vertices by one or more fields/columns. It is often used with aggregate functions, like: count, max, mean, min, sum.

Example:

var v []struct {
	Name string `json:"name,omitempty"`
	Count int `json:"count,omitempty"`
}

client.Airline.Query().
	GroupBy(airline.FieldName).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*AirlineQuery) IDs

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

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

func (*AirlineQuery) IDsX

func (aq *AirlineQuery) IDsX(ctx context.Context) []int

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

func (*AirlineQuery) Limit

func (aq *AirlineQuery) Limit(limit int) *AirlineQuery

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

func (*AirlineQuery) Offset

func (aq *AirlineQuery) Offset(offset int) *AirlineQuery

Offset to start from.

func (*AirlineQuery) Only

func (aq *AirlineQuery) Only(ctx context.Context) (*Airline, error)

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

func (*AirlineQuery) OnlyID

func (aq *AirlineQuery) OnlyID(ctx context.Context) (id int, err error)

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

func (*AirlineQuery) OnlyIDX

func (aq *AirlineQuery) OnlyIDX(ctx context.Context) int

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

func (*AirlineQuery) OnlyX

func (aq *AirlineQuery) OnlyX(ctx context.Context) *Airline

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

func (*AirlineQuery) Order

func (aq *AirlineQuery) Order(o ...OrderFunc) *AirlineQuery

Order specifies how the records should be ordered.

func (*AirlineQuery) Select

func (aq *AirlineQuery) Select(fields ...string) *AirlineSelect

Select allows the selection one or more fields/columns for the given query, instead of selecting all fields in the entity.

Example:

var v []struct {
	Name string `json:"name,omitempty"`
}

client.Airline.Query().
	Select(airline.FieldName).
	Scan(ctx, &v)

func (*AirlineQuery) Unique

func (aq *AirlineQuery) Unique(unique bool) *AirlineQuery

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 (*AirlineQuery) Where

func (aq *AirlineQuery) Where(ps ...predicate.Airline) *AirlineQuery

Where adds a new predicate for the AirlineQuery builder.

type AirlineSelect

type AirlineSelect struct {
	*AirlineQuery
	// contains filtered or unexported fields
}

AirlineSelect is the builder for selecting fields of Airline entities.

func (*AirlineSelect) Aggregate

func (as *AirlineSelect) Aggregate(fns ...AggregateFunc) *AirlineSelect

Aggregate adds the given aggregation functions to the selector query.

func (*AirlineSelect) Bool

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

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

func (*AirlineSelect) BoolX

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

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

func (*AirlineSelect) Bools

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

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

func (*AirlineSelect) BoolsX

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

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

func (*AirlineSelect) Float64

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

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

func (*AirlineSelect) Float64X

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

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

func (*AirlineSelect) Float64s

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

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

func (*AirlineSelect) Float64sX

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

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

func (*AirlineSelect) Int

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

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

func (*AirlineSelect) IntX

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

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

func (*AirlineSelect) Ints

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

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

func (*AirlineSelect) IntsX

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

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

func (*AirlineSelect) Scan

func (as *AirlineSelect) Scan(ctx context.Context, v any) error

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

func (*AirlineSelect) ScanX

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

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

func (*AirlineSelect) String

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

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

func (*AirlineSelect) StringX

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

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

func (*AirlineSelect) Strings

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

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

func (*AirlineSelect) StringsX

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

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

type AirlineUpdate

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

AirlineUpdate is the builder for updating Airline entities.

func (*AirlineUpdate) Exec

func (au *AirlineUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*AirlineUpdate) ExecX

func (au *AirlineUpdate) ExecX(ctx context.Context)

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

func (*AirlineUpdate) Mutation

func (au *AirlineUpdate) Mutation() *AirlineMutation

Mutation returns the AirlineMutation object of the builder.

func (*AirlineUpdate) Save

func (au *AirlineUpdate) Save(ctx context.Context) (int, error)

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

func (*AirlineUpdate) SaveX

func (au *AirlineUpdate) SaveX(ctx context.Context) int

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

func (*AirlineUpdate) SetActive

func (au *AirlineUpdate) SetActive(b bool) *AirlineUpdate

SetActive sets the "active" field.

func (*AirlineUpdate) SetAlias

func (au *AirlineUpdate) SetAlias(s string) *AirlineUpdate

SetAlias sets the "alias" field.

func (*AirlineUpdate) SetCountry

func (au *AirlineUpdate) SetCountry(s string) *AirlineUpdate

SetCountry sets the "country" field.

func (*AirlineUpdate) SetName

func (au *AirlineUpdate) SetName(s string) *AirlineUpdate

SetName sets the "name" field.

func (*AirlineUpdate) Where

func (au *AirlineUpdate) Where(ps ...predicate.Airline) *AirlineUpdate

Where appends a list predicates to the AirlineUpdate builder.

type AirlineUpdateOne

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

AirlineUpdateOne is the builder for updating a single Airline entity.

func (*AirlineUpdateOne) Exec

func (auo *AirlineUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*AirlineUpdateOne) ExecX

func (auo *AirlineUpdateOne) ExecX(ctx context.Context)

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

func (*AirlineUpdateOne) Mutation

func (auo *AirlineUpdateOne) Mutation() *AirlineMutation

Mutation returns the AirlineMutation object of the builder.

func (*AirlineUpdateOne) Save

func (auo *AirlineUpdateOne) Save(ctx context.Context) (*Airline, error)

Save executes the query and returns the updated Airline entity.

func (*AirlineUpdateOne) SaveX

func (auo *AirlineUpdateOne) SaveX(ctx context.Context) *Airline

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

func (*AirlineUpdateOne) Select

func (auo *AirlineUpdateOne) Select(field string, fields ...string) *AirlineUpdateOne

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

func (*AirlineUpdateOne) SetActive

func (auo *AirlineUpdateOne) SetActive(b bool) *AirlineUpdateOne

SetActive sets the "active" field.

func (*AirlineUpdateOne) SetAlias

func (auo *AirlineUpdateOne) SetAlias(s string) *AirlineUpdateOne

SetAlias sets the "alias" field.

func (*AirlineUpdateOne) SetCountry

func (auo *AirlineUpdateOne) SetCountry(s string) *AirlineUpdateOne

SetCountry sets the "country" field.

func (*AirlineUpdateOne) SetName

func (auo *AirlineUpdateOne) SetName(s string) *AirlineUpdateOne

SetName sets the "name" field.

func (*AirlineUpdateOne) Where

Where appends a list predicates to the AirlineUpdate builder.

type Airlines

type Airlines []*Airline

Airlines is a parsable slice of Airline.

type Airport

type Airport struct {

	// ID of the ent.
	ID int `json:"id,omitempty"`
	// Name holds the value of the "name" field.
	Name string `json:"name,omitempty"`
	// City holds the value of the "city" field.
	City string `json:"city,omitempty"`
	// Country holds the value of the "country" field.
	Country string `json:"country,omitempty"`
	// Iata holds the value of the "iata" field.
	Iata string `json:"iata,omitempty"`
	// Icao holds the value of the "icao" field.
	Icao string `json:"icao,omitempty"`
	// Latitude holds the value of the "latitude" field.
	Latitude float64 `json:"latitude,omitempty"`
	// Longitude holds the value of the "longitude" field.
	Longitude float64 `json:"longitude,omitempty"`
	// Altitude holds the value of the "altitude" field.
	Altitude int `json:"altitude,omitempty"`
	// Timezone holds the value of the "timezone" field.
	Timezone string `json:"timezone,omitempty"`
	// Dst holds the value of the "dst" field.
	Dst string `json:"dst,omitempty"`
	// TimezoneName holds the value of the "timezoneName" field.
	TimezoneName string `json:"timezoneName,omitempty"`
	// Type holds the value of the "type" field.
	Type string `json:"type,omitempty"`
	// Source holds the value of the "source" field.
	Source string `json:"source,omitempty"`
	// contains filtered or unexported fields
}

Airport is the model entity for the Airport schema.

func (*Airport) String

func (a *Airport) String() string

String implements the fmt.Stringer.

func (*Airport) Unwrap

func (a *Airport) Unwrap() *Airport

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

func (a *Airport) Update() *AirportUpdateOne

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

type AirportClient

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

AirportClient is a client for the Airport schema.

func NewAirportClient

func NewAirportClient(c config) *AirportClient

NewAirportClient returns a client for the Airport from the given config.

func (*AirportClient) Create

func (c *AirportClient) Create() *AirportCreate

Create returns a builder for creating a Airport entity.

func (*AirportClient) CreateBulk

func (c *AirportClient) CreateBulk(builders ...*AirportCreate) *AirportCreateBulk

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

func (*AirportClient) Delete

func (c *AirportClient) Delete() *AirportDelete

Delete returns a delete builder for Airport.

func (*AirportClient) DeleteOne

func (c *AirportClient) DeleteOne(a *Airport) *AirportDeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*AirportClient) DeleteOneID

func (c *AirportClient) DeleteOneID(id int) *AirportDeleteOne

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

func (*AirportClient) Get

func (c *AirportClient) Get(ctx context.Context, id int) (*Airport, error)

Get returns a Airport entity by its id.

func (*AirportClient) GetX

func (c *AirportClient) GetX(ctx context.Context, id int) *Airport

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

func (*AirportClient) Hooks

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

Hooks returns the client hooks.

func (*AirportClient) Intercept

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

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

func (*AirportClient) Interceptors

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

Interceptors returns the client interceptors.

func (*AirportClient) Query

func (c *AirportClient) Query() *AirportQuery

Query returns a query builder for Airport.

func (*AirportClient) Update

func (c *AirportClient) Update() *AirportUpdate

Update returns an update builder for Airport.

func (*AirportClient) UpdateOne

func (c *AirportClient) UpdateOne(a *Airport) *AirportUpdateOne

UpdateOne returns an update builder for the given entity.

func (*AirportClient) UpdateOneID

func (c *AirportClient) UpdateOneID(id int) *AirportUpdateOne

UpdateOneID returns an update builder for the given id.

func (*AirportClient) Use

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

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

type AirportCreate

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

AirportCreate is the builder for creating a Airport entity.

func (*AirportCreate) Exec

func (ac *AirportCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*AirportCreate) ExecX

func (ac *AirportCreate) ExecX(ctx context.Context)

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

func (*AirportCreate) Mutation

func (ac *AirportCreate) Mutation() *AirportMutation

Mutation returns the AirportMutation object of the builder.

func (*AirportCreate) Save

func (ac *AirportCreate) Save(ctx context.Context) (*Airport, error)

Save creates the Airport in the database.

func (*AirportCreate) SaveX

func (ac *AirportCreate) SaveX(ctx context.Context) *Airport

SaveX calls Save and panics if Save returns an error.

func (*AirportCreate) SetAltitude

func (ac *AirportCreate) SetAltitude(i int) *AirportCreate

SetAltitude sets the "altitude" field.

func (*AirportCreate) SetCity

func (ac *AirportCreate) SetCity(s string) *AirportCreate

SetCity sets the "city" field.

func (*AirportCreate) SetCountry

func (ac *AirportCreate) SetCountry(s string) *AirportCreate

SetCountry sets the "country" field.

func (*AirportCreate) SetDst

func (ac *AirportCreate) SetDst(s string) *AirportCreate

SetDst sets the "dst" field.

func (*AirportCreate) SetID

func (ac *AirportCreate) SetID(i int) *AirportCreate

SetID sets the "id" field.

func (*AirportCreate) SetIata

func (ac *AirportCreate) SetIata(s string) *AirportCreate

SetIata sets the "iata" field.

func (*AirportCreate) SetIcao

func (ac *AirportCreate) SetIcao(s string) *AirportCreate

SetIcao sets the "icao" field.

func (*AirportCreate) SetLatitude

func (ac *AirportCreate) SetLatitude(f float64) *AirportCreate

SetLatitude sets the "latitude" field.

func (*AirportCreate) SetLongitude

func (ac *AirportCreate) SetLongitude(f float64) *AirportCreate

SetLongitude sets the "longitude" field.

func (*AirportCreate) SetName

func (ac *AirportCreate) SetName(s string) *AirportCreate

SetName sets the "name" field.

func (*AirportCreate) SetNillableAltitude

func (ac *AirportCreate) SetNillableAltitude(i *int) *AirportCreate

SetNillableAltitude sets the "altitude" field if the given value is not nil.

func (*AirportCreate) SetNillableCity

func (ac *AirportCreate) SetNillableCity(s *string) *AirportCreate

SetNillableCity sets the "city" field if the given value is not nil.

func (*AirportCreate) SetNillableCountry

func (ac *AirportCreate) SetNillableCountry(s *string) *AirportCreate

SetNillableCountry sets the "country" field if the given value is not nil.

func (*AirportCreate) SetNillableDst

func (ac *AirportCreate) SetNillableDst(s *string) *AirportCreate

SetNillableDst sets the "dst" field if the given value is not nil.

func (*AirportCreate) SetNillableIata

func (ac *AirportCreate) SetNillableIata(s *string) *AirportCreate

SetNillableIata sets the "iata" field if the given value is not nil.

func (*AirportCreate) SetNillableIcao

func (ac *AirportCreate) SetNillableIcao(s *string) *AirportCreate

SetNillableIcao sets the "icao" field if the given value is not nil.

func (*AirportCreate) SetNillableLatitude

func (ac *AirportCreate) SetNillableLatitude(f *float64) *AirportCreate

SetNillableLatitude sets the "latitude" field if the given value is not nil.

func (*AirportCreate) SetNillableLongitude

func (ac *AirportCreate) SetNillableLongitude(f *float64) *AirportCreate

SetNillableLongitude sets the "longitude" field if the given value is not nil.

func (*AirportCreate) SetNillableName

func (ac *AirportCreate) SetNillableName(s *string) *AirportCreate

SetNillableName sets the "name" field if the given value is not nil.

func (*AirportCreate) SetNillableSource

func (ac *AirportCreate) SetNillableSource(s *string) *AirportCreate

SetNillableSource sets the "source" field if the given value is not nil.

func (*AirportCreate) SetNillableTimezone

func (ac *AirportCreate) SetNillableTimezone(s *string) *AirportCreate

SetNillableTimezone sets the "timezone" field if the given value is not nil.

func (*AirportCreate) SetNillableTimezoneName

func (ac *AirportCreate) SetNillableTimezoneName(s *string) *AirportCreate

SetNillableTimezoneName sets the "timezoneName" field if the given value is not nil.

func (*AirportCreate) SetNillableType

func (ac *AirportCreate) SetNillableType(s *string) *AirportCreate

SetNillableType sets the "type" field if the given value is not nil.

func (*AirportCreate) SetSource

func (ac *AirportCreate) SetSource(s string) *AirportCreate

SetSource sets the "source" field.

func (*AirportCreate) SetTimezone

func (ac *AirportCreate) SetTimezone(s string) *AirportCreate

SetTimezone sets the "timezone" field.

func (*AirportCreate) SetTimezoneName

func (ac *AirportCreate) SetTimezoneName(s string) *AirportCreate

SetTimezoneName sets the "timezoneName" field.

func (*AirportCreate) SetType

func (ac *AirportCreate) SetType(s string) *AirportCreate

SetType sets the "type" field.

type AirportCreateBulk

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

AirportCreateBulk is the builder for creating many Airport entities in bulk.

func (*AirportCreateBulk) Exec

func (acb *AirportCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*AirportCreateBulk) ExecX

func (acb *AirportCreateBulk) ExecX(ctx context.Context)

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

func (*AirportCreateBulk) Save

func (acb *AirportCreateBulk) Save(ctx context.Context) ([]*Airport, error)

Save creates the Airport entities in the database.

func (*AirportCreateBulk) SaveX

func (acb *AirportCreateBulk) SaveX(ctx context.Context) []*Airport

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

type AirportDelete

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

AirportDelete is the builder for deleting a Airport entity.

func (*AirportDelete) Exec

func (ad *AirportDelete) Exec(ctx context.Context) (int, error)

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

func (*AirportDelete) ExecX

func (ad *AirportDelete) ExecX(ctx context.Context) int

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

func (*AirportDelete) Where

func (ad *AirportDelete) Where(ps ...predicate.Airport) *AirportDelete

Where appends a list predicates to the AirportDelete builder.

type AirportDeleteOne

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

AirportDeleteOne is the builder for deleting a single Airport entity.

func (*AirportDeleteOne) Exec

func (ado *AirportDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*AirportDeleteOne) ExecX

func (ado *AirportDeleteOne) ExecX(ctx context.Context)

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

func (*AirportDeleteOne) Where

Where appends a list predicates to the AirportDelete builder.

type AirportGroupBy

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

AirportGroupBy is the group-by builder for Airport entities.

func (*AirportGroupBy) Aggregate

func (agb *AirportGroupBy) Aggregate(fns ...AggregateFunc) *AirportGroupBy

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

func (*AirportGroupBy) Bool

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

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

func (*AirportGroupBy) BoolX

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

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

func (*AirportGroupBy) Bools

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

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

func (*AirportGroupBy) BoolsX

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

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

func (*AirportGroupBy) Float64

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

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

func (*AirportGroupBy) Float64X

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

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

func (*AirportGroupBy) Float64s

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

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

func (*AirportGroupBy) Float64sX

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

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

func (*AirportGroupBy) Int

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

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

func (*AirportGroupBy) IntX

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

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

func (*AirportGroupBy) Ints

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

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

func (*AirportGroupBy) IntsX

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

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

func (*AirportGroupBy) Scan

func (agb *AirportGroupBy) Scan(ctx context.Context, v any) error

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

func (*AirportGroupBy) ScanX

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

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

func (*AirportGroupBy) String

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

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

func (*AirportGroupBy) StringX

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

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

func (*AirportGroupBy) Strings

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

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

func (*AirportGroupBy) StringsX

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

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

type AirportMutation

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

AirportMutation represents an operation that mutates the Airport nodes in the graph.

func (*AirportMutation) AddAltitude

func (m *AirportMutation) AddAltitude(i int)

AddAltitude adds i to the "altitude" field.

func (*AirportMutation) AddField

func (m *AirportMutation) 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 (*AirportMutation) AddLatitude

func (m *AirportMutation) AddLatitude(f float64)

AddLatitude adds f to the "latitude" field.

func (*AirportMutation) AddLongitude

func (m *AirportMutation) AddLongitude(f float64)

AddLongitude adds f to the "longitude" field.

func (*AirportMutation) AddedAltitude

func (m *AirportMutation) AddedAltitude() (r int, exists bool)

AddedAltitude returns the value that was added to the "altitude" field in this mutation.

func (*AirportMutation) AddedEdges

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

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

func (*AirportMutation) AddedField

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

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

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

func (*AirportMutation) AddedIDs

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

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

func (*AirportMutation) AddedLatitude

func (m *AirportMutation) AddedLatitude() (r float64, exists bool)

AddedLatitude returns the value that was added to the "latitude" field in this mutation.

func (*AirportMutation) AddedLongitude

func (m *AirportMutation) AddedLongitude() (r float64, exists bool)

AddedLongitude returns the value that was added to the "longitude" field in this mutation.

func (*AirportMutation) Altitude

func (m *AirportMutation) Altitude() (r int, exists bool)

Altitude returns the value of the "altitude" field in the mutation.

func (*AirportMutation) AltitudeCleared

func (m *AirportMutation) AltitudeCleared() bool

AltitudeCleared returns if the "altitude" field was cleared in this mutation.

func (*AirportMutation) City

func (m *AirportMutation) City() (r string, exists bool)

City returns the value of the "city" field in the mutation.

func (*AirportMutation) CityCleared

func (m *AirportMutation) CityCleared() bool

CityCleared returns if the "city" field was cleared in this mutation.

func (*AirportMutation) ClearAltitude

func (m *AirportMutation) ClearAltitude()

ClearAltitude clears the value of the "altitude" field.

func (*AirportMutation) ClearCity

func (m *AirportMutation) ClearCity()

ClearCity clears the value of the "city" field.

func (*AirportMutation) ClearCountry

func (m *AirportMutation) ClearCountry()

ClearCountry clears the value of the "country" field.

func (*AirportMutation) ClearDst

func (m *AirportMutation) ClearDst()

ClearDst clears the value of the "dst" field.

func (*AirportMutation) ClearEdge

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

func (m *AirportMutation) 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 (*AirportMutation) ClearIata

func (m *AirportMutation) ClearIata()

ClearIata clears the value of the "iata" field.

func (*AirportMutation) ClearIcao

func (m *AirportMutation) ClearIcao()

ClearIcao clears the value of the "icao" field.

func (*AirportMutation) ClearLatitude

func (m *AirportMutation) ClearLatitude()

ClearLatitude clears the value of the "latitude" field.

func (*AirportMutation) ClearLongitude

func (m *AirportMutation) ClearLongitude()

ClearLongitude clears the value of the "longitude" field.

func (*AirportMutation) ClearName

func (m *AirportMutation) ClearName()

ClearName clears the value of the "name" field.

func (*AirportMutation) ClearSource

func (m *AirportMutation) ClearSource()

ClearSource clears the value of the "source" field.

func (*AirportMutation) ClearTimezone

func (m *AirportMutation) ClearTimezone()

ClearTimezone clears the value of the "timezone" field.

func (*AirportMutation) ClearTimezoneName

func (m *AirportMutation) ClearTimezoneName()

ClearTimezoneName clears the value of the "timezoneName" field.

func (*AirportMutation) ClearType

func (m *AirportMutation) ClearType()

ClearType clears the value of the "type" field.

func (*AirportMutation) ClearedEdges

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

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

func (*AirportMutation) ClearedFields

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

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

func (AirportMutation) Client

func (m AirportMutation) 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 (*AirportMutation) Country

func (m *AirportMutation) Country() (r string, exists bool)

Country returns the value of the "country" field in the mutation.

func (*AirportMutation) CountryCleared

func (m *AirportMutation) CountryCleared() bool

CountryCleared returns if the "country" field was cleared in this mutation.

func (*AirportMutation) Dst

func (m *AirportMutation) Dst() (r string, exists bool)

Dst returns the value of the "dst" field in the mutation.

func (*AirportMutation) DstCleared

func (m *AirportMutation) DstCleared() bool

DstCleared returns if the "dst" field was cleared in this mutation.

func (*AirportMutation) EdgeCleared

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

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

func (*AirportMutation) Field

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

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

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

func (*AirportMutation) Fields

func (m *AirportMutation) 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 (*AirportMutation) GetType

func (m *AirportMutation) GetType() (r string, exists bool)

GetType returns the value of the "type" field in the mutation.

func (*AirportMutation) ID

func (m *AirportMutation) 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 (*AirportMutation) IDs

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

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

func (*AirportMutation) Iata

func (m *AirportMutation) Iata() (r string, exists bool)

Iata returns the value of the "iata" field in the mutation.

func (*AirportMutation) IataCleared

func (m *AirportMutation) IataCleared() bool

IataCleared returns if the "iata" field was cleared in this mutation.

func (*AirportMutation) Icao

func (m *AirportMutation) Icao() (r string, exists bool)

Icao returns the value of the "icao" field in the mutation.

func (*AirportMutation) IcaoCleared

func (m *AirportMutation) IcaoCleared() bool

IcaoCleared returns if the "icao" field was cleared in this mutation.

func (*AirportMutation) Latitude

func (m *AirportMutation) Latitude() (r float64, exists bool)

Latitude returns the value of the "latitude" field in the mutation.

func (*AirportMutation) LatitudeCleared

func (m *AirportMutation) LatitudeCleared() bool

LatitudeCleared returns if the "latitude" field was cleared in this mutation.

func (*AirportMutation) Longitude

func (m *AirportMutation) Longitude() (r float64, exists bool)

Longitude returns the value of the "longitude" field in the mutation.

func (*AirportMutation) LongitudeCleared

func (m *AirportMutation) LongitudeCleared() bool

LongitudeCleared returns if the "longitude" field was cleared in this mutation.

func (*AirportMutation) Name

func (m *AirportMutation) Name() (r string, exists bool)

Name returns the value of the "name" field in the mutation.

func (*AirportMutation) NameCleared

func (m *AirportMutation) NameCleared() bool

NameCleared returns if the "name" field was cleared in this mutation.

func (*AirportMutation) OldAltitude

func (m *AirportMutation) OldAltitude(ctx context.Context) (v int, err error)

OldAltitude returns the old "altitude" field's value of the Airport entity. If the Airport 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 (*AirportMutation) OldCity

func (m *AirportMutation) OldCity(ctx context.Context) (v string, err error)

OldCity returns the old "city" field's value of the Airport entity. If the Airport 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 (*AirportMutation) OldCountry

func (m *AirportMutation) OldCountry(ctx context.Context) (v string, err error)

OldCountry returns the old "country" field's value of the Airport entity. If the Airport 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 (*AirportMutation) OldDst

func (m *AirportMutation) OldDst(ctx context.Context) (v string, err error)

OldDst returns the old "dst" field's value of the Airport entity. If the Airport 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 (*AirportMutation) OldField

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

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

func (*AirportMutation) OldIata

func (m *AirportMutation) OldIata(ctx context.Context) (v string, err error)

OldIata returns the old "iata" field's value of the Airport entity. If the Airport 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 (*AirportMutation) OldIcao

func (m *AirportMutation) OldIcao(ctx context.Context) (v string, err error)

OldIcao returns the old "icao" field's value of the Airport entity. If the Airport 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 (*AirportMutation) OldLatitude

func (m *AirportMutation) OldLatitude(ctx context.Context) (v float64, err error)

OldLatitude returns the old "latitude" field's value of the Airport entity. If the Airport 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 (*AirportMutation) OldLongitude

func (m *AirportMutation) OldLongitude(ctx context.Context) (v float64, err error)

OldLongitude returns the old "longitude" field's value of the Airport entity. If the Airport 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 (*AirportMutation) OldName

func (m *AirportMutation) OldName(ctx context.Context) (v string, err error)

OldName returns the old "name" field's value of the Airport entity. If the Airport 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 (*AirportMutation) OldSource

func (m *AirportMutation) OldSource(ctx context.Context) (v string, err error)

OldSource returns the old "source" field's value of the Airport entity. If the Airport 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 (*AirportMutation) OldTimezone

func (m *AirportMutation) OldTimezone(ctx context.Context) (v string, err error)

OldTimezone returns the old "timezone" field's value of the Airport entity. If the Airport 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 (*AirportMutation) OldTimezoneName

func (m *AirportMutation) OldTimezoneName(ctx context.Context) (v string, err error)

OldTimezoneName returns the old "timezoneName" field's value of the Airport entity. If the Airport 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 (*AirportMutation) OldType

func (m *AirportMutation) OldType(ctx context.Context) (v string, err error)

OldType returns the old "type" field's value of the Airport entity. If the Airport 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 (*AirportMutation) Op

func (m *AirportMutation) Op() Op

Op returns the operation name.

func (*AirportMutation) RemovedEdges

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

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

func (*AirportMutation) RemovedIDs

func (m *AirportMutation) 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 (*AirportMutation) ResetAltitude

func (m *AirportMutation) ResetAltitude()

ResetAltitude resets all changes to the "altitude" field.

func (*AirportMutation) ResetCity

func (m *AirportMutation) ResetCity()

ResetCity resets all changes to the "city" field.

func (*AirportMutation) ResetCountry

func (m *AirportMutation) ResetCountry()

ResetCountry resets all changes to the "country" field.

func (*AirportMutation) ResetDst

func (m *AirportMutation) ResetDst()

ResetDst resets all changes to the "dst" field.

func (*AirportMutation) ResetEdge

func (m *AirportMutation) 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 (*AirportMutation) ResetField

func (m *AirportMutation) 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 (*AirportMutation) ResetIata

func (m *AirportMutation) ResetIata()

ResetIata resets all changes to the "iata" field.

func (*AirportMutation) ResetIcao

func (m *AirportMutation) ResetIcao()

ResetIcao resets all changes to the "icao" field.

func (*AirportMutation) ResetLatitude

func (m *AirportMutation) ResetLatitude()

ResetLatitude resets all changes to the "latitude" field.

func (*AirportMutation) ResetLongitude

func (m *AirportMutation) ResetLongitude()

ResetLongitude resets all changes to the "longitude" field.

func (*AirportMutation) ResetName

func (m *AirportMutation) ResetName()

ResetName resets all changes to the "name" field.

func (*AirportMutation) ResetSource

func (m *AirportMutation) ResetSource()

ResetSource resets all changes to the "source" field.

func (*AirportMutation) ResetTimezone

func (m *AirportMutation) ResetTimezone()

ResetTimezone resets all changes to the "timezone" field.

func (*AirportMutation) ResetTimezoneName

func (m *AirportMutation) ResetTimezoneName()

ResetTimezoneName resets all changes to the "timezoneName" field.

func (*AirportMutation) ResetType

func (m *AirportMutation) ResetType()

ResetType resets all changes to the "type" field.

func (*AirportMutation) SetAltitude

func (m *AirportMutation) SetAltitude(i int)

SetAltitude sets the "altitude" field.

func (*AirportMutation) SetCity

func (m *AirportMutation) SetCity(s string)

SetCity sets the "city" field.

func (*AirportMutation) SetCountry

func (m *AirportMutation) SetCountry(s string)

SetCountry sets the "country" field.

func (*AirportMutation) SetDst

func (m *AirportMutation) SetDst(s string)

SetDst sets the "dst" field.

func (*AirportMutation) SetField

func (m *AirportMutation) 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 (*AirportMutation) SetID

func (m *AirportMutation) SetID(id int)

SetID sets the value of the id field. Note that this operation is only accepted on creation of Airport entities.

func (*AirportMutation) SetIata

func (m *AirportMutation) SetIata(s string)

SetIata sets the "iata" field.

func (*AirportMutation) SetIcao

func (m *AirportMutation) SetIcao(s string)

SetIcao sets the "icao" field.

func (*AirportMutation) SetLatitude

func (m *AirportMutation) SetLatitude(f float64)

SetLatitude sets the "latitude" field.

func (*AirportMutation) SetLongitude

func (m *AirportMutation) SetLongitude(f float64)

SetLongitude sets the "longitude" field.

func (*AirportMutation) SetName

func (m *AirportMutation) SetName(s string)

SetName sets the "name" field.

func (*AirportMutation) SetOp

func (m *AirportMutation) SetOp(op Op)

SetOp allows setting the mutation operation.

func (*AirportMutation) SetSource

func (m *AirportMutation) SetSource(s string)

SetSource sets the "source" field.

func (*AirportMutation) SetTimezone

func (m *AirportMutation) SetTimezone(s string)

SetTimezone sets the "timezone" field.

func (*AirportMutation) SetTimezoneName

func (m *AirportMutation) SetTimezoneName(s string)

SetTimezoneName sets the "timezoneName" field.

func (*AirportMutation) SetType

func (m *AirportMutation) SetType(s string)

SetType sets the "type" field.

func (*AirportMutation) Source

func (m *AirportMutation) Source() (r string, exists bool)

Source returns the value of the "source" field in the mutation.

func (*AirportMutation) SourceCleared

func (m *AirportMutation) SourceCleared() bool

SourceCleared returns if the "source" field was cleared in this mutation.

func (*AirportMutation) Timezone

func (m *AirportMutation) Timezone() (r string, exists bool)

Timezone returns the value of the "timezone" field in the mutation.

func (*AirportMutation) TimezoneCleared

func (m *AirportMutation) TimezoneCleared() bool

TimezoneCleared returns if the "timezone" field was cleared in this mutation.

func (*AirportMutation) TimezoneName

func (m *AirportMutation) TimezoneName() (r string, exists bool)

TimezoneName returns the value of the "timezoneName" field in the mutation.

func (*AirportMutation) TimezoneNameCleared

func (m *AirportMutation) TimezoneNameCleared() bool

TimezoneNameCleared returns if the "timezoneName" field was cleared in this mutation.

func (AirportMutation) Tx

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

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

func (*AirportMutation) Type

func (m *AirportMutation) Type() string

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

func (*AirportMutation) TypeCleared

func (m *AirportMutation) TypeCleared() bool

TypeCleared returns if the "type" field was cleared in this mutation.

func (*AirportMutation) Where

func (m *AirportMutation) Where(ps ...predicate.Airport)

Where appends a list predicates to the AirportMutation builder.

func (*AirportMutation) WhereP

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

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

type AirportQuery

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

AirportQuery is the builder for querying Airport entities.

func (*AirportQuery) Aggregate

func (aq *AirportQuery) Aggregate(fns ...AggregateFunc) *AirportSelect

Aggregate returns a AirportSelect configured with the given aggregations.

func (*AirportQuery) All

func (aq *AirportQuery) All(ctx context.Context) ([]*Airport, error)

All executes the query and returns a list of Airports.

func (*AirportQuery) AllX

func (aq *AirportQuery) AllX(ctx context.Context) []*Airport

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

func (*AirportQuery) Clone

func (aq *AirportQuery) Clone() *AirportQuery

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

func (*AirportQuery) Count

func (aq *AirportQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*AirportQuery) CountX

func (aq *AirportQuery) CountX(ctx context.Context) int

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

func (*AirportQuery) Exist

func (aq *AirportQuery) Exist(ctx context.Context) (bool, error)

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

func (*AirportQuery) ExistX

func (aq *AirportQuery) ExistX(ctx context.Context) bool

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

func (*AirportQuery) First

func (aq *AirportQuery) First(ctx context.Context) (*Airport, error)

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

func (*AirportQuery) FirstID

func (aq *AirportQuery) FirstID(ctx context.Context) (id int, err error)

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

func (*AirportQuery) FirstIDX

func (aq *AirportQuery) FirstIDX(ctx context.Context) int

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

func (*AirportQuery) FirstX

func (aq *AirportQuery) FirstX(ctx context.Context) *Airport

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

func (*AirportQuery) GroupBy

func (aq *AirportQuery) GroupBy(field string, fields ...string) *AirportGroupBy

GroupBy is used to group vertices by one or more fields/columns. It is often used with aggregate functions, like: count, max, mean, min, sum.

Example:

var v []struct {
	Name string `json:"name,omitempty"`
	Count int `json:"count,omitempty"`
}

client.Airport.Query().
	GroupBy(airport.FieldName).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*AirportQuery) IDs

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

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

func (*AirportQuery) IDsX

func (aq *AirportQuery) IDsX(ctx context.Context) []int

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

func (*AirportQuery) Limit

func (aq *AirportQuery) Limit(limit int) *AirportQuery

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

func (*AirportQuery) Offset

func (aq *AirportQuery) Offset(offset int) *AirportQuery

Offset to start from.

func (*AirportQuery) Only

func (aq *AirportQuery) Only(ctx context.Context) (*Airport, error)

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

func (*AirportQuery) OnlyID

func (aq *AirportQuery) OnlyID(ctx context.Context) (id int, err error)

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

func (*AirportQuery) OnlyIDX

func (aq *AirportQuery) OnlyIDX(ctx context.Context) int

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

func (*AirportQuery) OnlyX

func (aq *AirportQuery) OnlyX(ctx context.Context) *Airport

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

func (*AirportQuery) Order

func (aq *AirportQuery) Order(o ...OrderFunc) *AirportQuery

Order specifies how the records should be ordered.

func (*AirportQuery) Select

func (aq *AirportQuery) Select(fields ...string) *AirportSelect

Select allows the selection one or more fields/columns for the given query, instead of selecting all fields in the entity.

Example:

var v []struct {
	Name string `json:"name,omitempty"`
}

client.Airport.Query().
	Select(airport.FieldName).
	Scan(ctx, &v)

func (*AirportQuery) Unique

func (aq *AirportQuery) Unique(unique bool) *AirportQuery

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 (*AirportQuery) Where

func (aq *AirportQuery) Where(ps ...predicate.Airport) *AirportQuery

Where adds a new predicate for the AirportQuery builder.

type AirportSelect

type AirportSelect struct {
	*AirportQuery
	// contains filtered or unexported fields
}

AirportSelect is the builder for selecting fields of Airport entities.

func (*AirportSelect) Aggregate

func (as *AirportSelect) Aggregate(fns ...AggregateFunc) *AirportSelect

Aggregate adds the given aggregation functions to the selector query.

func (*AirportSelect) Bool

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

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

func (*AirportSelect) BoolX

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

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

func (*AirportSelect) Bools

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

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

func (*AirportSelect) BoolsX

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

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

func (*AirportSelect) Float64

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

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

func (*AirportSelect) Float64X

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

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

func (*AirportSelect) Float64s

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

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

func (*AirportSelect) Float64sX

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

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

func (*AirportSelect) Int

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

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

func (*AirportSelect) IntX

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

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

func (*AirportSelect) Ints

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

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

func (*AirportSelect) IntsX

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

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

func (*AirportSelect) Scan

func (as *AirportSelect) Scan(ctx context.Context, v any) error

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

func (*AirportSelect) ScanX

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

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

func (*AirportSelect) String

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

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

func (*AirportSelect) StringX

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

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

func (*AirportSelect) Strings

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

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

func (*AirportSelect) StringsX

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

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

type AirportUpdate

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

AirportUpdate is the builder for updating Airport entities.

func (*AirportUpdate) AddAltitude

func (au *AirportUpdate) AddAltitude(i int) *AirportUpdate

AddAltitude adds i to the "altitude" field.

func (*AirportUpdate) AddLatitude

func (au *AirportUpdate) AddLatitude(f float64) *AirportUpdate

AddLatitude adds f to the "latitude" field.

func (*AirportUpdate) AddLongitude

func (au *AirportUpdate) AddLongitude(f float64) *AirportUpdate

AddLongitude adds f to the "longitude" field.

func (*AirportUpdate) ClearAltitude

func (au *AirportUpdate) ClearAltitude() *AirportUpdate

ClearAltitude clears the value of the "altitude" field.

func (*AirportUpdate) ClearCity

func (au *AirportUpdate) ClearCity() *AirportUpdate

ClearCity clears the value of the "city" field.

func (*AirportUpdate) ClearCountry

func (au *AirportUpdate) ClearCountry() *AirportUpdate

ClearCountry clears the value of the "country" field.

func (*AirportUpdate) ClearDst

func (au *AirportUpdate) ClearDst() *AirportUpdate

ClearDst clears the value of the "dst" field.

func (*AirportUpdate) ClearIata

func (au *AirportUpdate) ClearIata() *AirportUpdate

ClearIata clears the value of the "iata" field.

func (*AirportUpdate) ClearIcao

func (au *AirportUpdate) ClearIcao() *AirportUpdate

ClearIcao clears the value of the "icao" field.

func (*AirportUpdate) ClearLatitude

func (au *AirportUpdate) ClearLatitude() *AirportUpdate

ClearLatitude clears the value of the "latitude" field.

func (*AirportUpdate) ClearLongitude

func (au *AirportUpdate) ClearLongitude() *AirportUpdate

ClearLongitude clears the value of the "longitude" field.

func (*AirportUpdate) ClearName

func (au *AirportUpdate) ClearName() *AirportUpdate

ClearName clears the value of the "name" field.

func (*AirportUpdate) ClearSource

func (au *AirportUpdate) ClearSource() *AirportUpdate

ClearSource clears the value of the "source" field.

func (*AirportUpdate) ClearTimezone

func (au *AirportUpdate) ClearTimezone() *AirportUpdate

ClearTimezone clears the value of the "timezone" field.

func (*AirportUpdate) ClearTimezoneName

func (au *AirportUpdate) ClearTimezoneName() *AirportUpdate

ClearTimezoneName clears the value of the "timezoneName" field.

func (*AirportUpdate) ClearType

func (au *AirportUpdate) ClearType() *AirportUpdate

ClearType clears the value of the "type" field.

func (*AirportUpdate) Exec

func (au *AirportUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*AirportUpdate) ExecX

func (au *AirportUpdate) ExecX(ctx context.Context)

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

func (*AirportUpdate) Mutation

func (au *AirportUpdate) Mutation() *AirportMutation

Mutation returns the AirportMutation object of the builder.

func (*AirportUpdate) Save

func (au *AirportUpdate) Save(ctx context.Context) (int, error)

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

func (*AirportUpdate) SaveX

func (au *AirportUpdate) SaveX(ctx context.Context) int

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

func (*AirportUpdate) SetAltitude

func (au *AirportUpdate) SetAltitude(i int) *AirportUpdate

SetAltitude sets the "altitude" field.

func (*AirportUpdate) SetCity

func (au *AirportUpdate) SetCity(s string) *AirportUpdate

SetCity sets the "city" field.

func (*AirportUpdate) SetCountry

func (au *AirportUpdate) SetCountry(s string) *AirportUpdate

SetCountry sets the "country" field.

func (*AirportUpdate) SetDst

func (au *AirportUpdate) SetDst(s string) *AirportUpdate

SetDst sets the "dst" field.

func (*AirportUpdate) SetIata

func (au *AirportUpdate) SetIata(s string) *AirportUpdate

SetIata sets the "iata" field.

func (*AirportUpdate) SetIcao

func (au *AirportUpdate) SetIcao(s string) *AirportUpdate

SetIcao sets the "icao" field.

func (*AirportUpdate) SetLatitude

func (au *AirportUpdate) SetLatitude(f float64) *AirportUpdate

SetLatitude sets the "latitude" field.

func (*AirportUpdate) SetLongitude

func (au *AirportUpdate) SetLongitude(f float64) *AirportUpdate

SetLongitude sets the "longitude" field.

func (*AirportUpdate) SetName

func (au *AirportUpdate) SetName(s string) *AirportUpdate

SetName sets the "name" field.

func (*AirportUpdate) SetNillableAltitude

func (au *AirportUpdate) SetNillableAltitude(i *int) *AirportUpdate

SetNillableAltitude sets the "altitude" field if the given value is not nil.

func (*AirportUpdate) SetNillableCity

func (au *AirportUpdate) SetNillableCity(s *string) *AirportUpdate

SetNillableCity sets the "city" field if the given value is not nil.

func (*AirportUpdate) SetNillableCountry

func (au *AirportUpdate) SetNillableCountry(s *string) *AirportUpdate

SetNillableCountry sets the "country" field if the given value is not nil.

func (*AirportUpdate) SetNillableDst

func (au *AirportUpdate) SetNillableDst(s *string) *AirportUpdate

SetNillableDst sets the "dst" field if the given value is not nil.

func (*AirportUpdate) SetNillableIata

func (au *AirportUpdate) SetNillableIata(s *string) *AirportUpdate

SetNillableIata sets the "iata" field if the given value is not nil.

func (*AirportUpdate) SetNillableIcao

func (au *AirportUpdate) SetNillableIcao(s *string) *AirportUpdate

SetNillableIcao sets the "icao" field if the given value is not nil.

func (*AirportUpdate) SetNillableLatitude

func (au *AirportUpdate) SetNillableLatitude(f *float64) *AirportUpdate

SetNillableLatitude sets the "latitude" field if the given value is not nil.

func (*AirportUpdate) SetNillableLongitude

func (au *AirportUpdate) SetNillableLongitude(f *float64) *AirportUpdate

SetNillableLongitude sets the "longitude" field if the given value is not nil.

func (*AirportUpdate) SetNillableName

func (au *AirportUpdate) SetNillableName(s *string) *AirportUpdate

SetNillableName sets the "name" field if the given value is not nil.

func (*AirportUpdate) SetNillableSource

func (au *AirportUpdate) SetNillableSource(s *string) *AirportUpdate

SetNillableSource sets the "source" field if the given value is not nil.

func (*AirportUpdate) SetNillableTimezone

func (au *AirportUpdate) SetNillableTimezone(s *string) *AirportUpdate

SetNillableTimezone sets the "timezone" field if the given value is not nil.

func (*AirportUpdate) SetNillableTimezoneName

func (au *AirportUpdate) SetNillableTimezoneName(s *string) *AirportUpdate

SetNillableTimezoneName sets the "timezoneName" field if the given value is not nil.

func (*AirportUpdate) SetNillableType

func (au *AirportUpdate) SetNillableType(s *string) *AirportUpdate

SetNillableType sets the "type" field if the given value is not nil.

func (*AirportUpdate) SetSource

func (au *AirportUpdate) SetSource(s string) *AirportUpdate

SetSource sets the "source" field.

func (*AirportUpdate) SetTimezone

func (au *AirportUpdate) SetTimezone(s string) *AirportUpdate

SetTimezone sets the "timezone" field.

func (*AirportUpdate) SetTimezoneName

func (au *AirportUpdate) SetTimezoneName(s string) *AirportUpdate

SetTimezoneName sets the "timezoneName" field.

func (*AirportUpdate) SetType

func (au *AirportUpdate) SetType(s string) *AirportUpdate

SetType sets the "type" field.

func (*AirportUpdate) Where

func (au *AirportUpdate) Where(ps ...predicate.Airport) *AirportUpdate

Where appends a list predicates to the AirportUpdate builder.

type AirportUpdateOne

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

AirportUpdateOne is the builder for updating a single Airport entity.

func (*AirportUpdateOne) AddAltitude

func (auo *AirportUpdateOne) AddAltitude(i int) *AirportUpdateOne

AddAltitude adds i to the "altitude" field.

func (*AirportUpdateOne) AddLatitude

func (auo *AirportUpdateOne) AddLatitude(f float64) *AirportUpdateOne

AddLatitude adds f to the "latitude" field.

func (*AirportUpdateOne) AddLongitude

func (auo *AirportUpdateOne) AddLongitude(f float64) *AirportUpdateOne

AddLongitude adds f to the "longitude" field.

func (*AirportUpdateOne) ClearAltitude

func (auo *AirportUpdateOne) ClearAltitude() *AirportUpdateOne

ClearAltitude clears the value of the "altitude" field.

func (*AirportUpdateOne) ClearCity

func (auo *AirportUpdateOne) ClearCity() *AirportUpdateOne

ClearCity clears the value of the "city" field.

func (*AirportUpdateOne) ClearCountry

func (auo *AirportUpdateOne) ClearCountry() *AirportUpdateOne

ClearCountry clears the value of the "country" field.

func (*AirportUpdateOne) ClearDst

func (auo *AirportUpdateOne) ClearDst() *AirportUpdateOne

ClearDst clears the value of the "dst" field.

func (*AirportUpdateOne) ClearIata

func (auo *AirportUpdateOne) ClearIata() *AirportUpdateOne

ClearIata clears the value of the "iata" field.

func (*AirportUpdateOne) ClearIcao

func (auo *AirportUpdateOne) ClearIcao() *AirportUpdateOne

ClearIcao clears the value of the "icao" field.

func (*AirportUpdateOne) ClearLatitude

func (auo *AirportUpdateOne) ClearLatitude() *AirportUpdateOne

ClearLatitude clears the value of the "latitude" field.

func (*AirportUpdateOne) ClearLongitude

func (auo *AirportUpdateOne) ClearLongitude() *AirportUpdateOne

ClearLongitude clears the value of the "longitude" field.

func (*AirportUpdateOne) ClearName

func (auo *AirportUpdateOne) ClearName() *AirportUpdateOne

ClearName clears the value of the "name" field.

func (*AirportUpdateOne) ClearSource

func (auo *AirportUpdateOne) ClearSource() *AirportUpdateOne

ClearSource clears the value of the "source" field.

func (*AirportUpdateOne) ClearTimezone

func (auo *AirportUpdateOne) ClearTimezone() *AirportUpdateOne

ClearTimezone clears the value of the "timezone" field.

func (*AirportUpdateOne) ClearTimezoneName

func (auo *AirportUpdateOne) ClearTimezoneName() *AirportUpdateOne

ClearTimezoneName clears the value of the "timezoneName" field.

func (*AirportUpdateOne) ClearType

func (auo *AirportUpdateOne) ClearType() *AirportUpdateOne

ClearType clears the value of the "type" field.

func (*AirportUpdateOne) Exec

func (auo *AirportUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*AirportUpdateOne) ExecX

func (auo *AirportUpdateOne) ExecX(ctx context.Context)

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

func (*AirportUpdateOne) Mutation

func (auo *AirportUpdateOne) Mutation() *AirportMutation

Mutation returns the AirportMutation object of the builder.

func (*AirportUpdateOne) Save

func (auo *AirportUpdateOne) Save(ctx context.Context) (*Airport, error)

Save executes the query and returns the updated Airport entity.

func (*AirportUpdateOne) SaveX

func (auo *AirportUpdateOne) SaveX(ctx context.Context) *Airport

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

func (*AirportUpdateOne) Select

func (auo *AirportUpdateOne) Select(field string, fields ...string) *AirportUpdateOne

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

func (*AirportUpdateOne) SetAltitude

func (auo *AirportUpdateOne) SetAltitude(i int) *AirportUpdateOne

SetAltitude sets the "altitude" field.

func (*AirportUpdateOne) SetCity

func (auo *AirportUpdateOne) SetCity(s string) *AirportUpdateOne

SetCity sets the "city" field.

func (*AirportUpdateOne) SetCountry

func (auo *AirportUpdateOne) SetCountry(s string) *AirportUpdateOne

SetCountry sets the "country" field.

func (*AirportUpdateOne) SetDst

func (auo *AirportUpdateOne) SetDst(s string) *AirportUpdateOne

SetDst sets the "dst" field.

func (*AirportUpdateOne) SetIata

func (auo *AirportUpdateOne) SetIata(s string) *AirportUpdateOne

SetIata sets the "iata" field.

func (*AirportUpdateOne) SetIcao

func (auo *AirportUpdateOne) SetIcao(s string) *AirportUpdateOne

SetIcao sets the "icao" field.

func (*AirportUpdateOne) SetLatitude

func (auo *AirportUpdateOne) SetLatitude(f float64) *AirportUpdateOne

SetLatitude sets the "latitude" field.

func (*AirportUpdateOne) SetLongitude

func (auo *AirportUpdateOne) SetLongitude(f float64) *AirportUpdateOne

SetLongitude sets the "longitude" field.

func (*AirportUpdateOne) SetName

func (auo *AirportUpdateOne) SetName(s string) *AirportUpdateOne

SetName sets the "name" field.

func (*AirportUpdateOne) SetNillableAltitude

func (auo *AirportUpdateOne) SetNillableAltitude(i *int) *AirportUpdateOne

SetNillableAltitude sets the "altitude" field if the given value is not nil.

func (*AirportUpdateOne) SetNillableCity

func (auo *AirportUpdateOne) SetNillableCity(s *string) *AirportUpdateOne

SetNillableCity sets the "city" field if the given value is not nil.

func (*AirportUpdateOne) SetNillableCountry

func (auo *AirportUpdateOne) SetNillableCountry(s *string) *AirportUpdateOne

SetNillableCountry sets the "country" field if the given value is not nil.

func (*AirportUpdateOne) SetNillableDst

func (auo *AirportUpdateOne) SetNillableDst(s *string) *AirportUpdateOne

SetNillableDst sets the "dst" field if the given value is not nil.

func (*AirportUpdateOne) SetNillableIata

func (auo *AirportUpdateOne) SetNillableIata(s *string) *AirportUpdateOne

SetNillableIata sets the "iata" field if the given value is not nil.

func (*AirportUpdateOne) SetNillableIcao

func (auo *AirportUpdateOne) SetNillableIcao(s *string) *AirportUpdateOne

SetNillableIcao sets the "icao" field if the given value is not nil.

func (*AirportUpdateOne) SetNillableLatitude

func (auo *AirportUpdateOne) SetNillableLatitude(f *float64) *AirportUpdateOne

SetNillableLatitude sets the "latitude" field if the given value is not nil.

func (*AirportUpdateOne) SetNillableLongitude

func (auo *AirportUpdateOne) SetNillableLongitude(f *float64) *AirportUpdateOne

SetNillableLongitude sets the "longitude" field if the given value is not nil.

func (*AirportUpdateOne) SetNillableName

func (auo *AirportUpdateOne) SetNillableName(s *string) *AirportUpdateOne

SetNillableName sets the "name" field if the given value is not nil.

func (*AirportUpdateOne) SetNillableSource

func (auo *AirportUpdateOne) SetNillableSource(s *string) *AirportUpdateOne

SetNillableSource sets the "source" field if the given value is not nil.

func (*AirportUpdateOne) SetNillableTimezone

func (auo *AirportUpdateOne) SetNillableTimezone(s *string) *AirportUpdateOne

SetNillableTimezone sets the "timezone" field if the given value is not nil.

func (*AirportUpdateOne) SetNillableTimezoneName

func (auo *AirportUpdateOne) SetNillableTimezoneName(s *string) *AirportUpdateOne

SetNillableTimezoneName sets the "timezoneName" field if the given value is not nil.

func (*AirportUpdateOne) SetNillableType

func (auo *AirportUpdateOne) SetNillableType(s *string) *AirportUpdateOne

SetNillableType sets the "type" field if the given value is not nil.

func (*AirportUpdateOne) SetSource

func (auo *AirportUpdateOne) SetSource(s string) *AirportUpdateOne

SetSource sets the "source" field.

func (*AirportUpdateOne) SetTimezone

func (auo *AirportUpdateOne) SetTimezone(s string) *AirportUpdateOne

SetTimezone sets the "timezone" field.

func (*AirportUpdateOne) SetTimezoneName

func (auo *AirportUpdateOne) SetTimezoneName(s string) *AirportUpdateOne

SetTimezoneName sets the "timezoneName" field.

func (*AirportUpdateOne) SetType

func (auo *AirportUpdateOne) SetType(s string) *AirportUpdateOne

SetType sets the "type" field.

func (*AirportUpdateOne) Where

Where appends a list predicates to the AirportUpdate builder.

type Airports

type Airports []*Airport

Airports is a parsable slice of Airport.

type Client

type Client struct {

	// Schema is the client for creating, migrating and dropping schema.
	Schema *migrate.Schema
	// Airline is the client for interacting with the Airline builders.
	Airline *AirlineClient
	// Airport is the client for interacting with the Airport builders.
	Airport *AirportClient
	// Plane is the client for interacting with the Plane builders.
	Plane *PlaneClient
	// Route is the client for interacting with the Route builders.
	Route *RouteClient
	// contains filtered or unexported fields
}

Client is the client that holds all ent builders.

func FromContext

func FromContext(ctx context.Context) *Client

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

func NewClient

func NewClient(opts ...Option) *Client

NewClient creates a new client configured with the given options.

func Open

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

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

func (*Client) BeginTx

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

BeginTx returns a transactional client with specified options.

func (*Client) Close

func (c *Client) Close() error

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

func (*Client) Debug

func (c *Client) Debug() *Client

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

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

func (*Client) Intercept

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

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

func (*Client) Mutate

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

Mutate implements the ent.Mutator interface.

func (*Client) Tx

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

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

func (*Client) Use

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

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

type CommitFunc

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

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

func (CommitFunc) Commit

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

Commit calls f(ctx, m).

type CommitHook

type CommitHook func(Committer) Committer

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

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

type Committer

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

Committer is the interface that wraps the Commit method.

type ConstraintError

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

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

func (ConstraintError) Error

func (e ConstraintError) Error() string

Error implements the error interface.

func (*ConstraintError) Unwrap

func (e *ConstraintError) Unwrap() error

Unwrap implements the errors.Wrapper interface.

type Hook

type Hook = ent.Hook

ent aliases to avoid import conflicts in user's code.

type InterceptFunc

type InterceptFunc = ent.InterceptFunc

ent aliases to avoid import conflicts in user's code.

type Interceptor

type Interceptor = ent.Interceptor

ent aliases to avoid import conflicts in user's code.

type MutateFunc

type MutateFunc = ent.MutateFunc

ent aliases to avoid import conflicts in user's code.

type Mutation

type Mutation = ent.Mutation

ent aliases to avoid import conflicts in user's code.

type Mutator

type Mutator = ent.Mutator

ent aliases to avoid import conflicts in user's code.

type NotFoundError

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

NotFoundError returns when trying to fetch a specific entity and it was not found in the database.

func (*NotFoundError) Error

func (e *NotFoundError) Error() string

Error implements the error interface.

type NotLoadedError

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

NotLoadedError returns when trying to get a node that was not loaded by the query.

func (*NotLoadedError) Error

func (e *NotLoadedError) Error() string

Error implements the error interface.

type NotSingularError

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

NotSingularError returns when trying to fetch a singular entity and more then one was found in the database.

func (*NotSingularError) Error

func (e *NotSingularError) Error() string

Error implements the error interface.

type Op

type Op = ent.Op

ent aliases to avoid import conflicts in user's code.

type Option

type Option func(*config)

Option function to configure the client.

func Debug

func Debug() Option

Debug enables debug logging on the ent.Driver.

func Driver

func Driver(driver dialect.Driver) Option

Driver configures the client driver.

func Log

func Log(fn func(...any)) Option

Log sets the logging function for debug mode.

type OrderFunc

type OrderFunc func(*sql.Selector)

OrderFunc applies an ordering on the sql selector.

func Asc

func Asc(fields ...string) OrderFunc

Asc applies the given fields in ASC order.

func Desc

func Desc(fields ...string) OrderFunc

Desc applies the given fields in DESC order.

type Plane

type Plane struct {

	// ID of the ent.
	ID int `json:"id,omitempty"`
	// Name holds the value of the "name" field.
	Name string `json:"name,omitempty"`
	// TailNumber holds the value of the "tailNumber" field.
	TailNumber string `json:"tailNumber,omitempty"`
	// contains filtered or unexported fields
}

Plane is the model entity for the Plane schema.

func (*Plane) String

func (pl *Plane) String() string

String implements the fmt.Stringer.

func (*Plane) Unwrap

func (pl *Plane) Unwrap() *Plane

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

func (pl *Plane) Update() *PlaneUpdateOne

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

type PlaneClient

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

PlaneClient is a client for the Plane schema.

func NewPlaneClient

func NewPlaneClient(c config) *PlaneClient

NewPlaneClient returns a client for the Plane from the given config.

func (*PlaneClient) Create

func (c *PlaneClient) Create() *PlaneCreate

Create returns a builder for creating a Plane entity.

func (*PlaneClient) CreateBulk

func (c *PlaneClient) CreateBulk(builders ...*PlaneCreate) *PlaneCreateBulk

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

func (*PlaneClient) Delete

func (c *PlaneClient) Delete() *PlaneDelete

Delete returns a delete builder for Plane.

func (*PlaneClient) DeleteOne

func (c *PlaneClient) DeleteOne(pl *Plane) *PlaneDeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*PlaneClient) DeleteOneID

func (c *PlaneClient) DeleteOneID(id int) *PlaneDeleteOne

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

func (*PlaneClient) Get

func (c *PlaneClient) Get(ctx context.Context, id int) (*Plane, error)

Get returns a Plane entity by its id.

func (*PlaneClient) GetX

func (c *PlaneClient) GetX(ctx context.Context, id int) *Plane

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

func (*PlaneClient) Hooks

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

Hooks returns the client hooks.

func (*PlaneClient) Intercept

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

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

func (*PlaneClient) Interceptors

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

Interceptors returns the client interceptors.

func (*PlaneClient) Query

func (c *PlaneClient) Query() *PlaneQuery

Query returns a query builder for Plane.

func (*PlaneClient) Update

func (c *PlaneClient) Update() *PlaneUpdate

Update returns an update builder for Plane.

func (*PlaneClient) UpdateOne

func (c *PlaneClient) UpdateOne(pl *Plane) *PlaneUpdateOne

UpdateOne returns an update builder for the given entity.

func (*PlaneClient) UpdateOneID

func (c *PlaneClient) UpdateOneID(id int) *PlaneUpdateOne

UpdateOneID returns an update builder for the given id.

func (*PlaneClient) Use

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

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

type PlaneCreate

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

PlaneCreate is the builder for creating a Plane entity.

func (*PlaneCreate) Exec

func (pc *PlaneCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*PlaneCreate) ExecX

func (pc *PlaneCreate) ExecX(ctx context.Context)

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

func (*PlaneCreate) Mutation

func (pc *PlaneCreate) Mutation() *PlaneMutation

Mutation returns the PlaneMutation object of the builder.

func (*PlaneCreate) Save

func (pc *PlaneCreate) Save(ctx context.Context) (*Plane, error)

Save creates the Plane in the database.

func (*PlaneCreate) SaveX

func (pc *PlaneCreate) SaveX(ctx context.Context) *Plane

SaveX calls Save and panics if Save returns an error.

func (*PlaneCreate) SetID

func (pc *PlaneCreate) SetID(i int) *PlaneCreate

SetID sets the "id" field.

func (*PlaneCreate) SetName

func (pc *PlaneCreate) SetName(s string) *PlaneCreate

SetName sets the "name" field.

func (*PlaneCreate) SetTailNumber

func (pc *PlaneCreate) SetTailNumber(s string) *PlaneCreate

SetTailNumber sets the "tailNumber" field.

type PlaneCreateBulk

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

PlaneCreateBulk is the builder for creating many Plane entities in bulk.

func (*PlaneCreateBulk) Exec

func (pcb *PlaneCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*PlaneCreateBulk) ExecX

func (pcb *PlaneCreateBulk) ExecX(ctx context.Context)

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

func (*PlaneCreateBulk) Save

func (pcb *PlaneCreateBulk) Save(ctx context.Context) ([]*Plane, error)

Save creates the Plane entities in the database.

func (*PlaneCreateBulk) SaveX

func (pcb *PlaneCreateBulk) SaveX(ctx context.Context) []*Plane

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

type PlaneDelete

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

PlaneDelete is the builder for deleting a Plane entity.

func (*PlaneDelete) Exec

func (pd *PlaneDelete) Exec(ctx context.Context) (int, error)

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

func (*PlaneDelete) ExecX

func (pd *PlaneDelete) ExecX(ctx context.Context) int

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

func (*PlaneDelete) Where

func (pd *PlaneDelete) Where(ps ...predicate.Plane) *PlaneDelete

Where appends a list predicates to the PlaneDelete builder.

type PlaneDeleteOne

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

PlaneDeleteOne is the builder for deleting a single Plane entity.

func (*PlaneDeleteOne) Exec

func (pdo *PlaneDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*PlaneDeleteOne) ExecX

func (pdo *PlaneDeleteOne) ExecX(ctx context.Context)

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

func (*PlaneDeleteOne) Where

func (pdo *PlaneDeleteOne) Where(ps ...predicate.Plane) *PlaneDeleteOne

Where appends a list predicates to the PlaneDelete builder.

type PlaneGroupBy

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

PlaneGroupBy is the group-by builder for Plane entities.

func (*PlaneGroupBy) Aggregate

func (pgb *PlaneGroupBy) Aggregate(fns ...AggregateFunc) *PlaneGroupBy

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

func (*PlaneGroupBy) Bool

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

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

func (*PlaneGroupBy) BoolX

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

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

func (*PlaneGroupBy) Bools

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

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

func (*PlaneGroupBy) BoolsX

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

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

func (*PlaneGroupBy) Float64

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

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

func (*PlaneGroupBy) Float64X

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

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

func (*PlaneGroupBy) Float64s

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

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

func (*PlaneGroupBy) Float64sX

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

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

func (*PlaneGroupBy) Int

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

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

func (*PlaneGroupBy) IntX

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

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

func (*PlaneGroupBy) Ints

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

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

func (*PlaneGroupBy) IntsX

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

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

func (*PlaneGroupBy) Scan

func (pgb *PlaneGroupBy) Scan(ctx context.Context, v any) error

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

func (*PlaneGroupBy) ScanX

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

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

func (*PlaneGroupBy) String

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

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

func (*PlaneGroupBy) StringX

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

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

func (*PlaneGroupBy) Strings

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

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

func (*PlaneGroupBy) StringsX

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

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

type PlaneMutation

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

PlaneMutation represents an operation that mutates the Plane nodes in the graph.

func (*PlaneMutation) AddField

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

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

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

func (*PlaneMutation) AddedField

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

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

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

func (*PlaneMutation) AddedIDs

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

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

func (*PlaneMutation) ClearEdge

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

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

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

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

func (*PlaneMutation) ClearedFields

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

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

func (PlaneMutation) Client

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

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

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

func (*PlaneMutation) Field

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

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

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

func (*PlaneMutation) Fields

func (m *PlaneMutation) 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 (*PlaneMutation) ID

func (m *PlaneMutation) 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 (*PlaneMutation) IDs

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

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

func (*PlaneMutation) Name

func (m *PlaneMutation) Name() (r string, exists bool)

Name returns the value of the "name" field in the mutation.

func (*PlaneMutation) OldField

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

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

func (*PlaneMutation) OldName

func (m *PlaneMutation) OldName(ctx context.Context) (v string, err error)

OldName returns the old "name" field's value of the Plane entity. If the Plane 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 (*PlaneMutation) OldTailNumber

func (m *PlaneMutation) OldTailNumber(ctx context.Context) (v string, err error)

OldTailNumber returns the old "tailNumber" field's value of the Plane entity. If the Plane 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 (*PlaneMutation) Op

func (m *PlaneMutation) Op() Op

Op returns the operation name.

func (*PlaneMutation) RemovedEdges

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

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

func (*PlaneMutation) RemovedIDs

func (m *PlaneMutation) 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 (*PlaneMutation) ResetEdge

func (m *PlaneMutation) 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 (*PlaneMutation) ResetField

func (m *PlaneMutation) 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 (*PlaneMutation) ResetName

func (m *PlaneMutation) ResetName()

ResetName resets all changes to the "name" field.

func (*PlaneMutation) ResetTailNumber

func (m *PlaneMutation) ResetTailNumber()

ResetTailNumber resets all changes to the "tailNumber" field.

func (*PlaneMutation) SetField

func (m *PlaneMutation) 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 (*PlaneMutation) SetID

func (m *PlaneMutation) SetID(id int)

SetID sets the value of the id field. Note that this operation is only accepted on creation of Plane entities.

func (*PlaneMutation) SetName

func (m *PlaneMutation) SetName(s string)

SetName sets the "name" field.

func (*PlaneMutation) SetOp

func (m *PlaneMutation) SetOp(op Op)

SetOp allows setting the mutation operation.

func (*PlaneMutation) SetTailNumber

func (m *PlaneMutation) SetTailNumber(s string)

SetTailNumber sets the "tailNumber" field.

func (*PlaneMutation) TailNumber

func (m *PlaneMutation) TailNumber() (r string, exists bool)

TailNumber returns the value of the "tailNumber" field in the mutation.

func (PlaneMutation) Tx

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

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

func (*PlaneMutation) Type

func (m *PlaneMutation) Type() string

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

func (*PlaneMutation) Where

func (m *PlaneMutation) Where(ps ...predicate.Plane)

Where appends a list predicates to the PlaneMutation builder.

func (*PlaneMutation) WhereP

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

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

type PlaneQuery

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

PlaneQuery is the builder for querying Plane entities.

func (*PlaneQuery) Aggregate

func (pq *PlaneQuery) Aggregate(fns ...AggregateFunc) *PlaneSelect

Aggregate returns a PlaneSelect configured with the given aggregations.

func (*PlaneQuery) All

func (pq *PlaneQuery) All(ctx context.Context) ([]*Plane, error)

All executes the query and returns a list of Planes.

func (*PlaneQuery) AllX

func (pq *PlaneQuery) AllX(ctx context.Context) []*Plane

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

func (*PlaneQuery) Clone

func (pq *PlaneQuery) Clone() *PlaneQuery

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

func (*PlaneQuery) Count

func (pq *PlaneQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*PlaneQuery) CountX

func (pq *PlaneQuery) CountX(ctx context.Context) int

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

func (*PlaneQuery) Exist

func (pq *PlaneQuery) Exist(ctx context.Context) (bool, error)

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

func (*PlaneQuery) ExistX

func (pq *PlaneQuery) ExistX(ctx context.Context) bool

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

func (*PlaneQuery) First

func (pq *PlaneQuery) First(ctx context.Context) (*Plane, error)

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

func (*PlaneQuery) FirstID

func (pq *PlaneQuery) FirstID(ctx context.Context) (id int, err error)

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

func (*PlaneQuery) FirstIDX

func (pq *PlaneQuery) FirstIDX(ctx context.Context) int

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

func (*PlaneQuery) FirstX

func (pq *PlaneQuery) FirstX(ctx context.Context) *Plane

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

func (*PlaneQuery) GroupBy

func (pq *PlaneQuery) GroupBy(field string, fields ...string) *PlaneGroupBy

GroupBy is used to group vertices by one or more fields/columns. It is often used with aggregate functions, like: count, max, mean, min, sum.

Example:

var v []struct {
	Name string `json:"name,omitempty"`
	Count int `json:"count,omitempty"`
}

client.Plane.Query().
	GroupBy(plane.FieldName).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*PlaneQuery) IDs

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

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

func (*PlaneQuery) IDsX

func (pq *PlaneQuery) IDsX(ctx context.Context) []int

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

func (*PlaneQuery) Limit

func (pq *PlaneQuery) Limit(limit int) *PlaneQuery

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

func (*PlaneQuery) Offset

func (pq *PlaneQuery) Offset(offset int) *PlaneQuery

Offset to start from.

func (*PlaneQuery) Only

func (pq *PlaneQuery) Only(ctx context.Context) (*Plane, error)

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

func (*PlaneQuery) OnlyID

func (pq *PlaneQuery) OnlyID(ctx context.Context) (id int, err error)

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

func (*PlaneQuery) OnlyIDX

func (pq *PlaneQuery) OnlyIDX(ctx context.Context) int

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

func (*PlaneQuery) OnlyX

func (pq *PlaneQuery) OnlyX(ctx context.Context) *Plane

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

func (*PlaneQuery) Order

func (pq *PlaneQuery) Order(o ...OrderFunc) *PlaneQuery

Order specifies how the records should be ordered.

func (*PlaneQuery) Select

func (pq *PlaneQuery) Select(fields ...string) *PlaneSelect

Select allows the selection one or more fields/columns for the given query, instead of selecting all fields in the entity.

Example:

var v []struct {
	Name string `json:"name,omitempty"`
}

client.Plane.Query().
	Select(plane.FieldName).
	Scan(ctx, &v)

func (*PlaneQuery) Unique

func (pq *PlaneQuery) Unique(unique bool) *PlaneQuery

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 (*PlaneQuery) Where

func (pq *PlaneQuery) Where(ps ...predicate.Plane) *PlaneQuery

Where adds a new predicate for the PlaneQuery builder.

type PlaneSelect

type PlaneSelect struct {
	*PlaneQuery
	// contains filtered or unexported fields
}

PlaneSelect is the builder for selecting fields of Plane entities.

func (*PlaneSelect) Aggregate

func (ps *PlaneSelect) Aggregate(fns ...AggregateFunc) *PlaneSelect

Aggregate adds the given aggregation functions to the selector query.

func (*PlaneSelect) Bool

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

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

func (*PlaneSelect) BoolX

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

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

func (*PlaneSelect) Bools

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

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

func (*PlaneSelect) BoolsX

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

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

func (*PlaneSelect) Float64

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

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

func (*PlaneSelect) Float64X

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

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

func (*PlaneSelect) Float64s

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

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

func (*PlaneSelect) Float64sX

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

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

func (*PlaneSelect) Int

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

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

func (*PlaneSelect) IntX

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

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

func (*PlaneSelect) Ints

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

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

func (*PlaneSelect) IntsX

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

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

func (*PlaneSelect) Scan

func (ps *PlaneSelect) Scan(ctx context.Context, v any) error

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

func (*PlaneSelect) ScanX

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

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

func (*PlaneSelect) String

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

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

func (*PlaneSelect) StringX

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

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

func (*PlaneSelect) Strings

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

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

func (*PlaneSelect) StringsX

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

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

type PlaneUpdate

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

PlaneUpdate is the builder for updating Plane entities.

func (*PlaneUpdate) Exec

func (pu *PlaneUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*PlaneUpdate) ExecX

func (pu *PlaneUpdate) ExecX(ctx context.Context)

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

func (*PlaneUpdate) Mutation

func (pu *PlaneUpdate) Mutation() *PlaneMutation

Mutation returns the PlaneMutation object of the builder.

func (*PlaneUpdate) Save

func (pu *PlaneUpdate) Save(ctx context.Context) (int, error)

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

func (*PlaneUpdate) SaveX

func (pu *PlaneUpdate) SaveX(ctx context.Context) int

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

func (*PlaneUpdate) SetName

func (pu *PlaneUpdate) SetName(s string) *PlaneUpdate

SetName sets the "name" field.

func (*PlaneUpdate) SetTailNumber

func (pu *PlaneUpdate) SetTailNumber(s string) *PlaneUpdate

SetTailNumber sets the "tailNumber" field.

func (*PlaneUpdate) Where

func (pu *PlaneUpdate) Where(ps ...predicate.Plane) *PlaneUpdate

Where appends a list predicates to the PlaneUpdate builder.

type PlaneUpdateOne

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

PlaneUpdateOne is the builder for updating a single Plane entity.

func (*PlaneUpdateOne) Exec

func (puo *PlaneUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*PlaneUpdateOne) ExecX

func (puo *PlaneUpdateOne) ExecX(ctx context.Context)

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

func (*PlaneUpdateOne) Mutation

func (puo *PlaneUpdateOne) Mutation() *PlaneMutation

Mutation returns the PlaneMutation object of the builder.

func (*PlaneUpdateOne) Save

func (puo *PlaneUpdateOne) Save(ctx context.Context) (*Plane, error)

Save executes the query and returns the updated Plane entity.

func (*PlaneUpdateOne) SaveX

func (puo *PlaneUpdateOne) SaveX(ctx context.Context) *Plane

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

func (*PlaneUpdateOne) Select

func (puo *PlaneUpdateOne) Select(field string, fields ...string) *PlaneUpdateOne

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

func (*PlaneUpdateOne) SetName

func (puo *PlaneUpdateOne) SetName(s string) *PlaneUpdateOne

SetName sets the "name" field.

func (*PlaneUpdateOne) SetTailNumber

func (puo *PlaneUpdateOne) SetTailNumber(s string) *PlaneUpdateOne

SetTailNumber sets the "tailNumber" field.

func (*PlaneUpdateOne) Where

func (puo *PlaneUpdateOne) Where(ps ...predicate.Plane) *PlaneUpdateOne

Where appends a list predicates to the PlaneUpdate builder.

type Planes

type Planes []*Plane

Planes is a parsable slice of Plane.

type Policy

type Policy = ent.Policy

ent aliases to avoid import conflicts in user's code.

type Querier

type Querier = ent.Querier

ent aliases to avoid import conflicts in user's code.

type QuerierFunc

type QuerierFunc = ent.QuerierFunc

ent aliases to avoid import conflicts in user's code.

type Query

type Query = ent.Query

ent aliases to avoid import conflicts in user's code.

type QueryContext

type QueryContext = ent.QueryContext

ent aliases to avoid import conflicts in user's code.

type RollbackFunc

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

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

func (RollbackFunc) Rollback

func (f RollbackFunc) Rollback(ctx context.Context, tx *Tx) error

Rollback calls f(ctx, m).

type RollbackHook

type RollbackHook func(Rollbacker) Rollbacker

RollbackHook defines the "rollback middleware". A function that gets a Rollbacker and returns a Rollbacker. For example:

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

type Rollbacker

type Rollbacker interface {
	Rollback(context.Context, *Tx) error
}

Rollbacker is the interface that wraps the Rollback method.

type Route

type Route struct {

	// ID of the ent.
	ID int `json:"id,omitempty"`
	// AirlineId holds the value of the "airlineId" field.
	AirlineId int `json:"airlineId,omitempty"`
	// SourceAirportId holds the value of the "sourceAirportId" field.
	SourceAirportId int `json:"sourceAirportId,omitempty"`
	// DestinationAirportId holds the value of the "destinationAirportId" field.
	DestinationAirportId int `json:"destinationAirportId,omitempty"`
	// PlaneId holds the value of the "planeId" field.
	PlaneId int `json:"planeId,omitempty"`
	// NumberOfStops holds the value of the "numberOfStops" field.
	NumberOfStops int `json:"numberOfStops,omitempty"`
	// contains filtered or unexported fields
}

Route is the model entity for the Route schema.

func (*Route) String

func (r *Route) String() string

String implements the fmt.Stringer.

func (*Route) Unwrap

func (r *Route) Unwrap() *Route

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

func (r *Route) Update() *RouteUpdateOne

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

type RouteClient

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

RouteClient is a client for the Route schema.

func NewRouteClient

func NewRouteClient(c config) *RouteClient

NewRouteClient returns a client for the Route from the given config.

func (*RouteClient) Create

func (c *RouteClient) Create() *RouteCreate

Create returns a builder for creating a Route entity.

func (*RouteClient) CreateBulk

func (c *RouteClient) CreateBulk(builders ...*RouteCreate) *RouteCreateBulk

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

func (*RouteClient) Delete

func (c *RouteClient) Delete() *RouteDelete

Delete returns a delete builder for Route.

func (*RouteClient) DeleteOne

func (c *RouteClient) DeleteOne(r *Route) *RouteDeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*RouteClient) DeleteOneID

func (c *RouteClient) DeleteOneID(id int) *RouteDeleteOne

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

func (*RouteClient) Get

func (c *RouteClient) Get(ctx context.Context, id int) (*Route, error)

Get returns a Route entity by its id.

func (*RouteClient) GetX

func (c *RouteClient) GetX(ctx context.Context, id int) *Route

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

func (*RouteClient) Hooks

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

Hooks returns the client hooks.

func (*RouteClient) Intercept

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

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

func (*RouteClient) Interceptors

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

Interceptors returns the client interceptors.

func (*RouteClient) Query

func (c *RouteClient) Query() *RouteQuery

Query returns a query builder for Route.

func (*RouteClient) Update

func (c *RouteClient) Update() *RouteUpdate

Update returns an update builder for Route.

func (*RouteClient) UpdateOne

func (c *RouteClient) UpdateOne(r *Route) *RouteUpdateOne

UpdateOne returns an update builder for the given entity.

func (*RouteClient) UpdateOneID

func (c *RouteClient) UpdateOneID(id int) *RouteUpdateOne

UpdateOneID returns an update builder for the given id.

func (*RouteClient) Use

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

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

type RouteCreate

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

RouteCreate is the builder for creating a Route entity.

func (*RouteCreate) Exec

func (rc *RouteCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*RouteCreate) ExecX

func (rc *RouteCreate) ExecX(ctx context.Context)

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

func (*RouteCreate) Mutation

func (rc *RouteCreate) Mutation() *RouteMutation

Mutation returns the RouteMutation object of the builder.

func (*RouteCreate) Save

func (rc *RouteCreate) Save(ctx context.Context) (*Route, error)

Save creates the Route in the database.

func (*RouteCreate) SaveX

func (rc *RouteCreate) SaveX(ctx context.Context) *Route

SaveX calls Save and panics if Save returns an error.

func (*RouteCreate) SetAirlineId

func (rc *RouteCreate) SetAirlineId(i int) *RouteCreate

SetAirlineId sets the "airlineId" field.

func (*RouteCreate) SetDestinationAirportId

func (rc *RouteCreate) SetDestinationAirportId(i int) *RouteCreate

SetDestinationAirportId sets the "destinationAirportId" field.

func (*RouteCreate) SetID

func (rc *RouteCreate) SetID(i int) *RouteCreate

SetID sets the "id" field.

func (*RouteCreate) SetNumberOfStops

func (rc *RouteCreate) SetNumberOfStops(i int) *RouteCreate

SetNumberOfStops sets the "numberOfStops" field.

func (*RouteCreate) SetPlaneId

func (rc *RouteCreate) SetPlaneId(i int) *RouteCreate

SetPlaneId sets the "planeId" field.

func (*RouteCreate) SetSourceAirportId

func (rc *RouteCreate) SetSourceAirportId(i int) *RouteCreate

SetSourceAirportId sets the "sourceAirportId" field.

type RouteCreateBulk

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

RouteCreateBulk is the builder for creating many Route entities in bulk.

func (*RouteCreateBulk) Exec

func (rcb *RouteCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*RouteCreateBulk) ExecX

func (rcb *RouteCreateBulk) ExecX(ctx context.Context)

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

func (*RouteCreateBulk) Save

func (rcb *RouteCreateBulk) Save(ctx context.Context) ([]*Route, error)

Save creates the Route entities in the database.

func (*RouteCreateBulk) SaveX

func (rcb *RouteCreateBulk) SaveX(ctx context.Context) []*Route

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

type RouteDelete

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

RouteDelete is the builder for deleting a Route entity.

func (*RouteDelete) Exec

func (rd *RouteDelete) Exec(ctx context.Context) (int, error)

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

func (*RouteDelete) ExecX

func (rd *RouteDelete) ExecX(ctx context.Context) int

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

func (*RouteDelete) Where

func (rd *RouteDelete) Where(ps ...predicate.Route) *RouteDelete

Where appends a list predicates to the RouteDelete builder.

type RouteDeleteOne

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

RouteDeleteOne is the builder for deleting a single Route entity.

func (*RouteDeleteOne) Exec

func (rdo *RouteDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*RouteDeleteOne) ExecX

func (rdo *RouteDeleteOne) ExecX(ctx context.Context)

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

func (*RouteDeleteOne) Where

func (rdo *RouteDeleteOne) Where(ps ...predicate.Route) *RouteDeleteOne

Where appends a list predicates to the RouteDelete builder.

type RouteGroupBy

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

RouteGroupBy is the group-by builder for Route entities.

func (*RouteGroupBy) Aggregate

func (rgb *RouteGroupBy) Aggregate(fns ...AggregateFunc) *RouteGroupBy

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

func (*RouteGroupBy) Bool

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

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

func (*RouteGroupBy) BoolX

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

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

func (*RouteGroupBy) Bools

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

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

func (*RouteGroupBy) BoolsX

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

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

func (*RouteGroupBy) Float64

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

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

func (*RouteGroupBy) Float64X

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

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

func (*RouteGroupBy) Float64s

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

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

func (*RouteGroupBy) Float64sX

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

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

func (*RouteGroupBy) Int

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

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

func (*RouteGroupBy) IntX

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

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

func (*RouteGroupBy) Ints

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

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

func (*RouteGroupBy) IntsX

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

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

func (*RouteGroupBy) Scan

func (rgb *RouteGroupBy) Scan(ctx context.Context, v any) error

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

func (*RouteGroupBy) ScanX

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

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

func (*RouteGroupBy) String

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

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

func (*RouteGroupBy) StringX

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

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

func (*RouteGroupBy) Strings

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

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

func (*RouteGroupBy) StringsX

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

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

type RouteMutation

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

RouteMutation represents an operation that mutates the Route nodes in the graph.

func (*RouteMutation) AddAirlineId

func (m *RouteMutation) AddAirlineId(i int)

AddAirlineId adds i to the "airlineId" field.

func (*RouteMutation) AddDestinationAirportId

func (m *RouteMutation) AddDestinationAirportId(i int)

AddDestinationAirportId adds i to the "destinationAirportId" field.

func (*RouteMutation) AddField

func (m *RouteMutation) 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 (*RouteMutation) AddNumberOfStops

func (m *RouteMutation) AddNumberOfStops(i int)

AddNumberOfStops adds i to the "numberOfStops" field.

func (*RouteMutation) AddPlaneId

func (m *RouteMutation) AddPlaneId(i int)

AddPlaneId adds i to the "planeId" field.

func (*RouteMutation) AddSourceAirportId

func (m *RouteMutation) AddSourceAirportId(i int)

AddSourceAirportId adds i to the "sourceAirportId" field.

func (*RouteMutation) AddedAirlineId

func (m *RouteMutation) AddedAirlineId() (r int, exists bool)

AddedAirlineId returns the value that was added to the "airlineId" field in this mutation.

func (*RouteMutation) AddedDestinationAirportId

func (m *RouteMutation) AddedDestinationAirportId() (r int, exists bool)

AddedDestinationAirportId returns the value that was added to the "destinationAirportId" field in this mutation.

func (*RouteMutation) AddedEdges

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

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

func (*RouteMutation) AddedField

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

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

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

func (*RouteMutation) AddedIDs

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

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

func (*RouteMutation) AddedNumberOfStops

func (m *RouteMutation) AddedNumberOfStops() (r int, exists bool)

AddedNumberOfStops returns the value that was added to the "numberOfStops" field in this mutation.

func (*RouteMutation) AddedPlaneId

func (m *RouteMutation) AddedPlaneId() (r int, exists bool)

AddedPlaneId returns the value that was added to the "planeId" field in this mutation.

func (*RouteMutation) AddedSourceAirportId

func (m *RouteMutation) AddedSourceAirportId() (r int, exists bool)

AddedSourceAirportId returns the value that was added to the "sourceAirportId" field in this mutation.

func (*RouteMutation) AirlineId

func (m *RouteMutation) AirlineId() (r int, exists bool)

AirlineId returns the value of the "airlineId" field in the mutation.

func (*RouteMutation) ClearEdge

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

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

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

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

func (*RouteMutation) ClearedFields

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

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

func (RouteMutation) Client

func (m RouteMutation) 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 (*RouteMutation) DestinationAirportId

func (m *RouteMutation) DestinationAirportId() (r int, exists bool)

DestinationAirportId returns the value of the "destinationAirportId" field in the mutation.

func (*RouteMutation) EdgeCleared

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

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

func (*RouteMutation) Field

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

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

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

func (*RouteMutation) Fields

func (m *RouteMutation) 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 (*RouteMutation) ID

func (m *RouteMutation) 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 (*RouteMutation) IDs

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

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

func (*RouteMutation) NumberOfStops

func (m *RouteMutation) NumberOfStops() (r int, exists bool)

NumberOfStops returns the value of the "numberOfStops" field in the mutation.

func (*RouteMutation) OldAirlineId

func (m *RouteMutation) OldAirlineId(ctx context.Context) (v int, err error)

OldAirlineId returns the old "airlineId" field's value of the Route entity. If the Route 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 (*RouteMutation) OldDestinationAirportId

func (m *RouteMutation) OldDestinationAirportId(ctx context.Context) (v int, err error)

OldDestinationAirportId returns the old "destinationAirportId" field's value of the Route entity. If the Route 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 (*RouteMutation) OldField

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

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

func (*RouteMutation) OldNumberOfStops

func (m *RouteMutation) OldNumberOfStops(ctx context.Context) (v int, err error)

OldNumberOfStops returns the old "numberOfStops" field's value of the Route entity. If the Route 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 (*RouteMutation) OldPlaneId

func (m *RouteMutation) OldPlaneId(ctx context.Context) (v int, err error)

OldPlaneId returns the old "planeId" field's value of the Route entity. If the Route 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 (*RouteMutation) OldSourceAirportId

func (m *RouteMutation) OldSourceAirportId(ctx context.Context) (v int, err error)

OldSourceAirportId returns the old "sourceAirportId" field's value of the Route entity. If the Route 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 (*RouteMutation) Op

func (m *RouteMutation) Op() Op

Op returns the operation name.

func (*RouteMutation) PlaneId

func (m *RouteMutation) PlaneId() (r int, exists bool)

PlaneId returns the value of the "planeId" field in the mutation.

func (*RouteMutation) RemovedEdges

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

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

func (*RouteMutation) RemovedIDs

func (m *RouteMutation) 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 (*RouteMutation) ResetAirlineId

func (m *RouteMutation) ResetAirlineId()

ResetAirlineId resets all changes to the "airlineId" field.

func (*RouteMutation) ResetDestinationAirportId

func (m *RouteMutation) ResetDestinationAirportId()

ResetDestinationAirportId resets all changes to the "destinationAirportId" field.

func (*RouteMutation) ResetEdge

func (m *RouteMutation) 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 (*RouteMutation) ResetField

func (m *RouteMutation) 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 (*RouteMutation) ResetNumberOfStops

func (m *RouteMutation) ResetNumberOfStops()

ResetNumberOfStops resets all changes to the "numberOfStops" field.

func (*RouteMutation) ResetPlaneId

func (m *RouteMutation) ResetPlaneId()

ResetPlaneId resets all changes to the "planeId" field.

func (*RouteMutation) ResetSourceAirportId

func (m *RouteMutation) ResetSourceAirportId()

ResetSourceAirportId resets all changes to the "sourceAirportId" field.

func (*RouteMutation) SetAirlineId

func (m *RouteMutation) SetAirlineId(i int)

SetAirlineId sets the "airlineId" field.

func (*RouteMutation) SetDestinationAirportId

func (m *RouteMutation) SetDestinationAirportId(i int)

SetDestinationAirportId sets the "destinationAirportId" field.

func (*RouteMutation) SetField

func (m *RouteMutation) 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 (*RouteMutation) SetID

func (m *RouteMutation) SetID(id int)

SetID sets the value of the id field. Note that this operation is only accepted on creation of Route entities.

func (*RouteMutation) SetNumberOfStops

func (m *RouteMutation) SetNumberOfStops(i int)

SetNumberOfStops sets the "numberOfStops" field.

func (*RouteMutation) SetOp

func (m *RouteMutation) SetOp(op Op)

SetOp allows setting the mutation operation.

func (*RouteMutation) SetPlaneId

func (m *RouteMutation) SetPlaneId(i int)

SetPlaneId sets the "planeId" field.

func (*RouteMutation) SetSourceAirportId

func (m *RouteMutation) SetSourceAirportId(i int)

SetSourceAirportId sets the "sourceAirportId" field.

func (*RouteMutation) SourceAirportId

func (m *RouteMutation) SourceAirportId() (r int, exists bool)

SourceAirportId returns the value of the "sourceAirportId" field in the mutation.

func (RouteMutation) Tx

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

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

func (*RouteMutation) Type

func (m *RouteMutation) Type() string

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

func (*RouteMutation) Where

func (m *RouteMutation) Where(ps ...predicate.Route)

Where appends a list predicates to the RouteMutation builder.

func (*RouteMutation) WhereP

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

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

type RouteQuery

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

RouteQuery is the builder for querying Route entities.

func (*RouteQuery) Aggregate

func (rq *RouteQuery) Aggregate(fns ...AggregateFunc) *RouteSelect

Aggregate returns a RouteSelect configured with the given aggregations.

func (*RouteQuery) All

func (rq *RouteQuery) All(ctx context.Context) ([]*Route, error)

All executes the query and returns a list of Routes.

func (*RouteQuery) AllX

func (rq *RouteQuery) AllX(ctx context.Context) []*Route

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

func (*RouteQuery) Clone

func (rq *RouteQuery) Clone() *RouteQuery

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

func (*RouteQuery) Count

func (rq *RouteQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*RouteQuery) CountX

func (rq *RouteQuery) CountX(ctx context.Context) int

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

func (*RouteQuery) Exist

func (rq *RouteQuery) Exist(ctx context.Context) (bool, error)

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

func (*RouteQuery) ExistX

func (rq *RouteQuery) ExistX(ctx context.Context) bool

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

func (*RouteQuery) First

func (rq *RouteQuery) First(ctx context.Context) (*Route, error)

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

func (*RouteQuery) FirstID

func (rq *RouteQuery) FirstID(ctx context.Context) (id int, err error)

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

func (*RouteQuery) FirstIDX

func (rq *RouteQuery) FirstIDX(ctx context.Context) int

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

func (*RouteQuery) FirstX

func (rq *RouteQuery) FirstX(ctx context.Context) *Route

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

func (*RouteQuery) GroupBy

func (rq *RouteQuery) GroupBy(field string, fields ...string) *RouteGroupBy

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 {
	AirlineId int `json:"airlineId,omitempty"`
	Count int `json:"count,omitempty"`
}

client.Route.Query().
	GroupBy(route.FieldAirlineId).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*RouteQuery) IDs

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

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

func (*RouteQuery) IDsX

func (rq *RouteQuery) IDsX(ctx context.Context) []int

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

func (*RouteQuery) Limit

func (rq *RouteQuery) Limit(limit int) *RouteQuery

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

func (*RouteQuery) Offset

func (rq *RouteQuery) Offset(offset int) *RouteQuery

Offset to start from.

func (*RouteQuery) Only

func (rq *RouteQuery) Only(ctx context.Context) (*Route, error)

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

func (*RouteQuery) OnlyID

func (rq *RouteQuery) OnlyID(ctx context.Context) (id int, err error)

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

func (*RouteQuery) OnlyIDX

func (rq *RouteQuery) OnlyIDX(ctx context.Context) int

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

func (*RouteQuery) OnlyX

func (rq *RouteQuery) OnlyX(ctx context.Context) *Route

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

func (*RouteQuery) Order

func (rq *RouteQuery) Order(o ...OrderFunc) *RouteQuery

Order specifies how the records should be ordered.

func (*RouteQuery) Select

func (rq *RouteQuery) Select(fields ...string) *RouteSelect

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 {
	AirlineId int `json:"airlineId,omitempty"`
}

client.Route.Query().
	Select(route.FieldAirlineId).
	Scan(ctx, &v)

func (*RouteQuery) Unique

func (rq *RouteQuery) Unique(unique bool) *RouteQuery

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 (*RouteQuery) Where

func (rq *RouteQuery) Where(ps ...predicate.Route) *RouteQuery

Where adds a new predicate for the RouteQuery builder.

type RouteSelect

type RouteSelect struct {
	*RouteQuery
	// contains filtered or unexported fields
}

RouteSelect is the builder for selecting fields of Route entities.

func (*RouteSelect) Aggregate

func (rs *RouteSelect) Aggregate(fns ...AggregateFunc) *RouteSelect

Aggregate adds the given aggregation functions to the selector query.

func (*RouteSelect) Bool

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

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

func (*RouteSelect) BoolX

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

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

func (*RouteSelect) Bools

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

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

func (*RouteSelect) BoolsX

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

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

func (*RouteSelect) Float64

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

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

func (*RouteSelect) Float64X

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

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

func (*RouteSelect) Float64s

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

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

func (*RouteSelect) Float64sX

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

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

func (*RouteSelect) Int

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

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

func (*RouteSelect) IntX

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

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

func (*RouteSelect) Ints

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

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

func (*RouteSelect) IntsX

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

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

func (*RouteSelect) Scan

func (rs *RouteSelect) Scan(ctx context.Context, v any) error

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

func (*RouteSelect) ScanX

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

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

func (*RouteSelect) String

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

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

func (*RouteSelect) StringX

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

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

func (*RouteSelect) Strings

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

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

func (*RouteSelect) StringsX

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

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

type RouteUpdate

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

RouteUpdate is the builder for updating Route entities.

func (*RouteUpdate) AddAirlineId

func (ru *RouteUpdate) AddAirlineId(i int) *RouteUpdate

AddAirlineId adds i to the "airlineId" field.

func (*RouteUpdate) AddDestinationAirportId

func (ru *RouteUpdate) AddDestinationAirportId(i int) *RouteUpdate

AddDestinationAirportId adds i to the "destinationAirportId" field.

func (*RouteUpdate) AddNumberOfStops

func (ru *RouteUpdate) AddNumberOfStops(i int) *RouteUpdate

AddNumberOfStops adds i to the "numberOfStops" field.

func (*RouteUpdate) AddPlaneId

func (ru *RouteUpdate) AddPlaneId(i int) *RouteUpdate

AddPlaneId adds i to the "planeId" field.

func (*RouteUpdate) AddSourceAirportId

func (ru *RouteUpdate) AddSourceAirportId(i int) *RouteUpdate

AddSourceAirportId adds i to the "sourceAirportId" field.

func (*RouteUpdate) Exec

func (ru *RouteUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*RouteUpdate) ExecX

func (ru *RouteUpdate) ExecX(ctx context.Context)

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

func (*RouteUpdate) Mutation

func (ru *RouteUpdate) Mutation() *RouteMutation

Mutation returns the RouteMutation object of the builder.

func (*RouteUpdate) Save

func (ru *RouteUpdate) Save(ctx context.Context) (int, error)

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

func (*RouteUpdate) SaveX

func (ru *RouteUpdate) SaveX(ctx context.Context) int

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

func (*RouteUpdate) SetAirlineId

func (ru *RouteUpdate) SetAirlineId(i int) *RouteUpdate

SetAirlineId sets the "airlineId" field.

func (*RouteUpdate) SetDestinationAirportId

func (ru *RouteUpdate) SetDestinationAirportId(i int) *RouteUpdate

SetDestinationAirportId sets the "destinationAirportId" field.

func (*RouteUpdate) SetNumberOfStops

func (ru *RouteUpdate) SetNumberOfStops(i int) *RouteUpdate

SetNumberOfStops sets the "numberOfStops" field.

func (*RouteUpdate) SetPlaneId

func (ru *RouteUpdate) SetPlaneId(i int) *RouteUpdate

SetPlaneId sets the "planeId" field.

func (*RouteUpdate) SetSourceAirportId

func (ru *RouteUpdate) SetSourceAirportId(i int) *RouteUpdate

SetSourceAirportId sets the "sourceAirportId" field.

func (*RouteUpdate) Where

func (ru *RouteUpdate) Where(ps ...predicate.Route) *RouteUpdate

Where appends a list predicates to the RouteUpdate builder.

type RouteUpdateOne

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

RouteUpdateOne is the builder for updating a single Route entity.

func (*RouteUpdateOne) AddAirlineId

func (ruo *RouteUpdateOne) AddAirlineId(i int) *RouteUpdateOne

AddAirlineId adds i to the "airlineId" field.

func (*RouteUpdateOne) AddDestinationAirportId

func (ruo *RouteUpdateOne) AddDestinationAirportId(i int) *RouteUpdateOne

AddDestinationAirportId adds i to the "destinationAirportId" field.

func (*RouteUpdateOne) AddNumberOfStops

func (ruo *RouteUpdateOne) AddNumberOfStops(i int) *RouteUpdateOne

AddNumberOfStops adds i to the "numberOfStops" field.

func (*RouteUpdateOne) AddPlaneId

func (ruo *RouteUpdateOne) AddPlaneId(i int) *RouteUpdateOne

AddPlaneId adds i to the "planeId" field.

func (*RouteUpdateOne) AddSourceAirportId

func (ruo *RouteUpdateOne) AddSourceAirportId(i int) *RouteUpdateOne

AddSourceAirportId adds i to the "sourceAirportId" field.

func (*RouteUpdateOne) Exec

func (ruo *RouteUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*RouteUpdateOne) ExecX

func (ruo *RouteUpdateOne) ExecX(ctx context.Context)

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

func (*RouteUpdateOne) Mutation

func (ruo *RouteUpdateOne) Mutation() *RouteMutation

Mutation returns the RouteMutation object of the builder.

func (*RouteUpdateOne) Save

func (ruo *RouteUpdateOne) Save(ctx context.Context) (*Route, error)

Save executes the query and returns the updated Route entity.

func (*RouteUpdateOne) SaveX

func (ruo *RouteUpdateOne) SaveX(ctx context.Context) *Route

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

func (*RouteUpdateOne) Select

func (ruo *RouteUpdateOne) Select(field string, fields ...string) *RouteUpdateOne

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

func (*RouteUpdateOne) SetAirlineId

func (ruo *RouteUpdateOne) SetAirlineId(i int) *RouteUpdateOne

SetAirlineId sets the "airlineId" field.

func (*RouteUpdateOne) SetDestinationAirportId

func (ruo *RouteUpdateOne) SetDestinationAirportId(i int) *RouteUpdateOne

SetDestinationAirportId sets the "destinationAirportId" field.

func (*RouteUpdateOne) SetNumberOfStops

func (ruo *RouteUpdateOne) SetNumberOfStops(i int) *RouteUpdateOne

SetNumberOfStops sets the "numberOfStops" field.

func (*RouteUpdateOne) SetPlaneId

func (ruo *RouteUpdateOne) SetPlaneId(i int) *RouteUpdateOne

SetPlaneId sets the "planeId" field.

func (*RouteUpdateOne) SetSourceAirportId

func (ruo *RouteUpdateOne) SetSourceAirportId(i int) *RouteUpdateOne

SetSourceAirportId sets the "sourceAirportId" field.

func (*RouteUpdateOne) Where

func (ruo *RouteUpdateOne) Where(ps ...predicate.Route) *RouteUpdateOne

Where appends a list predicates to the RouteUpdate builder.

type Routes

type Routes []*Route

Routes is a parsable slice of Route.

type TraverseFunc

type TraverseFunc = ent.TraverseFunc

ent aliases to avoid import conflicts in user's code.

type Traverser

type Traverser = ent.Traverser

ent aliases to avoid import conflicts in user's code.

type Tx

type Tx struct {

	// Airline is the client for interacting with the Airline builders.
	Airline *AirlineClient
	// Airport is the client for interacting with the Airport builders.
	Airport *AirportClient
	// Plane is the client for interacting with the Plane builders.
	Plane *PlaneClient
	// Route is the client for interacting with the Route builders.
	Route *RouteClient
	// contains filtered or unexported fields
}

Tx is a transactional client that is created by calling Client.Tx().

func TxFromContext

func TxFromContext(ctx context.Context) *Tx

TxFromContext returns a Tx stored inside a context, or nil if there isn't one.

func (*Tx) Client

func (tx *Tx) Client() *Client

Client returns a Client that binds to current transaction.

func (*Tx) Commit

func (tx *Tx) Commit() error

Commit commits the transaction.

func (*Tx) OnCommit

func (tx *Tx) OnCommit(f CommitHook)

OnCommit adds a hook to call on commit.

func (*Tx) OnRollback

func (tx *Tx) OnRollback(f RollbackHook)

OnRollback adds a hook to call on rollback.

func (*Tx) Rollback

func (tx *Tx) Rollback() error

Rollback rollbacks the transaction.

type ValidationError

type ValidationError struct {
	Name string // Field or edge name.
	// contains filtered or unexported fields
}

ValidationError returns when validating a field or edge fails.

func (*ValidationError) Error

func (e *ValidationError) Error() string

Error implements the error interface.

func (*ValidationError) Unwrap

func (e *ValidationError) Unwrap() error

Unwrap implements the errors.Wrapper interface.

type Value

type Value = ent.Value

ent aliases to avoid import conflicts in user's code.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL