ent

package
v0.0.0-...-54b0228 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2022 License: GPL-3.0 Imports: 21 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.
	TypeRuleChan = "RuleChan"
	TypeRuleNode = "RuleNode"
	TypeSession  = "Session"
)

Variables

This section is empty.

Functions

func IsConstraintError

func IsConstraintError(err error) bool

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

func IsNotFound

func IsNotFound(err error) bool

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

func IsNotLoaded

func IsNotLoaded(err error) bool

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

func IsNotSingular

func IsNotSingular(err error) bool

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

func IsValidationError

func IsValidationError(err error) bool

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

func MaskNotFound

func MaskNotFound(err error) error

MaskNotFound masks not found error.

func NewContext

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

NewContext returns a new context with the given Client attached.

func NewTxContext

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

NewTxContext returns a new context with the given Tx attached.

Types

type AggregateFunc

type AggregateFunc func(*sql.Selector) string

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

func As

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

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

func Count

func Count() AggregateFunc

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

func Max

func Max(field string) AggregateFunc

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

func Mean

func Mean(field string) AggregateFunc

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

func Min

func Min(field string) AggregateFunc

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

func Sum

func Sum(field string) AggregateFunc

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

type Client

type Client struct {

	// Schema is the client for creating, migrating and dropping schema.
	Schema *migrate.Schema
	// RuleChan is the client for interacting with the RuleChan builders.
	RuleChan *RuleChanClient
	// RuleNode is the client for interacting with the RuleNode builders.
	RuleNode *RuleNodeClient
	// Session is the client for interacting with the Session builders.
	Session *SessionClient
	// 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().
	RuleChan.
	Query().
	Count(ctx)

func (*Client) Tx

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

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

func (*Client) Use

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

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

type CommitFunc

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

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

func (CommitFunc) Commit

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

Commit calls f(ctx, m).

type CommitHook

type CommitHook func(Committer) Committer

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

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

type Committer

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

Committer is the interface that wraps the Commit method.

type ConstraintError

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

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

func (ConstraintError) Error

func (e ConstraintError) Error() string

Error implements the error interface.

func (*ConstraintError) Unwrap

func (e *ConstraintError) Unwrap() error

Unwrap implements the errors.Wrapper interface.

type Hook

type Hook = ent.Hook

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

type MutateFunc

type MutateFunc = ent.MutateFunc

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

type Mutation

type Mutation = ent.Mutation

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

type Mutator

type Mutator = ent.Mutator

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

type NotFoundError

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

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

func (*NotFoundError) Error

func (e *NotFoundError) Error() string

Error implements the error interface.

type NotLoadedError

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

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

func (*NotLoadedError) Error

func (e *NotLoadedError) Error() string

Error implements the error interface.

type NotSingularError

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

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

func (*NotSingularError) Error

func (e *NotSingularError) Error() string

Error implements the error interface.

type Op

type Op = ent.Op

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

type Option

type Option func(*config)

Option function to configure the client.

func Debug

func Debug() Option

Debug enables debug logging on the ent.Driver.

func Driver

func Driver(driver dialect.Driver) Option

Driver configures the client driver.

func Log

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

Log sets the logging function for debug mode.

type OrderFunc

type OrderFunc func(*sql.Selector)

OrderFunc applies an ordering on the sql selector.

func Asc

func Asc(fields ...string) OrderFunc

Asc applies the given fields in ASC order.

func Desc

func Desc(fields ...string) OrderFunc

Desc applies the given fields in DESC order.

type Policy

type Policy = ent.Policy

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

type Query

type Query = ent.Query

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

type RollbackFunc

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

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

func (RollbackFunc) Rollback

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

Rollback calls f(ctx, m).

type RollbackHook

type RollbackHook func(Rollbacker) Rollbacker

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

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

type Rollbacker

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

Rollbacker is the interface that wraps the Rollback method.

type RuleChan

type RuleChan struct {

	// ID of the ent.
	ID uint64 `json:"id,omitempty"`
	// Name holds the value of the "name" field.
	Name string `json:"name,omitempty"`
	// Description holds the value of the "description" field.
	Description *string `json:"description,omitempty"`
	// RootNode holds the value of the "root_node" field.
	RootNode string `json:"root_node,omitempty"`
	// Infinite holds the value of the "infinite" field.
	Infinite bool `json:"infinite,omitempty"`
	// Status holds the value of the "status" field.
	Status rulechan.Status `json:"status,omitempty"`
	// CreatedAt holds the value of the "created_at" field.
	CreatedAt time.Time `json:"created_at,omitempty"`
	// UpdatedAt holds the value of the "updated_at" field.
	UpdatedAt time.Time `json:"updated_at,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the RuleChanQuery when eager-loading is set.
	Edges RuleChanEdges `json:"edges"`
	// contains filtered or unexported fields
}

RuleChan is the model entity for the RuleChan schema.

func (*RuleChan) QueryRules

func (rc *RuleChan) QueryRules() *RuleNodeQuery

QueryRules queries the "rules" edge of the RuleChan entity.

func (*RuleChan) QuerySessions

func (rc *RuleChan) QuerySessions() *SessionQuery

QuerySessions queries the "sessions" edge of the RuleChan entity.

func (*RuleChan) String

func (rc *RuleChan) String() string

String implements the fmt.Stringer.

func (*RuleChan) Unwrap

func (rc *RuleChan) Unwrap() *RuleChan

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

func (rc *RuleChan) Update() *RuleChanUpdateOne

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

type RuleChanClient

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

RuleChanClient is a client for the RuleChan schema.

func NewRuleChanClient

func NewRuleChanClient(c config) *RuleChanClient

NewRuleChanClient returns a client for the RuleChan from the given config.

func (*RuleChanClient) Create

func (c *RuleChanClient) Create() *RuleChanCreate

Create returns a builder for creating a RuleChan entity.

func (*RuleChanClient) CreateBulk

func (c *RuleChanClient) CreateBulk(builders ...*RuleChanCreate) *RuleChanCreateBulk

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

func (*RuleChanClient) Delete

func (c *RuleChanClient) Delete() *RuleChanDelete

Delete returns a delete builder for RuleChan.

func (*RuleChanClient) DeleteOne

func (c *RuleChanClient) DeleteOne(rc *RuleChan) *RuleChanDeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*RuleChanClient) DeleteOneID

func (c *RuleChanClient) DeleteOneID(id uint64) *RuleChanDeleteOne

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

func (*RuleChanClient) Get

func (c *RuleChanClient) Get(ctx context.Context, id uint64) (*RuleChan, error)

Get returns a RuleChan entity by its id.

func (*RuleChanClient) GetX

func (c *RuleChanClient) GetX(ctx context.Context, id uint64) *RuleChan

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

func (*RuleChanClient) Hooks

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

Hooks returns the client hooks.

func (*RuleChanClient) Query

func (c *RuleChanClient) Query() *RuleChanQuery

Query returns a query builder for RuleChan.

func (*RuleChanClient) QueryRules

func (c *RuleChanClient) QueryRules(rc *RuleChan) *RuleNodeQuery

QueryRules queries the rules edge of a RuleChan.

func (*RuleChanClient) QuerySessions

func (c *RuleChanClient) QuerySessions(rc *RuleChan) *SessionQuery

QuerySessions queries the sessions edge of a RuleChan.

func (*RuleChanClient) Update

func (c *RuleChanClient) Update() *RuleChanUpdate

Update returns an update builder for RuleChan.

func (*RuleChanClient) UpdateOne

func (c *RuleChanClient) UpdateOne(rc *RuleChan) *RuleChanUpdateOne

UpdateOne returns an update builder for the given entity.

func (*RuleChanClient) UpdateOneID

func (c *RuleChanClient) UpdateOneID(id uint64) *RuleChanUpdateOne

UpdateOneID returns an update builder for the given id.

func (*RuleChanClient) Use

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

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

type RuleChanCreate

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

RuleChanCreate is the builder for creating a RuleChan entity.

func (*RuleChanCreate) AddRuleIDs

func (rcc *RuleChanCreate) AddRuleIDs(ids ...uint64) *RuleChanCreate

AddRuleIDs adds the "rules" edge to the RuleNode entity by IDs.

func (*RuleChanCreate) AddRules

func (rcc *RuleChanCreate) AddRules(r ...*RuleNode) *RuleChanCreate

AddRules adds the "rules" edges to the RuleNode entity.

func (*RuleChanCreate) AddSessionIDs

func (rcc *RuleChanCreate) AddSessionIDs(ids ...uint64) *RuleChanCreate

AddSessionIDs adds the "sessions" edge to the Session entity by IDs.

func (*RuleChanCreate) AddSessions

func (rcc *RuleChanCreate) AddSessions(s ...*Session) *RuleChanCreate

AddSessions adds the "sessions" edges to the Session entity.

func (*RuleChanCreate) Exec

func (rcc *RuleChanCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*RuleChanCreate) ExecX

func (rcc *RuleChanCreate) ExecX(ctx context.Context)

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

func (*RuleChanCreate) Mutation

func (rcc *RuleChanCreate) Mutation() *RuleChanMutation

Mutation returns the RuleChanMutation object of the builder.

func (*RuleChanCreate) Save

func (rcc *RuleChanCreate) Save(ctx context.Context) (*RuleChan, error)

Save creates the RuleChan in the database.

func (*RuleChanCreate) SaveX

func (rcc *RuleChanCreate) SaveX(ctx context.Context) *RuleChan

SaveX calls Save and panics if Save returns an error.

func (*RuleChanCreate) SetCreatedAt

func (rcc *RuleChanCreate) SetCreatedAt(t time.Time) *RuleChanCreate

SetCreatedAt sets the "created_at" field.

func (*RuleChanCreate) SetDescription

func (rcc *RuleChanCreate) SetDescription(s string) *RuleChanCreate

SetDescription sets the "description" field.

func (*RuleChanCreate) SetID

func (rcc *RuleChanCreate) SetID(u uint64) *RuleChanCreate

SetID sets the "id" field.

func (*RuleChanCreate) SetInfinite

func (rcc *RuleChanCreate) SetInfinite(b bool) *RuleChanCreate

SetInfinite sets the "infinite" field.

func (*RuleChanCreate) SetName

func (rcc *RuleChanCreate) SetName(s string) *RuleChanCreate

SetName sets the "name" field.

func (*RuleChanCreate) SetNillableCreatedAt

func (rcc *RuleChanCreate) SetNillableCreatedAt(t *time.Time) *RuleChanCreate

SetNillableCreatedAt sets the "created_at" field if the given value is not nil.

func (*RuleChanCreate) SetNillableInfinite

func (rcc *RuleChanCreate) SetNillableInfinite(b *bool) *RuleChanCreate

SetNillableInfinite sets the "infinite" field if the given value is not nil.

func (*RuleChanCreate) SetNillableUpdatedAt

func (rcc *RuleChanCreate) SetNillableUpdatedAt(t *time.Time) *RuleChanCreate

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

func (*RuleChanCreate) SetRootNode

func (rcc *RuleChanCreate) SetRootNode(s string) *RuleChanCreate

SetRootNode sets the "root_node" field.

func (*RuleChanCreate) SetStatus

func (rcc *RuleChanCreate) SetStatus(r rulechan.Status) *RuleChanCreate

SetStatus sets the "status" field.

func (*RuleChanCreate) SetUpdatedAt

func (rcc *RuleChanCreate) SetUpdatedAt(t time.Time) *RuleChanCreate

SetUpdatedAt sets the "updated_at" field.

type RuleChanCreateBulk

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

RuleChanCreateBulk is the builder for creating many RuleChan entities in bulk.

func (*RuleChanCreateBulk) Exec

func (rccb *RuleChanCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*RuleChanCreateBulk) ExecX

func (rccb *RuleChanCreateBulk) ExecX(ctx context.Context)

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

func (*RuleChanCreateBulk) Save

func (rccb *RuleChanCreateBulk) Save(ctx context.Context) ([]*RuleChan, error)

Save creates the RuleChan entities in the database.

func (*RuleChanCreateBulk) SaveX

func (rccb *RuleChanCreateBulk) SaveX(ctx context.Context) []*RuleChan

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

type RuleChanDelete

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

RuleChanDelete is the builder for deleting a RuleChan entity.

func (*RuleChanDelete) Exec

func (rcd *RuleChanDelete) Exec(ctx context.Context) (int, error)

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

func (*RuleChanDelete) ExecX

func (rcd *RuleChanDelete) ExecX(ctx context.Context) int

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

func (*RuleChanDelete) Where

func (rcd *RuleChanDelete) Where(ps ...predicate.RuleChan) *RuleChanDelete

Where appends a list predicates to the RuleChanDelete builder.

type RuleChanDeleteOne

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

RuleChanDeleteOne is the builder for deleting a single RuleChan entity.

func (*RuleChanDeleteOne) Exec

func (rcdo *RuleChanDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*RuleChanDeleteOne) ExecX

func (rcdo *RuleChanDeleteOne) ExecX(ctx context.Context)

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

type RuleChanEdges

type RuleChanEdges struct {
	// Rules holds the value of the rules edge.
	Rules []*RuleNode `json:"rules,omitempty"`
	// Sessions holds the value of the sessions edge.
	Sessions []*Session `json:"sessions,omitempty"`
	// contains filtered or unexported fields
}

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

func (RuleChanEdges) RulesOrErr

func (e RuleChanEdges) RulesOrErr() ([]*RuleNode, error)

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

func (RuleChanEdges) SessionsOrErr

func (e RuleChanEdges) SessionsOrErr() ([]*Session, error)

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

type RuleChanGroupBy

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

RuleChanGroupBy is the group-by builder for RuleChan entities.

func (*RuleChanGroupBy) Aggregate

func (rcgb *RuleChanGroupBy) Aggregate(fns ...AggregateFunc) *RuleChanGroupBy

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

func (*RuleChanGroupBy) Bool

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

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

func (*RuleChanGroupBy) BoolX

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

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

func (*RuleChanGroupBy) Bools

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

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

func (*RuleChanGroupBy) BoolsX

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

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

func (*RuleChanGroupBy) Float64

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

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

func (*RuleChanGroupBy) Float64X

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

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

func (*RuleChanGroupBy) Float64s

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

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

func (*RuleChanGroupBy) Float64sX

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

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

func (*RuleChanGroupBy) Int

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

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

func (*RuleChanGroupBy) IntX

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

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

func (*RuleChanGroupBy) Ints

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

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

func (*RuleChanGroupBy) IntsX

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

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

func (*RuleChanGroupBy) Scan

func (rcgb *RuleChanGroupBy) Scan(ctx context.Context, v any) error

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

func (*RuleChanGroupBy) ScanX

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

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

func (*RuleChanGroupBy) String

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

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

func (*RuleChanGroupBy) StringX

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

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

func (*RuleChanGroupBy) Strings

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

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

func (*RuleChanGroupBy) StringsX

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

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

type RuleChanMutation

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

RuleChanMutation represents an operation that mutates the RuleChan nodes in the graph.

func (*RuleChanMutation) AddField

func (m *RuleChanMutation) 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 (*RuleChanMutation) AddRuleIDs

func (m *RuleChanMutation) AddRuleIDs(ids ...uint64)

AddRuleIDs adds the "rules" edge to the RuleNode entity by ids.

func (*RuleChanMutation) AddSessionIDs

func (m *RuleChanMutation) AddSessionIDs(ids ...uint64)

AddSessionIDs adds the "sessions" edge to the Session entity by ids.

func (*RuleChanMutation) AddedEdges

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

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

func (*RuleChanMutation) AddedField

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

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

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

func (*RuleChanMutation) AddedIDs

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

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

func (*RuleChanMutation) ClearEdge

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

func (m *RuleChanMutation) 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 (*RuleChanMutation) ClearRules

func (m *RuleChanMutation) ClearRules()

ClearRules clears the "rules" edge to the RuleNode entity.

func (*RuleChanMutation) ClearSessions

func (m *RuleChanMutation) ClearSessions()

ClearSessions clears the "sessions" edge to the Session entity.

func (*RuleChanMutation) ClearedEdges

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

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

func (*RuleChanMutation) ClearedFields

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

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

func (RuleChanMutation) Client

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

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

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

func (*RuleChanMutation) Description

func (m *RuleChanMutation) Description() (r string, exists bool)

Description returns the value of the "description" field in the mutation.

func (*RuleChanMutation) EdgeCleared

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

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

func (*RuleChanMutation) Field

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

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

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

func (*RuleChanMutation) Fields

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

func (m *RuleChanMutation) ID() (id uint64, 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 (*RuleChanMutation) IDs

func (m *RuleChanMutation) IDs(ctx context.Context) ([]uint64, 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 (*RuleChanMutation) Infinite

func (m *RuleChanMutation) Infinite() (r bool, exists bool)

Infinite returns the value of the "infinite" field in the mutation.

func (*RuleChanMutation) Name

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

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

func (*RuleChanMutation) OldCreatedAt

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

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

func (m *RuleChanMutation) OldDescription(ctx context.Context) (v *string, err error)

OldDescription returns the old "description" field's value of the RuleChan entity. If the RuleChan 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 (*RuleChanMutation) OldField

func (m *RuleChanMutation) 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 (*RuleChanMutation) OldInfinite

func (m *RuleChanMutation) OldInfinite(ctx context.Context) (v bool, err error)

OldInfinite returns the old "infinite" field's value of the RuleChan entity. If the RuleChan 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 (*RuleChanMutation) OldName

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

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

func (m *RuleChanMutation) OldRootNode(ctx context.Context) (v string, err error)

OldRootNode returns the old "root_node" field's value of the RuleChan entity. If the RuleChan 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 (*RuleChanMutation) OldStatus

func (m *RuleChanMutation) OldStatus(ctx context.Context) (v rulechan.Status, err error)

OldStatus returns the old "status" field's value of the RuleChan entity. If the RuleChan 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 (*RuleChanMutation) OldUpdatedAt

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

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

func (m *RuleChanMutation) Op() Op

Op returns the operation name.

func (*RuleChanMutation) RemoveRuleIDs

func (m *RuleChanMutation) RemoveRuleIDs(ids ...uint64)

RemoveRuleIDs removes the "rules" edge to the RuleNode entity by IDs.

func (*RuleChanMutation) RemoveSessionIDs

func (m *RuleChanMutation) RemoveSessionIDs(ids ...uint64)

RemoveSessionIDs removes the "sessions" edge to the Session entity by IDs.

func (*RuleChanMutation) RemovedEdges

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

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

func (*RuleChanMutation) RemovedIDs

func (m *RuleChanMutation) 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 (*RuleChanMutation) RemovedRulesIDs

func (m *RuleChanMutation) RemovedRulesIDs() (ids []uint64)

RemovedRules returns the removed IDs of the "rules" edge to the RuleNode entity.

func (*RuleChanMutation) RemovedSessionsIDs

func (m *RuleChanMutation) RemovedSessionsIDs() (ids []uint64)

RemovedSessions returns the removed IDs of the "sessions" edge to the Session entity.

func (*RuleChanMutation) ResetCreatedAt

func (m *RuleChanMutation) ResetCreatedAt()

ResetCreatedAt resets all changes to the "created_at" field.

func (*RuleChanMutation) ResetDescription

func (m *RuleChanMutation) ResetDescription()

ResetDescription resets all changes to the "description" field.

func (*RuleChanMutation) ResetEdge

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

func (m *RuleChanMutation) 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 (*RuleChanMutation) ResetInfinite

func (m *RuleChanMutation) ResetInfinite()

ResetInfinite resets all changes to the "infinite" field.

func (*RuleChanMutation) ResetName

func (m *RuleChanMutation) ResetName()

ResetName resets all changes to the "name" field.

func (*RuleChanMutation) ResetRootNode

func (m *RuleChanMutation) ResetRootNode()

ResetRootNode resets all changes to the "root_node" field.

func (*RuleChanMutation) ResetRules

func (m *RuleChanMutation) ResetRules()

ResetRules resets all changes to the "rules" edge.

func (*RuleChanMutation) ResetSessions

func (m *RuleChanMutation) ResetSessions()

ResetSessions resets all changes to the "sessions" edge.

func (*RuleChanMutation) ResetStatus

func (m *RuleChanMutation) ResetStatus()

ResetStatus resets all changes to the "status" field.

func (*RuleChanMutation) ResetUpdatedAt

func (m *RuleChanMutation) ResetUpdatedAt()

ResetUpdatedAt resets all changes to the "updated_at" field.

func (*RuleChanMutation) RootNode

func (m *RuleChanMutation) RootNode() (r string, exists bool)

RootNode returns the value of the "root_node" field in the mutation.

func (*RuleChanMutation) RulesCleared

func (m *RuleChanMutation) RulesCleared() bool

RulesCleared reports if the "rules" edge to the RuleNode entity was cleared.

func (*RuleChanMutation) RulesIDs

func (m *RuleChanMutation) RulesIDs() (ids []uint64)

RulesIDs returns the "rules" edge IDs in the mutation.

func (*RuleChanMutation) SessionsCleared

func (m *RuleChanMutation) SessionsCleared() bool

SessionsCleared reports if the "sessions" edge to the Session entity was cleared.

func (*RuleChanMutation) SessionsIDs

func (m *RuleChanMutation) SessionsIDs() (ids []uint64)

SessionsIDs returns the "sessions" edge IDs in the mutation.

func (*RuleChanMutation) SetCreatedAt

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

SetCreatedAt sets the "created_at" field.

func (*RuleChanMutation) SetDescription

func (m *RuleChanMutation) SetDescription(s string)

SetDescription sets the "description" field.

func (*RuleChanMutation) SetField

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

func (m *RuleChanMutation) SetID(id uint64)

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

func (*RuleChanMutation) SetInfinite

func (m *RuleChanMutation) SetInfinite(b bool)

SetInfinite sets the "infinite" field.

func (*RuleChanMutation) SetName

func (m *RuleChanMutation) SetName(s string)

SetName sets the "name" field.

func (*RuleChanMutation) SetRootNode

func (m *RuleChanMutation) SetRootNode(s string)

SetRootNode sets the "root_node" field.

func (*RuleChanMutation) SetStatus

func (m *RuleChanMutation) SetStatus(r rulechan.Status)

SetStatus sets the "status" field.

func (*RuleChanMutation) SetUpdatedAt

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

SetUpdatedAt sets the "updated_at" field.

func (*RuleChanMutation) Status

func (m *RuleChanMutation) Status() (r rulechan.Status, exists bool)

Status returns the value of the "status" field in the mutation.

func (RuleChanMutation) Tx

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

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

func (*RuleChanMutation) Type

func (m *RuleChanMutation) Type() string

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

func (*RuleChanMutation) UpdatedAt

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

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

func (*RuleChanMutation) Where

func (m *RuleChanMutation) Where(ps ...predicate.RuleChan)

Where appends a list predicates to the RuleChanMutation builder.

type RuleChanQuery

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

RuleChanQuery is the builder for querying RuleChan entities.

func (*RuleChanQuery) All

func (rcq *RuleChanQuery) All(ctx context.Context) ([]*RuleChan, error)

All executes the query and returns a list of RuleChans.

func (*RuleChanQuery) AllX

func (rcq *RuleChanQuery) AllX(ctx context.Context) []*RuleChan

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

func (*RuleChanQuery) Clone

func (rcq *RuleChanQuery) Clone() *RuleChanQuery

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

func (*RuleChanQuery) Count

func (rcq *RuleChanQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*RuleChanQuery) CountX

func (rcq *RuleChanQuery) CountX(ctx context.Context) int

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

func (*RuleChanQuery) Exist

func (rcq *RuleChanQuery) Exist(ctx context.Context) (bool, error)

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

func (*RuleChanQuery) ExistX

func (rcq *RuleChanQuery) ExistX(ctx context.Context) bool

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

func (*RuleChanQuery) First

func (rcq *RuleChanQuery) First(ctx context.Context) (*RuleChan, error)

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

func (*RuleChanQuery) FirstID

func (rcq *RuleChanQuery) FirstID(ctx context.Context) (id uint64, err error)

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

func (*RuleChanQuery) FirstIDX

func (rcq *RuleChanQuery) FirstIDX(ctx context.Context) uint64

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

func (*RuleChanQuery) FirstX

func (rcq *RuleChanQuery) FirstX(ctx context.Context) *RuleChan

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

func (*RuleChanQuery) GroupBy

func (rcq *RuleChanQuery) GroupBy(field string, fields ...string) *RuleChanGroupBy

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

Example:

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

client.RuleChan.Query().
	GroupBy(rulechan.FieldName).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*RuleChanQuery) IDs

func (rcq *RuleChanQuery) IDs(ctx context.Context) ([]uint64, error)

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

func (*RuleChanQuery) IDsX

func (rcq *RuleChanQuery) IDsX(ctx context.Context) []uint64

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

func (*RuleChanQuery) Limit

func (rcq *RuleChanQuery) Limit(limit int) *RuleChanQuery

Limit adds a limit step to the query.

func (*RuleChanQuery) Offset

func (rcq *RuleChanQuery) Offset(offset int) *RuleChanQuery

Offset adds an offset step to the query.

func (*RuleChanQuery) Only

func (rcq *RuleChanQuery) Only(ctx context.Context) (*RuleChan, error)

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

func (*RuleChanQuery) OnlyID

func (rcq *RuleChanQuery) OnlyID(ctx context.Context) (id uint64, err error)

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

func (*RuleChanQuery) OnlyIDX

func (rcq *RuleChanQuery) OnlyIDX(ctx context.Context) uint64

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

func (*RuleChanQuery) OnlyX

func (rcq *RuleChanQuery) OnlyX(ctx context.Context) *RuleChan

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

func (*RuleChanQuery) Order

func (rcq *RuleChanQuery) Order(o ...OrderFunc) *RuleChanQuery

Order adds an order step to the query.

func (*RuleChanQuery) QueryRules

func (rcq *RuleChanQuery) QueryRules() *RuleNodeQuery

QueryRules chains the current query on the "rules" edge.

func (*RuleChanQuery) QuerySessions

func (rcq *RuleChanQuery) QuerySessions() *SessionQuery

QuerySessions chains the current query on the "sessions" edge.

func (*RuleChanQuery) Select

func (rcq *RuleChanQuery) Select(fields ...string) *RuleChanSelect

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

Example:

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

client.RuleChan.Query().
	Select(rulechan.FieldName).
	Scan(ctx, &v)

func (*RuleChanQuery) Unique

func (rcq *RuleChanQuery) Unique(unique bool) *RuleChanQuery

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

func (rcq *RuleChanQuery) Where(ps ...predicate.RuleChan) *RuleChanQuery

Where adds a new predicate for the RuleChanQuery builder.

func (*RuleChanQuery) WithRules

func (rcq *RuleChanQuery) WithRules(opts ...func(*RuleNodeQuery)) *RuleChanQuery

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

func (*RuleChanQuery) WithSessions

func (rcq *RuleChanQuery) WithSessions(opts ...func(*SessionQuery)) *RuleChanQuery

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

type RuleChanSelect

type RuleChanSelect struct {
	*RuleChanQuery
	// contains filtered or unexported fields
}

RuleChanSelect is the builder for selecting fields of RuleChan entities.

func (*RuleChanSelect) Bool

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

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

func (*RuleChanSelect) BoolX

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

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

func (*RuleChanSelect) Bools

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

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

func (*RuleChanSelect) BoolsX

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

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

func (*RuleChanSelect) Float64

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

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

func (*RuleChanSelect) Float64X

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

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

func (*RuleChanSelect) Float64s

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

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

func (*RuleChanSelect) Float64sX

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

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

func (*RuleChanSelect) Int

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

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

func (*RuleChanSelect) IntX

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

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

func (*RuleChanSelect) Ints

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

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

func (*RuleChanSelect) IntsX

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

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

func (*RuleChanSelect) Scan

func (rcs *RuleChanSelect) Scan(ctx context.Context, v any) error

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

func (*RuleChanSelect) ScanX

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

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

func (*RuleChanSelect) String

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

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

func (*RuleChanSelect) StringX

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

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

func (*RuleChanSelect) Strings

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

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

func (*RuleChanSelect) StringsX

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

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

type RuleChanUpdate

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

RuleChanUpdate is the builder for updating RuleChan entities.

func (*RuleChanUpdate) AddRuleIDs

func (rcu *RuleChanUpdate) AddRuleIDs(ids ...uint64) *RuleChanUpdate

AddRuleIDs adds the "rules" edge to the RuleNode entity by IDs.

func (*RuleChanUpdate) AddRules

func (rcu *RuleChanUpdate) AddRules(r ...*RuleNode) *RuleChanUpdate

AddRules adds the "rules" edges to the RuleNode entity.

func (*RuleChanUpdate) AddSessionIDs

func (rcu *RuleChanUpdate) AddSessionIDs(ids ...uint64) *RuleChanUpdate

AddSessionIDs adds the "sessions" edge to the Session entity by IDs.

func (*RuleChanUpdate) AddSessions

func (rcu *RuleChanUpdate) AddSessions(s ...*Session) *RuleChanUpdate

AddSessions adds the "sessions" edges to the Session entity.

func (*RuleChanUpdate) ClearRules

func (rcu *RuleChanUpdate) ClearRules() *RuleChanUpdate

ClearRules clears all "rules" edges to the RuleNode entity.

func (*RuleChanUpdate) ClearSessions

func (rcu *RuleChanUpdate) ClearSessions() *RuleChanUpdate

ClearSessions clears all "sessions" edges to the Session entity.

func (*RuleChanUpdate) Exec

func (rcu *RuleChanUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*RuleChanUpdate) ExecX

func (rcu *RuleChanUpdate) ExecX(ctx context.Context)

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

func (*RuleChanUpdate) Mutation

func (rcu *RuleChanUpdate) Mutation() *RuleChanMutation

Mutation returns the RuleChanMutation object of the builder.

func (*RuleChanUpdate) RemoveRuleIDs

func (rcu *RuleChanUpdate) RemoveRuleIDs(ids ...uint64) *RuleChanUpdate

RemoveRuleIDs removes the "rules" edge to RuleNode entities by IDs.

func (*RuleChanUpdate) RemoveRules

func (rcu *RuleChanUpdate) RemoveRules(r ...*RuleNode) *RuleChanUpdate

RemoveRules removes "rules" edges to RuleNode entities.

func (*RuleChanUpdate) RemoveSessionIDs

func (rcu *RuleChanUpdate) RemoveSessionIDs(ids ...uint64) *RuleChanUpdate

RemoveSessionIDs removes the "sessions" edge to Session entities by IDs.

func (*RuleChanUpdate) RemoveSessions

func (rcu *RuleChanUpdate) RemoveSessions(s ...*Session) *RuleChanUpdate

RemoveSessions removes "sessions" edges to Session entities.

func (*RuleChanUpdate) Save

func (rcu *RuleChanUpdate) Save(ctx context.Context) (int, error)

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

func (*RuleChanUpdate) SaveX

func (rcu *RuleChanUpdate) SaveX(ctx context.Context) int

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

func (*RuleChanUpdate) SetCreatedAt

func (rcu *RuleChanUpdate) SetCreatedAt(t time.Time) *RuleChanUpdate

SetCreatedAt sets the "created_at" field.

func (*RuleChanUpdate) SetDescription

func (rcu *RuleChanUpdate) SetDescription(s string) *RuleChanUpdate

SetDescription sets the "description" field.

func (*RuleChanUpdate) SetInfinite

func (rcu *RuleChanUpdate) SetInfinite(b bool) *RuleChanUpdate

SetInfinite sets the "infinite" field.

func (*RuleChanUpdate) SetName

func (rcu *RuleChanUpdate) SetName(s string) *RuleChanUpdate

SetName sets the "name" field.

func (*RuleChanUpdate) SetNillableCreatedAt

func (rcu *RuleChanUpdate) SetNillableCreatedAt(t *time.Time) *RuleChanUpdate

SetNillableCreatedAt sets the "created_at" field if the given value is not nil.

func (*RuleChanUpdate) SetNillableInfinite

func (rcu *RuleChanUpdate) SetNillableInfinite(b *bool) *RuleChanUpdate

SetNillableInfinite sets the "infinite" field if the given value is not nil.

func (*RuleChanUpdate) SetNillableUpdatedAt

func (rcu *RuleChanUpdate) SetNillableUpdatedAt(t *time.Time) *RuleChanUpdate

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

func (*RuleChanUpdate) SetRootNode

func (rcu *RuleChanUpdate) SetRootNode(s string) *RuleChanUpdate

SetRootNode sets the "root_node" field.

func (*RuleChanUpdate) SetStatus

func (rcu *RuleChanUpdate) SetStatus(r rulechan.Status) *RuleChanUpdate

SetStatus sets the "status" field.

func (*RuleChanUpdate) SetUpdatedAt

func (rcu *RuleChanUpdate) SetUpdatedAt(t time.Time) *RuleChanUpdate

SetUpdatedAt sets the "updated_at" field.

func (*RuleChanUpdate) Where

func (rcu *RuleChanUpdate) Where(ps ...predicate.RuleChan) *RuleChanUpdate

Where appends a list predicates to the RuleChanUpdate builder.

type RuleChanUpdateOne

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

RuleChanUpdateOne is the builder for updating a single RuleChan entity.

func (*RuleChanUpdateOne) AddRuleIDs

func (rcuo *RuleChanUpdateOne) AddRuleIDs(ids ...uint64) *RuleChanUpdateOne

AddRuleIDs adds the "rules" edge to the RuleNode entity by IDs.

func (*RuleChanUpdateOne) AddRules

func (rcuo *RuleChanUpdateOne) AddRules(r ...*RuleNode) *RuleChanUpdateOne

AddRules adds the "rules" edges to the RuleNode entity.

func (*RuleChanUpdateOne) AddSessionIDs

func (rcuo *RuleChanUpdateOne) AddSessionIDs(ids ...uint64) *RuleChanUpdateOne

AddSessionIDs adds the "sessions" edge to the Session entity by IDs.

func (*RuleChanUpdateOne) AddSessions

func (rcuo *RuleChanUpdateOne) AddSessions(s ...*Session) *RuleChanUpdateOne

AddSessions adds the "sessions" edges to the Session entity.

func (*RuleChanUpdateOne) ClearRules

func (rcuo *RuleChanUpdateOne) ClearRules() *RuleChanUpdateOne

ClearRules clears all "rules" edges to the RuleNode entity.

func (*RuleChanUpdateOne) ClearSessions

func (rcuo *RuleChanUpdateOne) ClearSessions() *RuleChanUpdateOne

ClearSessions clears all "sessions" edges to the Session entity.

func (*RuleChanUpdateOne) Exec

func (rcuo *RuleChanUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*RuleChanUpdateOne) ExecX

func (rcuo *RuleChanUpdateOne) ExecX(ctx context.Context)

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

func (*RuleChanUpdateOne) Mutation

func (rcuo *RuleChanUpdateOne) Mutation() *RuleChanMutation

Mutation returns the RuleChanMutation object of the builder.

func (*RuleChanUpdateOne) RemoveRuleIDs

func (rcuo *RuleChanUpdateOne) RemoveRuleIDs(ids ...uint64) *RuleChanUpdateOne

RemoveRuleIDs removes the "rules" edge to RuleNode entities by IDs.

func (*RuleChanUpdateOne) RemoveRules

func (rcuo *RuleChanUpdateOne) RemoveRules(r ...*RuleNode) *RuleChanUpdateOne

RemoveRules removes "rules" edges to RuleNode entities.

func (*RuleChanUpdateOne) RemoveSessionIDs

func (rcuo *RuleChanUpdateOne) RemoveSessionIDs(ids ...uint64) *RuleChanUpdateOne

RemoveSessionIDs removes the "sessions" edge to Session entities by IDs.

func (*RuleChanUpdateOne) RemoveSessions

func (rcuo *RuleChanUpdateOne) RemoveSessions(s ...*Session) *RuleChanUpdateOne

RemoveSessions removes "sessions" edges to Session entities.

func (*RuleChanUpdateOne) Save

func (rcuo *RuleChanUpdateOne) Save(ctx context.Context) (*RuleChan, error)

Save executes the query and returns the updated RuleChan entity.

func (*RuleChanUpdateOne) SaveX

func (rcuo *RuleChanUpdateOne) SaveX(ctx context.Context) *RuleChan

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

func (*RuleChanUpdateOne) Select

func (rcuo *RuleChanUpdateOne) Select(field string, fields ...string) *RuleChanUpdateOne

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

func (*RuleChanUpdateOne) SetCreatedAt

func (rcuo *RuleChanUpdateOne) SetCreatedAt(t time.Time) *RuleChanUpdateOne

SetCreatedAt sets the "created_at" field.

func (*RuleChanUpdateOne) SetDescription

func (rcuo *RuleChanUpdateOne) SetDescription(s string) *RuleChanUpdateOne

SetDescription sets the "description" field.

func (*RuleChanUpdateOne) SetInfinite

func (rcuo *RuleChanUpdateOne) SetInfinite(b bool) *RuleChanUpdateOne

SetInfinite sets the "infinite" field.

func (*RuleChanUpdateOne) SetName

func (rcuo *RuleChanUpdateOne) SetName(s string) *RuleChanUpdateOne

SetName sets the "name" field.

func (*RuleChanUpdateOne) SetNillableCreatedAt

func (rcuo *RuleChanUpdateOne) SetNillableCreatedAt(t *time.Time) *RuleChanUpdateOne

SetNillableCreatedAt sets the "created_at" field if the given value is not nil.

func (*RuleChanUpdateOne) SetNillableInfinite

func (rcuo *RuleChanUpdateOne) SetNillableInfinite(b *bool) *RuleChanUpdateOne

SetNillableInfinite sets the "infinite" field if the given value is not nil.

func (*RuleChanUpdateOne) SetNillableUpdatedAt

func (rcuo *RuleChanUpdateOne) SetNillableUpdatedAt(t *time.Time) *RuleChanUpdateOne

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

func (*RuleChanUpdateOne) SetRootNode

func (rcuo *RuleChanUpdateOne) SetRootNode(s string) *RuleChanUpdateOne

SetRootNode sets the "root_node" field.

func (*RuleChanUpdateOne) SetStatus

func (rcuo *RuleChanUpdateOne) SetStatus(r rulechan.Status) *RuleChanUpdateOne

SetStatus sets the "status" field.

func (*RuleChanUpdateOne) SetUpdatedAt

func (rcuo *RuleChanUpdateOne) SetUpdatedAt(t time.Time) *RuleChanUpdateOne

SetUpdatedAt sets the "updated_at" field.

type RuleChans

type RuleChans []*RuleChan

RuleChans is a parsable slice of RuleChan.

type RuleNode

type RuleNode struct {

	// ID of the ent.
	ID uint64 `json:"id,omitempty"`
	// ChainID holds the value of the "chain_id" field.
	ChainID uint64 `json:"chain_id,omitempty"`
	// NodeID holds the value of the "node_id" field.
	NodeID string `json:"node_id,omitempty"`
	// Option holds the value of the "option" field.
	Option map[string]interface{} `json:"option,omitempty"`
	// Infinite holds the value of the "infinite" field.
	Infinite bool `json:"infinite,omitempty"`
	// Debug holds the value of the "debug" field.
	Debug bool `json:"debug,omitempty"`
	// End holds the value of the "end" field.
	End bool `json:"end,omitempty"`
	// CreatedAt holds the value of the "created_at" field.
	CreatedAt time.Time `json:"created_at,omitempty"`
	// UpdatedAt holds the value of the "updated_at" field.
	UpdatedAt time.Time `json:"updated_at,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the RuleNodeQuery when eager-loading is set.
	Edges RuleNodeEdges `json:"edges"`
	// contains filtered or unexported fields
}

RuleNode is the model entity for the RuleNode schema.

func (*RuleNode) QueryChain

func (rn *RuleNode) QueryChain() *RuleChanQuery

QueryChain queries the "chain" edge of the RuleNode entity.

func (*RuleNode) String

func (rn *RuleNode) String() string

String implements the fmt.Stringer.

func (*RuleNode) Unwrap

func (rn *RuleNode) Unwrap() *RuleNode

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

func (rn *RuleNode) Update() *RuleNodeUpdateOne

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

type RuleNodeClient

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

RuleNodeClient is a client for the RuleNode schema.

func NewRuleNodeClient

func NewRuleNodeClient(c config) *RuleNodeClient

NewRuleNodeClient returns a client for the RuleNode from the given config.

func (*RuleNodeClient) Create

func (c *RuleNodeClient) Create() *RuleNodeCreate

Create returns a builder for creating a RuleNode entity.

func (*RuleNodeClient) CreateBulk

func (c *RuleNodeClient) CreateBulk(builders ...*RuleNodeCreate) *RuleNodeCreateBulk

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

func (*RuleNodeClient) Delete

func (c *RuleNodeClient) Delete() *RuleNodeDelete

Delete returns a delete builder for RuleNode.

func (*RuleNodeClient) DeleteOne

func (c *RuleNodeClient) DeleteOne(rn *RuleNode) *RuleNodeDeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*RuleNodeClient) DeleteOneID

func (c *RuleNodeClient) DeleteOneID(id uint64) *RuleNodeDeleteOne

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

func (*RuleNodeClient) Get

func (c *RuleNodeClient) Get(ctx context.Context, id uint64) (*RuleNode, error)

Get returns a RuleNode entity by its id.

func (*RuleNodeClient) GetX

func (c *RuleNodeClient) GetX(ctx context.Context, id uint64) *RuleNode

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

func (*RuleNodeClient) Hooks

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

Hooks returns the client hooks.

func (*RuleNodeClient) Query

func (c *RuleNodeClient) Query() *RuleNodeQuery

Query returns a query builder for RuleNode.

func (*RuleNodeClient) QueryChain

func (c *RuleNodeClient) QueryChain(rn *RuleNode) *RuleChanQuery

QueryChain queries the chain edge of a RuleNode.

func (*RuleNodeClient) Update

func (c *RuleNodeClient) Update() *RuleNodeUpdate

Update returns an update builder for RuleNode.

func (*RuleNodeClient) UpdateOne

func (c *RuleNodeClient) UpdateOne(rn *RuleNode) *RuleNodeUpdateOne

UpdateOne returns an update builder for the given entity.

func (*RuleNodeClient) UpdateOneID

func (c *RuleNodeClient) UpdateOneID(id uint64) *RuleNodeUpdateOne

UpdateOneID returns an update builder for the given id.

func (*RuleNodeClient) Use

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

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

type RuleNodeCreate

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

RuleNodeCreate is the builder for creating a RuleNode entity.

func (*RuleNodeCreate) Exec

func (rnc *RuleNodeCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*RuleNodeCreate) ExecX

func (rnc *RuleNodeCreate) ExecX(ctx context.Context)

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

func (*RuleNodeCreate) Mutation

func (rnc *RuleNodeCreate) Mutation() *RuleNodeMutation

Mutation returns the RuleNodeMutation object of the builder.

func (*RuleNodeCreate) Save

func (rnc *RuleNodeCreate) Save(ctx context.Context) (*RuleNode, error)

Save creates the RuleNode in the database.

func (*RuleNodeCreate) SaveX

func (rnc *RuleNodeCreate) SaveX(ctx context.Context) *RuleNode

SaveX calls Save and panics if Save returns an error.

func (*RuleNodeCreate) SetChain

func (rnc *RuleNodeCreate) SetChain(r *RuleChan) *RuleNodeCreate

SetChain sets the "chain" edge to the RuleChan entity.

func (*RuleNodeCreate) SetChainID

func (rnc *RuleNodeCreate) SetChainID(u uint64) *RuleNodeCreate

SetChainID sets the "chain_id" field.

func (*RuleNodeCreate) SetCreatedAt

func (rnc *RuleNodeCreate) SetCreatedAt(t time.Time) *RuleNodeCreate

SetCreatedAt sets the "created_at" field.

func (*RuleNodeCreate) SetDebug

func (rnc *RuleNodeCreate) SetDebug(b bool) *RuleNodeCreate

SetDebug sets the "debug" field.

func (*RuleNodeCreate) SetEnd

func (rnc *RuleNodeCreate) SetEnd(b bool) *RuleNodeCreate

SetEnd sets the "end" field.

func (*RuleNodeCreate) SetID

func (rnc *RuleNodeCreate) SetID(u uint64) *RuleNodeCreate

SetID sets the "id" field.

func (*RuleNodeCreate) SetInfinite

func (rnc *RuleNodeCreate) SetInfinite(b bool) *RuleNodeCreate

SetInfinite sets the "infinite" field.

func (*RuleNodeCreate) SetNillableChainID

func (rnc *RuleNodeCreate) SetNillableChainID(u *uint64) *RuleNodeCreate

SetNillableChainID sets the "chain_id" field if the given value is not nil.

func (*RuleNodeCreate) SetNillableCreatedAt

func (rnc *RuleNodeCreate) SetNillableCreatedAt(t *time.Time) *RuleNodeCreate

SetNillableCreatedAt sets the "created_at" field if the given value is not nil.

func (*RuleNodeCreate) SetNillableDebug

func (rnc *RuleNodeCreate) SetNillableDebug(b *bool) *RuleNodeCreate

SetNillableDebug sets the "debug" field if the given value is not nil.

func (*RuleNodeCreate) SetNillableEnd

func (rnc *RuleNodeCreate) SetNillableEnd(b *bool) *RuleNodeCreate

SetNillableEnd sets the "end" field if the given value is not nil.

func (*RuleNodeCreate) SetNillableInfinite

func (rnc *RuleNodeCreate) SetNillableInfinite(b *bool) *RuleNodeCreate

SetNillableInfinite sets the "infinite" field if the given value is not nil.

func (*RuleNodeCreate) SetNillableUpdatedAt

func (rnc *RuleNodeCreate) SetNillableUpdatedAt(t *time.Time) *RuleNodeCreate

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

func (*RuleNodeCreate) SetNodeID

func (rnc *RuleNodeCreate) SetNodeID(s string) *RuleNodeCreate

SetNodeID sets the "node_id" field.

func (*RuleNodeCreate) SetOption

func (rnc *RuleNodeCreate) SetOption(m map[string]interface{}) *RuleNodeCreate

SetOption sets the "option" field.

func (*RuleNodeCreate) SetUpdatedAt

func (rnc *RuleNodeCreate) SetUpdatedAt(t time.Time) *RuleNodeCreate

SetUpdatedAt sets the "updated_at" field.

type RuleNodeCreateBulk

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

RuleNodeCreateBulk is the builder for creating many RuleNode entities in bulk.

func (*RuleNodeCreateBulk) Exec

func (rncb *RuleNodeCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*RuleNodeCreateBulk) ExecX

func (rncb *RuleNodeCreateBulk) ExecX(ctx context.Context)

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

func (*RuleNodeCreateBulk) Save

func (rncb *RuleNodeCreateBulk) Save(ctx context.Context) ([]*RuleNode, error)

Save creates the RuleNode entities in the database.

func (*RuleNodeCreateBulk) SaveX

func (rncb *RuleNodeCreateBulk) SaveX(ctx context.Context) []*RuleNode

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

type RuleNodeDelete

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

RuleNodeDelete is the builder for deleting a RuleNode entity.

func (*RuleNodeDelete) Exec

func (rnd *RuleNodeDelete) Exec(ctx context.Context) (int, error)

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

func (*RuleNodeDelete) ExecX

func (rnd *RuleNodeDelete) ExecX(ctx context.Context) int

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

func (*RuleNodeDelete) Where

func (rnd *RuleNodeDelete) Where(ps ...predicate.RuleNode) *RuleNodeDelete

Where appends a list predicates to the RuleNodeDelete builder.

type RuleNodeDeleteOne

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

RuleNodeDeleteOne is the builder for deleting a single RuleNode entity.

func (*RuleNodeDeleteOne) Exec

func (rndo *RuleNodeDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*RuleNodeDeleteOne) ExecX

func (rndo *RuleNodeDeleteOne) ExecX(ctx context.Context)

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

type RuleNodeEdges

type RuleNodeEdges struct {
	// Chain holds the value of the chain edge.
	Chain *RuleChan `json:"chain,omitempty"`
	// contains filtered or unexported fields
}

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

func (RuleNodeEdges) ChainOrErr

func (e RuleNodeEdges) ChainOrErr() (*RuleChan, error)

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

type RuleNodeGroupBy

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

RuleNodeGroupBy is the group-by builder for RuleNode entities.

func (*RuleNodeGroupBy) Aggregate

func (rngb *RuleNodeGroupBy) Aggregate(fns ...AggregateFunc) *RuleNodeGroupBy

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

func (*RuleNodeGroupBy) Bool

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

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

func (*RuleNodeGroupBy) BoolX

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

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

func (*RuleNodeGroupBy) Bools

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

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

func (*RuleNodeGroupBy) BoolsX

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

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

func (*RuleNodeGroupBy) Float64

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

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

func (*RuleNodeGroupBy) Float64X

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

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

func (*RuleNodeGroupBy) Float64s

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

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

func (*RuleNodeGroupBy) Float64sX

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

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

func (*RuleNodeGroupBy) Int

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

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

func (*RuleNodeGroupBy) IntX

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

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

func (*RuleNodeGroupBy) Ints

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

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

func (*RuleNodeGroupBy) IntsX

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

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

func (*RuleNodeGroupBy) Scan

func (rngb *RuleNodeGroupBy) Scan(ctx context.Context, v any) error

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

func (*RuleNodeGroupBy) ScanX

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

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

func (*RuleNodeGroupBy) String

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

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

func (*RuleNodeGroupBy) StringX

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

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

func (*RuleNodeGroupBy) Strings

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

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

func (*RuleNodeGroupBy) StringsX

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

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

type RuleNodeMutation

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

RuleNodeMutation represents an operation that mutates the RuleNode nodes in the graph.

func (*RuleNodeMutation) AddField

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

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

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

func (*RuleNodeMutation) AddedField

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

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

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

func (*RuleNodeMutation) AddedIDs

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

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

func (*RuleNodeMutation) ChainCleared

func (m *RuleNodeMutation) ChainCleared() bool

ChainCleared reports if the "chain" edge to the RuleChan entity was cleared.

func (*RuleNodeMutation) ChainID

func (m *RuleNodeMutation) ChainID() (r uint64, exists bool)

ChainID returns the value of the "chain_id" field in the mutation.

func (*RuleNodeMutation) ChainIDCleared

func (m *RuleNodeMutation) ChainIDCleared() bool

ChainIDCleared returns if the "chain_id" field was cleared in this mutation.

func (*RuleNodeMutation) ChainIDs

func (m *RuleNodeMutation) ChainIDs() (ids []uint64)

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

func (*RuleNodeMutation) ClearChain

func (m *RuleNodeMutation) ClearChain()

ClearChain clears the "chain" edge to the RuleChan entity.

func (*RuleNodeMutation) ClearChainID

func (m *RuleNodeMutation) ClearChainID()

ClearChainID clears the value of the "chain_id" field.

func (*RuleNodeMutation) ClearEdge

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

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

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

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

func (*RuleNodeMutation) ClearedFields

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

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

func (RuleNodeMutation) Client

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

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

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

func (*RuleNodeMutation) Debug

func (m *RuleNodeMutation) Debug() (r bool, exists bool)

Debug returns the value of the "debug" field in the mutation.

func (*RuleNodeMutation) EdgeCleared

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

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

func (*RuleNodeMutation) End

func (m *RuleNodeMutation) End() (r bool, exists bool)

End returns the value of the "end" field in the mutation.

func (*RuleNodeMutation) Field

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

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

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

func (*RuleNodeMutation) Fields

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

func (m *RuleNodeMutation) ID() (id uint64, 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 (*RuleNodeMutation) IDs

func (m *RuleNodeMutation) IDs(ctx context.Context) ([]uint64, 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 (*RuleNodeMutation) Infinite

func (m *RuleNodeMutation) Infinite() (r bool, exists bool)

Infinite returns the value of the "infinite" field in the mutation.

func (*RuleNodeMutation) NodeID

func (m *RuleNodeMutation) NodeID() (r string, exists bool)

NodeID returns the value of the "node_id" field in the mutation.

func (*RuleNodeMutation) OldChainID

func (m *RuleNodeMutation) OldChainID(ctx context.Context) (v uint64, err error)

OldChainID returns the old "chain_id" field's value of the RuleNode entity. If the RuleNode 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 (*RuleNodeMutation) OldCreatedAt

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

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

func (m *RuleNodeMutation) OldDebug(ctx context.Context) (v bool, err error)

OldDebug returns the old "debug" field's value of the RuleNode entity. If the RuleNode 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 (*RuleNodeMutation) OldEnd

func (m *RuleNodeMutation) OldEnd(ctx context.Context) (v bool, err error)

OldEnd returns the old "end" field's value of the RuleNode entity. If the RuleNode 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 (*RuleNodeMutation) OldField

func (m *RuleNodeMutation) 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 (*RuleNodeMutation) OldInfinite

func (m *RuleNodeMutation) OldInfinite(ctx context.Context) (v bool, err error)

OldInfinite returns the old "infinite" field's value of the RuleNode entity. If the RuleNode 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 (*RuleNodeMutation) OldNodeID

func (m *RuleNodeMutation) OldNodeID(ctx context.Context) (v string, err error)

OldNodeID returns the old "node_id" field's value of the RuleNode entity. If the RuleNode 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 (*RuleNodeMutation) OldOption

func (m *RuleNodeMutation) OldOption(ctx context.Context) (v map[string]interface{}, err error)

OldOption returns the old "option" field's value of the RuleNode entity. If the RuleNode 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 (*RuleNodeMutation) OldUpdatedAt

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

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

func (m *RuleNodeMutation) Op() Op

Op returns the operation name.

func (*RuleNodeMutation) Option

func (m *RuleNodeMutation) Option() (r map[string]interface{}, exists bool)

Option returns the value of the "option" field in the mutation.

func (*RuleNodeMutation) RemovedEdges

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

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

func (*RuleNodeMutation) RemovedIDs

func (m *RuleNodeMutation) 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 (*RuleNodeMutation) ResetChain

func (m *RuleNodeMutation) ResetChain()

ResetChain resets all changes to the "chain" edge.

func (*RuleNodeMutation) ResetChainID

func (m *RuleNodeMutation) ResetChainID()

ResetChainID resets all changes to the "chain_id" field.

func (*RuleNodeMutation) ResetCreatedAt

func (m *RuleNodeMutation) ResetCreatedAt()

ResetCreatedAt resets all changes to the "created_at" field.

func (*RuleNodeMutation) ResetDebug

func (m *RuleNodeMutation) ResetDebug()

ResetDebug resets all changes to the "debug" field.

func (*RuleNodeMutation) ResetEdge

func (m *RuleNodeMutation) 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 (*RuleNodeMutation) ResetEnd

func (m *RuleNodeMutation) ResetEnd()

ResetEnd resets all changes to the "end" field.

func (*RuleNodeMutation) ResetField

func (m *RuleNodeMutation) 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 (*RuleNodeMutation) ResetInfinite

func (m *RuleNodeMutation) ResetInfinite()

ResetInfinite resets all changes to the "infinite" field.

func (*RuleNodeMutation) ResetNodeID

func (m *RuleNodeMutation) ResetNodeID()

ResetNodeID resets all changes to the "node_id" field.

func (*RuleNodeMutation) ResetOption

func (m *RuleNodeMutation) ResetOption()

ResetOption resets all changes to the "option" field.

func (*RuleNodeMutation) ResetUpdatedAt

func (m *RuleNodeMutation) ResetUpdatedAt()

ResetUpdatedAt resets all changes to the "updated_at" field.

func (*RuleNodeMutation) SetChainID

func (m *RuleNodeMutation) SetChainID(u uint64)

SetChainID sets the "chain_id" field.

func (*RuleNodeMutation) SetCreatedAt

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

SetCreatedAt sets the "created_at" field.

func (*RuleNodeMutation) SetDebug

func (m *RuleNodeMutation) SetDebug(b bool)

SetDebug sets the "debug" field.

func (*RuleNodeMutation) SetEnd

func (m *RuleNodeMutation) SetEnd(b bool)

SetEnd sets the "end" field.

func (*RuleNodeMutation) SetField

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

func (m *RuleNodeMutation) SetID(id uint64)

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

func (*RuleNodeMutation) SetInfinite

func (m *RuleNodeMutation) SetInfinite(b bool)

SetInfinite sets the "infinite" field.

func (*RuleNodeMutation) SetNodeID

func (m *RuleNodeMutation) SetNodeID(s string)

SetNodeID sets the "node_id" field.

func (*RuleNodeMutation) SetOption

func (m *RuleNodeMutation) SetOption(value map[string]interface{})

SetOption sets the "option" field.

func (*RuleNodeMutation) SetUpdatedAt

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

SetUpdatedAt sets the "updated_at" field.

func (RuleNodeMutation) Tx

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

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

func (*RuleNodeMutation) Type

func (m *RuleNodeMutation) Type() string

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

func (*RuleNodeMutation) UpdatedAt

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

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

func (*RuleNodeMutation) Where

func (m *RuleNodeMutation) Where(ps ...predicate.RuleNode)

Where appends a list predicates to the RuleNodeMutation builder.

type RuleNodeQuery

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

RuleNodeQuery is the builder for querying RuleNode entities.

func (*RuleNodeQuery) All

func (rnq *RuleNodeQuery) All(ctx context.Context) ([]*RuleNode, error)

All executes the query and returns a list of RuleNodes.

func (*RuleNodeQuery) AllX

func (rnq *RuleNodeQuery) AllX(ctx context.Context) []*RuleNode

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

func (*RuleNodeQuery) Clone

func (rnq *RuleNodeQuery) Clone() *RuleNodeQuery

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

func (*RuleNodeQuery) Count

func (rnq *RuleNodeQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*RuleNodeQuery) CountX

func (rnq *RuleNodeQuery) CountX(ctx context.Context) int

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

func (*RuleNodeQuery) Exist

func (rnq *RuleNodeQuery) Exist(ctx context.Context) (bool, error)

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

func (*RuleNodeQuery) ExistX

func (rnq *RuleNodeQuery) ExistX(ctx context.Context) bool

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

func (*RuleNodeQuery) First

func (rnq *RuleNodeQuery) First(ctx context.Context) (*RuleNode, error)

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

func (*RuleNodeQuery) FirstID

func (rnq *RuleNodeQuery) FirstID(ctx context.Context) (id uint64, err error)

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

func (*RuleNodeQuery) FirstIDX

func (rnq *RuleNodeQuery) FirstIDX(ctx context.Context) uint64

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

func (*RuleNodeQuery) FirstX

func (rnq *RuleNodeQuery) FirstX(ctx context.Context) *RuleNode

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

func (*RuleNodeQuery) GroupBy

func (rnq *RuleNodeQuery) GroupBy(field string, fields ...string) *RuleNodeGroupBy

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 {
	ChainID uint64 `json:"chain_id,omitempty"`
	Count int `json:"count,omitempty"`
}

client.RuleNode.Query().
	GroupBy(rulenode.FieldChainID).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*RuleNodeQuery) IDs

func (rnq *RuleNodeQuery) IDs(ctx context.Context) ([]uint64, error)

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

func (*RuleNodeQuery) IDsX

func (rnq *RuleNodeQuery) IDsX(ctx context.Context) []uint64

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

func (*RuleNodeQuery) Limit

func (rnq *RuleNodeQuery) Limit(limit int) *RuleNodeQuery

Limit adds a limit step to the query.

func (*RuleNodeQuery) Offset

func (rnq *RuleNodeQuery) Offset(offset int) *RuleNodeQuery

Offset adds an offset step to the query.

func (*RuleNodeQuery) Only

func (rnq *RuleNodeQuery) Only(ctx context.Context) (*RuleNode, error)

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

func (*RuleNodeQuery) OnlyID

func (rnq *RuleNodeQuery) OnlyID(ctx context.Context) (id uint64, err error)

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

func (*RuleNodeQuery) OnlyIDX

func (rnq *RuleNodeQuery) OnlyIDX(ctx context.Context) uint64

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

func (*RuleNodeQuery) OnlyX

func (rnq *RuleNodeQuery) OnlyX(ctx context.Context) *RuleNode

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

func (*RuleNodeQuery) Order

func (rnq *RuleNodeQuery) Order(o ...OrderFunc) *RuleNodeQuery

Order adds an order step to the query.

func (*RuleNodeQuery) QueryChain

func (rnq *RuleNodeQuery) QueryChain() *RuleChanQuery

QueryChain chains the current query on the "chain" edge.

func (*RuleNodeQuery) Select

func (rnq *RuleNodeQuery) Select(fields ...string) *RuleNodeSelect

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 {
	ChainID uint64 `json:"chain_id,omitempty"`
}

client.RuleNode.Query().
	Select(rulenode.FieldChainID).
	Scan(ctx, &v)

func (*RuleNodeQuery) Unique

func (rnq *RuleNodeQuery) Unique(unique bool) *RuleNodeQuery

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

func (rnq *RuleNodeQuery) Where(ps ...predicate.RuleNode) *RuleNodeQuery

Where adds a new predicate for the RuleNodeQuery builder.

func (*RuleNodeQuery) WithChain

func (rnq *RuleNodeQuery) WithChain(opts ...func(*RuleChanQuery)) *RuleNodeQuery

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

type RuleNodeSelect

type RuleNodeSelect struct {
	*RuleNodeQuery
	// contains filtered or unexported fields
}

RuleNodeSelect is the builder for selecting fields of RuleNode entities.

func (*RuleNodeSelect) Bool

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

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

func (*RuleNodeSelect) BoolX

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

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

func (*RuleNodeSelect) Bools

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

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

func (*RuleNodeSelect) BoolsX

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

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

func (*RuleNodeSelect) Float64

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

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

func (*RuleNodeSelect) Float64X

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

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

func (*RuleNodeSelect) Float64s

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

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

func (*RuleNodeSelect) Float64sX

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

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

func (*RuleNodeSelect) Int

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

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

func (*RuleNodeSelect) IntX

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

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

func (*RuleNodeSelect) Ints

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

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

func (*RuleNodeSelect) IntsX

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

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

func (*RuleNodeSelect) Scan

func (rns *RuleNodeSelect) Scan(ctx context.Context, v any) error

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

func (*RuleNodeSelect) ScanX

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

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

func (*RuleNodeSelect) String

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

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

func (*RuleNodeSelect) StringX

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

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

func (*RuleNodeSelect) Strings

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

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

func (*RuleNodeSelect) StringsX

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

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

type RuleNodeUpdate

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

RuleNodeUpdate is the builder for updating RuleNode entities.

func (*RuleNodeUpdate) ClearChain

func (rnu *RuleNodeUpdate) ClearChain() *RuleNodeUpdate

ClearChain clears the "chain" edge to the RuleChan entity.

func (*RuleNodeUpdate) ClearChainID

func (rnu *RuleNodeUpdate) ClearChainID() *RuleNodeUpdate

ClearChainID clears the value of the "chain_id" field.

func (*RuleNodeUpdate) Exec

func (rnu *RuleNodeUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*RuleNodeUpdate) ExecX

func (rnu *RuleNodeUpdate) ExecX(ctx context.Context)

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

func (*RuleNodeUpdate) Mutation

func (rnu *RuleNodeUpdate) Mutation() *RuleNodeMutation

Mutation returns the RuleNodeMutation object of the builder.

func (*RuleNodeUpdate) Save

func (rnu *RuleNodeUpdate) Save(ctx context.Context) (int, error)

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

func (*RuleNodeUpdate) SaveX

func (rnu *RuleNodeUpdate) SaveX(ctx context.Context) int

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

func (*RuleNodeUpdate) SetChain

func (rnu *RuleNodeUpdate) SetChain(r *RuleChan) *RuleNodeUpdate

SetChain sets the "chain" edge to the RuleChan entity.

func (*RuleNodeUpdate) SetChainID

func (rnu *RuleNodeUpdate) SetChainID(u uint64) *RuleNodeUpdate

SetChainID sets the "chain_id" field.

func (*RuleNodeUpdate) SetCreatedAt

func (rnu *RuleNodeUpdate) SetCreatedAt(t time.Time) *RuleNodeUpdate

SetCreatedAt sets the "created_at" field.

func (*RuleNodeUpdate) SetDebug

func (rnu *RuleNodeUpdate) SetDebug(b bool) *RuleNodeUpdate

SetDebug sets the "debug" field.

func (*RuleNodeUpdate) SetEnd

func (rnu *RuleNodeUpdate) SetEnd(b bool) *RuleNodeUpdate

SetEnd sets the "end" field.

func (*RuleNodeUpdate) SetInfinite

func (rnu *RuleNodeUpdate) SetInfinite(b bool) *RuleNodeUpdate

SetInfinite sets the "infinite" field.

func (*RuleNodeUpdate) SetNillableChainID

func (rnu *RuleNodeUpdate) SetNillableChainID(u *uint64) *RuleNodeUpdate

SetNillableChainID sets the "chain_id" field if the given value is not nil.

func (*RuleNodeUpdate) SetNillableCreatedAt

func (rnu *RuleNodeUpdate) SetNillableCreatedAt(t *time.Time) *RuleNodeUpdate

SetNillableCreatedAt sets the "created_at" field if the given value is not nil.

func (*RuleNodeUpdate) SetNillableDebug

func (rnu *RuleNodeUpdate) SetNillableDebug(b *bool) *RuleNodeUpdate

SetNillableDebug sets the "debug" field if the given value is not nil.

func (*RuleNodeUpdate) SetNillableEnd

func (rnu *RuleNodeUpdate) SetNillableEnd(b *bool) *RuleNodeUpdate

SetNillableEnd sets the "end" field if the given value is not nil.

func (*RuleNodeUpdate) SetNillableInfinite

func (rnu *RuleNodeUpdate) SetNillableInfinite(b *bool) *RuleNodeUpdate

SetNillableInfinite sets the "infinite" field if the given value is not nil.

func (*RuleNodeUpdate) SetNillableUpdatedAt

func (rnu *RuleNodeUpdate) SetNillableUpdatedAt(t *time.Time) *RuleNodeUpdate

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

func (*RuleNodeUpdate) SetNodeID

func (rnu *RuleNodeUpdate) SetNodeID(s string) *RuleNodeUpdate

SetNodeID sets the "node_id" field.

func (*RuleNodeUpdate) SetOption

func (rnu *RuleNodeUpdate) SetOption(m map[string]interface{}) *RuleNodeUpdate

SetOption sets the "option" field.

func (*RuleNodeUpdate) SetUpdatedAt

func (rnu *RuleNodeUpdate) SetUpdatedAt(t time.Time) *RuleNodeUpdate

SetUpdatedAt sets the "updated_at" field.

func (*RuleNodeUpdate) Where

func (rnu *RuleNodeUpdate) Where(ps ...predicate.RuleNode) *RuleNodeUpdate

Where appends a list predicates to the RuleNodeUpdate builder.

type RuleNodeUpdateOne

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

RuleNodeUpdateOne is the builder for updating a single RuleNode entity.

func (*RuleNodeUpdateOne) ClearChain

func (rnuo *RuleNodeUpdateOne) ClearChain() *RuleNodeUpdateOne

ClearChain clears the "chain" edge to the RuleChan entity.

func (*RuleNodeUpdateOne) ClearChainID

func (rnuo *RuleNodeUpdateOne) ClearChainID() *RuleNodeUpdateOne

ClearChainID clears the value of the "chain_id" field.

func (*RuleNodeUpdateOne) Exec

func (rnuo *RuleNodeUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*RuleNodeUpdateOne) ExecX

func (rnuo *RuleNodeUpdateOne) ExecX(ctx context.Context)

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

func (*RuleNodeUpdateOne) Mutation

func (rnuo *RuleNodeUpdateOne) Mutation() *RuleNodeMutation

Mutation returns the RuleNodeMutation object of the builder.

func (*RuleNodeUpdateOne) Save

func (rnuo *RuleNodeUpdateOne) Save(ctx context.Context) (*RuleNode, error)

Save executes the query and returns the updated RuleNode entity.

func (*RuleNodeUpdateOne) SaveX

func (rnuo *RuleNodeUpdateOne) SaveX(ctx context.Context) *RuleNode

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

func (*RuleNodeUpdateOne) Select

func (rnuo *RuleNodeUpdateOne) Select(field string, fields ...string) *RuleNodeUpdateOne

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

func (*RuleNodeUpdateOne) SetChain

func (rnuo *RuleNodeUpdateOne) SetChain(r *RuleChan) *RuleNodeUpdateOne

SetChain sets the "chain" edge to the RuleChan entity.

func (*RuleNodeUpdateOne) SetChainID

func (rnuo *RuleNodeUpdateOne) SetChainID(u uint64) *RuleNodeUpdateOne

SetChainID sets the "chain_id" field.

func (*RuleNodeUpdateOne) SetCreatedAt

func (rnuo *RuleNodeUpdateOne) SetCreatedAt(t time.Time) *RuleNodeUpdateOne

SetCreatedAt sets the "created_at" field.

func (*RuleNodeUpdateOne) SetDebug

func (rnuo *RuleNodeUpdateOne) SetDebug(b bool) *RuleNodeUpdateOne

SetDebug sets the "debug" field.

func (*RuleNodeUpdateOne) SetEnd

func (rnuo *RuleNodeUpdateOne) SetEnd(b bool) *RuleNodeUpdateOne

SetEnd sets the "end" field.

func (*RuleNodeUpdateOne) SetInfinite

func (rnuo *RuleNodeUpdateOne) SetInfinite(b bool) *RuleNodeUpdateOne

SetInfinite sets the "infinite" field.

func (*RuleNodeUpdateOne) SetNillableChainID

func (rnuo *RuleNodeUpdateOne) SetNillableChainID(u *uint64) *RuleNodeUpdateOne

SetNillableChainID sets the "chain_id" field if the given value is not nil.

func (*RuleNodeUpdateOne) SetNillableCreatedAt

func (rnuo *RuleNodeUpdateOne) SetNillableCreatedAt(t *time.Time) *RuleNodeUpdateOne

SetNillableCreatedAt sets the "created_at" field if the given value is not nil.

func (*RuleNodeUpdateOne) SetNillableDebug

func (rnuo *RuleNodeUpdateOne) SetNillableDebug(b *bool) *RuleNodeUpdateOne

SetNillableDebug sets the "debug" field if the given value is not nil.

func (*RuleNodeUpdateOne) SetNillableEnd

func (rnuo *RuleNodeUpdateOne) SetNillableEnd(b *bool) *RuleNodeUpdateOne

SetNillableEnd sets the "end" field if the given value is not nil.

func (*RuleNodeUpdateOne) SetNillableInfinite

func (rnuo *RuleNodeUpdateOne) SetNillableInfinite(b *bool) *RuleNodeUpdateOne

SetNillableInfinite sets the "infinite" field if the given value is not nil.

func (*RuleNodeUpdateOne) SetNillableUpdatedAt

func (rnuo *RuleNodeUpdateOne) SetNillableUpdatedAt(t *time.Time) *RuleNodeUpdateOne

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

func (*RuleNodeUpdateOne) SetNodeID

func (rnuo *RuleNodeUpdateOne) SetNodeID(s string) *RuleNodeUpdateOne

SetNodeID sets the "node_id" field.

func (*RuleNodeUpdateOne) SetOption

func (rnuo *RuleNodeUpdateOne) SetOption(m map[string]interface{}) *RuleNodeUpdateOne

SetOption sets the "option" field.

func (*RuleNodeUpdateOne) SetUpdatedAt

func (rnuo *RuleNodeUpdateOne) SetUpdatedAt(t time.Time) *RuleNodeUpdateOne

SetUpdatedAt sets the "updated_at" field.

type RuleNodes

type RuleNodes []*RuleNode

RuleNodes is a parsable slice of RuleNode.

type Session

type Session struct {

	// ID of the ent.
	ID uint64 `json:"id,omitempty"`
	// ChainID holds the value of the "chain_id" field.
	ChainID uint64 `json:"chain_id,omitempty"`
	// Infinite holds the value of the "infinite" field.
	Infinite bool `json:"infinite,omitempty"`
	// Data holds the value of the "data" field.
	Data map[string]interface{} `json:"data,omitempty"`
	// Result holds the value of the "result" field.
	Result map[string]interface{} `json:"result,omitempty"`
	// CreatedAt holds the value of the "created_at" field.
	CreatedAt time.Time `json:"created_at,omitempty"`
	// UpdatedAt holds the value of the "updated_at" field.
	UpdatedAt time.Time `json:"updated_at,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the SessionQuery when eager-loading is set.
	Edges SessionEdges `json:"edges"`
	// contains filtered or unexported fields
}

Session is the model entity for the Session schema.

func (*Session) QueryChain

func (s *Session) QueryChain() *RuleChanQuery

QueryChain queries the "chain" edge of the Session entity.

func (*Session) String

func (s *Session) String() string

String implements the fmt.Stringer.

func (*Session) Unwrap

func (s *Session) Unwrap() *Session

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

func (s *Session) Update() *SessionUpdateOne

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

type SessionClient

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

SessionClient is a client for the Session schema.

func NewSessionClient

func NewSessionClient(c config) *SessionClient

NewSessionClient returns a client for the Session from the given config.

func (*SessionClient) Create

func (c *SessionClient) Create() *SessionCreate

Create returns a builder for creating a Session entity.

func (*SessionClient) CreateBulk

func (c *SessionClient) CreateBulk(builders ...*SessionCreate) *SessionCreateBulk

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

func (*SessionClient) Delete

func (c *SessionClient) Delete() *SessionDelete

Delete returns a delete builder for Session.

func (*SessionClient) DeleteOne

func (c *SessionClient) DeleteOne(s *Session) *SessionDeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*SessionClient) DeleteOneID

func (c *SessionClient) DeleteOneID(id uint64) *SessionDeleteOne

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

func (*SessionClient) Get

func (c *SessionClient) Get(ctx context.Context, id uint64) (*Session, error)

Get returns a Session entity by its id.

func (*SessionClient) GetX

func (c *SessionClient) GetX(ctx context.Context, id uint64) *Session

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

func (*SessionClient) Hooks

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

Hooks returns the client hooks.

func (*SessionClient) Query

func (c *SessionClient) Query() *SessionQuery

Query returns a query builder for Session.

func (*SessionClient) QueryChain

func (c *SessionClient) QueryChain(s *Session) *RuleChanQuery

QueryChain queries the chain edge of a Session.

func (*SessionClient) Update

func (c *SessionClient) Update() *SessionUpdate

Update returns an update builder for Session.

func (*SessionClient) UpdateOne

func (c *SessionClient) UpdateOne(s *Session) *SessionUpdateOne

UpdateOne returns an update builder for the given entity.

func (*SessionClient) UpdateOneID

func (c *SessionClient) UpdateOneID(id uint64) *SessionUpdateOne

UpdateOneID returns an update builder for the given id.

func (*SessionClient) Use

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

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

type SessionCreate

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

SessionCreate is the builder for creating a Session entity.

func (*SessionCreate) Exec

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

Exec executes the query.

func (*SessionCreate) ExecX

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

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

func (*SessionCreate) Mutation

func (sc *SessionCreate) Mutation() *SessionMutation

Mutation returns the SessionMutation object of the builder.

func (*SessionCreate) Save

func (sc *SessionCreate) Save(ctx context.Context) (*Session, error)

Save creates the Session in the database.

func (*SessionCreate) SaveX

func (sc *SessionCreate) SaveX(ctx context.Context) *Session

SaveX calls Save and panics if Save returns an error.

func (*SessionCreate) SetChain

func (sc *SessionCreate) SetChain(r *RuleChan) *SessionCreate

SetChain sets the "chain" edge to the RuleChan entity.

func (*SessionCreate) SetChainID

func (sc *SessionCreate) SetChainID(u uint64) *SessionCreate

SetChainID sets the "chain_id" field.

func (*SessionCreate) SetCreatedAt

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

SetCreatedAt sets the "created_at" field.

func (*SessionCreate) SetData

func (sc *SessionCreate) SetData(m map[string]interface{}) *SessionCreate

SetData sets the "data" field.

func (*SessionCreate) SetID

func (sc *SessionCreate) SetID(u uint64) *SessionCreate

SetID sets the "id" field.

func (*SessionCreate) SetInfinite

func (sc *SessionCreate) SetInfinite(b bool) *SessionCreate

SetInfinite sets the "infinite" field.

func (*SessionCreate) SetNillableChainID

func (sc *SessionCreate) SetNillableChainID(u *uint64) *SessionCreate

SetNillableChainID sets the "chain_id" field if the given value is not nil.

func (*SessionCreate) SetNillableCreatedAt

func (sc *SessionCreate) SetNillableCreatedAt(t *time.Time) *SessionCreate

SetNillableCreatedAt sets the "created_at" field if the given value is not nil.

func (*SessionCreate) SetNillableInfinite

func (sc *SessionCreate) SetNillableInfinite(b *bool) *SessionCreate

SetNillableInfinite sets the "infinite" field if the given value is not nil.

func (*SessionCreate) SetNillableUpdatedAt

func (sc *SessionCreate) SetNillableUpdatedAt(t *time.Time) *SessionCreate

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

func (*SessionCreate) SetResult

func (sc *SessionCreate) SetResult(m map[string]interface{}) *SessionCreate

SetResult sets the "result" field.

func (*SessionCreate) SetUpdatedAt

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

SetUpdatedAt sets the "updated_at" field.

type SessionCreateBulk

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

SessionCreateBulk is the builder for creating many Session entities in bulk.

func (*SessionCreateBulk) Exec

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

Exec executes the query.

func (*SessionCreateBulk) ExecX

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

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

func (*SessionCreateBulk) Save

func (scb *SessionCreateBulk) Save(ctx context.Context) ([]*Session, error)

Save creates the Session entities in the database.

func (*SessionCreateBulk) SaveX

func (scb *SessionCreateBulk) SaveX(ctx context.Context) []*Session

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

type SessionDelete

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

SessionDelete is the builder for deleting a Session entity.

func (*SessionDelete) Exec

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

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

func (*SessionDelete) ExecX

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

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

func (*SessionDelete) Where

func (sd *SessionDelete) Where(ps ...predicate.Session) *SessionDelete

Where appends a list predicates to the SessionDelete builder.

type SessionDeleteOne

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

SessionDeleteOne is the builder for deleting a single Session entity.

func (*SessionDeleteOne) Exec

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

Exec executes the deletion query.

func (*SessionDeleteOne) ExecX

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

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

type SessionEdges

type SessionEdges struct {
	// Chain holds the value of the chain edge.
	Chain *RuleChan `json:"chain,omitempty"`
	// contains filtered or unexported fields
}

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

func (SessionEdges) ChainOrErr

func (e SessionEdges) ChainOrErr() (*RuleChan, error)

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

type SessionGroupBy

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

SessionGroupBy is the group-by builder for Session entities.

func (*SessionGroupBy) Aggregate

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

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

func (*SessionGroupBy) Bool

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

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

func (*SessionGroupBy) BoolX

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

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

func (*SessionGroupBy) Bools

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

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

func (*SessionGroupBy) BoolsX

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

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

func (*SessionGroupBy) Float64

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

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

func (*SessionGroupBy) Float64X

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

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

func (*SessionGroupBy) Float64s

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

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

func (*SessionGroupBy) Float64sX

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

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

func (*SessionGroupBy) Int

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

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

func (*SessionGroupBy) IntX

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

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

func (*SessionGroupBy) Ints

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

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

func (*SessionGroupBy) IntsX

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

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

func (*SessionGroupBy) Scan

func (sgb *SessionGroupBy) Scan(ctx context.Context, v any) error

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

func (*SessionGroupBy) ScanX

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

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

func (*SessionGroupBy) String

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

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

func (*SessionGroupBy) StringX

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

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

func (*SessionGroupBy) Strings

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

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

func (*SessionGroupBy) StringsX

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

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

type SessionMutation

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

SessionMutation represents an operation that mutates the Session nodes in the graph.

func (*SessionMutation) AddField

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

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

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

func (*SessionMutation) AddedField

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

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

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

func (*SessionMutation) AddedIDs

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

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

func (*SessionMutation) ChainCleared

func (m *SessionMutation) ChainCleared() bool

ChainCleared reports if the "chain" edge to the RuleChan entity was cleared.

func (*SessionMutation) ChainID

func (m *SessionMutation) ChainID() (r uint64, exists bool)

ChainID returns the value of the "chain_id" field in the mutation.

func (*SessionMutation) ChainIDCleared

func (m *SessionMutation) ChainIDCleared() bool

ChainIDCleared returns if the "chain_id" field was cleared in this mutation.

func (*SessionMutation) ChainIDs

func (m *SessionMutation) ChainIDs() (ids []uint64)

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

func (*SessionMutation) ClearChain

func (m *SessionMutation) ClearChain()

ClearChain clears the "chain" edge to the RuleChan entity.

func (*SessionMutation) ClearChainID

func (m *SessionMutation) ClearChainID()

ClearChainID clears the value of the "chain_id" field.

func (*SessionMutation) ClearEdge

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

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

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

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

func (*SessionMutation) ClearedFields

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

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

func (SessionMutation) Client

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

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

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

func (*SessionMutation) Data

func (m *SessionMutation) Data() (r map[string]interface{}, exists bool)

Data returns the value of the "data" field in the mutation.

func (*SessionMutation) EdgeCleared

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

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

func (*SessionMutation) Field

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

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

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

func (*SessionMutation) Fields

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

func (m *SessionMutation) ID() (id uint64, 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 (*SessionMutation) IDs

func (m *SessionMutation) IDs(ctx context.Context) ([]uint64, 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 (*SessionMutation) Infinite

func (m *SessionMutation) Infinite() (r bool, exists bool)

Infinite returns the value of the "infinite" field in the mutation.

func (*SessionMutation) OldChainID

func (m *SessionMutation) OldChainID(ctx context.Context) (v uint64, err error)

OldChainID returns the old "chain_id" field's value of the Session entity. If the Session 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 (*SessionMutation) OldCreatedAt

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

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

func (m *SessionMutation) OldData(ctx context.Context) (v map[string]interface{}, err error)

OldData returns the old "data" field's value of the Session entity. If the Session 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 (*SessionMutation) OldField

func (m *SessionMutation) 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 (*SessionMutation) OldInfinite

func (m *SessionMutation) OldInfinite(ctx context.Context) (v bool, err error)

OldInfinite returns the old "infinite" field's value of the Session entity. If the Session 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 (*SessionMutation) OldResult

func (m *SessionMutation) OldResult(ctx context.Context) (v map[string]interface{}, err error)

OldResult returns the old "result" field's value of the Session entity. If the Session 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 (*SessionMutation) OldUpdatedAt

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

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

func (m *SessionMutation) Op() Op

Op returns the operation name.

func (*SessionMutation) RemovedEdges

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

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

func (*SessionMutation) RemovedIDs

func (m *SessionMutation) 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 (*SessionMutation) ResetChain

func (m *SessionMutation) ResetChain()

ResetChain resets all changes to the "chain" edge.

func (*SessionMutation) ResetChainID

func (m *SessionMutation) ResetChainID()

ResetChainID resets all changes to the "chain_id" field.

func (*SessionMutation) ResetCreatedAt

func (m *SessionMutation) ResetCreatedAt()

ResetCreatedAt resets all changes to the "created_at" field.

func (*SessionMutation) ResetData

func (m *SessionMutation) ResetData()

ResetData resets all changes to the "data" field.

func (*SessionMutation) ResetEdge

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

func (m *SessionMutation) 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 (*SessionMutation) ResetInfinite

func (m *SessionMutation) ResetInfinite()

ResetInfinite resets all changes to the "infinite" field.

func (*SessionMutation) ResetResult

func (m *SessionMutation) ResetResult()

ResetResult resets all changes to the "result" field.

func (*SessionMutation) ResetUpdatedAt

func (m *SessionMutation) ResetUpdatedAt()

ResetUpdatedAt resets all changes to the "updated_at" field.

func (*SessionMutation) Result

func (m *SessionMutation) Result() (r map[string]interface{}, exists bool)

Result returns the value of the "result" field in the mutation.

func (*SessionMutation) SetChainID

func (m *SessionMutation) SetChainID(u uint64)

SetChainID sets the "chain_id" field.

func (*SessionMutation) SetCreatedAt

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

SetCreatedAt sets the "created_at" field.

func (*SessionMutation) SetData

func (m *SessionMutation) SetData(value map[string]interface{})

SetData sets the "data" field.

func (*SessionMutation) SetField

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

func (m *SessionMutation) SetID(id uint64)

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

func (*SessionMutation) SetInfinite

func (m *SessionMutation) SetInfinite(b bool)

SetInfinite sets the "infinite" field.

func (*SessionMutation) SetResult

func (m *SessionMutation) SetResult(value map[string]interface{})

SetResult sets the "result" field.

func (*SessionMutation) SetUpdatedAt

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

SetUpdatedAt sets the "updated_at" field.

func (SessionMutation) Tx

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

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

func (*SessionMutation) Type

func (m *SessionMutation) Type() string

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

func (*SessionMutation) UpdatedAt

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

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

func (*SessionMutation) Where

func (m *SessionMutation) Where(ps ...predicate.Session)

Where appends a list predicates to the SessionMutation builder.

type SessionQuery

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

SessionQuery is the builder for querying Session entities.

func (*SessionQuery) All

func (sq *SessionQuery) All(ctx context.Context) ([]*Session, error)

All executes the query and returns a list of Sessions.

func (*SessionQuery) AllX

func (sq *SessionQuery) AllX(ctx context.Context) []*Session

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

func (*SessionQuery) Clone

func (sq *SessionQuery) Clone() *SessionQuery

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

func (*SessionQuery) Count

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

Count returns the count of the given query.

func (*SessionQuery) CountX

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

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

func (*SessionQuery) Exist

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

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

func (*SessionQuery) ExistX

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

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

func (*SessionQuery) First

func (sq *SessionQuery) First(ctx context.Context) (*Session, error)

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

func (*SessionQuery) FirstID

func (sq *SessionQuery) FirstID(ctx context.Context) (id uint64, err error)

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

func (*SessionQuery) FirstIDX

func (sq *SessionQuery) FirstIDX(ctx context.Context) uint64

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

func (*SessionQuery) FirstX

func (sq *SessionQuery) FirstX(ctx context.Context) *Session

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

func (*SessionQuery) GroupBy

func (sq *SessionQuery) GroupBy(field string, fields ...string) *SessionGroupBy

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 {
	ChainID uint64 `json:"chain_id,omitempty"`
	Count int `json:"count,omitempty"`
}

client.Session.Query().
	GroupBy(session.FieldChainID).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*SessionQuery) IDs

func (sq *SessionQuery) IDs(ctx context.Context) ([]uint64, error)

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

func (*SessionQuery) IDsX

func (sq *SessionQuery) IDsX(ctx context.Context) []uint64

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

func (*SessionQuery) Limit

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

Limit adds a limit step to the query.

func (*SessionQuery) Offset

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

Offset adds an offset step to the query.

func (*SessionQuery) Only

func (sq *SessionQuery) Only(ctx context.Context) (*Session, error)

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

func (*SessionQuery) OnlyID

func (sq *SessionQuery) OnlyID(ctx context.Context) (id uint64, err error)

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

func (*SessionQuery) OnlyIDX

func (sq *SessionQuery) OnlyIDX(ctx context.Context) uint64

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

func (*SessionQuery) OnlyX

func (sq *SessionQuery) OnlyX(ctx context.Context) *Session

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

func (*SessionQuery) Order

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

Order adds an order step to the query.

func (*SessionQuery) QueryChain

func (sq *SessionQuery) QueryChain() *RuleChanQuery

QueryChain chains the current query on the "chain" edge.

func (*SessionQuery) Select

func (sq *SessionQuery) Select(fields ...string) *SessionSelect

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 {
	ChainID uint64 `json:"chain_id,omitempty"`
}

client.Session.Query().
	Select(session.FieldChainID).
	Scan(ctx, &v)

func (*SessionQuery) Unique

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

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

func (sq *SessionQuery) Where(ps ...predicate.Session) *SessionQuery

Where adds a new predicate for the SessionQuery builder.

func (*SessionQuery) WithChain

func (sq *SessionQuery) WithChain(opts ...func(*RuleChanQuery)) *SessionQuery

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

type SessionSelect

type SessionSelect struct {
	*SessionQuery
	// contains filtered or unexported fields
}

SessionSelect is the builder for selecting fields of Session entities.

func (*SessionSelect) Bool

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

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

func (*SessionSelect) BoolX

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

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

func (*SessionSelect) Bools

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

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

func (*SessionSelect) BoolsX

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

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

func (*SessionSelect) Float64

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

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

func (*SessionSelect) Float64X

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

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

func (*SessionSelect) Float64s

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

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

func (*SessionSelect) Float64sX

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

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

func (*SessionSelect) Int

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

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

func (*SessionSelect) IntX

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

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

func (*SessionSelect) Ints

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

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

func (*SessionSelect) IntsX

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

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

func (*SessionSelect) Scan

func (ss *SessionSelect) Scan(ctx context.Context, v any) error

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

func (*SessionSelect) ScanX

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

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

func (*SessionSelect) String

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

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

func (*SessionSelect) StringX

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

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

func (*SessionSelect) Strings

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

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

func (*SessionSelect) StringsX

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

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

type SessionUpdate

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

SessionUpdate is the builder for updating Session entities.

func (*SessionUpdate) ClearChain

func (su *SessionUpdate) ClearChain() *SessionUpdate

ClearChain clears the "chain" edge to the RuleChan entity.

func (*SessionUpdate) ClearChainID

func (su *SessionUpdate) ClearChainID() *SessionUpdate

ClearChainID clears the value of the "chain_id" field.

func (*SessionUpdate) Exec

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

Exec executes the query.

func (*SessionUpdate) ExecX

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

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

func (*SessionUpdate) Mutation

func (su *SessionUpdate) Mutation() *SessionMutation

Mutation returns the SessionMutation object of the builder.

func (*SessionUpdate) Save

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

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

func (*SessionUpdate) SaveX

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

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

func (*SessionUpdate) SetChain

func (su *SessionUpdate) SetChain(r *RuleChan) *SessionUpdate

SetChain sets the "chain" edge to the RuleChan entity.

func (*SessionUpdate) SetChainID

func (su *SessionUpdate) SetChainID(u uint64) *SessionUpdate

SetChainID sets the "chain_id" field.

func (*SessionUpdate) SetCreatedAt

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

SetCreatedAt sets the "created_at" field.

func (*SessionUpdate) SetData

func (su *SessionUpdate) SetData(m map[string]interface{}) *SessionUpdate

SetData sets the "data" field.

func (*SessionUpdate) SetInfinite

func (su *SessionUpdate) SetInfinite(b bool) *SessionUpdate

SetInfinite sets the "infinite" field.

func (*SessionUpdate) SetNillableChainID

func (su *SessionUpdate) SetNillableChainID(u *uint64) *SessionUpdate

SetNillableChainID sets the "chain_id" field if the given value is not nil.

func (*SessionUpdate) SetNillableCreatedAt

func (su *SessionUpdate) SetNillableCreatedAt(t *time.Time) *SessionUpdate

SetNillableCreatedAt sets the "created_at" field if the given value is not nil.

func (*SessionUpdate) SetNillableInfinite

func (su *SessionUpdate) SetNillableInfinite(b *bool) *SessionUpdate

SetNillableInfinite sets the "infinite" field if the given value is not nil.

func (*SessionUpdate) SetNillableUpdatedAt

func (su *SessionUpdate) SetNillableUpdatedAt(t *time.Time) *SessionUpdate

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

func (*SessionUpdate) SetResult

func (su *SessionUpdate) SetResult(m map[string]interface{}) *SessionUpdate

SetResult sets the "result" field.

func (*SessionUpdate) SetUpdatedAt

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

SetUpdatedAt sets the "updated_at" field.

func (*SessionUpdate) Where

func (su *SessionUpdate) Where(ps ...predicate.Session) *SessionUpdate

Where appends a list predicates to the SessionUpdate builder.

type SessionUpdateOne

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

SessionUpdateOne is the builder for updating a single Session entity.

func (*SessionUpdateOne) ClearChain

func (suo *SessionUpdateOne) ClearChain() *SessionUpdateOne

ClearChain clears the "chain" edge to the RuleChan entity.

func (*SessionUpdateOne) ClearChainID

func (suo *SessionUpdateOne) ClearChainID() *SessionUpdateOne

ClearChainID clears the value of the "chain_id" field.

func (*SessionUpdateOne) Exec

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

Exec executes the query on the entity.

func (*SessionUpdateOne) ExecX

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

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

func (*SessionUpdateOne) Mutation

func (suo *SessionUpdateOne) Mutation() *SessionMutation

Mutation returns the SessionMutation object of the builder.

func (*SessionUpdateOne) Save

func (suo *SessionUpdateOne) Save(ctx context.Context) (*Session, error)

Save executes the query and returns the updated Session entity.

func (*SessionUpdateOne) SaveX

func (suo *SessionUpdateOne) SaveX(ctx context.Context) *Session

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

func (*SessionUpdateOne) Select

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

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

func (*SessionUpdateOne) SetChain

func (suo *SessionUpdateOne) SetChain(r *RuleChan) *SessionUpdateOne

SetChain sets the "chain" edge to the RuleChan entity.

func (*SessionUpdateOne) SetChainID

func (suo *SessionUpdateOne) SetChainID(u uint64) *SessionUpdateOne

SetChainID sets the "chain_id" field.

func (*SessionUpdateOne) SetCreatedAt

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

SetCreatedAt sets the "created_at" field.

func (*SessionUpdateOne) SetData

func (suo *SessionUpdateOne) SetData(m map[string]interface{}) *SessionUpdateOne

SetData sets the "data" field.

func (*SessionUpdateOne) SetInfinite

func (suo *SessionUpdateOne) SetInfinite(b bool) *SessionUpdateOne

SetInfinite sets the "infinite" field.

func (*SessionUpdateOne) SetNillableChainID

func (suo *SessionUpdateOne) SetNillableChainID(u *uint64) *SessionUpdateOne

SetNillableChainID sets the "chain_id" field if the given value is not nil.

func (*SessionUpdateOne) SetNillableCreatedAt

func (suo *SessionUpdateOne) SetNillableCreatedAt(t *time.Time) *SessionUpdateOne

SetNillableCreatedAt sets the "created_at" field if the given value is not nil.

func (*SessionUpdateOne) SetNillableInfinite

func (suo *SessionUpdateOne) SetNillableInfinite(b *bool) *SessionUpdateOne

SetNillableInfinite sets the "infinite" field if the given value is not nil.

func (*SessionUpdateOne) SetNillableUpdatedAt

func (suo *SessionUpdateOne) SetNillableUpdatedAt(t *time.Time) *SessionUpdateOne

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

func (*SessionUpdateOne) SetResult

func (suo *SessionUpdateOne) SetResult(m map[string]interface{}) *SessionUpdateOne

SetResult sets the "result" field.

func (*SessionUpdateOne) SetUpdatedAt

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

SetUpdatedAt sets the "updated_at" field.

type Sessions

type Sessions []*Session

Sessions is a parsable slice of Session.

type Tx

type Tx struct {

	// RuleChan is the client for interacting with the RuleChan builders.
	RuleChan *RuleChanClient
	// RuleNode is the client for interacting with the RuleNode builders.
	RuleNode *RuleNodeClient
	// Session is the client for interacting with the Session builders.
	Session *SessionClient
	// 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