ent

package
v0.0.0-...-cdb1537 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2024 License: Apache-2.0 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.
	TypeBirthday   = "Birthday"
	TypeShitpost   = "Shitpost"
	TypeSignin     = "Signin"
	TypeUser       = "User"
	TypeVote       = "Vote"
	TypeVoteResult = "VoteResult"
)

Variables

This section is empty.

Functions

func Asc

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

Asc applies the given fields in ASC order.

func Desc

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

Desc applies the given fields in DESC order.

func IsConstraintError

func IsConstraintError(err error) bool

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

func IsNotFound

func IsNotFound(err error) bool

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

func IsNotLoaded

func IsNotLoaded(err error) bool

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

func IsNotSingular

func IsNotSingular(err error) bool

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

func IsValidationError

func IsValidationError(err error) bool

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

func MaskNotFound

func MaskNotFound(err error) error

MaskNotFound masks not found error.

func NewContext

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

NewContext returns a new context with the given Client attached.

func NewTxContext

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

NewTxContext returns a new context with the given Tx attached.

Types

type AggregateFunc

type AggregateFunc func(*sql.Selector) string

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

func As

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

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

func Count

func Count() AggregateFunc

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

func Max

func Max(field string) AggregateFunc

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

func Mean

func Mean(field string) AggregateFunc

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

func Min

func Min(field string) AggregateFunc

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

func Sum

func Sum(field string) AggregateFunc

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

type Birthday

type Birthday struct {

	// ID of the ent.
	ID int `json:"id,omitempty"`
	// The day of the month of the birthday
	Day int `json:"day,omitempty"`
	// The month of the birthday
	Month int `json:"month,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the BirthdayQuery when eager-loading is set.
	Edges BirthdayEdges `json:"edges"`
	// contains filtered or unexported fields
}

Birthday is the model entity for the Birthday schema.

func (*Birthday) QueryUser

func (b *Birthday) QueryUser() *UserQuery

QueryUser queries the "user" edge of the Birthday entity.

func (*Birthday) String

func (b *Birthday) String() string

String implements the fmt.Stringer.

func (*Birthday) Unwrap

func (b *Birthday) Unwrap() *Birthday

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

func (b *Birthday) Update() *BirthdayUpdateOne

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

func (*Birthday) Value

func (b *Birthday) Value(name string) (ent.Value, error)

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

type BirthdayClient

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

BirthdayClient is a client for the Birthday schema.

func NewBirthdayClient

func NewBirthdayClient(c config) *BirthdayClient

NewBirthdayClient returns a client for the Birthday from the given config.

func (*BirthdayClient) Create

func (c *BirthdayClient) Create() *BirthdayCreate

Create returns a builder for creating a Birthday entity.

func (*BirthdayClient) CreateBulk

func (c *BirthdayClient) CreateBulk(builders ...*BirthdayCreate) *BirthdayCreateBulk

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

func (*BirthdayClient) Delete

func (c *BirthdayClient) Delete() *BirthdayDelete

Delete returns a delete builder for Birthday.

func (*BirthdayClient) DeleteOne

func (c *BirthdayClient) DeleteOne(b *Birthday) *BirthdayDeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*BirthdayClient) DeleteOneID

func (c *BirthdayClient) DeleteOneID(id int) *BirthdayDeleteOne

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

func (*BirthdayClient) Get

func (c *BirthdayClient) Get(ctx context.Context, id int) (*Birthday, error)

Get returns a Birthday entity by its id.

func (*BirthdayClient) GetX

func (c *BirthdayClient) GetX(ctx context.Context, id int) *Birthday

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

func (*BirthdayClient) Hooks

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

Hooks returns the client hooks.

func (*BirthdayClient) Intercept

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

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

func (*BirthdayClient) Interceptors

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

Interceptors returns the client interceptors.

func (*BirthdayClient) Query

func (c *BirthdayClient) Query() *BirthdayQuery

Query returns a query builder for Birthday.

func (*BirthdayClient) QueryUser

func (c *BirthdayClient) QueryUser(b *Birthday) *UserQuery

QueryUser queries the user edge of a Birthday.

func (*BirthdayClient) Update

func (c *BirthdayClient) Update() *BirthdayUpdate

Update returns an update builder for Birthday.

func (*BirthdayClient) UpdateOne

func (c *BirthdayClient) UpdateOne(b *Birthday) *BirthdayUpdateOne

UpdateOne returns an update builder for the given entity.

func (*BirthdayClient) UpdateOneID

func (c *BirthdayClient) UpdateOneID(id int) *BirthdayUpdateOne

UpdateOneID returns an update builder for the given id.

func (*BirthdayClient) Use

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

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

type BirthdayCreate

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

BirthdayCreate is the builder for creating a Birthday entity.

func (*BirthdayCreate) Exec

func (bc *BirthdayCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*BirthdayCreate) ExecX

func (bc *BirthdayCreate) ExecX(ctx context.Context)

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

func (*BirthdayCreate) Mutation

func (bc *BirthdayCreate) Mutation() *BirthdayMutation

Mutation returns the BirthdayMutation object of the builder.

func (*BirthdayCreate) Save

func (bc *BirthdayCreate) Save(ctx context.Context) (*Birthday, error)

Save creates the Birthday in the database.

func (*BirthdayCreate) SaveX

func (bc *BirthdayCreate) SaveX(ctx context.Context) *Birthday

SaveX calls Save and panics if Save returns an error.

func (*BirthdayCreate) SetDay

func (bc *BirthdayCreate) SetDay(i int) *BirthdayCreate

SetDay sets the "day" field.

func (*BirthdayCreate) SetMonth

func (bc *BirthdayCreate) SetMonth(i int) *BirthdayCreate

SetMonth sets the "month" field.

func (*BirthdayCreate) SetNillableUserID

func (bc *BirthdayCreate) SetNillableUserID(id *string) *BirthdayCreate

SetNillableUserID sets the "user" edge to the User entity by ID if the given value is not nil.

func (*BirthdayCreate) SetUser

func (bc *BirthdayCreate) SetUser(u *User) *BirthdayCreate

SetUser sets the "user" edge to the User entity.

func (*BirthdayCreate) SetUserID

func (bc *BirthdayCreate) SetUserID(id string) *BirthdayCreate

SetUserID sets the "user" edge to the User entity by ID.

type BirthdayCreateBulk

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

BirthdayCreateBulk is the builder for creating many Birthday entities in bulk.

func (*BirthdayCreateBulk) Exec

func (bcb *BirthdayCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*BirthdayCreateBulk) ExecX

func (bcb *BirthdayCreateBulk) ExecX(ctx context.Context)

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

func (*BirthdayCreateBulk) Save

func (bcb *BirthdayCreateBulk) Save(ctx context.Context) ([]*Birthday, error)

Save creates the Birthday entities in the database.

func (*BirthdayCreateBulk) SaveX

func (bcb *BirthdayCreateBulk) SaveX(ctx context.Context) []*Birthday

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

type BirthdayDelete

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

BirthdayDelete is the builder for deleting a Birthday entity.

func (*BirthdayDelete) Exec

func (bd *BirthdayDelete) Exec(ctx context.Context) (int, error)

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

func (*BirthdayDelete) ExecX

func (bd *BirthdayDelete) ExecX(ctx context.Context) int

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

func (*BirthdayDelete) Where

func (bd *BirthdayDelete) Where(ps ...predicate.Birthday) *BirthdayDelete

Where appends a list predicates to the BirthdayDelete builder.

type BirthdayDeleteOne

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

BirthdayDeleteOne is the builder for deleting a single Birthday entity.

func (*BirthdayDeleteOne) Exec

func (bdo *BirthdayDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*BirthdayDeleteOne) ExecX

func (bdo *BirthdayDeleteOne) ExecX(ctx context.Context)

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

func (*BirthdayDeleteOne) Where

Where appends a list predicates to the BirthdayDelete builder.

type BirthdayEdges

type BirthdayEdges struct {
	// User holds the value of the user edge.
	User *User `json:"user,omitempty"`
	// contains filtered or unexported fields
}

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

func (BirthdayEdges) UserOrErr

func (e BirthdayEdges) UserOrErr() (*User, error)

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

type BirthdayGroupBy

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

BirthdayGroupBy is the group-by builder for Birthday entities.

func (*BirthdayGroupBy) Aggregate

func (bgb *BirthdayGroupBy) Aggregate(fns ...AggregateFunc) *BirthdayGroupBy

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

func (*BirthdayGroupBy) Bool

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

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

func (*BirthdayGroupBy) BoolX

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

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

func (*BirthdayGroupBy) Bools

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

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

func (*BirthdayGroupBy) BoolsX

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

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

func (*BirthdayGroupBy) Float64

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

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

func (*BirthdayGroupBy) Float64X

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

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

func (*BirthdayGroupBy) Float64s

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

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

func (*BirthdayGroupBy) Float64sX

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

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

func (*BirthdayGroupBy) Int

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

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

func (*BirthdayGroupBy) IntX

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

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

func (*BirthdayGroupBy) Ints

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

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

func (*BirthdayGroupBy) IntsX

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

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

func (*BirthdayGroupBy) Scan

func (bgb *BirthdayGroupBy) Scan(ctx context.Context, v any) error

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

func (*BirthdayGroupBy) ScanX

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

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

func (*BirthdayGroupBy) String

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

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

func (*BirthdayGroupBy) StringX

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

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

func (*BirthdayGroupBy) Strings

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

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

func (*BirthdayGroupBy) StringsX

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

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

type BirthdayMutation

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

BirthdayMutation represents an operation that mutates the Birthday nodes in the graph.

func (*BirthdayMutation) AddDay

func (m *BirthdayMutation) AddDay(i int)

AddDay adds i to the "day" field.

func (*BirthdayMutation) AddField

func (m *BirthdayMutation) 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 (*BirthdayMutation) AddMonth

func (m *BirthdayMutation) AddMonth(i int)

AddMonth adds i to the "month" field.

func (*BirthdayMutation) AddedDay

func (m *BirthdayMutation) AddedDay() (r int, exists bool)

AddedDay returns the value that was added to the "day" field in this mutation.

func (*BirthdayMutation) AddedEdges

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

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

func (*BirthdayMutation) AddedField

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

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

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

func (*BirthdayMutation) AddedIDs

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

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

func (*BirthdayMutation) AddedMonth

func (m *BirthdayMutation) AddedMonth() (r int, exists bool)

AddedMonth returns the value that was added to the "month" field in this mutation.

func (*BirthdayMutation) ClearEdge

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

func (m *BirthdayMutation) 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 (*BirthdayMutation) ClearUser

func (m *BirthdayMutation) ClearUser()

ClearUser clears the "user" edge to the User entity.

func (*BirthdayMutation) ClearedEdges

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

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

func (*BirthdayMutation) ClearedFields

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

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

func (BirthdayMutation) Client

func (m BirthdayMutation) 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 (*BirthdayMutation) Day

func (m *BirthdayMutation) Day() (r int, exists bool)

Day returns the value of the "day" field in the mutation.

func (*BirthdayMutation) EdgeCleared

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

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

func (*BirthdayMutation) Field

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

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

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

func (*BirthdayMutation) Fields

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

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

func (m *BirthdayMutation) 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 (*BirthdayMutation) Month

func (m *BirthdayMutation) Month() (r int, exists bool)

Month returns the value of the "month" field in the mutation.

func (*BirthdayMutation) OldDay

func (m *BirthdayMutation) OldDay(ctx context.Context) (v int, err error)

OldDay returns the old "day" field's value of the Birthday entity. If the Birthday 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 (*BirthdayMutation) OldField

func (m *BirthdayMutation) 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 (*BirthdayMutation) OldMonth

func (m *BirthdayMutation) OldMonth(ctx context.Context) (v int, err error)

OldMonth returns the old "month" field's value of the Birthday entity. If the Birthday 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 (*BirthdayMutation) Op

func (m *BirthdayMutation) Op() Op

Op returns the operation name.

func (*BirthdayMutation) RemovedEdges

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

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

func (*BirthdayMutation) RemovedIDs

func (m *BirthdayMutation) 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 (*BirthdayMutation) ResetDay

func (m *BirthdayMutation) ResetDay()

ResetDay resets all changes to the "day" field.

func (*BirthdayMutation) ResetEdge

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

func (m *BirthdayMutation) 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 (*BirthdayMutation) ResetMonth

func (m *BirthdayMutation) ResetMonth()

ResetMonth resets all changes to the "month" field.

func (*BirthdayMutation) ResetUser

func (m *BirthdayMutation) ResetUser()

ResetUser resets all changes to the "user" edge.

func (*BirthdayMutation) SetDay

func (m *BirthdayMutation) SetDay(i int)

SetDay sets the "day" field.

func (*BirthdayMutation) SetField

func (m *BirthdayMutation) 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 (*BirthdayMutation) SetMonth

func (m *BirthdayMutation) SetMonth(i int)

SetMonth sets the "month" field.

func (*BirthdayMutation) SetOp

func (m *BirthdayMutation) SetOp(op Op)

SetOp allows setting the mutation operation.

func (*BirthdayMutation) SetUserID

func (m *BirthdayMutation) SetUserID(id string)

SetUserID sets the "user" edge to the User entity by id.

func (BirthdayMutation) Tx

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

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

func (*BirthdayMutation) Type

func (m *BirthdayMutation) Type() string

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

func (*BirthdayMutation) UserCleared

func (m *BirthdayMutation) UserCleared() bool

UserCleared reports if the "user" edge to the User entity was cleared.

func (*BirthdayMutation) UserID

func (m *BirthdayMutation) UserID() (id string, exists bool)

UserID returns the "user" edge ID in the mutation.

func (*BirthdayMutation) UserIDs

func (m *BirthdayMutation) UserIDs() (ids []string)

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

func (*BirthdayMutation) Where

func (m *BirthdayMutation) Where(ps ...predicate.Birthday)

Where appends a list predicates to the BirthdayMutation builder.

func (*BirthdayMutation) WhereP

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

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

type BirthdayQuery

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

BirthdayQuery is the builder for querying Birthday entities.

func (*BirthdayQuery) Aggregate

func (bq *BirthdayQuery) Aggregate(fns ...AggregateFunc) *BirthdaySelect

Aggregate returns a BirthdaySelect configured with the given aggregations.

func (*BirthdayQuery) All

func (bq *BirthdayQuery) All(ctx context.Context) ([]*Birthday, error)

All executes the query and returns a list of Birthdays.

func (*BirthdayQuery) AllX

func (bq *BirthdayQuery) AllX(ctx context.Context) []*Birthday

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

func (*BirthdayQuery) Clone

func (bq *BirthdayQuery) Clone() *BirthdayQuery

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

func (*BirthdayQuery) Count

func (bq *BirthdayQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*BirthdayQuery) CountX

func (bq *BirthdayQuery) CountX(ctx context.Context) int

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

func (*BirthdayQuery) Exist

func (bq *BirthdayQuery) Exist(ctx context.Context) (bool, error)

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

func (*BirthdayQuery) ExistX

func (bq *BirthdayQuery) ExistX(ctx context.Context) bool

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

func (*BirthdayQuery) First

func (bq *BirthdayQuery) First(ctx context.Context) (*Birthday, error)

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

func (*BirthdayQuery) FirstID

func (bq *BirthdayQuery) FirstID(ctx context.Context) (id int, err error)

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

func (*BirthdayQuery) FirstIDX

func (bq *BirthdayQuery) FirstIDX(ctx context.Context) int

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

func (*BirthdayQuery) FirstX

func (bq *BirthdayQuery) FirstX(ctx context.Context) *Birthday

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

func (*BirthdayQuery) GroupBy

func (bq *BirthdayQuery) GroupBy(field string, fields ...string) *BirthdayGroupBy

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

client.Birthday.Query().
	GroupBy(birthday.FieldDay).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*BirthdayQuery) IDs

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

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

func (*BirthdayQuery) IDsX

func (bq *BirthdayQuery) IDsX(ctx context.Context) []int

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

func (*BirthdayQuery) Limit

func (bq *BirthdayQuery) Limit(limit int) *BirthdayQuery

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

func (*BirthdayQuery) Offset

func (bq *BirthdayQuery) Offset(offset int) *BirthdayQuery

Offset to start from.

func (*BirthdayQuery) Only

func (bq *BirthdayQuery) Only(ctx context.Context) (*Birthday, error)

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

func (*BirthdayQuery) OnlyID

func (bq *BirthdayQuery) OnlyID(ctx context.Context) (id int, err error)

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

func (*BirthdayQuery) OnlyIDX

func (bq *BirthdayQuery) OnlyIDX(ctx context.Context) int

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

func (*BirthdayQuery) OnlyX

func (bq *BirthdayQuery) OnlyX(ctx context.Context) *Birthday

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

func (*BirthdayQuery) Order

Order specifies how the records should be ordered.

func (*BirthdayQuery) QueryUser

func (bq *BirthdayQuery) QueryUser() *UserQuery

QueryUser chains the current query on the "user" edge.

func (*BirthdayQuery) Select

func (bq *BirthdayQuery) Select(fields ...string) *BirthdaySelect

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

client.Birthday.Query().
	Select(birthday.FieldDay).
	Scan(ctx, &v)

func (*BirthdayQuery) Unique

func (bq *BirthdayQuery) Unique(unique bool) *BirthdayQuery

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

func (bq *BirthdayQuery) Where(ps ...predicate.Birthday) *BirthdayQuery

Where adds a new predicate for the BirthdayQuery builder.

func (*BirthdayQuery) WithUser

func (bq *BirthdayQuery) WithUser(opts ...func(*UserQuery)) *BirthdayQuery

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

type BirthdaySelect

type BirthdaySelect struct {
	*BirthdayQuery
	// contains filtered or unexported fields
}

BirthdaySelect is the builder for selecting fields of Birthday entities.

func (*BirthdaySelect) Aggregate

func (bs *BirthdaySelect) Aggregate(fns ...AggregateFunc) *BirthdaySelect

Aggregate adds the given aggregation functions to the selector query.

func (*BirthdaySelect) Bool

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

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

func (*BirthdaySelect) BoolX

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

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

func (*BirthdaySelect) Bools

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

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

func (*BirthdaySelect) BoolsX

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

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

func (*BirthdaySelect) Float64

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

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

func (*BirthdaySelect) Float64X

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

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

func (*BirthdaySelect) Float64s

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

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

func (*BirthdaySelect) Float64sX

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

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

func (*BirthdaySelect) Int

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

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

func (*BirthdaySelect) IntX

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

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

func (*BirthdaySelect) Ints

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

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

func (*BirthdaySelect) IntsX

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

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

func (*BirthdaySelect) Scan

func (bs *BirthdaySelect) Scan(ctx context.Context, v any) error

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

func (*BirthdaySelect) ScanX

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

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

func (*BirthdaySelect) String

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

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

func (*BirthdaySelect) StringX

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

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

func (*BirthdaySelect) Strings

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

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

func (*BirthdaySelect) StringsX

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

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

type BirthdayUpdate

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

BirthdayUpdate is the builder for updating Birthday entities.

func (*BirthdayUpdate) AddDay

func (bu *BirthdayUpdate) AddDay(i int) *BirthdayUpdate

AddDay adds i to the "day" field.

func (*BirthdayUpdate) AddMonth

func (bu *BirthdayUpdate) AddMonth(i int) *BirthdayUpdate

AddMonth adds i to the "month" field.

func (*BirthdayUpdate) ClearUser

func (bu *BirthdayUpdate) ClearUser() *BirthdayUpdate

ClearUser clears the "user" edge to the User entity.

func (*BirthdayUpdate) Exec

func (bu *BirthdayUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*BirthdayUpdate) ExecX

func (bu *BirthdayUpdate) ExecX(ctx context.Context)

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

func (*BirthdayUpdate) Mutation

func (bu *BirthdayUpdate) Mutation() *BirthdayMutation

Mutation returns the BirthdayMutation object of the builder.

func (*BirthdayUpdate) Save

func (bu *BirthdayUpdate) Save(ctx context.Context) (int, error)

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

func (*BirthdayUpdate) SaveX

func (bu *BirthdayUpdate) SaveX(ctx context.Context) int

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

func (*BirthdayUpdate) SetDay

func (bu *BirthdayUpdate) SetDay(i int) *BirthdayUpdate

SetDay sets the "day" field.

func (*BirthdayUpdate) SetMonth

func (bu *BirthdayUpdate) SetMonth(i int) *BirthdayUpdate

SetMonth sets the "month" field.

func (*BirthdayUpdate) SetNillableUserID

func (bu *BirthdayUpdate) SetNillableUserID(id *string) *BirthdayUpdate

SetNillableUserID sets the "user" edge to the User entity by ID if the given value is not nil.

func (*BirthdayUpdate) SetUser

func (bu *BirthdayUpdate) SetUser(u *User) *BirthdayUpdate

SetUser sets the "user" edge to the User entity.

func (*BirthdayUpdate) SetUserID

func (bu *BirthdayUpdate) SetUserID(id string) *BirthdayUpdate

SetUserID sets the "user" edge to the User entity by ID.

func (*BirthdayUpdate) Where

func (bu *BirthdayUpdate) Where(ps ...predicate.Birthday) *BirthdayUpdate

Where appends a list predicates to the BirthdayUpdate builder.

type BirthdayUpdateOne

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

BirthdayUpdateOne is the builder for updating a single Birthday entity.

func (*BirthdayUpdateOne) AddDay

func (buo *BirthdayUpdateOne) AddDay(i int) *BirthdayUpdateOne

AddDay adds i to the "day" field.

func (*BirthdayUpdateOne) AddMonth

func (buo *BirthdayUpdateOne) AddMonth(i int) *BirthdayUpdateOne

AddMonth adds i to the "month" field.

func (*BirthdayUpdateOne) ClearUser

func (buo *BirthdayUpdateOne) ClearUser() *BirthdayUpdateOne

ClearUser clears the "user" edge to the User entity.

func (*BirthdayUpdateOne) Exec

func (buo *BirthdayUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*BirthdayUpdateOne) ExecX

func (buo *BirthdayUpdateOne) ExecX(ctx context.Context)

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

func (*BirthdayUpdateOne) Mutation

func (buo *BirthdayUpdateOne) Mutation() *BirthdayMutation

Mutation returns the BirthdayMutation object of the builder.

func (*BirthdayUpdateOne) Save

func (buo *BirthdayUpdateOne) Save(ctx context.Context) (*Birthday, error)

Save executes the query and returns the updated Birthday entity.

func (*BirthdayUpdateOne) SaveX

func (buo *BirthdayUpdateOne) SaveX(ctx context.Context) *Birthday

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

func (*BirthdayUpdateOne) Select

func (buo *BirthdayUpdateOne) Select(field string, fields ...string) *BirthdayUpdateOne

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

func (*BirthdayUpdateOne) SetDay

func (buo *BirthdayUpdateOne) SetDay(i int) *BirthdayUpdateOne

SetDay sets the "day" field.

func (*BirthdayUpdateOne) SetMonth

func (buo *BirthdayUpdateOne) SetMonth(i int) *BirthdayUpdateOne

SetMonth sets the "month" field.

func (*BirthdayUpdateOne) SetNillableUserID

func (buo *BirthdayUpdateOne) SetNillableUserID(id *string) *BirthdayUpdateOne

SetNillableUserID sets the "user" edge to the User entity by ID if the given value is not nil.

func (*BirthdayUpdateOne) SetUser

func (buo *BirthdayUpdateOne) SetUser(u *User) *BirthdayUpdateOne

SetUser sets the "user" edge to the User entity.

func (*BirthdayUpdateOne) SetUserID

func (buo *BirthdayUpdateOne) SetUserID(id string) *BirthdayUpdateOne

SetUserID sets the "user" edge to the User entity by ID.

func (*BirthdayUpdateOne) Where

Where appends a list predicates to the BirthdayUpdate builder.

type Birthdays

type Birthdays []*Birthday

Birthdays is a parsable slice of Birthday.

type Client

type Client struct {

	// Schema is the client for creating, migrating and dropping schema.
	Schema *migrate.Schema
	// Birthday is the client for interacting with the Birthday builders.
	Birthday *BirthdayClient
	// Shitpost is the client for interacting with the Shitpost builders.
	Shitpost *ShitpostClient
	// Signin is the client for interacting with the Signin builders.
	Signin *SigninClient
	// User is the client for interacting with the User builders.
	User *UserClient
	// Vote is the client for interacting with the Vote builders.
	Vote *VoteClient
	// VoteResult is the client for interacting with the VoteResult builders.
	VoteResult *VoteResultClient
	// 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().
	Birthday.
	Query().
	Count(ctx)

func (*Client) Intercept

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

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

func (*Client) Mutate

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

Mutate implements the ent.Mutator interface.

func (*Client) Tx

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

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

func (*Client) Use

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

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

type CommitFunc

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

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

func (CommitFunc) Commit

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

Commit calls f(ctx, m).

type CommitHook

type CommitHook func(Committer) Committer

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

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

type Committer

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

Committer is the interface that wraps the Commit method.

type ConstraintError

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

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

func (ConstraintError) Error

func (e ConstraintError) Error() string

Error implements the error interface.

func (*ConstraintError) Unwrap

func (e *ConstraintError) Unwrap() error

Unwrap implements the errors.Wrapper interface.

type Hook

type Hook = ent.Hook

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

type InterceptFunc

type InterceptFunc = ent.InterceptFunc

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

type Interceptor

type Interceptor = ent.Interceptor

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

type MutateFunc

type MutateFunc = ent.MutateFunc

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

type Mutation

type Mutation = ent.Mutation

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

type Mutator

type Mutator = ent.Mutator

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

type NotFoundError

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

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

func (*NotFoundError) Error

func (e *NotFoundError) Error() string

Error implements the error interface.

type NotLoadedError

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

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

func (*NotLoadedError) Error

func (e *NotLoadedError) Error() string

Error implements the error interface.

type NotSingularError

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

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

func (*NotSingularError) Error

func (e *NotSingularError) Error() string

Error implements the error interface.

type Op

type Op = ent.Op

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

type Option

type Option func(*config)

Option function to configure the client.

func Debug

func Debug() Option

Debug enables debug logging on the ent.Driver.

func Driver

func Driver(driver dialect.Driver) Option

Driver configures the client driver.

func Log

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

Log sets the logging function for debug mode.

type OrderFunc

type OrderFunc func(*sql.Selector)

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

type Policy

type Policy = ent.Policy

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

type Querier

type Querier = ent.Querier

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

type QuerierFunc

type QuerierFunc = ent.QuerierFunc

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

type Query

type Query = ent.Query

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

type QueryContext

type QueryContext = ent.QueryContext

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

type RollbackFunc

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

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

func (RollbackFunc) Rollback

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

Rollback calls f(ctx, m).

type RollbackHook

type RollbackHook func(Rollbacker) Rollbacker

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

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

type Rollbacker

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

Rollbacker is the interface that wraps the Rollback method.

type Shitpost

type Shitpost struct {

	// ID of the ent.
	// Message ID
	ID string `json:"id,omitempty"`
	// Channel ID
	ChannelID string `json:"channel_id,omitempty"`
	// Shitpost Count
	Count int `json:"count,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the ShitpostQuery when eager-loading is set.
	Edges ShitpostEdges `json:"edges"`
	// contains filtered or unexported fields
}

Shitpost is the model entity for the Shitpost schema.

func (*Shitpost) QueryUser

func (s *Shitpost) QueryUser() *UserQuery

QueryUser queries the "user" edge of the Shitpost entity.

func (*Shitpost) String

func (s *Shitpost) String() string

String implements the fmt.Stringer.

func (*Shitpost) Unwrap

func (s *Shitpost) Unwrap() *Shitpost

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

func (s *Shitpost) Update() *ShitpostUpdateOne

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

func (*Shitpost) Value

func (s *Shitpost) Value(name string) (ent.Value, error)

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

type ShitpostClient

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

ShitpostClient is a client for the Shitpost schema.

func NewShitpostClient

func NewShitpostClient(c config) *ShitpostClient

NewShitpostClient returns a client for the Shitpost from the given config.

func (*ShitpostClient) Create

func (c *ShitpostClient) Create() *ShitpostCreate

Create returns a builder for creating a Shitpost entity.

func (*ShitpostClient) CreateBulk

func (c *ShitpostClient) CreateBulk(builders ...*ShitpostCreate) *ShitpostCreateBulk

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

func (*ShitpostClient) Delete

func (c *ShitpostClient) Delete() *ShitpostDelete

Delete returns a delete builder for Shitpost.

func (*ShitpostClient) DeleteOne

func (c *ShitpostClient) DeleteOne(s *Shitpost) *ShitpostDeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*ShitpostClient) DeleteOneID

func (c *ShitpostClient) DeleteOneID(id string) *ShitpostDeleteOne

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

func (*ShitpostClient) Get

func (c *ShitpostClient) Get(ctx context.Context, id string) (*Shitpost, error)

Get returns a Shitpost entity by its id.

func (*ShitpostClient) GetX

func (c *ShitpostClient) GetX(ctx context.Context, id string) *Shitpost

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

func (*ShitpostClient) Hooks

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

Hooks returns the client hooks.

func (*ShitpostClient) Intercept

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

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

func (*ShitpostClient) Interceptors

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

Interceptors returns the client interceptors.

func (*ShitpostClient) Query

func (c *ShitpostClient) Query() *ShitpostQuery

Query returns a query builder for Shitpost.

func (*ShitpostClient) QueryUser

func (c *ShitpostClient) QueryUser(s *Shitpost) *UserQuery

QueryUser queries the user edge of a Shitpost.

func (*ShitpostClient) Update

func (c *ShitpostClient) Update() *ShitpostUpdate

Update returns an update builder for Shitpost.

func (*ShitpostClient) UpdateOne

func (c *ShitpostClient) UpdateOne(s *Shitpost) *ShitpostUpdateOne

UpdateOne returns an update builder for the given entity.

func (*ShitpostClient) UpdateOneID

func (c *ShitpostClient) UpdateOneID(id string) *ShitpostUpdateOne

UpdateOneID returns an update builder for the given id.

func (*ShitpostClient) Use

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

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

type ShitpostCreate

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

ShitpostCreate is the builder for creating a Shitpost entity.

func (*ShitpostCreate) Exec

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

Exec executes the query.

func (*ShitpostCreate) ExecX

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

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

func (*ShitpostCreate) Mutation

func (sc *ShitpostCreate) Mutation() *ShitpostMutation

Mutation returns the ShitpostMutation object of the builder.

func (*ShitpostCreate) Save

func (sc *ShitpostCreate) Save(ctx context.Context) (*Shitpost, error)

Save creates the Shitpost in the database.

func (*ShitpostCreate) SaveX

func (sc *ShitpostCreate) SaveX(ctx context.Context) *Shitpost

SaveX calls Save and panics if Save returns an error.

func (*ShitpostCreate) SetChannelID

func (sc *ShitpostCreate) SetChannelID(s string) *ShitpostCreate

SetChannelID sets the "channel_id" field.

func (*ShitpostCreate) SetCount

func (sc *ShitpostCreate) SetCount(i int) *ShitpostCreate

SetCount sets the "count" field.

func (*ShitpostCreate) SetID

func (sc *ShitpostCreate) SetID(s string) *ShitpostCreate

SetID sets the "id" field.

func (*ShitpostCreate) SetNillableUserID

func (sc *ShitpostCreate) SetNillableUserID(id *string) *ShitpostCreate

SetNillableUserID sets the "user" edge to the User entity by ID if the given value is not nil.

func (*ShitpostCreate) SetUser

func (sc *ShitpostCreate) SetUser(u *User) *ShitpostCreate

SetUser sets the "user" edge to the User entity.

func (*ShitpostCreate) SetUserID

func (sc *ShitpostCreate) SetUserID(id string) *ShitpostCreate

SetUserID sets the "user" edge to the User entity by ID.

type ShitpostCreateBulk

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

ShitpostCreateBulk is the builder for creating many Shitpost entities in bulk.

func (*ShitpostCreateBulk) Exec

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

Exec executes the query.

func (*ShitpostCreateBulk) ExecX

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

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

func (*ShitpostCreateBulk) Save

func (scb *ShitpostCreateBulk) Save(ctx context.Context) ([]*Shitpost, error)

Save creates the Shitpost entities in the database.

func (*ShitpostCreateBulk) SaveX

func (scb *ShitpostCreateBulk) SaveX(ctx context.Context) []*Shitpost

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

type ShitpostDelete

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

ShitpostDelete is the builder for deleting a Shitpost entity.

func (*ShitpostDelete) Exec

func (sd *ShitpostDelete) Exec(ctx context.Context) (int, error)

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

func (*ShitpostDelete) ExecX

func (sd *ShitpostDelete) ExecX(ctx context.Context) int

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

func (*ShitpostDelete) Where

func (sd *ShitpostDelete) Where(ps ...predicate.Shitpost) *ShitpostDelete

Where appends a list predicates to the ShitpostDelete builder.

type ShitpostDeleteOne

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

ShitpostDeleteOne is the builder for deleting a single Shitpost entity.

func (*ShitpostDeleteOne) Exec

func (sdo *ShitpostDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*ShitpostDeleteOne) ExecX

func (sdo *ShitpostDeleteOne) ExecX(ctx context.Context)

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

func (*ShitpostDeleteOne) Where

Where appends a list predicates to the ShitpostDelete builder.

type ShitpostEdges

type ShitpostEdges struct {
	// Shitpost Author
	User *User `json:"user,omitempty"`
	// contains filtered or unexported fields
}

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

func (ShitpostEdges) UserOrErr

func (e ShitpostEdges) UserOrErr() (*User, error)

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

type ShitpostGroupBy

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

ShitpostGroupBy is the group-by builder for Shitpost entities.

func (*ShitpostGroupBy) Aggregate

func (sgb *ShitpostGroupBy) Aggregate(fns ...AggregateFunc) *ShitpostGroupBy

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

func (*ShitpostGroupBy) Bool

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

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

func (*ShitpostGroupBy) BoolX

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

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

func (*ShitpostGroupBy) Bools

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

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

func (*ShitpostGroupBy) BoolsX

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

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

func (*ShitpostGroupBy) Float64

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

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

func (*ShitpostGroupBy) Float64X

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

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

func (*ShitpostGroupBy) Float64s

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

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

func (*ShitpostGroupBy) Float64sX

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

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

func (*ShitpostGroupBy) Int

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

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

func (*ShitpostGroupBy) IntX

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

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

func (*ShitpostGroupBy) Ints

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

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

func (*ShitpostGroupBy) IntsX

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

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

func (*ShitpostGroupBy) Scan

func (sgb *ShitpostGroupBy) Scan(ctx context.Context, v any) error

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

func (*ShitpostGroupBy) ScanX

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

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

func (*ShitpostGroupBy) String

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

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

func (*ShitpostGroupBy) StringX

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

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

func (*ShitpostGroupBy) Strings

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

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

func (*ShitpostGroupBy) StringsX

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

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

type ShitpostMutation

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

ShitpostMutation represents an operation that mutates the Shitpost nodes in the graph.

func (*ShitpostMutation) AddCount

func (m *ShitpostMutation) AddCount(i int)

AddCount adds i to the "count" field.

func (*ShitpostMutation) AddField

func (m *ShitpostMutation) 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 (*ShitpostMutation) AddedCount

func (m *ShitpostMutation) AddedCount() (r int, exists bool)

AddedCount returns the value that was added to the "count" field in this mutation.

func (*ShitpostMutation) AddedEdges

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

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

func (*ShitpostMutation) AddedField

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

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

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

func (*ShitpostMutation) AddedIDs

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

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

func (*ShitpostMutation) ChannelID

func (m *ShitpostMutation) ChannelID() (r string, exists bool)

ChannelID returns the value of the "channel_id" field in the mutation.

func (*ShitpostMutation) ClearEdge

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

func (m *ShitpostMutation) 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 (*ShitpostMutation) ClearUser

func (m *ShitpostMutation) ClearUser()

ClearUser clears the "user" edge to the User entity.

func (*ShitpostMutation) ClearedEdges

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

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

func (*ShitpostMutation) ClearedFields

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

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

func (ShitpostMutation) Client

func (m ShitpostMutation) 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 (*ShitpostMutation) Count

func (m *ShitpostMutation) Count() (r int, exists bool)

Count returns the value of the "count" field in the mutation.

func (*ShitpostMutation) EdgeCleared

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

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

func (*ShitpostMutation) Field

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

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

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

func (*ShitpostMutation) Fields

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

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

func (m *ShitpostMutation) IDs(ctx context.Context) ([]string, 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 (*ShitpostMutation) OldChannelID

func (m *ShitpostMutation) OldChannelID(ctx context.Context) (v string, err error)

OldChannelID returns the old "channel_id" field's value of the Shitpost entity. If the Shitpost 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 (*ShitpostMutation) OldCount

func (m *ShitpostMutation) OldCount(ctx context.Context) (v int, err error)

OldCount returns the old "count" field's value of the Shitpost entity. If the Shitpost 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 (*ShitpostMutation) OldField

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

func (m *ShitpostMutation) Op() Op

Op returns the operation name.

func (*ShitpostMutation) RemovedEdges

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

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

func (*ShitpostMutation) RemovedIDs

func (m *ShitpostMutation) 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 (*ShitpostMutation) ResetChannelID

func (m *ShitpostMutation) ResetChannelID()

ResetChannelID resets all changes to the "channel_id" field.

func (*ShitpostMutation) ResetCount

func (m *ShitpostMutation) ResetCount()

ResetCount resets all changes to the "count" field.

func (*ShitpostMutation) ResetEdge

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

func (m *ShitpostMutation) 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 (*ShitpostMutation) ResetUser

func (m *ShitpostMutation) ResetUser()

ResetUser resets all changes to the "user" edge.

func (*ShitpostMutation) SetChannelID

func (m *ShitpostMutation) SetChannelID(s string)

SetChannelID sets the "channel_id" field.

func (*ShitpostMutation) SetCount

func (m *ShitpostMutation) SetCount(i int)

SetCount sets the "count" field.

func (*ShitpostMutation) SetField

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

func (m *ShitpostMutation) SetID(id string)

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

func (*ShitpostMutation) SetOp

func (m *ShitpostMutation) SetOp(op Op)

SetOp allows setting the mutation operation.

func (*ShitpostMutation) SetUserID

func (m *ShitpostMutation) SetUserID(id string)

SetUserID sets the "user" edge to the User entity by id.

func (ShitpostMutation) Tx

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

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

func (*ShitpostMutation) Type

func (m *ShitpostMutation) Type() string

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

func (*ShitpostMutation) UserCleared

func (m *ShitpostMutation) UserCleared() bool

UserCleared reports if the "user" edge to the User entity was cleared.

func (*ShitpostMutation) UserID

func (m *ShitpostMutation) UserID() (id string, exists bool)

UserID returns the "user" edge ID in the mutation.

func (*ShitpostMutation) UserIDs

func (m *ShitpostMutation) UserIDs() (ids []string)

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

func (*ShitpostMutation) Where

func (m *ShitpostMutation) Where(ps ...predicate.Shitpost)

Where appends a list predicates to the ShitpostMutation builder.

func (*ShitpostMutation) WhereP

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

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

type ShitpostQuery

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

ShitpostQuery is the builder for querying Shitpost entities.

func (*ShitpostQuery) Aggregate

func (sq *ShitpostQuery) Aggregate(fns ...AggregateFunc) *ShitpostSelect

Aggregate returns a ShitpostSelect configured with the given aggregations.

func (*ShitpostQuery) All

func (sq *ShitpostQuery) All(ctx context.Context) ([]*Shitpost, error)

All executes the query and returns a list of Shitposts.

func (*ShitpostQuery) AllX

func (sq *ShitpostQuery) AllX(ctx context.Context) []*Shitpost

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

func (*ShitpostQuery) Clone

func (sq *ShitpostQuery) Clone() *ShitpostQuery

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

func (*ShitpostQuery) Count

func (sq *ShitpostQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*ShitpostQuery) CountX

func (sq *ShitpostQuery) CountX(ctx context.Context) int

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

func (*ShitpostQuery) Exist

func (sq *ShitpostQuery) Exist(ctx context.Context) (bool, error)

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

func (*ShitpostQuery) ExistX

func (sq *ShitpostQuery) ExistX(ctx context.Context) bool

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

func (*ShitpostQuery) First

func (sq *ShitpostQuery) First(ctx context.Context) (*Shitpost, error)

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

func (*ShitpostQuery) FirstID

func (sq *ShitpostQuery) FirstID(ctx context.Context) (id string, err error)

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

func (*ShitpostQuery) FirstIDX

func (sq *ShitpostQuery) FirstIDX(ctx context.Context) string

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

func (*ShitpostQuery) FirstX

func (sq *ShitpostQuery) FirstX(ctx context.Context) *Shitpost

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

func (*ShitpostQuery) GroupBy

func (sq *ShitpostQuery) GroupBy(field string, fields ...string) *ShitpostGroupBy

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

client.Shitpost.Query().
	GroupBy(shitpost.FieldChannelID).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*ShitpostQuery) IDs

func (sq *ShitpostQuery) IDs(ctx context.Context) (ids []string, err error)

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

func (*ShitpostQuery) IDsX

func (sq *ShitpostQuery) IDsX(ctx context.Context) []string

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

func (*ShitpostQuery) Limit

func (sq *ShitpostQuery) Limit(limit int) *ShitpostQuery

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

func (*ShitpostQuery) Offset

func (sq *ShitpostQuery) Offset(offset int) *ShitpostQuery

Offset to start from.

func (*ShitpostQuery) Only

func (sq *ShitpostQuery) Only(ctx context.Context) (*Shitpost, error)

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

func (*ShitpostQuery) OnlyID

func (sq *ShitpostQuery) OnlyID(ctx context.Context) (id string, err error)

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

func (*ShitpostQuery) OnlyIDX

func (sq *ShitpostQuery) OnlyIDX(ctx context.Context) string

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

func (*ShitpostQuery) OnlyX

func (sq *ShitpostQuery) OnlyX(ctx context.Context) *Shitpost

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

func (*ShitpostQuery) Order

Order specifies how the records should be ordered.

func (*ShitpostQuery) QueryUser

func (sq *ShitpostQuery) QueryUser() *UserQuery

QueryUser chains the current query on the "user" edge.

func (*ShitpostQuery) Select

func (sq *ShitpostQuery) Select(fields ...string) *ShitpostSelect

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

client.Shitpost.Query().
	Select(shitpost.FieldChannelID).
	Scan(ctx, &v)

func (*ShitpostQuery) Unique

func (sq *ShitpostQuery) Unique(unique bool) *ShitpostQuery

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

func (sq *ShitpostQuery) Where(ps ...predicate.Shitpost) *ShitpostQuery

Where adds a new predicate for the ShitpostQuery builder.

func (*ShitpostQuery) WithUser

func (sq *ShitpostQuery) WithUser(opts ...func(*UserQuery)) *ShitpostQuery

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

type ShitpostSelect

type ShitpostSelect struct {
	*ShitpostQuery
	// contains filtered or unexported fields
}

ShitpostSelect is the builder for selecting fields of Shitpost entities.

func (*ShitpostSelect) Aggregate

func (ss *ShitpostSelect) Aggregate(fns ...AggregateFunc) *ShitpostSelect

Aggregate adds the given aggregation functions to the selector query.

func (*ShitpostSelect) Bool

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

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

func (*ShitpostSelect) BoolX

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

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

func (*ShitpostSelect) Bools

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

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

func (*ShitpostSelect) BoolsX

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

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

func (*ShitpostSelect) Float64

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

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

func (*ShitpostSelect) Float64X

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

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

func (*ShitpostSelect) Float64s

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

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

func (*ShitpostSelect) Float64sX

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

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

func (*ShitpostSelect) Int

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

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

func (*ShitpostSelect) IntX

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

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

func (*ShitpostSelect) Ints

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

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

func (*ShitpostSelect) IntsX

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

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

func (*ShitpostSelect) Scan

func (ss *ShitpostSelect) Scan(ctx context.Context, v any) error

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

func (*ShitpostSelect) ScanX

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

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

func (*ShitpostSelect) String

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

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

func (*ShitpostSelect) StringX

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

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

func (*ShitpostSelect) Strings

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

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

func (*ShitpostSelect) StringsX

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

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

type ShitpostUpdate

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

ShitpostUpdate is the builder for updating Shitpost entities.

func (*ShitpostUpdate) AddCount

func (su *ShitpostUpdate) AddCount(i int) *ShitpostUpdate

AddCount adds i to the "count" field.

func (*ShitpostUpdate) ClearUser

func (su *ShitpostUpdate) ClearUser() *ShitpostUpdate

ClearUser clears the "user" edge to the User entity.

func (*ShitpostUpdate) Exec

func (su *ShitpostUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*ShitpostUpdate) ExecX

func (su *ShitpostUpdate) ExecX(ctx context.Context)

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

func (*ShitpostUpdate) Mutation

func (su *ShitpostUpdate) Mutation() *ShitpostMutation

Mutation returns the ShitpostMutation object of the builder.

func (*ShitpostUpdate) Save

func (su *ShitpostUpdate) Save(ctx context.Context) (int, error)

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

func (*ShitpostUpdate) SaveX

func (su *ShitpostUpdate) SaveX(ctx context.Context) int

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

func (*ShitpostUpdate) SetChannelID

func (su *ShitpostUpdate) SetChannelID(s string) *ShitpostUpdate

SetChannelID sets the "channel_id" field.

func (*ShitpostUpdate) SetCount

func (su *ShitpostUpdate) SetCount(i int) *ShitpostUpdate

SetCount sets the "count" field.

func (*ShitpostUpdate) SetNillableUserID

func (su *ShitpostUpdate) SetNillableUserID(id *string) *ShitpostUpdate

SetNillableUserID sets the "user" edge to the User entity by ID if the given value is not nil.

func (*ShitpostUpdate) SetUser

func (su *ShitpostUpdate) SetUser(u *User) *ShitpostUpdate

SetUser sets the "user" edge to the User entity.

func (*ShitpostUpdate) SetUserID

func (su *ShitpostUpdate) SetUserID(id string) *ShitpostUpdate

SetUserID sets the "user" edge to the User entity by ID.

func (*ShitpostUpdate) Where

func (su *ShitpostUpdate) Where(ps ...predicate.Shitpost) *ShitpostUpdate

Where appends a list predicates to the ShitpostUpdate builder.

type ShitpostUpdateOne

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

ShitpostUpdateOne is the builder for updating a single Shitpost entity.

func (*ShitpostUpdateOne) AddCount

func (suo *ShitpostUpdateOne) AddCount(i int) *ShitpostUpdateOne

AddCount adds i to the "count" field.

func (*ShitpostUpdateOne) ClearUser

func (suo *ShitpostUpdateOne) ClearUser() *ShitpostUpdateOne

ClearUser clears the "user" edge to the User entity.

func (*ShitpostUpdateOne) Exec

func (suo *ShitpostUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*ShitpostUpdateOne) ExecX

func (suo *ShitpostUpdateOne) ExecX(ctx context.Context)

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

func (*ShitpostUpdateOne) Mutation

func (suo *ShitpostUpdateOne) Mutation() *ShitpostMutation

Mutation returns the ShitpostMutation object of the builder.

func (*ShitpostUpdateOne) Save

func (suo *ShitpostUpdateOne) Save(ctx context.Context) (*Shitpost, error)

Save executes the query and returns the updated Shitpost entity.

func (*ShitpostUpdateOne) SaveX

func (suo *ShitpostUpdateOne) SaveX(ctx context.Context) *Shitpost

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

func (*ShitpostUpdateOne) Select

func (suo *ShitpostUpdateOne) Select(field string, fields ...string) *ShitpostUpdateOne

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

func (*ShitpostUpdateOne) SetChannelID

func (suo *ShitpostUpdateOne) SetChannelID(s string) *ShitpostUpdateOne

SetChannelID sets the "channel_id" field.

func (*ShitpostUpdateOne) SetCount

func (suo *ShitpostUpdateOne) SetCount(i int) *ShitpostUpdateOne

SetCount sets the "count" field.

func (*ShitpostUpdateOne) SetNillableUserID

func (suo *ShitpostUpdateOne) SetNillableUserID(id *string) *ShitpostUpdateOne

SetNillableUserID sets the "user" edge to the User entity by ID if the given value is not nil.

func (*ShitpostUpdateOne) SetUser

func (suo *ShitpostUpdateOne) SetUser(u *User) *ShitpostUpdateOne

SetUser sets the "user" edge to the User entity.

func (*ShitpostUpdateOne) SetUserID

func (suo *ShitpostUpdateOne) SetUserID(id string) *ShitpostUpdateOne

SetUserID sets the "user" edge to the User entity by ID.

func (*ShitpostUpdateOne) Where

Where appends a list predicates to the ShitpostUpdate builder.

type Shitposts

type Shitposts []*Shitpost

Shitposts is a parsable slice of Shitpost.

type Signin

type Signin struct {

	// ID of the ent.
	ID int `json:"id,omitempty"`
	// Time of signin
	Timestamp time.Time `json:"timestamp,omitempty"`
	// Type of signin
	Type signin.Type `json:"type,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the SigninQuery when eager-loading is set.
	Edges SigninEdges `json:"edges"`
	// contains filtered or unexported fields
}

Signin is the model entity for the Signin schema.

func (*Signin) QueryUser

func (s *Signin) QueryUser() *UserQuery

QueryUser queries the "user" edge of the Signin entity.

func (*Signin) String

func (s *Signin) String() string

String implements the fmt.Stringer.

func (*Signin) Unwrap

func (s *Signin) Unwrap() *Signin

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

func (s *Signin) Update() *SigninUpdateOne

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

func (*Signin) Value

func (s *Signin) Value(name string) (ent.Value, error)

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

type SigninClient

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

SigninClient is a client for the Signin schema.

func NewSigninClient

func NewSigninClient(c config) *SigninClient

NewSigninClient returns a client for the Signin from the given config.

func (*SigninClient) Create

func (c *SigninClient) Create() *SigninCreate

Create returns a builder for creating a Signin entity.

func (*SigninClient) CreateBulk

func (c *SigninClient) CreateBulk(builders ...*SigninCreate) *SigninCreateBulk

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

func (*SigninClient) Delete

func (c *SigninClient) Delete() *SigninDelete

Delete returns a delete builder for Signin.

func (*SigninClient) DeleteOne

func (c *SigninClient) DeleteOne(s *Signin) *SigninDeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*SigninClient) DeleteOneID

func (c *SigninClient) DeleteOneID(id int) *SigninDeleteOne

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

func (*SigninClient) Get

func (c *SigninClient) Get(ctx context.Context, id int) (*Signin, error)

Get returns a Signin entity by its id.

func (*SigninClient) GetX

func (c *SigninClient) GetX(ctx context.Context, id int) *Signin

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

func (*SigninClient) Hooks

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

Hooks returns the client hooks.

func (*SigninClient) Intercept

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

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

func (*SigninClient) Interceptors

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

Interceptors returns the client interceptors.

func (*SigninClient) Query

func (c *SigninClient) Query() *SigninQuery

Query returns a query builder for Signin.

func (*SigninClient) QueryUser

func (c *SigninClient) QueryUser(s *Signin) *UserQuery

QueryUser queries the user edge of a Signin.

func (*SigninClient) Update

func (c *SigninClient) Update() *SigninUpdate

Update returns an update builder for Signin.

func (*SigninClient) UpdateOne

func (c *SigninClient) UpdateOne(s *Signin) *SigninUpdateOne

UpdateOne returns an update builder for the given entity.

func (*SigninClient) UpdateOneID

func (c *SigninClient) UpdateOneID(id int) *SigninUpdateOne

UpdateOneID returns an update builder for the given id.

func (*SigninClient) Use

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

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

type SigninCreate

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

SigninCreate is the builder for creating a Signin entity.

func (*SigninCreate) Exec

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

Exec executes the query.

func (*SigninCreate) ExecX

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

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

func (*SigninCreate) Mutation

func (sc *SigninCreate) Mutation() *SigninMutation

Mutation returns the SigninMutation object of the builder.

func (*SigninCreate) Save

func (sc *SigninCreate) Save(ctx context.Context) (*Signin, error)

Save creates the Signin in the database.

func (*SigninCreate) SaveX

func (sc *SigninCreate) SaveX(ctx context.Context) *Signin

SaveX calls Save and panics if Save returns an error.

func (*SigninCreate) SetNillableTimestamp

func (sc *SigninCreate) SetNillableTimestamp(t *time.Time) *SigninCreate

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

func (*SigninCreate) SetTimestamp

func (sc *SigninCreate) SetTimestamp(t time.Time) *SigninCreate

SetTimestamp sets the "timestamp" field.

func (*SigninCreate) SetType

func (sc *SigninCreate) SetType(s signin.Type) *SigninCreate

SetType sets the "type" field.

func (*SigninCreate) SetUser

func (sc *SigninCreate) SetUser(u *User) *SigninCreate

SetUser sets the "user" edge to the User entity.

func (*SigninCreate) SetUserID

func (sc *SigninCreate) SetUserID(id string) *SigninCreate

SetUserID sets the "user" edge to the User entity by ID.

type SigninCreateBulk

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

SigninCreateBulk is the builder for creating many Signin entities in bulk.

func (*SigninCreateBulk) Exec

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

Exec executes the query.

func (*SigninCreateBulk) ExecX

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

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

func (*SigninCreateBulk) Save

func (scb *SigninCreateBulk) Save(ctx context.Context) ([]*Signin, error)

Save creates the Signin entities in the database.

func (*SigninCreateBulk) SaveX

func (scb *SigninCreateBulk) SaveX(ctx context.Context) []*Signin

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

type SigninDelete

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

SigninDelete is the builder for deleting a Signin entity.

func (*SigninDelete) Exec

func (sd *SigninDelete) Exec(ctx context.Context) (int, error)

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

func (*SigninDelete) ExecX

func (sd *SigninDelete) ExecX(ctx context.Context) int

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

func (*SigninDelete) Where

func (sd *SigninDelete) Where(ps ...predicate.Signin) *SigninDelete

Where appends a list predicates to the SigninDelete builder.

type SigninDeleteOne

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

SigninDeleteOne is the builder for deleting a single Signin entity.

func (*SigninDeleteOne) Exec

func (sdo *SigninDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*SigninDeleteOne) ExecX

func (sdo *SigninDeleteOne) ExecX(ctx context.Context)

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

func (*SigninDeleteOne) Where

func (sdo *SigninDeleteOne) Where(ps ...predicate.Signin) *SigninDeleteOne

Where appends a list predicates to the SigninDelete builder.

type SigninEdges

type SigninEdges struct {
	// User who signed in
	User *User `json:"user,omitempty"`
	// contains filtered or unexported fields
}

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

func (SigninEdges) UserOrErr

func (e SigninEdges) UserOrErr() (*User, error)

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

type SigninGroupBy

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

SigninGroupBy is the group-by builder for Signin entities.

func (*SigninGroupBy) Aggregate

func (sgb *SigninGroupBy) Aggregate(fns ...AggregateFunc) *SigninGroupBy

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

func (*SigninGroupBy) Bool

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

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

func (*SigninGroupBy) BoolX

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

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

func (*SigninGroupBy) Bools

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

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

func (*SigninGroupBy) BoolsX

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

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

func (*SigninGroupBy) Float64

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

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

func (*SigninGroupBy) Float64X

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

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

func (*SigninGroupBy) Float64s

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

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

func (*SigninGroupBy) Float64sX

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

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

func (*SigninGroupBy) Int

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

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

func (*SigninGroupBy) IntX

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

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

func (*SigninGroupBy) Ints

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

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

func (*SigninGroupBy) IntsX

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

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

func (*SigninGroupBy) Scan

func (sgb *SigninGroupBy) Scan(ctx context.Context, v any) error

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

func (*SigninGroupBy) ScanX

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

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

func (*SigninGroupBy) String

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

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

func (*SigninGroupBy) StringX

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

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

func (*SigninGroupBy) Strings

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

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

func (*SigninGroupBy) StringsX

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

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

type SigninMutation

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

SigninMutation represents an operation that mutates the Signin nodes in the graph.

func (*SigninMutation) AddField

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

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

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

func (*SigninMutation) AddedField

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

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

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

func (*SigninMutation) AddedIDs

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

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

func (*SigninMutation) ClearEdge

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

func (m *SigninMutation) 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 (*SigninMutation) ClearUser

func (m *SigninMutation) ClearUser()

ClearUser clears the "user" edge to the User entity.

func (*SigninMutation) ClearedEdges

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

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

func (*SigninMutation) ClearedFields

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

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

func (SigninMutation) Client

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

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

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

func (*SigninMutation) Field

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

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

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

func (*SigninMutation) Fields

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

func (m *SigninMutation) GetType() (r signin.Type, exists bool)

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

func (*SigninMutation) ID

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

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

func (m *SigninMutation) 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 (*SigninMutation) OldTimestamp

func (m *SigninMutation) OldTimestamp(ctx context.Context) (v time.Time, err error)

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

func (m *SigninMutation) OldType(ctx context.Context) (v signin.Type, err error)

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

func (m *SigninMutation) Op() Op

Op returns the operation name.

func (*SigninMutation) RemovedEdges

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

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

func (*SigninMutation) RemovedIDs

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

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

func (m *SigninMutation) 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 (*SigninMutation) ResetTimestamp

func (m *SigninMutation) ResetTimestamp()

ResetTimestamp resets all changes to the "timestamp" field.

func (*SigninMutation) ResetType

func (m *SigninMutation) ResetType()

ResetType resets all changes to the "type" field.

func (*SigninMutation) ResetUser

func (m *SigninMutation) ResetUser()

ResetUser resets all changes to the "user" edge.

func (*SigninMutation) SetField

func (m *SigninMutation) 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 (*SigninMutation) SetOp

func (m *SigninMutation) SetOp(op Op)

SetOp allows setting the mutation operation.

func (*SigninMutation) SetTimestamp

func (m *SigninMutation) SetTimestamp(t time.Time)

SetTimestamp sets the "timestamp" field.

func (*SigninMutation) SetType

func (m *SigninMutation) SetType(s signin.Type)

SetType sets the "type" field.

func (*SigninMutation) SetUserID

func (m *SigninMutation) SetUserID(id string)

SetUserID sets the "user" edge to the User entity by id.

func (*SigninMutation) Timestamp

func (m *SigninMutation) Timestamp() (r time.Time, exists bool)

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

func (SigninMutation) Tx

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

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

func (*SigninMutation) Type

func (m *SigninMutation) Type() string

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

func (*SigninMutation) UserCleared

func (m *SigninMutation) UserCleared() bool

UserCleared reports if the "user" edge to the User entity was cleared.

func (*SigninMutation) UserID

func (m *SigninMutation) UserID() (id string, exists bool)

UserID returns the "user" edge ID in the mutation.

func (*SigninMutation) UserIDs

func (m *SigninMutation) UserIDs() (ids []string)

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

func (*SigninMutation) Where

func (m *SigninMutation) Where(ps ...predicate.Signin)

Where appends a list predicates to the SigninMutation builder.

func (*SigninMutation) WhereP

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

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

type SigninQuery

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

SigninQuery is the builder for querying Signin entities.

func (*SigninQuery) Aggregate

func (sq *SigninQuery) Aggregate(fns ...AggregateFunc) *SigninSelect

Aggregate returns a SigninSelect configured with the given aggregations.

func (*SigninQuery) All

func (sq *SigninQuery) All(ctx context.Context) ([]*Signin, error)

All executes the query and returns a list of Signins.

func (*SigninQuery) AllX

func (sq *SigninQuery) AllX(ctx context.Context) []*Signin

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

func (*SigninQuery) Clone

func (sq *SigninQuery) Clone() *SigninQuery

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

func (*SigninQuery) Count

func (sq *SigninQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*SigninQuery) CountX

func (sq *SigninQuery) CountX(ctx context.Context) int

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

func (*SigninQuery) Exist

func (sq *SigninQuery) Exist(ctx context.Context) (bool, error)

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

func (*SigninQuery) ExistX

func (sq *SigninQuery) ExistX(ctx context.Context) bool

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

func (*SigninQuery) First

func (sq *SigninQuery) First(ctx context.Context) (*Signin, error)

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

func (*SigninQuery) FirstID

func (sq *SigninQuery) FirstID(ctx context.Context) (id int, err error)

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

func (*SigninQuery) FirstIDX

func (sq *SigninQuery) FirstIDX(ctx context.Context) int

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

func (*SigninQuery) FirstX

func (sq *SigninQuery) FirstX(ctx context.Context) *Signin

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

func (*SigninQuery) GroupBy

func (sq *SigninQuery) GroupBy(field string, fields ...string) *SigninGroupBy

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 {
	Timestamp time.Time `json:"timestamp,omitempty"`
	Count int `json:"count,omitempty"`
}

client.Signin.Query().
	GroupBy(signin.FieldTimestamp).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*SigninQuery) IDs

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

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

func (*SigninQuery) IDsX

func (sq *SigninQuery) IDsX(ctx context.Context) []int

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

func (*SigninQuery) Limit

func (sq *SigninQuery) Limit(limit int) *SigninQuery

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

func (*SigninQuery) Offset

func (sq *SigninQuery) Offset(offset int) *SigninQuery

Offset to start from.

func (*SigninQuery) Only

func (sq *SigninQuery) Only(ctx context.Context) (*Signin, error)

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

func (*SigninQuery) OnlyID

func (sq *SigninQuery) OnlyID(ctx context.Context) (id int, err error)

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

func (*SigninQuery) OnlyIDX

func (sq *SigninQuery) OnlyIDX(ctx context.Context) int

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

func (*SigninQuery) OnlyX

func (sq *SigninQuery) OnlyX(ctx context.Context) *Signin

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

func (*SigninQuery) Order

func (sq *SigninQuery) Order(o ...signin.OrderOption) *SigninQuery

Order specifies how the records should be ordered.

func (*SigninQuery) QueryUser

func (sq *SigninQuery) QueryUser() *UserQuery

QueryUser chains the current query on the "user" edge.

func (*SigninQuery) Select

func (sq *SigninQuery) Select(fields ...string) *SigninSelect

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 {
	Timestamp time.Time `json:"timestamp,omitempty"`
}

client.Signin.Query().
	Select(signin.FieldTimestamp).
	Scan(ctx, &v)

func (*SigninQuery) Unique

func (sq *SigninQuery) Unique(unique bool) *SigninQuery

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

func (sq *SigninQuery) Where(ps ...predicate.Signin) *SigninQuery

Where adds a new predicate for the SigninQuery builder.

func (*SigninQuery) WithUser

func (sq *SigninQuery) WithUser(opts ...func(*UserQuery)) *SigninQuery

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

type SigninSelect

type SigninSelect struct {
	*SigninQuery
	// contains filtered or unexported fields
}

SigninSelect is the builder for selecting fields of Signin entities.

func (*SigninSelect) Aggregate

func (ss *SigninSelect) Aggregate(fns ...AggregateFunc) *SigninSelect

Aggregate adds the given aggregation functions to the selector query.

func (*SigninSelect) Bool

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

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

func (*SigninSelect) BoolX

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

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

func (*SigninSelect) Bools

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

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

func (*SigninSelect) BoolsX

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

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

func (*SigninSelect) Float64

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

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

func (*SigninSelect) Float64X

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

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

func (*SigninSelect) Float64s

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

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

func (*SigninSelect) Float64sX

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

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

func (*SigninSelect) Int

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

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

func (*SigninSelect) IntX

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

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

func (*SigninSelect) Ints

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

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

func (*SigninSelect) IntsX

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

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

func (*SigninSelect) Scan

func (ss *SigninSelect) Scan(ctx context.Context, v any) error

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

func (*SigninSelect) ScanX

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

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

func (*SigninSelect) String

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

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

func (*SigninSelect) StringX

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

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

func (*SigninSelect) Strings

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

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

func (*SigninSelect) StringsX

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

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

type SigninUpdate

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

SigninUpdate is the builder for updating Signin entities.

func (*SigninUpdate) ClearUser

func (su *SigninUpdate) ClearUser() *SigninUpdate

ClearUser clears the "user" edge to the User entity.

func (*SigninUpdate) Exec

func (su *SigninUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*SigninUpdate) ExecX

func (su *SigninUpdate) ExecX(ctx context.Context)

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

func (*SigninUpdate) Mutation

func (su *SigninUpdate) Mutation() *SigninMutation

Mutation returns the SigninMutation object of the builder.

func (*SigninUpdate) Save

func (su *SigninUpdate) Save(ctx context.Context) (int, error)

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

func (*SigninUpdate) SaveX

func (su *SigninUpdate) SaveX(ctx context.Context) int

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

func (*SigninUpdate) SetNillableTimestamp

func (su *SigninUpdate) SetNillableTimestamp(t *time.Time) *SigninUpdate

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

func (*SigninUpdate) SetTimestamp

func (su *SigninUpdate) SetTimestamp(t time.Time) *SigninUpdate

SetTimestamp sets the "timestamp" field.

func (*SigninUpdate) SetType

func (su *SigninUpdate) SetType(s signin.Type) *SigninUpdate

SetType sets the "type" field.

func (*SigninUpdate) SetUser

func (su *SigninUpdate) SetUser(u *User) *SigninUpdate

SetUser sets the "user" edge to the User entity.

func (*SigninUpdate) SetUserID

func (su *SigninUpdate) SetUserID(id string) *SigninUpdate

SetUserID sets the "user" edge to the User entity by ID.

func (*SigninUpdate) Where

func (su *SigninUpdate) Where(ps ...predicate.Signin) *SigninUpdate

Where appends a list predicates to the SigninUpdate builder.

type SigninUpdateOne

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

SigninUpdateOne is the builder for updating a single Signin entity.

func (*SigninUpdateOne) ClearUser

func (suo *SigninUpdateOne) ClearUser() *SigninUpdateOne

ClearUser clears the "user" edge to the User entity.

func (*SigninUpdateOne) Exec

func (suo *SigninUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*SigninUpdateOne) ExecX

func (suo *SigninUpdateOne) ExecX(ctx context.Context)

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

func (*SigninUpdateOne) Mutation

func (suo *SigninUpdateOne) Mutation() *SigninMutation

Mutation returns the SigninMutation object of the builder.

func (*SigninUpdateOne) Save

func (suo *SigninUpdateOne) Save(ctx context.Context) (*Signin, error)

Save executes the query and returns the updated Signin entity.

func (*SigninUpdateOne) SaveX

func (suo *SigninUpdateOne) SaveX(ctx context.Context) *Signin

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

func (*SigninUpdateOne) Select

func (suo *SigninUpdateOne) Select(field string, fields ...string) *SigninUpdateOne

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

func (*SigninUpdateOne) SetNillableTimestamp

func (suo *SigninUpdateOne) SetNillableTimestamp(t *time.Time) *SigninUpdateOne

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

func (*SigninUpdateOne) SetTimestamp

func (suo *SigninUpdateOne) SetTimestamp(t time.Time) *SigninUpdateOne

SetTimestamp sets the "timestamp" field.

func (*SigninUpdateOne) SetType

func (suo *SigninUpdateOne) SetType(s signin.Type) *SigninUpdateOne

SetType sets the "type" field.

func (*SigninUpdateOne) SetUser

func (suo *SigninUpdateOne) SetUser(u *User) *SigninUpdateOne

SetUser sets the "user" edge to the User entity.

func (*SigninUpdateOne) SetUserID

func (suo *SigninUpdateOne) SetUserID(id string) *SigninUpdateOne

SetUserID sets the "user" edge to the User entity by ID.

func (*SigninUpdateOne) Where

func (suo *SigninUpdateOne) Where(ps ...predicate.Signin) *SigninUpdateOne

Where appends a list predicates to the SigninUpdate builder.

type Signins

type Signins []*Signin

Signins is a parsable slice of Signin.

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 {

	// Birthday is the client for interacting with the Birthday builders.
	Birthday *BirthdayClient
	// Shitpost is the client for interacting with the Shitpost builders.
	Shitpost *ShitpostClient
	// Signin is the client for interacting with the Signin builders.
	Signin *SigninClient
	// User is the client for interacting with the User builders.
	User *UserClient
	// Vote is the client for interacting with the Vote builders.
	Vote *VoteClient
	// VoteResult is the client for interacting with the VoteResult builders.
	VoteResult *VoteResultClient
	// 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.
	// User's Discord ID
	ID string `json:"id,omitempty"`
	// User's email address
	Email string `json:"email,omitempty"`
	// Number of times the user has attempted to verify their email address
	VerificationAttempts int8 `json:"verification_attempts,omitempty"`
	// Whether the user has been verified before
	Verified bool `json:"verified,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) QueryBirthday

func (u *User) QueryBirthday() *BirthdayQuery

QueryBirthday queries the "birthday" edge of the User entity.

func (*User) QueryShitposts

func (u *User) QueryShitposts() *ShitpostQuery

QueryShitposts queries the "shitposts" edge of the User entity.

func (*User) QuerySignins

func (u *User) QuerySignins() *SigninQuery

QuerySignins queries the "signins" edge of the User entity.

func (*User) QueryVotes

func (u *User) QueryVotes() *VoteQuery

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

func (*User) String

func (u *User) String() string

String implements the fmt.Stringer.

func (*User) Unwrap

func (u *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 (u *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 (u *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(u *User) *UserDeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*UserClient) DeleteOneID

func (c *UserClient) DeleteOneID(id string) *UserDeleteOne

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

func (*UserClient) Get

func (c *UserClient) Get(ctx context.Context, id string) (*User, error)

Get returns a User entity by its id.

func (*UserClient) GetX

func (c *UserClient) GetX(ctx context.Context, id string) *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) Query

func (c *UserClient) Query() *UserQuery

Query returns a query builder for User.

func (*UserClient) QueryBirthday

func (c *UserClient) QueryBirthday(u *User) *BirthdayQuery

QueryBirthday queries the birthday edge of a User.

func (*UserClient) QueryShitposts

func (c *UserClient) QueryShitposts(u *User) *ShitpostQuery

QueryShitposts queries the shitposts edge of a User.

func (*UserClient) QuerySignins

func (c *UserClient) QuerySignins(u *User) *SigninQuery

QuerySignins queries the signins edge of a User.

func (*UserClient) QueryVotes

func (c *UserClient) QueryVotes(u *User) *VoteQuery

QueryVotes queries the 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(u *User) *UserUpdateOne

UpdateOne returns an update builder for the given entity.

func (*UserClient) UpdateOneID

func (c *UserClient) UpdateOneID(id string) *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) AddShitpostIDs

func (uc *UserCreate) AddShitpostIDs(ids ...string) *UserCreate

AddShitpostIDs adds the "shitposts" edge to the Shitpost entity by IDs.

func (*UserCreate) AddShitposts

func (uc *UserCreate) AddShitposts(s ...*Shitpost) *UserCreate

AddShitposts adds the "shitposts" edges to the Shitpost entity.

func (*UserCreate) AddSigninIDs

func (uc *UserCreate) AddSigninIDs(ids ...int) *UserCreate

AddSigninIDs adds the "signins" edge to the Signin entity by IDs.

func (*UserCreate) AddSignins

func (uc *UserCreate) AddSignins(s ...*Signin) *UserCreate

AddSignins adds the "signins" edges to the Signin entity.

func (*UserCreate) AddVoteIDs

func (uc *UserCreate) AddVoteIDs(ids ...int) *UserCreate

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

func (*UserCreate) AddVotes

func (uc *UserCreate) AddVotes(v ...*Vote) *UserCreate

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

func (*UserCreate) Exec

func (uc *UserCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*UserCreate) ExecX

func (uc *UserCreate) ExecX(ctx context.Context)

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

func (*UserCreate) Mutation

func (uc *UserCreate) Mutation() *UserMutation

Mutation returns the UserMutation object of the builder.

func (*UserCreate) Save

func (uc *UserCreate) Save(ctx context.Context) (*User, error)

Save creates the User in the database.

func (*UserCreate) SaveX

func (uc *UserCreate) SaveX(ctx context.Context) *User

SaveX calls Save and panics if Save returns an error.

func (*UserCreate) SetBirthday

func (uc *UserCreate) SetBirthday(b *Birthday) *UserCreate

SetBirthday sets the "birthday" edge to the Birthday entity.

func (*UserCreate) SetBirthdayID

func (uc *UserCreate) SetBirthdayID(id int) *UserCreate

SetBirthdayID sets the "birthday" edge to the Birthday entity by ID.

func (*UserCreate) SetEmail

func (uc *UserCreate) SetEmail(s string) *UserCreate

SetEmail sets the "email" field.

func (*UserCreate) SetID

func (uc *UserCreate) SetID(s string) *UserCreate

SetID sets the "id" field.

func (*UserCreate) SetNillableBirthdayID

func (uc *UserCreate) SetNillableBirthdayID(id *int) *UserCreate

SetNillableBirthdayID sets the "birthday" edge to the Birthday entity by ID if the given value is not nil.

func (*UserCreate) SetNillableEmail

func (uc *UserCreate) SetNillableEmail(s *string) *UserCreate

SetNillableEmail sets the "email" field if the given value is not nil.

func (*UserCreate) SetNillableVerificationAttempts

func (uc *UserCreate) SetNillableVerificationAttempts(i *int8) *UserCreate

SetNillableVerificationAttempts sets the "verification_attempts" field if the given value is not nil.

func (*UserCreate) SetNillableVerified

func (uc *UserCreate) SetNillableVerified(b *bool) *UserCreate

SetNillableVerified sets the "verified" field if the given value is not nil.

func (*UserCreate) SetVerificationAttempts

func (uc *UserCreate) SetVerificationAttempts(i int8) *UserCreate

SetVerificationAttempts sets the "verification_attempts" field.

func (*UserCreate) SetVerified

func (uc *UserCreate) SetVerified(b bool) *UserCreate

SetVerified sets the "verified" 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 (ucb *UserCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*UserCreateBulk) ExecX

func (ucb *UserCreateBulk) ExecX(ctx context.Context)

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

func (*UserCreateBulk) Save

func (ucb *UserCreateBulk) Save(ctx context.Context) ([]*User, error)

Save creates the User entities in the database.

func (*UserCreateBulk) SaveX

func (ucb *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 (ud *UserDelete) Exec(ctx context.Context) (int, error)

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

func (*UserDelete) ExecX

func (ud *UserDelete) ExecX(ctx context.Context) int

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

func (*UserDelete) Where

func (ud *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 (udo *UserDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*UserDeleteOne) ExecX

func (udo *UserDeleteOne) ExecX(ctx context.Context)

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

func (*UserDeleteOne) Where

func (udo *UserDeleteOne) Where(ps ...predicate.User) *UserDeleteOne

Where appends a list predicates to the UserDelete builder.

type UserEdges

type UserEdges struct {
	// Signins made by the user
	Signins []*Signin `json:"signins,omitempty"`
	// Votes made by the user
	Votes []*Vote `json:"votes,omitempty"`
	// Shitposts made by the user
	Shitposts []*Shitpost `json:"shitposts,omitempty"`
	// Birthdays of the user
	Birthday *Birthday `json:"birthday,omitempty"`
	// contains filtered or unexported fields
}

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

func (UserEdges) BirthdayOrErr

func (e UserEdges) BirthdayOrErr() (*Birthday, error)

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

func (UserEdges) ShitpostsOrErr

func (e UserEdges) ShitpostsOrErr() ([]*Shitpost, error)

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

func (UserEdges) SigninsOrErr

func (e UserEdges) SigninsOrErr() ([]*Signin, error)

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

func (UserEdges) VotesOrErr

func (e UserEdges) VotesOrErr() ([]*Vote, error)

VotesOrErr returns the Votes 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 (ugb *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 (ugb *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) AddShitpostIDs

func (m *UserMutation) AddShitpostIDs(ids ...string)

AddShitpostIDs adds the "shitposts" edge to the Shitpost entity by ids.

func (*UserMutation) AddSigninIDs

func (m *UserMutation) AddSigninIDs(ids ...int)

AddSigninIDs adds the "signins" edge to the Signin entity by ids.

func (*UserMutation) AddVerificationAttempts

func (m *UserMutation) AddVerificationAttempts(i int8)

AddVerificationAttempts adds i to the "verification_attempts" field.

func (*UserMutation) AddVoteIDs

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

AddVoteIDs adds the "votes" edge to the Vote 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) AddedVerificationAttempts

func (m *UserMutation) AddedVerificationAttempts() (r int8, exists bool)

AddedVerificationAttempts returns the value that was added to the "verification_attempts" field in this mutation.

func (*UserMutation) BirthdayCleared

func (m *UserMutation) BirthdayCleared() bool

BirthdayCleared reports if the "birthday" edge to the Birthday entity was cleared.

func (*UserMutation) BirthdayID

func (m *UserMutation) BirthdayID() (id int, exists bool)

BirthdayID returns the "birthday" edge ID in the mutation.

func (*UserMutation) BirthdayIDs

func (m *UserMutation) BirthdayIDs() (ids []int)

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

func (*UserMutation) ClearBirthday

func (m *UserMutation) ClearBirthday()

ClearBirthday clears the "birthday" edge to the Birthday entity.

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) ClearShitposts

func (m *UserMutation) ClearShitposts()

ClearShitposts clears the "shitposts" edge to the Shitpost entity.

func (*UserMutation) ClearSignins

func (m *UserMutation) ClearSignins()

ClearSignins clears the "signins" edge to the Signin entity.

func (*UserMutation) ClearVotes

func (m *UserMutation) ClearVotes()

ClearVotes clears the "votes" edge to the Vote 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) Email

func (m *UserMutation) Email() (r string, exists bool)

Email returns the value of the "email" field in the 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 string, 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) ([]string, 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) OldEmail

func (m *UserMutation) OldEmail(ctx context.Context) (v string, err error)

OldEmail returns the old "email" field's value of the User entity. If the User 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 (*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) OldVerificationAttempts

func (m *UserMutation) OldVerificationAttempts(ctx context.Context) (v int8, err error)

OldVerificationAttempts returns the old "verification_attempts" field's value of the User entity. If the User 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 (*UserMutation) OldVerified

func (m *UserMutation) OldVerified(ctx context.Context) (v bool, err error)

OldVerified returns the old "verified" field's value of the User entity. If the User 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 (*UserMutation) Op

func (m *UserMutation) Op() Op

Op returns the operation name.

func (*UserMutation) RemoveShitpostIDs

func (m *UserMutation) RemoveShitpostIDs(ids ...string)

RemoveShitpostIDs removes the "shitposts" edge to the Shitpost entity by IDs.

func (*UserMutation) RemoveSigninIDs

func (m *UserMutation) RemoveSigninIDs(ids ...int)

RemoveSigninIDs removes the "signins" edge to the Signin entity by IDs.

func (*UserMutation) RemoveVoteIDs

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

RemoveVoteIDs removes the "votes" edge to the Vote 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) RemovedShitpostsIDs

func (m *UserMutation) RemovedShitpostsIDs() (ids []string)

RemovedShitposts returns the removed IDs of the "shitposts" edge to the Shitpost entity.

func (*UserMutation) RemovedSigninsIDs

func (m *UserMutation) RemovedSigninsIDs() (ids []int)

RemovedSignins returns the removed IDs of the "signins" edge to the Signin entity.

func (*UserMutation) RemovedVotesIDs

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

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

func (*UserMutation) ResetBirthday

func (m *UserMutation) ResetBirthday()

ResetBirthday resets all changes to the "birthday" edge.

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) ResetEmail

func (m *UserMutation) ResetEmail()

ResetEmail resets all changes to the "email" field.

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) ResetShitposts

func (m *UserMutation) ResetShitposts()

ResetShitposts resets all changes to the "shitposts" edge.

func (*UserMutation) ResetSignins

func (m *UserMutation) ResetSignins()

ResetSignins resets all changes to the "signins" edge.

func (*UserMutation) ResetVerificationAttempts

func (m *UserMutation) ResetVerificationAttempts()

ResetVerificationAttempts resets all changes to the "verification_attempts" field.

func (*UserMutation) ResetVerified

func (m *UserMutation) ResetVerified()

ResetVerified resets all changes to the "verified" field.

func (*UserMutation) ResetVotes

func (m *UserMutation) ResetVotes()

ResetVotes resets all changes to the "votes" edge.

func (*UserMutation) SetBirthdayID

func (m *UserMutation) SetBirthdayID(id int)

SetBirthdayID sets the "birthday" edge to the Birthday entity by id.

func (*UserMutation) SetEmail

func (m *UserMutation) SetEmail(s string)

SetEmail sets the "email" field.

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 string)

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) SetVerificationAttempts

func (m *UserMutation) SetVerificationAttempts(i int8)

SetVerificationAttempts sets the "verification_attempts" field.

func (*UserMutation) SetVerified

func (m *UserMutation) SetVerified(b bool)

SetVerified sets the "verified" field.

func (*UserMutation) ShitpostsCleared

func (m *UserMutation) ShitpostsCleared() bool

ShitpostsCleared reports if the "shitposts" edge to the Shitpost entity was cleared.

func (*UserMutation) ShitpostsIDs

func (m *UserMutation) ShitpostsIDs() (ids []string)

ShitpostsIDs returns the "shitposts" edge IDs in the mutation.

func (*UserMutation) SigninsCleared

func (m *UserMutation) SigninsCleared() bool

SigninsCleared reports if the "signins" edge to the Signin entity was cleared.

func (*UserMutation) SigninsIDs

func (m *UserMutation) SigninsIDs() (ids []int)

SigninsIDs returns the "signins" edge IDs in the mutation.

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) VerificationAttempts

func (m *UserMutation) VerificationAttempts() (r int8, exists bool)

VerificationAttempts returns the value of the "verification_attempts" field in the mutation.

func (*UserMutation) Verified

func (m *UserMutation) Verified() (r bool, exists bool)

Verified returns the value of the "verified" field in the mutation.

func (*UserMutation) VotesCleared

func (m *UserMutation) VotesCleared() bool

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

func (*UserMutation) VotesIDs

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

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

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 (uq *UserQuery) Aggregate(fns ...AggregateFunc) *UserSelect

Aggregate returns a UserSelect configured with the given aggregations.

func (*UserQuery) All

func (uq *UserQuery) All(ctx context.Context) ([]*User, error)

All executes the query and returns a list of Users.

func (*UserQuery) AllX

func (uq *UserQuery) AllX(ctx context.Context) []*User

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

func (*UserQuery) Clone

func (uq *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 (uq *UserQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*UserQuery) CountX

func (uq *UserQuery) CountX(ctx context.Context) int

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

func (*UserQuery) Exist

func (uq *UserQuery) Exist(ctx context.Context) (bool, error)

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

func (*UserQuery) ExistX

func (uq *UserQuery) ExistX(ctx context.Context) bool

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

func (*UserQuery) First

func (uq *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 (uq *UserQuery) FirstID(ctx context.Context) (id string, err error)

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

func (*UserQuery) FirstIDX

func (uq *UserQuery) FirstIDX(ctx context.Context) string

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

func (*UserQuery) FirstX

func (uq *UserQuery) FirstX(ctx context.Context) *User

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

func (*UserQuery) GroupBy

func (uq *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.

Example:

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

client.User.Query().
	GroupBy(user.FieldEmail).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*UserQuery) IDs

func (uq *UserQuery) IDs(ctx context.Context) (ids []string, err error)

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

func (*UserQuery) IDsX

func (uq *UserQuery) IDsX(ctx context.Context) []string

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

func (*UserQuery) Limit

func (uq *UserQuery) Limit(limit int) *UserQuery

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

func (*UserQuery) Offset

func (uq *UserQuery) Offset(offset int) *UserQuery

Offset to start from.

func (*UserQuery) Only

func (uq *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 (uq *UserQuery) OnlyID(ctx context.Context) (id string, 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 (uq *UserQuery) OnlyIDX(ctx context.Context) string

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

func (*UserQuery) OnlyX

func (uq *UserQuery) OnlyX(ctx context.Context) *User

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

func (*UserQuery) Order

func (uq *UserQuery) Order(o ...user.OrderOption) *UserQuery

Order specifies how the records should be ordered.

func (*UserQuery) QueryBirthday

func (uq *UserQuery) QueryBirthday() *BirthdayQuery

QueryBirthday chains the current query on the "birthday" edge.

func (*UserQuery) QueryShitposts

func (uq *UserQuery) QueryShitposts() *ShitpostQuery

QueryShitposts chains the current query on the "shitposts" edge.

func (*UserQuery) QuerySignins

func (uq *UserQuery) QuerySignins() *SigninQuery

QuerySignins chains the current query on the "signins" edge.

func (*UserQuery) QueryVotes

func (uq *UserQuery) QueryVotes() *VoteQuery

QueryVotes chains the current query on the "votes" edge.

func (*UserQuery) Select

func (uq *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.

Example:

var v []struct {
	Email string `json:"email,omitempty"`
}

client.User.Query().
	Select(user.FieldEmail).
	Scan(ctx, &v)

func (*UserQuery) Unique

func (uq *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 (uq *UserQuery) Where(ps ...predicate.User) *UserQuery

Where adds a new predicate for the UserQuery builder.

func (*UserQuery) WithBirthday

func (uq *UserQuery) WithBirthday(opts ...func(*BirthdayQuery)) *UserQuery

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

func (*UserQuery) WithShitposts

func (uq *UserQuery) WithShitposts(opts ...func(*ShitpostQuery)) *UserQuery

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

func (*UserQuery) WithSignins

func (uq *UserQuery) WithSignins(opts ...func(*SigninQuery)) *UserQuery

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

func (*UserQuery) WithVotes

func (uq *UserQuery) WithVotes(opts ...func(*VoteQuery)) *UserQuery

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 UserSelect

type UserSelect struct {
	*UserQuery
	// contains filtered or unexported fields
}

UserSelect is the builder for selecting fields of User entities.

func (*UserSelect) Aggregate

func (us *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 (us *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) AddShitpostIDs

func (uu *UserUpdate) AddShitpostIDs(ids ...string) *UserUpdate

AddShitpostIDs adds the "shitposts" edge to the Shitpost entity by IDs.

func (*UserUpdate) AddShitposts

func (uu *UserUpdate) AddShitposts(s ...*Shitpost) *UserUpdate

AddShitposts adds the "shitposts" edges to the Shitpost entity.

func (*UserUpdate) AddSigninIDs

func (uu *UserUpdate) AddSigninIDs(ids ...int) *UserUpdate

AddSigninIDs adds the "signins" edge to the Signin entity by IDs.

func (*UserUpdate) AddSignins

func (uu *UserUpdate) AddSignins(s ...*Signin) *UserUpdate

AddSignins adds the "signins" edges to the Signin entity.

func (*UserUpdate) AddVerificationAttempts

func (uu *UserUpdate) AddVerificationAttempts(i int8) *UserUpdate

AddVerificationAttempts adds i to the "verification_attempts" field.

func (*UserUpdate) AddVoteIDs

func (uu *UserUpdate) AddVoteIDs(ids ...int) *UserUpdate

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

func (*UserUpdate) AddVotes

func (uu *UserUpdate) AddVotes(v ...*Vote) *UserUpdate

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

func (*UserUpdate) ClearBirthday

func (uu *UserUpdate) ClearBirthday() *UserUpdate

ClearBirthday clears the "birthday" edge to the Birthday entity.

func (*UserUpdate) ClearShitposts

func (uu *UserUpdate) ClearShitposts() *UserUpdate

ClearShitposts clears all "shitposts" edges to the Shitpost entity.

func (*UserUpdate) ClearSignins

func (uu *UserUpdate) ClearSignins() *UserUpdate

ClearSignins clears all "signins" edges to the Signin entity.

func (*UserUpdate) ClearVotes

func (uu *UserUpdate) ClearVotes() *UserUpdate

ClearVotes clears all "votes" edges to the Vote entity.

func (*UserUpdate) Exec

func (uu *UserUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*UserUpdate) ExecX

func (uu *UserUpdate) ExecX(ctx context.Context)

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

func (*UserUpdate) Mutation

func (uu *UserUpdate) Mutation() *UserMutation

Mutation returns the UserMutation object of the builder.

func (*UserUpdate) RemoveShitpostIDs

func (uu *UserUpdate) RemoveShitpostIDs(ids ...string) *UserUpdate

RemoveShitpostIDs removes the "shitposts" edge to Shitpost entities by IDs.

func (*UserUpdate) RemoveShitposts

func (uu *UserUpdate) RemoveShitposts(s ...*Shitpost) *UserUpdate

RemoveShitposts removes "shitposts" edges to Shitpost entities.

func (*UserUpdate) RemoveSigninIDs

func (uu *UserUpdate) RemoveSigninIDs(ids ...int) *UserUpdate

RemoveSigninIDs removes the "signins" edge to Signin entities by IDs.

func (*UserUpdate) RemoveSignins

func (uu *UserUpdate) RemoveSignins(s ...*Signin) *UserUpdate

RemoveSignins removes "signins" edges to Signin entities.

func (*UserUpdate) RemoveVoteIDs

func (uu *UserUpdate) RemoveVoteIDs(ids ...int) *UserUpdate

RemoveVoteIDs removes the "votes" edge to Vote entities by IDs.

func (*UserUpdate) RemoveVotes

func (uu *UserUpdate) RemoveVotes(v ...*Vote) *UserUpdate

RemoveVotes removes "votes" edges to Vote entities.

func (*UserUpdate) Save

func (uu *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 (uu *UserUpdate) SaveX(ctx context.Context) int

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

func (*UserUpdate) SetBirthday

func (uu *UserUpdate) SetBirthday(b *Birthday) *UserUpdate

SetBirthday sets the "birthday" edge to the Birthday entity.

func (*UserUpdate) SetBirthdayID

func (uu *UserUpdate) SetBirthdayID(id int) *UserUpdate

SetBirthdayID sets the "birthday" edge to the Birthday entity by ID.

func (*UserUpdate) SetEmail

func (uu *UserUpdate) SetEmail(s string) *UserUpdate

SetEmail sets the "email" field.

func (*UserUpdate) SetNillableBirthdayID

func (uu *UserUpdate) SetNillableBirthdayID(id *int) *UserUpdate

SetNillableBirthdayID sets the "birthday" edge to the Birthday entity by ID if the given value is not nil.

func (*UserUpdate) SetNillableEmail

func (uu *UserUpdate) SetNillableEmail(s *string) *UserUpdate

SetNillableEmail sets the "email" field if the given value is not nil.

func (*UserUpdate) SetNillableVerificationAttempts

func (uu *UserUpdate) SetNillableVerificationAttempts(i *int8) *UserUpdate

SetNillableVerificationAttempts sets the "verification_attempts" field if the given value is not nil.

func (*UserUpdate) SetNillableVerified

func (uu *UserUpdate) SetNillableVerified(b *bool) *UserUpdate

SetNillableVerified sets the "verified" field if the given value is not nil.

func (*UserUpdate) SetVerificationAttempts

func (uu *UserUpdate) SetVerificationAttempts(i int8) *UserUpdate

SetVerificationAttempts sets the "verification_attempts" field.

func (*UserUpdate) SetVerified

func (uu *UserUpdate) SetVerified(b bool) *UserUpdate

SetVerified sets the "verified" field.

func (*UserUpdate) Where

func (uu *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) AddShitpostIDs

func (uuo *UserUpdateOne) AddShitpostIDs(ids ...string) *UserUpdateOne

AddShitpostIDs adds the "shitposts" edge to the Shitpost entity by IDs.

func (*UserUpdateOne) AddShitposts

func (uuo *UserUpdateOne) AddShitposts(s ...*Shitpost) *UserUpdateOne

AddShitposts adds the "shitposts" edges to the Shitpost entity.

func (*UserUpdateOne) AddSigninIDs

func (uuo *UserUpdateOne) AddSigninIDs(ids ...int) *UserUpdateOne

AddSigninIDs adds the "signins" edge to the Signin entity by IDs.

func (*UserUpdateOne) AddSignins

func (uuo *UserUpdateOne) AddSignins(s ...*Signin) *UserUpdateOne

AddSignins adds the "signins" edges to the Signin entity.

func (*UserUpdateOne) AddVerificationAttempts

func (uuo *UserUpdateOne) AddVerificationAttempts(i int8) *UserUpdateOne

AddVerificationAttempts adds i to the "verification_attempts" field.

func (*UserUpdateOne) AddVoteIDs

func (uuo *UserUpdateOne) AddVoteIDs(ids ...int) *UserUpdateOne

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

func (*UserUpdateOne) AddVotes

func (uuo *UserUpdateOne) AddVotes(v ...*Vote) *UserUpdateOne

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

func (*UserUpdateOne) ClearBirthday

func (uuo *UserUpdateOne) ClearBirthday() *UserUpdateOne

ClearBirthday clears the "birthday" edge to the Birthday entity.

func (*UserUpdateOne) ClearShitposts

func (uuo *UserUpdateOne) ClearShitposts() *UserUpdateOne

ClearShitposts clears all "shitposts" edges to the Shitpost entity.

func (*UserUpdateOne) ClearSignins

func (uuo *UserUpdateOne) ClearSignins() *UserUpdateOne

ClearSignins clears all "signins" edges to the Signin entity.

func (*UserUpdateOne) ClearVotes

func (uuo *UserUpdateOne) ClearVotes() *UserUpdateOne

ClearVotes clears all "votes" edges to the Vote entity.

func (*UserUpdateOne) Exec

func (uuo *UserUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*UserUpdateOne) ExecX

func (uuo *UserUpdateOne) ExecX(ctx context.Context)

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

func (*UserUpdateOne) Mutation

func (uuo *UserUpdateOne) Mutation() *UserMutation

Mutation returns the UserMutation object of the builder.

func (*UserUpdateOne) RemoveShitpostIDs

func (uuo *UserUpdateOne) RemoveShitpostIDs(ids ...string) *UserUpdateOne

RemoveShitpostIDs removes the "shitposts" edge to Shitpost entities by IDs.

func (*UserUpdateOne) RemoveShitposts

func (uuo *UserUpdateOne) RemoveShitposts(s ...*Shitpost) *UserUpdateOne

RemoveShitposts removes "shitposts" edges to Shitpost entities.

func (*UserUpdateOne) RemoveSigninIDs

func (uuo *UserUpdateOne) RemoveSigninIDs(ids ...int) *UserUpdateOne

RemoveSigninIDs removes the "signins" edge to Signin entities by IDs.

func (*UserUpdateOne) RemoveSignins

func (uuo *UserUpdateOne) RemoveSignins(s ...*Signin) *UserUpdateOne

RemoveSignins removes "signins" edges to Signin entities.

func (*UserUpdateOne) RemoveVoteIDs

func (uuo *UserUpdateOne) RemoveVoteIDs(ids ...int) *UserUpdateOne

RemoveVoteIDs removes the "votes" edge to Vote entities by IDs.

func (*UserUpdateOne) RemoveVotes

func (uuo *UserUpdateOne) RemoveVotes(v ...*Vote) *UserUpdateOne

RemoveVotes removes "votes" edges to Vote entities.

func (*UserUpdateOne) Save

func (uuo *UserUpdateOne) Save(ctx context.Context) (*User, error)

Save executes the query and returns the updated User entity.

func (*UserUpdateOne) SaveX

func (uuo *UserUpdateOne) SaveX(ctx context.Context) *User

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

func (*UserUpdateOne) Select

func (uuo *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) SetBirthday

func (uuo *UserUpdateOne) SetBirthday(b *Birthday) *UserUpdateOne

SetBirthday sets the "birthday" edge to the Birthday entity.

func (*UserUpdateOne) SetBirthdayID

func (uuo *UserUpdateOne) SetBirthdayID(id int) *UserUpdateOne

SetBirthdayID sets the "birthday" edge to the Birthday entity by ID.

func (*UserUpdateOne) SetEmail

func (uuo *UserUpdateOne) SetEmail(s string) *UserUpdateOne

SetEmail sets the "email" field.

func (*UserUpdateOne) SetNillableBirthdayID

func (uuo *UserUpdateOne) SetNillableBirthdayID(id *int) *UserUpdateOne

SetNillableBirthdayID sets the "birthday" edge to the Birthday entity by ID if the given value is not nil.

func (*UserUpdateOne) SetNillableEmail

func (uuo *UserUpdateOne) SetNillableEmail(s *string) *UserUpdateOne

SetNillableEmail sets the "email" field if the given value is not nil.

func (*UserUpdateOne) SetNillableVerificationAttempts

func (uuo *UserUpdateOne) SetNillableVerificationAttempts(i *int8) *UserUpdateOne

SetNillableVerificationAttempts sets the "verification_attempts" field if the given value is not nil.

func (*UserUpdateOne) SetNillableVerified

func (uuo *UserUpdateOne) SetNillableVerified(b *bool) *UserUpdateOne

SetNillableVerified sets the "verified" field if the given value is not nil.

func (*UserUpdateOne) SetVerificationAttempts

func (uuo *UserUpdateOne) SetVerificationAttempts(i int8) *UserUpdateOne

SetVerificationAttempts sets the "verification_attempts" field.

func (*UserUpdateOne) SetVerified

func (uuo *UserUpdateOne) SetVerified(b bool) *UserUpdateOne

SetVerified sets the "verified" field.

func (*UserUpdateOne) Where

func (uuo *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.

type Vote

type Vote struct {

	// ID of the ent.
	ID int `json:"id,omitempty"`
	// The user's selection
	Selection string `json:"selection,omitempty"`
	// The selection's position
	Rank int `json:"rank,omitempty"`
	// The vote's ID
	VoteID string `json:"vote_id,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the VoteQuery when eager-loading is set.
	Edges VoteEdges `json:"edges"`
	// contains filtered or unexported fields
}

Vote is the model entity for the Vote schema.

func (*Vote) QueryUser

func (v *Vote) QueryUser() *UserQuery

QueryUser queries the "user" edge of the Vote entity.

func (*Vote) String

func (v *Vote) String() string

String implements the fmt.Stringer.

func (*Vote) Unwrap

func (v *Vote) Unwrap() *Vote

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

func (v *Vote) Update() *VoteUpdateOne

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

func (*Vote) Value

func (v *Vote) Value(name string) (ent.Value, error)

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

type VoteClient

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

VoteClient is a client for the Vote schema.

func NewVoteClient

func NewVoteClient(c config) *VoteClient

NewVoteClient returns a client for the Vote from the given config.

func (*VoteClient) Create

func (c *VoteClient) Create() *VoteCreate

Create returns a builder for creating a Vote entity.

func (*VoteClient) CreateBulk

func (c *VoteClient) CreateBulk(builders ...*VoteCreate) *VoteCreateBulk

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

func (*VoteClient) Delete

func (c *VoteClient) Delete() *VoteDelete

Delete returns a delete builder for Vote.

func (*VoteClient) DeleteOne

func (c *VoteClient) DeleteOne(v *Vote) *VoteDeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*VoteClient) DeleteOneID

func (c *VoteClient) DeleteOneID(id int) *VoteDeleteOne

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

func (*VoteClient) Get

func (c *VoteClient) Get(ctx context.Context, id int) (*Vote, error)

Get returns a Vote entity by its id.

func (*VoteClient) GetX

func (c *VoteClient) GetX(ctx context.Context, id int) *Vote

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

func (*VoteClient) Hooks

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

Hooks returns the client hooks.

func (*VoteClient) Intercept

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

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

func (*VoteClient) Interceptors

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

Interceptors returns the client interceptors.

func (*VoteClient) Query

func (c *VoteClient) Query() *VoteQuery

Query returns a query builder for Vote.

func (*VoteClient) QueryUser

func (c *VoteClient) QueryUser(v *Vote) *UserQuery

QueryUser queries the user edge of a Vote.

func (*VoteClient) Update

func (c *VoteClient) Update() *VoteUpdate

Update returns an update builder for Vote.

func (*VoteClient) UpdateOne

func (c *VoteClient) UpdateOne(v *Vote) *VoteUpdateOne

UpdateOne returns an update builder for the given entity.

func (*VoteClient) UpdateOneID

func (c *VoteClient) UpdateOneID(id int) *VoteUpdateOne

UpdateOneID returns an update builder for the given id.

func (*VoteClient) Use

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

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

type VoteCreate

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

VoteCreate is the builder for creating a Vote entity.

func (*VoteCreate) Exec

func (vc *VoteCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*VoteCreate) ExecX

func (vc *VoteCreate) ExecX(ctx context.Context)

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

func (*VoteCreate) Mutation

func (vc *VoteCreate) Mutation() *VoteMutation

Mutation returns the VoteMutation object of the builder.

func (*VoteCreate) Save

func (vc *VoteCreate) Save(ctx context.Context) (*Vote, error)

Save creates the Vote in the database.

func (*VoteCreate) SaveX

func (vc *VoteCreate) SaveX(ctx context.Context) *Vote

SaveX calls Save and panics if Save returns an error.

func (*VoteCreate) SetRank

func (vc *VoteCreate) SetRank(i int) *VoteCreate

SetRank sets the "rank" field.

func (*VoteCreate) SetSelection

func (vc *VoteCreate) SetSelection(s string) *VoteCreate

SetSelection sets the "selection" field.

func (*VoteCreate) SetUser

func (vc *VoteCreate) SetUser(u *User) *VoteCreate

SetUser sets the "user" edge to the User entity.

func (*VoteCreate) SetUserID

func (vc *VoteCreate) SetUserID(id string) *VoteCreate

SetUserID sets the "user" edge to the User entity by ID.

func (*VoteCreate) SetVoteID

func (vc *VoteCreate) SetVoteID(s string) *VoteCreate

SetVoteID sets the "vote_id" field.

type VoteCreateBulk

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

VoteCreateBulk is the builder for creating many Vote entities in bulk.

func (*VoteCreateBulk) Exec

func (vcb *VoteCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*VoteCreateBulk) ExecX

func (vcb *VoteCreateBulk) ExecX(ctx context.Context)

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

func (*VoteCreateBulk) Save

func (vcb *VoteCreateBulk) Save(ctx context.Context) ([]*Vote, error)

Save creates the Vote entities in the database.

func (*VoteCreateBulk) SaveX

func (vcb *VoteCreateBulk) SaveX(ctx context.Context) []*Vote

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

type VoteDelete

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

VoteDelete is the builder for deleting a Vote entity.

func (*VoteDelete) Exec

func (vd *VoteDelete) Exec(ctx context.Context) (int, error)

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

func (*VoteDelete) ExecX

func (vd *VoteDelete) ExecX(ctx context.Context) int

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

func (*VoteDelete) Where

func (vd *VoteDelete) Where(ps ...predicate.Vote) *VoteDelete

Where appends a list predicates to the VoteDelete builder.

type VoteDeleteOne

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

VoteDeleteOne is the builder for deleting a single Vote entity.

func (*VoteDeleteOne) Exec

func (vdo *VoteDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*VoteDeleteOne) ExecX

func (vdo *VoteDeleteOne) ExecX(ctx context.Context)

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

func (*VoteDeleteOne) Where

func (vdo *VoteDeleteOne) Where(ps ...predicate.Vote) *VoteDeleteOne

Where appends a list predicates to the VoteDelete builder.

type VoteEdges

type VoteEdges struct {
	// User who voted
	User *User `json:"user,omitempty"`
	// contains filtered or unexported fields
}

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

func (VoteEdges) UserOrErr

func (e VoteEdges) UserOrErr() (*User, error)

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

type VoteGroupBy

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

VoteGroupBy is the group-by builder for Vote entities.

func (*VoteGroupBy) Aggregate

func (vgb *VoteGroupBy) Aggregate(fns ...AggregateFunc) *VoteGroupBy

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

func (*VoteGroupBy) Bool

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

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

func (*VoteGroupBy) BoolX

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

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

func (*VoteGroupBy) Bools

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

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

func (*VoteGroupBy) BoolsX

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

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

func (*VoteGroupBy) Float64

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

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

func (*VoteGroupBy) Float64X

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

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

func (*VoteGroupBy) Float64s

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

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

func (*VoteGroupBy) Float64sX

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

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

func (*VoteGroupBy) Int

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

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

func (*VoteGroupBy) IntX

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

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

func (*VoteGroupBy) Ints

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

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

func (*VoteGroupBy) IntsX

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

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

func (*VoteGroupBy) Scan

func (vgb *VoteGroupBy) Scan(ctx context.Context, v any) error

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

func (*VoteGroupBy) ScanX

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

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

func (*VoteGroupBy) String

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

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

func (*VoteGroupBy) StringX

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

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

func (*VoteGroupBy) Strings

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

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

func (*VoteGroupBy) StringsX

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

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

type VoteMutation

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

VoteMutation represents an operation that mutates the Vote nodes in the graph.

func (*VoteMutation) AddField

func (m *VoteMutation) 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 (*VoteMutation) AddRank

func (m *VoteMutation) AddRank(i int)

AddRank adds i to the "rank" field.

func (*VoteMutation) AddedEdges

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

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

func (*VoteMutation) AddedField

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

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

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

func (*VoteMutation) AddedIDs

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

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

func (*VoteMutation) AddedRank

func (m *VoteMutation) AddedRank() (r int, exists bool)

AddedRank returns the value that was added to the "rank" field in this mutation.

func (*VoteMutation) ClearEdge

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

func (m *VoteMutation) 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 (*VoteMutation) ClearUser

func (m *VoteMutation) ClearUser()

ClearUser clears the "user" edge to the User entity.

func (*VoteMutation) ClearedEdges

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

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

func (*VoteMutation) ClearedFields

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

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

func (VoteMutation) Client

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

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

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

func (*VoteMutation) Field

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

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

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

func (*VoteMutation) Fields

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

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

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

func (m *VoteMutation) 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 (*VoteMutation) OldRank

func (m *VoteMutation) OldRank(ctx context.Context) (v int, err error)

OldRank returns the old "rank" field's value of the Vote entity. If the Vote 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 (*VoteMutation) OldSelection

func (m *VoteMutation) OldSelection(ctx context.Context) (v string, err error)

OldSelection returns the old "selection" field's value of the Vote entity. If the Vote 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 (*VoteMutation) OldVoteID

func (m *VoteMutation) OldVoteID(ctx context.Context) (v string, err error)

OldVoteID returns the old "vote_id" field's value of the Vote entity. If the Vote 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 (*VoteMutation) Op

func (m *VoteMutation) Op() Op

Op returns the operation name.

func (*VoteMutation) Rank

func (m *VoteMutation) Rank() (r int, exists bool)

Rank returns the value of the "rank" field in the mutation.

func (*VoteMutation) RemovedEdges

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

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

func (*VoteMutation) RemovedIDs

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

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

func (m *VoteMutation) 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 (*VoteMutation) ResetRank

func (m *VoteMutation) ResetRank()

ResetRank resets all changes to the "rank" field.

func (*VoteMutation) ResetSelection

func (m *VoteMutation) ResetSelection()

ResetSelection resets all changes to the "selection" field.

func (*VoteMutation) ResetUser

func (m *VoteMutation) ResetUser()

ResetUser resets all changes to the "user" edge.

func (*VoteMutation) ResetVoteID

func (m *VoteMutation) ResetVoteID()

ResetVoteID resets all changes to the "vote_id" field.

func (*VoteMutation) Selection

func (m *VoteMutation) Selection() (r string, exists bool)

Selection returns the value of the "selection" field in the mutation.

func (*VoteMutation) SetField

func (m *VoteMutation) 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 (*VoteMutation) SetOp

func (m *VoteMutation) SetOp(op Op)

SetOp allows setting the mutation operation.

func (*VoteMutation) SetRank

func (m *VoteMutation) SetRank(i int)

SetRank sets the "rank" field.

func (*VoteMutation) SetSelection

func (m *VoteMutation) SetSelection(s string)

SetSelection sets the "selection" field.

func (*VoteMutation) SetUserID

func (m *VoteMutation) SetUserID(id string)

SetUserID sets the "user" edge to the User entity by id.

func (*VoteMutation) SetVoteID

func (m *VoteMutation) SetVoteID(s string)

SetVoteID sets the "vote_id" field.

func (VoteMutation) Tx

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

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

func (*VoteMutation) Type

func (m *VoteMutation) Type() string

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

func (*VoteMutation) UserCleared

func (m *VoteMutation) UserCleared() bool

UserCleared reports if the "user" edge to the User entity was cleared.

func (*VoteMutation) UserID

func (m *VoteMutation) UserID() (id string, exists bool)

UserID returns the "user" edge ID in the mutation.

func (*VoteMutation) UserIDs

func (m *VoteMutation) UserIDs() (ids []string)

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

func (*VoteMutation) VoteID

func (m *VoteMutation) VoteID() (r string, exists bool)

VoteID returns the value of the "vote_id" field in the mutation.

func (*VoteMutation) Where

func (m *VoteMutation) Where(ps ...predicate.Vote)

Where appends a list predicates to the VoteMutation builder.

func (*VoteMutation) WhereP

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

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

type VoteQuery

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

VoteQuery is the builder for querying Vote entities.

func (*VoteQuery) Aggregate

func (vq *VoteQuery) Aggregate(fns ...AggregateFunc) *VoteSelect

Aggregate returns a VoteSelect configured with the given aggregations.

func (*VoteQuery) All

func (vq *VoteQuery) All(ctx context.Context) ([]*Vote, error)

All executes the query and returns a list of Votes.

func (*VoteQuery) AllX

func (vq *VoteQuery) AllX(ctx context.Context) []*Vote

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

func (*VoteQuery) Clone

func (vq *VoteQuery) Clone() *VoteQuery

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

func (*VoteQuery) Count

func (vq *VoteQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*VoteQuery) CountX

func (vq *VoteQuery) CountX(ctx context.Context) int

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

func (*VoteQuery) Exist

func (vq *VoteQuery) Exist(ctx context.Context) (bool, error)

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

func (*VoteQuery) ExistX

func (vq *VoteQuery) ExistX(ctx context.Context) bool

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

func (*VoteQuery) First

func (vq *VoteQuery) First(ctx context.Context) (*Vote, error)

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

func (*VoteQuery) FirstID

func (vq *VoteQuery) FirstID(ctx context.Context) (id int, err error)

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

func (*VoteQuery) FirstIDX

func (vq *VoteQuery) FirstIDX(ctx context.Context) int

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

func (*VoteQuery) FirstX

func (vq *VoteQuery) FirstX(ctx context.Context) *Vote

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

func (*VoteQuery) GroupBy

func (vq *VoteQuery) GroupBy(field string, fields ...string) *VoteGroupBy

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

client.Vote.Query().
	GroupBy(vote.FieldSelection).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*VoteQuery) IDs

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

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

func (*VoteQuery) IDsX

func (vq *VoteQuery) IDsX(ctx context.Context) []int

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

func (*VoteQuery) Limit

func (vq *VoteQuery) Limit(limit int) *VoteQuery

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

func (*VoteQuery) Offset

func (vq *VoteQuery) Offset(offset int) *VoteQuery

Offset to start from.

func (*VoteQuery) Only

func (vq *VoteQuery) Only(ctx context.Context) (*Vote, error)

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

func (*VoteQuery) OnlyID

func (vq *VoteQuery) OnlyID(ctx context.Context) (id int, err error)

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

func (*VoteQuery) OnlyIDX

func (vq *VoteQuery) OnlyIDX(ctx context.Context) int

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

func (*VoteQuery) OnlyX

func (vq *VoteQuery) OnlyX(ctx context.Context) *Vote

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

func (*VoteQuery) Order

func (vq *VoteQuery) Order(o ...vote.OrderOption) *VoteQuery

Order specifies how the records should be ordered.

func (*VoteQuery) QueryUser

func (vq *VoteQuery) QueryUser() *UserQuery

QueryUser chains the current query on the "user" edge.

func (*VoteQuery) Select

func (vq *VoteQuery) Select(fields ...string) *VoteSelect

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

client.Vote.Query().
	Select(vote.FieldSelection).
	Scan(ctx, &v)

func (*VoteQuery) Unique

func (vq *VoteQuery) Unique(unique bool) *VoteQuery

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

func (vq *VoteQuery) Where(ps ...predicate.Vote) *VoteQuery

Where adds a new predicate for the VoteQuery builder.

func (*VoteQuery) WithUser

func (vq *VoteQuery) WithUser(opts ...func(*UserQuery)) *VoteQuery

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

type VoteResult

type VoteResult struct {

	// ID of the ent.
	ID int `json:"id,omitempty"`
	// The vote's HTML Results
	HTML string `json:"html,omitempty"`
	// The vote's plaintext results
	Plain string `json:"plain,omitempty"`
	// The vote's ID
	VoteID string `json:"vote_id,omitempty"`
	// contains filtered or unexported fields
}

VoteResult is the model entity for the VoteResult schema.

func (*VoteResult) String

func (vr *VoteResult) String() string

String implements the fmt.Stringer.

func (*VoteResult) Unwrap

func (vr *VoteResult) Unwrap() *VoteResult

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

func (vr *VoteResult) Update() *VoteResultUpdateOne

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

func (*VoteResult) Value

func (vr *VoteResult) Value(name string) (ent.Value, error)

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

type VoteResultClient

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

VoteResultClient is a client for the VoteResult schema.

func NewVoteResultClient

func NewVoteResultClient(c config) *VoteResultClient

NewVoteResultClient returns a client for the VoteResult from the given config.

func (*VoteResultClient) Create

func (c *VoteResultClient) Create() *VoteResultCreate

Create returns a builder for creating a VoteResult entity.

func (*VoteResultClient) CreateBulk

func (c *VoteResultClient) CreateBulk(builders ...*VoteResultCreate) *VoteResultCreateBulk

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

func (*VoteResultClient) Delete

func (c *VoteResultClient) Delete() *VoteResultDelete

Delete returns a delete builder for VoteResult.

func (*VoteResultClient) DeleteOne

func (c *VoteResultClient) DeleteOne(vr *VoteResult) *VoteResultDeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*VoteResultClient) DeleteOneID

func (c *VoteResultClient) DeleteOneID(id int) *VoteResultDeleteOne

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

func (*VoteResultClient) Get

func (c *VoteResultClient) Get(ctx context.Context, id int) (*VoteResult, error)

Get returns a VoteResult entity by its id.

func (*VoteResultClient) GetX

func (c *VoteResultClient) GetX(ctx context.Context, id int) *VoteResult

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

func (*VoteResultClient) Hooks

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

Hooks returns the client hooks.

func (*VoteResultClient) Intercept

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

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

func (*VoteResultClient) Interceptors

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

Interceptors returns the client interceptors.

func (*VoteResultClient) Query

func (c *VoteResultClient) Query() *VoteResultQuery

Query returns a query builder for VoteResult.

func (*VoteResultClient) Update

func (c *VoteResultClient) Update() *VoteResultUpdate

Update returns an update builder for VoteResult.

func (*VoteResultClient) UpdateOne

func (c *VoteResultClient) UpdateOne(vr *VoteResult) *VoteResultUpdateOne

UpdateOne returns an update builder for the given entity.

func (*VoteResultClient) UpdateOneID

func (c *VoteResultClient) UpdateOneID(id int) *VoteResultUpdateOne

UpdateOneID returns an update builder for the given id.

func (*VoteResultClient) Use

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

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

type VoteResultCreate

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

VoteResultCreate is the builder for creating a VoteResult entity.

func (*VoteResultCreate) Exec

func (vrc *VoteResultCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*VoteResultCreate) ExecX

func (vrc *VoteResultCreate) ExecX(ctx context.Context)

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

func (*VoteResultCreate) Mutation

func (vrc *VoteResultCreate) Mutation() *VoteResultMutation

Mutation returns the VoteResultMutation object of the builder.

func (*VoteResultCreate) Save

func (vrc *VoteResultCreate) Save(ctx context.Context) (*VoteResult, error)

Save creates the VoteResult in the database.

func (*VoteResultCreate) SaveX

func (vrc *VoteResultCreate) SaveX(ctx context.Context) *VoteResult

SaveX calls Save and panics if Save returns an error.

func (*VoteResultCreate) SetHTML

func (vrc *VoteResultCreate) SetHTML(s string) *VoteResultCreate

SetHTML sets the "html" field.

func (*VoteResultCreate) SetPlain

func (vrc *VoteResultCreate) SetPlain(s string) *VoteResultCreate

SetPlain sets the "plain" field.

func (*VoteResultCreate) SetVoteID

func (vrc *VoteResultCreate) SetVoteID(s string) *VoteResultCreate

SetVoteID sets the "vote_id" field.

type VoteResultCreateBulk

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

VoteResultCreateBulk is the builder for creating many VoteResult entities in bulk.

func (*VoteResultCreateBulk) Exec

func (vrcb *VoteResultCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*VoteResultCreateBulk) ExecX

func (vrcb *VoteResultCreateBulk) ExecX(ctx context.Context)

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

func (*VoteResultCreateBulk) Save

func (vrcb *VoteResultCreateBulk) Save(ctx context.Context) ([]*VoteResult, error)

Save creates the VoteResult entities in the database.

func (*VoteResultCreateBulk) SaveX

func (vrcb *VoteResultCreateBulk) SaveX(ctx context.Context) []*VoteResult

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

type VoteResultDelete

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

VoteResultDelete is the builder for deleting a VoteResult entity.

func (*VoteResultDelete) Exec

func (vrd *VoteResultDelete) Exec(ctx context.Context) (int, error)

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

func (*VoteResultDelete) ExecX

func (vrd *VoteResultDelete) ExecX(ctx context.Context) int

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

func (*VoteResultDelete) Where

Where appends a list predicates to the VoteResultDelete builder.

type VoteResultDeleteOne

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

VoteResultDeleteOne is the builder for deleting a single VoteResult entity.

func (*VoteResultDeleteOne) Exec

func (vrdo *VoteResultDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*VoteResultDeleteOne) ExecX

func (vrdo *VoteResultDeleteOne) ExecX(ctx context.Context)

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

func (*VoteResultDeleteOne) Where

Where appends a list predicates to the VoteResultDelete builder.

type VoteResultGroupBy

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

VoteResultGroupBy is the group-by builder for VoteResult entities.

func (*VoteResultGroupBy) Aggregate

func (vrgb *VoteResultGroupBy) Aggregate(fns ...AggregateFunc) *VoteResultGroupBy

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

func (*VoteResultGroupBy) Bool

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

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

func (*VoteResultGroupBy) BoolX

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

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

func (*VoteResultGroupBy) Bools

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

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

func (*VoteResultGroupBy) BoolsX

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

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

func (*VoteResultGroupBy) Float64

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

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

func (*VoteResultGroupBy) Float64X

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

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

func (*VoteResultGroupBy) Float64s

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

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

func (*VoteResultGroupBy) Float64sX

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

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

func (*VoteResultGroupBy) Int

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

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

func (*VoteResultGroupBy) IntX

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

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

func (*VoteResultGroupBy) Ints

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

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

func (*VoteResultGroupBy) IntsX

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

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

func (*VoteResultGroupBy) Scan

func (vrgb *VoteResultGroupBy) Scan(ctx context.Context, v any) error

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

func (*VoteResultGroupBy) ScanX

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

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

func (*VoteResultGroupBy) String

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

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

func (*VoteResultGroupBy) StringX

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

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

func (*VoteResultGroupBy) Strings

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

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

func (*VoteResultGroupBy) StringsX

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

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

type VoteResultMutation

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

VoteResultMutation represents an operation that mutates the VoteResult nodes in the graph.

func (*VoteResultMutation) AddField

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

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

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

func (*VoteResultMutation) AddedField

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

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

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

func (*VoteResultMutation) AddedIDs

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

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

func (*VoteResultMutation) ClearEdge

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

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

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

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

func (*VoteResultMutation) ClearedFields

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

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

func (VoteResultMutation) Client

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

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

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

func (*VoteResultMutation) Field

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

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

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

func (*VoteResultMutation) Fields

func (m *VoteResultMutation) 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 (*VoteResultMutation) HTML

func (m *VoteResultMutation) HTML() (r string, exists bool)

HTML returns the value of the "html" field in the mutation.

func (*VoteResultMutation) ID

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

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

func (m *VoteResultMutation) 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 (*VoteResultMutation) OldHTML

func (m *VoteResultMutation) OldHTML(ctx context.Context) (v string, err error)

OldHTML returns the old "html" field's value of the VoteResult entity. If the VoteResult 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 (*VoteResultMutation) OldPlain

func (m *VoteResultMutation) OldPlain(ctx context.Context) (v string, err error)

OldPlain returns the old "plain" field's value of the VoteResult entity. If the VoteResult 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 (*VoteResultMutation) OldVoteID

func (m *VoteResultMutation) OldVoteID(ctx context.Context) (v string, err error)

OldVoteID returns the old "vote_id" field's value of the VoteResult entity. If the VoteResult 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 (*VoteResultMutation) Op

func (m *VoteResultMutation) Op() Op

Op returns the operation name.

func (*VoteResultMutation) Plain

func (m *VoteResultMutation) Plain() (r string, exists bool)

Plain returns the value of the "plain" field in the mutation.

func (*VoteResultMutation) RemovedEdges

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

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

func (*VoteResultMutation) RemovedIDs

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

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

func (m *VoteResultMutation) 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 (*VoteResultMutation) ResetHTML

func (m *VoteResultMutation) ResetHTML()

ResetHTML resets all changes to the "html" field.

func (*VoteResultMutation) ResetPlain

func (m *VoteResultMutation) ResetPlain()

ResetPlain resets all changes to the "plain" field.

func (*VoteResultMutation) ResetVoteID

func (m *VoteResultMutation) ResetVoteID()

ResetVoteID resets all changes to the "vote_id" field.

func (*VoteResultMutation) SetField

func (m *VoteResultMutation) 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 (*VoteResultMutation) SetHTML

func (m *VoteResultMutation) SetHTML(s string)

SetHTML sets the "html" field.

func (*VoteResultMutation) SetOp

func (m *VoteResultMutation) SetOp(op Op)

SetOp allows setting the mutation operation.

func (*VoteResultMutation) SetPlain

func (m *VoteResultMutation) SetPlain(s string)

SetPlain sets the "plain" field.

func (*VoteResultMutation) SetVoteID

func (m *VoteResultMutation) SetVoteID(s string)

SetVoteID sets the "vote_id" field.

func (VoteResultMutation) Tx

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

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

func (*VoteResultMutation) Type

func (m *VoteResultMutation) Type() string

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

func (*VoteResultMutation) VoteID

func (m *VoteResultMutation) VoteID() (r string, exists bool)

VoteID returns the value of the "vote_id" field in the mutation.

func (*VoteResultMutation) Where

func (m *VoteResultMutation) Where(ps ...predicate.VoteResult)

Where appends a list predicates to the VoteResultMutation builder.

func (*VoteResultMutation) WhereP

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

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

type VoteResultQuery

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

VoteResultQuery is the builder for querying VoteResult entities.

func (*VoteResultQuery) Aggregate

func (vrq *VoteResultQuery) Aggregate(fns ...AggregateFunc) *VoteResultSelect

Aggregate returns a VoteResultSelect configured with the given aggregations.

func (*VoteResultQuery) All

func (vrq *VoteResultQuery) All(ctx context.Context) ([]*VoteResult, error)

All executes the query and returns a list of VoteResults.

func (*VoteResultQuery) AllX

func (vrq *VoteResultQuery) AllX(ctx context.Context) []*VoteResult

AllX is like All, but panics if an error occurs.

func (*VoteResultQuery) Clone

func (vrq *VoteResultQuery) Clone() *VoteResultQuery

Clone returns a duplicate of the VoteResultQuery builder, including all associated steps. It can be used to prepare common query builders and use them differently after the clone is made.

func (*VoteResultQuery) Count

func (vrq *VoteResultQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*VoteResultQuery) CountX

func (vrq *VoteResultQuery) CountX(ctx context.Context) int

CountX is like Count, but panics if an error occurs.

func (*VoteResultQuery) Exist

func (vrq *VoteResultQuery) Exist(ctx context.Context) (bool, error)

Exist returns true if the query has elements in the graph.

func (*VoteResultQuery) ExistX

func (vrq *VoteResultQuery) ExistX(ctx context.Context) bool

ExistX is like Exist, but panics if an error occurs.

func (*VoteResultQuery) First

func (vrq *VoteResultQuery) First(ctx context.Context) (*VoteResult, error)

First returns the first VoteResult entity from the query. Returns a *NotFoundError when no VoteResult was found.

func (*VoteResultQuery) FirstID

func (vrq *VoteResultQuery) FirstID(ctx context.Context) (id int, err error)

FirstID returns the first VoteResult ID from the query. Returns a *NotFoundError when no VoteResult ID was found.

func (*VoteResultQuery) FirstIDX

func (vrq *VoteResultQuery) FirstIDX(ctx context.Context) int

FirstIDX is like FirstID, but panics if an error occurs.

func (*VoteResultQuery) FirstX

func (vrq *VoteResultQuery) FirstX(ctx context.Context) *VoteResult

FirstX is like First, but panics if an error occurs.

func (*VoteResultQuery) GroupBy

func (vrq *VoteResultQuery) GroupBy(field string, fields ...string) *VoteResultGroupBy

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 {
	HTML string `json:"html,omitempty"`
	Count int `json:"count,omitempty"`
}

client.VoteResult.Query().
	GroupBy(voteresult.FieldHTML).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*VoteResultQuery) IDs

func (vrq *VoteResultQuery) IDs(ctx context.Context) (ids []int, err error)

IDs executes the query and returns a list of VoteResult IDs.

func (*VoteResultQuery) IDsX

func (vrq *VoteResultQuery) IDsX(ctx context.Context) []int

IDsX is like IDs, but panics if an error occurs.

func (*VoteResultQuery) Limit

func (vrq *VoteResultQuery) Limit(limit int) *VoteResultQuery

Limit the number of records to be returned by this query.

func (*VoteResultQuery) Offset

func (vrq *VoteResultQuery) Offset(offset int) *VoteResultQuery

Offset to start from.

func (*VoteResultQuery) Only

func (vrq *VoteResultQuery) Only(ctx context.Context) (*VoteResult, error)

Only returns a single VoteResult entity found by the query, ensuring it only returns one. Returns a *NotSingularError when more than one VoteResult entity is found. Returns a *NotFoundError when no VoteResult entities are found.

func (*VoteResultQuery) OnlyID

func (vrq *VoteResultQuery) OnlyID(ctx context.Context) (id int, err error)

OnlyID is like Only, but returns the only VoteResult ID in the query. Returns a *NotSingularError when more than one VoteResult ID is found. Returns a *NotFoundError when no entities are found.

func (*VoteResultQuery) OnlyIDX

func (vrq *VoteResultQuery) OnlyIDX(ctx context.Context) int

OnlyIDX is like OnlyID, but panics if an error occurs.

func (*VoteResultQuery) OnlyX

func (vrq *VoteResultQuery) OnlyX(ctx context.Context) *VoteResult

OnlyX is like Only, but panics if an error occurs.

func (*VoteResultQuery) Order

Order specifies how the records should be ordered.

func (*VoteResultQuery) Select

func (vrq *VoteResultQuery) Select(fields ...string) *VoteResultSelect

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 {
	HTML string `json:"html,omitempty"`
}

client.VoteResult.Query().
	Select(voteresult.FieldHTML).
	Scan(ctx, &v)

func (*VoteResultQuery) Unique

func (vrq *VoteResultQuery) Unique(unique bool) *VoteResultQuery

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 (*VoteResultQuery) Where

Where adds a new predicate for the VoteResultQuery builder.

type VoteResultSelect

type VoteResultSelect struct {
	*VoteResultQuery
	// contains filtered or unexported fields
}

VoteResultSelect is the builder for selecting fields of VoteResult entities.

func (*VoteResultSelect) Aggregate

func (vrs *VoteResultSelect) Aggregate(fns ...AggregateFunc) *VoteResultSelect

Aggregate adds the given aggregation functions to the selector query.

func (*VoteResultSelect) Bool

func (s *VoteResultSelect) Bool(ctx context.Context) (_ bool, err error)

Bool returns a single bool from a selector. It is only allowed when selecting one field.

func (*VoteResultSelect) BoolX

func (s *VoteResultSelect) BoolX(ctx context.Context) bool

BoolX is like Bool, but panics if an error occurs.

func (*VoteResultSelect) Bools

func (s *VoteResultSelect) Bools(ctx context.Context) ([]bool, error)

Bools returns list of bools from a selector. It is only allowed when selecting one field.

func (*VoteResultSelect) BoolsX

func (s *VoteResultSelect) BoolsX(ctx context.Context) []bool

BoolsX is like Bools, but panics if an error occurs.

func (*VoteResultSelect) Float64

func (s *VoteResultSelect) Float64(ctx context.Context) (_ float64, err error)

Float64 returns a single float64 from a selector. It is only allowed when selecting one field.

func (*VoteResultSelect) Float64X

func (s *VoteResultSelect) Float64X(ctx context.Context) float64

Float64X is like Float64, but panics if an error occurs.

func (*VoteResultSelect) Float64s

func (s *VoteResultSelect) Float64s(ctx context.Context) ([]float64, error)

Float64s returns list of float64s from a selector. It is only allowed when selecting one field.

func (*VoteResultSelect) Float64sX

func (s *VoteResultSelect) Float64sX(ctx context.Context) []float64

Float64sX is like Float64s, but panics if an error occurs.

func (*VoteResultSelect) Int

func (s *VoteResultSelect) Int(ctx context.Context) (_ int, err error)

Int returns a single int from a selector. It is only allowed when selecting one field.

func (*VoteResultSelect) IntX

func (s *VoteResultSelect) IntX(ctx context.Context) int

IntX is like Int, but panics if an error occurs.

func (*VoteResultSelect) Ints

func (s *VoteResultSelect) Ints(ctx context.Context) ([]int, error)

Ints returns list of ints from a selector. It is only allowed when selecting one field.

func (*VoteResultSelect) IntsX

func (s *VoteResultSelect) IntsX(ctx context.Context) []int

IntsX is like Ints, but panics if an error occurs.

func (*VoteResultSelect) Scan

func (vrs *VoteResultSelect) Scan(ctx context.Context, v any) error

Scan applies the selector query and scans the result into the given value.

func (*VoteResultSelect) ScanX

func (s *VoteResultSelect) ScanX(ctx context.Context, v any)

ScanX is like Scan, but panics if an error occurs.

func (*VoteResultSelect) String

func (s *VoteResultSelect) String(ctx context.Context) (_ string, err error)

String returns a single string from a selector. It is only allowed when selecting one field.

func (*VoteResultSelect) StringX

func (s *VoteResultSelect) StringX(ctx context.Context) string

StringX is like String, but panics if an error occurs.

func (*VoteResultSelect) Strings

func (s *VoteResultSelect) Strings(ctx context.Context) ([]string, error)

Strings returns list of strings from a selector. It is only allowed when selecting one field.

func (*VoteResultSelect) StringsX

func (s *VoteResultSelect) StringsX(ctx context.Context) []string

StringsX is like Strings, but panics if an error occurs.

type VoteResultUpdate

type VoteResultUpdate struct {
	// contains filtered or unexported fields
}

VoteResultUpdate is the builder for updating VoteResult entities.

func (*VoteResultUpdate) Exec

func (vru *VoteResultUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*VoteResultUpdate) ExecX

func (vru *VoteResultUpdate) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*VoteResultUpdate) Mutation

func (vru *VoteResultUpdate) Mutation() *VoteResultMutation

Mutation returns the VoteResultMutation object of the builder.

func (*VoteResultUpdate) Save

func (vru *VoteResultUpdate) Save(ctx context.Context) (int, error)

Save executes the query and returns the number of nodes affected by the update operation.

func (*VoteResultUpdate) SaveX

func (vru *VoteResultUpdate) SaveX(ctx context.Context) int

SaveX is like Save, but panics if an error occurs.

func (*VoteResultUpdate) SetHTML

func (vru *VoteResultUpdate) SetHTML(s string) *VoteResultUpdate

SetHTML sets the "html" field.

func (*VoteResultUpdate) SetPlain

func (vru *VoteResultUpdate) SetPlain(s string) *VoteResultUpdate

SetPlain sets the "plain" field.

func (*VoteResultUpdate) SetVoteID

func (vru *VoteResultUpdate) SetVoteID(s string) *VoteResultUpdate

SetVoteID sets the "vote_id" field.

func (*VoteResultUpdate) Where

Where appends a list predicates to the VoteResultUpdate builder.

type VoteResultUpdateOne

type VoteResultUpdateOne struct {
	// contains filtered or unexported fields
}

VoteResultUpdateOne is the builder for updating a single VoteResult entity.

func (*VoteResultUpdateOne) Exec

func (vruo *VoteResultUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*VoteResultUpdateOne) ExecX

func (vruo *VoteResultUpdateOne) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*VoteResultUpdateOne) Mutation

func (vruo *VoteResultUpdateOne) Mutation() *VoteResultMutation

Mutation returns the VoteResultMutation object of the builder.

func (*VoteResultUpdateOne) Save

func (vruo *VoteResultUpdateOne) Save(ctx context.Context) (*VoteResult, error)

Save executes the query and returns the updated VoteResult entity.

func (*VoteResultUpdateOne) SaveX

func (vruo *VoteResultUpdateOne) SaveX(ctx context.Context) *VoteResult

SaveX is like Save, but panics if an error occurs.

func (*VoteResultUpdateOne) Select

func (vruo *VoteResultUpdateOne) Select(field string, fields ...string) *VoteResultUpdateOne

Select allows selecting one or more fields (columns) of the returned entity. The default is selecting all fields defined in the entity schema.

func (*VoteResultUpdateOne) SetHTML

SetHTML sets the "html" field.

func (*VoteResultUpdateOne) SetPlain

func (vruo *VoteResultUpdateOne) SetPlain(s string) *VoteResultUpdateOne

SetPlain sets the "plain" field.

func (*VoteResultUpdateOne) SetVoteID

func (vruo *VoteResultUpdateOne) SetVoteID(s string) *VoteResultUpdateOne

SetVoteID sets the "vote_id" field.

func (*VoteResultUpdateOne) Where

Where appends a list predicates to the VoteResultUpdate builder.

type VoteResults

type VoteResults []*VoteResult

VoteResults is a parsable slice of VoteResult.

type VoteSelect

type VoteSelect struct {
	*VoteQuery
	// contains filtered or unexported fields
}

VoteSelect is the builder for selecting fields of Vote entities.

func (*VoteSelect) Aggregate

func (vs *VoteSelect) Aggregate(fns ...AggregateFunc) *VoteSelect

Aggregate adds the given aggregation functions to the selector query.

func (*VoteSelect) Bool

func (s *VoteSelect) Bool(ctx context.Context) (_ bool, err error)

Bool returns a single bool from a selector. It is only allowed when selecting one field.

func (*VoteSelect) BoolX

func (s *VoteSelect) BoolX(ctx context.Context) bool

BoolX is like Bool, but panics if an error occurs.

func (*VoteSelect) Bools

func (s *VoteSelect) Bools(ctx context.Context) ([]bool, error)

Bools returns list of bools from a selector. It is only allowed when selecting one field.

func (*VoteSelect) BoolsX

func (s *VoteSelect) BoolsX(ctx context.Context) []bool

BoolsX is like Bools, but panics if an error occurs.

func (*VoteSelect) Float64

func (s *VoteSelect) Float64(ctx context.Context) (_ float64, err error)

Float64 returns a single float64 from a selector. It is only allowed when selecting one field.

func (*VoteSelect) Float64X

func (s *VoteSelect) Float64X(ctx context.Context) float64

Float64X is like Float64, but panics if an error occurs.

func (*VoteSelect) Float64s

func (s *VoteSelect) Float64s(ctx context.Context) ([]float64, error)

Float64s returns list of float64s from a selector. It is only allowed when selecting one field.

func (*VoteSelect) Float64sX

func (s *VoteSelect) Float64sX(ctx context.Context) []float64

Float64sX is like Float64s, but panics if an error occurs.

func (*VoteSelect) Int

func (s *VoteSelect) Int(ctx context.Context) (_ int, err error)

Int returns a single int from a selector. It is only allowed when selecting one field.

func (*VoteSelect) IntX

func (s *VoteSelect) IntX(ctx context.Context) int

IntX is like Int, but panics if an error occurs.

func (*VoteSelect) Ints

func (s *VoteSelect) Ints(ctx context.Context) ([]int, error)

Ints returns list of ints from a selector. It is only allowed when selecting one field.

func (*VoteSelect) IntsX

func (s *VoteSelect) IntsX(ctx context.Context) []int

IntsX is like Ints, but panics if an error occurs.

func (*VoteSelect) Scan

func (vs *VoteSelect) Scan(ctx context.Context, v any) error

Scan applies the selector query and scans the result into the given value.

func (*VoteSelect) ScanX

func (s *VoteSelect) ScanX(ctx context.Context, v any)

ScanX is like Scan, but panics if an error occurs.

func (*VoteSelect) String

func (s *VoteSelect) String(ctx context.Context) (_ string, err error)

String returns a single string from a selector. It is only allowed when selecting one field.

func (*VoteSelect) StringX

func (s *VoteSelect) StringX(ctx context.Context) string

StringX is like String, but panics if an error occurs.

func (*VoteSelect) Strings

func (s *VoteSelect) Strings(ctx context.Context) ([]string, error)

Strings returns list of strings from a selector. It is only allowed when selecting one field.

func (*VoteSelect) StringsX

func (s *VoteSelect) StringsX(ctx context.Context) []string

StringsX is like Strings, but panics if an error occurs.

type VoteUpdate

type VoteUpdate struct {
	// contains filtered or unexported fields
}

VoteUpdate is the builder for updating Vote entities.

func (*VoteUpdate) AddRank

func (vu *VoteUpdate) AddRank(i int) *VoteUpdate

AddRank adds i to the "rank" field.

func (*VoteUpdate) ClearUser

func (vu *VoteUpdate) ClearUser() *VoteUpdate

ClearUser clears the "user" edge to the User entity.

func (*VoteUpdate) Exec

func (vu *VoteUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*VoteUpdate) ExecX

func (vu *VoteUpdate) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*VoteUpdate) Mutation

func (vu *VoteUpdate) Mutation() *VoteMutation

Mutation returns the VoteMutation object of the builder.

func (*VoteUpdate) Save

func (vu *VoteUpdate) Save(ctx context.Context) (int, error)

Save executes the query and returns the number of nodes affected by the update operation.

func (*VoteUpdate) SaveX

func (vu *VoteUpdate) SaveX(ctx context.Context) int

SaveX is like Save, but panics if an error occurs.

func (*VoteUpdate) SetRank

func (vu *VoteUpdate) SetRank(i int) *VoteUpdate

SetRank sets the "rank" field.

func (*VoteUpdate) SetSelection

func (vu *VoteUpdate) SetSelection(s string) *VoteUpdate

SetSelection sets the "selection" field.

func (*VoteUpdate) SetUser

func (vu *VoteUpdate) SetUser(u *User) *VoteUpdate

SetUser sets the "user" edge to the User entity.

func (*VoteUpdate) SetUserID

func (vu *VoteUpdate) SetUserID(id string) *VoteUpdate

SetUserID sets the "user" edge to the User entity by ID.

func (*VoteUpdate) SetVoteID

func (vu *VoteUpdate) SetVoteID(s string) *VoteUpdate

SetVoteID sets the "vote_id" field.

func (*VoteUpdate) Where

func (vu *VoteUpdate) Where(ps ...predicate.Vote) *VoteUpdate

Where appends a list predicates to the VoteUpdate builder.

type VoteUpdateOne

type VoteUpdateOne struct {
	// contains filtered or unexported fields
}

VoteUpdateOne is the builder for updating a single Vote entity.

func (*VoteUpdateOne) AddRank

func (vuo *VoteUpdateOne) AddRank(i int) *VoteUpdateOne

AddRank adds i to the "rank" field.

func (*VoteUpdateOne) ClearUser

func (vuo *VoteUpdateOne) ClearUser() *VoteUpdateOne

ClearUser clears the "user" edge to the User entity.

func (*VoteUpdateOne) Exec

func (vuo *VoteUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*VoteUpdateOne) ExecX

func (vuo *VoteUpdateOne) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*VoteUpdateOne) Mutation

func (vuo *VoteUpdateOne) Mutation() *VoteMutation

Mutation returns the VoteMutation object of the builder.

func (*VoteUpdateOne) Save

func (vuo *VoteUpdateOne) Save(ctx context.Context) (*Vote, error)

Save executes the query and returns the updated Vote entity.

func (*VoteUpdateOne) SaveX

func (vuo *VoteUpdateOne) SaveX(ctx context.Context) *Vote

SaveX is like Save, but panics if an error occurs.

func (*VoteUpdateOne) Select

func (vuo *VoteUpdateOne) Select(field string, fields ...string) *VoteUpdateOne

Select allows selecting one or more fields (columns) of the returned entity. The default is selecting all fields defined in the entity schema.

func (*VoteUpdateOne) SetRank

func (vuo *VoteUpdateOne) SetRank(i int) *VoteUpdateOne

SetRank sets the "rank" field.

func (*VoteUpdateOne) SetSelection

func (vuo *VoteUpdateOne) SetSelection(s string) *VoteUpdateOne

SetSelection sets the "selection" field.

func (*VoteUpdateOne) SetUser

func (vuo *VoteUpdateOne) SetUser(u *User) *VoteUpdateOne

SetUser sets the "user" edge to the User entity.

func (*VoteUpdateOne) SetUserID

func (vuo *VoteUpdateOne) SetUserID(id string) *VoteUpdateOne

SetUserID sets the "user" edge to the User entity by ID.

func (*VoteUpdateOne) SetVoteID

func (vuo *VoteUpdateOne) SetVoteID(s string) *VoteUpdateOne

SetVoteID sets the "vote_id" field.

func (*VoteUpdateOne) Where

func (vuo *VoteUpdateOne) Where(ps ...predicate.Vote) *VoteUpdateOne

Where appends a list predicates to the VoteUpdate builder.

type Votes

type Votes []*Vote

Votes is a parsable slice of Vote.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL