ent

package
v0.0.0-...-0bc79a0 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2022 License: MIT Imports: 18 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.
	TypeAddressPlace = "AddressPlace"
	TypeCity         = "City"
	TypeStreet       = "Street"
)

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 AddressPlace

type AddressPlace struct {

	// ID of the ent.
	ID int32 `json:"id,omitempty"`
	// Number holds the value of the "number" field.
	Number int32 `json:"number,omitempty"`
	// OrientationNumber holds the value of the "orientation_number" field.
	OrientationNumber int32 `json:"orientation_number,omitempty"`
	// OrientationNumberLetter holds the value of the "orientation_number_letter" field.
	OrientationNumberLetter string `json:"orientation_number_letter,omitempty"`
	// Zip holds the value of the "zip" field.
	Zip int32 `json:"zip,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the AddressPlaceQuery when eager-loading is set.
	Edges AddressPlaceEdges `json:"edges"`
	// contains filtered or unexported fields
}

AddressPlace is the model entity for the AddressPlace schema.

func (*AddressPlace) QueryStreets

func (ap *AddressPlace) QueryStreets() *StreetQuery

QueryStreets queries the "streets" edge of the AddressPlace entity.

func (*AddressPlace) String

func (ap *AddressPlace) String() string

String implements the fmt.Stringer.

func (*AddressPlace) Unwrap

func (ap *AddressPlace) Unwrap() *AddressPlace

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

func (ap *AddressPlace) Update() *AddressPlaceUpdateOne

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

type AddressPlaceClient

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

AddressPlaceClient is a client for the AddressPlace schema.

func NewAddressPlaceClient

func NewAddressPlaceClient(c config) *AddressPlaceClient

NewAddressPlaceClient returns a client for the AddressPlace from the given config.

func (*AddressPlaceClient) Create

Create returns a create builder for AddressPlace.

func (*AddressPlaceClient) CreateBulk

func (c *AddressPlaceClient) CreateBulk(builders ...*AddressPlaceCreate) *AddressPlaceCreateBulk

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

func (*AddressPlaceClient) Delete

Delete returns a delete builder for AddressPlace.

func (*AddressPlaceClient) DeleteOne

DeleteOne returns a delete builder for the given entity.

func (*AddressPlaceClient) DeleteOneID

func (c *AddressPlaceClient) DeleteOneID(id int32) *AddressPlaceDeleteOne

DeleteOneID returns a delete builder for the given id.

func (*AddressPlaceClient) Get

Get returns a AddressPlace entity by its id.

func (*AddressPlaceClient) GetX

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

func (*AddressPlaceClient) Hooks

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

Hooks returns the client hooks.

func (*AddressPlaceClient) Query

Query returns a query builder for AddressPlace.

func (*AddressPlaceClient) QueryStreets

func (c *AddressPlaceClient) QueryStreets(ap *AddressPlace) *StreetQuery

QueryStreets queries the streets edge of a AddressPlace.

func (*AddressPlaceClient) Update

Update returns an update builder for AddressPlace.

func (*AddressPlaceClient) UpdateOne

UpdateOne returns an update builder for the given entity.

func (*AddressPlaceClient) UpdateOneID

func (c *AddressPlaceClient) UpdateOneID(id int32) *AddressPlaceUpdateOne

UpdateOneID returns an update builder for the given id.

func (*AddressPlaceClient) Use

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

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

type AddressPlaceCreate

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

AddressPlaceCreate is the builder for creating a AddressPlace entity.

func (*AddressPlaceCreate) AddStreetIDs

func (apc *AddressPlaceCreate) AddStreetIDs(ids ...int32) *AddressPlaceCreate

AddStreetIDs adds the "streets" edge to the Street entity by IDs.

func (*AddressPlaceCreate) AddStreets

func (apc *AddressPlaceCreate) AddStreets(s ...*Street) *AddressPlaceCreate

AddStreets adds the "streets" edges to the Street entity.

func (*AddressPlaceCreate) Exec

func (apc *AddressPlaceCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*AddressPlaceCreate) ExecX

func (apc *AddressPlaceCreate) ExecX(ctx context.Context)

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

func (*AddressPlaceCreate) Mutation

func (apc *AddressPlaceCreate) Mutation() *AddressPlaceMutation

Mutation returns the AddressPlaceMutation object of the builder.

func (*AddressPlaceCreate) OnConflict

func (apc *AddressPlaceCreate) OnConflict(opts ...sql.ConflictOption) *AddressPlaceUpsertOne

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

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

func (*AddressPlaceCreate) OnConflictColumns

func (apc *AddressPlaceCreate) OnConflictColumns(columns ...string) *AddressPlaceUpsertOne

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

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

func (*AddressPlaceCreate) Save

Save creates the AddressPlace in the database.

func (*AddressPlaceCreate) SaveX

SaveX calls Save and panics if Save returns an error.

func (*AddressPlaceCreate) SetID

SetID sets the "id" field.

func (*AddressPlaceCreate) SetNillableOrientationNumber

func (apc *AddressPlaceCreate) SetNillableOrientationNumber(i *int32) *AddressPlaceCreate

SetNillableOrientationNumber sets the "orientation_number" field if the given value is not nil.

func (*AddressPlaceCreate) SetNillableOrientationNumberLetter

func (apc *AddressPlaceCreate) SetNillableOrientationNumberLetter(s *string) *AddressPlaceCreate

SetNillableOrientationNumberLetter sets the "orientation_number_letter" field if the given value is not nil.

func (*AddressPlaceCreate) SetNumber

func (apc *AddressPlaceCreate) SetNumber(i int32) *AddressPlaceCreate

SetNumber sets the "number" field.

func (*AddressPlaceCreate) SetOrientationNumber

func (apc *AddressPlaceCreate) SetOrientationNumber(i int32) *AddressPlaceCreate

SetOrientationNumber sets the "orientation_number" field.

func (*AddressPlaceCreate) SetOrientationNumberLetter

func (apc *AddressPlaceCreate) SetOrientationNumberLetter(s string) *AddressPlaceCreate

SetOrientationNumberLetter sets the "orientation_number_letter" field.

func (*AddressPlaceCreate) SetZip

SetZip sets the "zip" field.

type AddressPlaceCreateBulk

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

AddressPlaceCreateBulk is the builder for creating many AddressPlace entities in bulk.

func (*AddressPlaceCreateBulk) Exec

func (apcb *AddressPlaceCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*AddressPlaceCreateBulk) ExecX

func (apcb *AddressPlaceCreateBulk) ExecX(ctx context.Context)

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

func (*AddressPlaceCreateBulk) OnConflict

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

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

func (*AddressPlaceCreateBulk) OnConflictColumns

func (apcb *AddressPlaceCreateBulk) OnConflictColumns(columns ...string) *AddressPlaceUpsertBulk

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

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

func (*AddressPlaceCreateBulk) Save

Save creates the AddressPlace entities in the database.

func (*AddressPlaceCreateBulk) SaveX

func (apcb *AddressPlaceCreateBulk) SaveX(ctx context.Context) []*AddressPlace

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

type AddressPlaceDelete

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

AddressPlaceDelete is the builder for deleting a AddressPlace entity.

func (*AddressPlaceDelete) Exec

func (apd *AddressPlaceDelete) Exec(ctx context.Context) (int, error)

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

func (*AddressPlaceDelete) ExecX

func (apd *AddressPlaceDelete) ExecX(ctx context.Context) int

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

func (*AddressPlaceDelete) Where

Where appends a list predicates to the AddressPlaceDelete builder.

type AddressPlaceDeleteOne

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

AddressPlaceDeleteOne is the builder for deleting a single AddressPlace entity.

func (*AddressPlaceDeleteOne) Exec

func (apdo *AddressPlaceDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*AddressPlaceDeleteOne) ExecX

func (apdo *AddressPlaceDeleteOne) ExecX(ctx context.Context)

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

type AddressPlaceEdges

type AddressPlaceEdges struct {
	// Streets holds the value of the streets edge.
	Streets []*Street `json:"streets,omitempty"`
	// contains filtered or unexported fields
}

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

func (AddressPlaceEdges) StreetsOrErr

func (e AddressPlaceEdges) StreetsOrErr() ([]*Street, error)

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

type AddressPlaceGroupBy

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

AddressPlaceGroupBy is the group-by builder for AddressPlace entities.

func (*AddressPlaceGroupBy) Aggregate

func (apgb *AddressPlaceGroupBy) Aggregate(fns ...AggregateFunc) *AddressPlaceGroupBy

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

func (*AddressPlaceGroupBy) Bool

func (apgb *AddressPlaceGroupBy) Bool(ctx context.Context) (_ bool, err error)

Bool returns a single bool from a group-by query. It is only allowed when executing a group-by query with one field.

func (*AddressPlaceGroupBy) BoolX

func (apgb *AddressPlaceGroupBy) BoolX(ctx context.Context) bool

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

func (*AddressPlaceGroupBy) Bools

func (apgb *AddressPlaceGroupBy) Bools(ctx context.Context) ([]bool, error)

Bools returns list of bools from group-by. It is only allowed when executing a group-by query with one field.

func (*AddressPlaceGroupBy) BoolsX

func (apgb *AddressPlaceGroupBy) BoolsX(ctx context.Context) []bool

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

func (*AddressPlaceGroupBy) Float64

func (apgb *AddressPlaceGroupBy) Float64(ctx context.Context) (_ float64, err error)

Float64 returns a single float64 from a group-by query. It is only allowed when executing a group-by query with one field.

func (*AddressPlaceGroupBy) Float64X

func (apgb *AddressPlaceGroupBy) Float64X(ctx context.Context) float64

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

func (*AddressPlaceGroupBy) Float64s

func (apgb *AddressPlaceGroupBy) Float64s(ctx context.Context) ([]float64, error)

Float64s returns list of float64s from group-by. It is only allowed when executing a group-by query with one field.

func (*AddressPlaceGroupBy) Float64sX

func (apgb *AddressPlaceGroupBy) Float64sX(ctx context.Context) []float64

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

func (*AddressPlaceGroupBy) Int

func (apgb *AddressPlaceGroupBy) Int(ctx context.Context) (_ int, err error)

Int returns a single int from a group-by query. It is only allowed when executing a group-by query with one field.

func (*AddressPlaceGroupBy) IntX

func (apgb *AddressPlaceGroupBy) IntX(ctx context.Context) int

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

func (*AddressPlaceGroupBy) Ints

func (apgb *AddressPlaceGroupBy) Ints(ctx context.Context) ([]int, error)

Ints returns list of ints from group-by. It is only allowed when executing a group-by query with one field.

func (*AddressPlaceGroupBy) IntsX

func (apgb *AddressPlaceGroupBy) IntsX(ctx context.Context) []int

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

func (*AddressPlaceGroupBy) Scan

func (apgb *AddressPlaceGroupBy) Scan(ctx context.Context, v interface{}) error

Scan applies the group-by query and scans the result into the given value.

func (*AddressPlaceGroupBy) ScanX

func (apgb *AddressPlaceGroupBy) ScanX(ctx context.Context, v interface{})

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

func (*AddressPlaceGroupBy) String

func (apgb *AddressPlaceGroupBy) String(ctx context.Context) (_ string, err error)

String returns a single string from a group-by query. It is only allowed when executing a group-by query with one field.

func (*AddressPlaceGroupBy) StringX

func (apgb *AddressPlaceGroupBy) StringX(ctx context.Context) string

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

func (*AddressPlaceGroupBy) Strings

func (apgb *AddressPlaceGroupBy) Strings(ctx context.Context) ([]string, error)

Strings returns list of strings from group-by. It is only allowed when executing a group-by query with one field.

func (*AddressPlaceGroupBy) StringsX

func (apgb *AddressPlaceGroupBy) StringsX(ctx context.Context) []string

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

type AddressPlaceMutation

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

AddressPlaceMutation represents an operation that mutates the AddressPlace nodes in the graph.

func (*AddressPlaceMutation) AddField

func (m *AddressPlaceMutation) 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 (*AddressPlaceMutation) AddNumber

func (m *AddressPlaceMutation) AddNumber(i int32)

AddNumber adds i to the "number" field.

func (*AddressPlaceMutation) AddOrientationNumber

func (m *AddressPlaceMutation) AddOrientationNumber(i int32)

AddOrientationNumber adds i to the "orientation_number" field.

func (*AddressPlaceMutation) AddStreetIDs

func (m *AddressPlaceMutation) AddStreetIDs(ids ...int32)

AddStreetIDs adds the "streets" edge to the Street entity by ids.

func (*AddressPlaceMutation) AddZip

func (m *AddressPlaceMutation) AddZip(i int32)

AddZip adds i to the "zip" field.

func (*AddressPlaceMutation) AddedEdges

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

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

func (*AddressPlaceMutation) AddedField

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

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

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

func (*AddressPlaceMutation) AddedIDs

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

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

func (*AddressPlaceMutation) AddedNumber

func (m *AddressPlaceMutation) AddedNumber() (r int32, exists bool)

AddedNumber returns the value that was added to the "number" field in this mutation.

func (*AddressPlaceMutation) AddedOrientationNumber

func (m *AddressPlaceMutation) AddedOrientationNumber() (r int32, exists bool)

AddedOrientationNumber returns the value that was added to the "orientation_number" field in this mutation.

func (*AddressPlaceMutation) AddedZip

func (m *AddressPlaceMutation) AddedZip() (r int32, exists bool)

AddedZip returns the value that was added to the "zip" field in this mutation.

func (*AddressPlaceMutation) ClearEdge

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

func (m *AddressPlaceMutation) 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 (*AddressPlaceMutation) ClearOrientationNumber

func (m *AddressPlaceMutation) ClearOrientationNumber()

ClearOrientationNumber clears the value of the "orientation_number" field.

func (*AddressPlaceMutation) ClearOrientationNumberLetter

func (m *AddressPlaceMutation) ClearOrientationNumberLetter()

ClearOrientationNumberLetter clears the value of the "orientation_number_letter" field.

func (*AddressPlaceMutation) ClearStreets

func (m *AddressPlaceMutation) ClearStreets()

ClearStreets clears the "streets" edge to the Street entity.

func (*AddressPlaceMutation) ClearedEdges

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

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

func (*AddressPlaceMutation) ClearedFields

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

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

func (AddressPlaceMutation) Client

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

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

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

func (*AddressPlaceMutation) Field

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

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

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

func (*AddressPlaceMutation) Fields

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

func (m *AddressPlaceMutation) ID() (id int32, 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 (*AddressPlaceMutation) Number

func (m *AddressPlaceMutation) Number() (r int32, exists bool)

Number returns the value of the "number" field in the mutation.

func (*AddressPlaceMutation) OldField

func (m *AddressPlaceMutation) 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 (*AddressPlaceMutation) OldNumber

func (m *AddressPlaceMutation) OldNumber(ctx context.Context) (v int32, err error)

OldNumber returns the old "number" field's value of the AddressPlace entity. If the AddressPlace 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 (*AddressPlaceMutation) OldOrientationNumber

func (m *AddressPlaceMutation) OldOrientationNumber(ctx context.Context) (v int32, err error)

OldOrientationNumber returns the old "orientation_number" field's value of the AddressPlace entity. If the AddressPlace 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 (*AddressPlaceMutation) OldOrientationNumberLetter

func (m *AddressPlaceMutation) OldOrientationNumberLetter(ctx context.Context) (v string, err error)

OldOrientationNumberLetter returns the old "orientation_number_letter" field's value of the AddressPlace entity. If the AddressPlace 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 (*AddressPlaceMutation) OldZip

func (m *AddressPlaceMutation) OldZip(ctx context.Context) (v int32, err error)

OldZip returns the old "zip" field's value of the AddressPlace entity. If the AddressPlace 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 (*AddressPlaceMutation) Op

func (m *AddressPlaceMutation) Op() Op

Op returns the operation name.

func (*AddressPlaceMutation) OrientationNumber

func (m *AddressPlaceMutation) OrientationNumber() (r int32, exists bool)

OrientationNumber returns the value of the "orientation_number" field in the mutation.

func (*AddressPlaceMutation) OrientationNumberCleared

func (m *AddressPlaceMutation) OrientationNumberCleared() bool

OrientationNumberCleared returns if the "orientation_number" field was cleared in this mutation.

func (*AddressPlaceMutation) OrientationNumberLetter

func (m *AddressPlaceMutation) OrientationNumberLetter() (r string, exists bool)

OrientationNumberLetter returns the value of the "orientation_number_letter" field in the mutation.

func (*AddressPlaceMutation) OrientationNumberLetterCleared

func (m *AddressPlaceMutation) OrientationNumberLetterCleared() bool

OrientationNumberLetterCleared returns if the "orientation_number_letter" field was cleared in this mutation.

func (*AddressPlaceMutation) RemoveStreetIDs

func (m *AddressPlaceMutation) RemoveStreetIDs(ids ...int32)

RemoveStreetIDs removes the "streets" edge to the Street entity by IDs.

func (*AddressPlaceMutation) RemovedEdges

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

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

func (*AddressPlaceMutation) RemovedIDs

func (m *AddressPlaceMutation) 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 (*AddressPlaceMutation) RemovedStreetsIDs

func (m *AddressPlaceMutation) RemovedStreetsIDs() (ids []int32)

RemovedStreets returns the removed IDs of the "streets" edge to the Street entity.

func (*AddressPlaceMutation) ResetEdge

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

func (m *AddressPlaceMutation) 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 (*AddressPlaceMutation) ResetNumber

func (m *AddressPlaceMutation) ResetNumber()

ResetNumber resets all changes to the "number" field.

func (*AddressPlaceMutation) ResetOrientationNumber

func (m *AddressPlaceMutation) ResetOrientationNumber()

ResetOrientationNumber resets all changes to the "orientation_number" field.

func (*AddressPlaceMutation) ResetOrientationNumberLetter

func (m *AddressPlaceMutation) ResetOrientationNumberLetter()

ResetOrientationNumberLetter resets all changes to the "orientation_number_letter" field.

func (*AddressPlaceMutation) ResetStreets

func (m *AddressPlaceMutation) ResetStreets()

ResetStreets resets all changes to the "streets" edge.

func (*AddressPlaceMutation) ResetZip

func (m *AddressPlaceMutation) ResetZip()

ResetZip resets all changes to the "zip" field.

func (*AddressPlaceMutation) SetField

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

func (m *AddressPlaceMutation) SetID(id int32)

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

func (*AddressPlaceMutation) SetNumber

func (m *AddressPlaceMutation) SetNumber(i int32)

SetNumber sets the "number" field.

func (*AddressPlaceMutation) SetOrientationNumber

func (m *AddressPlaceMutation) SetOrientationNumber(i int32)

SetOrientationNumber sets the "orientation_number" field.

func (*AddressPlaceMutation) SetOrientationNumberLetter

func (m *AddressPlaceMutation) SetOrientationNumberLetter(s string)

SetOrientationNumberLetter sets the "orientation_number_letter" field.

func (*AddressPlaceMutation) SetZip

func (m *AddressPlaceMutation) SetZip(i int32)

SetZip sets the "zip" field.

func (*AddressPlaceMutation) StreetsCleared

func (m *AddressPlaceMutation) StreetsCleared() bool

StreetsCleared reports if the "streets" edge to the Street entity was cleared.

func (*AddressPlaceMutation) StreetsIDs

func (m *AddressPlaceMutation) StreetsIDs() (ids []int32)

StreetsIDs returns the "streets" edge IDs in the mutation.

func (AddressPlaceMutation) Tx

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

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

func (*AddressPlaceMutation) Type

func (m *AddressPlaceMutation) Type() string

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

func (*AddressPlaceMutation) Where

Where appends a list predicates to the AddressPlaceMutation builder.

func (*AddressPlaceMutation) Zip

func (m *AddressPlaceMutation) Zip() (r int32, exists bool)

Zip returns the value of the "zip" field in the mutation.

type AddressPlaceQuery

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

AddressPlaceQuery is the builder for querying AddressPlace entities.

func (*AddressPlaceQuery) All

func (apq *AddressPlaceQuery) All(ctx context.Context) ([]*AddressPlace, error)

All executes the query and returns a list of AddressPlaces.

func (*AddressPlaceQuery) AllX

func (apq *AddressPlaceQuery) AllX(ctx context.Context) []*AddressPlace

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

func (*AddressPlaceQuery) Clone

func (apq *AddressPlaceQuery) Clone() *AddressPlaceQuery

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

func (*AddressPlaceQuery) Count

func (apq *AddressPlaceQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*AddressPlaceQuery) CountX

func (apq *AddressPlaceQuery) CountX(ctx context.Context) int

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

func (*AddressPlaceQuery) Exist

func (apq *AddressPlaceQuery) Exist(ctx context.Context) (bool, error)

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

func (*AddressPlaceQuery) ExistX

func (apq *AddressPlaceQuery) ExistX(ctx context.Context) bool

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

func (*AddressPlaceQuery) First

func (apq *AddressPlaceQuery) First(ctx context.Context) (*AddressPlace, error)

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

func (*AddressPlaceQuery) FirstID

func (apq *AddressPlaceQuery) FirstID(ctx context.Context) (id int32, err error)

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

func (*AddressPlaceQuery) FirstIDX

func (apq *AddressPlaceQuery) FirstIDX(ctx context.Context) int32

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

func (*AddressPlaceQuery) FirstX

func (apq *AddressPlaceQuery) FirstX(ctx context.Context) *AddressPlace

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

func (*AddressPlaceQuery) GroupBy

func (apq *AddressPlaceQuery) GroupBy(field string, fields ...string) *AddressPlaceGroupBy

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 {
	Number int32 `json:"number,omitempty"`
	Count int `json:"count,omitempty"`
}

client.AddressPlace.Query().
	GroupBy(addressplace.FieldNumber).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*AddressPlaceQuery) IDs

func (apq *AddressPlaceQuery) IDs(ctx context.Context) ([]int32, error)

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

func (*AddressPlaceQuery) IDsX

func (apq *AddressPlaceQuery) IDsX(ctx context.Context) []int32

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

func (*AddressPlaceQuery) Limit

func (apq *AddressPlaceQuery) Limit(limit int) *AddressPlaceQuery

Limit adds a limit step to the query.

func (*AddressPlaceQuery) Offset

func (apq *AddressPlaceQuery) Offset(offset int) *AddressPlaceQuery

Offset adds an offset step to the query.

func (*AddressPlaceQuery) Only

func (apq *AddressPlaceQuery) Only(ctx context.Context) (*AddressPlace, error)

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

func (*AddressPlaceQuery) OnlyID

func (apq *AddressPlaceQuery) OnlyID(ctx context.Context) (id int32, err error)

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

func (*AddressPlaceQuery) OnlyIDX

func (apq *AddressPlaceQuery) OnlyIDX(ctx context.Context) int32

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

func (*AddressPlaceQuery) OnlyX

func (apq *AddressPlaceQuery) OnlyX(ctx context.Context) *AddressPlace

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

func (*AddressPlaceQuery) Order

func (apq *AddressPlaceQuery) Order(o ...OrderFunc) *AddressPlaceQuery

Order adds an order step to the query.

func (*AddressPlaceQuery) QueryStreets

func (apq *AddressPlaceQuery) QueryStreets() *StreetQuery

QueryStreets chains the current query on the "streets" edge.

func (*AddressPlaceQuery) Select

func (apq *AddressPlaceQuery) Select(fields ...string) *AddressPlaceSelect

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 {
	Number int32 `json:"number,omitempty"`
}

client.AddressPlace.Query().
	Select(addressplace.FieldNumber).
	Scan(ctx, &v)

func (*AddressPlaceQuery) Unique

func (apq *AddressPlaceQuery) Unique(unique bool) *AddressPlaceQuery

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

Where adds a new predicate for the AddressPlaceQuery builder.

func (*AddressPlaceQuery) WithStreets

func (apq *AddressPlaceQuery) WithStreets(opts ...func(*StreetQuery)) *AddressPlaceQuery

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

type AddressPlaceSelect

type AddressPlaceSelect struct {
	*AddressPlaceQuery
	// contains filtered or unexported fields
}

AddressPlaceSelect is the builder for selecting fields of AddressPlace entities.

func (*AddressPlaceSelect) Bool

func (aps *AddressPlaceSelect) Bool(ctx context.Context) (_ bool, err error)

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

func (*AddressPlaceSelect) BoolX

func (aps *AddressPlaceSelect) BoolX(ctx context.Context) bool

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

func (*AddressPlaceSelect) Bools

func (aps *AddressPlaceSelect) Bools(ctx context.Context) ([]bool, error)

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

func (*AddressPlaceSelect) BoolsX

func (aps *AddressPlaceSelect) BoolsX(ctx context.Context) []bool

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

func (*AddressPlaceSelect) Float64

func (aps *AddressPlaceSelect) Float64(ctx context.Context) (_ float64, err error)

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

func (*AddressPlaceSelect) Float64X

func (aps *AddressPlaceSelect) Float64X(ctx context.Context) float64

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

func (*AddressPlaceSelect) Float64s

func (aps *AddressPlaceSelect) Float64s(ctx context.Context) ([]float64, error)

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

func (*AddressPlaceSelect) Float64sX

func (aps *AddressPlaceSelect) Float64sX(ctx context.Context) []float64

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

func (*AddressPlaceSelect) Int

func (aps *AddressPlaceSelect) Int(ctx context.Context) (_ int, err error)

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

func (*AddressPlaceSelect) IntX

func (aps *AddressPlaceSelect) IntX(ctx context.Context) int

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

func (*AddressPlaceSelect) Ints

func (aps *AddressPlaceSelect) Ints(ctx context.Context) ([]int, error)

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

func (*AddressPlaceSelect) IntsX

func (aps *AddressPlaceSelect) IntsX(ctx context.Context) []int

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

func (*AddressPlaceSelect) Scan

func (aps *AddressPlaceSelect) Scan(ctx context.Context, v interface{}) error

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

func (*AddressPlaceSelect) ScanX

func (aps *AddressPlaceSelect) ScanX(ctx context.Context, v interface{})

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

func (*AddressPlaceSelect) String

func (aps *AddressPlaceSelect) String(ctx context.Context) (_ string, err error)

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

func (*AddressPlaceSelect) StringX

func (aps *AddressPlaceSelect) StringX(ctx context.Context) string

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

func (*AddressPlaceSelect) Strings

func (aps *AddressPlaceSelect) Strings(ctx context.Context) ([]string, error)

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

func (*AddressPlaceSelect) StringsX

func (aps *AddressPlaceSelect) StringsX(ctx context.Context) []string

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

type AddressPlaceUpdate

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

AddressPlaceUpdate is the builder for updating AddressPlace entities.

func (*AddressPlaceUpdate) AddNumber

func (apu *AddressPlaceUpdate) AddNumber(i int32) *AddressPlaceUpdate

AddNumber adds i to the "number" field.

func (*AddressPlaceUpdate) AddOrientationNumber

func (apu *AddressPlaceUpdate) AddOrientationNumber(i int32) *AddressPlaceUpdate

AddOrientationNumber adds i to the "orientation_number" field.

func (*AddressPlaceUpdate) AddStreetIDs

func (apu *AddressPlaceUpdate) AddStreetIDs(ids ...int32) *AddressPlaceUpdate

AddStreetIDs adds the "streets" edge to the Street entity by IDs.

func (*AddressPlaceUpdate) AddStreets

func (apu *AddressPlaceUpdate) AddStreets(s ...*Street) *AddressPlaceUpdate

AddStreets adds the "streets" edges to the Street entity.

func (*AddressPlaceUpdate) AddZip

AddZip adds i to the "zip" field.

func (*AddressPlaceUpdate) ClearOrientationNumber

func (apu *AddressPlaceUpdate) ClearOrientationNumber() *AddressPlaceUpdate

ClearOrientationNumber clears the value of the "orientation_number" field.

func (*AddressPlaceUpdate) ClearOrientationNumberLetter

func (apu *AddressPlaceUpdate) ClearOrientationNumberLetter() *AddressPlaceUpdate

ClearOrientationNumberLetter clears the value of the "orientation_number_letter" field.

func (*AddressPlaceUpdate) ClearStreets

func (apu *AddressPlaceUpdate) ClearStreets() *AddressPlaceUpdate

ClearStreets clears all "streets" edges to the Street entity.

func (*AddressPlaceUpdate) Exec

func (apu *AddressPlaceUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*AddressPlaceUpdate) ExecX

func (apu *AddressPlaceUpdate) ExecX(ctx context.Context)

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

func (*AddressPlaceUpdate) Mutation

func (apu *AddressPlaceUpdate) Mutation() *AddressPlaceMutation

Mutation returns the AddressPlaceMutation object of the builder.

func (*AddressPlaceUpdate) RemoveStreetIDs

func (apu *AddressPlaceUpdate) RemoveStreetIDs(ids ...int32) *AddressPlaceUpdate

RemoveStreetIDs removes the "streets" edge to Street entities by IDs.

func (*AddressPlaceUpdate) RemoveStreets

func (apu *AddressPlaceUpdate) RemoveStreets(s ...*Street) *AddressPlaceUpdate

RemoveStreets removes "streets" edges to Street entities.

func (*AddressPlaceUpdate) Save

func (apu *AddressPlaceUpdate) Save(ctx context.Context) (int, error)

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

func (*AddressPlaceUpdate) SaveX

func (apu *AddressPlaceUpdate) SaveX(ctx context.Context) int

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

func (*AddressPlaceUpdate) SetNillableOrientationNumber

func (apu *AddressPlaceUpdate) SetNillableOrientationNumber(i *int32) *AddressPlaceUpdate

SetNillableOrientationNumber sets the "orientation_number" field if the given value is not nil.

func (*AddressPlaceUpdate) SetNillableOrientationNumberLetter

func (apu *AddressPlaceUpdate) SetNillableOrientationNumberLetter(s *string) *AddressPlaceUpdate

SetNillableOrientationNumberLetter sets the "orientation_number_letter" field if the given value is not nil.

func (*AddressPlaceUpdate) SetNumber

func (apu *AddressPlaceUpdate) SetNumber(i int32) *AddressPlaceUpdate

SetNumber sets the "number" field.

func (*AddressPlaceUpdate) SetOrientationNumber

func (apu *AddressPlaceUpdate) SetOrientationNumber(i int32) *AddressPlaceUpdate

SetOrientationNumber sets the "orientation_number" field.

func (*AddressPlaceUpdate) SetOrientationNumberLetter

func (apu *AddressPlaceUpdate) SetOrientationNumberLetter(s string) *AddressPlaceUpdate

SetOrientationNumberLetter sets the "orientation_number_letter" field.

func (*AddressPlaceUpdate) SetZip

SetZip sets the "zip" field.

func (*AddressPlaceUpdate) Where

Where appends a list predicates to the AddressPlaceUpdate builder.

type AddressPlaceUpdateOne

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

AddressPlaceUpdateOne is the builder for updating a single AddressPlace entity.

func (*AddressPlaceUpdateOne) AddNumber

AddNumber adds i to the "number" field.

func (*AddressPlaceUpdateOne) AddOrientationNumber

func (apuo *AddressPlaceUpdateOne) AddOrientationNumber(i int32) *AddressPlaceUpdateOne

AddOrientationNumber adds i to the "orientation_number" field.

func (*AddressPlaceUpdateOne) AddStreetIDs

func (apuo *AddressPlaceUpdateOne) AddStreetIDs(ids ...int32) *AddressPlaceUpdateOne

AddStreetIDs adds the "streets" edge to the Street entity by IDs.

func (*AddressPlaceUpdateOne) AddStreets

func (apuo *AddressPlaceUpdateOne) AddStreets(s ...*Street) *AddressPlaceUpdateOne

AddStreets adds the "streets" edges to the Street entity.

func (*AddressPlaceUpdateOne) AddZip

AddZip adds i to the "zip" field.

func (*AddressPlaceUpdateOne) ClearOrientationNumber

func (apuo *AddressPlaceUpdateOne) ClearOrientationNumber() *AddressPlaceUpdateOne

ClearOrientationNumber clears the value of the "orientation_number" field.

func (*AddressPlaceUpdateOne) ClearOrientationNumberLetter

func (apuo *AddressPlaceUpdateOne) ClearOrientationNumberLetter() *AddressPlaceUpdateOne

ClearOrientationNumberLetter clears the value of the "orientation_number_letter" field.

func (*AddressPlaceUpdateOne) ClearStreets

func (apuo *AddressPlaceUpdateOne) ClearStreets() *AddressPlaceUpdateOne

ClearStreets clears all "streets" edges to the Street entity.

func (*AddressPlaceUpdateOne) Exec

func (apuo *AddressPlaceUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*AddressPlaceUpdateOne) ExecX

func (apuo *AddressPlaceUpdateOne) ExecX(ctx context.Context)

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

func (*AddressPlaceUpdateOne) Mutation

func (apuo *AddressPlaceUpdateOne) Mutation() *AddressPlaceMutation

Mutation returns the AddressPlaceMutation object of the builder.

func (*AddressPlaceUpdateOne) RemoveStreetIDs

func (apuo *AddressPlaceUpdateOne) RemoveStreetIDs(ids ...int32) *AddressPlaceUpdateOne

RemoveStreetIDs removes the "streets" edge to Street entities by IDs.

func (*AddressPlaceUpdateOne) RemoveStreets

func (apuo *AddressPlaceUpdateOne) RemoveStreets(s ...*Street) *AddressPlaceUpdateOne

RemoveStreets removes "streets" edges to Street entities.

func (*AddressPlaceUpdateOne) Save

Save executes the query and returns the updated AddressPlace entity.

func (*AddressPlaceUpdateOne) SaveX

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

func (*AddressPlaceUpdateOne) Select

func (apuo *AddressPlaceUpdateOne) Select(field string, fields ...string) *AddressPlaceUpdateOne

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

func (*AddressPlaceUpdateOne) SetNillableOrientationNumber

func (apuo *AddressPlaceUpdateOne) SetNillableOrientationNumber(i *int32) *AddressPlaceUpdateOne

SetNillableOrientationNumber sets the "orientation_number" field if the given value is not nil.

func (*AddressPlaceUpdateOne) SetNillableOrientationNumberLetter

func (apuo *AddressPlaceUpdateOne) SetNillableOrientationNumberLetter(s *string) *AddressPlaceUpdateOne

SetNillableOrientationNumberLetter sets the "orientation_number_letter" field if the given value is not nil.

func (*AddressPlaceUpdateOne) SetNumber

SetNumber sets the "number" field.

func (*AddressPlaceUpdateOne) SetOrientationNumber

func (apuo *AddressPlaceUpdateOne) SetOrientationNumber(i int32) *AddressPlaceUpdateOne

SetOrientationNumber sets the "orientation_number" field.

func (*AddressPlaceUpdateOne) SetOrientationNumberLetter

func (apuo *AddressPlaceUpdateOne) SetOrientationNumberLetter(s string) *AddressPlaceUpdateOne

SetOrientationNumberLetter sets the "orientation_number_letter" field.

func (*AddressPlaceUpdateOne) SetZip

SetZip sets the "zip" field.

type AddressPlaceUpsert

type AddressPlaceUpsert struct {
	*sql.UpdateSet
}

AddressPlaceUpsert is the "OnConflict" setter.

func (*AddressPlaceUpsert) ClearOrientationNumber

func (u *AddressPlaceUpsert) ClearOrientationNumber() *AddressPlaceUpsert

ClearOrientationNumber clears the value of the "orientation_number" field.

func (*AddressPlaceUpsert) ClearOrientationNumberLetter

func (u *AddressPlaceUpsert) ClearOrientationNumberLetter() *AddressPlaceUpsert

ClearOrientationNumberLetter clears the value of the "orientation_number_letter" field.

func (*AddressPlaceUpsert) SetNumber

func (u *AddressPlaceUpsert) SetNumber(v int32) *AddressPlaceUpsert

SetNumber sets the "number" field.

func (*AddressPlaceUpsert) SetOrientationNumber

func (u *AddressPlaceUpsert) SetOrientationNumber(v int32) *AddressPlaceUpsert

SetOrientationNumber sets the "orientation_number" field.

func (*AddressPlaceUpsert) SetOrientationNumberLetter

func (u *AddressPlaceUpsert) SetOrientationNumberLetter(v string) *AddressPlaceUpsert

SetOrientationNumberLetter sets the "orientation_number_letter" field.

func (*AddressPlaceUpsert) SetZip

SetZip sets the "zip" field.

func (*AddressPlaceUpsert) UpdateNumber

func (u *AddressPlaceUpsert) UpdateNumber() *AddressPlaceUpsert

UpdateNumber sets the "number" field to the value that was provided on create.

func (*AddressPlaceUpsert) UpdateOrientationNumber

func (u *AddressPlaceUpsert) UpdateOrientationNumber() *AddressPlaceUpsert

UpdateOrientationNumber sets the "orientation_number" field to the value that was provided on create.

func (*AddressPlaceUpsert) UpdateOrientationNumberLetter

func (u *AddressPlaceUpsert) UpdateOrientationNumberLetter() *AddressPlaceUpsert

UpdateOrientationNumberLetter sets the "orientation_number_letter" field to the value that was provided on create.

func (*AddressPlaceUpsert) UpdateZip

func (u *AddressPlaceUpsert) UpdateZip() *AddressPlaceUpsert

UpdateZip sets the "zip" field to the value that was provided on create.

type AddressPlaceUpsertBulk

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

AddressPlaceUpsertBulk is the builder for "upsert"-ing a bulk of AddressPlace nodes.

func (*AddressPlaceUpsertBulk) ClearOrientationNumber

func (u *AddressPlaceUpsertBulk) ClearOrientationNumber() *AddressPlaceUpsertBulk

ClearOrientationNumber clears the value of the "orientation_number" field.

func (*AddressPlaceUpsertBulk) ClearOrientationNumberLetter

func (u *AddressPlaceUpsertBulk) ClearOrientationNumberLetter() *AddressPlaceUpsertBulk

ClearOrientationNumberLetter clears the value of the "orientation_number_letter" field.

func (*AddressPlaceUpsertBulk) DoNothing

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

func (*AddressPlaceUpsertBulk) Exec

Exec executes the query.

func (*AddressPlaceUpsertBulk) ExecX

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

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

func (*AddressPlaceUpsertBulk) Ignore

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

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

func (*AddressPlaceUpsertBulk) SetNumber

SetNumber sets the "number" field.

func (*AddressPlaceUpsertBulk) SetOrientationNumber

func (u *AddressPlaceUpsertBulk) SetOrientationNumber(v int32) *AddressPlaceUpsertBulk

SetOrientationNumber sets the "orientation_number" field.

func (*AddressPlaceUpsertBulk) SetOrientationNumberLetter

func (u *AddressPlaceUpsertBulk) SetOrientationNumberLetter(v string) *AddressPlaceUpsertBulk

SetOrientationNumberLetter sets the "orientation_number_letter" field.

func (*AddressPlaceUpsertBulk) SetZip

SetZip sets the "zip" field.

func (*AddressPlaceUpsertBulk) Update

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

func (*AddressPlaceUpsertBulk) UpdateNewValues

func (u *AddressPlaceUpsertBulk) UpdateNewValues() *AddressPlaceUpsertBulk

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

client.AddressPlace.Create().
	OnConflict(
		sql.ResolveWithNewValues(),
		sql.ResolveWith(func(u *sql.UpdateSet) {
			u.SetIgnore(addressplace.FieldID)
		}),
	).
	Exec(ctx)

func (*AddressPlaceUpsertBulk) UpdateNumber

UpdateNumber sets the "number" field to the value that was provided on create.

func (*AddressPlaceUpsertBulk) UpdateOrientationNumber

func (u *AddressPlaceUpsertBulk) UpdateOrientationNumber() *AddressPlaceUpsertBulk

UpdateOrientationNumber sets the "orientation_number" field to the value that was provided on create.

func (*AddressPlaceUpsertBulk) UpdateOrientationNumberLetter

func (u *AddressPlaceUpsertBulk) UpdateOrientationNumberLetter() *AddressPlaceUpsertBulk

UpdateOrientationNumberLetter sets the "orientation_number_letter" field to the value that was provided on create.

func (*AddressPlaceUpsertBulk) UpdateZip

UpdateZip sets the "zip" field to the value that was provided on create.

type AddressPlaceUpsertOne

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

AddressPlaceUpsertOne is the builder for "upsert"-ing

one AddressPlace node.

func (*AddressPlaceUpsertOne) ClearOrientationNumber

func (u *AddressPlaceUpsertOne) ClearOrientationNumber() *AddressPlaceUpsertOne

ClearOrientationNumber clears the value of the "orientation_number" field.

func (*AddressPlaceUpsertOne) ClearOrientationNumberLetter

func (u *AddressPlaceUpsertOne) ClearOrientationNumberLetter() *AddressPlaceUpsertOne

ClearOrientationNumberLetter clears the value of the "orientation_number_letter" field.

func (*AddressPlaceUpsertOne) DoNothing

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

func (*AddressPlaceUpsertOne) Exec

Exec executes the query.

func (*AddressPlaceUpsertOne) ExecX

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

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

func (*AddressPlaceUpsertOne) ID

func (u *AddressPlaceUpsertOne) ID(ctx context.Context) (id int32, err error)

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

func (*AddressPlaceUpsertOne) IDX

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

func (*AddressPlaceUpsertOne) Ignore

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

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

func (*AddressPlaceUpsertOne) SetNumber

SetNumber sets the "number" field.

func (*AddressPlaceUpsertOne) SetOrientationNumber

func (u *AddressPlaceUpsertOne) SetOrientationNumber(v int32) *AddressPlaceUpsertOne

SetOrientationNumber sets the "orientation_number" field.

func (*AddressPlaceUpsertOne) SetOrientationNumberLetter

func (u *AddressPlaceUpsertOne) SetOrientationNumberLetter(v string) *AddressPlaceUpsertOne

SetOrientationNumberLetter sets the "orientation_number_letter" field.

func (*AddressPlaceUpsertOne) SetZip

SetZip sets the "zip" field.

func (*AddressPlaceUpsertOne) Update

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

func (*AddressPlaceUpsertOne) UpdateNewValues

func (u *AddressPlaceUpsertOne) UpdateNewValues() *AddressPlaceUpsertOne

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

client.AddressPlace.Create().
	OnConflict(
		sql.ResolveWithNewValues(),
		sql.ResolveWith(func(u *sql.UpdateSet) {
			u.SetIgnore(addressplace.FieldID)
		}),
	).
	Exec(ctx)

func (*AddressPlaceUpsertOne) UpdateNumber

func (u *AddressPlaceUpsertOne) UpdateNumber() *AddressPlaceUpsertOne

UpdateNumber sets the "number" field to the value that was provided on create.

func (*AddressPlaceUpsertOne) UpdateOrientationNumber

func (u *AddressPlaceUpsertOne) UpdateOrientationNumber() *AddressPlaceUpsertOne

UpdateOrientationNumber sets the "orientation_number" field to the value that was provided on create.

func (*AddressPlaceUpsertOne) UpdateOrientationNumberLetter

func (u *AddressPlaceUpsertOne) UpdateOrientationNumberLetter() *AddressPlaceUpsertOne

UpdateOrientationNumberLetter sets the "orientation_number_letter" field to the value that was provided on create.

func (*AddressPlaceUpsertOne) UpdateZip

UpdateZip sets the "zip" field to the value that was provided on create.

type AddressPlaces

type AddressPlaces []*AddressPlace

AddressPlaces is a parsable slice of AddressPlace.

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 Cities

type Cities []*City

Cities is a parsable slice of City.

type City

type City struct {

	// ID of the ent.
	ID int32 `json:"id,omitempty"`
	// Name holds the value of the "name" field.
	Name string `json:"name,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the CityQuery when eager-loading is set.
	Edges CityEdges `json:"edges"`
	// contains filtered or unexported fields
}

City is the model entity for the City schema.

func (*City) QueryStreet

func (c *City) QueryStreet() *StreetQuery

QueryStreet queries the "street" edge of the City entity.

func (*City) String

func (c *City) String() string

String implements the fmt.Stringer.

func (*City) Unwrap

func (c *City) Unwrap() *City

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

func (c *City) Update() *CityUpdateOne

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

type CityClient

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

CityClient is a client for the City schema.

func NewCityClient

func NewCityClient(c config) *CityClient

NewCityClient returns a client for the City from the given config.

func (*CityClient) Create

func (c *CityClient) Create() *CityCreate

Create returns a create builder for City.

func (*CityClient) CreateBulk

func (c *CityClient) CreateBulk(builders ...*CityCreate) *CityCreateBulk

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

func (*CityClient) Delete

func (c *CityClient) Delete() *CityDelete

Delete returns a delete builder for City.

func (*CityClient) DeleteOne

func (c *CityClient) DeleteOne(ci *City) *CityDeleteOne

DeleteOne returns a delete builder for the given entity.

func (*CityClient) DeleteOneID

func (c *CityClient) DeleteOneID(id int32) *CityDeleteOne

DeleteOneID returns a delete builder for the given id.

func (*CityClient) Get

func (c *CityClient) Get(ctx context.Context, id int32) (*City, error)

Get returns a City entity by its id.

func (*CityClient) GetX

func (c *CityClient) GetX(ctx context.Context, id int32) *City

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

func (*CityClient) Hooks

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

Hooks returns the client hooks.

func (*CityClient) Query

func (c *CityClient) Query() *CityQuery

Query returns a query builder for City.

func (*CityClient) QueryStreet

func (c *CityClient) QueryStreet(ci *City) *StreetQuery

QueryStreet queries the street edge of a City.

func (*CityClient) Update

func (c *CityClient) Update() *CityUpdate

Update returns an update builder for City.

func (*CityClient) UpdateOne

func (c *CityClient) UpdateOne(ci *City) *CityUpdateOne

UpdateOne returns an update builder for the given entity.

func (*CityClient) UpdateOneID

func (c *CityClient) UpdateOneID(id int32) *CityUpdateOne

UpdateOneID returns an update builder for the given id.

func (*CityClient) Use

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

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

type CityCreate

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

CityCreate is the builder for creating a City entity.

func (*CityCreate) AddStreet

func (cc *CityCreate) AddStreet(s ...*Street) *CityCreate

AddStreet adds the "street" edges to the Street entity.

func (*CityCreate) AddStreetIDs

func (cc *CityCreate) AddStreetIDs(ids ...int32) *CityCreate

AddStreetIDs adds the "street" edge to the Street entity by IDs.

func (*CityCreate) Exec

func (cc *CityCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*CityCreate) ExecX

func (cc *CityCreate) ExecX(ctx context.Context)

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

func (*CityCreate) Mutation

func (cc *CityCreate) Mutation() *CityMutation

Mutation returns the CityMutation object of the builder.

func (*CityCreate) OnConflict

func (cc *CityCreate) OnConflict(opts ...sql.ConflictOption) *CityUpsertOne

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

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

func (*CityCreate) OnConflictColumns

func (cc *CityCreate) OnConflictColumns(columns ...string) *CityUpsertOne

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

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

func (*CityCreate) Save

func (cc *CityCreate) Save(ctx context.Context) (*City, error)

Save creates the City in the database.

func (*CityCreate) SaveX

func (cc *CityCreate) SaveX(ctx context.Context) *City

SaveX calls Save and panics if Save returns an error.

func (*CityCreate) SetID

func (cc *CityCreate) SetID(i int32) *CityCreate

SetID sets the "id" field.

func (*CityCreate) SetName

func (cc *CityCreate) SetName(s string) *CityCreate

SetName sets the "name" field.

type CityCreateBulk

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

CityCreateBulk is the builder for creating many City entities in bulk.

func (*CityCreateBulk) Exec

func (ccb *CityCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*CityCreateBulk) ExecX

func (ccb *CityCreateBulk) ExecX(ctx context.Context)

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

func (*CityCreateBulk) OnConflict

func (ccb *CityCreateBulk) OnConflict(opts ...sql.ConflictOption) *CityUpsertBulk

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

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

func (*CityCreateBulk) OnConflictColumns

func (ccb *CityCreateBulk) OnConflictColumns(columns ...string) *CityUpsertBulk

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

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

func (*CityCreateBulk) Save

func (ccb *CityCreateBulk) Save(ctx context.Context) ([]*City, error)

Save creates the City entities in the database.

func (*CityCreateBulk) SaveX

func (ccb *CityCreateBulk) SaveX(ctx context.Context) []*City

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

type CityDelete

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

CityDelete is the builder for deleting a City entity.

func (*CityDelete) Exec

func (cd *CityDelete) Exec(ctx context.Context) (int, error)

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

func (*CityDelete) ExecX

func (cd *CityDelete) ExecX(ctx context.Context) int

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

func (*CityDelete) Where

func (cd *CityDelete) Where(ps ...predicate.City) *CityDelete

Where appends a list predicates to the CityDelete builder.

type CityDeleteOne

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

CityDeleteOne is the builder for deleting a single City entity.

func (*CityDeleteOne) Exec

func (cdo *CityDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*CityDeleteOne) ExecX

func (cdo *CityDeleteOne) ExecX(ctx context.Context)

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

type CityEdges

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

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

func (CityEdges) StreetOrErr

func (e CityEdges) StreetOrErr() ([]*Street, error)

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

type CityGroupBy

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

CityGroupBy is the group-by builder for City entities.

func (*CityGroupBy) Aggregate

func (cgb *CityGroupBy) Aggregate(fns ...AggregateFunc) *CityGroupBy

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

func (*CityGroupBy) Bool

func (cgb *CityGroupBy) Bool(ctx context.Context) (_ bool, err error)

Bool returns a single bool from a group-by query. It is only allowed when executing a group-by query with one field.

func (*CityGroupBy) BoolX

func (cgb *CityGroupBy) BoolX(ctx context.Context) bool

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

func (*CityGroupBy) Bools

func (cgb *CityGroupBy) Bools(ctx context.Context) ([]bool, error)

Bools returns list of bools from group-by. It is only allowed when executing a group-by query with one field.

func (*CityGroupBy) BoolsX

func (cgb *CityGroupBy) BoolsX(ctx context.Context) []bool

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

func (*CityGroupBy) Float64

func (cgb *CityGroupBy) Float64(ctx context.Context) (_ float64, err error)

Float64 returns a single float64 from a group-by query. It is only allowed when executing a group-by query with one field.

func (*CityGroupBy) Float64X

func (cgb *CityGroupBy) Float64X(ctx context.Context) float64

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

func (*CityGroupBy) Float64s

func (cgb *CityGroupBy) Float64s(ctx context.Context) ([]float64, error)

Float64s returns list of float64s from group-by. It is only allowed when executing a group-by query with one field.

func (*CityGroupBy) Float64sX

func (cgb *CityGroupBy) Float64sX(ctx context.Context) []float64

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

func (*CityGroupBy) Int

func (cgb *CityGroupBy) Int(ctx context.Context) (_ int, err error)

Int returns a single int from a group-by query. It is only allowed when executing a group-by query with one field.

func (*CityGroupBy) IntX

func (cgb *CityGroupBy) IntX(ctx context.Context) int

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

func (*CityGroupBy) Ints

func (cgb *CityGroupBy) Ints(ctx context.Context) ([]int, error)

Ints returns list of ints from group-by. It is only allowed when executing a group-by query with one field.

func (*CityGroupBy) IntsX

func (cgb *CityGroupBy) IntsX(ctx context.Context) []int

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

func (*CityGroupBy) Scan

func (cgb *CityGroupBy) Scan(ctx context.Context, v interface{}) error

Scan applies the group-by query and scans the result into the given value.

func (*CityGroupBy) ScanX

func (cgb *CityGroupBy) ScanX(ctx context.Context, v interface{})

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

func (*CityGroupBy) String

func (cgb *CityGroupBy) String(ctx context.Context) (_ string, err error)

String returns a single string from a group-by query. It is only allowed when executing a group-by query with one field.

func (*CityGroupBy) StringX

func (cgb *CityGroupBy) StringX(ctx context.Context) string

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

func (*CityGroupBy) Strings

func (cgb *CityGroupBy) Strings(ctx context.Context) ([]string, error)

Strings returns list of strings from group-by. It is only allowed when executing a group-by query with one field.

func (*CityGroupBy) StringsX

func (cgb *CityGroupBy) StringsX(ctx context.Context) []string

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

type CityMutation

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

CityMutation represents an operation that mutates the City nodes in the graph.

func (*CityMutation) AddField

func (m *CityMutation) 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 (*CityMutation) AddStreetIDs

func (m *CityMutation) AddStreetIDs(ids ...int32)

AddStreetIDs adds the "street" edge to the Street entity by ids.

func (*CityMutation) AddedEdges

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

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

func (*CityMutation) AddedField

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

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

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

func (*CityMutation) AddedIDs

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

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

func (*CityMutation) ClearEdge

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

func (m *CityMutation) 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 (*CityMutation) ClearStreet

func (m *CityMutation) ClearStreet()

ClearStreet clears the "street" edge to the Street entity.

func (*CityMutation) ClearedEdges

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

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

func (*CityMutation) ClearedFields

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

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

func (CityMutation) Client

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

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

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

func (*CityMutation) Field

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

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

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

func (*CityMutation) Fields

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

func (m *CityMutation) ID() (id int32, 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 (*CityMutation) Name

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

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

func (*CityMutation) OldField

func (m *CityMutation) 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 (*CityMutation) OldName

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

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

func (m *CityMutation) Op() Op

Op returns the operation name.

func (*CityMutation) RemoveStreetIDs

func (m *CityMutation) RemoveStreetIDs(ids ...int32)

RemoveStreetIDs removes the "street" edge to the Street entity by IDs.

func (*CityMutation) RemovedEdges

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

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

func (*CityMutation) RemovedIDs

func (m *CityMutation) 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 (*CityMutation) RemovedStreetIDs

func (m *CityMutation) RemovedStreetIDs() (ids []int32)

RemovedStreet returns the removed IDs of the "street" edge to the Street entity.

func (*CityMutation) ResetEdge

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

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

func (m *CityMutation) ResetName()

ResetName resets all changes to the "name" field.

func (*CityMutation) ResetStreet

func (m *CityMutation) ResetStreet()

ResetStreet resets all changes to the "street" edge.

func (*CityMutation) SetField

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

func (m *CityMutation) SetID(id int32)

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

func (*CityMutation) SetName

func (m *CityMutation) SetName(s string)

SetName sets the "name" field.

func (*CityMutation) StreetCleared

func (m *CityMutation) StreetCleared() bool

StreetCleared reports if the "street" edge to the Street entity was cleared.

func (*CityMutation) StreetIDs

func (m *CityMutation) StreetIDs() (ids []int32)

StreetIDs returns the "street" edge IDs in the mutation.

func (CityMutation) Tx

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

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

func (*CityMutation) Type

func (m *CityMutation) Type() string

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

func (*CityMutation) Where

func (m *CityMutation) Where(ps ...predicate.City)

Where appends a list predicates to the CityMutation builder.

type CityQuery

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

CityQuery is the builder for querying City entities.

func (*CityQuery) All

func (cq *CityQuery) All(ctx context.Context) ([]*City, error)

All executes the query and returns a list of Cities.

func (*CityQuery) AllX

func (cq *CityQuery) AllX(ctx context.Context) []*City

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

func (*CityQuery) Clone

func (cq *CityQuery) Clone() *CityQuery

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

func (*CityQuery) Count

func (cq *CityQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*CityQuery) CountX

func (cq *CityQuery) CountX(ctx context.Context) int

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

func (*CityQuery) Exist

func (cq *CityQuery) Exist(ctx context.Context) (bool, error)

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

func (*CityQuery) ExistX

func (cq *CityQuery) ExistX(ctx context.Context) bool

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

func (*CityQuery) First

func (cq *CityQuery) First(ctx context.Context) (*City, error)

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

func (*CityQuery) FirstID

func (cq *CityQuery) FirstID(ctx context.Context) (id int32, err error)

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

func (*CityQuery) FirstIDX

func (cq *CityQuery) FirstIDX(ctx context.Context) int32

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

func (*CityQuery) FirstX

func (cq *CityQuery) FirstX(ctx context.Context) *City

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

func (*CityQuery) GroupBy

func (cq *CityQuery) GroupBy(field string, fields ...string) *CityGroupBy

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.City.Query().
	GroupBy(city.FieldName).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*CityQuery) IDs

func (cq *CityQuery) IDs(ctx context.Context) ([]int32, error)

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

func (*CityQuery) IDsX

func (cq *CityQuery) IDsX(ctx context.Context) []int32

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

func (*CityQuery) Limit

func (cq *CityQuery) Limit(limit int) *CityQuery

Limit adds a limit step to the query.

func (*CityQuery) Offset

func (cq *CityQuery) Offset(offset int) *CityQuery

Offset adds an offset step to the query.

func (*CityQuery) Only

func (cq *CityQuery) Only(ctx context.Context) (*City, error)

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

func (*CityQuery) OnlyID

func (cq *CityQuery) OnlyID(ctx context.Context) (id int32, err error)

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

func (*CityQuery) OnlyIDX

func (cq *CityQuery) OnlyIDX(ctx context.Context) int32

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

func (*CityQuery) OnlyX

func (cq *CityQuery) OnlyX(ctx context.Context) *City

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

func (*CityQuery) Order

func (cq *CityQuery) Order(o ...OrderFunc) *CityQuery

Order adds an order step to the query.

func (*CityQuery) QueryStreet

func (cq *CityQuery) QueryStreet() *StreetQuery

QueryStreet chains the current query on the "street" edge.

func (*CityQuery) Select

func (cq *CityQuery) Select(fields ...string) *CitySelect

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.City.Query().
	Select(city.FieldName).
	Scan(ctx, &v)

func (*CityQuery) Unique

func (cq *CityQuery) Unique(unique bool) *CityQuery

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

func (cq *CityQuery) Where(ps ...predicate.City) *CityQuery

Where adds a new predicate for the CityQuery builder.

func (*CityQuery) WithStreet

func (cq *CityQuery) WithStreet(opts ...func(*StreetQuery)) *CityQuery

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

type CitySelect

type CitySelect struct {
	*CityQuery
	// contains filtered or unexported fields
}

CitySelect is the builder for selecting fields of City entities.

func (*CitySelect) Bool

func (cs *CitySelect) Bool(ctx context.Context) (_ bool, err error)

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

func (*CitySelect) BoolX

func (cs *CitySelect) BoolX(ctx context.Context) bool

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

func (*CitySelect) Bools

func (cs *CitySelect) Bools(ctx context.Context) ([]bool, error)

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

func (*CitySelect) BoolsX

func (cs *CitySelect) BoolsX(ctx context.Context) []bool

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

func (*CitySelect) Float64

func (cs *CitySelect) Float64(ctx context.Context) (_ float64, err error)

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

func (*CitySelect) Float64X

func (cs *CitySelect) Float64X(ctx context.Context) float64

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

func (*CitySelect) Float64s

func (cs *CitySelect) Float64s(ctx context.Context) ([]float64, error)

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

func (*CitySelect) Float64sX

func (cs *CitySelect) Float64sX(ctx context.Context) []float64

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

func (*CitySelect) Int

func (cs *CitySelect) Int(ctx context.Context) (_ int, err error)

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

func (*CitySelect) IntX

func (cs *CitySelect) IntX(ctx context.Context) int

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

func (*CitySelect) Ints

func (cs *CitySelect) Ints(ctx context.Context) ([]int, error)

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

func (*CitySelect) IntsX

func (cs *CitySelect) IntsX(ctx context.Context) []int

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

func (*CitySelect) Scan

func (cs *CitySelect) Scan(ctx context.Context, v interface{}) error

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

func (*CitySelect) ScanX

func (cs *CitySelect) ScanX(ctx context.Context, v interface{})

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

func (*CitySelect) String

func (cs *CitySelect) String(ctx context.Context) (_ string, err error)

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

func (*CitySelect) StringX

func (cs *CitySelect) StringX(ctx context.Context) string

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

func (*CitySelect) Strings

func (cs *CitySelect) Strings(ctx context.Context) ([]string, error)

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

func (*CitySelect) StringsX

func (cs *CitySelect) StringsX(ctx context.Context) []string

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

type CityUpdate

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

CityUpdate is the builder for updating City entities.

func (*CityUpdate) AddStreet

func (cu *CityUpdate) AddStreet(s ...*Street) *CityUpdate

AddStreet adds the "street" edges to the Street entity.

func (*CityUpdate) AddStreetIDs

func (cu *CityUpdate) AddStreetIDs(ids ...int32) *CityUpdate

AddStreetIDs adds the "street" edge to the Street entity by IDs.

func (*CityUpdate) ClearStreet

func (cu *CityUpdate) ClearStreet() *CityUpdate

ClearStreet clears all "street" edges to the Street entity.

func (*CityUpdate) Exec

func (cu *CityUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*CityUpdate) ExecX

func (cu *CityUpdate) ExecX(ctx context.Context)

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

func (*CityUpdate) Mutation

func (cu *CityUpdate) Mutation() *CityMutation

Mutation returns the CityMutation object of the builder.

func (*CityUpdate) RemoveStreet

func (cu *CityUpdate) RemoveStreet(s ...*Street) *CityUpdate

RemoveStreet removes "street" edges to Street entities.

func (*CityUpdate) RemoveStreetIDs

func (cu *CityUpdate) RemoveStreetIDs(ids ...int32) *CityUpdate

RemoveStreetIDs removes the "street" edge to Street entities by IDs.

func (*CityUpdate) Save

func (cu *CityUpdate) Save(ctx context.Context) (int, error)

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

func (*CityUpdate) SaveX

func (cu *CityUpdate) SaveX(ctx context.Context) int

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

func (*CityUpdate) SetName

func (cu *CityUpdate) SetName(s string) *CityUpdate

SetName sets the "name" field.

func (*CityUpdate) Where

func (cu *CityUpdate) Where(ps ...predicate.City) *CityUpdate

Where appends a list predicates to the CityUpdate builder.

type CityUpdateOne

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

CityUpdateOne is the builder for updating a single City entity.

func (*CityUpdateOne) AddStreet

func (cuo *CityUpdateOne) AddStreet(s ...*Street) *CityUpdateOne

AddStreet adds the "street" edges to the Street entity.

func (*CityUpdateOne) AddStreetIDs

func (cuo *CityUpdateOne) AddStreetIDs(ids ...int32) *CityUpdateOne

AddStreetIDs adds the "street" edge to the Street entity by IDs.

func (*CityUpdateOne) ClearStreet

func (cuo *CityUpdateOne) ClearStreet() *CityUpdateOne

ClearStreet clears all "street" edges to the Street entity.

func (*CityUpdateOne) Exec

func (cuo *CityUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*CityUpdateOne) ExecX

func (cuo *CityUpdateOne) ExecX(ctx context.Context)

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

func (*CityUpdateOne) Mutation

func (cuo *CityUpdateOne) Mutation() *CityMutation

Mutation returns the CityMutation object of the builder.

func (*CityUpdateOne) RemoveStreet

func (cuo *CityUpdateOne) RemoveStreet(s ...*Street) *CityUpdateOne

RemoveStreet removes "street" edges to Street entities.

func (*CityUpdateOne) RemoveStreetIDs

func (cuo *CityUpdateOne) RemoveStreetIDs(ids ...int32) *CityUpdateOne

RemoveStreetIDs removes the "street" edge to Street entities by IDs.

func (*CityUpdateOne) Save

func (cuo *CityUpdateOne) Save(ctx context.Context) (*City, error)

Save executes the query and returns the updated City entity.

func (*CityUpdateOne) SaveX

func (cuo *CityUpdateOne) SaveX(ctx context.Context) *City

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

func (*CityUpdateOne) Select

func (cuo *CityUpdateOne) Select(field string, fields ...string) *CityUpdateOne

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

func (*CityUpdateOne) SetName

func (cuo *CityUpdateOne) SetName(s string) *CityUpdateOne

SetName sets the "name" field.

type CityUpsert

type CityUpsert struct {
	*sql.UpdateSet
}

CityUpsert is the "OnConflict" setter.

func (*CityUpsert) SetName

func (u *CityUpsert) SetName(v string) *CityUpsert

SetName sets the "name" field.

func (*CityUpsert) UpdateName

func (u *CityUpsert) UpdateName() *CityUpsert

UpdateName sets the "name" field to the value that was provided on create.

type CityUpsertBulk

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

CityUpsertBulk is the builder for "upsert"-ing a bulk of City nodes.

func (*CityUpsertBulk) DoNothing

func (u *CityUpsertBulk) DoNothing() *CityUpsertBulk

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

func (*CityUpsertBulk) Exec

func (u *CityUpsertBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*CityUpsertBulk) ExecX

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

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

func (*CityUpsertBulk) Ignore

func (u *CityUpsertBulk) Ignore() *CityUpsertBulk

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

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

func (*CityUpsertBulk) SetName

func (u *CityUpsertBulk) SetName(v string) *CityUpsertBulk

SetName sets the "name" field.

func (*CityUpsertBulk) Update

func (u *CityUpsertBulk) Update(set func(*CityUpsert)) *CityUpsertBulk

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

func (*CityUpsertBulk) UpdateName

func (u *CityUpsertBulk) UpdateName() *CityUpsertBulk

UpdateName sets the "name" field to the value that was provided on create.

func (*CityUpsertBulk) UpdateNewValues

func (u *CityUpsertBulk) UpdateNewValues() *CityUpsertBulk

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

client.City.Create().
	OnConflict(
		sql.ResolveWithNewValues(),
		sql.ResolveWith(func(u *sql.UpdateSet) {
			u.SetIgnore(city.FieldID)
		}),
	).
	Exec(ctx)

type CityUpsertOne

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

CityUpsertOne is the builder for "upsert"-ing

one City node.

func (*CityUpsertOne) DoNothing

func (u *CityUpsertOne) DoNothing() *CityUpsertOne

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

func (*CityUpsertOne) Exec

func (u *CityUpsertOne) Exec(ctx context.Context) error

Exec executes the query.

func (*CityUpsertOne) ExecX

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

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

func (*CityUpsertOne) ID

func (u *CityUpsertOne) ID(ctx context.Context) (id int32, err error)

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

func (*CityUpsertOne) IDX

func (u *CityUpsertOne) IDX(ctx context.Context) int32

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

func (*CityUpsertOne) Ignore

func (u *CityUpsertOne) Ignore() *CityUpsertOne

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

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

func (*CityUpsertOne) SetName

func (u *CityUpsertOne) SetName(v string) *CityUpsertOne

SetName sets the "name" field.

func (*CityUpsertOne) Update

func (u *CityUpsertOne) Update(set func(*CityUpsert)) *CityUpsertOne

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

func (*CityUpsertOne) UpdateName

func (u *CityUpsertOne) UpdateName() *CityUpsertOne

UpdateName sets the "name" field to the value that was provided on create.

func (*CityUpsertOne) UpdateNewValues

func (u *CityUpsertOne) UpdateNewValues() *CityUpsertOne

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

client.City.Create().
	OnConflict(
		sql.ResolveWithNewValues(),
		sql.ResolveWith(func(u *sql.UpdateSet) {
			u.SetIgnore(city.FieldID)
		}),
	).
	Exec(ctx)

type Client

type Client struct {

	// Schema is the client for creating, migrating and dropping schema.
	Schema *migrate.Schema
	// AddressPlace is the client for interacting with the AddressPlace builders.
	AddressPlace *AddressPlaceClient
	// City is the client for interacting with the City builders.
	City *CityClient
	// Street is the client for interacting with the Street builders.
	Street *StreetClient
	// 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().
	AddressPlace.
	Query().
	Count(ctx)

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(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 Committer 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 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(...interface{})) 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 Policy

type Policy = ent.Policy

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 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(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 Rollbacker method.

type Street

type Street struct {

	// ID of the ent.
	ID int32 `json:"id,omitempty"`
	// Name holds the value of the "name" field.
	Name string `json:"name,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the StreetQuery when eager-loading is set.
	Edges StreetEdges `json:"edges"`
	// contains filtered or unexported fields
}

Street is the model entity for the Street schema.

func (*Street) QueryAdresses

func (s *Street) QueryAdresses() *AddressPlaceQuery

QueryAdresses queries the "adresses" edge of the Street entity.

func (*Street) QueryCities

func (s *Street) QueryCities() *CityQuery

QueryCities queries the "cities" edge of the Street entity.

func (*Street) String

func (s *Street) String() string

String implements the fmt.Stringer.

func (*Street) Unwrap

func (s *Street) Unwrap() *Street

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

func (s *Street) Update() *StreetUpdateOne

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

type StreetClient

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

StreetClient is a client for the Street schema.

func NewStreetClient

func NewStreetClient(c config) *StreetClient

NewStreetClient returns a client for the Street from the given config.

func (*StreetClient) Create

func (c *StreetClient) Create() *StreetCreate

Create returns a create builder for Street.

func (*StreetClient) CreateBulk

func (c *StreetClient) CreateBulk(builders ...*StreetCreate) *StreetCreateBulk

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

func (*StreetClient) Delete

func (c *StreetClient) Delete() *StreetDelete

Delete returns a delete builder for Street.

func (*StreetClient) DeleteOne

func (c *StreetClient) DeleteOne(s *Street) *StreetDeleteOne

DeleteOne returns a delete builder for the given entity.

func (*StreetClient) DeleteOneID

func (c *StreetClient) DeleteOneID(id int32) *StreetDeleteOne

DeleteOneID returns a delete builder for the given id.

func (*StreetClient) Get

func (c *StreetClient) Get(ctx context.Context, id int32) (*Street, error)

Get returns a Street entity by its id.

func (*StreetClient) GetX

func (c *StreetClient) GetX(ctx context.Context, id int32) *Street

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

func (*StreetClient) Hooks

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

Hooks returns the client hooks.

func (*StreetClient) Query

func (c *StreetClient) Query() *StreetQuery

Query returns a query builder for Street.

func (*StreetClient) QueryAdresses

func (c *StreetClient) QueryAdresses(s *Street) *AddressPlaceQuery

QueryAdresses queries the adresses edge of a Street.

func (*StreetClient) QueryCities

func (c *StreetClient) QueryCities(s *Street) *CityQuery

QueryCities queries the cities edge of a Street.

func (*StreetClient) Update

func (c *StreetClient) Update() *StreetUpdate

Update returns an update builder for Street.

func (*StreetClient) UpdateOne

func (c *StreetClient) UpdateOne(s *Street) *StreetUpdateOne

UpdateOne returns an update builder for the given entity.

func (*StreetClient) UpdateOneID

func (c *StreetClient) UpdateOneID(id int32) *StreetUpdateOne

UpdateOneID returns an update builder for the given id.

func (*StreetClient) Use

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

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

type StreetCreate

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

StreetCreate is the builder for creating a Street entity.

func (*StreetCreate) AddAdressIDs

func (sc *StreetCreate) AddAdressIDs(ids ...int32) *StreetCreate

AddAdressIDs adds the "adresses" edge to the AddressPlace entity by IDs.

func (*StreetCreate) AddAdresses

func (sc *StreetCreate) AddAdresses(a ...*AddressPlace) *StreetCreate

AddAdresses adds the "adresses" edges to the AddressPlace entity.

func (*StreetCreate) AddCities

func (sc *StreetCreate) AddCities(c ...*City) *StreetCreate

AddCities adds the "cities" edges to the City entity.

func (*StreetCreate) AddCityIDs

func (sc *StreetCreate) AddCityIDs(ids ...int32) *StreetCreate

AddCityIDs adds the "cities" edge to the City entity by IDs.

func (*StreetCreate) Exec

func (sc *StreetCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*StreetCreate) ExecX

func (sc *StreetCreate) ExecX(ctx context.Context)

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

func (*StreetCreate) Mutation

func (sc *StreetCreate) Mutation() *StreetMutation

Mutation returns the StreetMutation object of the builder.

func (*StreetCreate) OnConflict

func (sc *StreetCreate) OnConflict(opts ...sql.ConflictOption) *StreetUpsertOne

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

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

func (*StreetCreate) OnConflictColumns

func (sc *StreetCreate) OnConflictColumns(columns ...string) *StreetUpsertOne

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

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

func (*StreetCreate) Save

func (sc *StreetCreate) Save(ctx context.Context) (*Street, error)

Save creates the Street in the database.

func (*StreetCreate) SaveX

func (sc *StreetCreate) SaveX(ctx context.Context) *Street

SaveX calls Save and panics if Save returns an error.

func (*StreetCreate) SetID

func (sc *StreetCreate) SetID(i int32) *StreetCreate

SetID sets the "id" field.

func (*StreetCreate) SetName

func (sc *StreetCreate) SetName(s string) *StreetCreate

SetName sets the "name" field.

type StreetCreateBulk

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

StreetCreateBulk is the builder for creating many Street entities in bulk.

func (*StreetCreateBulk) Exec

func (scb *StreetCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*StreetCreateBulk) ExecX

func (scb *StreetCreateBulk) ExecX(ctx context.Context)

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

func (*StreetCreateBulk) OnConflict

func (scb *StreetCreateBulk) OnConflict(opts ...sql.ConflictOption) *StreetUpsertBulk

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

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

func (*StreetCreateBulk) OnConflictColumns

func (scb *StreetCreateBulk) OnConflictColumns(columns ...string) *StreetUpsertBulk

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

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

func (*StreetCreateBulk) Save

func (scb *StreetCreateBulk) Save(ctx context.Context) ([]*Street, error)

Save creates the Street entities in the database.

func (*StreetCreateBulk) SaveX

func (scb *StreetCreateBulk) SaveX(ctx context.Context) []*Street

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

type StreetDelete

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

StreetDelete is the builder for deleting a Street entity.

func (*StreetDelete) Exec

func (sd *StreetDelete) Exec(ctx context.Context) (int, error)

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

func (*StreetDelete) ExecX

func (sd *StreetDelete) ExecX(ctx context.Context) int

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

func (*StreetDelete) Where

func (sd *StreetDelete) Where(ps ...predicate.Street) *StreetDelete

Where appends a list predicates to the StreetDelete builder.

type StreetDeleteOne

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

StreetDeleteOne is the builder for deleting a single Street entity.

func (*StreetDeleteOne) Exec

func (sdo *StreetDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*StreetDeleteOne) ExecX

func (sdo *StreetDeleteOne) ExecX(ctx context.Context)

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

type StreetEdges

type StreetEdges struct {
	// Cities holds the value of the cities edge.
	Cities []*City `json:"cities,omitempty"`
	// Adresses holds the value of the adresses edge.
	Adresses []*AddressPlace `json:"adresses,omitempty"`
	// contains filtered or unexported fields
}

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

func (StreetEdges) AdressesOrErr

func (e StreetEdges) AdressesOrErr() ([]*AddressPlace, error)

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

func (StreetEdges) CitiesOrErr

func (e StreetEdges) CitiesOrErr() ([]*City, error)

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

type StreetGroupBy

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

StreetGroupBy is the group-by builder for Street entities.

func (*StreetGroupBy) Aggregate

func (sgb *StreetGroupBy) Aggregate(fns ...AggregateFunc) *StreetGroupBy

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

func (*StreetGroupBy) Bool

func (sgb *StreetGroupBy) Bool(ctx context.Context) (_ bool, err error)

Bool returns a single bool from a group-by query. It is only allowed when executing a group-by query with one field.

func (*StreetGroupBy) BoolX

func (sgb *StreetGroupBy) BoolX(ctx context.Context) bool

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

func (*StreetGroupBy) Bools

func (sgb *StreetGroupBy) Bools(ctx context.Context) ([]bool, error)

Bools returns list of bools from group-by. It is only allowed when executing a group-by query with one field.

func (*StreetGroupBy) BoolsX

func (sgb *StreetGroupBy) BoolsX(ctx context.Context) []bool

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

func (*StreetGroupBy) Float64

func (sgb *StreetGroupBy) Float64(ctx context.Context) (_ float64, err error)

Float64 returns a single float64 from a group-by query. It is only allowed when executing a group-by query with one field.

func (*StreetGroupBy) Float64X

func (sgb *StreetGroupBy) Float64X(ctx context.Context) float64

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

func (*StreetGroupBy) Float64s

func (sgb *StreetGroupBy) Float64s(ctx context.Context) ([]float64, error)

Float64s returns list of float64s from group-by. It is only allowed when executing a group-by query with one field.

func (*StreetGroupBy) Float64sX

func (sgb *StreetGroupBy) Float64sX(ctx context.Context) []float64

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

func (*StreetGroupBy) Int

func (sgb *StreetGroupBy) Int(ctx context.Context) (_ int, err error)

Int returns a single int from a group-by query. It is only allowed when executing a group-by query with one field.

func (*StreetGroupBy) IntX

func (sgb *StreetGroupBy) IntX(ctx context.Context) int

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

func (*StreetGroupBy) Ints

func (sgb *StreetGroupBy) Ints(ctx context.Context) ([]int, error)

Ints returns list of ints from group-by. It is only allowed when executing a group-by query with one field.

func (*StreetGroupBy) IntsX

func (sgb *StreetGroupBy) IntsX(ctx context.Context) []int

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

func (*StreetGroupBy) Scan

func (sgb *StreetGroupBy) Scan(ctx context.Context, v interface{}) error

Scan applies the group-by query and scans the result into the given value.

func (*StreetGroupBy) ScanX

func (sgb *StreetGroupBy) ScanX(ctx context.Context, v interface{})

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

func (*StreetGroupBy) String

func (sgb *StreetGroupBy) String(ctx context.Context) (_ string, err error)

String returns a single string from a group-by query. It is only allowed when executing a group-by query with one field.

func (*StreetGroupBy) StringX

func (sgb *StreetGroupBy) StringX(ctx context.Context) string

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

func (*StreetGroupBy) Strings

func (sgb *StreetGroupBy) Strings(ctx context.Context) ([]string, error)

Strings returns list of strings from group-by. It is only allowed when executing a group-by query with one field.

func (*StreetGroupBy) StringsX

func (sgb *StreetGroupBy) StringsX(ctx context.Context) []string

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

type StreetMutation

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

StreetMutation represents an operation that mutates the Street nodes in the graph.

func (*StreetMutation) AddAdressIDs

func (m *StreetMutation) AddAdressIDs(ids ...int32)

AddAdressIDs adds the "adresses" edge to the AddressPlace entity by ids.

func (*StreetMutation) AddCityIDs

func (m *StreetMutation) AddCityIDs(ids ...int32)

AddCityIDs adds the "cities" edge to the City entity by ids.

func (*StreetMutation) AddField

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

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

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

func (*StreetMutation) AddedField

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

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

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

func (*StreetMutation) AddedIDs

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

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

func (*StreetMutation) AdressesCleared

func (m *StreetMutation) AdressesCleared() bool

AdressesCleared reports if the "adresses" edge to the AddressPlace entity was cleared.

func (*StreetMutation) AdressesIDs

func (m *StreetMutation) AdressesIDs() (ids []int32)

AdressesIDs returns the "adresses" edge IDs in the mutation.

func (*StreetMutation) CitiesCleared

func (m *StreetMutation) CitiesCleared() bool

CitiesCleared reports if the "cities" edge to the City entity was cleared.

func (*StreetMutation) CitiesIDs

func (m *StreetMutation) CitiesIDs() (ids []int32)

CitiesIDs returns the "cities" edge IDs in the mutation.

func (*StreetMutation) ClearAdresses

func (m *StreetMutation) ClearAdresses()

ClearAdresses clears the "adresses" edge to the AddressPlace entity.

func (*StreetMutation) ClearCities

func (m *StreetMutation) ClearCities()

ClearCities clears the "cities" edge to the City entity.

func (*StreetMutation) ClearEdge

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

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

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

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

func (*StreetMutation) ClearedFields

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

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

func (StreetMutation) Client

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

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

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

func (*StreetMutation) Field

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

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

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

func (*StreetMutation) Fields

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

func (m *StreetMutation) ID() (id int32, 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 (*StreetMutation) Name

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

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

func (*StreetMutation) OldField

func (m *StreetMutation) 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 (*StreetMutation) OldName

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

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

func (m *StreetMutation) Op() Op

Op returns the operation name.

func (*StreetMutation) RemoveAdressIDs

func (m *StreetMutation) RemoveAdressIDs(ids ...int32)

RemoveAdressIDs removes the "adresses" edge to the AddressPlace entity by IDs.

func (*StreetMutation) RemoveCityIDs

func (m *StreetMutation) RemoveCityIDs(ids ...int32)

RemoveCityIDs removes the "cities" edge to the City entity by IDs.

func (*StreetMutation) RemovedAdressesIDs

func (m *StreetMutation) RemovedAdressesIDs() (ids []int32)

RemovedAdresses returns the removed IDs of the "adresses" edge to the AddressPlace entity.

func (*StreetMutation) RemovedCitiesIDs

func (m *StreetMutation) RemovedCitiesIDs() (ids []int32)

RemovedCities returns the removed IDs of the "cities" edge to the City entity.

func (*StreetMutation) RemovedEdges

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

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

func (*StreetMutation) RemovedIDs

func (m *StreetMutation) 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 (*StreetMutation) ResetAdresses

func (m *StreetMutation) ResetAdresses()

ResetAdresses resets all changes to the "adresses" edge.

func (*StreetMutation) ResetCities

func (m *StreetMutation) ResetCities()

ResetCities resets all changes to the "cities" edge.

func (*StreetMutation) ResetEdge

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

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

func (m *StreetMutation) ResetName()

ResetName resets all changes to the "name" field.

func (*StreetMutation) SetField

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

func (m *StreetMutation) SetID(id int32)

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

func (*StreetMutation) SetName

func (m *StreetMutation) SetName(s string)

SetName sets the "name" field.

func (StreetMutation) Tx

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

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

func (*StreetMutation) Type

func (m *StreetMutation) Type() string

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

func (*StreetMutation) Where

func (m *StreetMutation) Where(ps ...predicate.Street)

Where appends a list predicates to the StreetMutation builder.

type StreetQuery

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

StreetQuery is the builder for querying Street entities.

func (*StreetQuery) All

func (sq *StreetQuery) All(ctx context.Context) ([]*Street, error)

All executes the query and returns a list of Streets.

func (*StreetQuery) AllX

func (sq *StreetQuery) AllX(ctx context.Context) []*Street

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

func (*StreetQuery) Clone

func (sq *StreetQuery) Clone() *StreetQuery

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

func (*StreetQuery) Count

func (sq *StreetQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*StreetQuery) CountX

func (sq *StreetQuery) CountX(ctx context.Context) int

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

func (*StreetQuery) Exist

func (sq *StreetQuery) Exist(ctx context.Context) (bool, error)

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

func (*StreetQuery) ExistX

func (sq *StreetQuery) ExistX(ctx context.Context) bool

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

func (*StreetQuery) First

func (sq *StreetQuery) First(ctx context.Context) (*Street, error)

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

func (*StreetQuery) FirstID

func (sq *StreetQuery) FirstID(ctx context.Context) (id int32, err error)

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

func (*StreetQuery) FirstIDX

func (sq *StreetQuery) FirstIDX(ctx context.Context) int32

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

func (*StreetQuery) FirstX

func (sq *StreetQuery) FirstX(ctx context.Context) *Street

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

func (*StreetQuery) GroupBy

func (sq *StreetQuery) GroupBy(field string, fields ...string) *StreetGroupBy

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.Street.Query().
	GroupBy(street.FieldName).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*StreetQuery) IDs

func (sq *StreetQuery) IDs(ctx context.Context) ([]int32, error)

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

func (*StreetQuery) IDsX

func (sq *StreetQuery) IDsX(ctx context.Context) []int32

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

func (*StreetQuery) Limit

func (sq *StreetQuery) Limit(limit int) *StreetQuery

Limit adds a limit step to the query.

func (*StreetQuery) Offset

func (sq *StreetQuery) Offset(offset int) *StreetQuery

Offset adds an offset step to the query.

func (*StreetQuery) Only

func (sq *StreetQuery) Only(ctx context.Context) (*Street, error)

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

func (*StreetQuery) OnlyID

func (sq *StreetQuery) OnlyID(ctx context.Context) (id int32, err error)

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

func (*StreetQuery) OnlyIDX

func (sq *StreetQuery) OnlyIDX(ctx context.Context) int32

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

func (*StreetQuery) OnlyX

func (sq *StreetQuery) OnlyX(ctx context.Context) *Street

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

func (*StreetQuery) Order

func (sq *StreetQuery) Order(o ...OrderFunc) *StreetQuery

Order adds an order step to the query.

func (*StreetQuery) QueryAdresses

func (sq *StreetQuery) QueryAdresses() *AddressPlaceQuery

QueryAdresses chains the current query on the "adresses" edge.

func (*StreetQuery) QueryCities

func (sq *StreetQuery) QueryCities() *CityQuery

QueryCities chains the current query on the "cities" edge.

func (*StreetQuery) Select

func (sq *StreetQuery) Select(fields ...string) *StreetSelect

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.Street.Query().
	Select(street.FieldName).
	Scan(ctx, &v)

func (*StreetQuery) Unique

func (sq *StreetQuery) Unique(unique bool) *StreetQuery

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

func (sq *StreetQuery) Where(ps ...predicate.Street) *StreetQuery

Where adds a new predicate for the StreetQuery builder.

func (*StreetQuery) WithAdresses

func (sq *StreetQuery) WithAdresses(opts ...func(*AddressPlaceQuery)) *StreetQuery

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

func (*StreetQuery) WithCities

func (sq *StreetQuery) WithCities(opts ...func(*CityQuery)) *StreetQuery

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

type StreetSelect

type StreetSelect struct {
	*StreetQuery
	// contains filtered or unexported fields
}

StreetSelect is the builder for selecting fields of Street entities.

func (*StreetSelect) Bool

func (ss *StreetSelect) Bool(ctx context.Context) (_ bool, err error)

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

func (*StreetSelect) BoolX

func (ss *StreetSelect) BoolX(ctx context.Context) bool

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

func (*StreetSelect) Bools

func (ss *StreetSelect) Bools(ctx context.Context) ([]bool, error)

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

func (*StreetSelect) BoolsX

func (ss *StreetSelect) BoolsX(ctx context.Context) []bool

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

func (*StreetSelect) Float64

func (ss *StreetSelect) Float64(ctx context.Context) (_ float64, err error)

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

func (*StreetSelect) Float64X

func (ss *StreetSelect) Float64X(ctx context.Context) float64

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

func (*StreetSelect) Float64s

func (ss *StreetSelect) Float64s(ctx context.Context) ([]float64, error)

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

func (*StreetSelect) Float64sX

func (ss *StreetSelect) Float64sX(ctx context.Context) []float64

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

func (*StreetSelect) Int

func (ss *StreetSelect) Int(ctx context.Context) (_ int, err error)

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

func (*StreetSelect) IntX

func (ss *StreetSelect) IntX(ctx context.Context) int

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

func (*StreetSelect) Ints

func (ss *StreetSelect) Ints(ctx context.Context) ([]int, error)

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

func (*StreetSelect) IntsX

func (ss *StreetSelect) IntsX(ctx context.Context) []int

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

func (*StreetSelect) Scan

func (ss *StreetSelect) Scan(ctx context.Context, v interface{}) error

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

func (*StreetSelect) ScanX

func (ss *StreetSelect) ScanX(ctx context.Context, v interface{})

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

func (*StreetSelect) String

func (ss *StreetSelect) String(ctx context.Context) (_ string, err error)

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

func (*StreetSelect) StringX

func (ss *StreetSelect) StringX(ctx context.Context) string

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

func (*StreetSelect) Strings

func (ss *StreetSelect) Strings(ctx context.Context) ([]string, error)

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

func (*StreetSelect) StringsX

func (ss *StreetSelect) StringsX(ctx context.Context) []string

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

type StreetUpdate

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

StreetUpdate is the builder for updating Street entities.

func (*StreetUpdate) AddAdressIDs

func (su *StreetUpdate) AddAdressIDs(ids ...int32) *StreetUpdate

AddAdressIDs adds the "adresses" edge to the AddressPlace entity by IDs.

func (*StreetUpdate) AddAdresses

func (su *StreetUpdate) AddAdresses(a ...*AddressPlace) *StreetUpdate

AddAdresses adds the "adresses" edges to the AddressPlace entity.

func (*StreetUpdate) AddCities

func (su *StreetUpdate) AddCities(c ...*City) *StreetUpdate

AddCities adds the "cities" edges to the City entity.

func (*StreetUpdate) AddCityIDs

func (su *StreetUpdate) AddCityIDs(ids ...int32) *StreetUpdate

AddCityIDs adds the "cities" edge to the City entity by IDs.

func (*StreetUpdate) ClearAdresses

func (su *StreetUpdate) ClearAdresses() *StreetUpdate

ClearAdresses clears all "adresses" edges to the AddressPlace entity.

func (*StreetUpdate) ClearCities

func (su *StreetUpdate) ClearCities() *StreetUpdate

ClearCities clears all "cities" edges to the City entity.

func (*StreetUpdate) Exec

func (su *StreetUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*StreetUpdate) ExecX

func (su *StreetUpdate) ExecX(ctx context.Context)

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

func (*StreetUpdate) Mutation

func (su *StreetUpdate) Mutation() *StreetMutation

Mutation returns the StreetMutation object of the builder.

func (*StreetUpdate) RemoveAdressIDs

func (su *StreetUpdate) RemoveAdressIDs(ids ...int32) *StreetUpdate

RemoveAdressIDs removes the "adresses" edge to AddressPlace entities by IDs.

func (*StreetUpdate) RemoveAdresses

func (su *StreetUpdate) RemoveAdresses(a ...*AddressPlace) *StreetUpdate

RemoveAdresses removes "adresses" edges to AddressPlace entities.

func (*StreetUpdate) RemoveCities

func (su *StreetUpdate) RemoveCities(c ...*City) *StreetUpdate

RemoveCities removes "cities" edges to City entities.

func (*StreetUpdate) RemoveCityIDs

func (su *StreetUpdate) RemoveCityIDs(ids ...int32) *StreetUpdate

RemoveCityIDs removes the "cities" edge to City entities by IDs.

func (*StreetUpdate) Save

func (su *StreetUpdate) Save(ctx context.Context) (int, error)

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

func (*StreetUpdate) SaveX

func (su *StreetUpdate) SaveX(ctx context.Context) int

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

func (*StreetUpdate) SetName

func (su *StreetUpdate) SetName(s string) *StreetUpdate

SetName sets the "name" field.

func (*StreetUpdate) Where

func (su *StreetUpdate) Where(ps ...predicate.Street) *StreetUpdate

Where appends a list predicates to the StreetUpdate builder.

type StreetUpdateOne

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

StreetUpdateOne is the builder for updating a single Street entity.

func (*StreetUpdateOne) AddAdressIDs

func (suo *StreetUpdateOne) AddAdressIDs(ids ...int32) *StreetUpdateOne

AddAdressIDs adds the "adresses" edge to the AddressPlace entity by IDs.

func (*StreetUpdateOne) AddAdresses

func (suo *StreetUpdateOne) AddAdresses(a ...*AddressPlace) *StreetUpdateOne

AddAdresses adds the "adresses" edges to the AddressPlace entity.

func (*StreetUpdateOne) AddCities

func (suo *StreetUpdateOne) AddCities(c ...*City) *StreetUpdateOne

AddCities adds the "cities" edges to the City entity.

func (*StreetUpdateOne) AddCityIDs

func (suo *StreetUpdateOne) AddCityIDs(ids ...int32) *StreetUpdateOne

AddCityIDs adds the "cities" edge to the City entity by IDs.

func (*StreetUpdateOne) ClearAdresses

func (suo *StreetUpdateOne) ClearAdresses() *StreetUpdateOne

ClearAdresses clears all "adresses" edges to the AddressPlace entity.

func (*StreetUpdateOne) ClearCities

func (suo *StreetUpdateOne) ClearCities() *StreetUpdateOne

ClearCities clears all "cities" edges to the City entity.

func (*StreetUpdateOne) Exec

func (suo *StreetUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*StreetUpdateOne) ExecX

func (suo *StreetUpdateOne) ExecX(ctx context.Context)

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

func (*StreetUpdateOne) Mutation

func (suo *StreetUpdateOne) Mutation() *StreetMutation

Mutation returns the StreetMutation object of the builder.

func (*StreetUpdateOne) RemoveAdressIDs

func (suo *StreetUpdateOne) RemoveAdressIDs(ids ...int32) *StreetUpdateOne

RemoveAdressIDs removes the "adresses" edge to AddressPlace entities by IDs.

func (*StreetUpdateOne) RemoveAdresses

func (suo *StreetUpdateOne) RemoveAdresses(a ...*AddressPlace) *StreetUpdateOne

RemoveAdresses removes "adresses" edges to AddressPlace entities.

func (*StreetUpdateOne) RemoveCities

func (suo *StreetUpdateOne) RemoveCities(c ...*City) *StreetUpdateOne

RemoveCities removes "cities" edges to City entities.

func (*StreetUpdateOne) RemoveCityIDs

func (suo *StreetUpdateOne) RemoveCityIDs(ids ...int32) *StreetUpdateOne

RemoveCityIDs removes the "cities" edge to City entities by IDs.

func (*StreetUpdateOne) Save

func (suo *StreetUpdateOne) Save(ctx context.Context) (*Street, error)

Save executes the query and returns the updated Street entity.

func (*StreetUpdateOne) SaveX

func (suo *StreetUpdateOne) SaveX(ctx context.Context) *Street

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

func (*StreetUpdateOne) Select

func (suo *StreetUpdateOne) Select(field string, fields ...string) *StreetUpdateOne

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

func (*StreetUpdateOne) SetName

func (suo *StreetUpdateOne) SetName(s string) *StreetUpdateOne

SetName sets the "name" field.

type StreetUpsert

type StreetUpsert struct {
	*sql.UpdateSet
}

StreetUpsert is the "OnConflict" setter.

func (*StreetUpsert) SetName

func (u *StreetUpsert) SetName(v string) *StreetUpsert

SetName sets the "name" field.

func (*StreetUpsert) UpdateName

func (u *StreetUpsert) UpdateName() *StreetUpsert

UpdateName sets the "name" field to the value that was provided on create.

type StreetUpsertBulk

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

StreetUpsertBulk is the builder for "upsert"-ing a bulk of Street nodes.

func (*StreetUpsertBulk) DoNothing

func (u *StreetUpsertBulk) DoNothing() *StreetUpsertBulk

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

func (*StreetUpsertBulk) Exec

func (u *StreetUpsertBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*StreetUpsertBulk) ExecX

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

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

func (*StreetUpsertBulk) Ignore

func (u *StreetUpsertBulk) Ignore() *StreetUpsertBulk

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

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

func (*StreetUpsertBulk) SetName

func (u *StreetUpsertBulk) SetName(v string) *StreetUpsertBulk

SetName sets the "name" field.

func (*StreetUpsertBulk) Update

func (u *StreetUpsertBulk) Update(set func(*StreetUpsert)) *StreetUpsertBulk

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

func (*StreetUpsertBulk) UpdateName

func (u *StreetUpsertBulk) UpdateName() *StreetUpsertBulk

UpdateName sets the "name" field to the value that was provided on create.

func (*StreetUpsertBulk) UpdateNewValues

func (u *StreetUpsertBulk) UpdateNewValues() *StreetUpsertBulk

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

client.Street.Create().
	OnConflict(
		sql.ResolveWithNewValues(),
		sql.ResolveWith(func(u *sql.UpdateSet) {
			u.SetIgnore(street.FieldID)
		}),
	).
	Exec(ctx)

type StreetUpsertOne

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

StreetUpsertOne is the builder for "upsert"-ing

one Street node.

func (*StreetUpsertOne) DoNothing

func (u *StreetUpsertOne) DoNothing() *StreetUpsertOne

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

func (*StreetUpsertOne) Exec

func (u *StreetUpsertOne) Exec(ctx context.Context) error

Exec executes the query.

func (*StreetUpsertOne) ExecX

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

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

func (*StreetUpsertOne) ID

func (u *StreetUpsertOne) ID(ctx context.Context) (id int32, err error)

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

func (*StreetUpsertOne) IDX

func (u *StreetUpsertOne) IDX(ctx context.Context) int32

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

func (*StreetUpsertOne) Ignore

func (u *StreetUpsertOne) Ignore() *StreetUpsertOne

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

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

func (*StreetUpsertOne) SetName

func (u *StreetUpsertOne) SetName(v string) *StreetUpsertOne

SetName sets the "name" field.

func (*StreetUpsertOne) Update

func (u *StreetUpsertOne) Update(set func(*StreetUpsert)) *StreetUpsertOne

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

func (*StreetUpsertOne) UpdateName

func (u *StreetUpsertOne) UpdateName() *StreetUpsertOne

UpdateName sets the "name" field to the value that was provided on create.

func (*StreetUpsertOne) UpdateNewValues

func (u *StreetUpsertOne) UpdateNewValues() *StreetUpsertOne

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

client.Street.Create().
	OnConflict(
		sql.ResolveWithNewValues(),
		sql.ResolveWith(func(u *sql.UpdateSet) {
			u.SetIgnore(street.FieldID)
		}),
	).
	Exec(ctx)

type Streets

type Streets []*Street

Streets is a parsable slice of Street.

type Tx

type Tx struct {

	// AddressPlace is the client for interacting with the AddressPlace builders.
	AddressPlace *AddressPlaceClient
	// City is the client for interacting with the City builders.
	City *CityClient
	// Street is the client for interacting with the Street builders.
	Street *StreetClient
	// 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 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