generated

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2026 License: MIT Imports: 24 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.
	TypeNode       = "Node"
	TypePoll       = "Poll"
	TypePollOption = "PollOption"
	TypePollVote   = "PollVote"
	TypeUser       = "User"
)

Variables

View Source
var ErrTxStarted = errors.New("generated: 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(generated.As(generated.Sum(field1), "sum_field1"), (generated.As(generated.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
	// Node is the client for interacting with the Node builders.
	Node *NodeClient
	// Poll is the client for interacting with the Poll builders.
	Poll *PollClient
	// PollOption is the client for interacting with the PollOption builders.
	PollOption *PollOptionClient
	// PollVote is the client for interacting with the PollVote builders.
	PollVote *PollVoteClient
	// User is the client for interacting with the User builders.
	User *UserClient
	// 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().
	Node.
	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 Node

type Node struct {

	// ID of the ent.
	ID int `json:"id,omitempty"`
	// contains filtered or unexported fields
}

Node is the model entity for the Node schema.

func (*Node) String

func (_m *Node) String() string

String implements the fmt.Stringer.

func (*Node) Unwrap

func (_m *Node) Unwrap() *Node

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

func (_m *Node) Update() *NodeUpdateOne

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

func (*Node) Value

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

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

type NodeClient

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

NodeClient is a client for the Node schema.

func NewNodeClient

func NewNodeClient(c config) *NodeClient

NewNodeClient returns a client for the Node from the given config.

func (*NodeClient) Create

func (c *NodeClient) Create() *NodeCreate

Create returns a builder for creating a Node entity.

func (*NodeClient) CreateBulk

func (c *NodeClient) CreateBulk(builders ...*NodeCreate) *NodeCreateBulk

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

func (*NodeClient) Delete

func (c *NodeClient) Delete() *NodeDelete

Delete returns a delete builder for Node.

func (*NodeClient) DeleteOne

func (c *NodeClient) DeleteOne(_m *Node) *NodeDeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*NodeClient) DeleteOneID

func (c *NodeClient) DeleteOneID(id int) *NodeDeleteOne

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

func (*NodeClient) Get

func (c *NodeClient) Get(ctx context.Context, id int) (*Node, error)

Get returns a Node entity by its id.

func (*NodeClient) GetX

func (c *NodeClient) GetX(ctx context.Context, id int) *Node

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

func (*NodeClient) Hooks

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

Hooks returns the client hooks.

func (*NodeClient) Intercept

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

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

func (*NodeClient) Interceptors

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

Interceptors returns the client interceptors.

func (*NodeClient) MapCreateBulk

func (c *NodeClient) MapCreateBulk(slice any, setFunc func(*NodeCreate, int)) *NodeCreateBulk

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

func (c *NodeClient) Query() *NodeQuery

Query returns a query builder for Node.

func (*NodeClient) Update

func (c *NodeClient) Update() *NodeUpdate

Update returns an update builder for Node.

func (*NodeClient) UpdateOne

func (c *NodeClient) UpdateOne(_m *Node) *NodeUpdateOne

UpdateOne returns an update builder for the given entity.

func (*NodeClient) UpdateOneID

func (c *NodeClient) UpdateOneID(id int) *NodeUpdateOne

UpdateOneID returns an update builder for the given id.

func (*NodeClient) Use

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

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

type NodeCreate

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

NodeCreate is the builder for creating a Node entity.

func (*NodeCreate) Exec

func (_c *NodeCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*NodeCreate) ExecX

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

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

func (*NodeCreate) Mutation

func (_c *NodeCreate) Mutation() *NodeMutation

Mutation returns the NodeMutation object of the builder.

func (*NodeCreate) Save

func (_c *NodeCreate) Save(ctx context.Context) (*Node, error)

Save creates the Node in the database.

func (*NodeCreate) SaveX

func (_c *NodeCreate) SaveX(ctx context.Context) *Node

SaveX calls Save and panics if Save returns an error.

func (*NodeCreate) SetID

func (_c *NodeCreate) SetID(v int) *NodeCreate

SetID sets the "id" field.

type NodeCreateBulk

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

NodeCreateBulk is the builder for creating many Node entities in bulk.

func (*NodeCreateBulk) Exec

func (_c *NodeCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*NodeCreateBulk) ExecX

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

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

func (*NodeCreateBulk) Save

func (_c *NodeCreateBulk) Save(ctx context.Context) ([]*Node, error)

Save creates the Node entities in the database.

func (*NodeCreateBulk) SaveX

func (_c *NodeCreateBulk) SaveX(ctx context.Context) []*Node

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

type NodeDelete

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

NodeDelete is the builder for deleting a Node entity.

func (*NodeDelete) Exec

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

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

func (*NodeDelete) ExecX

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

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

func (*NodeDelete) Where

func (_d *NodeDelete) Where(ps ...predicate.Node) *NodeDelete

Where appends a list predicates to the NodeDelete builder.

type NodeDeleteOne

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

NodeDeleteOne is the builder for deleting a single Node entity.

func (*NodeDeleteOne) Exec

func (_d *NodeDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*NodeDeleteOne) ExecX

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

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

func (*NodeDeleteOne) Where

func (_d *NodeDeleteOne) Where(ps ...predicate.Node) *NodeDeleteOne

Where appends a list predicates to the NodeDelete builder.

type NodeGroupBy

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

NodeGroupBy is the group-by builder for Node entities.

func (*NodeGroupBy) Aggregate

func (_g *NodeGroupBy) Aggregate(fns ...AggregateFunc) *NodeGroupBy

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

func (*NodeGroupBy) Bool

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

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

func (*NodeGroupBy) BoolX

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

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

func (*NodeGroupBy) Bools

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

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

func (*NodeGroupBy) BoolsX

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

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

func (*NodeGroupBy) Float64

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

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

func (*NodeGroupBy) Float64X

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

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

func (*NodeGroupBy) Float64s

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

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

func (*NodeGroupBy) Float64sX

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

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

func (*NodeGroupBy) Int

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

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

func (*NodeGroupBy) IntX

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

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

func (*NodeGroupBy) Ints

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

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

func (*NodeGroupBy) IntsX

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

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

func (*NodeGroupBy) Scan

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

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

func (*NodeGroupBy) ScanX

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

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

func (*NodeGroupBy) String

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

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

func (*NodeGroupBy) StringX

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

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

func (*NodeGroupBy) Strings

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

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

func (*NodeGroupBy) StringsX

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

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

type NodeMutation

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

NodeMutation represents an operation that mutates the Node nodes in the graph.

func (*NodeMutation) AddField

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

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

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

func (*NodeMutation) AddedField

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

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

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

func (*NodeMutation) AddedIDs

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

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

func (*NodeMutation) ClearEdge

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

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

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

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

func (*NodeMutation) ClearedFields

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

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

func (NodeMutation) Client

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

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

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

func (*NodeMutation) Field

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

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

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

func (*NodeMutation) Fields

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

func (m *NodeMutation) 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 (*NodeMutation) IDs

func (m *NodeMutation) 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 (*NodeMutation) OldField

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

func (m *NodeMutation) Op() Op

Op returns the operation name.

func (*NodeMutation) RemovedEdges

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

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

func (*NodeMutation) RemovedIDs

func (m *NodeMutation) 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 (*NodeMutation) ResetEdge

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

func (m *NodeMutation) 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 (*NodeMutation) SetField

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

func (m *NodeMutation) SetID(id int)

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

func (*NodeMutation) SetOp

func (m *NodeMutation) SetOp(op Op)

SetOp allows setting the mutation operation.

func (NodeMutation) Tx

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

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

func (*NodeMutation) Type

func (m *NodeMutation) Type() string

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

func (*NodeMutation) Where

func (m *NodeMutation) Where(ps ...predicate.Node)

Where appends a list predicates to the NodeMutation builder.

func (*NodeMutation) WhereP

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

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

type NodeQuery

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

NodeQuery is the builder for querying Node entities.

func (*NodeQuery) Aggregate

func (_q *NodeQuery) Aggregate(fns ...AggregateFunc) *NodeSelect

Aggregate returns a NodeSelect configured with the given aggregations.

func (*NodeQuery) All

func (_q *NodeQuery) All(ctx context.Context) ([]*Node, error)

All executes the query and returns a list of Nodes.

func (*NodeQuery) AllX

func (_q *NodeQuery) AllX(ctx context.Context) []*Node

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

func (*NodeQuery) Clone

func (_q *NodeQuery) Clone() *NodeQuery

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

func (*NodeQuery) Count

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

Count returns the count of the given query.

func (*NodeQuery) CountX

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

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

func (*NodeQuery) Exist

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

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

func (*NodeQuery) ExistX

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

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

func (*NodeQuery) First

func (_q *NodeQuery) First(ctx context.Context) (*Node, error)

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

func (*NodeQuery) FirstID

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

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

func (*NodeQuery) FirstIDX

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

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

func (*NodeQuery) FirstX

func (_q *NodeQuery) FirstX(ctx context.Context) *Node

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

func (*NodeQuery) GroupBy

func (_q *NodeQuery) GroupBy(field string, fields ...string) *NodeGroupBy

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.

func (*NodeQuery) IDs

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

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

func (*NodeQuery) IDsX

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

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

func (*NodeQuery) Limit

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

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

func (*NodeQuery) Offset

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

Offset to start from.

func (*NodeQuery) Only

func (_q *NodeQuery) Only(ctx context.Context) (*Node, error)

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

func (*NodeQuery) OnlyID

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

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

func (*NodeQuery) OnlyIDX

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

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

func (*NodeQuery) OnlyX

func (_q *NodeQuery) OnlyX(ctx context.Context) *Node

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

func (*NodeQuery) Order

func (_q *NodeQuery) Order(o ...node.OrderOption) *NodeQuery

Order specifies how the records should be ordered.

func (*NodeQuery) Select

func (_q *NodeQuery) Select(fields ...string) *NodeSelect

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

func (*NodeQuery) Unique

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

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

func (_q *NodeQuery) Where(ps ...predicate.Node) *NodeQuery

Where adds a new predicate for the NodeQuery builder.

type NodeSelect

type NodeSelect struct {
	*NodeQuery
	// contains filtered or unexported fields
}

NodeSelect is the builder for selecting fields of Node entities.

func (*NodeSelect) Aggregate

func (_s *NodeSelect) Aggregate(fns ...AggregateFunc) *NodeSelect

Aggregate adds the given aggregation functions to the selector query.

func (*NodeSelect) Bool

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

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

func (*NodeSelect) BoolX

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

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

func (*NodeSelect) Bools

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

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

func (*NodeSelect) BoolsX

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

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

func (*NodeSelect) Float64

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

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

func (*NodeSelect) Float64X

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

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

func (*NodeSelect) Float64s

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

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

func (*NodeSelect) Float64sX

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

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

func (*NodeSelect) Int

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

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

func (*NodeSelect) IntX

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

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

func (*NodeSelect) Ints

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

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

func (*NodeSelect) IntsX

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

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

func (*NodeSelect) Scan

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

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

func (*NodeSelect) ScanX

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

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

func (*NodeSelect) String

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

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

func (*NodeSelect) StringX

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

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

func (*NodeSelect) Strings

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

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

func (*NodeSelect) StringsX

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

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

type NodeUpdate

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

NodeUpdate is the builder for updating Node entities.

func (*NodeUpdate) Exec

func (_u *NodeUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*NodeUpdate) ExecX

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

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

func (*NodeUpdate) Mutation

func (_u *NodeUpdate) Mutation() *NodeMutation

Mutation returns the NodeMutation object of the builder.

func (*NodeUpdate) Save

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

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

func (*NodeUpdate) SaveX

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

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

func (*NodeUpdate) Where

func (_u *NodeUpdate) Where(ps ...predicate.Node) *NodeUpdate

Where appends a list predicates to the NodeUpdate builder.

type NodeUpdateOne

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

NodeUpdateOne is the builder for updating a single Node entity.

func (*NodeUpdateOne) Exec

func (_u *NodeUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*NodeUpdateOne) ExecX

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

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

func (*NodeUpdateOne) Mutation

func (_u *NodeUpdateOne) Mutation() *NodeMutation

Mutation returns the NodeMutation object of the builder.

func (*NodeUpdateOne) Save

func (_u *NodeUpdateOne) Save(ctx context.Context) (*Node, error)

Save executes the query and returns the updated Node entity.

func (*NodeUpdateOne) SaveX

func (_u *NodeUpdateOne) SaveX(ctx context.Context) *Node

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

func (*NodeUpdateOne) Select

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

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

func (*NodeUpdateOne) Where

func (_u *NodeUpdateOne) Where(ps ...predicate.Node) *NodeUpdateOne

Where appends a list predicates to the NodeUpdate builder.

type Nodes

type Nodes []*Node

Nodes is a parsable slice of Node.

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.

func (*NotFoundError) Is

func (e *NotFoundError) Is(target error) bool

Is makes errors.Is(err, schemakit.ErrEntityNotFound) true for ent's not-found errors, so the engine recognizes the module's missing record as it does the core's (its handlers answer 404).

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 Poll

type Poll struct {

	// ID of the ent.
	ID int `json:"id,omitempty"`
	// Nid holds the value of the "nid" field.
	Nid int `json:"nid,omitempty"`
	// Description holds the value of the "description" field.
	Description string `json:"description,omitempty"`
	// MaxAnswers holds the value of the "max_answers" field.
	MaxAnswers int `json:"max_answers,omitempty"`
	// AvailableFrom holds the value of the "available_from" field.
	AvailableFrom *time.Time `json:"available_from,omitempty"`
	// AvailableTo holds the value of the "available_to" field.
	AvailableTo *time.Time `json:"available_to,omitempty"`
	// ResultsOnly holds the value of the "results_only" field.
	ResultsOnly bool `json:"results_only,omitempty"`
	// AllowRevote holds the value of the "allow_revote" field.
	AllowRevote bool `json:"allow_revote,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the PollQuery when eager-loading is set.
	Edges PollEdges `json:"edges"`
	// contains filtered or unexported fields
}

Poll is the model entity for the Poll schema.

func (*Poll) QueryNodes

func (_m *Poll) QueryNodes() *NodeQuery

QueryNodes queries the "nodes" edge of the Poll entity.

func (*Poll) QueryOptions

func (_m *Poll) QueryOptions() *PollOptionQuery

QueryOptions queries the "options" edge of the Poll entity.

func (*Poll) QueryVotes

func (_m *Poll) QueryVotes() *PollVoteQuery

QueryVotes queries the "votes" edge of the Poll entity.

func (*Poll) String

func (_m *Poll) String() string

String implements the fmt.Stringer.

func (*Poll) Unwrap

func (_m *Poll) Unwrap() *Poll

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

func (_m *Poll) Update() *PollUpdateOne

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

func (*Poll) Value

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

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

type PollClient

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

PollClient is a client for the Poll schema.

func NewPollClient

func NewPollClient(c config) *PollClient

NewPollClient returns a client for the Poll from the given config.

func (*PollClient) Create

func (c *PollClient) Create() *PollCreate

Create returns a builder for creating a Poll entity.

func (*PollClient) CreateBulk

func (c *PollClient) CreateBulk(builders ...*PollCreate) *PollCreateBulk

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

func (*PollClient) Delete

func (c *PollClient) Delete() *PollDelete

Delete returns a delete builder for Poll.

func (*PollClient) DeleteOne

func (c *PollClient) DeleteOne(_m *Poll) *PollDeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*PollClient) DeleteOneID

func (c *PollClient) DeleteOneID(id int) *PollDeleteOne

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

func (*PollClient) Get

func (c *PollClient) Get(ctx context.Context, id int) (*Poll, error)

Get returns a Poll entity by its id.

func (*PollClient) GetX

func (c *PollClient) GetX(ctx context.Context, id int) *Poll

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

func (*PollClient) Hooks

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

Hooks returns the client hooks.

func (*PollClient) Intercept

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

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

func (*PollClient) Interceptors

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

Interceptors returns the client interceptors.

func (*PollClient) MapCreateBulk

func (c *PollClient) MapCreateBulk(slice any, setFunc func(*PollCreate, int)) *PollCreateBulk

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

func (c *PollClient) Query() *PollQuery

Query returns a query builder for Poll.

func (*PollClient) QueryNodes

func (c *PollClient) QueryNodes(_m *Poll) *NodeQuery

QueryNodes queries the nodes edge of a Poll.

func (*PollClient) QueryOptions

func (c *PollClient) QueryOptions(_m *Poll) *PollOptionQuery

QueryOptions queries the options edge of a Poll.

func (*PollClient) QueryVotes

func (c *PollClient) QueryVotes(_m *Poll) *PollVoteQuery

QueryVotes queries the votes edge of a Poll.

func (*PollClient) Update

func (c *PollClient) Update() *PollUpdate

Update returns an update builder for Poll.

func (*PollClient) UpdateOne

func (c *PollClient) UpdateOne(_m *Poll) *PollUpdateOne

UpdateOne returns an update builder for the given entity.

func (*PollClient) UpdateOneID

func (c *PollClient) UpdateOneID(id int) *PollUpdateOne

UpdateOneID returns an update builder for the given id.

func (*PollClient) Use

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

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

type PollCreate

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

PollCreate is the builder for creating a Poll entity.

func (*PollCreate) AddOptionIDs

func (_c *PollCreate) AddOptionIDs(ids ...int) *PollCreate

AddOptionIDs adds the "options" edge to the PollOption entity by IDs.

func (*PollCreate) AddOptions

func (_c *PollCreate) AddOptions(v ...*PollOption) *PollCreate

AddOptions adds the "options" edges to the PollOption entity.

func (*PollCreate) AddVoteIDs

func (_c *PollCreate) AddVoteIDs(ids ...int) *PollCreate

AddVoteIDs adds the "votes" edge to the PollVote entity by IDs.

func (*PollCreate) AddVotes

func (_c *PollCreate) AddVotes(v ...*PollVote) *PollCreate

AddVotes adds the "votes" edges to the PollVote entity.

func (*PollCreate) Exec

func (_c *PollCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*PollCreate) ExecX

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

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

func (*PollCreate) Mutation

func (_c *PollCreate) Mutation() *PollMutation

Mutation returns the PollMutation object of the builder.

func (*PollCreate) Save

func (_c *PollCreate) Save(ctx context.Context) (*Poll, error)

Save creates the Poll in the database.

func (*PollCreate) SaveX

func (_c *PollCreate) SaveX(ctx context.Context) *Poll

SaveX calls Save and panics if Save returns an error.

func (*PollCreate) SetAllowRevote

func (_c *PollCreate) SetAllowRevote(v bool) *PollCreate

SetAllowRevote sets the "allow_revote" field.

func (*PollCreate) SetAvailableFrom

func (_c *PollCreate) SetAvailableFrom(v time.Time) *PollCreate

SetAvailableFrom sets the "available_from" field.

func (*PollCreate) SetAvailableTo

func (_c *PollCreate) SetAvailableTo(v time.Time) *PollCreate

SetAvailableTo sets the "available_to" field.

func (*PollCreate) SetDescription

func (_c *PollCreate) SetDescription(v string) *PollCreate

SetDescription sets the "description" field.

func (*PollCreate) SetID

func (_c *PollCreate) SetID(v int) *PollCreate

SetID sets the "id" field.

func (*PollCreate) SetMaxAnswers

func (_c *PollCreate) SetMaxAnswers(v int) *PollCreate

SetMaxAnswers sets the "max_answers" field.

func (*PollCreate) SetNid

func (_c *PollCreate) SetNid(v int) *PollCreate

SetNid sets the "nid" field.

func (*PollCreate) SetNillableAllowRevote

func (_c *PollCreate) SetNillableAllowRevote(v *bool) *PollCreate

SetNillableAllowRevote sets the "allow_revote" field if the given value is not nil.

func (*PollCreate) SetNillableAvailableFrom

func (_c *PollCreate) SetNillableAvailableFrom(v *time.Time) *PollCreate

SetNillableAvailableFrom sets the "available_from" field if the given value is not nil.

func (*PollCreate) SetNillableAvailableTo

func (_c *PollCreate) SetNillableAvailableTo(v *time.Time) *PollCreate

SetNillableAvailableTo sets the "available_to" field if the given value is not nil.

func (*PollCreate) SetNillableDescription

func (_c *PollCreate) SetNillableDescription(v *string) *PollCreate

SetNillableDescription sets the "description" field if the given value is not nil.

func (*PollCreate) SetNillableMaxAnswers

func (_c *PollCreate) SetNillableMaxAnswers(v *int) *PollCreate

SetNillableMaxAnswers sets the "max_answers" field if the given value is not nil.

func (*PollCreate) SetNillableResultsOnly

func (_c *PollCreate) SetNillableResultsOnly(v *bool) *PollCreate

SetNillableResultsOnly sets the "results_only" field if the given value is not nil.

func (*PollCreate) SetNodes

func (_c *PollCreate) SetNodes(v *Node) *PollCreate

SetNodes sets the "nodes" edge to the Node entity.

func (*PollCreate) SetNodesID

func (_c *PollCreate) SetNodesID(id int) *PollCreate

SetNodesID sets the "nodes" edge to the Node entity by ID.

func (*PollCreate) SetResultsOnly

func (_c *PollCreate) SetResultsOnly(v bool) *PollCreate

SetResultsOnly sets the "results_only" field.

type PollCreateBulk

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

PollCreateBulk is the builder for creating many Poll entities in bulk.

func (*PollCreateBulk) Exec

func (_c *PollCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*PollCreateBulk) ExecX

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

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

func (*PollCreateBulk) Save

func (_c *PollCreateBulk) Save(ctx context.Context) ([]*Poll, error)

Save creates the Poll entities in the database.

func (*PollCreateBulk) SaveX

func (_c *PollCreateBulk) SaveX(ctx context.Context) []*Poll

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

type PollDelete

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

PollDelete is the builder for deleting a Poll entity.

func (*PollDelete) Exec

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

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

func (*PollDelete) ExecX

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

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

func (*PollDelete) Where

func (_d *PollDelete) Where(ps ...predicate.Poll) *PollDelete

Where appends a list predicates to the PollDelete builder.

type PollDeleteOne

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

PollDeleteOne is the builder for deleting a single Poll entity.

func (*PollDeleteOne) Exec

func (_d *PollDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*PollDeleteOne) ExecX

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

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

func (*PollDeleteOne) Where

func (_d *PollDeleteOne) Where(ps ...predicate.Poll) *PollDeleteOne

Where appends a list predicates to the PollDelete builder.

type PollEdges

type PollEdges struct {
	// Nodes holds the value of the nodes edge.
	Nodes *Node `json:"nodes,omitempty"`
	// Options holds the value of the options edge.
	Options []*PollOption `json:"options,omitempty"`
	// Votes holds the value of the votes edge.
	Votes []*PollVote `json:"votes,omitempty"`
	// contains filtered or unexported fields
}

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

func (PollEdges) NodesOrErr

func (e PollEdges) NodesOrErr() (*Node, error)

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

func (PollEdges) OptionsOrErr

func (e PollEdges) OptionsOrErr() ([]*PollOption, error)

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

func (PollEdges) VotesOrErr

func (e PollEdges) VotesOrErr() ([]*PollVote, error)

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

type PollGroupBy

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

PollGroupBy is the group-by builder for Poll entities.

func (*PollGroupBy) Aggregate

func (_g *PollGroupBy) Aggregate(fns ...AggregateFunc) *PollGroupBy

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

func (*PollGroupBy) Bool

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

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

func (*PollGroupBy) BoolX

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

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

func (*PollGroupBy) Bools

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

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

func (*PollGroupBy) BoolsX

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

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

func (*PollGroupBy) Float64

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

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

func (*PollGroupBy) Float64X

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

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

func (*PollGroupBy) Float64s

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

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

func (*PollGroupBy) Float64sX

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

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

func (*PollGroupBy) Int

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

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

func (*PollGroupBy) IntX

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

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

func (*PollGroupBy) Ints

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

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

func (*PollGroupBy) IntsX

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

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

func (*PollGroupBy) Scan

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

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

func (*PollGroupBy) ScanX

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

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

func (*PollGroupBy) String

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

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

func (*PollGroupBy) StringX

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

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

func (*PollGroupBy) Strings

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

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

func (*PollGroupBy) StringsX

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

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

type PollMutation

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

PollMutation represents an operation that mutates the Poll nodes in the graph.

func (*PollMutation) AddField

func (m *PollMutation) 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 (*PollMutation) AddMaxAnswers

func (m *PollMutation) AddMaxAnswers(i int)

AddMaxAnswers adds i to the "max_answers" field.

func (*PollMutation) AddOptionIDs

func (m *PollMutation) AddOptionIDs(ids ...int)

AddOptionIDs adds the "options" edge to the PollOption entity by ids.

func (*PollMutation) AddVoteIDs

func (m *PollMutation) AddVoteIDs(ids ...int)

AddVoteIDs adds the "votes" edge to the PollVote entity by ids.

func (*PollMutation) AddedEdges

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

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

func (*PollMutation) AddedField

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

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

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

func (*PollMutation) AddedIDs

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

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

func (*PollMutation) AddedMaxAnswers

func (m *PollMutation) AddedMaxAnswers() (r int, exists bool)

AddedMaxAnswers returns the value that was added to the "max_answers" field in this mutation.

func (*PollMutation) AllowRevote

func (m *PollMutation) AllowRevote() (r bool, exists bool)

AllowRevote returns the value of the "allow_revote" field in the mutation.

func (*PollMutation) AvailableFrom

func (m *PollMutation) AvailableFrom() (r time.Time, exists bool)

AvailableFrom returns the value of the "available_from" field in the mutation.

func (*PollMutation) AvailableFromCleared

func (m *PollMutation) AvailableFromCleared() bool

AvailableFromCleared returns if the "available_from" field was cleared in this mutation.

func (*PollMutation) AvailableTo

func (m *PollMutation) AvailableTo() (r time.Time, exists bool)

AvailableTo returns the value of the "available_to" field in the mutation.

func (*PollMutation) AvailableToCleared

func (m *PollMutation) AvailableToCleared() bool

AvailableToCleared returns if the "available_to" field was cleared in this mutation.

func (*PollMutation) ClearAvailableFrom

func (m *PollMutation) ClearAvailableFrom()

ClearAvailableFrom clears the value of the "available_from" field.

func (*PollMutation) ClearAvailableTo

func (m *PollMutation) ClearAvailableTo()

ClearAvailableTo clears the value of the "available_to" field.

func (*PollMutation) ClearDescription

func (m *PollMutation) ClearDescription()

ClearDescription clears the value of the "description" field.

func (*PollMutation) ClearEdge

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

func (m *PollMutation) 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 (*PollMutation) ClearNodes

func (m *PollMutation) ClearNodes()

ClearNodes clears the "nodes" edge to the Node entity.

func (*PollMutation) ClearOptions

func (m *PollMutation) ClearOptions()

ClearOptions clears the "options" edge to the PollOption entity.

func (*PollMutation) ClearVotes

func (m *PollMutation) ClearVotes()

ClearVotes clears the "votes" edge to the PollVote entity.

func (*PollMutation) ClearedEdges

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

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

func (*PollMutation) ClearedFields

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

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

func (PollMutation) Client

func (m PollMutation) 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 (*PollMutation) Description

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

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

func (*PollMutation) DescriptionCleared

func (m *PollMutation) DescriptionCleared() bool

DescriptionCleared returns if the "description" field was cleared in this mutation.

func (*PollMutation) EdgeCleared

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

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

func (*PollMutation) Field

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

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

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

func (*PollMutation) Fields

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

func (m *PollMutation) 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 (*PollMutation) IDs

func (m *PollMutation) 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 (*PollMutation) MaxAnswers

func (m *PollMutation) MaxAnswers() (r int, exists bool)

MaxAnswers returns the value of the "max_answers" field in the mutation.

func (*PollMutation) Nid

func (m *PollMutation) Nid() (r int, exists bool)

Nid returns the value of the "nid" field in the mutation.

func (*PollMutation) NodesCleared

func (m *PollMutation) NodesCleared() bool

NodesCleared reports if the "nodes" edge to the Node entity was cleared.

func (*PollMutation) NodesID

func (m *PollMutation) NodesID() (id int, exists bool)

NodesID returns the "nodes" edge ID in the mutation.

func (*PollMutation) NodesIDs

func (m *PollMutation) NodesIDs() (ids []int)

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

func (*PollMutation) OldAllowRevote

func (m *PollMutation) OldAllowRevote(ctx context.Context) (v bool, err error)

OldAllowRevote returns the old "allow_revote" field's value of the Poll entity. If the Poll 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 (*PollMutation) OldAvailableFrom

func (m *PollMutation) OldAvailableFrom(ctx context.Context) (v *time.Time, err error)

OldAvailableFrom returns the old "available_from" field's value of the Poll entity. If the Poll 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 (*PollMutation) OldAvailableTo

func (m *PollMutation) OldAvailableTo(ctx context.Context) (v *time.Time, err error)

OldAvailableTo returns the old "available_to" field's value of the Poll entity. If the Poll 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 (*PollMutation) OldDescription

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

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

func (m *PollMutation) 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 (*PollMutation) OldMaxAnswers

func (m *PollMutation) OldMaxAnswers(ctx context.Context) (v int, err error)

OldMaxAnswers returns the old "max_answers" field's value of the Poll entity. If the Poll 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 (*PollMutation) OldNid

func (m *PollMutation) OldNid(ctx context.Context) (v int, err error)

OldNid returns the old "nid" field's value of the Poll entity. If the Poll 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 (*PollMutation) OldResultsOnly

func (m *PollMutation) OldResultsOnly(ctx context.Context) (v bool, err error)

OldResultsOnly returns the old "results_only" field's value of the Poll entity. If the Poll 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 (*PollMutation) Op

func (m *PollMutation) Op() Op

Op returns the operation name.

func (*PollMutation) OptionsCleared

func (m *PollMutation) OptionsCleared() bool

OptionsCleared reports if the "options" edge to the PollOption entity was cleared.

func (*PollMutation) OptionsIDs

func (m *PollMutation) OptionsIDs() (ids []int)

OptionsIDs returns the "options" edge IDs in the mutation.

func (*PollMutation) RemoveOptionIDs

func (m *PollMutation) RemoveOptionIDs(ids ...int)

RemoveOptionIDs removes the "options" edge to the PollOption entity by IDs.

func (*PollMutation) RemoveVoteIDs

func (m *PollMutation) RemoveVoteIDs(ids ...int)

RemoveVoteIDs removes the "votes" edge to the PollVote entity by IDs.

func (*PollMutation) RemovedEdges

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

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

func (*PollMutation) RemovedIDs

func (m *PollMutation) 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 (*PollMutation) RemovedOptionsIDs

func (m *PollMutation) RemovedOptionsIDs() (ids []int)

RemovedOptions returns the removed IDs of the "options" edge to the PollOption entity.

func (*PollMutation) RemovedVotesIDs

func (m *PollMutation) RemovedVotesIDs() (ids []int)

RemovedVotes returns the removed IDs of the "votes" edge to the PollVote entity.

func (*PollMutation) ResetAllowRevote

func (m *PollMutation) ResetAllowRevote()

ResetAllowRevote resets all changes to the "allow_revote" field.

func (*PollMutation) ResetAvailableFrom

func (m *PollMutation) ResetAvailableFrom()

ResetAvailableFrom resets all changes to the "available_from" field.

func (*PollMutation) ResetAvailableTo

func (m *PollMutation) ResetAvailableTo()

ResetAvailableTo resets all changes to the "available_to" field.

func (*PollMutation) ResetDescription

func (m *PollMutation) ResetDescription()

ResetDescription resets all changes to the "description" field.

func (*PollMutation) ResetEdge

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

func (m *PollMutation) 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 (*PollMutation) ResetMaxAnswers

func (m *PollMutation) ResetMaxAnswers()

ResetMaxAnswers resets all changes to the "max_answers" field.

func (*PollMutation) ResetNid

func (m *PollMutation) ResetNid()

ResetNid resets all changes to the "nid" field.

func (*PollMutation) ResetNodes

func (m *PollMutation) ResetNodes()

ResetNodes resets all changes to the "nodes" edge.

func (*PollMutation) ResetOptions

func (m *PollMutation) ResetOptions()

ResetOptions resets all changes to the "options" edge.

func (*PollMutation) ResetResultsOnly

func (m *PollMutation) ResetResultsOnly()

ResetResultsOnly resets all changes to the "results_only" field.

func (*PollMutation) ResetVotes

func (m *PollMutation) ResetVotes()

ResetVotes resets all changes to the "votes" edge.

func (*PollMutation) ResultsOnly

func (m *PollMutation) ResultsOnly() (r bool, exists bool)

ResultsOnly returns the value of the "results_only" field in the mutation.

func (*PollMutation) SetAllowRevote

func (m *PollMutation) SetAllowRevote(b bool)

SetAllowRevote sets the "allow_revote" field.

func (*PollMutation) SetAvailableFrom

func (m *PollMutation) SetAvailableFrom(t time.Time)

SetAvailableFrom sets the "available_from" field.

func (*PollMutation) SetAvailableTo

func (m *PollMutation) SetAvailableTo(t time.Time)

SetAvailableTo sets the "available_to" field.

func (*PollMutation) SetDescription

func (m *PollMutation) SetDescription(s string)

SetDescription sets the "description" field.

func (*PollMutation) SetField

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

func (m *PollMutation) SetID(id int)

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

func (*PollMutation) SetMaxAnswers

func (m *PollMutation) SetMaxAnswers(i int)

SetMaxAnswers sets the "max_answers" field.

func (*PollMutation) SetNid

func (m *PollMutation) SetNid(i int)

SetNid sets the "nid" field.

func (*PollMutation) SetNodesID

func (m *PollMutation) SetNodesID(id int)

SetNodesID sets the "nodes" edge to the Node entity by id.

func (*PollMutation) SetOp

func (m *PollMutation) SetOp(op Op)

SetOp allows setting the mutation operation.

func (*PollMutation) SetResultsOnly

func (m *PollMutation) SetResultsOnly(b bool)

SetResultsOnly sets the "results_only" field.

func (PollMutation) Tx

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

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

func (*PollMutation) Type

func (m *PollMutation) Type() string

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

func (*PollMutation) VotesCleared

func (m *PollMutation) VotesCleared() bool

VotesCleared reports if the "votes" edge to the PollVote entity was cleared.

func (*PollMutation) VotesIDs

func (m *PollMutation) VotesIDs() (ids []int)

VotesIDs returns the "votes" edge IDs in the mutation.

func (*PollMutation) Where

func (m *PollMutation) Where(ps ...predicate.Poll)

Where appends a list predicates to the PollMutation builder.

func (*PollMutation) WhereP

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

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

type PollOption

type PollOption struct {

	// ID of the ent.
	ID int `json:"id,omitempty"`
	// PollID holds the value of the "poll_id" field.
	PollID int `json:"poll_id,omitempty"`
	// Label holds the value of the "label" field.
	Label string `json:"label,omitempty"`
	// Weight holds the value of the "weight" field.
	Weight int `json:"weight,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the PollOptionQuery when eager-loading is set.
	Edges PollOptionEdges `json:"edges"`
	// contains filtered or unexported fields
}

PollOption is the model entity for the PollOption schema.

func (*PollOption) QueryOptionVotes

func (_m *PollOption) QueryOptionVotes() *PollVoteQuery

QueryOptionVotes queries the "option_votes" edge of the PollOption entity.

func (*PollOption) QueryPoll

func (_m *PollOption) QueryPoll() *PollQuery

QueryPoll queries the "poll" edge of the PollOption entity.

func (*PollOption) String

func (_m *PollOption) String() string

String implements the fmt.Stringer.

func (*PollOption) Unwrap

func (_m *PollOption) Unwrap() *PollOption

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

func (_m *PollOption) Update() *PollOptionUpdateOne

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

func (*PollOption) Value

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

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

type PollOptionClient

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

PollOptionClient is a client for the PollOption schema.

func NewPollOptionClient

func NewPollOptionClient(c config) *PollOptionClient

NewPollOptionClient returns a client for the PollOption from the given config.

func (*PollOptionClient) Create

func (c *PollOptionClient) Create() *PollOptionCreate

Create returns a builder for creating a PollOption entity.

func (*PollOptionClient) CreateBulk

func (c *PollOptionClient) CreateBulk(builders ...*PollOptionCreate) *PollOptionCreateBulk

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

func (*PollOptionClient) Delete

func (c *PollOptionClient) Delete() *PollOptionDelete

Delete returns a delete builder for PollOption.

func (*PollOptionClient) DeleteOne

func (c *PollOptionClient) DeleteOne(_m *PollOption) *PollOptionDeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*PollOptionClient) DeleteOneID

func (c *PollOptionClient) DeleteOneID(id int) *PollOptionDeleteOne

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

func (*PollOptionClient) Get

func (c *PollOptionClient) Get(ctx context.Context, id int) (*PollOption, error)

Get returns a PollOption entity by its id.

func (*PollOptionClient) GetX

func (c *PollOptionClient) GetX(ctx context.Context, id int) *PollOption

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

func (*PollOptionClient) Hooks

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

Hooks returns the client hooks.

func (*PollOptionClient) Intercept

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

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

func (*PollOptionClient) Interceptors

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

Interceptors returns the client interceptors.

func (*PollOptionClient) MapCreateBulk

func (c *PollOptionClient) MapCreateBulk(slice any, setFunc func(*PollOptionCreate, int)) *PollOptionCreateBulk

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

func (c *PollOptionClient) Query() *PollOptionQuery

Query returns a query builder for PollOption.

func (*PollOptionClient) QueryOptionVotes

func (c *PollOptionClient) QueryOptionVotes(_m *PollOption) *PollVoteQuery

QueryOptionVotes queries the option_votes edge of a PollOption.

func (*PollOptionClient) QueryPoll

func (c *PollOptionClient) QueryPoll(_m *PollOption) *PollQuery

QueryPoll queries the poll edge of a PollOption.

func (*PollOptionClient) Update

func (c *PollOptionClient) Update() *PollOptionUpdate

Update returns an update builder for PollOption.

func (*PollOptionClient) UpdateOne

func (c *PollOptionClient) UpdateOne(_m *PollOption) *PollOptionUpdateOne

UpdateOne returns an update builder for the given entity.

func (*PollOptionClient) UpdateOneID

func (c *PollOptionClient) UpdateOneID(id int) *PollOptionUpdateOne

UpdateOneID returns an update builder for the given id.

func (*PollOptionClient) Use

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

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

type PollOptionCreate

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

PollOptionCreate is the builder for creating a PollOption entity.

func (*PollOptionCreate) AddOptionVoteIDs

func (_c *PollOptionCreate) AddOptionVoteIDs(ids ...int) *PollOptionCreate

AddOptionVoteIDs adds the "option_votes" edge to the PollVote entity by IDs.

func (*PollOptionCreate) AddOptionVotes

func (_c *PollOptionCreate) AddOptionVotes(v ...*PollVote) *PollOptionCreate

AddOptionVotes adds the "option_votes" edges to the PollVote entity.

func (*PollOptionCreate) Exec

func (_c *PollOptionCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*PollOptionCreate) ExecX

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

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

func (*PollOptionCreate) Mutation

func (_c *PollOptionCreate) Mutation() *PollOptionMutation

Mutation returns the PollOptionMutation object of the builder.

func (*PollOptionCreate) Save

func (_c *PollOptionCreate) Save(ctx context.Context) (*PollOption, error)

Save creates the PollOption in the database.

func (*PollOptionCreate) SaveX

func (_c *PollOptionCreate) SaveX(ctx context.Context) *PollOption

SaveX calls Save and panics if Save returns an error.

func (*PollOptionCreate) SetID

func (_c *PollOptionCreate) SetID(v int) *PollOptionCreate

SetID sets the "id" field.

func (*PollOptionCreate) SetLabel

func (_c *PollOptionCreate) SetLabel(v string) *PollOptionCreate

SetLabel sets the "label" field.

func (*PollOptionCreate) SetNillableWeight

func (_c *PollOptionCreate) SetNillableWeight(v *int) *PollOptionCreate

SetNillableWeight sets the "weight" field if the given value is not nil.

func (*PollOptionCreate) SetPoll

func (_c *PollOptionCreate) SetPoll(v *Poll) *PollOptionCreate

SetPoll sets the "poll" edge to the Poll entity.

func (*PollOptionCreate) SetPollID

func (_c *PollOptionCreate) SetPollID(v int) *PollOptionCreate

SetPollID sets the "poll_id" field.

func (*PollOptionCreate) SetWeight

func (_c *PollOptionCreate) SetWeight(v int) *PollOptionCreate

SetWeight sets the "weight" field.

type PollOptionCreateBulk

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

PollOptionCreateBulk is the builder for creating many PollOption entities in bulk.

func (*PollOptionCreateBulk) Exec

func (_c *PollOptionCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*PollOptionCreateBulk) ExecX

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

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

func (*PollOptionCreateBulk) Save

func (_c *PollOptionCreateBulk) Save(ctx context.Context) ([]*PollOption, error)

Save creates the PollOption entities in the database.

func (*PollOptionCreateBulk) SaveX

func (_c *PollOptionCreateBulk) SaveX(ctx context.Context) []*PollOption

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

type PollOptionDelete

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

PollOptionDelete is the builder for deleting a PollOption entity.

func (*PollOptionDelete) Exec

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

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

func (*PollOptionDelete) ExecX

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

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

func (*PollOptionDelete) Where

Where appends a list predicates to the PollOptionDelete builder.

type PollOptionDeleteOne

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

PollOptionDeleteOne is the builder for deleting a single PollOption entity.

func (*PollOptionDeleteOne) Exec

func (_d *PollOptionDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*PollOptionDeleteOne) ExecX

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

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

func (*PollOptionDeleteOne) Where

Where appends a list predicates to the PollOptionDelete builder.

type PollOptionEdges

type PollOptionEdges struct {
	// Poll holds the value of the poll edge.
	Poll *Poll `json:"poll,omitempty"`
	// OptionVotes holds the value of the option_votes edge.
	OptionVotes []*PollVote `json:"option_votes,omitempty"`
	// contains filtered or unexported fields
}

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

func (PollOptionEdges) OptionVotesOrErr

func (e PollOptionEdges) OptionVotesOrErr() ([]*PollVote, error)

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

func (PollOptionEdges) PollOrErr

func (e PollOptionEdges) PollOrErr() (*Poll, error)

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

type PollOptionGroupBy

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

PollOptionGroupBy is the group-by builder for PollOption entities.

func (*PollOptionGroupBy) Aggregate

func (_g *PollOptionGroupBy) Aggregate(fns ...AggregateFunc) *PollOptionGroupBy

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

func (*PollOptionGroupBy) Bool

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

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

func (*PollOptionGroupBy) BoolX

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

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

func (*PollOptionGroupBy) Bools

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

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

func (*PollOptionGroupBy) BoolsX

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

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

func (*PollOptionGroupBy) Float64

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

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

func (*PollOptionGroupBy) Float64X

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

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

func (*PollOptionGroupBy) Float64s

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

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

func (*PollOptionGroupBy) Float64sX

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

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

func (*PollOptionGroupBy) Int

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

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

func (*PollOptionGroupBy) IntX

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

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

func (*PollOptionGroupBy) Ints

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

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

func (*PollOptionGroupBy) IntsX

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

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

func (*PollOptionGroupBy) Scan

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

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

func (*PollOptionGroupBy) ScanX

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

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

func (*PollOptionGroupBy) String

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

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

func (*PollOptionGroupBy) StringX

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

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

func (*PollOptionGroupBy) Strings

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

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

func (*PollOptionGroupBy) StringsX

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

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

type PollOptionMutation

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

PollOptionMutation represents an operation that mutates the PollOption nodes in the graph.

func (*PollOptionMutation) AddField

func (m *PollOptionMutation) 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 (*PollOptionMutation) AddOptionVoteIDs

func (m *PollOptionMutation) AddOptionVoteIDs(ids ...int)

AddOptionVoteIDs adds the "option_votes" edge to the PollVote entity by ids.

func (*PollOptionMutation) AddWeight

func (m *PollOptionMutation) AddWeight(i int)

AddWeight adds i to the "weight" field.

func (*PollOptionMutation) AddedEdges

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

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

func (*PollOptionMutation) AddedField

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

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

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

func (*PollOptionMutation) AddedIDs

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

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

func (*PollOptionMutation) AddedWeight

func (m *PollOptionMutation) AddedWeight() (r int, exists bool)

AddedWeight returns the value that was added to the "weight" field in this mutation.

func (*PollOptionMutation) ClearEdge

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

func (m *PollOptionMutation) 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 (*PollOptionMutation) ClearOptionVotes

func (m *PollOptionMutation) ClearOptionVotes()

ClearOptionVotes clears the "option_votes" edge to the PollVote entity.

func (*PollOptionMutation) ClearPoll

func (m *PollOptionMutation) ClearPoll()

ClearPoll clears the "poll" edge to the Poll entity.

func (*PollOptionMutation) ClearedEdges

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

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

func (*PollOptionMutation) ClearedFields

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

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

func (PollOptionMutation) Client

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

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

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

func (*PollOptionMutation) Field

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

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

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

func (*PollOptionMutation) Fields

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

func (m *PollOptionMutation) 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 (*PollOptionMutation) IDs

func (m *PollOptionMutation) 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 (*PollOptionMutation) Label

func (m *PollOptionMutation) Label() (r string, exists bool)

Label returns the value of the "label" field in the mutation.

func (*PollOptionMutation) OldField

func (m *PollOptionMutation) 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 (*PollOptionMutation) OldLabel

func (m *PollOptionMutation) OldLabel(ctx context.Context) (v string, err error)

OldLabel returns the old "label" field's value of the PollOption entity. If the PollOption 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 (*PollOptionMutation) OldPollID

func (m *PollOptionMutation) OldPollID(ctx context.Context) (v int, err error)

OldPollID returns the old "poll_id" field's value of the PollOption entity. If the PollOption 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 (*PollOptionMutation) OldWeight

func (m *PollOptionMutation) OldWeight(ctx context.Context) (v int, err error)

OldWeight returns the old "weight" field's value of the PollOption entity. If the PollOption 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 (*PollOptionMutation) Op

func (m *PollOptionMutation) Op() Op

Op returns the operation name.

func (*PollOptionMutation) OptionVotesCleared

func (m *PollOptionMutation) OptionVotesCleared() bool

OptionVotesCleared reports if the "option_votes" edge to the PollVote entity was cleared.

func (*PollOptionMutation) OptionVotesIDs

func (m *PollOptionMutation) OptionVotesIDs() (ids []int)

OptionVotesIDs returns the "option_votes" edge IDs in the mutation.

func (*PollOptionMutation) PollCleared

func (m *PollOptionMutation) PollCleared() bool

PollCleared reports if the "poll" edge to the Poll entity was cleared.

func (*PollOptionMutation) PollID

func (m *PollOptionMutation) PollID() (r int, exists bool)

PollID returns the value of the "poll_id" field in the mutation.

func (*PollOptionMutation) PollIDs

func (m *PollOptionMutation) PollIDs() (ids []int)

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

func (*PollOptionMutation) RemoveOptionVoteIDs

func (m *PollOptionMutation) RemoveOptionVoteIDs(ids ...int)

RemoveOptionVoteIDs removes the "option_votes" edge to the PollVote entity by IDs.

func (*PollOptionMutation) RemovedEdges

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

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

func (*PollOptionMutation) RemovedIDs

func (m *PollOptionMutation) 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 (*PollOptionMutation) RemovedOptionVotesIDs

func (m *PollOptionMutation) RemovedOptionVotesIDs() (ids []int)

RemovedOptionVotes returns the removed IDs of the "option_votes" edge to the PollVote entity.

func (*PollOptionMutation) ResetEdge

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

func (m *PollOptionMutation) 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 (*PollOptionMutation) ResetLabel

func (m *PollOptionMutation) ResetLabel()

ResetLabel resets all changes to the "label" field.

func (*PollOptionMutation) ResetOptionVotes

func (m *PollOptionMutation) ResetOptionVotes()

ResetOptionVotes resets all changes to the "option_votes" edge.

func (*PollOptionMutation) ResetPoll

func (m *PollOptionMutation) ResetPoll()

ResetPoll resets all changes to the "poll" edge.

func (*PollOptionMutation) ResetPollID

func (m *PollOptionMutation) ResetPollID()

ResetPollID resets all changes to the "poll_id" field.

func (*PollOptionMutation) ResetWeight

func (m *PollOptionMutation) ResetWeight()

ResetWeight resets all changes to the "weight" field.

func (*PollOptionMutation) SetField

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

func (m *PollOptionMutation) SetID(id int)

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

func (*PollOptionMutation) SetLabel

func (m *PollOptionMutation) SetLabel(s string)

SetLabel sets the "label" field.

func (*PollOptionMutation) SetOp

func (m *PollOptionMutation) SetOp(op Op)

SetOp allows setting the mutation operation.

func (*PollOptionMutation) SetPollID

func (m *PollOptionMutation) SetPollID(i int)

SetPollID sets the "poll_id" field.

func (*PollOptionMutation) SetWeight

func (m *PollOptionMutation) SetWeight(i int)

SetWeight sets the "weight" field.

func (PollOptionMutation) Tx

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

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

func (*PollOptionMutation) Type

func (m *PollOptionMutation) Type() string

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

func (*PollOptionMutation) Weight

func (m *PollOptionMutation) Weight() (r int, exists bool)

Weight returns the value of the "weight" field in the mutation.

func (*PollOptionMutation) Where

func (m *PollOptionMutation) Where(ps ...predicate.PollOption)

Where appends a list predicates to the PollOptionMutation builder.

func (*PollOptionMutation) WhereP

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

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

type PollOptionQuery

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

PollOptionQuery is the builder for querying PollOption entities.

func (*PollOptionQuery) Aggregate

func (_q *PollOptionQuery) Aggregate(fns ...AggregateFunc) *PollOptionSelect

Aggregate returns a PollOptionSelect configured with the given aggregations.

func (*PollOptionQuery) All

func (_q *PollOptionQuery) All(ctx context.Context) ([]*PollOption, error)

All executes the query and returns a list of PollOptions.

func (*PollOptionQuery) AllX

func (_q *PollOptionQuery) AllX(ctx context.Context) []*PollOption

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

func (*PollOptionQuery) Clone

func (_q *PollOptionQuery) Clone() *PollOptionQuery

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

func (*PollOptionQuery) Count

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

Count returns the count of the given query.

func (*PollOptionQuery) CountX

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

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

func (*PollOptionQuery) Exist

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

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

func (*PollOptionQuery) ExistX

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

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

func (*PollOptionQuery) First

func (_q *PollOptionQuery) First(ctx context.Context) (*PollOption, error)

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

func (*PollOptionQuery) FirstID

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

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

func (*PollOptionQuery) FirstIDX

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

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

func (*PollOptionQuery) FirstX

func (_q *PollOptionQuery) FirstX(ctx context.Context) *PollOption

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

func (*PollOptionQuery) GroupBy

func (_q *PollOptionQuery) GroupBy(field string, fields ...string) *PollOptionGroupBy

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 {
	PollID int `json:"poll_id,omitempty"`
	Count int `json:"count,omitempty"`
}

client.PollOption.Query().
	GroupBy(polloption.FieldPollID).
	Aggregate(generated.Count()).
	Scan(ctx, &v)

func (*PollOptionQuery) IDs

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

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

func (*PollOptionQuery) IDsX

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

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

func (*PollOptionQuery) Limit

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

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

func (*PollOptionQuery) Offset

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

Offset to start from.

func (*PollOptionQuery) Only

func (_q *PollOptionQuery) Only(ctx context.Context) (*PollOption, error)

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

func (*PollOptionQuery) OnlyID

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

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

func (*PollOptionQuery) OnlyIDX

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

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

func (*PollOptionQuery) OnlyX

func (_q *PollOptionQuery) OnlyX(ctx context.Context) *PollOption

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

func (*PollOptionQuery) Order

Order specifies how the records should be ordered.

func (*PollOptionQuery) QueryOptionVotes

func (_q *PollOptionQuery) QueryOptionVotes() *PollVoteQuery

QueryOptionVotes chains the current query on the "option_votes" edge.

func (*PollOptionQuery) QueryPoll

func (_q *PollOptionQuery) QueryPoll() *PollQuery

QueryPoll chains the current query on the "poll" edge.

func (*PollOptionQuery) Select

func (_q *PollOptionQuery) Select(fields ...string) *PollOptionSelect

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 {
	PollID int `json:"poll_id,omitempty"`
}

client.PollOption.Query().
	Select(polloption.FieldPollID).
	Scan(ctx, &v)

func (*PollOptionQuery) Unique

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

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

Where adds a new predicate for the PollOptionQuery builder.

func (*PollOptionQuery) WithOptionVotes

func (_q *PollOptionQuery) WithOptionVotes(opts ...func(*PollVoteQuery)) *PollOptionQuery

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

func (*PollOptionQuery) WithPoll

func (_q *PollOptionQuery) WithPoll(opts ...func(*PollQuery)) *PollOptionQuery

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

type PollOptionSelect

type PollOptionSelect struct {
	*PollOptionQuery
	// contains filtered or unexported fields
}

PollOptionSelect is the builder for selecting fields of PollOption entities.

func (*PollOptionSelect) Aggregate

func (_s *PollOptionSelect) Aggregate(fns ...AggregateFunc) *PollOptionSelect

Aggregate adds the given aggregation functions to the selector query.

func (*PollOptionSelect) Bool

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

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

func (*PollOptionSelect) BoolX

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

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

func (*PollOptionSelect) Bools

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

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

func (*PollOptionSelect) BoolsX

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

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

func (*PollOptionSelect) Float64

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

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

func (*PollOptionSelect) Float64X

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

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

func (*PollOptionSelect) Float64s

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

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

func (*PollOptionSelect) Float64sX

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

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

func (*PollOptionSelect) Int

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

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

func (*PollOptionSelect) IntX

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

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

func (*PollOptionSelect) Ints

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

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

func (*PollOptionSelect) IntsX

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

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

func (*PollOptionSelect) Scan

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

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

func (*PollOptionSelect) ScanX

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

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

func (*PollOptionSelect) String

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

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

func (*PollOptionSelect) StringX

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

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

func (*PollOptionSelect) Strings

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

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

func (*PollOptionSelect) StringsX

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

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

type PollOptionUpdate

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

PollOptionUpdate is the builder for updating PollOption entities.

func (*PollOptionUpdate) AddOptionVoteIDs

func (_u *PollOptionUpdate) AddOptionVoteIDs(ids ...int) *PollOptionUpdate

AddOptionVoteIDs adds the "option_votes" edge to the PollVote entity by IDs.

func (*PollOptionUpdate) AddOptionVotes

func (_u *PollOptionUpdate) AddOptionVotes(v ...*PollVote) *PollOptionUpdate

AddOptionVotes adds the "option_votes" edges to the PollVote entity.

func (*PollOptionUpdate) AddWeight

func (_u *PollOptionUpdate) AddWeight(v int) *PollOptionUpdate

AddWeight adds value to the "weight" field.

func (*PollOptionUpdate) ClearOptionVotes

func (_u *PollOptionUpdate) ClearOptionVotes() *PollOptionUpdate

ClearOptionVotes clears all "option_votes" edges to the PollVote entity.

func (*PollOptionUpdate) ClearPoll

func (_u *PollOptionUpdate) ClearPoll() *PollOptionUpdate

ClearPoll clears the "poll" edge to the Poll entity.

func (*PollOptionUpdate) Exec

func (_u *PollOptionUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*PollOptionUpdate) ExecX

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

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

func (*PollOptionUpdate) Mutation

func (_u *PollOptionUpdate) Mutation() *PollOptionMutation

Mutation returns the PollOptionMutation object of the builder.

func (*PollOptionUpdate) RemoveOptionVoteIDs

func (_u *PollOptionUpdate) RemoveOptionVoteIDs(ids ...int) *PollOptionUpdate

RemoveOptionVoteIDs removes the "option_votes" edge to PollVote entities by IDs.

func (*PollOptionUpdate) RemoveOptionVotes

func (_u *PollOptionUpdate) RemoveOptionVotes(v ...*PollVote) *PollOptionUpdate

RemoveOptionVotes removes "option_votes" edges to PollVote entities.

func (*PollOptionUpdate) Save

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

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

func (*PollOptionUpdate) SaveX

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

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

func (*PollOptionUpdate) SetLabel

func (_u *PollOptionUpdate) SetLabel(v string) *PollOptionUpdate

SetLabel sets the "label" field.

func (*PollOptionUpdate) SetNillableLabel

func (_u *PollOptionUpdate) SetNillableLabel(v *string) *PollOptionUpdate

SetNillableLabel sets the "label" field if the given value is not nil.

func (*PollOptionUpdate) SetNillablePollID

func (_u *PollOptionUpdate) SetNillablePollID(v *int) *PollOptionUpdate

SetNillablePollID sets the "poll_id" field if the given value is not nil.

func (*PollOptionUpdate) SetNillableWeight

func (_u *PollOptionUpdate) SetNillableWeight(v *int) *PollOptionUpdate

SetNillableWeight sets the "weight" field if the given value is not nil.

func (*PollOptionUpdate) SetPoll

func (_u *PollOptionUpdate) SetPoll(v *Poll) *PollOptionUpdate

SetPoll sets the "poll" edge to the Poll entity.

func (*PollOptionUpdate) SetPollID

func (_u *PollOptionUpdate) SetPollID(v int) *PollOptionUpdate

SetPollID sets the "poll_id" field.

func (*PollOptionUpdate) SetWeight

func (_u *PollOptionUpdate) SetWeight(v int) *PollOptionUpdate

SetWeight sets the "weight" field.

func (*PollOptionUpdate) Where

Where appends a list predicates to the PollOptionUpdate builder.

type PollOptionUpdateOne

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

PollOptionUpdateOne is the builder for updating a single PollOption entity.

func (*PollOptionUpdateOne) AddOptionVoteIDs

func (_u *PollOptionUpdateOne) AddOptionVoteIDs(ids ...int) *PollOptionUpdateOne

AddOptionVoteIDs adds the "option_votes" edge to the PollVote entity by IDs.

func (*PollOptionUpdateOne) AddOptionVotes

func (_u *PollOptionUpdateOne) AddOptionVotes(v ...*PollVote) *PollOptionUpdateOne

AddOptionVotes adds the "option_votes" edges to the PollVote entity.

func (*PollOptionUpdateOne) AddWeight

func (_u *PollOptionUpdateOne) AddWeight(v int) *PollOptionUpdateOne

AddWeight adds value to the "weight" field.

func (*PollOptionUpdateOne) ClearOptionVotes

func (_u *PollOptionUpdateOne) ClearOptionVotes() *PollOptionUpdateOne

ClearOptionVotes clears all "option_votes" edges to the PollVote entity.

func (*PollOptionUpdateOne) ClearPoll

func (_u *PollOptionUpdateOne) ClearPoll() *PollOptionUpdateOne

ClearPoll clears the "poll" edge to the Poll entity.

func (*PollOptionUpdateOne) Exec

func (_u *PollOptionUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*PollOptionUpdateOne) ExecX

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

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

func (*PollOptionUpdateOne) Mutation

func (_u *PollOptionUpdateOne) Mutation() *PollOptionMutation

Mutation returns the PollOptionMutation object of the builder.

func (*PollOptionUpdateOne) RemoveOptionVoteIDs

func (_u *PollOptionUpdateOne) RemoveOptionVoteIDs(ids ...int) *PollOptionUpdateOne

RemoveOptionVoteIDs removes the "option_votes" edge to PollVote entities by IDs.

func (*PollOptionUpdateOne) RemoveOptionVotes

func (_u *PollOptionUpdateOne) RemoveOptionVotes(v ...*PollVote) *PollOptionUpdateOne

RemoveOptionVotes removes "option_votes" edges to PollVote entities.

func (*PollOptionUpdateOne) Save

Save executes the query and returns the updated PollOption entity.

func (*PollOptionUpdateOne) SaveX

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

func (*PollOptionUpdateOne) Select

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

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

func (*PollOptionUpdateOne) SetLabel

SetLabel sets the "label" field.

func (*PollOptionUpdateOne) SetNillableLabel

func (_u *PollOptionUpdateOne) SetNillableLabel(v *string) *PollOptionUpdateOne

SetNillableLabel sets the "label" field if the given value is not nil.

func (*PollOptionUpdateOne) SetNillablePollID

func (_u *PollOptionUpdateOne) SetNillablePollID(v *int) *PollOptionUpdateOne

SetNillablePollID sets the "poll_id" field if the given value is not nil.

func (*PollOptionUpdateOne) SetNillableWeight

func (_u *PollOptionUpdateOne) SetNillableWeight(v *int) *PollOptionUpdateOne

SetNillableWeight sets the "weight" field if the given value is not nil.

func (*PollOptionUpdateOne) SetPoll

func (_u *PollOptionUpdateOne) SetPoll(v *Poll) *PollOptionUpdateOne

SetPoll sets the "poll" edge to the Poll entity.

func (*PollOptionUpdateOne) SetPollID

func (_u *PollOptionUpdateOne) SetPollID(v int) *PollOptionUpdateOne

SetPollID sets the "poll_id" field.

func (*PollOptionUpdateOne) SetWeight

func (_u *PollOptionUpdateOne) SetWeight(v int) *PollOptionUpdateOne

SetWeight sets the "weight" field.

func (*PollOptionUpdateOne) Where

Where appends a list predicates to the PollOptionUpdate builder.

type PollOptions

type PollOptions []*PollOption

PollOptions is a parsable slice of PollOption.

type PollQuery

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

PollQuery is the builder for querying Poll entities.

func (*PollQuery) Aggregate

func (_q *PollQuery) Aggregate(fns ...AggregateFunc) *PollSelect

Aggregate returns a PollSelect configured with the given aggregations.

func (*PollQuery) All

func (_q *PollQuery) All(ctx context.Context) ([]*Poll, error)

All executes the query and returns a list of Polls.

func (*PollQuery) AllX

func (_q *PollQuery) AllX(ctx context.Context) []*Poll

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

func (*PollQuery) Clone

func (_q *PollQuery) Clone() *PollQuery

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

func (*PollQuery) Count

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

Count returns the count of the given query.

func (*PollQuery) CountX

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

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

func (*PollQuery) Exist

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

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

func (*PollQuery) ExistX

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

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

func (*PollQuery) First

func (_q *PollQuery) First(ctx context.Context) (*Poll, error)

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

func (*PollQuery) FirstID

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

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

func (*PollQuery) FirstIDX

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

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

func (*PollQuery) FirstX

func (_q *PollQuery) FirstX(ctx context.Context) *Poll

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

func (*PollQuery) GroupBy

func (_q *PollQuery) GroupBy(field string, fields ...string) *PollGroupBy

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 {
	Nid int `json:"nid,omitempty"`
	Count int `json:"count,omitempty"`
}

client.Poll.Query().
	GroupBy(poll.FieldNid).
	Aggregate(generated.Count()).
	Scan(ctx, &v)

func (*PollQuery) IDs

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

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

func (*PollQuery) IDsX

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

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

func (*PollQuery) Limit

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

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

func (*PollQuery) Offset

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

Offset to start from.

func (*PollQuery) Only

func (_q *PollQuery) Only(ctx context.Context) (*Poll, error)

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

func (*PollQuery) OnlyID

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

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

func (*PollQuery) OnlyIDX

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

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

func (*PollQuery) OnlyX

func (_q *PollQuery) OnlyX(ctx context.Context) *Poll

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

func (*PollQuery) Order

func (_q *PollQuery) Order(o ...poll.OrderOption) *PollQuery

Order specifies how the records should be ordered.

func (*PollQuery) QueryNodes

func (_q *PollQuery) QueryNodes() *NodeQuery

QueryNodes chains the current query on the "nodes" edge.

func (*PollQuery) QueryOptions

func (_q *PollQuery) QueryOptions() *PollOptionQuery

QueryOptions chains the current query on the "options" edge.

func (*PollQuery) QueryVotes

func (_q *PollQuery) QueryVotes() *PollVoteQuery

QueryVotes chains the current query on the "votes" edge.

func (*PollQuery) Select

func (_q *PollQuery) Select(fields ...string) *PollSelect

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 {
	Nid int `json:"nid,omitempty"`
}

client.Poll.Query().
	Select(poll.FieldNid).
	Scan(ctx, &v)

func (*PollQuery) Unique

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

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

func (_q *PollQuery) Where(ps ...predicate.Poll) *PollQuery

Where adds a new predicate for the PollQuery builder.

func (*PollQuery) WithNodes

func (_q *PollQuery) WithNodes(opts ...func(*NodeQuery)) *PollQuery

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

func (*PollQuery) WithOptions

func (_q *PollQuery) WithOptions(opts ...func(*PollOptionQuery)) *PollQuery

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

func (*PollQuery) WithVotes

func (_q *PollQuery) WithVotes(opts ...func(*PollVoteQuery)) *PollQuery

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

type PollSelect

type PollSelect struct {
	*PollQuery
	// contains filtered or unexported fields
}

PollSelect is the builder for selecting fields of Poll entities.

func (*PollSelect) Aggregate

func (_s *PollSelect) Aggregate(fns ...AggregateFunc) *PollSelect

Aggregate adds the given aggregation functions to the selector query.

func (*PollSelect) Bool

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

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

func (*PollSelect) BoolX

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

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

func (*PollSelect) Bools

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

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

func (*PollSelect) BoolsX

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

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

func (*PollSelect) Float64

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

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

func (*PollSelect) Float64X

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

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

func (*PollSelect) Float64s

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

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

func (*PollSelect) Float64sX

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

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

func (*PollSelect) Int

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

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

func (*PollSelect) IntX

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

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

func (*PollSelect) Ints

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

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

func (*PollSelect) IntsX

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

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

func (*PollSelect) Scan

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

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

func (*PollSelect) ScanX

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

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

func (*PollSelect) String

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

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

func (*PollSelect) StringX

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

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

func (*PollSelect) Strings

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

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

func (*PollSelect) StringsX

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

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

type PollUpdate

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

PollUpdate is the builder for updating Poll entities.

func (*PollUpdate) AddMaxAnswers

func (_u *PollUpdate) AddMaxAnswers(v int) *PollUpdate

AddMaxAnswers adds value to the "max_answers" field.

func (*PollUpdate) AddOptionIDs

func (_u *PollUpdate) AddOptionIDs(ids ...int) *PollUpdate

AddOptionIDs adds the "options" edge to the PollOption entity by IDs.

func (*PollUpdate) AddOptions

func (_u *PollUpdate) AddOptions(v ...*PollOption) *PollUpdate

AddOptions adds the "options" edges to the PollOption entity.

func (*PollUpdate) AddVoteIDs

func (_u *PollUpdate) AddVoteIDs(ids ...int) *PollUpdate

AddVoteIDs adds the "votes" edge to the PollVote entity by IDs.

func (*PollUpdate) AddVotes

func (_u *PollUpdate) AddVotes(v ...*PollVote) *PollUpdate

AddVotes adds the "votes" edges to the PollVote entity.

func (*PollUpdate) ClearAvailableFrom

func (_u *PollUpdate) ClearAvailableFrom() *PollUpdate

ClearAvailableFrom clears the value of the "available_from" field.

func (*PollUpdate) ClearAvailableTo

func (_u *PollUpdate) ClearAvailableTo() *PollUpdate

ClearAvailableTo clears the value of the "available_to" field.

func (*PollUpdate) ClearDescription

func (_u *PollUpdate) ClearDescription() *PollUpdate

ClearDescription clears the value of the "description" field.

func (*PollUpdate) ClearNodes

func (_u *PollUpdate) ClearNodes() *PollUpdate

ClearNodes clears the "nodes" edge to the Node entity.

func (*PollUpdate) ClearOptions

func (_u *PollUpdate) ClearOptions() *PollUpdate

ClearOptions clears all "options" edges to the PollOption entity.

func (*PollUpdate) ClearVotes

func (_u *PollUpdate) ClearVotes() *PollUpdate

ClearVotes clears all "votes" edges to the PollVote entity.

func (*PollUpdate) Exec

func (_u *PollUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*PollUpdate) ExecX

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

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

func (*PollUpdate) Mutation

func (_u *PollUpdate) Mutation() *PollMutation

Mutation returns the PollMutation object of the builder.

func (*PollUpdate) RemoveOptionIDs

func (_u *PollUpdate) RemoveOptionIDs(ids ...int) *PollUpdate

RemoveOptionIDs removes the "options" edge to PollOption entities by IDs.

func (*PollUpdate) RemoveOptions

func (_u *PollUpdate) RemoveOptions(v ...*PollOption) *PollUpdate

RemoveOptions removes "options" edges to PollOption entities.

func (*PollUpdate) RemoveVoteIDs

func (_u *PollUpdate) RemoveVoteIDs(ids ...int) *PollUpdate

RemoveVoteIDs removes the "votes" edge to PollVote entities by IDs.

func (*PollUpdate) RemoveVotes

func (_u *PollUpdate) RemoveVotes(v ...*PollVote) *PollUpdate

RemoveVotes removes "votes" edges to PollVote entities.

func (*PollUpdate) Save

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

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

func (*PollUpdate) SaveX

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

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

func (*PollUpdate) SetAllowRevote

func (_u *PollUpdate) SetAllowRevote(v bool) *PollUpdate

SetAllowRevote sets the "allow_revote" field.

func (*PollUpdate) SetAvailableFrom

func (_u *PollUpdate) SetAvailableFrom(v time.Time) *PollUpdate

SetAvailableFrom sets the "available_from" field.

func (*PollUpdate) SetAvailableTo

func (_u *PollUpdate) SetAvailableTo(v time.Time) *PollUpdate

SetAvailableTo sets the "available_to" field.

func (*PollUpdate) SetDescription

func (_u *PollUpdate) SetDescription(v string) *PollUpdate

SetDescription sets the "description" field.

func (*PollUpdate) SetMaxAnswers

func (_u *PollUpdate) SetMaxAnswers(v int) *PollUpdate

SetMaxAnswers sets the "max_answers" field.

func (*PollUpdate) SetNid

func (_u *PollUpdate) SetNid(v int) *PollUpdate

SetNid sets the "nid" field.

func (*PollUpdate) SetNillableAllowRevote

func (_u *PollUpdate) SetNillableAllowRevote(v *bool) *PollUpdate

SetNillableAllowRevote sets the "allow_revote" field if the given value is not nil.

func (*PollUpdate) SetNillableAvailableFrom

func (_u *PollUpdate) SetNillableAvailableFrom(v *time.Time) *PollUpdate

SetNillableAvailableFrom sets the "available_from" field if the given value is not nil.

func (*PollUpdate) SetNillableAvailableTo

func (_u *PollUpdate) SetNillableAvailableTo(v *time.Time) *PollUpdate

SetNillableAvailableTo sets the "available_to" field if the given value is not nil.

func (*PollUpdate) SetNillableDescription

func (_u *PollUpdate) SetNillableDescription(v *string) *PollUpdate

SetNillableDescription sets the "description" field if the given value is not nil.

func (*PollUpdate) SetNillableMaxAnswers

func (_u *PollUpdate) SetNillableMaxAnswers(v *int) *PollUpdate

SetNillableMaxAnswers sets the "max_answers" field if the given value is not nil.

func (*PollUpdate) SetNillableNid

func (_u *PollUpdate) SetNillableNid(v *int) *PollUpdate

SetNillableNid sets the "nid" field if the given value is not nil.

func (*PollUpdate) SetNillableResultsOnly

func (_u *PollUpdate) SetNillableResultsOnly(v *bool) *PollUpdate

SetNillableResultsOnly sets the "results_only" field if the given value is not nil.

func (*PollUpdate) SetNodes

func (_u *PollUpdate) SetNodes(v *Node) *PollUpdate

SetNodes sets the "nodes" edge to the Node entity.

func (*PollUpdate) SetNodesID

func (_u *PollUpdate) SetNodesID(id int) *PollUpdate

SetNodesID sets the "nodes" edge to the Node entity by ID.

func (*PollUpdate) SetResultsOnly

func (_u *PollUpdate) SetResultsOnly(v bool) *PollUpdate

SetResultsOnly sets the "results_only" field.

func (*PollUpdate) Where

func (_u *PollUpdate) Where(ps ...predicate.Poll) *PollUpdate

Where appends a list predicates to the PollUpdate builder.

type PollUpdateOne

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

PollUpdateOne is the builder for updating a single Poll entity.

func (*PollUpdateOne) AddMaxAnswers

func (_u *PollUpdateOne) AddMaxAnswers(v int) *PollUpdateOne

AddMaxAnswers adds value to the "max_answers" field.

func (*PollUpdateOne) AddOptionIDs

func (_u *PollUpdateOne) AddOptionIDs(ids ...int) *PollUpdateOne

AddOptionIDs adds the "options" edge to the PollOption entity by IDs.

func (*PollUpdateOne) AddOptions

func (_u *PollUpdateOne) AddOptions(v ...*PollOption) *PollUpdateOne

AddOptions adds the "options" edges to the PollOption entity.

func (*PollUpdateOne) AddVoteIDs

func (_u *PollUpdateOne) AddVoteIDs(ids ...int) *PollUpdateOne

AddVoteIDs adds the "votes" edge to the PollVote entity by IDs.

func (*PollUpdateOne) AddVotes

func (_u *PollUpdateOne) AddVotes(v ...*PollVote) *PollUpdateOne

AddVotes adds the "votes" edges to the PollVote entity.

func (*PollUpdateOne) ClearAvailableFrom

func (_u *PollUpdateOne) ClearAvailableFrom() *PollUpdateOne

ClearAvailableFrom clears the value of the "available_from" field.

func (*PollUpdateOne) ClearAvailableTo

func (_u *PollUpdateOne) ClearAvailableTo() *PollUpdateOne

ClearAvailableTo clears the value of the "available_to" field.

func (*PollUpdateOne) ClearDescription

func (_u *PollUpdateOne) ClearDescription() *PollUpdateOne

ClearDescription clears the value of the "description" field.

func (*PollUpdateOne) ClearNodes

func (_u *PollUpdateOne) ClearNodes() *PollUpdateOne

ClearNodes clears the "nodes" edge to the Node entity.

func (*PollUpdateOne) ClearOptions

func (_u *PollUpdateOne) ClearOptions() *PollUpdateOne

ClearOptions clears all "options" edges to the PollOption entity.

func (*PollUpdateOne) ClearVotes

func (_u *PollUpdateOne) ClearVotes() *PollUpdateOne

ClearVotes clears all "votes" edges to the PollVote entity.

func (*PollUpdateOne) Exec

func (_u *PollUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*PollUpdateOne) ExecX

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

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

func (*PollUpdateOne) Mutation

func (_u *PollUpdateOne) Mutation() *PollMutation

Mutation returns the PollMutation object of the builder.

func (*PollUpdateOne) RemoveOptionIDs

func (_u *PollUpdateOne) RemoveOptionIDs(ids ...int) *PollUpdateOne

RemoveOptionIDs removes the "options" edge to PollOption entities by IDs.

func (*PollUpdateOne) RemoveOptions

func (_u *PollUpdateOne) RemoveOptions(v ...*PollOption) *PollUpdateOne

RemoveOptions removes "options" edges to PollOption entities.

func (*PollUpdateOne) RemoveVoteIDs

func (_u *PollUpdateOne) RemoveVoteIDs(ids ...int) *PollUpdateOne

RemoveVoteIDs removes the "votes" edge to PollVote entities by IDs.

func (*PollUpdateOne) RemoveVotes

func (_u *PollUpdateOne) RemoveVotes(v ...*PollVote) *PollUpdateOne

RemoveVotes removes "votes" edges to PollVote entities.

func (*PollUpdateOne) Save

func (_u *PollUpdateOne) Save(ctx context.Context) (*Poll, error)

Save executes the query and returns the updated Poll entity.

func (*PollUpdateOne) SaveX

func (_u *PollUpdateOne) SaveX(ctx context.Context) *Poll

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

func (*PollUpdateOne) Select

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

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

func (*PollUpdateOne) SetAllowRevote

func (_u *PollUpdateOne) SetAllowRevote(v bool) *PollUpdateOne

SetAllowRevote sets the "allow_revote" field.

func (*PollUpdateOne) SetAvailableFrom

func (_u *PollUpdateOne) SetAvailableFrom(v time.Time) *PollUpdateOne

SetAvailableFrom sets the "available_from" field.

func (*PollUpdateOne) SetAvailableTo

func (_u *PollUpdateOne) SetAvailableTo(v time.Time) *PollUpdateOne

SetAvailableTo sets the "available_to" field.

func (*PollUpdateOne) SetDescription

func (_u *PollUpdateOne) SetDescription(v string) *PollUpdateOne

SetDescription sets the "description" field.

func (*PollUpdateOne) SetMaxAnswers

func (_u *PollUpdateOne) SetMaxAnswers(v int) *PollUpdateOne

SetMaxAnswers sets the "max_answers" field.

func (*PollUpdateOne) SetNid

func (_u *PollUpdateOne) SetNid(v int) *PollUpdateOne

SetNid sets the "nid" field.

func (*PollUpdateOne) SetNillableAllowRevote

func (_u *PollUpdateOne) SetNillableAllowRevote(v *bool) *PollUpdateOne

SetNillableAllowRevote sets the "allow_revote" field if the given value is not nil.

func (*PollUpdateOne) SetNillableAvailableFrom

func (_u *PollUpdateOne) SetNillableAvailableFrom(v *time.Time) *PollUpdateOne

SetNillableAvailableFrom sets the "available_from" field if the given value is not nil.

func (*PollUpdateOne) SetNillableAvailableTo

func (_u *PollUpdateOne) SetNillableAvailableTo(v *time.Time) *PollUpdateOne

SetNillableAvailableTo sets the "available_to" field if the given value is not nil.

func (*PollUpdateOne) SetNillableDescription

func (_u *PollUpdateOne) SetNillableDescription(v *string) *PollUpdateOne

SetNillableDescription sets the "description" field if the given value is not nil.

func (*PollUpdateOne) SetNillableMaxAnswers

func (_u *PollUpdateOne) SetNillableMaxAnswers(v *int) *PollUpdateOne

SetNillableMaxAnswers sets the "max_answers" field if the given value is not nil.

func (*PollUpdateOne) SetNillableNid

func (_u *PollUpdateOne) SetNillableNid(v *int) *PollUpdateOne

SetNillableNid sets the "nid" field if the given value is not nil.

func (*PollUpdateOne) SetNillableResultsOnly

func (_u *PollUpdateOne) SetNillableResultsOnly(v *bool) *PollUpdateOne

SetNillableResultsOnly sets the "results_only" field if the given value is not nil.

func (*PollUpdateOne) SetNodes

func (_u *PollUpdateOne) SetNodes(v *Node) *PollUpdateOne

SetNodes sets the "nodes" edge to the Node entity.

func (*PollUpdateOne) SetNodesID

func (_u *PollUpdateOne) SetNodesID(id int) *PollUpdateOne

SetNodesID sets the "nodes" edge to the Node entity by ID.

func (*PollUpdateOne) SetResultsOnly

func (_u *PollUpdateOne) SetResultsOnly(v bool) *PollUpdateOne

SetResultsOnly sets the "results_only" field.

func (*PollUpdateOne) Where

func (_u *PollUpdateOne) Where(ps ...predicate.Poll) *PollUpdateOne

Where appends a list predicates to the PollUpdate builder.

type PollVote

type PollVote struct {

	// ID of the ent.
	ID int `json:"id,omitempty"`
	// PollID holds the value of the "poll_id" field.
	PollID int `json:"poll_id,omitempty"`
	// UserID holds the value of the "user_id" field.
	UserID int `json:"user_id,omitempty"`
	// OptionID holds the value of the "option_id" field.
	OptionID int `json:"option_id,omitempty"`
	// CreatedAt holds the value of the "created_at" field.
	CreatedAt time.Time `json:"created_at,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the PollVoteQuery when eager-loading is set.
	Edges PollVoteEdges `json:"edges"`
	// contains filtered or unexported fields
}

PollVote is the model entity for the PollVote schema.

func (*PollVote) QueryPoll

func (_m *PollVote) QueryPoll() *PollQuery

QueryPoll queries the "poll" edge of the PollVote entity.

func (*PollVote) QueryPollOption

func (_m *PollVote) QueryPollOption() *PollOptionQuery

QueryPollOption queries the "poll_option" edge of the PollVote entity.

func (*PollVote) QueryUsers

func (_m *PollVote) QueryUsers() *UserQuery

QueryUsers queries the "users" edge of the PollVote entity.

func (*PollVote) String

func (_m *PollVote) String() string

String implements the fmt.Stringer.

func (*PollVote) Unwrap

func (_m *PollVote) Unwrap() *PollVote

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

func (_m *PollVote) Update() *PollVoteUpdateOne

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

func (*PollVote) Value

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

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

type PollVoteClient

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

PollVoteClient is a client for the PollVote schema.

func NewPollVoteClient

func NewPollVoteClient(c config) *PollVoteClient

NewPollVoteClient returns a client for the PollVote from the given config.

func (*PollVoteClient) Create

func (c *PollVoteClient) Create() *PollVoteCreate

Create returns a builder for creating a PollVote entity.

func (*PollVoteClient) CreateBulk

func (c *PollVoteClient) CreateBulk(builders ...*PollVoteCreate) *PollVoteCreateBulk

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

func (*PollVoteClient) Delete

func (c *PollVoteClient) Delete() *PollVoteDelete

Delete returns a delete builder for PollVote.

func (*PollVoteClient) DeleteOne

func (c *PollVoteClient) DeleteOne(_m *PollVote) *PollVoteDeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*PollVoteClient) DeleteOneID

func (c *PollVoteClient) DeleteOneID(id int) *PollVoteDeleteOne

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

func (*PollVoteClient) Get

func (c *PollVoteClient) Get(ctx context.Context, id int) (*PollVote, error)

Get returns a PollVote entity by its id.

func (*PollVoteClient) GetX

func (c *PollVoteClient) GetX(ctx context.Context, id int) *PollVote

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

func (*PollVoteClient) Hooks

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

Hooks returns the client hooks.

func (*PollVoteClient) Intercept

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

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

func (*PollVoteClient) Interceptors

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

Interceptors returns the client interceptors.

func (*PollVoteClient) MapCreateBulk

func (c *PollVoteClient) MapCreateBulk(slice any, setFunc func(*PollVoteCreate, int)) *PollVoteCreateBulk

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

func (c *PollVoteClient) Query() *PollVoteQuery

Query returns a query builder for PollVote.

func (*PollVoteClient) QueryPoll

func (c *PollVoteClient) QueryPoll(_m *PollVote) *PollQuery

QueryPoll queries the poll edge of a PollVote.

func (*PollVoteClient) QueryPollOption

func (c *PollVoteClient) QueryPollOption(_m *PollVote) *PollOptionQuery

QueryPollOption queries the poll_option edge of a PollVote.

func (*PollVoteClient) QueryUsers

func (c *PollVoteClient) QueryUsers(_m *PollVote) *UserQuery

QueryUsers queries the users edge of a PollVote.

func (*PollVoteClient) Update

func (c *PollVoteClient) Update() *PollVoteUpdate

Update returns an update builder for PollVote.

func (*PollVoteClient) UpdateOne

func (c *PollVoteClient) UpdateOne(_m *PollVote) *PollVoteUpdateOne

UpdateOne returns an update builder for the given entity.

func (*PollVoteClient) UpdateOneID

func (c *PollVoteClient) UpdateOneID(id int) *PollVoteUpdateOne

UpdateOneID returns an update builder for the given id.

func (*PollVoteClient) Use

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

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

type PollVoteCreate

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

PollVoteCreate is the builder for creating a PollVote entity.

func (*PollVoteCreate) Exec

func (_c *PollVoteCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*PollVoteCreate) ExecX

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

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

func (*PollVoteCreate) Mutation

func (_c *PollVoteCreate) Mutation() *PollVoteMutation

Mutation returns the PollVoteMutation object of the builder.

func (*PollVoteCreate) Save

func (_c *PollVoteCreate) Save(ctx context.Context) (*PollVote, error)

Save creates the PollVote in the database.

func (*PollVoteCreate) SaveX

func (_c *PollVoteCreate) SaveX(ctx context.Context) *PollVote

SaveX calls Save and panics if Save returns an error.

func (*PollVoteCreate) SetCreatedAt

func (_c *PollVoteCreate) SetCreatedAt(v time.Time) *PollVoteCreate

SetCreatedAt sets the "created_at" field.

func (*PollVoteCreate) SetID

func (_c *PollVoteCreate) SetID(v int) *PollVoteCreate

SetID sets the "id" field.

func (*PollVoteCreate) SetNillableCreatedAt

func (_c *PollVoteCreate) SetNillableCreatedAt(v *time.Time) *PollVoteCreate

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

func (*PollVoteCreate) SetOptionID

func (_c *PollVoteCreate) SetOptionID(v int) *PollVoteCreate

SetOptionID sets the "option_id" field.

func (*PollVoteCreate) SetPoll

func (_c *PollVoteCreate) SetPoll(v *Poll) *PollVoteCreate

SetPoll sets the "poll" edge to the Poll entity.

func (*PollVoteCreate) SetPollID

func (_c *PollVoteCreate) SetPollID(v int) *PollVoteCreate

SetPollID sets the "poll_id" field.

func (*PollVoteCreate) SetPollOption

func (_c *PollVoteCreate) SetPollOption(v *PollOption) *PollVoteCreate

SetPollOption sets the "poll_option" edge to the PollOption entity.

func (*PollVoteCreate) SetPollOptionID

func (_c *PollVoteCreate) SetPollOptionID(id int) *PollVoteCreate

SetPollOptionID sets the "poll_option" edge to the PollOption entity by ID.

func (*PollVoteCreate) SetUserID

func (_c *PollVoteCreate) SetUserID(v int) *PollVoteCreate

SetUserID sets the "user_id" field.

func (*PollVoteCreate) SetUsers

func (_c *PollVoteCreate) SetUsers(v *User) *PollVoteCreate

SetUsers sets the "users" edge to the User entity.

func (*PollVoteCreate) SetUsersID

func (_c *PollVoteCreate) SetUsersID(id int) *PollVoteCreate

SetUsersID sets the "users" edge to the User entity by ID.

type PollVoteCreateBulk

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

PollVoteCreateBulk is the builder for creating many PollVote entities in bulk.

func (*PollVoteCreateBulk) Exec

func (_c *PollVoteCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*PollVoteCreateBulk) ExecX

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

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

func (*PollVoteCreateBulk) Save

func (_c *PollVoteCreateBulk) Save(ctx context.Context) ([]*PollVote, error)

Save creates the PollVote entities in the database.

func (*PollVoteCreateBulk) SaveX

func (_c *PollVoteCreateBulk) SaveX(ctx context.Context) []*PollVote

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

type PollVoteDelete

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

PollVoteDelete is the builder for deleting a PollVote entity.

func (*PollVoteDelete) Exec

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

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

func (*PollVoteDelete) ExecX

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

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

func (*PollVoteDelete) Where

func (_d *PollVoteDelete) Where(ps ...predicate.PollVote) *PollVoteDelete

Where appends a list predicates to the PollVoteDelete builder.

type PollVoteDeleteOne

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

PollVoteDeleteOne is the builder for deleting a single PollVote entity.

func (*PollVoteDeleteOne) Exec

func (_d *PollVoteDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*PollVoteDeleteOne) ExecX

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

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

func (*PollVoteDeleteOne) Where

Where appends a list predicates to the PollVoteDelete builder.

type PollVoteEdges

type PollVoteEdges struct {
	// Poll holds the value of the poll edge.
	Poll *Poll `json:"poll,omitempty"`
	// Users holds the value of the users edge.
	Users *User `json:"users,omitempty"`
	// PollOption holds the value of the poll_option edge.
	PollOption *PollOption `json:"poll_option,omitempty"`
	// contains filtered or unexported fields
}

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

func (PollVoteEdges) PollOptionOrErr

func (e PollVoteEdges) PollOptionOrErr() (*PollOption, error)

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

func (PollVoteEdges) PollOrErr

func (e PollVoteEdges) PollOrErr() (*Poll, error)

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

func (PollVoteEdges) UsersOrErr

func (e PollVoteEdges) UsersOrErr() (*User, error)

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

type PollVoteGroupBy

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

PollVoteGroupBy is the group-by builder for PollVote entities.

func (*PollVoteGroupBy) Aggregate

func (_g *PollVoteGroupBy) Aggregate(fns ...AggregateFunc) *PollVoteGroupBy

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

func (*PollVoteGroupBy) Bool

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

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

func (*PollVoteGroupBy) BoolX

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

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

func (*PollVoteGroupBy) Bools

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

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

func (*PollVoteGroupBy) BoolsX

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

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

func (*PollVoteGroupBy) Float64

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

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

func (*PollVoteGroupBy) Float64X

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

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

func (*PollVoteGroupBy) Float64s

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

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

func (*PollVoteGroupBy) Float64sX

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

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

func (*PollVoteGroupBy) Int

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

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

func (*PollVoteGroupBy) IntX

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

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

func (*PollVoteGroupBy) Ints

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

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

func (*PollVoteGroupBy) IntsX

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

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

func (*PollVoteGroupBy) Scan

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

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

func (*PollVoteGroupBy) ScanX

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

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

func (*PollVoteGroupBy) String

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

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

func (*PollVoteGroupBy) StringX

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

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

func (*PollVoteGroupBy) Strings

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

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

func (*PollVoteGroupBy) StringsX

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

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

type PollVoteMutation

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

PollVoteMutation represents an operation that mutates the PollVote nodes in the graph.

func (*PollVoteMutation) AddField

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

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

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

func (*PollVoteMutation) AddedField

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

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

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

func (*PollVoteMutation) AddedIDs

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

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

func (*PollVoteMutation) ClearEdge

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

func (m *PollVoteMutation) 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 (*PollVoteMutation) ClearPoll

func (m *PollVoteMutation) ClearPoll()

ClearPoll clears the "poll" edge to the Poll entity.

func (*PollVoteMutation) ClearPollOption

func (m *PollVoteMutation) ClearPollOption()

ClearPollOption clears the "poll_option" edge to the PollOption entity.

func (*PollVoteMutation) ClearUsers

func (m *PollVoteMutation) ClearUsers()

ClearUsers clears the "users" edge to the User entity.

func (*PollVoteMutation) ClearedEdges

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

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

func (*PollVoteMutation) ClearedFields

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

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

func (PollVoteMutation) Client

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

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

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

func (*PollVoteMutation) EdgeCleared

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

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

func (*PollVoteMutation) Field

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

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

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

func (*PollVoteMutation) Fields

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

func (m *PollVoteMutation) 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 (*PollVoteMutation) IDs

func (m *PollVoteMutation) 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 (*PollVoteMutation) OldCreatedAt

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

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

func (m *PollVoteMutation) 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 (*PollVoteMutation) OldOptionID

func (m *PollVoteMutation) OldOptionID(ctx context.Context) (v int, err error)

OldOptionID returns the old "option_id" field's value of the PollVote entity. If the PollVote 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 (*PollVoteMutation) OldPollID

func (m *PollVoteMutation) OldPollID(ctx context.Context) (v int, err error)

OldPollID returns the old "poll_id" field's value of the PollVote entity. If the PollVote 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 (*PollVoteMutation) OldUserID

func (m *PollVoteMutation) OldUserID(ctx context.Context) (v int, err error)

OldUserID returns the old "user_id" field's value of the PollVote entity. If the PollVote 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 (*PollVoteMutation) Op

func (m *PollVoteMutation) Op() Op

Op returns the operation name.

func (*PollVoteMutation) OptionID

func (m *PollVoteMutation) OptionID() (r int, exists bool)

OptionID returns the value of the "option_id" field in the mutation.

func (*PollVoteMutation) PollCleared

func (m *PollVoteMutation) PollCleared() bool

PollCleared reports if the "poll" edge to the Poll entity was cleared.

func (*PollVoteMutation) PollID

func (m *PollVoteMutation) PollID() (r int, exists bool)

PollID returns the value of the "poll_id" field in the mutation.

func (*PollVoteMutation) PollIDs

func (m *PollVoteMutation) PollIDs() (ids []int)

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

func (*PollVoteMutation) PollOptionCleared

func (m *PollVoteMutation) PollOptionCleared() bool

PollOptionCleared reports if the "poll_option" edge to the PollOption entity was cleared.

func (*PollVoteMutation) PollOptionID

func (m *PollVoteMutation) PollOptionID() (id int, exists bool)

PollOptionID returns the "poll_option" edge ID in the mutation.

func (*PollVoteMutation) PollOptionIDs

func (m *PollVoteMutation) PollOptionIDs() (ids []int)

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

func (*PollVoteMutation) RemovedEdges

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

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

func (*PollVoteMutation) RemovedIDs

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

func (m *PollVoteMutation) ResetCreatedAt()

ResetCreatedAt resets all changes to the "created_at" field.

func (*PollVoteMutation) ResetEdge

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

func (m *PollVoteMutation) 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 (*PollVoteMutation) ResetOptionID

func (m *PollVoteMutation) ResetOptionID()

ResetOptionID resets all changes to the "option_id" field.

func (*PollVoteMutation) ResetPoll

func (m *PollVoteMutation) ResetPoll()

ResetPoll resets all changes to the "poll" edge.

func (*PollVoteMutation) ResetPollID

func (m *PollVoteMutation) ResetPollID()

ResetPollID resets all changes to the "poll_id" field.

func (*PollVoteMutation) ResetPollOption

func (m *PollVoteMutation) ResetPollOption()

ResetPollOption resets all changes to the "poll_option" edge.

func (*PollVoteMutation) ResetUserID

func (m *PollVoteMutation) ResetUserID()

ResetUserID resets all changes to the "user_id" field.

func (*PollVoteMutation) ResetUsers

func (m *PollVoteMutation) ResetUsers()

ResetUsers resets all changes to the "users" edge.

func (*PollVoteMutation) SetCreatedAt

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

SetCreatedAt sets the "created_at" field.

func (*PollVoteMutation) SetField

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

func (m *PollVoteMutation) SetID(id int)

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

func (*PollVoteMutation) SetOp

func (m *PollVoteMutation) SetOp(op Op)

SetOp allows setting the mutation operation.

func (*PollVoteMutation) SetOptionID

func (m *PollVoteMutation) SetOptionID(i int)

SetOptionID sets the "option_id" field.

func (*PollVoteMutation) SetPollID

func (m *PollVoteMutation) SetPollID(i int)

SetPollID sets the "poll_id" field.

func (*PollVoteMutation) SetPollOptionID

func (m *PollVoteMutation) SetPollOptionID(id int)

SetPollOptionID sets the "poll_option" edge to the PollOption entity by id.

func (*PollVoteMutation) SetUserID

func (m *PollVoteMutation) SetUserID(i int)

SetUserID sets the "user_id" field.

func (*PollVoteMutation) SetUsersID

func (m *PollVoteMutation) SetUsersID(id int)

SetUsersID sets the "users" edge to the User entity by id.

func (PollVoteMutation) Tx

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

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

func (*PollVoteMutation) Type

func (m *PollVoteMutation) Type() string

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

func (*PollVoteMutation) UserID

func (m *PollVoteMutation) UserID() (r int, exists bool)

UserID returns the value of the "user_id" field in the mutation.

func (*PollVoteMutation) UsersCleared

func (m *PollVoteMutation) UsersCleared() bool

UsersCleared reports if the "users" edge to the User entity was cleared.

func (*PollVoteMutation) UsersID

func (m *PollVoteMutation) UsersID() (id int, exists bool)

UsersID returns the "users" edge ID in the mutation.

func (*PollVoteMutation) UsersIDs

func (m *PollVoteMutation) UsersIDs() (ids []int)

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

func (*PollVoteMutation) Where

func (m *PollVoteMutation) Where(ps ...predicate.PollVote)

Where appends a list predicates to the PollVoteMutation builder.

func (*PollVoteMutation) WhereP

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

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

type PollVoteQuery

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

PollVoteQuery is the builder for querying PollVote entities.

func (*PollVoteQuery) Aggregate

func (_q *PollVoteQuery) Aggregate(fns ...AggregateFunc) *PollVoteSelect

Aggregate returns a PollVoteSelect configured with the given aggregations.

func (*PollVoteQuery) All

func (_q *PollVoteQuery) All(ctx context.Context) ([]*PollVote, error)

All executes the query and returns a list of PollVotes.

func (*PollVoteQuery) AllX

func (_q *PollVoteQuery) AllX(ctx context.Context) []*PollVote

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

func (*PollVoteQuery) Clone

func (_q *PollVoteQuery) Clone() *PollVoteQuery

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

func (*PollVoteQuery) Count

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

Count returns the count of the given query.

func (*PollVoteQuery) CountX

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

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

func (*PollVoteQuery) Exist

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

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

func (*PollVoteQuery) ExistX

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

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

func (*PollVoteQuery) First

func (_q *PollVoteQuery) First(ctx context.Context) (*PollVote, error)

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

func (*PollVoteQuery) FirstID

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

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

func (*PollVoteQuery) FirstIDX

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

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

func (*PollVoteQuery) FirstX

func (_q *PollVoteQuery) FirstX(ctx context.Context) *PollVote

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

func (*PollVoteQuery) GroupBy

func (_q *PollVoteQuery) GroupBy(field string, fields ...string) *PollVoteGroupBy

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 {
	PollID int `json:"poll_id,omitempty"`
	Count int `json:"count,omitempty"`
}

client.PollVote.Query().
	GroupBy(pollvote.FieldPollID).
	Aggregate(generated.Count()).
	Scan(ctx, &v)

func (*PollVoteQuery) IDs

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

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

func (*PollVoteQuery) IDsX

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

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

func (*PollVoteQuery) Limit

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

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

func (*PollVoteQuery) Offset

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

Offset to start from.

func (*PollVoteQuery) Only

func (_q *PollVoteQuery) Only(ctx context.Context) (*PollVote, error)

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

func (*PollVoteQuery) OnlyID

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

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

func (*PollVoteQuery) OnlyIDX

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

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

func (*PollVoteQuery) OnlyX

func (_q *PollVoteQuery) OnlyX(ctx context.Context) *PollVote

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

func (*PollVoteQuery) Order

Order specifies how the records should be ordered.

func (*PollVoteQuery) QueryPoll

func (_q *PollVoteQuery) QueryPoll() *PollQuery

QueryPoll chains the current query on the "poll" edge.

func (*PollVoteQuery) QueryPollOption

func (_q *PollVoteQuery) QueryPollOption() *PollOptionQuery

QueryPollOption chains the current query on the "poll_option" edge.

func (*PollVoteQuery) QueryUsers

func (_q *PollVoteQuery) QueryUsers() *UserQuery

QueryUsers chains the current query on the "users" edge.

func (*PollVoteQuery) Select

func (_q *PollVoteQuery) Select(fields ...string) *PollVoteSelect

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 {
	PollID int `json:"poll_id,omitempty"`
}

client.PollVote.Query().
	Select(pollvote.FieldPollID).
	Scan(ctx, &v)

func (*PollVoteQuery) Unique

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

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

func (_q *PollVoteQuery) Where(ps ...predicate.PollVote) *PollVoteQuery

Where adds a new predicate for the PollVoteQuery builder.

func (*PollVoteQuery) WithPoll

func (_q *PollVoteQuery) WithPoll(opts ...func(*PollQuery)) *PollVoteQuery

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

func (*PollVoteQuery) WithPollOption

func (_q *PollVoteQuery) WithPollOption(opts ...func(*PollOptionQuery)) *PollVoteQuery

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

func (*PollVoteQuery) WithUsers

func (_q *PollVoteQuery) WithUsers(opts ...func(*UserQuery)) *PollVoteQuery

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

type PollVoteSelect

type PollVoteSelect struct {
	*PollVoteQuery
	// contains filtered or unexported fields
}

PollVoteSelect is the builder for selecting fields of PollVote entities.

func (*PollVoteSelect) Aggregate

func (_s *PollVoteSelect) Aggregate(fns ...AggregateFunc) *PollVoteSelect

Aggregate adds the given aggregation functions to the selector query.

func (*PollVoteSelect) Bool

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

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

func (*PollVoteSelect) BoolX

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

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

func (*PollVoteSelect) Bools

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

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

func (*PollVoteSelect) BoolsX

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

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

func (*PollVoteSelect) Float64

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

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

func (*PollVoteSelect) Float64X

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

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

func (*PollVoteSelect) Float64s

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

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

func (*PollVoteSelect) Float64sX

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

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

func (*PollVoteSelect) Int

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

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

func (*PollVoteSelect) IntX

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

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

func (*PollVoteSelect) Ints

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

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

func (*PollVoteSelect) IntsX

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

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

func (*PollVoteSelect) Scan

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

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

func (*PollVoteSelect) ScanX

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

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

func (*PollVoteSelect) String

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

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

func (*PollVoteSelect) StringX

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

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

func (*PollVoteSelect) Strings

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

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

func (*PollVoteSelect) StringsX

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

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

type PollVoteUpdate

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

PollVoteUpdate is the builder for updating PollVote entities.

func (*PollVoteUpdate) ClearPoll

func (_u *PollVoteUpdate) ClearPoll() *PollVoteUpdate

ClearPoll clears the "poll" edge to the Poll entity.

func (*PollVoteUpdate) ClearPollOption

func (_u *PollVoteUpdate) ClearPollOption() *PollVoteUpdate

ClearPollOption clears the "poll_option" edge to the PollOption entity.

func (*PollVoteUpdate) ClearUsers

func (_u *PollVoteUpdate) ClearUsers() *PollVoteUpdate

ClearUsers clears the "users" edge to the User entity.

func (*PollVoteUpdate) Exec

func (_u *PollVoteUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*PollVoteUpdate) ExecX

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

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

func (*PollVoteUpdate) Mutation

func (_u *PollVoteUpdate) Mutation() *PollVoteMutation

Mutation returns the PollVoteMutation object of the builder.

func (*PollVoteUpdate) Save

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

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

func (*PollVoteUpdate) SaveX

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

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

func (*PollVoteUpdate) SetCreatedAt

func (_u *PollVoteUpdate) SetCreatedAt(v time.Time) *PollVoteUpdate

SetCreatedAt sets the "created_at" field.

func (*PollVoteUpdate) SetNillableCreatedAt

func (_u *PollVoteUpdate) SetNillableCreatedAt(v *time.Time) *PollVoteUpdate

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

func (*PollVoteUpdate) SetNillableOptionID

func (_u *PollVoteUpdate) SetNillableOptionID(v *int) *PollVoteUpdate

SetNillableOptionID sets the "option_id" field if the given value is not nil.

func (*PollVoteUpdate) SetNillablePollID

func (_u *PollVoteUpdate) SetNillablePollID(v *int) *PollVoteUpdate

SetNillablePollID sets the "poll_id" field if the given value is not nil.

func (*PollVoteUpdate) SetNillableUserID

func (_u *PollVoteUpdate) SetNillableUserID(v *int) *PollVoteUpdate

SetNillableUserID sets the "user_id" field if the given value is not nil.

func (*PollVoteUpdate) SetOptionID

func (_u *PollVoteUpdate) SetOptionID(v int) *PollVoteUpdate

SetOptionID sets the "option_id" field.

func (*PollVoteUpdate) SetPoll

func (_u *PollVoteUpdate) SetPoll(v *Poll) *PollVoteUpdate

SetPoll sets the "poll" edge to the Poll entity.

func (*PollVoteUpdate) SetPollID

func (_u *PollVoteUpdate) SetPollID(v int) *PollVoteUpdate

SetPollID sets the "poll_id" field.

func (*PollVoteUpdate) SetPollOption

func (_u *PollVoteUpdate) SetPollOption(v *PollOption) *PollVoteUpdate

SetPollOption sets the "poll_option" edge to the PollOption entity.

func (*PollVoteUpdate) SetPollOptionID

func (_u *PollVoteUpdate) SetPollOptionID(id int) *PollVoteUpdate

SetPollOptionID sets the "poll_option" edge to the PollOption entity by ID.

func (*PollVoteUpdate) SetUserID

func (_u *PollVoteUpdate) SetUserID(v int) *PollVoteUpdate

SetUserID sets the "user_id" field.

func (*PollVoteUpdate) SetUsers

func (_u *PollVoteUpdate) SetUsers(v *User) *PollVoteUpdate

SetUsers sets the "users" edge to the User entity.

func (*PollVoteUpdate) SetUsersID

func (_u *PollVoteUpdate) SetUsersID(id int) *PollVoteUpdate

SetUsersID sets the "users" edge to the User entity by ID.

func (*PollVoteUpdate) Where

func (_u *PollVoteUpdate) Where(ps ...predicate.PollVote) *PollVoteUpdate

Where appends a list predicates to the PollVoteUpdate builder.

type PollVoteUpdateOne

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

PollVoteUpdateOne is the builder for updating a single PollVote entity.

func (*PollVoteUpdateOne) ClearPoll

func (_u *PollVoteUpdateOne) ClearPoll() *PollVoteUpdateOne

ClearPoll clears the "poll" edge to the Poll entity.

func (*PollVoteUpdateOne) ClearPollOption

func (_u *PollVoteUpdateOne) ClearPollOption() *PollVoteUpdateOne

ClearPollOption clears the "poll_option" edge to the PollOption entity.

func (*PollVoteUpdateOne) ClearUsers

func (_u *PollVoteUpdateOne) ClearUsers() *PollVoteUpdateOne

ClearUsers clears the "users" edge to the User entity.

func (*PollVoteUpdateOne) Exec

func (_u *PollVoteUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*PollVoteUpdateOne) ExecX

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

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

func (*PollVoteUpdateOne) Mutation

func (_u *PollVoteUpdateOne) Mutation() *PollVoteMutation

Mutation returns the PollVoteMutation object of the builder.

func (*PollVoteUpdateOne) Save

func (_u *PollVoteUpdateOne) Save(ctx context.Context) (*PollVote, error)

Save executes the query and returns the updated PollVote entity.

func (*PollVoteUpdateOne) SaveX

func (_u *PollVoteUpdateOne) SaveX(ctx context.Context) *PollVote

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

func (*PollVoteUpdateOne) Select

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

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

func (*PollVoteUpdateOne) SetCreatedAt

func (_u *PollVoteUpdateOne) SetCreatedAt(v time.Time) *PollVoteUpdateOne

SetCreatedAt sets the "created_at" field.

func (*PollVoteUpdateOne) SetNillableCreatedAt

func (_u *PollVoteUpdateOne) SetNillableCreatedAt(v *time.Time) *PollVoteUpdateOne

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

func (*PollVoteUpdateOne) SetNillableOptionID

func (_u *PollVoteUpdateOne) SetNillableOptionID(v *int) *PollVoteUpdateOne

SetNillableOptionID sets the "option_id" field if the given value is not nil.

func (*PollVoteUpdateOne) SetNillablePollID

func (_u *PollVoteUpdateOne) SetNillablePollID(v *int) *PollVoteUpdateOne

SetNillablePollID sets the "poll_id" field if the given value is not nil.

func (*PollVoteUpdateOne) SetNillableUserID

func (_u *PollVoteUpdateOne) SetNillableUserID(v *int) *PollVoteUpdateOne

SetNillableUserID sets the "user_id" field if the given value is not nil.

func (*PollVoteUpdateOne) SetOptionID

func (_u *PollVoteUpdateOne) SetOptionID(v int) *PollVoteUpdateOne

SetOptionID sets the "option_id" field.

func (*PollVoteUpdateOne) SetPoll

func (_u *PollVoteUpdateOne) SetPoll(v *Poll) *PollVoteUpdateOne

SetPoll sets the "poll" edge to the Poll entity.

func (*PollVoteUpdateOne) SetPollID

func (_u *PollVoteUpdateOne) SetPollID(v int) *PollVoteUpdateOne

SetPollID sets the "poll_id" field.

func (*PollVoteUpdateOne) SetPollOption

func (_u *PollVoteUpdateOne) SetPollOption(v *PollOption) *PollVoteUpdateOne

SetPollOption sets the "poll_option" edge to the PollOption entity.

func (*PollVoteUpdateOne) SetPollOptionID

func (_u *PollVoteUpdateOne) SetPollOptionID(id int) *PollVoteUpdateOne

SetPollOptionID sets the "poll_option" edge to the PollOption entity by ID.

func (*PollVoteUpdateOne) SetUserID

func (_u *PollVoteUpdateOne) SetUserID(v int) *PollVoteUpdateOne

SetUserID sets the "user_id" field.

func (*PollVoteUpdateOne) SetUsers

func (_u *PollVoteUpdateOne) SetUsers(v *User) *PollVoteUpdateOne

SetUsers sets the "users" edge to the User entity.

func (*PollVoteUpdateOne) SetUsersID

func (_u *PollVoteUpdateOne) SetUsersID(id int) *PollVoteUpdateOne

SetUsersID sets the "users" edge to the User entity by ID.

func (*PollVoteUpdateOne) Where

Where appends a list predicates to the PollVoteUpdate builder.

type PollVotes

type PollVotes []*PollVote

PollVotes is a parsable slice of PollVote.

type Polls

type Polls []*Poll

Polls is a parsable slice of Poll.

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 {

	// Node is the client for interacting with the Node builders.
	Node *NodeClient
	// Poll is the client for interacting with the Poll builders.
	Poll *PollClient
	// PollOption is the client for interacting with the PollOption builders.
	PollOption *PollOptionClient
	// PollVote is the client for interacting with the PollVote builders.
	PollVote *PollVoteClient
	// User is the client for interacting with the User builders.
	User *UserClient
	// 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 User

type User struct {

	// ID of the ent.
	ID int `json:"id,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the UserQuery when eager-loading is set.
	Edges UserEdges `json:"edges"`
	// contains filtered or unexported fields
}

User is the model entity for the User schema.

func (*User) QueryPollVotes

func (_m *User) QueryPollVotes() *PollVoteQuery

QueryPollVotes queries the "poll_votes" edge of the User entity.

func (*User) String

func (_m *User) String() string

String implements the fmt.Stringer.

func (*User) Unwrap

func (_m *User) Unwrap() *User

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

func (_m *User) Update() *UserUpdateOne

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

func (*User) Value

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

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

type UserClient

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

UserClient is a client for the User schema.

func NewUserClient

func NewUserClient(c config) *UserClient

NewUserClient returns a client for the User from the given config.

func (*UserClient) Create

func (c *UserClient) Create() *UserCreate

Create returns a builder for creating a User entity.

func (*UserClient) CreateBulk

func (c *UserClient) CreateBulk(builders ...*UserCreate) *UserCreateBulk

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

func (*UserClient) Delete

func (c *UserClient) Delete() *UserDelete

Delete returns a delete builder for User.

func (*UserClient) DeleteOne

func (c *UserClient) DeleteOne(_m *User) *UserDeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*UserClient) DeleteOneID

func (c *UserClient) DeleteOneID(id int) *UserDeleteOne

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

func (*UserClient) Get

func (c *UserClient) Get(ctx context.Context, id int) (*User, error)

Get returns a User entity by its id.

func (*UserClient) GetX

func (c *UserClient) GetX(ctx context.Context, id int) *User

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

func (*UserClient) Hooks

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

Hooks returns the client hooks.

func (*UserClient) Intercept

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

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

func (*UserClient) Interceptors

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

Interceptors returns the client interceptors.

func (*UserClient) MapCreateBulk

func (c *UserClient) MapCreateBulk(slice any, setFunc func(*UserCreate, int)) *UserCreateBulk

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

func (c *UserClient) Query() *UserQuery

Query returns a query builder for User.

func (*UserClient) QueryPollVotes

func (c *UserClient) QueryPollVotes(_m *User) *PollVoteQuery

QueryPollVotes queries the poll_votes edge of a User.

func (*UserClient) Update

func (c *UserClient) Update() *UserUpdate

Update returns an update builder for User.

func (*UserClient) UpdateOne

func (c *UserClient) UpdateOne(_m *User) *UserUpdateOne

UpdateOne returns an update builder for the given entity.

func (*UserClient) UpdateOneID

func (c *UserClient) UpdateOneID(id int) *UserUpdateOne

UpdateOneID returns an update builder for the given id.

func (*UserClient) Use

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

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

type UserCreate

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

UserCreate is the builder for creating a User entity.

func (*UserCreate) AddPollVoteIDs

func (_c *UserCreate) AddPollVoteIDs(ids ...int) *UserCreate

AddPollVoteIDs adds the "poll_votes" edge to the PollVote entity by IDs.

func (*UserCreate) AddPollVotes

func (_c *UserCreate) AddPollVotes(v ...*PollVote) *UserCreate

AddPollVotes adds the "poll_votes" edges to the PollVote entity.

func (*UserCreate) Exec

func (_c *UserCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*UserCreate) ExecX

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

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

func (*UserCreate) Mutation

func (_c *UserCreate) Mutation() *UserMutation

Mutation returns the UserMutation object of the builder.

func (*UserCreate) Save

func (_c *UserCreate) Save(ctx context.Context) (*User, error)

Save creates the User in the database.

func (*UserCreate) SaveX

func (_c *UserCreate) SaveX(ctx context.Context) *User

SaveX calls Save and panics if Save returns an error.

func (*UserCreate) SetID

func (_c *UserCreate) SetID(v int) *UserCreate

SetID sets the "id" field.

type UserCreateBulk

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

UserCreateBulk is the builder for creating many User entities in bulk.

func (*UserCreateBulk) Exec

func (_c *UserCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*UserCreateBulk) ExecX

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

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

func (*UserCreateBulk) Save

func (_c *UserCreateBulk) Save(ctx context.Context) ([]*User, error)

Save creates the User entities in the database.

func (*UserCreateBulk) SaveX

func (_c *UserCreateBulk) SaveX(ctx context.Context) []*User

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

type UserDelete

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

UserDelete is the builder for deleting a User entity.

func (*UserDelete) Exec

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

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

func (*UserDelete) ExecX

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

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

func (*UserDelete) Where

func (_d *UserDelete) Where(ps ...predicate.User) *UserDelete

Where appends a list predicates to the UserDelete builder.

type UserDeleteOne

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

UserDeleteOne is the builder for deleting a single User entity.

func (*UserDeleteOne) Exec

func (_d *UserDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*UserDeleteOne) ExecX

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

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

func (*UserDeleteOne) Where

func (_d *UserDeleteOne) Where(ps ...predicate.User) *UserDeleteOne

Where appends a list predicates to the UserDelete builder.

type UserEdges

type UserEdges struct {
	// PollVotes holds the value of the poll_votes edge.
	PollVotes []*PollVote `json:"poll_votes,omitempty"`
	// contains filtered or unexported fields
}

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

func (UserEdges) PollVotesOrErr

func (e UserEdges) PollVotesOrErr() ([]*PollVote, error)

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

type UserGroupBy

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

UserGroupBy is the group-by builder for User entities.

func (*UserGroupBy) Aggregate

func (_g *UserGroupBy) Aggregate(fns ...AggregateFunc) *UserGroupBy

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

func (*UserGroupBy) Bool

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

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

func (*UserGroupBy) BoolX

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

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

func (*UserGroupBy) Bools

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

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

func (*UserGroupBy) BoolsX

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

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

func (*UserGroupBy) Float64

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

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

func (*UserGroupBy) Float64X

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

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

func (*UserGroupBy) Float64s

func (s *UserGroupBy) Float64s(ctx context.Context) ([]float64, error)

Float64s returns list of float64s from a selector. It is only allowed when selecting one field.

func (*UserGroupBy) Float64sX

func (s *UserGroupBy) Float64sX(ctx context.Context) []float64

Float64sX is like Float64s, but panics if an error occurs.

func (*UserGroupBy) Int

func (s *UserGroupBy) Int(ctx context.Context) (_ int, err error)

Int returns a single int from a selector. It is only allowed when selecting one field.

func (*UserGroupBy) IntX

func (s *UserGroupBy) IntX(ctx context.Context) int

IntX is like Int, but panics if an error occurs.

func (*UserGroupBy) Ints

func (s *UserGroupBy) Ints(ctx context.Context) ([]int, error)

Ints returns list of ints from a selector. It is only allowed when selecting one field.

func (*UserGroupBy) IntsX

func (s *UserGroupBy) IntsX(ctx context.Context) []int

IntsX is like Ints, but panics if an error occurs.

func (*UserGroupBy) Scan

func (_g *UserGroupBy) Scan(ctx context.Context, v any) error

Scan applies the selector query and scans the result into the given value.

func (*UserGroupBy) ScanX

func (s *UserGroupBy) ScanX(ctx context.Context, v any)

ScanX is like Scan, but panics if an error occurs.

func (*UserGroupBy) String

func (s *UserGroupBy) String(ctx context.Context) (_ string, err error)

String returns a single string from a selector. It is only allowed when selecting one field.

func (*UserGroupBy) StringX

func (s *UserGroupBy) StringX(ctx context.Context) string

StringX is like String, but panics if an error occurs.

func (*UserGroupBy) Strings

func (s *UserGroupBy) Strings(ctx context.Context) ([]string, error)

Strings returns list of strings from a selector. It is only allowed when selecting one field.

func (*UserGroupBy) StringsX

func (s *UserGroupBy) StringsX(ctx context.Context) []string

StringsX is like Strings, but panics if an error occurs.

type UserMutation

type UserMutation struct {
	// contains filtered or unexported fields
}

UserMutation represents an operation that mutates the User nodes in the graph.

func (*UserMutation) AddField

func (m *UserMutation) 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 (*UserMutation) AddPollVoteIDs

func (m *UserMutation) AddPollVoteIDs(ids ...int)

AddPollVoteIDs adds the "poll_votes" edge to the PollVote entity by ids.

func (*UserMutation) AddedEdges

func (m *UserMutation) AddedEdges() []string

AddedEdges returns all edge names that were set/added in this mutation.

func (*UserMutation) AddedField

func (m *UserMutation) 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 (*UserMutation) AddedFields

func (m *UserMutation) AddedFields() []string

AddedFields returns all numeric fields that were incremented/decremented during this mutation.

func (*UserMutation) AddedIDs

func (m *UserMutation) AddedIDs(name string) []ent.Value

AddedIDs returns all IDs (to other nodes) that were added for the given edge name in this mutation.

func (*UserMutation) ClearEdge

func (m *UserMutation) 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 (*UserMutation) ClearField

func (m *UserMutation) 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 (*UserMutation) ClearPollVotes

func (m *UserMutation) ClearPollVotes()

ClearPollVotes clears the "poll_votes" edge to the PollVote entity.

func (*UserMutation) ClearedEdges

func (m *UserMutation) ClearedEdges() []string

ClearedEdges returns all edge names that were cleared in this mutation.

func (*UserMutation) ClearedFields

func (m *UserMutation) ClearedFields() []string

ClearedFields returns all nullable fields that were cleared during this mutation.

func (UserMutation) Client

func (m UserMutation) 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 (*UserMutation) EdgeCleared

func (m *UserMutation) EdgeCleared(name string) bool

EdgeCleared returns a boolean which indicates if the edge with the given name was cleared in this mutation.

func (*UserMutation) Field

func (m *UserMutation) 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 (*UserMutation) FieldCleared

func (m *UserMutation) FieldCleared(name string) bool

FieldCleared returns a boolean indicating if a field with the given name was cleared in this mutation.

func (*UserMutation) Fields

func (m *UserMutation) 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 (*UserMutation) ID

func (m *UserMutation) 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 (*UserMutation) IDs

func (m *UserMutation) 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 (*UserMutation) OldField

func (m *UserMutation) 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 (*UserMutation) Op

func (m *UserMutation) Op() Op

Op returns the operation name.

func (*UserMutation) PollVotesCleared

func (m *UserMutation) PollVotesCleared() bool

PollVotesCleared reports if the "poll_votes" edge to the PollVote entity was cleared.

func (*UserMutation) PollVotesIDs

func (m *UserMutation) PollVotesIDs() (ids []int)

PollVotesIDs returns the "poll_votes" edge IDs in the mutation.

func (*UserMutation) RemovePollVoteIDs

func (m *UserMutation) RemovePollVoteIDs(ids ...int)

RemovePollVoteIDs removes the "poll_votes" edge to the PollVote entity by IDs.

func (*UserMutation) RemovedEdges

func (m *UserMutation) RemovedEdges() []string

RemovedEdges returns all edge names that were removed in this mutation.

func (*UserMutation) RemovedIDs

func (m *UserMutation) 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 (*UserMutation) RemovedPollVotesIDs

func (m *UserMutation) RemovedPollVotesIDs() (ids []int)

RemovedPollVotes returns the removed IDs of the "poll_votes" edge to the PollVote entity.

func (*UserMutation) ResetEdge

func (m *UserMutation) 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 (*UserMutation) ResetField

func (m *UserMutation) 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 (*UserMutation) ResetPollVotes

func (m *UserMutation) ResetPollVotes()

ResetPollVotes resets all changes to the "poll_votes" edge.

func (*UserMutation) SetField

func (m *UserMutation) 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 (*UserMutation) SetID

func (m *UserMutation) SetID(id int)

SetID sets the value of the id field. Note that this operation is only accepted on creation of User entities.

func (*UserMutation) SetOp

func (m *UserMutation) SetOp(op Op)

SetOp allows setting the mutation operation.

func (UserMutation) Tx

func (m UserMutation) Tx() (*Tx, error)

Tx returns an `ent.Tx` for mutations that were executed in transactions; it returns an error otherwise.

func (*UserMutation) Type

func (m *UserMutation) Type() string

Type returns the node type of this mutation (User).

func (*UserMutation) Where

func (m *UserMutation) Where(ps ...predicate.User)

Where appends a list predicates to the UserMutation builder.

func (*UserMutation) WhereP

func (m *UserMutation) WhereP(ps ...func(*sql.Selector))

WhereP appends storage-level predicates to the UserMutation builder. Using this method, users can use type-assertion to append predicates that do not depend on any generated package.

type UserQuery

type UserQuery struct {
	// contains filtered or unexported fields
}

UserQuery is the builder for querying User entities.

func (*UserQuery) Aggregate

func (_q *UserQuery) Aggregate(fns ...AggregateFunc) *UserSelect

Aggregate returns a UserSelect configured with the given aggregations.

func (*UserQuery) All

func (_q *UserQuery) All(ctx context.Context) ([]*User, error)

All executes the query and returns a list of Users.

func (*UserQuery) AllX

func (_q *UserQuery) AllX(ctx context.Context) []*User

AllX is like All, but panics if an error occurs.

func (*UserQuery) Clone

func (_q *UserQuery) Clone() *UserQuery

Clone returns a duplicate of the UserQuery builder, including all associated steps. It can be used to prepare common query builders and use them differently after the clone is made.

func (*UserQuery) Count

func (_q *UserQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*UserQuery) CountX

func (_q *UserQuery) CountX(ctx context.Context) int

CountX is like Count, but panics if an error occurs.

func (*UserQuery) Exist

func (_q *UserQuery) Exist(ctx context.Context) (bool, error)

Exist returns true if the query has elements in the graph.

func (*UserQuery) ExistX

func (_q *UserQuery) ExistX(ctx context.Context) bool

ExistX is like Exist, but panics if an error occurs.

func (*UserQuery) First

func (_q *UserQuery) First(ctx context.Context) (*User, error)

First returns the first User entity from the query. Returns a *NotFoundError when no User was found.

func (*UserQuery) FirstID

func (_q *UserQuery) FirstID(ctx context.Context) (id int, err error)

FirstID returns the first User ID from the query. Returns a *NotFoundError when no User ID was found.

func (*UserQuery) FirstIDX

func (_q *UserQuery) FirstIDX(ctx context.Context) int

FirstIDX is like FirstID, but panics if an error occurs.

func (*UserQuery) FirstX

func (_q *UserQuery) FirstX(ctx context.Context) *User

FirstX is like First, but panics if an error occurs.

func (*UserQuery) GroupBy

func (_q *UserQuery) GroupBy(field string, fields ...string) *UserGroupBy

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.

func (*UserQuery) IDs

func (_q *UserQuery) IDs(ctx context.Context) (ids []int, err error)

IDs executes the query and returns a list of User IDs.

func (*UserQuery) IDsX

func (_q *UserQuery) IDsX(ctx context.Context) []int

IDsX is like IDs, but panics if an error occurs.

func (*UserQuery) Limit

func (_q *UserQuery) Limit(limit int) *UserQuery

Limit the number of records to be returned by this query.

func (*UserQuery) Offset

func (_q *UserQuery) Offset(offset int) *UserQuery

Offset to start from.

func (*UserQuery) Only

func (_q *UserQuery) Only(ctx context.Context) (*User, error)

Only returns a single User entity found by the query, ensuring it only returns one. Returns a *NotSingularError when more than one User entity is found. Returns a *NotFoundError when no User entities are found.

func (*UserQuery) OnlyID

func (_q *UserQuery) OnlyID(ctx context.Context) (id int, err error)

OnlyID is like Only, but returns the only User ID in the query. Returns a *NotSingularError when more than one User ID is found. Returns a *NotFoundError when no entities are found.

func (*UserQuery) OnlyIDX

func (_q *UserQuery) OnlyIDX(ctx context.Context) int

OnlyIDX is like OnlyID, but panics if an error occurs.

func (*UserQuery) OnlyX

func (_q *UserQuery) OnlyX(ctx context.Context) *User

OnlyX is like Only, but panics if an error occurs.

func (*UserQuery) Order

func (_q *UserQuery) Order(o ...user.OrderOption) *UserQuery

Order specifies how the records should be ordered.

func (*UserQuery) QueryPollVotes

func (_q *UserQuery) QueryPollVotes() *PollVoteQuery

QueryPollVotes chains the current query on the "poll_votes" edge.

func (*UserQuery) Select

func (_q *UserQuery) Select(fields ...string) *UserSelect

Select allows the selection one or more fields/columns for the given query, instead of selecting all fields in the entity.

func (*UserQuery) Unique

func (_q *UserQuery) Unique(unique bool) *UserQuery

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 (*UserQuery) Where

func (_q *UserQuery) Where(ps ...predicate.User) *UserQuery

Where adds a new predicate for the UserQuery builder.

func (*UserQuery) WithPollVotes

func (_q *UserQuery) WithPollVotes(opts ...func(*PollVoteQuery)) *UserQuery

WithPollVotes tells the query-builder to eager-load the nodes that are connected to the "poll_votes" edge. The optional arguments are used to configure the query builder of the edge.

type UserSelect

type UserSelect struct {
	*UserQuery
	// contains filtered or unexported fields
}

UserSelect is the builder for selecting fields of User entities.

func (*UserSelect) Aggregate

func (_s *UserSelect) Aggregate(fns ...AggregateFunc) *UserSelect

Aggregate adds the given aggregation functions to the selector query.

func (*UserSelect) Bool

func (s *UserSelect) Bool(ctx context.Context) (_ bool, err error)

Bool returns a single bool from a selector. It is only allowed when selecting one field.

func (*UserSelect) BoolX

func (s *UserSelect) BoolX(ctx context.Context) bool

BoolX is like Bool, but panics if an error occurs.

func (*UserSelect) Bools

func (s *UserSelect) Bools(ctx context.Context) ([]bool, error)

Bools returns list of bools from a selector. It is only allowed when selecting one field.

func (*UserSelect) BoolsX

func (s *UserSelect) BoolsX(ctx context.Context) []bool

BoolsX is like Bools, but panics if an error occurs.

func (*UserSelect) Float64

func (s *UserSelect) Float64(ctx context.Context) (_ float64, err error)

Float64 returns a single float64 from a selector. It is only allowed when selecting one field.

func (*UserSelect) Float64X

func (s *UserSelect) Float64X(ctx context.Context) float64

Float64X is like Float64, but panics if an error occurs.

func (*UserSelect) Float64s

func (s *UserSelect) Float64s(ctx context.Context) ([]float64, error)

Float64s returns list of float64s from a selector. It is only allowed when selecting one field.

func (*UserSelect) Float64sX

func (s *UserSelect) Float64sX(ctx context.Context) []float64

Float64sX is like Float64s, but panics if an error occurs.

func (*UserSelect) Int

func (s *UserSelect) Int(ctx context.Context) (_ int, err error)

Int returns a single int from a selector. It is only allowed when selecting one field.

func (*UserSelect) IntX

func (s *UserSelect) IntX(ctx context.Context) int

IntX is like Int, but panics if an error occurs.

func (*UserSelect) Ints

func (s *UserSelect) Ints(ctx context.Context) ([]int, error)

Ints returns list of ints from a selector. It is only allowed when selecting one field.

func (*UserSelect) IntsX

func (s *UserSelect) IntsX(ctx context.Context) []int

IntsX is like Ints, but panics if an error occurs.

func (*UserSelect) Scan

func (_s *UserSelect) Scan(ctx context.Context, v any) error

Scan applies the selector query and scans the result into the given value.

func (*UserSelect) ScanX

func (s *UserSelect) ScanX(ctx context.Context, v any)

ScanX is like Scan, but panics if an error occurs.

func (*UserSelect) String

func (s *UserSelect) String(ctx context.Context) (_ string, err error)

String returns a single string from a selector. It is only allowed when selecting one field.

func (*UserSelect) StringX

func (s *UserSelect) StringX(ctx context.Context) string

StringX is like String, but panics if an error occurs.

func (*UserSelect) Strings

func (s *UserSelect) Strings(ctx context.Context) ([]string, error)

Strings returns list of strings from a selector. It is only allowed when selecting one field.

func (*UserSelect) StringsX

func (s *UserSelect) StringsX(ctx context.Context) []string

StringsX is like Strings, but panics if an error occurs.

type UserUpdate

type UserUpdate struct {
	// contains filtered or unexported fields
}

UserUpdate is the builder for updating User entities.

func (*UserUpdate) AddPollVoteIDs

func (_u *UserUpdate) AddPollVoteIDs(ids ...int) *UserUpdate

AddPollVoteIDs adds the "poll_votes" edge to the PollVote entity by IDs.

func (*UserUpdate) AddPollVotes

func (_u *UserUpdate) AddPollVotes(v ...*PollVote) *UserUpdate

AddPollVotes adds the "poll_votes" edges to the PollVote entity.

func (*UserUpdate) ClearPollVotes

func (_u *UserUpdate) ClearPollVotes() *UserUpdate

ClearPollVotes clears all "poll_votes" edges to the PollVote entity.

func (*UserUpdate) Exec

func (_u *UserUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*UserUpdate) ExecX

func (_u *UserUpdate) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*UserUpdate) Mutation

func (_u *UserUpdate) Mutation() *UserMutation

Mutation returns the UserMutation object of the builder.

func (*UserUpdate) RemovePollVoteIDs

func (_u *UserUpdate) RemovePollVoteIDs(ids ...int) *UserUpdate

RemovePollVoteIDs removes the "poll_votes" edge to PollVote entities by IDs.

func (*UserUpdate) RemovePollVotes

func (_u *UserUpdate) RemovePollVotes(v ...*PollVote) *UserUpdate

RemovePollVotes removes "poll_votes" edges to PollVote entities.

func (*UserUpdate) Save

func (_u *UserUpdate) Save(ctx context.Context) (int, error)

Save executes the query and returns the number of nodes affected by the update operation.

func (*UserUpdate) SaveX

func (_u *UserUpdate) SaveX(ctx context.Context) int

SaveX is like Save, but panics if an error occurs.

func (*UserUpdate) Where

func (_u *UserUpdate) Where(ps ...predicate.User) *UserUpdate

Where appends a list predicates to the UserUpdate builder.

type UserUpdateOne

type UserUpdateOne struct {
	// contains filtered or unexported fields
}

UserUpdateOne is the builder for updating a single User entity.

func (*UserUpdateOne) AddPollVoteIDs

func (_u *UserUpdateOne) AddPollVoteIDs(ids ...int) *UserUpdateOne

AddPollVoteIDs adds the "poll_votes" edge to the PollVote entity by IDs.

func (*UserUpdateOne) AddPollVotes

func (_u *UserUpdateOne) AddPollVotes(v ...*PollVote) *UserUpdateOne

AddPollVotes adds the "poll_votes" edges to the PollVote entity.

func (*UserUpdateOne) ClearPollVotes

func (_u *UserUpdateOne) ClearPollVotes() *UserUpdateOne

ClearPollVotes clears all "poll_votes" edges to the PollVote entity.

func (*UserUpdateOne) Exec

func (_u *UserUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*UserUpdateOne) ExecX

func (_u *UserUpdateOne) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*UserUpdateOne) Mutation

func (_u *UserUpdateOne) Mutation() *UserMutation

Mutation returns the UserMutation object of the builder.

func (*UserUpdateOne) RemovePollVoteIDs

func (_u *UserUpdateOne) RemovePollVoteIDs(ids ...int) *UserUpdateOne

RemovePollVoteIDs removes the "poll_votes" edge to PollVote entities by IDs.

func (*UserUpdateOne) RemovePollVotes

func (_u *UserUpdateOne) RemovePollVotes(v ...*PollVote) *UserUpdateOne

RemovePollVotes removes "poll_votes" edges to PollVote entities.

func (*UserUpdateOne) Save

func (_u *UserUpdateOne) Save(ctx context.Context) (*User, error)

Save executes the query and returns the updated User entity.

func (*UserUpdateOne) SaveX

func (_u *UserUpdateOne) SaveX(ctx context.Context) *User

SaveX is like Save, but panics if an error occurs.

func (*UserUpdateOne) Select

func (_u *UserUpdateOne) Select(field string, fields ...string) *UserUpdateOne

Select allows selecting one or more fields (columns) of the returned entity. The default is selecting all fields defined in the entity schema.

func (*UserUpdateOne) Where

func (_u *UserUpdateOne) Where(ps ...predicate.User) *UserUpdateOne

Where appends a list predicates to the UserUpdate builder.

type Users

type Users []*User

Users is a parsable slice of User.

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