ent

package
v0.0.0-...-e91a8f2 Latest Latest
Warning

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

Go to latest
Published: Feb 6, 2023 License: MIT Imports: 25 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.
	TypeRide                   = "Ride"
	TypeUser                   = "User"
	TypeUserPromoCode          = "UserPromoCode"
	TypeVehicle                = "Vehicle"
	TypeVehicleLocationHistory = "VehicleLocationHistory"
)

Variables

This section is empty.

Functions

func IsConstraintError

func IsConstraintError(err error) bool

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

func IsNotFound

func IsNotFound(err error) bool

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

func IsNotLoaded

func IsNotLoaded(err error) bool

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

func IsNotSingular

func IsNotSingular(err error) bool

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

func IsValidationError

func IsValidationError(err error) bool

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

func MaskNotFound

func MaskNotFound(err error) error

MaskNotFound masks not found error.

func NewContext

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

NewContext returns a new context with the given Client attached.

func NewTxContext

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

NewTxContext returns a new context with the given Tx attached.

Types

type AggregateFunc

type AggregateFunc func(*sql.Selector) string

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

func As

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

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

func Count

func Count() AggregateFunc

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

func Max

func Max(field string) AggregateFunc

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

func Mean

func Mean(field string) AggregateFunc

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

func Min

func Min(field string) AggregateFunc

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

func Sum

func Sum(field string) AggregateFunc

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

type Client

type Client struct {

	// Schema is the client for creating, migrating and dropping schema.
	Schema *migrate.Schema
	// Ride is the client for interacting with the Ride builders.
	Ride *RideClient
	// User is the client for interacting with the User builders.
	User *UserClient
	// UserPromoCode is the client for interacting with the UserPromoCode builders.
	UserPromoCode *UserPromoCodeClient
	// Vehicle is the client for interacting with the Vehicle builders.
	Vehicle *VehicleClient
	// VehicleLocationHistory is the client for interacting with the VehicleLocationHistory builders.
	VehicleLocationHistory *VehicleLocationHistoryClient
	// 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().
	Ride.
	Query().
	Count(ctx)

func (*Client) Intercept

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

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

func (*Client) Mutate

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

Mutate implements the ent.Mutator interface.

func (*Client) Tx

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

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

func (*Client) Use

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

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

type CommitFunc

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

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

func (CommitFunc) Commit

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

Commit calls f(ctx, m).

type CommitHook

type CommitHook func(Committer) Committer

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

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

type Committer

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

Committer is the interface that wraps the Commit method.

type ConstraintError

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

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

func (ConstraintError) Error

func (e ConstraintError) Error() string

Error implements the error interface.

func (*ConstraintError) Unwrap

func (e *ConstraintError) Unwrap() error

Unwrap implements the errors.Wrapper interface.

type Hook

type Hook = ent.Hook

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

type InterceptFunc

type InterceptFunc = ent.InterceptFunc

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

type Interceptor

type Interceptor = ent.Interceptor

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

type MutateFunc

type MutateFunc = ent.MutateFunc

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

type Mutation

type Mutation = ent.Mutation

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

type Mutator

type Mutator = ent.Mutator

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

type NotFoundError

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

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

func (*NotFoundError) Error

func (e *NotFoundError) Error() string

Error implements the error interface.

type NotLoadedError

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

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

func (*NotLoadedError) Error

func (e *NotLoadedError) Error() string

Error implements the error interface.

type NotSingularError

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

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

func (*NotSingularError) Error

func (e *NotSingularError) Error() string

Error implements the error interface.

type Op

type Op = ent.Op

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

type Option

type Option func(*config)

Option function to configure the client.

func Debug

func Debug() Option

Debug enables debug logging on the ent.Driver.

func Driver

func Driver(driver dialect.Driver) Option

Driver configures the client driver.

func Log

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

Log sets the logging function for debug mode.

type OrderFunc

type OrderFunc func(*sql.Selector)

OrderFunc applies an ordering on the sql selector.

func Asc

func Asc(fields ...string) OrderFunc

Asc applies the given fields in ASC order.

func Desc

func Desc(fields ...string) OrderFunc

Desc applies the given fields in DESC order.

type Policy

type Policy = ent.Policy

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

type Querier

type Querier = ent.Querier

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

type QuerierFunc

type QuerierFunc = ent.QuerierFunc

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

type Query

type Query = ent.Query

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

type QueryContext

type QueryContext = ent.QueryContext

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

type Ride

type Ride struct {

	// ID of the ent.
	ID uuid.UUID `json:"id,omitempty"`
	// City holds the value of the "city" field.
	City string `json:"city,omitempty"`
	// VehicleCity holds the value of the "vehicle_city" field.
	VehicleCity string `json:"vehicle_city,omitempty"`
	// RiderID holds the value of the "rider_id" field.
	RiderID uuid.UUID `json:"rider_id,omitempty"`
	// VehicleID holds the value of the "vehicle_id" field.
	VehicleID uuid.UUID `json:"vehicle_id,omitempty"`
	// StartAddress holds the value of the "start_address" field.
	StartAddress string `json:"start_address,omitempty"`
	// EndAddress holds the value of the "end_address" field.
	EndAddress string `json:"end_address,omitempty"`
	// StartTime holds the value of the "start_time" field.
	StartTime time.Time `json:"start_time,omitempty"`
	// EndTime holds the value of the "end_time" field.
	EndTime time.Time `json:"end_time,omitempty"`
	// Revenue holds the value of the "revenue" field.
	Revenue float64 `json:"revenue,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the RideQuery when eager-loading is set.
	Edges RideEdges `json:"edges"`
	// contains filtered or unexported fields
}

Ride is the model entity for the Ride schema.

func (*Ride) QueryUser

func (r *Ride) QueryUser() *UserQuery

QueryUser queries the "user" edge of the Ride entity.

func (*Ride) QueryVehicle

func (r *Ride) QueryVehicle() *VehicleQuery

QueryVehicle queries the "vehicle" edge of the Ride entity.

func (*Ride) QueryVehicleLocationHistories

func (r *Ride) QueryVehicleLocationHistories() *VehicleLocationHistoryQuery

QueryVehicleLocationHistories queries the "vehicle_location_histories" edge of the Ride entity.

func (*Ride) String

func (r *Ride) String() string

String implements the fmt.Stringer.

func (*Ride) Unwrap

func (r *Ride) Unwrap() *Ride

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

func (r *Ride) Update() *RideUpdateOne

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

type RideClient

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

RideClient is a client for the Ride schema.

func NewRideClient

func NewRideClient(c config) *RideClient

NewRideClient returns a client for the Ride from the given config.

func (*RideClient) Create

func (c *RideClient) Create() *RideCreate

Create returns a builder for creating a Ride entity.

func (*RideClient) CreateBulk

func (c *RideClient) CreateBulk(builders ...*RideCreate) *RideCreateBulk

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

func (*RideClient) Delete

func (c *RideClient) Delete() *RideDelete

Delete returns a delete builder for Ride.

func (*RideClient) DeleteOne

func (c *RideClient) DeleteOne(r *Ride) *RideDeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*RideClient) DeleteOneID

func (c *RideClient) DeleteOneID(id uuid.UUID) *RideDeleteOne

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

func (*RideClient) Get

func (c *RideClient) Get(ctx context.Context, id uuid.UUID) (*Ride, error)

Get returns a Ride entity by its id.

func (*RideClient) GetX

func (c *RideClient) GetX(ctx context.Context, id uuid.UUID) *Ride

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

func (*RideClient) Hooks

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

Hooks returns the client hooks.

func (*RideClient) Intercept

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

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

func (*RideClient) Interceptors

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

Interceptors returns the client interceptors.

func (*RideClient) Query

func (c *RideClient) Query() *RideQuery

Query returns a query builder for Ride.

func (*RideClient) QueryUser

func (c *RideClient) QueryUser(r *Ride) *UserQuery

QueryUser queries the user edge of a Ride.

func (*RideClient) QueryVehicle

func (c *RideClient) QueryVehicle(r *Ride) *VehicleQuery

QueryVehicle queries the vehicle edge of a Ride.

func (*RideClient) QueryVehicleLocationHistories

func (c *RideClient) QueryVehicleLocationHistories(r *Ride) *VehicleLocationHistoryQuery

QueryVehicleLocationHistories queries the vehicle_location_histories edge of a Ride.

func (*RideClient) Update

func (c *RideClient) Update() *RideUpdate

Update returns an update builder for Ride.

func (*RideClient) UpdateOne

func (c *RideClient) UpdateOne(r *Ride) *RideUpdateOne

UpdateOne returns an update builder for the given entity.

func (*RideClient) UpdateOneID

func (c *RideClient) UpdateOneID(id uuid.UUID) *RideUpdateOne

UpdateOneID returns an update builder for the given id.

func (*RideClient) Use

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

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

type RideCreate

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

RideCreate is the builder for creating a Ride entity.

func (*RideCreate) AddVehicleLocationHistories

func (rc *RideCreate) AddVehicleLocationHistories(v ...*VehicleLocationHistory) *RideCreate

AddVehicleLocationHistories adds the "vehicle_location_histories" edges to the VehicleLocationHistory entity.

func (*RideCreate) AddVehicleLocationHistoryIDs

func (rc *RideCreate) AddVehicleLocationHistoryIDs(ids ...uuid.UUID) *RideCreate

AddVehicleLocationHistoryIDs adds the "vehicle_location_histories" edge to the VehicleLocationHistory entity by IDs.

func (*RideCreate) Exec

func (rc *RideCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*RideCreate) ExecX

func (rc *RideCreate) ExecX(ctx context.Context)

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

func (*RideCreate) Mutation

func (rc *RideCreate) Mutation() *RideMutation

Mutation returns the RideMutation object of the builder.

func (*RideCreate) Save

func (rc *RideCreate) Save(ctx context.Context) (*Ride, error)

Save creates the Ride in the database.

func (*RideCreate) SaveX

func (rc *RideCreate) SaveX(ctx context.Context) *Ride

SaveX calls Save and panics if Save returns an error.

func (*RideCreate) SetCity

func (rc *RideCreate) SetCity(s string) *RideCreate

SetCity sets the "city" field.

func (*RideCreate) SetEndAddress

func (rc *RideCreate) SetEndAddress(s string) *RideCreate

SetEndAddress sets the "end_address" field.

func (*RideCreate) SetEndTime

func (rc *RideCreate) SetEndTime(t time.Time) *RideCreate

SetEndTime sets the "end_time" field.

func (*RideCreate) SetID

func (rc *RideCreate) SetID(u uuid.UUID) *RideCreate

SetID sets the "id" field.

func (*RideCreate) SetNillableEndAddress

func (rc *RideCreate) SetNillableEndAddress(s *string) *RideCreate

SetNillableEndAddress sets the "end_address" field if the given value is not nil.

func (*RideCreate) SetNillableEndTime

func (rc *RideCreate) SetNillableEndTime(t *time.Time) *RideCreate

SetNillableEndTime sets the "end_time" field if the given value is not nil.

func (*RideCreate) SetNillableID

func (rc *RideCreate) SetNillableID(u *uuid.UUID) *RideCreate

SetNillableID sets the "id" field if the given value is not nil.

func (*RideCreate) SetNillableRevenue

func (rc *RideCreate) SetNillableRevenue(f *float64) *RideCreate

SetNillableRevenue sets the "revenue" field if the given value is not nil.

func (*RideCreate) SetNillableRiderID

func (rc *RideCreate) SetNillableRiderID(u *uuid.UUID) *RideCreate

SetNillableRiderID sets the "rider_id" field if the given value is not nil.

func (*RideCreate) SetNillableStartAddress

func (rc *RideCreate) SetNillableStartAddress(s *string) *RideCreate

SetNillableStartAddress sets the "start_address" field if the given value is not nil.

func (*RideCreate) SetNillableStartTime

func (rc *RideCreate) SetNillableStartTime(t *time.Time) *RideCreate

SetNillableStartTime sets the "start_time" field if the given value is not nil.

func (*RideCreate) SetNillableUserID

func (rc *RideCreate) SetNillableUserID(id *uuid.UUID) *RideCreate

SetNillableUserID sets the "user" edge to the User entity by ID if the given value is not nil.

func (*RideCreate) SetNillableVehicleCity

func (rc *RideCreate) SetNillableVehicleCity(s *string) *RideCreate

SetNillableVehicleCity sets the "vehicle_city" field if the given value is not nil.

func (*RideCreate) SetNillableVehicleID

func (rc *RideCreate) SetNillableVehicleID(u *uuid.UUID) *RideCreate

SetNillableVehicleID sets the "vehicle_id" field if the given value is not nil.

func (*RideCreate) SetRevenue

func (rc *RideCreate) SetRevenue(f float64) *RideCreate

SetRevenue sets the "revenue" field.

func (*RideCreate) SetRiderID

func (rc *RideCreate) SetRiderID(u uuid.UUID) *RideCreate

SetRiderID sets the "rider_id" field.

func (*RideCreate) SetStartAddress

func (rc *RideCreate) SetStartAddress(s string) *RideCreate

SetStartAddress sets the "start_address" field.

func (*RideCreate) SetStartTime

func (rc *RideCreate) SetStartTime(t time.Time) *RideCreate

SetStartTime sets the "start_time" field.

func (*RideCreate) SetUser

func (rc *RideCreate) SetUser(u *User) *RideCreate

SetUser sets the "user" edge to the User entity.

func (*RideCreate) SetUserID

func (rc *RideCreate) SetUserID(id uuid.UUID) *RideCreate

SetUserID sets the "user" edge to the User entity by ID.

func (*RideCreate) SetVehicle

func (rc *RideCreate) SetVehicle(v *Vehicle) *RideCreate

SetVehicle sets the "vehicle" edge to the Vehicle entity.

func (*RideCreate) SetVehicleCity

func (rc *RideCreate) SetVehicleCity(s string) *RideCreate

SetVehicleCity sets the "vehicle_city" field.

func (*RideCreate) SetVehicleID

func (rc *RideCreate) SetVehicleID(u uuid.UUID) *RideCreate

SetVehicleID sets the "vehicle_id" field.

type RideCreateBulk

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

RideCreateBulk is the builder for creating many Ride entities in bulk.

func (*RideCreateBulk) Exec

func (rcb *RideCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*RideCreateBulk) ExecX

func (rcb *RideCreateBulk) ExecX(ctx context.Context)

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

func (*RideCreateBulk) Save

func (rcb *RideCreateBulk) Save(ctx context.Context) ([]*Ride, error)

Save creates the Ride entities in the database.

func (*RideCreateBulk) SaveX

func (rcb *RideCreateBulk) SaveX(ctx context.Context) []*Ride

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

type RideDelete

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

RideDelete is the builder for deleting a Ride entity.

func (*RideDelete) Exec

func (rd *RideDelete) Exec(ctx context.Context) (int, error)

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

func (*RideDelete) ExecX

func (rd *RideDelete) ExecX(ctx context.Context) int

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

func (*RideDelete) Where

func (rd *RideDelete) Where(ps ...predicate.Ride) *RideDelete

Where appends a list predicates to the RideDelete builder.

type RideDeleteOne

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

RideDeleteOne is the builder for deleting a single Ride entity.

func (*RideDeleteOne) Exec

func (rdo *RideDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*RideDeleteOne) ExecX

func (rdo *RideDeleteOne) ExecX(ctx context.Context)

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

func (*RideDeleteOne) Where

func (rdo *RideDeleteOne) Where(ps ...predicate.Ride) *RideDeleteOne

Where appends a list predicates to the RideDelete builder.

type RideEdges

type RideEdges struct {
	// User holds the value of the user edge.
	User *User `json:"user,omitempty"`
	// Vehicle holds the value of the vehicle edge.
	Vehicle *Vehicle `json:"vehicle,omitempty"`
	// VehicleLocationHistories holds the value of the vehicle_location_histories edge.
	VehicleLocationHistories []*VehicleLocationHistory `json:"vehicle_location_histories,omitempty"`
	// contains filtered or unexported fields
}

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

func (RideEdges) UserOrErr

func (e RideEdges) UserOrErr() (*User, error)

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

func (RideEdges) VehicleLocationHistoriesOrErr

func (e RideEdges) VehicleLocationHistoriesOrErr() ([]*VehicleLocationHistory, error)

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

func (RideEdges) VehicleOrErr

func (e RideEdges) VehicleOrErr() (*Vehicle, error)

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

type RideGroupBy

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

RideGroupBy is the group-by builder for Ride entities.

func (*RideGroupBy) Aggregate

func (rgb *RideGroupBy) Aggregate(fns ...AggregateFunc) *RideGroupBy

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

func (*RideGroupBy) Bool

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

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

func (*RideGroupBy) BoolX

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

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

func (*RideGroupBy) Bools

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

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

func (*RideGroupBy) BoolsX

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

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

func (*RideGroupBy) Float64

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

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

func (*RideGroupBy) Float64X

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

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

func (*RideGroupBy) Float64s

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

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

func (*RideGroupBy) Float64sX

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

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

func (*RideGroupBy) Int

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

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

func (*RideGroupBy) IntX

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

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

func (*RideGroupBy) Ints

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

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

func (*RideGroupBy) IntsX

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

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

func (*RideGroupBy) Scan

func (rgb *RideGroupBy) Scan(ctx context.Context, v any) error

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

func (*RideGroupBy) ScanX

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

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

func (*RideGroupBy) String

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

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

func (*RideGroupBy) StringX

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

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

func (*RideGroupBy) Strings

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

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

func (*RideGroupBy) StringsX

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

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

type RideMutation

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

RideMutation represents an operation that mutates the Ride nodes in the graph.

func (*RideMutation) AddField

func (m *RideMutation) 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 (*RideMutation) AddRevenue

func (m *RideMutation) AddRevenue(f float64)

AddRevenue adds f to the "revenue" field.

func (*RideMutation) AddVehicleLocationHistoryIDs

func (m *RideMutation) AddVehicleLocationHistoryIDs(ids ...uuid.UUID)

AddVehicleLocationHistoryIDs adds the "vehicle_location_histories" edge to the VehicleLocationHistory entity by ids.

func (*RideMutation) AddedEdges

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

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

func (*RideMutation) AddedField

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

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

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

func (*RideMutation) AddedIDs

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

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

func (*RideMutation) AddedRevenue

func (m *RideMutation) AddedRevenue() (r float64, exists bool)

AddedRevenue returns the value that was added to the "revenue" field in this mutation.

func (*RideMutation) City

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

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

func (*RideMutation) ClearEdge

func (m *RideMutation) 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 (*RideMutation) ClearEndAddress

func (m *RideMutation) ClearEndAddress()

ClearEndAddress clears the value of the "end_address" field.

func (*RideMutation) ClearEndTime

func (m *RideMutation) ClearEndTime()

ClearEndTime clears the value of the "end_time" field.

func (*RideMutation) ClearField

func (m *RideMutation) 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 (*RideMutation) ClearRevenue

func (m *RideMutation) ClearRevenue()

ClearRevenue clears the value of the "revenue" field.

func (*RideMutation) ClearRiderID

func (m *RideMutation) ClearRiderID()

ClearRiderID clears the value of the "rider_id" field.

func (*RideMutation) ClearStartAddress

func (m *RideMutation) ClearStartAddress()

ClearStartAddress clears the value of the "start_address" field.

func (*RideMutation) ClearStartTime

func (m *RideMutation) ClearStartTime()

ClearStartTime clears the value of the "start_time" field.

func (*RideMutation) ClearUser

func (m *RideMutation) ClearUser()

ClearUser clears the "user" edge to the User entity.

func (*RideMutation) ClearVehicle

func (m *RideMutation) ClearVehicle()

ClearVehicle clears the "vehicle" edge to the Vehicle entity.

func (*RideMutation) ClearVehicleCity

func (m *RideMutation) ClearVehicleCity()

ClearVehicleCity clears the value of the "vehicle_city" field.

func (*RideMutation) ClearVehicleID

func (m *RideMutation) ClearVehicleID()

ClearVehicleID clears the value of the "vehicle_id" field.

func (*RideMutation) ClearVehicleLocationHistories

func (m *RideMutation) ClearVehicleLocationHistories()

ClearVehicleLocationHistories clears the "vehicle_location_histories" edge to the VehicleLocationHistory entity.

func (*RideMutation) ClearedEdges

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

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

func (*RideMutation) ClearedFields

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

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

func (RideMutation) Client

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

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

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

func (*RideMutation) EndAddress

func (m *RideMutation) EndAddress() (r string, exists bool)

EndAddress returns the value of the "end_address" field in the mutation.

func (*RideMutation) EndAddressCleared

func (m *RideMutation) EndAddressCleared() bool

EndAddressCleared returns if the "end_address" field was cleared in this mutation.

func (*RideMutation) EndTime

func (m *RideMutation) EndTime() (r time.Time, exists bool)

EndTime returns the value of the "end_time" field in the mutation.

func (*RideMutation) EndTimeCleared

func (m *RideMutation) EndTimeCleared() bool

EndTimeCleared returns if the "end_time" field was cleared in this mutation.

func (*RideMutation) Field

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

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

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

func (*RideMutation) Fields

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

func (m *RideMutation) ID() (id uuid.UUID, 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 (*RideMutation) IDs

func (m *RideMutation) IDs(ctx context.Context) ([]uuid.UUID, error)

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

func (*RideMutation) OldCity

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

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

func (m *RideMutation) OldEndAddress(ctx context.Context) (v string, err error)

OldEndAddress returns the old "end_address" field's value of the Ride entity. If the Ride 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 (*RideMutation) OldEndTime

func (m *RideMutation) OldEndTime(ctx context.Context) (v time.Time, err error)

OldEndTime returns the old "end_time" field's value of the Ride entity. If the Ride 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 (*RideMutation) OldField

func (m *RideMutation) 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 (*RideMutation) OldRevenue

func (m *RideMutation) OldRevenue(ctx context.Context) (v float64, err error)

OldRevenue returns the old "revenue" field's value of the Ride entity. If the Ride 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 (*RideMutation) OldRiderID

func (m *RideMutation) OldRiderID(ctx context.Context) (v uuid.UUID, err error)

OldRiderID returns the old "rider_id" field's value of the Ride entity. If the Ride 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 (*RideMutation) OldStartAddress

func (m *RideMutation) OldStartAddress(ctx context.Context) (v string, err error)

OldStartAddress returns the old "start_address" field's value of the Ride entity. If the Ride 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 (*RideMutation) OldStartTime

func (m *RideMutation) OldStartTime(ctx context.Context) (v time.Time, err error)

OldStartTime returns the old "start_time" field's value of the Ride entity. If the Ride 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 (*RideMutation) OldVehicleCity

func (m *RideMutation) OldVehicleCity(ctx context.Context) (v string, err error)

OldVehicleCity returns the old "vehicle_city" field's value of the Ride entity. If the Ride 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 (*RideMutation) OldVehicleID

func (m *RideMutation) OldVehicleID(ctx context.Context) (v uuid.UUID, err error)

OldVehicleID returns the old "vehicle_id" field's value of the Ride entity. If the Ride 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 (*RideMutation) Op

func (m *RideMutation) Op() Op

Op returns the operation name.

func (*RideMutation) RemoveVehicleLocationHistoryIDs

func (m *RideMutation) RemoveVehicleLocationHistoryIDs(ids ...uuid.UUID)

RemoveVehicleLocationHistoryIDs removes the "vehicle_location_histories" edge to the VehicleLocationHistory entity by IDs.

func (*RideMutation) RemovedEdges

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

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

func (*RideMutation) RemovedIDs

func (m *RideMutation) 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 (*RideMutation) RemovedVehicleLocationHistoriesIDs

func (m *RideMutation) RemovedVehicleLocationHistoriesIDs() (ids []uuid.UUID)

RemovedVehicleLocationHistories returns the removed IDs of the "vehicle_location_histories" edge to the VehicleLocationHistory entity.

func (*RideMutation) ResetCity

func (m *RideMutation) ResetCity()

ResetCity resets all changes to the "city" field.

func (*RideMutation) ResetEdge

func (m *RideMutation) 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 (*RideMutation) ResetEndAddress

func (m *RideMutation) ResetEndAddress()

ResetEndAddress resets all changes to the "end_address" field.

func (*RideMutation) ResetEndTime

func (m *RideMutation) ResetEndTime()

ResetEndTime resets all changes to the "end_time" field.

func (*RideMutation) ResetField

func (m *RideMutation) 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 (*RideMutation) ResetRevenue

func (m *RideMutation) ResetRevenue()

ResetRevenue resets all changes to the "revenue" field.

func (*RideMutation) ResetRiderID

func (m *RideMutation) ResetRiderID()

ResetRiderID resets all changes to the "rider_id" field.

func (*RideMutation) ResetStartAddress

func (m *RideMutation) ResetStartAddress()

ResetStartAddress resets all changes to the "start_address" field.

func (*RideMutation) ResetStartTime

func (m *RideMutation) ResetStartTime()

ResetStartTime resets all changes to the "start_time" field.

func (*RideMutation) ResetUser

func (m *RideMutation) ResetUser()

ResetUser resets all changes to the "user" edge.

func (*RideMutation) ResetVehicle

func (m *RideMutation) ResetVehicle()

ResetVehicle resets all changes to the "vehicle" edge.

func (*RideMutation) ResetVehicleCity

func (m *RideMutation) ResetVehicleCity()

ResetVehicleCity resets all changes to the "vehicle_city" field.

func (*RideMutation) ResetVehicleID

func (m *RideMutation) ResetVehicleID()

ResetVehicleID resets all changes to the "vehicle_id" field.

func (*RideMutation) ResetVehicleLocationHistories

func (m *RideMutation) ResetVehicleLocationHistories()

ResetVehicleLocationHistories resets all changes to the "vehicle_location_histories" edge.

func (*RideMutation) Revenue

func (m *RideMutation) Revenue() (r float64, exists bool)

Revenue returns the value of the "revenue" field in the mutation.

func (*RideMutation) RevenueCleared

func (m *RideMutation) RevenueCleared() bool

RevenueCleared returns if the "revenue" field was cleared in this mutation.

func (*RideMutation) RiderID

func (m *RideMutation) RiderID() (r uuid.UUID, exists bool)

RiderID returns the value of the "rider_id" field in the mutation.

func (*RideMutation) RiderIDCleared

func (m *RideMutation) RiderIDCleared() bool

RiderIDCleared returns if the "rider_id" field was cleared in this mutation.

func (*RideMutation) SetCity

func (m *RideMutation) SetCity(s string)

SetCity sets the "city" field.

func (*RideMutation) SetEndAddress

func (m *RideMutation) SetEndAddress(s string)

SetEndAddress sets the "end_address" field.

func (*RideMutation) SetEndTime

func (m *RideMutation) SetEndTime(t time.Time)

SetEndTime sets the "end_time" field.

func (*RideMutation) SetField

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

func (m *RideMutation) SetID(id uuid.UUID)

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

func (*RideMutation) SetOp

func (m *RideMutation) SetOp(op Op)

SetOp allows setting the mutation operation.

func (*RideMutation) SetRevenue

func (m *RideMutation) SetRevenue(f float64)

SetRevenue sets the "revenue" field.

func (*RideMutation) SetRiderID

func (m *RideMutation) SetRiderID(u uuid.UUID)

SetRiderID sets the "rider_id" field.

func (*RideMutation) SetStartAddress

func (m *RideMutation) SetStartAddress(s string)

SetStartAddress sets the "start_address" field.

func (*RideMutation) SetStartTime

func (m *RideMutation) SetStartTime(t time.Time)

SetStartTime sets the "start_time" field.

func (*RideMutation) SetUserID

func (m *RideMutation) SetUserID(id uuid.UUID)

SetUserID sets the "user" edge to the User entity by id.

func (*RideMutation) SetVehicleCity

func (m *RideMutation) SetVehicleCity(s string)

SetVehicleCity sets the "vehicle_city" field.

func (*RideMutation) SetVehicleID

func (m *RideMutation) SetVehicleID(u uuid.UUID)

SetVehicleID sets the "vehicle_id" field.

func (*RideMutation) StartAddress

func (m *RideMutation) StartAddress() (r string, exists bool)

StartAddress returns the value of the "start_address" field in the mutation.

func (*RideMutation) StartAddressCleared

func (m *RideMutation) StartAddressCleared() bool

StartAddressCleared returns if the "start_address" field was cleared in this mutation.

func (*RideMutation) StartTime

func (m *RideMutation) StartTime() (r time.Time, exists bool)

StartTime returns the value of the "start_time" field in the mutation.

func (*RideMutation) StartTimeCleared

func (m *RideMutation) StartTimeCleared() bool

StartTimeCleared returns if the "start_time" field was cleared in this mutation.

func (RideMutation) Tx

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

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

func (*RideMutation) Type

func (m *RideMutation) Type() string

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

func (*RideMutation) UserCleared

func (m *RideMutation) UserCleared() bool

UserCleared reports if the "user" edge to the User entity was cleared.

func (*RideMutation) UserID

func (m *RideMutation) UserID() (id uuid.UUID, exists bool)

UserID returns the "user" edge ID in the mutation.

func (*RideMutation) UserIDs

func (m *RideMutation) UserIDs() (ids []uuid.UUID)

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

func (*RideMutation) VehicleCity

func (m *RideMutation) VehicleCity() (r string, exists bool)

VehicleCity returns the value of the "vehicle_city" field in the mutation.

func (*RideMutation) VehicleCityCleared

func (m *RideMutation) VehicleCityCleared() bool

VehicleCityCleared returns if the "vehicle_city" field was cleared in this mutation.

func (*RideMutation) VehicleCleared

func (m *RideMutation) VehicleCleared() bool

VehicleCleared reports if the "vehicle" edge to the Vehicle entity was cleared.

func (*RideMutation) VehicleID

func (m *RideMutation) VehicleID() (r uuid.UUID, exists bool)

VehicleID returns the value of the "vehicle_id" field in the mutation.

func (*RideMutation) VehicleIDCleared

func (m *RideMutation) VehicleIDCleared() bool

VehicleIDCleared returns if the "vehicle_id" field was cleared in this mutation.

func (*RideMutation) VehicleIDs

func (m *RideMutation) VehicleIDs() (ids []uuid.UUID)

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

func (*RideMutation) VehicleLocationHistoriesCleared

func (m *RideMutation) VehicleLocationHistoriesCleared() bool

VehicleLocationHistoriesCleared reports if the "vehicle_location_histories" edge to the VehicleLocationHistory entity was cleared.

func (*RideMutation) VehicleLocationHistoriesIDs

func (m *RideMutation) VehicleLocationHistoriesIDs() (ids []uuid.UUID)

VehicleLocationHistoriesIDs returns the "vehicle_location_histories" edge IDs in the mutation.

func (*RideMutation) Where

func (m *RideMutation) Where(ps ...predicate.Ride)

Where appends a list predicates to the RideMutation builder.

func (*RideMutation) WhereP

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

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

type RideQuery

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

RideQuery is the builder for querying Ride entities.

func (*RideQuery) Aggregate

func (rq *RideQuery) Aggregate(fns ...AggregateFunc) *RideSelect

Aggregate returns a RideSelect configured with the given aggregations.

func (*RideQuery) All

func (rq *RideQuery) All(ctx context.Context) ([]*Ride, error)

All executes the query and returns a list of Rides.

func (*RideQuery) AllX

func (rq *RideQuery) AllX(ctx context.Context) []*Ride

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

func (*RideQuery) Clone

func (rq *RideQuery) Clone() *RideQuery

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

func (*RideQuery) Count

func (rq *RideQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*RideQuery) CountX

func (rq *RideQuery) CountX(ctx context.Context) int

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

func (*RideQuery) Exist

func (rq *RideQuery) Exist(ctx context.Context) (bool, error)

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

func (*RideQuery) ExistX

func (rq *RideQuery) ExistX(ctx context.Context) bool

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

func (*RideQuery) First

func (rq *RideQuery) First(ctx context.Context) (*Ride, error)

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

func (*RideQuery) FirstID

func (rq *RideQuery) FirstID(ctx context.Context) (id uuid.UUID, err error)

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

func (*RideQuery) FirstIDX

func (rq *RideQuery) FirstIDX(ctx context.Context) uuid.UUID

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

func (*RideQuery) FirstX

func (rq *RideQuery) FirstX(ctx context.Context) *Ride

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

func (*RideQuery) GroupBy

func (rq *RideQuery) GroupBy(field string, fields ...string) *RideGroupBy

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

client.Ride.Query().
	GroupBy(ride.FieldCity).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*RideQuery) IDs

func (rq *RideQuery) IDs(ctx context.Context) ([]uuid.UUID, error)

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

func (*RideQuery) IDsX

func (rq *RideQuery) IDsX(ctx context.Context) []uuid.UUID

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

func (*RideQuery) Limit

func (rq *RideQuery) Limit(limit int) *RideQuery

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

func (*RideQuery) Offset

func (rq *RideQuery) Offset(offset int) *RideQuery

Offset to start from.

func (*RideQuery) Only

func (rq *RideQuery) Only(ctx context.Context) (*Ride, error)

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

func (*RideQuery) OnlyID

func (rq *RideQuery) OnlyID(ctx context.Context) (id uuid.UUID, err error)

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

func (*RideQuery) OnlyIDX

func (rq *RideQuery) OnlyIDX(ctx context.Context) uuid.UUID

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

func (*RideQuery) OnlyX

func (rq *RideQuery) OnlyX(ctx context.Context) *Ride

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

func (*RideQuery) Order

func (rq *RideQuery) Order(o ...OrderFunc) *RideQuery

Order specifies how the records should be ordered.

func (*RideQuery) QueryUser

func (rq *RideQuery) QueryUser() *UserQuery

QueryUser chains the current query on the "user" edge.

func (*RideQuery) QueryVehicle

func (rq *RideQuery) QueryVehicle() *VehicleQuery

QueryVehicle chains the current query on the "vehicle" edge.

func (*RideQuery) QueryVehicleLocationHistories

func (rq *RideQuery) QueryVehicleLocationHistories() *VehicleLocationHistoryQuery

QueryVehicleLocationHistories chains the current query on the "vehicle_location_histories" edge.

func (*RideQuery) Select

func (rq *RideQuery) Select(fields ...string) *RideSelect

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 {
	City string `json:"city,omitempty"`
}

client.Ride.Query().
	Select(ride.FieldCity).
	Scan(ctx, &v)

func (*RideQuery) Unique

func (rq *RideQuery) Unique(unique bool) *RideQuery

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

func (rq *RideQuery) Where(ps ...predicate.Ride) *RideQuery

Where adds a new predicate for the RideQuery builder.

func (*RideQuery) WithUser

func (rq *RideQuery) WithUser(opts ...func(*UserQuery)) *RideQuery

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

func (*RideQuery) WithVehicle

func (rq *RideQuery) WithVehicle(opts ...func(*VehicleQuery)) *RideQuery

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

func (*RideQuery) WithVehicleLocationHistories

func (rq *RideQuery) WithVehicleLocationHistories(opts ...func(*VehicleLocationHistoryQuery)) *RideQuery

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

type RideSelect

type RideSelect struct {
	*RideQuery
	// contains filtered or unexported fields
}

RideSelect is the builder for selecting fields of Ride entities.

func (*RideSelect) Aggregate

func (rs *RideSelect) Aggregate(fns ...AggregateFunc) *RideSelect

Aggregate adds the given aggregation functions to the selector query.

func (*RideSelect) Bool

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

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

func (*RideSelect) BoolX

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

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

func (*RideSelect) Bools

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

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

func (*RideSelect) BoolsX

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

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

func (*RideSelect) Float64

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

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

func (*RideSelect) Float64X

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

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

func (*RideSelect) Float64s

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

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

func (*RideSelect) Float64sX

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

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

func (*RideSelect) Int

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

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

func (*RideSelect) IntX

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

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

func (*RideSelect) Ints

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

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

func (*RideSelect) IntsX

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

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

func (*RideSelect) Scan

func (rs *RideSelect) Scan(ctx context.Context, v any) error

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

func (*RideSelect) ScanX

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

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

func (*RideSelect) String

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

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

func (*RideSelect) StringX

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

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

func (*RideSelect) Strings

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

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

func (*RideSelect) StringsX

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

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

type RideUpdate

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

RideUpdate is the builder for updating Ride entities.

func (*RideUpdate) AddRevenue

func (ru *RideUpdate) AddRevenue(f float64) *RideUpdate

AddRevenue adds f to the "revenue" field.

func (*RideUpdate) AddVehicleLocationHistories

func (ru *RideUpdate) AddVehicleLocationHistories(v ...*VehicleLocationHistory) *RideUpdate

AddVehicleLocationHistories adds the "vehicle_location_histories" edges to the VehicleLocationHistory entity.

func (*RideUpdate) AddVehicleLocationHistoryIDs

func (ru *RideUpdate) AddVehicleLocationHistoryIDs(ids ...uuid.UUID) *RideUpdate

AddVehicleLocationHistoryIDs adds the "vehicle_location_histories" edge to the VehicleLocationHistory entity by IDs.

func (*RideUpdate) ClearEndAddress

func (ru *RideUpdate) ClearEndAddress() *RideUpdate

ClearEndAddress clears the value of the "end_address" field.

func (*RideUpdate) ClearEndTime

func (ru *RideUpdate) ClearEndTime() *RideUpdate

ClearEndTime clears the value of the "end_time" field.

func (*RideUpdate) ClearRevenue

func (ru *RideUpdate) ClearRevenue() *RideUpdate

ClearRevenue clears the value of the "revenue" field.

func (*RideUpdate) ClearRiderID

func (ru *RideUpdate) ClearRiderID() *RideUpdate

ClearRiderID clears the value of the "rider_id" field.

func (*RideUpdate) ClearStartAddress

func (ru *RideUpdate) ClearStartAddress() *RideUpdate

ClearStartAddress clears the value of the "start_address" field.

func (*RideUpdate) ClearStartTime

func (ru *RideUpdate) ClearStartTime() *RideUpdate

ClearStartTime clears the value of the "start_time" field.

func (*RideUpdate) ClearUser

func (ru *RideUpdate) ClearUser() *RideUpdate

ClearUser clears the "user" edge to the User entity.

func (*RideUpdate) ClearVehicle

func (ru *RideUpdate) ClearVehicle() *RideUpdate

ClearVehicle clears the "vehicle" edge to the Vehicle entity.

func (*RideUpdate) ClearVehicleCity

func (ru *RideUpdate) ClearVehicleCity() *RideUpdate

ClearVehicleCity clears the value of the "vehicle_city" field.

func (*RideUpdate) ClearVehicleID

func (ru *RideUpdate) ClearVehicleID() *RideUpdate

ClearVehicleID clears the value of the "vehicle_id" field.

func (*RideUpdate) ClearVehicleLocationHistories

func (ru *RideUpdate) ClearVehicleLocationHistories() *RideUpdate

ClearVehicleLocationHistories clears all "vehicle_location_histories" edges to the VehicleLocationHistory entity.

func (*RideUpdate) Exec

func (ru *RideUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*RideUpdate) ExecX

func (ru *RideUpdate) ExecX(ctx context.Context)

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

func (*RideUpdate) Mutation

func (ru *RideUpdate) Mutation() *RideMutation

Mutation returns the RideMutation object of the builder.

func (*RideUpdate) RemoveVehicleLocationHistories

func (ru *RideUpdate) RemoveVehicleLocationHistories(v ...*VehicleLocationHistory) *RideUpdate

RemoveVehicleLocationHistories removes "vehicle_location_histories" edges to VehicleLocationHistory entities.

func (*RideUpdate) RemoveVehicleLocationHistoryIDs

func (ru *RideUpdate) RemoveVehicleLocationHistoryIDs(ids ...uuid.UUID) *RideUpdate

RemoveVehicleLocationHistoryIDs removes the "vehicle_location_histories" edge to VehicleLocationHistory entities by IDs.

func (*RideUpdate) Save

func (ru *RideUpdate) Save(ctx context.Context) (int, error)

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

func (*RideUpdate) SaveX

func (ru *RideUpdate) SaveX(ctx context.Context) int

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

func (*RideUpdate) SetCity

func (ru *RideUpdate) SetCity(s string) *RideUpdate

SetCity sets the "city" field.

func (*RideUpdate) SetEndAddress

func (ru *RideUpdate) SetEndAddress(s string) *RideUpdate

SetEndAddress sets the "end_address" field.

func (*RideUpdate) SetEndTime

func (ru *RideUpdate) SetEndTime(t time.Time) *RideUpdate

SetEndTime sets the "end_time" field.

func (*RideUpdate) SetNillableEndAddress

func (ru *RideUpdate) SetNillableEndAddress(s *string) *RideUpdate

SetNillableEndAddress sets the "end_address" field if the given value is not nil.

func (*RideUpdate) SetNillableEndTime

func (ru *RideUpdate) SetNillableEndTime(t *time.Time) *RideUpdate

SetNillableEndTime sets the "end_time" field if the given value is not nil.

func (*RideUpdate) SetNillableRevenue

func (ru *RideUpdate) SetNillableRevenue(f *float64) *RideUpdate

SetNillableRevenue sets the "revenue" field if the given value is not nil.

func (*RideUpdate) SetNillableRiderID

func (ru *RideUpdate) SetNillableRiderID(u *uuid.UUID) *RideUpdate

SetNillableRiderID sets the "rider_id" field if the given value is not nil.

func (*RideUpdate) SetNillableStartAddress

func (ru *RideUpdate) SetNillableStartAddress(s *string) *RideUpdate

SetNillableStartAddress sets the "start_address" field if the given value is not nil.

func (*RideUpdate) SetNillableStartTime

func (ru *RideUpdate) SetNillableStartTime(t *time.Time) *RideUpdate

SetNillableStartTime sets the "start_time" field if the given value is not nil.

func (*RideUpdate) SetNillableUserID

func (ru *RideUpdate) SetNillableUserID(id *uuid.UUID) *RideUpdate

SetNillableUserID sets the "user" edge to the User entity by ID if the given value is not nil.

func (*RideUpdate) SetNillableVehicleCity

func (ru *RideUpdate) SetNillableVehicleCity(s *string) *RideUpdate

SetNillableVehicleCity sets the "vehicle_city" field if the given value is not nil.

func (*RideUpdate) SetNillableVehicleID

func (ru *RideUpdate) SetNillableVehicleID(u *uuid.UUID) *RideUpdate

SetNillableVehicleID sets the "vehicle_id" field if the given value is not nil.

func (*RideUpdate) SetRevenue

func (ru *RideUpdate) SetRevenue(f float64) *RideUpdate

SetRevenue sets the "revenue" field.

func (*RideUpdate) SetRiderID

func (ru *RideUpdate) SetRiderID(u uuid.UUID) *RideUpdate

SetRiderID sets the "rider_id" field.

func (*RideUpdate) SetStartAddress

func (ru *RideUpdate) SetStartAddress(s string) *RideUpdate

SetStartAddress sets the "start_address" field.

func (*RideUpdate) SetStartTime

func (ru *RideUpdate) SetStartTime(t time.Time) *RideUpdate

SetStartTime sets the "start_time" field.

func (*RideUpdate) SetUser

func (ru *RideUpdate) SetUser(u *User) *RideUpdate

SetUser sets the "user" edge to the User entity.

func (*RideUpdate) SetUserID

func (ru *RideUpdate) SetUserID(id uuid.UUID) *RideUpdate

SetUserID sets the "user" edge to the User entity by ID.

func (*RideUpdate) SetVehicle

func (ru *RideUpdate) SetVehicle(v *Vehicle) *RideUpdate

SetVehicle sets the "vehicle" edge to the Vehicle entity.

func (*RideUpdate) SetVehicleCity

func (ru *RideUpdate) SetVehicleCity(s string) *RideUpdate

SetVehicleCity sets the "vehicle_city" field.

func (*RideUpdate) SetVehicleID

func (ru *RideUpdate) SetVehicleID(u uuid.UUID) *RideUpdate

SetVehicleID sets the "vehicle_id" field.

func (*RideUpdate) Where

func (ru *RideUpdate) Where(ps ...predicate.Ride) *RideUpdate

Where appends a list predicates to the RideUpdate builder.

type RideUpdateOne

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

RideUpdateOne is the builder for updating a single Ride entity.

func (*RideUpdateOne) AddRevenue

func (ruo *RideUpdateOne) AddRevenue(f float64) *RideUpdateOne

AddRevenue adds f to the "revenue" field.

func (*RideUpdateOne) AddVehicleLocationHistories

func (ruo *RideUpdateOne) AddVehicleLocationHistories(v ...*VehicleLocationHistory) *RideUpdateOne

AddVehicleLocationHistories adds the "vehicle_location_histories" edges to the VehicleLocationHistory entity.

func (*RideUpdateOne) AddVehicleLocationHistoryIDs

func (ruo *RideUpdateOne) AddVehicleLocationHistoryIDs(ids ...uuid.UUID) *RideUpdateOne

AddVehicleLocationHistoryIDs adds the "vehicle_location_histories" edge to the VehicleLocationHistory entity by IDs.

func (*RideUpdateOne) ClearEndAddress

func (ruo *RideUpdateOne) ClearEndAddress() *RideUpdateOne

ClearEndAddress clears the value of the "end_address" field.

func (*RideUpdateOne) ClearEndTime

func (ruo *RideUpdateOne) ClearEndTime() *RideUpdateOne

ClearEndTime clears the value of the "end_time" field.

func (*RideUpdateOne) ClearRevenue

func (ruo *RideUpdateOne) ClearRevenue() *RideUpdateOne

ClearRevenue clears the value of the "revenue" field.

func (*RideUpdateOne) ClearRiderID

func (ruo *RideUpdateOne) ClearRiderID() *RideUpdateOne

ClearRiderID clears the value of the "rider_id" field.

func (*RideUpdateOne) ClearStartAddress

func (ruo *RideUpdateOne) ClearStartAddress() *RideUpdateOne

ClearStartAddress clears the value of the "start_address" field.

func (*RideUpdateOne) ClearStartTime

func (ruo *RideUpdateOne) ClearStartTime() *RideUpdateOne

ClearStartTime clears the value of the "start_time" field.

func (*RideUpdateOne) ClearUser

func (ruo *RideUpdateOne) ClearUser() *RideUpdateOne

ClearUser clears the "user" edge to the User entity.

func (*RideUpdateOne) ClearVehicle

func (ruo *RideUpdateOne) ClearVehicle() *RideUpdateOne

ClearVehicle clears the "vehicle" edge to the Vehicle entity.

func (*RideUpdateOne) ClearVehicleCity

func (ruo *RideUpdateOne) ClearVehicleCity() *RideUpdateOne

ClearVehicleCity clears the value of the "vehicle_city" field.

func (*RideUpdateOne) ClearVehicleID

func (ruo *RideUpdateOne) ClearVehicleID() *RideUpdateOne

ClearVehicleID clears the value of the "vehicle_id" field.

func (*RideUpdateOne) ClearVehicleLocationHistories

func (ruo *RideUpdateOne) ClearVehicleLocationHistories() *RideUpdateOne

ClearVehicleLocationHistories clears all "vehicle_location_histories" edges to the VehicleLocationHistory entity.

func (*RideUpdateOne) Exec

func (ruo *RideUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*RideUpdateOne) ExecX

func (ruo *RideUpdateOne) ExecX(ctx context.Context)

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

func (*RideUpdateOne) Mutation

func (ruo *RideUpdateOne) Mutation() *RideMutation

Mutation returns the RideMutation object of the builder.

func (*RideUpdateOne) RemoveVehicleLocationHistories

func (ruo *RideUpdateOne) RemoveVehicleLocationHistories(v ...*VehicleLocationHistory) *RideUpdateOne

RemoveVehicleLocationHistories removes "vehicle_location_histories" edges to VehicleLocationHistory entities.

func (*RideUpdateOne) RemoveVehicleLocationHistoryIDs

func (ruo *RideUpdateOne) RemoveVehicleLocationHistoryIDs(ids ...uuid.UUID) *RideUpdateOne

RemoveVehicleLocationHistoryIDs removes the "vehicle_location_histories" edge to VehicleLocationHistory entities by IDs.

func (*RideUpdateOne) Save

func (ruo *RideUpdateOne) Save(ctx context.Context) (*Ride, error)

Save executes the query and returns the updated Ride entity.

func (*RideUpdateOne) SaveX

func (ruo *RideUpdateOne) SaveX(ctx context.Context) *Ride

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

func (*RideUpdateOne) Select

func (ruo *RideUpdateOne) Select(field string, fields ...string) *RideUpdateOne

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

func (*RideUpdateOne) SetCity

func (ruo *RideUpdateOne) SetCity(s string) *RideUpdateOne

SetCity sets the "city" field.

func (*RideUpdateOne) SetEndAddress

func (ruo *RideUpdateOne) SetEndAddress(s string) *RideUpdateOne

SetEndAddress sets the "end_address" field.

func (*RideUpdateOne) SetEndTime

func (ruo *RideUpdateOne) SetEndTime(t time.Time) *RideUpdateOne

SetEndTime sets the "end_time" field.

func (*RideUpdateOne) SetNillableEndAddress

func (ruo *RideUpdateOne) SetNillableEndAddress(s *string) *RideUpdateOne

SetNillableEndAddress sets the "end_address" field if the given value is not nil.

func (*RideUpdateOne) SetNillableEndTime

func (ruo *RideUpdateOne) SetNillableEndTime(t *time.Time) *RideUpdateOne

SetNillableEndTime sets the "end_time" field if the given value is not nil.

func (*RideUpdateOne) SetNillableRevenue

func (ruo *RideUpdateOne) SetNillableRevenue(f *float64) *RideUpdateOne

SetNillableRevenue sets the "revenue" field if the given value is not nil.

func (*RideUpdateOne) SetNillableRiderID

func (ruo *RideUpdateOne) SetNillableRiderID(u *uuid.UUID) *RideUpdateOne

SetNillableRiderID sets the "rider_id" field if the given value is not nil.

func (*RideUpdateOne) SetNillableStartAddress

func (ruo *RideUpdateOne) SetNillableStartAddress(s *string) *RideUpdateOne

SetNillableStartAddress sets the "start_address" field if the given value is not nil.

func (*RideUpdateOne) SetNillableStartTime

func (ruo *RideUpdateOne) SetNillableStartTime(t *time.Time) *RideUpdateOne

SetNillableStartTime sets the "start_time" field if the given value is not nil.

func (*RideUpdateOne) SetNillableUserID

func (ruo *RideUpdateOne) SetNillableUserID(id *uuid.UUID) *RideUpdateOne

SetNillableUserID sets the "user" edge to the User entity by ID if the given value is not nil.

func (*RideUpdateOne) SetNillableVehicleCity

func (ruo *RideUpdateOne) SetNillableVehicleCity(s *string) *RideUpdateOne

SetNillableVehicleCity sets the "vehicle_city" field if the given value is not nil.

func (*RideUpdateOne) SetNillableVehicleID

func (ruo *RideUpdateOne) SetNillableVehicleID(u *uuid.UUID) *RideUpdateOne

SetNillableVehicleID sets the "vehicle_id" field if the given value is not nil.

func (*RideUpdateOne) SetRevenue

func (ruo *RideUpdateOne) SetRevenue(f float64) *RideUpdateOne

SetRevenue sets the "revenue" field.

func (*RideUpdateOne) SetRiderID

func (ruo *RideUpdateOne) SetRiderID(u uuid.UUID) *RideUpdateOne

SetRiderID sets the "rider_id" field.

func (*RideUpdateOne) SetStartAddress

func (ruo *RideUpdateOne) SetStartAddress(s string) *RideUpdateOne

SetStartAddress sets the "start_address" field.

func (*RideUpdateOne) SetStartTime

func (ruo *RideUpdateOne) SetStartTime(t time.Time) *RideUpdateOne

SetStartTime sets the "start_time" field.

func (*RideUpdateOne) SetUser

func (ruo *RideUpdateOne) SetUser(u *User) *RideUpdateOne

SetUser sets the "user" edge to the User entity.

func (*RideUpdateOne) SetUserID

func (ruo *RideUpdateOne) SetUserID(id uuid.UUID) *RideUpdateOne

SetUserID sets the "user" edge to the User entity by ID.

func (*RideUpdateOne) SetVehicle

func (ruo *RideUpdateOne) SetVehicle(v *Vehicle) *RideUpdateOne

SetVehicle sets the "vehicle" edge to the Vehicle entity.

func (*RideUpdateOne) SetVehicleCity

func (ruo *RideUpdateOne) SetVehicleCity(s string) *RideUpdateOne

SetVehicleCity sets the "vehicle_city" field.

func (*RideUpdateOne) SetVehicleID

func (ruo *RideUpdateOne) SetVehicleID(u uuid.UUID) *RideUpdateOne

SetVehicleID sets the "vehicle_id" field.

type Rides

type Rides []*Ride

Rides is a parsable slice of Ride.

type RollbackFunc

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

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

func (RollbackFunc) Rollback

func (f RollbackFunc) Rollback(ctx context.Context, tx *Tx) error

Rollback calls f(ctx, m).

type RollbackHook

type RollbackHook func(Rollbacker) Rollbacker

RollbackHook defines the "rollback middleware". A function that gets a Rollbacker and returns a Rollbacker. For example:

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

type Rollbacker

type Rollbacker interface {
	Rollback(context.Context, *Tx) error
}

Rollbacker is the interface that wraps the Rollback method.

type TraverseFunc

type TraverseFunc = ent.TraverseFunc

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

type Traverser

type Traverser = ent.Traverser

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

type Tx

type Tx struct {

	// Ride is the client for interacting with the Ride builders.
	Ride *RideClient
	// User is the client for interacting with the User builders.
	User *UserClient
	// UserPromoCode is the client for interacting with the UserPromoCode builders.
	UserPromoCode *UserPromoCodeClient
	// Vehicle is the client for interacting with the Vehicle builders.
	Vehicle *VehicleClient
	// VehicleLocationHistory is the client for interacting with the VehicleLocationHistory builders.
	VehicleLocationHistory *VehicleLocationHistoryClient
	// 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 User

type User struct {

	// ID of the ent.
	ID uuid.UUID `json:"id,omitempty"`
	// City holds the value of the "city" field.
	City string `json:"city,omitempty"`
	// Name holds the value of the "name" field.
	Name string `json:"name,omitempty"`
	// Address holds the value of the "address" field.
	Address string `json:"address,omitempty"`
	// CreditCard holds the value of the "credit_card" field.
	CreditCard string `json:"credit_card,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the UserQuery when eager-loading is set.
	Edges UserEdges `json:"edges"`
	// contains filtered or unexported fields
}

User is the model entity for the User schema.

func (*User) QueryRides

func (u *User) QueryRides() *RideQuery

QueryRides queries the "rides" edge of the User entity.

func (*User) QueryUserPromoCodes

func (u *User) QueryUserPromoCodes() *UserPromoCodeQuery

QueryUserPromoCodes queries the "user_promo_codes" edge of the User entity.

func (*User) QueryVehicles

func (u *User) QueryVehicles() *VehicleQuery

QueryVehicles queries the "vehicles" edge of the User entity.

func (*User) String

func (u *User) String() string

String implements the fmt.Stringer.

func (*User) Unwrap

func (u *User) Unwrap() *User

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

func (u *User) Update() *UserUpdateOne

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

type UserClient

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

UserClient is a client for the User schema.

func NewUserClient

func NewUserClient(c config) *UserClient

NewUserClient returns a client for the User from the given config.

func (*UserClient) Create

func (c *UserClient) Create() *UserCreate

Create returns a builder for creating a User entity.

func (*UserClient) CreateBulk

func (c *UserClient) CreateBulk(builders ...*UserCreate) *UserCreateBulk

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

func (*UserClient) Delete

func (c *UserClient) Delete() *UserDelete

Delete returns a delete builder for User.

func (*UserClient) DeleteOne

func (c *UserClient) DeleteOne(u *User) *UserDeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*UserClient) DeleteOneID

func (c *UserClient) DeleteOneID(id uuid.UUID) *UserDeleteOne

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

func (*UserClient) Get

func (c *UserClient) Get(ctx context.Context, id uuid.UUID) (*User, error)

Get returns a User entity by its id.

func (*UserClient) GetX

func (c *UserClient) GetX(ctx context.Context, id uuid.UUID) *User

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

func (*UserClient) Hooks

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

Hooks returns the client hooks.

func (*UserClient) Intercept

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

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

func (*UserClient) Interceptors

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

Interceptors returns the client interceptors.

func (*UserClient) Query

func (c *UserClient) Query() *UserQuery

Query returns a query builder for User.

func (*UserClient) QueryRides

func (c *UserClient) QueryRides(u *User) *RideQuery

QueryRides queries the rides edge of a User.

func (*UserClient) QueryUserPromoCodes

func (c *UserClient) QueryUserPromoCodes(u *User) *UserPromoCodeQuery

QueryUserPromoCodes queries the user_promo_codes edge of a User.

func (*UserClient) QueryVehicles

func (c *UserClient) QueryVehicles(u *User) *VehicleQuery

QueryVehicles queries the vehicles edge of a User.

func (*UserClient) Update

func (c *UserClient) Update() *UserUpdate

Update returns an update builder for User.

func (*UserClient) UpdateOne

func (c *UserClient) UpdateOne(u *User) *UserUpdateOne

UpdateOne returns an update builder for the given entity.

func (*UserClient) UpdateOneID

func (c *UserClient) UpdateOneID(id uuid.UUID) *UserUpdateOne

UpdateOneID returns an update builder for the given id.

func (*UserClient) Use

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

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

type UserCreate

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

UserCreate is the builder for creating a User entity.

func (*UserCreate) AddRideIDs

func (uc *UserCreate) AddRideIDs(ids ...uuid.UUID) *UserCreate

AddRideIDs adds the "rides" edge to the Ride entity by IDs.

func (*UserCreate) AddRides

func (uc *UserCreate) AddRides(r ...*Ride) *UserCreate

AddRides adds the "rides" edges to the Ride entity.

func (*UserCreate) AddUserPromoCodeIDs

func (uc *UserCreate) AddUserPromoCodeIDs(ids ...uuid.UUID) *UserCreate

AddUserPromoCodeIDs adds the "user_promo_codes" edge to the UserPromoCode entity by IDs.

func (*UserCreate) AddUserPromoCodes

func (uc *UserCreate) AddUserPromoCodes(u ...*UserPromoCode) *UserCreate

AddUserPromoCodes adds the "user_promo_codes" edges to the UserPromoCode entity.

func (*UserCreate) AddVehicleIDs

func (uc *UserCreate) AddVehicleIDs(ids ...uuid.UUID) *UserCreate

AddVehicleIDs adds the "vehicles" edge to the Vehicle entity by IDs.

func (*UserCreate) AddVehicles

func (uc *UserCreate) AddVehicles(v ...*Vehicle) *UserCreate

AddVehicles adds the "vehicles" edges to the Vehicle entity.

func (*UserCreate) Exec

func (uc *UserCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*UserCreate) ExecX

func (uc *UserCreate) ExecX(ctx context.Context)

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

func (*UserCreate) Mutation

func (uc *UserCreate) Mutation() *UserMutation

Mutation returns the UserMutation object of the builder.

func (*UserCreate) Save

func (uc *UserCreate) Save(ctx context.Context) (*User, error)

Save creates the User in the database.

func (*UserCreate) SaveX

func (uc *UserCreate) SaveX(ctx context.Context) *User

SaveX calls Save and panics if Save returns an error.

func (*UserCreate) SetAddress

func (uc *UserCreate) SetAddress(s string) *UserCreate

SetAddress sets the "address" field.

func (*UserCreate) SetCity

func (uc *UserCreate) SetCity(s string) *UserCreate

SetCity sets the "city" field.

func (*UserCreate) SetCreditCard

func (uc *UserCreate) SetCreditCard(s string) *UserCreate

SetCreditCard sets the "credit_card" field.

func (*UserCreate) SetID

func (uc *UserCreate) SetID(u uuid.UUID) *UserCreate

SetID sets the "id" field.

func (*UserCreate) SetName

func (uc *UserCreate) SetName(s string) *UserCreate

SetName sets the "name" field.

func (*UserCreate) SetNillableAddress

func (uc *UserCreate) SetNillableAddress(s *string) *UserCreate

SetNillableAddress sets the "address" field if the given value is not nil.

func (*UserCreate) SetNillableCreditCard

func (uc *UserCreate) SetNillableCreditCard(s *string) *UserCreate

SetNillableCreditCard sets the "credit_card" field if the given value is not nil.

func (*UserCreate) SetNillableID

func (uc *UserCreate) SetNillableID(u *uuid.UUID) *UserCreate

SetNillableID sets the "id" field if the given value is not nil.

func (*UserCreate) SetNillableName

func (uc *UserCreate) SetNillableName(s *string) *UserCreate

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

type UserCreateBulk

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

UserCreateBulk is the builder for creating many User entities in bulk.

func (*UserCreateBulk) Exec

func (ucb *UserCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*UserCreateBulk) ExecX

func (ucb *UserCreateBulk) ExecX(ctx context.Context)

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

func (*UserCreateBulk) Save

func (ucb *UserCreateBulk) Save(ctx context.Context) ([]*User, error)

Save creates the User entities in the database.

func (*UserCreateBulk) SaveX

func (ucb *UserCreateBulk) SaveX(ctx context.Context) []*User

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

type UserDelete

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

UserDelete is the builder for deleting a User entity.

func (*UserDelete) Exec

func (ud *UserDelete) Exec(ctx context.Context) (int, error)

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

func (*UserDelete) ExecX

func (ud *UserDelete) ExecX(ctx context.Context) int

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

func (*UserDelete) Where

func (ud *UserDelete) Where(ps ...predicate.User) *UserDelete

Where appends a list predicates to the UserDelete builder.

type UserDeleteOne

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

UserDeleteOne is the builder for deleting a single User entity.

func (*UserDeleteOne) Exec

func (udo *UserDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*UserDeleteOne) ExecX

func (udo *UserDeleteOne) ExecX(ctx context.Context)

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

func (*UserDeleteOne) Where

func (udo *UserDeleteOne) Where(ps ...predicate.User) *UserDeleteOne

Where appends a list predicates to the UserDelete builder.

type UserEdges

type UserEdges struct {
	// Vehicles holds the value of the vehicles edge.
	Vehicles []*Vehicle `json:"vehicles,omitempty"`
	// Rides holds the value of the rides edge.
	Rides []*Ride `json:"rides,omitempty"`
	// UserPromoCodes holds the value of the user_promo_codes edge.
	UserPromoCodes []*UserPromoCode `json:"user_promo_codes,omitempty"`
	// contains filtered or unexported fields
}

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

func (UserEdges) RidesOrErr

func (e UserEdges) RidesOrErr() ([]*Ride, error)

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

func (UserEdges) UserPromoCodesOrErr

func (e UserEdges) UserPromoCodesOrErr() ([]*UserPromoCode, error)

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

func (UserEdges) VehiclesOrErr

func (e UserEdges) VehiclesOrErr() ([]*Vehicle, error)

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

type UserGroupBy

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

UserGroupBy is the group-by builder for User entities.

func (*UserGroupBy) Aggregate

func (ugb *UserGroupBy) Aggregate(fns ...AggregateFunc) *UserGroupBy

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

func (*UserGroupBy) Bool

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

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

func (*UserGroupBy) BoolX

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

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

func (*UserGroupBy) Bools

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

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

func (*UserGroupBy) BoolsX

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

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

func (*UserGroupBy) Float64

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

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

func (*UserGroupBy) Float64X

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

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

func (*UserGroupBy) Float64s

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

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

func (*UserGroupBy) Float64sX

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

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

func (*UserGroupBy) Int

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

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

func (*UserGroupBy) IntX

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

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

func (*UserGroupBy) Ints

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

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

func (*UserGroupBy) IntsX

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

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

func (*UserGroupBy) Scan

func (ugb *UserGroupBy) Scan(ctx context.Context, v any) error

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

func (*UserGroupBy) ScanX

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

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

func (*UserGroupBy) String

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

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

func (*UserGroupBy) StringX

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

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

func (*UserGroupBy) Strings

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

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

func (*UserGroupBy) StringsX

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

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

type UserMutation

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

UserMutation represents an operation that mutates the User nodes in the graph.

func (*UserMutation) AddField

func (m *UserMutation) 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 (*UserMutation) AddRideIDs

func (m *UserMutation) AddRideIDs(ids ...uuid.UUID)

AddRideIDs adds the "rides" edge to the Ride entity by ids.

func (*UserMutation) AddUserPromoCodeIDs

func (m *UserMutation) AddUserPromoCodeIDs(ids ...uuid.UUID)

AddUserPromoCodeIDs adds the "user_promo_codes" edge to the UserPromoCode entity by ids.

func (*UserMutation) AddVehicleIDs

func (m *UserMutation) AddVehicleIDs(ids ...uuid.UUID)

AddVehicleIDs adds the "vehicles" edge to the Vehicle entity by ids.

func (*UserMutation) AddedEdges

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

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

func (*UserMutation) AddedField

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

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

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

func (*UserMutation) AddedIDs

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

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

func (*UserMutation) Address

func (m *UserMutation) Address() (r string, exists bool)

Address returns the value of the "address" field in the mutation.

func (*UserMutation) AddressCleared

func (m *UserMutation) AddressCleared() bool

AddressCleared returns if the "address" field was cleared in this mutation.

func (*UserMutation) City

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

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

func (*UserMutation) ClearAddress

func (m *UserMutation) ClearAddress()

ClearAddress clears the value of the "address" field.

func (*UserMutation) ClearCreditCard

func (m *UserMutation) ClearCreditCard()

ClearCreditCard clears the value of the "credit_card" field.

func (*UserMutation) ClearEdge

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

func (m *UserMutation) 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 (*UserMutation) ClearName

func (m *UserMutation) ClearName()

ClearName clears the value of the "name" field.

func (*UserMutation) ClearRides

func (m *UserMutation) ClearRides()

ClearRides clears the "rides" edge to the Ride entity.

func (*UserMutation) ClearUserPromoCodes

func (m *UserMutation) ClearUserPromoCodes()

ClearUserPromoCodes clears the "user_promo_codes" edge to the UserPromoCode entity.

func (*UserMutation) ClearVehicles

func (m *UserMutation) ClearVehicles()

ClearVehicles clears the "vehicles" edge to the Vehicle entity.

func (*UserMutation) ClearedEdges

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

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

func (*UserMutation) ClearedFields

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

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

func (UserMutation) Client

func (m UserMutation) 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 (*UserMutation) CreditCard

func (m *UserMutation) CreditCard() (r string, exists bool)

CreditCard returns the value of the "credit_card" field in the mutation.

func (*UserMutation) CreditCardCleared

func (m *UserMutation) CreditCardCleared() bool

CreditCardCleared returns if the "credit_card" field was cleared in this mutation.

func (*UserMutation) EdgeCleared

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

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

func (*UserMutation) Field

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

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

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

func (*UserMutation) Fields

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

func (m *UserMutation) ID() (id uuid.UUID, 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 (*UserMutation) IDs

func (m *UserMutation) IDs(ctx context.Context) ([]uuid.UUID, error)

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

func (*UserMutation) Name

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

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

func (*UserMutation) NameCleared

func (m *UserMutation) NameCleared() bool

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

func (*UserMutation) OldAddress

func (m *UserMutation) OldAddress(ctx context.Context) (v string, err error)

OldAddress returns the old "address" field's value of the User entity. If the User 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 (*UserMutation) OldCity

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

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

func (m *UserMutation) OldCreditCard(ctx context.Context) (v string, err error)

OldCreditCard returns the old "credit_card" field's value of the User entity. If the User 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 (*UserMutation) OldField

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

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

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

func (m *UserMutation) Op() Op

Op returns the operation name.

func (*UserMutation) RemoveRideIDs

func (m *UserMutation) RemoveRideIDs(ids ...uuid.UUID)

RemoveRideIDs removes the "rides" edge to the Ride entity by IDs.

func (*UserMutation) RemoveUserPromoCodeIDs

func (m *UserMutation) RemoveUserPromoCodeIDs(ids ...uuid.UUID)

RemoveUserPromoCodeIDs removes the "user_promo_codes" edge to the UserPromoCode entity by IDs.

func (*UserMutation) RemoveVehicleIDs

func (m *UserMutation) RemoveVehicleIDs(ids ...uuid.UUID)

RemoveVehicleIDs removes the "vehicles" edge to the Vehicle entity by IDs.

func (*UserMutation) RemovedEdges

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

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

func (*UserMutation) RemovedIDs

func (m *UserMutation) 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 (*UserMutation) RemovedRidesIDs

func (m *UserMutation) RemovedRidesIDs() (ids []uuid.UUID)

RemovedRides returns the removed IDs of the "rides" edge to the Ride entity.

func (*UserMutation) RemovedUserPromoCodesIDs

func (m *UserMutation) RemovedUserPromoCodesIDs() (ids []uuid.UUID)

RemovedUserPromoCodes returns the removed IDs of the "user_promo_codes" edge to the UserPromoCode entity.

func (*UserMutation) RemovedVehiclesIDs

func (m *UserMutation) RemovedVehiclesIDs() (ids []uuid.UUID)

RemovedVehicles returns the removed IDs of the "vehicles" edge to the Vehicle entity.

func (*UserMutation) ResetAddress

func (m *UserMutation) ResetAddress()

ResetAddress resets all changes to the "address" field.

func (*UserMutation) ResetCity

func (m *UserMutation) ResetCity()

ResetCity resets all changes to the "city" field.

func (*UserMutation) ResetCreditCard

func (m *UserMutation) ResetCreditCard()

ResetCreditCard resets all changes to the "credit_card" field.

func (*UserMutation) ResetEdge

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

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

func (m *UserMutation) ResetName()

ResetName resets all changes to the "name" field.

func (*UserMutation) ResetRides

func (m *UserMutation) ResetRides()

ResetRides resets all changes to the "rides" edge.

func (*UserMutation) ResetUserPromoCodes

func (m *UserMutation) ResetUserPromoCodes()

ResetUserPromoCodes resets all changes to the "user_promo_codes" edge.

func (*UserMutation) ResetVehicles

func (m *UserMutation) ResetVehicles()

ResetVehicles resets all changes to the "vehicles" edge.

func (*UserMutation) RidesCleared

func (m *UserMutation) RidesCleared() bool

RidesCleared reports if the "rides" edge to the Ride entity was cleared.

func (*UserMutation) RidesIDs

func (m *UserMutation) RidesIDs() (ids []uuid.UUID)

RidesIDs returns the "rides" edge IDs in the mutation.

func (*UserMutation) SetAddress

func (m *UserMutation) SetAddress(s string)

SetAddress sets the "address" field.

func (*UserMutation) SetCity

func (m *UserMutation) SetCity(s string)

SetCity sets the "city" field.

func (*UserMutation) SetCreditCard

func (m *UserMutation) SetCreditCard(s string)

SetCreditCard sets the "credit_card" field.

func (*UserMutation) SetField

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

func (m *UserMutation) SetID(id uuid.UUID)

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

func (*UserMutation) SetName

func (m *UserMutation) SetName(s string)

SetName sets the "name" field.

func (*UserMutation) SetOp

func (m *UserMutation) SetOp(op Op)

SetOp allows setting the mutation operation.

func (UserMutation) Tx

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

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

func (*UserMutation) Type

func (m *UserMutation) Type() string

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

func (*UserMutation) UserPromoCodesCleared

func (m *UserMutation) UserPromoCodesCleared() bool

UserPromoCodesCleared reports if the "user_promo_codes" edge to the UserPromoCode entity was cleared.

func (*UserMutation) UserPromoCodesIDs

func (m *UserMutation) UserPromoCodesIDs() (ids []uuid.UUID)

UserPromoCodesIDs returns the "user_promo_codes" edge IDs in the mutation.

func (*UserMutation) VehiclesCleared

func (m *UserMutation) VehiclesCleared() bool

VehiclesCleared reports if the "vehicles" edge to the Vehicle entity was cleared.

func (*UserMutation) VehiclesIDs

func (m *UserMutation) VehiclesIDs() (ids []uuid.UUID)

VehiclesIDs returns the "vehicles" edge IDs in the mutation.

func (*UserMutation) Where

func (m *UserMutation) Where(ps ...predicate.User)

Where appends a list predicates to the UserMutation builder.

func (*UserMutation) WhereP

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

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

type UserPromoCode

type UserPromoCode struct {

	// ID of the ent.
	ID uuid.UUID `json:"id,omitempty"`
	// City holds the value of the "city" field.
	City string `json:"city,omitempty"`
	// UserID holds the value of the "user_id" field.
	UserID uuid.UUID `json:"user_id,omitempty"`
	// Code holds the value of the "code" field.
	Code string `json:"code,omitempty"`
	// Timestamp holds the value of the "timestamp" field.
	Timestamp time.Time `json:"timestamp,omitempty"`
	// UsageCount holds the value of the "usage_count" field.
	UsageCount int `json:"usage_count,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the UserPromoCodeQuery when eager-loading is set.
	Edges UserPromoCodeEdges `json:"edges"`
	// contains filtered or unexported fields
}

UserPromoCode is the model entity for the UserPromoCode schema.

func (*UserPromoCode) QueryUser

func (upc *UserPromoCode) QueryUser() *UserQuery

QueryUser queries the "user" edge of the UserPromoCode entity.

func (*UserPromoCode) String

func (upc *UserPromoCode) String() string

String implements the fmt.Stringer.

func (*UserPromoCode) Unwrap

func (upc *UserPromoCode) Unwrap() *UserPromoCode

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

func (upc *UserPromoCode) Update() *UserPromoCodeUpdateOne

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

type UserPromoCodeClient

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

UserPromoCodeClient is a client for the UserPromoCode schema.

func NewUserPromoCodeClient

func NewUserPromoCodeClient(c config) *UserPromoCodeClient

NewUserPromoCodeClient returns a client for the UserPromoCode from the given config.

func (*UserPromoCodeClient) Create

Create returns a builder for creating a UserPromoCode entity.

func (*UserPromoCodeClient) CreateBulk

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

func (*UserPromoCodeClient) Delete

Delete returns a delete builder for UserPromoCode.

func (*UserPromoCodeClient) DeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*UserPromoCodeClient) DeleteOneID

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

func (*UserPromoCodeClient) Get

Get returns a UserPromoCode entity by its id.

func (*UserPromoCodeClient) GetX

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

func (*UserPromoCodeClient) Hooks

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

Hooks returns the client hooks.

func (*UserPromoCodeClient) Intercept

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

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

func (*UserPromoCodeClient) Interceptors

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

Interceptors returns the client interceptors.

func (*UserPromoCodeClient) Query

Query returns a query builder for UserPromoCode.

func (*UserPromoCodeClient) QueryUser

func (c *UserPromoCodeClient) QueryUser(upc *UserPromoCode) *UserQuery

QueryUser queries the user edge of a UserPromoCode.

func (*UserPromoCodeClient) Update

Update returns an update builder for UserPromoCode.

func (*UserPromoCodeClient) UpdateOne

UpdateOne returns an update builder for the given entity.

func (*UserPromoCodeClient) UpdateOneID

UpdateOneID returns an update builder for the given id.

func (*UserPromoCodeClient) Use

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

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

type UserPromoCodeCreate

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

UserPromoCodeCreate is the builder for creating a UserPromoCode entity.

func (*UserPromoCodeCreate) Exec

func (upcc *UserPromoCodeCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*UserPromoCodeCreate) ExecX

func (upcc *UserPromoCodeCreate) ExecX(ctx context.Context)

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

func (*UserPromoCodeCreate) Mutation

func (upcc *UserPromoCodeCreate) Mutation() *UserPromoCodeMutation

Mutation returns the UserPromoCodeMutation object of the builder.

func (*UserPromoCodeCreate) Save

Save creates the UserPromoCode in the database.

func (*UserPromoCodeCreate) SaveX

SaveX calls Save and panics if Save returns an error.

func (*UserPromoCodeCreate) SetCity

SetCity sets the "city" field.

func (*UserPromoCodeCreate) SetCode

SetCode sets the "code" field.

func (*UserPromoCodeCreate) SetID

SetID sets the "id" field.

func (*UserPromoCodeCreate) SetNillableID

func (upcc *UserPromoCodeCreate) SetNillableID(u *uuid.UUID) *UserPromoCodeCreate

SetNillableID sets the "id" field if the given value is not nil.

func (*UserPromoCodeCreate) SetNillableTimestamp

func (upcc *UserPromoCodeCreate) SetNillableTimestamp(t *time.Time) *UserPromoCodeCreate

SetNillableTimestamp sets the "timestamp" field if the given value is not nil.

func (*UserPromoCodeCreate) SetNillableUsageCount

func (upcc *UserPromoCodeCreate) SetNillableUsageCount(i *int) *UserPromoCodeCreate

SetNillableUsageCount sets the "usage_count" field if the given value is not nil.

func (*UserPromoCodeCreate) SetTimestamp

func (upcc *UserPromoCodeCreate) SetTimestamp(t time.Time) *UserPromoCodeCreate

SetTimestamp sets the "timestamp" field.

func (*UserPromoCodeCreate) SetUsageCount

func (upcc *UserPromoCodeCreate) SetUsageCount(i int) *UserPromoCodeCreate

SetUsageCount sets the "usage_count" field.

func (*UserPromoCodeCreate) SetUser

func (upcc *UserPromoCodeCreate) SetUser(u *User) *UserPromoCodeCreate

SetUser sets the "user" edge to the User entity.

func (*UserPromoCodeCreate) SetUserID

func (upcc *UserPromoCodeCreate) SetUserID(u uuid.UUID) *UserPromoCodeCreate

SetUserID sets the "user_id" field.

type UserPromoCodeCreateBulk

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

UserPromoCodeCreateBulk is the builder for creating many UserPromoCode entities in bulk.

func (*UserPromoCodeCreateBulk) Exec

func (upccb *UserPromoCodeCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*UserPromoCodeCreateBulk) ExecX

func (upccb *UserPromoCodeCreateBulk) ExecX(ctx context.Context)

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

func (*UserPromoCodeCreateBulk) Save

Save creates the UserPromoCode entities in the database.

func (*UserPromoCodeCreateBulk) SaveX

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

type UserPromoCodeDelete

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

UserPromoCodeDelete is the builder for deleting a UserPromoCode entity.

func (*UserPromoCodeDelete) Exec

func (upcd *UserPromoCodeDelete) Exec(ctx context.Context) (int, error)

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

func (*UserPromoCodeDelete) ExecX

func (upcd *UserPromoCodeDelete) ExecX(ctx context.Context) int

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

func (*UserPromoCodeDelete) Where

Where appends a list predicates to the UserPromoCodeDelete builder.

type UserPromoCodeDeleteOne

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

UserPromoCodeDeleteOne is the builder for deleting a single UserPromoCode entity.

func (*UserPromoCodeDeleteOne) Exec

func (upcdo *UserPromoCodeDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*UserPromoCodeDeleteOne) ExecX

func (upcdo *UserPromoCodeDeleteOne) ExecX(ctx context.Context)

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

func (*UserPromoCodeDeleteOne) Where

Where appends a list predicates to the UserPromoCodeDelete builder.

type UserPromoCodeEdges

type UserPromoCodeEdges struct {
	// User holds the value of the user edge.
	User *User `json:"user,omitempty"`
	// contains filtered or unexported fields
}

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

func (UserPromoCodeEdges) UserOrErr

func (e UserPromoCodeEdges) UserOrErr() (*User, error)

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

type UserPromoCodeGroupBy

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

UserPromoCodeGroupBy is the group-by builder for UserPromoCode entities.

func (*UserPromoCodeGroupBy) Aggregate

func (upcgb *UserPromoCodeGroupBy) Aggregate(fns ...AggregateFunc) *UserPromoCodeGroupBy

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

func (*UserPromoCodeGroupBy) Bool

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

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

func (*UserPromoCodeGroupBy) BoolX

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

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

func (*UserPromoCodeGroupBy) Bools

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

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

func (*UserPromoCodeGroupBy) BoolsX

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

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

func (*UserPromoCodeGroupBy) Float64

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

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

func (*UserPromoCodeGroupBy) Float64X

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

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

func (*UserPromoCodeGroupBy) Float64s

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

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

func (*UserPromoCodeGroupBy) Float64sX

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

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

func (*UserPromoCodeGroupBy) Int

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

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

func (*UserPromoCodeGroupBy) IntX

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

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

func (*UserPromoCodeGroupBy) Ints

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

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

func (*UserPromoCodeGroupBy) IntsX

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

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

func (*UserPromoCodeGroupBy) Scan

func (upcgb *UserPromoCodeGroupBy) Scan(ctx context.Context, v any) error

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

func (*UserPromoCodeGroupBy) ScanX

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

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

func (*UserPromoCodeGroupBy) String

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

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

func (*UserPromoCodeGroupBy) StringX

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

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

func (*UserPromoCodeGroupBy) Strings

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

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

func (*UserPromoCodeGroupBy) StringsX

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

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

type UserPromoCodeMutation

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

UserPromoCodeMutation represents an operation that mutates the UserPromoCode nodes in the graph.

func (*UserPromoCodeMutation) AddField

func (m *UserPromoCodeMutation) 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 (*UserPromoCodeMutation) AddUsageCount

func (m *UserPromoCodeMutation) AddUsageCount(i int)

AddUsageCount adds i to the "usage_count" field.

func (*UserPromoCodeMutation) AddedEdges

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

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

func (*UserPromoCodeMutation) AddedField

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

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

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

func (*UserPromoCodeMutation) AddedIDs

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

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

func (*UserPromoCodeMutation) AddedUsageCount

func (m *UserPromoCodeMutation) AddedUsageCount() (r int, exists bool)

AddedUsageCount returns the value that was added to the "usage_count" field in this mutation.

func (*UserPromoCodeMutation) City

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

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

func (*UserPromoCodeMutation) ClearEdge

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

func (m *UserPromoCodeMutation) 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 (*UserPromoCodeMutation) ClearTimestamp

func (m *UserPromoCodeMutation) ClearTimestamp()

ClearTimestamp clears the value of the "timestamp" field.

func (*UserPromoCodeMutation) ClearUsageCount

func (m *UserPromoCodeMutation) ClearUsageCount()

ClearUsageCount clears the value of the "usage_count" field.

func (*UserPromoCodeMutation) ClearUser

func (m *UserPromoCodeMutation) ClearUser()

ClearUser clears the "user" edge to the User entity.

func (*UserPromoCodeMutation) ClearedEdges

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

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

func (*UserPromoCodeMutation) ClearedFields

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

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

func (UserPromoCodeMutation) Client

func (m UserPromoCodeMutation) 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 (*UserPromoCodeMutation) Code

func (m *UserPromoCodeMutation) Code() (r string, exists bool)

Code returns the value of the "code" field in the mutation.

func (*UserPromoCodeMutation) EdgeCleared

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

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

func (*UserPromoCodeMutation) Field

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

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

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

func (*UserPromoCodeMutation) Fields

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

func (m *UserPromoCodeMutation) ID() (id uuid.UUID, 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 (*UserPromoCodeMutation) IDs

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

func (*UserPromoCodeMutation) OldCity

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

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

func (m *UserPromoCodeMutation) OldCode(ctx context.Context) (v string, err error)

OldCode returns the old "code" field's value of the UserPromoCode entity. If the UserPromoCode 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 (*UserPromoCodeMutation) OldField

func (m *UserPromoCodeMutation) 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 (*UserPromoCodeMutation) OldTimestamp

func (m *UserPromoCodeMutation) OldTimestamp(ctx context.Context) (v time.Time, err error)

OldTimestamp returns the old "timestamp" field's value of the UserPromoCode entity. If the UserPromoCode 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 (*UserPromoCodeMutation) OldUsageCount

func (m *UserPromoCodeMutation) OldUsageCount(ctx context.Context) (v int, err error)

OldUsageCount returns the old "usage_count" field's value of the UserPromoCode entity. If the UserPromoCode 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 (*UserPromoCodeMutation) OldUserID

func (m *UserPromoCodeMutation) OldUserID(ctx context.Context) (v uuid.UUID, err error)

OldUserID returns the old "user_id" field's value of the UserPromoCode entity. If the UserPromoCode 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 (*UserPromoCodeMutation) Op

func (m *UserPromoCodeMutation) Op() Op

Op returns the operation name.

func (*UserPromoCodeMutation) RemovedEdges

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

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

func (*UserPromoCodeMutation) RemovedIDs

func (m *UserPromoCodeMutation) 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 (*UserPromoCodeMutation) ResetCity

func (m *UserPromoCodeMutation) ResetCity()

ResetCity resets all changes to the "city" field.

func (*UserPromoCodeMutation) ResetCode

func (m *UserPromoCodeMutation) ResetCode()

ResetCode resets all changes to the "code" field.

func (*UserPromoCodeMutation) ResetEdge

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

func (m *UserPromoCodeMutation) 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 (*UserPromoCodeMutation) ResetTimestamp

func (m *UserPromoCodeMutation) ResetTimestamp()

ResetTimestamp resets all changes to the "timestamp" field.

func (*UserPromoCodeMutation) ResetUsageCount

func (m *UserPromoCodeMutation) ResetUsageCount()

ResetUsageCount resets all changes to the "usage_count" field.

func (*UserPromoCodeMutation) ResetUser

func (m *UserPromoCodeMutation) ResetUser()

ResetUser resets all changes to the "user" edge.

func (*UserPromoCodeMutation) ResetUserID

func (m *UserPromoCodeMutation) ResetUserID()

ResetUserID resets all changes to the "user_id" field.

func (*UserPromoCodeMutation) SetCity

func (m *UserPromoCodeMutation) SetCity(s string)

SetCity sets the "city" field.

func (*UserPromoCodeMutation) SetCode

func (m *UserPromoCodeMutation) SetCode(s string)

SetCode sets the "code" field.

func (*UserPromoCodeMutation) SetField

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

func (m *UserPromoCodeMutation) SetID(id uuid.UUID)

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

func (*UserPromoCodeMutation) SetOp

func (m *UserPromoCodeMutation) SetOp(op Op)

SetOp allows setting the mutation operation.

func (*UserPromoCodeMutation) SetTimestamp

func (m *UserPromoCodeMutation) SetTimestamp(t time.Time)

SetTimestamp sets the "timestamp" field.

func (*UserPromoCodeMutation) SetUsageCount

func (m *UserPromoCodeMutation) SetUsageCount(i int)

SetUsageCount sets the "usage_count" field.

func (*UserPromoCodeMutation) SetUserID

func (m *UserPromoCodeMutation) SetUserID(u uuid.UUID)

SetUserID sets the "user_id" field.

func (*UserPromoCodeMutation) Timestamp

func (m *UserPromoCodeMutation) Timestamp() (r time.Time, exists bool)

Timestamp returns the value of the "timestamp" field in the mutation.

func (*UserPromoCodeMutation) TimestampCleared

func (m *UserPromoCodeMutation) TimestampCleared() bool

TimestampCleared returns if the "timestamp" field was cleared in this mutation.

func (UserPromoCodeMutation) Tx

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

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

func (*UserPromoCodeMutation) Type

func (m *UserPromoCodeMutation) Type() string

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

func (*UserPromoCodeMutation) UsageCount

func (m *UserPromoCodeMutation) UsageCount() (r int, exists bool)

UsageCount returns the value of the "usage_count" field in the mutation.

func (*UserPromoCodeMutation) UsageCountCleared

func (m *UserPromoCodeMutation) UsageCountCleared() bool

UsageCountCleared returns if the "usage_count" field was cleared in this mutation.

func (*UserPromoCodeMutation) UserCleared

func (m *UserPromoCodeMutation) UserCleared() bool

UserCleared reports if the "user" edge to the User entity was cleared.

func (*UserPromoCodeMutation) UserID

func (m *UserPromoCodeMutation) UserID() (r uuid.UUID, exists bool)

UserID returns the value of the "user_id" field in the mutation.

func (*UserPromoCodeMutation) UserIDs

func (m *UserPromoCodeMutation) UserIDs() (ids []uuid.UUID)

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

func (*UserPromoCodeMutation) Where

Where appends a list predicates to the UserPromoCodeMutation builder.

func (*UserPromoCodeMutation) WhereP

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

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

type UserPromoCodeQuery

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

UserPromoCodeQuery is the builder for querying UserPromoCode entities.

func (*UserPromoCodeQuery) Aggregate

func (upcq *UserPromoCodeQuery) Aggregate(fns ...AggregateFunc) *UserPromoCodeSelect

Aggregate returns a UserPromoCodeSelect configured with the given aggregations.

func (*UserPromoCodeQuery) All

func (upcq *UserPromoCodeQuery) All(ctx context.Context) ([]*UserPromoCode, error)

All executes the query and returns a list of UserPromoCodes.

func (*UserPromoCodeQuery) AllX

func (upcq *UserPromoCodeQuery) AllX(ctx context.Context) []*UserPromoCode

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

func (*UserPromoCodeQuery) Clone

func (upcq *UserPromoCodeQuery) Clone() *UserPromoCodeQuery

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

func (*UserPromoCodeQuery) Count

func (upcq *UserPromoCodeQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*UserPromoCodeQuery) CountX

func (upcq *UserPromoCodeQuery) CountX(ctx context.Context) int

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

func (*UserPromoCodeQuery) Exist

func (upcq *UserPromoCodeQuery) Exist(ctx context.Context) (bool, error)

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

func (*UserPromoCodeQuery) ExistX

func (upcq *UserPromoCodeQuery) ExistX(ctx context.Context) bool

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

func (*UserPromoCodeQuery) First

func (upcq *UserPromoCodeQuery) First(ctx context.Context) (*UserPromoCode, error)

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

func (*UserPromoCodeQuery) FirstID

func (upcq *UserPromoCodeQuery) FirstID(ctx context.Context) (id uuid.UUID, err error)

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

func (*UserPromoCodeQuery) FirstIDX

func (upcq *UserPromoCodeQuery) FirstIDX(ctx context.Context) uuid.UUID

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

func (*UserPromoCodeQuery) FirstX

func (upcq *UserPromoCodeQuery) FirstX(ctx context.Context) *UserPromoCode

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

func (*UserPromoCodeQuery) GroupBy

func (upcq *UserPromoCodeQuery) GroupBy(field string, fields ...string) *UserPromoCodeGroupBy

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

client.UserPromoCode.Query().
	GroupBy(userpromocode.FieldCity).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*UserPromoCodeQuery) IDs

func (upcq *UserPromoCodeQuery) IDs(ctx context.Context) ([]uuid.UUID, error)

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

func (*UserPromoCodeQuery) IDsX

func (upcq *UserPromoCodeQuery) IDsX(ctx context.Context) []uuid.UUID

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

func (*UserPromoCodeQuery) Limit

func (upcq *UserPromoCodeQuery) Limit(limit int) *UserPromoCodeQuery

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

func (*UserPromoCodeQuery) Offset

func (upcq *UserPromoCodeQuery) Offset(offset int) *UserPromoCodeQuery

Offset to start from.

func (*UserPromoCodeQuery) Only

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

func (*UserPromoCodeQuery) OnlyID

func (upcq *UserPromoCodeQuery) OnlyID(ctx context.Context) (id uuid.UUID, err error)

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

func (*UserPromoCodeQuery) OnlyIDX

func (upcq *UserPromoCodeQuery) OnlyIDX(ctx context.Context) uuid.UUID

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

func (*UserPromoCodeQuery) OnlyX

func (upcq *UserPromoCodeQuery) OnlyX(ctx context.Context) *UserPromoCode

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

func (*UserPromoCodeQuery) Order

func (upcq *UserPromoCodeQuery) Order(o ...OrderFunc) *UserPromoCodeQuery

Order specifies how the records should be ordered.

func (*UserPromoCodeQuery) QueryUser

func (upcq *UserPromoCodeQuery) QueryUser() *UserQuery

QueryUser chains the current query on the "user" edge.

func (*UserPromoCodeQuery) Select

func (upcq *UserPromoCodeQuery) Select(fields ...string) *UserPromoCodeSelect

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 {
	City string `json:"city,omitempty"`
}

client.UserPromoCode.Query().
	Select(userpromocode.FieldCity).
	Scan(ctx, &v)

func (*UserPromoCodeQuery) Unique

func (upcq *UserPromoCodeQuery) Unique(unique bool) *UserPromoCodeQuery

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

Where adds a new predicate for the UserPromoCodeQuery builder.

func (*UserPromoCodeQuery) WithUser

func (upcq *UserPromoCodeQuery) WithUser(opts ...func(*UserQuery)) *UserPromoCodeQuery

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

type UserPromoCodeSelect

type UserPromoCodeSelect struct {
	*UserPromoCodeQuery
	// contains filtered or unexported fields
}

UserPromoCodeSelect is the builder for selecting fields of UserPromoCode entities.

func (*UserPromoCodeSelect) Aggregate

func (upcs *UserPromoCodeSelect) Aggregate(fns ...AggregateFunc) *UserPromoCodeSelect

Aggregate adds the given aggregation functions to the selector query.

func (*UserPromoCodeSelect) Bool

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

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

func (*UserPromoCodeSelect) BoolX

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

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

func (*UserPromoCodeSelect) Bools

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

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

func (*UserPromoCodeSelect) BoolsX

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

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

func (*UserPromoCodeSelect) Float64

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

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

func (*UserPromoCodeSelect) Float64X

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

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

func (*UserPromoCodeSelect) Float64s

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

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

func (*UserPromoCodeSelect) Float64sX

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

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

func (*UserPromoCodeSelect) Int

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

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

func (*UserPromoCodeSelect) IntX

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

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

func (*UserPromoCodeSelect) Ints

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

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

func (*UserPromoCodeSelect) IntsX

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

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

func (*UserPromoCodeSelect) Scan

func (upcs *UserPromoCodeSelect) Scan(ctx context.Context, v any) error

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

func (*UserPromoCodeSelect) ScanX

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

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

func (*UserPromoCodeSelect) String

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

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

func (*UserPromoCodeSelect) StringX

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

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

func (*UserPromoCodeSelect) Strings

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

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

func (*UserPromoCodeSelect) StringsX

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

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

type UserPromoCodeUpdate

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

UserPromoCodeUpdate is the builder for updating UserPromoCode entities.

func (*UserPromoCodeUpdate) AddUsageCount

func (upcu *UserPromoCodeUpdate) AddUsageCount(i int) *UserPromoCodeUpdate

AddUsageCount adds i to the "usage_count" field.

func (*UserPromoCodeUpdate) ClearTimestamp

func (upcu *UserPromoCodeUpdate) ClearTimestamp() *UserPromoCodeUpdate

ClearTimestamp clears the value of the "timestamp" field.

func (*UserPromoCodeUpdate) ClearUsageCount

func (upcu *UserPromoCodeUpdate) ClearUsageCount() *UserPromoCodeUpdate

ClearUsageCount clears the value of the "usage_count" field.

func (*UserPromoCodeUpdate) ClearUser

func (upcu *UserPromoCodeUpdate) ClearUser() *UserPromoCodeUpdate

ClearUser clears the "user" edge to the User entity.

func (*UserPromoCodeUpdate) Exec

func (upcu *UserPromoCodeUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*UserPromoCodeUpdate) ExecX

func (upcu *UserPromoCodeUpdate) ExecX(ctx context.Context)

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

func (*UserPromoCodeUpdate) Mutation

func (upcu *UserPromoCodeUpdate) Mutation() *UserPromoCodeMutation

Mutation returns the UserPromoCodeMutation object of the builder.

func (*UserPromoCodeUpdate) Save

func (upcu *UserPromoCodeUpdate) Save(ctx context.Context) (int, error)

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

func (*UserPromoCodeUpdate) SaveX

func (upcu *UserPromoCodeUpdate) SaveX(ctx context.Context) int

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

func (*UserPromoCodeUpdate) SetCity

SetCity sets the "city" field.

func (*UserPromoCodeUpdate) SetCode

SetCode sets the "code" field.

func (*UserPromoCodeUpdate) SetNillableTimestamp

func (upcu *UserPromoCodeUpdate) SetNillableTimestamp(t *time.Time) *UserPromoCodeUpdate

SetNillableTimestamp sets the "timestamp" field if the given value is not nil.

func (*UserPromoCodeUpdate) SetNillableUsageCount

func (upcu *UserPromoCodeUpdate) SetNillableUsageCount(i *int) *UserPromoCodeUpdate

SetNillableUsageCount sets the "usage_count" field if the given value is not nil.

func (*UserPromoCodeUpdate) SetTimestamp

func (upcu *UserPromoCodeUpdate) SetTimestamp(t time.Time) *UserPromoCodeUpdate

SetTimestamp sets the "timestamp" field.

func (*UserPromoCodeUpdate) SetUsageCount

func (upcu *UserPromoCodeUpdate) SetUsageCount(i int) *UserPromoCodeUpdate

SetUsageCount sets the "usage_count" field.

func (*UserPromoCodeUpdate) SetUser

func (upcu *UserPromoCodeUpdate) SetUser(u *User) *UserPromoCodeUpdate

SetUser sets the "user" edge to the User entity.

func (*UserPromoCodeUpdate) SetUserID

func (upcu *UserPromoCodeUpdate) SetUserID(u uuid.UUID) *UserPromoCodeUpdate

SetUserID sets the "user_id" field.

func (*UserPromoCodeUpdate) Where

Where appends a list predicates to the UserPromoCodeUpdate builder.

type UserPromoCodeUpdateOne

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

UserPromoCodeUpdateOne is the builder for updating a single UserPromoCode entity.

func (*UserPromoCodeUpdateOne) AddUsageCount

func (upcuo *UserPromoCodeUpdateOne) AddUsageCount(i int) *UserPromoCodeUpdateOne

AddUsageCount adds i to the "usage_count" field.

func (*UserPromoCodeUpdateOne) ClearTimestamp

func (upcuo *UserPromoCodeUpdateOne) ClearTimestamp() *UserPromoCodeUpdateOne

ClearTimestamp clears the value of the "timestamp" field.

func (*UserPromoCodeUpdateOne) ClearUsageCount

func (upcuo *UserPromoCodeUpdateOne) ClearUsageCount() *UserPromoCodeUpdateOne

ClearUsageCount clears the value of the "usage_count" field.

func (*UserPromoCodeUpdateOne) ClearUser

func (upcuo *UserPromoCodeUpdateOne) ClearUser() *UserPromoCodeUpdateOne

ClearUser clears the "user" edge to the User entity.

func (*UserPromoCodeUpdateOne) Exec

func (upcuo *UserPromoCodeUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*UserPromoCodeUpdateOne) ExecX

func (upcuo *UserPromoCodeUpdateOne) ExecX(ctx context.Context)

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

func (*UserPromoCodeUpdateOne) Mutation

func (upcuo *UserPromoCodeUpdateOne) Mutation() *UserPromoCodeMutation

Mutation returns the UserPromoCodeMutation object of the builder.

func (*UserPromoCodeUpdateOne) Save

Save executes the query and returns the updated UserPromoCode entity.

func (*UserPromoCodeUpdateOne) SaveX

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

func (*UserPromoCodeUpdateOne) Select

func (upcuo *UserPromoCodeUpdateOne) Select(field string, fields ...string) *UserPromoCodeUpdateOne

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

func (*UserPromoCodeUpdateOne) SetCity

SetCity sets the "city" field.

func (*UserPromoCodeUpdateOne) SetCode

SetCode sets the "code" field.

func (*UserPromoCodeUpdateOne) SetNillableTimestamp

func (upcuo *UserPromoCodeUpdateOne) SetNillableTimestamp(t *time.Time) *UserPromoCodeUpdateOne

SetNillableTimestamp sets the "timestamp" field if the given value is not nil.

func (*UserPromoCodeUpdateOne) SetNillableUsageCount

func (upcuo *UserPromoCodeUpdateOne) SetNillableUsageCount(i *int) *UserPromoCodeUpdateOne

SetNillableUsageCount sets the "usage_count" field if the given value is not nil.

func (*UserPromoCodeUpdateOne) SetTimestamp

func (upcuo *UserPromoCodeUpdateOne) SetTimestamp(t time.Time) *UserPromoCodeUpdateOne

SetTimestamp sets the "timestamp" field.

func (*UserPromoCodeUpdateOne) SetUsageCount

func (upcuo *UserPromoCodeUpdateOne) SetUsageCount(i int) *UserPromoCodeUpdateOne

SetUsageCount sets the "usage_count" field.

func (*UserPromoCodeUpdateOne) SetUser

SetUser sets the "user" edge to the User entity.

func (*UserPromoCodeUpdateOne) SetUserID

SetUserID sets the "user_id" field.

type UserPromoCodes

type UserPromoCodes []*UserPromoCode

UserPromoCodes is a parsable slice of UserPromoCode.

type UserQuery

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

UserQuery is the builder for querying User entities.

func (*UserQuery) Aggregate

func (uq *UserQuery) Aggregate(fns ...AggregateFunc) *UserSelect

Aggregate returns a UserSelect configured with the given aggregations.

func (*UserQuery) All

func (uq *UserQuery) All(ctx context.Context) ([]*User, error)

All executes the query and returns a list of Users.

func (*UserQuery) AllX

func (uq *UserQuery) AllX(ctx context.Context) []*User

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

func (*UserQuery) Clone

func (uq *UserQuery) Clone() *UserQuery

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

func (*UserQuery) Count

func (uq *UserQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*UserQuery) CountX

func (uq *UserQuery) CountX(ctx context.Context) int

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

func (*UserQuery) Exist

func (uq *UserQuery) Exist(ctx context.Context) (bool, error)

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

func (*UserQuery) ExistX

func (uq *UserQuery) ExistX(ctx context.Context) bool

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

func (*UserQuery) First

func (uq *UserQuery) First(ctx context.Context) (*User, error)

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

func (*UserQuery) FirstID

func (uq *UserQuery) FirstID(ctx context.Context) (id uuid.UUID, err error)

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

func (*UserQuery) FirstIDX

func (uq *UserQuery) FirstIDX(ctx context.Context) uuid.UUID

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

func (*UserQuery) FirstX

func (uq *UserQuery) FirstX(ctx context.Context) *User

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

func (*UserQuery) GroupBy

func (uq *UserQuery) GroupBy(field string, fields ...string) *UserGroupBy

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

client.User.Query().
	GroupBy(user.FieldCity).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*UserQuery) IDs

func (uq *UserQuery) IDs(ctx context.Context) ([]uuid.UUID, error)

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

func (*UserQuery) IDsX

func (uq *UserQuery) IDsX(ctx context.Context) []uuid.UUID

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

func (*UserQuery) Limit

func (uq *UserQuery) Limit(limit int) *UserQuery

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

func (*UserQuery) Offset

func (uq *UserQuery) Offset(offset int) *UserQuery

Offset to start from.

func (*UserQuery) Only

func (uq *UserQuery) Only(ctx context.Context) (*User, error)

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

func (*UserQuery) OnlyID

func (uq *UserQuery) OnlyID(ctx context.Context) (id uuid.UUID, err error)

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

func (*UserQuery) OnlyIDX

func (uq *UserQuery) OnlyIDX(ctx context.Context) uuid.UUID

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

func (*UserQuery) OnlyX

func (uq *UserQuery) OnlyX(ctx context.Context) *User

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

func (*UserQuery) Order

func (uq *UserQuery) Order(o ...OrderFunc) *UserQuery

Order specifies how the records should be ordered.

func (*UserQuery) QueryRides

func (uq *UserQuery) QueryRides() *RideQuery

QueryRides chains the current query on the "rides" edge.

func (*UserQuery) QueryUserPromoCodes

func (uq *UserQuery) QueryUserPromoCodes() *UserPromoCodeQuery

QueryUserPromoCodes chains the current query on the "user_promo_codes" edge.

func (*UserQuery) QueryVehicles

func (uq *UserQuery) QueryVehicles() *VehicleQuery

QueryVehicles chains the current query on the "vehicles" edge.

func (*UserQuery) Select

func (uq *UserQuery) Select(fields ...string) *UserSelect

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 {
	City string `json:"city,omitempty"`
}

client.User.Query().
	Select(user.FieldCity).
	Scan(ctx, &v)

func (*UserQuery) Unique

func (uq *UserQuery) Unique(unique bool) *UserQuery

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

func (uq *UserQuery) Where(ps ...predicate.User) *UserQuery

Where adds a new predicate for the UserQuery builder.

func (*UserQuery) WithRides

func (uq *UserQuery) WithRides(opts ...func(*RideQuery)) *UserQuery

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

func (*UserQuery) WithUserPromoCodes

func (uq *UserQuery) WithUserPromoCodes(opts ...func(*UserPromoCodeQuery)) *UserQuery

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

func (*UserQuery) WithVehicles

func (uq *UserQuery) WithVehicles(opts ...func(*VehicleQuery)) *UserQuery

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

type UserSelect

type UserSelect struct {
	*UserQuery
	// contains filtered or unexported fields
}

UserSelect is the builder for selecting fields of User entities.

func (*UserSelect) Aggregate

func (us *UserSelect) Aggregate(fns ...AggregateFunc) *UserSelect

Aggregate adds the given aggregation functions to the selector query.

func (*UserSelect) Bool

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

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

func (*UserSelect) BoolX

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

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

func (*UserSelect) Bools

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

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

func (*UserSelect) BoolsX

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

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

func (*UserSelect) Float64

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

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

func (*UserSelect) Float64X

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

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

func (*UserSelect) Float64s

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

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

func (*UserSelect) Float64sX

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

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

func (*UserSelect) Int

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

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

func (*UserSelect) IntX

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

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

func (*UserSelect) Ints

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

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

func (*UserSelect) IntsX

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

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

func (*UserSelect) Scan

func (us *UserSelect) Scan(ctx context.Context, v any) error

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

func (*UserSelect) ScanX

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

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

func (*UserSelect) String

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

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

func (*UserSelect) StringX

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

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

func (*UserSelect) Strings

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

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

func (*UserSelect) StringsX

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

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

type UserUpdate

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

UserUpdate is the builder for updating User entities.

func (*UserUpdate) AddRideIDs

func (uu *UserUpdate) AddRideIDs(ids ...uuid.UUID) *UserUpdate

AddRideIDs adds the "rides" edge to the Ride entity by IDs.

func (*UserUpdate) AddRides

func (uu *UserUpdate) AddRides(r ...*Ride) *UserUpdate

AddRides adds the "rides" edges to the Ride entity.

func (*UserUpdate) AddUserPromoCodeIDs

func (uu *UserUpdate) AddUserPromoCodeIDs(ids ...uuid.UUID) *UserUpdate

AddUserPromoCodeIDs adds the "user_promo_codes" edge to the UserPromoCode entity by IDs.

func (*UserUpdate) AddUserPromoCodes

func (uu *UserUpdate) AddUserPromoCodes(u ...*UserPromoCode) *UserUpdate

AddUserPromoCodes adds the "user_promo_codes" edges to the UserPromoCode entity.

func (*UserUpdate) AddVehicleIDs

func (uu *UserUpdate) AddVehicleIDs(ids ...uuid.UUID) *UserUpdate

AddVehicleIDs adds the "vehicles" edge to the Vehicle entity by IDs.

func (*UserUpdate) AddVehicles

func (uu *UserUpdate) AddVehicles(v ...*Vehicle) *UserUpdate

AddVehicles adds the "vehicles" edges to the Vehicle entity.

func (*UserUpdate) ClearAddress

func (uu *UserUpdate) ClearAddress() *UserUpdate

ClearAddress clears the value of the "address" field.

func (*UserUpdate) ClearCreditCard

func (uu *UserUpdate) ClearCreditCard() *UserUpdate

ClearCreditCard clears the value of the "credit_card" field.

func (*UserUpdate) ClearName

func (uu *UserUpdate) ClearName() *UserUpdate

ClearName clears the value of the "name" field.

func (*UserUpdate) ClearRides

func (uu *UserUpdate) ClearRides() *UserUpdate

ClearRides clears all "rides" edges to the Ride entity.

func (*UserUpdate) ClearUserPromoCodes

func (uu *UserUpdate) ClearUserPromoCodes() *UserUpdate

ClearUserPromoCodes clears all "user_promo_codes" edges to the UserPromoCode entity.

func (*UserUpdate) ClearVehicles

func (uu *UserUpdate) ClearVehicles() *UserUpdate

ClearVehicles clears all "vehicles" edges to the Vehicle entity.

func (*UserUpdate) Exec

func (uu *UserUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*UserUpdate) ExecX

func (uu *UserUpdate) ExecX(ctx context.Context)

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

func (*UserUpdate) Mutation

func (uu *UserUpdate) Mutation() *UserMutation

Mutation returns the UserMutation object of the builder.

func (*UserUpdate) RemoveRideIDs

func (uu *UserUpdate) RemoveRideIDs(ids ...uuid.UUID) *UserUpdate

RemoveRideIDs removes the "rides" edge to Ride entities by IDs.

func (*UserUpdate) RemoveRides

func (uu *UserUpdate) RemoveRides(r ...*Ride) *UserUpdate

RemoveRides removes "rides" edges to Ride entities.

func (*UserUpdate) RemoveUserPromoCodeIDs

func (uu *UserUpdate) RemoveUserPromoCodeIDs(ids ...uuid.UUID) *UserUpdate

RemoveUserPromoCodeIDs removes the "user_promo_codes" edge to UserPromoCode entities by IDs.

func (*UserUpdate) RemoveUserPromoCodes

func (uu *UserUpdate) RemoveUserPromoCodes(u ...*UserPromoCode) *UserUpdate

RemoveUserPromoCodes removes "user_promo_codes" edges to UserPromoCode entities.

func (*UserUpdate) RemoveVehicleIDs

func (uu *UserUpdate) RemoveVehicleIDs(ids ...uuid.UUID) *UserUpdate

RemoveVehicleIDs removes the "vehicles" edge to Vehicle entities by IDs.

func (*UserUpdate) RemoveVehicles

func (uu *UserUpdate) RemoveVehicles(v ...*Vehicle) *UserUpdate

RemoveVehicles removes "vehicles" edges to Vehicle entities.

func (*UserUpdate) Save

func (uu *UserUpdate) Save(ctx context.Context) (int, error)

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

func (*UserUpdate) SaveX

func (uu *UserUpdate) SaveX(ctx context.Context) int

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

func (*UserUpdate) SetAddress

func (uu *UserUpdate) SetAddress(s string) *UserUpdate

SetAddress sets the "address" field.

func (*UserUpdate) SetCity

func (uu *UserUpdate) SetCity(s string) *UserUpdate

SetCity sets the "city" field.

func (*UserUpdate) SetCreditCard

func (uu *UserUpdate) SetCreditCard(s string) *UserUpdate

SetCreditCard sets the "credit_card" field.

func (*UserUpdate) SetName

func (uu *UserUpdate) SetName(s string) *UserUpdate

SetName sets the "name" field.

func (*UserUpdate) SetNillableAddress

func (uu *UserUpdate) SetNillableAddress(s *string) *UserUpdate

SetNillableAddress sets the "address" field if the given value is not nil.

func (*UserUpdate) SetNillableCreditCard

func (uu *UserUpdate) SetNillableCreditCard(s *string) *UserUpdate

SetNillableCreditCard sets the "credit_card" field if the given value is not nil.

func (*UserUpdate) SetNillableName

func (uu *UserUpdate) SetNillableName(s *string) *UserUpdate

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

func (*UserUpdate) Where

func (uu *UserUpdate) Where(ps ...predicate.User) *UserUpdate

Where appends a list predicates to the UserUpdate builder.

type UserUpdateOne

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

UserUpdateOne is the builder for updating a single User entity.

func (*UserUpdateOne) AddRideIDs

func (uuo *UserUpdateOne) AddRideIDs(ids ...uuid.UUID) *UserUpdateOne

AddRideIDs adds the "rides" edge to the Ride entity by IDs.

func (*UserUpdateOne) AddRides

func (uuo *UserUpdateOne) AddRides(r ...*Ride) *UserUpdateOne

AddRides adds the "rides" edges to the Ride entity.

func (*UserUpdateOne) AddUserPromoCodeIDs

func (uuo *UserUpdateOne) AddUserPromoCodeIDs(ids ...uuid.UUID) *UserUpdateOne

AddUserPromoCodeIDs adds the "user_promo_codes" edge to the UserPromoCode entity by IDs.

func (*UserUpdateOne) AddUserPromoCodes

func (uuo *UserUpdateOne) AddUserPromoCodes(u ...*UserPromoCode) *UserUpdateOne

AddUserPromoCodes adds the "user_promo_codes" edges to the UserPromoCode entity.

func (*UserUpdateOne) AddVehicleIDs

func (uuo *UserUpdateOne) AddVehicleIDs(ids ...uuid.UUID) *UserUpdateOne

AddVehicleIDs adds the "vehicles" edge to the Vehicle entity by IDs.

func (*UserUpdateOne) AddVehicles

func (uuo *UserUpdateOne) AddVehicles(v ...*Vehicle) *UserUpdateOne

AddVehicles adds the "vehicles" edges to the Vehicle entity.

func (*UserUpdateOne) ClearAddress

func (uuo *UserUpdateOne) ClearAddress() *UserUpdateOne

ClearAddress clears the value of the "address" field.

func (*UserUpdateOne) ClearCreditCard

func (uuo *UserUpdateOne) ClearCreditCard() *UserUpdateOne

ClearCreditCard clears the value of the "credit_card" field.

func (*UserUpdateOne) ClearName

func (uuo *UserUpdateOne) ClearName() *UserUpdateOne

ClearName clears the value of the "name" field.

func (*UserUpdateOne) ClearRides

func (uuo *UserUpdateOne) ClearRides() *UserUpdateOne

ClearRides clears all "rides" edges to the Ride entity.

func (*UserUpdateOne) ClearUserPromoCodes

func (uuo *UserUpdateOne) ClearUserPromoCodes() *UserUpdateOne

ClearUserPromoCodes clears all "user_promo_codes" edges to the UserPromoCode entity.

func (*UserUpdateOne) ClearVehicles

func (uuo *UserUpdateOne) ClearVehicles() *UserUpdateOne

ClearVehicles clears all "vehicles" edges to the Vehicle entity.

func (*UserUpdateOne) Exec

func (uuo *UserUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*UserUpdateOne) ExecX

func (uuo *UserUpdateOne) ExecX(ctx context.Context)

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

func (*UserUpdateOne) Mutation

func (uuo *UserUpdateOne) Mutation() *UserMutation

Mutation returns the UserMutation object of the builder.

func (*UserUpdateOne) RemoveRideIDs

func (uuo *UserUpdateOne) RemoveRideIDs(ids ...uuid.UUID) *UserUpdateOne

RemoveRideIDs removes the "rides" edge to Ride entities by IDs.

func (*UserUpdateOne) RemoveRides

func (uuo *UserUpdateOne) RemoveRides(r ...*Ride) *UserUpdateOne

RemoveRides removes "rides" edges to Ride entities.

func (*UserUpdateOne) RemoveUserPromoCodeIDs

func (uuo *UserUpdateOne) RemoveUserPromoCodeIDs(ids ...uuid.UUID) *UserUpdateOne

RemoveUserPromoCodeIDs removes the "user_promo_codes" edge to UserPromoCode entities by IDs.

func (*UserUpdateOne) RemoveUserPromoCodes

func (uuo *UserUpdateOne) RemoveUserPromoCodes(u ...*UserPromoCode) *UserUpdateOne

RemoveUserPromoCodes removes "user_promo_codes" edges to UserPromoCode entities.

func (*UserUpdateOne) RemoveVehicleIDs

func (uuo *UserUpdateOne) RemoveVehicleIDs(ids ...uuid.UUID) *UserUpdateOne

RemoveVehicleIDs removes the "vehicles" edge to Vehicle entities by IDs.

func (*UserUpdateOne) RemoveVehicles

func (uuo *UserUpdateOne) RemoveVehicles(v ...*Vehicle) *UserUpdateOne

RemoveVehicles removes "vehicles" edges to Vehicle entities.

func (*UserUpdateOne) Save

func (uuo *UserUpdateOne) Save(ctx context.Context) (*User, error)

Save executes the query and returns the updated User entity.

func (*UserUpdateOne) SaveX

func (uuo *UserUpdateOne) SaveX(ctx context.Context) *User

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

func (*UserUpdateOne) Select

func (uuo *UserUpdateOne) Select(field string, fields ...string) *UserUpdateOne

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

func (*UserUpdateOne) SetAddress

func (uuo *UserUpdateOne) SetAddress(s string) *UserUpdateOne

SetAddress sets the "address" field.

func (*UserUpdateOne) SetCity

func (uuo *UserUpdateOne) SetCity(s string) *UserUpdateOne

SetCity sets the "city" field.

func (*UserUpdateOne) SetCreditCard

func (uuo *UserUpdateOne) SetCreditCard(s string) *UserUpdateOne

SetCreditCard sets the "credit_card" field.

func (*UserUpdateOne) SetName

func (uuo *UserUpdateOne) SetName(s string) *UserUpdateOne

SetName sets the "name" field.

func (*UserUpdateOne) SetNillableAddress

func (uuo *UserUpdateOne) SetNillableAddress(s *string) *UserUpdateOne

SetNillableAddress sets the "address" field if the given value is not nil.

func (*UserUpdateOne) SetNillableCreditCard

func (uuo *UserUpdateOne) SetNillableCreditCard(s *string) *UserUpdateOne

SetNillableCreditCard sets the "credit_card" field if the given value is not nil.

func (*UserUpdateOne) SetNillableName

func (uuo *UserUpdateOne) SetNillableName(s *string) *UserUpdateOne

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

type Users

type Users []*User

Users is a parsable slice of User.

type ValidationError

type ValidationError struct {
	Name string // Field or edge name.
	// contains filtered or unexported fields
}

ValidationError returns when validating a field or edge fails.

func (*ValidationError) Error

func (e *ValidationError) Error() string

Error implements the error interface.

func (*ValidationError) Unwrap

func (e *ValidationError) Unwrap() error

Unwrap implements the errors.Wrapper interface.

type Value

type Value = ent.Value

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

type Vehicle

type Vehicle struct {

	// ID of the ent.
	ID uuid.UUID `json:"id,omitempty"`
	// City holds the value of the "city" field.
	City string `json:"city,omitempty"`
	// Type holds the value of the "type" field.
	Type string `json:"type,omitempty"`
	// OwnerID holds the value of the "owner_id" field.
	OwnerID uuid.UUID `json:"owner_id,omitempty"`
	// CreationTime holds the value of the "creation_time" field.
	CreationTime time.Time `json:"creation_time,omitempty"`
	// Status holds the value of the "status" field.
	Status string `json:"status,omitempty"`
	// CurrentLocation holds the value of the "current_location" field.
	CurrentLocation string `json:"current_location,omitempty"`
	// Ext holds the value of the "ext" field.
	Ext *map[string]interface{} `json:"ext,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the VehicleQuery when eager-loading is set.
	Edges VehicleEdges `json:"edges"`
	// contains filtered or unexported fields
}

Vehicle is the model entity for the Vehicle schema.

func (*Vehicle) QueryRides

func (v *Vehicle) QueryRides() *RideQuery

QueryRides queries the "rides" edge of the Vehicle entity.

func (*Vehicle) QueryUser

func (v *Vehicle) QueryUser() *UserQuery

QueryUser queries the "user" edge of the Vehicle entity.

func (*Vehicle) String

func (v *Vehicle) String() string

String implements the fmt.Stringer.

func (*Vehicle) Unwrap

func (v *Vehicle) Unwrap() *Vehicle

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

func (v *Vehicle) Update() *VehicleUpdateOne

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

type VehicleClient

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

VehicleClient is a client for the Vehicle schema.

func NewVehicleClient

func NewVehicleClient(c config) *VehicleClient

NewVehicleClient returns a client for the Vehicle from the given config.

func (*VehicleClient) Create

func (c *VehicleClient) Create() *VehicleCreate

Create returns a builder for creating a Vehicle entity.

func (*VehicleClient) CreateBulk

func (c *VehicleClient) CreateBulk(builders ...*VehicleCreate) *VehicleCreateBulk

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

func (*VehicleClient) Delete

func (c *VehicleClient) Delete() *VehicleDelete

Delete returns a delete builder for Vehicle.

func (*VehicleClient) DeleteOne

func (c *VehicleClient) DeleteOne(v *Vehicle) *VehicleDeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*VehicleClient) DeleteOneID

func (c *VehicleClient) DeleteOneID(id uuid.UUID) *VehicleDeleteOne

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

func (*VehicleClient) Get

func (c *VehicleClient) Get(ctx context.Context, id uuid.UUID) (*Vehicle, error)

Get returns a Vehicle entity by its id.

func (*VehicleClient) GetX

func (c *VehicleClient) GetX(ctx context.Context, id uuid.UUID) *Vehicle

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

func (*VehicleClient) Hooks

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

Hooks returns the client hooks.

func (*VehicleClient) Intercept

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

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

func (*VehicleClient) Interceptors

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

Interceptors returns the client interceptors.

func (*VehicleClient) Query

func (c *VehicleClient) Query() *VehicleQuery

Query returns a query builder for Vehicle.

func (*VehicleClient) QueryRides

func (c *VehicleClient) QueryRides(v *Vehicle) *RideQuery

QueryRides queries the rides edge of a Vehicle.

func (*VehicleClient) QueryUser

func (c *VehicleClient) QueryUser(v *Vehicle) *UserQuery

QueryUser queries the user edge of a Vehicle.

func (*VehicleClient) Update

func (c *VehicleClient) Update() *VehicleUpdate

Update returns an update builder for Vehicle.

func (*VehicleClient) UpdateOne

func (c *VehicleClient) UpdateOne(v *Vehicle) *VehicleUpdateOne

UpdateOne returns an update builder for the given entity.

func (*VehicleClient) UpdateOneID

func (c *VehicleClient) UpdateOneID(id uuid.UUID) *VehicleUpdateOne

UpdateOneID returns an update builder for the given id.

func (*VehicleClient) Use

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

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

type VehicleCreate

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

VehicleCreate is the builder for creating a Vehicle entity.

func (*VehicleCreate) AddRideIDs

func (vc *VehicleCreate) AddRideIDs(ids ...uuid.UUID) *VehicleCreate

AddRideIDs adds the "rides" edge to the Ride entity by IDs.

func (*VehicleCreate) AddRides

func (vc *VehicleCreate) AddRides(r ...*Ride) *VehicleCreate

AddRides adds the "rides" edges to the Ride entity.

func (*VehicleCreate) Exec

func (vc *VehicleCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*VehicleCreate) ExecX

func (vc *VehicleCreate) ExecX(ctx context.Context)

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

func (*VehicleCreate) Mutation

func (vc *VehicleCreate) Mutation() *VehicleMutation

Mutation returns the VehicleMutation object of the builder.

func (*VehicleCreate) Save

func (vc *VehicleCreate) Save(ctx context.Context) (*Vehicle, error)

Save creates the Vehicle in the database.

func (*VehicleCreate) SaveX

func (vc *VehicleCreate) SaveX(ctx context.Context) *Vehicle

SaveX calls Save and panics if Save returns an error.

func (*VehicleCreate) SetCity

func (vc *VehicleCreate) SetCity(s string) *VehicleCreate

SetCity sets the "city" field.

func (*VehicleCreate) SetCreationTime

func (vc *VehicleCreate) SetCreationTime(t time.Time) *VehicleCreate

SetCreationTime sets the "creation_time" field.

func (*VehicleCreate) SetCurrentLocation

func (vc *VehicleCreate) SetCurrentLocation(s string) *VehicleCreate

SetCurrentLocation sets the "current_location" field.

func (*VehicleCreate) SetExt

func (vc *VehicleCreate) SetExt(m *map[string]interface{}) *VehicleCreate

SetExt sets the "ext" field.

func (*VehicleCreate) SetID

func (vc *VehicleCreate) SetID(u uuid.UUID) *VehicleCreate

SetID sets the "id" field.

func (*VehicleCreate) SetNillableCreationTime

func (vc *VehicleCreate) SetNillableCreationTime(t *time.Time) *VehicleCreate

SetNillableCreationTime sets the "creation_time" field if the given value is not nil.

func (*VehicleCreate) SetNillableCurrentLocation

func (vc *VehicleCreate) SetNillableCurrentLocation(s *string) *VehicleCreate

SetNillableCurrentLocation sets the "current_location" field if the given value is not nil.

func (*VehicleCreate) SetNillableID

func (vc *VehicleCreate) SetNillableID(u *uuid.UUID) *VehicleCreate

SetNillableID sets the "id" field if the given value is not nil.

func (*VehicleCreate) SetNillableOwnerID

func (vc *VehicleCreate) SetNillableOwnerID(u *uuid.UUID) *VehicleCreate

SetNillableOwnerID sets the "owner_id" field if the given value is not nil.

func (*VehicleCreate) SetNillableStatus

func (vc *VehicleCreate) SetNillableStatus(s *string) *VehicleCreate

SetNillableStatus sets the "status" field if the given value is not nil.

func (*VehicleCreate) SetNillableType

func (vc *VehicleCreate) SetNillableType(s *string) *VehicleCreate

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

func (*VehicleCreate) SetNillableUserID

func (vc *VehicleCreate) SetNillableUserID(id *uuid.UUID) *VehicleCreate

SetNillableUserID sets the "user" edge to the User entity by ID if the given value is not nil.

func (*VehicleCreate) SetOwnerID

func (vc *VehicleCreate) SetOwnerID(u uuid.UUID) *VehicleCreate

SetOwnerID sets the "owner_id" field.

func (*VehicleCreate) SetStatus

func (vc *VehicleCreate) SetStatus(s string) *VehicleCreate

SetStatus sets the "status" field.

func (*VehicleCreate) SetType

func (vc *VehicleCreate) SetType(s string) *VehicleCreate

SetType sets the "type" field.

func (*VehicleCreate) SetUser

func (vc *VehicleCreate) SetUser(u *User) *VehicleCreate

SetUser sets the "user" edge to the User entity.

func (*VehicleCreate) SetUserID

func (vc *VehicleCreate) SetUserID(id uuid.UUID) *VehicleCreate

SetUserID sets the "user" edge to the User entity by ID.

type VehicleCreateBulk

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

VehicleCreateBulk is the builder for creating many Vehicle entities in bulk.

func (*VehicleCreateBulk) Exec

func (vcb *VehicleCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*VehicleCreateBulk) ExecX

func (vcb *VehicleCreateBulk) ExecX(ctx context.Context)

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

func (*VehicleCreateBulk) Save

func (vcb *VehicleCreateBulk) Save(ctx context.Context) ([]*Vehicle, error)

Save creates the Vehicle entities in the database.

func (*VehicleCreateBulk) SaveX

func (vcb *VehicleCreateBulk) SaveX(ctx context.Context) []*Vehicle

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

type VehicleDelete

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

VehicleDelete is the builder for deleting a Vehicle entity.

func (*VehicleDelete) Exec

func (vd *VehicleDelete) Exec(ctx context.Context) (int, error)

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

func (*VehicleDelete) ExecX

func (vd *VehicleDelete) ExecX(ctx context.Context) int

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

func (*VehicleDelete) Where

func (vd *VehicleDelete) Where(ps ...predicate.Vehicle) *VehicleDelete

Where appends a list predicates to the VehicleDelete builder.

type VehicleDeleteOne

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

VehicleDeleteOne is the builder for deleting a single Vehicle entity.

func (*VehicleDeleteOne) Exec

func (vdo *VehicleDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*VehicleDeleteOne) ExecX

func (vdo *VehicleDeleteOne) ExecX(ctx context.Context)

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

func (*VehicleDeleteOne) Where

Where appends a list predicates to the VehicleDelete builder.

type VehicleEdges

type VehicleEdges struct {
	// User holds the value of the user edge.
	User *User `json:"user,omitempty"`
	// Rides holds the value of the rides edge.
	Rides []*Ride `json:"rides,omitempty"`
	// contains filtered or unexported fields
}

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

func (VehicleEdges) RidesOrErr

func (e VehicleEdges) RidesOrErr() ([]*Ride, error)

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

func (VehicleEdges) UserOrErr

func (e VehicleEdges) UserOrErr() (*User, error)

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

type VehicleGroupBy

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

VehicleGroupBy is the group-by builder for Vehicle entities.

func (*VehicleGroupBy) Aggregate

func (vgb *VehicleGroupBy) Aggregate(fns ...AggregateFunc) *VehicleGroupBy

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

func (*VehicleGroupBy) Bool

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

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

func (*VehicleGroupBy) BoolX

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

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

func (*VehicleGroupBy) Bools

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

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

func (*VehicleGroupBy) BoolsX

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

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

func (*VehicleGroupBy) Float64

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

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

func (*VehicleGroupBy) Float64X

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

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

func (*VehicleGroupBy) Float64s

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

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

func (*VehicleGroupBy) Float64sX

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

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

func (*VehicleGroupBy) Int

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

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

func (*VehicleGroupBy) IntX

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

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

func (*VehicleGroupBy) Ints

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

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

func (*VehicleGroupBy) IntsX

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

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

func (*VehicleGroupBy) Scan

func (vgb *VehicleGroupBy) Scan(ctx context.Context, v any) error

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

func (*VehicleGroupBy) ScanX

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

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

func (*VehicleGroupBy) String

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

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

func (*VehicleGroupBy) StringX

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

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

func (*VehicleGroupBy) Strings

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

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

func (*VehicleGroupBy) StringsX

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

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

type VehicleLocationHistories

type VehicleLocationHistories []*VehicleLocationHistory

VehicleLocationHistories is a parsable slice of VehicleLocationHistory.

type VehicleLocationHistory

type VehicleLocationHistory struct {

	// ID of the ent.
	ID uuid.UUID `json:"id,omitempty"`
	// City holds the value of the "city" field.
	City string `json:"city,omitempty"`
	// RideID holds the value of the "ride_id" field.
	RideID uuid.UUID `json:"ride_id,omitempty"`
	// Timestamp holds the value of the "timestamp" field.
	Timestamp time.Time `json:"timestamp,omitempty"`
	// Lat holds the value of the "lat" field.
	Lat float64 `json:"lat,omitempty"`
	// Long holds the value of the "long" field.
	Long float64 `json:"long,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the VehicleLocationHistoryQuery when eager-loading is set.
	Edges VehicleLocationHistoryEdges `json:"edges"`
	// contains filtered or unexported fields
}

VehicleLocationHistory is the model entity for the VehicleLocationHistory schema.

func (*VehicleLocationHistory) QueryRides

func (vlh *VehicleLocationHistory) QueryRides() *RideQuery

QueryRides queries the "rides" edge of the VehicleLocationHistory entity.

func (*VehicleLocationHistory) String

func (vlh *VehicleLocationHistory) String() string

String implements the fmt.Stringer.

func (*VehicleLocationHistory) Unwrap

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

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

type VehicleLocationHistoryClient

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

VehicleLocationHistoryClient is a client for the VehicleLocationHistory schema.

func NewVehicleLocationHistoryClient

func NewVehicleLocationHistoryClient(c config) *VehicleLocationHistoryClient

NewVehicleLocationHistoryClient returns a client for the VehicleLocationHistory from the given config.

func (*VehicleLocationHistoryClient) Create

Create returns a builder for creating a VehicleLocationHistory entity.

func (*VehicleLocationHistoryClient) CreateBulk

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

func (*VehicleLocationHistoryClient) Delete

Delete returns a delete builder for VehicleLocationHistory.

func (*VehicleLocationHistoryClient) DeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*VehicleLocationHistoryClient) DeleteOneID

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

func (*VehicleLocationHistoryClient) Get

Get returns a VehicleLocationHistory entity by its id.

func (*VehicleLocationHistoryClient) GetX

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

func (*VehicleLocationHistoryClient) Hooks

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

Hooks returns the client hooks.

func (*VehicleLocationHistoryClient) Intercept

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

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

func (*VehicleLocationHistoryClient) Interceptors

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

Interceptors returns the client interceptors.

func (*VehicleLocationHistoryClient) Query

Query returns a query builder for VehicleLocationHistory.

func (*VehicleLocationHistoryClient) QueryRides

QueryRides queries the rides edge of a VehicleLocationHistory.

func (*VehicleLocationHistoryClient) Update

Update returns an update builder for VehicleLocationHistory.

func (*VehicleLocationHistoryClient) UpdateOne

UpdateOne returns an update builder for the given entity.

func (*VehicleLocationHistoryClient) UpdateOneID

UpdateOneID returns an update builder for the given id.

func (*VehicleLocationHistoryClient) Use

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

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

type VehicleLocationHistoryCreate

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

VehicleLocationHistoryCreate is the builder for creating a VehicleLocationHistory entity.

func (*VehicleLocationHistoryCreate) Exec

Exec executes the query.

func (*VehicleLocationHistoryCreate) ExecX

func (vlhc *VehicleLocationHistoryCreate) ExecX(ctx context.Context)

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

func (*VehicleLocationHistoryCreate) Mutation

Mutation returns the VehicleLocationHistoryMutation object of the builder.

func (*VehicleLocationHistoryCreate) Save

Save creates the VehicleLocationHistory in the database.

func (*VehicleLocationHistoryCreate) SaveX

SaveX calls Save and panics if Save returns an error.

func (*VehicleLocationHistoryCreate) SetCity

SetCity sets the "city" field.

func (*VehicleLocationHistoryCreate) SetID

SetID sets the "id" field.

func (*VehicleLocationHistoryCreate) SetLat

SetLat sets the "lat" field.

func (*VehicleLocationHistoryCreate) SetLong

SetLong sets the "long" field.

func (*VehicleLocationHistoryCreate) SetNillableID

SetNillableID sets the "id" field if the given value is not nil.

func (*VehicleLocationHistoryCreate) SetNillableLat

SetNillableLat sets the "lat" field if the given value is not nil.

func (*VehicleLocationHistoryCreate) SetNillableLong

SetNillableLong sets the "long" field if the given value is not nil.

func (*VehicleLocationHistoryCreate) SetRideID

SetRideID sets the "ride_id" field.

func (*VehicleLocationHistoryCreate) SetRides

SetRides sets the "rides" edge to the Ride entity.

func (*VehicleLocationHistoryCreate) SetRidesID

SetRidesID sets the "rides" edge to the Ride entity by ID.

func (*VehicleLocationHistoryCreate) SetTimestamp

SetTimestamp sets the "timestamp" field.

type VehicleLocationHistoryCreateBulk

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

VehicleLocationHistoryCreateBulk is the builder for creating many VehicleLocationHistory entities in bulk.

func (*VehicleLocationHistoryCreateBulk) Exec

Exec executes the query.

func (*VehicleLocationHistoryCreateBulk) ExecX

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

func (*VehicleLocationHistoryCreateBulk) Save

Save creates the VehicleLocationHistory entities in the database.

func (*VehicleLocationHistoryCreateBulk) SaveX

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

type VehicleLocationHistoryDelete

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

VehicleLocationHistoryDelete is the builder for deleting a VehicleLocationHistory entity.

func (*VehicleLocationHistoryDelete) Exec

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

func (*VehicleLocationHistoryDelete) ExecX

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

func (*VehicleLocationHistoryDelete) Where

Where appends a list predicates to the VehicleLocationHistoryDelete builder.

type VehicleLocationHistoryDeleteOne

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

VehicleLocationHistoryDeleteOne is the builder for deleting a single VehicleLocationHistory entity.

func (*VehicleLocationHistoryDeleteOne) Exec

Exec executes the deletion query.

func (*VehicleLocationHistoryDeleteOne) ExecX

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

func (*VehicleLocationHistoryDeleteOne) Where

Where appends a list predicates to the VehicleLocationHistoryDelete builder.

type VehicleLocationHistoryEdges

type VehicleLocationHistoryEdges struct {
	// Rides holds the value of the rides edge.
	Rides *Ride `json:"rides,omitempty"`
	// contains filtered or unexported fields
}

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

func (VehicleLocationHistoryEdges) RidesOrErr

func (e VehicleLocationHistoryEdges) RidesOrErr() (*Ride, error)

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

type VehicleLocationHistoryGroupBy

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

VehicleLocationHistoryGroupBy is the group-by builder for VehicleLocationHistory entities.

func (*VehicleLocationHistoryGroupBy) Aggregate

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

func (*VehicleLocationHistoryGroupBy) Bool

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

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

func (*VehicleLocationHistoryGroupBy) BoolX

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

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

func (*VehicleLocationHistoryGroupBy) Bools

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

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

func (*VehicleLocationHistoryGroupBy) BoolsX

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

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

func (*VehicleLocationHistoryGroupBy) Float64

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

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

func (*VehicleLocationHistoryGroupBy) Float64X

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

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

func (*VehicleLocationHistoryGroupBy) Float64s

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

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

func (*VehicleLocationHistoryGroupBy) Float64sX

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

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

func (*VehicleLocationHistoryGroupBy) Int

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

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

func (*VehicleLocationHistoryGroupBy) IntX

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

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

func (*VehicleLocationHistoryGroupBy) Ints

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

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

func (*VehicleLocationHistoryGroupBy) IntsX

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

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

func (*VehicleLocationHistoryGroupBy) Scan

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

func (*VehicleLocationHistoryGroupBy) ScanX

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

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

func (*VehicleLocationHistoryGroupBy) String

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

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

func (*VehicleLocationHistoryGroupBy) StringX

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

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

func (*VehicleLocationHistoryGroupBy) Strings

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

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

func (*VehicleLocationHistoryGroupBy) StringsX

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

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

type VehicleLocationHistoryMutation

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

VehicleLocationHistoryMutation represents an operation that mutates the VehicleLocationHistory nodes in the graph.

func (*VehicleLocationHistoryMutation) AddField

func (m *VehicleLocationHistoryMutation) 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 (*VehicleLocationHistoryMutation) AddLat

AddLat adds f to the "lat" field.

func (*VehicleLocationHistoryMutation) AddLong

AddLong adds f to the "long" field.

func (*VehicleLocationHistoryMutation) AddedEdges

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

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

func (*VehicleLocationHistoryMutation) AddedField

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

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

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

func (*VehicleLocationHistoryMutation) AddedIDs

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

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

func (*VehicleLocationHistoryMutation) AddedLat

func (m *VehicleLocationHistoryMutation) AddedLat() (r float64, exists bool)

AddedLat returns the value that was added to the "lat" field in this mutation.

func (*VehicleLocationHistoryMutation) AddedLong

func (m *VehicleLocationHistoryMutation) AddedLong() (r float64, exists bool)

AddedLong returns the value that was added to the "long" field in this mutation.

func (*VehicleLocationHistoryMutation) City

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

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

func (*VehicleLocationHistoryMutation) ClearEdge

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

func (m *VehicleLocationHistoryMutation) 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 (*VehicleLocationHistoryMutation) ClearLat

func (m *VehicleLocationHistoryMutation) ClearLat()

ClearLat clears the value of the "lat" field.

func (*VehicleLocationHistoryMutation) ClearLong

func (m *VehicleLocationHistoryMutation) ClearLong()

ClearLong clears the value of the "long" field.

func (*VehicleLocationHistoryMutation) ClearRides

func (m *VehicleLocationHistoryMutation) ClearRides()

ClearRides clears the "rides" edge to the Ride entity.

func (*VehicleLocationHistoryMutation) ClearedEdges

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

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

func (*VehicleLocationHistoryMutation) ClearedFields

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

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

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

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

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

func (*VehicleLocationHistoryMutation) Field

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 (*VehicleLocationHistoryMutation) FieldCleared

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

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

func (*VehicleLocationHistoryMutation) Fields

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

func (m *VehicleLocationHistoryMutation) ID() (id uuid.UUID, 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 (*VehicleLocationHistoryMutation) IDs

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

func (*VehicleLocationHistoryMutation) Lat

func (m *VehicleLocationHistoryMutation) Lat() (r float64, exists bool)

Lat returns the value of the "lat" field in the mutation.

func (*VehicleLocationHistoryMutation) LatCleared

func (m *VehicleLocationHistoryMutation) LatCleared() bool

LatCleared returns if the "lat" field was cleared in this mutation.

func (*VehicleLocationHistoryMutation) Long

func (m *VehicleLocationHistoryMutation) Long() (r float64, exists bool)

Long returns the value of the "long" field in the mutation.

func (*VehicleLocationHistoryMutation) LongCleared

func (m *VehicleLocationHistoryMutation) LongCleared() bool

LongCleared returns if the "long" field was cleared in this mutation.

func (*VehicleLocationHistoryMutation) OldCity

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

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

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

func (*VehicleLocationHistoryMutation) OldLat

OldLat returns the old "lat" field's value of the VehicleLocationHistory entity. If the VehicleLocationHistory 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 (*VehicleLocationHistoryMutation) OldLong

func (m *VehicleLocationHistoryMutation) OldLong(ctx context.Context) (v float64, err error)

OldLong returns the old "long" field's value of the VehicleLocationHistory entity. If the VehicleLocationHistory 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 (*VehicleLocationHistoryMutation) OldRideID

func (m *VehicleLocationHistoryMutation) OldRideID(ctx context.Context) (v uuid.UUID, err error)

OldRideID returns the old "ride_id" field's value of the VehicleLocationHistory entity. If the VehicleLocationHistory 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 (*VehicleLocationHistoryMutation) OldTimestamp

func (m *VehicleLocationHistoryMutation) OldTimestamp(ctx context.Context) (v time.Time, err error)

OldTimestamp returns the old "timestamp" field's value of the VehicleLocationHistory entity. If the VehicleLocationHistory 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 (*VehicleLocationHistoryMutation) Op

Op returns the operation name.

func (*VehicleLocationHistoryMutation) RemovedEdges

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

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

func (*VehicleLocationHistoryMutation) RemovedIDs

func (m *VehicleLocationHistoryMutation) 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 (*VehicleLocationHistoryMutation) ResetCity

func (m *VehicleLocationHistoryMutation) ResetCity()

ResetCity resets all changes to the "city" field.

func (*VehicleLocationHistoryMutation) ResetEdge

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

func (m *VehicleLocationHistoryMutation) 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 (*VehicleLocationHistoryMutation) ResetLat

func (m *VehicleLocationHistoryMutation) ResetLat()

ResetLat resets all changes to the "lat" field.

func (*VehicleLocationHistoryMutation) ResetLong

func (m *VehicleLocationHistoryMutation) ResetLong()

ResetLong resets all changes to the "long" field.

func (*VehicleLocationHistoryMutation) ResetRideID

func (m *VehicleLocationHistoryMutation) ResetRideID()

ResetRideID resets all changes to the "ride_id" field.

func (*VehicleLocationHistoryMutation) ResetRides

func (m *VehicleLocationHistoryMutation) ResetRides()

ResetRides resets all changes to the "rides" edge.

func (*VehicleLocationHistoryMutation) ResetTimestamp

func (m *VehicleLocationHistoryMutation) ResetTimestamp()

ResetTimestamp resets all changes to the "timestamp" field.

func (*VehicleLocationHistoryMutation) RideID

func (m *VehicleLocationHistoryMutation) RideID() (r uuid.UUID, exists bool)

RideID returns the value of the "ride_id" field in the mutation.

func (*VehicleLocationHistoryMutation) RidesCleared

func (m *VehicleLocationHistoryMutation) RidesCleared() bool

RidesCleared reports if the "rides" edge to the Ride entity was cleared.

func (*VehicleLocationHistoryMutation) RidesID

func (m *VehicleLocationHistoryMutation) RidesID() (id uuid.UUID, exists bool)

RidesID returns the "rides" edge ID in the mutation.

func (*VehicleLocationHistoryMutation) RidesIDs

func (m *VehicleLocationHistoryMutation) RidesIDs() (ids []uuid.UUID)

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

func (*VehicleLocationHistoryMutation) SetCity

func (m *VehicleLocationHistoryMutation) SetCity(s string)

SetCity sets the "city" field.

func (*VehicleLocationHistoryMutation) SetField

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

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

func (*VehicleLocationHistoryMutation) SetLat

SetLat sets the "lat" field.

func (*VehicleLocationHistoryMutation) SetLong

SetLong sets the "long" field.

func (*VehicleLocationHistoryMutation) SetOp

func (m *VehicleLocationHistoryMutation) SetOp(op Op)

SetOp allows setting the mutation operation.

func (*VehicleLocationHistoryMutation) SetRideID

func (m *VehicleLocationHistoryMutation) SetRideID(u uuid.UUID)

SetRideID sets the "ride_id" field.

func (*VehicleLocationHistoryMutation) SetRidesID

func (m *VehicleLocationHistoryMutation) SetRidesID(id uuid.UUID)

SetRidesID sets the "rides" edge to the Ride entity by id.

func (*VehicleLocationHistoryMutation) SetTimestamp

func (m *VehicleLocationHistoryMutation) SetTimestamp(t time.Time)

SetTimestamp sets the "timestamp" field.

func (*VehicleLocationHistoryMutation) Timestamp

func (m *VehicleLocationHistoryMutation) Timestamp() (r time.Time, exists bool)

Timestamp returns the value of the "timestamp" field in the mutation.

func (VehicleLocationHistoryMutation) Tx

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

func (*VehicleLocationHistoryMutation) Type

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

func (*VehicleLocationHistoryMutation) Where

Where appends a list predicates to the VehicleLocationHistoryMutation builder.

func (*VehicleLocationHistoryMutation) WhereP

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

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

type VehicleLocationHistoryQuery

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

VehicleLocationHistoryQuery is the builder for querying VehicleLocationHistory entities.

func (*VehicleLocationHistoryQuery) Aggregate

Aggregate returns a VehicleLocationHistorySelect configured with the given aggregations.

func (*VehicleLocationHistoryQuery) All

All executes the query and returns a list of VehicleLocationHistories.

func (*VehicleLocationHistoryQuery) AllX

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

func (*VehicleLocationHistoryQuery) Clone

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

func (*VehicleLocationHistoryQuery) Count

func (vlhq *VehicleLocationHistoryQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*VehicleLocationHistoryQuery) CountX

func (vlhq *VehicleLocationHistoryQuery) CountX(ctx context.Context) int

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

func (*VehicleLocationHistoryQuery) Exist

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

func (*VehicleLocationHistoryQuery) ExistX

func (vlhq *VehicleLocationHistoryQuery) ExistX(ctx context.Context) bool

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

func (*VehicleLocationHistoryQuery) First

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

func (*VehicleLocationHistoryQuery) FirstID

func (vlhq *VehicleLocationHistoryQuery) FirstID(ctx context.Context) (id uuid.UUID, err error)

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

func (*VehicleLocationHistoryQuery) FirstIDX

func (vlhq *VehicleLocationHistoryQuery) FirstIDX(ctx context.Context) uuid.UUID

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

func (*VehicleLocationHistoryQuery) FirstX

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

func (*VehicleLocationHistoryQuery) GroupBy

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

client.VehicleLocationHistory.Query().
	GroupBy(vehiclelocationhistory.FieldCity).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*VehicleLocationHistoryQuery) IDs

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

func (*VehicleLocationHistoryQuery) IDsX

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

func (*VehicleLocationHistoryQuery) Limit

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

func (*VehicleLocationHistoryQuery) Offset

Offset to start from.

func (*VehicleLocationHistoryQuery) Only

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

func (*VehicleLocationHistoryQuery) OnlyID

func (vlhq *VehicleLocationHistoryQuery) OnlyID(ctx context.Context) (id uuid.UUID, err error)

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

func (*VehicleLocationHistoryQuery) OnlyIDX

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

func (*VehicleLocationHistoryQuery) OnlyX

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

func (*VehicleLocationHistoryQuery) Order

Order specifies how the records should be ordered.

func (*VehicleLocationHistoryQuery) QueryRides

func (vlhq *VehicleLocationHistoryQuery) QueryRides() *RideQuery

QueryRides chains the current query on the "rides" edge.

func (*VehicleLocationHistoryQuery) Select

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 {
	City string `json:"city,omitempty"`
}

client.VehicleLocationHistory.Query().
	Select(vehiclelocationhistory.FieldCity).
	Scan(ctx, &v)

func (*VehicleLocationHistoryQuery) Unique

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

Where adds a new predicate for the VehicleLocationHistoryQuery builder.

func (*VehicleLocationHistoryQuery) WithRides

func (vlhq *VehicleLocationHistoryQuery) WithRides(opts ...func(*RideQuery)) *VehicleLocationHistoryQuery

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

type VehicleLocationHistorySelect

type VehicleLocationHistorySelect struct {
	*VehicleLocationHistoryQuery
	// contains filtered or unexported fields
}

VehicleLocationHistorySelect is the builder for selecting fields of VehicleLocationHistory entities.

func (*VehicleLocationHistorySelect) Aggregate

Aggregate adds the given aggregation functions to the selector query.

func (*VehicleLocationHistorySelect) Bool

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

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

func (*VehicleLocationHistorySelect) BoolX

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

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

func (*VehicleLocationHistorySelect) Bools

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

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

func (*VehicleLocationHistorySelect) BoolsX

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

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

func (*VehicleLocationHistorySelect) Float64

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

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

func (*VehicleLocationHistorySelect) Float64X

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

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

func (*VehicleLocationHistorySelect) Float64s

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

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

func (*VehicleLocationHistorySelect) Float64sX

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

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

func (*VehicleLocationHistorySelect) Int

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

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

func (*VehicleLocationHistorySelect) IntX

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

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

func (*VehicleLocationHistorySelect) Ints

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

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

func (*VehicleLocationHistorySelect) IntsX

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

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

func (*VehicleLocationHistorySelect) Scan

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

func (*VehicleLocationHistorySelect) ScanX

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

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

func (*VehicleLocationHistorySelect) String

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

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

func (*VehicleLocationHistorySelect) StringX

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

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

func (*VehicleLocationHistorySelect) Strings

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

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

func (*VehicleLocationHistorySelect) StringsX

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

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

type VehicleLocationHistoryUpdate

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

VehicleLocationHistoryUpdate is the builder for updating VehicleLocationHistory entities.

func (*VehicleLocationHistoryUpdate) AddLat

AddLat adds f to the "lat" field.

func (*VehicleLocationHistoryUpdate) AddLong

AddLong adds f to the "long" field.

func (*VehicleLocationHistoryUpdate) ClearLat

ClearLat clears the value of the "lat" field.

func (*VehicleLocationHistoryUpdate) ClearLong

ClearLong clears the value of the "long" field.

func (*VehicleLocationHistoryUpdate) ClearRides

ClearRides clears the "rides" edge to the Ride entity.

func (*VehicleLocationHistoryUpdate) Exec

Exec executes the query.

func (*VehicleLocationHistoryUpdate) ExecX

func (vlhu *VehicleLocationHistoryUpdate) ExecX(ctx context.Context)

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

func (*VehicleLocationHistoryUpdate) Mutation

Mutation returns the VehicleLocationHistoryMutation object of the builder.

func (*VehicleLocationHistoryUpdate) Save

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

func (*VehicleLocationHistoryUpdate) SaveX

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

func (*VehicleLocationHistoryUpdate) SetCity

SetCity sets the "city" field.

func (*VehicleLocationHistoryUpdate) SetLat

SetLat sets the "lat" field.

func (*VehicleLocationHistoryUpdate) SetLong

SetLong sets the "long" field.

func (*VehicleLocationHistoryUpdate) SetNillableLat

SetNillableLat sets the "lat" field if the given value is not nil.

func (*VehicleLocationHistoryUpdate) SetNillableLong

SetNillableLong sets the "long" field if the given value is not nil.

func (*VehicleLocationHistoryUpdate) SetRideID

SetRideID sets the "ride_id" field.

func (*VehicleLocationHistoryUpdate) SetRides

SetRides sets the "rides" edge to the Ride entity.

func (*VehicleLocationHistoryUpdate) SetRidesID

SetRidesID sets the "rides" edge to the Ride entity by ID.

func (*VehicleLocationHistoryUpdate) SetTimestamp

SetTimestamp sets the "timestamp" field.

func (*VehicleLocationHistoryUpdate) Where

Where appends a list predicates to the VehicleLocationHistoryUpdate builder.

type VehicleLocationHistoryUpdateOne

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

VehicleLocationHistoryUpdateOne is the builder for updating a single VehicleLocationHistory entity.

func (*VehicleLocationHistoryUpdateOne) AddLat

AddLat adds f to the "lat" field.

func (*VehicleLocationHistoryUpdateOne) AddLong

AddLong adds f to the "long" field.

func (*VehicleLocationHistoryUpdateOne) ClearLat

ClearLat clears the value of the "lat" field.

func (*VehicleLocationHistoryUpdateOne) ClearLong

ClearLong clears the value of the "long" field.

func (*VehicleLocationHistoryUpdateOne) ClearRides

ClearRides clears the "rides" edge to the Ride entity.

func (*VehicleLocationHistoryUpdateOne) Exec

Exec executes the query on the entity.

func (*VehicleLocationHistoryUpdateOne) ExecX

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

func (*VehicleLocationHistoryUpdateOne) Mutation

Mutation returns the VehicleLocationHistoryMutation object of the builder.

func (*VehicleLocationHistoryUpdateOne) Save

Save executes the query and returns the updated VehicleLocationHistory entity.

func (*VehicleLocationHistoryUpdateOne) SaveX

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

func (*VehicleLocationHistoryUpdateOne) Select

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

func (*VehicleLocationHistoryUpdateOne) SetCity

SetCity sets the "city" field.

func (*VehicleLocationHistoryUpdateOne) SetLat

SetLat sets the "lat" field.

func (*VehicleLocationHistoryUpdateOne) SetLong

SetLong sets the "long" field.

func (*VehicleLocationHistoryUpdateOne) SetNillableLat

SetNillableLat sets the "lat" field if the given value is not nil.

func (*VehicleLocationHistoryUpdateOne) SetNillableLong

SetNillableLong sets the "long" field if the given value is not nil.

func (*VehicleLocationHistoryUpdateOne) SetRideID

SetRideID sets the "ride_id" field.

func (*VehicleLocationHistoryUpdateOne) SetRides

SetRides sets the "rides" edge to the Ride entity.

func (*VehicleLocationHistoryUpdateOne) SetRidesID

SetRidesID sets the "rides" edge to the Ride entity by ID.

func (*VehicleLocationHistoryUpdateOne) SetTimestamp

SetTimestamp sets the "timestamp" field.

type VehicleMutation

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

VehicleMutation represents an operation that mutates the Vehicle nodes in the graph.

func (*VehicleMutation) AddField

func (m *VehicleMutation) 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 (*VehicleMutation) AddRideIDs

func (m *VehicleMutation) AddRideIDs(ids ...uuid.UUID)

AddRideIDs adds the "rides" edge to the Ride entity by ids.

func (*VehicleMutation) AddedEdges

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

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

func (*VehicleMutation) AddedField

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

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

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

func (*VehicleMutation) AddedIDs

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

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

func (*VehicleMutation) City

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

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

func (*VehicleMutation) ClearCreationTime

func (m *VehicleMutation) ClearCreationTime()

ClearCreationTime clears the value of the "creation_time" field.

func (*VehicleMutation) ClearCurrentLocation

func (m *VehicleMutation) ClearCurrentLocation()

ClearCurrentLocation clears the value of the "current_location" field.

func (*VehicleMutation) ClearEdge

func (m *VehicleMutation) 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 (*VehicleMutation) ClearExt

func (m *VehicleMutation) ClearExt()

ClearExt clears the value of the "ext" field.

func (*VehicleMutation) ClearField

func (m *VehicleMutation) 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 (*VehicleMutation) ClearOwnerID

func (m *VehicleMutation) ClearOwnerID()

ClearOwnerID clears the value of the "owner_id" field.

func (*VehicleMutation) ClearRides

func (m *VehicleMutation) ClearRides()

ClearRides clears the "rides" edge to the Ride entity.

func (*VehicleMutation) ClearStatus

func (m *VehicleMutation) ClearStatus()

ClearStatus clears the value of the "status" field.

func (*VehicleMutation) ClearType

func (m *VehicleMutation) ClearType()

ClearType clears the value of the "type" field.

func (*VehicleMutation) ClearUser

func (m *VehicleMutation) ClearUser()

ClearUser clears the "user" edge to the User entity.

func (*VehicleMutation) ClearedEdges

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

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

func (*VehicleMutation) ClearedFields

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

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

func (VehicleMutation) Client

func (m VehicleMutation) 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 (*VehicleMutation) CreationTime

func (m *VehicleMutation) CreationTime() (r time.Time, exists bool)

CreationTime returns the value of the "creation_time" field in the mutation.

func (*VehicleMutation) CreationTimeCleared

func (m *VehicleMutation) CreationTimeCleared() bool

CreationTimeCleared returns if the "creation_time" field was cleared in this mutation.

func (*VehicleMutation) CurrentLocation

func (m *VehicleMutation) CurrentLocation() (r string, exists bool)

CurrentLocation returns the value of the "current_location" field in the mutation.

func (*VehicleMutation) CurrentLocationCleared

func (m *VehicleMutation) CurrentLocationCleared() bool

CurrentLocationCleared returns if the "current_location" field was cleared in this mutation.

func (*VehicleMutation) EdgeCleared

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

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

func (*VehicleMutation) Ext

func (m *VehicleMutation) Ext() (r *map[string]interface{}, exists bool)

Ext returns the value of the "ext" field in the mutation.

func (*VehicleMutation) ExtCleared

func (m *VehicleMutation) ExtCleared() bool

ExtCleared returns if the "ext" field was cleared in this mutation.

func (*VehicleMutation) Field

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

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

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

func (*VehicleMutation) Fields

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

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

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

func (*VehicleMutation) ID

func (m *VehicleMutation) ID() (id uuid.UUID, 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 (*VehicleMutation) IDs

func (m *VehicleMutation) IDs(ctx context.Context) ([]uuid.UUID, error)

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

func (*VehicleMutation) OldCity

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

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

func (m *VehicleMutation) OldCreationTime(ctx context.Context) (v time.Time, err error)

OldCreationTime returns the old "creation_time" field's value of the Vehicle entity. If the Vehicle 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 (*VehicleMutation) OldCurrentLocation

func (m *VehicleMutation) OldCurrentLocation(ctx context.Context) (v string, err error)

OldCurrentLocation returns the old "current_location" field's value of the Vehicle entity. If the Vehicle 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 (*VehicleMutation) OldExt

func (m *VehicleMutation) OldExt(ctx context.Context) (v *map[string]interface{}, err error)

OldExt returns the old "ext" field's value of the Vehicle entity. If the Vehicle 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 (*VehicleMutation) OldField

func (m *VehicleMutation) 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 (*VehicleMutation) OldOwnerID

func (m *VehicleMutation) OldOwnerID(ctx context.Context) (v uuid.UUID, err error)

OldOwnerID returns the old "owner_id" field's value of the Vehicle entity. If the Vehicle 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 (*VehicleMutation) OldStatus

func (m *VehicleMutation) OldStatus(ctx context.Context) (v string, err error)

OldStatus returns the old "status" field's value of the Vehicle entity. If the Vehicle 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 (*VehicleMutation) OldType

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

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

func (m *VehicleMutation) Op() Op

Op returns the operation name.

func (*VehicleMutation) OwnerID

func (m *VehicleMutation) OwnerID() (r uuid.UUID, exists bool)

OwnerID returns the value of the "owner_id" field in the mutation.

func (*VehicleMutation) OwnerIDCleared

func (m *VehicleMutation) OwnerIDCleared() bool

OwnerIDCleared returns if the "owner_id" field was cleared in this mutation.

func (*VehicleMutation) RemoveRideIDs

func (m *VehicleMutation) RemoveRideIDs(ids ...uuid.UUID)

RemoveRideIDs removes the "rides" edge to the Ride entity by IDs.

func (*VehicleMutation) RemovedEdges

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

RemovedEdges returns all edge names that were removed in this mutation.

func (*VehicleMutation) RemovedIDs

func (m *VehicleMutation) 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 (*VehicleMutation) RemovedRidesIDs

func (m *VehicleMutation) RemovedRidesIDs() (ids []uuid.UUID)

RemovedRides returns the removed IDs of the "rides" edge to the Ride entity.

func (*VehicleMutation) ResetCity

func (m *VehicleMutation) ResetCity()

ResetCity resets all changes to the "city" field.

func (*VehicleMutation) ResetCreationTime

func (m *VehicleMutation) ResetCreationTime()

ResetCreationTime resets all changes to the "creation_time" field.

func (*VehicleMutation) ResetCurrentLocation

func (m *VehicleMutation) ResetCurrentLocation()

ResetCurrentLocation resets all changes to the "current_location" field.

func (*VehicleMutation) ResetEdge

func (m *VehicleMutation) 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 (*VehicleMutation) ResetExt

func (m *VehicleMutation) ResetExt()

ResetExt resets all changes to the "ext" field.

func (*VehicleMutation) ResetField

func (m *VehicleMutation) 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 (*VehicleMutation) ResetOwnerID

func (m *VehicleMutation) ResetOwnerID()

ResetOwnerID resets all changes to the "owner_id" field.

func (*VehicleMutation) ResetRides

func (m *VehicleMutation) ResetRides()

ResetRides resets all changes to the "rides" edge.

func (*VehicleMutation) ResetStatus

func (m *VehicleMutation) ResetStatus()

ResetStatus resets all changes to the "status" field.

func (*VehicleMutation) ResetType

func (m *VehicleMutation) ResetType()

ResetType resets all changes to the "type" field.

func (*VehicleMutation) ResetUser

func (m *VehicleMutation) ResetUser()

ResetUser resets all changes to the "user" edge.

func (*VehicleMutation) RidesCleared

func (m *VehicleMutation) RidesCleared() bool

RidesCleared reports if the "rides" edge to the Ride entity was cleared.

func (*VehicleMutation) RidesIDs

func (m *VehicleMutation) RidesIDs() (ids []uuid.UUID)

RidesIDs returns the "rides" edge IDs in the mutation.

func (*VehicleMutation) SetCity

func (m *VehicleMutation) SetCity(s string)

SetCity sets the "city" field.

func (*VehicleMutation) SetCreationTime

func (m *VehicleMutation) SetCreationTime(t time.Time)

SetCreationTime sets the "creation_time" field.

func (*VehicleMutation) SetCurrentLocation

func (m *VehicleMutation) SetCurrentLocation(s string)

SetCurrentLocation sets the "current_location" field.

func (*VehicleMutation) SetExt

func (m *VehicleMutation) SetExt(value *map[string]interface{})

SetExt sets the "ext" field.

func (*VehicleMutation) SetField

func (m *VehicleMutation) 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 (*VehicleMutation) SetID

func (m *VehicleMutation) SetID(id uuid.UUID)

SetID sets the value of the id field. Note that this operation is only accepted on creation of Vehicle entities.

func (*VehicleMutation) SetOp

func (m *VehicleMutation) SetOp(op Op)

SetOp allows setting the mutation operation.

func (*VehicleMutation) SetOwnerID

func (m *VehicleMutation) SetOwnerID(u uuid.UUID)

SetOwnerID sets the "owner_id" field.

func (*VehicleMutation) SetStatus

func (m *VehicleMutation) SetStatus(s string)

SetStatus sets the "status" field.

func (*VehicleMutation) SetType

func (m *VehicleMutation) SetType(s string)

SetType sets the "type" field.

func (*VehicleMutation) SetUserID

func (m *VehicleMutation) SetUserID(id uuid.UUID)

SetUserID sets the "user" edge to the User entity by id.

func (*VehicleMutation) Status

func (m *VehicleMutation) Status() (r string, exists bool)

Status returns the value of the "status" field in the mutation.

func (*VehicleMutation) StatusCleared

func (m *VehicleMutation) StatusCleared() bool

StatusCleared returns if the "status" field was cleared in this mutation.

func (VehicleMutation) Tx

func (m VehicleMutation) Tx() (*Tx, error)

Tx returns an `ent.Tx` for mutations that were executed in transactions; it returns an error otherwise.

func (*VehicleMutation) Type

func (m *VehicleMutation) Type() string

Type returns the node type of this mutation (Vehicle).

func (*VehicleMutation) TypeCleared

func (m *VehicleMutation) TypeCleared() bool

TypeCleared returns if the "type" field was cleared in this mutation.

func (*VehicleMutation) UserCleared

func (m *VehicleMutation) UserCleared() bool

UserCleared reports if the "user" edge to the User entity was cleared.

func (*VehicleMutation) UserID

func (m *VehicleMutation) UserID() (id uuid.UUID, exists bool)

UserID returns the "user" edge ID in the mutation.

func (*VehicleMutation) UserIDs

func (m *VehicleMutation) UserIDs() (ids []uuid.UUID)

UserIDs returns the "user" edge IDs in the mutation. Note that IDs always returns len(IDs) <= 1 for unique edges, and you should use UserID instead. It exists only for internal usage by the builders.

func (*VehicleMutation) Where

func (m *VehicleMutation) Where(ps ...predicate.Vehicle)

Where appends a list predicates to the VehicleMutation builder.

func (*VehicleMutation) WhereP

func (m *VehicleMutation) WhereP(ps ...func(*sql.Selector))

WhereP appends storage-level predicates to the VehicleMutation builder. Using this method, users can use type-assertion to append predicates that do not depend on any generated package.

type VehicleQuery

type VehicleQuery struct {
	// contains filtered or unexported fields
}

VehicleQuery is the builder for querying Vehicle entities.

func (*VehicleQuery) Aggregate

func (vq *VehicleQuery) Aggregate(fns ...AggregateFunc) *VehicleSelect

Aggregate returns a VehicleSelect configured with the given aggregations.

func (*VehicleQuery) All

func (vq *VehicleQuery) All(ctx context.Context) ([]*Vehicle, error)

All executes the query and returns a list of Vehicles.

func (*VehicleQuery) AllX

func (vq *VehicleQuery) AllX(ctx context.Context) []*Vehicle

AllX is like All, but panics if an error occurs.

func (*VehicleQuery) Clone

func (vq *VehicleQuery) Clone() *VehicleQuery

Clone returns a duplicate of the VehicleQuery builder, including all associated steps. It can be used to prepare common query builders and use them differently after the clone is made.

func (*VehicleQuery) Count

func (vq *VehicleQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*VehicleQuery) CountX

func (vq *VehicleQuery) CountX(ctx context.Context) int

CountX is like Count, but panics if an error occurs.

func (*VehicleQuery) Exist

func (vq *VehicleQuery) Exist(ctx context.Context) (bool, error)

Exist returns true if the query has elements in the graph.

func (*VehicleQuery) ExistX

func (vq *VehicleQuery) ExistX(ctx context.Context) bool

ExistX is like Exist, but panics if an error occurs.

func (*VehicleQuery) First

func (vq *VehicleQuery) First(ctx context.Context) (*Vehicle, error)

First returns the first Vehicle entity from the query. Returns a *NotFoundError when no Vehicle was found.

func (*VehicleQuery) FirstID

func (vq *VehicleQuery) FirstID(ctx context.Context) (id uuid.UUID, err error)

FirstID returns the first Vehicle ID from the query. Returns a *NotFoundError when no Vehicle ID was found.

func (*VehicleQuery) FirstIDX

func (vq *VehicleQuery) FirstIDX(ctx context.Context) uuid.UUID

FirstIDX is like FirstID, but panics if an error occurs.

func (*VehicleQuery) FirstX

func (vq *VehicleQuery) FirstX(ctx context.Context) *Vehicle

FirstX is like First, but panics if an error occurs.

func (*VehicleQuery) GroupBy

func (vq *VehicleQuery) GroupBy(field string, fields ...string) *VehicleGroupBy

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 {
	City string `json:"city,omitempty"`
	Count int `json:"count,omitempty"`
}

client.Vehicle.Query().
	GroupBy(vehicle.FieldCity).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*VehicleQuery) IDs

func (vq *VehicleQuery) IDs(ctx context.Context) ([]uuid.UUID, error)

IDs executes the query and returns a list of Vehicle IDs.

func (*VehicleQuery) IDsX

func (vq *VehicleQuery) IDsX(ctx context.Context) []uuid.UUID

IDsX is like IDs, but panics if an error occurs.

func (*VehicleQuery) Limit

func (vq *VehicleQuery) Limit(limit int) *VehicleQuery

Limit the number of records to be returned by this query.

func (*VehicleQuery) Offset

func (vq *VehicleQuery) Offset(offset int) *VehicleQuery

Offset to start from.

func (*VehicleQuery) Only

func (vq *VehicleQuery) Only(ctx context.Context) (*Vehicle, error)

Only returns a single Vehicle entity found by the query, ensuring it only returns one. Returns a *NotSingularError when more than one Vehicle entity is found. Returns a *NotFoundError when no Vehicle entities are found.

func (*VehicleQuery) OnlyID

func (vq *VehicleQuery) OnlyID(ctx context.Context) (id uuid.UUID, err error)

OnlyID is like Only, but returns the only Vehicle ID in the query. Returns a *NotSingularError when more than one Vehicle ID is found. Returns a *NotFoundError when no entities are found.

func (*VehicleQuery) OnlyIDX

func (vq *VehicleQuery) OnlyIDX(ctx context.Context) uuid.UUID

OnlyIDX is like OnlyID, but panics if an error occurs.

func (*VehicleQuery) OnlyX

func (vq *VehicleQuery) OnlyX(ctx context.Context) *Vehicle

OnlyX is like Only, but panics if an error occurs.

func (*VehicleQuery) Order

func (vq *VehicleQuery) Order(o ...OrderFunc) *VehicleQuery

Order specifies how the records should be ordered.

func (*VehicleQuery) QueryRides

func (vq *VehicleQuery) QueryRides() *RideQuery

QueryRides chains the current query on the "rides" edge.

func (*VehicleQuery) QueryUser

func (vq *VehicleQuery) QueryUser() *UserQuery

QueryUser chains the current query on the "user" edge.

func (*VehicleQuery) Select

func (vq *VehicleQuery) Select(fields ...string) *VehicleSelect

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 {
	City string `json:"city,omitempty"`
}

client.Vehicle.Query().
	Select(vehicle.FieldCity).
	Scan(ctx, &v)

func (*VehicleQuery) Unique

func (vq *VehicleQuery) Unique(unique bool) *VehicleQuery

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 (*VehicleQuery) Where

func (vq *VehicleQuery) Where(ps ...predicate.Vehicle) *VehicleQuery

Where adds a new predicate for the VehicleQuery builder.

func (*VehicleQuery) WithRides

func (vq *VehicleQuery) WithRides(opts ...func(*RideQuery)) *VehicleQuery

WithRides tells the query-builder to eager-load the nodes that are connected to the "rides" edge. The optional arguments are used to configure the query builder of the edge.

func (*VehicleQuery) WithUser

func (vq *VehicleQuery) WithUser(opts ...func(*UserQuery)) *VehicleQuery

WithUser tells the query-builder to eager-load the nodes that are connected to the "user" edge. The optional arguments are used to configure the query builder of the edge.

type VehicleSelect

type VehicleSelect struct {
	*VehicleQuery
	// contains filtered or unexported fields
}

VehicleSelect is the builder for selecting fields of Vehicle entities.

func (*VehicleSelect) Aggregate

func (vs *VehicleSelect) Aggregate(fns ...AggregateFunc) *VehicleSelect

Aggregate adds the given aggregation functions to the selector query.

func (*VehicleSelect) Bool

func (s *VehicleSelect) Bool(ctx context.Context) (_ bool, err error)

Bool returns a single bool from a selector. It is only allowed when selecting one field.

func (*VehicleSelect) BoolX

func (s *VehicleSelect) BoolX(ctx context.Context) bool

BoolX is like Bool, but panics if an error occurs.

func (*VehicleSelect) Bools

func (s *VehicleSelect) Bools(ctx context.Context) ([]bool, error)

Bools returns list of bools from a selector. It is only allowed when selecting one field.

func (*VehicleSelect) BoolsX

func (s *VehicleSelect) BoolsX(ctx context.Context) []bool

BoolsX is like Bools, but panics if an error occurs.

func (*VehicleSelect) Float64

func (s *VehicleSelect) Float64(ctx context.Context) (_ float64, err error)

Float64 returns a single float64 from a selector. It is only allowed when selecting one field.

func (*VehicleSelect) Float64X

func (s *VehicleSelect) Float64X(ctx context.Context) float64

Float64X is like Float64, but panics if an error occurs.

func (*VehicleSelect) Float64s

func (s *VehicleSelect) Float64s(ctx context.Context) ([]float64, error)

Float64s returns list of float64s from a selector. It is only allowed when selecting one field.

func (*VehicleSelect) Float64sX

func (s *VehicleSelect) Float64sX(ctx context.Context) []float64

Float64sX is like Float64s, but panics if an error occurs.

func (*VehicleSelect) Int

func (s *VehicleSelect) Int(ctx context.Context) (_ int, err error)

Int returns a single int from a selector. It is only allowed when selecting one field.

func (*VehicleSelect) IntX

func (s *VehicleSelect) IntX(ctx context.Context) int

IntX is like Int, but panics if an error occurs.

func (*VehicleSelect) Ints

func (s *VehicleSelect) Ints(ctx context.Context) ([]int, error)

Ints returns list of ints from a selector. It is only allowed when selecting one field.

func (*VehicleSelect) IntsX

func (s *VehicleSelect) IntsX(ctx context.Context) []int

IntsX is like Ints, but panics if an error occurs.

func (*VehicleSelect) Scan

func (vs *VehicleSelect) Scan(ctx context.Context, v any) error

Scan applies the selector query and scans the result into the given value.

func (*VehicleSelect) ScanX

func (s *VehicleSelect) ScanX(ctx context.Context, v any)

ScanX is like Scan, but panics if an error occurs.

func (*VehicleSelect) String

func (s *VehicleSelect) String(ctx context.Context) (_ string, err error)

String returns a single string from a selector. It is only allowed when selecting one field.

func (*VehicleSelect) StringX

func (s *VehicleSelect) StringX(ctx context.Context) string

StringX is like String, but panics if an error occurs.

func (*VehicleSelect) Strings

func (s *VehicleSelect) Strings(ctx context.Context) ([]string, error)

Strings returns list of strings from a selector. It is only allowed when selecting one field.

func (*VehicleSelect) StringsX

func (s *VehicleSelect) StringsX(ctx context.Context) []string

StringsX is like Strings, but panics if an error occurs.

type VehicleUpdate

type VehicleUpdate struct {
	// contains filtered or unexported fields
}

VehicleUpdate is the builder for updating Vehicle entities.

func (*VehicleUpdate) AddRideIDs

func (vu *VehicleUpdate) AddRideIDs(ids ...uuid.UUID) *VehicleUpdate

AddRideIDs adds the "rides" edge to the Ride entity by IDs.

func (*VehicleUpdate) AddRides

func (vu *VehicleUpdate) AddRides(r ...*Ride) *VehicleUpdate

AddRides adds the "rides" edges to the Ride entity.

func (*VehicleUpdate) ClearCreationTime

func (vu *VehicleUpdate) ClearCreationTime() *VehicleUpdate

ClearCreationTime clears the value of the "creation_time" field.

func (*VehicleUpdate) ClearCurrentLocation

func (vu *VehicleUpdate) ClearCurrentLocation() *VehicleUpdate

ClearCurrentLocation clears the value of the "current_location" field.

func (*VehicleUpdate) ClearExt

func (vu *VehicleUpdate) ClearExt() *VehicleUpdate

ClearExt clears the value of the "ext" field.

func (*VehicleUpdate) ClearOwnerID

func (vu *VehicleUpdate) ClearOwnerID() *VehicleUpdate

ClearOwnerID clears the value of the "owner_id" field.

func (*VehicleUpdate) ClearRides

func (vu *VehicleUpdate) ClearRides() *VehicleUpdate

ClearRides clears all "rides" edges to the Ride entity.

func (*VehicleUpdate) ClearStatus

func (vu *VehicleUpdate) ClearStatus() *VehicleUpdate

ClearStatus clears the value of the "status" field.

func (*VehicleUpdate) ClearType

func (vu *VehicleUpdate) ClearType() *VehicleUpdate

ClearType clears the value of the "type" field.

func (*VehicleUpdate) ClearUser

func (vu *VehicleUpdate) ClearUser() *VehicleUpdate

ClearUser clears the "user" edge to the User entity.

func (*VehicleUpdate) Exec

func (vu *VehicleUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*VehicleUpdate) ExecX

func (vu *VehicleUpdate) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*VehicleUpdate) Mutation

func (vu *VehicleUpdate) Mutation() *VehicleMutation

Mutation returns the VehicleMutation object of the builder.

func (*VehicleUpdate) RemoveRideIDs

func (vu *VehicleUpdate) RemoveRideIDs(ids ...uuid.UUID) *VehicleUpdate

RemoveRideIDs removes the "rides" edge to Ride entities by IDs.

func (*VehicleUpdate) RemoveRides

func (vu *VehicleUpdate) RemoveRides(r ...*Ride) *VehicleUpdate

RemoveRides removes "rides" edges to Ride entities.

func (*VehicleUpdate) Save

func (vu *VehicleUpdate) Save(ctx context.Context) (int, error)

Save executes the query and returns the number of nodes affected by the update operation.

func (*VehicleUpdate) SaveX

func (vu *VehicleUpdate) SaveX(ctx context.Context) int

SaveX is like Save, but panics if an error occurs.

func (*VehicleUpdate) SetCity

func (vu *VehicleUpdate) SetCity(s string) *VehicleUpdate

SetCity sets the "city" field.

func (*VehicleUpdate) SetCreationTime

func (vu *VehicleUpdate) SetCreationTime(t time.Time) *VehicleUpdate

SetCreationTime sets the "creation_time" field.

func (*VehicleUpdate) SetCurrentLocation

func (vu *VehicleUpdate) SetCurrentLocation(s string) *VehicleUpdate

SetCurrentLocation sets the "current_location" field.

func (*VehicleUpdate) SetExt

func (vu *VehicleUpdate) SetExt(m *map[string]interface{}) *VehicleUpdate

SetExt sets the "ext" field.

func (*VehicleUpdate) SetNillableCreationTime

func (vu *VehicleUpdate) SetNillableCreationTime(t *time.Time) *VehicleUpdate

SetNillableCreationTime sets the "creation_time" field if the given value is not nil.

func (*VehicleUpdate) SetNillableCurrentLocation

func (vu *VehicleUpdate) SetNillableCurrentLocation(s *string) *VehicleUpdate

SetNillableCurrentLocation sets the "current_location" field if the given value is not nil.

func (*VehicleUpdate) SetNillableOwnerID

func (vu *VehicleUpdate) SetNillableOwnerID(u *uuid.UUID) *VehicleUpdate

SetNillableOwnerID sets the "owner_id" field if the given value is not nil.

func (*VehicleUpdate) SetNillableStatus

func (vu *VehicleUpdate) SetNillableStatus(s *string) *VehicleUpdate

SetNillableStatus sets the "status" field if the given value is not nil.

func (*VehicleUpdate) SetNillableType

func (vu *VehicleUpdate) SetNillableType(s *string) *VehicleUpdate

SetNillableType sets the "type" field if the given value is not nil.

func (*VehicleUpdate) SetNillableUserID

func (vu *VehicleUpdate) SetNillableUserID(id *uuid.UUID) *VehicleUpdate

SetNillableUserID sets the "user" edge to the User entity by ID if the given value is not nil.

func (*VehicleUpdate) SetOwnerID

func (vu *VehicleUpdate) SetOwnerID(u uuid.UUID) *VehicleUpdate

SetOwnerID sets the "owner_id" field.

func (*VehicleUpdate) SetStatus

func (vu *VehicleUpdate) SetStatus(s string) *VehicleUpdate

SetStatus sets the "status" field.

func (*VehicleUpdate) SetType

func (vu *VehicleUpdate) SetType(s string) *VehicleUpdate

SetType sets the "type" field.

func (*VehicleUpdate) SetUser

func (vu *VehicleUpdate) SetUser(u *User) *VehicleUpdate

SetUser sets the "user" edge to the User entity.

func (*VehicleUpdate) SetUserID

func (vu *VehicleUpdate) SetUserID(id uuid.UUID) *VehicleUpdate

SetUserID sets the "user" edge to the User entity by ID.

func (*VehicleUpdate) Where

func (vu *VehicleUpdate) Where(ps ...predicate.Vehicle) *VehicleUpdate

Where appends a list predicates to the VehicleUpdate builder.

type VehicleUpdateOne

type VehicleUpdateOne struct {
	// contains filtered or unexported fields
}

VehicleUpdateOne is the builder for updating a single Vehicle entity.

func (*VehicleUpdateOne) AddRideIDs

func (vuo *VehicleUpdateOne) AddRideIDs(ids ...uuid.UUID) *VehicleUpdateOne

AddRideIDs adds the "rides" edge to the Ride entity by IDs.

func (*VehicleUpdateOne) AddRides

func (vuo *VehicleUpdateOne) AddRides(r ...*Ride) *VehicleUpdateOne

AddRides adds the "rides" edges to the Ride entity.

func (*VehicleUpdateOne) ClearCreationTime

func (vuo *VehicleUpdateOne) ClearCreationTime() *VehicleUpdateOne

ClearCreationTime clears the value of the "creation_time" field.

func (*VehicleUpdateOne) ClearCurrentLocation

func (vuo *VehicleUpdateOne) ClearCurrentLocation() *VehicleUpdateOne

ClearCurrentLocation clears the value of the "current_location" field.

func (*VehicleUpdateOne) ClearExt

func (vuo *VehicleUpdateOne) ClearExt() *VehicleUpdateOne

ClearExt clears the value of the "ext" field.

func (*VehicleUpdateOne) ClearOwnerID

func (vuo *VehicleUpdateOne) ClearOwnerID() *VehicleUpdateOne

ClearOwnerID clears the value of the "owner_id" field.

func (*VehicleUpdateOne) ClearRides

func (vuo *VehicleUpdateOne) ClearRides() *VehicleUpdateOne

ClearRides clears all "rides" edges to the Ride entity.

func (*VehicleUpdateOne) ClearStatus

func (vuo *VehicleUpdateOne) ClearStatus() *VehicleUpdateOne

ClearStatus clears the value of the "status" field.

func (*VehicleUpdateOne) ClearType

func (vuo *VehicleUpdateOne) ClearType() *VehicleUpdateOne

ClearType clears the value of the "type" field.

func (*VehicleUpdateOne) ClearUser

func (vuo *VehicleUpdateOne) ClearUser() *VehicleUpdateOne

ClearUser clears the "user" edge to the User entity.

func (*VehicleUpdateOne) Exec

func (vuo *VehicleUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*VehicleUpdateOne) ExecX

func (vuo *VehicleUpdateOne) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*VehicleUpdateOne) Mutation

func (vuo *VehicleUpdateOne) Mutation() *VehicleMutation

Mutation returns the VehicleMutation object of the builder.

func (*VehicleUpdateOne) RemoveRideIDs

func (vuo *VehicleUpdateOne) RemoveRideIDs(ids ...uuid.UUID) *VehicleUpdateOne

RemoveRideIDs removes the "rides" edge to Ride entities by IDs.

func (*VehicleUpdateOne) RemoveRides

func (vuo *VehicleUpdateOne) RemoveRides(r ...*Ride) *VehicleUpdateOne

RemoveRides removes "rides" edges to Ride entities.

func (*VehicleUpdateOne) Save

func (vuo *VehicleUpdateOne) Save(ctx context.Context) (*Vehicle, error)

Save executes the query and returns the updated Vehicle entity.

func (*VehicleUpdateOne) SaveX

func (vuo *VehicleUpdateOne) SaveX(ctx context.Context) *Vehicle

SaveX is like Save, but panics if an error occurs.

func (*VehicleUpdateOne) Select

func (vuo *VehicleUpdateOne) Select(field string, fields ...string) *VehicleUpdateOne

Select allows selecting one or more fields (columns) of the returned entity. The default is selecting all fields defined in the entity schema.

func (*VehicleUpdateOne) SetCity

func (vuo *VehicleUpdateOne) SetCity(s string) *VehicleUpdateOne

SetCity sets the "city" field.

func (*VehicleUpdateOne) SetCreationTime

func (vuo *VehicleUpdateOne) SetCreationTime(t time.Time) *VehicleUpdateOne

SetCreationTime sets the "creation_time" field.

func (*VehicleUpdateOne) SetCurrentLocation

func (vuo *VehicleUpdateOne) SetCurrentLocation(s string) *VehicleUpdateOne

SetCurrentLocation sets the "current_location" field.

func (*VehicleUpdateOne) SetExt

func (vuo *VehicleUpdateOne) SetExt(m *map[string]interface{}) *VehicleUpdateOne

SetExt sets the "ext" field.

func (*VehicleUpdateOne) SetNillableCreationTime

func (vuo *VehicleUpdateOne) SetNillableCreationTime(t *time.Time) *VehicleUpdateOne

SetNillableCreationTime sets the "creation_time" field if the given value is not nil.

func (*VehicleUpdateOne) SetNillableCurrentLocation

func (vuo *VehicleUpdateOne) SetNillableCurrentLocation(s *string) *VehicleUpdateOne

SetNillableCurrentLocation sets the "current_location" field if the given value is not nil.

func (*VehicleUpdateOne) SetNillableOwnerID

func (vuo *VehicleUpdateOne) SetNillableOwnerID(u *uuid.UUID) *VehicleUpdateOne

SetNillableOwnerID sets the "owner_id" field if the given value is not nil.

func (*VehicleUpdateOne) SetNillableStatus

func (vuo *VehicleUpdateOne) SetNillableStatus(s *string) *VehicleUpdateOne

SetNillableStatus sets the "status" field if the given value is not nil.

func (*VehicleUpdateOne) SetNillableType

func (vuo *VehicleUpdateOne) SetNillableType(s *string) *VehicleUpdateOne

SetNillableType sets the "type" field if the given value is not nil.

func (*VehicleUpdateOne) SetNillableUserID

func (vuo *VehicleUpdateOne) SetNillableUserID(id *uuid.UUID) *VehicleUpdateOne

SetNillableUserID sets the "user" edge to the User entity by ID if the given value is not nil.

func (*VehicleUpdateOne) SetOwnerID

func (vuo *VehicleUpdateOne) SetOwnerID(u uuid.UUID) *VehicleUpdateOne

SetOwnerID sets the "owner_id" field.

func (*VehicleUpdateOne) SetStatus

func (vuo *VehicleUpdateOne) SetStatus(s string) *VehicleUpdateOne

SetStatus sets the "status" field.

func (*VehicleUpdateOne) SetType

func (vuo *VehicleUpdateOne) SetType(s string) *VehicleUpdateOne

SetType sets the "type" field.

func (*VehicleUpdateOne) SetUser

func (vuo *VehicleUpdateOne) SetUser(u *User) *VehicleUpdateOne

SetUser sets the "user" edge to the User entity.

func (*VehicleUpdateOne) SetUserID

func (vuo *VehicleUpdateOne) SetUserID(id uuid.UUID) *VehicleUpdateOne

SetUserID sets the "user" edge to the User entity by ID.

type Vehicles

type Vehicles []*Vehicle

Vehicles is a parsable slice of Vehicle.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL