ent

package
v0.0.0-...-24968f5 Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2022 License: MIT, MIT Imports: 16 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.
	TypeHouse = "House"
)

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
	// House is the client for interacting with the House builders.
	House *HouseClient
	// 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().
	House.
	Query().
	Count(ctx)

func (*Client) Tx

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

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

func (*Client) Use

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

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

type CommitFunc

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

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

func (CommitFunc) Commit

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

Commit calls f(ctx, m).

type CommitHook

type CommitHook func(Committer) Committer

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

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

type Committer

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

Committer is the interface that wraps the Committer method.

type ConstraintError

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

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

func (ConstraintError) Error

func (e ConstraintError) Error() string

Error implements the error interface.

func (*ConstraintError) Unwrap

func (e *ConstraintError) Unwrap() error

Unwrap implements the errors.Wrapper interface.

type Hook

type Hook = ent.Hook

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

type House

type House struct {

	// ID of the ent.
	ID int64 `json:"id,omitempty"`
	// Price holds the value of the "Price" field.
	Price float64 `json:"Price,omitempty"`
	// Title holds the value of the "title" field.
	Title string `json:"title,omitempty"`
	// Community holds the value of the "community" field.
	Community string `json:"community,omitempty"`
	// Image holds the value of the "image" field.
	Image string `json:"image,omitempty"`
	// ToiletCount holds the value of the "toilet_count" field.
	ToiletCount int32 `json:"toilet_count,omitempty"`
	// KitchenCount holds the value of the "kitchen_count" field.
	KitchenCount int32 `json:"kitchen_count,omitempty"`
	// FloorCount holds the value of the "floor_count" field.
	FloorCount int32 `json:"floor_count,omitempty"`
	// HallCount holds the value of the "hall_count" field.
	HallCount int32 `json:"hall_count,omitempty"`
	// RoomCount holds the value of the "room_count" field.
	RoomCount int32 `json:"room_count,omitempty"`
	// contains filtered or unexported fields
}

House is the model entity for the House schema.

func (*House) String

func (h *House) String() string

String implements the fmt.Stringer.

func (*House) Unwrap

func (h *House) Unwrap() *House

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

func (h *House) Update() *HouseUpdateOne

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

type HouseClient

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

HouseClient is a client for the House schema.

func NewHouseClient

func NewHouseClient(c config) *HouseClient

NewHouseClient returns a client for the House from the given config.

func (*HouseClient) Create

func (c *HouseClient) Create() *HouseCreate

Create returns a create builder for House.

func (*HouseClient) CreateBulk

func (c *HouseClient) CreateBulk(builders ...*HouseCreate) *HouseCreateBulk

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

func (*HouseClient) Delete

func (c *HouseClient) Delete() *HouseDelete

Delete returns a delete builder for House.

func (*HouseClient) DeleteOne

func (c *HouseClient) DeleteOne(h *House) *HouseDeleteOne

DeleteOne returns a delete builder for the given entity.

func (*HouseClient) DeleteOneID

func (c *HouseClient) DeleteOneID(id int64) *HouseDeleteOne

DeleteOneID returns a delete builder for the given id.

func (*HouseClient) Get

func (c *HouseClient) Get(ctx context.Context, id int64) (*House, error)

Get returns a House entity by its id.

func (*HouseClient) GetX

func (c *HouseClient) GetX(ctx context.Context, id int64) *House

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

func (*HouseClient) Hooks

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

Hooks returns the client hooks.

func (*HouseClient) Query

func (c *HouseClient) Query() *HouseQuery

Query returns a query builder for House.

func (*HouseClient) Update

func (c *HouseClient) Update() *HouseUpdate

Update returns an update builder for House.

func (*HouseClient) UpdateOne

func (c *HouseClient) UpdateOne(h *House) *HouseUpdateOne

UpdateOne returns an update builder for the given entity.

func (*HouseClient) UpdateOneID

func (c *HouseClient) UpdateOneID(id int64) *HouseUpdateOne

UpdateOneID returns an update builder for the given id.

func (*HouseClient) Use

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

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

type HouseCreate

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

HouseCreate is the builder for creating a House entity.

func (*HouseCreate) Exec

func (hc *HouseCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*HouseCreate) ExecX

func (hc *HouseCreate) ExecX(ctx context.Context)

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

func (*HouseCreate) Mutation

func (hc *HouseCreate) Mutation() *HouseMutation

Mutation returns the HouseMutation object of the builder.

func (*HouseCreate) Save

func (hc *HouseCreate) Save(ctx context.Context) (*House, error)

Save creates the House in the database.

func (*HouseCreate) SaveX

func (hc *HouseCreate) SaveX(ctx context.Context) *House

SaveX calls Save and panics if Save returns an error.

func (*HouseCreate) SetCommunity

func (hc *HouseCreate) SetCommunity(s string) *HouseCreate

SetCommunity sets the "community" field.

func (*HouseCreate) SetFloorCount

func (hc *HouseCreate) SetFloorCount(i int32) *HouseCreate

SetFloorCount sets the "floor_count" field.

func (*HouseCreate) SetHallCount

func (hc *HouseCreate) SetHallCount(i int32) *HouseCreate

SetHallCount sets the "hall_count" field.

func (*HouseCreate) SetID

func (hc *HouseCreate) SetID(i int64) *HouseCreate

SetID sets the "id" field.

func (*HouseCreate) SetImage

func (hc *HouseCreate) SetImage(s string) *HouseCreate

SetImage sets the "image" field.

func (*HouseCreate) SetKitchenCount

func (hc *HouseCreate) SetKitchenCount(i int32) *HouseCreate

SetKitchenCount sets the "kitchen_count" field.

func (*HouseCreate) SetNillableFloorCount

func (hc *HouseCreate) SetNillableFloorCount(i *int32) *HouseCreate

SetNillableFloorCount sets the "floor_count" field if the given value is not nil.

func (*HouseCreate) SetNillableHallCount

func (hc *HouseCreate) SetNillableHallCount(i *int32) *HouseCreate

SetNillableHallCount sets the "hall_count" field if the given value is not nil.

func (*HouseCreate) SetNillableImage

func (hc *HouseCreate) SetNillableImage(s *string) *HouseCreate

SetNillableImage sets the "image" field if the given value is not nil.

func (*HouseCreate) SetNillableKitchenCount

func (hc *HouseCreate) SetNillableKitchenCount(i *int32) *HouseCreate

SetNillableKitchenCount sets the "kitchen_count" field if the given value is not nil.

func (*HouseCreate) SetNillableRoomCount

func (hc *HouseCreate) SetNillableRoomCount(i *int32) *HouseCreate

SetNillableRoomCount sets the "room_count" field if the given value is not nil.

func (*HouseCreate) SetNillableToiletCount

func (hc *HouseCreate) SetNillableToiletCount(i *int32) *HouseCreate

SetNillableToiletCount sets the "toilet_count" field if the given value is not nil.

func (*HouseCreate) SetPrice

func (hc *HouseCreate) SetPrice(f float64) *HouseCreate

SetPrice sets the "Price" field.

func (*HouseCreate) SetRoomCount

func (hc *HouseCreate) SetRoomCount(i int32) *HouseCreate

SetRoomCount sets the "room_count" field.

func (*HouseCreate) SetTitle

func (hc *HouseCreate) SetTitle(s string) *HouseCreate

SetTitle sets the "title" field.

func (*HouseCreate) SetToiletCount

func (hc *HouseCreate) SetToiletCount(i int32) *HouseCreate

SetToiletCount sets the "toilet_count" field.

type HouseCreateBulk

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

HouseCreateBulk is the builder for creating many House entities in bulk.

func (*HouseCreateBulk) Exec

func (hcb *HouseCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*HouseCreateBulk) ExecX

func (hcb *HouseCreateBulk) ExecX(ctx context.Context)

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

func (*HouseCreateBulk) Save

func (hcb *HouseCreateBulk) Save(ctx context.Context) ([]*House, error)

Save creates the House entities in the database.

func (*HouseCreateBulk) SaveX

func (hcb *HouseCreateBulk) SaveX(ctx context.Context) []*House

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

type HouseDelete

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

HouseDelete is the builder for deleting a House entity.

func (*HouseDelete) Exec

func (hd *HouseDelete) Exec(ctx context.Context) (int, error)

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

func (*HouseDelete) ExecX

func (hd *HouseDelete) ExecX(ctx context.Context) int

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

func (*HouseDelete) Where

func (hd *HouseDelete) Where(ps ...predicate.House) *HouseDelete

Where appends a list predicates to the HouseDelete builder.

type HouseDeleteOne

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

HouseDeleteOne is the builder for deleting a single House entity.

func (*HouseDeleteOne) Exec

func (hdo *HouseDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*HouseDeleteOne) ExecX

func (hdo *HouseDeleteOne) ExecX(ctx context.Context)

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

type HouseGroupBy

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

HouseGroupBy is the group-by builder for House entities.

func (*HouseGroupBy) Aggregate

func (hgb *HouseGroupBy) Aggregate(fns ...AggregateFunc) *HouseGroupBy

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

func (*HouseGroupBy) Bool

func (hgb *HouseGroupBy) Bool(ctx context.Context) (_ bool, err error)

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

func (*HouseGroupBy) BoolX

func (hgb *HouseGroupBy) BoolX(ctx context.Context) bool

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

func (*HouseGroupBy) Bools

func (hgb *HouseGroupBy) Bools(ctx context.Context) ([]bool, error)

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

func (*HouseGroupBy) BoolsX

func (hgb *HouseGroupBy) BoolsX(ctx context.Context) []bool

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

func (*HouseGroupBy) Float64

func (hgb *HouseGroupBy) Float64(ctx context.Context) (_ float64, err error)

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

func (*HouseGroupBy) Float64X

func (hgb *HouseGroupBy) Float64X(ctx context.Context) float64

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

func (*HouseGroupBy) Float64s

func (hgb *HouseGroupBy) Float64s(ctx context.Context) ([]float64, error)

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

func (*HouseGroupBy) Float64sX

func (hgb *HouseGroupBy) Float64sX(ctx context.Context) []float64

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

func (*HouseGroupBy) Int

func (hgb *HouseGroupBy) Int(ctx context.Context) (_ int, err error)

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

func (*HouseGroupBy) IntX

func (hgb *HouseGroupBy) IntX(ctx context.Context) int

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

func (*HouseGroupBy) Ints

func (hgb *HouseGroupBy) Ints(ctx context.Context) ([]int, error)

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

func (*HouseGroupBy) IntsX

func (hgb *HouseGroupBy) IntsX(ctx context.Context) []int

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

func (*HouseGroupBy) Scan

func (hgb *HouseGroupBy) Scan(ctx context.Context, v interface{}) error

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

func (*HouseGroupBy) ScanX

func (hgb *HouseGroupBy) ScanX(ctx context.Context, v interface{})

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

func (*HouseGroupBy) String

func (hgb *HouseGroupBy) String(ctx context.Context) (_ string, err error)

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

func (*HouseGroupBy) StringX

func (hgb *HouseGroupBy) StringX(ctx context.Context) string

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

func (*HouseGroupBy) Strings

func (hgb *HouseGroupBy) Strings(ctx context.Context) ([]string, error)

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

func (*HouseGroupBy) StringsX

func (hgb *HouseGroupBy) StringsX(ctx context.Context) []string

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

type HouseMutation

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

HouseMutation represents an operation that mutates the House nodes in the graph.

func (*HouseMutation) AddField

func (m *HouseMutation) 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 (*HouseMutation) AddFloorCount

func (m *HouseMutation) AddFloorCount(i int32)

AddFloorCount adds i to the "floor_count" field.

func (*HouseMutation) AddHallCount

func (m *HouseMutation) AddHallCount(i int32)

AddHallCount adds i to the "hall_count" field.

func (*HouseMutation) AddKitchenCount

func (m *HouseMutation) AddKitchenCount(i int32)

AddKitchenCount adds i to the "kitchen_count" field.

func (*HouseMutation) AddPrice

func (m *HouseMutation) AddPrice(f float64)

AddPrice adds f to the "Price" field.

func (*HouseMutation) AddRoomCount

func (m *HouseMutation) AddRoomCount(i int32)

AddRoomCount adds i to the "room_count" field.

func (*HouseMutation) AddToiletCount

func (m *HouseMutation) AddToiletCount(i int32)

AddToiletCount adds i to the "toilet_count" field.

func (*HouseMutation) AddedEdges

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

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

func (*HouseMutation) AddedField

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

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

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

func (*HouseMutation) AddedFloorCount

func (m *HouseMutation) AddedFloorCount() (r int32, exists bool)

AddedFloorCount returns the value that was added to the "floor_count" field in this mutation.

func (*HouseMutation) AddedHallCount

func (m *HouseMutation) AddedHallCount() (r int32, exists bool)

AddedHallCount returns the value that was added to the "hall_count" field in this mutation.

func (*HouseMutation) AddedIDs

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

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

func (*HouseMutation) AddedKitchenCount

func (m *HouseMutation) AddedKitchenCount() (r int32, exists bool)

AddedKitchenCount returns the value that was added to the "kitchen_count" field in this mutation.

func (*HouseMutation) AddedPrice

func (m *HouseMutation) AddedPrice() (r float64, exists bool)

AddedPrice returns the value that was added to the "Price" field in this mutation.

func (*HouseMutation) AddedRoomCount

func (m *HouseMutation) AddedRoomCount() (r int32, exists bool)

AddedRoomCount returns the value that was added to the "room_count" field in this mutation.

func (*HouseMutation) AddedToiletCount

func (m *HouseMutation) AddedToiletCount() (r int32, exists bool)

AddedToiletCount returns the value that was added to the "toilet_count" field in this mutation.

func (*HouseMutation) ClearEdge

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

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

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

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

func (*HouseMutation) ClearedFields

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

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

func (HouseMutation) Client

func (m HouseMutation) 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 (*HouseMutation) Community

func (m *HouseMutation) Community() (r string, exists bool)

Community returns the value of the "community" field in the mutation.

func (*HouseMutation) EdgeCleared

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

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

func (*HouseMutation) Field

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

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

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

func (*HouseMutation) Fields

func (m *HouseMutation) 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 (*HouseMutation) FloorCount

func (m *HouseMutation) FloorCount() (r int32, exists bool)

FloorCount returns the value of the "floor_count" field in the mutation.

func (*HouseMutation) HallCount

func (m *HouseMutation) HallCount() (r int32, exists bool)

HallCount returns the value of the "hall_count" field in the mutation.

func (*HouseMutation) ID

func (m *HouseMutation) ID() (id int64, 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 (*HouseMutation) Image

func (m *HouseMutation) Image() (r string, exists bool)

Image returns the value of the "image" field in the mutation.

func (*HouseMutation) KitchenCount

func (m *HouseMutation) KitchenCount() (r int32, exists bool)

KitchenCount returns the value of the "kitchen_count" field in the mutation.

func (*HouseMutation) OldCommunity

func (m *HouseMutation) OldCommunity(ctx context.Context) (v string, err error)

OldCommunity returns the old "community" field's value of the House entity. If the House 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 (*HouseMutation) OldField

func (m *HouseMutation) 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 (*HouseMutation) OldFloorCount

func (m *HouseMutation) OldFloorCount(ctx context.Context) (v int32, err error)

OldFloorCount returns the old "floor_count" field's value of the House entity. If the House 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 (*HouseMutation) OldHallCount

func (m *HouseMutation) OldHallCount(ctx context.Context) (v int32, err error)

OldHallCount returns the old "hall_count" field's value of the House entity. If the House 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 (*HouseMutation) OldImage

func (m *HouseMutation) OldImage(ctx context.Context) (v string, err error)

OldImage returns the old "image" field's value of the House entity. If the House 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 (*HouseMutation) OldKitchenCount

func (m *HouseMutation) OldKitchenCount(ctx context.Context) (v int32, err error)

OldKitchenCount returns the old "kitchen_count" field's value of the House entity. If the House 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 (*HouseMutation) OldPrice

func (m *HouseMutation) OldPrice(ctx context.Context) (v float64, err error)

OldPrice returns the old "Price" field's value of the House entity. If the House 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 (*HouseMutation) OldRoomCount

func (m *HouseMutation) OldRoomCount(ctx context.Context) (v int32, err error)

OldRoomCount returns the old "room_count" field's value of the House entity. If the House 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 (*HouseMutation) OldTitle

func (m *HouseMutation) OldTitle(ctx context.Context) (v string, err error)

OldTitle returns the old "title" field's value of the House entity. If the House 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 (*HouseMutation) OldToiletCount

func (m *HouseMutation) OldToiletCount(ctx context.Context) (v int32, err error)

OldToiletCount returns the old "toilet_count" field's value of the House entity. If the House 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 (*HouseMutation) Op

func (m *HouseMutation) Op() Op

Op returns the operation name.

func (*HouseMutation) Price

func (m *HouseMutation) Price() (r float64, exists bool)

Price returns the value of the "Price" field in the mutation.

func (*HouseMutation) RemovedEdges

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

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

func (*HouseMutation) RemovedIDs

func (m *HouseMutation) 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 (*HouseMutation) ResetCommunity

func (m *HouseMutation) ResetCommunity()

ResetCommunity resets all changes to the "community" field.

func (*HouseMutation) ResetEdge

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

func (m *HouseMutation) 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 (*HouseMutation) ResetFloorCount

func (m *HouseMutation) ResetFloorCount()

ResetFloorCount resets all changes to the "floor_count" field.

func (*HouseMutation) ResetHallCount

func (m *HouseMutation) ResetHallCount()

ResetHallCount resets all changes to the "hall_count" field.

func (*HouseMutation) ResetImage

func (m *HouseMutation) ResetImage()

ResetImage resets all changes to the "image" field.

func (*HouseMutation) ResetKitchenCount

func (m *HouseMutation) ResetKitchenCount()

ResetKitchenCount resets all changes to the "kitchen_count" field.

func (*HouseMutation) ResetPrice

func (m *HouseMutation) ResetPrice()

ResetPrice resets all changes to the "Price" field.

func (*HouseMutation) ResetRoomCount

func (m *HouseMutation) ResetRoomCount()

ResetRoomCount resets all changes to the "room_count" field.

func (*HouseMutation) ResetTitle

func (m *HouseMutation) ResetTitle()

ResetTitle resets all changes to the "title" field.

func (*HouseMutation) ResetToiletCount

func (m *HouseMutation) ResetToiletCount()

ResetToiletCount resets all changes to the "toilet_count" field.

func (*HouseMutation) RoomCount

func (m *HouseMutation) RoomCount() (r int32, exists bool)

RoomCount returns the value of the "room_count" field in the mutation.

func (*HouseMutation) SetCommunity

func (m *HouseMutation) SetCommunity(s string)

SetCommunity sets the "community" field.

func (*HouseMutation) SetField

func (m *HouseMutation) 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 (*HouseMutation) SetFloorCount

func (m *HouseMutation) SetFloorCount(i int32)

SetFloorCount sets the "floor_count" field.

func (*HouseMutation) SetHallCount

func (m *HouseMutation) SetHallCount(i int32)

SetHallCount sets the "hall_count" field.

func (*HouseMutation) SetID

func (m *HouseMutation) SetID(id int64)

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

func (*HouseMutation) SetImage

func (m *HouseMutation) SetImage(s string)

SetImage sets the "image" field.

func (*HouseMutation) SetKitchenCount

func (m *HouseMutation) SetKitchenCount(i int32)

SetKitchenCount sets the "kitchen_count" field.

func (*HouseMutation) SetPrice

func (m *HouseMutation) SetPrice(f float64)

SetPrice sets the "Price" field.

func (*HouseMutation) SetRoomCount

func (m *HouseMutation) SetRoomCount(i int32)

SetRoomCount sets the "room_count" field.

func (*HouseMutation) SetTitle

func (m *HouseMutation) SetTitle(s string)

SetTitle sets the "title" field.

func (*HouseMutation) SetToiletCount

func (m *HouseMutation) SetToiletCount(i int32)

SetToiletCount sets the "toilet_count" field.

func (*HouseMutation) Title

func (m *HouseMutation) Title() (r string, exists bool)

Title returns the value of the "title" field in the mutation.

func (*HouseMutation) ToiletCount

func (m *HouseMutation) ToiletCount() (r int32, exists bool)

ToiletCount returns the value of the "toilet_count" field in the mutation.

func (HouseMutation) Tx

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

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

func (*HouseMutation) Type

func (m *HouseMutation) Type() string

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

func (*HouseMutation) Where

func (m *HouseMutation) Where(ps ...predicate.House)

Where appends a list predicates to the HouseMutation builder.

type HouseQuery

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

HouseQuery is the builder for querying House entities.

func (*HouseQuery) All

func (hq *HouseQuery) All(ctx context.Context) ([]*House, error)

All executes the query and returns a list of Houses.

func (*HouseQuery) AllX

func (hq *HouseQuery) AllX(ctx context.Context) []*House

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

func (*HouseQuery) Clone

func (hq *HouseQuery) Clone() *HouseQuery

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

func (*HouseQuery) Count

func (hq *HouseQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*HouseQuery) CountX

func (hq *HouseQuery) CountX(ctx context.Context) int

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

func (*HouseQuery) Exist

func (hq *HouseQuery) Exist(ctx context.Context) (bool, error)

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

func (*HouseQuery) ExistX

func (hq *HouseQuery) ExistX(ctx context.Context) bool

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

func (*HouseQuery) First

func (hq *HouseQuery) First(ctx context.Context) (*House, error)

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

func (*HouseQuery) FirstID

func (hq *HouseQuery) FirstID(ctx context.Context) (id int64, err error)

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

func (*HouseQuery) FirstIDX

func (hq *HouseQuery) FirstIDX(ctx context.Context) int64

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

func (*HouseQuery) FirstX

func (hq *HouseQuery) FirstX(ctx context.Context) *House

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

func (*HouseQuery) GroupBy

func (hq *HouseQuery) GroupBy(field string, fields ...string) *HouseGroupBy

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 {
	Price float64 `json:"Price,omitempty"`
	Count int `json:"count,omitempty"`
}

client.House.Query().
	GroupBy(house.FieldPrice).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*HouseQuery) IDs

func (hq *HouseQuery) IDs(ctx context.Context) ([]int64, error)

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

func (*HouseQuery) IDsX

func (hq *HouseQuery) IDsX(ctx context.Context) []int64

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

func (*HouseQuery) Limit

func (hq *HouseQuery) Limit(limit int) *HouseQuery

Limit adds a limit step to the query.

func (*HouseQuery) Offset

func (hq *HouseQuery) Offset(offset int) *HouseQuery

Offset adds an offset step to the query.

func (*HouseQuery) Only

func (hq *HouseQuery) Only(ctx context.Context) (*House, error)

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

func (*HouseQuery) OnlyID

func (hq *HouseQuery) OnlyID(ctx context.Context) (id int64, err error)

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

func (*HouseQuery) OnlyIDX

func (hq *HouseQuery) OnlyIDX(ctx context.Context) int64

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

func (*HouseQuery) OnlyX

func (hq *HouseQuery) OnlyX(ctx context.Context) *House

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

func (*HouseQuery) Order

func (hq *HouseQuery) Order(o ...OrderFunc) *HouseQuery

Order adds an order step to the query.

func (*HouseQuery) Select

func (hq *HouseQuery) Select(fields ...string) *HouseSelect

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 {
	Price float64 `json:"Price,omitempty"`
}

client.House.Query().
	Select(house.FieldPrice).
	Scan(ctx, &v)

func (*HouseQuery) Unique

func (hq *HouseQuery) Unique(unique bool) *HouseQuery

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

func (hq *HouseQuery) Where(ps ...predicate.House) *HouseQuery

Where adds a new predicate for the HouseQuery builder.

type HouseSelect

type HouseSelect struct {
	*HouseQuery
	// contains filtered or unexported fields
}

HouseSelect is the builder for selecting fields of House entities.

func (*HouseSelect) Bool

func (hs *HouseSelect) Bool(ctx context.Context) (_ bool, err error)

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

func (*HouseSelect) BoolX

func (hs *HouseSelect) BoolX(ctx context.Context) bool

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

func (*HouseSelect) Bools

func (hs *HouseSelect) Bools(ctx context.Context) ([]bool, error)

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

func (*HouseSelect) BoolsX

func (hs *HouseSelect) BoolsX(ctx context.Context) []bool

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

func (*HouseSelect) Float64

func (hs *HouseSelect) Float64(ctx context.Context) (_ float64, err error)

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

func (*HouseSelect) Float64X

func (hs *HouseSelect) Float64X(ctx context.Context) float64

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

func (*HouseSelect) Float64s

func (hs *HouseSelect) Float64s(ctx context.Context) ([]float64, error)

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

func (*HouseSelect) Float64sX

func (hs *HouseSelect) Float64sX(ctx context.Context) []float64

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

func (*HouseSelect) Int

func (hs *HouseSelect) Int(ctx context.Context) (_ int, err error)

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

func (*HouseSelect) IntX

func (hs *HouseSelect) IntX(ctx context.Context) int

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

func (*HouseSelect) Ints

func (hs *HouseSelect) Ints(ctx context.Context) ([]int, error)

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

func (*HouseSelect) IntsX

func (hs *HouseSelect) IntsX(ctx context.Context) []int

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

func (*HouseSelect) Scan

func (hs *HouseSelect) Scan(ctx context.Context, v interface{}) error

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

func (*HouseSelect) ScanX

func (hs *HouseSelect) ScanX(ctx context.Context, v interface{})

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

func (*HouseSelect) String

func (hs *HouseSelect) String(ctx context.Context) (_ string, err error)

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

func (*HouseSelect) StringX

func (hs *HouseSelect) StringX(ctx context.Context) string

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

func (*HouseSelect) Strings

func (hs *HouseSelect) Strings(ctx context.Context) ([]string, error)

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

func (*HouseSelect) StringsX

func (hs *HouseSelect) StringsX(ctx context.Context) []string

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

type HouseUpdate

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

HouseUpdate is the builder for updating House entities.

func (*HouseUpdate) AddFloorCount

func (hu *HouseUpdate) AddFloorCount(i int32) *HouseUpdate

AddFloorCount adds i to the "floor_count" field.

func (*HouseUpdate) AddHallCount

func (hu *HouseUpdate) AddHallCount(i int32) *HouseUpdate

AddHallCount adds i to the "hall_count" field.

func (*HouseUpdate) AddKitchenCount

func (hu *HouseUpdate) AddKitchenCount(i int32) *HouseUpdate

AddKitchenCount adds i to the "kitchen_count" field.

func (*HouseUpdate) AddPrice

func (hu *HouseUpdate) AddPrice(f float64) *HouseUpdate

AddPrice adds f to the "Price" field.

func (*HouseUpdate) AddRoomCount

func (hu *HouseUpdate) AddRoomCount(i int32) *HouseUpdate

AddRoomCount adds i to the "room_count" field.

func (*HouseUpdate) AddToiletCount

func (hu *HouseUpdate) AddToiletCount(i int32) *HouseUpdate

AddToiletCount adds i to the "toilet_count" field.

func (*HouseUpdate) Exec

func (hu *HouseUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*HouseUpdate) ExecX

func (hu *HouseUpdate) ExecX(ctx context.Context)

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

func (*HouseUpdate) Mutation

func (hu *HouseUpdate) Mutation() *HouseMutation

Mutation returns the HouseMutation object of the builder.

func (*HouseUpdate) Save

func (hu *HouseUpdate) Save(ctx context.Context) (int, error)

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

func (*HouseUpdate) SaveX

func (hu *HouseUpdate) SaveX(ctx context.Context) int

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

func (*HouseUpdate) SetCommunity

func (hu *HouseUpdate) SetCommunity(s string) *HouseUpdate

SetCommunity sets the "community" field.

func (*HouseUpdate) SetFloorCount

func (hu *HouseUpdate) SetFloorCount(i int32) *HouseUpdate

SetFloorCount sets the "floor_count" field.

func (*HouseUpdate) SetHallCount

func (hu *HouseUpdate) SetHallCount(i int32) *HouseUpdate

SetHallCount sets the "hall_count" field.

func (*HouseUpdate) SetImage

func (hu *HouseUpdate) SetImage(s string) *HouseUpdate

SetImage sets the "image" field.

func (*HouseUpdate) SetKitchenCount

func (hu *HouseUpdate) SetKitchenCount(i int32) *HouseUpdate

SetKitchenCount sets the "kitchen_count" field.

func (*HouseUpdate) SetNillableFloorCount

func (hu *HouseUpdate) SetNillableFloorCount(i *int32) *HouseUpdate

SetNillableFloorCount sets the "floor_count" field if the given value is not nil.

func (*HouseUpdate) SetNillableHallCount

func (hu *HouseUpdate) SetNillableHallCount(i *int32) *HouseUpdate

SetNillableHallCount sets the "hall_count" field if the given value is not nil.

func (*HouseUpdate) SetNillableImage

func (hu *HouseUpdate) SetNillableImage(s *string) *HouseUpdate

SetNillableImage sets the "image" field if the given value is not nil.

func (*HouseUpdate) SetNillableKitchenCount

func (hu *HouseUpdate) SetNillableKitchenCount(i *int32) *HouseUpdate

SetNillableKitchenCount sets the "kitchen_count" field if the given value is not nil.

func (*HouseUpdate) SetNillableRoomCount

func (hu *HouseUpdate) SetNillableRoomCount(i *int32) *HouseUpdate

SetNillableRoomCount sets the "room_count" field if the given value is not nil.

func (*HouseUpdate) SetNillableToiletCount

func (hu *HouseUpdate) SetNillableToiletCount(i *int32) *HouseUpdate

SetNillableToiletCount sets the "toilet_count" field if the given value is not nil.

func (*HouseUpdate) SetPrice

func (hu *HouseUpdate) SetPrice(f float64) *HouseUpdate

SetPrice sets the "Price" field.

func (*HouseUpdate) SetRoomCount

func (hu *HouseUpdate) SetRoomCount(i int32) *HouseUpdate

SetRoomCount sets the "room_count" field.

func (*HouseUpdate) SetTitle

func (hu *HouseUpdate) SetTitle(s string) *HouseUpdate

SetTitle sets the "title" field.

func (*HouseUpdate) SetToiletCount

func (hu *HouseUpdate) SetToiletCount(i int32) *HouseUpdate

SetToiletCount sets the "toilet_count" field.

func (*HouseUpdate) Where

func (hu *HouseUpdate) Where(ps ...predicate.House) *HouseUpdate

Where appends a list predicates to the HouseUpdate builder.

type HouseUpdateOne

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

HouseUpdateOne is the builder for updating a single House entity.

func (*HouseUpdateOne) AddFloorCount

func (huo *HouseUpdateOne) AddFloorCount(i int32) *HouseUpdateOne

AddFloorCount adds i to the "floor_count" field.

func (*HouseUpdateOne) AddHallCount

func (huo *HouseUpdateOne) AddHallCount(i int32) *HouseUpdateOne

AddHallCount adds i to the "hall_count" field.

func (*HouseUpdateOne) AddKitchenCount

func (huo *HouseUpdateOne) AddKitchenCount(i int32) *HouseUpdateOne

AddKitchenCount adds i to the "kitchen_count" field.

func (*HouseUpdateOne) AddPrice

func (huo *HouseUpdateOne) AddPrice(f float64) *HouseUpdateOne

AddPrice adds f to the "Price" field.

func (*HouseUpdateOne) AddRoomCount

func (huo *HouseUpdateOne) AddRoomCount(i int32) *HouseUpdateOne

AddRoomCount adds i to the "room_count" field.

func (*HouseUpdateOne) AddToiletCount

func (huo *HouseUpdateOne) AddToiletCount(i int32) *HouseUpdateOne

AddToiletCount adds i to the "toilet_count" field.

func (*HouseUpdateOne) Exec

func (huo *HouseUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*HouseUpdateOne) ExecX

func (huo *HouseUpdateOne) ExecX(ctx context.Context)

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

func (*HouseUpdateOne) Mutation

func (huo *HouseUpdateOne) Mutation() *HouseMutation

Mutation returns the HouseMutation object of the builder.

func (*HouseUpdateOne) Save

func (huo *HouseUpdateOne) Save(ctx context.Context) (*House, error)

Save executes the query and returns the updated House entity.

func (*HouseUpdateOne) SaveX

func (huo *HouseUpdateOne) SaveX(ctx context.Context) *House

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

func (*HouseUpdateOne) Select

func (huo *HouseUpdateOne) Select(field string, fields ...string) *HouseUpdateOne

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

func (*HouseUpdateOne) SetCommunity

func (huo *HouseUpdateOne) SetCommunity(s string) *HouseUpdateOne

SetCommunity sets the "community" field.

func (*HouseUpdateOne) SetFloorCount

func (huo *HouseUpdateOne) SetFloorCount(i int32) *HouseUpdateOne

SetFloorCount sets the "floor_count" field.

func (*HouseUpdateOne) SetHallCount

func (huo *HouseUpdateOne) SetHallCount(i int32) *HouseUpdateOne

SetHallCount sets the "hall_count" field.

func (*HouseUpdateOne) SetImage

func (huo *HouseUpdateOne) SetImage(s string) *HouseUpdateOne

SetImage sets the "image" field.

func (*HouseUpdateOne) SetKitchenCount

func (huo *HouseUpdateOne) SetKitchenCount(i int32) *HouseUpdateOne

SetKitchenCount sets the "kitchen_count" field.

func (*HouseUpdateOne) SetNillableFloorCount

func (huo *HouseUpdateOne) SetNillableFloorCount(i *int32) *HouseUpdateOne

SetNillableFloorCount sets the "floor_count" field if the given value is not nil.

func (*HouseUpdateOne) SetNillableHallCount

func (huo *HouseUpdateOne) SetNillableHallCount(i *int32) *HouseUpdateOne

SetNillableHallCount sets the "hall_count" field if the given value is not nil.

func (*HouseUpdateOne) SetNillableImage

func (huo *HouseUpdateOne) SetNillableImage(s *string) *HouseUpdateOne

SetNillableImage sets the "image" field if the given value is not nil.

func (*HouseUpdateOne) SetNillableKitchenCount

func (huo *HouseUpdateOne) SetNillableKitchenCount(i *int32) *HouseUpdateOne

SetNillableKitchenCount sets the "kitchen_count" field if the given value is not nil.

func (*HouseUpdateOne) SetNillableRoomCount

func (huo *HouseUpdateOne) SetNillableRoomCount(i *int32) *HouseUpdateOne

SetNillableRoomCount sets the "room_count" field if the given value is not nil.

func (*HouseUpdateOne) SetNillableToiletCount

func (huo *HouseUpdateOne) SetNillableToiletCount(i *int32) *HouseUpdateOne

SetNillableToiletCount sets the "toilet_count" field if the given value is not nil.

func (*HouseUpdateOne) SetPrice

func (huo *HouseUpdateOne) SetPrice(f float64) *HouseUpdateOne

SetPrice sets the "Price" field.

func (*HouseUpdateOne) SetRoomCount

func (huo *HouseUpdateOne) SetRoomCount(i int32) *HouseUpdateOne

SetRoomCount sets the "room_count" field.

func (*HouseUpdateOne) SetTitle

func (huo *HouseUpdateOne) SetTitle(s string) *HouseUpdateOne

SetTitle sets the "title" field.

func (*HouseUpdateOne) SetToiletCount

func (huo *HouseUpdateOne) SetToiletCount(i int32) *HouseUpdateOne

SetToiletCount sets the "toilet_count" field.

type Houses

type Houses []*House

Houses is a parsable slice of House.

type MutateFunc

type MutateFunc = ent.MutateFunc

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

type Mutation

type Mutation = ent.Mutation

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

type Mutator

type Mutator = ent.Mutator

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

type NotFoundError

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

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

func (*NotFoundError) Error

func (e *NotFoundError) Error() string

Error implements the error interface.

type NotLoadedError

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

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

func (*NotLoadedError) Error

func (e *NotLoadedError) Error() string

Error implements the error interface.

type NotSingularError

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

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

func (*NotSingularError) Error

func (e *NotSingularError) Error() string

Error implements the error interface.

type Op

type Op = ent.Op

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

type Option

type Option func(*config)

Option function to configure the client.

func Debug

func Debug() Option

Debug enables debug logging on the ent.Driver.

func Driver

func Driver(driver dialect.Driver) Option

Driver configures the client driver.

func Log

func Log(fn func(...interface{})) Option

Log sets the logging function for debug mode.

type OrderFunc

type OrderFunc func(*sql.Selector)

OrderFunc applies an ordering on the sql selector.

func Asc

func Asc(fields ...string) OrderFunc

Asc applies the given fields in ASC order.

func Desc

func Desc(fields ...string) OrderFunc

Desc applies the given fields in DESC order.

type Policy

type Policy = ent.Policy

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

type Query

type Query = ent.Query

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

type RollbackFunc

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

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

func (RollbackFunc) Rollback

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

Rollback calls f(ctx, m).

type RollbackHook

type RollbackHook func(Rollbacker) Rollbacker

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

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

type Rollbacker

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

Rollbacker is the interface that wraps the Rollbacker method.

type Tx

type Tx struct {

	// House is the client for interacting with the House builders.
	House *HouseClient
	// contains filtered or unexported fields
}

Tx is a transactional client that is created by calling Client.Tx().

func TxFromContext

func TxFromContext(ctx context.Context) *Tx

TxFromContext returns a Tx stored inside a context, or nil if there isn't one.

func (*Tx) Client

func (tx *Tx) Client() *Client

Client returns a Client that binds to current transaction.

func (*Tx) Commit

func (tx *Tx) Commit() error

Commit commits the transaction.

func (*Tx) OnCommit

func (tx *Tx) OnCommit(f CommitHook)

OnCommit adds a hook to call on commit.

func (*Tx) OnRollback

func (tx *Tx) OnRollback(f RollbackHook)

OnRollback adds a hook to call on rollback.

func (*Tx) Rollback

func (tx *Tx) Rollback() error

Rollback rollbacks the transaction.

type ValidationError

type ValidationError struct {
	Name string // Field or edge name.
	// contains filtered or unexported fields
}

ValidationError returns when validating a field fails.

func (*ValidationError) Error

func (e *ValidationError) Error() string

Error implements the error interface.

func (*ValidationError) Unwrap

func (e *ValidationError) Unwrap() error

Unwrap implements the errors.Wrapper interface.

type Value

type Value = ent.Value

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL