ent

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2025 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Overview

Package ent wraps generated and non-generated ent-related code.

Index

Constants

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

	// Node types.
	TypeTelegramChannel = "TelegramChannel"
	TypeTelegramSession = "TelegramSession"
)

Variables

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

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

Functions

func Asc

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

Asc applies the given fields in ASC order.

func Desc

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

Desc applies the given fields in DESC order.

func IsConstraintError

func IsConstraintError(err error) bool

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

func IsNotFound

func IsNotFound(err error) bool

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

func IsNotLoaded

func IsNotLoaded(err error) bool

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

func IsNotSingular

func IsNotSingular(err error) bool

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

func IsValidationError

func IsValidationError(err error) bool

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

func MaskNotFound

func MaskNotFound(err error) error

MaskNotFound masks not found error.

func NewContext

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

NewContext returns a new context with the given Client attached.

func NewTxContext

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

NewTxContext returns a new context with the given Tx attached.

Types

type AggregateFunc

type AggregateFunc func(*sql.Selector) string

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

func As

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

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

func Count

func Count() AggregateFunc

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

func Max

func Max(field string) AggregateFunc

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

func Mean

func Mean(field string) AggregateFunc

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

func Min

func Min(field string) AggregateFunc

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

func Sum

func Sum(field string) AggregateFunc

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

type Client

type Client struct {

	// Schema is the client for creating, migrating and dropping schema.
	Schema *migrate.Schema
	// TelegramChannel is the client for interacting with the TelegramChannel builders.
	TelegramChannel *TelegramChannelClient
	// TelegramSession is the client for interacting with the TelegramSession builders.
	TelegramSession *TelegramSessionClient
	// 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().
	TelegramChannel.
	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 TelegramChannel

type TelegramChannel struct {

	// ID of the ent.
	ID int64 `json:"id,omitempty"`
	// AccessHash holds the value of the "access_hash" field.
	AccessHash int64 `json:"access_hash,omitempty"`
	// Title holds the value of the "title" field.
	Title string `json:"title,omitempty"`
	// Active holds the value of the "active" field.
	Active bool `json:"active,omitempty"`
	// contains filtered or unexported fields
}

TelegramChannel is the model entity for the TelegramChannel schema.

func (*TelegramChannel) String

func (_m *TelegramChannel) String() string

String implements the fmt.Stringer.

func (*TelegramChannel) Unwrap

func (_m *TelegramChannel) Unwrap() *TelegramChannel

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

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

func (*TelegramChannel) Value

func (_m *TelegramChannel) Value(name string) (ent.Value, error)

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

type TelegramChannelClient

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

TelegramChannelClient is a client for the TelegramChannel schema.

func NewTelegramChannelClient

func NewTelegramChannelClient(c config) *TelegramChannelClient

NewTelegramChannelClient returns a client for the TelegramChannel from the given config.

func (*TelegramChannelClient) Create

Create returns a builder for creating a TelegramChannel entity.

func (*TelegramChannelClient) CreateBulk

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

func (*TelegramChannelClient) Delete

Delete returns a delete builder for TelegramChannel.

func (*TelegramChannelClient) DeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*TelegramChannelClient) DeleteOneID

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

func (*TelegramChannelClient) Get

Get returns a TelegramChannel entity by its id.

func (*TelegramChannelClient) GetX

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

func (*TelegramChannelClient) Hooks

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

Hooks returns the client hooks.

func (*TelegramChannelClient) Intercept

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

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

func (*TelegramChannelClient) Interceptors

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

Interceptors returns the client interceptors.

func (*TelegramChannelClient) MapCreateBulk

func (c *TelegramChannelClient) MapCreateBulk(slice any, setFunc func(*TelegramChannelCreate, int)) *TelegramChannelCreateBulk

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 (*TelegramChannelClient) Query

Query returns a query builder for TelegramChannel.

func (*TelegramChannelClient) Update

Update returns an update builder for TelegramChannel.

func (*TelegramChannelClient) UpdateOne

UpdateOne returns an update builder for the given entity.

func (*TelegramChannelClient) UpdateOneID

UpdateOneID returns an update builder for the given id.

func (*TelegramChannelClient) Use

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

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

type TelegramChannelCreate

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

TelegramChannelCreate is the builder for creating a TelegramChannel entity.

func (*TelegramChannelCreate) Exec

Exec executes the query.

func (*TelegramChannelCreate) ExecX

func (_c *TelegramChannelCreate) ExecX(ctx context.Context)

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

func (*TelegramChannelCreate) Mutation

Mutation returns the TelegramChannelMutation object of the builder.

func (*TelegramChannelCreate) OnConflict

OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause of the `INSERT` statement. For example:

client.TelegramChannel.Create().
	SetAccessHash(v).
	OnConflict(
		// Update the row with the new values
		// the was proposed for insertion.
		sql.ResolveWithNewValues(),
	).
	// Override some of the fields with custom
	// update values.
	Update(func(u *ent.TelegramChannelUpsert) {
		SetAccessHash(v+v).
	}).
	Exec(ctx)

func (*TelegramChannelCreate) OnConflictColumns

func (_c *TelegramChannelCreate) OnConflictColumns(columns ...string) *TelegramChannelUpsertOne

OnConflictColumns calls `OnConflict` and configures the columns as conflict target. Using this option is equivalent to using:

client.TelegramChannel.Create().
	OnConflict(sql.ConflictColumns(columns...)).
	Exec(ctx)

func (*TelegramChannelCreate) Save

Save creates the TelegramChannel in the database.

func (*TelegramChannelCreate) SaveX

SaveX calls Save and panics if Save returns an error.

func (*TelegramChannelCreate) SetAccessHash

func (_c *TelegramChannelCreate) SetAccessHash(v int64) *TelegramChannelCreate

SetAccessHash sets the "access_hash" field.

func (*TelegramChannelCreate) SetActive

SetActive sets the "active" field.

func (*TelegramChannelCreate) SetID

SetID sets the "id" field.

func (*TelegramChannelCreate) SetTitle

SetTitle sets the "title" field.

type TelegramChannelCreateBulk

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

TelegramChannelCreateBulk is the builder for creating many TelegramChannel entities in bulk.

func (*TelegramChannelCreateBulk) Exec

Exec executes the query.

func (*TelegramChannelCreateBulk) ExecX

func (_c *TelegramChannelCreateBulk) ExecX(ctx context.Context)

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

func (*TelegramChannelCreateBulk) OnConflict

OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause of the `INSERT` statement. For example:

client.TelegramChannel.CreateBulk(builders...).
	OnConflict(
		// Update the row with the new values
		// the was proposed for insertion.
		sql.ResolveWithNewValues(),
	).
	// Override some of the fields with custom
	// update values.
	Update(func(u *ent.TelegramChannelUpsert) {
		SetAccessHash(v+v).
	}).
	Exec(ctx)

func (*TelegramChannelCreateBulk) OnConflictColumns

func (_c *TelegramChannelCreateBulk) OnConflictColumns(columns ...string) *TelegramChannelUpsertBulk

OnConflictColumns calls `OnConflict` and configures the columns as conflict target. Using this option is equivalent to using:

client.TelegramChannel.Create().
	OnConflict(sql.ConflictColumns(columns...)).
	Exec(ctx)

func (*TelegramChannelCreateBulk) Save

Save creates the TelegramChannel entities in the database.

func (*TelegramChannelCreateBulk) SaveX

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

type TelegramChannelDelete

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

TelegramChannelDelete is the builder for deleting a TelegramChannel entity.

func (*TelegramChannelDelete) Exec

func (_d *TelegramChannelDelete) Exec(ctx context.Context) (int, error)

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

func (*TelegramChannelDelete) ExecX

func (_d *TelegramChannelDelete) ExecX(ctx context.Context) int

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

func (*TelegramChannelDelete) Where

Where appends a list predicates to the TelegramChannelDelete builder.

type TelegramChannelDeleteOne

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

TelegramChannelDeleteOne is the builder for deleting a single TelegramChannel entity.

func (*TelegramChannelDeleteOne) Exec

Exec executes the deletion query.

func (*TelegramChannelDeleteOne) ExecX

func (_d *TelegramChannelDeleteOne) ExecX(ctx context.Context)

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

func (*TelegramChannelDeleteOne) Where

Where appends a list predicates to the TelegramChannelDelete builder.

type TelegramChannelGroupBy

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

TelegramChannelGroupBy is the group-by builder for TelegramChannel entities.

func (*TelegramChannelGroupBy) Aggregate

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

func (*TelegramChannelGroupBy) Bool

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

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

func (*TelegramChannelGroupBy) BoolX

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

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

func (*TelegramChannelGroupBy) Bools

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

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

func (*TelegramChannelGroupBy) BoolsX

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

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

func (*TelegramChannelGroupBy) Float64

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

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

func (*TelegramChannelGroupBy) Float64X

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

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

func (*TelegramChannelGroupBy) Float64s

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

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

func (*TelegramChannelGroupBy) Float64sX

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

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

func (*TelegramChannelGroupBy) Int

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

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

func (*TelegramChannelGroupBy) IntX

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

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

func (*TelegramChannelGroupBy) Ints

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

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

func (*TelegramChannelGroupBy) IntsX

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

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

func (*TelegramChannelGroupBy) Scan

func (_g *TelegramChannelGroupBy) Scan(ctx context.Context, v any) error

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

func (*TelegramChannelGroupBy) ScanX

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

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

func (*TelegramChannelGroupBy) String

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

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

func (*TelegramChannelGroupBy) StringX

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

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

func (*TelegramChannelGroupBy) Strings

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

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

func (*TelegramChannelGroupBy) StringsX

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

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

type TelegramChannelMutation

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

TelegramChannelMutation represents an operation that mutates the TelegramChannel nodes in the graph.

func (*TelegramChannelMutation) AccessHash

func (m *TelegramChannelMutation) AccessHash() (r int64, exists bool)

AccessHash returns the value of the "access_hash" field in the mutation.

func (*TelegramChannelMutation) Active

func (m *TelegramChannelMutation) Active() (r bool, exists bool)

Active returns the value of the "active" field in the mutation.

func (*TelegramChannelMutation) AddAccessHash

func (m *TelegramChannelMutation) AddAccessHash(i int64)

AddAccessHash adds i to the "access_hash" field.

func (*TelegramChannelMutation) AddField

func (m *TelegramChannelMutation) 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 (*TelegramChannelMutation) AddedAccessHash

func (m *TelegramChannelMutation) AddedAccessHash() (r int64, exists bool)

AddedAccessHash returns the value that was added to the "access_hash" field in this mutation.

func (*TelegramChannelMutation) AddedEdges

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

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

func (*TelegramChannelMutation) AddedField

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

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

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

func (*TelegramChannelMutation) AddedIDs

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

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

func (*TelegramChannelMutation) ClearEdge

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

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

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

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

func (*TelegramChannelMutation) ClearedFields

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

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

func (TelegramChannelMutation) Client

func (m TelegramChannelMutation) 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 (*TelegramChannelMutation) EdgeCleared

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

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

func (*TelegramChannelMutation) Field

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

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

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

func (*TelegramChannelMutation) Fields

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

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

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

func (*TelegramChannelMutation) 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 (*TelegramChannelMutation) OldAccessHash

func (m *TelegramChannelMutation) OldAccessHash(ctx context.Context) (v int64, err error)

OldAccessHash returns the old "access_hash" field's value of the TelegramChannel entity. If the TelegramChannel 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 (*TelegramChannelMutation) OldActive

func (m *TelegramChannelMutation) OldActive(ctx context.Context) (v bool, err error)

OldActive returns the old "active" field's value of the TelegramChannel entity. If the TelegramChannel 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 (*TelegramChannelMutation) OldField

func (m *TelegramChannelMutation) 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 (*TelegramChannelMutation) OldTitle

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

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

func (m *TelegramChannelMutation) Op() Op

Op returns the operation name.

func (*TelegramChannelMutation) RemovedEdges

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

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

func (*TelegramChannelMutation) RemovedIDs

func (m *TelegramChannelMutation) 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 (*TelegramChannelMutation) ResetAccessHash

func (m *TelegramChannelMutation) ResetAccessHash()

ResetAccessHash resets all changes to the "access_hash" field.

func (*TelegramChannelMutation) ResetActive

func (m *TelegramChannelMutation) ResetActive()

ResetActive resets all changes to the "active" field.

func (*TelegramChannelMutation) ResetEdge

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

func (m *TelegramChannelMutation) 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 (*TelegramChannelMutation) ResetTitle

func (m *TelegramChannelMutation) ResetTitle()

ResetTitle resets all changes to the "title" field.

func (*TelegramChannelMutation) SetAccessHash

func (m *TelegramChannelMutation) SetAccessHash(i int64)

SetAccessHash sets the "access_hash" field.

func (*TelegramChannelMutation) SetActive

func (m *TelegramChannelMutation) SetActive(b bool)

SetActive sets the "active" field.

func (*TelegramChannelMutation) SetField

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

func (m *TelegramChannelMutation) SetID(id int64)

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

func (*TelegramChannelMutation) SetOp

func (m *TelegramChannelMutation) SetOp(op Op)

SetOp allows setting the mutation operation.

func (*TelegramChannelMutation) SetTitle

func (m *TelegramChannelMutation) SetTitle(s string)

SetTitle sets the "title" field.

func (*TelegramChannelMutation) Title

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

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

func (TelegramChannelMutation) Tx

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

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

func (*TelegramChannelMutation) Type

func (m *TelegramChannelMutation) Type() string

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

func (*TelegramChannelMutation) Where

Where appends a list predicates to the TelegramChannelMutation builder.

func (*TelegramChannelMutation) WhereP

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

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

type TelegramChannelQuery

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

TelegramChannelQuery is the builder for querying TelegramChannel entities.

func (*TelegramChannelQuery) Aggregate

Aggregate returns a TelegramChannelSelect configured with the given aggregations.

func (*TelegramChannelQuery) All

All executes the query and returns a list of TelegramChannels.

func (*TelegramChannelQuery) AllX

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

func (*TelegramChannelQuery) Clone

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

func (*TelegramChannelQuery) Count

func (_q *TelegramChannelQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*TelegramChannelQuery) CountX

func (_q *TelegramChannelQuery) CountX(ctx context.Context) int

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

func (*TelegramChannelQuery) Exist

func (_q *TelegramChannelQuery) Exist(ctx context.Context) (bool, error)

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

func (*TelegramChannelQuery) ExistX

func (_q *TelegramChannelQuery) ExistX(ctx context.Context) bool

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

func (*TelegramChannelQuery) First

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

func (*TelegramChannelQuery) FirstID

func (_q *TelegramChannelQuery) FirstID(ctx context.Context) (id int64, err error)

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

func (*TelegramChannelQuery) FirstIDX

func (_q *TelegramChannelQuery) FirstIDX(ctx context.Context) int64

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

func (*TelegramChannelQuery) FirstX

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

func (*TelegramChannelQuery) GroupBy

func (_q *TelegramChannelQuery) GroupBy(field string, fields ...string) *TelegramChannelGroupBy

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

client.TelegramChannel.Query().
	GroupBy(telegramchannel.FieldAccessHash).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*TelegramChannelQuery) IDs

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

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

func (*TelegramChannelQuery) IDsX

func (_q *TelegramChannelQuery) IDsX(ctx context.Context) []int64

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

func (*TelegramChannelQuery) Limit

func (_q *TelegramChannelQuery) Limit(limit int) *TelegramChannelQuery

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

func (*TelegramChannelQuery) Offset

func (_q *TelegramChannelQuery) Offset(offset int) *TelegramChannelQuery

Offset to start from.

func (*TelegramChannelQuery) Only

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

func (*TelegramChannelQuery) OnlyID

func (_q *TelegramChannelQuery) OnlyID(ctx context.Context) (id int64, err error)

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

func (*TelegramChannelQuery) OnlyIDX

func (_q *TelegramChannelQuery) OnlyIDX(ctx context.Context) int64

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

func (*TelegramChannelQuery) OnlyX

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

func (*TelegramChannelQuery) Order

Order specifies how the records should be ordered.

func (*TelegramChannelQuery) Select

func (_q *TelegramChannelQuery) Select(fields ...string) *TelegramChannelSelect

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

client.TelegramChannel.Query().
	Select(telegramchannel.FieldAccessHash).
	Scan(ctx, &v)

func (*TelegramChannelQuery) Unique

func (_q *TelegramChannelQuery) Unique(unique bool) *TelegramChannelQuery

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

Where adds a new predicate for the TelegramChannelQuery builder.

type TelegramChannelSelect

type TelegramChannelSelect struct {
	*TelegramChannelQuery
	// contains filtered or unexported fields
}

TelegramChannelSelect is the builder for selecting fields of TelegramChannel entities.

func (*TelegramChannelSelect) Aggregate

Aggregate adds the given aggregation functions to the selector query.

func (*TelegramChannelSelect) Bool

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

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

func (*TelegramChannelSelect) BoolX

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

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

func (*TelegramChannelSelect) Bools

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

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

func (*TelegramChannelSelect) BoolsX

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

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

func (*TelegramChannelSelect) Float64

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

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

func (*TelegramChannelSelect) Float64X

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

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

func (*TelegramChannelSelect) Float64s

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

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

func (*TelegramChannelSelect) Float64sX

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

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

func (*TelegramChannelSelect) Int

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

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

func (*TelegramChannelSelect) IntX

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

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

func (*TelegramChannelSelect) Ints

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

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

func (*TelegramChannelSelect) IntsX

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

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

func (*TelegramChannelSelect) Scan

func (_s *TelegramChannelSelect) Scan(ctx context.Context, v any) error

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

func (*TelegramChannelSelect) ScanX

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

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

func (*TelegramChannelSelect) String

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

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

func (*TelegramChannelSelect) StringX

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

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

func (*TelegramChannelSelect) Strings

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

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

func (*TelegramChannelSelect) StringsX

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

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

type TelegramChannelUpdate

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

TelegramChannelUpdate is the builder for updating TelegramChannel entities.

func (*TelegramChannelUpdate) AddAccessHash

func (_u *TelegramChannelUpdate) AddAccessHash(v int64) *TelegramChannelUpdate

AddAccessHash adds value to the "access_hash" field.

func (*TelegramChannelUpdate) Exec

Exec executes the query.

func (*TelegramChannelUpdate) ExecX

func (_u *TelegramChannelUpdate) ExecX(ctx context.Context)

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

func (*TelegramChannelUpdate) Mutation

Mutation returns the TelegramChannelMutation object of the builder.

func (*TelegramChannelUpdate) Save

func (_u *TelegramChannelUpdate) Save(ctx context.Context) (int, error)

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

func (*TelegramChannelUpdate) SaveX

func (_u *TelegramChannelUpdate) SaveX(ctx context.Context) int

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

func (*TelegramChannelUpdate) SetAccessHash

func (_u *TelegramChannelUpdate) SetAccessHash(v int64) *TelegramChannelUpdate

SetAccessHash sets the "access_hash" field.

func (*TelegramChannelUpdate) SetActive

SetActive sets the "active" field.

func (*TelegramChannelUpdate) SetNillableAccessHash

func (_u *TelegramChannelUpdate) SetNillableAccessHash(v *int64) *TelegramChannelUpdate

SetNillableAccessHash sets the "access_hash" field if the given value is not nil.

func (*TelegramChannelUpdate) SetNillableActive

func (_u *TelegramChannelUpdate) SetNillableActive(v *bool) *TelegramChannelUpdate

SetNillableActive sets the "active" field if the given value is not nil.

func (*TelegramChannelUpdate) SetNillableTitle

func (_u *TelegramChannelUpdate) SetNillableTitle(v *string) *TelegramChannelUpdate

SetNillableTitle sets the "title" field if the given value is not nil.

func (*TelegramChannelUpdate) SetTitle

SetTitle sets the "title" field.

func (*TelegramChannelUpdate) Where

Where appends a list predicates to the TelegramChannelUpdate builder.

type TelegramChannelUpdateOne

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

TelegramChannelUpdateOne is the builder for updating a single TelegramChannel entity.

func (*TelegramChannelUpdateOne) AddAccessHash

AddAccessHash adds value to the "access_hash" field.

func (*TelegramChannelUpdateOne) Exec

Exec executes the query on the entity.

func (*TelegramChannelUpdateOne) ExecX

func (_u *TelegramChannelUpdateOne) ExecX(ctx context.Context)

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

func (*TelegramChannelUpdateOne) Mutation

Mutation returns the TelegramChannelMutation object of the builder.

func (*TelegramChannelUpdateOne) Save

Save executes the query and returns the updated TelegramChannel entity.

func (*TelegramChannelUpdateOne) SaveX

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

func (*TelegramChannelUpdateOne) Select

func (_u *TelegramChannelUpdateOne) Select(field string, fields ...string) *TelegramChannelUpdateOne

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

func (*TelegramChannelUpdateOne) SetAccessHash

SetAccessHash sets the "access_hash" field.

func (*TelegramChannelUpdateOne) SetActive

SetActive sets the "active" field.

func (*TelegramChannelUpdateOne) SetNillableAccessHash

func (_u *TelegramChannelUpdateOne) SetNillableAccessHash(v *int64) *TelegramChannelUpdateOne

SetNillableAccessHash sets the "access_hash" field if the given value is not nil.

func (*TelegramChannelUpdateOne) SetNillableActive

func (_u *TelegramChannelUpdateOne) SetNillableActive(v *bool) *TelegramChannelUpdateOne

SetNillableActive sets the "active" field if the given value is not nil.

func (*TelegramChannelUpdateOne) SetNillableTitle

func (_u *TelegramChannelUpdateOne) SetNillableTitle(v *string) *TelegramChannelUpdateOne

SetNillableTitle sets the "title" field if the given value is not nil.

func (*TelegramChannelUpdateOne) SetTitle

SetTitle sets the "title" field.

func (*TelegramChannelUpdateOne) Where

Where appends a list predicates to the TelegramChannelUpdate builder.

type TelegramChannelUpsert

type TelegramChannelUpsert struct {
	*sql.UpdateSet
}

TelegramChannelUpsert is the "OnConflict" setter.

func (*TelegramChannelUpsert) AddAccessHash

func (u *TelegramChannelUpsert) AddAccessHash(v int64) *TelegramChannelUpsert

AddAccessHash adds v to the "access_hash" field.

func (*TelegramChannelUpsert) SetAccessHash

func (u *TelegramChannelUpsert) SetAccessHash(v int64) *TelegramChannelUpsert

SetAccessHash sets the "access_hash" field.

func (*TelegramChannelUpsert) SetActive

SetActive sets the "active" field.

func (*TelegramChannelUpsert) SetTitle

SetTitle sets the "title" field.

func (*TelegramChannelUpsert) UpdateAccessHash

func (u *TelegramChannelUpsert) UpdateAccessHash() *TelegramChannelUpsert

UpdateAccessHash sets the "access_hash" field to the value that was provided on create.

func (*TelegramChannelUpsert) UpdateActive

func (u *TelegramChannelUpsert) UpdateActive() *TelegramChannelUpsert

UpdateActive sets the "active" field to the value that was provided on create.

func (*TelegramChannelUpsert) UpdateTitle

func (u *TelegramChannelUpsert) UpdateTitle() *TelegramChannelUpsert

UpdateTitle sets the "title" field to the value that was provided on create.

type TelegramChannelUpsertBulk

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

TelegramChannelUpsertBulk is the builder for "upsert"-ing a bulk of TelegramChannel nodes.

func (*TelegramChannelUpsertBulk) AddAccessHash

AddAccessHash adds v to the "access_hash" field.

func (*TelegramChannelUpsertBulk) DoNothing

DoNothing configures the conflict_action to `DO NOTHING`. Supported only by SQLite and PostgreSQL.

func (*TelegramChannelUpsertBulk) Exec

Exec executes the query.

func (*TelegramChannelUpsertBulk) ExecX

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

func (*TelegramChannelUpsertBulk) Ignore

Ignore sets each column to itself in case of conflict. Using this option is equivalent to using:

client.TelegramChannel.Create().
	OnConflict(sql.ResolveWithIgnore()).
	Exec(ctx)

func (*TelegramChannelUpsertBulk) SetAccessHash

SetAccessHash sets the "access_hash" field.

func (*TelegramChannelUpsertBulk) SetActive

SetActive sets the "active" field.

func (*TelegramChannelUpsertBulk) SetTitle

SetTitle sets the "title" field.

func (*TelegramChannelUpsertBulk) Update

Update allows overriding fields `UPDATE` values. See the TelegramChannelCreateBulk.OnConflict documentation for more info.

func (*TelegramChannelUpsertBulk) UpdateAccessHash

UpdateAccessHash sets the "access_hash" field to the value that was provided on create.

func (*TelegramChannelUpsertBulk) UpdateActive

UpdateActive sets the "active" field to the value that was provided on create.

func (*TelegramChannelUpsertBulk) UpdateNewValues

UpdateNewValues updates the mutable fields using the new values that were set on create. Using this option is equivalent to using:

client.TelegramChannel.Create().
	OnConflict(
		sql.ResolveWithNewValues(),
		sql.ResolveWith(func(u *sql.UpdateSet) {
			u.SetIgnore(telegramchannel.FieldID)
		}),
	).
	Exec(ctx)

func (*TelegramChannelUpsertBulk) UpdateTitle

UpdateTitle sets the "title" field to the value that was provided on create.

type TelegramChannelUpsertOne

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

TelegramChannelUpsertOne is the builder for "upsert"-ing

one TelegramChannel node.

func (*TelegramChannelUpsertOne) AddAccessHash

AddAccessHash adds v to the "access_hash" field.

func (*TelegramChannelUpsertOne) DoNothing

DoNothing configures the conflict_action to `DO NOTHING`. Supported only by SQLite and PostgreSQL.

func (*TelegramChannelUpsertOne) Exec

Exec executes the query.

func (*TelegramChannelUpsertOne) ExecX

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

func (*TelegramChannelUpsertOne) ID

func (u *TelegramChannelUpsertOne) ID(ctx context.Context) (id int64, err error)

Exec executes the UPSERT query and returns the inserted/updated ID.

func (*TelegramChannelUpsertOne) IDX

IDX is like ID, but panics if an error occurs.

func (*TelegramChannelUpsertOne) Ignore

Ignore sets each column to itself in case of conflict. Using this option is equivalent to using:

client.TelegramChannel.Create().
    OnConflict(sql.ResolveWithIgnore()).
    Exec(ctx)

func (*TelegramChannelUpsertOne) SetAccessHash

SetAccessHash sets the "access_hash" field.

func (*TelegramChannelUpsertOne) SetActive

SetActive sets the "active" field.

func (*TelegramChannelUpsertOne) SetTitle

SetTitle sets the "title" field.

func (*TelegramChannelUpsertOne) Update

Update allows overriding fields `UPDATE` values. See the TelegramChannelCreate.OnConflict documentation for more info.

func (*TelegramChannelUpsertOne) UpdateAccessHash

func (u *TelegramChannelUpsertOne) UpdateAccessHash() *TelegramChannelUpsertOne

UpdateAccessHash sets the "access_hash" field to the value that was provided on create.

func (*TelegramChannelUpsertOne) UpdateActive

UpdateActive sets the "active" field to the value that was provided on create.

func (*TelegramChannelUpsertOne) UpdateNewValues

func (u *TelegramChannelUpsertOne) UpdateNewValues() *TelegramChannelUpsertOne

UpdateNewValues updates the mutable fields using the new values that were set on create except the ID field. Using this option is equivalent to using:

client.TelegramChannel.Create().
	OnConflict(
		sql.ResolveWithNewValues(),
		sql.ResolveWith(func(u *sql.UpdateSet) {
			u.SetIgnore(telegramchannel.FieldID)
		}),
	).
	Exec(ctx)

func (*TelegramChannelUpsertOne) UpdateTitle

UpdateTitle sets the "title" field to the value that was provided on create.

type TelegramChannels

type TelegramChannels []*TelegramChannel

TelegramChannels is a parsable slice of TelegramChannel.

type TelegramSession

type TelegramSession struct {

	// ID of the ent.
	ID int `json:"id,omitempty"`
	// Data holds the value of the "data" field.
	Data []byte `json:"data,omitempty"`
	// contains filtered or unexported fields
}

TelegramSession is the model entity for the TelegramSession schema.

func (*TelegramSession) String

func (_m *TelegramSession) String() string

String implements the fmt.Stringer.

func (*TelegramSession) Unwrap

func (_m *TelegramSession) Unwrap() *TelegramSession

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

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

func (*TelegramSession) Value

func (_m *TelegramSession) Value(name string) (ent.Value, error)

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

type TelegramSessionClient

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

TelegramSessionClient is a client for the TelegramSession schema.

func NewTelegramSessionClient

func NewTelegramSessionClient(c config) *TelegramSessionClient

NewTelegramSessionClient returns a client for the TelegramSession from the given config.

func (*TelegramSessionClient) Create

Create returns a builder for creating a TelegramSession entity.

func (*TelegramSessionClient) CreateBulk

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

func (*TelegramSessionClient) Delete

Delete returns a delete builder for TelegramSession.

func (*TelegramSessionClient) DeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*TelegramSessionClient) DeleteOneID

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

func (*TelegramSessionClient) Get

Get returns a TelegramSession entity by its id.

func (*TelegramSessionClient) GetX

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

func (*TelegramSessionClient) Hooks

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

Hooks returns the client hooks.

func (*TelegramSessionClient) Intercept

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

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

func (*TelegramSessionClient) Interceptors

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

Interceptors returns the client interceptors.

func (*TelegramSessionClient) MapCreateBulk

func (c *TelegramSessionClient) MapCreateBulk(slice any, setFunc func(*TelegramSessionCreate, int)) *TelegramSessionCreateBulk

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 (*TelegramSessionClient) Query

Query returns a query builder for TelegramSession.

func (*TelegramSessionClient) Update

Update returns an update builder for TelegramSession.

func (*TelegramSessionClient) UpdateOne

UpdateOne returns an update builder for the given entity.

func (*TelegramSessionClient) UpdateOneID

UpdateOneID returns an update builder for the given id.

func (*TelegramSessionClient) Use

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

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

type TelegramSessionCreate

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

TelegramSessionCreate is the builder for creating a TelegramSession entity.

func (*TelegramSessionCreate) Exec

Exec executes the query.

func (*TelegramSessionCreate) ExecX

func (_c *TelegramSessionCreate) ExecX(ctx context.Context)

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

func (*TelegramSessionCreate) Mutation

Mutation returns the TelegramSessionMutation object of the builder.

func (*TelegramSessionCreate) OnConflict

OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause of the `INSERT` statement. For example:

client.TelegramSession.Create().
	SetData(v).
	OnConflict(
		// Update the row with the new values
		// the was proposed for insertion.
		sql.ResolveWithNewValues(),
	).
	// Override some of the fields with custom
	// update values.
	Update(func(u *ent.TelegramSessionUpsert) {
		SetData(v+v).
	}).
	Exec(ctx)

func (*TelegramSessionCreate) OnConflictColumns

func (_c *TelegramSessionCreate) OnConflictColumns(columns ...string) *TelegramSessionUpsertOne

OnConflictColumns calls `OnConflict` and configures the columns as conflict target. Using this option is equivalent to using:

client.TelegramSession.Create().
	OnConflict(sql.ConflictColumns(columns...)).
	Exec(ctx)

func (*TelegramSessionCreate) Save

Save creates the TelegramSession in the database.

func (*TelegramSessionCreate) SaveX

SaveX calls Save and panics if Save returns an error.

func (*TelegramSessionCreate) SetData

SetData sets the "data" field.

func (*TelegramSessionCreate) SetID

SetID sets the "id" field.

type TelegramSessionCreateBulk

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

TelegramSessionCreateBulk is the builder for creating many TelegramSession entities in bulk.

func (*TelegramSessionCreateBulk) Exec

Exec executes the query.

func (*TelegramSessionCreateBulk) ExecX

func (_c *TelegramSessionCreateBulk) ExecX(ctx context.Context)

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

func (*TelegramSessionCreateBulk) OnConflict

OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause of the `INSERT` statement. For example:

client.TelegramSession.CreateBulk(builders...).
	OnConflict(
		// Update the row with the new values
		// the was proposed for insertion.
		sql.ResolveWithNewValues(),
	).
	// Override some of the fields with custom
	// update values.
	Update(func(u *ent.TelegramSessionUpsert) {
		SetData(v+v).
	}).
	Exec(ctx)

func (*TelegramSessionCreateBulk) OnConflictColumns

func (_c *TelegramSessionCreateBulk) OnConflictColumns(columns ...string) *TelegramSessionUpsertBulk

OnConflictColumns calls `OnConflict` and configures the columns as conflict target. Using this option is equivalent to using:

client.TelegramSession.Create().
	OnConflict(sql.ConflictColumns(columns...)).
	Exec(ctx)

func (*TelegramSessionCreateBulk) Save

Save creates the TelegramSession entities in the database.

func (*TelegramSessionCreateBulk) SaveX

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

type TelegramSessionDelete

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

TelegramSessionDelete is the builder for deleting a TelegramSession entity.

func (*TelegramSessionDelete) Exec

func (_d *TelegramSessionDelete) Exec(ctx context.Context) (int, error)

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

func (*TelegramSessionDelete) ExecX

func (_d *TelegramSessionDelete) ExecX(ctx context.Context) int

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

func (*TelegramSessionDelete) Where

Where appends a list predicates to the TelegramSessionDelete builder.

type TelegramSessionDeleteOne

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

TelegramSessionDeleteOne is the builder for deleting a single TelegramSession entity.

func (*TelegramSessionDeleteOne) Exec

Exec executes the deletion query.

func (*TelegramSessionDeleteOne) ExecX

func (_d *TelegramSessionDeleteOne) ExecX(ctx context.Context)

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

func (*TelegramSessionDeleteOne) Where

Where appends a list predicates to the TelegramSessionDelete builder.

type TelegramSessionGroupBy

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

TelegramSessionGroupBy is the group-by builder for TelegramSession entities.

func (*TelegramSessionGroupBy) Aggregate

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

func (*TelegramSessionGroupBy) Bool

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

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

func (*TelegramSessionGroupBy) BoolX

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

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

func (*TelegramSessionGroupBy) Bools

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

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

func (*TelegramSessionGroupBy) BoolsX

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

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

func (*TelegramSessionGroupBy) Float64

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

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

func (*TelegramSessionGroupBy) Float64X

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

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

func (*TelegramSessionGroupBy) Float64s

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

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

func (*TelegramSessionGroupBy) Float64sX

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

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

func (*TelegramSessionGroupBy) Int

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

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

func (*TelegramSessionGroupBy) IntX

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

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

func (*TelegramSessionGroupBy) Ints

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

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

func (*TelegramSessionGroupBy) IntsX

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

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

func (*TelegramSessionGroupBy) Scan

func (_g *TelegramSessionGroupBy) Scan(ctx context.Context, v any) error

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

func (*TelegramSessionGroupBy) ScanX

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

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

func (*TelegramSessionGroupBy) String

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

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

func (*TelegramSessionGroupBy) StringX

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

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

func (*TelegramSessionGroupBy) Strings

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

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

func (*TelegramSessionGroupBy) StringsX

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

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

type TelegramSessionMutation

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

TelegramSessionMutation represents an operation that mutates the TelegramSession nodes in the graph.

func (*TelegramSessionMutation) AddField

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

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

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

func (*TelegramSessionMutation) AddedField

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

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

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

func (*TelegramSessionMutation) AddedIDs

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

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

func (*TelegramSessionMutation) ClearEdge

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

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

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

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

func (*TelegramSessionMutation) ClearedFields

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

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

func (TelegramSessionMutation) Client

func (m TelegramSessionMutation) 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 (*TelegramSessionMutation) Data

func (m *TelegramSessionMutation) Data() (r []byte, exists bool)

Data returns the value of the "data" field in the mutation.

func (*TelegramSessionMutation) EdgeCleared

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

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

func (*TelegramSessionMutation) Field

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

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

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

func (*TelegramSessionMutation) Fields

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

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

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

func (*TelegramSessionMutation) IDs

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

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

func (*TelegramSessionMutation) OldData

func (m *TelegramSessionMutation) OldData(ctx context.Context) (v []byte, err error)

OldData returns the old "data" field's value of the TelegramSession entity. If the TelegramSession 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 (*TelegramSessionMutation) OldField

func (m *TelegramSessionMutation) 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 (*TelegramSessionMutation) Op

func (m *TelegramSessionMutation) Op() Op

Op returns the operation name.

func (*TelegramSessionMutation) RemovedEdges

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

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

func (*TelegramSessionMutation) RemovedIDs

func (m *TelegramSessionMutation) 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 (*TelegramSessionMutation) ResetData

func (m *TelegramSessionMutation) ResetData()

ResetData resets all changes to the "data" field.

func (*TelegramSessionMutation) ResetEdge

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

func (m *TelegramSessionMutation) 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 (*TelegramSessionMutation) SetData

func (m *TelegramSessionMutation) SetData(b []byte)

SetData sets the "data" field.

func (*TelegramSessionMutation) SetField

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

func (m *TelegramSessionMutation) SetID(id int)

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

func (*TelegramSessionMutation) SetOp

func (m *TelegramSessionMutation) SetOp(op Op)

SetOp allows setting the mutation operation.

func (TelegramSessionMutation) Tx

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

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

func (*TelegramSessionMutation) Type

func (m *TelegramSessionMutation) Type() string

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

func (*TelegramSessionMutation) Where

Where appends a list predicates to the TelegramSessionMutation builder.

func (*TelegramSessionMutation) WhereP

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

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

type TelegramSessionQuery

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

TelegramSessionQuery is the builder for querying TelegramSession entities.

func (*TelegramSessionQuery) Aggregate

Aggregate returns a TelegramSessionSelect configured with the given aggregations.

func (*TelegramSessionQuery) All

All executes the query and returns a list of TelegramSessions.

func (*TelegramSessionQuery) AllX

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

func (*TelegramSessionQuery) Clone

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

func (*TelegramSessionQuery) Count

func (_q *TelegramSessionQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*TelegramSessionQuery) CountX

func (_q *TelegramSessionQuery) CountX(ctx context.Context) int

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

func (*TelegramSessionQuery) Exist

func (_q *TelegramSessionQuery) Exist(ctx context.Context) (bool, error)

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

func (*TelegramSessionQuery) ExistX

func (_q *TelegramSessionQuery) ExistX(ctx context.Context) bool

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

func (*TelegramSessionQuery) First

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

func (*TelegramSessionQuery) FirstID

func (_q *TelegramSessionQuery) FirstID(ctx context.Context) (id int, err error)

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

func (*TelegramSessionQuery) FirstIDX

func (_q *TelegramSessionQuery) FirstIDX(ctx context.Context) int

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

func (*TelegramSessionQuery) FirstX

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

func (*TelegramSessionQuery) GroupBy

func (_q *TelegramSessionQuery) GroupBy(field string, fields ...string) *TelegramSessionGroupBy

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 {
	Data []byte `json:"data,omitempty"`
	Count int `json:"count,omitempty"`
}

client.TelegramSession.Query().
	GroupBy(telegramsession.FieldData).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*TelegramSessionQuery) IDs

func (_q *TelegramSessionQuery) IDs(ctx context.Context) (ids []int, err error)

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

func (*TelegramSessionQuery) IDsX

func (_q *TelegramSessionQuery) IDsX(ctx context.Context) []int

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

func (*TelegramSessionQuery) Limit

func (_q *TelegramSessionQuery) Limit(limit int) *TelegramSessionQuery

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

func (*TelegramSessionQuery) Offset

func (_q *TelegramSessionQuery) Offset(offset int) *TelegramSessionQuery

Offset to start from.

func (*TelegramSessionQuery) Only

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

func (*TelegramSessionQuery) OnlyID

func (_q *TelegramSessionQuery) OnlyID(ctx context.Context) (id int, err error)

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

func (*TelegramSessionQuery) OnlyIDX

func (_q *TelegramSessionQuery) OnlyIDX(ctx context.Context) int

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

func (*TelegramSessionQuery) OnlyX

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

func (*TelegramSessionQuery) Order

Order specifies how the records should be ordered.

func (*TelegramSessionQuery) Select

func (_q *TelegramSessionQuery) Select(fields ...string) *TelegramSessionSelect

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 {
	Data []byte `json:"data,omitempty"`
}

client.TelegramSession.Query().
	Select(telegramsession.FieldData).
	Scan(ctx, &v)

func (*TelegramSessionQuery) Unique

func (_q *TelegramSessionQuery) Unique(unique bool) *TelegramSessionQuery

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

Where adds a new predicate for the TelegramSessionQuery builder.

type TelegramSessionSelect

type TelegramSessionSelect struct {
	*TelegramSessionQuery
	// contains filtered or unexported fields
}

TelegramSessionSelect is the builder for selecting fields of TelegramSession entities.

func (*TelegramSessionSelect) Aggregate

Aggregate adds the given aggregation functions to the selector query.

func (*TelegramSessionSelect) Bool

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

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

func (*TelegramSessionSelect) BoolX

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

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

func (*TelegramSessionSelect) Bools

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

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

func (*TelegramSessionSelect) BoolsX

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

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

func (*TelegramSessionSelect) Float64

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

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

func (*TelegramSessionSelect) Float64X

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

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

func (*TelegramSessionSelect) Float64s

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

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

func (*TelegramSessionSelect) Float64sX

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

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

func (*TelegramSessionSelect) Int

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

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

func (*TelegramSessionSelect) IntX

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

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

func (*TelegramSessionSelect) Ints

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

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

func (*TelegramSessionSelect) IntsX

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

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

func (*TelegramSessionSelect) Scan

func (_s *TelegramSessionSelect) Scan(ctx context.Context, v any) error

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

func (*TelegramSessionSelect) ScanX

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

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

func (*TelegramSessionSelect) String

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

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

func (*TelegramSessionSelect) StringX

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

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

func (*TelegramSessionSelect) Strings

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

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

func (*TelegramSessionSelect) StringsX

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

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

type TelegramSessionUpdate

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

TelegramSessionUpdate is the builder for updating TelegramSession entities.

func (*TelegramSessionUpdate) Exec

Exec executes the query.

func (*TelegramSessionUpdate) ExecX

func (_u *TelegramSessionUpdate) ExecX(ctx context.Context)

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

func (*TelegramSessionUpdate) Mutation

Mutation returns the TelegramSessionMutation object of the builder.

func (*TelegramSessionUpdate) Save

func (_u *TelegramSessionUpdate) Save(ctx context.Context) (int, error)

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

func (*TelegramSessionUpdate) SaveX

func (_u *TelegramSessionUpdate) SaveX(ctx context.Context) int

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

func (*TelegramSessionUpdate) SetData

SetData sets the "data" field.

func (*TelegramSessionUpdate) Where

Where appends a list predicates to the TelegramSessionUpdate builder.

type TelegramSessionUpdateOne

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

TelegramSessionUpdateOne is the builder for updating a single TelegramSession entity.

func (*TelegramSessionUpdateOne) Exec

Exec executes the query on the entity.

func (*TelegramSessionUpdateOne) ExecX

func (_u *TelegramSessionUpdateOne) ExecX(ctx context.Context)

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

func (*TelegramSessionUpdateOne) Mutation

Mutation returns the TelegramSessionMutation object of the builder.

func (*TelegramSessionUpdateOne) Save

Save executes the query and returns the updated TelegramSession entity.

func (*TelegramSessionUpdateOne) SaveX

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

func (*TelegramSessionUpdateOne) Select

func (_u *TelegramSessionUpdateOne) Select(field string, fields ...string) *TelegramSessionUpdateOne

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

func (*TelegramSessionUpdateOne) SetData

SetData sets the "data" field.

func (*TelegramSessionUpdateOne) Where

Where appends a list predicates to the TelegramSessionUpdate builder.

type TelegramSessionUpsert

type TelegramSessionUpsert struct {
	*sql.UpdateSet
}

TelegramSessionUpsert is the "OnConflict" setter.

func (*TelegramSessionUpsert) SetData

SetData sets the "data" field.

func (*TelegramSessionUpsert) UpdateData

UpdateData sets the "data" field to the value that was provided on create.

type TelegramSessionUpsertBulk

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

TelegramSessionUpsertBulk is the builder for "upsert"-ing a bulk of TelegramSession nodes.

func (*TelegramSessionUpsertBulk) DoNothing

DoNothing configures the conflict_action to `DO NOTHING`. Supported only by SQLite and PostgreSQL.

func (*TelegramSessionUpsertBulk) Exec

Exec executes the query.

func (*TelegramSessionUpsertBulk) ExecX

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

func (*TelegramSessionUpsertBulk) Ignore

Ignore sets each column to itself in case of conflict. Using this option is equivalent to using:

client.TelegramSession.Create().
	OnConflict(sql.ResolveWithIgnore()).
	Exec(ctx)

func (*TelegramSessionUpsertBulk) SetData

SetData sets the "data" field.

func (*TelegramSessionUpsertBulk) Update

Update allows overriding fields `UPDATE` values. See the TelegramSessionCreateBulk.OnConflict documentation for more info.

func (*TelegramSessionUpsertBulk) UpdateData

UpdateData sets the "data" field to the value that was provided on create.

func (*TelegramSessionUpsertBulk) UpdateNewValues

UpdateNewValues updates the mutable fields using the new values that were set on create. Using this option is equivalent to using:

client.TelegramSession.Create().
	OnConflict(
		sql.ResolveWithNewValues(),
		sql.ResolveWith(func(u *sql.UpdateSet) {
			u.SetIgnore(telegramsession.FieldID)
		}),
	).
	Exec(ctx)

type TelegramSessionUpsertOne

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

TelegramSessionUpsertOne is the builder for "upsert"-ing

one TelegramSession node.

func (*TelegramSessionUpsertOne) DoNothing

DoNothing configures the conflict_action to `DO NOTHING`. Supported only by SQLite and PostgreSQL.

func (*TelegramSessionUpsertOne) Exec

Exec executes the query.

func (*TelegramSessionUpsertOne) ExecX

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

func (*TelegramSessionUpsertOne) ID

func (u *TelegramSessionUpsertOne) ID(ctx context.Context) (id int, err error)

Exec executes the UPSERT query and returns the inserted/updated ID.

func (*TelegramSessionUpsertOne) IDX

IDX is like ID, but panics if an error occurs.

func (*TelegramSessionUpsertOne) Ignore

Ignore sets each column to itself in case of conflict. Using this option is equivalent to using:

client.TelegramSession.Create().
    OnConflict(sql.ResolveWithIgnore()).
    Exec(ctx)

func (*TelegramSessionUpsertOne) SetData

SetData sets the "data" field.

func (*TelegramSessionUpsertOne) Update

Update allows overriding fields `UPDATE` values. See the TelegramSessionCreate.OnConflict documentation for more info.

func (*TelegramSessionUpsertOne) UpdateData

UpdateData sets the "data" field to the value that was provided on create.

func (*TelegramSessionUpsertOne) UpdateNewValues

func (u *TelegramSessionUpsertOne) UpdateNewValues() *TelegramSessionUpsertOne

UpdateNewValues updates the mutable fields using the new values that were set on create except the ID field. Using this option is equivalent to using:

client.TelegramSession.Create().
	OnConflict(
		sql.ResolveWithNewValues(),
		sql.ResolveWith(func(u *sql.UpdateSet) {
			u.SetIgnore(telegramsession.FieldID)
		}),
	).
	Exec(ctx)

type TelegramSessions

type TelegramSessions []*TelegramSession

TelegramSessions is a parsable slice of TelegramSession.

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 {

	// TelegramChannel is the client for interacting with the TelegramChannel builders.
	TelegramChannel *TelegramChannelClient
	// TelegramSession is the client for interacting with the TelegramSession builders.
	TelegramSession *TelegramSessionClient
	// 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