ent

package
v0.0.0-...-31c84d2 Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2022 License: GPL-2.0 Imports: 17 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.
	TypeCommunity = "Community"
	TypeShop      = "Shop"
)

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
	// Community is the client for interacting with the Community builders.
	Community *CommunityClient
	// Shop is the client for interacting with the Shop builders.
	Shop *ShopClient
	// 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().
	Community.
	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(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 Communities

type Communities []*Community

Communities is a parsable slice of Community.

type Community

type Community struct {

	// ID of the ent.
	ID int `json:"id,omitempty"`
	// Name holds the value of the "name" field.
	Name string `json:"name,omitempty"`
	// ProvinceID holds the value of the "province_id" field.
	ProvinceID int `json:"province_id,omitempty"`
	// CityID holds the value of the "city_id" field.
	CityID int `json:"city_id,omitempty"`
	// AreaID holds the value of the "area_id" field.
	AreaID int `json:"area_id,omitempty"`
	// AreaNum holds the value of the "area_num" field.
	AreaNum int `json:"area_num,omitempty"`
	// AdminID holds the value of the "admin_id" field.
	AdminID int `json:"admin_id,omitempty"`
	// CommNumber holds the value of the "comm_number" field.
	CommNumber int `json:"comm_number,omitempty"`
	// State holds the value of the "state" field.
	State int `json:"state,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"`
	// CreatedAt holds the value of the "created_at" field.
	CreatedAt time.Time `json:"created_at,omitempty"`
	// UpdatedAt holds the value of the "updated_at" field.
	UpdatedAt time.Time `json:"updated_at,omitempty"`
	// DeletedAt holds the value of the "deleted_at" field.
	DeletedAt time.Time `json:"deleted_at,omitempty"`
	// contains filtered or unexported fields
}

Community is the model entity for the Community schema.

func (*Community) String

func (c *Community) String() string

String implements the fmt.Stringer.

func (*Community) Unwrap

func (c *Community) Unwrap() *Community

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

func (c *Community) Update() *CommunityUpdateOne

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

type CommunityClient

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

CommunityClient is a client for the Community schema.

func NewCommunityClient

func NewCommunityClient(c config) *CommunityClient

NewCommunityClient returns a client for the Community from the given config.

func (*CommunityClient) Create

func (c *CommunityClient) Create() *CommunityCreate

Create returns a create builder for Community.

func (*CommunityClient) CreateBulk

func (c *CommunityClient) CreateBulk(builders ...*CommunityCreate) *CommunityCreateBulk

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

func (*CommunityClient) Delete

func (c *CommunityClient) Delete() *CommunityDelete

Delete returns a delete builder for Community.

func (*CommunityClient) DeleteOne

func (c *CommunityClient) DeleteOne(co *Community) *CommunityDeleteOne

DeleteOne returns a delete builder for the given entity.

func (*CommunityClient) DeleteOneID

func (c *CommunityClient) DeleteOneID(id int) *CommunityDeleteOne

DeleteOneID returns a delete builder for the given id.

func (*CommunityClient) Get

func (c *CommunityClient) Get(ctx context.Context, id int) (*Community, error)

Get returns a Community entity by its id.

func (*CommunityClient) GetX

func (c *CommunityClient) GetX(ctx context.Context, id int) *Community

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

func (*CommunityClient) Hooks

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

Hooks returns the client hooks.

func (*CommunityClient) Query

func (c *CommunityClient) Query() *CommunityQuery

Query returns a query builder for Community.

func (*CommunityClient) Update

func (c *CommunityClient) Update() *CommunityUpdate

Update returns an update builder for Community.

func (*CommunityClient) UpdateOne

func (c *CommunityClient) UpdateOne(co *Community) *CommunityUpdateOne

UpdateOne returns an update builder for the given entity.

func (*CommunityClient) UpdateOneID

func (c *CommunityClient) UpdateOneID(id int) *CommunityUpdateOne

UpdateOneID returns an update builder for the given id.

func (*CommunityClient) Use

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

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

type CommunityCreate

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

CommunityCreate is the builder for creating a Community entity.

func (*CommunityCreate) Exec

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

Exec executes the query.

func (*CommunityCreate) ExecX

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

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

func (*CommunityCreate) Mutation

func (cc *CommunityCreate) Mutation() *CommunityMutation

Mutation returns the CommunityMutation object of the builder.

func (*CommunityCreate) Save

func (cc *CommunityCreate) Save(ctx context.Context) (*Community, error)

Save creates the Community in the database.

func (*CommunityCreate) SaveX

func (cc *CommunityCreate) SaveX(ctx context.Context) *Community

SaveX calls Save and panics if Save returns an error.

func (*CommunityCreate) SetAdminID

func (cc *CommunityCreate) SetAdminID(i int) *CommunityCreate

SetAdminID sets the "admin_id" field.

func (*CommunityCreate) SetAreaID

func (cc *CommunityCreate) SetAreaID(i int) *CommunityCreate

SetAreaID sets the "area_id" field.

func (*CommunityCreate) SetAreaNum

func (cc *CommunityCreate) SetAreaNum(i int) *CommunityCreate

SetAreaNum sets the "area_num" field.

func (*CommunityCreate) SetCityID

func (cc *CommunityCreate) SetCityID(i int) *CommunityCreate

SetCityID sets the "city_id" field.

func (*CommunityCreate) SetCommNumber

func (cc *CommunityCreate) SetCommNumber(i int) *CommunityCreate

SetCommNumber sets the "comm_number" field.

func (*CommunityCreate) SetCreatedAt

func (cc *CommunityCreate) SetCreatedAt(t time.Time) *CommunityCreate

SetCreatedAt sets the "created_at" field.

func (*CommunityCreate) SetDeletedAt

func (cc *CommunityCreate) SetDeletedAt(t time.Time) *CommunityCreate

SetDeletedAt sets the "deleted_at" field.

func (*CommunityCreate) SetEndTime

func (cc *CommunityCreate) SetEndTime(t time.Time) *CommunityCreate

SetEndTime sets the "end_time" field.

func (*CommunityCreate) SetID

func (cc *CommunityCreate) SetID(i int) *CommunityCreate

SetID sets the "id" field.

func (*CommunityCreate) SetName

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

SetName sets the "name" field.

func (*CommunityCreate) SetProvinceID

func (cc *CommunityCreate) SetProvinceID(i int) *CommunityCreate

SetProvinceID sets the "province_id" field.

func (*CommunityCreate) SetStartTime

func (cc *CommunityCreate) SetStartTime(t time.Time) *CommunityCreate

SetStartTime sets the "start_time" field.

func (*CommunityCreate) SetState

func (cc *CommunityCreate) SetState(i int) *CommunityCreate

SetState sets the "state" field.

func (*CommunityCreate) SetUpdatedAt

func (cc *CommunityCreate) SetUpdatedAt(t time.Time) *CommunityCreate

SetUpdatedAt sets the "updated_at" field.

type CommunityCreateBulk

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

CommunityCreateBulk is the builder for creating many Community entities in bulk.

func (*CommunityCreateBulk) Exec

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

Exec executes the query.

func (*CommunityCreateBulk) ExecX

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

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

func (*CommunityCreateBulk) Save

func (ccb *CommunityCreateBulk) Save(ctx context.Context) ([]*Community, error)

Save creates the Community entities in the database.

func (*CommunityCreateBulk) SaveX

func (ccb *CommunityCreateBulk) SaveX(ctx context.Context) []*Community

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

type CommunityDelete

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

CommunityDelete is the builder for deleting a Community entity.

func (*CommunityDelete) Exec

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

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

func (*CommunityDelete) ExecX

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

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

func (*CommunityDelete) Where

Where appends a list predicates to the CommunityDelete builder.

type CommunityDeleteOne

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

CommunityDeleteOne is the builder for deleting a single Community entity.

func (*CommunityDeleteOne) Exec

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

Exec executes the deletion query.

func (*CommunityDeleteOne) ExecX

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

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

type CommunityGroupBy

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

CommunityGroupBy is the group-by builder for Community entities.

func (*CommunityGroupBy) Aggregate

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

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

func (*CommunityGroupBy) Bool

func (cgb *CommunityGroupBy) 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 (*CommunityGroupBy) BoolX

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

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

func (*CommunityGroupBy) Bools

func (cgb *CommunityGroupBy) 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 (*CommunityGroupBy) BoolsX

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

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

func (*CommunityGroupBy) Float64

func (cgb *CommunityGroupBy) 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 (*CommunityGroupBy) Float64X

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

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

func (*CommunityGroupBy) Float64s

func (cgb *CommunityGroupBy) 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 (*CommunityGroupBy) Float64sX

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

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

func (*CommunityGroupBy) Int

func (cgb *CommunityGroupBy) 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 (*CommunityGroupBy) IntX

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

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

func (*CommunityGroupBy) Ints

func (cgb *CommunityGroupBy) 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 (*CommunityGroupBy) IntsX

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

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

func (*CommunityGroupBy) Scan

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

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

func (*CommunityGroupBy) ScanX

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

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

func (*CommunityGroupBy) String

func (cgb *CommunityGroupBy) 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 (*CommunityGroupBy) StringX

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

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

func (*CommunityGroupBy) Strings

func (cgb *CommunityGroupBy) 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 (*CommunityGroupBy) StringsX

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

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

type CommunityMutation

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

CommunityMutation represents an operation that mutates the Community nodes in the graph.

func (*CommunityMutation) AddAdminID

func (m *CommunityMutation) AddAdminID(i int)

AddAdminID adds i to the "admin_id" field.

func (*CommunityMutation) AddAreaID

func (m *CommunityMutation) AddAreaID(i int)

AddAreaID adds i to the "area_id" field.

func (*CommunityMutation) AddAreaNum

func (m *CommunityMutation) AddAreaNum(i int)

AddAreaNum adds i to the "area_num" field.

func (*CommunityMutation) AddCityID

func (m *CommunityMutation) AddCityID(i int)

AddCityID adds i to the "city_id" field.

func (*CommunityMutation) AddCommNumber

func (m *CommunityMutation) AddCommNumber(i int)

AddCommNumber adds i to the "comm_number" field.

func (*CommunityMutation) AddField

func (m *CommunityMutation) 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 (*CommunityMutation) AddProvinceID

func (m *CommunityMutation) AddProvinceID(i int)

AddProvinceID adds i to the "province_id" field.

func (*CommunityMutation) AddState

func (m *CommunityMutation) AddState(i int)

AddState adds i to the "state" field.

func (*CommunityMutation) AddedAdminID

func (m *CommunityMutation) AddedAdminID() (r int, exists bool)

AddedAdminID returns the value that was added to the "admin_id" field in this mutation.

func (*CommunityMutation) AddedAreaID

func (m *CommunityMutation) AddedAreaID() (r int, exists bool)

AddedAreaID returns the value that was added to the "area_id" field in this mutation.

func (*CommunityMutation) AddedAreaNum

func (m *CommunityMutation) AddedAreaNum() (r int, exists bool)

AddedAreaNum returns the value that was added to the "area_num" field in this mutation.

func (*CommunityMutation) AddedCityID

func (m *CommunityMutation) AddedCityID() (r int, exists bool)

AddedCityID returns the value that was added to the "city_id" field in this mutation.

func (*CommunityMutation) AddedCommNumber

func (m *CommunityMutation) AddedCommNumber() (r int, exists bool)

AddedCommNumber returns the value that was added to the "comm_number" field in this mutation.

func (*CommunityMutation) AddedEdges

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

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

func (*CommunityMutation) AddedField

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

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

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

func (*CommunityMutation) AddedIDs

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

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

func (*CommunityMutation) AddedProvinceID

func (m *CommunityMutation) AddedProvinceID() (r int, exists bool)

AddedProvinceID returns the value that was added to the "province_id" field in this mutation.

func (*CommunityMutation) AddedState

func (m *CommunityMutation) AddedState() (r int, exists bool)

AddedState returns the value that was added to the "state" field in this mutation.

func (*CommunityMutation) AdminID

func (m *CommunityMutation) AdminID() (r int, exists bool)

AdminID returns the value of the "admin_id" field in the mutation.

func (*CommunityMutation) AreaID

func (m *CommunityMutation) AreaID() (r int, exists bool)

AreaID returns the value of the "area_id" field in the mutation.

func (*CommunityMutation) AreaNum

func (m *CommunityMutation) AreaNum() (r int, exists bool)

AreaNum returns the value of the "area_num" field in the mutation.

func (*CommunityMutation) CityID

func (m *CommunityMutation) CityID() (r int, exists bool)

CityID returns the value of the "city_id" field in the mutation.

func (*CommunityMutation) ClearEdge

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

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

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

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

func (*CommunityMutation) ClearedFields

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

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

func (CommunityMutation) Client

func (m CommunityMutation) 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 (*CommunityMutation) CommNumber

func (m *CommunityMutation) CommNumber() (r int, exists bool)

CommNumber returns the value of the "comm_number" field in the mutation.

func (*CommunityMutation) CreatedAt

func (m *CommunityMutation) CreatedAt() (r time.Time, exists bool)

CreatedAt returns the value of the "created_at" field in the mutation.

func (*CommunityMutation) DeletedAt

func (m *CommunityMutation) DeletedAt() (r time.Time, exists bool)

DeletedAt returns the value of the "deleted_at" field in the mutation.

func (*CommunityMutation) EdgeCleared

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

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

func (*CommunityMutation) EndTime

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

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

func (*CommunityMutation) Field

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

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

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

func (*CommunityMutation) Fields

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

func (m *CommunityMutation) ID() (id int, exists bool)

ID returns the ID value in the mutation. Note that the ID is only available if it was provided to the builder or after it was returned from the database.

func (*CommunityMutation) IDs

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

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

func (*CommunityMutation) Name

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

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

func (*CommunityMutation) OldAdminID

func (m *CommunityMutation) OldAdminID(ctx context.Context) (v int, err error)

OldAdminID returns the old "admin_id" field's value of the Community entity. If the Community 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 (*CommunityMutation) OldAreaID

func (m *CommunityMutation) OldAreaID(ctx context.Context) (v int, err error)

OldAreaID returns the old "area_id" field's value of the Community entity. If the Community 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 (*CommunityMutation) OldAreaNum

func (m *CommunityMutation) OldAreaNum(ctx context.Context) (v int, err error)

OldAreaNum returns the old "area_num" field's value of the Community entity. If the Community 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 (*CommunityMutation) OldCityID

func (m *CommunityMutation) OldCityID(ctx context.Context) (v int, err error)

OldCityID returns the old "city_id" field's value of the Community entity. If the Community 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 (*CommunityMutation) OldCommNumber

func (m *CommunityMutation) OldCommNumber(ctx context.Context) (v int, err error)

OldCommNumber returns the old "comm_number" field's value of the Community entity. If the Community 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 (*CommunityMutation) OldCreatedAt

func (m *CommunityMutation) OldCreatedAt(ctx context.Context) (v time.Time, err error)

OldCreatedAt returns the old "created_at" field's value of the Community entity. If the Community 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 (*CommunityMutation) OldDeletedAt

func (m *CommunityMutation) OldDeletedAt(ctx context.Context) (v time.Time, err error)

OldDeletedAt returns the old "deleted_at" field's value of the Community entity. If the Community 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 (*CommunityMutation) OldEndTime

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

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

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

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

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

func (m *CommunityMutation) OldProvinceID(ctx context.Context) (v int, err error)

OldProvinceID returns the old "province_id" field's value of the Community entity. If the Community 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 (*CommunityMutation) OldStartTime

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

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

func (m *CommunityMutation) OldState(ctx context.Context) (v int, err error)

OldState returns the old "state" field's value of the Community entity. If the Community 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 (*CommunityMutation) OldUpdatedAt

func (m *CommunityMutation) OldUpdatedAt(ctx context.Context) (v time.Time, err error)

OldUpdatedAt returns the old "updated_at" field's value of the Community entity. If the Community 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 (*CommunityMutation) Op

func (m *CommunityMutation) Op() Op

Op returns the operation name.

func (*CommunityMutation) ProvinceID

func (m *CommunityMutation) ProvinceID() (r int, exists bool)

ProvinceID returns the value of the "province_id" field in the mutation.

func (*CommunityMutation) RemovedEdges

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

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

func (*CommunityMutation) RemovedIDs

func (m *CommunityMutation) 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 (*CommunityMutation) ResetAdminID

func (m *CommunityMutation) ResetAdminID()

ResetAdminID resets all changes to the "admin_id" field.

func (*CommunityMutation) ResetAreaID

func (m *CommunityMutation) ResetAreaID()

ResetAreaID resets all changes to the "area_id" field.

func (*CommunityMutation) ResetAreaNum

func (m *CommunityMutation) ResetAreaNum()

ResetAreaNum resets all changes to the "area_num" field.

func (*CommunityMutation) ResetCityID

func (m *CommunityMutation) ResetCityID()

ResetCityID resets all changes to the "city_id" field.

func (*CommunityMutation) ResetCommNumber

func (m *CommunityMutation) ResetCommNumber()

ResetCommNumber resets all changes to the "comm_number" field.

func (*CommunityMutation) ResetCreatedAt

func (m *CommunityMutation) ResetCreatedAt()

ResetCreatedAt resets all changes to the "created_at" field.

func (*CommunityMutation) ResetDeletedAt

func (m *CommunityMutation) ResetDeletedAt()

ResetDeletedAt resets all changes to the "deleted_at" field.

func (*CommunityMutation) ResetEdge

func (m *CommunityMutation) 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 (*CommunityMutation) ResetEndTime

func (m *CommunityMutation) ResetEndTime()

ResetEndTime resets all changes to the "end_time" field.

func (*CommunityMutation) ResetField

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

func (m *CommunityMutation) ResetName()

ResetName resets all changes to the "name" field.

func (*CommunityMutation) ResetProvinceID

func (m *CommunityMutation) ResetProvinceID()

ResetProvinceID resets all changes to the "province_id" field.

func (*CommunityMutation) ResetStartTime

func (m *CommunityMutation) ResetStartTime()

ResetStartTime resets all changes to the "start_time" field.

func (*CommunityMutation) ResetState

func (m *CommunityMutation) ResetState()

ResetState resets all changes to the "state" field.

func (*CommunityMutation) ResetUpdatedAt

func (m *CommunityMutation) ResetUpdatedAt()

ResetUpdatedAt resets all changes to the "updated_at" field.

func (*CommunityMutation) SetAdminID

func (m *CommunityMutation) SetAdminID(i int)

SetAdminID sets the "admin_id" field.

func (*CommunityMutation) SetAreaID

func (m *CommunityMutation) SetAreaID(i int)

SetAreaID sets the "area_id" field.

func (*CommunityMutation) SetAreaNum

func (m *CommunityMutation) SetAreaNum(i int)

SetAreaNum sets the "area_num" field.

func (*CommunityMutation) SetCityID

func (m *CommunityMutation) SetCityID(i int)

SetCityID sets the "city_id" field.

func (*CommunityMutation) SetCommNumber

func (m *CommunityMutation) SetCommNumber(i int)

SetCommNumber sets the "comm_number" field.

func (*CommunityMutation) SetCreatedAt

func (m *CommunityMutation) SetCreatedAt(t time.Time)

SetCreatedAt sets the "created_at" field.

func (*CommunityMutation) SetDeletedAt

func (m *CommunityMutation) SetDeletedAt(t time.Time)

SetDeletedAt sets the "deleted_at" field.

func (*CommunityMutation) SetEndTime

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

SetEndTime sets the "end_time" field.

func (*CommunityMutation) SetField

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

func (m *CommunityMutation) SetID(id int)

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

func (*CommunityMutation) SetName

func (m *CommunityMutation) SetName(s string)

SetName sets the "name" field.

func (*CommunityMutation) SetProvinceID

func (m *CommunityMutation) SetProvinceID(i int)

SetProvinceID sets the "province_id" field.

func (*CommunityMutation) SetStartTime

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

SetStartTime sets the "start_time" field.

func (*CommunityMutation) SetState

func (m *CommunityMutation) SetState(i int)

SetState sets the "state" field.

func (*CommunityMutation) SetUpdatedAt

func (m *CommunityMutation) SetUpdatedAt(t time.Time)

SetUpdatedAt sets the "updated_at" field.

func (*CommunityMutation) StartTime

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

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

func (*CommunityMutation) State

func (m *CommunityMutation) State() (r int, exists bool)

State returns the value of the "state" field in the mutation.

func (CommunityMutation) Tx

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

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

func (*CommunityMutation) Type

func (m *CommunityMutation) Type() string

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

func (*CommunityMutation) UpdatedAt

func (m *CommunityMutation) UpdatedAt() (r time.Time, exists bool)

UpdatedAt returns the value of the "updated_at" field in the mutation.

func (*CommunityMutation) Where

func (m *CommunityMutation) Where(ps ...predicate.Community)

Where appends a list predicates to the CommunityMutation builder.

type CommunityQuery

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

CommunityQuery is the builder for querying Community entities.

func (*CommunityQuery) All

func (cq *CommunityQuery) All(ctx context.Context) ([]*Community, error)

All executes the query and returns a list of Communities.

func (*CommunityQuery) AllX

func (cq *CommunityQuery) AllX(ctx context.Context) []*Community

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

func (*CommunityQuery) Clone

func (cq *CommunityQuery) Clone() *CommunityQuery

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

func (*CommunityQuery) Count

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

Count returns the count of the given query.

func (*CommunityQuery) CountX

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

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

func (*CommunityQuery) Exist

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

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

func (*CommunityQuery) ExistX

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

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

func (*CommunityQuery) First

func (cq *CommunityQuery) First(ctx context.Context) (*Community, error)

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

func (*CommunityQuery) FirstID

func (cq *CommunityQuery) FirstID(ctx context.Context) (id int, err error)

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

func (*CommunityQuery) FirstIDX

func (cq *CommunityQuery) FirstIDX(ctx context.Context) int

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

func (*CommunityQuery) FirstX

func (cq *CommunityQuery) FirstX(ctx context.Context) *Community

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

func (*CommunityQuery) GroupBy

func (cq *CommunityQuery) GroupBy(field string, fields ...string) *CommunityGroupBy

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

Example:

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

client.Community.Query().
	GroupBy(community.FieldName).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*CommunityQuery) IDs

func (cq *CommunityQuery) IDs(ctx context.Context) ([]int, error)

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

func (*CommunityQuery) IDsX

func (cq *CommunityQuery) IDsX(ctx context.Context) []int

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

func (*CommunityQuery) Limit

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

Limit adds a limit step to the query.

func (*CommunityQuery) Offset

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

Offset adds an offset step to the query.

func (*CommunityQuery) Only

func (cq *CommunityQuery) Only(ctx context.Context) (*Community, error)

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

func (*CommunityQuery) OnlyID

func (cq *CommunityQuery) OnlyID(ctx context.Context) (id int, err error)

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

func (*CommunityQuery) OnlyIDX

func (cq *CommunityQuery) OnlyIDX(ctx context.Context) int

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

func (*CommunityQuery) OnlyX

func (cq *CommunityQuery) OnlyX(ctx context.Context) *Community

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

func (*CommunityQuery) Order

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

Order adds an order step to the query.

func (*CommunityQuery) Select

func (cq *CommunityQuery) Select(fields ...string) *CommunitySelect

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

Example:

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

client.Community.Query().
	Select(community.FieldName).
	Scan(ctx, &v)

func (*CommunityQuery) Unique

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

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

Where adds a new predicate for the CommunityQuery builder.

type CommunitySelect

type CommunitySelect struct {
	*CommunityQuery
	// contains filtered or unexported fields
}

CommunitySelect is the builder for selecting fields of Community entities.

func (*CommunitySelect) Bool

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

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

func (*CommunitySelect) BoolX

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

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

func (*CommunitySelect) Bools

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

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

func (*CommunitySelect) BoolsX

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

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

func (*CommunitySelect) Float64

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

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

func (*CommunitySelect) Float64X

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

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

func (*CommunitySelect) Float64s

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

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

func (*CommunitySelect) Float64sX

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

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

func (*CommunitySelect) Int

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

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

func (*CommunitySelect) IntX

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

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

func (*CommunitySelect) Ints

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

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

func (*CommunitySelect) IntsX

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

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

func (*CommunitySelect) Scan

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

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

func (*CommunitySelect) ScanX

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

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

func (*CommunitySelect) String

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

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

func (*CommunitySelect) StringX

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

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

func (*CommunitySelect) Strings

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

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

func (*CommunitySelect) StringsX

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

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

type CommunityUpdate

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

CommunityUpdate is the builder for updating Community entities.

func (*CommunityUpdate) AddAdminID

func (cu *CommunityUpdate) AddAdminID(i int) *CommunityUpdate

AddAdminID adds i to the "admin_id" field.

func (*CommunityUpdate) AddAreaID

func (cu *CommunityUpdate) AddAreaID(i int) *CommunityUpdate

AddAreaID adds i to the "area_id" field.

func (*CommunityUpdate) AddAreaNum

func (cu *CommunityUpdate) AddAreaNum(i int) *CommunityUpdate

AddAreaNum adds i to the "area_num" field.

func (*CommunityUpdate) AddCityID

func (cu *CommunityUpdate) AddCityID(i int) *CommunityUpdate

AddCityID adds i to the "city_id" field.

func (*CommunityUpdate) AddCommNumber

func (cu *CommunityUpdate) AddCommNumber(i int) *CommunityUpdate

AddCommNumber adds i to the "comm_number" field.

func (*CommunityUpdate) AddProvinceID

func (cu *CommunityUpdate) AddProvinceID(i int) *CommunityUpdate

AddProvinceID adds i to the "province_id" field.

func (*CommunityUpdate) AddState

func (cu *CommunityUpdate) AddState(i int) *CommunityUpdate

AddState adds i to the "state" field.

func (*CommunityUpdate) Exec

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

Exec executes the query.

func (*CommunityUpdate) ExecX

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

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

func (*CommunityUpdate) Mutation

func (cu *CommunityUpdate) Mutation() *CommunityMutation

Mutation returns the CommunityMutation object of the builder.

func (*CommunityUpdate) Save

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

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

func (*CommunityUpdate) SaveX

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

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

func (*CommunityUpdate) SetAdminID

func (cu *CommunityUpdate) SetAdminID(i int) *CommunityUpdate

SetAdminID sets the "admin_id" field.

func (*CommunityUpdate) SetAreaID

func (cu *CommunityUpdate) SetAreaID(i int) *CommunityUpdate

SetAreaID sets the "area_id" field.

func (*CommunityUpdate) SetAreaNum

func (cu *CommunityUpdate) SetAreaNum(i int) *CommunityUpdate

SetAreaNum sets the "area_num" field.

func (*CommunityUpdate) SetCityID

func (cu *CommunityUpdate) SetCityID(i int) *CommunityUpdate

SetCityID sets the "city_id" field.

func (*CommunityUpdate) SetCommNumber

func (cu *CommunityUpdate) SetCommNumber(i int) *CommunityUpdate

SetCommNumber sets the "comm_number" field.

func (*CommunityUpdate) SetCreatedAt

func (cu *CommunityUpdate) SetCreatedAt(t time.Time) *CommunityUpdate

SetCreatedAt sets the "created_at" field.

func (*CommunityUpdate) SetDeletedAt

func (cu *CommunityUpdate) SetDeletedAt(t time.Time) *CommunityUpdate

SetDeletedAt sets the "deleted_at" field.

func (*CommunityUpdate) SetEndTime

func (cu *CommunityUpdate) SetEndTime(t time.Time) *CommunityUpdate

SetEndTime sets the "end_time" field.

func (*CommunityUpdate) SetName

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

SetName sets the "name" field.

func (*CommunityUpdate) SetProvinceID

func (cu *CommunityUpdate) SetProvinceID(i int) *CommunityUpdate

SetProvinceID sets the "province_id" field.

func (*CommunityUpdate) SetStartTime

func (cu *CommunityUpdate) SetStartTime(t time.Time) *CommunityUpdate

SetStartTime sets the "start_time" field.

func (*CommunityUpdate) SetState

func (cu *CommunityUpdate) SetState(i int) *CommunityUpdate

SetState sets the "state" field.

func (*CommunityUpdate) SetUpdatedAt

func (cu *CommunityUpdate) SetUpdatedAt(t time.Time) *CommunityUpdate

SetUpdatedAt sets the "updated_at" field.

func (*CommunityUpdate) Where

Where appends a list predicates to the CommunityUpdate builder.

type CommunityUpdateOne

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

CommunityUpdateOne is the builder for updating a single Community entity.

func (*CommunityUpdateOne) AddAdminID

func (cuo *CommunityUpdateOne) AddAdminID(i int) *CommunityUpdateOne

AddAdminID adds i to the "admin_id" field.

func (*CommunityUpdateOne) AddAreaID

func (cuo *CommunityUpdateOne) AddAreaID(i int) *CommunityUpdateOne

AddAreaID adds i to the "area_id" field.

func (*CommunityUpdateOne) AddAreaNum

func (cuo *CommunityUpdateOne) AddAreaNum(i int) *CommunityUpdateOne

AddAreaNum adds i to the "area_num" field.

func (*CommunityUpdateOne) AddCityID

func (cuo *CommunityUpdateOne) AddCityID(i int) *CommunityUpdateOne

AddCityID adds i to the "city_id" field.

func (*CommunityUpdateOne) AddCommNumber

func (cuo *CommunityUpdateOne) AddCommNumber(i int) *CommunityUpdateOne

AddCommNumber adds i to the "comm_number" field.

func (*CommunityUpdateOne) AddProvinceID

func (cuo *CommunityUpdateOne) AddProvinceID(i int) *CommunityUpdateOne

AddProvinceID adds i to the "province_id" field.

func (*CommunityUpdateOne) AddState

func (cuo *CommunityUpdateOne) AddState(i int) *CommunityUpdateOne

AddState adds i to the "state" field.

func (*CommunityUpdateOne) Exec

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

Exec executes the query on the entity.

func (*CommunityUpdateOne) ExecX

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

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

func (*CommunityUpdateOne) Mutation

func (cuo *CommunityUpdateOne) Mutation() *CommunityMutation

Mutation returns the CommunityMutation object of the builder.

func (*CommunityUpdateOne) Save

func (cuo *CommunityUpdateOne) Save(ctx context.Context) (*Community, error)

Save executes the query and returns the updated Community entity.

func (*CommunityUpdateOne) SaveX

func (cuo *CommunityUpdateOne) SaveX(ctx context.Context) *Community

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

func (*CommunityUpdateOne) Select

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

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

func (*CommunityUpdateOne) SetAdminID

func (cuo *CommunityUpdateOne) SetAdminID(i int) *CommunityUpdateOne

SetAdminID sets the "admin_id" field.

func (*CommunityUpdateOne) SetAreaID

func (cuo *CommunityUpdateOne) SetAreaID(i int) *CommunityUpdateOne

SetAreaID sets the "area_id" field.

func (*CommunityUpdateOne) SetAreaNum

func (cuo *CommunityUpdateOne) SetAreaNum(i int) *CommunityUpdateOne

SetAreaNum sets the "area_num" field.

func (*CommunityUpdateOne) SetCityID

func (cuo *CommunityUpdateOne) SetCityID(i int) *CommunityUpdateOne

SetCityID sets the "city_id" field.

func (*CommunityUpdateOne) SetCommNumber

func (cuo *CommunityUpdateOne) SetCommNumber(i int) *CommunityUpdateOne

SetCommNumber sets the "comm_number" field.

func (*CommunityUpdateOne) SetCreatedAt

func (cuo *CommunityUpdateOne) SetCreatedAt(t time.Time) *CommunityUpdateOne

SetCreatedAt sets the "created_at" field.

func (*CommunityUpdateOne) SetDeletedAt

func (cuo *CommunityUpdateOne) SetDeletedAt(t time.Time) *CommunityUpdateOne

SetDeletedAt sets the "deleted_at" field.

func (*CommunityUpdateOne) SetEndTime

func (cuo *CommunityUpdateOne) SetEndTime(t time.Time) *CommunityUpdateOne

SetEndTime sets the "end_time" field.

func (*CommunityUpdateOne) SetName

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

SetName sets the "name" field.

func (*CommunityUpdateOne) SetProvinceID

func (cuo *CommunityUpdateOne) SetProvinceID(i int) *CommunityUpdateOne

SetProvinceID sets the "province_id" field.

func (*CommunityUpdateOne) SetStartTime

func (cuo *CommunityUpdateOne) SetStartTime(t time.Time) *CommunityUpdateOne

SetStartTime sets the "start_time" field.

func (*CommunityUpdateOne) SetState

func (cuo *CommunityUpdateOne) SetState(i int) *CommunityUpdateOne

SetState sets the "state" field.

func (*CommunityUpdateOne) SetUpdatedAt

func (cuo *CommunityUpdateOne) SetUpdatedAt(t time.Time) *CommunityUpdateOne

SetUpdatedAt sets the "updated_at" field.

type ConstraintError

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

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

func (ConstraintError) Error

func (e ConstraintError) Error() string

Error implements the error interface.

func (*ConstraintError) Unwrap

func (e *ConstraintError) Unwrap() error

Unwrap implements the errors.Wrapper interface.

type Hook

type Hook = ent.Hook

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

type MutateFunc

type MutateFunc = ent.MutateFunc

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

type Mutation

type Mutation = ent.Mutation

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

type Mutator

type Mutator = ent.Mutator

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

type NotFoundError

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

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

func (*NotFoundError) Error

func (e *NotFoundError) Error() string

Error implements the error interface.

type NotLoadedError

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

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

func (*NotLoadedError) Error

func (e *NotLoadedError) Error() string

Error implements the error interface.

type NotSingularError

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

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

func (*NotSingularError) Error

func (e *NotSingularError) Error() string

Error implements the error interface.

type Op

type Op = ent.Op

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

type Option

type Option func(*config)

Option function to configure the client.

func Debug

func Debug() Option

Debug enables debug logging on the ent.Driver.

func Driver

func Driver(driver dialect.Driver) Option

Driver configures the client driver.

func Log

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

Log sets the logging function for debug mode.

type OrderFunc

type OrderFunc func(*sql.Selector)

OrderFunc applies an ordering on the sql selector.

func Asc

func Asc(fields ...string) OrderFunc

Asc applies the given fields in ASC order.

func Desc

func Desc(fields ...string) OrderFunc

Desc applies the given fields in DESC order.

type Policy

type Policy = ent.Policy

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

type Query

type Query = ent.Query

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

type RollbackFunc

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

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

func (RollbackFunc) Rollback

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

Rollback calls f(ctx, m).

type RollbackHook

type RollbackHook func(Rollbacker) Rollbacker

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

hook := func(next ent.Rollbacker) ent.Rollbacker {
	return ent.RollbackFunc(func(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 Shop

type Shop struct {

	// ID of the ent.
	ID int `json:"id,omitempty"`
	// FloorID holds the value of the "floor_id" field.
	FloorID string `json:"floor_id,omitempty"`
	// RoomNum holds the value of the "room_num" field.
	RoomNum int `json:"room_num,omitempty"`
	// Layer holds the value of the "layer" field.
	Layer int `json:"layer,omitempty"`
	// BuiltUpArea holds the value of the "built_up_area" field.
	BuiltUpArea float32 `json:"built_up_area,omitempty"`
	// CommunityID holds the value of the "community_id" field.
	CommunityID int `json:"community_id,omitempty"`
	// FeeRate holds the value of the "fee_rate" field.
	FeeRate float32 `json:"fee_rate,omitempty"`
	// RoomArea holds the value of the "room_area" field.
	RoomArea float32 `json:"room_area,omitempty"`
	// Rent holds the value of the "rent" field.
	Rent float32 `json:"rent,omitempty"`
	// Remark holds the value of the "remark" field.
	Remark string `json:"remark,omitempty"`
	// CreatedAt holds the value of the "created_at" field.
	CreatedAt time.Time `json:"created_at,omitempty"`
	// UpdatedAt holds the value of the "updated_at" field.
	UpdatedAt time.Time `json:"updated_at,omitempty"`
	// DeletedAt holds the value of the "deleted_at" field.
	DeletedAt time.Time `json:"deleted_at,omitempty"`
	// contains filtered or unexported fields
}

Shop is the model entity for the Shop schema.

func (*Shop) String

func (s *Shop) String() string

String implements the fmt.Stringer.

func (*Shop) Unwrap

func (s *Shop) Unwrap() *Shop

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

func (s *Shop) Update() *ShopUpdateOne

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

type ShopClient

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

ShopClient is a client for the Shop schema.

func NewShopClient

func NewShopClient(c config) *ShopClient

NewShopClient returns a client for the Shop from the given config.

func (*ShopClient) Create

func (c *ShopClient) Create() *ShopCreate

Create returns a create builder for Shop.

func (*ShopClient) CreateBulk

func (c *ShopClient) CreateBulk(builders ...*ShopCreate) *ShopCreateBulk

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

func (*ShopClient) Delete

func (c *ShopClient) Delete() *ShopDelete

Delete returns a delete builder for Shop.

func (*ShopClient) DeleteOne

func (c *ShopClient) DeleteOne(s *Shop) *ShopDeleteOne

DeleteOne returns a delete builder for the given entity.

func (*ShopClient) DeleteOneID

func (c *ShopClient) DeleteOneID(id int) *ShopDeleteOne

DeleteOneID returns a delete builder for the given id.

func (*ShopClient) Get

func (c *ShopClient) Get(ctx context.Context, id int) (*Shop, error)

Get returns a Shop entity by its id.

func (*ShopClient) GetX

func (c *ShopClient) GetX(ctx context.Context, id int) *Shop

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

func (*ShopClient) Hooks

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

Hooks returns the client hooks.

func (*ShopClient) Query

func (c *ShopClient) Query() *ShopQuery

Query returns a query builder for Shop.

func (*ShopClient) Update

func (c *ShopClient) Update() *ShopUpdate

Update returns an update builder for Shop.

func (*ShopClient) UpdateOne

func (c *ShopClient) UpdateOne(s *Shop) *ShopUpdateOne

UpdateOne returns an update builder for the given entity.

func (*ShopClient) UpdateOneID

func (c *ShopClient) UpdateOneID(id int) *ShopUpdateOne

UpdateOneID returns an update builder for the given id.

func (*ShopClient) Use

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

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

type ShopCreate

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

ShopCreate is the builder for creating a Shop entity.

func (*ShopCreate) Exec

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

Exec executes the query.

func (*ShopCreate) ExecX

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

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

func (*ShopCreate) Mutation

func (sc *ShopCreate) Mutation() *ShopMutation

Mutation returns the ShopMutation object of the builder.

func (*ShopCreate) Save

func (sc *ShopCreate) Save(ctx context.Context) (*Shop, error)

Save creates the Shop in the database.

func (*ShopCreate) SaveX

func (sc *ShopCreate) SaveX(ctx context.Context) *Shop

SaveX calls Save and panics if Save returns an error.

func (*ShopCreate) SetBuiltUpArea

func (sc *ShopCreate) SetBuiltUpArea(f float32) *ShopCreate

SetBuiltUpArea sets the "built_up_area" field.

func (*ShopCreate) SetCommunityID

func (sc *ShopCreate) SetCommunityID(i int) *ShopCreate

SetCommunityID sets the "community_id" field.

func (*ShopCreate) SetCreatedAt

func (sc *ShopCreate) SetCreatedAt(t time.Time) *ShopCreate

SetCreatedAt sets the "created_at" field.

func (*ShopCreate) SetDeletedAt

func (sc *ShopCreate) SetDeletedAt(t time.Time) *ShopCreate

SetDeletedAt sets the "deleted_at" field.

func (*ShopCreate) SetFeeRate

func (sc *ShopCreate) SetFeeRate(f float32) *ShopCreate

SetFeeRate sets the "fee_rate" field.

func (*ShopCreate) SetFloorID

func (sc *ShopCreate) SetFloorID(s string) *ShopCreate

SetFloorID sets the "floor_id" field.

func (*ShopCreate) SetID

func (sc *ShopCreate) SetID(i int) *ShopCreate

SetID sets the "id" field.

func (*ShopCreate) SetLayer

func (sc *ShopCreate) SetLayer(i int) *ShopCreate

SetLayer sets the "layer" field.

func (*ShopCreate) SetRemark

func (sc *ShopCreate) SetRemark(s string) *ShopCreate

SetRemark sets the "remark" field.

func (*ShopCreate) SetRent

func (sc *ShopCreate) SetRent(f float32) *ShopCreate

SetRent sets the "rent" field.

func (*ShopCreate) SetRoomArea

func (sc *ShopCreate) SetRoomArea(f float32) *ShopCreate

SetRoomArea sets the "room_area" field.

func (*ShopCreate) SetRoomNum

func (sc *ShopCreate) SetRoomNum(i int) *ShopCreate

SetRoomNum sets the "room_num" field.

func (*ShopCreate) SetUpdatedAt

func (sc *ShopCreate) SetUpdatedAt(t time.Time) *ShopCreate

SetUpdatedAt sets the "updated_at" field.

type ShopCreateBulk

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

ShopCreateBulk is the builder for creating many Shop entities in bulk.

func (*ShopCreateBulk) Exec

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

Exec executes the query.

func (*ShopCreateBulk) ExecX

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

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

func (*ShopCreateBulk) Save

func (scb *ShopCreateBulk) Save(ctx context.Context) ([]*Shop, error)

Save creates the Shop entities in the database.

func (*ShopCreateBulk) SaveX

func (scb *ShopCreateBulk) SaveX(ctx context.Context) []*Shop

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

type ShopDelete

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

ShopDelete is the builder for deleting a Shop entity.

func (*ShopDelete) Exec

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

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

func (*ShopDelete) ExecX

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

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

func (*ShopDelete) Where

func (sd *ShopDelete) Where(ps ...predicate.Shop) *ShopDelete

Where appends a list predicates to the ShopDelete builder.

type ShopDeleteOne

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

ShopDeleteOne is the builder for deleting a single Shop entity.

func (*ShopDeleteOne) Exec

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

Exec executes the deletion query.

func (*ShopDeleteOne) ExecX

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

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

type ShopGroupBy

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

ShopGroupBy is the group-by builder for Shop entities.

func (*ShopGroupBy) Aggregate

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

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

func (*ShopGroupBy) Bool

func (sgb *ShopGroupBy) 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 (*ShopGroupBy) BoolX

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

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

func (*ShopGroupBy) Bools

func (sgb *ShopGroupBy) 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 (*ShopGroupBy) BoolsX

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

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

func (*ShopGroupBy) Float64

func (sgb *ShopGroupBy) 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 (*ShopGroupBy) Float64X

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

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

func (*ShopGroupBy) Float64s

func (sgb *ShopGroupBy) 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 (*ShopGroupBy) Float64sX

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

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

func (*ShopGroupBy) Int

func (sgb *ShopGroupBy) 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 (*ShopGroupBy) IntX

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

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

func (*ShopGroupBy) Ints

func (sgb *ShopGroupBy) 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 (*ShopGroupBy) IntsX

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

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

func (*ShopGroupBy) Scan

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

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

func (*ShopGroupBy) ScanX

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

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

func (*ShopGroupBy) String

func (sgb *ShopGroupBy) 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 (*ShopGroupBy) StringX

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

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

func (*ShopGroupBy) Strings

func (sgb *ShopGroupBy) 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 (*ShopGroupBy) StringsX

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

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

type ShopMutation

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

ShopMutation represents an operation that mutates the Shop nodes in the graph.

func (*ShopMutation) AddBuiltUpArea

func (m *ShopMutation) AddBuiltUpArea(f float32)

AddBuiltUpArea adds f to the "built_up_area" field.

func (*ShopMutation) AddCommunityID

func (m *ShopMutation) AddCommunityID(i int)

AddCommunityID adds i to the "community_id" field.

func (*ShopMutation) AddFeeRate

func (m *ShopMutation) AddFeeRate(f float32)

AddFeeRate adds f to the "fee_rate" field.

func (*ShopMutation) AddField

func (m *ShopMutation) 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 (*ShopMutation) AddLayer

func (m *ShopMutation) AddLayer(i int)

AddLayer adds i to the "layer" field.

func (*ShopMutation) AddRent

func (m *ShopMutation) AddRent(f float32)

AddRent adds f to the "rent" field.

func (*ShopMutation) AddRoomArea

func (m *ShopMutation) AddRoomArea(f float32)

AddRoomArea adds f to the "room_area" field.

func (*ShopMutation) AddRoomNum

func (m *ShopMutation) AddRoomNum(i int)

AddRoomNum adds i to the "room_num" field.

func (*ShopMutation) AddedBuiltUpArea

func (m *ShopMutation) AddedBuiltUpArea() (r float32, exists bool)

AddedBuiltUpArea returns the value that was added to the "built_up_area" field in this mutation.

func (*ShopMutation) AddedCommunityID

func (m *ShopMutation) AddedCommunityID() (r int, exists bool)

AddedCommunityID returns the value that was added to the "community_id" field in this mutation.

func (*ShopMutation) AddedEdges

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

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

func (*ShopMutation) AddedFeeRate

func (m *ShopMutation) AddedFeeRate() (r float32, exists bool)

AddedFeeRate returns the value that was added to the "fee_rate" field in this mutation.

func (*ShopMutation) AddedField

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

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

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

func (*ShopMutation) AddedIDs

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

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

func (*ShopMutation) AddedLayer

func (m *ShopMutation) AddedLayer() (r int, exists bool)

AddedLayer returns the value that was added to the "layer" field in this mutation.

func (*ShopMutation) AddedRent

func (m *ShopMutation) AddedRent() (r float32, exists bool)

AddedRent returns the value that was added to the "rent" field in this mutation.

func (*ShopMutation) AddedRoomArea

func (m *ShopMutation) AddedRoomArea() (r float32, exists bool)

AddedRoomArea returns the value that was added to the "room_area" field in this mutation.

func (*ShopMutation) AddedRoomNum

func (m *ShopMutation) AddedRoomNum() (r int, exists bool)

AddedRoomNum returns the value that was added to the "room_num" field in this mutation.

func (*ShopMutation) BuiltUpArea

func (m *ShopMutation) BuiltUpArea() (r float32, exists bool)

BuiltUpArea returns the value of the "built_up_area" field in the mutation.

func (*ShopMutation) ClearEdge

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

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

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

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

func (*ShopMutation) ClearedFields

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

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

func (ShopMutation) Client

func (m ShopMutation) 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 (*ShopMutation) CommunityID

func (m *ShopMutation) CommunityID() (r int, exists bool)

CommunityID returns the value of the "community_id" field in the mutation.

func (*ShopMutation) CreatedAt

func (m *ShopMutation) CreatedAt() (r time.Time, exists bool)

CreatedAt returns the value of the "created_at" field in the mutation.

func (*ShopMutation) DeletedAt

func (m *ShopMutation) DeletedAt() (r time.Time, exists bool)

DeletedAt returns the value of the "deleted_at" field in the mutation.

func (*ShopMutation) EdgeCleared

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

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

func (*ShopMutation) FeeRate

func (m *ShopMutation) FeeRate() (r float32, exists bool)

FeeRate returns the value of the "fee_rate" field in the mutation.

func (*ShopMutation) Field

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

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

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

func (*ShopMutation) Fields

func (m *ShopMutation) 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 (*ShopMutation) FloorID

func (m *ShopMutation) FloorID() (r string, exists bool)

FloorID returns the value of the "floor_id" field in the mutation.

func (*ShopMutation) ID

func (m *ShopMutation) ID() (id int, exists bool)

ID returns the ID value in the mutation. Note that the ID is only available if it was provided to the builder or after it was returned from the database.

func (*ShopMutation) IDs

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

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

func (*ShopMutation) Layer

func (m *ShopMutation) Layer() (r int, exists bool)

Layer returns the value of the "layer" field in the mutation.

func (*ShopMutation) OldBuiltUpArea

func (m *ShopMutation) OldBuiltUpArea(ctx context.Context) (v float32, err error)

OldBuiltUpArea returns the old "built_up_area" field's value of the Shop entity. If the Shop 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 (*ShopMutation) OldCommunityID

func (m *ShopMutation) OldCommunityID(ctx context.Context) (v int, err error)

OldCommunityID returns the old "community_id" field's value of the Shop entity. If the Shop 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 (*ShopMutation) OldCreatedAt

func (m *ShopMutation) OldCreatedAt(ctx context.Context) (v time.Time, err error)

OldCreatedAt returns the old "created_at" field's value of the Shop entity. If the Shop 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 (*ShopMutation) OldDeletedAt

func (m *ShopMutation) OldDeletedAt(ctx context.Context) (v time.Time, err error)

OldDeletedAt returns the old "deleted_at" field's value of the Shop entity. If the Shop 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 (*ShopMutation) OldFeeRate

func (m *ShopMutation) OldFeeRate(ctx context.Context) (v float32, err error)

OldFeeRate returns the old "fee_rate" field's value of the Shop entity. If the Shop 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 (*ShopMutation) OldField

func (m *ShopMutation) 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 (*ShopMutation) OldFloorID

func (m *ShopMutation) OldFloorID(ctx context.Context) (v string, err error)

OldFloorID returns the old "floor_id" field's value of the Shop entity. If the Shop 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 (*ShopMutation) OldLayer

func (m *ShopMutation) OldLayer(ctx context.Context) (v int, err error)

OldLayer returns the old "layer" field's value of the Shop entity. If the Shop 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 (*ShopMutation) OldRemark

func (m *ShopMutation) OldRemark(ctx context.Context) (v string, err error)

OldRemark returns the old "remark" field's value of the Shop entity. If the Shop 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 (*ShopMutation) OldRent

func (m *ShopMutation) OldRent(ctx context.Context) (v float32, err error)

OldRent returns the old "rent" field's value of the Shop entity. If the Shop 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 (*ShopMutation) OldRoomArea

func (m *ShopMutation) OldRoomArea(ctx context.Context) (v float32, err error)

OldRoomArea returns the old "room_area" field's value of the Shop entity. If the Shop 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 (*ShopMutation) OldRoomNum

func (m *ShopMutation) OldRoomNum(ctx context.Context) (v int, err error)

OldRoomNum returns the old "room_num" field's value of the Shop entity. If the Shop 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 (*ShopMutation) OldUpdatedAt

func (m *ShopMutation) OldUpdatedAt(ctx context.Context) (v time.Time, err error)

OldUpdatedAt returns the old "updated_at" field's value of the Shop entity. If the Shop 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 (*ShopMutation) Op

func (m *ShopMutation) Op() Op

Op returns the operation name.

func (*ShopMutation) Remark

func (m *ShopMutation) Remark() (r string, exists bool)

Remark returns the value of the "remark" field in the mutation.

func (*ShopMutation) RemovedEdges

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

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

func (*ShopMutation) RemovedIDs

func (m *ShopMutation) 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 (*ShopMutation) Rent

func (m *ShopMutation) Rent() (r float32, exists bool)

Rent returns the value of the "rent" field in the mutation.

func (*ShopMutation) ResetBuiltUpArea

func (m *ShopMutation) ResetBuiltUpArea()

ResetBuiltUpArea resets all changes to the "built_up_area" field.

func (*ShopMutation) ResetCommunityID

func (m *ShopMutation) ResetCommunityID()

ResetCommunityID resets all changes to the "community_id" field.

func (*ShopMutation) ResetCreatedAt

func (m *ShopMutation) ResetCreatedAt()

ResetCreatedAt resets all changes to the "created_at" field.

func (*ShopMutation) ResetDeletedAt

func (m *ShopMutation) ResetDeletedAt()

ResetDeletedAt resets all changes to the "deleted_at" field.

func (*ShopMutation) ResetEdge

func (m *ShopMutation) 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 (*ShopMutation) ResetFeeRate

func (m *ShopMutation) ResetFeeRate()

ResetFeeRate resets all changes to the "fee_rate" field.

func (*ShopMutation) ResetField

func (m *ShopMutation) 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 (*ShopMutation) ResetFloorID

func (m *ShopMutation) ResetFloorID()

ResetFloorID resets all changes to the "floor_id" field.

func (*ShopMutation) ResetLayer

func (m *ShopMutation) ResetLayer()

ResetLayer resets all changes to the "layer" field.

func (*ShopMutation) ResetRemark

func (m *ShopMutation) ResetRemark()

ResetRemark resets all changes to the "remark" field.

func (*ShopMutation) ResetRent

func (m *ShopMutation) ResetRent()

ResetRent resets all changes to the "rent" field.

func (*ShopMutation) ResetRoomArea

func (m *ShopMutation) ResetRoomArea()

ResetRoomArea resets all changes to the "room_area" field.

func (*ShopMutation) ResetRoomNum

func (m *ShopMutation) ResetRoomNum()

ResetRoomNum resets all changes to the "room_num" field.

func (*ShopMutation) ResetUpdatedAt

func (m *ShopMutation) ResetUpdatedAt()

ResetUpdatedAt resets all changes to the "updated_at" field.

func (*ShopMutation) RoomArea

func (m *ShopMutation) RoomArea() (r float32, exists bool)

RoomArea returns the value of the "room_area" field in the mutation.

func (*ShopMutation) RoomNum

func (m *ShopMutation) RoomNum() (r int, exists bool)

RoomNum returns the value of the "room_num" field in the mutation.

func (*ShopMutation) SetBuiltUpArea

func (m *ShopMutation) SetBuiltUpArea(f float32)

SetBuiltUpArea sets the "built_up_area" field.

func (*ShopMutation) SetCommunityID

func (m *ShopMutation) SetCommunityID(i int)

SetCommunityID sets the "community_id" field.

func (*ShopMutation) SetCreatedAt

func (m *ShopMutation) SetCreatedAt(t time.Time)

SetCreatedAt sets the "created_at" field.

func (*ShopMutation) SetDeletedAt

func (m *ShopMutation) SetDeletedAt(t time.Time)

SetDeletedAt sets the "deleted_at" field.

func (*ShopMutation) SetFeeRate

func (m *ShopMutation) SetFeeRate(f float32)

SetFeeRate sets the "fee_rate" field.

func (*ShopMutation) SetField

func (m *ShopMutation) 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 (*ShopMutation) SetFloorID

func (m *ShopMutation) SetFloorID(s string)

SetFloorID sets the "floor_id" field.

func (*ShopMutation) SetID

func (m *ShopMutation) SetID(id int)

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

func (*ShopMutation) SetLayer

func (m *ShopMutation) SetLayer(i int)

SetLayer sets the "layer" field.

func (*ShopMutation) SetRemark

func (m *ShopMutation) SetRemark(s string)

SetRemark sets the "remark" field.

func (*ShopMutation) SetRent

func (m *ShopMutation) SetRent(f float32)

SetRent sets the "rent" field.

func (*ShopMutation) SetRoomArea

func (m *ShopMutation) SetRoomArea(f float32)

SetRoomArea sets the "room_area" field.

func (*ShopMutation) SetRoomNum

func (m *ShopMutation) SetRoomNum(i int)

SetRoomNum sets the "room_num" field.

func (*ShopMutation) SetUpdatedAt

func (m *ShopMutation) SetUpdatedAt(t time.Time)

SetUpdatedAt sets the "updated_at" field.

func (ShopMutation) Tx

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

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

func (*ShopMutation) Type

func (m *ShopMutation) Type() string

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

func (*ShopMutation) UpdatedAt

func (m *ShopMutation) UpdatedAt() (r time.Time, exists bool)

UpdatedAt returns the value of the "updated_at" field in the mutation.

func (*ShopMutation) Where

func (m *ShopMutation) Where(ps ...predicate.Shop)

Where appends a list predicates to the ShopMutation builder.

type ShopQuery

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

ShopQuery is the builder for querying Shop entities.

func (*ShopQuery) All

func (sq *ShopQuery) All(ctx context.Context) ([]*Shop, error)

All executes the query and returns a list of Shops.

func (*ShopQuery) AllX

func (sq *ShopQuery) AllX(ctx context.Context) []*Shop

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

func (*ShopQuery) Clone

func (sq *ShopQuery) Clone() *ShopQuery

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

func (*ShopQuery) Count

func (sq *ShopQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*ShopQuery) CountX

func (sq *ShopQuery) CountX(ctx context.Context) int

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

func (*ShopQuery) Exist

func (sq *ShopQuery) Exist(ctx context.Context) (bool, error)

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

func (*ShopQuery) ExistX

func (sq *ShopQuery) ExistX(ctx context.Context) bool

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

func (*ShopQuery) First

func (sq *ShopQuery) First(ctx context.Context) (*Shop, error)

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

func (*ShopQuery) FirstID

func (sq *ShopQuery) FirstID(ctx context.Context) (id int, err error)

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

func (*ShopQuery) FirstIDX

func (sq *ShopQuery) FirstIDX(ctx context.Context) int

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

func (*ShopQuery) FirstX

func (sq *ShopQuery) FirstX(ctx context.Context) *Shop

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

func (*ShopQuery) GroupBy

func (sq *ShopQuery) GroupBy(field string, fields ...string) *ShopGroupBy

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

client.Shop.Query().
	GroupBy(shop.FieldFloorID).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*ShopQuery) IDs

func (sq *ShopQuery) IDs(ctx context.Context) ([]int, error)

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

func (*ShopQuery) IDsX

func (sq *ShopQuery) IDsX(ctx context.Context) []int

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

func (*ShopQuery) Limit

func (sq *ShopQuery) Limit(limit int) *ShopQuery

Limit adds a limit step to the query.

func (*ShopQuery) Offset

func (sq *ShopQuery) Offset(offset int) *ShopQuery

Offset adds an offset step to the query.

func (*ShopQuery) Only

func (sq *ShopQuery) Only(ctx context.Context) (*Shop, error)

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

func (*ShopQuery) OnlyID

func (sq *ShopQuery) OnlyID(ctx context.Context) (id int, err error)

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

func (*ShopQuery) OnlyIDX

func (sq *ShopQuery) OnlyIDX(ctx context.Context) int

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

func (*ShopQuery) OnlyX

func (sq *ShopQuery) OnlyX(ctx context.Context) *Shop

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

func (*ShopQuery) Order

func (sq *ShopQuery) Order(o ...OrderFunc) *ShopQuery

Order adds an order step to the query.

func (*ShopQuery) Select

func (sq *ShopQuery) Select(fields ...string) *ShopSelect

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

client.Shop.Query().
	Select(shop.FieldFloorID).
	Scan(ctx, &v)

func (*ShopQuery) Unique

func (sq *ShopQuery) Unique(unique bool) *ShopQuery

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

func (sq *ShopQuery) Where(ps ...predicate.Shop) *ShopQuery

Where adds a new predicate for the ShopQuery builder.

type ShopSelect

type ShopSelect struct {
	*ShopQuery
	// contains filtered or unexported fields
}

ShopSelect is the builder for selecting fields of Shop entities.

func (*ShopSelect) Bool

func (ss *ShopSelect) Bool(ctx context.Context) (_ bool, err error)

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

func (*ShopSelect) BoolX

func (ss *ShopSelect) BoolX(ctx context.Context) bool

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

func (*ShopSelect) Bools

func (ss *ShopSelect) Bools(ctx context.Context) ([]bool, error)

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

func (*ShopSelect) BoolsX

func (ss *ShopSelect) BoolsX(ctx context.Context) []bool

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

func (*ShopSelect) Float64

func (ss *ShopSelect) Float64(ctx context.Context) (_ float64, err error)

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

func (*ShopSelect) Float64X

func (ss *ShopSelect) Float64X(ctx context.Context) float64

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

func (*ShopSelect) Float64s

func (ss *ShopSelect) Float64s(ctx context.Context) ([]float64, error)

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

func (*ShopSelect) Float64sX

func (ss *ShopSelect) Float64sX(ctx context.Context) []float64

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

func (*ShopSelect) Int

func (ss *ShopSelect) Int(ctx context.Context) (_ int, err error)

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

func (*ShopSelect) IntX

func (ss *ShopSelect) IntX(ctx context.Context) int

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

func (*ShopSelect) Ints

func (ss *ShopSelect) Ints(ctx context.Context) ([]int, error)

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

func (*ShopSelect) IntsX

func (ss *ShopSelect) IntsX(ctx context.Context) []int

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

func (*ShopSelect) Scan

func (ss *ShopSelect) Scan(ctx context.Context, v interface{}) error

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

func (*ShopSelect) ScanX

func (ss *ShopSelect) ScanX(ctx context.Context, v interface{})

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

func (*ShopSelect) String

func (ss *ShopSelect) String(ctx context.Context) (_ string, err error)

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

func (*ShopSelect) StringX

func (ss *ShopSelect) StringX(ctx context.Context) string

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

func (*ShopSelect) Strings

func (ss *ShopSelect) Strings(ctx context.Context) ([]string, error)

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

func (*ShopSelect) StringsX

func (ss *ShopSelect) StringsX(ctx context.Context) []string

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

type ShopUpdate

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

ShopUpdate is the builder for updating Shop entities.

func (*ShopUpdate) AddBuiltUpArea

func (su *ShopUpdate) AddBuiltUpArea(f float32) *ShopUpdate

AddBuiltUpArea adds f to the "built_up_area" field.

func (*ShopUpdate) AddCommunityID

func (su *ShopUpdate) AddCommunityID(i int) *ShopUpdate

AddCommunityID adds i to the "community_id" field.

func (*ShopUpdate) AddFeeRate

func (su *ShopUpdate) AddFeeRate(f float32) *ShopUpdate

AddFeeRate adds f to the "fee_rate" field.

func (*ShopUpdate) AddLayer

func (su *ShopUpdate) AddLayer(i int) *ShopUpdate

AddLayer adds i to the "layer" field.

func (*ShopUpdate) AddRent

func (su *ShopUpdate) AddRent(f float32) *ShopUpdate

AddRent adds f to the "rent" field.

func (*ShopUpdate) AddRoomArea

func (su *ShopUpdate) AddRoomArea(f float32) *ShopUpdate

AddRoomArea adds f to the "room_area" field.

func (*ShopUpdate) AddRoomNum

func (su *ShopUpdate) AddRoomNum(i int) *ShopUpdate

AddRoomNum adds i to the "room_num" field.

func (*ShopUpdate) Exec

func (su *ShopUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*ShopUpdate) ExecX

func (su *ShopUpdate) ExecX(ctx context.Context)

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

func (*ShopUpdate) Mutation

func (su *ShopUpdate) Mutation() *ShopMutation

Mutation returns the ShopMutation object of the builder.

func (*ShopUpdate) Save

func (su *ShopUpdate) Save(ctx context.Context) (int, error)

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

func (*ShopUpdate) SaveX

func (su *ShopUpdate) SaveX(ctx context.Context) int

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

func (*ShopUpdate) SetBuiltUpArea

func (su *ShopUpdate) SetBuiltUpArea(f float32) *ShopUpdate

SetBuiltUpArea sets the "built_up_area" field.

func (*ShopUpdate) SetCommunityID

func (su *ShopUpdate) SetCommunityID(i int) *ShopUpdate

SetCommunityID sets the "community_id" field.

func (*ShopUpdate) SetCreatedAt

func (su *ShopUpdate) SetCreatedAt(t time.Time) *ShopUpdate

SetCreatedAt sets the "created_at" field.

func (*ShopUpdate) SetDeletedAt

func (su *ShopUpdate) SetDeletedAt(t time.Time) *ShopUpdate

SetDeletedAt sets the "deleted_at" field.

func (*ShopUpdate) SetFeeRate

func (su *ShopUpdate) SetFeeRate(f float32) *ShopUpdate

SetFeeRate sets the "fee_rate" field.

func (*ShopUpdate) SetFloorID

func (su *ShopUpdate) SetFloorID(s string) *ShopUpdate

SetFloorID sets the "floor_id" field.

func (*ShopUpdate) SetLayer

func (su *ShopUpdate) SetLayer(i int) *ShopUpdate

SetLayer sets the "layer" field.

func (*ShopUpdate) SetRemark

func (su *ShopUpdate) SetRemark(s string) *ShopUpdate

SetRemark sets the "remark" field.

func (*ShopUpdate) SetRent

func (su *ShopUpdate) SetRent(f float32) *ShopUpdate

SetRent sets the "rent" field.

func (*ShopUpdate) SetRoomArea

func (su *ShopUpdate) SetRoomArea(f float32) *ShopUpdate

SetRoomArea sets the "room_area" field.

func (*ShopUpdate) SetRoomNum

func (su *ShopUpdate) SetRoomNum(i int) *ShopUpdate

SetRoomNum sets the "room_num" field.

func (*ShopUpdate) SetUpdatedAt

func (su *ShopUpdate) SetUpdatedAt(t time.Time) *ShopUpdate

SetUpdatedAt sets the "updated_at" field.

func (*ShopUpdate) Where

func (su *ShopUpdate) Where(ps ...predicate.Shop) *ShopUpdate

Where appends a list predicates to the ShopUpdate builder.

type ShopUpdateOne

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

ShopUpdateOne is the builder for updating a single Shop entity.

func (*ShopUpdateOne) AddBuiltUpArea

func (suo *ShopUpdateOne) AddBuiltUpArea(f float32) *ShopUpdateOne

AddBuiltUpArea adds f to the "built_up_area" field.

func (*ShopUpdateOne) AddCommunityID

func (suo *ShopUpdateOne) AddCommunityID(i int) *ShopUpdateOne

AddCommunityID adds i to the "community_id" field.

func (*ShopUpdateOne) AddFeeRate

func (suo *ShopUpdateOne) AddFeeRate(f float32) *ShopUpdateOne

AddFeeRate adds f to the "fee_rate" field.

func (*ShopUpdateOne) AddLayer

func (suo *ShopUpdateOne) AddLayer(i int) *ShopUpdateOne

AddLayer adds i to the "layer" field.

func (*ShopUpdateOne) AddRent

func (suo *ShopUpdateOne) AddRent(f float32) *ShopUpdateOne

AddRent adds f to the "rent" field.

func (*ShopUpdateOne) AddRoomArea

func (suo *ShopUpdateOne) AddRoomArea(f float32) *ShopUpdateOne

AddRoomArea adds f to the "room_area" field.

func (*ShopUpdateOne) AddRoomNum

func (suo *ShopUpdateOne) AddRoomNum(i int) *ShopUpdateOne

AddRoomNum adds i to the "room_num" field.

func (*ShopUpdateOne) Exec

func (suo *ShopUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*ShopUpdateOne) ExecX

func (suo *ShopUpdateOne) ExecX(ctx context.Context)

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

func (*ShopUpdateOne) Mutation

func (suo *ShopUpdateOne) Mutation() *ShopMutation

Mutation returns the ShopMutation object of the builder.

func (*ShopUpdateOne) Save

func (suo *ShopUpdateOne) Save(ctx context.Context) (*Shop, error)

Save executes the query and returns the updated Shop entity.

func (*ShopUpdateOne) SaveX

func (suo *ShopUpdateOne) SaveX(ctx context.Context) *Shop

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

func (*ShopUpdateOne) Select

func (suo *ShopUpdateOne) Select(field string, fields ...string) *ShopUpdateOne

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

func (*ShopUpdateOne) SetBuiltUpArea

func (suo *ShopUpdateOne) SetBuiltUpArea(f float32) *ShopUpdateOne

SetBuiltUpArea sets the "built_up_area" field.

func (*ShopUpdateOne) SetCommunityID

func (suo *ShopUpdateOne) SetCommunityID(i int) *ShopUpdateOne

SetCommunityID sets the "community_id" field.

func (*ShopUpdateOne) SetCreatedAt

func (suo *ShopUpdateOne) SetCreatedAt(t time.Time) *ShopUpdateOne

SetCreatedAt sets the "created_at" field.

func (*ShopUpdateOne) SetDeletedAt

func (suo *ShopUpdateOne) SetDeletedAt(t time.Time) *ShopUpdateOne

SetDeletedAt sets the "deleted_at" field.

func (*ShopUpdateOne) SetFeeRate

func (suo *ShopUpdateOne) SetFeeRate(f float32) *ShopUpdateOne

SetFeeRate sets the "fee_rate" field.

func (*ShopUpdateOne) SetFloorID

func (suo *ShopUpdateOne) SetFloorID(s string) *ShopUpdateOne

SetFloorID sets the "floor_id" field.

func (*ShopUpdateOne) SetLayer

func (suo *ShopUpdateOne) SetLayer(i int) *ShopUpdateOne

SetLayer sets the "layer" field.

func (*ShopUpdateOne) SetRemark

func (suo *ShopUpdateOne) SetRemark(s string) *ShopUpdateOne

SetRemark sets the "remark" field.

func (*ShopUpdateOne) SetRent

func (suo *ShopUpdateOne) SetRent(f float32) *ShopUpdateOne

SetRent sets the "rent" field.

func (*ShopUpdateOne) SetRoomArea

func (suo *ShopUpdateOne) SetRoomArea(f float32) *ShopUpdateOne

SetRoomArea sets the "room_area" field.

func (*ShopUpdateOne) SetRoomNum

func (suo *ShopUpdateOne) SetRoomNum(i int) *ShopUpdateOne

SetRoomNum sets the "room_num" field.

func (*ShopUpdateOne) SetUpdatedAt

func (suo *ShopUpdateOne) SetUpdatedAt(t time.Time) *ShopUpdateOne

SetUpdatedAt sets the "updated_at" field.

type Shops

type Shops []*Shop

Shops is a parsable slice of Shop.

type Tx

type Tx struct {

	// Community is the client for interacting with the Community builders.
	Community *CommunityClient
	// Shop is the client for interacting with the Shop builders.
	Shop *ShopClient
	// contains filtered or unexported fields
}

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

func TxFromContext

func TxFromContext(ctx context.Context) *Tx

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

func (*Tx) Client

func (tx *Tx) Client() *Client

Client returns a Client that binds to current transaction.

func (*Tx) Commit

func (tx *Tx) Commit() error

Commit commits the transaction.

func (*Tx) OnCommit

func (tx *Tx) OnCommit(f CommitHook)

OnCommit adds a hook to call on commit.

func (*Tx) OnRollback

func (tx *Tx) OnRollback(f RollbackHook)

OnRollback adds a hook to call on rollback.

func (*Tx) Rollback

func (tx *Tx) Rollback() error

Rollback rollbacks the transaction.

type ValidationError

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

ValidationError returns when validating a field or edge fails.

func (*ValidationError) Error

func (e *ValidationError) Error() string

Error implements the error interface.

func (*ValidationError) Unwrap

func (e *ValidationError) Unwrap() error

Unwrap implements the errors.Wrapper interface.

type Value

type Value = ent.Value

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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