ent

package
v0.0.0-...-dd4ad15 Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2025 License: MIT Imports: 20 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.
	TypeActiveSession = "ActiveSession"
	TypeCandle        = "Candle"
)

Variables

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

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

Functions

func Asc

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

Asc applies the given fields in ASC order.

func Desc

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

Desc applies the given fields in DESC order.

func IsConstraintError

func IsConstraintError(err error) bool

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

func IsNotFound

func IsNotFound(err error) bool

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

func IsNotLoaded

func IsNotLoaded(err error) bool

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

func IsNotSingular

func IsNotSingular(err error) bool

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

func IsValidationError

func IsValidationError(err error) bool

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

func MaskNotFound

func MaskNotFound(err error) error

MaskNotFound masks not found error.

func NewContext

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

NewContext returns a new context with the given Client attached.

func NewTxContext

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

NewTxContext returns a new context with the given Tx attached.

Types

type ActiveSession

type ActiveSession struct {

	// ID of the ent.
	ID uuid.UUID `json:"id,omitempty"`
	// SessionID holds the value of the "session_id" field.
	SessionID string `json:"session_id,omitempty"`
	// Exchange holds the value of the "exchange" field.
	Exchange string `json:"exchange,omitempty"`
	// Symbol holds the value of the "symbol" field.
	Symbol string `json:"symbol,omitempty"`
	// Type holds the value of the "type" field.
	Type activesession.Type `json:"type,omitempty"`
	// Timeframe holds the value of the "timeframe" field.
	Timeframe *activesession.Timeframe `json:"timeframe,omitempty"`
	// Enabled holds the value of the "enabled" field.
	Enabled bool `json:"enabled,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"`
	// contains filtered or unexported fields
}

ActiveSession is the model entity for the ActiveSession schema.

func (*ActiveSession) String

func (as *ActiveSession) String() string

String implements the fmt.Stringer.

func (*ActiveSession) Unwrap

func (as *ActiveSession) Unwrap() *ActiveSession

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

func (as *ActiveSession) Update() *ActiveSessionUpdateOne

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

func (*ActiveSession) Value

func (as *ActiveSession) Value(name string) (ent.Value, error)

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

type ActiveSessionClient

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

ActiveSessionClient is a client for the ActiveSession schema.

func NewActiveSessionClient

func NewActiveSessionClient(c config) *ActiveSessionClient

NewActiveSessionClient returns a client for the ActiveSession from the given config.

func (*ActiveSessionClient) Create

Create returns a builder for creating a ActiveSession entity.

func (*ActiveSessionClient) CreateBulk

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

func (*ActiveSessionClient) Delete

Delete returns a delete builder for ActiveSession.

func (*ActiveSessionClient) DeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*ActiveSessionClient) DeleteOneID

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

func (*ActiveSessionClient) Get

Get returns a ActiveSession entity by its id.

func (*ActiveSessionClient) GetX

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

func (*ActiveSessionClient) Hooks

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

Hooks returns the client hooks.

func (*ActiveSessionClient) Intercept

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

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

func (*ActiveSessionClient) Interceptors

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

Interceptors returns the client interceptors.

func (*ActiveSessionClient) MapCreateBulk

func (c *ActiveSessionClient) MapCreateBulk(slice any, setFunc func(*ActiveSessionCreate, int)) *ActiveSessionCreateBulk

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

func (*ActiveSessionClient) Query

Query returns a query builder for ActiveSession.

func (*ActiveSessionClient) Update

Update returns an update builder for ActiveSession.

func (*ActiveSessionClient) UpdateOne

UpdateOne returns an update builder for the given entity.

func (*ActiveSessionClient) UpdateOneID

UpdateOneID returns an update builder for the given id.

func (*ActiveSessionClient) Use

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

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

type ActiveSessionCreate

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

ActiveSessionCreate is the builder for creating a ActiveSession entity.

func (*ActiveSessionCreate) Exec

func (asc *ActiveSessionCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*ActiveSessionCreate) ExecX

func (asc *ActiveSessionCreate) ExecX(ctx context.Context)

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

func (*ActiveSessionCreate) Mutation

func (asc *ActiveSessionCreate) Mutation() *ActiveSessionMutation

Mutation returns the ActiveSessionMutation object of the builder.

func (*ActiveSessionCreate) Save

Save creates the ActiveSession in the database.

func (*ActiveSessionCreate) SaveX

SaveX calls Save and panics if Save returns an error.

func (*ActiveSessionCreate) SetCreatedAt

func (asc *ActiveSessionCreate) SetCreatedAt(t time.Time) *ActiveSessionCreate

SetCreatedAt sets the "created_at" field.

func (*ActiveSessionCreate) SetEnabled

func (asc *ActiveSessionCreate) SetEnabled(b bool) *ActiveSessionCreate

SetEnabled sets the "enabled" field.

func (*ActiveSessionCreate) SetExchange

func (asc *ActiveSessionCreate) SetExchange(s string) *ActiveSessionCreate

SetExchange sets the "exchange" field.

func (*ActiveSessionCreate) SetID

SetID sets the "id" field.

func (*ActiveSessionCreate) SetNillableCreatedAt

func (asc *ActiveSessionCreate) SetNillableCreatedAt(t *time.Time) *ActiveSessionCreate

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

func (*ActiveSessionCreate) SetNillableEnabled

func (asc *ActiveSessionCreate) SetNillableEnabled(b *bool) *ActiveSessionCreate

SetNillableEnabled sets the "enabled" field if the given value is not nil.

func (*ActiveSessionCreate) SetNillableID

func (asc *ActiveSessionCreate) SetNillableID(u *uuid.UUID) *ActiveSessionCreate

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

func (*ActiveSessionCreate) SetNillableTimeframe

func (asc *ActiveSessionCreate) SetNillableTimeframe(a *activesession.Timeframe) *ActiveSessionCreate

SetNillableTimeframe sets the "timeframe" field if the given value is not nil.

func (*ActiveSessionCreate) SetNillableType

func (asc *ActiveSessionCreate) SetNillableType(a *activesession.Type) *ActiveSessionCreate

SetNillableType sets the "type" field if the given value is not nil.

func (*ActiveSessionCreate) SetNillableUpdatedAt

func (asc *ActiveSessionCreate) SetNillableUpdatedAt(t *time.Time) *ActiveSessionCreate

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

func (*ActiveSessionCreate) SetSessionID

func (asc *ActiveSessionCreate) SetSessionID(s string) *ActiveSessionCreate

SetSessionID sets the "session_id" field.

func (*ActiveSessionCreate) SetSymbol

func (asc *ActiveSessionCreate) SetSymbol(s string) *ActiveSessionCreate

SetSymbol sets the "symbol" field.

func (*ActiveSessionCreate) SetTimeframe

SetTimeframe sets the "timeframe" field.

func (*ActiveSessionCreate) SetType

SetType sets the "type" field.

func (*ActiveSessionCreate) SetUpdatedAt

func (asc *ActiveSessionCreate) SetUpdatedAt(t time.Time) *ActiveSessionCreate

SetUpdatedAt sets the "updated_at" field.

type ActiveSessionCreateBulk

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

ActiveSessionCreateBulk is the builder for creating many ActiveSession entities in bulk.

func (*ActiveSessionCreateBulk) Exec

func (ascb *ActiveSessionCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*ActiveSessionCreateBulk) ExecX

func (ascb *ActiveSessionCreateBulk) ExecX(ctx context.Context)

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

func (*ActiveSessionCreateBulk) Save

Save creates the ActiveSession entities in the database.

func (*ActiveSessionCreateBulk) SaveX

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

type ActiveSessionDelete

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

ActiveSessionDelete is the builder for deleting a ActiveSession entity.

func (*ActiveSessionDelete) Exec

func (asd *ActiveSessionDelete) Exec(ctx context.Context) (int, error)

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

func (*ActiveSessionDelete) ExecX

func (asd *ActiveSessionDelete) ExecX(ctx context.Context) int

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

func (*ActiveSessionDelete) Where

Where appends a list predicates to the ActiveSessionDelete builder.

type ActiveSessionDeleteOne

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

ActiveSessionDeleteOne is the builder for deleting a single ActiveSession entity.

func (*ActiveSessionDeleteOne) Exec

func (asdo *ActiveSessionDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*ActiveSessionDeleteOne) ExecX

func (asdo *ActiveSessionDeleteOne) ExecX(ctx context.Context)

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

func (*ActiveSessionDeleteOne) Where

Where appends a list predicates to the ActiveSessionDelete builder.

type ActiveSessionGroupBy

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

ActiveSessionGroupBy is the group-by builder for ActiveSession entities.

func (*ActiveSessionGroupBy) Aggregate

func (asgb *ActiveSessionGroupBy) Aggregate(fns ...AggregateFunc) *ActiveSessionGroupBy

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

func (*ActiveSessionGroupBy) Bool

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

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

func (*ActiveSessionGroupBy) BoolX

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

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

func (*ActiveSessionGroupBy) Bools

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

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

func (*ActiveSessionGroupBy) BoolsX

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

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

func (*ActiveSessionGroupBy) Float64

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

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

func (*ActiveSessionGroupBy) Float64X

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

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

func (*ActiveSessionGroupBy) Float64s

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

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

func (*ActiveSessionGroupBy) Float64sX

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

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

func (*ActiveSessionGroupBy) Int

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

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

func (*ActiveSessionGroupBy) IntX

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

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

func (*ActiveSessionGroupBy) Ints

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

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

func (*ActiveSessionGroupBy) IntsX

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

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

func (*ActiveSessionGroupBy) Scan

func (asgb *ActiveSessionGroupBy) Scan(ctx context.Context, v any) error

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

func (*ActiveSessionGroupBy) ScanX

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

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

func (*ActiveSessionGroupBy) String

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

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

func (*ActiveSessionGroupBy) StringX

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

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

func (*ActiveSessionGroupBy) Strings

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

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

func (*ActiveSessionGroupBy) StringsX

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

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

type ActiveSessionMutation

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

ActiveSessionMutation represents an operation that mutates the ActiveSession nodes in the graph.

func (*ActiveSessionMutation) AddField

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

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

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

func (*ActiveSessionMutation) AddedField

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

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

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

func (*ActiveSessionMutation) AddedIDs

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

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

func (*ActiveSessionMutation) ClearEdge

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

func (m *ActiveSessionMutation) 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 (*ActiveSessionMutation) ClearTimeframe

func (m *ActiveSessionMutation) ClearTimeframe()

ClearTimeframe clears the value of the "timeframe" field.

func (*ActiveSessionMutation) ClearedEdges

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

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

func (*ActiveSessionMutation) ClearedFields

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

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

func (ActiveSessionMutation) Client

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

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

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

func (*ActiveSessionMutation) EdgeCleared

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

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

func (*ActiveSessionMutation) Enabled

func (m *ActiveSessionMutation) Enabled() (r bool, exists bool)

Enabled returns the value of the "enabled" field in the mutation.

func (*ActiveSessionMutation) Exchange

func (m *ActiveSessionMutation) Exchange() (r string, exists bool)

Exchange returns the value of the "exchange" field in the mutation.

func (*ActiveSessionMutation) Field

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

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

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

func (*ActiveSessionMutation) Fields

func (m *ActiveSessionMutation) 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 (*ActiveSessionMutation) GetType

func (m *ActiveSessionMutation) GetType() (r activesession.Type, exists bool)

GetType returns the value of the "type" field in the mutation.

func (*ActiveSessionMutation) ID

func (m *ActiveSessionMutation) ID() (id uuid.UUID, exists bool)

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

func (*ActiveSessionMutation) IDs

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

func (*ActiveSessionMutation) OldCreatedAt

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

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

func (m *ActiveSessionMutation) OldEnabled(ctx context.Context) (v bool, err error)

OldEnabled returns the old "enabled" field's value of the ActiveSession entity. If the ActiveSession 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 (*ActiveSessionMutation) OldExchange

func (m *ActiveSessionMutation) OldExchange(ctx context.Context) (v string, err error)

OldExchange returns the old "exchange" field's value of the ActiveSession entity. If the ActiveSession 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 (*ActiveSessionMutation) OldField

func (m *ActiveSessionMutation) 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 (*ActiveSessionMutation) OldSessionID

func (m *ActiveSessionMutation) OldSessionID(ctx context.Context) (v string, err error)

OldSessionID returns the old "session_id" field's value of the ActiveSession entity. If the ActiveSession 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 (*ActiveSessionMutation) OldSymbol

func (m *ActiveSessionMutation) OldSymbol(ctx context.Context) (v string, err error)

OldSymbol returns the old "symbol" field's value of the ActiveSession entity. If the ActiveSession 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 (*ActiveSessionMutation) OldTimeframe

func (m *ActiveSessionMutation) OldTimeframe(ctx context.Context) (v *activesession.Timeframe, err error)

OldTimeframe returns the old "timeframe" field's value of the ActiveSession entity. If the ActiveSession 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 (*ActiveSessionMutation) OldType

func (m *ActiveSessionMutation) OldType(ctx context.Context) (v activesession.Type, err error)

OldType returns the old "type" field's value of the ActiveSession entity. If the ActiveSession 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 (*ActiveSessionMutation) OldUpdatedAt

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

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

func (m *ActiveSessionMutation) Op() Op

Op returns the operation name.

func (*ActiveSessionMutation) RemovedEdges

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

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

func (*ActiveSessionMutation) RemovedIDs

func (m *ActiveSessionMutation) 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 (*ActiveSessionMutation) ResetCreatedAt

func (m *ActiveSessionMutation) ResetCreatedAt()

ResetCreatedAt resets all changes to the "created_at" field.

func (*ActiveSessionMutation) ResetEdge

func (m *ActiveSessionMutation) 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 (*ActiveSessionMutation) ResetEnabled

func (m *ActiveSessionMutation) ResetEnabled()

ResetEnabled resets all changes to the "enabled" field.

func (*ActiveSessionMutation) ResetExchange

func (m *ActiveSessionMutation) ResetExchange()

ResetExchange resets all changes to the "exchange" field.

func (*ActiveSessionMutation) ResetField

func (m *ActiveSessionMutation) 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 (*ActiveSessionMutation) ResetSessionID

func (m *ActiveSessionMutation) ResetSessionID()

ResetSessionID resets all changes to the "session_id" field.

func (*ActiveSessionMutation) ResetSymbol

func (m *ActiveSessionMutation) ResetSymbol()

ResetSymbol resets all changes to the "symbol" field.

func (*ActiveSessionMutation) ResetTimeframe

func (m *ActiveSessionMutation) ResetTimeframe()

ResetTimeframe resets all changes to the "timeframe" field.

func (*ActiveSessionMutation) ResetType

func (m *ActiveSessionMutation) ResetType()

ResetType resets all changes to the "type" field.

func (*ActiveSessionMutation) ResetUpdatedAt

func (m *ActiveSessionMutation) ResetUpdatedAt()

ResetUpdatedAt resets all changes to the "updated_at" field.

func (*ActiveSessionMutation) SessionID

func (m *ActiveSessionMutation) SessionID() (r string, exists bool)

SessionID returns the value of the "session_id" field in the mutation.

func (*ActiveSessionMutation) SetCreatedAt

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

SetCreatedAt sets the "created_at" field.

func (*ActiveSessionMutation) SetEnabled

func (m *ActiveSessionMutation) SetEnabled(b bool)

SetEnabled sets the "enabled" field.

func (*ActiveSessionMutation) SetExchange

func (m *ActiveSessionMutation) SetExchange(s string)

SetExchange sets the "exchange" field.

func (*ActiveSessionMutation) SetField

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

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

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

func (*ActiveSessionMutation) SetOp

func (m *ActiveSessionMutation) SetOp(op Op)

SetOp allows setting the mutation operation.

func (*ActiveSessionMutation) SetSessionID

func (m *ActiveSessionMutation) SetSessionID(s string)

SetSessionID sets the "session_id" field.

func (*ActiveSessionMutation) SetSymbol

func (m *ActiveSessionMutation) SetSymbol(s string)

SetSymbol sets the "symbol" field.

func (*ActiveSessionMutation) SetTimeframe

func (m *ActiveSessionMutation) SetTimeframe(a activesession.Timeframe)

SetTimeframe sets the "timeframe" field.

func (*ActiveSessionMutation) SetType

SetType sets the "type" field.

func (*ActiveSessionMutation) SetUpdatedAt

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

SetUpdatedAt sets the "updated_at" field.

func (*ActiveSessionMutation) Symbol

func (m *ActiveSessionMutation) Symbol() (r string, exists bool)

Symbol returns the value of the "symbol" field in the mutation.

func (*ActiveSessionMutation) Timeframe

func (m *ActiveSessionMutation) Timeframe() (r activesession.Timeframe, exists bool)

Timeframe returns the value of the "timeframe" field in the mutation.

func (*ActiveSessionMutation) TimeframeCleared

func (m *ActiveSessionMutation) TimeframeCleared() bool

TimeframeCleared returns if the "timeframe" field was cleared in this mutation.

func (ActiveSessionMutation) Tx

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

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

func (*ActiveSessionMutation) Type

func (m *ActiveSessionMutation) Type() string

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

func (*ActiveSessionMutation) UpdatedAt

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

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

func (*ActiveSessionMutation) Where

Where appends a list predicates to the ActiveSessionMutation builder.

func (*ActiveSessionMutation) WhereP

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

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

type ActiveSessionQuery

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

ActiveSessionQuery is the builder for querying ActiveSession entities.

func (*ActiveSessionQuery) Aggregate

func (asq *ActiveSessionQuery) Aggregate(fns ...AggregateFunc) *ActiveSessionSelect

Aggregate returns a ActiveSessionSelect configured with the given aggregations.

func (*ActiveSessionQuery) All

All executes the query and returns a list of ActiveSessions.

func (*ActiveSessionQuery) AllX

func (asq *ActiveSessionQuery) AllX(ctx context.Context) []*ActiveSession

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

func (*ActiveSessionQuery) Clone

func (asq *ActiveSessionQuery) Clone() *ActiveSessionQuery

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

func (*ActiveSessionQuery) Count

func (asq *ActiveSessionQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*ActiveSessionQuery) CountX

func (asq *ActiveSessionQuery) CountX(ctx context.Context) int

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

func (*ActiveSessionQuery) Exist

func (asq *ActiveSessionQuery) Exist(ctx context.Context) (bool, error)

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

func (*ActiveSessionQuery) ExistX

func (asq *ActiveSessionQuery) ExistX(ctx context.Context) bool

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

func (*ActiveSessionQuery) First

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

func (*ActiveSessionQuery) FirstID

func (asq *ActiveSessionQuery) FirstID(ctx context.Context) (id uuid.UUID, err error)

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

func (*ActiveSessionQuery) FirstIDX

func (asq *ActiveSessionQuery) FirstIDX(ctx context.Context) uuid.UUID

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

func (*ActiveSessionQuery) FirstX

func (asq *ActiveSessionQuery) FirstX(ctx context.Context) *ActiveSession

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

func (*ActiveSessionQuery) GroupBy

func (asq *ActiveSessionQuery) GroupBy(field string, fields ...string) *ActiveSessionGroupBy

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

client.ActiveSession.Query().
	GroupBy(activesession.FieldSessionID).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*ActiveSessionQuery) IDs

func (asq *ActiveSessionQuery) IDs(ctx context.Context) (ids []uuid.UUID, err error)

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

func (*ActiveSessionQuery) IDsX

func (asq *ActiveSessionQuery) IDsX(ctx context.Context) []uuid.UUID

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

func (*ActiveSessionQuery) Limit

func (asq *ActiveSessionQuery) Limit(limit int) *ActiveSessionQuery

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

func (*ActiveSessionQuery) Offset

func (asq *ActiveSessionQuery) Offset(offset int) *ActiveSessionQuery

Offset to start from.

func (*ActiveSessionQuery) Only

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

func (*ActiveSessionQuery) OnlyID

func (asq *ActiveSessionQuery) OnlyID(ctx context.Context) (id uuid.UUID, err error)

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

func (*ActiveSessionQuery) OnlyIDX

func (asq *ActiveSessionQuery) OnlyIDX(ctx context.Context) uuid.UUID

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

func (*ActiveSessionQuery) OnlyX

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

func (*ActiveSessionQuery) Order

Order specifies how the records should be ordered.

func (*ActiveSessionQuery) Select

func (asq *ActiveSessionQuery) Select(fields ...string) *ActiveSessionSelect

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

client.ActiveSession.Query().
	Select(activesession.FieldSessionID).
	Scan(ctx, &v)

func (*ActiveSessionQuery) Unique

func (asq *ActiveSessionQuery) Unique(unique bool) *ActiveSessionQuery

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

Where adds a new predicate for the ActiveSessionQuery builder.

type ActiveSessionSelect

type ActiveSessionSelect struct {
	*ActiveSessionQuery
	// contains filtered or unexported fields
}

ActiveSessionSelect is the builder for selecting fields of ActiveSession entities.

func (*ActiveSessionSelect) Aggregate

func (ass *ActiveSessionSelect) Aggregate(fns ...AggregateFunc) *ActiveSessionSelect

Aggregate adds the given aggregation functions to the selector query.

func (*ActiveSessionSelect) Bool

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

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

func (*ActiveSessionSelect) BoolX

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

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

func (*ActiveSessionSelect) Bools

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

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

func (*ActiveSessionSelect) BoolsX

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

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

func (*ActiveSessionSelect) Float64

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

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

func (*ActiveSessionSelect) Float64X

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

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

func (*ActiveSessionSelect) Float64s

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

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

func (*ActiveSessionSelect) Float64sX

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

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

func (*ActiveSessionSelect) Int

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

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

func (*ActiveSessionSelect) IntX

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

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

func (*ActiveSessionSelect) Ints

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

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

func (*ActiveSessionSelect) IntsX

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

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

func (*ActiveSessionSelect) Scan

func (ass *ActiveSessionSelect) Scan(ctx context.Context, v any) error

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

func (*ActiveSessionSelect) ScanX

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

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

func (*ActiveSessionSelect) String

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

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

func (*ActiveSessionSelect) StringX

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

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

func (*ActiveSessionSelect) Strings

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

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

func (*ActiveSessionSelect) StringsX

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

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

type ActiveSessionUpdate

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

ActiveSessionUpdate is the builder for updating ActiveSession entities.

func (*ActiveSessionUpdate) ClearTimeframe

func (asu *ActiveSessionUpdate) ClearTimeframe() *ActiveSessionUpdate

ClearTimeframe clears the value of the "timeframe" field.

func (*ActiveSessionUpdate) Exec

func (asu *ActiveSessionUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*ActiveSessionUpdate) ExecX

func (asu *ActiveSessionUpdate) ExecX(ctx context.Context)

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

func (*ActiveSessionUpdate) Mutation

func (asu *ActiveSessionUpdate) Mutation() *ActiveSessionMutation

Mutation returns the ActiveSessionMutation object of the builder.

func (*ActiveSessionUpdate) Save

func (asu *ActiveSessionUpdate) Save(ctx context.Context) (int, error)

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

func (*ActiveSessionUpdate) SaveX

func (asu *ActiveSessionUpdate) SaveX(ctx context.Context) int

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

func (*ActiveSessionUpdate) SetCreatedAt

func (asu *ActiveSessionUpdate) SetCreatedAt(t time.Time) *ActiveSessionUpdate

SetCreatedAt sets the "created_at" field.

func (*ActiveSessionUpdate) SetEnabled

func (asu *ActiveSessionUpdate) SetEnabled(b bool) *ActiveSessionUpdate

SetEnabled sets the "enabled" field.

func (*ActiveSessionUpdate) SetExchange

func (asu *ActiveSessionUpdate) SetExchange(s string) *ActiveSessionUpdate

SetExchange sets the "exchange" field.

func (*ActiveSessionUpdate) SetNillableCreatedAt

func (asu *ActiveSessionUpdate) SetNillableCreatedAt(t *time.Time) *ActiveSessionUpdate

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

func (*ActiveSessionUpdate) SetNillableEnabled

func (asu *ActiveSessionUpdate) SetNillableEnabled(b *bool) *ActiveSessionUpdate

SetNillableEnabled sets the "enabled" field if the given value is not nil.

func (*ActiveSessionUpdate) SetNillableExchange

func (asu *ActiveSessionUpdate) SetNillableExchange(s *string) *ActiveSessionUpdate

SetNillableExchange sets the "exchange" field if the given value is not nil.

func (*ActiveSessionUpdate) SetNillableSessionID

func (asu *ActiveSessionUpdate) SetNillableSessionID(s *string) *ActiveSessionUpdate

SetNillableSessionID sets the "session_id" field if the given value is not nil.

func (*ActiveSessionUpdate) SetNillableSymbol

func (asu *ActiveSessionUpdate) SetNillableSymbol(s *string) *ActiveSessionUpdate

SetNillableSymbol sets the "symbol" field if the given value is not nil.

func (*ActiveSessionUpdate) SetNillableTimeframe

func (asu *ActiveSessionUpdate) SetNillableTimeframe(a *activesession.Timeframe) *ActiveSessionUpdate

SetNillableTimeframe sets the "timeframe" field if the given value is not nil.

func (*ActiveSessionUpdate) SetNillableType

func (asu *ActiveSessionUpdate) SetNillableType(a *activesession.Type) *ActiveSessionUpdate

SetNillableType sets the "type" field if the given value is not nil.

func (*ActiveSessionUpdate) SetSessionID

func (asu *ActiveSessionUpdate) SetSessionID(s string) *ActiveSessionUpdate

SetSessionID sets the "session_id" field.

func (*ActiveSessionUpdate) SetSymbol

func (asu *ActiveSessionUpdate) SetSymbol(s string) *ActiveSessionUpdate

SetSymbol sets the "symbol" field.

func (*ActiveSessionUpdate) SetTimeframe

SetTimeframe sets the "timeframe" field.

func (*ActiveSessionUpdate) SetType

SetType sets the "type" field.

func (*ActiveSessionUpdate) SetUpdatedAt

func (asu *ActiveSessionUpdate) SetUpdatedAt(t time.Time) *ActiveSessionUpdate

SetUpdatedAt sets the "updated_at" field.

func (*ActiveSessionUpdate) Where

Where appends a list predicates to the ActiveSessionUpdate builder.

type ActiveSessionUpdateOne

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

ActiveSessionUpdateOne is the builder for updating a single ActiveSession entity.

func (*ActiveSessionUpdateOne) ClearTimeframe

func (asuo *ActiveSessionUpdateOne) ClearTimeframe() *ActiveSessionUpdateOne

ClearTimeframe clears the value of the "timeframe" field.

func (*ActiveSessionUpdateOne) Exec

func (asuo *ActiveSessionUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*ActiveSessionUpdateOne) ExecX

func (asuo *ActiveSessionUpdateOne) ExecX(ctx context.Context)

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

func (*ActiveSessionUpdateOne) Mutation

Mutation returns the ActiveSessionMutation object of the builder.

func (*ActiveSessionUpdateOne) Save

Save executes the query and returns the updated ActiveSession entity.

func (*ActiveSessionUpdateOne) SaveX

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

func (*ActiveSessionUpdateOne) Select

func (asuo *ActiveSessionUpdateOne) Select(field string, fields ...string) *ActiveSessionUpdateOne

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

func (*ActiveSessionUpdateOne) SetCreatedAt

func (asuo *ActiveSessionUpdateOne) SetCreatedAt(t time.Time) *ActiveSessionUpdateOne

SetCreatedAt sets the "created_at" field.

func (*ActiveSessionUpdateOne) SetEnabled

func (asuo *ActiveSessionUpdateOne) SetEnabled(b bool) *ActiveSessionUpdateOne

SetEnabled sets the "enabled" field.

func (*ActiveSessionUpdateOne) SetExchange

SetExchange sets the "exchange" field.

func (*ActiveSessionUpdateOne) SetNillableCreatedAt

func (asuo *ActiveSessionUpdateOne) SetNillableCreatedAt(t *time.Time) *ActiveSessionUpdateOne

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

func (*ActiveSessionUpdateOne) SetNillableEnabled

func (asuo *ActiveSessionUpdateOne) SetNillableEnabled(b *bool) *ActiveSessionUpdateOne

SetNillableEnabled sets the "enabled" field if the given value is not nil.

func (*ActiveSessionUpdateOne) SetNillableExchange

func (asuo *ActiveSessionUpdateOne) SetNillableExchange(s *string) *ActiveSessionUpdateOne

SetNillableExchange sets the "exchange" field if the given value is not nil.

func (*ActiveSessionUpdateOne) SetNillableSessionID

func (asuo *ActiveSessionUpdateOne) SetNillableSessionID(s *string) *ActiveSessionUpdateOne

SetNillableSessionID sets the "session_id" field if the given value is not nil.

func (*ActiveSessionUpdateOne) SetNillableSymbol

func (asuo *ActiveSessionUpdateOne) SetNillableSymbol(s *string) *ActiveSessionUpdateOne

SetNillableSymbol sets the "symbol" field if the given value is not nil.

func (*ActiveSessionUpdateOne) SetNillableTimeframe

func (asuo *ActiveSessionUpdateOne) SetNillableTimeframe(a *activesession.Timeframe) *ActiveSessionUpdateOne

SetNillableTimeframe sets the "timeframe" field if the given value is not nil.

func (*ActiveSessionUpdateOne) SetNillableType

SetNillableType sets the "type" field if the given value is not nil.

func (*ActiveSessionUpdateOne) SetSessionID

func (asuo *ActiveSessionUpdateOne) SetSessionID(s string) *ActiveSessionUpdateOne

SetSessionID sets the "session_id" field.

func (*ActiveSessionUpdateOne) SetSymbol

SetSymbol sets the "symbol" field.

func (*ActiveSessionUpdateOne) SetTimeframe

SetTimeframe sets the "timeframe" field.

func (*ActiveSessionUpdateOne) SetType

SetType sets the "type" field.

func (*ActiveSessionUpdateOne) SetUpdatedAt

func (asuo *ActiveSessionUpdateOne) SetUpdatedAt(t time.Time) *ActiveSessionUpdateOne

SetUpdatedAt sets the "updated_at" field.

func (*ActiveSessionUpdateOne) Where

Where appends a list predicates to the ActiveSessionUpdate builder.

type ActiveSessions

type ActiveSessions []*ActiveSession

ActiveSessions is a parsable slice of ActiveSession.

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 Candle

type Candle struct {

	// ID of the ent.
	ID uuid.UUID `json:"id,omitempty"`
	// Exchange holds the value of the "exchange" field.
	Exchange string `json:"exchange,omitempty"`
	// Symbol holds the value of the "symbol" field.
	Symbol string `json:"symbol,omitempty"`
	// Timeframe holds the value of the "timeframe" field.
	Timeframe candle.Timeframe `json:"timeframe,omitempty"`
	// Timestamp holds the value of the "timestamp" field.
	Timestamp int64 `json:"timestamp,omitempty"`
	// Open holds the value of the "open" field.
	Open float64 `json:"open,omitempty"`
	// High holds the value of the "high" field.
	High float64 `json:"high,omitempty"`
	// Low holds the value of the "low" field.
	Low float64 `json:"low,omitempty"`
	// Close holds the value of the "close" field.
	Close float64 `json:"close,omitempty"`
	// Volume holds the value of the "volume" field.
	Volume float64 `json:"volume,omitempty"`
	// CreatedAt holds the value of the "created_at" field.
	CreatedAt time.Time `json:"created_at,omitempty"`
	// contains filtered or unexported fields
}

Candle is the model entity for the Candle schema.

func (*Candle) String

func (c *Candle) String() string

String implements the fmt.Stringer.

func (*Candle) Unwrap

func (c *Candle) Unwrap() *Candle

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

func (c *Candle) Update() *CandleUpdateOne

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

func (*Candle) Value

func (c *Candle) Value(name string) (ent.Value, error)

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

type CandleClient

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

CandleClient is a client for the Candle schema.

func NewCandleClient

func NewCandleClient(c config) *CandleClient

NewCandleClient returns a client for the Candle from the given config.

func (*CandleClient) Create

func (c *CandleClient) Create() *CandleCreate

Create returns a builder for creating a Candle entity.

func (*CandleClient) CreateBulk

func (c *CandleClient) CreateBulk(builders ...*CandleCreate) *CandleCreateBulk

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

func (*CandleClient) Delete

func (c *CandleClient) Delete() *CandleDelete

Delete returns a delete builder for Candle.

func (*CandleClient) DeleteOne

func (c *CandleClient) DeleteOne(ca *Candle) *CandleDeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*CandleClient) DeleteOneID

func (c *CandleClient) DeleteOneID(id uuid.UUID) *CandleDeleteOne

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

func (*CandleClient) Get

func (c *CandleClient) Get(ctx context.Context, id uuid.UUID) (*Candle, error)

Get returns a Candle entity by its id.

func (*CandleClient) GetX

func (c *CandleClient) GetX(ctx context.Context, id uuid.UUID) *Candle

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

func (*CandleClient) Hooks

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

Hooks returns the client hooks.

func (*CandleClient) Intercept

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

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

func (*CandleClient) Interceptors

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

Interceptors returns the client interceptors.

func (*CandleClient) MapCreateBulk

func (c *CandleClient) MapCreateBulk(slice any, setFunc func(*CandleCreate, int)) *CandleCreateBulk

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

func (*CandleClient) Query

func (c *CandleClient) Query() *CandleQuery

Query returns a query builder for Candle.

func (*CandleClient) Update

func (c *CandleClient) Update() *CandleUpdate

Update returns an update builder for Candle.

func (*CandleClient) UpdateOne

func (c *CandleClient) UpdateOne(ca *Candle) *CandleUpdateOne

UpdateOne returns an update builder for the given entity.

func (*CandleClient) UpdateOneID

func (c *CandleClient) UpdateOneID(id uuid.UUID) *CandleUpdateOne

UpdateOneID returns an update builder for the given id.

func (*CandleClient) Use

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

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

type CandleCreate

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

CandleCreate is the builder for creating a Candle entity.

func (*CandleCreate) Exec

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

Exec executes the query.

func (*CandleCreate) ExecX

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

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

func (*CandleCreate) Mutation

func (cc *CandleCreate) Mutation() *CandleMutation

Mutation returns the CandleMutation object of the builder.

func (*CandleCreate) Save

func (cc *CandleCreate) Save(ctx context.Context) (*Candle, error)

Save creates the Candle in the database.

func (*CandleCreate) SaveX

func (cc *CandleCreate) SaveX(ctx context.Context) *Candle

SaveX calls Save and panics if Save returns an error.

func (*CandleCreate) SetClose

func (cc *CandleCreate) SetClose(f float64) *CandleCreate

SetClose sets the "close" field.

func (*CandleCreate) SetCreatedAt

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

SetCreatedAt sets the "created_at" field.

func (*CandleCreate) SetExchange

func (cc *CandleCreate) SetExchange(s string) *CandleCreate

SetExchange sets the "exchange" field.

func (*CandleCreate) SetHigh

func (cc *CandleCreate) SetHigh(f float64) *CandleCreate

SetHigh sets the "high" field.

func (*CandleCreate) SetID

func (cc *CandleCreate) SetID(u uuid.UUID) *CandleCreate

SetID sets the "id" field.

func (*CandleCreate) SetLow

func (cc *CandleCreate) SetLow(f float64) *CandleCreate

SetLow sets the "low" field.

func (*CandleCreate) SetNillableCreatedAt

func (cc *CandleCreate) SetNillableCreatedAt(t *time.Time) *CandleCreate

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

func (*CandleCreate) SetNillableID

func (cc *CandleCreate) SetNillableID(u *uuid.UUID) *CandleCreate

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

func (*CandleCreate) SetOpen

func (cc *CandleCreate) SetOpen(f float64) *CandleCreate

SetOpen sets the "open" field.

func (*CandleCreate) SetSymbol

func (cc *CandleCreate) SetSymbol(s string) *CandleCreate

SetSymbol sets the "symbol" field.

func (*CandleCreate) SetTimeframe

func (cc *CandleCreate) SetTimeframe(c candle.Timeframe) *CandleCreate

SetTimeframe sets the "timeframe" field.

func (*CandleCreate) SetTimestamp

func (cc *CandleCreate) SetTimestamp(i int64) *CandleCreate

SetTimestamp sets the "timestamp" field.

func (*CandleCreate) SetVolume

func (cc *CandleCreate) SetVolume(f float64) *CandleCreate

SetVolume sets the "volume" field.

type CandleCreateBulk

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

CandleCreateBulk is the builder for creating many Candle entities in bulk.

func (*CandleCreateBulk) Exec

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

Exec executes the query.

func (*CandleCreateBulk) ExecX

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

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

func (*CandleCreateBulk) Save

func (ccb *CandleCreateBulk) Save(ctx context.Context) ([]*Candle, error)

Save creates the Candle entities in the database.

func (*CandleCreateBulk) SaveX

func (ccb *CandleCreateBulk) SaveX(ctx context.Context) []*Candle

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

type CandleDelete

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

CandleDelete is the builder for deleting a Candle entity.

func (*CandleDelete) Exec

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

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

func (*CandleDelete) ExecX

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

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

func (*CandleDelete) Where

func (cd *CandleDelete) Where(ps ...predicate.Candle) *CandleDelete

Where appends a list predicates to the CandleDelete builder.

type CandleDeleteOne

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

CandleDeleteOne is the builder for deleting a single Candle entity.

func (*CandleDeleteOne) Exec

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

Exec executes the deletion query.

func (*CandleDeleteOne) ExecX

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

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

func (*CandleDeleteOne) Where

func (cdo *CandleDeleteOne) Where(ps ...predicate.Candle) *CandleDeleteOne

Where appends a list predicates to the CandleDelete builder.

type CandleGroupBy

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

CandleGroupBy is the group-by builder for Candle entities.

func (*CandleGroupBy) Aggregate

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

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

func (*CandleGroupBy) Bool

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

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

func (*CandleGroupBy) BoolX

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

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

func (*CandleGroupBy) Bools

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

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

func (*CandleGroupBy) BoolsX

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

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

func (*CandleGroupBy) Float64

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

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

func (*CandleGroupBy) Float64X

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

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

func (*CandleGroupBy) Float64s

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

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

func (*CandleGroupBy) Float64sX

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

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

func (*CandleGroupBy) Int

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

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

func (*CandleGroupBy) IntX

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

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

func (*CandleGroupBy) Ints

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

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

func (*CandleGroupBy) IntsX

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

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

func (*CandleGroupBy) Scan

func (cgb *CandleGroupBy) Scan(ctx context.Context, v any) error

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

func (*CandleGroupBy) ScanX

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

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

func (*CandleGroupBy) String

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

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

func (*CandleGroupBy) StringX

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

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

func (*CandleGroupBy) Strings

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

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

func (*CandleGroupBy) StringsX

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

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

type CandleMutation

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

CandleMutation represents an operation that mutates the Candle nodes in the graph.

func (*CandleMutation) AddClose

func (m *CandleMutation) AddClose(f float64)

AddClose adds f to the "close" field.

func (*CandleMutation) AddField

func (m *CandleMutation) 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 (*CandleMutation) AddHigh

func (m *CandleMutation) AddHigh(f float64)

AddHigh adds f to the "high" field.

func (*CandleMutation) AddLow

func (m *CandleMutation) AddLow(f float64)

AddLow adds f to the "low" field.

func (*CandleMutation) AddOpen

func (m *CandleMutation) AddOpen(f float64)

AddOpen adds f to the "open" field.

func (*CandleMutation) AddTimestamp

func (m *CandleMutation) AddTimestamp(i int64)

AddTimestamp adds i to the "timestamp" field.

func (*CandleMutation) AddVolume

func (m *CandleMutation) AddVolume(f float64)

AddVolume adds f to the "volume" field.

func (*CandleMutation) AddedClose

func (m *CandleMutation) AddedClose() (r float64, exists bool)

AddedClose returns the value that was added to the "close" field in this mutation.

func (*CandleMutation) AddedEdges

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

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

func (*CandleMutation) AddedField

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

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

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

func (*CandleMutation) AddedHigh

func (m *CandleMutation) AddedHigh() (r float64, exists bool)

AddedHigh returns the value that was added to the "high" field in this mutation.

func (*CandleMutation) AddedIDs

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

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

func (*CandleMutation) AddedLow

func (m *CandleMutation) AddedLow() (r float64, exists bool)

AddedLow returns the value that was added to the "low" field in this mutation.

func (*CandleMutation) AddedOpen

func (m *CandleMutation) AddedOpen() (r float64, exists bool)

AddedOpen returns the value that was added to the "open" field in this mutation.

func (*CandleMutation) AddedTimestamp

func (m *CandleMutation) AddedTimestamp() (r int64, exists bool)

AddedTimestamp returns the value that was added to the "timestamp" field in this mutation.

func (*CandleMutation) AddedVolume

func (m *CandleMutation) AddedVolume() (r float64, exists bool)

AddedVolume returns the value that was added to the "volume" field in this mutation.

func (*CandleMutation) ClearEdge

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

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

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

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

func (*CandleMutation) ClearedFields

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

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

func (CandleMutation) Client

func (m CandleMutation) 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 (*CandleMutation) Close

func (m *CandleMutation) Close() (r float64, exists bool)

Close returns the value of the "close" field in the mutation.

func (*CandleMutation) CreatedAt

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

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

func (*CandleMutation) EdgeCleared

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

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

func (*CandleMutation) Exchange

func (m *CandleMutation) Exchange() (r string, exists bool)

Exchange returns the value of the "exchange" field in the mutation.

func (*CandleMutation) Field

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

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

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

func (*CandleMutation) Fields

func (m *CandleMutation) 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 (*CandleMutation) High

func (m *CandleMutation) High() (r float64, exists bool)

High returns the value of the "high" field in the mutation.

func (*CandleMutation) ID

func (m *CandleMutation) ID() (id uuid.UUID, exists bool)

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

func (*CandleMutation) IDs

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

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

func (*CandleMutation) Low

func (m *CandleMutation) Low() (r float64, exists bool)

Low returns the value of the "low" field in the mutation.

func (*CandleMutation) OldClose

func (m *CandleMutation) OldClose(ctx context.Context) (v float64, err error)

OldClose returns the old "close" field's value of the Candle entity. If the Candle 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 (*CandleMutation) OldCreatedAt

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

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

func (m *CandleMutation) OldExchange(ctx context.Context) (v string, err error)

OldExchange returns the old "exchange" field's value of the Candle entity. If the Candle 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 (*CandleMutation) OldField

func (m *CandleMutation) 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 (*CandleMutation) OldHigh

func (m *CandleMutation) OldHigh(ctx context.Context) (v float64, err error)

OldHigh returns the old "high" field's value of the Candle entity. If the Candle 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 (*CandleMutation) OldLow

func (m *CandleMutation) OldLow(ctx context.Context) (v float64, err error)

OldLow returns the old "low" field's value of the Candle entity. If the Candle 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 (*CandleMutation) OldOpen

func (m *CandleMutation) OldOpen(ctx context.Context) (v float64, err error)

OldOpen returns the old "open" field's value of the Candle entity. If the Candle 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 (*CandleMutation) OldSymbol

func (m *CandleMutation) OldSymbol(ctx context.Context) (v string, err error)

OldSymbol returns the old "symbol" field's value of the Candle entity. If the Candle 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 (*CandleMutation) OldTimeframe

func (m *CandleMutation) OldTimeframe(ctx context.Context) (v candle.Timeframe, err error)

OldTimeframe returns the old "timeframe" field's value of the Candle entity. If the Candle 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 (*CandleMutation) OldTimestamp

func (m *CandleMutation) OldTimestamp(ctx context.Context) (v int64, err error)

OldTimestamp returns the old "timestamp" field's value of the Candle entity. If the Candle 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 (*CandleMutation) OldVolume

func (m *CandleMutation) OldVolume(ctx context.Context) (v float64, err error)

OldVolume returns the old "volume" field's value of the Candle entity. If the Candle 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 (*CandleMutation) Op

func (m *CandleMutation) Op() Op

Op returns the operation name.

func (*CandleMutation) Open

func (m *CandleMutation) Open() (r float64, exists bool)

Open returns the value of the "open" field in the mutation.

func (*CandleMutation) RemovedEdges

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

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

func (*CandleMutation) RemovedIDs

func (m *CandleMutation) 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 (*CandleMutation) ResetClose

func (m *CandleMutation) ResetClose()

ResetClose resets all changes to the "close" field.

func (*CandleMutation) ResetCreatedAt

func (m *CandleMutation) ResetCreatedAt()

ResetCreatedAt resets all changes to the "created_at" field.

func (*CandleMutation) ResetEdge

func (m *CandleMutation) 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 (*CandleMutation) ResetExchange

func (m *CandleMutation) ResetExchange()

ResetExchange resets all changes to the "exchange" field.

func (*CandleMutation) ResetField

func (m *CandleMutation) 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 (*CandleMutation) ResetHigh

func (m *CandleMutation) ResetHigh()

ResetHigh resets all changes to the "high" field.

func (*CandleMutation) ResetLow

func (m *CandleMutation) ResetLow()

ResetLow resets all changes to the "low" field.

func (*CandleMutation) ResetOpen

func (m *CandleMutation) ResetOpen()

ResetOpen resets all changes to the "open" field.

func (*CandleMutation) ResetSymbol

func (m *CandleMutation) ResetSymbol()

ResetSymbol resets all changes to the "symbol" field.

func (*CandleMutation) ResetTimeframe

func (m *CandleMutation) ResetTimeframe()

ResetTimeframe resets all changes to the "timeframe" field.

func (*CandleMutation) ResetTimestamp

func (m *CandleMutation) ResetTimestamp()

ResetTimestamp resets all changes to the "timestamp" field.

func (*CandleMutation) ResetVolume

func (m *CandleMutation) ResetVolume()

ResetVolume resets all changes to the "volume" field.

func (*CandleMutation) SetClose

func (m *CandleMutation) SetClose(f float64)

SetClose sets the "close" field.

func (*CandleMutation) SetCreatedAt

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

SetCreatedAt sets the "created_at" field.

func (*CandleMutation) SetExchange

func (m *CandleMutation) SetExchange(s string)

SetExchange sets the "exchange" field.

func (*CandleMutation) SetField

func (m *CandleMutation) 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 (*CandleMutation) SetHigh

func (m *CandleMutation) SetHigh(f float64)

SetHigh sets the "high" field.

func (*CandleMutation) SetID

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

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

func (*CandleMutation) SetLow

func (m *CandleMutation) SetLow(f float64)

SetLow sets the "low" field.

func (*CandleMutation) SetOp

func (m *CandleMutation) SetOp(op Op)

SetOp allows setting the mutation operation.

func (*CandleMutation) SetOpen

func (m *CandleMutation) SetOpen(f float64)

SetOpen sets the "open" field.

func (*CandleMutation) SetSymbol

func (m *CandleMutation) SetSymbol(s string)

SetSymbol sets the "symbol" field.

func (*CandleMutation) SetTimeframe

func (m *CandleMutation) SetTimeframe(c candle.Timeframe)

SetTimeframe sets the "timeframe" field.

func (*CandleMutation) SetTimestamp

func (m *CandleMutation) SetTimestamp(i int64)

SetTimestamp sets the "timestamp" field.

func (*CandleMutation) SetVolume

func (m *CandleMutation) SetVolume(f float64)

SetVolume sets the "volume" field.

func (*CandleMutation) Symbol

func (m *CandleMutation) Symbol() (r string, exists bool)

Symbol returns the value of the "symbol" field in the mutation.

func (*CandleMutation) Timeframe

func (m *CandleMutation) Timeframe() (r candle.Timeframe, exists bool)

Timeframe returns the value of the "timeframe" field in the mutation.

func (*CandleMutation) Timestamp

func (m *CandleMutation) Timestamp() (r int64, exists bool)

Timestamp returns the value of the "timestamp" field in the mutation.

func (CandleMutation) Tx

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

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

func (*CandleMutation) Type

func (m *CandleMutation) Type() string

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

func (*CandleMutation) Volume

func (m *CandleMutation) Volume() (r float64, exists bool)

Volume returns the value of the "volume" field in the mutation.

func (*CandleMutation) Where

func (m *CandleMutation) Where(ps ...predicate.Candle)

Where appends a list predicates to the CandleMutation builder.

func (*CandleMutation) WhereP

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

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

type CandleQuery

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

CandleQuery is the builder for querying Candle entities.

func (*CandleQuery) Aggregate

func (cq *CandleQuery) Aggregate(fns ...AggregateFunc) *CandleSelect

Aggregate returns a CandleSelect configured with the given aggregations.

func (*CandleQuery) All

func (cq *CandleQuery) All(ctx context.Context) ([]*Candle, error)

All executes the query and returns a list of Candles.

func (*CandleQuery) AllX

func (cq *CandleQuery) AllX(ctx context.Context) []*Candle

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

func (*CandleQuery) Clone

func (cq *CandleQuery) Clone() *CandleQuery

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

func (*CandleQuery) Count

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

Count returns the count of the given query.

func (*CandleQuery) CountX

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

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

func (*CandleQuery) Exist

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

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

func (*CandleQuery) ExistX

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

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

func (*CandleQuery) First

func (cq *CandleQuery) First(ctx context.Context) (*Candle, error)

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

func (*CandleQuery) FirstID

func (cq *CandleQuery) FirstID(ctx context.Context) (id uuid.UUID, err error)

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

func (*CandleQuery) FirstIDX

func (cq *CandleQuery) FirstIDX(ctx context.Context) uuid.UUID

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

func (*CandleQuery) FirstX

func (cq *CandleQuery) FirstX(ctx context.Context) *Candle

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

func (*CandleQuery) GroupBy

func (cq *CandleQuery) GroupBy(field string, fields ...string) *CandleGroupBy

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

client.Candle.Query().
	GroupBy(candle.FieldExchange).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*CandleQuery) IDs

func (cq *CandleQuery) IDs(ctx context.Context) (ids []uuid.UUID, err error)

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

func (*CandleQuery) IDsX

func (cq *CandleQuery) IDsX(ctx context.Context) []uuid.UUID

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

func (*CandleQuery) Limit

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

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

func (*CandleQuery) Offset

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

Offset to start from.

func (*CandleQuery) Only

func (cq *CandleQuery) Only(ctx context.Context) (*Candle, error)

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

func (*CandleQuery) OnlyID

func (cq *CandleQuery) OnlyID(ctx context.Context) (id uuid.UUID, err error)

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

func (*CandleQuery) OnlyIDX

func (cq *CandleQuery) OnlyIDX(ctx context.Context) uuid.UUID

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

func (*CandleQuery) OnlyX

func (cq *CandleQuery) OnlyX(ctx context.Context) *Candle

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

func (*CandleQuery) Order

func (cq *CandleQuery) Order(o ...candle.OrderOption) *CandleQuery

Order specifies how the records should be ordered.

func (*CandleQuery) Select

func (cq *CandleQuery) Select(fields ...string) *CandleSelect

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

client.Candle.Query().
	Select(candle.FieldExchange).
	Scan(ctx, &v)

func (*CandleQuery) Unique

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

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

func (cq *CandleQuery) Where(ps ...predicate.Candle) *CandleQuery

Where adds a new predicate for the CandleQuery builder.

type CandleSelect

type CandleSelect struct {
	*CandleQuery
	// contains filtered or unexported fields
}

CandleSelect is the builder for selecting fields of Candle entities.

func (*CandleSelect) Aggregate

func (cs *CandleSelect) Aggregate(fns ...AggregateFunc) *CandleSelect

Aggregate adds the given aggregation functions to the selector query.

func (*CandleSelect) Bool

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

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

func (*CandleSelect) BoolX

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

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

func (*CandleSelect) Bools

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

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

func (*CandleSelect) BoolsX

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

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

func (*CandleSelect) Float64

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

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

func (*CandleSelect) Float64X

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

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

func (*CandleSelect) Float64s

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

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

func (*CandleSelect) Float64sX

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

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

func (*CandleSelect) Int

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

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

func (*CandleSelect) IntX

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

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

func (*CandleSelect) Ints

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

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

func (*CandleSelect) IntsX

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

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

func (*CandleSelect) Scan

func (cs *CandleSelect) Scan(ctx context.Context, v any) error

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

func (*CandleSelect) ScanX

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

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

func (*CandleSelect) String

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

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

func (*CandleSelect) StringX

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

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

func (*CandleSelect) Strings

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

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

func (*CandleSelect) StringsX

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

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

type CandleUpdate

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

CandleUpdate is the builder for updating Candle entities.

func (*CandleUpdate) AddClose

func (cu *CandleUpdate) AddClose(f float64) *CandleUpdate

AddClose adds f to the "close" field.

func (*CandleUpdate) AddHigh

func (cu *CandleUpdate) AddHigh(f float64) *CandleUpdate

AddHigh adds f to the "high" field.

func (*CandleUpdate) AddLow

func (cu *CandleUpdate) AddLow(f float64) *CandleUpdate

AddLow adds f to the "low" field.

func (*CandleUpdate) AddOpen

func (cu *CandleUpdate) AddOpen(f float64) *CandleUpdate

AddOpen adds f to the "open" field.

func (*CandleUpdate) AddTimestamp

func (cu *CandleUpdate) AddTimestamp(i int64) *CandleUpdate

AddTimestamp adds i to the "timestamp" field.

func (*CandleUpdate) AddVolume

func (cu *CandleUpdate) AddVolume(f float64) *CandleUpdate

AddVolume adds f to the "volume" field.

func (*CandleUpdate) Exec

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

Exec executes the query.

func (*CandleUpdate) ExecX

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

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

func (*CandleUpdate) Mutation

func (cu *CandleUpdate) Mutation() *CandleMutation

Mutation returns the CandleMutation object of the builder.

func (*CandleUpdate) Save

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

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

func (*CandleUpdate) SaveX

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

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

func (*CandleUpdate) SetClose

func (cu *CandleUpdate) SetClose(f float64) *CandleUpdate

SetClose sets the "close" field.

func (*CandleUpdate) SetCreatedAt

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

SetCreatedAt sets the "created_at" field.

func (*CandleUpdate) SetExchange

func (cu *CandleUpdate) SetExchange(s string) *CandleUpdate

SetExchange sets the "exchange" field.

func (*CandleUpdate) SetHigh

func (cu *CandleUpdate) SetHigh(f float64) *CandleUpdate

SetHigh sets the "high" field.

func (*CandleUpdate) SetLow

func (cu *CandleUpdate) SetLow(f float64) *CandleUpdate

SetLow sets the "low" field.

func (*CandleUpdate) SetNillableClose

func (cu *CandleUpdate) SetNillableClose(f *float64) *CandleUpdate

SetNillableClose sets the "close" field if the given value is not nil.

func (*CandleUpdate) SetNillableCreatedAt

func (cu *CandleUpdate) SetNillableCreatedAt(t *time.Time) *CandleUpdate

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

func (*CandleUpdate) SetNillableExchange

func (cu *CandleUpdate) SetNillableExchange(s *string) *CandleUpdate

SetNillableExchange sets the "exchange" field if the given value is not nil.

func (*CandleUpdate) SetNillableHigh

func (cu *CandleUpdate) SetNillableHigh(f *float64) *CandleUpdate

SetNillableHigh sets the "high" field if the given value is not nil.

func (*CandleUpdate) SetNillableLow

func (cu *CandleUpdate) SetNillableLow(f *float64) *CandleUpdate

SetNillableLow sets the "low" field if the given value is not nil.

func (*CandleUpdate) SetNillableOpen

func (cu *CandleUpdate) SetNillableOpen(f *float64) *CandleUpdate

SetNillableOpen sets the "open" field if the given value is not nil.

func (*CandleUpdate) SetNillableSymbol

func (cu *CandleUpdate) SetNillableSymbol(s *string) *CandleUpdate

SetNillableSymbol sets the "symbol" field if the given value is not nil.

func (*CandleUpdate) SetNillableTimeframe

func (cu *CandleUpdate) SetNillableTimeframe(c *candle.Timeframe) *CandleUpdate

SetNillableTimeframe sets the "timeframe" field if the given value is not nil.

func (*CandleUpdate) SetNillableTimestamp

func (cu *CandleUpdate) SetNillableTimestamp(i *int64) *CandleUpdate

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

func (*CandleUpdate) SetNillableVolume

func (cu *CandleUpdate) SetNillableVolume(f *float64) *CandleUpdate

SetNillableVolume sets the "volume" field if the given value is not nil.

func (*CandleUpdate) SetOpen

func (cu *CandleUpdate) SetOpen(f float64) *CandleUpdate

SetOpen sets the "open" field.

func (*CandleUpdate) SetSymbol

func (cu *CandleUpdate) SetSymbol(s string) *CandleUpdate

SetSymbol sets the "symbol" field.

func (*CandleUpdate) SetTimeframe

func (cu *CandleUpdate) SetTimeframe(c candle.Timeframe) *CandleUpdate

SetTimeframe sets the "timeframe" field.

func (*CandleUpdate) SetTimestamp

func (cu *CandleUpdate) SetTimestamp(i int64) *CandleUpdate

SetTimestamp sets the "timestamp" field.

func (*CandleUpdate) SetVolume

func (cu *CandleUpdate) SetVolume(f float64) *CandleUpdate

SetVolume sets the "volume" field.

func (*CandleUpdate) Where

func (cu *CandleUpdate) Where(ps ...predicate.Candle) *CandleUpdate

Where appends a list predicates to the CandleUpdate builder.

type CandleUpdateOne

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

CandleUpdateOne is the builder for updating a single Candle entity.

func (*CandleUpdateOne) AddClose

func (cuo *CandleUpdateOne) AddClose(f float64) *CandleUpdateOne

AddClose adds f to the "close" field.

func (*CandleUpdateOne) AddHigh

func (cuo *CandleUpdateOne) AddHigh(f float64) *CandleUpdateOne

AddHigh adds f to the "high" field.

func (*CandleUpdateOne) AddLow

func (cuo *CandleUpdateOne) AddLow(f float64) *CandleUpdateOne

AddLow adds f to the "low" field.

func (*CandleUpdateOne) AddOpen

func (cuo *CandleUpdateOne) AddOpen(f float64) *CandleUpdateOne

AddOpen adds f to the "open" field.

func (*CandleUpdateOne) AddTimestamp

func (cuo *CandleUpdateOne) AddTimestamp(i int64) *CandleUpdateOne

AddTimestamp adds i to the "timestamp" field.

func (*CandleUpdateOne) AddVolume

func (cuo *CandleUpdateOne) AddVolume(f float64) *CandleUpdateOne

AddVolume adds f to the "volume" field.

func (*CandleUpdateOne) Exec

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

Exec executes the query on the entity.

func (*CandleUpdateOne) ExecX

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

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

func (*CandleUpdateOne) Mutation

func (cuo *CandleUpdateOne) Mutation() *CandleMutation

Mutation returns the CandleMutation object of the builder.

func (*CandleUpdateOne) Save

func (cuo *CandleUpdateOne) Save(ctx context.Context) (*Candle, error)

Save executes the query and returns the updated Candle entity.

func (*CandleUpdateOne) SaveX

func (cuo *CandleUpdateOne) SaveX(ctx context.Context) *Candle

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

func (*CandleUpdateOne) Select

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

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

func (*CandleUpdateOne) SetClose

func (cuo *CandleUpdateOne) SetClose(f float64) *CandleUpdateOne

SetClose sets the "close" field.

func (*CandleUpdateOne) SetCreatedAt

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

SetCreatedAt sets the "created_at" field.

func (*CandleUpdateOne) SetExchange

func (cuo *CandleUpdateOne) SetExchange(s string) *CandleUpdateOne

SetExchange sets the "exchange" field.

func (*CandleUpdateOne) SetHigh

func (cuo *CandleUpdateOne) SetHigh(f float64) *CandleUpdateOne

SetHigh sets the "high" field.

func (*CandleUpdateOne) SetLow

func (cuo *CandleUpdateOne) SetLow(f float64) *CandleUpdateOne

SetLow sets the "low" field.

func (*CandleUpdateOne) SetNillableClose

func (cuo *CandleUpdateOne) SetNillableClose(f *float64) *CandleUpdateOne

SetNillableClose sets the "close" field if the given value is not nil.

func (*CandleUpdateOne) SetNillableCreatedAt

func (cuo *CandleUpdateOne) SetNillableCreatedAt(t *time.Time) *CandleUpdateOne

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

func (*CandleUpdateOne) SetNillableExchange

func (cuo *CandleUpdateOne) SetNillableExchange(s *string) *CandleUpdateOne

SetNillableExchange sets the "exchange" field if the given value is not nil.

func (*CandleUpdateOne) SetNillableHigh

func (cuo *CandleUpdateOne) SetNillableHigh(f *float64) *CandleUpdateOne

SetNillableHigh sets the "high" field if the given value is not nil.

func (*CandleUpdateOne) SetNillableLow

func (cuo *CandleUpdateOne) SetNillableLow(f *float64) *CandleUpdateOne

SetNillableLow sets the "low" field if the given value is not nil.

func (*CandleUpdateOne) SetNillableOpen

func (cuo *CandleUpdateOne) SetNillableOpen(f *float64) *CandleUpdateOne

SetNillableOpen sets the "open" field if the given value is not nil.

func (*CandleUpdateOne) SetNillableSymbol

func (cuo *CandleUpdateOne) SetNillableSymbol(s *string) *CandleUpdateOne

SetNillableSymbol sets the "symbol" field if the given value is not nil.

func (*CandleUpdateOne) SetNillableTimeframe

func (cuo *CandleUpdateOne) SetNillableTimeframe(c *candle.Timeframe) *CandleUpdateOne

SetNillableTimeframe sets the "timeframe" field if the given value is not nil.

func (*CandleUpdateOne) SetNillableTimestamp

func (cuo *CandleUpdateOne) SetNillableTimestamp(i *int64) *CandleUpdateOne

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

func (*CandleUpdateOne) SetNillableVolume

func (cuo *CandleUpdateOne) SetNillableVolume(f *float64) *CandleUpdateOne

SetNillableVolume sets the "volume" field if the given value is not nil.

func (*CandleUpdateOne) SetOpen

func (cuo *CandleUpdateOne) SetOpen(f float64) *CandleUpdateOne

SetOpen sets the "open" field.

func (*CandleUpdateOne) SetSymbol

func (cuo *CandleUpdateOne) SetSymbol(s string) *CandleUpdateOne

SetSymbol sets the "symbol" field.

func (*CandleUpdateOne) SetTimeframe

func (cuo *CandleUpdateOne) SetTimeframe(c candle.Timeframe) *CandleUpdateOne

SetTimeframe sets the "timeframe" field.

func (*CandleUpdateOne) SetTimestamp

func (cuo *CandleUpdateOne) SetTimestamp(i int64) *CandleUpdateOne

SetTimestamp sets the "timestamp" field.

func (*CandleUpdateOne) SetVolume

func (cuo *CandleUpdateOne) SetVolume(f float64) *CandleUpdateOne

SetVolume sets the "volume" field.

func (*CandleUpdateOne) Where

func (cuo *CandleUpdateOne) Where(ps ...predicate.Candle) *CandleUpdateOne

Where appends a list predicates to the CandleUpdate builder.

type Candles

type Candles []*Candle

Candles is a parsable slice of Candle.

type Client

type Client struct {

	// Schema is the client for creating, migrating and dropping schema.
	Schema *migrate.Schema
	// ActiveSession is the client for interacting with the ActiveSession builders.
	ActiveSession *ActiveSessionClient
	// Candle is the client for interacting with the Candle builders.
	Candle *CandleClient
	// 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().
	ActiveSession.
	Query().
	Count(ctx)

func (*Client) Intercept

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

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

func (*Client) Mutate

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

Mutate implements the ent.Mutator interface.

func (*Client) Tx

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

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

func (*Client) Use

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

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

type CommitFunc

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

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

func (CommitFunc) Commit

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

Commit calls f(ctx, m).

type CommitHook

type CommitHook func(Committer) Committer

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

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

type Committer

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

Committer is the interface that wraps the Commit method.

type ConstraintError

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

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

func (ConstraintError) Error

func (e ConstraintError) Error() string

Error implements the error interface.

func (*ConstraintError) Unwrap

func (e *ConstraintError) Unwrap() error

Unwrap implements the errors.Wrapper interface.

type Hook

type Hook = ent.Hook

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

type InterceptFunc

type InterceptFunc = ent.InterceptFunc

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

type Interceptor

type Interceptor = ent.Interceptor

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

type MutateFunc

type MutateFunc = ent.MutateFunc

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

type Mutation

type Mutation = ent.Mutation

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

type Mutator

type Mutator = ent.Mutator

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

type NotFoundError

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

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

func (*NotFoundError) Error

func (e *NotFoundError) Error() string

Error implements the error interface.

type NotLoadedError

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

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

func (*NotLoadedError) Error

func (e *NotLoadedError) Error() string

Error implements the error interface.

type NotSingularError

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

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

func (*NotSingularError) Error

func (e *NotSingularError) Error() string

Error implements the error interface.

type Op

type Op = ent.Op

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

type Option

type Option func(*config)

Option function to configure the client.

func Debug

func Debug() Option

Debug enables debug logging on the ent.Driver.

func Driver

func Driver(driver dialect.Driver) Option

Driver configures the client driver.

func Log

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

Log sets the logging function for debug mode.

type OrderFunc

type OrderFunc func(*sql.Selector)

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

type Policy

type Policy = ent.Policy

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

type Querier

type Querier = ent.Querier

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

type QuerierFunc

type QuerierFunc = ent.QuerierFunc

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

type Query

type Query = ent.Query

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

type QueryContext

type QueryContext = ent.QueryContext

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

type RollbackFunc

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

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

func (RollbackFunc) Rollback

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

Rollback calls f(ctx, m).

type RollbackHook

type RollbackHook func(Rollbacker) Rollbacker

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

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

type Rollbacker

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

Rollbacker is the interface that wraps the Rollback method.

type TraverseFunc

type TraverseFunc = ent.TraverseFunc

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

type Traverser

type Traverser = ent.Traverser

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

type Tx

type Tx struct {

	// ActiveSession is the client for interacting with the ActiveSession builders.
	ActiveSession *ActiveSessionClient
	// Candle is the client for interacting with the Candle builders.
	Candle *CandleClient
	// 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