ent

package
v0.0.0-...-c30d74c Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2024 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

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

	// Node types.
	TypeTLeaf     = "TLeaf"
	TypeTShortUrl = "TShortUrl"
)

Variables

View Source
var ErrTxStarted = errors.New("ent: cannot start a transaction within a transaction")

ErrTxStarted is returned when trying to start a new transaction from a transactional client.

Functions

func Asc

func Asc(fields ...string) func(*sql.Selector)

Asc applies the given fields in ASC order.

func Desc

func Desc(fields ...string) func(*sql.Selector)

Desc applies the given fields in DESC order.

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
	// TLeaf is the client for interacting with the TLeaf builders.
	TLeaf *TLeafClient
	// TShortUrl is the client for interacting with the TShortUrl builders.
	TShortUrl *TShortUrlClient
	// 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().
	TLeaf.
	Query().
	Count(ctx)

func (*Client) Intercept

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

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

func (*Client) Mutate

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

Mutate implements the ent.Mutator interface.

func (*Client) Tx

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

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

func (*Client) Use

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

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

type CommitFunc

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

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

func (CommitFunc) Commit

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

Commit calls f(ctx, m).

type CommitHook

type CommitHook func(Committer) Committer

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

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

type Committer

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

Committer is the interface that wraps the Commit method.

type ConstraintError

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

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

func (ConstraintError) Error

func (e ConstraintError) Error() string

Error implements the error interface.

func (*ConstraintError) Unwrap

func (e *ConstraintError) Unwrap() error

Unwrap implements the errors.Wrapper interface.

type Hook

type Hook = ent.Hook

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

type InterceptFunc

type InterceptFunc = ent.InterceptFunc

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

type Interceptor

type Interceptor = ent.Interceptor

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

type MutateFunc

type MutateFunc = ent.MutateFunc

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

type Mutation

type Mutation = ent.Mutation

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

type Mutator

type Mutator = ent.Mutator

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

type NotFoundError

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

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

func (*NotFoundError) Error

func (e *NotFoundError) Error() string

Error implements the error interface.

type NotLoadedError

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

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

func (*NotLoadedError) Error

func (e *NotLoadedError) Error() string

Error implements the error interface.

type NotSingularError

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

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

func (*NotSingularError) Error

func (e *NotSingularError) Error() string

Error implements the error interface.

type Op

type Op = ent.Op

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

type Option

type Option func(*config)

Option function to configure the client.

func Debug

func Debug() Option

Debug enables debug logging on the ent.Driver.

func Driver

func Driver(driver dialect.Driver) Option

Driver configures the client driver.

func Log

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

Log sets the logging function for debug mode.

type OrderFunc

type OrderFunc func(*sql.Selector)

OrderFunc applies an ordering on the sql selector. Deprecated: Use Asc/Desc functions or the package builders instead.

type Policy

type Policy = ent.Policy

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

type Querier

type Querier = ent.Querier

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

type QuerierFunc

type QuerierFunc = ent.QuerierFunc

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

type Query

type Query = ent.Query

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

type QueryContext

type QueryContext = ent.QueryContext

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

type RollbackFunc

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

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

func (RollbackFunc) Rollback

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

Rollback calls f(ctx, m).

type RollbackHook

type RollbackHook func(Rollbacker) Rollbacker

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

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

type Rollbacker

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

Rollbacker is the interface that wraps the Rollback method.

type TLeaf

type TLeaf struct {

	// ID of the ent.
	// primary key
	ID int64 `json:"id,omitempty"`
	// for different biz
	BizTag string `json:"biz_tag,omitempty"`
	// current max id
	MaxID int64 `json:"max_id,omitempty"`
	// nums per batch
	Step int64 `json:"step,omitempty"`
	// Desc holds the value of the "desc" field.
	Desc string `json:"desc,omitempty"`
	// version control
	Version int32 `json:"version,omitempty"`
	// CreatedAt holds the value of the "created_at" field.
	CreatedAt int64 `json:"created_at,omitempty"`
	// UpdatedAt holds the value of the "updated_at" field.
	UpdatedAt int64 `json:"updated_at,omitempty"`
	// contains filtered or unexported fields
}

TLeaf is the model entity for the TLeaf schema.

func (*TLeaf) String

func (t *TLeaf) String() string

String implements the fmt.Stringer.

func (*TLeaf) Unwrap

func (t *TLeaf) Unwrap() *TLeaf

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

func (t *TLeaf) Update() *TLeafUpdateOne

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

func (*TLeaf) Value

func (t *TLeaf) Value(name string) (ent.Value, error)

Value returns the ent.Value that was dynamically selected and assigned to the TLeaf. This includes values selected through modifiers, order, etc.

type TLeafClient

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

TLeafClient is a client for the TLeaf schema.

func NewTLeafClient

func NewTLeafClient(c config) *TLeafClient

NewTLeafClient returns a client for the TLeaf from the given config.

func (*TLeafClient) Create

func (c *TLeafClient) Create() *TLeafCreate

Create returns a builder for creating a TLeaf entity.

func (*TLeafClient) CreateBulk

func (c *TLeafClient) CreateBulk(builders ...*TLeafCreate) *TLeafCreateBulk

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

func (*TLeafClient) Delete

func (c *TLeafClient) Delete() *TLeafDelete

Delete returns a delete builder for TLeaf.

func (*TLeafClient) DeleteOne

func (c *TLeafClient) DeleteOne(t *TLeaf) *TLeafDeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*TLeafClient) DeleteOneID

func (c *TLeafClient) DeleteOneID(id int64) *TLeafDeleteOne

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

func (*TLeafClient) Get

func (c *TLeafClient) Get(ctx context.Context, id int64) (*TLeaf, error)

Get returns a TLeaf entity by its id.

func (*TLeafClient) GetX

func (c *TLeafClient) GetX(ctx context.Context, id int64) *TLeaf

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

func (*TLeafClient) Hooks

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

Hooks returns the client hooks.

func (*TLeafClient) Intercept

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

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

func (*TLeafClient) Interceptors

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

Interceptors returns the client interceptors.

func (*TLeafClient) MapCreateBulk

func (c *TLeafClient) MapCreateBulk(slice any, setFunc func(*TLeafCreate, int)) *TLeafCreateBulk

MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates a builder and applies setFunc on it.

func (*TLeafClient) Query

func (c *TLeafClient) Query() *TLeafQuery

Query returns a query builder for TLeaf.

func (*TLeafClient) Update

func (c *TLeafClient) Update() *TLeafUpdate

Update returns an update builder for TLeaf.

func (*TLeafClient) UpdateOne

func (c *TLeafClient) UpdateOne(t *TLeaf) *TLeafUpdateOne

UpdateOne returns an update builder for the given entity.

func (*TLeafClient) UpdateOneID

func (c *TLeafClient) UpdateOneID(id int64) *TLeafUpdateOne

UpdateOneID returns an update builder for the given id.

func (*TLeafClient) Use

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

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

type TLeafCreate

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

TLeafCreate is the builder for creating a TLeaf entity.

func (*TLeafCreate) Exec

func (tc *TLeafCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*TLeafCreate) ExecX

func (tc *TLeafCreate) ExecX(ctx context.Context)

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

func (*TLeafCreate) Mutation

func (tc *TLeafCreate) Mutation() *TLeafMutation

Mutation returns the TLeafMutation object of the builder.

func (*TLeafCreate) Save

func (tc *TLeafCreate) Save(ctx context.Context) (*TLeaf, error)

Save creates the TLeaf in the database.

func (*TLeafCreate) SaveX

func (tc *TLeafCreate) SaveX(ctx context.Context) *TLeaf

SaveX calls Save and panics if Save returns an error.

func (*TLeafCreate) SetBizTag

func (tc *TLeafCreate) SetBizTag(s string) *TLeafCreate

SetBizTag sets the "biz_tag" field.

func (*TLeafCreate) SetCreatedAt

func (tc *TLeafCreate) SetCreatedAt(i int64) *TLeafCreate

SetCreatedAt sets the "created_at" field.

func (*TLeafCreate) SetDesc

func (tc *TLeafCreate) SetDesc(s string) *TLeafCreate

SetDesc sets the "desc" field.

func (*TLeafCreate) SetID

func (tc *TLeafCreate) SetID(i int64) *TLeafCreate

SetID sets the "id" field.

func (*TLeafCreate) SetMaxID

func (tc *TLeafCreate) SetMaxID(i int64) *TLeafCreate

SetMaxID sets the "max_id" field.

func (*TLeafCreate) SetNillableMaxID

func (tc *TLeafCreate) SetNillableMaxID(i *int64) *TLeafCreate

SetNillableMaxID sets the "max_id" field if the given value is not nil.

func (*TLeafCreate) SetNillableStep

func (tc *TLeafCreate) SetNillableStep(i *int64) *TLeafCreate

SetNillableStep sets the "step" field if the given value is not nil.

func (*TLeafCreate) SetNillableVersion

func (tc *TLeafCreate) SetNillableVersion(i *int32) *TLeafCreate

SetNillableVersion sets the "version" field if the given value is not nil.

func (*TLeafCreate) SetStep

func (tc *TLeafCreate) SetStep(i int64) *TLeafCreate

SetStep sets the "step" field.

func (*TLeafCreate) SetUpdatedAt

func (tc *TLeafCreate) SetUpdatedAt(i int64) *TLeafCreate

SetUpdatedAt sets the "updated_at" field.

func (*TLeafCreate) SetVersion

func (tc *TLeafCreate) SetVersion(i int32) *TLeafCreate

SetVersion sets the "version" field.

type TLeafCreateBulk

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

TLeafCreateBulk is the builder for creating many TLeaf entities in bulk.

func (*TLeafCreateBulk) Exec

func (tcb *TLeafCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*TLeafCreateBulk) ExecX

func (tcb *TLeafCreateBulk) ExecX(ctx context.Context)

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

func (*TLeafCreateBulk) Save

func (tcb *TLeafCreateBulk) Save(ctx context.Context) ([]*TLeaf, error)

Save creates the TLeaf entities in the database.

func (*TLeafCreateBulk) SaveX

func (tcb *TLeafCreateBulk) SaveX(ctx context.Context) []*TLeaf

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

type TLeafDelete

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

TLeafDelete is the builder for deleting a TLeaf entity.

func (*TLeafDelete) Exec

func (td *TLeafDelete) Exec(ctx context.Context) (int, error)

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

func (*TLeafDelete) ExecX

func (td *TLeafDelete) ExecX(ctx context.Context) int

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

func (*TLeafDelete) Where

func (td *TLeafDelete) Where(ps ...predicate.TLeaf) *TLeafDelete

Where appends a list predicates to the TLeafDelete builder.

type TLeafDeleteOne

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

TLeafDeleteOne is the builder for deleting a single TLeaf entity.

func (*TLeafDeleteOne) Exec

func (tdo *TLeafDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*TLeafDeleteOne) ExecX

func (tdo *TLeafDeleteOne) ExecX(ctx context.Context)

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

func (*TLeafDeleteOne) Where

func (tdo *TLeafDeleteOne) Where(ps ...predicate.TLeaf) *TLeafDeleteOne

Where appends a list predicates to the TLeafDelete builder.

type TLeafGroupBy

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

TLeafGroupBy is the group-by builder for TLeaf entities.

func (*TLeafGroupBy) Aggregate

func (tgb *TLeafGroupBy) Aggregate(fns ...AggregateFunc) *TLeafGroupBy

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

func (*TLeafGroupBy) Bool

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

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

func (*TLeafGroupBy) BoolX

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

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

func (*TLeafGroupBy) Bools

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

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

func (*TLeafGroupBy) BoolsX

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

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

func (*TLeafGroupBy) Float64

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

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

func (*TLeafGroupBy) Float64X

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

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

func (*TLeafGroupBy) Float64s

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

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

func (*TLeafGroupBy) Float64sX

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

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

func (*TLeafGroupBy) Int

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

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

func (*TLeafGroupBy) IntX

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

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

func (*TLeafGroupBy) Ints

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

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

func (*TLeafGroupBy) IntsX

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

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

func (*TLeafGroupBy) Scan

func (tgb *TLeafGroupBy) Scan(ctx context.Context, v any) error

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

func (*TLeafGroupBy) ScanX

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

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

func (*TLeafGroupBy) String

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

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

func (*TLeafGroupBy) StringX

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

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

func (*TLeafGroupBy) Strings

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

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

func (*TLeafGroupBy) StringsX

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

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

type TLeafMutation

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

TLeafMutation represents an operation that mutates the TLeaf nodes in the graph.

func (*TLeafMutation) AddCreatedAt

func (m *TLeafMutation) AddCreatedAt(i int64)

AddCreatedAt adds i to the "created_at" field.

func (*TLeafMutation) AddField

func (m *TLeafMutation) 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 (*TLeafMutation) AddMaxID

func (m *TLeafMutation) AddMaxID(i int64)

AddMaxID adds i to the "max_id" field.

func (*TLeafMutation) AddStep

func (m *TLeafMutation) AddStep(i int64)

AddStep adds i to the "step" field.

func (*TLeafMutation) AddUpdatedAt

func (m *TLeafMutation) AddUpdatedAt(i int64)

AddUpdatedAt adds i to the "updated_at" field.

func (*TLeafMutation) AddVersion

func (m *TLeafMutation) AddVersion(i int32)

AddVersion adds i to the "version" field.

func (*TLeafMutation) AddedCreatedAt

func (m *TLeafMutation) AddedCreatedAt() (r int64, exists bool)

AddedCreatedAt returns the value that was added to the "created_at" field in this mutation.

func (*TLeafMutation) AddedEdges

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

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

func (*TLeafMutation) AddedField

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

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

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

func (*TLeafMutation) AddedIDs

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

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

func (*TLeafMutation) AddedMaxID

func (m *TLeafMutation) AddedMaxID() (r int64, exists bool)

AddedMaxID returns the value that was added to the "max_id" field in this mutation.

func (*TLeafMutation) AddedStep

func (m *TLeafMutation) AddedStep() (r int64, exists bool)

AddedStep returns the value that was added to the "step" field in this mutation.

func (*TLeafMutation) AddedUpdatedAt

func (m *TLeafMutation) AddedUpdatedAt() (r int64, exists bool)

AddedUpdatedAt returns the value that was added to the "updated_at" field in this mutation.

func (*TLeafMutation) AddedVersion

func (m *TLeafMutation) AddedVersion() (r int32, exists bool)

AddedVersion returns the value that was added to the "version" field in this mutation.

func (*TLeafMutation) BizTag

func (m *TLeafMutation) BizTag() (r string, exists bool)

BizTag returns the value of the "biz_tag" field in the mutation.

func (*TLeafMutation) ClearEdge

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

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

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

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

func (*TLeafMutation) ClearedFields

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

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

func (TLeafMutation) Client

func (m TLeafMutation) 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 (*TLeafMutation) CreatedAt

func (m *TLeafMutation) CreatedAt() (r int64, exists bool)

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

func (*TLeafMutation) Desc

func (m *TLeafMutation) Desc() (r string, exists bool)

Desc returns the value of the "desc" field in the mutation.

func (*TLeafMutation) EdgeCleared

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

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

func (*TLeafMutation) Field

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

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

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

func (*TLeafMutation) Fields

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

func (m *TLeafMutation) ID() (id int64, exists bool)

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

func (*TLeafMutation) IDs

func (m *TLeafMutation) IDs(ctx context.Context) ([]int64, 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 (*TLeafMutation) MaxID

func (m *TLeafMutation) MaxID() (r int64, exists bool)

MaxID returns the value of the "max_id" field in the mutation.

func (*TLeafMutation) OldBizTag

func (m *TLeafMutation) OldBizTag(ctx context.Context) (v string, err error)

OldBizTag returns the old "biz_tag" field's value of the TLeaf entity. If the TLeaf 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 (*TLeafMutation) OldCreatedAt

func (m *TLeafMutation) OldCreatedAt(ctx context.Context) (v int64, err error)

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

func (m *TLeafMutation) OldDesc(ctx context.Context) (v string, err error)

OldDesc returns the old "desc" field's value of the TLeaf entity. If the TLeaf 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 (*TLeafMutation) OldField

func (m *TLeafMutation) 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 (*TLeafMutation) OldMaxID

func (m *TLeafMutation) OldMaxID(ctx context.Context) (v int64, err error)

OldMaxID returns the old "max_id" field's value of the TLeaf entity. If the TLeaf 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 (*TLeafMutation) OldStep

func (m *TLeafMutation) OldStep(ctx context.Context) (v int64, err error)

OldStep returns the old "step" field's value of the TLeaf entity. If the TLeaf 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 (*TLeafMutation) OldUpdatedAt

func (m *TLeafMutation) OldUpdatedAt(ctx context.Context) (v int64, err error)

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

func (m *TLeafMutation) OldVersion(ctx context.Context) (v int32, err error)

OldVersion returns the old "version" field's value of the TLeaf entity. If the TLeaf 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 (*TLeafMutation) Op

func (m *TLeafMutation) Op() Op

Op returns the operation name.

func (*TLeafMutation) RemovedEdges

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

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

func (*TLeafMutation) RemovedIDs

func (m *TLeafMutation) 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 (*TLeafMutation) ResetBizTag

func (m *TLeafMutation) ResetBizTag()

ResetBizTag resets all changes to the "biz_tag" field.

func (*TLeafMutation) ResetCreatedAt

func (m *TLeafMutation) ResetCreatedAt()

ResetCreatedAt resets all changes to the "created_at" field.

func (*TLeafMutation) ResetDesc

func (m *TLeafMutation) ResetDesc()

ResetDesc resets all changes to the "desc" field.

func (*TLeafMutation) ResetEdge

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

func (m *TLeafMutation) 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 (*TLeafMutation) ResetMaxID

func (m *TLeafMutation) ResetMaxID()

ResetMaxID resets all changes to the "max_id" field.

func (*TLeafMutation) ResetStep

func (m *TLeafMutation) ResetStep()

ResetStep resets all changes to the "step" field.

func (*TLeafMutation) ResetUpdatedAt

func (m *TLeafMutation) ResetUpdatedAt()

ResetUpdatedAt resets all changes to the "updated_at" field.

func (*TLeafMutation) ResetVersion

func (m *TLeafMutation) ResetVersion()

ResetVersion resets all changes to the "version" field.

func (*TLeafMutation) SetBizTag

func (m *TLeafMutation) SetBizTag(s string)

SetBizTag sets the "biz_tag" field.

func (*TLeafMutation) SetCreatedAt

func (m *TLeafMutation) SetCreatedAt(i int64)

SetCreatedAt sets the "created_at" field.

func (*TLeafMutation) SetDesc

func (m *TLeafMutation) SetDesc(s string)

SetDesc sets the "desc" field.

func (*TLeafMutation) SetField

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

func (m *TLeafMutation) SetID(id int64)

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

func (*TLeafMutation) SetMaxID

func (m *TLeafMutation) SetMaxID(i int64)

SetMaxID sets the "max_id" field.

func (*TLeafMutation) SetOp

func (m *TLeafMutation) SetOp(op Op)

SetOp allows setting the mutation operation.

func (*TLeafMutation) SetStep

func (m *TLeafMutation) SetStep(i int64)

SetStep sets the "step" field.

func (*TLeafMutation) SetUpdatedAt

func (m *TLeafMutation) SetUpdatedAt(i int64)

SetUpdatedAt sets the "updated_at" field.

func (*TLeafMutation) SetVersion

func (m *TLeafMutation) SetVersion(i int32)

SetVersion sets the "version" field.

func (*TLeafMutation) Step

func (m *TLeafMutation) Step() (r int64, exists bool)

Step returns the value of the "step" field in the mutation.

func (TLeafMutation) Tx

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

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

func (*TLeafMutation) Type

func (m *TLeafMutation) Type() string

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

func (*TLeafMutation) UpdatedAt

func (m *TLeafMutation) UpdatedAt() (r int64, exists bool)

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

func (*TLeafMutation) Version

func (m *TLeafMutation) Version() (r int32, exists bool)

Version returns the value of the "version" field in the mutation.

func (*TLeafMutation) Where

func (m *TLeafMutation) Where(ps ...predicate.TLeaf)

Where appends a list predicates to the TLeafMutation builder.

func (*TLeafMutation) WhereP

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

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

type TLeafQuery

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

TLeafQuery is the builder for querying TLeaf entities.

func (*TLeafQuery) Aggregate

func (tq *TLeafQuery) Aggregate(fns ...AggregateFunc) *TLeafSelect

Aggregate returns a TLeafSelect configured with the given aggregations.

func (*TLeafQuery) All

func (tq *TLeafQuery) All(ctx context.Context) ([]*TLeaf, error)

All executes the query and returns a list of TLeafs.

func (*TLeafQuery) AllX

func (tq *TLeafQuery) AllX(ctx context.Context) []*TLeaf

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

func (*TLeafQuery) Clone

func (tq *TLeafQuery) Clone() *TLeafQuery

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

func (*TLeafQuery) Count

func (tq *TLeafQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*TLeafQuery) CountX

func (tq *TLeafQuery) CountX(ctx context.Context) int

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

func (*TLeafQuery) Exist

func (tq *TLeafQuery) Exist(ctx context.Context) (bool, error)

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

func (*TLeafQuery) ExistX

func (tq *TLeafQuery) ExistX(ctx context.Context) bool

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

func (*TLeafQuery) First

func (tq *TLeafQuery) First(ctx context.Context) (*TLeaf, error)

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

func (*TLeafQuery) FirstID

func (tq *TLeafQuery) FirstID(ctx context.Context) (id int64, err error)

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

func (*TLeafQuery) FirstIDX

func (tq *TLeafQuery) FirstIDX(ctx context.Context) int64

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

func (*TLeafQuery) FirstX

func (tq *TLeafQuery) FirstX(ctx context.Context) *TLeaf

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

func (*TLeafQuery) GroupBy

func (tq *TLeafQuery) GroupBy(field string, fields ...string) *TLeafGroupBy

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

client.TLeaf.Query().
	GroupBy(tleaf.FieldBizTag).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*TLeafQuery) IDs

func (tq *TLeafQuery) IDs(ctx context.Context) (ids []int64, err error)

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

func (*TLeafQuery) IDsX

func (tq *TLeafQuery) IDsX(ctx context.Context) []int64

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

func (*TLeafQuery) Limit

func (tq *TLeafQuery) Limit(limit int) *TLeafQuery

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

func (*TLeafQuery) Modify

func (tq *TLeafQuery) Modify(modifiers ...func(s *sql.Selector)) *TLeafSelect

Modify adds a query modifier for attaching custom logic to queries.

func (*TLeafQuery) Offset

func (tq *TLeafQuery) Offset(offset int) *TLeafQuery

Offset to start from.

func (*TLeafQuery) Only

func (tq *TLeafQuery) Only(ctx context.Context) (*TLeaf, error)

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

func (*TLeafQuery) OnlyID

func (tq *TLeafQuery) OnlyID(ctx context.Context) (id int64, err error)

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

func (*TLeafQuery) OnlyIDX

func (tq *TLeafQuery) OnlyIDX(ctx context.Context) int64

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

func (*TLeafQuery) OnlyX

func (tq *TLeafQuery) OnlyX(ctx context.Context) *TLeaf

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

func (*TLeafQuery) Order

func (tq *TLeafQuery) Order(o ...tleaf.OrderOption) *TLeafQuery

Order specifies how the records should be ordered.

func (*TLeafQuery) Select

func (tq *TLeafQuery) Select(fields ...string) *TLeafSelect

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

client.TLeaf.Query().
	Select(tleaf.FieldBizTag).
	Scan(ctx, &v)

func (*TLeafQuery) Unique

func (tq *TLeafQuery) Unique(unique bool) *TLeafQuery

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

func (tq *TLeafQuery) Where(ps ...predicate.TLeaf) *TLeafQuery

Where adds a new predicate for the TLeafQuery builder.

type TLeafSelect

type TLeafSelect struct {
	*TLeafQuery
	// contains filtered or unexported fields
}

TLeafSelect is the builder for selecting fields of TLeaf entities.

func (*TLeafSelect) Aggregate

func (ts *TLeafSelect) Aggregate(fns ...AggregateFunc) *TLeafSelect

Aggregate adds the given aggregation functions to the selector query.

func (*TLeafSelect) Bool

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

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

func (*TLeafSelect) BoolX

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

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

func (*TLeafSelect) Bools

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

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

func (*TLeafSelect) BoolsX

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

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

func (*TLeafSelect) Float64

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

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

func (*TLeafSelect) Float64X

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

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

func (*TLeafSelect) Float64s

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

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

func (*TLeafSelect) Float64sX

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

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

func (*TLeafSelect) Int

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

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

func (*TLeafSelect) IntX

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

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

func (*TLeafSelect) Ints

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

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

func (*TLeafSelect) IntsX

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

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

func (*TLeafSelect) Modify

func (ts *TLeafSelect) Modify(modifiers ...func(s *sql.Selector)) *TLeafSelect

Modify adds a query modifier for attaching custom logic to queries.

func (*TLeafSelect) Scan

func (ts *TLeafSelect) Scan(ctx context.Context, v any) error

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

func (*TLeafSelect) ScanX

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

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

func (*TLeafSelect) String

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

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

func (*TLeafSelect) StringX

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

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

func (*TLeafSelect) Strings

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

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

func (*TLeafSelect) StringsX

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

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

type TLeafUpdate

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

TLeafUpdate is the builder for updating TLeaf entities.

func (*TLeafUpdate) AddMaxID

func (tu *TLeafUpdate) AddMaxID(i int64) *TLeafUpdate

AddMaxID adds i to the "max_id" field.

func (*TLeafUpdate) AddStep

func (tu *TLeafUpdate) AddStep(i int64) *TLeafUpdate

AddStep adds i to the "step" field.

func (*TLeafUpdate) AddUpdatedAt

func (tu *TLeafUpdate) AddUpdatedAt(i int64) *TLeafUpdate

AddUpdatedAt adds i to the "updated_at" field.

func (*TLeafUpdate) AddVersion

func (tu *TLeafUpdate) AddVersion(i int32) *TLeafUpdate

AddVersion adds i to the "version" field.

func (*TLeafUpdate) Exec

func (tu *TLeafUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*TLeafUpdate) ExecX

func (tu *TLeafUpdate) ExecX(ctx context.Context)

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

func (*TLeafUpdate) Modify

func (tu *TLeafUpdate) Modify(modifiers ...func(u *sql.UpdateBuilder)) *TLeafUpdate

Modify adds a statement modifier for attaching custom logic to the UPDATE statement.

func (*TLeafUpdate) Mutation

func (tu *TLeafUpdate) Mutation() *TLeafMutation

Mutation returns the TLeafMutation object of the builder.

func (*TLeafUpdate) Save

func (tu *TLeafUpdate) Save(ctx context.Context) (int, error)

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

func (*TLeafUpdate) SaveX

func (tu *TLeafUpdate) SaveX(ctx context.Context) int

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

func (*TLeafUpdate) SetBizTag

func (tu *TLeafUpdate) SetBizTag(s string) *TLeafUpdate

SetBizTag sets the "biz_tag" field.

func (*TLeafUpdate) SetDesc

func (tu *TLeafUpdate) SetDesc(s string) *TLeafUpdate

SetDesc sets the "desc" field.

func (*TLeafUpdate) SetMaxID

func (tu *TLeafUpdate) SetMaxID(i int64) *TLeafUpdate

SetMaxID sets the "max_id" field.

func (*TLeafUpdate) SetNillableBizTag

func (tu *TLeafUpdate) SetNillableBizTag(s *string) *TLeafUpdate

SetNillableBizTag sets the "biz_tag" field if the given value is not nil.

func (*TLeafUpdate) SetNillableDesc

func (tu *TLeafUpdate) SetNillableDesc(s *string) *TLeafUpdate

SetNillableDesc sets the "desc" field if the given value is not nil.

func (*TLeafUpdate) SetNillableMaxID

func (tu *TLeafUpdate) SetNillableMaxID(i *int64) *TLeafUpdate

SetNillableMaxID sets the "max_id" field if the given value is not nil.

func (*TLeafUpdate) SetNillableStep

func (tu *TLeafUpdate) SetNillableStep(i *int64) *TLeafUpdate

SetNillableStep sets the "step" field if the given value is not nil.

func (*TLeafUpdate) SetNillableUpdatedAt

func (tu *TLeafUpdate) SetNillableUpdatedAt(i *int64) *TLeafUpdate

SetNillableUpdatedAt sets the "updated_at" field if the given value is not nil.

func (*TLeafUpdate) SetNillableVersion

func (tu *TLeafUpdate) SetNillableVersion(i *int32) *TLeafUpdate

SetNillableVersion sets the "version" field if the given value is not nil.

func (*TLeafUpdate) SetStep

func (tu *TLeafUpdate) SetStep(i int64) *TLeafUpdate

SetStep sets the "step" field.

func (*TLeafUpdate) SetUpdatedAt

func (tu *TLeafUpdate) SetUpdatedAt(i int64) *TLeafUpdate

SetUpdatedAt sets the "updated_at" field.

func (*TLeafUpdate) SetVersion

func (tu *TLeafUpdate) SetVersion(i int32) *TLeafUpdate

SetVersion sets the "version" field.

func (*TLeafUpdate) Where

func (tu *TLeafUpdate) Where(ps ...predicate.TLeaf) *TLeafUpdate

Where appends a list predicates to the TLeafUpdate builder.

type TLeafUpdateOne

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

TLeafUpdateOne is the builder for updating a single TLeaf entity.

func (*TLeafUpdateOne) AddMaxID

func (tuo *TLeafUpdateOne) AddMaxID(i int64) *TLeafUpdateOne

AddMaxID adds i to the "max_id" field.

func (*TLeafUpdateOne) AddStep

func (tuo *TLeafUpdateOne) AddStep(i int64) *TLeafUpdateOne

AddStep adds i to the "step" field.

func (*TLeafUpdateOne) AddUpdatedAt

func (tuo *TLeafUpdateOne) AddUpdatedAt(i int64) *TLeafUpdateOne

AddUpdatedAt adds i to the "updated_at" field.

func (*TLeafUpdateOne) AddVersion

func (tuo *TLeafUpdateOne) AddVersion(i int32) *TLeafUpdateOne

AddVersion adds i to the "version" field.

func (*TLeafUpdateOne) Exec

func (tuo *TLeafUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*TLeafUpdateOne) ExecX

func (tuo *TLeafUpdateOne) ExecX(ctx context.Context)

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

func (*TLeafUpdateOne) Modify

func (tuo *TLeafUpdateOne) Modify(modifiers ...func(u *sql.UpdateBuilder)) *TLeafUpdateOne

Modify adds a statement modifier for attaching custom logic to the UPDATE statement.

func (*TLeafUpdateOne) Mutation

func (tuo *TLeafUpdateOne) Mutation() *TLeafMutation

Mutation returns the TLeafMutation object of the builder.

func (*TLeafUpdateOne) Save

func (tuo *TLeafUpdateOne) Save(ctx context.Context) (*TLeaf, error)

Save executes the query and returns the updated TLeaf entity.

func (*TLeafUpdateOne) SaveX

func (tuo *TLeafUpdateOne) SaveX(ctx context.Context) *TLeaf

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

func (*TLeafUpdateOne) Select

func (tuo *TLeafUpdateOne) Select(field string, fields ...string) *TLeafUpdateOne

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

func (*TLeafUpdateOne) SetBizTag

func (tuo *TLeafUpdateOne) SetBizTag(s string) *TLeafUpdateOne

SetBizTag sets the "biz_tag" field.

func (*TLeafUpdateOne) SetDesc

func (tuo *TLeafUpdateOne) SetDesc(s string) *TLeafUpdateOne

SetDesc sets the "desc" field.

func (*TLeafUpdateOne) SetMaxID

func (tuo *TLeafUpdateOne) SetMaxID(i int64) *TLeafUpdateOne

SetMaxID sets the "max_id" field.

func (*TLeafUpdateOne) SetNillableBizTag

func (tuo *TLeafUpdateOne) SetNillableBizTag(s *string) *TLeafUpdateOne

SetNillableBizTag sets the "biz_tag" field if the given value is not nil.

func (*TLeafUpdateOne) SetNillableDesc

func (tuo *TLeafUpdateOne) SetNillableDesc(s *string) *TLeafUpdateOne

SetNillableDesc sets the "desc" field if the given value is not nil.

func (*TLeafUpdateOne) SetNillableMaxID

func (tuo *TLeafUpdateOne) SetNillableMaxID(i *int64) *TLeafUpdateOne

SetNillableMaxID sets the "max_id" field if the given value is not nil.

func (*TLeafUpdateOne) SetNillableStep

func (tuo *TLeafUpdateOne) SetNillableStep(i *int64) *TLeafUpdateOne

SetNillableStep sets the "step" field if the given value is not nil.

func (*TLeafUpdateOne) SetNillableUpdatedAt

func (tuo *TLeafUpdateOne) SetNillableUpdatedAt(i *int64) *TLeafUpdateOne

SetNillableUpdatedAt sets the "updated_at" field if the given value is not nil.

func (*TLeafUpdateOne) SetNillableVersion

func (tuo *TLeafUpdateOne) SetNillableVersion(i *int32) *TLeafUpdateOne

SetNillableVersion sets the "version" field if the given value is not nil.

func (*TLeafUpdateOne) SetStep

func (tuo *TLeafUpdateOne) SetStep(i int64) *TLeafUpdateOne

SetStep sets the "step" field.

func (*TLeafUpdateOne) SetUpdatedAt

func (tuo *TLeafUpdateOne) SetUpdatedAt(i int64) *TLeafUpdateOne

SetUpdatedAt sets the "updated_at" field.

func (*TLeafUpdateOne) SetVersion

func (tuo *TLeafUpdateOne) SetVersion(i int32) *TLeafUpdateOne

SetVersion sets the "version" field.

func (*TLeafUpdateOne) Where

func (tuo *TLeafUpdateOne) Where(ps ...predicate.TLeaf) *TLeafUpdateOne

Where appends a list predicates to the TLeafUpdate builder.

type TLeafs

type TLeafs []*TLeaf

TLeafs is a parsable slice of TLeaf.

type TShortUrl

type TShortUrl struct {

	// ID of the ent.
	// primary key
	ID int64 `json:"id,omitempty"`
	// refer to leaf id
	BizID int64 `json:"biz_id,omitempty"`
	// current max id
	Origin string `json:"origin,omitempty"`
	// short url
	Short int64 `json:"short,omitempty"`
	// Visit holds the value of the "visit" field.
	Visit int64 `json:"visit,omitempty"`
	// CreatedAt holds the value of the "created_at" field.
	CreatedAt int64 `json:"created_at,omitempty"`
	// UpdatedAt holds the value of the "updated_at" field.
	UpdatedAt int64 `json:"updated_at,omitempty"`
	// ExpiredAt holds the value of the "expired_at" field.
	ExpiredAt int64 `json:"expired_at,omitempty"`
	// contains filtered or unexported fields
}

TShortUrl is the model entity for the TShortUrl schema.

func (*TShortUrl) String

func (tu *TShortUrl) String() string

String implements the fmt.Stringer.

func (*TShortUrl) Unwrap

func (tu *TShortUrl) Unwrap() *TShortUrl

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

func (tu *TShortUrl) Update() *TShortUrlUpdateOne

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

func (*TShortUrl) Value

func (tu *TShortUrl) Value(name string) (ent.Value, error)

Value returns the ent.Value that was dynamically selected and assigned to the TShortUrl. This includes values selected through modifiers, order, etc.

type TShortUrlClient

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

TShortUrlClient is a client for the TShortUrl schema.

func NewTShortUrlClient

func NewTShortUrlClient(c config) *TShortUrlClient

NewTShortUrlClient returns a client for the TShortUrl from the given config.

func (*TShortUrlClient) Create

func (c *TShortUrlClient) Create() *TShortUrlCreate

Create returns a builder for creating a TShortUrl entity.

func (*TShortUrlClient) CreateBulk

func (c *TShortUrlClient) CreateBulk(builders ...*TShortUrlCreate) *TShortUrlCreateBulk

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

func (*TShortUrlClient) Delete

func (c *TShortUrlClient) Delete() *TShortUrlDelete

Delete returns a delete builder for TShortUrl.

func (*TShortUrlClient) DeleteOne

func (c *TShortUrlClient) DeleteOne(tu *TShortUrl) *TShortUrlDeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*TShortUrlClient) DeleteOneID

func (c *TShortUrlClient) DeleteOneID(id int64) *TShortUrlDeleteOne

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

func (*TShortUrlClient) Get

func (c *TShortUrlClient) Get(ctx context.Context, id int64) (*TShortUrl, error)

Get returns a TShortUrl entity by its id.

func (*TShortUrlClient) GetX

func (c *TShortUrlClient) GetX(ctx context.Context, id int64) *TShortUrl

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

func (*TShortUrlClient) Hooks

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

Hooks returns the client hooks.

func (*TShortUrlClient) Intercept

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

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

func (*TShortUrlClient) Interceptors

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

Interceptors returns the client interceptors.

func (*TShortUrlClient) MapCreateBulk

func (c *TShortUrlClient) MapCreateBulk(slice any, setFunc func(*TShortUrlCreate, int)) *TShortUrlCreateBulk

MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates a builder and applies setFunc on it.

func (*TShortUrlClient) Query

func (c *TShortUrlClient) Query() *TShortUrlQuery

Query returns a query builder for TShortUrl.

func (*TShortUrlClient) Update

func (c *TShortUrlClient) Update() *TShortUrlUpdate

Update returns an update builder for TShortUrl.

func (*TShortUrlClient) UpdateOne

func (c *TShortUrlClient) UpdateOne(tu *TShortUrl) *TShortUrlUpdateOne

UpdateOne returns an update builder for the given entity.

func (*TShortUrlClient) UpdateOneID

func (c *TShortUrlClient) UpdateOneID(id int64) *TShortUrlUpdateOne

UpdateOneID returns an update builder for the given id.

func (*TShortUrlClient) Use

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

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

type TShortUrlCreate

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

TShortUrlCreate is the builder for creating a TShortUrl entity.

func (*TShortUrlCreate) Exec

func (tuc *TShortUrlCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*TShortUrlCreate) ExecX

func (tuc *TShortUrlCreate) ExecX(ctx context.Context)

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

func (*TShortUrlCreate) Mutation

func (tuc *TShortUrlCreate) Mutation() *TShortUrlMutation

Mutation returns the TShortUrlMutation object of the builder.

func (*TShortUrlCreate) Save

func (tuc *TShortUrlCreate) Save(ctx context.Context) (*TShortUrl, error)

Save creates the TShortUrl in the database.

func (*TShortUrlCreate) SaveX

func (tuc *TShortUrlCreate) SaveX(ctx context.Context) *TShortUrl

SaveX calls Save and panics if Save returns an error.

func (*TShortUrlCreate) SetBizID

func (tuc *TShortUrlCreate) SetBizID(i int64) *TShortUrlCreate

SetBizID sets the "biz_id" field.

func (*TShortUrlCreate) SetCreatedAt

func (tuc *TShortUrlCreate) SetCreatedAt(i int64) *TShortUrlCreate

SetCreatedAt sets the "created_at" field.

func (*TShortUrlCreate) SetExpiredAt

func (tuc *TShortUrlCreate) SetExpiredAt(i int64) *TShortUrlCreate

SetExpiredAt sets the "expired_at" field.

func (*TShortUrlCreate) SetID

func (tuc *TShortUrlCreate) SetID(i int64) *TShortUrlCreate

SetID sets the "id" field.

func (*TShortUrlCreate) SetNillableExpiredAt

func (tuc *TShortUrlCreate) SetNillableExpiredAt(i *int64) *TShortUrlCreate

SetNillableExpiredAt sets the "expired_at" field if the given value is not nil.

func (*TShortUrlCreate) SetNillableVisit

func (tuc *TShortUrlCreate) SetNillableVisit(i *int64) *TShortUrlCreate

SetNillableVisit sets the "visit" field if the given value is not nil.

func (*TShortUrlCreate) SetOrigin

func (tuc *TShortUrlCreate) SetOrigin(s string) *TShortUrlCreate

SetOrigin sets the "origin" field.

func (*TShortUrlCreate) SetShort

func (tuc *TShortUrlCreate) SetShort(i int64) *TShortUrlCreate

SetShort sets the "short" field.

func (*TShortUrlCreate) SetUpdatedAt

func (tuc *TShortUrlCreate) SetUpdatedAt(i int64) *TShortUrlCreate

SetUpdatedAt sets the "updated_at" field.

func (*TShortUrlCreate) SetVisit

func (tuc *TShortUrlCreate) SetVisit(i int64) *TShortUrlCreate

SetVisit sets the "visit" field.

type TShortUrlCreateBulk

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

TShortUrlCreateBulk is the builder for creating many TShortUrl entities in bulk.

func (*TShortUrlCreateBulk) Exec

func (tucb *TShortUrlCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*TShortUrlCreateBulk) ExecX

func (tucb *TShortUrlCreateBulk) ExecX(ctx context.Context)

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

func (*TShortUrlCreateBulk) Save

func (tucb *TShortUrlCreateBulk) Save(ctx context.Context) ([]*TShortUrl, error)

Save creates the TShortUrl entities in the database.

func (*TShortUrlCreateBulk) SaveX

func (tucb *TShortUrlCreateBulk) SaveX(ctx context.Context) []*TShortUrl

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

type TShortUrlDelete

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

TShortUrlDelete is the builder for deleting a TShortUrl entity.

func (*TShortUrlDelete) Exec

func (tud *TShortUrlDelete) Exec(ctx context.Context) (int, error)

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

func (*TShortUrlDelete) ExecX

func (tud *TShortUrlDelete) ExecX(ctx context.Context) int

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

func (*TShortUrlDelete) Where

Where appends a list predicates to the TShortUrlDelete builder.

type TShortUrlDeleteOne

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

TShortUrlDeleteOne is the builder for deleting a single TShortUrl entity.

func (*TShortUrlDeleteOne) Exec

func (tudo *TShortUrlDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*TShortUrlDeleteOne) ExecX

func (tudo *TShortUrlDeleteOne) ExecX(ctx context.Context)

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

func (*TShortUrlDeleteOne) Where

Where appends a list predicates to the TShortUrlDelete builder.

type TShortUrlGroupBy

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

TShortUrlGroupBy is the group-by builder for TShortUrl entities.

func (*TShortUrlGroupBy) Aggregate

func (tugb *TShortUrlGroupBy) Aggregate(fns ...AggregateFunc) *TShortUrlGroupBy

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

func (*TShortUrlGroupBy) Bool

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

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

func (*TShortUrlGroupBy) BoolX

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

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

func (*TShortUrlGroupBy) Bools

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

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

func (*TShortUrlGroupBy) BoolsX

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

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

func (*TShortUrlGroupBy) Float64

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

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

func (*TShortUrlGroupBy) Float64X

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

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

func (*TShortUrlGroupBy) Float64s

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

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

func (*TShortUrlGroupBy) Float64sX

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

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

func (*TShortUrlGroupBy) Int

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

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

func (*TShortUrlGroupBy) IntX

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

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

func (*TShortUrlGroupBy) Ints

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

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

func (*TShortUrlGroupBy) IntsX

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

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

func (*TShortUrlGroupBy) Scan

func (tugb *TShortUrlGroupBy) Scan(ctx context.Context, v any) error

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

func (*TShortUrlGroupBy) ScanX

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

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

func (*TShortUrlGroupBy) String

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

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

func (*TShortUrlGroupBy) StringX

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

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

func (*TShortUrlGroupBy) Strings

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

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

func (*TShortUrlGroupBy) StringsX

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

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

type TShortUrlMutation

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

TShortUrlMutation represents an operation that mutates the TShortUrl nodes in the graph.

func (*TShortUrlMutation) AddBizID

func (m *TShortUrlMutation) AddBizID(i int64)

AddBizID adds i to the "biz_id" field.

func (*TShortUrlMutation) AddCreatedAt

func (m *TShortUrlMutation) AddCreatedAt(i int64)

AddCreatedAt adds i to the "created_at" field.

func (*TShortUrlMutation) AddExpiredAt

func (m *TShortUrlMutation) AddExpiredAt(i int64)

AddExpiredAt adds i to the "expired_at" field.

func (*TShortUrlMutation) AddField

func (m *TShortUrlMutation) 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 (*TShortUrlMutation) AddShort

func (m *TShortUrlMutation) AddShort(i int64)

AddShort adds i to the "short" field.

func (*TShortUrlMutation) AddUpdatedAt

func (m *TShortUrlMutation) AddUpdatedAt(i int64)

AddUpdatedAt adds i to the "updated_at" field.

func (*TShortUrlMutation) AddVisit

func (m *TShortUrlMutation) AddVisit(i int64)

AddVisit adds i to the "visit" field.

func (*TShortUrlMutation) AddedBizID

func (m *TShortUrlMutation) AddedBizID() (r int64, exists bool)

AddedBizID returns the value that was added to the "biz_id" field in this mutation.

func (*TShortUrlMutation) AddedCreatedAt

func (m *TShortUrlMutation) AddedCreatedAt() (r int64, exists bool)

AddedCreatedAt returns the value that was added to the "created_at" field in this mutation.

func (*TShortUrlMutation) AddedEdges

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

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

func (*TShortUrlMutation) AddedExpiredAt

func (m *TShortUrlMutation) AddedExpiredAt() (r int64, exists bool)

AddedExpiredAt returns the value that was added to the "expired_at" field in this mutation.

func (*TShortUrlMutation) AddedField

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

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

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

func (*TShortUrlMutation) AddedIDs

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

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

func (*TShortUrlMutation) AddedShort

func (m *TShortUrlMutation) AddedShort() (r int64, exists bool)

AddedShort returns the value that was added to the "short" field in this mutation.

func (*TShortUrlMutation) AddedUpdatedAt

func (m *TShortUrlMutation) AddedUpdatedAt() (r int64, exists bool)

AddedUpdatedAt returns the value that was added to the "updated_at" field in this mutation.

func (*TShortUrlMutation) AddedVisit

func (m *TShortUrlMutation) AddedVisit() (r int64, exists bool)

AddedVisit returns the value that was added to the "visit" field in this mutation.

func (*TShortUrlMutation) BizID

func (m *TShortUrlMutation) BizID() (r int64, exists bool)

BizID returns the value of the "biz_id" field in the mutation.

func (*TShortUrlMutation) ClearEdge

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

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

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

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

func (*TShortUrlMutation) ClearedFields

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

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

func (TShortUrlMutation) Client

func (m TShortUrlMutation) 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 (*TShortUrlMutation) CreatedAt

func (m *TShortUrlMutation) CreatedAt() (r int64, exists bool)

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

func (*TShortUrlMutation) EdgeCleared

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

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

func (*TShortUrlMutation) ExpiredAt

func (m *TShortUrlMutation) ExpiredAt() (r int64, exists bool)

ExpiredAt returns the value of the "expired_at" field in the mutation.

func (*TShortUrlMutation) Field

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

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

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

func (*TShortUrlMutation) Fields

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

func (m *TShortUrlMutation) ID() (id int64, exists bool)

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

func (*TShortUrlMutation) IDs

func (m *TShortUrlMutation) IDs(ctx context.Context) ([]int64, 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 (*TShortUrlMutation) OldBizID

func (m *TShortUrlMutation) OldBizID(ctx context.Context) (v int64, err error)

OldBizID returns the old "biz_id" field's value of the TShortUrl entity. If the TShortUrl 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 (*TShortUrlMutation) OldCreatedAt

func (m *TShortUrlMutation) OldCreatedAt(ctx context.Context) (v int64, err error)

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

func (m *TShortUrlMutation) OldExpiredAt(ctx context.Context) (v int64, err error)

OldExpiredAt returns the old "expired_at" field's value of the TShortUrl entity. If the TShortUrl 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 (*TShortUrlMutation) OldField

func (m *TShortUrlMutation) 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 (*TShortUrlMutation) OldOrigin

func (m *TShortUrlMutation) OldOrigin(ctx context.Context) (v string, err error)

OldOrigin returns the old "origin" field's value of the TShortUrl entity. If the TShortUrl 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 (*TShortUrlMutation) OldShort

func (m *TShortUrlMutation) OldShort(ctx context.Context) (v int64, err error)

OldShort returns the old "short" field's value of the TShortUrl entity. If the TShortUrl 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 (*TShortUrlMutation) OldUpdatedAt

func (m *TShortUrlMutation) OldUpdatedAt(ctx context.Context) (v int64, err error)

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

func (m *TShortUrlMutation) OldVisit(ctx context.Context) (v int64, err error)

OldVisit returns the old "visit" field's value of the TShortUrl entity. If the TShortUrl 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 (*TShortUrlMutation) Op

func (m *TShortUrlMutation) Op() Op

Op returns the operation name.

func (*TShortUrlMutation) Origin

func (m *TShortUrlMutation) Origin() (r string, exists bool)

Origin returns the value of the "origin" field in the mutation.

func (*TShortUrlMutation) RemovedEdges

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

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

func (*TShortUrlMutation) RemovedIDs

func (m *TShortUrlMutation) 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 (*TShortUrlMutation) ResetBizID

func (m *TShortUrlMutation) ResetBizID()

ResetBizID resets all changes to the "biz_id" field.

func (*TShortUrlMutation) ResetCreatedAt

func (m *TShortUrlMutation) ResetCreatedAt()

ResetCreatedAt resets all changes to the "created_at" field.

func (*TShortUrlMutation) ResetEdge

func (m *TShortUrlMutation) 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 (*TShortUrlMutation) ResetExpiredAt

func (m *TShortUrlMutation) ResetExpiredAt()

ResetExpiredAt resets all changes to the "expired_at" field.

func (*TShortUrlMutation) ResetField

func (m *TShortUrlMutation) 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 (*TShortUrlMutation) ResetOrigin

func (m *TShortUrlMutation) ResetOrigin()

ResetOrigin resets all changes to the "origin" field.

func (*TShortUrlMutation) ResetShort

func (m *TShortUrlMutation) ResetShort()

ResetShort resets all changes to the "short" field.

func (*TShortUrlMutation) ResetUpdatedAt

func (m *TShortUrlMutation) ResetUpdatedAt()

ResetUpdatedAt resets all changes to the "updated_at" field.

func (*TShortUrlMutation) ResetVisit

func (m *TShortUrlMutation) ResetVisit()

ResetVisit resets all changes to the "visit" field.

func (*TShortUrlMutation) SetBizID

func (m *TShortUrlMutation) SetBizID(i int64)

SetBizID sets the "biz_id" field.

func (*TShortUrlMutation) SetCreatedAt

func (m *TShortUrlMutation) SetCreatedAt(i int64)

SetCreatedAt sets the "created_at" field.

func (*TShortUrlMutation) SetExpiredAt

func (m *TShortUrlMutation) SetExpiredAt(i int64)

SetExpiredAt sets the "expired_at" field.

func (*TShortUrlMutation) SetField

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

func (m *TShortUrlMutation) SetID(id int64)

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

func (*TShortUrlMutation) SetOp

func (m *TShortUrlMutation) SetOp(op Op)

SetOp allows setting the mutation operation.

func (*TShortUrlMutation) SetOrigin

func (m *TShortUrlMutation) SetOrigin(s string)

SetOrigin sets the "origin" field.

func (*TShortUrlMutation) SetShort

func (m *TShortUrlMutation) SetShort(i int64)

SetShort sets the "short" field.

func (*TShortUrlMutation) SetUpdatedAt

func (m *TShortUrlMutation) SetUpdatedAt(i int64)

SetUpdatedAt sets the "updated_at" field.

func (*TShortUrlMutation) SetVisit

func (m *TShortUrlMutation) SetVisit(i int64)

SetVisit sets the "visit" field.

func (*TShortUrlMutation) Short

func (m *TShortUrlMutation) Short() (r int64, exists bool)

Short returns the value of the "short" field in the mutation.

func (TShortUrlMutation) Tx

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

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

func (*TShortUrlMutation) Type

func (m *TShortUrlMutation) Type() string

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

func (*TShortUrlMutation) UpdatedAt

func (m *TShortUrlMutation) UpdatedAt() (r int64, exists bool)

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

func (*TShortUrlMutation) Visit

func (m *TShortUrlMutation) Visit() (r int64, exists bool)

Visit returns the value of the "visit" field in the mutation.

func (*TShortUrlMutation) Where

func (m *TShortUrlMutation) Where(ps ...predicate.TShortUrl)

Where appends a list predicates to the TShortUrlMutation builder.

func (*TShortUrlMutation) WhereP

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

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

type TShortUrlQuery

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

TShortUrlQuery is the builder for querying TShortUrl entities.

func (*TShortUrlQuery) Aggregate

func (tuq *TShortUrlQuery) Aggregate(fns ...AggregateFunc) *TShortUrlSelect

Aggregate returns a TShortUrlSelect configured with the given aggregations.

func (*TShortUrlQuery) All

func (tuq *TShortUrlQuery) All(ctx context.Context) ([]*TShortUrl, error)

All executes the query and returns a list of TShortUrls.

func (*TShortUrlQuery) AllX

func (tuq *TShortUrlQuery) AllX(ctx context.Context) []*TShortUrl

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

func (*TShortUrlQuery) Clone

func (tuq *TShortUrlQuery) Clone() *TShortUrlQuery

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

func (*TShortUrlQuery) Count

func (tuq *TShortUrlQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*TShortUrlQuery) CountX

func (tuq *TShortUrlQuery) CountX(ctx context.Context) int

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

func (*TShortUrlQuery) Exist

func (tuq *TShortUrlQuery) Exist(ctx context.Context) (bool, error)

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

func (*TShortUrlQuery) ExistX

func (tuq *TShortUrlQuery) ExistX(ctx context.Context) bool

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

func (*TShortUrlQuery) First

func (tuq *TShortUrlQuery) First(ctx context.Context) (*TShortUrl, error)

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

func (*TShortUrlQuery) FirstID

func (tuq *TShortUrlQuery) FirstID(ctx context.Context) (id int64, err error)

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

func (*TShortUrlQuery) FirstIDX

func (tuq *TShortUrlQuery) FirstIDX(ctx context.Context) int64

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

func (*TShortUrlQuery) FirstX

func (tuq *TShortUrlQuery) FirstX(ctx context.Context) *TShortUrl

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

func (*TShortUrlQuery) GroupBy

func (tuq *TShortUrlQuery) GroupBy(field string, fields ...string) *TShortUrlGroupBy

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 {
	BizID int64 `json:"biz_id,omitempty"`
	Count int `json:"count,omitempty"`
}

client.TShortUrl.Query().
	GroupBy(tshorturl.FieldBizID).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*TShortUrlQuery) IDs

func (tuq *TShortUrlQuery) IDs(ctx context.Context) (ids []int64, err error)

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

func (*TShortUrlQuery) IDsX

func (tuq *TShortUrlQuery) IDsX(ctx context.Context) []int64

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

func (*TShortUrlQuery) Limit

func (tuq *TShortUrlQuery) Limit(limit int) *TShortUrlQuery

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

func (*TShortUrlQuery) Modify

func (tuq *TShortUrlQuery) Modify(modifiers ...func(s *sql.Selector)) *TShortUrlSelect

Modify adds a query modifier for attaching custom logic to queries.

func (*TShortUrlQuery) Offset

func (tuq *TShortUrlQuery) Offset(offset int) *TShortUrlQuery

Offset to start from.

func (*TShortUrlQuery) Only

func (tuq *TShortUrlQuery) Only(ctx context.Context) (*TShortUrl, error)

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

func (*TShortUrlQuery) OnlyID

func (tuq *TShortUrlQuery) OnlyID(ctx context.Context) (id int64, err error)

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

func (*TShortUrlQuery) OnlyIDX

func (tuq *TShortUrlQuery) OnlyIDX(ctx context.Context) int64

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

func (*TShortUrlQuery) OnlyX

func (tuq *TShortUrlQuery) OnlyX(ctx context.Context) *TShortUrl

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

func (*TShortUrlQuery) Order

Order specifies how the records should be ordered.

func (*TShortUrlQuery) Select

func (tuq *TShortUrlQuery) Select(fields ...string) *TShortUrlSelect

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 {
	BizID int64 `json:"biz_id,omitempty"`
}

client.TShortUrl.Query().
	Select(tshorturl.FieldBizID).
	Scan(ctx, &v)

func (*TShortUrlQuery) Unique

func (tuq *TShortUrlQuery) Unique(unique bool) *TShortUrlQuery

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

func (tuq *TShortUrlQuery) Where(ps ...predicate.TShortUrl) *TShortUrlQuery

Where adds a new predicate for the TShortUrlQuery builder.

type TShortUrlSelect

type TShortUrlSelect struct {
	*TShortUrlQuery
	// contains filtered or unexported fields
}

TShortUrlSelect is the builder for selecting fields of TShortUrl entities.

func (*TShortUrlSelect) Aggregate

func (tus *TShortUrlSelect) Aggregate(fns ...AggregateFunc) *TShortUrlSelect

Aggregate adds the given aggregation functions to the selector query.

func (*TShortUrlSelect) Bool

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

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

func (*TShortUrlSelect) BoolX

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

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

func (*TShortUrlSelect) Bools

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

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

func (*TShortUrlSelect) BoolsX

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

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

func (*TShortUrlSelect) Float64

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

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

func (*TShortUrlSelect) Float64X

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

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

func (*TShortUrlSelect) Float64s

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

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

func (*TShortUrlSelect) Float64sX

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

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

func (*TShortUrlSelect) Int

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

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

func (*TShortUrlSelect) IntX

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

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

func (*TShortUrlSelect) Ints

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

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

func (*TShortUrlSelect) IntsX

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

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

func (*TShortUrlSelect) Modify

func (tus *TShortUrlSelect) Modify(modifiers ...func(s *sql.Selector)) *TShortUrlSelect

Modify adds a query modifier for attaching custom logic to queries.

func (*TShortUrlSelect) Scan

func (tus *TShortUrlSelect) Scan(ctx context.Context, v any) error

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

func (*TShortUrlSelect) ScanX

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

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

func (*TShortUrlSelect) String

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

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

func (*TShortUrlSelect) StringX

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

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

func (*TShortUrlSelect) Strings

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

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

func (*TShortUrlSelect) StringsX

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

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

type TShortUrlUpdate

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

TShortUrlUpdate is the builder for updating TShortUrl entities.

func (*TShortUrlUpdate) AddBizID

func (tuu *TShortUrlUpdate) AddBizID(i int64) *TShortUrlUpdate

AddBizID adds i to the "biz_id" field.

func (*TShortUrlUpdate) AddExpiredAt

func (tuu *TShortUrlUpdate) AddExpiredAt(i int64) *TShortUrlUpdate

AddExpiredAt adds i to the "expired_at" field.

func (*TShortUrlUpdate) AddUpdatedAt

func (tuu *TShortUrlUpdate) AddUpdatedAt(i int64) *TShortUrlUpdate

AddUpdatedAt adds i to the "updated_at" field.

func (*TShortUrlUpdate) AddVisit

func (tuu *TShortUrlUpdate) AddVisit(i int64) *TShortUrlUpdate

AddVisit adds i to the "visit" field.

func (*TShortUrlUpdate) Exec

func (tuu *TShortUrlUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*TShortUrlUpdate) ExecX

func (tuu *TShortUrlUpdate) ExecX(ctx context.Context)

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

func (*TShortUrlUpdate) Modify

func (tuu *TShortUrlUpdate) Modify(modifiers ...func(u *sql.UpdateBuilder)) *TShortUrlUpdate

Modify adds a statement modifier for attaching custom logic to the UPDATE statement.

func (*TShortUrlUpdate) Mutation

func (tuu *TShortUrlUpdate) Mutation() *TShortUrlMutation

Mutation returns the TShortUrlMutation object of the builder.

func (*TShortUrlUpdate) Save

func (tuu *TShortUrlUpdate) Save(ctx context.Context) (int, error)

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

func (*TShortUrlUpdate) SaveX

func (tuu *TShortUrlUpdate) SaveX(ctx context.Context) int

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

func (*TShortUrlUpdate) SetBizID

func (tuu *TShortUrlUpdate) SetBizID(i int64) *TShortUrlUpdate

SetBizID sets the "biz_id" field.

func (*TShortUrlUpdate) SetExpiredAt

func (tuu *TShortUrlUpdate) SetExpiredAt(i int64) *TShortUrlUpdate

SetExpiredAt sets the "expired_at" field.

func (*TShortUrlUpdate) SetNillableBizID

func (tuu *TShortUrlUpdate) SetNillableBizID(i *int64) *TShortUrlUpdate

SetNillableBizID sets the "biz_id" field if the given value is not nil.

func (*TShortUrlUpdate) SetNillableExpiredAt

func (tuu *TShortUrlUpdate) SetNillableExpiredAt(i *int64) *TShortUrlUpdate

SetNillableExpiredAt sets the "expired_at" field if the given value is not nil.

func (*TShortUrlUpdate) SetNillableOrigin

func (tuu *TShortUrlUpdate) SetNillableOrigin(s *string) *TShortUrlUpdate

SetNillableOrigin sets the "origin" field if the given value is not nil.

func (*TShortUrlUpdate) SetNillableUpdatedAt

func (tuu *TShortUrlUpdate) SetNillableUpdatedAt(i *int64) *TShortUrlUpdate

SetNillableUpdatedAt sets the "updated_at" field if the given value is not nil.

func (*TShortUrlUpdate) SetNillableVisit

func (tuu *TShortUrlUpdate) SetNillableVisit(i *int64) *TShortUrlUpdate

SetNillableVisit sets the "visit" field if the given value is not nil.

func (*TShortUrlUpdate) SetOrigin

func (tuu *TShortUrlUpdate) SetOrigin(s string) *TShortUrlUpdate

SetOrigin sets the "origin" field.

func (*TShortUrlUpdate) SetUpdatedAt

func (tuu *TShortUrlUpdate) SetUpdatedAt(i int64) *TShortUrlUpdate

SetUpdatedAt sets the "updated_at" field.

func (*TShortUrlUpdate) SetVisit

func (tuu *TShortUrlUpdate) SetVisit(i int64) *TShortUrlUpdate

SetVisit sets the "visit" field.

func (*TShortUrlUpdate) Where

Where appends a list predicates to the TShortUrlUpdate builder.

type TShortUrlUpdateOne

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

TShortUrlUpdateOne is the builder for updating a single TShortUrl entity.

func (*TShortUrlUpdateOne) AddBizID

func (tuuo *TShortUrlUpdateOne) AddBizID(i int64) *TShortUrlUpdateOne

AddBizID adds i to the "biz_id" field.

func (*TShortUrlUpdateOne) AddExpiredAt

func (tuuo *TShortUrlUpdateOne) AddExpiredAt(i int64) *TShortUrlUpdateOne

AddExpiredAt adds i to the "expired_at" field.

func (*TShortUrlUpdateOne) AddUpdatedAt

func (tuuo *TShortUrlUpdateOne) AddUpdatedAt(i int64) *TShortUrlUpdateOne

AddUpdatedAt adds i to the "updated_at" field.

func (*TShortUrlUpdateOne) AddVisit

func (tuuo *TShortUrlUpdateOne) AddVisit(i int64) *TShortUrlUpdateOne

AddVisit adds i to the "visit" field.

func (*TShortUrlUpdateOne) Exec

func (tuuo *TShortUrlUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*TShortUrlUpdateOne) ExecX

func (tuuo *TShortUrlUpdateOne) ExecX(ctx context.Context)

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

func (*TShortUrlUpdateOne) Modify

func (tuuo *TShortUrlUpdateOne) Modify(modifiers ...func(u *sql.UpdateBuilder)) *TShortUrlUpdateOne

Modify adds a statement modifier for attaching custom logic to the UPDATE statement.

func (*TShortUrlUpdateOne) Mutation

func (tuuo *TShortUrlUpdateOne) Mutation() *TShortUrlMutation

Mutation returns the TShortUrlMutation object of the builder.

func (*TShortUrlUpdateOne) Save

func (tuuo *TShortUrlUpdateOne) Save(ctx context.Context) (*TShortUrl, error)

Save executes the query and returns the updated TShortUrl entity.

func (*TShortUrlUpdateOne) SaveX

func (tuuo *TShortUrlUpdateOne) SaveX(ctx context.Context) *TShortUrl

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

func (*TShortUrlUpdateOne) Select

func (tuuo *TShortUrlUpdateOne) Select(field string, fields ...string) *TShortUrlUpdateOne

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

func (*TShortUrlUpdateOne) SetBizID

func (tuuo *TShortUrlUpdateOne) SetBizID(i int64) *TShortUrlUpdateOne

SetBizID sets the "biz_id" field.

func (*TShortUrlUpdateOne) SetExpiredAt

func (tuuo *TShortUrlUpdateOne) SetExpiredAt(i int64) *TShortUrlUpdateOne

SetExpiredAt sets the "expired_at" field.

func (*TShortUrlUpdateOne) SetNillableBizID

func (tuuo *TShortUrlUpdateOne) SetNillableBizID(i *int64) *TShortUrlUpdateOne

SetNillableBizID sets the "biz_id" field if the given value is not nil.

func (*TShortUrlUpdateOne) SetNillableExpiredAt

func (tuuo *TShortUrlUpdateOne) SetNillableExpiredAt(i *int64) *TShortUrlUpdateOne

SetNillableExpiredAt sets the "expired_at" field if the given value is not nil.

func (*TShortUrlUpdateOne) SetNillableOrigin

func (tuuo *TShortUrlUpdateOne) SetNillableOrigin(s *string) *TShortUrlUpdateOne

SetNillableOrigin sets the "origin" field if the given value is not nil.

func (*TShortUrlUpdateOne) SetNillableUpdatedAt

func (tuuo *TShortUrlUpdateOne) SetNillableUpdatedAt(i *int64) *TShortUrlUpdateOne

SetNillableUpdatedAt sets the "updated_at" field if the given value is not nil.

func (*TShortUrlUpdateOne) SetNillableVisit

func (tuuo *TShortUrlUpdateOne) SetNillableVisit(i *int64) *TShortUrlUpdateOne

SetNillableVisit sets the "visit" field if the given value is not nil.

func (*TShortUrlUpdateOne) SetOrigin

func (tuuo *TShortUrlUpdateOne) SetOrigin(s string) *TShortUrlUpdateOne

SetOrigin sets the "origin" field.

func (*TShortUrlUpdateOne) SetUpdatedAt

func (tuuo *TShortUrlUpdateOne) SetUpdatedAt(i int64) *TShortUrlUpdateOne

SetUpdatedAt sets the "updated_at" field.

func (*TShortUrlUpdateOne) SetVisit

func (tuuo *TShortUrlUpdateOne) SetVisit(i int64) *TShortUrlUpdateOne

SetVisit sets the "visit" field.

func (*TShortUrlUpdateOne) Where

Where appends a list predicates to the TShortUrlUpdate builder.

type TShortUrls

type TShortUrls []*TShortUrl

TShortUrls is a parsable slice of TShortUrl.

type TraverseFunc

type TraverseFunc = ent.TraverseFunc

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

type Traverser

type Traverser = ent.Traverser

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

type Tx

type Tx struct {

	// TLeaf is the client for interacting with the TLeaf builders.
	TLeaf *TLeafClient
	// TShortUrl is the client for interacting with the TShortUrl builders.
	TShortUrl *TShortUrlClient
	// 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