model

package
v0.0.0-...-8495beb Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2022 License: MPL-2.0 Imports: 28 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.
	TypeAccount        = "Account"
	TypeAuthentication = "Authentication"
	TypeCategory       = "Category"
	TypeNotification   = "Notification"
	TypePost           = "Post"
	TypeReact          = "React"
	TypeRole           = "Role"
	TypeSubscription   = "Subscription"
	TypeTag            = "Tag"
)

Variables

This section is empty.

Functions

func IsConstraintError

func IsConstraintError(err error) bool

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

func IsNotFound

func IsNotFound(err error) bool

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

func IsNotLoaded

func IsNotLoaded(err error) bool

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

func IsNotSingular

func IsNotSingular(err error) bool

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

func IsValidationError

func IsValidationError(err error) bool

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

func MaskNotFound

func MaskNotFound(err error) error

MaskNotFound masks not found error.

func NewContext

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

NewContext returns a new context with the given Client attached.

func NewTxContext

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

NewTxContext returns a new context with the given Tx attached.

Types

type Account

type Account struct {

	// ID of the ent.
	ID xid.ID `json:"id,omitempty"`
	// CreatedAt holds the value of the "created_at" field.
	CreatedAt time.Time `json:"created_at,omitempty"`
	// UpdatedAt holds the value of the "updated_at" field.
	UpdatedAt time.Time `json:"updated_at,omitempty"`
	// DeletedAt holds the value of the "deleted_at" field.
	DeletedAt *time.Time `json:"deleted_at,omitempty"`
	// Email holds the value of the "email" field.
	Email string `json:"email,omitempty"`
	// Name holds the value of the "name" field.
	Name string `json:"name,omitempty"`
	// Bio holds the value of the "bio" field.
	Bio string `json:"bio,omitempty"`
	// Admin holds the value of the "admin" field.
	Admin bool `json:"admin,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the AccountQuery when eager-loading is set.
	Edges AccountEdges `json:"edges"`
	// contains filtered or unexported fields
}

Account is the model entity for the Account schema.

func (*Account) QueryAuthentication

func (a *Account) QueryAuthentication() *AuthenticationQuery

QueryAuthentication queries the "authentication" edge of the Account entity.

func (*Account) QueryPosts

func (a *Account) QueryPosts() *PostQuery

QueryPosts queries the "posts" edge of the Account entity.

func (*Account) QueryReacts

func (a *Account) QueryReacts() *ReactQuery

QueryReacts queries the "reacts" edge of the Account entity.

func (*Account) QueryRoles

func (a *Account) QueryRoles() *RoleQuery

QueryRoles queries the "roles" edge of the Account entity.

func (*Account) QuerySubscriptions

func (a *Account) QuerySubscriptions() *SubscriptionQuery

QuerySubscriptions queries the "subscriptions" edge of the Account entity.

func (*Account) QueryTags

func (a *Account) QueryTags() *TagQuery

QueryTags queries the "tags" edge of the Account entity.

func (*Account) String

func (a *Account) String() string

String implements the fmt.Stringer.

func (*Account) Unwrap

func (a *Account) Unwrap() *Account

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

func (a *Account) Update() *AccountUpdateOne

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

type AccountClient

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

AccountClient is a client for the Account schema.

func NewAccountClient

func NewAccountClient(c config) *AccountClient

NewAccountClient returns a client for the Account from the given config.

func (*AccountClient) Create

func (c *AccountClient) Create() *AccountCreate

Create returns a builder for creating a Account entity.

func (*AccountClient) CreateBulk

func (c *AccountClient) CreateBulk(builders ...*AccountCreate) *AccountCreateBulk

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

func (*AccountClient) Delete

func (c *AccountClient) Delete() *AccountDelete

Delete returns a delete builder for Account.

func (*AccountClient) DeleteOne

func (c *AccountClient) DeleteOne(a *Account) *AccountDeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*AccountClient) DeleteOneID

func (c *AccountClient) DeleteOneID(id xid.ID) *AccountDeleteOne

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

func (*AccountClient) Get

func (c *AccountClient) Get(ctx context.Context, id xid.ID) (*Account, error)

Get returns a Account entity by its id.

func (*AccountClient) GetX

func (c *AccountClient) GetX(ctx context.Context, id xid.ID) *Account

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

func (*AccountClient) Hooks

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

Hooks returns the client hooks.

func (*AccountClient) Query

func (c *AccountClient) Query() *AccountQuery

Query returns a query builder for Account.

func (*AccountClient) QueryAuthentication

func (c *AccountClient) QueryAuthentication(a *Account) *AuthenticationQuery

QueryAuthentication queries the authentication edge of a Account.

func (*AccountClient) QueryPosts

func (c *AccountClient) QueryPosts(a *Account) *PostQuery

QueryPosts queries the posts edge of a Account.

func (*AccountClient) QueryReacts

func (c *AccountClient) QueryReacts(a *Account) *ReactQuery

QueryReacts queries the reacts edge of a Account.

func (*AccountClient) QueryRoles

func (c *AccountClient) QueryRoles(a *Account) *RoleQuery

QueryRoles queries the roles edge of a Account.

func (*AccountClient) QuerySubscriptions

func (c *AccountClient) QuerySubscriptions(a *Account) *SubscriptionQuery

QuerySubscriptions queries the subscriptions edge of a Account.

func (*AccountClient) QueryTags

func (c *AccountClient) QueryTags(a *Account) *TagQuery

QueryTags queries the tags edge of a Account.

func (*AccountClient) Update

func (c *AccountClient) Update() *AccountUpdate

Update returns an update builder for Account.

func (*AccountClient) UpdateOne

func (c *AccountClient) UpdateOne(a *Account) *AccountUpdateOne

UpdateOne returns an update builder for the given entity.

func (*AccountClient) UpdateOneID

func (c *AccountClient) UpdateOneID(id xid.ID) *AccountUpdateOne

UpdateOneID returns an update builder for the given id.

func (*AccountClient) Use

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

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

type AccountCreate

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

AccountCreate is the builder for creating a Account entity.

func (*AccountCreate) AddAuthentication

func (ac *AccountCreate) AddAuthentication(a ...*Authentication) *AccountCreate

AddAuthentication adds the "authentication" edges to the Authentication entity.

func (*AccountCreate) AddAuthenticationIDs

func (ac *AccountCreate) AddAuthenticationIDs(ids ...xid.ID) *AccountCreate

AddAuthenticationIDs adds the "authentication" edge to the Authentication entity by IDs.

func (*AccountCreate) AddPostIDs

func (ac *AccountCreate) AddPostIDs(ids ...xid.ID) *AccountCreate

AddPostIDs adds the "posts" edge to the Post entity by IDs.

func (*AccountCreate) AddPosts

func (ac *AccountCreate) AddPosts(p ...*Post) *AccountCreate

AddPosts adds the "posts" edges to the Post entity.

func (*AccountCreate) AddReactIDs

func (ac *AccountCreate) AddReactIDs(ids ...xid.ID) *AccountCreate

AddReactIDs adds the "reacts" edge to the React entity by IDs.

func (*AccountCreate) AddReacts

func (ac *AccountCreate) AddReacts(r ...*React) *AccountCreate

AddReacts adds the "reacts" edges to the React entity.

func (*AccountCreate) AddRoleIDs

func (ac *AccountCreate) AddRoleIDs(ids ...xid.ID) *AccountCreate

AddRoleIDs adds the "roles" edge to the Role entity by IDs.

func (*AccountCreate) AddRoles

func (ac *AccountCreate) AddRoles(r ...*Role) *AccountCreate

AddRoles adds the "roles" edges to the Role entity.

func (*AccountCreate) AddSubscriptionIDs

func (ac *AccountCreate) AddSubscriptionIDs(ids ...xid.ID) *AccountCreate

AddSubscriptionIDs adds the "subscriptions" edge to the Subscription entity by IDs.

func (*AccountCreate) AddSubscriptions

func (ac *AccountCreate) AddSubscriptions(s ...*Subscription) *AccountCreate

AddSubscriptions adds the "subscriptions" edges to the Subscription entity.

func (*AccountCreate) AddTagIDs

func (ac *AccountCreate) AddTagIDs(ids ...xid.ID) *AccountCreate

AddTagIDs adds the "tags" edge to the Tag entity by IDs.

func (*AccountCreate) AddTags

func (ac *AccountCreate) AddTags(t ...*Tag) *AccountCreate

AddTags adds the "tags" edges to the Tag entity.

func (*AccountCreate) Exec

func (ac *AccountCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*AccountCreate) ExecX

func (ac *AccountCreate) ExecX(ctx context.Context)

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

func (*AccountCreate) Mutation

func (ac *AccountCreate) Mutation() *AccountMutation

Mutation returns the AccountMutation object of the builder.

func (*AccountCreate) OnConflict

func (ac *AccountCreate) OnConflict(opts ...sql.ConflictOption) *AccountUpsertOne

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

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

func (*AccountCreate) OnConflictColumns

func (ac *AccountCreate) OnConflictColumns(columns ...string) *AccountUpsertOne

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

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

func (*AccountCreate) Save

func (ac *AccountCreate) Save(ctx context.Context) (*Account, error)

Save creates the Account in the database.

func (*AccountCreate) SaveX

func (ac *AccountCreate) SaveX(ctx context.Context) *Account

SaveX calls Save and panics if Save returns an error.

func (*AccountCreate) SetAdmin

func (ac *AccountCreate) SetAdmin(b bool) *AccountCreate

SetAdmin sets the "admin" field.

func (*AccountCreate) SetBio

func (ac *AccountCreate) SetBio(s string) *AccountCreate

SetBio sets the "bio" field.

func (*AccountCreate) SetCreatedAt

func (ac *AccountCreate) SetCreatedAt(t time.Time) *AccountCreate

SetCreatedAt sets the "created_at" field.

func (*AccountCreate) SetDeletedAt

func (ac *AccountCreate) SetDeletedAt(t time.Time) *AccountCreate

SetDeletedAt sets the "deleted_at" field.

func (*AccountCreate) SetEmail

func (ac *AccountCreate) SetEmail(s string) *AccountCreate

SetEmail sets the "email" field.

func (*AccountCreate) SetID

func (ac *AccountCreate) SetID(x xid.ID) *AccountCreate

SetID sets the "id" field.

func (*AccountCreate) SetName

func (ac *AccountCreate) SetName(s string) *AccountCreate

SetName sets the "name" field.

func (*AccountCreate) SetNillableAdmin

func (ac *AccountCreate) SetNillableAdmin(b *bool) *AccountCreate

SetNillableAdmin sets the "admin" field if the given value is not nil.

func (*AccountCreate) SetNillableBio

func (ac *AccountCreate) SetNillableBio(s *string) *AccountCreate

SetNillableBio sets the "bio" field if the given value is not nil.

func (*AccountCreate) SetNillableCreatedAt

func (ac *AccountCreate) SetNillableCreatedAt(t *time.Time) *AccountCreate

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

func (*AccountCreate) SetNillableDeletedAt

func (ac *AccountCreate) SetNillableDeletedAt(t *time.Time) *AccountCreate

SetNillableDeletedAt sets the "deleted_at" field if the given value is not nil.

func (*AccountCreate) SetNillableID

func (ac *AccountCreate) SetNillableID(x *xid.ID) *AccountCreate

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

func (*AccountCreate) SetNillableUpdatedAt

func (ac *AccountCreate) SetNillableUpdatedAt(t *time.Time) *AccountCreate

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

func (*AccountCreate) SetUpdatedAt

func (ac *AccountCreate) SetUpdatedAt(t time.Time) *AccountCreate

SetUpdatedAt sets the "updated_at" field.

type AccountCreateBulk

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

AccountCreateBulk is the builder for creating many Account entities in bulk.

func (*AccountCreateBulk) Exec

func (acb *AccountCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*AccountCreateBulk) ExecX

func (acb *AccountCreateBulk) ExecX(ctx context.Context)

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

func (*AccountCreateBulk) OnConflict

func (acb *AccountCreateBulk) OnConflict(opts ...sql.ConflictOption) *AccountUpsertBulk

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

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

func (*AccountCreateBulk) OnConflictColumns

func (acb *AccountCreateBulk) OnConflictColumns(columns ...string) *AccountUpsertBulk

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

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

func (*AccountCreateBulk) Save

func (acb *AccountCreateBulk) Save(ctx context.Context) ([]*Account, error)

Save creates the Account entities in the database.

func (*AccountCreateBulk) SaveX

func (acb *AccountCreateBulk) SaveX(ctx context.Context) []*Account

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

type AccountDelete

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

AccountDelete is the builder for deleting a Account entity.

func (*AccountDelete) Exec

func (ad *AccountDelete) Exec(ctx context.Context) (int, error)

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

func (*AccountDelete) ExecX

func (ad *AccountDelete) ExecX(ctx context.Context) int

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

func (*AccountDelete) Where

func (ad *AccountDelete) Where(ps ...predicate.Account) *AccountDelete

Where appends a list predicates to the AccountDelete builder.

type AccountDeleteOne

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

AccountDeleteOne is the builder for deleting a single Account entity.

func (*AccountDeleteOne) Exec

func (ado *AccountDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*AccountDeleteOne) ExecX

func (ado *AccountDeleteOne) ExecX(ctx context.Context)

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

type AccountEdges

type AccountEdges struct {
	// Posts holds the value of the posts edge.
	Posts []*Post `json:"posts,omitempty"`
	// Reacts holds the value of the reacts edge.
	Reacts []*React `json:"reacts,omitempty"`
	// Roles holds the value of the roles edge.
	Roles []*Role `json:"roles,omitempty"`
	// Subscriptions holds the value of the subscriptions edge.
	Subscriptions []*Subscription `json:"subscriptions,omitempty"`
	// Authentication holds the value of the authentication edge.
	Authentication []*Authentication `json:"authentication,omitempty"`
	// Tags holds the value of the tags edge.
	Tags []*Tag `json:"tags,omitempty"`
	// contains filtered or unexported fields
}

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

func (AccountEdges) AuthenticationOrErr

func (e AccountEdges) AuthenticationOrErr() ([]*Authentication, error)

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

func (AccountEdges) PostsOrErr

func (e AccountEdges) PostsOrErr() ([]*Post, error)

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

func (AccountEdges) ReactsOrErr

func (e AccountEdges) ReactsOrErr() ([]*React, error)

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

func (AccountEdges) RolesOrErr

func (e AccountEdges) RolesOrErr() ([]*Role, error)

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

func (AccountEdges) SubscriptionsOrErr

func (e AccountEdges) SubscriptionsOrErr() ([]*Subscription, error)

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

func (AccountEdges) TagsOrErr

func (e AccountEdges) TagsOrErr() ([]*Tag, error)

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

type AccountGroupBy

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

AccountGroupBy is the group-by builder for Account entities.

func (*AccountGroupBy) Aggregate

func (agb *AccountGroupBy) Aggregate(fns ...AggregateFunc) *AccountGroupBy

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

func (*AccountGroupBy) Bool

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

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

func (*AccountGroupBy) BoolX

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

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

func (*AccountGroupBy) Bools

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

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

func (*AccountGroupBy) BoolsX

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

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

func (*AccountGroupBy) Float64

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

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

func (*AccountGroupBy) Float64X

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

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

func (*AccountGroupBy) Float64s

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

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

func (*AccountGroupBy) Float64sX

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

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

func (*AccountGroupBy) Int

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

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

func (*AccountGroupBy) IntX

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

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

func (*AccountGroupBy) Ints

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

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

func (*AccountGroupBy) IntsX

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

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

func (*AccountGroupBy) Scan

func (agb *AccountGroupBy) Scan(ctx context.Context, v interface{}) error

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

func (*AccountGroupBy) ScanX

func (s *AccountGroupBy) ScanX(ctx context.Context, v interface{})

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

func (*AccountGroupBy) String

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

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

func (*AccountGroupBy) StringX

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

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

func (*AccountGroupBy) Strings

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

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

func (*AccountGroupBy) StringsX

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

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

type AccountMutation

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

AccountMutation represents an operation that mutates the Account nodes in the graph.

func (*AccountMutation) AddAuthenticationIDs

func (m *AccountMutation) AddAuthenticationIDs(ids ...xid.ID)

AddAuthenticationIDs adds the "authentication" edge to the Authentication entity by ids.

func (*AccountMutation) AddField

func (m *AccountMutation) 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 (*AccountMutation) AddPostIDs

func (m *AccountMutation) AddPostIDs(ids ...xid.ID)

AddPostIDs adds the "posts" edge to the Post entity by ids.

func (*AccountMutation) AddReactIDs

func (m *AccountMutation) AddReactIDs(ids ...xid.ID)

AddReactIDs adds the "reacts" edge to the React entity by ids.

func (*AccountMutation) AddRoleIDs

func (m *AccountMutation) AddRoleIDs(ids ...xid.ID)

AddRoleIDs adds the "roles" edge to the Role entity by ids.

func (*AccountMutation) AddSubscriptionIDs

func (m *AccountMutation) AddSubscriptionIDs(ids ...xid.ID)

AddSubscriptionIDs adds the "subscriptions" edge to the Subscription entity by ids.

func (*AccountMutation) AddTagIDs

func (m *AccountMutation) AddTagIDs(ids ...xid.ID)

AddTagIDs adds the "tags" edge to the Tag entity by ids.

func (*AccountMutation) AddedEdges

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

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

func (*AccountMutation) AddedField

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

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

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

func (*AccountMutation) AddedIDs

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

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

func (*AccountMutation) Admin

func (m *AccountMutation) Admin() (r bool, exists bool)

Admin returns the value of the "admin" field in the mutation.

func (*AccountMutation) AuthenticationCleared

func (m *AccountMutation) AuthenticationCleared() bool

AuthenticationCleared reports if the "authentication" edge to the Authentication entity was cleared.

func (*AccountMutation) AuthenticationIDs

func (m *AccountMutation) AuthenticationIDs() (ids []xid.ID)

AuthenticationIDs returns the "authentication" edge IDs in the mutation.

func (*AccountMutation) Bio

func (m *AccountMutation) Bio() (r string, exists bool)

Bio returns the value of the "bio" field in the mutation.

func (*AccountMutation) BioCleared

func (m *AccountMutation) BioCleared() bool

BioCleared returns if the "bio" field was cleared in this mutation.

func (*AccountMutation) ClearAuthentication

func (m *AccountMutation) ClearAuthentication()

ClearAuthentication clears the "authentication" edge to the Authentication entity.

func (*AccountMutation) ClearBio

func (m *AccountMutation) ClearBio()

ClearBio clears the value of the "bio" field.

func (*AccountMutation) ClearDeletedAt

func (m *AccountMutation) ClearDeletedAt()

ClearDeletedAt clears the value of the "deleted_at" field.

func (*AccountMutation) ClearEdge

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

func (m *AccountMutation) 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 (*AccountMutation) ClearPosts

func (m *AccountMutation) ClearPosts()

ClearPosts clears the "posts" edge to the Post entity.

func (*AccountMutation) ClearReacts

func (m *AccountMutation) ClearReacts()

ClearReacts clears the "reacts" edge to the React entity.

func (*AccountMutation) ClearRoles

func (m *AccountMutation) ClearRoles()

ClearRoles clears the "roles" edge to the Role entity.

func (*AccountMutation) ClearSubscriptions

func (m *AccountMutation) ClearSubscriptions()

ClearSubscriptions clears the "subscriptions" edge to the Subscription entity.

func (*AccountMutation) ClearTags

func (m *AccountMutation) ClearTags()

ClearTags clears the "tags" edge to the Tag entity.

func (*AccountMutation) ClearedEdges

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

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

func (*AccountMutation) ClearedFields

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

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

func (AccountMutation) Client

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

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

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

func (*AccountMutation) DeletedAt

func (m *AccountMutation) DeletedAt() (r time.Time, exists bool)

DeletedAt returns the value of the "deleted_at" field in the mutation.

func (*AccountMutation) DeletedAtCleared

func (m *AccountMutation) DeletedAtCleared() bool

DeletedAtCleared returns if the "deleted_at" field was cleared in this mutation.

func (*AccountMutation) EdgeCleared

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

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

func (*AccountMutation) Email

func (m *AccountMutation) Email() (r string, exists bool)

Email returns the value of the "email" field in the mutation.

func (*AccountMutation) Field

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

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

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

func (*AccountMutation) Fields

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

func (m *AccountMutation) ID() (id xid.ID, 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 (*AccountMutation) IDs

func (m *AccountMutation) IDs(ctx context.Context) ([]xid.ID, 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 (*AccountMutation) Name

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

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

func (*AccountMutation) OldAdmin

func (m *AccountMutation) OldAdmin(ctx context.Context) (v bool, err error)

OldAdmin returns the old "admin" field's value of the Account entity. If the Account 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 (*AccountMutation) OldBio

func (m *AccountMutation) OldBio(ctx context.Context) (v string, err error)

OldBio returns the old "bio" field's value of the Account entity. If the Account 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 (*AccountMutation) OldCreatedAt

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

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

func (m *AccountMutation) OldDeletedAt(ctx context.Context) (v *time.Time, err error)

OldDeletedAt returns the old "deleted_at" field's value of the Account entity. If the Account 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 (*AccountMutation) OldEmail

func (m *AccountMutation) OldEmail(ctx context.Context) (v string, err error)

OldEmail returns the old "email" field's value of the Account entity. If the Account 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 (*AccountMutation) OldField

func (m *AccountMutation) 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 (*AccountMutation) OldName

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

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

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

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

func (m *AccountMutation) Op() Op

Op returns the operation name.

func (*AccountMutation) PostsCleared

func (m *AccountMutation) PostsCleared() bool

PostsCleared reports if the "posts" edge to the Post entity was cleared.

func (*AccountMutation) PostsIDs

func (m *AccountMutation) PostsIDs() (ids []xid.ID)

PostsIDs returns the "posts" edge IDs in the mutation.

func (*AccountMutation) ReactsCleared

func (m *AccountMutation) ReactsCleared() bool

ReactsCleared reports if the "reacts" edge to the React entity was cleared.

func (*AccountMutation) ReactsIDs

func (m *AccountMutation) ReactsIDs() (ids []xid.ID)

ReactsIDs returns the "reacts" edge IDs in the mutation.

func (*AccountMutation) RemoveAuthenticationIDs

func (m *AccountMutation) RemoveAuthenticationIDs(ids ...xid.ID)

RemoveAuthenticationIDs removes the "authentication" edge to the Authentication entity by IDs.

func (*AccountMutation) RemovePostIDs

func (m *AccountMutation) RemovePostIDs(ids ...xid.ID)

RemovePostIDs removes the "posts" edge to the Post entity by IDs.

func (*AccountMutation) RemoveReactIDs

func (m *AccountMutation) RemoveReactIDs(ids ...xid.ID)

RemoveReactIDs removes the "reacts" edge to the React entity by IDs.

func (*AccountMutation) RemoveRoleIDs

func (m *AccountMutation) RemoveRoleIDs(ids ...xid.ID)

RemoveRoleIDs removes the "roles" edge to the Role entity by IDs.

func (*AccountMutation) RemoveSubscriptionIDs

func (m *AccountMutation) RemoveSubscriptionIDs(ids ...xid.ID)

RemoveSubscriptionIDs removes the "subscriptions" edge to the Subscription entity by IDs.

func (*AccountMutation) RemoveTagIDs

func (m *AccountMutation) RemoveTagIDs(ids ...xid.ID)

RemoveTagIDs removes the "tags" edge to the Tag entity by IDs.

func (*AccountMutation) RemovedAuthenticationIDs

func (m *AccountMutation) RemovedAuthenticationIDs() (ids []xid.ID)

RemovedAuthentication returns the removed IDs of the "authentication" edge to the Authentication entity.

func (*AccountMutation) RemovedEdges

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

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

func (*AccountMutation) RemovedIDs

func (m *AccountMutation) 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 (*AccountMutation) RemovedPostsIDs

func (m *AccountMutation) RemovedPostsIDs() (ids []xid.ID)

RemovedPosts returns the removed IDs of the "posts" edge to the Post entity.

func (*AccountMutation) RemovedReactsIDs

func (m *AccountMutation) RemovedReactsIDs() (ids []xid.ID)

RemovedReacts returns the removed IDs of the "reacts" edge to the React entity.

func (*AccountMutation) RemovedRolesIDs

func (m *AccountMutation) RemovedRolesIDs() (ids []xid.ID)

RemovedRoles returns the removed IDs of the "roles" edge to the Role entity.

func (*AccountMutation) RemovedSubscriptionsIDs

func (m *AccountMutation) RemovedSubscriptionsIDs() (ids []xid.ID)

RemovedSubscriptions returns the removed IDs of the "subscriptions" edge to the Subscription entity.

func (*AccountMutation) RemovedTagsIDs

func (m *AccountMutation) RemovedTagsIDs() (ids []xid.ID)

RemovedTags returns the removed IDs of the "tags" edge to the Tag entity.

func (*AccountMutation) ResetAdmin

func (m *AccountMutation) ResetAdmin()

ResetAdmin resets all changes to the "admin" field.

func (*AccountMutation) ResetAuthentication

func (m *AccountMutation) ResetAuthentication()

ResetAuthentication resets all changes to the "authentication" edge.

func (*AccountMutation) ResetBio

func (m *AccountMutation) ResetBio()

ResetBio resets all changes to the "bio" field.

func (*AccountMutation) ResetCreatedAt

func (m *AccountMutation) ResetCreatedAt()

ResetCreatedAt resets all changes to the "created_at" field.

func (*AccountMutation) ResetDeletedAt

func (m *AccountMutation) ResetDeletedAt()

ResetDeletedAt resets all changes to the "deleted_at" field.

func (*AccountMutation) ResetEdge

func (m *AccountMutation) 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 (*AccountMutation) ResetEmail

func (m *AccountMutation) ResetEmail()

ResetEmail resets all changes to the "email" field.

func (*AccountMutation) ResetField

func (m *AccountMutation) 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 (*AccountMutation) ResetName

func (m *AccountMutation) ResetName()

ResetName resets all changes to the "name" field.

func (*AccountMutation) ResetPosts

func (m *AccountMutation) ResetPosts()

ResetPosts resets all changes to the "posts" edge.

func (*AccountMutation) ResetReacts

func (m *AccountMutation) ResetReacts()

ResetReacts resets all changes to the "reacts" edge.

func (*AccountMutation) ResetRoles

func (m *AccountMutation) ResetRoles()

ResetRoles resets all changes to the "roles" edge.

func (*AccountMutation) ResetSubscriptions

func (m *AccountMutation) ResetSubscriptions()

ResetSubscriptions resets all changes to the "subscriptions" edge.

func (*AccountMutation) ResetTags

func (m *AccountMutation) ResetTags()

ResetTags resets all changes to the "tags" edge.

func (*AccountMutation) ResetUpdatedAt

func (m *AccountMutation) ResetUpdatedAt()

ResetUpdatedAt resets all changes to the "updated_at" field.

func (*AccountMutation) RolesCleared

func (m *AccountMutation) RolesCleared() bool

RolesCleared reports if the "roles" edge to the Role entity was cleared.

func (*AccountMutation) RolesIDs

func (m *AccountMutation) RolesIDs() (ids []xid.ID)

RolesIDs returns the "roles" edge IDs in the mutation.

func (*AccountMutation) SetAdmin

func (m *AccountMutation) SetAdmin(b bool)

SetAdmin sets the "admin" field.

func (*AccountMutation) SetBio

func (m *AccountMutation) SetBio(s string)

SetBio sets the "bio" field.

func (*AccountMutation) SetCreatedAt

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

SetCreatedAt sets the "created_at" field.

func (*AccountMutation) SetDeletedAt

func (m *AccountMutation) SetDeletedAt(t time.Time)

SetDeletedAt sets the "deleted_at" field.

func (*AccountMutation) SetEmail

func (m *AccountMutation) SetEmail(s string)

SetEmail sets the "email" field.

func (*AccountMutation) SetField

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

func (m *AccountMutation) SetID(id xid.ID)

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

func (*AccountMutation) SetName

func (m *AccountMutation) SetName(s string)

SetName sets the "name" field.

func (*AccountMutation) SetUpdatedAt

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

SetUpdatedAt sets the "updated_at" field.

func (*AccountMutation) SubscriptionsCleared

func (m *AccountMutation) SubscriptionsCleared() bool

SubscriptionsCleared reports if the "subscriptions" edge to the Subscription entity was cleared.

func (*AccountMutation) SubscriptionsIDs

func (m *AccountMutation) SubscriptionsIDs() (ids []xid.ID)

SubscriptionsIDs returns the "subscriptions" edge IDs in the mutation.

func (*AccountMutation) TagsCleared

func (m *AccountMutation) TagsCleared() bool

TagsCleared reports if the "tags" edge to the Tag entity was cleared.

func (*AccountMutation) TagsIDs

func (m *AccountMutation) TagsIDs() (ids []xid.ID)

TagsIDs returns the "tags" edge IDs in the mutation.

func (AccountMutation) Tx

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

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

func (*AccountMutation) Type

func (m *AccountMutation) Type() string

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

func (*AccountMutation) UpdatedAt

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

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

func (*AccountMutation) Where

func (m *AccountMutation) Where(ps ...predicate.Account)

Where appends a list predicates to the AccountMutation builder.

type AccountQuery

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

AccountQuery is the builder for querying Account entities.

func (*AccountQuery) All

func (aq *AccountQuery) All(ctx context.Context) ([]*Account, error)

All executes the query and returns a list of Accounts.

func (*AccountQuery) AllX

func (aq *AccountQuery) AllX(ctx context.Context) []*Account

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

func (*AccountQuery) Clone

func (aq *AccountQuery) Clone() *AccountQuery

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

func (*AccountQuery) Count

func (aq *AccountQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*AccountQuery) CountX

func (aq *AccountQuery) CountX(ctx context.Context) int

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

func (*AccountQuery) Exist

func (aq *AccountQuery) Exist(ctx context.Context) (bool, error)

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

func (*AccountQuery) ExistX

func (aq *AccountQuery) ExistX(ctx context.Context) bool

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

func (*AccountQuery) First

func (aq *AccountQuery) First(ctx context.Context) (*Account, error)

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

func (*AccountQuery) FirstID

func (aq *AccountQuery) FirstID(ctx context.Context) (id xid.ID, err error)

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

func (*AccountQuery) FirstIDX

func (aq *AccountQuery) FirstIDX(ctx context.Context) xid.ID

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

func (*AccountQuery) FirstX

func (aq *AccountQuery) FirstX(ctx context.Context) *Account

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

func (*AccountQuery) GroupBy

func (aq *AccountQuery) GroupBy(field string, fields ...string) *AccountGroupBy

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 {
	CreatedAt time.Time `json:"created_at,omitempty"`
	Count int `json:"count,omitempty"`
}

client.Account.Query().
	GroupBy(account.FieldCreatedAt).
	Aggregate(model.Count()).
	Scan(ctx, &v)

func (*AccountQuery) IDs

func (aq *AccountQuery) IDs(ctx context.Context) ([]xid.ID, error)

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

func (*AccountQuery) IDsX

func (aq *AccountQuery) IDsX(ctx context.Context) []xid.ID

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

func (*AccountQuery) Limit

func (aq *AccountQuery) Limit(limit int) *AccountQuery

Limit adds a limit step to the query.

func (*AccountQuery) Modify

func (aq *AccountQuery) Modify(modifiers ...func(s *sql.Selector)) *AccountSelect

Modify adds a query modifier for attaching custom logic to queries.

func (*AccountQuery) Offset

func (aq *AccountQuery) Offset(offset int) *AccountQuery

Offset adds an offset step to the query.

func (*AccountQuery) Only

func (aq *AccountQuery) Only(ctx context.Context) (*Account, error)

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

func (*AccountQuery) OnlyID

func (aq *AccountQuery) OnlyID(ctx context.Context) (id xid.ID, err error)

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

func (*AccountQuery) OnlyIDX

func (aq *AccountQuery) OnlyIDX(ctx context.Context) xid.ID

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

func (*AccountQuery) OnlyX

func (aq *AccountQuery) OnlyX(ctx context.Context) *Account

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

func (*AccountQuery) Order

func (aq *AccountQuery) Order(o ...OrderFunc) *AccountQuery

Order adds an order step to the query.

func (*AccountQuery) QueryAuthentication

func (aq *AccountQuery) QueryAuthentication() *AuthenticationQuery

QueryAuthentication chains the current query on the "authentication" edge.

func (*AccountQuery) QueryPosts

func (aq *AccountQuery) QueryPosts() *PostQuery

QueryPosts chains the current query on the "posts" edge.

func (*AccountQuery) QueryReacts

func (aq *AccountQuery) QueryReacts() *ReactQuery

QueryReacts chains the current query on the "reacts" edge.

func (*AccountQuery) QueryRoles

func (aq *AccountQuery) QueryRoles() *RoleQuery

QueryRoles chains the current query on the "roles" edge.

func (*AccountQuery) QuerySubscriptions

func (aq *AccountQuery) QuerySubscriptions() *SubscriptionQuery

QuerySubscriptions chains the current query on the "subscriptions" edge.

func (*AccountQuery) QueryTags

func (aq *AccountQuery) QueryTags() *TagQuery

QueryTags chains the current query on the "tags" edge.

func (*AccountQuery) Select

func (aq *AccountQuery) Select(fields ...string) *AccountSelect

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 {
	CreatedAt time.Time `json:"created_at,omitempty"`
}

client.Account.Query().
	Select(account.FieldCreatedAt).
	Scan(ctx, &v)

func (*AccountQuery) Unique

func (aq *AccountQuery) Unique(unique bool) *AccountQuery

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

func (aq *AccountQuery) Where(ps ...predicate.Account) *AccountQuery

Where adds a new predicate for the AccountQuery builder.

func (*AccountQuery) WithAuthentication

func (aq *AccountQuery) WithAuthentication(opts ...func(*AuthenticationQuery)) *AccountQuery

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

func (*AccountQuery) WithPosts

func (aq *AccountQuery) WithPosts(opts ...func(*PostQuery)) *AccountQuery

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

func (*AccountQuery) WithReacts

func (aq *AccountQuery) WithReacts(opts ...func(*ReactQuery)) *AccountQuery

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

func (*AccountQuery) WithRoles

func (aq *AccountQuery) WithRoles(opts ...func(*RoleQuery)) *AccountQuery

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

func (*AccountQuery) WithSubscriptions

func (aq *AccountQuery) WithSubscriptions(opts ...func(*SubscriptionQuery)) *AccountQuery

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

func (*AccountQuery) WithTags

func (aq *AccountQuery) WithTags(opts ...func(*TagQuery)) *AccountQuery

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

type AccountSelect

type AccountSelect struct {
	*AccountQuery
	// contains filtered or unexported fields
}

AccountSelect is the builder for selecting fields of Account entities.

func (*AccountSelect) Bool

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

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

func (*AccountSelect) BoolX

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

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

func (*AccountSelect) Bools

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

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

func (*AccountSelect) BoolsX

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

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

func (*AccountSelect) Float64

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

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

func (*AccountSelect) Float64X

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

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

func (*AccountSelect) Float64s

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

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

func (*AccountSelect) Float64sX

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

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

func (*AccountSelect) Int

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

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

func (*AccountSelect) IntX

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

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

func (*AccountSelect) Ints

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

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

func (*AccountSelect) IntsX

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

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

func (*AccountSelect) Modify

func (as *AccountSelect) Modify(modifiers ...func(s *sql.Selector)) *AccountSelect

Modify adds a query modifier for attaching custom logic to queries.

func (*AccountSelect) Scan

func (as *AccountSelect) Scan(ctx context.Context, v interface{}) error

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

func (*AccountSelect) ScanX

func (s *AccountSelect) ScanX(ctx context.Context, v interface{})

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

func (*AccountSelect) String

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

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

func (*AccountSelect) StringX

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

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

func (*AccountSelect) Strings

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

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

func (*AccountSelect) StringsX

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

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

type AccountUpdate

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

AccountUpdate is the builder for updating Account entities.

func (*AccountUpdate) AddAuthentication

func (au *AccountUpdate) AddAuthentication(a ...*Authentication) *AccountUpdate

AddAuthentication adds the "authentication" edges to the Authentication entity.

func (*AccountUpdate) AddAuthenticationIDs

func (au *AccountUpdate) AddAuthenticationIDs(ids ...xid.ID) *AccountUpdate

AddAuthenticationIDs adds the "authentication" edge to the Authentication entity by IDs.

func (*AccountUpdate) AddPostIDs

func (au *AccountUpdate) AddPostIDs(ids ...xid.ID) *AccountUpdate

AddPostIDs adds the "posts" edge to the Post entity by IDs.

func (*AccountUpdate) AddPosts

func (au *AccountUpdate) AddPosts(p ...*Post) *AccountUpdate

AddPosts adds the "posts" edges to the Post entity.

func (*AccountUpdate) AddReactIDs

func (au *AccountUpdate) AddReactIDs(ids ...xid.ID) *AccountUpdate

AddReactIDs adds the "reacts" edge to the React entity by IDs.

func (*AccountUpdate) AddReacts

func (au *AccountUpdate) AddReacts(r ...*React) *AccountUpdate

AddReacts adds the "reacts" edges to the React entity.

func (*AccountUpdate) AddRoleIDs

func (au *AccountUpdate) AddRoleIDs(ids ...xid.ID) *AccountUpdate

AddRoleIDs adds the "roles" edge to the Role entity by IDs.

func (*AccountUpdate) AddRoles

func (au *AccountUpdate) AddRoles(r ...*Role) *AccountUpdate

AddRoles adds the "roles" edges to the Role entity.

func (*AccountUpdate) AddSubscriptionIDs

func (au *AccountUpdate) AddSubscriptionIDs(ids ...xid.ID) *AccountUpdate

AddSubscriptionIDs adds the "subscriptions" edge to the Subscription entity by IDs.

func (*AccountUpdate) AddSubscriptions

func (au *AccountUpdate) AddSubscriptions(s ...*Subscription) *AccountUpdate

AddSubscriptions adds the "subscriptions" edges to the Subscription entity.

func (*AccountUpdate) AddTagIDs

func (au *AccountUpdate) AddTagIDs(ids ...xid.ID) *AccountUpdate

AddTagIDs adds the "tags" edge to the Tag entity by IDs.

func (*AccountUpdate) AddTags

func (au *AccountUpdate) AddTags(t ...*Tag) *AccountUpdate

AddTags adds the "tags" edges to the Tag entity.

func (*AccountUpdate) ClearAuthentication

func (au *AccountUpdate) ClearAuthentication() *AccountUpdate

ClearAuthentication clears all "authentication" edges to the Authentication entity.

func (*AccountUpdate) ClearBio

func (au *AccountUpdate) ClearBio() *AccountUpdate

ClearBio clears the value of the "bio" field.

func (*AccountUpdate) ClearDeletedAt

func (au *AccountUpdate) ClearDeletedAt() *AccountUpdate

ClearDeletedAt clears the value of the "deleted_at" field.

func (*AccountUpdate) ClearPosts

func (au *AccountUpdate) ClearPosts() *AccountUpdate

ClearPosts clears all "posts" edges to the Post entity.

func (*AccountUpdate) ClearReacts

func (au *AccountUpdate) ClearReacts() *AccountUpdate

ClearReacts clears all "reacts" edges to the React entity.

func (*AccountUpdate) ClearRoles

func (au *AccountUpdate) ClearRoles() *AccountUpdate

ClearRoles clears all "roles" edges to the Role entity.

func (*AccountUpdate) ClearSubscriptions

func (au *AccountUpdate) ClearSubscriptions() *AccountUpdate

ClearSubscriptions clears all "subscriptions" edges to the Subscription entity.

func (*AccountUpdate) ClearTags

func (au *AccountUpdate) ClearTags() *AccountUpdate

ClearTags clears all "tags" edges to the Tag entity.

func (*AccountUpdate) Exec

func (au *AccountUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*AccountUpdate) ExecX

func (au *AccountUpdate) ExecX(ctx context.Context)

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

func (*AccountUpdate) Modify

func (au *AccountUpdate) Modify(modifiers ...func(u *sql.UpdateBuilder)) *AccountUpdate

Modify adds a statement modifier for attaching custom logic to the UPDATE statement.

func (*AccountUpdate) Mutation

func (au *AccountUpdate) Mutation() *AccountMutation

Mutation returns the AccountMutation object of the builder.

func (*AccountUpdate) RemoveAuthentication

func (au *AccountUpdate) RemoveAuthentication(a ...*Authentication) *AccountUpdate

RemoveAuthentication removes "authentication" edges to Authentication entities.

func (*AccountUpdate) RemoveAuthenticationIDs

func (au *AccountUpdate) RemoveAuthenticationIDs(ids ...xid.ID) *AccountUpdate

RemoveAuthenticationIDs removes the "authentication" edge to Authentication entities by IDs.

func (*AccountUpdate) RemovePostIDs

func (au *AccountUpdate) RemovePostIDs(ids ...xid.ID) *AccountUpdate

RemovePostIDs removes the "posts" edge to Post entities by IDs.

func (*AccountUpdate) RemovePosts

func (au *AccountUpdate) RemovePosts(p ...*Post) *AccountUpdate

RemovePosts removes "posts" edges to Post entities.

func (*AccountUpdate) RemoveReactIDs

func (au *AccountUpdate) RemoveReactIDs(ids ...xid.ID) *AccountUpdate

RemoveReactIDs removes the "reacts" edge to React entities by IDs.

func (*AccountUpdate) RemoveReacts

func (au *AccountUpdate) RemoveReacts(r ...*React) *AccountUpdate

RemoveReacts removes "reacts" edges to React entities.

func (*AccountUpdate) RemoveRoleIDs

func (au *AccountUpdate) RemoveRoleIDs(ids ...xid.ID) *AccountUpdate

RemoveRoleIDs removes the "roles" edge to Role entities by IDs.

func (*AccountUpdate) RemoveRoles

func (au *AccountUpdate) RemoveRoles(r ...*Role) *AccountUpdate

RemoveRoles removes "roles" edges to Role entities.

func (*AccountUpdate) RemoveSubscriptionIDs

func (au *AccountUpdate) RemoveSubscriptionIDs(ids ...xid.ID) *AccountUpdate

RemoveSubscriptionIDs removes the "subscriptions" edge to Subscription entities by IDs.

func (*AccountUpdate) RemoveSubscriptions

func (au *AccountUpdate) RemoveSubscriptions(s ...*Subscription) *AccountUpdate

RemoveSubscriptions removes "subscriptions" edges to Subscription entities.

func (*AccountUpdate) RemoveTagIDs

func (au *AccountUpdate) RemoveTagIDs(ids ...xid.ID) *AccountUpdate

RemoveTagIDs removes the "tags" edge to Tag entities by IDs.

func (*AccountUpdate) RemoveTags

func (au *AccountUpdate) RemoveTags(t ...*Tag) *AccountUpdate

RemoveTags removes "tags" edges to Tag entities.

func (*AccountUpdate) Save

func (au *AccountUpdate) Save(ctx context.Context) (int, error)

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

func (*AccountUpdate) SaveX

func (au *AccountUpdate) SaveX(ctx context.Context) int

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

func (*AccountUpdate) SetAdmin

func (au *AccountUpdate) SetAdmin(b bool) *AccountUpdate

SetAdmin sets the "admin" field.

func (*AccountUpdate) SetBio

func (au *AccountUpdate) SetBio(s string) *AccountUpdate

SetBio sets the "bio" field.

func (*AccountUpdate) SetDeletedAt

func (au *AccountUpdate) SetDeletedAt(t time.Time) *AccountUpdate

SetDeletedAt sets the "deleted_at" field.

func (*AccountUpdate) SetEmail

func (au *AccountUpdate) SetEmail(s string) *AccountUpdate

SetEmail sets the "email" field.

func (*AccountUpdate) SetName

func (au *AccountUpdate) SetName(s string) *AccountUpdate

SetName sets the "name" field.

func (*AccountUpdate) SetNillableAdmin

func (au *AccountUpdate) SetNillableAdmin(b *bool) *AccountUpdate

SetNillableAdmin sets the "admin" field if the given value is not nil.

func (*AccountUpdate) SetNillableBio

func (au *AccountUpdate) SetNillableBio(s *string) *AccountUpdate

SetNillableBio sets the "bio" field if the given value is not nil.

func (*AccountUpdate) SetNillableDeletedAt

func (au *AccountUpdate) SetNillableDeletedAt(t *time.Time) *AccountUpdate

SetNillableDeletedAt sets the "deleted_at" field if the given value is not nil.

func (*AccountUpdate) SetUpdatedAt

func (au *AccountUpdate) SetUpdatedAt(t time.Time) *AccountUpdate

SetUpdatedAt sets the "updated_at" field.

func (*AccountUpdate) Where

func (au *AccountUpdate) Where(ps ...predicate.Account) *AccountUpdate

Where appends a list predicates to the AccountUpdate builder.

type AccountUpdateOne

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

AccountUpdateOne is the builder for updating a single Account entity.

func (*AccountUpdateOne) AddAuthentication

func (auo *AccountUpdateOne) AddAuthentication(a ...*Authentication) *AccountUpdateOne

AddAuthentication adds the "authentication" edges to the Authentication entity.

func (*AccountUpdateOne) AddAuthenticationIDs

func (auo *AccountUpdateOne) AddAuthenticationIDs(ids ...xid.ID) *AccountUpdateOne

AddAuthenticationIDs adds the "authentication" edge to the Authentication entity by IDs.

func (*AccountUpdateOne) AddPostIDs

func (auo *AccountUpdateOne) AddPostIDs(ids ...xid.ID) *AccountUpdateOne

AddPostIDs adds the "posts" edge to the Post entity by IDs.

func (*AccountUpdateOne) AddPosts

func (auo *AccountUpdateOne) AddPosts(p ...*Post) *AccountUpdateOne

AddPosts adds the "posts" edges to the Post entity.

func (*AccountUpdateOne) AddReactIDs

func (auo *AccountUpdateOne) AddReactIDs(ids ...xid.ID) *AccountUpdateOne

AddReactIDs adds the "reacts" edge to the React entity by IDs.

func (*AccountUpdateOne) AddReacts

func (auo *AccountUpdateOne) AddReacts(r ...*React) *AccountUpdateOne

AddReacts adds the "reacts" edges to the React entity.

func (*AccountUpdateOne) AddRoleIDs

func (auo *AccountUpdateOne) AddRoleIDs(ids ...xid.ID) *AccountUpdateOne

AddRoleIDs adds the "roles" edge to the Role entity by IDs.

func (*AccountUpdateOne) AddRoles

func (auo *AccountUpdateOne) AddRoles(r ...*Role) *AccountUpdateOne

AddRoles adds the "roles" edges to the Role entity.

func (*AccountUpdateOne) AddSubscriptionIDs

func (auo *AccountUpdateOne) AddSubscriptionIDs(ids ...xid.ID) *AccountUpdateOne

AddSubscriptionIDs adds the "subscriptions" edge to the Subscription entity by IDs.

func (*AccountUpdateOne) AddSubscriptions

func (auo *AccountUpdateOne) AddSubscriptions(s ...*Subscription) *AccountUpdateOne

AddSubscriptions adds the "subscriptions" edges to the Subscription entity.

func (*AccountUpdateOne) AddTagIDs

func (auo *AccountUpdateOne) AddTagIDs(ids ...xid.ID) *AccountUpdateOne

AddTagIDs adds the "tags" edge to the Tag entity by IDs.

func (*AccountUpdateOne) AddTags

func (auo *AccountUpdateOne) AddTags(t ...*Tag) *AccountUpdateOne

AddTags adds the "tags" edges to the Tag entity.

func (*AccountUpdateOne) ClearAuthentication

func (auo *AccountUpdateOne) ClearAuthentication() *AccountUpdateOne

ClearAuthentication clears all "authentication" edges to the Authentication entity.

func (*AccountUpdateOne) ClearBio

func (auo *AccountUpdateOne) ClearBio() *AccountUpdateOne

ClearBio clears the value of the "bio" field.

func (*AccountUpdateOne) ClearDeletedAt

func (auo *AccountUpdateOne) ClearDeletedAt() *AccountUpdateOne

ClearDeletedAt clears the value of the "deleted_at" field.

func (*AccountUpdateOne) ClearPosts

func (auo *AccountUpdateOne) ClearPosts() *AccountUpdateOne

ClearPosts clears all "posts" edges to the Post entity.

func (*AccountUpdateOne) ClearReacts

func (auo *AccountUpdateOne) ClearReacts() *AccountUpdateOne

ClearReacts clears all "reacts" edges to the React entity.

func (*AccountUpdateOne) ClearRoles

func (auo *AccountUpdateOne) ClearRoles() *AccountUpdateOne

ClearRoles clears all "roles" edges to the Role entity.

func (*AccountUpdateOne) ClearSubscriptions

func (auo *AccountUpdateOne) ClearSubscriptions() *AccountUpdateOne

ClearSubscriptions clears all "subscriptions" edges to the Subscription entity.

func (*AccountUpdateOne) ClearTags

func (auo *AccountUpdateOne) ClearTags() *AccountUpdateOne

ClearTags clears all "tags" edges to the Tag entity.

func (*AccountUpdateOne) Exec

func (auo *AccountUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*AccountUpdateOne) ExecX

func (auo *AccountUpdateOne) ExecX(ctx context.Context)

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

func (*AccountUpdateOne) Modify

func (auo *AccountUpdateOne) Modify(modifiers ...func(u *sql.UpdateBuilder)) *AccountUpdateOne

Modify adds a statement modifier for attaching custom logic to the UPDATE statement.

func (*AccountUpdateOne) Mutation

func (auo *AccountUpdateOne) Mutation() *AccountMutation

Mutation returns the AccountMutation object of the builder.

func (*AccountUpdateOne) RemoveAuthentication

func (auo *AccountUpdateOne) RemoveAuthentication(a ...*Authentication) *AccountUpdateOne

RemoveAuthentication removes "authentication" edges to Authentication entities.

func (*AccountUpdateOne) RemoveAuthenticationIDs

func (auo *AccountUpdateOne) RemoveAuthenticationIDs(ids ...xid.ID) *AccountUpdateOne

RemoveAuthenticationIDs removes the "authentication" edge to Authentication entities by IDs.

func (*AccountUpdateOne) RemovePostIDs

func (auo *AccountUpdateOne) RemovePostIDs(ids ...xid.ID) *AccountUpdateOne

RemovePostIDs removes the "posts" edge to Post entities by IDs.

func (*AccountUpdateOne) RemovePosts

func (auo *AccountUpdateOne) RemovePosts(p ...*Post) *AccountUpdateOne

RemovePosts removes "posts" edges to Post entities.

func (*AccountUpdateOne) RemoveReactIDs

func (auo *AccountUpdateOne) RemoveReactIDs(ids ...xid.ID) *AccountUpdateOne

RemoveReactIDs removes the "reacts" edge to React entities by IDs.

func (*AccountUpdateOne) RemoveReacts

func (auo *AccountUpdateOne) RemoveReacts(r ...*React) *AccountUpdateOne

RemoveReacts removes "reacts" edges to React entities.

func (*AccountUpdateOne) RemoveRoleIDs

func (auo *AccountUpdateOne) RemoveRoleIDs(ids ...xid.ID) *AccountUpdateOne

RemoveRoleIDs removes the "roles" edge to Role entities by IDs.

func (*AccountUpdateOne) RemoveRoles

func (auo *AccountUpdateOne) RemoveRoles(r ...*Role) *AccountUpdateOne

RemoveRoles removes "roles" edges to Role entities.

func (*AccountUpdateOne) RemoveSubscriptionIDs

func (auo *AccountUpdateOne) RemoveSubscriptionIDs(ids ...xid.ID) *AccountUpdateOne

RemoveSubscriptionIDs removes the "subscriptions" edge to Subscription entities by IDs.

func (*AccountUpdateOne) RemoveSubscriptions

func (auo *AccountUpdateOne) RemoveSubscriptions(s ...*Subscription) *AccountUpdateOne

RemoveSubscriptions removes "subscriptions" edges to Subscription entities.

func (*AccountUpdateOne) RemoveTagIDs

func (auo *AccountUpdateOne) RemoveTagIDs(ids ...xid.ID) *AccountUpdateOne

RemoveTagIDs removes the "tags" edge to Tag entities by IDs.

func (*AccountUpdateOne) RemoveTags

func (auo *AccountUpdateOne) RemoveTags(t ...*Tag) *AccountUpdateOne

RemoveTags removes "tags" edges to Tag entities.

func (*AccountUpdateOne) Save

func (auo *AccountUpdateOne) Save(ctx context.Context) (*Account, error)

Save executes the query and returns the updated Account entity.

func (*AccountUpdateOne) SaveX

func (auo *AccountUpdateOne) SaveX(ctx context.Context) *Account

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

func (*AccountUpdateOne) Select

func (auo *AccountUpdateOne) Select(field string, fields ...string) *AccountUpdateOne

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

func (*AccountUpdateOne) SetAdmin

func (auo *AccountUpdateOne) SetAdmin(b bool) *AccountUpdateOne

SetAdmin sets the "admin" field.

func (*AccountUpdateOne) SetBio

func (auo *AccountUpdateOne) SetBio(s string) *AccountUpdateOne

SetBio sets the "bio" field.

func (*AccountUpdateOne) SetDeletedAt

func (auo *AccountUpdateOne) SetDeletedAt(t time.Time) *AccountUpdateOne

SetDeletedAt sets the "deleted_at" field.

func (*AccountUpdateOne) SetEmail

func (auo *AccountUpdateOne) SetEmail(s string) *AccountUpdateOne

SetEmail sets the "email" field.

func (*AccountUpdateOne) SetName

func (auo *AccountUpdateOne) SetName(s string) *AccountUpdateOne

SetName sets the "name" field.

func (*AccountUpdateOne) SetNillableAdmin

func (auo *AccountUpdateOne) SetNillableAdmin(b *bool) *AccountUpdateOne

SetNillableAdmin sets the "admin" field if the given value is not nil.

func (*AccountUpdateOne) SetNillableBio

func (auo *AccountUpdateOne) SetNillableBio(s *string) *AccountUpdateOne

SetNillableBio sets the "bio" field if the given value is not nil.

func (*AccountUpdateOne) SetNillableDeletedAt

func (auo *AccountUpdateOne) SetNillableDeletedAt(t *time.Time) *AccountUpdateOne

SetNillableDeletedAt sets the "deleted_at" field if the given value is not nil.

func (*AccountUpdateOne) SetUpdatedAt

func (auo *AccountUpdateOne) SetUpdatedAt(t time.Time) *AccountUpdateOne

SetUpdatedAt sets the "updated_at" field.

type AccountUpsert

type AccountUpsert struct {
	*sql.UpdateSet
}

AccountUpsert is the "OnConflict" setter.

func (*AccountUpsert) ClearBio

func (u *AccountUpsert) ClearBio() *AccountUpsert

ClearBio clears the value of the "bio" field.

func (*AccountUpsert) ClearDeletedAt

func (u *AccountUpsert) ClearDeletedAt() *AccountUpsert

ClearDeletedAt clears the value of the "deleted_at" field.

func (*AccountUpsert) SetAdmin

func (u *AccountUpsert) SetAdmin(v bool) *AccountUpsert

SetAdmin sets the "admin" field.

func (*AccountUpsert) SetBio

func (u *AccountUpsert) SetBio(v string) *AccountUpsert

SetBio sets the "bio" field.

func (*AccountUpsert) SetCreatedAt

func (u *AccountUpsert) SetCreatedAt(v time.Time) *AccountUpsert

SetCreatedAt sets the "created_at" field.

func (*AccountUpsert) SetDeletedAt

func (u *AccountUpsert) SetDeletedAt(v time.Time) *AccountUpsert

SetDeletedAt sets the "deleted_at" field.

func (*AccountUpsert) SetEmail

func (u *AccountUpsert) SetEmail(v string) *AccountUpsert

SetEmail sets the "email" field.

func (*AccountUpsert) SetName

func (u *AccountUpsert) SetName(v string) *AccountUpsert

SetName sets the "name" field.

func (*AccountUpsert) SetUpdatedAt

func (u *AccountUpsert) SetUpdatedAt(v time.Time) *AccountUpsert

SetUpdatedAt sets the "updated_at" field.

func (*AccountUpsert) UpdateAdmin

func (u *AccountUpsert) UpdateAdmin() *AccountUpsert

UpdateAdmin sets the "admin" field to the value that was provided on create.

func (*AccountUpsert) UpdateBio

func (u *AccountUpsert) UpdateBio() *AccountUpsert

UpdateBio sets the "bio" field to the value that was provided on create.

func (*AccountUpsert) UpdateCreatedAt

func (u *AccountUpsert) UpdateCreatedAt() *AccountUpsert

UpdateCreatedAt sets the "created_at" field to the value that was provided on create.

func (*AccountUpsert) UpdateDeletedAt

func (u *AccountUpsert) UpdateDeletedAt() *AccountUpsert

UpdateDeletedAt sets the "deleted_at" field to the value that was provided on create.

func (*AccountUpsert) UpdateEmail

func (u *AccountUpsert) UpdateEmail() *AccountUpsert

UpdateEmail sets the "email" field to the value that was provided on create.

func (*AccountUpsert) UpdateName

func (u *AccountUpsert) UpdateName() *AccountUpsert

UpdateName sets the "name" field to the value that was provided on create.

func (*AccountUpsert) UpdateUpdatedAt

func (u *AccountUpsert) UpdateUpdatedAt() *AccountUpsert

UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create.

type AccountUpsertBulk

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

AccountUpsertBulk is the builder for "upsert"-ing a bulk of Account nodes.

func (*AccountUpsertBulk) ClearBio

func (u *AccountUpsertBulk) ClearBio() *AccountUpsertBulk

ClearBio clears the value of the "bio" field.

func (*AccountUpsertBulk) ClearDeletedAt

func (u *AccountUpsertBulk) ClearDeletedAt() *AccountUpsertBulk

ClearDeletedAt clears the value of the "deleted_at" field.

func (*AccountUpsertBulk) DoNothing

func (u *AccountUpsertBulk) DoNothing() *AccountUpsertBulk

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

func (*AccountUpsertBulk) Exec

func (u *AccountUpsertBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*AccountUpsertBulk) ExecX

func (u *AccountUpsertBulk) ExecX(ctx context.Context)

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

func (*AccountUpsertBulk) Ignore

func (u *AccountUpsertBulk) Ignore() *AccountUpsertBulk

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

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

func (*AccountUpsertBulk) SetAdmin

func (u *AccountUpsertBulk) SetAdmin(v bool) *AccountUpsertBulk

SetAdmin sets the "admin" field.

func (*AccountUpsertBulk) SetBio

SetBio sets the "bio" field.

func (*AccountUpsertBulk) SetCreatedAt

func (u *AccountUpsertBulk) SetCreatedAt(v time.Time) *AccountUpsertBulk

SetCreatedAt sets the "created_at" field.

func (*AccountUpsertBulk) SetDeletedAt

func (u *AccountUpsertBulk) SetDeletedAt(v time.Time) *AccountUpsertBulk

SetDeletedAt sets the "deleted_at" field.

func (*AccountUpsertBulk) SetEmail

func (u *AccountUpsertBulk) SetEmail(v string) *AccountUpsertBulk

SetEmail sets the "email" field.

func (*AccountUpsertBulk) SetName

SetName sets the "name" field.

func (*AccountUpsertBulk) SetUpdatedAt

func (u *AccountUpsertBulk) SetUpdatedAt(v time.Time) *AccountUpsertBulk

SetUpdatedAt sets the "updated_at" field.

func (*AccountUpsertBulk) Update

func (u *AccountUpsertBulk) Update(set func(*AccountUpsert)) *AccountUpsertBulk

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

func (*AccountUpsertBulk) UpdateAdmin

func (u *AccountUpsertBulk) UpdateAdmin() *AccountUpsertBulk

UpdateAdmin sets the "admin" field to the value that was provided on create.

func (*AccountUpsertBulk) UpdateBio

func (u *AccountUpsertBulk) UpdateBio() *AccountUpsertBulk

UpdateBio sets the "bio" field to the value that was provided on create.

func (*AccountUpsertBulk) UpdateCreatedAt

func (u *AccountUpsertBulk) UpdateCreatedAt() *AccountUpsertBulk

UpdateCreatedAt sets the "created_at" field to the value that was provided on create.

func (*AccountUpsertBulk) UpdateDeletedAt

func (u *AccountUpsertBulk) UpdateDeletedAt() *AccountUpsertBulk

UpdateDeletedAt sets the "deleted_at" field to the value that was provided on create.

func (*AccountUpsertBulk) UpdateEmail

func (u *AccountUpsertBulk) UpdateEmail() *AccountUpsertBulk

UpdateEmail sets the "email" field to the value that was provided on create.

func (*AccountUpsertBulk) UpdateName

func (u *AccountUpsertBulk) UpdateName() *AccountUpsertBulk

UpdateName sets the "name" field to the value that was provided on create.

func (*AccountUpsertBulk) UpdateNewValues

func (u *AccountUpsertBulk) UpdateNewValues() *AccountUpsertBulk

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

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

func (*AccountUpsertBulk) UpdateUpdatedAt

func (u *AccountUpsertBulk) UpdateUpdatedAt() *AccountUpsertBulk

UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create.

type AccountUpsertOne

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

AccountUpsertOne is the builder for "upsert"-ing

one Account node.

func (*AccountUpsertOne) ClearBio

func (u *AccountUpsertOne) ClearBio() *AccountUpsertOne

ClearBio clears the value of the "bio" field.

func (*AccountUpsertOne) ClearDeletedAt

func (u *AccountUpsertOne) ClearDeletedAt() *AccountUpsertOne

ClearDeletedAt clears the value of the "deleted_at" field.

func (*AccountUpsertOne) DoNothing

func (u *AccountUpsertOne) DoNothing() *AccountUpsertOne

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

func (*AccountUpsertOne) Exec

func (u *AccountUpsertOne) Exec(ctx context.Context) error

Exec executes the query.

func (*AccountUpsertOne) ExecX

func (u *AccountUpsertOne) ExecX(ctx context.Context)

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

func (*AccountUpsertOne) ID

func (u *AccountUpsertOne) ID(ctx context.Context) (id xid.ID, err error)

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

func (*AccountUpsertOne) IDX

func (u *AccountUpsertOne) IDX(ctx context.Context) xid.ID

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

func (*AccountUpsertOne) Ignore

func (u *AccountUpsertOne) Ignore() *AccountUpsertOne

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

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

func (*AccountUpsertOne) SetAdmin

func (u *AccountUpsertOne) SetAdmin(v bool) *AccountUpsertOne

SetAdmin sets the "admin" field.

func (*AccountUpsertOne) SetBio

SetBio sets the "bio" field.

func (*AccountUpsertOne) SetCreatedAt

func (u *AccountUpsertOne) SetCreatedAt(v time.Time) *AccountUpsertOne

SetCreatedAt sets the "created_at" field.

func (*AccountUpsertOne) SetDeletedAt

func (u *AccountUpsertOne) SetDeletedAt(v time.Time) *AccountUpsertOne

SetDeletedAt sets the "deleted_at" field.

func (*AccountUpsertOne) SetEmail

func (u *AccountUpsertOne) SetEmail(v string) *AccountUpsertOne

SetEmail sets the "email" field.

func (*AccountUpsertOne) SetName

func (u *AccountUpsertOne) SetName(v string) *AccountUpsertOne

SetName sets the "name" field.

func (*AccountUpsertOne) SetUpdatedAt

func (u *AccountUpsertOne) SetUpdatedAt(v time.Time) *AccountUpsertOne

SetUpdatedAt sets the "updated_at" field.

func (*AccountUpsertOne) Update

func (u *AccountUpsertOne) Update(set func(*AccountUpsert)) *AccountUpsertOne

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

func (*AccountUpsertOne) UpdateAdmin

func (u *AccountUpsertOne) UpdateAdmin() *AccountUpsertOne

UpdateAdmin sets the "admin" field to the value that was provided on create.

func (*AccountUpsertOne) UpdateBio

func (u *AccountUpsertOne) UpdateBio() *AccountUpsertOne

UpdateBio sets the "bio" field to the value that was provided on create.

func (*AccountUpsertOne) UpdateCreatedAt

func (u *AccountUpsertOne) UpdateCreatedAt() *AccountUpsertOne

UpdateCreatedAt sets the "created_at" field to the value that was provided on create.

func (*AccountUpsertOne) UpdateDeletedAt

func (u *AccountUpsertOne) UpdateDeletedAt() *AccountUpsertOne

UpdateDeletedAt sets the "deleted_at" field to the value that was provided on create.

func (*AccountUpsertOne) UpdateEmail

func (u *AccountUpsertOne) UpdateEmail() *AccountUpsertOne

UpdateEmail sets the "email" field to the value that was provided on create.

func (*AccountUpsertOne) UpdateName

func (u *AccountUpsertOne) UpdateName() *AccountUpsertOne

UpdateName sets the "name" field to the value that was provided on create.

func (*AccountUpsertOne) UpdateNewValues

func (u *AccountUpsertOne) UpdateNewValues() *AccountUpsertOne

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

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

func (*AccountUpsertOne) UpdateUpdatedAt

func (u *AccountUpsertOne) UpdateUpdatedAt() *AccountUpsertOne

UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create.

type Accounts

type Accounts []*Account

Accounts is a parsable slice of Account.

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(model.As(model.Sum(field1), "sum_field1"), (model.As(model.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 Authentication

type Authentication struct {

	// ID of the ent.
	ID xid.ID `json:"id,omitempty"`
	// CreatedAt holds the value of the "created_at" field.
	CreatedAt time.Time `json:"created_at,omitempty"`
	// The authentication service name, such as GitHub, Twitter, Discord, etc. Or, 'password' for password auth and 'api_token' for token auth
	Service string `json:"service,omitempty"`
	// The identifier, usually a user/account ID on some OAuth service or API token name. If it's a password, this is blank.
	Identifier string `json:"identifier,omitempty"`
	// The actual authentication token/password/key/etc. If OAuth, it'll be the access_token value, if it's a password, a hash and if it's an api_token type then the API token string.
	Token string `json:"-"`
	// Any necessary metadata specific to the authentication method.
	Metadata map[string]interface{} `json:"metadata,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the AuthenticationQuery when eager-loading is set.
	Edges AuthenticationEdges `json:"edges"`
	// contains filtered or unexported fields
}

Authentication is the model entity for the Authentication schema.

func (*Authentication) QueryAccount

func (a *Authentication) QueryAccount() *AccountQuery

QueryAccount queries the "account" edge of the Authentication entity.

func (*Authentication) String

func (a *Authentication) String() string

String implements the fmt.Stringer.

func (*Authentication) Unwrap

func (a *Authentication) Unwrap() *Authentication

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

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

type AuthenticationClient

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

AuthenticationClient is a client for the Authentication schema.

func NewAuthenticationClient

func NewAuthenticationClient(c config) *AuthenticationClient

NewAuthenticationClient returns a client for the Authentication from the given config.

func (*AuthenticationClient) Create

Create returns a builder for creating a Authentication entity.

func (*AuthenticationClient) CreateBulk

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

func (*AuthenticationClient) Delete

Delete returns a delete builder for Authentication.

func (*AuthenticationClient) DeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*AuthenticationClient) DeleteOneID

func (c *AuthenticationClient) DeleteOneID(id xid.ID) *AuthenticationDeleteOne

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

func (*AuthenticationClient) Get

Get returns a Authentication entity by its id.

func (*AuthenticationClient) GetX

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

func (*AuthenticationClient) Hooks

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

Hooks returns the client hooks.

func (*AuthenticationClient) Query

Query returns a query builder for Authentication.

func (*AuthenticationClient) QueryAccount

func (c *AuthenticationClient) QueryAccount(a *Authentication) *AccountQuery

QueryAccount queries the account edge of a Authentication.

func (*AuthenticationClient) Update

Update returns an update builder for Authentication.

func (*AuthenticationClient) UpdateOne

UpdateOne returns an update builder for the given entity.

func (*AuthenticationClient) UpdateOneID

func (c *AuthenticationClient) UpdateOneID(id xid.ID) *AuthenticationUpdateOne

UpdateOneID returns an update builder for the given id.

func (*AuthenticationClient) Use

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

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

type AuthenticationCreate

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

AuthenticationCreate is the builder for creating a Authentication entity.

func (*AuthenticationCreate) Exec

func (ac *AuthenticationCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*AuthenticationCreate) ExecX

func (ac *AuthenticationCreate) ExecX(ctx context.Context)

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

func (*AuthenticationCreate) Mutation

Mutation returns the AuthenticationMutation object of the builder.

func (*AuthenticationCreate) OnConflict

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

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

func (*AuthenticationCreate) OnConflictColumns

func (ac *AuthenticationCreate) OnConflictColumns(columns ...string) *AuthenticationUpsertOne

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

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

func (*AuthenticationCreate) Save

Save creates the Authentication in the database.

func (*AuthenticationCreate) SaveX

SaveX calls Save and panics if Save returns an error.

func (*AuthenticationCreate) SetAccount

SetAccount sets the "account" edge to the Account entity.

func (*AuthenticationCreate) SetAccountID

func (ac *AuthenticationCreate) SetAccountID(id xid.ID) *AuthenticationCreate

SetAccountID sets the "account" edge to the Account entity by ID.

func (*AuthenticationCreate) SetCreatedAt

func (ac *AuthenticationCreate) SetCreatedAt(t time.Time) *AuthenticationCreate

SetCreatedAt sets the "created_at" field.

func (*AuthenticationCreate) SetID

SetID sets the "id" field.

func (*AuthenticationCreate) SetIdentifier

func (ac *AuthenticationCreate) SetIdentifier(s string) *AuthenticationCreate

SetIdentifier sets the "identifier" field.

func (*AuthenticationCreate) SetMetadata

func (ac *AuthenticationCreate) SetMetadata(m map[string]interface{}) *AuthenticationCreate

SetMetadata sets the "metadata" field.

func (*AuthenticationCreate) SetNillableAccountID

func (ac *AuthenticationCreate) SetNillableAccountID(id *xid.ID) *AuthenticationCreate

SetNillableAccountID sets the "account" edge to the Account entity by ID if the given value is not nil.

func (*AuthenticationCreate) SetNillableCreatedAt

func (ac *AuthenticationCreate) SetNillableCreatedAt(t *time.Time) *AuthenticationCreate

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

func (*AuthenticationCreate) SetNillableID

func (ac *AuthenticationCreate) SetNillableID(x *xid.ID) *AuthenticationCreate

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

func (*AuthenticationCreate) SetService

SetService sets the "service" field.

func (*AuthenticationCreate) SetToken

SetToken sets the "token" field.

type AuthenticationCreateBulk

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

AuthenticationCreateBulk is the builder for creating many Authentication entities in bulk.

func (*AuthenticationCreateBulk) Exec

Exec executes the query.

func (*AuthenticationCreateBulk) ExecX

func (acb *AuthenticationCreateBulk) ExecX(ctx context.Context)

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

func (*AuthenticationCreateBulk) OnConflict

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

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

func (*AuthenticationCreateBulk) OnConflictColumns

func (acb *AuthenticationCreateBulk) OnConflictColumns(columns ...string) *AuthenticationUpsertBulk

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

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

func (*AuthenticationCreateBulk) Save

Save creates the Authentication entities in the database.

func (*AuthenticationCreateBulk) SaveX

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

type AuthenticationDelete

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

AuthenticationDelete is the builder for deleting a Authentication entity.

func (*AuthenticationDelete) Exec

func (ad *AuthenticationDelete) Exec(ctx context.Context) (int, error)

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

func (*AuthenticationDelete) ExecX

func (ad *AuthenticationDelete) ExecX(ctx context.Context) int

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

func (*AuthenticationDelete) Where

Where appends a list predicates to the AuthenticationDelete builder.

type AuthenticationDeleteOne

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

AuthenticationDeleteOne is the builder for deleting a single Authentication entity.

func (*AuthenticationDeleteOne) Exec

Exec executes the deletion query.

func (*AuthenticationDeleteOne) ExecX

func (ado *AuthenticationDeleteOne) ExecX(ctx context.Context)

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

type AuthenticationEdges

type AuthenticationEdges struct {
	// Account holds the value of the account edge.
	Account *Account `json:"account,omitempty"`
	// contains filtered or unexported fields
}

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

func (AuthenticationEdges) AccountOrErr

func (e AuthenticationEdges) AccountOrErr() (*Account, error)

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

type AuthenticationGroupBy

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

AuthenticationGroupBy is the group-by builder for Authentication entities.

func (*AuthenticationGroupBy) Aggregate

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

func (*AuthenticationGroupBy) Bool

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

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

func (*AuthenticationGroupBy) BoolX

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

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

func (*AuthenticationGroupBy) Bools

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

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

func (*AuthenticationGroupBy) BoolsX

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

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

func (*AuthenticationGroupBy) Float64

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

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

func (*AuthenticationGroupBy) Float64X

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

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

func (*AuthenticationGroupBy) Float64s

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

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

func (*AuthenticationGroupBy) Float64sX

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

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

func (*AuthenticationGroupBy) Int

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

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

func (*AuthenticationGroupBy) IntX

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

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

func (*AuthenticationGroupBy) Ints

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

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

func (*AuthenticationGroupBy) IntsX

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

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

func (*AuthenticationGroupBy) Scan

func (agb *AuthenticationGroupBy) Scan(ctx context.Context, v interface{}) error

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

func (*AuthenticationGroupBy) ScanX

func (s *AuthenticationGroupBy) ScanX(ctx context.Context, v interface{})

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

func (*AuthenticationGroupBy) String

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

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

func (*AuthenticationGroupBy) StringX

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

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

func (*AuthenticationGroupBy) Strings

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

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

func (*AuthenticationGroupBy) StringsX

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

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

type AuthenticationMutation

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

AuthenticationMutation represents an operation that mutates the Authentication nodes in the graph.

func (*AuthenticationMutation) AccountCleared

func (m *AuthenticationMutation) AccountCleared() bool

AccountCleared reports if the "account" edge to the Account entity was cleared.

func (*AuthenticationMutation) AccountID

func (m *AuthenticationMutation) AccountID() (id xid.ID, exists bool)

AccountID returns the "account" edge ID in the mutation.

func (*AuthenticationMutation) AccountIDs

func (m *AuthenticationMutation) AccountIDs() (ids []xid.ID)

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

func (*AuthenticationMutation) AddField

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

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

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

func (*AuthenticationMutation) AddedField

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

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

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

func (*AuthenticationMutation) AddedIDs

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

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

func (*AuthenticationMutation) ClearAccount

func (m *AuthenticationMutation) ClearAccount()

ClearAccount clears the "account" edge to the Account entity.

func (*AuthenticationMutation) ClearEdge

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

func (m *AuthenticationMutation) 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 (*AuthenticationMutation) ClearMetadata

func (m *AuthenticationMutation) ClearMetadata()

ClearMetadata clears the value of the "metadata" field.

func (*AuthenticationMutation) ClearedEdges

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

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

func (*AuthenticationMutation) ClearedFields

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

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

func (AuthenticationMutation) Client

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

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

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

func (*AuthenticationMutation) EdgeCleared

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

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

func (*AuthenticationMutation) Field

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

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

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

func (*AuthenticationMutation) Fields

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

func (m *AuthenticationMutation) ID() (id xid.ID, 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 (*AuthenticationMutation) IDs

func (m *AuthenticationMutation) IDs(ctx context.Context) ([]xid.ID, 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 (*AuthenticationMutation) Identifier

func (m *AuthenticationMutation) Identifier() (r string, exists bool)

Identifier returns the value of the "identifier" field in the mutation.

func (*AuthenticationMutation) Metadata

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

Metadata returns the value of the "metadata" field in the mutation.

func (*AuthenticationMutation) MetadataCleared

func (m *AuthenticationMutation) MetadataCleared() bool

MetadataCleared returns if the "metadata" field was cleared in this mutation.

func (*AuthenticationMutation) OldCreatedAt

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

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

func (m *AuthenticationMutation) 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 (*AuthenticationMutation) OldIdentifier

func (m *AuthenticationMutation) OldIdentifier(ctx context.Context) (v string, err error)

OldIdentifier returns the old "identifier" field's value of the Authentication entity. If the Authentication 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 (*AuthenticationMutation) OldMetadata

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

OldMetadata returns the old "metadata" field's value of the Authentication entity. If the Authentication 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 (*AuthenticationMutation) OldService

func (m *AuthenticationMutation) OldService(ctx context.Context) (v string, err error)

OldService returns the old "service" field's value of the Authentication entity. If the Authentication 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 (*AuthenticationMutation) OldToken

func (m *AuthenticationMutation) OldToken(ctx context.Context) (v string, err error)

OldToken returns the old "token" field's value of the Authentication entity. If the Authentication 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 (*AuthenticationMutation) Op

func (m *AuthenticationMutation) Op() Op

Op returns the operation name.

func (*AuthenticationMutation) RemovedEdges

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

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

func (*AuthenticationMutation) RemovedIDs

func (m *AuthenticationMutation) 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 (*AuthenticationMutation) ResetAccount

func (m *AuthenticationMutation) ResetAccount()

ResetAccount resets all changes to the "account" edge.

func (*AuthenticationMutation) ResetCreatedAt

func (m *AuthenticationMutation) ResetCreatedAt()

ResetCreatedAt resets all changes to the "created_at" field.

func (*AuthenticationMutation) ResetEdge

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

func (m *AuthenticationMutation) 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 (*AuthenticationMutation) ResetIdentifier

func (m *AuthenticationMutation) ResetIdentifier()

ResetIdentifier resets all changes to the "identifier" field.

func (*AuthenticationMutation) ResetMetadata

func (m *AuthenticationMutation) ResetMetadata()

ResetMetadata resets all changes to the "metadata" field.

func (*AuthenticationMutation) ResetService

func (m *AuthenticationMutation) ResetService()

ResetService resets all changes to the "service" field.

func (*AuthenticationMutation) ResetToken

func (m *AuthenticationMutation) ResetToken()

ResetToken resets all changes to the "token" field.

func (*AuthenticationMutation) Service

func (m *AuthenticationMutation) Service() (r string, exists bool)

Service returns the value of the "service" field in the mutation.

func (*AuthenticationMutation) SetAccountID

func (m *AuthenticationMutation) SetAccountID(id xid.ID)

SetAccountID sets the "account" edge to the Account entity by id.

func (*AuthenticationMutation) SetCreatedAt

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

SetCreatedAt sets the "created_at" field.

func (*AuthenticationMutation) SetField

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

func (m *AuthenticationMutation) SetID(id xid.ID)

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

func (*AuthenticationMutation) SetIdentifier

func (m *AuthenticationMutation) SetIdentifier(s string)

SetIdentifier sets the "identifier" field.

func (*AuthenticationMutation) SetMetadata

func (m *AuthenticationMutation) SetMetadata(value map[string]interface{})

SetMetadata sets the "metadata" field.

func (*AuthenticationMutation) SetService

func (m *AuthenticationMutation) SetService(s string)

SetService sets the "service" field.

func (*AuthenticationMutation) SetToken

func (m *AuthenticationMutation) SetToken(s string)

SetToken sets the "token" field.

func (*AuthenticationMutation) Token

func (m *AuthenticationMutation) Token() (r string, exists bool)

Token returns the value of the "token" field in the mutation.

func (AuthenticationMutation) Tx

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

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

func (*AuthenticationMutation) Type

func (m *AuthenticationMutation) Type() string

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

func (*AuthenticationMutation) Where

Where appends a list predicates to the AuthenticationMutation builder.

type AuthenticationQuery

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

AuthenticationQuery is the builder for querying Authentication entities.

func (*AuthenticationQuery) All

All executes the query and returns a list of Authentications.

func (*AuthenticationQuery) AllX

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

func (*AuthenticationQuery) Clone

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

func (*AuthenticationQuery) Count

func (aq *AuthenticationQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*AuthenticationQuery) CountX

func (aq *AuthenticationQuery) CountX(ctx context.Context) int

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

func (*AuthenticationQuery) Exist

func (aq *AuthenticationQuery) Exist(ctx context.Context) (bool, error)

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

func (*AuthenticationQuery) ExistX

func (aq *AuthenticationQuery) ExistX(ctx context.Context) bool

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

func (*AuthenticationQuery) First

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

func (*AuthenticationQuery) FirstID

func (aq *AuthenticationQuery) FirstID(ctx context.Context) (id xid.ID, err error)

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

func (*AuthenticationQuery) FirstIDX

func (aq *AuthenticationQuery) FirstIDX(ctx context.Context) xid.ID

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

func (*AuthenticationQuery) FirstX

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

func (*AuthenticationQuery) GroupBy

func (aq *AuthenticationQuery) GroupBy(field string, fields ...string) *AuthenticationGroupBy

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 {
	CreatedAt time.Time `json:"created_at,omitempty"`
	Count int `json:"count,omitempty"`
}

client.Authentication.Query().
	GroupBy(authentication.FieldCreatedAt).
	Aggregate(model.Count()).
	Scan(ctx, &v)

func (*AuthenticationQuery) IDs

func (aq *AuthenticationQuery) IDs(ctx context.Context) ([]xid.ID, error)

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

func (*AuthenticationQuery) IDsX

func (aq *AuthenticationQuery) IDsX(ctx context.Context) []xid.ID

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

func (*AuthenticationQuery) Limit

func (aq *AuthenticationQuery) Limit(limit int) *AuthenticationQuery

Limit adds a limit step to the query.

func (*AuthenticationQuery) Modify

func (aq *AuthenticationQuery) Modify(modifiers ...func(s *sql.Selector)) *AuthenticationSelect

Modify adds a query modifier for attaching custom logic to queries.

func (*AuthenticationQuery) Offset

func (aq *AuthenticationQuery) Offset(offset int) *AuthenticationQuery

Offset adds an offset step to the query.

func (*AuthenticationQuery) Only

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

func (*AuthenticationQuery) OnlyID

func (aq *AuthenticationQuery) OnlyID(ctx context.Context) (id xid.ID, err error)

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

func (*AuthenticationQuery) OnlyIDX

func (aq *AuthenticationQuery) OnlyIDX(ctx context.Context) xid.ID

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

func (*AuthenticationQuery) OnlyX

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

func (*AuthenticationQuery) Order

Order adds an order step to the query.

func (*AuthenticationQuery) QueryAccount

func (aq *AuthenticationQuery) QueryAccount() *AccountQuery

QueryAccount chains the current query on the "account" edge.

func (*AuthenticationQuery) Select

func (aq *AuthenticationQuery) Select(fields ...string) *AuthenticationSelect

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 {
	CreatedAt time.Time `json:"created_at,omitempty"`
}

client.Authentication.Query().
	Select(authentication.FieldCreatedAt).
	Scan(ctx, &v)

func (*AuthenticationQuery) Unique

func (aq *AuthenticationQuery) Unique(unique bool) *AuthenticationQuery

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

Where adds a new predicate for the AuthenticationQuery builder.

func (*AuthenticationQuery) WithAccount

func (aq *AuthenticationQuery) WithAccount(opts ...func(*AccountQuery)) *AuthenticationQuery

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

type AuthenticationSelect

type AuthenticationSelect struct {
	*AuthenticationQuery
	// contains filtered or unexported fields
}

AuthenticationSelect is the builder for selecting fields of Authentication entities.

func (*AuthenticationSelect) Bool

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

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

func (*AuthenticationSelect) BoolX

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

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

func (*AuthenticationSelect) Bools

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

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

func (*AuthenticationSelect) BoolsX

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

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

func (*AuthenticationSelect) Float64

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

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

func (*AuthenticationSelect) Float64X

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

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

func (*AuthenticationSelect) Float64s

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

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

func (*AuthenticationSelect) Float64sX

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

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

func (*AuthenticationSelect) Int

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

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

func (*AuthenticationSelect) IntX

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

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

func (*AuthenticationSelect) Ints

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

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

func (*AuthenticationSelect) IntsX

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

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

func (*AuthenticationSelect) Modify

func (as *AuthenticationSelect) Modify(modifiers ...func(s *sql.Selector)) *AuthenticationSelect

Modify adds a query modifier for attaching custom logic to queries.

func (*AuthenticationSelect) Scan

func (as *AuthenticationSelect) Scan(ctx context.Context, v interface{}) error

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

func (*AuthenticationSelect) ScanX

func (s *AuthenticationSelect) ScanX(ctx context.Context, v interface{})

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

func (*AuthenticationSelect) String

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

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

func (*AuthenticationSelect) StringX

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

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

func (*AuthenticationSelect) Strings

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

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

func (*AuthenticationSelect) StringsX

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

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

type AuthenticationUpdate

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

AuthenticationUpdate is the builder for updating Authentication entities.

func (*AuthenticationUpdate) ClearAccount

func (au *AuthenticationUpdate) ClearAccount() *AuthenticationUpdate

ClearAccount clears the "account" edge to the Account entity.

func (*AuthenticationUpdate) ClearMetadata

func (au *AuthenticationUpdate) ClearMetadata() *AuthenticationUpdate

ClearMetadata clears the value of the "metadata" field.

func (*AuthenticationUpdate) Exec

func (au *AuthenticationUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*AuthenticationUpdate) ExecX

func (au *AuthenticationUpdate) ExecX(ctx context.Context)

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

func (*AuthenticationUpdate) Modify

func (au *AuthenticationUpdate) Modify(modifiers ...func(u *sql.UpdateBuilder)) *AuthenticationUpdate

Modify adds a statement modifier for attaching custom logic to the UPDATE statement.

func (*AuthenticationUpdate) Mutation

Mutation returns the AuthenticationMutation object of the builder.

func (*AuthenticationUpdate) Save

func (au *AuthenticationUpdate) Save(ctx context.Context) (int, error)

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

func (*AuthenticationUpdate) SaveX

func (au *AuthenticationUpdate) SaveX(ctx context.Context) int

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

func (*AuthenticationUpdate) SetAccount

SetAccount sets the "account" edge to the Account entity.

func (*AuthenticationUpdate) SetAccountID

func (au *AuthenticationUpdate) SetAccountID(id xid.ID) *AuthenticationUpdate

SetAccountID sets the "account" edge to the Account entity by ID.

func (*AuthenticationUpdate) SetIdentifier

func (au *AuthenticationUpdate) SetIdentifier(s string) *AuthenticationUpdate

SetIdentifier sets the "identifier" field.

func (*AuthenticationUpdate) SetMetadata

func (au *AuthenticationUpdate) SetMetadata(m map[string]interface{}) *AuthenticationUpdate

SetMetadata sets the "metadata" field.

func (*AuthenticationUpdate) SetNillableAccountID

func (au *AuthenticationUpdate) SetNillableAccountID(id *xid.ID) *AuthenticationUpdate

SetNillableAccountID sets the "account" edge to the Account entity by ID if the given value is not nil.

func (*AuthenticationUpdate) SetService

SetService sets the "service" field.

func (*AuthenticationUpdate) SetToken

SetToken sets the "token" field.

func (*AuthenticationUpdate) Where

Where appends a list predicates to the AuthenticationUpdate builder.

type AuthenticationUpdateOne

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

AuthenticationUpdateOne is the builder for updating a single Authentication entity.

func (*AuthenticationUpdateOne) ClearAccount

func (auo *AuthenticationUpdateOne) ClearAccount() *AuthenticationUpdateOne

ClearAccount clears the "account" edge to the Account entity.

func (*AuthenticationUpdateOne) ClearMetadata

func (auo *AuthenticationUpdateOne) ClearMetadata() *AuthenticationUpdateOne

ClearMetadata clears the value of the "metadata" field.

func (*AuthenticationUpdateOne) Exec

Exec executes the query on the entity.

func (*AuthenticationUpdateOne) ExecX

func (auo *AuthenticationUpdateOne) ExecX(ctx context.Context)

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

func (*AuthenticationUpdateOne) Modify

func (auo *AuthenticationUpdateOne) Modify(modifiers ...func(u *sql.UpdateBuilder)) *AuthenticationUpdateOne

Modify adds a statement modifier for attaching custom logic to the UPDATE statement.

func (*AuthenticationUpdateOne) Mutation

Mutation returns the AuthenticationMutation object of the builder.

func (*AuthenticationUpdateOne) Save

Save executes the query and returns the updated Authentication entity.

func (*AuthenticationUpdateOne) SaveX

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

func (*AuthenticationUpdateOne) Select

func (auo *AuthenticationUpdateOne) Select(field string, fields ...string) *AuthenticationUpdateOne

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

func (*AuthenticationUpdateOne) SetAccount

SetAccount sets the "account" edge to the Account entity.

func (*AuthenticationUpdateOne) SetAccountID

func (auo *AuthenticationUpdateOne) SetAccountID(id xid.ID) *AuthenticationUpdateOne

SetAccountID sets the "account" edge to the Account entity by ID.

func (*AuthenticationUpdateOne) SetIdentifier

SetIdentifier sets the "identifier" field.

func (*AuthenticationUpdateOne) SetMetadata

func (auo *AuthenticationUpdateOne) SetMetadata(m map[string]interface{}) *AuthenticationUpdateOne

SetMetadata sets the "metadata" field.

func (*AuthenticationUpdateOne) SetNillableAccountID

func (auo *AuthenticationUpdateOne) SetNillableAccountID(id *xid.ID) *AuthenticationUpdateOne

SetNillableAccountID sets the "account" edge to the Account entity by ID if the given value is not nil.

func (*AuthenticationUpdateOne) SetService

SetService sets the "service" field.

func (*AuthenticationUpdateOne) SetToken

SetToken sets the "token" field.

type AuthenticationUpsert

type AuthenticationUpsert struct {
	*sql.UpdateSet
}

AuthenticationUpsert is the "OnConflict" setter.

func (*AuthenticationUpsert) ClearMetadata

func (u *AuthenticationUpsert) ClearMetadata() *AuthenticationUpsert

ClearMetadata clears the value of the "metadata" field.

func (*AuthenticationUpsert) SetCreatedAt

func (u *AuthenticationUpsert) SetCreatedAt(v time.Time) *AuthenticationUpsert

SetCreatedAt sets the "created_at" field.

func (*AuthenticationUpsert) SetIdentifier

func (u *AuthenticationUpsert) SetIdentifier(v string) *AuthenticationUpsert

SetIdentifier sets the "identifier" field.

func (*AuthenticationUpsert) SetMetadata

func (u *AuthenticationUpsert) SetMetadata(v map[string]interface{}) *AuthenticationUpsert

SetMetadata sets the "metadata" field.

func (*AuthenticationUpsert) SetService

SetService sets the "service" field.

func (*AuthenticationUpsert) SetToken

SetToken sets the "token" field.

func (*AuthenticationUpsert) UpdateCreatedAt

func (u *AuthenticationUpsert) UpdateCreatedAt() *AuthenticationUpsert

UpdateCreatedAt sets the "created_at" field to the value that was provided on create.

func (*AuthenticationUpsert) UpdateIdentifier

func (u *AuthenticationUpsert) UpdateIdentifier() *AuthenticationUpsert

UpdateIdentifier sets the "identifier" field to the value that was provided on create.

func (*AuthenticationUpsert) UpdateMetadata

func (u *AuthenticationUpsert) UpdateMetadata() *AuthenticationUpsert

UpdateMetadata sets the "metadata" field to the value that was provided on create.

func (*AuthenticationUpsert) UpdateService

func (u *AuthenticationUpsert) UpdateService() *AuthenticationUpsert

UpdateService sets the "service" field to the value that was provided on create.

func (*AuthenticationUpsert) UpdateToken

func (u *AuthenticationUpsert) UpdateToken() *AuthenticationUpsert

UpdateToken sets the "token" field to the value that was provided on create.

type AuthenticationUpsertBulk

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

AuthenticationUpsertBulk is the builder for "upsert"-ing a bulk of Authentication nodes.

func (*AuthenticationUpsertBulk) ClearMetadata

ClearMetadata clears the value of the "metadata" field.

func (*AuthenticationUpsertBulk) DoNothing

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

func (*AuthenticationUpsertBulk) Exec

Exec executes the query.

func (*AuthenticationUpsertBulk) ExecX

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

func (*AuthenticationUpsertBulk) Ignore

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

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

func (*AuthenticationUpsertBulk) SetCreatedAt

SetCreatedAt sets the "created_at" field.

func (*AuthenticationUpsertBulk) SetIdentifier

SetIdentifier sets the "identifier" field.

func (*AuthenticationUpsertBulk) SetMetadata

func (u *AuthenticationUpsertBulk) SetMetadata(v map[string]interface{}) *AuthenticationUpsertBulk

SetMetadata sets the "metadata" field.

func (*AuthenticationUpsertBulk) SetService

SetService sets the "service" field.

func (*AuthenticationUpsertBulk) SetToken

SetToken sets the "token" field.

func (*AuthenticationUpsertBulk) Update

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

func (*AuthenticationUpsertBulk) UpdateCreatedAt

func (u *AuthenticationUpsertBulk) UpdateCreatedAt() *AuthenticationUpsertBulk

UpdateCreatedAt sets the "created_at" field to the value that was provided on create.

func (*AuthenticationUpsertBulk) UpdateIdentifier

func (u *AuthenticationUpsertBulk) UpdateIdentifier() *AuthenticationUpsertBulk

UpdateIdentifier sets the "identifier" field to the value that was provided on create.

func (*AuthenticationUpsertBulk) UpdateMetadata

UpdateMetadata sets the "metadata" field to the value that was provided on create.

func (*AuthenticationUpsertBulk) UpdateNewValues

func (u *AuthenticationUpsertBulk) UpdateNewValues() *AuthenticationUpsertBulk

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

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

func (*AuthenticationUpsertBulk) UpdateService

UpdateService sets the "service" field to the value that was provided on create.

func (*AuthenticationUpsertBulk) UpdateToken

UpdateToken sets the "token" field to the value that was provided on create.

type AuthenticationUpsertOne

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

AuthenticationUpsertOne is the builder for "upsert"-ing

one Authentication node.

func (*AuthenticationUpsertOne) ClearMetadata

ClearMetadata clears the value of the "metadata" field.

func (*AuthenticationUpsertOne) DoNothing

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

func (*AuthenticationUpsertOne) Exec

Exec executes the query.

func (*AuthenticationUpsertOne) ExecX

func (u *AuthenticationUpsertOne) ExecX(ctx context.Context)

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

func (*AuthenticationUpsertOne) ID

func (u *AuthenticationUpsertOne) ID(ctx context.Context) (id xid.ID, err error)

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

func (*AuthenticationUpsertOne) IDX

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

func (*AuthenticationUpsertOne) Ignore

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

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

func (*AuthenticationUpsertOne) SetCreatedAt

SetCreatedAt sets the "created_at" field.

func (*AuthenticationUpsertOne) SetIdentifier

SetIdentifier sets the "identifier" field.

func (*AuthenticationUpsertOne) SetMetadata

func (u *AuthenticationUpsertOne) SetMetadata(v map[string]interface{}) *AuthenticationUpsertOne

SetMetadata sets the "metadata" field.

func (*AuthenticationUpsertOne) SetService

SetService sets the "service" field.

func (*AuthenticationUpsertOne) SetToken

SetToken sets the "token" field.

func (*AuthenticationUpsertOne) Update

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

func (*AuthenticationUpsertOne) UpdateCreatedAt

func (u *AuthenticationUpsertOne) UpdateCreatedAt() *AuthenticationUpsertOne

UpdateCreatedAt sets the "created_at" field to the value that was provided on create.

func (*AuthenticationUpsertOne) UpdateIdentifier

func (u *AuthenticationUpsertOne) UpdateIdentifier() *AuthenticationUpsertOne

UpdateIdentifier sets the "identifier" field to the value that was provided on create.

func (*AuthenticationUpsertOne) UpdateMetadata

func (u *AuthenticationUpsertOne) UpdateMetadata() *AuthenticationUpsertOne

UpdateMetadata sets the "metadata" field to the value that was provided on create.

func (*AuthenticationUpsertOne) UpdateNewValues

func (u *AuthenticationUpsertOne) UpdateNewValues() *AuthenticationUpsertOne

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

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

func (*AuthenticationUpsertOne) UpdateService

UpdateService sets the "service" field to the value that was provided on create.

func (*AuthenticationUpsertOne) UpdateToken

UpdateToken sets the "token" field to the value that was provided on create.

type Authentications

type Authentications []*Authentication

Authentications is a parsable slice of Authentication.

type Categories

type Categories []*Category

Categories is a parsable slice of Category.

type Category

type Category struct {

	// ID of the ent.
	ID xid.ID `json:"id,omitempty"`
	// CreatedAt holds the value of the "created_at" field.
	CreatedAt time.Time `json:"created_at,omitempty"`
	// UpdatedAt holds the value of the "updated_at" field.
	UpdatedAt time.Time `json:"updated_at,omitempty"`
	// Name holds the value of the "name" field.
	Name string `json:"name,omitempty"`
	// Description holds the value of the "description" field.
	Description string `json:"description,omitempty"`
	// Colour holds the value of the "colour" field.
	Colour string `json:"colour,omitempty"`
	// Sort holds the value of the "sort" field.
	Sort int `json:"sort,omitempty"`
	// Admin holds the value of the "admin" field.
	Admin bool `json:"admin,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the CategoryQuery when eager-loading is set.
	Edges CategoryEdges `json:"edges"`
	// contains filtered or unexported fields
}

Category is the model entity for the Category schema.

func (*Category) QueryPosts

func (c *Category) QueryPosts() *PostQuery

QueryPosts queries the "posts" edge of the Category entity.

func (*Category) String

func (c *Category) String() string

String implements the fmt.Stringer.

func (*Category) Unwrap

func (c *Category) Unwrap() *Category

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

func (c *Category) Update() *CategoryUpdateOne

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

type CategoryClient

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

CategoryClient is a client for the Category schema.

func NewCategoryClient

func NewCategoryClient(c config) *CategoryClient

NewCategoryClient returns a client for the Category from the given config.

func (*CategoryClient) Create

func (c *CategoryClient) Create() *CategoryCreate

Create returns a builder for creating a Category entity.

func (*CategoryClient) CreateBulk

func (c *CategoryClient) CreateBulk(builders ...*CategoryCreate) *CategoryCreateBulk

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

func (*CategoryClient) Delete

func (c *CategoryClient) Delete() *CategoryDelete

Delete returns a delete builder for Category.

func (*CategoryClient) DeleteOne

func (c *CategoryClient) DeleteOne(ca *Category) *CategoryDeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*CategoryClient) DeleteOneID

func (c *CategoryClient) DeleteOneID(id xid.ID) *CategoryDeleteOne

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

func (*CategoryClient) Get

func (c *CategoryClient) Get(ctx context.Context, id xid.ID) (*Category, error)

Get returns a Category entity by its id.

func (*CategoryClient) GetX

func (c *CategoryClient) GetX(ctx context.Context, id xid.ID) *Category

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

func (*CategoryClient) Hooks

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

Hooks returns the client hooks.

func (*CategoryClient) Query

func (c *CategoryClient) Query() *CategoryQuery

Query returns a query builder for Category.

func (*CategoryClient) QueryPosts

func (c *CategoryClient) QueryPosts(ca *Category) *PostQuery

QueryPosts queries the posts edge of a Category.

func (*CategoryClient) Update

func (c *CategoryClient) Update() *CategoryUpdate

Update returns an update builder for Category.

func (*CategoryClient) UpdateOne

func (c *CategoryClient) UpdateOne(ca *Category) *CategoryUpdateOne

UpdateOne returns an update builder for the given entity.

func (*CategoryClient) UpdateOneID

func (c *CategoryClient) UpdateOneID(id xid.ID) *CategoryUpdateOne

UpdateOneID returns an update builder for the given id.

func (*CategoryClient) Use

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

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

type CategoryCreate

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

CategoryCreate is the builder for creating a Category entity.

func (*CategoryCreate) AddPostIDs

func (cc *CategoryCreate) AddPostIDs(ids ...xid.ID) *CategoryCreate

AddPostIDs adds the "posts" edge to the Post entity by IDs.

func (*CategoryCreate) AddPosts

func (cc *CategoryCreate) AddPosts(p ...*Post) *CategoryCreate

AddPosts adds the "posts" edges to the Post entity.

func (*CategoryCreate) Exec

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

Exec executes the query.

func (*CategoryCreate) ExecX

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

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

func (*CategoryCreate) Mutation

func (cc *CategoryCreate) Mutation() *CategoryMutation

Mutation returns the CategoryMutation object of the builder.

func (*CategoryCreate) OnConflict

func (cc *CategoryCreate) OnConflict(opts ...sql.ConflictOption) *CategoryUpsertOne

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

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

func (*CategoryCreate) OnConflictColumns

func (cc *CategoryCreate) OnConflictColumns(columns ...string) *CategoryUpsertOne

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

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

func (*CategoryCreate) Save

func (cc *CategoryCreate) Save(ctx context.Context) (*Category, error)

Save creates the Category in the database.

func (*CategoryCreate) SaveX

func (cc *CategoryCreate) SaveX(ctx context.Context) *Category

SaveX calls Save and panics if Save returns an error.

func (*CategoryCreate) SetAdmin

func (cc *CategoryCreate) SetAdmin(b bool) *CategoryCreate

SetAdmin sets the "admin" field.

func (*CategoryCreate) SetColour

func (cc *CategoryCreate) SetColour(s string) *CategoryCreate

SetColour sets the "colour" field.

func (*CategoryCreate) SetCreatedAt

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

SetCreatedAt sets the "created_at" field.

func (*CategoryCreate) SetDescription

func (cc *CategoryCreate) SetDescription(s string) *CategoryCreate

SetDescription sets the "description" field.

func (*CategoryCreate) SetID

func (cc *CategoryCreate) SetID(x xid.ID) *CategoryCreate

SetID sets the "id" field.

func (*CategoryCreate) SetName

func (cc *CategoryCreate) SetName(s string) *CategoryCreate

SetName sets the "name" field.

func (*CategoryCreate) SetNillableAdmin

func (cc *CategoryCreate) SetNillableAdmin(b *bool) *CategoryCreate

SetNillableAdmin sets the "admin" field if the given value is not nil.

func (*CategoryCreate) SetNillableColour

func (cc *CategoryCreate) SetNillableColour(s *string) *CategoryCreate

SetNillableColour sets the "colour" field if the given value is not nil.

func (*CategoryCreate) SetNillableCreatedAt

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

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

func (*CategoryCreate) SetNillableDescription

func (cc *CategoryCreate) SetNillableDescription(s *string) *CategoryCreate

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

func (*CategoryCreate) SetNillableID

func (cc *CategoryCreate) SetNillableID(x *xid.ID) *CategoryCreate

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

func (*CategoryCreate) SetNillableSort

func (cc *CategoryCreate) SetNillableSort(i *int) *CategoryCreate

SetNillableSort sets the "sort" field if the given value is not nil.

func (*CategoryCreate) SetNillableUpdatedAt

func (cc *CategoryCreate) SetNillableUpdatedAt(t *time.Time) *CategoryCreate

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

func (*CategoryCreate) SetSort

func (cc *CategoryCreate) SetSort(i int) *CategoryCreate

SetSort sets the "sort" field.

func (*CategoryCreate) SetUpdatedAt

func (cc *CategoryCreate) SetUpdatedAt(t time.Time) *CategoryCreate

SetUpdatedAt sets the "updated_at" field.

type CategoryCreateBulk

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

CategoryCreateBulk is the builder for creating many Category entities in bulk.

func (*CategoryCreateBulk) Exec

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

Exec executes the query.

func (*CategoryCreateBulk) ExecX

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

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

func (*CategoryCreateBulk) OnConflict

func (ccb *CategoryCreateBulk) OnConflict(opts ...sql.ConflictOption) *CategoryUpsertBulk

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

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

func (*CategoryCreateBulk) OnConflictColumns

func (ccb *CategoryCreateBulk) OnConflictColumns(columns ...string) *CategoryUpsertBulk

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

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

func (*CategoryCreateBulk) Save

func (ccb *CategoryCreateBulk) Save(ctx context.Context) ([]*Category, error)

Save creates the Category entities in the database.

func (*CategoryCreateBulk) SaveX

func (ccb *CategoryCreateBulk) SaveX(ctx context.Context) []*Category

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

type CategoryDelete

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

CategoryDelete is the builder for deleting a Category entity.

func (*CategoryDelete) Exec

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

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

func (*CategoryDelete) ExecX

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

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

func (*CategoryDelete) Where

func (cd *CategoryDelete) Where(ps ...predicate.Category) *CategoryDelete

Where appends a list predicates to the CategoryDelete builder.

type CategoryDeleteOne

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

CategoryDeleteOne is the builder for deleting a single Category entity.

func (*CategoryDeleteOne) Exec

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

Exec executes the deletion query.

func (*CategoryDeleteOne) ExecX

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

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

type CategoryEdges

type CategoryEdges struct {
	// Posts holds the value of the posts edge.
	Posts []*Post `json:"posts,omitempty"`
	// contains filtered or unexported fields
}

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

func (CategoryEdges) PostsOrErr

func (e CategoryEdges) PostsOrErr() ([]*Post, error)

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

type CategoryGroupBy

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

CategoryGroupBy is the group-by builder for Category entities.

func (*CategoryGroupBy) Aggregate

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

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

func (*CategoryGroupBy) Bool

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

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

func (*CategoryGroupBy) BoolX

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

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

func (*CategoryGroupBy) Bools

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

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

func (*CategoryGroupBy) BoolsX

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

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

func (*CategoryGroupBy) Float64

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

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

func (*CategoryGroupBy) Float64X

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

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

func (*CategoryGroupBy) Float64s

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

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

func (*CategoryGroupBy) Float64sX

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

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

func (*CategoryGroupBy) Int

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

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

func (*CategoryGroupBy) IntX

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

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

func (*CategoryGroupBy) Ints

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

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

func (*CategoryGroupBy) IntsX

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

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

func (*CategoryGroupBy) Scan

func (cgb *CategoryGroupBy) Scan(ctx context.Context, v interface{}) error

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

func (*CategoryGroupBy) ScanX

func (s *CategoryGroupBy) ScanX(ctx context.Context, v interface{})

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

func (*CategoryGroupBy) String

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

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

func (*CategoryGroupBy) StringX

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

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

func (*CategoryGroupBy) Strings

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

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

func (*CategoryGroupBy) StringsX

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

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

type CategoryMutation

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

CategoryMutation represents an operation that mutates the Category nodes in the graph.

func (*CategoryMutation) AddField

func (m *CategoryMutation) 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 (*CategoryMutation) AddPostIDs

func (m *CategoryMutation) AddPostIDs(ids ...xid.ID)

AddPostIDs adds the "posts" edge to the Post entity by ids.

func (*CategoryMutation) AddSort

func (m *CategoryMutation) AddSort(i int)

AddSort adds i to the "sort" field.

func (*CategoryMutation) AddedEdges

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

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

func (*CategoryMutation) AddedField

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

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

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

func (*CategoryMutation) AddedIDs

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

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

func (*CategoryMutation) AddedSort

func (m *CategoryMutation) AddedSort() (r int, exists bool)

AddedSort returns the value that was added to the "sort" field in this mutation.

func (*CategoryMutation) Admin

func (m *CategoryMutation) Admin() (r bool, exists bool)

Admin returns the value of the "admin" field in the mutation.

func (*CategoryMutation) ClearEdge

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

func (m *CategoryMutation) 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 (*CategoryMutation) ClearPosts

func (m *CategoryMutation) ClearPosts()

ClearPosts clears the "posts" edge to the Post entity.

func (*CategoryMutation) ClearedEdges

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

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

func (*CategoryMutation) ClearedFields

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

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

func (CategoryMutation) Client

func (m CategoryMutation) 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 (*CategoryMutation) Colour

func (m *CategoryMutation) Colour() (r string, exists bool)

Colour returns the value of the "colour" field in the mutation.

func (*CategoryMutation) CreatedAt

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

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

func (*CategoryMutation) Description

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

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

func (*CategoryMutation) EdgeCleared

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

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

func (*CategoryMutation) Field

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

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

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

func (*CategoryMutation) Fields

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

func (m *CategoryMutation) ID() (id xid.ID, 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 (*CategoryMutation) IDs

func (m *CategoryMutation) IDs(ctx context.Context) ([]xid.ID, 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 (*CategoryMutation) Name

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

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

func (*CategoryMutation) OldAdmin

func (m *CategoryMutation) OldAdmin(ctx context.Context) (v bool, err error)

OldAdmin returns the old "admin" field's value of the Category entity. If the Category 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 (*CategoryMutation) OldColour

func (m *CategoryMutation) OldColour(ctx context.Context) (v string, err error)

OldColour returns the old "colour" field's value of the Category entity. If the Category 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 (*CategoryMutation) OldCreatedAt

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

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

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

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

func (m *CategoryMutation) 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 (*CategoryMutation) OldName

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

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

func (m *CategoryMutation) OldSort(ctx context.Context) (v int, err error)

OldSort returns the old "sort" field's value of the Category entity. If the Category 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 (*CategoryMutation) OldUpdatedAt

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

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

func (m *CategoryMutation) Op() Op

Op returns the operation name.

func (*CategoryMutation) PostsCleared

func (m *CategoryMutation) PostsCleared() bool

PostsCleared reports if the "posts" edge to the Post entity was cleared.

func (*CategoryMutation) PostsIDs

func (m *CategoryMutation) PostsIDs() (ids []xid.ID)

PostsIDs returns the "posts" edge IDs in the mutation.

func (*CategoryMutation) RemovePostIDs

func (m *CategoryMutation) RemovePostIDs(ids ...xid.ID)

RemovePostIDs removes the "posts" edge to the Post entity by IDs.

func (*CategoryMutation) RemovedEdges

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

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

func (*CategoryMutation) RemovedIDs

func (m *CategoryMutation) 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 (*CategoryMutation) RemovedPostsIDs

func (m *CategoryMutation) RemovedPostsIDs() (ids []xid.ID)

RemovedPosts returns the removed IDs of the "posts" edge to the Post entity.

func (*CategoryMutation) ResetAdmin

func (m *CategoryMutation) ResetAdmin()

ResetAdmin resets all changes to the "admin" field.

func (*CategoryMutation) ResetColour

func (m *CategoryMutation) ResetColour()

ResetColour resets all changes to the "colour" field.

func (*CategoryMutation) ResetCreatedAt

func (m *CategoryMutation) ResetCreatedAt()

ResetCreatedAt resets all changes to the "created_at" field.

func (*CategoryMutation) ResetDescription

func (m *CategoryMutation) ResetDescription()

ResetDescription resets all changes to the "description" field.

func (*CategoryMutation) ResetEdge

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

func (m *CategoryMutation) 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 (*CategoryMutation) ResetName

func (m *CategoryMutation) ResetName()

ResetName resets all changes to the "name" field.

func (*CategoryMutation) ResetPosts

func (m *CategoryMutation) ResetPosts()

ResetPosts resets all changes to the "posts" edge.

func (*CategoryMutation) ResetSort

func (m *CategoryMutation) ResetSort()

ResetSort resets all changes to the "sort" field.

func (*CategoryMutation) ResetUpdatedAt

func (m *CategoryMutation) ResetUpdatedAt()

ResetUpdatedAt resets all changes to the "updated_at" field.

func (*CategoryMutation) SetAdmin

func (m *CategoryMutation) SetAdmin(b bool)

SetAdmin sets the "admin" field.

func (*CategoryMutation) SetColour

func (m *CategoryMutation) SetColour(s string)

SetColour sets the "colour" field.

func (*CategoryMutation) SetCreatedAt

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

SetCreatedAt sets the "created_at" field.

func (*CategoryMutation) SetDescription

func (m *CategoryMutation) SetDescription(s string)

SetDescription sets the "description" field.

func (*CategoryMutation) SetField

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

func (m *CategoryMutation) SetID(id xid.ID)

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

func (*CategoryMutation) SetName

func (m *CategoryMutation) SetName(s string)

SetName sets the "name" field.

func (*CategoryMutation) SetSort

func (m *CategoryMutation) SetSort(i int)

SetSort sets the "sort" field.

func (*CategoryMutation) SetUpdatedAt

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

SetUpdatedAt sets the "updated_at" field.

func (*CategoryMutation) Sort

func (m *CategoryMutation) Sort() (r int, exists bool)

Sort returns the value of the "sort" field in the mutation.

func (CategoryMutation) Tx

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

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

func (*CategoryMutation) Type

func (m *CategoryMutation) Type() string

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

func (*CategoryMutation) UpdatedAt

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

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

func (*CategoryMutation) Where

func (m *CategoryMutation) Where(ps ...predicate.Category)

Where appends a list predicates to the CategoryMutation builder.

type CategoryQuery

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

CategoryQuery is the builder for querying Category entities.

func (*CategoryQuery) All

func (cq *CategoryQuery) All(ctx context.Context) ([]*Category, error)

All executes the query and returns a list of Categories.

func (*CategoryQuery) AllX

func (cq *CategoryQuery) AllX(ctx context.Context) []*Category

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

func (*CategoryQuery) Clone

func (cq *CategoryQuery) Clone() *CategoryQuery

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

func (*CategoryQuery) Count

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

Count returns the count of the given query.

func (*CategoryQuery) CountX

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

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

func (*CategoryQuery) Exist

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

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

func (*CategoryQuery) ExistX

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

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

func (*CategoryQuery) First

func (cq *CategoryQuery) First(ctx context.Context) (*Category, error)

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

func (*CategoryQuery) FirstID

func (cq *CategoryQuery) FirstID(ctx context.Context) (id xid.ID, err error)

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

func (*CategoryQuery) FirstIDX

func (cq *CategoryQuery) FirstIDX(ctx context.Context) xid.ID

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

func (*CategoryQuery) FirstX

func (cq *CategoryQuery) FirstX(ctx context.Context) *Category

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

func (*CategoryQuery) GroupBy

func (cq *CategoryQuery) GroupBy(field string, fields ...string) *CategoryGroupBy

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 {
	CreatedAt time.Time `json:"created_at,omitempty"`
	Count int `json:"count,omitempty"`
}

client.Category.Query().
	GroupBy(category.FieldCreatedAt).
	Aggregate(model.Count()).
	Scan(ctx, &v)

func (*CategoryQuery) IDs

func (cq *CategoryQuery) IDs(ctx context.Context) ([]xid.ID, error)

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

func (*CategoryQuery) IDsX

func (cq *CategoryQuery) IDsX(ctx context.Context) []xid.ID

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

func (*CategoryQuery) Limit

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

Limit adds a limit step to the query.

func (*CategoryQuery) Modify

func (cq *CategoryQuery) Modify(modifiers ...func(s *sql.Selector)) *CategorySelect

Modify adds a query modifier for attaching custom logic to queries.

func (*CategoryQuery) Offset

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

Offset adds an offset step to the query.

func (*CategoryQuery) Only

func (cq *CategoryQuery) Only(ctx context.Context) (*Category, error)

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

func (*CategoryQuery) OnlyID

func (cq *CategoryQuery) OnlyID(ctx context.Context) (id xid.ID, err error)

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

func (*CategoryQuery) OnlyIDX

func (cq *CategoryQuery) OnlyIDX(ctx context.Context) xid.ID

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

func (*CategoryQuery) OnlyX

func (cq *CategoryQuery) OnlyX(ctx context.Context) *Category

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

func (*CategoryQuery) Order

func (cq *CategoryQuery) Order(o ...OrderFunc) *CategoryQuery

Order adds an order step to the query.

func (*CategoryQuery) QueryPosts

func (cq *CategoryQuery) QueryPosts() *PostQuery

QueryPosts chains the current query on the "posts" edge.

func (*CategoryQuery) Select

func (cq *CategoryQuery) Select(fields ...string) *CategorySelect

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 {
	CreatedAt time.Time `json:"created_at,omitempty"`
}

client.Category.Query().
	Select(category.FieldCreatedAt).
	Scan(ctx, &v)

func (*CategoryQuery) Unique

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

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

func (cq *CategoryQuery) Where(ps ...predicate.Category) *CategoryQuery

Where adds a new predicate for the CategoryQuery builder.

func (*CategoryQuery) WithPosts

func (cq *CategoryQuery) WithPosts(opts ...func(*PostQuery)) *CategoryQuery

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

type CategorySelect

type CategorySelect struct {
	*CategoryQuery
	// contains filtered or unexported fields
}

CategorySelect is the builder for selecting fields of Category entities.

func (*CategorySelect) Bool

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

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

func (*CategorySelect) BoolX

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

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

func (*CategorySelect) Bools

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

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

func (*CategorySelect) BoolsX

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

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

func (*CategorySelect) Float64

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

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

func (*CategorySelect) Float64X

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

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

func (*CategorySelect) Float64s

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

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

func (*CategorySelect) Float64sX

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

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

func (*CategorySelect) Int

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

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

func (*CategorySelect) IntX

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

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

func (*CategorySelect) Ints

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

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

func (*CategorySelect) IntsX

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

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

func (*CategorySelect) Modify

func (cs *CategorySelect) Modify(modifiers ...func(s *sql.Selector)) *CategorySelect

Modify adds a query modifier for attaching custom logic to queries.

func (*CategorySelect) Scan

func (cs *CategorySelect) Scan(ctx context.Context, v interface{}) error

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

func (*CategorySelect) ScanX

func (s *CategorySelect) ScanX(ctx context.Context, v interface{})

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

func (*CategorySelect) String

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

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

func (*CategorySelect) StringX

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

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

func (*CategorySelect) Strings

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

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

func (*CategorySelect) StringsX

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

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

type CategoryUpdate

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

CategoryUpdate is the builder for updating Category entities.

func (*CategoryUpdate) AddPostIDs

func (cu *CategoryUpdate) AddPostIDs(ids ...xid.ID) *CategoryUpdate

AddPostIDs adds the "posts" edge to the Post entity by IDs.

func (*CategoryUpdate) AddPosts

func (cu *CategoryUpdate) AddPosts(p ...*Post) *CategoryUpdate

AddPosts adds the "posts" edges to the Post entity.

func (*CategoryUpdate) AddSort

func (cu *CategoryUpdate) AddSort(i int) *CategoryUpdate

AddSort adds i to the "sort" field.

func (*CategoryUpdate) ClearPosts

func (cu *CategoryUpdate) ClearPosts() *CategoryUpdate

ClearPosts clears all "posts" edges to the Post entity.

func (*CategoryUpdate) Exec

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

Exec executes the query.

func (*CategoryUpdate) ExecX

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

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

func (*CategoryUpdate) Modify

func (cu *CategoryUpdate) Modify(modifiers ...func(u *sql.UpdateBuilder)) *CategoryUpdate

Modify adds a statement modifier for attaching custom logic to the UPDATE statement.

func (*CategoryUpdate) Mutation

func (cu *CategoryUpdate) Mutation() *CategoryMutation

Mutation returns the CategoryMutation object of the builder.

func (*CategoryUpdate) RemovePostIDs

func (cu *CategoryUpdate) RemovePostIDs(ids ...xid.ID) *CategoryUpdate

RemovePostIDs removes the "posts" edge to Post entities by IDs.

func (*CategoryUpdate) RemovePosts

func (cu *CategoryUpdate) RemovePosts(p ...*Post) *CategoryUpdate

RemovePosts removes "posts" edges to Post entities.

func (*CategoryUpdate) Save

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

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

func (*CategoryUpdate) SaveX

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

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

func (*CategoryUpdate) SetAdmin

func (cu *CategoryUpdate) SetAdmin(b bool) *CategoryUpdate

SetAdmin sets the "admin" field.

func (*CategoryUpdate) SetColour

func (cu *CategoryUpdate) SetColour(s string) *CategoryUpdate

SetColour sets the "colour" field.

func (*CategoryUpdate) SetDescription

func (cu *CategoryUpdate) SetDescription(s string) *CategoryUpdate

SetDescription sets the "description" field.

func (*CategoryUpdate) SetName

func (cu *CategoryUpdate) SetName(s string) *CategoryUpdate

SetName sets the "name" field.

func (*CategoryUpdate) SetNillableAdmin

func (cu *CategoryUpdate) SetNillableAdmin(b *bool) *CategoryUpdate

SetNillableAdmin sets the "admin" field if the given value is not nil.

func (*CategoryUpdate) SetNillableColour

func (cu *CategoryUpdate) SetNillableColour(s *string) *CategoryUpdate

SetNillableColour sets the "colour" field if the given value is not nil.

func (*CategoryUpdate) SetNillableDescription

func (cu *CategoryUpdate) SetNillableDescription(s *string) *CategoryUpdate

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

func (*CategoryUpdate) SetNillableSort

func (cu *CategoryUpdate) SetNillableSort(i *int) *CategoryUpdate

SetNillableSort sets the "sort" field if the given value is not nil.

func (*CategoryUpdate) SetSort

func (cu *CategoryUpdate) SetSort(i int) *CategoryUpdate

SetSort sets the "sort" field.

func (*CategoryUpdate) SetUpdatedAt

func (cu *CategoryUpdate) SetUpdatedAt(t time.Time) *CategoryUpdate

SetUpdatedAt sets the "updated_at" field.

func (*CategoryUpdate) Where

func (cu *CategoryUpdate) Where(ps ...predicate.Category) *CategoryUpdate

Where appends a list predicates to the CategoryUpdate builder.

type CategoryUpdateOne

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

CategoryUpdateOne is the builder for updating a single Category entity.

func (*CategoryUpdateOne) AddPostIDs

func (cuo *CategoryUpdateOne) AddPostIDs(ids ...xid.ID) *CategoryUpdateOne

AddPostIDs adds the "posts" edge to the Post entity by IDs.

func (*CategoryUpdateOne) AddPosts

func (cuo *CategoryUpdateOne) AddPosts(p ...*Post) *CategoryUpdateOne

AddPosts adds the "posts" edges to the Post entity.

func (*CategoryUpdateOne) AddSort

func (cuo *CategoryUpdateOne) AddSort(i int) *CategoryUpdateOne

AddSort adds i to the "sort" field.

func (*CategoryUpdateOne) ClearPosts

func (cuo *CategoryUpdateOne) ClearPosts() *CategoryUpdateOne

ClearPosts clears all "posts" edges to the Post entity.

func (*CategoryUpdateOne) Exec

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

Exec executes the query on the entity.

func (*CategoryUpdateOne) ExecX

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

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

func (*CategoryUpdateOne) Modify

func (cuo *CategoryUpdateOne) Modify(modifiers ...func(u *sql.UpdateBuilder)) *CategoryUpdateOne

Modify adds a statement modifier for attaching custom logic to the UPDATE statement.

func (*CategoryUpdateOne) Mutation

func (cuo *CategoryUpdateOne) Mutation() *CategoryMutation

Mutation returns the CategoryMutation object of the builder.

func (*CategoryUpdateOne) RemovePostIDs

func (cuo *CategoryUpdateOne) RemovePostIDs(ids ...xid.ID) *CategoryUpdateOne

RemovePostIDs removes the "posts" edge to Post entities by IDs.

func (*CategoryUpdateOne) RemovePosts

func (cuo *CategoryUpdateOne) RemovePosts(p ...*Post) *CategoryUpdateOne

RemovePosts removes "posts" edges to Post entities.

func (*CategoryUpdateOne) Save

func (cuo *CategoryUpdateOne) Save(ctx context.Context) (*Category, error)

Save executes the query and returns the updated Category entity.

func (*CategoryUpdateOne) SaveX

func (cuo *CategoryUpdateOne) SaveX(ctx context.Context) *Category

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

func (*CategoryUpdateOne) Select

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

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

func (*CategoryUpdateOne) SetAdmin

func (cuo *CategoryUpdateOne) SetAdmin(b bool) *CategoryUpdateOne

SetAdmin sets the "admin" field.

func (*CategoryUpdateOne) SetColour

func (cuo *CategoryUpdateOne) SetColour(s string) *CategoryUpdateOne

SetColour sets the "colour" field.

func (*CategoryUpdateOne) SetDescription

func (cuo *CategoryUpdateOne) SetDescription(s string) *CategoryUpdateOne

SetDescription sets the "description" field.

func (*CategoryUpdateOne) SetName

func (cuo *CategoryUpdateOne) SetName(s string) *CategoryUpdateOne

SetName sets the "name" field.

func (*CategoryUpdateOne) SetNillableAdmin

func (cuo *CategoryUpdateOne) SetNillableAdmin(b *bool) *CategoryUpdateOne

SetNillableAdmin sets the "admin" field if the given value is not nil.

func (*CategoryUpdateOne) SetNillableColour

func (cuo *CategoryUpdateOne) SetNillableColour(s *string) *CategoryUpdateOne

SetNillableColour sets the "colour" field if the given value is not nil.

func (*CategoryUpdateOne) SetNillableDescription

func (cuo *CategoryUpdateOne) SetNillableDescription(s *string) *CategoryUpdateOne

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

func (*CategoryUpdateOne) SetNillableSort

func (cuo *CategoryUpdateOne) SetNillableSort(i *int) *CategoryUpdateOne

SetNillableSort sets the "sort" field if the given value is not nil.

func (*CategoryUpdateOne) SetSort

func (cuo *CategoryUpdateOne) SetSort(i int) *CategoryUpdateOne

SetSort sets the "sort" field.

func (*CategoryUpdateOne) SetUpdatedAt

func (cuo *CategoryUpdateOne) SetUpdatedAt(t time.Time) *CategoryUpdateOne

SetUpdatedAt sets the "updated_at" field.

type CategoryUpsert

type CategoryUpsert struct {
	*sql.UpdateSet
}

CategoryUpsert is the "OnConflict" setter.

func (*CategoryUpsert) AddSort

func (u *CategoryUpsert) AddSort(v int) *CategoryUpsert

AddSort adds v to the "sort" field.

func (*CategoryUpsert) SetAdmin

func (u *CategoryUpsert) SetAdmin(v bool) *CategoryUpsert

SetAdmin sets the "admin" field.

func (*CategoryUpsert) SetColour

func (u *CategoryUpsert) SetColour(v string) *CategoryUpsert

SetColour sets the "colour" field.

func (*CategoryUpsert) SetCreatedAt

func (u *CategoryUpsert) SetCreatedAt(v time.Time) *CategoryUpsert

SetCreatedAt sets the "created_at" field.

func (*CategoryUpsert) SetDescription

func (u *CategoryUpsert) SetDescription(v string) *CategoryUpsert

SetDescription sets the "description" field.

func (*CategoryUpsert) SetName

func (u *CategoryUpsert) SetName(v string) *CategoryUpsert

SetName sets the "name" field.

func (*CategoryUpsert) SetSort

func (u *CategoryUpsert) SetSort(v int) *CategoryUpsert

SetSort sets the "sort" field.

func (*CategoryUpsert) SetUpdatedAt

func (u *CategoryUpsert) SetUpdatedAt(v time.Time) *CategoryUpsert

SetUpdatedAt sets the "updated_at" field.

func (*CategoryUpsert) UpdateAdmin

func (u *CategoryUpsert) UpdateAdmin() *CategoryUpsert

UpdateAdmin sets the "admin" field to the value that was provided on create.

func (*CategoryUpsert) UpdateColour

func (u *CategoryUpsert) UpdateColour() *CategoryUpsert

UpdateColour sets the "colour" field to the value that was provided on create.

func (*CategoryUpsert) UpdateCreatedAt

func (u *CategoryUpsert) UpdateCreatedAt() *CategoryUpsert

UpdateCreatedAt sets the "created_at" field to the value that was provided on create.

func (*CategoryUpsert) UpdateDescription

func (u *CategoryUpsert) UpdateDescription() *CategoryUpsert

UpdateDescription sets the "description" field to the value that was provided on create.

func (*CategoryUpsert) UpdateName

func (u *CategoryUpsert) UpdateName() *CategoryUpsert

UpdateName sets the "name" field to the value that was provided on create.

func (*CategoryUpsert) UpdateSort

func (u *CategoryUpsert) UpdateSort() *CategoryUpsert

UpdateSort sets the "sort" field to the value that was provided on create.

func (*CategoryUpsert) UpdateUpdatedAt

func (u *CategoryUpsert) UpdateUpdatedAt() *CategoryUpsert

UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create.

type CategoryUpsertBulk

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

CategoryUpsertBulk is the builder for "upsert"-ing a bulk of Category nodes.

func (*CategoryUpsertBulk) AddSort

func (u *CategoryUpsertBulk) AddSort(v int) *CategoryUpsertBulk

AddSort adds v to the "sort" field.

func (*CategoryUpsertBulk) DoNothing

func (u *CategoryUpsertBulk) DoNothing() *CategoryUpsertBulk

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

func (*CategoryUpsertBulk) Exec

func (u *CategoryUpsertBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*CategoryUpsertBulk) ExecX

func (u *CategoryUpsertBulk) ExecX(ctx context.Context)

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

func (*CategoryUpsertBulk) Ignore

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

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

func (*CategoryUpsertBulk) SetAdmin

func (u *CategoryUpsertBulk) SetAdmin(v bool) *CategoryUpsertBulk

SetAdmin sets the "admin" field.

func (*CategoryUpsertBulk) SetColour

func (u *CategoryUpsertBulk) SetColour(v string) *CategoryUpsertBulk

SetColour sets the "colour" field.

func (*CategoryUpsertBulk) SetCreatedAt

func (u *CategoryUpsertBulk) SetCreatedAt(v time.Time) *CategoryUpsertBulk

SetCreatedAt sets the "created_at" field.

func (*CategoryUpsertBulk) SetDescription

func (u *CategoryUpsertBulk) SetDescription(v string) *CategoryUpsertBulk

SetDescription sets the "description" field.

func (*CategoryUpsertBulk) SetName

SetName sets the "name" field.

func (*CategoryUpsertBulk) SetSort

func (u *CategoryUpsertBulk) SetSort(v int) *CategoryUpsertBulk

SetSort sets the "sort" field.

func (*CategoryUpsertBulk) SetUpdatedAt

func (u *CategoryUpsertBulk) SetUpdatedAt(v time.Time) *CategoryUpsertBulk

SetUpdatedAt sets the "updated_at" field.

func (*CategoryUpsertBulk) Update

func (u *CategoryUpsertBulk) Update(set func(*CategoryUpsert)) *CategoryUpsertBulk

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

func (*CategoryUpsertBulk) UpdateAdmin

func (u *CategoryUpsertBulk) UpdateAdmin() *CategoryUpsertBulk

UpdateAdmin sets the "admin" field to the value that was provided on create.

func (*CategoryUpsertBulk) UpdateColour

func (u *CategoryUpsertBulk) UpdateColour() *CategoryUpsertBulk

UpdateColour sets the "colour" field to the value that was provided on create.

func (*CategoryUpsertBulk) UpdateCreatedAt

func (u *CategoryUpsertBulk) UpdateCreatedAt() *CategoryUpsertBulk

UpdateCreatedAt sets the "created_at" field to the value that was provided on create.

func (*CategoryUpsertBulk) UpdateDescription

func (u *CategoryUpsertBulk) UpdateDescription() *CategoryUpsertBulk

UpdateDescription sets the "description" field to the value that was provided on create.

func (*CategoryUpsertBulk) UpdateName

func (u *CategoryUpsertBulk) UpdateName() *CategoryUpsertBulk

UpdateName sets the "name" field to the value that was provided on create.

func (*CategoryUpsertBulk) UpdateNewValues

func (u *CategoryUpsertBulk) UpdateNewValues() *CategoryUpsertBulk

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

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

func (*CategoryUpsertBulk) UpdateSort

func (u *CategoryUpsertBulk) UpdateSort() *CategoryUpsertBulk

UpdateSort sets the "sort" field to the value that was provided on create.

func (*CategoryUpsertBulk) UpdateUpdatedAt

func (u *CategoryUpsertBulk) UpdateUpdatedAt() *CategoryUpsertBulk

UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create.

type CategoryUpsertOne

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

CategoryUpsertOne is the builder for "upsert"-ing

one Category node.

func (*CategoryUpsertOne) AddSort

func (u *CategoryUpsertOne) AddSort(v int) *CategoryUpsertOne

AddSort adds v to the "sort" field.

func (*CategoryUpsertOne) DoNothing

func (u *CategoryUpsertOne) DoNothing() *CategoryUpsertOne

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

func (*CategoryUpsertOne) Exec

func (u *CategoryUpsertOne) Exec(ctx context.Context) error

Exec executes the query.

func (*CategoryUpsertOne) ExecX

func (u *CategoryUpsertOne) ExecX(ctx context.Context)

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

func (*CategoryUpsertOne) ID

func (u *CategoryUpsertOne) ID(ctx context.Context) (id xid.ID, err error)

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

func (*CategoryUpsertOne) IDX

func (u *CategoryUpsertOne) IDX(ctx context.Context) xid.ID

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

func (*CategoryUpsertOne) Ignore

func (u *CategoryUpsertOne) Ignore() *CategoryUpsertOne

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

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

func (*CategoryUpsertOne) SetAdmin

func (u *CategoryUpsertOne) SetAdmin(v bool) *CategoryUpsertOne

SetAdmin sets the "admin" field.

func (*CategoryUpsertOne) SetColour

func (u *CategoryUpsertOne) SetColour(v string) *CategoryUpsertOne

SetColour sets the "colour" field.

func (*CategoryUpsertOne) SetCreatedAt

func (u *CategoryUpsertOne) SetCreatedAt(v time.Time) *CategoryUpsertOne

SetCreatedAt sets the "created_at" field.

func (*CategoryUpsertOne) SetDescription

func (u *CategoryUpsertOne) SetDescription(v string) *CategoryUpsertOne

SetDescription sets the "description" field.

func (*CategoryUpsertOne) SetName

SetName sets the "name" field.

func (*CategoryUpsertOne) SetSort

func (u *CategoryUpsertOne) SetSort(v int) *CategoryUpsertOne

SetSort sets the "sort" field.

func (*CategoryUpsertOne) SetUpdatedAt

func (u *CategoryUpsertOne) SetUpdatedAt(v time.Time) *CategoryUpsertOne

SetUpdatedAt sets the "updated_at" field.

func (*CategoryUpsertOne) Update

func (u *CategoryUpsertOne) Update(set func(*CategoryUpsert)) *CategoryUpsertOne

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

func (*CategoryUpsertOne) UpdateAdmin

func (u *CategoryUpsertOne) UpdateAdmin() *CategoryUpsertOne

UpdateAdmin sets the "admin" field to the value that was provided on create.

func (*CategoryUpsertOne) UpdateColour

func (u *CategoryUpsertOne) UpdateColour() *CategoryUpsertOne

UpdateColour sets the "colour" field to the value that was provided on create.

func (*CategoryUpsertOne) UpdateCreatedAt

func (u *CategoryUpsertOne) UpdateCreatedAt() *CategoryUpsertOne

UpdateCreatedAt sets the "created_at" field to the value that was provided on create.

func (*CategoryUpsertOne) UpdateDescription

func (u *CategoryUpsertOne) UpdateDescription() *CategoryUpsertOne

UpdateDescription sets the "description" field to the value that was provided on create.

func (*CategoryUpsertOne) UpdateName

func (u *CategoryUpsertOne) UpdateName() *CategoryUpsertOne

UpdateName sets the "name" field to the value that was provided on create.

func (*CategoryUpsertOne) UpdateNewValues

func (u *CategoryUpsertOne) UpdateNewValues() *CategoryUpsertOne

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

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

func (*CategoryUpsertOne) UpdateSort

func (u *CategoryUpsertOne) UpdateSort() *CategoryUpsertOne

UpdateSort sets the "sort" field to the value that was provided on create.

func (*CategoryUpsertOne) UpdateUpdatedAt

func (u *CategoryUpsertOne) UpdateUpdatedAt() *CategoryUpsertOne

UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create.

type Client

type Client struct {

	// Schema is the client for creating, migrating and dropping schema.
	Schema *migrate.Schema
	// Account is the client for interacting with the Account builders.
	Account *AccountClient
	// Authentication is the client for interacting with the Authentication builders.
	Authentication *AuthenticationClient
	// Category is the client for interacting with the Category builders.
	Category *CategoryClient
	// Notification is the client for interacting with the Notification builders.
	Notification *NotificationClient
	// Post is the client for interacting with the Post builders.
	Post *PostClient
	// React is the client for interacting with the React builders.
	React *ReactClient
	// Role is the client for interacting with the Role builders.
	Role *RoleClient
	// Subscription is the client for interacting with the Subscription builders.
	Subscription *SubscriptionClient
	// Tag is the client for interacting with the Tag builders.
	Tag *TagClient
	// 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().
	Account.
	Query().
	Count(ctx)

func (*Client) Tx

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

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

func (*Client) Use

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

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

type CommitFunc

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

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

func (CommitFunc) Commit

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

Commit calls f(ctx, m).

type CommitHook

type CommitHook func(Committer) Committer

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

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

type Committer

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

Committer is the interface that wraps the Commit method.

type ConstraintError

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

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

func (ConstraintError) Error

func (e ConstraintError) Error() string

Error implements the error interface.

func (*ConstraintError) Unwrap

func (e *ConstraintError) Unwrap() error

Unwrap implements the errors.Wrapper interface.

type Hook

type Hook = ent.Hook

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

type MutateFunc

type MutateFunc = ent.MutateFunc

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

type Mutation

type Mutation = ent.Mutation

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

type Mutator

type Mutator = ent.Mutator

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

type NotFoundError

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

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

func (*NotFoundError) Error

func (e *NotFoundError) Error() string

Error implements the error interface.

type NotLoadedError

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

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

func (*NotLoadedError) Error

func (e *NotLoadedError) Error() string

Error implements the error interface.

type NotSingularError

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

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

func (*NotSingularError) Error

func (e *NotSingularError) Error() string

Error implements the error interface.

type Notification

type Notification struct {

	// ID of the ent.
	ID xid.ID `json:"id,omitempty"`
	// CreatedAt holds the value of the "created_at" field.
	CreatedAt time.Time `json:"created_at,omitempty"`
	// Title holds the value of the "title" field.
	Title string `json:"title,omitempty"`
	// Description holds the value of the "description" field.
	Description string `json:"description,omitempty"`
	// Link holds the value of the "link" field.
	Link string `json:"link,omitempty"`
	// Read holds the value of the "read" field.
	Read bool `json:"read,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the NotificationQuery when eager-loading is set.
	Edges NotificationEdges `json:"edges"`
	// contains filtered or unexported fields
}

Notification is the model entity for the Notification schema.

func (*Notification) QuerySubscription

func (n *Notification) QuerySubscription() *SubscriptionQuery

QuerySubscription queries the "subscription" edge of the Notification entity.

func (*Notification) String

func (n *Notification) String() string

String implements the fmt.Stringer.

func (*Notification) Unwrap

func (n *Notification) Unwrap() *Notification

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

func (n *Notification) Update() *NotificationUpdateOne

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

type NotificationClient

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

NotificationClient is a client for the Notification schema.

func NewNotificationClient

func NewNotificationClient(c config) *NotificationClient

NewNotificationClient returns a client for the Notification from the given config.

func (*NotificationClient) Create

Create returns a builder for creating a Notification entity.

func (*NotificationClient) CreateBulk

func (c *NotificationClient) CreateBulk(builders ...*NotificationCreate) *NotificationCreateBulk

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

func (*NotificationClient) Delete

Delete returns a delete builder for Notification.

func (*NotificationClient) DeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*NotificationClient) DeleteOneID

func (c *NotificationClient) DeleteOneID(id xid.ID) *NotificationDeleteOne

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

func (*NotificationClient) Get

Get returns a Notification entity by its id.

func (*NotificationClient) GetX

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

func (*NotificationClient) Hooks

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

Hooks returns the client hooks.

func (*NotificationClient) Query

Query returns a query builder for Notification.

func (*NotificationClient) QuerySubscription

func (c *NotificationClient) QuerySubscription(n *Notification) *SubscriptionQuery

QuerySubscription queries the subscription edge of a Notification.

func (*NotificationClient) Update

Update returns an update builder for Notification.

func (*NotificationClient) UpdateOne

UpdateOne returns an update builder for the given entity.

func (*NotificationClient) UpdateOneID

func (c *NotificationClient) UpdateOneID(id xid.ID) *NotificationUpdateOne

UpdateOneID returns an update builder for the given id.

func (*NotificationClient) Use

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

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

type NotificationCreate

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

NotificationCreate is the builder for creating a Notification entity.

func (*NotificationCreate) Exec

func (nc *NotificationCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*NotificationCreate) ExecX

func (nc *NotificationCreate) ExecX(ctx context.Context)

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

func (*NotificationCreate) Mutation

func (nc *NotificationCreate) Mutation() *NotificationMutation

Mutation returns the NotificationMutation object of the builder.

func (*NotificationCreate) OnConflict

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

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

func (*NotificationCreate) OnConflictColumns

func (nc *NotificationCreate) OnConflictColumns(columns ...string) *NotificationUpsertOne

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

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

func (*NotificationCreate) Save

Save creates the Notification in the database.

func (*NotificationCreate) SaveX

SaveX calls Save and panics if Save returns an error.

func (*NotificationCreate) SetCreatedAt

func (nc *NotificationCreate) SetCreatedAt(t time.Time) *NotificationCreate

SetCreatedAt sets the "created_at" field.

func (*NotificationCreate) SetDescription

func (nc *NotificationCreate) SetDescription(s string) *NotificationCreate

SetDescription sets the "description" field.

func (*NotificationCreate) SetID

SetID sets the "id" field.

SetLink sets the "link" field.

func (*NotificationCreate) SetNillableCreatedAt

func (nc *NotificationCreate) SetNillableCreatedAt(t *time.Time) *NotificationCreate

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

func (*NotificationCreate) SetNillableID

func (nc *NotificationCreate) SetNillableID(x *xid.ID) *NotificationCreate

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

func (*NotificationCreate) SetNillableSubscriptionID

func (nc *NotificationCreate) SetNillableSubscriptionID(id *xid.ID) *NotificationCreate

SetNillableSubscriptionID sets the "subscription" edge to the Subscription entity by ID if the given value is not nil.

func (*NotificationCreate) SetRead

func (nc *NotificationCreate) SetRead(b bool) *NotificationCreate

SetRead sets the "read" field.

func (*NotificationCreate) SetSubscription

func (nc *NotificationCreate) SetSubscription(s *Subscription) *NotificationCreate

SetSubscription sets the "subscription" edge to the Subscription entity.

func (*NotificationCreate) SetSubscriptionID

func (nc *NotificationCreate) SetSubscriptionID(id xid.ID) *NotificationCreate

SetSubscriptionID sets the "subscription" edge to the Subscription entity by ID.

func (*NotificationCreate) SetTitle

func (nc *NotificationCreate) SetTitle(s string) *NotificationCreate

SetTitle sets the "title" field.

type NotificationCreateBulk

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

NotificationCreateBulk is the builder for creating many Notification entities in bulk.

func (*NotificationCreateBulk) Exec

Exec executes the query.

func (*NotificationCreateBulk) ExecX

func (ncb *NotificationCreateBulk) ExecX(ctx context.Context)

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

func (*NotificationCreateBulk) OnConflict

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

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

func (*NotificationCreateBulk) OnConflictColumns

func (ncb *NotificationCreateBulk) OnConflictColumns(columns ...string) *NotificationUpsertBulk

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

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

func (*NotificationCreateBulk) Save

Save creates the Notification entities in the database.

func (*NotificationCreateBulk) SaveX

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

type NotificationDelete

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

NotificationDelete is the builder for deleting a Notification entity.

func (*NotificationDelete) Exec

func (nd *NotificationDelete) Exec(ctx context.Context) (int, error)

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

func (*NotificationDelete) ExecX

func (nd *NotificationDelete) ExecX(ctx context.Context) int

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

func (*NotificationDelete) Where

Where appends a list predicates to the NotificationDelete builder.

type NotificationDeleteOne

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

NotificationDeleteOne is the builder for deleting a single Notification entity.

func (*NotificationDeleteOne) Exec

func (ndo *NotificationDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*NotificationDeleteOne) ExecX

func (ndo *NotificationDeleteOne) ExecX(ctx context.Context)

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

type NotificationEdges

type NotificationEdges struct {
	// Subscription holds the value of the subscription edge.
	Subscription *Subscription `json:"subscription,omitempty"`
	// contains filtered or unexported fields
}

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

func (NotificationEdges) SubscriptionOrErr

func (e NotificationEdges) SubscriptionOrErr() (*Subscription, error)

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

type NotificationGroupBy

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

NotificationGroupBy is the group-by builder for Notification entities.

func (*NotificationGroupBy) Aggregate

func (ngb *NotificationGroupBy) Aggregate(fns ...AggregateFunc) *NotificationGroupBy

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

func (*NotificationGroupBy) Bool

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

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

func (*NotificationGroupBy) BoolX

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

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

func (*NotificationGroupBy) Bools

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

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

func (*NotificationGroupBy) BoolsX

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

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

func (*NotificationGroupBy) Float64

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

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

func (*NotificationGroupBy) Float64X

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

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

func (*NotificationGroupBy) Float64s

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

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

func (*NotificationGroupBy) Float64sX

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

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

func (*NotificationGroupBy) Int

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

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

func (*NotificationGroupBy) IntX

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

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

func (*NotificationGroupBy) Ints

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

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

func (*NotificationGroupBy) IntsX

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

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

func (*NotificationGroupBy) Scan

func (ngb *NotificationGroupBy) Scan(ctx context.Context, v interface{}) error

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

func (*NotificationGroupBy) ScanX

func (s *NotificationGroupBy) ScanX(ctx context.Context, v interface{})

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

func (*NotificationGroupBy) String

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

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

func (*NotificationGroupBy) StringX

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

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

func (*NotificationGroupBy) Strings

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

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

func (*NotificationGroupBy) StringsX

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

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

type NotificationMutation

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

NotificationMutation represents an operation that mutates the Notification nodes in the graph.

func (*NotificationMutation) AddField

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

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

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

func (*NotificationMutation) AddedField

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

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

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

func (*NotificationMutation) AddedIDs

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

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

func (*NotificationMutation) ClearEdge

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

func (m *NotificationMutation) 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 (*NotificationMutation) ClearSubscription

func (m *NotificationMutation) ClearSubscription()

ClearSubscription clears the "subscription" edge to the Subscription entity.

func (*NotificationMutation) ClearedEdges

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

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

func (*NotificationMutation) ClearedFields

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

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

func (NotificationMutation) Client

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

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

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

func (*NotificationMutation) Description

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

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

func (*NotificationMutation) EdgeCleared

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

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

func (*NotificationMutation) Field

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

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

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

func (*NotificationMutation) Fields

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

func (m *NotificationMutation) ID() (id xid.ID, 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 (*NotificationMutation) IDs

func (m *NotificationMutation) IDs(ctx context.Context) ([]xid.ID, 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 (m *NotificationMutation) Link() (r string, exists bool)

Link returns the value of the "link" field in the mutation.

func (*NotificationMutation) OldCreatedAt

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

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

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

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

func (m *NotificationMutation) 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 (m *NotificationMutation) OldLink(ctx context.Context) (v string, err error)

OldLink returns the old "link" field's value of the Notification entity. If the Notification 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 (*NotificationMutation) OldRead

func (m *NotificationMutation) OldRead(ctx context.Context) (v bool, err error)

OldRead returns the old "read" field's value of the Notification entity. If the Notification 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 (*NotificationMutation) OldTitle

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

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

func (m *NotificationMutation) Op() Op

Op returns the operation name.

func (*NotificationMutation) Read

func (m *NotificationMutation) Read() (r bool, exists bool)

Read returns the value of the "read" field in the mutation.

func (*NotificationMutation) RemovedEdges

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

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

func (*NotificationMutation) RemovedIDs

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

func (m *NotificationMutation) ResetCreatedAt()

ResetCreatedAt resets all changes to the "created_at" field.

func (*NotificationMutation) ResetDescription

func (m *NotificationMutation) ResetDescription()

ResetDescription resets all changes to the "description" field.

func (*NotificationMutation) ResetEdge

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

func (m *NotificationMutation) 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 (m *NotificationMutation) ResetLink()

ResetLink resets all changes to the "link" field.

func (*NotificationMutation) ResetRead

func (m *NotificationMutation) ResetRead()

ResetRead resets all changes to the "read" field.

func (*NotificationMutation) ResetSubscription

func (m *NotificationMutation) ResetSubscription()

ResetSubscription resets all changes to the "subscription" edge.

func (*NotificationMutation) ResetTitle

func (m *NotificationMutation) ResetTitle()

ResetTitle resets all changes to the "title" field.

func (*NotificationMutation) SetCreatedAt

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

SetCreatedAt sets the "created_at" field.

func (*NotificationMutation) SetDescription

func (m *NotificationMutation) SetDescription(s string)

SetDescription sets the "description" field.

func (*NotificationMutation) SetField

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

func (m *NotificationMutation) SetID(id xid.ID)

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

func (m *NotificationMutation) SetLink(s string)

SetLink sets the "link" field.

func (*NotificationMutation) SetRead

func (m *NotificationMutation) SetRead(b bool)

SetRead sets the "read" field.

func (*NotificationMutation) SetSubscriptionID

func (m *NotificationMutation) SetSubscriptionID(id xid.ID)

SetSubscriptionID sets the "subscription" edge to the Subscription entity by id.

func (*NotificationMutation) SetTitle

func (m *NotificationMutation) SetTitle(s string)

SetTitle sets the "title" field.

func (*NotificationMutation) SubscriptionCleared

func (m *NotificationMutation) SubscriptionCleared() bool

SubscriptionCleared reports if the "subscription" edge to the Subscription entity was cleared.

func (*NotificationMutation) SubscriptionID

func (m *NotificationMutation) SubscriptionID() (id xid.ID, exists bool)

SubscriptionID returns the "subscription" edge ID in the mutation.

func (*NotificationMutation) SubscriptionIDs

func (m *NotificationMutation) SubscriptionIDs() (ids []xid.ID)

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

func (*NotificationMutation) Title

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

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

func (NotificationMutation) Tx

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

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

func (*NotificationMutation) Type

func (m *NotificationMutation) Type() string

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

func (*NotificationMutation) Where

Where appends a list predicates to the NotificationMutation builder.

type NotificationQuery

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

NotificationQuery is the builder for querying Notification entities.

func (*NotificationQuery) All

func (nq *NotificationQuery) All(ctx context.Context) ([]*Notification, error)

All executes the query and returns a list of Notifications.

func (*NotificationQuery) AllX

func (nq *NotificationQuery) AllX(ctx context.Context) []*Notification

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

func (*NotificationQuery) Clone

func (nq *NotificationQuery) Clone() *NotificationQuery

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

func (*NotificationQuery) Count

func (nq *NotificationQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*NotificationQuery) CountX

func (nq *NotificationQuery) CountX(ctx context.Context) int

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

func (*NotificationQuery) Exist

func (nq *NotificationQuery) Exist(ctx context.Context) (bool, error)

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

func (*NotificationQuery) ExistX

func (nq *NotificationQuery) ExistX(ctx context.Context) bool

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

func (*NotificationQuery) First

func (nq *NotificationQuery) First(ctx context.Context) (*Notification, error)

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

func (*NotificationQuery) FirstID

func (nq *NotificationQuery) FirstID(ctx context.Context) (id xid.ID, err error)

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

func (*NotificationQuery) FirstIDX

func (nq *NotificationQuery) FirstIDX(ctx context.Context) xid.ID

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

func (*NotificationQuery) FirstX

func (nq *NotificationQuery) FirstX(ctx context.Context) *Notification

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

func (*NotificationQuery) GroupBy

func (nq *NotificationQuery) GroupBy(field string, fields ...string) *NotificationGroupBy

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 {
	CreatedAt time.Time `json:"created_at,omitempty"`
	Count int `json:"count,omitempty"`
}

client.Notification.Query().
	GroupBy(notification.FieldCreatedAt).
	Aggregate(model.Count()).
	Scan(ctx, &v)

func (*NotificationQuery) IDs

func (nq *NotificationQuery) IDs(ctx context.Context) ([]xid.ID, error)

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

func (*NotificationQuery) IDsX

func (nq *NotificationQuery) IDsX(ctx context.Context) []xid.ID

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

func (*NotificationQuery) Limit

func (nq *NotificationQuery) Limit(limit int) *NotificationQuery

Limit adds a limit step to the query.

func (*NotificationQuery) Modify

func (nq *NotificationQuery) Modify(modifiers ...func(s *sql.Selector)) *NotificationSelect

Modify adds a query modifier for attaching custom logic to queries.

func (*NotificationQuery) Offset

func (nq *NotificationQuery) Offset(offset int) *NotificationQuery

Offset adds an offset step to the query.

func (*NotificationQuery) Only

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

func (*NotificationQuery) OnlyID

func (nq *NotificationQuery) OnlyID(ctx context.Context) (id xid.ID, err error)

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

func (*NotificationQuery) OnlyIDX

func (nq *NotificationQuery) OnlyIDX(ctx context.Context) xid.ID

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

func (*NotificationQuery) OnlyX

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

func (*NotificationQuery) Order

Order adds an order step to the query.

func (*NotificationQuery) QuerySubscription

func (nq *NotificationQuery) QuerySubscription() *SubscriptionQuery

QuerySubscription chains the current query on the "subscription" edge.

func (*NotificationQuery) Select

func (nq *NotificationQuery) Select(fields ...string) *NotificationSelect

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 {
	CreatedAt time.Time `json:"created_at,omitempty"`
}

client.Notification.Query().
	Select(notification.FieldCreatedAt).
	Scan(ctx, &v)

func (*NotificationQuery) Unique

func (nq *NotificationQuery) Unique(unique bool) *NotificationQuery

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

Where adds a new predicate for the NotificationQuery builder.

func (*NotificationQuery) WithSubscription

func (nq *NotificationQuery) WithSubscription(opts ...func(*SubscriptionQuery)) *NotificationQuery

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

type NotificationSelect

type NotificationSelect struct {
	*NotificationQuery
	// contains filtered or unexported fields
}

NotificationSelect is the builder for selecting fields of Notification entities.

func (*NotificationSelect) Bool

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

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

func (*NotificationSelect) BoolX

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

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

func (*NotificationSelect) Bools

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

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

func (*NotificationSelect) BoolsX

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

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

func (*NotificationSelect) Float64

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

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

func (*NotificationSelect) Float64X

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

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

func (*NotificationSelect) Float64s

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

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

func (*NotificationSelect) Float64sX

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

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

func (*NotificationSelect) Int

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

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

func (*NotificationSelect) IntX

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

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

func (*NotificationSelect) Ints

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

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

func (*NotificationSelect) IntsX

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

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

func (*NotificationSelect) Modify

func (ns *NotificationSelect) Modify(modifiers ...func(s *sql.Selector)) *NotificationSelect

Modify adds a query modifier for attaching custom logic to queries.

func (*NotificationSelect) Scan

func (ns *NotificationSelect) Scan(ctx context.Context, v interface{}) error

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

func (*NotificationSelect) ScanX

func (s *NotificationSelect) ScanX(ctx context.Context, v interface{})

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

func (*NotificationSelect) String

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

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

func (*NotificationSelect) StringX

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

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

func (*NotificationSelect) Strings

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

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

func (*NotificationSelect) StringsX

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

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

type NotificationUpdate

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

NotificationUpdate is the builder for updating Notification entities.

func (*NotificationUpdate) ClearSubscription

func (nu *NotificationUpdate) ClearSubscription() *NotificationUpdate

ClearSubscription clears the "subscription" edge to the Subscription entity.

func (*NotificationUpdate) Exec

func (nu *NotificationUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*NotificationUpdate) ExecX

func (nu *NotificationUpdate) ExecX(ctx context.Context)

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

func (*NotificationUpdate) Modify

func (nu *NotificationUpdate) Modify(modifiers ...func(u *sql.UpdateBuilder)) *NotificationUpdate

Modify adds a statement modifier for attaching custom logic to the UPDATE statement.

func (*NotificationUpdate) Mutation

func (nu *NotificationUpdate) Mutation() *NotificationMutation

Mutation returns the NotificationMutation object of the builder.

func (*NotificationUpdate) Save

func (nu *NotificationUpdate) Save(ctx context.Context) (int, error)

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

func (*NotificationUpdate) SaveX

func (nu *NotificationUpdate) SaveX(ctx context.Context) int

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

func (*NotificationUpdate) SetDescription

func (nu *NotificationUpdate) SetDescription(s string) *NotificationUpdate

SetDescription sets the "description" field.

SetLink sets the "link" field.

func (*NotificationUpdate) SetNillableSubscriptionID

func (nu *NotificationUpdate) SetNillableSubscriptionID(id *xid.ID) *NotificationUpdate

SetNillableSubscriptionID sets the "subscription" edge to the Subscription entity by ID if the given value is not nil.

func (*NotificationUpdate) SetRead

func (nu *NotificationUpdate) SetRead(b bool) *NotificationUpdate

SetRead sets the "read" field.

func (*NotificationUpdate) SetSubscription

func (nu *NotificationUpdate) SetSubscription(s *Subscription) *NotificationUpdate

SetSubscription sets the "subscription" edge to the Subscription entity.

func (*NotificationUpdate) SetSubscriptionID

func (nu *NotificationUpdate) SetSubscriptionID(id xid.ID) *NotificationUpdate

SetSubscriptionID sets the "subscription" edge to the Subscription entity by ID.

func (*NotificationUpdate) SetTitle

func (nu *NotificationUpdate) SetTitle(s string) *NotificationUpdate

SetTitle sets the "title" field.

func (*NotificationUpdate) Where

Where appends a list predicates to the NotificationUpdate builder.

type NotificationUpdateOne

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

NotificationUpdateOne is the builder for updating a single Notification entity.

func (*NotificationUpdateOne) ClearSubscription

func (nuo *NotificationUpdateOne) ClearSubscription() *NotificationUpdateOne

ClearSubscription clears the "subscription" edge to the Subscription entity.

func (*NotificationUpdateOne) Exec

func (nuo *NotificationUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*NotificationUpdateOne) ExecX

func (nuo *NotificationUpdateOne) ExecX(ctx context.Context)

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

func (*NotificationUpdateOne) Modify

func (nuo *NotificationUpdateOne) Modify(modifiers ...func(u *sql.UpdateBuilder)) *NotificationUpdateOne

Modify adds a statement modifier for attaching custom logic to the UPDATE statement.

func (*NotificationUpdateOne) Mutation

Mutation returns the NotificationMutation object of the builder.

func (*NotificationUpdateOne) Save

Save executes the query and returns the updated Notification entity.

func (*NotificationUpdateOne) SaveX

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

func (*NotificationUpdateOne) Select

func (nuo *NotificationUpdateOne) Select(field string, fields ...string) *NotificationUpdateOne

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

func (*NotificationUpdateOne) SetDescription

func (nuo *NotificationUpdateOne) SetDescription(s string) *NotificationUpdateOne

SetDescription sets the "description" field.

SetLink sets the "link" field.

func (*NotificationUpdateOne) SetNillableSubscriptionID

func (nuo *NotificationUpdateOne) SetNillableSubscriptionID(id *xid.ID) *NotificationUpdateOne

SetNillableSubscriptionID sets the "subscription" edge to the Subscription entity by ID if the given value is not nil.

func (*NotificationUpdateOne) SetRead

SetRead sets the "read" field.

func (*NotificationUpdateOne) SetSubscription

func (nuo *NotificationUpdateOne) SetSubscription(s *Subscription) *NotificationUpdateOne

SetSubscription sets the "subscription" edge to the Subscription entity.

func (*NotificationUpdateOne) SetSubscriptionID

func (nuo *NotificationUpdateOne) SetSubscriptionID(id xid.ID) *NotificationUpdateOne

SetSubscriptionID sets the "subscription" edge to the Subscription entity by ID.

func (*NotificationUpdateOne) SetTitle

SetTitle sets the "title" field.

type NotificationUpsert

type NotificationUpsert struct {
	*sql.UpdateSet
}

NotificationUpsert is the "OnConflict" setter.

func (*NotificationUpsert) SetCreatedAt

func (u *NotificationUpsert) SetCreatedAt(v time.Time) *NotificationUpsert

SetCreatedAt sets the "created_at" field.

func (*NotificationUpsert) SetDescription

func (u *NotificationUpsert) SetDescription(v string) *NotificationUpsert

SetDescription sets the "description" field.

SetLink sets the "link" field.

func (*NotificationUpsert) SetRead

SetRead sets the "read" field.

func (*NotificationUpsert) SetTitle

SetTitle sets the "title" field.

func (*NotificationUpsert) UpdateCreatedAt

func (u *NotificationUpsert) UpdateCreatedAt() *NotificationUpsert

UpdateCreatedAt sets the "created_at" field to the value that was provided on create.

func (*NotificationUpsert) UpdateDescription

func (u *NotificationUpsert) UpdateDescription() *NotificationUpsert

UpdateDescription sets the "description" field to the value that was provided on create.

func (u *NotificationUpsert) UpdateLink() *NotificationUpsert

UpdateLink sets the "link" field to the value that was provided on create.

func (*NotificationUpsert) UpdateRead

func (u *NotificationUpsert) UpdateRead() *NotificationUpsert

UpdateRead sets the "read" field to the value that was provided on create.

func (*NotificationUpsert) UpdateTitle

func (u *NotificationUpsert) UpdateTitle() *NotificationUpsert

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

type NotificationUpsertBulk

type NotificationUpsertBulk struct {
	// contains filtered or unexported fields
}

NotificationUpsertBulk is the builder for "upsert"-ing a bulk of Notification nodes.

func (*NotificationUpsertBulk) DoNothing

DoNothing configures the conflict_action to `DO NOTHING`. Supported only by SQLite and PostgreSQL.

func (*NotificationUpsertBulk) Exec

Exec executes the query.

func (*NotificationUpsertBulk) ExecX

func (u *NotificationUpsertBulk) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*NotificationUpsertBulk) Ignore

Ignore sets each column to itself in case of conflict. Using this option is equivalent to using:

client.Notification.Create().
	OnConflict(sql.ResolveWithIgnore()).
	Exec(ctx)

func (*NotificationUpsertBulk) SetCreatedAt

SetCreatedAt sets the "created_at" field.

func (*NotificationUpsertBulk) SetDescription

SetDescription sets the "description" field.

SetLink sets the "link" field.

func (*NotificationUpsertBulk) SetRead

SetRead sets the "read" field.

func (*NotificationUpsertBulk) SetTitle

SetTitle sets the "title" field.

func (*NotificationUpsertBulk) Update

Update allows overriding fields `UPDATE` values. See the NotificationCreateBulk.OnConflict documentation for more info.

func (*NotificationUpsertBulk) UpdateCreatedAt

func (u *NotificationUpsertBulk) UpdateCreatedAt() *NotificationUpsertBulk

UpdateCreatedAt sets the "created_at" field to the value that was provided on create.

func (*NotificationUpsertBulk) UpdateDescription

func (u *NotificationUpsertBulk) UpdateDescription() *NotificationUpsertBulk

UpdateDescription sets the "description" field to the value that was provided on create.

UpdateLink sets the "link" field to the value that was provided on create.

func (*NotificationUpsertBulk) UpdateNewValues

func (u *NotificationUpsertBulk) UpdateNewValues() *NotificationUpsertBulk

UpdateNewValues updates the mutable fields using the new values that were set on create. Using this option is equivalent to using:

client.Notification.Create().
	OnConflict(
		sql.ResolveWithNewValues(),
		sql.ResolveWith(func(u *sql.UpdateSet) {
			u.SetIgnore(notification.FieldID)
		}),
	).
	Exec(ctx)

func (*NotificationUpsertBulk) UpdateRead

UpdateRead sets the "read" field to the value that was provided on create.

func (*NotificationUpsertBulk) UpdateTitle

UpdateTitle sets the "title" field to the value that was provided on create.

type NotificationUpsertOne

type NotificationUpsertOne struct {
	// contains filtered or unexported fields
}

NotificationUpsertOne is the builder for "upsert"-ing

one Notification node.

func (*NotificationUpsertOne) DoNothing

DoNothing configures the conflict_action to `DO NOTHING`. Supported only by SQLite and PostgreSQL.

func (*NotificationUpsertOne) Exec

Exec executes the query.

func (*NotificationUpsertOne) ExecX

func (u *NotificationUpsertOne) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*NotificationUpsertOne) ID

func (u *NotificationUpsertOne) ID(ctx context.Context) (id xid.ID, err error)

Exec executes the UPSERT query and returns the inserted/updated ID.

func (*NotificationUpsertOne) IDX

IDX is like ID, but panics if an error occurs.

func (*NotificationUpsertOne) Ignore

Ignore sets each column to itself in case of conflict. Using this option is equivalent to using:

client.Notification.Create().
    OnConflict(sql.ResolveWithIgnore()).
    Exec(ctx)

func (*NotificationUpsertOne) SetCreatedAt

SetCreatedAt sets the "created_at" field.

func (*NotificationUpsertOne) SetDescription

func (u *NotificationUpsertOne) SetDescription(v string) *NotificationUpsertOne

SetDescription sets the "description" field.

SetLink sets the "link" field.

func (*NotificationUpsertOne) SetRead

SetRead sets the "read" field.

func (*NotificationUpsertOne) SetTitle

SetTitle sets the "title" field.

func (*NotificationUpsertOne) Update

Update allows overriding fields `UPDATE` values. See the NotificationCreate.OnConflict documentation for more info.

func (*NotificationUpsertOne) UpdateCreatedAt

func (u *NotificationUpsertOne) UpdateCreatedAt() *NotificationUpsertOne

UpdateCreatedAt sets the "created_at" field to the value that was provided on create.

func (*NotificationUpsertOne) UpdateDescription

func (u *NotificationUpsertOne) UpdateDescription() *NotificationUpsertOne

UpdateDescription sets the "description" field to the value that was provided on create.

UpdateLink sets the "link" field to the value that was provided on create.

func (*NotificationUpsertOne) UpdateNewValues

func (u *NotificationUpsertOne) UpdateNewValues() *NotificationUpsertOne

UpdateNewValues updates the mutable fields using the new values that were set on create except the ID field. Using this option is equivalent to using:

client.Notification.Create().
	OnConflict(
		sql.ResolveWithNewValues(),
		sql.ResolveWith(func(u *sql.UpdateSet) {
			u.SetIgnore(notification.FieldID)
		}),
	).
	Exec(ctx)

func (*NotificationUpsertOne) UpdateRead

UpdateRead sets the "read" field to the value that was provided on create.

func (*NotificationUpsertOne) UpdateTitle

func (u *NotificationUpsertOne) UpdateTitle() *NotificationUpsertOne

UpdateTitle sets the "title" field to the value that was provided on create.

type Notifications

type Notifications []*Notification

Notifications is a parsable slice of Notification.

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(...interface{})) Option

Log sets the logging function for debug mode.

type OrderFunc

type OrderFunc func(*sql.Selector)

OrderFunc applies an ordering on the sql selector.

func Asc

func Asc(fields ...string) OrderFunc

Asc applies the given fields in ASC order.

func Desc

func Desc(fields ...string) OrderFunc

Desc applies the given fields in DESC order.

type Policy

type Policy = ent.Policy

ent aliases to avoid import conflicts in user's code.

type Post

type Post struct {

	// ID of the ent.
	ID xid.ID `json:"id,omitempty"`
	// CreatedAt holds the value of the "created_at" field.
	CreatedAt time.Time `json:"created_at,omitempty"`
	// UpdatedAt holds the value of the "updated_at" field.
	UpdatedAt time.Time `json:"updated_at,omitempty"`
	// DeletedAt holds the value of the "deleted_at" field.
	DeletedAt *time.Time `json:"deleted_at,omitempty"`
	// First holds the value of the "first" field.
	First bool `json:"first,omitempty"`
	// Title holds the value of the "title" field.
	Title string `json:"title,omitempty"`
	// Slug holds the value of the "slug" field.
	Slug string `json:"slug,omitempty"`
	// Pinned holds the value of the "pinned" field.
	Pinned bool `json:"pinned,omitempty"`
	// RootPostID holds the value of the "root_post_id" field.
	RootPostID xid.ID `json:"root_post_id,omitempty"`
	// ReplyToPostID holds the value of the "reply_to_post_id" field.
	ReplyToPostID xid.ID `json:"reply_to_post_id,omitempty"`
	// Body holds the value of the "body" field.
	Body string `json:"body,omitempty"`
	// Short holds the value of the "short" field.
	Short string `json:"short,omitempty"`
	// CategoryID holds the value of the "category_id" field.
	CategoryID xid.ID `json:"category_id,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the PostQuery when eager-loading is set.
	Edges PostEdges `json:"edges"`
	// contains filtered or unexported fields
}

Post is the model entity for the Post schema.

func (*Post) QueryAuthor

func (po *Post) QueryAuthor() *AccountQuery

QueryAuthor queries the "author" edge of the Post entity.

func (*Post) QueryCategory

func (po *Post) QueryCategory() *CategoryQuery

QueryCategory queries the "category" edge of the Post entity.

func (*Post) QueryPosts

func (po *Post) QueryPosts() *PostQuery

QueryPosts queries the "posts" edge of the Post entity.

func (*Post) QueryReacts

func (po *Post) QueryReacts() *ReactQuery

QueryReacts queries the "reacts" edge of the Post entity.

func (*Post) QueryReplies

func (po *Post) QueryReplies() *PostQuery

QueryReplies queries the "replies" edge of the Post entity.

func (*Post) QueryReplyTo

func (po *Post) QueryReplyTo() *PostQuery

QueryReplyTo queries the "replyTo" edge of the Post entity.

func (*Post) QueryRoot

func (po *Post) QueryRoot() *PostQuery

QueryRoot queries the "root" edge of the Post entity.

func (*Post) QueryTags

func (po *Post) QueryTags() *TagQuery

QueryTags queries the "tags" edge of the Post entity.

func (*Post) String

func (po *Post) String() string

String implements the fmt.Stringer.

func (*Post) Unwrap

func (po *Post) Unwrap() *Post

Unwrap unwraps the Post 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 (*Post) Update

func (po *Post) Update() *PostUpdateOne

Update returns a builder for updating this Post. Note that you need to call Post.Unwrap() before calling this method if this Post was returned from a transaction, and the transaction was committed or rolled back.

type PostClient

type PostClient struct {
	// contains filtered or unexported fields
}

PostClient is a client for the Post schema.

func NewPostClient

func NewPostClient(c config) *PostClient

NewPostClient returns a client for the Post from the given config.

func (*PostClient) Create

func (c *PostClient) Create() *PostCreate

Create returns a builder for creating a Post entity.

func (*PostClient) CreateBulk

func (c *PostClient) CreateBulk(builders ...*PostCreate) *PostCreateBulk

CreateBulk returns a builder for creating a bulk of Post entities.

func (*PostClient) Delete

func (c *PostClient) Delete() *PostDelete

Delete returns a delete builder for Post.

func (*PostClient) DeleteOne

func (c *PostClient) DeleteOne(po *Post) *PostDeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*PostClient) DeleteOneID

func (c *PostClient) DeleteOneID(id xid.ID) *PostDeleteOne

DeleteOne returns a builder for deleting the given entity by its id.

func (*PostClient) Get

func (c *PostClient) Get(ctx context.Context, id xid.ID) (*Post, error)

Get returns a Post entity by its id.

func (*PostClient) GetX

func (c *PostClient) GetX(ctx context.Context, id xid.ID) *Post

GetX is like Get, but panics if an error occurs.

func (*PostClient) Hooks

func (c *PostClient) Hooks() []Hook

Hooks returns the client hooks.

func (*PostClient) Query

func (c *PostClient) Query() *PostQuery

Query returns a query builder for Post.

func (*PostClient) QueryAuthor

func (c *PostClient) QueryAuthor(po *Post) *AccountQuery

QueryAuthor queries the author edge of a Post.

func (*PostClient) QueryCategory

func (c *PostClient) QueryCategory(po *Post) *CategoryQuery

QueryCategory queries the category edge of a Post.

func (*PostClient) QueryPosts

func (c *PostClient) QueryPosts(po *Post) *PostQuery

QueryPosts queries the posts edge of a Post.

func (*PostClient) QueryReacts

func (c *PostClient) QueryReacts(po *Post) *ReactQuery

QueryReacts queries the reacts edge of a Post.

func (*PostClient) QueryReplies

func (c *PostClient) QueryReplies(po *Post) *PostQuery

QueryReplies queries the replies edge of a Post.

func (*PostClient) QueryReplyTo

func (c *PostClient) QueryReplyTo(po *Post) *PostQuery

QueryReplyTo queries the replyTo edge of a Post.

func (*PostClient) QueryRoot

func (c *PostClient) QueryRoot(po *Post) *PostQuery

QueryRoot queries the root edge of a Post.

func (*PostClient) QueryTags

func (c *PostClient) QueryTags(po *Post) *TagQuery

QueryTags queries the tags edge of a Post.

func (*PostClient) Update

func (c *PostClient) Update() *PostUpdate

Update returns an update builder for Post.

func (*PostClient) UpdateOne

func (c *PostClient) UpdateOne(po *Post) *PostUpdateOne

UpdateOne returns an update builder for the given entity.

func (*PostClient) UpdateOneID

func (c *PostClient) UpdateOneID(id xid.ID) *PostUpdateOne

UpdateOneID returns an update builder for the given id.

func (*PostClient) Use

func (c *PostClient) Use(hooks ...Hook)

Use adds a list of mutation hooks to the hooks stack. A call to `Use(f, g, h)` equals to `post.Hooks(f(g(h())))`.

type PostCreate

type PostCreate struct {
	// contains filtered or unexported fields
}

PostCreate is the builder for creating a Post entity.

func (*PostCreate) AddPostIDs

func (pc *PostCreate) AddPostIDs(ids ...xid.ID) *PostCreate

AddPostIDs adds the "posts" edge to the Post entity by IDs.

func (*PostCreate) AddPosts

func (pc *PostCreate) AddPosts(p ...*Post) *PostCreate

AddPosts adds the "posts" edges to the Post entity.

func (*PostCreate) AddReactIDs

func (pc *PostCreate) AddReactIDs(ids ...xid.ID) *PostCreate

AddReactIDs adds the "reacts" edge to the React entity by IDs.

func (*PostCreate) AddReacts

func (pc *PostCreate) AddReacts(r ...*React) *PostCreate

AddReacts adds the "reacts" edges to the React entity.

func (*PostCreate) AddReplies

func (pc *PostCreate) AddReplies(p ...*Post) *PostCreate

AddReplies adds the "replies" edges to the Post entity.

func (*PostCreate) AddReplyIDs

func (pc *PostCreate) AddReplyIDs(ids ...xid.ID) *PostCreate

AddReplyIDs adds the "replies" edge to the Post entity by IDs.

func (*PostCreate) AddTagIDs

func (pc *PostCreate) AddTagIDs(ids ...xid.ID) *PostCreate

AddTagIDs adds the "tags" edge to the Tag entity by IDs.

func (*PostCreate) AddTags

func (pc *PostCreate) AddTags(t ...*Tag) *PostCreate

AddTags adds the "tags" edges to the Tag entity.

func (*PostCreate) Exec

func (pc *PostCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*PostCreate) ExecX

func (pc *PostCreate) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*PostCreate) Mutation

func (pc *PostCreate) Mutation() *PostMutation

Mutation returns the PostMutation object of the builder.

func (*PostCreate) OnConflict

func (pc *PostCreate) OnConflict(opts ...sql.ConflictOption) *PostUpsertOne

OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause of the `INSERT` statement. For example:

client.Post.Create().
	SetCreatedAt(v).
	OnConflict(
		// Update the row with the new values
		// the was proposed for insertion.
		sql.ResolveWithNewValues(),
	).
	// Override some of the fields with custom
	// update values.
	Update(func(u *ent.PostUpsert) {
		SetCreatedAt(v+v).
	}).
	Exec(ctx)

func (*PostCreate) OnConflictColumns

func (pc *PostCreate) OnConflictColumns(columns ...string) *PostUpsertOne

OnConflictColumns calls `OnConflict` and configures the columns as conflict target. Using this option is equivalent to using:

client.Post.Create().
	OnConflict(sql.ConflictColumns(columns...)).
	Exec(ctx)

func (*PostCreate) Save

func (pc *PostCreate) Save(ctx context.Context) (*Post, error)

Save creates the Post in the database.

func (*PostCreate) SaveX

func (pc *PostCreate) SaveX(ctx context.Context) *Post

SaveX calls Save and panics if Save returns an error.

func (*PostCreate) SetAuthor

func (pc *PostCreate) SetAuthor(a *Account) *PostCreate

SetAuthor sets the "author" edge to the Account entity.

func (*PostCreate) SetAuthorID

func (pc *PostCreate) SetAuthorID(id xid.ID) *PostCreate

SetAuthorID sets the "author" edge to the Account entity by ID.

func (*PostCreate) SetBody

func (pc *PostCreate) SetBody(s string) *PostCreate

SetBody sets the "body" field.

func (*PostCreate) SetCategory

func (pc *PostCreate) SetCategory(c *Category) *PostCreate

SetCategory sets the "category" edge to the Category entity.

func (*PostCreate) SetCategoryID

func (pc *PostCreate) SetCategoryID(x xid.ID) *PostCreate

SetCategoryID sets the "category_id" field.

func (*PostCreate) SetCreatedAt

func (pc *PostCreate) SetCreatedAt(t time.Time) *PostCreate

SetCreatedAt sets the "created_at" field.

func (*PostCreate) SetDeletedAt

func (pc *PostCreate) SetDeletedAt(t time.Time) *PostCreate

SetDeletedAt sets the "deleted_at" field.

func (*PostCreate) SetFirst

func (pc *PostCreate) SetFirst(b bool) *PostCreate

SetFirst sets the "first" field.

func (*PostCreate) SetID

func (pc *PostCreate) SetID(x xid.ID) *PostCreate

SetID sets the "id" field.

func (*PostCreate) SetNillableCategoryID

func (pc *PostCreate) SetNillableCategoryID(x *xid.ID) *PostCreate

SetNillableCategoryID sets the "category_id" field if the given value is not nil.

func (*PostCreate) SetNillableCreatedAt

func (pc *PostCreate) SetNillableCreatedAt(t *time.Time) *PostCreate

SetNillableCreatedAt sets the "created_at" field if the given value is not nil.

func (*PostCreate) SetNillableDeletedAt

func (pc *PostCreate) SetNillableDeletedAt(t *time.Time) *PostCreate

SetNillableDeletedAt sets the "deleted_at" field if the given value is not nil.

func (*PostCreate) SetNillableID

func (pc *PostCreate) SetNillableID(x *xid.ID) *PostCreate

SetNillableID sets the "id" field if the given value is not nil.

func (*PostCreate) SetNillablePinned

func (pc *PostCreate) SetNillablePinned(b *bool) *PostCreate

SetNillablePinned sets the "pinned" field if the given value is not nil.

func (*PostCreate) SetNillableReplyToID

func (pc *PostCreate) SetNillableReplyToID(id *xid.ID) *PostCreate

SetNillableReplyToID sets the "replyTo" edge to the Post entity by ID if the given value is not nil.

func (*PostCreate) SetNillableReplyToPostID

func (pc *PostCreate) SetNillableReplyToPostID(x *xid.ID) *PostCreate

SetNillableReplyToPostID sets the "reply_to_post_id" field if the given value is not nil.

func (*PostCreate) SetNillableRootID

func (pc *PostCreate) SetNillableRootID(id *xid.ID) *PostCreate

SetNillableRootID sets the "root" edge to the Post entity by ID if the given value is not nil.

func (*PostCreate) SetNillableRootPostID

func (pc *PostCreate) SetNillableRootPostID(x *xid.ID) *PostCreate

SetNillableRootPostID sets the "root_post_id" field if the given value is not nil.

func (*PostCreate) SetNillableSlug

func (pc *PostCreate) SetNillableSlug(s *string) *PostCreate

SetNillableSlug sets the "slug" field if the given value is not nil.

func (*PostCreate) SetNillableTitle

func (pc *PostCreate) SetNillableTitle(s *string) *PostCreate

SetNillableTitle sets the "title" field if the given value is not nil.

func (*PostCreate) SetNillableUpdatedAt

func (pc *PostCreate) SetNillableUpdatedAt(t *time.Time) *PostCreate

SetNillableUpdatedAt sets the "updated_at" field if the given value is not nil.

func (*PostCreate) SetPinned

func (pc *PostCreate) SetPinned(b bool) *PostCreate

SetPinned sets the "pinned" field.

func (*PostCreate) SetReplyTo

func (pc *PostCreate) SetReplyTo(p *Post) *PostCreate

SetReplyTo sets the "replyTo" edge to the Post entity.

func (*PostCreate) SetReplyToID

func (pc *PostCreate) SetReplyToID(id xid.ID) *PostCreate

SetReplyToID sets the "replyTo" edge to the Post entity by ID.

func (*PostCreate) SetReplyToPostID

func (pc *PostCreate) SetReplyToPostID(x xid.ID) *PostCreate

SetReplyToPostID sets the "reply_to_post_id" field.

func (*PostCreate) SetRoot

func (pc *PostCreate) SetRoot(p *Post) *PostCreate

SetRoot sets the "root" edge to the Post entity.

func (*PostCreate) SetRootID

func (pc *PostCreate) SetRootID(id xid.ID) *PostCreate

SetRootID sets the "root" edge to the Post entity by ID.

func (*PostCreate) SetRootPostID

func (pc *PostCreate) SetRootPostID(x xid.ID) *PostCreate

SetRootPostID sets the "root_post_id" field.

func (*PostCreate) SetShort

func (pc *PostCreate) SetShort(s string) *PostCreate

SetShort sets the "short" field.

func (*PostCreate) SetSlug

func (pc *PostCreate) SetSlug(s string) *PostCreate

SetSlug sets the "slug" field.

func (*PostCreate) SetTitle

func (pc *PostCreate) SetTitle(s string) *PostCreate

SetTitle sets the "title" field.

func (*PostCreate) SetUpdatedAt

func (pc *PostCreate) SetUpdatedAt(t time.Time) *PostCreate

SetUpdatedAt sets the "updated_at" field.

type PostCreateBulk

type PostCreateBulk struct {
	// contains filtered or unexported fields
}

PostCreateBulk is the builder for creating many Post entities in bulk.

func (*PostCreateBulk) Exec

func (pcb *PostCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*PostCreateBulk) ExecX

func (pcb *PostCreateBulk) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*PostCreateBulk) OnConflict

func (pcb *PostCreateBulk) OnConflict(opts ...sql.ConflictOption) *PostUpsertBulk

OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause of the `INSERT` statement. For example:

client.Post.CreateBulk(builders...).
	OnConflict(
		// Update the row with the new values
		// the was proposed for insertion.
		sql.ResolveWithNewValues(),
	).
	// Override some of the fields with custom
	// update values.
	Update(func(u *ent.PostUpsert) {
		SetCreatedAt(v+v).
	}).
	Exec(ctx)

func (*PostCreateBulk) OnConflictColumns

func (pcb *PostCreateBulk) OnConflictColumns(columns ...string) *PostUpsertBulk

OnConflictColumns calls `OnConflict` and configures the columns as conflict target. Using this option is equivalent to using:

client.Post.Create().
	OnConflict(sql.ConflictColumns(columns...)).
	Exec(ctx)

func (*PostCreateBulk) Save

func (pcb *PostCreateBulk) Save(ctx context.Context) ([]*Post, error)

Save creates the Post entities in the database.

func (*PostCreateBulk) SaveX

func (pcb *PostCreateBulk) SaveX(ctx context.Context) []*Post

SaveX is like Save, but panics if an error occurs.

type PostDelete

type PostDelete struct {
	// contains filtered or unexported fields
}

PostDelete is the builder for deleting a Post entity.

func (*PostDelete) Exec

func (pd *PostDelete) Exec(ctx context.Context) (int, error)

Exec executes the deletion query and returns how many vertices were deleted.

func (*PostDelete) ExecX

func (pd *PostDelete) ExecX(ctx context.Context) int

ExecX is like Exec, but panics if an error occurs.

func (*PostDelete) Where

func (pd *PostDelete) Where(ps ...predicate.Post) *PostDelete

Where appends a list predicates to the PostDelete builder.

type PostDeleteOne

type PostDeleteOne struct {
	// contains filtered or unexported fields
}

PostDeleteOne is the builder for deleting a single Post entity.

func (*PostDeleteOne) Exec

func (pdo *PostDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*PostDeleteOne) ExecX

func (pdo *PostDeleteOne) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

type PostEdges

type PostEdges struct {
	// Author holds the value of the author edge.
	Author *Account `json:"author,omitempty"`
	// Category is only required for root posts. It should never be added to a child post.
	Category *Category `json:"category,omitempty"`
	// Tags are only required for root posts. It should never be added to a child post.
	Tags []*Tag `json:"tags,omitempty"`
	// A many-to-many recursive self reference. The root post is the first post in the thread.
	Root *Post `json:"root,omitempty"`
	// Posts holds the value of the posts edge.
	Posts []*Post `json:"posts,omitempty"`
	// A many-to-many recursive self reference. The replyTo post is an optional post that this post is in reply to.
	ReplyTo *Post `json:"replyTo,omitempty"`
	// Replies holds the value of the replies edge.
	Replies []*Post `json:"replies,omitempty"`
	// Reacts holds the value of the reacts edge.
	Reacts []*React `json:"reacts,omitempty"`
	// contains filtered or unexported fields
}

PostEdges holds the relations/edges for other nodes in the graph.

func (PostEdges) AuthorOrErr

func (e PostEdges) AuthorOrErr() (*Account, error)

AuthorOrErr returns the Author value or an error if the edge was not loaded in eager-loading, or loaded but was not found.

func (PostEdges) CategoryOrErr

func (e PostEdges) CategoryOrErr() (*Category, error)

CategoryOrErr returns the Category value or an error if the edge was not loaded in eager-loading, or loaded but was not found.

func (PostEdges) PostsOrErr

func (e PostEdges) PostsOrErr() ([]*Post, error)

PostsOrErr returns the Posts value or an error if the edge was not loaded in eager-loading.

func (PostEdges) ReactsOrErr

func (e PostEdges) ReactsOrErr() ([]*React, error)

ReactsOrErr returns the Reacts value or an error if the edge was not loaded in eager-loading.

func (PostEdges) RepliesOrErr

func (e PostEdges) RepliesOrErr() ([]*Post, error)

RepliesOrErr returns the Replies value or an error if the edge was not loaded in eager-loading.

func (PostEdges) ReplyToOrErr

func (e PostEdges) ReplyToOrErr() (*Post, error)

ReplyToOrErr returns the ReplyTo value or an error if the edge was not loaded in eager-loading, or loaded but was not found.

func (PostEdges) RootOrErr

func (e PostEdges) RootOrErr() (*Post, error)

RootOrErr returns the Root value or an error if the edge was not loaded in eager-loading, or loaded but was not found.

func (PostEdges) TagsOrErr

func (e PostEdges) TagsOrErr() ([]*Tag, error)

TagsOrErr returns the Tags value or an error if the edge was not loaded in eager-loading.

type PostGroupBy

type PostGroupBy struct {
	// contains filtered or unexported fields
}

PostGroupBy is the group-by builder for Post entities.

func (*PostGroupBy) Aggregate

func (pgb *PostGroupBy) Aggregate(fns ...AggregateFunc) *PostGroupBy

Aggregate adds the given aggregation functions to the group-by query.

func (*PostGroupBy) Bool

func (s *PostGroupBy) Bool(ctx context.Context) (_ bool, err error)

Bool returns a single bool from a selector. It is only allowed when selecting one field.

func (*PostGroupBy) BoolX

func (s *PostGroupBy) BoolX(ctx context.Context) bool

BoolX is like Bool, but panics if an error occurs.

func (*PostGroupBy) Bools

func (s *PostGroupBy) Bools(ctx context.Context) ([]bool, error)

Bools returns list of bools from a selector. It is only allowed when selecting one field.

func (*PostGroupBy) BoolsX

func (s *PostGroupBy) BoolsX(ctx context.Context) []bool

BoolsX is like Bools, but panics if an error occurs.

func (*PostGroupBy) Float64

func (s *PostGroupBy) Float64(ctx context.Context) (_ float64, err error)

Float64 returns a single float64 from a selector. It is only allowed when selecting one field.

func (*PostGroupBy) Float64X

func (s *PostGroupBy) Float64X(ctx context.Context) float64

Float64X is like Float64, but panics if an error occurs.

func (*PostGroupBy) Float64s

func (s *PostGroupBy) Float64s(ctx context.Context) ([]float64, error)

Float64s returns list of float64s from a selector. It is only allowed when selecting one field.

func (*PostGroupBy) Float64sX

func (s *PostGroupBy) Float64sX(ctx context.Context) []float64

Float64sX is like Float64s, but panics if an error occurs.

func (*PostGroupBy) Int

func (s *PostGroupBy) Int(ctx context.Context) (_ int, err error)

Int returns a single int from a selector. It is only allowed when selecting one field.

func (*PostGroupBy) IntX

func (s *PostGroupBy) IntX(ctx context.Context) int

IntX is like Int, but panics if an error occurs.

func (*PostGroupBy) Ints

func (s *PostGroupBy) Ints(ctx context.Context) ([]int, error)

Ints returns list of ints from a selector. It is only allowed when selecting one field.

func (*PostGroupBy) IntsX

func (s *PostGroupBy) IntsX(ctx context.Context) []int

IntsX is like Ints, but panics if an error occurs.

func (*PostGroupBy) Scan

func (pgb *PostGroupBy) Scan(ctx context.Context, v interface{}) error

Scan applies the group-by query and scans the result into the given value.

func (*PostGroupBy) ScanX

func (s *PostGroupBy) ScanX(ctx context.Context, v interface{})

ScanX is like Scan, but panics if an error occurs.

func (*PostGroupBy) String

func (s *PostGroupBy) String(ctx context.Context) (_ string, err error)

String returns a single string from a selector. It is only allowed when selecting one field.

func (*PostGroupBy) StringX

func (s *PostGroupBy) StringX(ctx context.Context) string

StringX is like String, but panics if an error occurs.

func (*PostGroupBy) Strings

func (s *PostGroupBy) Strings(ctx context.Context) ([]string, error)

Strings returns list of strings from a selector. It is only allowed when selecting one field.

func (*PostGroupBy) StringsX

func (s *PostGroupBy) StringsX(ctx context.Context) []string

StringsX is like Strings, but panics if an error occurs.

type PostMutation

type PostMutation struct {
	// contains filtered or unexported fields
}

PostMutation represents an operation that mutates the Post nodes in the graph.

func (*PostMutation) AddField

func (m *PostMutation) 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 (*PostMutation) AddPostIDs

func (m *PostMutation) AddPostIDs(ids ...xid.ID)

AddPostIDs adds the "posts" edge to the Post entity by ids.

func (*PostMutation) AddReactIDs

func (m *PostMutation) AddReactIDs(ids ...xid.ID)

AddReactIDs adds the "reacts" edge to the React entity by ids.

func (*PostMutation) AddReplyIDs

func (m *PostMutation) AddReplyIDs(ids ...xid.ID)

AddReplyIDs adds the "replies" edge to the Post entity by ids.

func (*PostMutation) AddTagIDs

func (m *PostMutation) AddTagIDs(ids ...xid.ID)

AddTagIDs adds the "tags" edge to the Tag entity by ids.

func (*PostMutation) AddedEdges

func (m *PostMutation) AddedEdges() []string

AddedEdges returns all edge names that were set/added in this mutation.

func (*PostMutation) AddedField

func (m *PostMutation) 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 (*PostMutation) AddedFields

func (m *PostMutation) AddedFields() []string

AddedFields returns all numeric fields that were incremented/decremented during this mutation.

func (*PostMutation) AddedIDs

func (m *PostMutation) AddedIDs(name string) []ent.Value

AddedIDs returns all IDs (to other nodes) that were added for the given edge name in this mutation.

func (*PostMutation) AuthorCleared

func (m *PostMutation) AuthorCleared() bool

AuthorCleared reports if the "author" edge to the Account entity was cleared.

func (*PostMutation) AuthorID

func (m *PostMutation) AuthorID() (id xid.ID, exists bool)

AuthorID returns the "author" edge ID in the mutation.

func (*PostMutation) AuthorIDs

func (m *PostMutation) AuthorIDs() (ids []xid.ID)

AuthorIDs returns the "author" edge IDs in the mutation. Note that IDs always returns len(IDs) <= 1 for unique edges, and you should use AuthorID instead. It exists only for internal usage by the builders.

func (*PostMutation) Body

func (m *PostMutation) Body() (r string, exists bool)

Body returns the value of the "body" field in the mutation.

func (*PostMutation) CategoryCleared

func (m *PostMutation) CategoryCleared() bool

CategoryCleared reports if the "category" edge to the Category entity was cleared.

func (*PostMutation) CategoryID

func (m *PostMutation) CategoryID() (r xid.ID, exists bool)

CategoryID returns the value of the "category_id" field in the mutation.

func (*PostMutation) CategoryIDCleared

func (m *PostMutation) CategoryIDCleared() bool

CategoryIDCleared returns if the "category_id" field was cleared in this mutation.

func (*PostMutation) CategoryIDs

func (m *PostMutation) CategoryIDs() (ids []xid.ID)

CategoryIDs returns the "category" edge IDs in the mutation. Note that IDs always returns len(IDs) <= 1 for unique edges, and you should use CategoryID instead. It exists only for internal usage by the builders.

func (*PostMutation) ClearAuthor

func (m *PostMutation) ClearAuthor()

ClearAuthor clears the "author" edge to the Account entity.

func (*PostMutation) ClearCategory

func (m *PostMutation) ClearCategory()

ClearCategory clears the "category" edge to the Category entity.

func (*PostMutation) ClearCategoryID

func (m *PostMutation) ClearCategoryID()

ClearCategoryID clears the value of the "category_id" field.

func (*PostMutation) ClearDeletedAt

func (m *PostMutation) ClearDeletedAt()

ClearDeletedAt clears the value of the "deleted_at" field.

func (*PostMutation) ClearEdge

func (m *PostMutation) 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 (*PostMutation) ClearField

func (m *PostMutation) 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 (*PostMutation) ClearPosts

func (m *PostMutation) ClearPosts()

ClearPosts clears the "posts" edge to the Post entity.

func (*PostMutation) ClearReacts

func (m *PostMutation) ClearReacts()

ClearReacts clears the "reacts" edge to the React entity.

func (*PostMutation) ClearReplies

func (m *PostMutation) ClearReplies()

ClearReplies clears the "replies" edge to the Post entity.

func (*PostMutation) ClearReplyTo

func (m *PostMutation) ClearReplyTo()

ClearReplyTo clears the "replyTo" edge to the Post entity.

func (*PostMutation) ClearReplyToPostID

func (m *PostMutation) ClearReplyToPostID()

ClearReplyToPostID clears the value of the "reply_to_post_id" field.

func (*PostMutation) ClearRoot

func (m *PostMutation) ClearRoot()

ClearRoot clears the "root" edge to the Post entity.

func (*PostMutation) ClearRootPostID

func (m *PostMutation) ClearRootPostID()

ClearRootPostID clears the value of the "root_post_id" field.

func (*PostMutation) ClearSlug

func (m *PostMutation) ClearSlug()

ClearSlug clears the value of the "slug" field.

func (*PostMutation) ClearTags

func (m *PostMutation) ClearTags()

ClearTags clears the "tags" edge to the Tag entity.

func (*PostMutation) ClearTitle

func (m *PostMutation) ClearTitle()

ClearTitle clears the value of the "title" field.

func (*PostMutation) ClearedEdges

func (m *PostMutation) ClearedEdges() []string

ClearedEdges returns all edge names that were cleared in this mutation.

func (*PostMutation) ClearedFields

func (m *PostMutation) ClearedFields() []string

ClearedFields returns all nullable fields that were cleared during this mutation.

func (PostMutation) Client

func (m PostMutation) 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 (*PostMutation) CreatedAt

func (m *PostMutation) CreatedAt() (r time.Time, exists bool)

CreatedAt returns the value of the "created_at" field in the mutation.

func (*PostMutation) DeletedAt

func (m *PostMutation) DeletedAt() (r time.Time, exists bool)

DeletedAt returns the value of the "deleted_at" field in the mutation.

func (*PostMutation) DeletedAtCleared

func (m *PostMutation) DeletedAtCleared() bool

DeletedAtCleared returns if the "deleted_at" field was cleared in this mutation.

func (*PostMutation) EdgeCleared

func (m *PostMutation) EdgeCleared(name string) bool

EdgeCleared returns a boolean which indicates if the edge with the given name was cleared in this mutation.

func (*PostMutation) Field

func (m *PostMutation) 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 (*PostMutation) FieldCleared

func (m *PostMutation) FieldCleared(name string) bool

FieldCleared returns a boolean indicating if a field with the given name was cleared in this mutation.

func (*PostMutation) Fields

func (m *PostMutation) 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 (*PostMutation) First

func (m *PostMutation) First() (r bool, exists bool)

First returns the value of the "first" field in the mutation.

func (*PostMutation) ID

func (m *PostMutation) ID() (id xid.ID, 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 (*PostMutation) IDs

func (m *PostMutation) IDs(ctx context.Context) ([]xid.ID, 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 (*PostMutation) OldBody

func (m *PostMutation) OldBody(ctx context.Context) (v string, err error)

OldBody returns the old "body" field's value of the Post entity. If the Post 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 (*PostMutation) OldCategoryID

func (m *PostMutation) OldCategoryID(ctx context.Context) (v xid.ID, err error)

OldCategoryID returns the old "category_id" field's value of the Post entity. If the Post 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 (*PostMutation) OldCreatedAt

func (m *PostMutation) OldCreatedAt(ctx context.Context) (v time.Time, err error)

OldCreatedAt returns the old "created_at" field's value of the Post entity. If the Post 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 (*PostMutation) OldDeletedAt

func (m *PostMutation) OldDeletedAt(ctx context.Context) (v *time.Time, err error)

OldDeletedAt returns the old "deleted_at" field's value of the Post entity. If the Post 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 (*PostMutation) OldField

func (m *PostMutation) 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 (*PostMutation) OldFirst

func (m *PostMutation) OldFirst(ctx context.Context) (v bool, err error)

OldFirst returns the old "first" field's value of the Post entity. If the Post 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 (*PostMutation) OldPinned

func (m *PostMutation) OldPinned(ctx context.Context) (v bool, err error)

OldPinned returns the old "pinned" field's value of the Post entity. If the Post 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 (*PostMutation) OldReplyToPostID

func (m *PostMutation) OldReplyToPostID(ctx context.Context) (v xid.ID, err error)

OldReplyToPostID returns the old "reply_to_post_id" field's value of the Post entity. If the Post 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 (*PostMutation) OldRootPostID

func (m *PostMutation) OldRootPostID(ctx context.Context) (v xid.ID, err error)

OldRootPostID returns the old "root_post_id" field's value of the Post entity. If the Post 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 (*PostMutation) OldShort

func (m *PostMutation) OldShort(ctx context.Context) (v string, err error)

OldShort returns the old "short" field's value of the Post entity. If the Post 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 (*PostMutation) OldSlug

func (m *PostMutation) OldSlug(ctx context.Context) (v string, err error)

OldSlug returns the old "slug" field's value of the Post entity. If the Post 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 (*PostMutation) OldTitle

func (m *PostMutation) OldTitle(ctx context.Context) (v string, err error)

OldTitle returns the old "title" field's value of the Post entity. If the Post 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 (*PostMutation) OldUpdatedAt

func (m *PostMutation) OldUpdatedAt(ctx context.Context) (v time.Time, err error)

OldUpdatedAt returns the old "updated_at" field's value of the Post entity. If the Post 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 (*PostMutation) Op

func (m *PostMutation) Op() Op

Op returns the operation name.

func (*PostMutation) Pinned

func (m *PostMutation) Pinned() (r bool, exists bool)

Pinned returns the value of the "pinned" field in the mutation.

func (*PostMutation) PostsCleared

func (m *PostMutation) PostsCleared() bool

PostsCleared reports if the "posts" edge to the Post entity was cleared.

func (*PostMutation) PostsIDs

func (m *PostMutation) PostsIDs() (ids []xid.ID)

PostsIDs returns the "posts" edge IDs in the mutation.

func (*PostMutation) ReactsCleared

func (m *PostMutation) ReactsCleared() bool

ReactsCleared reports if the "reacts" edge to the React entity was cleared.

func (*PostMutation) ReactsIDs

func (m *PostMutation) ReactsIDs() (ids []xid.ID)

ReactsIDs returns the "reacts" edge IDs in the mutation.

func (*PostMutation) RemovePostIDs

func (m *PostMutation) RemovePostIDs(ids ...xid.ID)

RemovePostIDs removes the "posts" edge to the Post entity by IDs.

func (*PostMutation) RemoveReactIDs

func (m *PostMutation) RemoveReactIDs(ids ...xid.ID)

RemoveReactIDs removes the "reacts" edge to the React entity by IDs.

func (*PostMutation) RemoveReplyIDs

func (m *PostMutation) RemoveReplyIDs(ids ...xid.ID)

RemoveReplyIDs removes the "replies" edge to the Post entity by IDs.

func (*PostMutation) RemoveTagIDs

func (m *PostMutation) RemoveTagIDs(ids ...xid.ID)

RemoveTagIDs removes the "tags" edge to the Tag entity by IDs.

func (*PostMutation) RemovedEdges

func (m *PostMutation) RemovedEdges() []string

RemovedEdges returns all edge names that were removed in this mutation.

func (*PostMutation) RemovedIDs

func (m *PostMutation) 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 (*PostMutation) RemovedPostsIDs

func (m *PostMutation) RemovedPostsIDs() (ids []xid.ID)

RemovedPosts returns the removed IDs of the "posts" edge to the Post entity.

func (*PostMutation) RemovedReactsIDs

func (m *PostMutation) RemovedReactsIDs() (ids []xid.ID)

RemovedReacts returns the removed IDs of the "reacts" edge to the React entity.

func (*PostMutation) RemovedRepliesIDs

func (m *PostMutation) RemovedRepliesIDs() (ids []xid.ID)

RemovedReplies returns the removed IDs of the "replies" edge to the Post entity.

func (*PostMutation) RemovedTagsIDs

func (m *PostMutation) RemovedTagsIDs() (ids []xid.ID)

RemovedTags returns the removed IDs of the "tags" edge to the Tag entity.

func (*PostMutation) RepliesCleared

func (m *PostMutation) RepliesCleared() bool

RepliesCleared reports if the "replies" edge to the Post entity was cleared.

func (*PostMutation) RepliesIDs

func (m *PostMutation) RepliesIDs() (ids []xid.ID)

RepliesIDs returns the "replies" edge IDs in the mutation.

func (*PostMutation) ReplyToCleared

func (m *PostMutation) ReplyToCleared() bool

ReplyToCleared reports if the "replyTo" edge to the Post entity was cleared.

func (*PostMutation) ReplyToID

func (m *PostMutation) ReplyToID() (id xid.ID, exists bool)

ReplyToID returns the "replyTo" edge ID in the mutation.

func (*PostMutation) ReplyToIDs

func (m *PostMutation) ReplyToIDs() (ids []xid.ID)

ReplyToIDs returns the "replyTo" edge IDs in the mutation. Note that IDs always returns len(IDs) <= 1 for unique edges, and you should use ReplyToID instead. It exists only for internal usage by the builders.

func (*PostMutation) ReplyToPostID

func (m *PostMutation) ReplyToPostID() (r xid.ID, exists bool)

ReplyToPostID returns the value of the "reply_to_post_id" field in the mutation.

func (*PostMutation) ReplyToPostIDCleared

func (m *PostMutation) ReplyToPostIDCleared() bool

ReplyToPostIDCleared returns if the "reply_to_post_id" field was cleared in this mutation.

func (*PostMutation) ResetAuthor

func (m *PostMutation) ResetAuthor()

ResetAuthor resets all changes to the "author" edge.

func (*PostMutation) ResetBody

func (m *PostMutation) ResetBody()

ResetBody resets all changes to the "body" field.

func (*PostMutation) ResetCategory

func (m *PostMutation) ResetCategory()

ResetCategory resets all changes to the "category" edge.

func (*PostMutation) ResetCategoryID

func (m *PostMutation) ResetCategoryID()

ResetCategoryID resets all changes to the "category_id" field.

func (*PostMutation) ResetCreatedAt

func (m *PostMutation) ResetCreatedAt()

ResetCreatedAt resets all changes to the "created_at" field.

func (*PostMutation) ResetDeletedAt

func (m *PostMutation) ResetDeletedAt()

ResetDeletedAt resets all changes to the "deleted_at" field.

func (*PostMutation) ResetEdge

func (m *PostMutation) 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 (*PostMutation) ResetField

func (m *PostMutation) 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 (*PostMutation) ResetFirst

func (m *PostMutation) ResetFirst()

ResetFirst resets all changes to the "first" field.

func (*PostMutation) ResetPinned

func (m *PostMutation) ResetPinned()

ResetPinned resets all changes to the "pinned" field.

func (*PostMutation) ResetPosts

func (m *PostMutation) ResetPosts()

ResetPosts resets all changes to the "posts" edge.

func (*PostMutation) ResetReacts

func (m *PostMutation) ResetReacts()

ResetReacts resets all changes to the "reacts" edge.

func (*PostMutation) ResetReplies

func (m *PostMutation) ResetReplies()

ResetReplies resets all changes to the "replies" edge.

func (*PostMutation) ResetReplyTo

func (m *PostMutation) ResetReplyTo()

ResetReplyTo resets all changes to the "replyTo" edge.

func (*PostMutation) ResetReplyToPostID

func (m *PostMutation) ResetReplyToPostID()

ResetReplyToPostID resets all changes to the "reply_to_post_id" field.

func (*PostMutation) ResetRoot

func (m *PostMutation) ResetRoot()

ResetRoot resets all changes to the "root" edge.

func (*PostMutation) ResetRootPostID

func (m *PostMutation) ResetRootPostID()

ResetRootPostID resets all changes to the "root_post_id" field.

func (*PostMutation) ResetShort

func (m *PostMutation) ResetShort()

ResetShort resets all changes to the "short" field.

func (*PostMutation) ResetSlug

func (m *PostMutation) ResetSlug()

ResetSlug resets all changes to the "slug" field.

func (*PostMutation) ResetTags

func (m *PostMutation) ResetTags()

ResetTags resets all changes to the "tags" edge.

func (*PostMutation) ResetTitle

func (m *PostMutation) ResetTitle()

ResetTitle resets all changes to the "title" field.

func (*PostMutation) ResetUpdatedAt

func (m *PostMutation) ResetUpdatedAt()

ResetUpdatedAt resets all changes to the "updated_at" field.

func (*PostMutation) RootCleared

func (m *PostMutation) RootCleared() bool

RootCleared reports if the "root" edge to the Post entity was cleared.

func (*PostMutation) RootID

func (m *PostMutation) RootID() (id xid.ID, exists bool)

RootID returns the "root" edge ID in the mutation.

func (*PostMutation) RootIDs

func (m *PostMutation) RootIDs() (ids []xid.ID)

RootIDs returns the "root" edge IDs in the mutation. Note that IDs always returns len(IDs) <= 1 for unique edges, and you should use RootID instead. It exists only for internal usage by the builders.

func (*PostMutation) RootPostID

func (m *PostMutation) RootPostID() (r xid.ID, exists bool)

RootPostID returns the value of the "root_post_id" field in the mutation.

func (*PostMutation) RootPostIDCleared

func (m *PostMutation) RootPostIDCleared() bool

RootPostIDCleared returns if the "root_post_id" field was cleared in this mutation.

func (*PostMutation) SetAuthorID

func (m *PostMutation) SetAuthorID(id xid.ID)

SetAuthorID sets the "author" edge to the Account entity by id.

func (*PostMutation) SetBody

func (m *PostMutation) SetBody(s string)

SetBody sets the "body" field.

func (*PostMutation) SetCategoryID

func (m *PostMutation) SetCategoryID(x xid.ID)

SetCategoryID sets the "category_id" field.

func (*PostMutation) SetCreatedAt

func (m *PostMutation) SetCreatedAt(t time.Time)

SetCreatedAt sets the "created_at" field.

func (*PostMutation) SetDeletedAt

func (m *PostMutation) SetDeletedAt(t time.Time)

SetDeletedAt sets the "deleted_at" field.

func (*PostMutation) SetField

func (m *PostMutation) 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 (*PostMutation) SetFirst

func (m *PostMutation) SetFirst(b bool)

SetFirst sets the "first" field.

func (*PostMutation) SetID

func (m *PostMutation) SetID(id xid.ID)

SetID sets the value of the id field. Note that this operation is only accepted on creation of Post entities.

func (*PostMutation) SetPinned

func (m *PostMutation) SetPinned(b bool)

SetPinned sets the "pinned" field.

func (*PostMutation) SetReplyToID

func (m *PostMutation) SetReplyToID(id xid.ID)

SetReplyToID sets the "replyTo" edge to the Post entity by id.

func (*PostMutation) SetReplyToPostID

func (m *PostMutation) SetReplyToPostID(x xid.ID)

SetReplyToPostID sets the "reply_to_post_id" field.

func (*PostMutation) SetRootID

func (m *PostMutation) SetRootID(id xid.ID)

SetRootID sets the "root" edge to the Post entity by id.

func (*PostMutation) SetRootPostID

func (m *PostMutation) SetRootPostID(x xid.ID)

SetRootPostID sets the "root_post_id" field.

func (*PostMutation) SetShort

func (m *PostMutation) SetShort(s string)

SetShort sets the "short" field.

func (*PostMutation) SetSlug

func (m *PostMutation) SetSlug(s string)

SetSlug sets the "slug" field.

func (*PostMutation) SetTitle

func (m *PostMutation) SetTitle(s string)

SetTitle sets the "title" field.

func (*PostMutation) SetUpdatedAt

func (m *PostMutation) SetUpdatedAt(t time.Time)

SetUpdatedAt sets the "updated_at" field.

func (*PostMutation) Short

func (m *PostMutation) Short() (r string, exists bool)

Short returns the value of the "short" field in the mutation.

func (*PostMutation) Slug

func (m *PostMutation) Slug() (r string, exists bool)

Slug returns the value of the "slug" field in the mutation.

func (*PostMutation) SlugCleared

func (m *PostMutation) SlugCleared() bool

SlugCleared returns if the "slug" field was cleared in this mutation.

func (*PostMutation) TagsCleared

func (m *PostMutation) TagsCleared() bool

TagsCleared reports if the "tags" edge to the Tag entity was cleared.

func (*PostMutation) TagsIDs

func (m *PostMutation) TagsIDs() (ids []xid.ID)

TagsIDs returns the "tags" edge IDs in the mutation.

func (*PostMutation) Title

func (m *PostMutation) Title() (r string, exists bool)

Title returns the value of the "title" field in the mutation.

func (*PostMutation) TitleCleared

func (m *PostMutation) TitleCleared() bool

TitleCleared returns if the "title" field was cleared in this mutation.

func (PostMutation) Tx

func (m PostMutation) Tx() (*Tx, error)

Tx returns an `ent.Tx` for mutations that were executed in transactions; it returns an error otherwise.

func (*PostMutation) Type

func (m *PostMutation) Type() string

Type returns the node type of this mutation (Post).

func (*PostMutation) UpdatedAt

func (m *PostMutation) UpdatedAt() (r time.Time, exists bool)

UpdatedAt returns the value of the "updated_at" field in the mutation.

func (*PostMutation) Where

func (m *PostMutation) Where(ps ...predicate.Post)

Where appends a list predicates to the PostMutation builder.

type PostQuery

type PostQuery struct {
	// contains filtered or unexported fields
}

PostQuery is the builder for querying Post entities.

func (*PostQuery) All

func (pq *PostQuery) All(ctx context.Context) ([]*Post, error)

All executes the query and returns a list of Posts.

func (*PostQuery) AllX

func (pq *PostQuery) AllX(ctx context.Context) []*Post

AllX is like All, but panics if an error occurs.

func (*PostQuery) Clone

func (pq *PostQuery) Clone() *PostQuery

Clone returns a duplicate of the PostQuery builder, including all associated steps. It can be used to prepare common query builders and use them differently after the clone is made.

func (*PostQuery) Count

func (pq *PostQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*PostQuery) CountX

func (pq *PostQuery) CountX(ctx context.Context) int

CountX is like Count, but panics if an error occurs.

func (*PostQuery) Exist

func (pq *PostQuery) Exist(ctx context.Context) (bool, error)

Exist returns true if the query has elements in the graph.

func (*PostQuery) ExistX

func (pq *PostQuery) ExistX(ctx context.Context) bool

ExistX is like Exist, but panics if an error occurs.

func (*PostQuery) First

func (pq *PostQuery) First(ctx context.Context) (*Post, error)

First returns the first Post entity from the query. Returns a *NotFoundError when no Post was found.

func (*PostQuery) FirstID

func (pq *PostQuery) FirstID(ctx context.Context) (id xid.ID, err error)

FirstID returns the first Post ID from the query. Returns a *NotFoundError when no Post ID was found.

func (*PostQuery) FirstIDX

func (pq *PostQuery) FirstIDX(ctx context.Context) xid.ID

FirstIDX is like FirstID, but panics if an error occurs.

func (*PostQuery) FirstX

func (pq *PostQuery) FirstX(ctx context.Context) *Post

FirstX is like First, but panics if an error occurs.

func (*PostQuery) GroupBy

func (pq *PostQuery) GroupBy(field string, fields ...string) *PostGroupBy

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 {
	CreatedAt time.Time `json:"created_at,omitempty"`
	Count int `json:"count,omitempty"`
}

client.Post.Query().
	GroupBy(post.FieldCreatedAt).
	Aggregate(model.Count()).
	Scan(ctx, &v)

func (*PostQuery) IDs

func (pq *PostQuery) IDs(ctx context.Context) ([]xid.ID, error)

IDs executes the query and returns a list of Post IDs.

func (*PostQuery) IDsX

func (pq *PostQuery) IDsX(ctx context.Context) []xid.ID

IDsX is like IDs, but panics if an error occurs.

func (*PostQuery) Limit

func (pq *PostQuery) Limit(limit int) *PostQuery

Limit adds a limit step to the query.

func (*PostQuery) Modify

func (pq *PostQuery) Modify(modifiers ...func(s *sql.Selector)) *PostSelect

Modify adds a query modifier for attaching custom logic to queries.

func (*PostQuery) Offset

func (pq *PostQuery) Offset(offset int) *PostQuery

Offset adds an offset step to the query.

func (*PostQuery) Only

func (pq *PostQuery) Only(ctx context.Context) (*Post, error)

Only returns a single Post entity found by the query, ensuring it only returns one. Returns a *NotSingularError when more than one Post entity is found. Returns a *NotFoundError when no Post entities are found.

func (*PostQuery) OnlyID

func (pq *PostQuery) OnlyID(ctx context.Context) (id xid.ID, err error)

OnlyID is like Only, but returns the only Post ID in the query. Returns a *NotSingularError when more than one Post ID is found. Returns a *NotFoundError when no entities are found.

func (*PostQuery) OnlyIDX

func (pq *PostQuery) OnlyIDX(ctx context.Context) xid.ID

OnlyIDX is like OnlyID, but panics if an error occurs.

func (*PostQuery) OnlyX

func (pq *PostQuery) OnlyX(ctx context.Context) *Post

OnlyX is like Only, but panics if an error occurs.

func (*PostQuery) Order

func (pq *PostQuery) Order(o ...OrderFunc) *PostQuery

Order adds an order step to the query.

func (*PostQuery) QueryAuthor

func (pq *PostQuery) QueryAuthor() *AccountQuery

QueryAuthor chains the current query on the "author" edge.

func (*PostQuery) QueryCategory

func (pq *PostQuery) QueryCategory() *CategoryQuery

QueryCategory chains the current query on the "category" edge.

func (*PostQuery) QueryPosts

func (pq *PostQuery) QueryPosts() *PostQuery

QueryPosts chains the current query on the "posts" edge.

func (*PostQuery) QueryReacts

func (pq *PostQuery) QueryReacts() *ReactQuery

QueryReacts chains the current query on the "reacts" edge.

func (*PostQuery) QueryReplies

func (pq *PostQuery) QueryReplies() *PostQuery

QueryReplies chains the current query on the "replies" edge.

func (*PostQuery) QueryReplyTo

func (pq *PostQuery) QueryReplyTo() *PostQuery

QueryReplyTo chains the current query on the "replyTo" edge.

func (*PostQuery) QueryRoot

func (pq *PostQuery) QueryRoot() *PostQuery

QueryRoot chains the current query on the "root" edge.

func (*PostQuery) QueryTags

func (pq *PostQuery) QueryTags() *TagQuery

QueryTags chains the current query on the "tags" edge.

func (*PostQuery) Select

func (pq *PostQuery) Select(fields ...string) *PostSelect

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 {
	CreatedAt time.Time `json:"created_at,omitempty"`
}

client.Post.Query().
	Select(post.FieldCreatedAt).
	Scan(ctx, &v)

func (*PostQuery) Unique

func (pq *PostQuery) Unique(unique bool) *PostQuery

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 (*PostQuery) Where

func (pq *PostQuery) Where(ps ...predicate.Post) *PostQuery

Where adds a new predicate for the PostQuery builder.

func (*PostQuery) WithAuthor

func (pq *PostQuery) WithAuthor(opts ...func(*AccountQuery)) *PostQuery

WithAuthor tells the query-builder to eager-load the nodes that are connected to the "author" edge. The optional arguments are used to configure the query builder of the edge.

func (*PostQuery) WithCategory

func (pq *PostQuery) WithCategory(opts ...func(*CategoryQuery)) *PostQuery

WithCategory tells the query-builder to eager-load the nodes that are connected to the "category" edge. The optional arguments are used to configure the query builder of the edge.

func (*PostQuery) WithPosts

func (pq *PostQuery) WithPosts(opts ...func(*PostQuery)) *PostQuery

WithPosts tells the query-builder to eager-load the nodes that are connected to the "posts" edge. The optional arguments are used to configure the query builder of the edge.

func (*PostQuery) WithReacts

func (pq *PostQuery) WithReacts(opts ...func(*ReactQuery)) *PostQuery

WithReacts tells the query-builder to eager-load the nodes that are connected to the "reacts" edge. The optional arguments are used to configure the query builder of the edge.

func (*PostQuery) WithReplies

func (pq *PostQuery) WithReplies(opts ...func(*PostQuery)) *PostQuery

WithReplies tells the query-builder to eager-load the nodes that are connected to the "replies" edge. The optional arguments are used to configure the query builder of the edge.

func (*PostQuery) WithReplyTo

func (pq *PostQuery) WithReplyTo(opts ...func(*PostQuery)) *PostQuery

WithReplyTo tells the query-builder to eager-load the nodes that are connected to the "replyTo" edge. The optional arguments are used to configure the query builder of the edge.

func (*PostQuery) WithRoot

func (pq *PostQuery) WithRoot(opts ...func(*PostQuery)) *PostQuery

WithRoot tells the query-builder to eager-load the nodes that are connected to the "root" edge. The optional arguments are used to configure the query builder of the edge.

func (*PostQuery) WithTags

func (pq *PostQuery) WithTags(opts ...func(*TagQuery)) *PostQuery

WithTags tells the query-builder to eager-load the nodes that are connected to the "tags" edge. The optional arguments are used to configure the query builder of the edge.

type PostSelect

type PostSelect struct {
	*PostQuery
	// contains filtered or unexported fields
}

PostSelect is the builder for selecting fields of Post entities.

func (*PostSelect) Bool

func (s *PostSelect) Bool(ctx context.Context) (_ bool, err error)

Bool returns a single bool from a selector. It is only allowed when selecting one field.

func (*PostSelect) BoolX

func (s *PostSelect) BoolX(ctx context.Context) bool

BoolX is like Bool, but panics if an error occurs.

func (*PostSelect) Bools

func (s *PostSelect) Bools(ctx context.Context) ([]bool, error)

Bools returns list of bools from a selector. It is only allowed when selecting one field.

func (*PostSelect) BoolsX

func (s *PostSelect) BoolsX(ctx context.Context) []bool

BoolsX is like Bools, but panics if an error occurs.

func (*PostSelect) Float64

func (s *PostSelect) Float64(ctx context.Context) (_ float64, err error)

Float64 returns a single float64 from a selector. It is only allowed when selecting one field.

func (*PostSelect) Float64X

func (s *PostSelect) Float64X(ctx context.Context) float64

Float64X is like Float64, but panics if an error occurs.

func (*PostSelect) Float64s

func (s *PostSelect) Float64s(ctx context.Context) ([]float64, error)

Float64s returns list of float64s from a selector. It is only allowed when selecting one field.

func (*PostSelect) Float64sX

func (s *PostSelect) Float64sX(ctx context.Context) []float64

Float64sX is like Float64s, but panics if an error occurs.

func (*PostSelect) Int

func (s *PostSelect) Int(ctx context.Context) (_ int, err error)

Int returns a single int from a selector. It is only allowed when selecting one field.

func (*PostSelect) IntX

func (s *PostSelect) IntX(ctx context.Context) int

IntX is like Int, but panics if an error occurs.

func (*PostSelect) Ints

func (s *PostSelect) Ints(ctx context.Context) ([]int, error)

Ints returns list of ints from a selector. It is only allowed when selecting one field.

func (*PostSelect) IntsX

func (s *PostSelect) IntsX(ctx context.Context) []int

IntsX is like Ints, but panics if an error occurs.

func (*PostSelect) Modify

func (ps *PostSelect) Modify(modifiers ...func(s *sql.Selector)) *PostSelect

Modify adds a query modifier for attaching custom logic to queries.

func (*PostSelect) Scan

func (ps *PostSelect) Scan(ctx context.Context, v interface{}) error

Scan applies the selector query and scans the result into the given value.

func (*PostSelect) ScanX

func (s *PostSelect) ScanX(ctx context.Context, v interface{})

ScanX is like Scan, but panics if an error occurs.

func (*PostSelect) String

func (s *PostSelect) String(ctx context.Context) (_ string, err error)

String returns a single string from a selector. It is only allowed when selecting one field.

func (*PostSelect) StringX

func (s *PostSelect) StringX(ctx context.Context) string

StringX is like String, but panics if an error occurs.

func (*PostSelect) Strings

func (s *PostSelect) Strings(ctx context.Context) ([]string, error)

Strings returns list of strings from a selector. It is only allowed when selecting one field.

func (*PostSelect) StringsX

func (s *PostSelect) StringsX(ctx context.Context) []string

StringsX is like Strings, but panics if an error occurs.

type PostUpdate

type PostUpdate struct {
	// contains filtered or unexported fields
}

PostUpdate is the builder for updating Post entities.

func (*PostUpdate) AddPostIDs

func (pu *PostUpdate) AddPostIDs(ids ...xid.ID) *PostUpdate

AddPostIDs adds the "posts" edge to the Post entity by IDs.

func (*PostUpdate) AddPosts

func (pu *PostUpdate) AddPosts(p ...*Post) *PostUpdate

AddPosts adds the "posts" edges to the Post entity.

func (*PostUpdate) AddReactIDs

func (pu *PostUpdate) AddReactIDs(ids ...xid.ID) *PostUpdate

AddReactIDs adds the "reacts" edge to the React entity by IDs.

func (*PostUpdate) AddReacts

func (pu *PostUpdate) AddReacts(r ...*React) *PostUpdate

AddReacts adds the "reacts" edges to the React entity.

func (*PostUpdate) AddReplies

func (pu *PostUpdate) AddReplies(p ...*Post) *PostUpdate

AddReplies adds the "replies" edges to the Post entity.

func (*PostUpdate) AddReplyIDs

func (pu *PostUpdate) AddReplyIDs(ids ...xid.ID) *PostUpdate

AddReplyIDs adds the "replies" edge to the Post entity by IDs.

func (*PostUpdate) AddTagIDs

func (pu *PostUpdate) AddTagIDs(ids ...xid.ID) *PostUpdate

AddTagIDs adds the "tags" edge to the Tag entity by IDs.

func (*PostUpdate) AddTags

func (pu *PostUpdate) AddTags(t ...*Tag) *PostUpdate

AddTags adds the "tags" edges to the Tag entity.

func (*PostUpdate) ClearAuthor

func (pu *PostUpdate) ClearAuthor() *PostUpdate

ClearAuthor clears the "author" edge to the Account entity.

func (*PostUpdate) ClearCategory

func (pu *PostUpdate) ClearCategory() *PostUpdate

ClearCategory clears the "category" edge to the Category entity.

func (*PostUpdate) ClearCategoryID

func (pu *PostUpdate) ClearCategoryID() *PostUpdate

ClearCategoryID clears the value of the "category_id" field.

func (*PostUpdate) ClearDeletedAt

func (pu *PostUpdate) ClearDeletedAt() *PostUpdate

ClearDeletedAt clears the value of the "deleted_at" field.

func (*PostUpdate) ClearPosts

func (pu *PostUpdate) ClearPosts() *PostUpdate

ClearPosts clears all "posts" edges to the Post entity.

func (*PostUpdate) ClearReacts

func (pu *PostUpdate) ClearReacts() *PostUpdate

ClearReacts clears all "reacts" edges to the React entity.

func (*PostUpdate) ClearReplies

func (pu *PostUpdate) ClearReplies() *PostUpdate

ClearReplies clears all "replies" edges to the Post entity.

func (*PostUpdate) ClearReplyTo

func (pu *PostUpdate) ClearReplyTo() *PostUpdate

ClearReplyTo clears the "replyTo" edge to the Post entity.

func (*PostUpdate) ClearReplyToPostID

func (pu *PostUpdate) ClearReplyToPostID() *PostUpdate

ClearReplyToPostID clears the value of the "reply_to_post_id" field.

func (*PostUpdate) ClearRoot

func (pu *PostUpdate) ClearRoot() *PostUpdate

ClearRoot clears the "root" edge to the Post entity.

func (*PostUpdate) ClearRootPostID

func (pu *PostUpdate) ClearRootPostID() *PostUpdate

ClearRootPostID clears the value of the "root_post_id" field.

func (*PostUpdate) ClearSlug

func (pu *PostUpdate) ClearSlug() *PostUpdate

ClearSlug clears the value of the "slug" field.

func (*PostUpdate) ClearTags

func (pu *PostUpdate) ClearTags() *PostUpdate

ClearTags clears all "tags" edges to the Tag entity.

func (*PostUpdate) ClearTitle

func (pu *PostUpdate) ClearTitle() *PostUpdate

ClearTitle clears the value of the "title" field.

func (*PostUpdate) Exec

func (pu *PostUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*PostUpdate) ExecX

func (pu *PostUpdate) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*PostUpdate) Modify

func (pu *PostUpdate) Modify(modifiers ...func(u *sql.UpdateBuilder)) *PostUpdate

Modify adds a statement modifier for attaching custom logic to the UPDATE statement.

func (*PostUpdate) Mutation

func (pu *PostUpdate) Mutation() *PostMutation

Mutation returns the PostMutation object of the builder.

func (*PostUpdate) RemovePostIDs

func (pu *PostUpdate) RemovePostIDs(ids ...xid.ID) *PostUpdate

RemovePostIDs removes the "posts" edge to Post entities by IDs.

func (*PostUpdate) RemovePosts

func (pu *PostUpdate) RemovePosts(p ...*Post) *PostUpdate

RemovePosts removes "posts" edges to Post entities.

func (*PostUpdate) RemoveReactIDs

func (pu *PostUpdate) RemoveReactIDs(ids ...xid.ID) *PostUpdate

RemoveReactIDs removes the "reacts" edge to React entities by IDs.

func (*PostUpdate) RemoveReacts

func (pu *PostUpdate) RemoveReacts(r ...*React) *PostUpdate

RemoveReacts removes "reacts" edges to React entities.

func (*PostUpdate) RemoveReplies

func (pu *PostUpdate) RemoveReplies(p ...*Post) *PostUpdate

RemoveReplies removes "replies" edges to Post entities.

func (*PostUpdate) RemoveReplyIDs

func (pu *PostUpdate) RemoveReplyIDs(ids ...xid.ID) *PostUpdate

RemoveReplyIDs removes the "replies" edge to Post entities by IDs.

func (*PostUpdate) RemoveTagIDs

func (pu *PostUpdate) RemoveTagIDs(ids ...xid.ID) *PostUpdate

RemoveTagIDs removes the "tags" edge to Tag entities by IDs.

func (*PostUpdate) RemoveTags

func (pu *PostUpdate) RemoveTags(t ...*Tag) *PostUpdate

RemoveTags removes "tags" edges to Tag entities.

func (*PostUpdate) Save

func (pu *PostUpdate) Save(ctx context.Context) (int, error)

Save executes the query and returns the number of nodes affected by the update operation.

func (*PostUpdate) SaveX

func (pu *PostUpdate) SaveX(ctx context.Context) int

SaveX is like Save, but panics if an error occurs.

func (*PostUpdate) SetAuthor

func (pu *PostUpdate) SetAuthor(a *Account) *PostUpdate

SetAuthor sets the "author" edge to the Account entity.

func (*PostUpdate) SetAuthorID

func (pu *PostUpdate) SetAuthorID(id xid.ID) *PostUpdate

SetAuthorID sets the "author" edge to the Account entity by ID.

func (*PostUpdate) SetBody

func (pu *PostUpdate) SetBody(s string) *PostUpdate

SetBody sets the "body" field.

func (*PostUpdate) SetCategory

func (pu *PostUpdate) SetCategory(c *Category) *PostUpdate

SetCategory sets the "category" edge to the Category entity.

func (*PostUpdate) SetCategoryID

func (pu *PostUpdate) SetCategoryID(x xid.ID) *PostUpdate

SetCategoryID sets the "category_id" field.

func (*PostUpdate) SetDeletedAt

func (pu *PostUpdate) SetDeletedAt(t time.Time) *PostUpdate

SetDeletedAt sets the "deleted_at" field.

func (*PostUpdate) SetFirst

func (pu *PostUpdate) SetFirst(b bool) *PostUpdate

SetFirst sets the "first" field.

func (*PostUpdate) SetNillableCategoryID

func (pu *PostUpdate) SetNillableCategoryID(x *xid.ID) *PostUpdate

SetNillableCategoryID sets the "category_id" field if the given value is not nil.

func (*PostUpdate) SetNillableDeletedAt

func (pu *PostUpdate) SetNillableDeletedAt(t *time.Time) *PostUpdate

SetNillableDeletedAt sets the "deleted_at" field if the given value is not nil.

func (*PostUpdate) SetNillablePinned

func (pu *PostUpdate) SetNillablePinned(b *bool) *PostUpdate

SetNillablePinned sets the "pinned" field if the given value is not nil.

func (*PostUpdate) SetNillableReplyToID

func (pu *PostUpdate) SetNillableReplyToID(id *xid.ID) *PostUpdate

SetNillableReplyToID sets the "replyTo" edge to the Post entity by ID if the given value is not nil.

func (*PostUpdate) SetNillableReplyToPostID

func (pu *PostUpdate) SetNillableReplyToPostID(x *xid.ID) *PostUpdate

SetNillableReplyToPostID sets the "reply_to_post_id" field if the given value is not nil.

func (*PostUpdate) SetNillableRootID

func (pu *PostUpdate) SetNillableRootID(id *xid.ID) *PostUpdate

SetNillableRootID sets the "root" edge to the Post entity by ID if the given value is not nil.

func (*PostUpdate) SetNillableRootPostID

func (pu *PostUpdate) SetNillableRootPostID(x *xid.ID) *PostUpdate

SetNillableRootPostID sets the "root_post_id" field if the given value is not nil.

func (*PostUpdate) SetNillableSlug

func (pu *PostUpdate) SetNillableSlug(s *string) *PostUpdate

SetNillableSlug sets the "slug" field if the given value is not nil.

func (*PostUpdate) SetNillableTitle

func (pu *PostUpdate) SetNillableTitle(s *string) *PostUpdate

SetNillableTitle sets the "title" field if the given value is not nil.

func (*PostUpdate) SetPinned

func (pu *PostUpdate) SetPinned(b bool) *PostUpdate

SetPinned sets the "pinned" field.

func (*PostUpdate) SetReplyTo

func (pu *PostUpdate) SetReplyTo(p *Post) *PostUpdate

SetReplyTo sets the "replyTo" edge to the Post entity.

func (*PostUpdate) SetReplyToID

func (pu *PostUpdate) SetReplyToID(id xid.ID) *PostUpdate

SetReplyToID sets the "replyTo" edge to the Post entity by ID.

func (*PostUpdate) SetReplyToPostID

func (pu *PostUpdate) SetReplyToPostID(x xid.ID) *PostUpdate

SetReplyToPostID sets the "reply_to_post_id" field.

func (*PostUpdate) SetRoot

func (pu *PostUpdate) SetRoot(p *Post) *PostUpdate

SetRoot sets the "root" edge to the Post entity.

func (*PostUpdate) SetRootID

func (pu *PostUpdate) SetRootID(id xid.ID) *PostUpdate

SetRootID sets the "root" edge to the Post entity by ID.

func (*PostUpdate) SetRootPostID

func (pu *PostUpdate) SetRootPostID(x xid.ID) *PostUpdate

SetRootPostID sets the "root_post_id" field.

func (*PostUpdate) SetShort

func (pu *PostUpdate) SetShort(s string) *PostUpdate

SetShort sets the "short" field.

func (*PostUpdate) SetSlug

func (pu *PostUpdate) SetSlug(s string) *PostUpdate

SetSlug sets the "slug" field.

func (*PostUpdate) SetTitle

func (pu *PostUpdate) SetTitle(s string) *PostUpdate

SetTitle sets the "title" field.

func (*PostUpdate) SetUpdatedAt

func (pu *PostUpdate) SetUpdatedAt(t time.Time) *PostUpdate

SetUpdatedAt sets the "updated_at" field.

func (*PostUpdate) Where

func (pu *PostUpdate) Where(ps ...predicate.Post) *PostUpdate

Where appends a list predicates to the PostUpdate builder.

type PostUpdateOne

type PostUpdateOne struct {
	// contains filtered or unexported fields
}

PostUpdateOne is the builder for updating a single Post entity.

func (*PostUpdateOne) AddPostIDs

func (puo *PostUpdateOne) AddPostIDs(ids ...xid.ID) *PostUpdateOne

AddPostIDs adds the "posts" edge to the Post entity by IDs.

func (*PostUpdateOne) AddPosts

func (puo *PostUpdateOne) AddPosts(p ...*Post) *PostUpdateOne

AddPosts adds the "posts" edges to the Post entity.

func (*PostUpdateOne) AddReactIDs

func (puo *PostUpdateOne) AddReactIDs(ids ...xid.ID) *PostUpdateOne

AddReactIDs adds the "reacts" edge to the React entity by IDs.

func (*PostUpdateOne) AddReacts

func (puo *PostUpdateOne) AddReacts(r ...*React) *PostUpdateOne

AddReacts adds the "reacts" edges to the React entity.

func (*PostUpdateOne) AddReplies

func (puo *PostUpdateOne) AddReplies(p ...*Post) *PostUpdateOne

AddReplies adds the "replies" edges to the Post entity.

func (*PostUpdateOne) AddReplyIDs

func (puo *PostUpdateOne) AddReplyIDs(ids ...xid.ID) *PostUpdateOne

AddReplyIDs adds the "replies" edge to the Post entity by IDs.

func (*PostUpdateOne) AddTagIDs

func (puo *PostUpdateOne) AddTagIDs(ids ...xid.ID) *PostUpdateOne

AddTagIDs adds the "tags" edge to the Tag entity by IDs.

func (*PostUpdateOne) AddTags

func (puo *PostUpdateOne) AddTags(t ...*Tag) *PostUpdateOne

AddTags adds the "tags" edges to the Tag entity.

func (*PostUpdateOne) ClearAuthor

func (puo *PostUpdateOne) ClearAuthor() *PostUpdateOne

ClearAuthor clears the "author" edge to the Account entity.

func (*PostUpdateOne) ClearCategory

func (puo *PostUpdateOne) ClearCategory() *PostUpdateOne

ClearCategory clears the "category" edge to the Category entity.

func (*PostUpdateOne) ClearCategoryID

func (puo *PostUpdateOne) ClearCategoryID() *PostUpdateOne

ClearCategoryID clears the value of the "category_id" field.

func (*PostUpdateOne) ClearDeletedAt

func (puo *PostUpdateOne) ClearDeletedAt() *PostUpdateOne

ClearDeletedAt clears the value of the "deleted_at" field.

func (*PostUpdateOne) ClearPosts

func (puo *PostUpdateOne) ClearPosts() *PostUpdateOne

ClearPosts clears all "posts" edges to the Post entity.

func (*PostUpdateOne) ClearReacts

func (puo *PostUpdateOne) ClearReacts() *PostUpdateOne

ClearReacts clears all "reacts" edges to the React entity.

func (*PostUpdateOne) ClearReplies

func (puo *PostUpdateOne) ClearReplies() *PostUpdateOne

ClearReplies clears all "replies" edges to the Post entity.

func (*PostUpdateOne) ClearReplyTo

func (puo *PostUpdateOne) ClearReplyTo() *PostUpdateOne

ClearReplyTo clears the "replyTo" edge to the Post entity.

func (*PostUpdateOne) ClearReplyToPostID

func (puo *PostUpdateOne) ClearReplyToPostID() *PostUpdateOne

ClearReplyToPostID clears the value of the "reply_to_post_id" field.

func (*PostUpdateOne) ClearRoot

func (puo *PostUpdateOne) ClearRoot() *PostUpdateOne

ClearRoot clears the "root" edge to the Post entity.

func (*PostUpdateOne) ClearRootPostID

func (puo *PostUpdateOne) ClearRootPostID() *PostUpdateOne

ClearRootPostID clears the value of the "root_post_id" field.

func (*PostUpdateOne) ClearSlug

func (puo *PostUpdateOne) ClearSlug() *PostUpdateOne

ClearSlug clears the value of the "slug" field.

func (*PostUpdateOne) ClearTags

func (puo *PostUpdateOne) ClearTags() *PostUpdateOne

ClearTags clears all "tags" edges to the Tag entity.

func (*PostUpdateOne) ClearTitle

func (puo *PostUpdateOne) ClearTitle() *PostUpdateOne

ClearTitle clears the value of the "title" field.

func (*PostUpdateOne) Exec

func (puo *PostUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*PostUpdateOne) ExecX

func (puo *PostUpdateOne) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*PostUpdateOne) Modify

func (puo *PostUpdateOne) Modify(modifiers ...func(u *sql.UpdateBuilder)) *PostUpdateOne

Modify adds a statement modifier for attaching custom logic to the UPDATE statement.

func (*PostUpdateOne) Mutation

func (puo *PostUpdateOne) Mutation() *PostMutation

Mutation returns the PostMutation object of the builder.

func (*PostUpdateOne) RemovePostIDs

func (puo *PostUpdateOne) RemovePostIDs(ids ...xid.ID) *PostUpdateOne

RemovePostIDs removes the "posts" edge to Post entities by IDs.

func (*PostUpdateOne) RemovePosts

func (puo *PostUpdateOne) RemovePosts(p ...*Post) *PostUpdateOne

RemovePosts removes "posts" edges to Post entities.

func (*PostUpdateOne) RemoveReactIDs

func (puo *PostUpdateOne) RemoveReactIDs(ids ...xid.ID) *PostUpdateOne

RemoveReactIDs removes the "reacts" edge to React entities by IDs.

func (*PostUpdateOne) RemoveReacts

func (puo *PostUpdateOne) RemoveReacts(r ...*React) *PostUpdateOne

RemoveReacts removes "reacts" edges to React entities.

func (*PostUpdateOne) RemoveReplies

func (puo *PostUpdateOne) RemoveReplies(p ...*Post) *PostUpdateOne

RemoveReplies removes "replies" edges to Post entities.

func (*PostUpdateOne) RemoveReplyIDs

func (puo *PostUpdateOne) RemoveReplyIDs(ids ...xid.ID) *PostUpdateOne

RemoveReplyIDs removes the "replies" edge to Post entities by IDs.

func (*PostUpdateOne) RemoveTagIDs

func (puo *PostUpdateOne) RemoveTagIDs(ids ...xid.ID) *PostUpdateOne

RemoveTagIDs removes the "tags" edge to Tag entities by IDs.

func (*PostUpdateOne) RemoveTags

func (puo *PostUpdateOne) RemoveTags(t ...*Tag) *PostUpdateOne

RemoveTags removes "tags" edges to Tag entities.

func (*PostUpdateOne) Save

func (puo *PostUpdateOne) Save(ctx context.Context) (*Post, error)

Save executes the query and returns the updated Post entity.

func (*PostUpdateOne) SaveX

func (puo *PostUpdateOne) SaveX(ctx context.Context) *Post

SaveX is like Save, but panics if an error occurs.

func (*PostUpdateOne) Select

func (puo *PostUpdateOne) Select(field string, fields ...string) *PostUpdateOne

Select allows selecting one or more fields (columns) of the returned entity. The default is selecting all fields defined in the entity schema.

func (*PostUpdateOne) SetAuthor

func (puo *PostUpdateOne) SetAuthor(a *Account) *PostUpdateOne

SetAuthor sets the "author" edge to the Account entity.

func (*PostUpdateOne) SetAuthorID

func (puo *PostUpdateOne) SetAuthorID(id xid.ID) *PostUpdateOne

SetAuthorID sets the "author" edge to the Account entity by ID.

func (*PostUpdateOne) SetBody

func (puo *PostUpdateOne) SetBody(s string) *PostUpdateOne

SetBody sets the "body" field.

func (*PostUpdateOne) SetCategory

func (puo *PostUpdateOne) SetCategory(c *Category) *PostUpdateOne

SetCategory sets the "category" edge to the Category entity.

func (*PostUpdateOne) SetCategoryID

func (puo *PostUpdateOne) SetCategoryID(x xid.ID) *PostUpdateOne

SetCategoryID sets the "category_id" field.

func (*PostUpdateOne) SetDeletedAt

func (puo *PostUpdateOne) SetDeletedAt(t time.Time) *PostUpdateOne

SetDeletedAt sets the "deleted_at" field.

func (*PostUpdateOne) SetFirst

func (puo *PostUpdateOne) SetFirst(b bool) *PostUpdateOne

SetFirst sets the "first" field.

func (*PostUpdateOne) SetNillableCategoryID

func (puo *PostUpdateOne) SetNillableCategoryID(x *xid.ID) *PostUpdateOne

SetNillableCategoryID sets the "category_id" field if the given value is not nil.

func (*PostUpdateOne) SetNillableDeletedAt

func (puo *PostUpdateOne) SetNillableDeletedAt(t *time.Time) *PostUpdateOne

SetNillableDeletedAt sets the "deleted_at" field if the given value is not nil.

func (*PostUpdateOne) SetNillablePinned

func (puo *PostUpdateOne) SetNillablePinned(b *bool) *PostUpdateOne

SetNillablePinned sets the "pinned" field if the given value is not nil.

func (*PostUpdateOne) SetNillableReplyToID

func (puo *PostUpdateOne) SetNillableReplyToID(id *xid.ID) *PostUpdateOne

SetNillableReplyToID sets the "replyTo" edge to the Post entity by ID if the given value is not nil.

func (*PostUpdateOne) SetNillableReplyToPostID

func (puo *PostUpdateOne) SetNillableReplyToPostID(x *xid.ID) *PostUpdateOne

SetNillableReplyToPostID sets the "reply_to_post_id" field if the given value is not nil.

func (*PostUpdateOne) SetNillableRootID

func (puo *PostUpdateOne) SetNillableRootID(id *xid.ID) *PostUpdateOne

SetNillableRootID sets the "root" edge to the Post entity by ID if the given value is not nil.

func (*PostUpdateOne) SetNillableRootPostID

func (puo *PostUpdateOne) SetNillableRootPostID(x *xid.ID) *PostUpdateOne

SetNillableRootPostID sets the "root_post_id" field if the given value is not nil.

func (*PostUpdateOne) SetNillableSlug

func (puo *PostUpdateOne) SetNillableSlug(s *string) *PostUpdateOne

SetNillableSlug sets the "slug" field if the given value is not nil.

func (*PostUpdateOne) SetNillableTitle

func (puo *PostUpdateOne) SetNillableTitle(s *string) *PostUpdateOne

SetNillableTitle sets the "title" field if the given value is not nil.

func (*PostUpdateOne) SetPinned

func (puo *PostUpdateOne) SetPinned(b bool) *PostUpdateOne

SetPinned sets the "pinned" field.

func (*PostUpdateOne) SetReplyTo

func (puo *PostUpdateOne) SetReplyTo(p *Post) *PostUpdateOne

SetReplyTo sets the "replyTo" edge to the Post entity.

func (*PostUpdateOne) SetReplyToID

func (puo *PostUpdateOne) SetReplyToID(id xid.ID) *PostUpdateOne

SetReplyToID sets the "replyTo" edge to the Post entity by ID.

func (*PostUpdateOne) SetReplyToPostID

func (puo *PostUpdateOne) SetReplyToPostID(x xid.ID) *PostUpdateOne

SetReplyToPostID sets the "reply_to_post_id" field.

func (*PostUpdateOne) SetRoot

func (puo *PostUpdateOne) SetRoot(p *Post) *PostUpdateOne

SetRoot sets the "root" edge to the Post entity.

func (*PostUpdateOne) SetRootID

func (puo *PostUpdateOne) SetRootID(id xid.ID) *PostUpdateOne

SetRootID sets the "root" edge to the Post entity by ID.

func (*PostUpdateOne) SetRootPostID

func (puo *PostUpdateOne) SetRootPostID(x xid.ID) *PostUpdateOne

SetRootPostID sets the "root_post_id" field.

func (*PostUpdateOne) SetShort

func (puo *PostUpdateOne) SetShort(s string) *PostUpdateOne

SetShort sets the "short" field.

func (*PostUpdateOne) SetSlug

func (puo *PostUpdateOne) SetSlug(s string) *PostUpdateOne

SetSlug sets the "slug" field.

func (*PostUpdateOne) SetTitle

func (puo *PostUpdateOne) SetTitle(s string) *PostUpdateOne

SetTitle sets the "title" field.

func (*PostUpdateOne) SetUpdatedAt

func (puo *PostUpdateOne) SetUpdatedAt(t time.Time) *PostUpdateOne

SetUpdatedAt sets the "updated_at" field.

type PostUpsert

type PostUpsert struct {
	*sql.UpdateSet
}

PostUpsert is the "OnConflict" setter.

func (*PostUpsert) ClearCategoryID

func (u *PostUpsert) ClearCategoryID() *PostUpsert

ClearCategoryID clears the value of the "category_id" field.

func (*PostUpsert) ClearDeletedAt

func (u *PostUpsert) ClearDeletedAt() *PostUpsert

ClearDeletedAt clears the value of the "deleted_at" field.

func (*PostUpsert) ClearReplyToPostID

func (u *PostUpsert) ClearReplyToPostID() *PostUpsert

ClearReplyToPostID clears the value of the "reply_to_post_id" field.

func (*PostUpsert) ClearRootPostID

func (u *PostUpsert) ClearRootPostID() *PostUpsert

ClearRootPostID clears the value of the "root_post_id" field.

func (*PostUpsert) ClearSlug

func (u *PostUpsert) ClearSlug() *PostUpsert

ClearSlug clears the value of the "slug" field.

func (*PostUpsert) ClearTitle

func (u *PostUpsert) ClearTitle() *PostUpsert

ClearTitle clears the value of the "title" field.

func (*PostUpsert) SetBody

func (u *PostUpsert) SetBody(v string) *PostUpsert

SetBody sets the "body" field.

func (*PostUpsert) SetCategoryID

func (u *PostUpsert) SetCategoryID(v xid.ID) *PostUpsert

SetCategoryID sets the "category_id" field.

func (*PostUpsert) SetCreatedAt

func (u *PostUpsert) SetCreatedAt(v time.Time) *PostUpsert

SetCreatedAt sets the "created_at" field.

func (*PostUpsert) SetDeletedAt

func (u *PostUpsert) SetDeletedAt(v time.Time) *PostUpsert

SetDeletedAt sets the "deleted_at" field.

func (*PostUpsert) SetFirst

func (u *PostUpsert) SetFirst(v bool) *PostUpsert

SetFirst sets the "first" field.

func (*PostUpsert) SetPinned

func (u *PostUpsert) SetPinned(v bool) *PostUpsert

SetPinned sets the "pinned" field.

func (*PostUpsert) SetReplyToPostID

func (u *PostUpsert) SetReplyToPostID(v xid.ID) *PostUpsert

SetReplyToPostID sets the "reply_to_post_id" field.

func (*PostUpsert) SetRootPostID

func (u *PostUpsert) SetRootPostID(v xid.ID) *PostUpsert

SetRootPostID sets the "root_post_id" field.

func (*PostUpsert) SetShort

func (u *PostUpsert) SetShort(v string) *PostUpsert

SetShort sets the "short" field.

func (*PostUpsert) SetSlug

func (u *PostUpsert) SetSlug(v string) *PostUpsert

SetSlug sets the "slug" field.

func (*PostUpsert) SetTitle

func (u *PostUpsert) SetTitle(v string) *PostUpsert

SetTitle sets the "title" field.

func (*PostUpsert) SetUpdatedAt

func (u *PostUpsert) SetUpdatedAt(v time.Time) *PostUpsert

SetUpdatedAt sets the "updated_at" field.

func (*PostUpsert) UpdateBody

func (u *PostUpsert) UpdateBody() *PostUpsert

UpdateBody sets the "body" field to the value that was provided on create.

func (*PostUpsert) UpdateCategoryID

func (u *PostUpsert) UpdateCategoryID() *PostUpsert

UpdateCategoryID sets the "category_id" field to the value that was provided on create.

func (*PostUpsert) UpdateCreatedAt

func (u *PostUpsert) UpdateCreatedAt() *PostUpsert

UpdateCreatedAt sets the "created_at" field to the value that was provided on create.

func (*PostUpsert) UpdateDeletedAt

func (u *PostUpsert) UpdateDeletedAt() *PostUpsert

UpdateDeletedAt sets the "deleted_at" field to the value that was provided on create.

func (*PostUpsert) UpdateFirst

func (u *PostUpsert) UpdateFirst() *PostUpsert

UpdateFirst sets the "first" field to the value that was provided on create.

func (*PostUpsert) UpdatePinned

func (u *PostUpsert) UpdatePinned() *PostUpsert

UpdatePinned sets the "pinned" field to the value that was provided on create.

func (*PostUpsert) UpdateReplyToPostID

func (u *PostUpsert) UpdateReplyToPostID() *PostUpsert

UpdateReplyToPostID sets the "reply_to_post_id" field to the value that was provided on create.

func (*PostUpsert) UpdateRootPostID

func (u *PostUpsert) UpdateRootPostID() *PostUpsert

UpdateRootPostID sets the "root_post_id" field to the value that was provided on create.

func (*PostUpsert) UpdateShort

func (u *PostUpsert) UpdateShort() *PostUpsert

UpdateShort sets the "short" field to the value that was provided on create.

func (*PostUpsert) UpdateSlug

func (u *PostUpsert) UpdateSlug() *PostUpsert

UpdateSlug sets the "slug" field to the value that was provided on create.

func (*PostUpsert) UpdateTitle

func (u *PostUpsert) UpdateTitle() *PostUpsert

UpdateTitle sets the "title" field to the value that was provided on create.

func (*PostUpsert) UpdateUpdatedAt

func (u *PostUpsert) UpdateUpdatedAt() *PostUpsert

UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create.

type PostUpsertBulk

type PostUpsertBulk struct {
	// contains filtered or unexported fields
}

PostUpsertBulk is the builder for "upsert"-ing a bulk of Post nodes.

func (*PostUpsertBulk) ClearCategoryID

func (u *PostUpsertBulk) ClearCategoryID() *PostUpsertBulk

ClearCategoryID clears the value of the "category_id" field.

func (*PostUpsertBulk) ClearDeletedAt

func (u *PostUpsertBulk) ClearDeletedAt() *PostUpsertBulk

ClearDeletedAt clears the value of the "deleted_at" field.

func (*PostUpsertBulk) ClearReplyToPostID

func (u *PostUpsertBulk) ClearReplyToPostID() *PostUpsertBulk

ClearReplyToPostID clears the value of the "reply_to_post_id" field.

func (*PostUpsertBulk) ClearRootPostID

func (u *PostUpsertBulk) ClearRootPostID() *PostUpsertBulk

ClearRootPostID clears the value of the "root_post_id" field.

func (*PostUpsertBulk) ClearSlug

func (u *PostUpsertBulk) ClearSlug() *PostUpsertBulk

ClearSlug clears the value of the "slug" field.

func (*PostUpsertBulk) ClearTitle

func (u *PostUpsertBulk) ClearTitle() *PostUpsertBulk

ClearTitle clears the value of the "title" field.

func (*PostUpsertBulk) DoNothing

func (u *PostUpsertBulk) DoNothing() *PostUpsertBulk

DoNothing configures the conflict_action to `DO NOTHING`. Supported only by SQLite and PostgreSQL.

func (*PostUpsertBulk) Exec

func (u *PostUpsertBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*PostUpsertBulk) ExecX

func (u *PostUpsertBulk) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*PostUpsertBulk) Ignore

func (u *PostUpsertBulk) Ignore() *PostUpsertBulk

Ignore sets each column to itself in case of conflict. Using this option is equivalent to using:

client.Post.Create().
	OnConflict(sql.ResolveWithIgnore()).
	Exec(ctx)

func (*PostUpsertBulk) SetBody

func (u *PostUpsertBulk) SetBody(v string) *PostUpsertBulk

SetBody sets the "body" field.

func (*PostUpsertBulk) SetCategoryID

func (u *PostUpsertBulk) SetCategoryID(v xid.ID) *PostUpsertBulk

SetCategoryID sets the "category_id" field.

func (*PostUpsertBulk) SetCreatedAt

func (u *PostUpsertBulk) SetCreatedAt(v time.Time) *PostUpsertBulk

SetCreatedAt sets the "created_at" field.

func (*PostUpsertBulk) SetDeletedAt

func (u *PostUpsertBulk) SetDeletedAt(v time.Time) *PostUpsertBulk

SetDeletedAt sets the "deleted_at" field.

func (*PostUpsertBulk) SetFirst

func (u *PostUpsertBulk) SetFirst(v bool) *PostUpsertBulk

SetFirst sets the "first" field.

func (*PostUpsertBulk) SetPinned

func (u *PostUpsertBulk) SetPinned(v bool) *PostUpsertBulk

SetPinned sets the "pinned" field.

func (*PostUpsertBulk) SetReplyToPostID

func (u *PostUpsertBulk) SetReplyToPostID(v xid.ID) *PostUpsertBulk

SetReplyToPostID sets the "reply_to_post_id" field.

func (*PostUpsertBulk) SetRootPostID

func (u *PostUpsertBulk) SetRootPostID(v xid.ID) *PostUpsertBulk

SetRootPostID sets the "root_post_id" field.

func (*PostUpsertBulk) SetShort

func (u *PostUpsertBulk) SetShort(v string) *PostUpsertBulk

SetShort sets the "short" field.

func (*PostUpsertBulk) SetSlug

func (u *PostUpsertBulk) SetSlug(v string) *PostUpsertBulk

SetSlug sets the "slug" field.

func (*PostUpsertBulk) SetTitle

func (u *PostUpsertBulk) SetTitle(v string) *PostUpsertBulk

SetTitle sets the "title" field.

func (*PostUpsertBulk) SetUpdatedAt

func (u *PostUpsertBulk) SetUpdatedAt(v time.Time) *PostUpsertBulk

SetUpdatedAt sets the "updated_at" field.

func (*PostUpsertBulk) Update

func (u *PostUpsertBulk) Update(set func(*PostUpsert)) *PostUpsertBulk

Update allows overriding fields `UPDATE` values. See the PostCreateBulk.OnConflict documentation for more info.

func (*PostUpsertBulk) UpdateBody

func (u *PostUpsertBulk) UpdateBody() *PostUpsertBulk

UpdateBody sets the "body" field to the value that was provided on create.

func (*PostUpsertBulk) UpdateCategoryID

func (u *PostUpsertBulk) UpdateCategoryID() *PostUpsertBulk

UpdateCategoryID sets the "category_id" field to the value that was provided on create.

func (*PostUpsertBulk) UpdateCreatedAt

func (u *PostUpsertBulk) UpdateCreatedAt() *PostUpsertBulk

UpdateCreatedAt sets the "created_at" field to the value that was provided on create.

func (*PostUpsertBulk) UpdateDeletedAt

func (u *PostUpsertBulk) UpdateDeletedAt() *PostUpsertBulk

UpdateDeletedAt sets the "deleted_at" field to the value that was provided on create.

func (*PostUpsertBulk) UpdateFirst

func (u *PostUpsertBulk) UpdateFirst() *PostUpsertBulk

UpdateFirst sets the "first" field to the value that was provided on create.

func (*PostUpsertBulk) UpdateNewValues

func (u *PostUpsertBulk) UpdateNewValues() *PostUpsertBulk

UpdateNewValues updates the mutable fields using the new values that were set on create. Using this option is equivalent to using:

client.Post.Create().
	OnConflict(
		sql.ResolveWithNewValues(),
		sql.ResolveWith(func(u *sql.UpdateSet) {
			u.SetIgnore(post.FieldID)
		}),
	).
	Exec(ctx)

func (*PostUpsertBulk) UpdatePinned

func (u *PostUpsertBulk) UpdatePinned() *PostUpsertBulk

UpdatePinned sets the "pinned" field to the value that was provided on create.

func (*PostUpsertBulk) UpdateReplyToPostID

func (u *PostUpsertBulk) UpdateReplyToPostID() *PostUpsertBulk

UpdateReplyToPostID sets the "reply_to_post_id" field to the value that was provided on create.

func (*PostUpsertBulk) UpdateRootPostID

func (u *PostUpsertBulk) UpdateRootPostID() *PostUpsertBulk

UpdateRootPostID sets the "root_post_id" field to the value that was provided on create.

func (*PostUpsertBulk) UpdateShort

func (u *PostUpsertBulk) UpdateShort() *PostUpsertBulk

UpdateShort sets the "short" field to the value that was provided on create.

func (*PostUpsertBulk) UpdateSlug

func (u *PostUpsertBulk) UpdateSlug() *PostUpsertBulk

UpdateSlug sets the "slug" field to the value that was provided on create.

func (*PostUpsertBulk) UpdateTitle

func (u *PostUpsertBulk) UpdateTitle() *PostUpsertBulk

UpdateTitle sets the "title" field to the value that was provided on create.

func (*PostUpsertBulk) UpdateUpdatedAt

func (u *PostUpsertBulk) UpdateUpdatedAt() *PostUpsertBulk

UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create.

type PostUpsertOne

type PostUpsertOne struct {
	// contains filtered or unexported fields
}

PostUpsertOne is the builder for "upsert"-ing

one Post node.

func (*PostUpsertOne) ClearCategoryID

func (u *PostUpsertOne) ClearCategoryID() *PostUpsertOne

ClearCategoryID clears the value of the "category_id" field.

func (*PostUpsertOne) ClearDeletedAt

func (u *PostUpsertOne) ClearDeletedAt() *PostUpsertOne

ClearDeletedAt clears the value of the "deleted_at" field.

func (*PostUpsertOne) ClearReplyToPostID

func (u *PostUpsertOne) ClearReplyToPostID() *PostUpsertOne

ClearReplyToPostID clears the value of the "reply_to_post_id" field.

func (*PostUpsertOne) ClearRootPostID

func (u *PostUpsertOne) ClearRootPostID() *PostUpsertOne

ClearRootPostID clears the value of the "root_post_id" field.

func (*PostUpsertOne) ClearSlug

func (u *PostUpsertOne) ClearSlug() *PostUpsertOne

ClearSlug clears the value of the "slug" field.

func (*PostUpsertOne) ClearTitle

func (u *PostUpsertOne) ClearTitle() *PostUpsertOne

ClearTitle clears the value of the "title" field.

func (*PostUpsertOne) DoNothing

func (u *PostUpsertOne) DoNothing() *PostUpsertOne

DoNothing configures the conflict_action to `DO NOTHING`. Supported only by SQLite and PostgreSQL.

func (*PostUpsertOne) Exec

func (u *PostUpsertOne) Exec(ctx context.Context) error

Exec executes the query.

func (*PostUpsertOne) ExecX

func (u *PostUpsertOne) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*PostUpsertOne) ID

func (u *PostUpsertOne) ID(ctx context.Context) (id xid.ID, err error)

Exec executes the UPSERT query and returns the inserted/updated ID.

func (*PostUpsertOne) IDX

func (u *PostUpsertOne) IDX(ctx context.Context) xid.ID

IDX is like ID, but panics if an error occurs.

func (*PostUpsertOne) Ignore

func (u *PostUpsertOne) Ignore() *PostUpsertOne

Ignore sets each column to itself in case of conflict. Using this option is equivalent to using:

client.Post.Create().
    OnConflict(sql.ResolveWithIgnore()).
    Exec(ctx)

func (*PostUpsertOne) SetBody

func (u *PostUpsertOne) SetBody(v string) *PostUpsertOne

SetBody sets the "body" field.

func (*PostUpsertOne) SetCategoryID

func (u *PostUpsertOne) SetCategoryID(v xid.ID) *PostUpsertOne

SetCategoryID sets the "category_id" field.

func (*PostUpsertOne) SetCreatedAt

func (u *PostUpsertOne) SetCreatedAt(v time.Time) *PostUpsertOne

SetCreatedAt sets the "created_at" field.

func (*PostUpsertOne) SetDeletedAt

func (u *PostUpsertOne) SetDeletedAt(v time.Time) *PostUpsertOne

SetDeletedAt sets the "deleted_at" field.

func (*PostUpsertOne) SetFirst

func (u *PostUpsertOne) SetFirst(v bool) *PostUpsertOne

SetFirst sets the "first" field.

func (*PostUpsertOne) SetPinned

func (u *PostUpsertOne) SetPinned(v bool) *PostUpsertOne

SetPinned sets the "pinned" field.

func (*PostUpsertOne) SetReplyToPostID

func (u *PostUpsertOne) SetReplyToPostID(v xid.ID) *PostUpsertOne

SetReplyToPostID sets the "reply_to_post_id" field.

func (*PostUpsertOne) SetRootPostID

func (u *PostUpsertOne) SetRootPostID(v xid.ID) *PostUpsertOne

SetRootPostID sets the "root_post_id" field.

func (*PostUpsertOne) SetShort

func (u *PostUpsertOne) SetShort(v string) *PostUpsertOne

SetShort sets the "short" field.

func (*PostUpsertOne) SetSlug

func (u *PostUpsertOne) SetSlug(v string) *PostUpsertOne

SetSlug sets the "slug" field.

func (*PostUpsertOne) SetTitle

func (u *PostUpsertOne) SetTitle(v string) *PostUpsertOne

SetTitle sets the "title" field.

func (*PostUpsertOne) SetUpdatedAt

func (u *PostUpsertOne) SetUpdatedAt(v time.Time) *PostUpsertOne

SetUpdatedAt sets the "updated_at" field.

func (*PostUpsertOne) Update

func (u *PostUpsertOne) Update(set func(*PostUpsert)) *PostUpsertOne

Update allows overriding fields `UPDATE` values. See the PostCreate.OnConflict documentation for more info.

func (*PostUpsertOne) UpdateBody

func (u *PostUpsertOne) UpdateBody() *PostUpsertOne

UpdateBody sets the "body" field to the value that was provided on create.

func (*PostUpsertOne) UpdateCategoryID

func (u *PostUpsertOne) UpdateCategoryID() *PostUpsertOne

UpdateCategoryID sets the "category_id" field to the value that was provided on create.

func (*PostUpsertOne) UpdateCreatedAt

func (u *PostUpsertOne) UpdateCreatedAt() *PostUpsertOne

UpdateCreatedAt sets the "created_at" field to the value that was provided on create.

func (*PostUpsertOne) UpdateDeletedAt

func (u *PostUpsertOne) UpdateDeletedAt() *PostUpsertOne

UpdateDeletedAt sets the "deleted_at" field to the value that was provided on create.

func (*PostUpsertOne) UpdateFirst

func (u *PostUpsertOne) UpdateFirst() *PostUpsertOne

UpdateFirst sets the "first" field to the value that was provided on create.

func (*PostUpsertOne) UpdateNewValues

func (u *PostUpsertOne) UpdateNewValues() *PostUpsertOne

UpdateNewValues updates the mutable fields using the new values that were set on create except the ID field. Using this option is equivalent to using:

client.Post.Create().
	OnConflict(
		sql.ResolveWithNewValues(),
		sql.ResolveWith(func(u *sql.UpdateSet) {
			u.SetIgnore(post.FieldID)
		}),
	).
	Exec(ctx)

func (*PostUpsertOne) UpdatePinned

func (u *PostUpsertOne) UpdatePinned() *PostUpsertOne

UpdatePinned sets the "pinned" field to the value that was provided on create.

func (*PostUpsertOne) UpdateReplyToPostID

func (u *PostUpsertOne) UpdateReplyToPostID() *PostUpsertOne

UpdateReplyToPostID sets the "reply_to_post_id" field to the value that was provided on create.

func (*PostUpsertOne) UpdateRootPostID

func (u *PostUpsertOne) UpdateRootPostID() *PostUpsertOne

UpdateRootPostID sets the "root_post_id" field to the value that was provided on create.

func (*PostUpsertOne) UpdateShort

func (u *PostUpsertOne) UpdateShort() *PostUpsertOne

UpdateShort sets the "short" field to the value that was provided on create.

func (*PostUpsertOne) UpdateSlug

func (u *PostUpsertOne) UpdateSlug() *PostUpsertOne

UpdateSlug sets the "slug" field to the value that was provided on create.

func (*PostUpsertOne) UpdateTitle

func (u *PostUpsertOne) UpdateTitle() *PostUpsertOne

UpdateTitle sets the "title" field to the value that was provided on create.

func (*PostUpsertOne) UpdateUpdatedAt

func (u *PostUpsertOne) UpdateUpdatedAt() *PostUpsertOne

UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create.

type Posts

type Posts []*Post

Posts is a parsable slice of Post.

type Query

type Query = ent.Query

ent aliases to avoid import conflicts in user's code.

type React

type React struct {

	// ID of the ent.
	ID xid.ID `json:"id,omitempty"`
	// CreatedAt holds the value of the "created_at" field.
	CreatedAt time.Time `json:"created_at,omitempty"`
	// Emoji holds the value of the "emoji" field.
	Emoji string `json:"emoji,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the ReactQuery when eager-loading is set.
	Edges ReactEdges `json:"edges"`
	// contains filtered or unexported fields
}

React is the model entity for the React schema.

func (*React) QueryAccount

func (r *React) QueryAccount() *AccountQuery

QueryAccount queries the "account" edge of the React entity.

func (*React) QueryPost

func (r *React) QueryPost() *PostQuery

QueryPost queries the "Post" edge of the React entity.

func (*React) String

func (r *React) String() string

String implements the fmt.Stringer.

func (*React) Unwrap

func (r *React) Unwrap() *React

Unwrap unwraps the React 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 (*React) Update

func (r *React) Update() *ReactUpdateOne

Update returns a builder for updating this React. Note that you need to call React.Unwrap() before calling this method if this React was returned from a transaction, and the transaction was committed or rolled back.

type ReactClient

type ReactClient struct {
	// contains filtered or unexported fields
}

ReactClient is a client for the React schema.

func NewReactClient

func NewReactClient(c config) *ReactClient

NewReactClient returns a client for the React from the given config.

func (*ReactClient) Create

func (c *ReactClient) Create() *ReactCreate

Create returns a builder for creating a React entity.

func (*ReactClient) CreateBulk

func (c *ReactClient) CreateBulk(builders ...*ReactCreate) *ReactCreateBulk

CreateBulk returns a builder for creating a bulk of React entities.

func (*ReactClient) Delete

func (c *ReactClient) Delete() *ReactDelete

Delete returns a delete builder for React.

func (*ReactClient) DeleteOne

func (c *ReactClient) DeleteOne(r *React) *ReactDeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*ReactClient) DeleteOneID

func (c *ReactClient) DeleteOneID(id xid.ID) *ReactDeleteOne

DeleteOne returns a builder for deleting the given entity by its id.

func (*ReactClient) Get

func (c *ReactClient) Get(ctx context.Context, id xid.ID) (*React, error)

Get returns a React entity by its id.

func (*ReactClient) GetX

func (c *ReactClient) GetX(ctx context.Context, id xid.ID) *React

GetX is like Get, but panics if an error occurs.

func (*ReactClient) Hooks

func (c *ReactClient) Hooks() []Hook

Hooks returns the client hooks.

func (*ReactClient) Query

func (c *ReactClient) Query() *ReactQuery

Query returns a query builder for React.

func (*ReactClient) QueryAccount

func (c *ReactClient) QueryAccount(r *React) *AccountQuery

QueryAccount queries the account edge of a React.

func (*ReactClient) QueryPost

func (c *ReactClient) QueryPost(r *React) *PostQuery

QueryPost queries the Post edge of a React.

func (*ReactClient) Update

func (c *ReactClient) Update() *ReactUpdate

Update returns an update builder for React.

func (*ReactClient) UpdateOne

func (c *ReactClient) UpdateOne(r *React) *ReactUpdateOne

UpdateOne returns an update builder for the given entity.

func (*ReactClient) UpdateOneID

func (c *ReactClient) UpdateOneID(id xid.ID) *ReactUpdateOne

UpdateOneID returns an update builder for the given id.

func (*ReactClient) Use

func (c *ReactClient) Use(hooks ...Hook)

Use adds a list of mutation hooks to the hooks stack. A call to `Use(f, g, h)` equals to `react.Hooks(f(g(h())))`.

type ReactCreate

type ReactCreate struct {
	// contains filtered or unexported fields
}

ReactCreate is the builder for creating a React entity.

func (*ReactCreate) Exec

func (rc *ReactCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*ReactCreate) ExecX

func (rc *ReactCreate) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*ReactCreate) Mutation

func (rc *ReactCreate) Mutation() *ReactMutation

Mutation returns the ReactMutation object of the builder.

func (*ReactCreate) OnConflict

func (rc *ReactCreate) OnConflict(opts ...sql.ConflictOption) *ReactUpsertOne

OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause of the `INSERT` statement. For example:

client.React.Create().
	SetCreatedAt(v).
	OnConflict(
		// Update the row with the new values
		// the was proposed for insertion.
		sql.ResolveWithNewValues(),
	).
	// Override some of the fields with custom
	// update values.
	Update(func(u *ent.ReactUpsert) {
		SetCreatedAt(v+v).
	}).
	Exec(ctx)

func (*ReactCreate) OnConflictColumns

func (rc *ReactCreate) OnConflictColumns(columns ...string) *ReactUpsertOne

OnConflictColumns calls `OnConflict` and configures the columns as conflict target. Using this option is equivalent to using:

client.React.Create().
	OnConflict(sql.ConflictColumns(columns...)).
	Exec(ctx)

func (*ReactCreate) Save

func (rc *ReactCreate) Save(ctx context.Context) (*React, error)

Save creates the React in the database.

func (*ReactCreate) SaveX

func (rc *ReactCreate) SaveX(ctx context.Context) *React

SaveX calls Save and panics if Save returns an error.

func (*ReactCreate) SetAccount

func (rc *ReactCreate) SetAccount(a *Account) *ReactCreate

SetAccount sets the "account" edge to the Account entity.

func (*ReactCreate) SetAccountID

func (rc *ReactCreate) SetAccountID(id xid.ID) *ReactCreate

SetAccountID sets the "account" edge to the Account entity by ID.

func (*ReactCreate) SetCreatedAt

func (rc *ReactCreate) SetCreatedAt(t time.Time) *ReactCreate

SetCreatedAt sets the "created_at" field.

func (*ReactCreate) SetEmoji

func (rc *ReactCreate) SetEmoji(s string) *ReactCreate

SetEmoji sets the "emoji" field.

func (*ReactCreate) SetID

func (rc *ReactCreate) SetID(x xid.ID) *ReactCreate

SetID sets the "id" field.

func (*ReactCreate) SetNillableAccountID

func (rc *ReactCreate) SetNillableAccountID(id *xid.ID) *ReactCreate

SetNillableAccountID sets the "account" edge to the Account entity by ID if the given value is not nil.

func (*ReactCreate) SetNillableCreatedAt

func (rc *ReactCreate) SetNillableCreatedAt(t *time.Time) *ReactCreate

SetNillableCreatedAt sets the "created_at" field if the given value is not nil.

func (*ReactCreate) SetNillableID

func (rc *ReactCreate) SetNillableID(x *xid.ID) *ReactCreate

SetNillableID sets the "id" field if the given value is not nil.

func (*ReactCreate) SetNillablePostID

func (rc *ReactCreate) SetNillablePostID(id *xid.ID) *ReactCreate

SetNillablePostID sets the "Post" edge to the Post entity by ID if the given value is not nil.

func (*ReactCreate) SetPost

func (rc *ReactCreate) SetPost(p *Post) *ReactCreate

SetPost sets the "Post" edge to the Post entity.

func (*ReactCreate) SetPostID

func (rc *ReactCreate) SetPostID(id xid.ID) *ReactCreate

SetPostID sets the "Post" edge to the Post entity by ID.

type ReactCreateBulk

type ReactCreateBulk struct {
	// contains filtered or unexported fields
}

ReactCreateBulk is the builder for creating many React entities in bulk.

func (*ReactCreateBulk) Exec

func (rcb *ReactCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*ReactCreateBulk) ExecX

func (rcb *ReactCreateBulk) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*ReactCreateBulk) OnConflict

func (rcb *ReactCreateBulk) OnConflict(opts ...sql.ConflictOption) *ReactUpsertBulk

OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause of the `INSERT` statement. For example:

client.React.CreateBulk(builders...).
	OnConflict(
		// Update the row with the new values
		// the was proposed for insertion.
		sql.ResolveWithNewValues(),
	).
	// Override some of the fields with custom
	// update values.
	Update(func(u *ent.ReactUpsert) {
		SetCreatedAt(v+v).
	}).
	Exec(ctx)

func (*ReactCreateBulk) OnConflictColumns

func (rcb *ReactCreateBulk) OnConflictColumns(columns ...string) *ReactUpsertBulk

OnConflictColumns calls `OnConflict` and configures the columns as conflict target. Using this option is equivalent to using:

client.React.Create().
	OnConflict(sql.ConflictColumns(columns...)).
	Exec(ctx)

func (*ReactCreateBulk) Save

func (rcb *ReactCreateBulk) Save(ctx context.Context) ([]*React, error)

Save creates the React entities in the database.

func (*ReactCreateBulk) SaveX

func (rcb *ReactCreateBulk) SaveX(ctx context.Context) []*React

SaveX is like Save, but panics if an error occurs.

type ReactDelete

type ReactDelete struct {
	// contains filtered or unexported fields
}

ReactDelete is the builder for deleting a React entity.

func (*ReactDelete) Exec

func (rd *ReactDelete) Exec(ctx context.Context) (int, error)

Exec executes the deletion query and returns how many vertices were deleted.

func (*ReactDelete) ExecX

func (rd *ReactDelete) ExecX(ctx context.Context) int

ExecX is like Exec, but panics if an error occurs.

func (*ReactDelete) Where

func (rd *ReactDelete) Where(ps ...predicate.React) *ReactDelete

Where appends a list predicates to the ReactDelete builder.

type ReactDeleteOne

type ReactDeleteOne struct {
	// contains filtered or unexported fields
}

ReactDeleteOne is the builder for deleting a single React entity.

func (*ReactDeleteOne) Exec

func (rdo *ReactDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*ReactDeleteOne) ExecX

func (rdo *ReactDeleteOne) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

type ReactEdges

type ReactEdges struct {
	// Account holds the value of the account edge.
	Account *Account `json:"account,omitempty"`
	// Post holds the value of the Post edge.
	Post *Post `json:"Post,omitempty"`
	// contains filtered or unexported fields
}

ReactEdges holds the relations/edges for other nodes in the graph.

func (ReactEdges) AccountOrErr

func (e ReactEdges) AccountOrErr() (*Account, error)

AccountOrErr returns the Account value or an error if the edge was not loaded in eager-loading, or loaded but was not found.

func (ReactEdges) PostOrErr

func (e ReactEdges) PostOrErr() (*Post, error)

PostOrErr returns the Post value or an error if the edge was not loaded in eager-loading, or loaded but was not found.

type ReactGroupBy

type ReactGroupBy struct {
	// contains filtered or unexported fields
}

ReactGroupBy is the group-by builder for React entities.

func (*ReactGroupBy) Aggregate

func (rgb *ReactGroupBy) Aggregate(fns ...AggregateFunc) *ReactGroupBy

Aggregate adds the given aggregation functions to the group-by query.

func (*ReactGroupBy) Bool

func (s *ReactGroupBy) Bool(ctx context.Context) (_ bool, err error)

Bool returns a single bool from a selector. It is only allowed when selecting one field.

func (*ReactGroupBy) BoolX

func (s *ReactGroupBy) BoolX(ctx context.Context) bool

BoolX is like Bool, but panics if an error occurs.

func (*ReactGroupBy) Bools

func (s *ReactGroupBy) Bools(ctx context.Context) ([]bool, error)

Bools returns list of bools from a selector. It is only allowed when selecting one field.

func (*ReactGroupBy) BoolsX

func (s *ReactGroupBy) BoolsX(ctx context.Context) []bool

BoolsX is like Bools, but panics if an error occurs.

func (*ReactGroupBy) Float64

func (s *ReactGroupBy) Float64(ctx context.Context) (_ float64, err error)

Float64 returns a single float64 from a selector. It is only allowed when selecting one field.

func (*ReactGroupBy) Float64X

func (s *ReactGroupBy) Float64X(ctx context.Context) float64

Float64X is like Float64, but panics if an error occurs.

func (*ReactGroupBy) Float64s

func (s *ReactGroupBy) Float64s(ctx context.Context) ([]float64, error)

Float64s returns list of float64s from a selector. It is only allowed when selecting one field.

func (*ReactGroupBy) Float64sX

func (s *ReactGroupBy) Float64sX(ctx context.Context) []float64

Float64sX is like Float64s, but panics if an error occurs.

func (*ReactGroupBy) Int

func (s *ReactGroupBy) Int(ctx context.Context) (_ int, err error)

Int returns a single int from a selector. It is only allowed when selecting one field.

func (*ReactGroupBy) IntX

func (s *ReactGroupBy) IntX(ctx context.Context) int

IntX is like Int, but panics if an error occurs.

func (*ReactGroupBy) Ints

func (s *ReactGroupBy) Ints(ctx context.Context) ([]int, error)

Ints returns list of ints from a selector. It is only allowed when selecting one field.

func (*ReactGroupBy) IntsX

func (s *ReactGroupBy) IntsX(ctx context.Context) []int

IntsX is like Ints, but panics if an error occurs.

func (*ReactGroupBy) Scan

func (rgb *ReactGroupBy) Scan(ctx context.Context, v interface{}) error

Scan applies the group-by query and scans the result into the given value.

func (*ReactGroupBy) ScanX

func (s *ReactGroupBy) ScanX(ctx context.Context, v interface{})

ScanX is like Scan, but panics if an error occurs.

func (*ReactGroupBy) String

func (s *ReactGroupBy) String(ctx context.Context) (_ string, err error)

String returns a single string from a selector. It is only allowed when selecting one field.

func (*ReactGroupBy) StringX

func (s *ReactGroupBy) StringX(ctx context.Context) string

StringX is like String, but panics if an error occurs.

func (*ReactGroupBy) Strings

func (s *ReactGroupBy) Strings(ctx context.Context) ([]string, error)

Strings returns list of strings from a selector. It is only allowed when selecting one field.

func (*ReactGroupBy) StringsX

func (s *ReactGroupBy) StringsX(ctx context.Context) []string

StringsX is like Strings, but panics if an error occurs.

type ReactMutation

type ReactMutation struct {
	// contains filtered or unexported fields
}

ReactMutation represents an operation that mutates the React nodes in the graph.

func (*ReactMutation) AccountCleared

func (m *ReactMutation) AccountCleared() bool

AccountCleared reports if the "account" edge to the Account entity was cleared.

func (*ReactMutation) AccountID

func (m *ReactMutation) AccountID() (id xid.ID, exists bool)

AccountID returns the "account" edge ID in the mutation.

func (*ReactMutation) AccountIDs

func (m *ReactMutation) AccountIDs() (ids []xid.ID)

AccountIDs returns the "account" edge IDs in the mutation. Note that IDs always returns len(IDs) <= 1 for unique edges, and you should use AccountID instead. It exists only for internal usage by the builders.

func (*ReactMutation) AddField

func (m *ReactMutation) 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 (*ReactMutation) AddedEdges

func (m *ReactMutation) AddedEdges() []string

AddedEdges returns all edge names that were set/added in this mutation.

func (*ReactMutation) AddedField

func (m *ReactMutation) 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 (*ReactMutation) AddedFields

func (m *ReactMutation) AddedFields() []string

AddedFields returns all numeric fields that were incremented/decremented during this mutation.

func (*ReactMutation) AddedIDs

func (m *ReactMutation) AddedIDs(name string) []ent.Value

AddedIDs returns all IDs (to other nodes) that were added for the given edge name in this mutation.

func (*ReactMutation) ClearAccount

func (m *ReactMutation) ClearAccount()

ClearAccount clears the "account" edge to the Account entity.

func (*ReactMutation) ClearEdge

func (m *ReactMutation) 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 (*ReactMutation) ClearField

func (m *ReactMutation) 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 (*ReactMutation) ClearPost

func (m *ReactMutation) ClearPost()

ClearPost clears the "Post" edge to the Post entity.

func (*ReactMutation) ClearedEdges

func (m *ReactMutation) ClearedEdges() []string

ClearedEdges returns all edge names that were cleared in this mutation.

func (*ReactMutation) ClearedFields

func (m *ReactMutation) ClearedFields() []string

ClearedFields returns all nullable fields that were cleared during this mutation.

func (ReactMutation) Client

func (m ReactMutation) 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 (*ReactMutation) CreatedAt

func (m *ReactMutation) CreatedAt() (r time.Time, exists bool)

CreatedAt returns the value of the "created_at" field in the mutation.

func (*ReactMutation) EdgeCleared

func (m *ReactMutation) EdgeCleared(name string) bool

EdgeCleared returns a boolean which indicates if the edge with the given name was cleared in this mutation.

func (*ReactMutation) Emoji

func (m *ReactMutation) Emoji() (r string, exists bool)

Emoji returns the value of the "emoji" field in the mutation.

func (*ReactMutation) Field

func (m *ReactMutation) 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 (*ReactMutation) FieldCleared

func (m *ReactMutation) FieldCleared(name string) bool

FieldCleared returns a boolean indicating if a field with the given name was cleared in this mutation.

func (*ReactMutation) Fields

func (m *ReactMutation) 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 (*ReactMutation) ID

func (m *ReactMutation) ID() (id xid.ID, 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 (*ReactMutation) IDs

func (m *ReactMutation) IDs(ctx context.Context) ([]xid.ID, 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 (*ReactMutation) OldCreatedAt

func (m *ReactMutation) OldCreatedAt(ctx context.Context) (v time.Time, err error)

OldCreatedAt returns the old "created_at" field's value of the React entity. If the React 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 (*ReactMutation) OldEmoji

func (m *ReactMutation) OldEmoji(ctx context.Context) (v string, err error)

OldEmoji returns the old "emoji" field's value of the React entity. If the React 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 (*ReactMutation) OldField

func (m *ReactMutation) 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 (*ReactMutation) Op

func (m *ReactMutation) Op() Op

Op returns the operation name.

func (*ReactMutation) PostCleared

func (m *ReactMutation) PostCleared() bool

PostCleared reports if the "Post" edge to the Post entity was cleared.

func (*ReactMutation) PostID

func (m *ReactMutation) PostID() (id xid.ID, exists bool)

PostID returns the "Post" edge ID in the mutation.

func (*ReactMutation) PostIDs

func (m *ReactMutation) PostIDs() (ids []xid.ID)

PostIDs returns the "Post" edge IDs in the mutation. Note that IDs always returns len(IDs) <= 1 for unique edges, and you should use PostID instead. It exists only for internal usage by the builders.

func (*ReactMutation) RemovedEdges

func (m *ReactMutation) RemovedEdges() []string

RemovedEdges returns all edge names that were removed in this mutation.

func (*ReactMutation) RemovedIDs

func (m *ReactMutation) 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 (*ReactMutation) ResetAccount

func (m *ReactMutation) ResetAccount()

ResetAccount resets all changes to the "account" edge.

func (*ReactMutation) ResetCreatedAt

func (m *ReactMutation) ResetCreatedAt()

ResetCreatedAt resets all changes to the "created_at" field.

func (*ReactMutation) ResetEdge

func (m *ReactMutation) 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 (*ReactMutation) ResetEmoji

func (m *ReactMutation) ResetEmoji()

ResetEmoji resets all changes to the "emoji" field.

func (*ReactMutation) ResetField

func (m *ReactMutation) 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 (*ReactMutation) ResetPost

func (m *ReactMutation) ResetPost()

ResetPost resets all changes to the "Post" edge.

func (*ReactMutation) SetAccountID

func (m *ReactMutation) SetAccountID(id xid.ID)

SetAccountID sets the "account" edge to the Account entity by id.

func (*ReactMutation) SetCreatedAt

func (m *ReactMutation) SetCreatedAt(t time.Time)

SetCreatedAt sets the "created_at" field.

func (*ReactMutation) SetEmoji

func (m *ReactMutation) SetEmoji(s string)

SetEmoji sets the "emoji" field.

func (*ReactMutation) SetField

func (m *ReactMutation) 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 (*ReactMutation) SetID

func (m *ReactMutation) SetID(id xid.ID)

SetID sets the value of the id field. Note that this operation is only accepted on creation of React entities.

func (*ReactMutation) SetPostID

func (m *ReactMutation) SetPostID(id xid.ID)

SetPostID sets the "Post" edge to the Post entity by id.

func (ReactMutation) Tx

func (m ReactMutation) Tx() (*Tx, error)

Tx returns an `ent.Tx` for mutations that were executed in transactions; it returns an error otherwise.

func (*ReactMutation) Type

func (m *ReactMutation) Type() string

Type returns the node type of this mutation (React).

func (*ReactMutation) Where

func (m *ReactMutation) Where(ps ...predicate.React)

Where appends a list predicates to the ReactMutation builder.

type ReactQuery

type ReactQuery struct {
	// contains filtered or unexported fields
}

ReactQuery is the builder for querying React entities.

func (*ReactQuery) All

func (rq *ReactQuery) All(ctx context.Context) ([]*React, error)

All executes the query and returns a list of Reacts.

func (*ReactQuery) AllX

func (rq *ReactQuery) AllX(ctx context.Context) []*React

AllX is like All, but panics if an error occurs.

func (*ReactQuery) Clone

func (rq *ReactQuery) Clone() *ReactQuery

Clone returns a duplicate of the ReactQuery builder, including all associated steps. It can be used to prepare common query builders and use them differently after the clone is made.

func (*ReactQuery) Count

func (rq *ReactQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*ReactQuery) CountX

func (rq *ReactQuery) CountX(ctx context.Context) int

CountX is like Count, but panics if an error occurs.

func (*ReactQuery) Exist

func (rq *ReactQuery) Exist(ctx context.Context) (bool, error)

Exist returns true if the query has elements in the graph.

func (*ReactQuery) ExistX

func (rq *ReactQuery) ExistX(ctx context.Context) bool

ExistX is like Exist, but panics if an error occurs.

func (*ReactQuery) First

func (rq *ReactQuery) First(ctx context.Context) (*React, error)

First returns the first React entity from the query. Returns a *NotFoundError when no React was found.

func (*ReactQuery) FirstID

func (rq *ReactQuery) FirstID(ctx context.Context) (id xid.ID, err error)

FirstID returns the first React ID from the query. Returns a *NotFoundError when no React ID was found.

func (*ReactQuery) FirstIDX

func (rq *ReactQuery) FirstIDX(ctx context.Context) xid.ID

FirstIDX is like FirstID, but panics if an error occurs.

func (*ReactQuery) FirstX

func (rq *ReactQuery) FirstX(ctx context.Context) *React

FirstX is like First, but panics if an error occurs.

func (*ReactQuery) GroupBy

func (rq *ReactQuery) GroupBy(field string, fields ...string) *ReactGroupBy

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 {
	CreatedAt time.Time `json:"created_at,omitempty"`
	Count int `json:"count,omitempty"`
}

client.React.Query().
	GroupBy(react.FieldCreatedAt).
	Aggregate(model.Count()).
	Scan(ctx, &v)

func (*ReactQuery) IDs

func (rq *ReactQuery) IDs(ctx context.Context) ([]xid.ID, error)

IDs executes the query and returns a list of React IDs.

func (*ReactQuery) IDsX

func (rq *ReactQuery) IDsX(ctx context.Context) []xid.ID

IDsX is like IDs, but panics if an error occurs.

func (*ReactQuery) Limit

func (rq *ReactQuery) Limit(limit int) *ReactQuery

Limit adds a limit step to the query.

func (*ReactQuery) Modify

func (rq *ReactQuery) Modify(modifiers ...func(s *sql.Selector)) *ReactSelect

Modify adds a query modifier for attaching custom logic to queries.

func (*ReactQuery) Offset

func (rq *ReactQuery) Offset(offset int) *ReactQuery

Offset adds an offset step to the query.

func (*ReactQuery) Only

func (rq *ReactQuery) Only(ctx context.Context) (*React, error)

Only returns a single React entity found by the query, ensuring it only returns one. Returns a *NotSingularError when more than one React entity is found. Returns a *NotFoundError when no React entities are found.

func (*ReactQuery) OnlyID

func (rq *ReactQuery) OnlyID(ctx context.Context) (id xid.ID, err error)

OnlyID is like Only, but returns the only React ID in the query. Returns a *NotSingularError when more than one React ID is found. Returns a *NotFoundError when no entities are found.

func (*ReactQuery) OnlyIDX

func (rq *ReactQuery) OnlyIDX(ctx context.Context) xid.ID

OnlyIDX is like OnlyID, but panics if an error occurs.

func (*ReactQuery) OnlyX

func (rq *ReactQuery) OnlyX(ctx context.Context) *React

OnlyX is like Only, but panics if an error occurs.

func (*ReactQuery) Order

func (rq *ReactQuery) Order(o ...OrderFunc) *ReactQuery

Order adds an order step to the query.

func (*ReactQuery) QueryAccount

func (rq *ReactQuery) QueryAccount() *AccountQuery

QueryAccount chains the current query on the "account" edge.

func (*ReactQuery) QueryPost

func (rq *ReactQuery) QueryPost() *PostQuery

QueryPost chains the current query on the "Post" edge.

func (*ReactQuery) Select

func (rq *ReactQuery) Select(fields ...string) *ReactSelect

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 {
	CreatedAt time.Time `json:"created_at,omitempty"`
}

client.React.Query().
	Select(react.FieldCreatedAt).
	Scan(ctx, &v)

func (*ReactQuery) Unique

func (rq *ReactQuery) Unique(unique bool) *ReactQuery

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 (*ReactQuery) Where

func (rq *ReactQuery) Where(ps ...predicate.React) *ReactQuery

Where adds a new predicate for the ReactQuery builder.

func (*ReactQuery) WithAccount

func (rq *ReactQuery) WithAccount(opts ...func(*AccountQuery)) *ReactQuery

WithAccount tells the query-builder to eager-load the nodes that are connected to the "account" edge. The optional arguments are used to configure the query builder of the edge.

func (*ReactQuery) WithPost

func (rq *ReactQuery) WithPost(opts ...func(*PostQuery)) *ReactQuery

WithPost tells the query-builder to eager-load the nodes that are connected to the "Post" edge. The optional arguments are used to configure the query builder of the edge.

type ReactSelect

type ReactSelect struct {
	*ReactQuery
	// contains filtered or unexported fields
}

ReactSelect is the builder for selecting fields of React entities.

func (*ReactSelect) Bool

func (s *ReactSelect) Bool(ctx context.Context) (_ bool, err error)

Bool returns a single bool from a selector. It is only allowed when selecting one field.

func (*ReactSelect) BoolX

func (s *ReactSelect) BoolX(ctx context.Context) bool

BoolX is like Bool, but panics if an error occurs.

func (*ReactSelect) Bools

func (s *ReactSelect) Bools(ctx context.Context) ([]bool, error)

Bools returns list of bools from a selector. It is only allowed when selecting one field.

func (*ReactSelect) BoolsX

func (s *ReactSelect) BoolsX(ctx context.Context) []bool

BoolsX is like Bools, but panics if an error occurs.

func (*ReactSelect) Float64

func (s *ReactSelect) Float64(ctx context.Context) (_ float64, err error)

Float64 returns a single float64 from a selector. It is only allowed when selecting one field.

func (*ReactSelect) Float64X

func (s *ReactSelect) Float64X(ctx context.Context) float64

Float64X is like Float64, but panics if an error occurs.

func (*ReactSelect) Float64s

func (s *ReactSelect) Float64s(ctx context.Context) ([]float64, error)

Float64s returns list of float64s from a selector. It is only allowed when selecting one field.

func (*ReactSelect) Float64sX

func (s *ReactSelect) Float64sX(ctx context.Context) []float64

Float64sX is like Float64s, but panics if an error occurs.

func (*ReactSelect) Int

func (s *ReactSelect) Int(ctx context.Context) (_ int, err error)

Int returns a single int from a selector. It is only allowed when selecting one field.

func (*ReactSelect) IntX

func (s *ReactSelect) IntX(ctx context.Context) int

IntX is like Int, but panics if an error occurs.

func (*ReactSelect) Ints

func (s *ReactSelect) Ints(ctx context.Context) ([]int, error)

Ints returns list of ints from a selector. It is only allowed when selecting one field.

func (*ReactSelect) IntsX

func (s *ReactSelect) IntsX(ctx context.Context) []int

IntsX is like Ints, but panics if an error occurs.

func (*ReactSelect) Modify

func (rs *ReactSelect) Modify(modifiers ...func(s *sql.Selector)) *ReactSelect

Modify adds a query modifier for attaching custom logic to queries.

func (*ReactSelect) Scan

func (rs *ReactSelect) Scan(ctx context.Context, v interface{}) error

Scan applies the selector query and scans the result into the given value.

func (*ReactSelect) ScanX

func (s *ReactSelect) ScanX(ctx context.Context, v interface{})

ScanX is like Scan, but panics if an error occurs.

func (*ReactSelect) String

func (s *ReactSelect) String(ctx context.Context) (_ string, err error)

String returns a single string from a selector. It is only allowed when selecting one field.

func (*ReactSelect) StringX

func (s *ReactSelect) StringX(ctx context.Context) string

StringX is like String, but panics if an error occurs.

func (*ReactSelect) Strings

func (s *ReactSelect) Strings(ctx context.Context) ([]string, error)

Strings returns list of strings from a selector. It is only allowed when selecting one field.

func (*ReactSelect) StringsX

func (s *ReactSelect) StringsX(ctx context.Context) []string

StringsX is like Strings, but panics if an error occurs.

type ReactUpdate

type ReactUpdate struct {
	// contains filtered or unexported fields
}

ReactUpdate is the builder for updating React entities.

func (*ReactUpdate) ClearAccount

func (ru *ReactUpdate) ClearAccount() *ReactUpdate

ClearAccount clears the "account" edge to the Account entity.

func (*ReactUpdate) ClearPost

func (ru *ReactUpdate) ClearPost() *ReactUpdate

ClearPost clears the "Post" edge to the Post entity.

func (*ReactUpdate) Exec

func (ru *ReactUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*ReactUpdate) ExecX

func (ru *ReactUpdate) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*ReactUpdate) Modify

func (ru *ReactUpdate) Modify(modifiers ...func(u *sql.UpdateBuilder)) *ReactUpdate

Modify adds a statement modifier for attaching custom logic to the UPDATE statement.

func (*ReactUpdate) Mutation

func (ru *ReactUpdate) Mutation() *ReactMutation

Mutation returns the ReactMutation object of the builder.

func (*ReactUpdate) Save

func (ru *ReactUpdate) Save(ctx context.Context) (int, error)

Save executes the query and returns the number of nodes affected by the update operation.

func (*ReactUpdate) SaveX

func (ru *ReactUpdate) SaveX(ctx context.Context) int

SaveX is like Save, but panics if an error occurs.

func (*ReactUpdate) SetAccount

func (ru *ReactUpdate) SetAccount(a *Account) *ReactUpdate

SetAccount sets the "account" edge to the Account entity.

func (*ReactUpdate) SetAccountID

func (ru *ReactUpdate) SetAccountID(id xid.ID) *ReactUpdate

SetAccountID sets the "account" edge to the Account entity by ID.

func (*ReactUpdate) SetEmoji

func (ru *ReactUpdate) SetEmoji(s string) *ReactUpdate

SetEmoji sets the "emoji" field.

func (*ReactUpdate) SetNillableAccountID

func (ru *ReactUpdate) SetNillableAccountID(id *xid.ID) *ReactUpdate

SetNillableAccountID sets the "account" edge to the Account entity by ID if the given value is not nil.

func (*ReactUpdate) SetNillablePostID

func (ru *ReactUpdate) SetNillablePostID(id *xid.ID) *ReactUpdate

SetNillablePostID sets the "Post" edge to the Post entity by ID if the given value is not nil.

func (*ReactUpdate) SetPost

func (ru *ReactUpdate) SetPost(p *Post) *ReactUpdate

SetPost sets the "Post" edge to the Post entity.

func (*ReactUpdate) SetPostID

func (ru *ReactUpdate) SetPostID(id xid.ID) *ReactUpdate

SetPostID sets the "Post" edge to the Post entity by ID.

func (*ReactUpdate) Where

func (ru *ReactUpdate) Where(ps ...predicate.React) *ReactUpdate

Where appends a list predicates to the ReactUpdate builder.

type ReactUpdateOne

type ReactUpdateOne struct {
	// contains filtered or unexported fields
}

ReactUpdateOne is the builder for updating a single React entity.

func (*ReactUpdateOne) ClearAccount

func (ruo *ReactUpdateOne) ClearAccount() *ReactUpdateOne

ClearAccount clears the "account" edge to the Account entity.

func (*ReactUpdateOne) ClearPost

func (ruo *ReactUpdateOne) ClearPost() *ReactUpdateOne

ClearPost clears the "Post" edge to the Post entity.

func (*ReactUpdateOne) Exec

func (ruo *ReactUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*ReactUpdateOne) ExecX

func (ruo *ReactUpdateOne) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*ReactUpdateOne) Modify

func (ruo *ReactUpdateOne) Modify(modifiers ...func(u *sql.UpdateBuilder)) *ReactUpdateOne

Modify adds a statement modifier for attaching custom logic to the UPDATE statement.

func (*ReactUpdateOne) Mutation

func (ruo *ReactUpdateOne) Mutation() *ReactMutation

Mutation returns the ReactMutation object of the builder.

func (*ReactUpdateOne) Save

func (ruo *ReactUpdateOne) Save(ctx context.Context) (*React, error)

Save executes the query and returns the updated React entity.

func (*ReactUpdateOne) SaveX

func (ruo *ReactUpdateOne) SaveX(ctx context.Context) *React

SaveX is like Save, but panics if an error occurs.

func (*ReactUpdateOne) Select

func (ruo *ReactUpdateOne) Select(field string, fields ...string) *ReactUpdateOne

Select allows selecting one or more fields (columns) of the returned entity. The default is selecting all fields defined in the entity schema.

func (*ReactUpdateOne) SetAccount

func (ruo *ReactUpdateOne) SetAccount(a *Account) *ReactUpdateOne

SetAccount sets the "account" edge to the Account entity.

func (*ReactUpdateOne) SetAccountID

func (ruo *ReactUpdateOne) SetAccountID(id xid.ID) *ReactUpdateOne

SetAccountID sets the "account" edge to the Account entity by ID.

func (*ReactUpdateOne) SetEmoji

func (ruo *ReactUpdateOne) SetEmoji(s string) *ReactUpdateOne

SetEmoji sets the "emoji" field.

func (*ReactUpdateOne) SetNillableAccountID

func (ruo *ReactUpdateOne) SetNillableAccountID(id *xid.ID) *ReactUpdateOne

SetNillableAccountID sets the "account" edge to the Account entity by ID if the given value is not nil.

func (*ReactUpdateOne) SetNillablePostID

func (ruo *ReactUpdateOne) SetNillablePostID(id *xid.ID) *ReactUpdateOne

SetNillablePostID sets the "Post" edge to the Post entity by ID if the given value is not nil.

func (*ReactUpdateOne) SetPost

func (ruo *ReactUpdateOne) SetPost(p *Post) *ReactUpdateOne

SetPost sets the "Post" edge to the Post entity.

func (*ReactUpdateOne) SetPostID

func (ruo *ReactUpdateOne) SetPostID(id xid.ID) *ReactUpdateOne

SetPostID sets the "Post" edge to the Post entity by ID.

type ReactUpsert

type ReactUpsert struct {
	*sql.UpdateSet
}

ReactUpsert is the "OnConflict" setter.

func (*ReactUpsert) SetCreatedAt

func (u *ReactUpsert) SetCreatedAt(v time.Time) *ReactUpsert

SetCreatedAt sets the "created_at" field.

func (*ReactUpsert) SetEmoji

func (u *ReactUpsert) SetEmoji(v string) *ReactUpsert

SetEmoji sets the "emoji" field.

func (*ReactUpsert) UpdateCreatedAt

func (u *ReactUpsert) UpdateCreatedAt() *ReactUpsert

UpdateCreatedAt sets the "created_at" field to the value that was provided on create.

func (*ReactUpsert) UpdateEmoji

func (u *ReactUpsert) UpdateEmoji() *ReactUpsert

UpdateEmoji sets the "emoji" field to the value that was provided on create.

type ReactUpsertBulk

type ReactUpsertBulk struct {
	// contains filtered or unexported fields
}

ReactUpsertBulk is the builder for "upsert"-ing a bulk of React nodes.

func (*ReactUpsertBulk) DoNothing

func (u *ReactUpsertBulk) DoNothing() *ReactUpsertBulk

DoNothing configures the conflict_action to `DO NOTHING`. Supported only by SQLite and PostgreSQL.

func (*ReactUpsertBulk) Exec

func (u *ReactUpsertBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*ReactUpsertBulk) ExecX

func (u *ReactUpsertBulk) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*ReactUpsertBulk) Ignore

func (u *ReactUpsertBulk) Ignore() *ReactUpsertBulk

Ignore sets each column to itself in case of conflict. Using this option is equivalent to using:

client.React.Create().
	OnConflict(sql.ResolveWithIgnore()).
	Exec(ctx)

func (*ReactUpsertBulk) SetCreatedAt

func (u *ReactUpsertBulk) SetCreatedAt(v time.Time) *ReactUpsertBulk

SetCreatedAt sets the "created_at" field.

func (*ReactUpsertBulk) SetEmoji

func (u *ReactUpsertBulk) SetEmoji(v string) *ReactUpsertBulk

SetEmoji sets the "emoji" field.

func (*ReactUpsertBulk) Update

func (u *ReactUpsertBulk) Update(set func(*ReactUpsert)) *ReactUpsertBulk

Update allows overriding fields `UPDATE` values. See the ReactCreateBulk.OnConflict documentation for more info.

func (*ReactUpsertBulk) UpdateCreatedAt

func (u *ReactUpsertBulk) UpdateCreatedAt() *ReactUpsertBulk

UpdateCreatedAt sets the "created_at" field to the value that was provided on create.

func (*ReactUpsertBulk) UpdateEmoji

func (u *ReactUpsertBulk) UpdateEmoji() *ReactUpsertBulk

UpdateEmoji sets the "emoji" field to the value that was provided on create.

func (*ReactUpsertBulk) UpdateNewValues

func (u *ReactUpsertBulk) UpdateNewValues() *ReactUpsertBulk

UpdateNewValues updates the mutable fields using the new values that were set on create. Using this option is equivalent to using:

client.React.Create().
	OnConflict(
		sql.ResolveWithNewValues(),
		sql.ResolveWith(func(u *sql.UpdateSet) {
			u.SetIgnore(react.FieldID)
		}),
	).
	Exec(ctx)

type ReactUpsertOne

type ReactUpsertOne struct {
	// contains filtered or unexported fields
}

ReactUpsertOne is the builder for "upsert"-ing

one React node.

func (*ReactUpsertOne) DoNothing

func (u *ReactUpsertOne) DoNothing() *ReactUpsertOne

DoNothing configures the conflict_action to `DO NOTHING`. Supported only by SQLite and PostgreSQL.

func (*ReactUpsertOne) Exec

func (u *ReactUpsertOne) Exec(ctx context.Context) error

Exec executes the query.

func (*ReactUpsertOne) ExecX

func (u *ReactUpsertOne) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*ReactUpsertOne) ID

func (u *ReactUpsertOne) ID(ctx context.Context) (id xid.ID, err error)

Exec executes the UPSERT query and returns the inserted/updated ID.

func (*ReactUpsertOne) IDX

func (u *ReactUpsertOne) IDX(ctx context.Context) xid.ID

IDX is like ID, but panics if an error occurs.

func (*ReactUpsertOne) Ignore

func (u *ReactUpsertOne) Ignore() *ReactUpsertOne

Ignore sets each column to itself in case of conflict. Using this option is equivalent to using:

client.React.Create().
    OnConflict(sql.ResolveWithIgnore()).
    Exec(ctx)

func (*ReactUpsertOne) SetCreatedAt

func (u *ReactUpsertOne) SetCreatedAt(v time.Time) *ReactUpsertOne

SetCreatedAt sets the "created_at" field.

func (*ReactUpsertOne) SetEmoji

func (u *ReactUpsertOne) SetEmoji(v string) *ReactUpsertOne

SetEmoji sets the "emoji" field.

func (*ReactUpsertOne) Update

func (u *ReactUpsertOne) Update(set func(*ReactUpsert)) *ReactUpsertOne

Update allows overriding fields `UPDATE` values. See the ReactCreate.OnConflict documentation for more info.

func (*ReactUpsertOne) UpdateCreatedAt

func (u *ReactUpsertOne) UpdateCreatedAt() *ReactUpsertOne

UpdateCreatedAt sets the "created_at" field to the value that was provided on create.

func (*ReactUpsertOne) UpdateEmoji

func (u *ReactUpsertOne) UpdateEmoji() *ReactUpsertOne

UpdateEmoji sets the "emoji" field to the value that was provided on create.

func (*ReactUpsertOne) UpdateNewValues

func (u *ReactUpsertOne) UpdateNewValues() *ReactUpsertOne

UpdateNewValues updates the mutable fields using the new values that were set on create except the ID field. Using this option is equivalent to using:

client.React.Create().
	OnConflict(
		sql.ResolveWithNewValues(),
		sql.ResolveWith(func(u *sql.UpdateSet) {
			u.SetIgnore(react.FieldID)
		}),
	).
	Exec(ctx)

type Reacts

type Reacts []*React

Reacts is a parsable slice of React.

type Role

type Role struct {

	// ID of the ent.
	ID xid.ID `json:"id,omitempty"`
	// CreatedAt holds the value of the "created_at" field.
	CreatedAt time.Time `json:"created_at,omitempty"`
	// UpdatedAt holds the value of the "updated_at" field.
	UpdatedAt time.Time `json:"updated_at,omitempty"`
	// Name holds the value of the "name" field.
	Name string `json:"name,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the RoleQuery when eager-loading is set.
	Edges RoleEdges `json:"edges"`
	// contains filtered or unexported fields
}

Role is the model entity for the Role schema.

func (*Role) QueryAccounts

func (r *Role) QueryAccounts() *AccountQuery

QueryAccounts queries the "accounts" edge of the Role entity.

func (*Role) String

func (r *Role) String() string

String implements the fmt.Stringer.

func (*Role) Unwrap

func (r *Role) Unwrap() *Role

Unwrap unwraps the Role 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 (*Role) Update

func (r *Role) Update() *RoleUpdateOne

Update returns a builder for updating this Role. Note that you need to call Role.Unwrap() before calling this method if this Role was returned from a transaction, and the transaction was committed or rolled back.

type RoleClient

type RoleClient struct {
	// contains filtered or unexported fields
}

RoleClient is a client for the Role schema.

func NewRoleClient

func NewRoleClient(c config) *RoleClient

NewRoleClient returns a client for the Role from the given config.

func (*RoleClient) Create

func (c *RoleClient) Create() *RoleCreate

Create returns a builder for creating a Role entity.

func (*RoleClient) CreateBulk

func (c *RoleClient) CreateBulk(builders ...*RoleCreate) *RoleCreateBulk

CreateBulk returns a builder for creating a bulk of Role entities.

func (*RoleClient) Delete

func (c *RoleClient) Delete() *RoleDelete

Delete returns a delete builder for Role.

func (*RoleClient) DeleteOne

func (c *RoleClient) DeleteOne(r *Role) *RoleDeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*RoleClient) DeleteOneID

func (c *RoleClient) DeleteOneID(id xid.ID) *RoleDeleteOne

DeleteOne returns a builder for deleting the given entity by its id.

func (*RoleClient) Get

func (c *RoleClient) Get(ctx context.Context, id xid.ID) (*Role, error)

Get returns a Role entity by its id.

func (*RoleClient) GetX

func (c *RoleClient) GetX(ctx context.Context, id xid.ID) *Role

GetX is like Get, but panics if an error occurs.

func (*RoleClient) Hooks

func (c *RoleClient) Hooks() []Hook

Hooks returns the client hooks.

func (*RoleClient) Query

func (c *RoleClient) Query() *RoleQuery

Query returns a query builder for Role.

func (*RoleClient) QueryAccounts

func (c *RoleClient) QueryAccounts(r *Role) *AccountQuery

QueryAccounts queries the accounts edge of a Role.

func (*RoleClient) Update

func (c *RoleClient) Update() *RoleUpdate

Update returns an update builder for Role.

func (*RoleClient) UpdateOne

func (c *RoleClient) UpdateOne(r *Role) *RoleUpdateOne

UpdateOne returns an update builder for the given entity.

func (*RoleClient) UpdateOneID

func (c *RoleClient) UpdateOneID(id xid.ID) *RoleUpdateOne

UpdateOneID returns an update builder for the given id.

func (*RoleClient) Use

func (c *RoleClient) Use(hooks ...Hook)

Use adds a list of mutation hooks to the hooks stack. A call to `Use(f, g, h)` equals to `role.Hooks(f(g(h())))`.

type RoleCreate

type RoleCreate struct {
	// contains filtered or unexported fields
}

RoleCreate is the builder for creating a Role entity.

func (*RoleCreate) AddAccountIDs

func (rc *RoleCreate) AddAccountIDs(ids ...xid.ID) *RoleCreate

AddAccountIDs adds the "accounts" edge to the Account entity by IDs.

func (*RoleCreate) AddAccounts

func (rc *RoleCreate) AddAccounts(a ...*Account) *RoleCreate

AddAccounts adds the "accounts" edges to the Account entity.

func (*RoleCreate) Exec

func (rc *RoleCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*RoleCreate) ExecX

func (rc *RoleCreate) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*RoleCreate) Mutation

func (rc *RoleCreate) Mutation() *RoleMutation

Mutation returns the RoleMutation object of the builder.

func (*RoleCreate) OnConflict

func (rc *RoleCreate) OnConflict(opts ...sql.ConflictOption) *RoleUpsertOne

OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause of the `INSERT` statement. For example:

client.Role.Create().
	SetCreatedAt(v).
	OnConflict(
		// Update the row with the new values
		// the was proposed for insertion.
		sql.ResolveWithNewValues(),
	).
	// Override some of the fields with custom
	// update values.
	Update(func(u *ent.RoleUpsert) {
		SetCreatedAt(v+v).
	}).
	Exec(ctx)

func (*RoleCreate) OnConflictColumns

func (rc *RoleCreate) OnConflictColumns(columns ...string) *RoleUpsertOne

OnConflictColumns calls `OnConflict` and configures the columns as conflict target. Using this option is equivalent to using:

client.Role.Create().
	OnConflict(sql.ConflictColumns(columns...)).
	Exec(ctx)

func (*RoleCreate) Save

func (rc *RoleCreate) Save(ctx context.Context) (*Role, error)

Save creates the Role in the database.

func (*RoleCreate) SaveX

func (rc *RoleCreate) SaveX(ctx context.Context) *Role

SaveX calls Save and panics if Save returns an error.

func (*RoleCreate) SetCreatedAt

func (rc *RoleCreate) SetCreatedAt(t time.Time) *RoleCreate

SetCreatedAt sets the "created_at" field.

func (*RoleCreate) SetID

func (rc *RoleCreate) SetID(x xid.ID) *RoleCreate

SetID sets the "id" field.

func (*RoleCreate) SetName

func (rc *RoleCreate) SetName(s string) *RoleCreate

SetName sets the "name" field.

func (*RoleCreate) SetNillableCreatedAt

func (rc *RoleCreate) SetNillableCreatedAt(t *time.Time) *RoleCreate

SetNillableCreatedAt sets the "created_at" field if the given value is not nil.

func (*RoleCreate) SetNillableID

func (rc *RoleCreate) SetNillableID(x *xid.ID) *RoleCreate

SetNillableID sets the "id" field if the given value is not nil.

func (*RoleCreate) SetNillableUpdatedAt

func (rc *RoleCreate) SetNillableUpdatedAt(t *time.Time) *RoleCreate

SetNillableUpdatedAt sets the "updated_at" field if the given value is not nil.

func (*RoleCreate) SetUpdatedAt

func (rc *RoleCreate) SetUpdatedAt(t time.Time) *RoleCreate

SetUpdatedAt sets the "updated_at" field.

type RoleCreateBulk

type RoleCreateBulk struct {
	// contains filtered or unexported fields
}

RoleCreateBulk is the builder for creating many Role entities in bulk.

func (*RoleCreateBulk) Exec

func (rcb *RoleCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*RoleCreateBulk) ExecX

func (rcb *RoleCreateBulk) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*RoleCreateBulk) OnConflict

func (rcb *RoleCreateBulk) OnConflict(opts ...sql.ConflictOption) *RoleUpsertBulk

OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause of the `INSERT` statement. For example:

client.Role.CreateBulk(builders...).
	OnConflict(
		// Update the row with the new values
		// the was proposed for insertion.
		sql.ResolveWithNewValues(),
	).
	// Override some of the fields with custom
	// update values.
	Update(func(u *ent.RoleUpsert) {
		SetCreatedAt(v+v).
	}).
	Exec(ctx)

func (*RoleCreateBulk) OnConflictColumns

func (rcb *RoleCreateBulk) OnConflictColumns(columns ...string) *RoleUpsertBulk

OnConflictColumns calls `OnConflict` and configures the columns as conflict target. Using this option is equivalent to using:

client.Role.Create().
	OnConflict(sql.ConflictColumns(columns...)).
	Exec(ctx)

func (*RoleCreateBulk) Save

func (rcb *RoleCreateBulk) Save(ctx context.Context) ([]*Role, error)

Save creates the Role entities in the database.

func (*RoleCreateBulk) SaveX

func (rcb *RoleCreateBulk) SaveX(ctx context.Context) []*Role

SaveX is like Save, but panics if an error occurs.

type RoleDelete

type RoleDelete struct {
	// contains filtered or unexported fields
}

RoleDelete is the builder for deleting a Role entity.

func (*RoleDelete) Exec

func (rd *RoleDelete) Exec(ctx context.Context) (int, error)

Exec executes the deletion query and returns how many vertices were deleted.

func (*RoleDelete) ExecX

func (rd *RoleDelete) ExecX(ctx context.Context) int

ExecX is like Exec, but panics if an error occurs.

func (*RoleDelete) Where

func (rd *RoleDelete) Where(ps ...predicate.Role) *RoleDelete

Where appends a list predicates to the RoleDelete builder.

type RoleDeleteOne

type RoleDeleteOne struct {
	// contains filtered or unexported fields
}

RoleDeleteOne is the builder for deleting a single Role entity.

func (*RoleDeleteOne) Exec

func (rdo *RoleDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*RoleDeleteOne) ExecX

func (rdo *RoleDeleteOne) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

type RoleEdges

type RoleEdges struct {
	// Accounts holds the value of the accounts edge.
	Accounts []*Account `json:"accounts,omitempty"`
	// contains filtered or unexported fields
}

RoleEdges holds the relations/edges for other nodes in the graph.

func (RoleEdges) AccountsOrErr

func (e RoleEdges) AccountsOrErr() ([]*Account, error)

AccountsOrErr returns the Accounts value or an error if the edge was not loaded in eager-loading.

type RoleGroupBy

type RoleGroupBy struct {
	// contains filtered or unexported fields
}

RoleGroupBy is the group-by builder for Role entities.

func (*RoleGroupBy) Aggregate

func (rgb *RoleGroupBy) Aggregate(fns ...AggregateFunc) *RoleGroupBy

Aggregate adds the given aggregation functions to the group-by query.

func (*RoleGroupBy) Bool

func (s *RoleGroupBy) Bool(ctx context.Context) (_ bool, err error)

Bool returns a single bool from a selector. It is only allowed when selecting one field.

func (*RoleGroupBy) BoolX

func (s *RoleGroupBy) BoolX(ctx context.Context) bool

BoolX is like Bool, but panics if an error occurs.

func (*RoleGroupBy) Bools

func (s *RoleGroupBy) Bools(ctx context.Context) ([]bool, error)

Bools returns list of bools from a selector. It is only allowed when selecting one field.

func (*RoleGroupBy) BoolsX

func (s *RoleGroupBy) BoolsX(ctx context.Context) []bool

BoolsX is like Bools, but panics if an error occurs.

func (*RoleGroupBy) Float64

func (s *RoleGroupBy) Float64(ctx context.Context) (_ float64, err error)

Float64 returns a single float64 from a selector. It is only allowed when selecting one field.

func (*RoleGroupBy) Float64X

func (s *RoleGroupBy) Float64X(ctx context.Context) float64

Float64X is like Float64, but panics if an error occurs.

func (*RoleGroupBy) Float64s

func (s *RoleGroupBy) Float64s(ctx context.Context) ([]float64, error)

Float64s returns list of float64s from a selector. It is only allowed when selecting one field.

func (*RoleGroupBy) Float64sX

func (s *RoleGroupBy) Float64sX(ctx context.Context) []float64

Float64sX is like Float64s, but panics if an error occurs.

func (*RoleGroupBy) Int

func (s *RoleGroupBy) Int(ctx context.Context) (_ int, err error)

Int returns a single int from a selector. It is only allowed when selecting one field.

func (*RoleGroupBy) IntX

func (s *RoleGroupBy) IntX(ctx context.Context) int

IntX is like Int, but panics if an error occurs.

func (*RoleGroupBy) Ints

func (s *RoleGroupBy) Ints(ctx context.Context) ([]int, error)

Ints returns list of ints from a selector. It is only allowed when selecting one field.

func (*RoleGroupBy) IntsX

func (s *RoleGroupBy) IntsX(ctx context.Context) []int

IntsX is like Ints, but panics if an error occurs.

func (*RoleGroupBy) Scan

func (rgb *RoleGroupBy) Scan(ctx context.Context, v interface{}) error

Scan applies the group-by query and scans the result into the given value.

func (*RoleGroupBy) ScanX

func (s *RoleGroupBy) ScanX(ctx context.Context, v interface{})

ScanX is like Scan, but panics if an error occurs.

func (*RoleGroupBy) String

func (s *RoleGroupBy) String(ctx context.Context) (_ string, err error)

String returns a single string from a selector. It is only allowed when selecting one field.

func (*RoleGroupBy) StringX

func (s *RoleGroupBy) StringX(ctx context.Context) string

StringX is like String, but panics if an error occurs.

func (*RoleGroupBy) Strings

func (s *RoleGroupBy) Strings(ctx context.Context) ([]string, error)

Strings returns list of strings from a selector. It is only allowed when selecting one field.

func (*RoleGroupBy) StringsX

func (s *RoleGroupBy) StringsX(ctx context.Context) []string

StringsX is like Strings, but panics if an error occurs.

type RoleMutation

type RoleMutation struct {
	// contains filtered or unexported fields
}

RoleMutation represents an operation that mutates the Role nodes in the graph.

func (*RoleMutation) AccountsCleared

func (m *RoleMutation) AccountsCleared() bool

AccountsCleared reports if the "accounts" edge to the Account entity was cleared.

func (*RoleMutation) AccountsIDs

func (m *RoleMutation) AccountsIDs() (ids []xid.ID)

AccountsIDs returns the "accounts" edge IDs in the mutation.

func (*RoleMutation) AddAccountIDs

func (m *RoleMutation) AddAccountIDs(ids ...xid.ID)

AddAccountIDs adds the "accounts" edge to the Account entity by ids.

func (*RoleMutation) AddField

func (m *RoleMutation) 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 (*RoleMutation) AddedEdges

func (m *RoleMutation) AddedEdges() []string

AddedEdges returns all edge names that were set/added in this mutation.

func (*RoleMutation) AddedField

func (m *RoleMutation) 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 (*RoleMutation) AddedFields

func (m *RoleMutation) AddedFields() []string

AddedFields returns all numeric fields that were incremented/decremented during this mutation.

func (*RoleMutation) AddedIDs

func (m *RoleMutation) AddedIDs(name string) []ent.Value

AddedIDs returns all IDs (to other nodes) that were added for the given edge name in this mutation.

func (*RoleMutation) ClearAccounts

func (m *RoleMutation) ClearAccounts()

ClearAccounts clears the "accounts" edge to the Account entity.

func (*RoleMutation) ClearEdge

func (m *RoleMutation) 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 (*RoleMutation) ClearField

func (m *RoleMutation) 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 (*RoleMutation) ClearedEdges

func (m *RoleMutation) ClearedEdges() []string

ClearedEdges returns all edge names that were cleared in this mutation.

func (*RoleMutation) ClearedFields

func (m *RoleMutation) ClearedFields() []string

ClearedFields returns all nullable fields that were cleared during this mutation.

func (RoleMutation) Client

func (m RoleMutation) 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 (*RoleMutation) CreatedAt

func (m *RoleMutation) CreatedAt() (r time.Time, exists bool)

CreatedAt returns the value of the "created_at" field in the mutation.

func (*RoleMutation) EdgeCleared

func (m *RoleMutation) EdgeCleared(name string) bool

EdgeCleared returns a boolean which indicates if the edge with the given name was cleared in this mutation.

func (*RoleMutation) Field

func (m *RoleMutation) 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 (*RoleMutation) FieldCleared

func (m *RoleMutation) FieldCleared(name string) bool

FieldCleared returns a boolean indicating if a field with the given name was cleared in this mutation.

func (*RoleMutation) Fields

func (m *RoleMutation) 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 (*RoleMutation) ID

func (m *RoleMutation) ID() (id xid.ID, 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 (*RoleMutation) IDs

func (m *RoleMutation) IDs(ctx context.Context) ([]xid.ID, 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 (*RoleMutation) Name

func (m *RoleMutation) Name() (r string, exists bool)

Name returns the value of the "name" field in the mutation.

func (*RoleMutation) OldCreatedAt

func (m *RoleMutation) OldCreatedAt(ctx context.Context) (v time.Time, err error)

OldCreatedAt returns the old "created_at" field's value of the Role entity. If the Role 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 (*RoleMutation) OldField

func (m *RoleMutation) 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 (*RoleMutation) OldName

func (m *RoleMutation) OldName(ctx context.Context) (v string, err error)

OldName returns the old "name" field's value of the Role entity. If the Role 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 (*RoleMutation) OldUpdatedAt

func (m *RoleMutation) OldUpdatedAt(ctx context.Context) (v time.Time, err error)

OldUpdatedAt returns the old "updated_at" field's value of the Role entity. If the Role 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 (*RoleMutation) Op

func (m *RoleMutation) Op() Op

Op returns the operation name.

func (*RoleMutation) RemoveAccountIDs

func (m *RoleMutation) RemoveAccountIDs(ids ...xid.ID)

RemoveAccountIDs removes the "accounts" edge to the Account entity by IDs.

func (*RoleMutation) RemovedAccountsIDs

func (m *RoleMutation) RemovedAccountsIDs() (ids []xid.ID)

RemovedAccounts returns the removed IDs of the "accounts" edge to the Account entity.

func (*RoleMutation) RemovedEdges

func (m *RoleMutation) RemovedEdges() []string

RemovedEdges returns all edge names that were removed in this mutation.

func (*RoleMutation) RemovedIDs

func (m *RoleMutation) 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 (*RoleMutation) ResetAccounts

func (m *RoleMutation) ResetAccounts()

ResetAccounts resets all changes to the "accounts" edge.

func (*RoleMutation) ResetCreatedAt

func (m *RoleMutation) ResetCreatedAt()

ResetCreatedAt resets all changes to the "created_at" field.

func (*RoleMutation) ResetEdge

func (m *RoleMutation) 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 (*RoleMutation) ResetField

func (m *RoleMutation) 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 (*RoleMutation) ResetName

func (m *RoleMutation) ResetName()

ResetName resets all changes to the "name" field.

func (*RoleMutation) ResetUpdatedAt

func (m *RoleMutation) ResetUpdatedAt()

ResetUpdatedAt resets all changes to the "updated_at" field.

func (*RoleMutation) SetCreatedAt

func (m *RoleMutation) SetCreatedAt(t time.Time)

SetCreatedAt sets the "created_at" field.

func (*RoleMutation) SetField

func (m *RoleMutation) 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 (*RoleMutation) SetID

func (m *RoleMutation) SetID(id xid.ID)

SetID sets the value of the id field. Note that this operation is only accepted on creation of Role entities.

func (*RoleMutation) SetName

func (m *RoleMutation) SetName(s string)

SetName sets the "name" field.

func (*RoleMutation) SetUpdatedAt

func (m *RoleMutation) SetUpdatedAt(t time.Time)

SetUpdatedAt sets the "updated_at" field.

func (RoleMutation) Tx

func (m RoleMutation) Tx() (*Tx, error)

Tx returns an `ent.Tx` for mutations that were executed in transactions; it returns an error otherwise.

func (*RoleMutation) Type

func (m *RoleMutation) Type() string

Type returns the node type of this mutation (Role).

func (*RoleMutation) UpdatedAt

func (m *RoleMutation) UpdatedAt() (r time.Time, exists bool)

UpdatedAt returns the value of the "updated_at" field in the mutation.

func (*RoleMutation) Where

func (m *RoleMutation) Where(ps ...predicate.Role)

Where appends a list predicates to the RoleMutation builder.

type RoleQuery

type RoleQuery struct {
	// contains filtered or unexported fields
}

RoleQuery is the builder for querying Role entities.

func (*RoleQuery) All

func (rq *RoleQuery) All(ctx context.Context) ([]*Role, error)

All executes the query and returns a list of Roles.

func (*RoleQuery) AllX

func (rq *RoleQuery) AllX(ctx context.Context) []*Role

AllX is like All, but panics if an error occurs.

func (*RoleQuery) Clone

func (rq *RoleQuery) Clone() *RoleQuery

Clone returns a duplicate of the RoleQuery builder, including all associated steps. It can be used to prepare common query builders and use them differently after the clone is made.

func (*RoleQuery) Count

func (rq *RoleQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*RoleQuery) CountX

func (rq *RoleQuery) CountX(ctx context.Context) int

CountX is like Count, but panics if an error occurs.

func (*RoleQuery) Exist

func (rq *RoleQuery) Exist(ctx context.Context) (bool, error)

Exist returns true if the query has elements in the graph.

func (*RoleQuery) ExistX

func (rq *RoleQuery) ExistX(ctx context.Context) bool

ExistX is like Exist, but panics if an error occurs.

func (*RoleQuery) First

func (rq *RoleQuery) First(ctx context.Context) (*Role, error)

First returns the first Role entity from the query. Returns a *NotFoundError when no Role was found.

func (*RoleQuery) FirstID

func (rq *RoleQuery) FirstID(ctx context.Context) (id xid.ID, err error)

FirstID returns the first Role ID from the query. Returns a *NotFoundError when no Role ID was found.

func (*RoleQuery) FirstIDX

func (rq *RoleQuery) FirstIDX(ctx context.Context) xid.ID

FirstIDX is like FirstID, but panics if an error occurs.

func (*RoleQuery) FirstX

func (rq *RoleQuery) FirstX(ctx context.Context) *Role

FirstX is like First, but panics if an error occurs.

func (*RoleQuery) GroupBy

func (rq *RoleQuery) GroupBy(field string, fields ...string) *RoleGroupBy

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 {
	CreatedAt time.Time `json:"created_at,omitempty"`
	Count int `json:"count,omitempty"`
}

client.Role.Query().
	GroupBy(role.FieldCreatedAt).
	Aggregate(model.Count()).
	Scan(ctx, &v)

func (*RoleQuery) IDs

func (rq *RoleQuery) IDs(ctx context.Context) ([]xid.ID, error)

IDs executes the query and returns a list of Role IDs.

func (*RoleQuery) IDsX

func (rq *RoleQuery) IDsX(ctx context.Context) []xid.ID

IDsX is like IDs, but panics if an error occurs.

func (*RoleQuery) Limit

func (rq *RoleQuery) Limit(limit int) *RoleQuery

Limit adds a limit step to the query.

func (*RoleQuery) Modify

func (rq *RoleQuery) Modify(modifiers ...func(s *sql.Selector)) *RoleSelect

Modify adds a query modifier for attaching custom logic to queries.

func (*RoleQuery) Offset

func (rq *RoleQuery) Offset(offset int) *RoleQuery

Offset adds an offset step to the query.

func (*RoleQuery) Only

func (rq *RoleQuery) Only(ctx context.Context) (*Role, error)

Only returns a single Role entity found by the query, ensuring it only returns one. Returns a *NotSingularError when more than one Role entity is found. Returns a *NotFoundError when no Role entities are found.

func (*RoleQuery) OnlyID

func (rq *RoleQuery) OnlyID(ctx context.Context) (id xid.ID, err error)

OnlyID is like Only, but returns the only Role ID in the query. Returns a *NotSingularError when more than one Role ID is found. Returns a *NotFoundError when no entities are found.

func (*RoleQuery) OnlyIDX

func (rq *RoleQuery) OnlyIDX(ctx context.Context) xid.ID

OnlyIDX is like OnlyID, but panics if an error occurs.

func (*RoleQuery) OnlyX

func (rq *RoleQuery) OnlyX(ctx context.Context) *Role

OnlyX is like Only, but panics if an error occurs.

func (*RoleQuery) Order

func (rq *RoleQuery) Order(o ...OrderFunc) *RoleQuery

Order adds an order step to the query.

func (*RoleQuery) QueryAccounts

func (rq *RoleQuery) QueryAccounts() *AccountQuery

QueryAccounts chains the current query on the "accounts" edge.

func (*RoleQuery) Select

func (rq *RoleQuery) Select(fields ...string) *RoleSelect

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 {
	CreatedAt time.Time `json:"created_at,omitempty"`
}

client.Role.Query().
	Select(role.FieldCreatedAt).
	Scan(ctx, &v)

func (*RoleQuery) Unique

func (rq *RoleQuery) Unique(unique bool) *RoleQuery

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 (*RoleQuery) Where

func (rq *RoleQuery) Where(ps ...predicate.Role) *RoleQuery

Where adds a new predicate for the RoleQuery builder.

func (*RoleQuery) WithAccounts

func (rq *RoleQuery) WithAccounts(opts ...func(*AccountQuery)) *RoleQuery

WithAccounts tells the query-builder to eager-load the nodes that are connected to the "accounts" edge. The optional arguments are used to configure the query builder of the edge.

type RoleSelect

type RoleSelect struct {
	*RoleQuery
	// contains filtered or unexported fields
}

RoleSelect is the builder for selecting fields of Role entities.

func (*RoleSelect) Bool

func (s *RoleSelect) Bool(ctx context.Context) (_ bool, err error)

Bool returns a single bool from a selector. It is only allowed when selecting one field.

func (*RoleSelect) BoolX

func (s *RoleSelect) BoolX(ctx context.Context) bool

BoolX is like Bool, but panics if an error occurs.

func (*RoleSelect) Bools

func (s *RoleSelect) Bools(ctx context.Context) ([]bool, error)

Bools returns list of bools from a selector. It is only allowed when selecting one field.

func (*RoleSelect) BoolsX

func (s *RoleSelect) BoolsX(ctx context.Context) []bool

BoolsX is like Bools, but panics if an error occurs.

func (*RoleSelect) Float64

func (s *RoleSelect) Float64(ctx context.Context) (_ float64, err error)

Float64 returns a single float64 from a selector. It is only allowed when selecting one field.

func (*RoleSelect) Float64X

func (s *RoleSelect) Float64X(ctx context.Context) float64

Float64X is like Float64, but panics if an error occurs.

func (*RoleSelect) Float64s

func (s *RoleSelect) Float64s(ctx context.Context) ([]float64, error)

Float64s returns list of float64s from a selector. It is only allowed when selecting one field.

func (*RoleSelect) Float64sX

func (s *RoleSelect) Float64sX(ctx context.Context) []float64

Float64sX is like Float64s, but panics if an error occurs.

func (*RoleSelect) Int

func (s *RoleSelect) Int(ctx context.Context) (_ int, err error)

Int returns a single int from a selector. It is only allowed when selecting one field.

func (*RoleSelect) IntX

func (s *RoleSelect) IntX(ctx context.Context) int

IntX is like Int, but panics if an error occurs.

func (*RoleSelect) Ints

func (s *RoleSelect) Ints(ctx context.Context) ([]int, error)

Ints returns list of ints from a selector. It is only allowed when selecting one field.

func (*RoleSelect) IntsX

func (s *RoleSelect) IntsX(ctx context.Context) []int

IntsX is like Ints, but panics if an error occurs.

func (*RoleSelect) Modify

func (rs *RoleSelect) Modify(modifiers ...func(s *sql.Selector)) *RoleSelect

Modify adds a query modifier for attaching custom logic to queries.

func (*RoleSelect) Scan

func (rs *RoleSelect) Scan(ctx context.Context, v interface{}) error

Scan applies the selector query and scans the result into the given value.

func (*RoleSelect) ScanX

func (s *RoleSelect) ScanX(ctx context.Context, v interface{})

ScanX is like Scan, but panics if an error occurs.

func (*RoleSelect) String

func (s *RoleSelect) String(ctx context.Context) (_ string, err error)

String returns a single string from a selector. It is only allowed when selecting one field.

func (*RoleSelect) StringX

func (s *RoleSelect) StringX(ctx context.Context) string

StringX is like String, but panics if an error occurs.

func (*RoleSelect) Strings

func (s *RoleSelect) Strings(ctx context.Context) ([]string, error)

Strings returns list of strings from a selector. It is only allowed when selecting one field.

func (*RoleSelect) StringsX

func (s *RoleSelect) StringsX(ctx context.Context) []string

StringsX is like Strings, but panics if an error occurs.

type RoleUpdate

type RoleUpdate struct {
	// contains filtered or unexported fields
}

RoleUpdate is the builder for updating Role entities.

func (*RoleUpdate) AddAccountIDs

func (ru *RoleUpdate) AddAccountIDs(ids ...xid.ID) *RoleUpdate

AddAccountIDs adds the "accounts" edge to the Account entity by IDs.

func (*RoleUpdate) AddAccounts

func (ru *RoleUpdate) AddAccounts(a ...*Account) *RoleUpdate

AddAccounts adds the "accounts" edges to the Account entity.

func (*RoleUpdate) ClearAccounts

func (ru *RoleUpdate) ClearAccounts() *RoleUpdate

ClearAccounts clears all "accounts" edges to the Account entity.

func (*RoleUpdate) Exec

func (ru *RoleUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*RoleUpdate) ExecX

func (ru *RoleUpdate) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*RoleUpdate) Modify

func (ru *RoleUpdate) Modify(modifiers ...func(u *sql.UpdateBuilder)) *RoleUpdate

Modify adds a statement modifier for attaching custom logic to the UPDATE statement.

func (*RoleUpdate) Mutation

func (ru *RoleUpdate) Mutation() *RoleMutation

Mutation returns the RoleMutation object of the builder.

func (*RoleUpdate) RemoveAccountIDs

func (ru *RoleUpdate) RemoveAccountIDs(ids ...xid.ID) *RoleUpdate

RemoveAccountIDs removes the "accounts" edge to Account entities by IDs.

func (*RoleUpdate) RemoveAccounts

func (ru *RoleUpdate) RemoveAccounts(a ...*Account) *RoleUpdate

RemoveAccounts removes "accounts" edges to Account entities.

func (*RoleUpdate) Save

func (ru *RoleUpdate) Save(ctx context.Context) (int, error)

Save executes the query and returns the number of nodes affected by the update operation.

func (*RoleUpdate) SaveX

func (ru *RoleUpdate) SaveX(ctx context.Context) int

SaveX is like Save, but panics if an error occurs.

func (*RoleUpdate) SetName

func (ru *RoleUpdate) SetName(s string) *RoleUpdate

SetName sets the "name" field.

func (*RoleUpdate) SetUpdatedAt

func (ru *RoleUpdate) SetUpdatedAt(t time.Time) *RoleUpdate

SetUpdatedAt sets the "updated_at" field.

func (*RoleUpdate) Where

func (ru *RoleUpdate) Where(ps ...predicate.Role) *RoleUpdate

Where appends a list predicates to the RoleUpdate builder.

type RoleUpdateOne

type RoleUpdateOne struct {
	// contains filtered or unexported fields
}

RoleUpdateOne is the builder for updating a single Role entity.

func (*RoleUpdateOne) AddAccountIDs

func (ruo *RoleUpdateOne) AddAccountIDs(ids ...xid.ID) *RoleUpdateOne

AddAccountIDs adds the "accounts" edge to the Account entity by IDs.

func (*RoleUpdateOne) AddAccounts

func (ruo *RoleUpdateOne) AddAccounts(a ...*Account) *RoleUpdateOne

AddAccounts adds the "accounts" edges to the Account entity.

func (*RoleUpdateOne) ClearAccounts

func (ruo *RoleUpdateOne) ClearAccounts() *RoleUpdateOne

ClearAccounts clears all "accounts" edges to the Account entity.

func (*RoleUpdateOne) Exec

func (ruo *RoleUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*RoleUpdateOne) ExecX

func (ruo *RoleUpdateOne) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*RoleUpdateOne) Modify

func (ruo *RoleUpdateOne) Modify(modifiers ...func(u *sql.UpdateBuilder)) *RoleUpdateOne

Modify adds a statement modifier for attaching custom logic to the UPDATE statement.

func (*RoleUpdateOne) Mutation

func (ruo *RoleUpdateOne) Mutation() *RoleMutation

Mutation returns the RoleMutation object of the builder.

func (*RoleUpdateOne) RemoveAccountIDs

func (ruo *RoleUpdateOne) RemoveAccountIDs(ids ...xid.ID) *RoleUpdateOne

RemoveAccountIDs removes the "accounts" edge to Account entities by IDs.

func (*RoleUpdateOne) RemoveAccounts

func (ruo *RoleUpdateOne) RemoveAccounts(a ...*Account) *RoleUpdateOne

RemoveAccounts removes "accounts" edges to Account entities.

func (*RoleUpdateOne) Save

func (ruo *RoleUpdateOne) Save(ctx context.Context) (*Role, error)

Save executes the query and returns the updated Role entity.

func (*RoleUpdateOne) SaveX

func (ruo *RoleUpdateOne) SaveX(ctx context.Context) *Role

SaveX is like Save, but panics if an error occurs.

func (*RoleUpdateOne) Select

func (ruo *RoleUpdateOne) Select(field string, fields ...string) *RoleUpdateOne

Select allows selecting one or more fields (columns) of the returned entity. The default is selecting all fields defined in the entity schema.

func (*RoleUpdateOne) SetName

func (ruo *RoleUpdateOne) SetName(s string) *RoleUpdateOne

SetName sets the "name" field.

func (*RoleUpdateOne) SetUpdatedAt

func (ruo *RoleUpdateOne) SetUpdatedAt(t time.Time) *RoleUpdateOne

SetUpdatedAt sets the "updated_at" field.

type RoleUpsert

type RoleUpsert struct {
	*sql.UpdateSet
}

RoleUpsert is the "OnConflict" setter.

func (*RoleUpsert) SetCreatedAt

func (u *RoleUpsert) SetCreatedAt(v time.Time) *RoleUpsert

SetCreatedAt sets the "created_at" field.

func (*RoleUpsert) SetName

func (u *RoleUpsert) SetName(v string) *RoleUpsert

SetName sets the "name" field.

func (*RoleUpsert) SetUpdatedAt

func (u *RoleUpsert) SetUpdatedAt(v time.Time) *RoleUpsert

SetUpdatedAt sets the "updated_at" field.

func (*RoleUpsert) UpdateCreatedAt

func (u *RoleUpsert) UpdateCreatedAt() *RoleUpsert

UpdateCreatedAt sets the "created_at" field to the value that was provided on create.

func (*RoleUpsert) UpdateName

func (u *RoleUpsert) UpdateName() *RoleUpsert

UpdateName sets the "name" field to the value that was provided on create.

func (*RoleUpsert) UpdateUpdatedAt

func (u *RoleUpsert) UpdateUpdatedAt() *RoleUpsert

UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create.

type RoleUpsertBulk

type RoleUpsertBulk struct {
	// contains filtered or unexported fields
}

RoleUpsertBulk is the builder for "upsert"-ing a bulk of Role nodes.

func (*RoleUpsertBulk) DoNothing

func (u *RoleUpsertBulk) DoNothing() *RoleUpsertBulk

DoNothing configures the conflict_action to `DO NOTHING`. Supported only by SQLite and PostgreSQL.

func (*RoleUpsertBulk) Exec

func (u *RoleUpsertBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*RoleUpsertBulk) ExecX

func (u *RoleUpsertBulk) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*RoleUpsertBulk) Ignore

func (u *RoleUpsertBulk) Ignore() *RoleUpsertBulk

Ignore sets each column to itself in case of conflict. Using this option is equivalent to using:

client.Role.Create().
	OnConflict(sql.ResolveWithIgnore()).
	Exec(ctx)

func (*RoleUpsertBulk) SetCreatedAt

func (u *RoleUpsertBulk) SetCreatedAt(v time.Time) *RoleUpsertBulk

SetCreatedAt sets the "created_at" field.

func (*RoleUpsertBulk) SetName

func (u *RoleUpsertBulk) SetName(v string) *RoleUpsertBulk

SetName sets the "name" field.

func (*RoleUpsertBulk) SetUpdatedAt

func (u *RoleUpsertBulk) SetUpdatedAt(v time.Time) *RoleUpsertBulk

SetUpdatedAt sets the "updated_at" field.

func (*RoleUpsertBulk) Update

func (u *RoleUpsertBulk) Update(set func(*RoleUpsert)) *RoleUpsertBulk

Update allows overriding fields `UPDATE` values. See the RoleCreateBulk.OnConflict documentation for more info.

func (*RoleUpsertBulk) UpdateCreatedAt

func (u *RoleUpsertBulk) UpdateCreatedAt() *RoleUpsertBulk

UpdateCreatedAt sets the "created_at" field to the value that was provided on create.

func (*RoleUpsertBulk) UpdateName

func (u *RoleUpsertBulk) UpdateName() *RoleUpsertBulk

UpdateName sets the "name" field to the value that was provided on create.

func (*RoleUpsertBulk) UpdateNewValues

func (u *RoleUpsertBulk) UpdateNewValues() *RoleUpsertBulk

UpdateNewValues updates the mutable fields using the new values that were set on create. Using this option is equivalent to using:

client.Role.Create().
	OnConflict(
		sql.ResolveWithNewValues(),
		sql.ResolveWith(func(u *sql.UpdateSet) {
			u.SetIgnore(role.FieldID)
		}),
	).
	Exec(ctx)

func (*RoleUpsertBulk) UpdateUpdatedAt

func (u *RoleUpsertBulk) UpdateUpdatedAt() *RoleUpsertBulk

UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create.

type RoleUpsertOne

type RoleUpsertOne struct {
	// contains filtered or unexported fields
}

RoleUpsertOne is the builder for "upsert"-ing

one Role node.

func (*RoleUpsertOne) DoNothing

func (u *RoleUpsertOne) DoNothing() *RoleUpsertOne

DoNothing configures the conflict_action to `DO NOTHING`. Supported only by SQLite and PostgreSQL.

func (*RoleUpsertOne) Exec

func (u *RoleUpsertOne) Exec(ctx context.Context) error

Exec executes the query.

func (*RoleUpsertOne) ExecX

func (u *RoleUpsertOne) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*RoleUpsertOne) ID

func (u *RoleUpsertOne) ID(ctx context.Context) (id xid.ID, err error)

Exec executes the UPSERT query and returns the inserted/updated ID.

func (*RoleUpsertOne) IDX

func (u *RoleUpsertOne) IDX(ctx context.Context) xid.ID

IDX is like ID, but panics if an error occurs.

func (*RoleUpsertOne) Ignore

func (u *RoleUpsertOne) Ignore() *RoleUpsertOne

Ignore sets each column to itself in case of conflict. Using this option is equivalent to using:

client.Role.Create().
    OnConflict(sql.ResolveWithIgnore()).
    Exec(ctx)

func (*RoleUpsertOne) SetCreatedAt

func (u *RoleUpsertOne) SetCreatedAt(v time.Time) *RoleUpsertOne

SetCreatedAt sets the "created_at" field.

func (*RoleUpsertOne) SetName

func (u *RoleUpsertOne) SetName(v string) *RoleUpsertOne

SetName sets the "name" field.

func (*RoleUpsertOne) SetUpdatedAt

func (u *RoleUpsertOne) SetUpdatedAt(v time.Time) *RoleUpsertOne

SetUpdatedAt sets the "updated_at" field.

func (*RoleUpsertOne) Update

func (u *RoleUpsertOne) Update(set func(*RoleUpsert)) *RoleUpsertOne

Update allows overriding fields `UPDATE` values. See the RoleCreate.OnConflict documentation for more info.

func (*RoleUpsertOne) UpdateCreatedAt

func (u *RoleUpsertOne) UpdateCreatedAt() *RoleUpsertOne

UpdateCreatedAt sets the "created_at" field to the value that was provided on create.

func (*RoleUpsertOne) UpdateName

func (u *RoleUpsertOne) UpdateName() *RoleUpsertOne

UpdateName sets the "name" field to the value that was provided on create.

func (*RoleUpsertOne) UpdateNewValues

func (u *RoleUpsertOne) UpdateNewValues() *RoleUpsertOne

UpdateNewValues updates the mutable fields using the new values that were set on create except the ID field. Using this option is equivalent to using:

client.Role.Create().
	OnConflict(
		sql.ResolveWithNewValues(),
		sql.ResolveWith(func(u *sql.UpdateSet) {
			u.SetIgnore(role.FieldID)
		}),
	).
	Exec(ctx)

func (*RoleUpsertOne) UpdateUpdatedAt

func (u *RoleUpsertOne) UpdateUpdatedAt() *RoleUpsertOne

UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create.

type Roles

type Roles []*Role

Roles is a parsable slice of Role.

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 Subscription

type Subscription struct {

	// ID of the ent.
	ID xid.ID `json:"id,omitempty"`
	// CreatedAt holds the value of the "created_at" field.
	CreatedAt time.Time `json:"created_at,omitempty"`
	// RefersType holds the value of the "refers_type" field.
	RefersType string `json:"refers_type,omitempty"`
	// RefersTo holds the value of the "refers_to" field.
	RefersTo string `json:"refers_to,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the SubscriptionQuery when eager-loading is set.
	Edges SubscriptionEdges `json:"edges"`
	// contains filtered or unexported fields
}

Subscription is the model entity for the Subscription schema.

func (*Subscription) QueryAccount

func (s *Subscription) QueryAccount() *AccountQuery

QueryAccount queries the "account" edge of the Subscription entity.

func (*Subscription) QueryNotifications

func (s *Subscription) QueryNotifications() *NotificationQuery

QueryNotifications queries the "notifications" edge of the Subscription entity.

func (*Subscription) String

func (s *Subscription) String() string

String implements the fmt.Stringer.

func (*Subscription) Unwrap

func (s *Subscription) Unwrap() *Subscription

Unwrap unwraps the Subscription 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 (*Subscription) Update

func (s *Subscription) Update() *SubscriptionUpdateOne

Update returns a builder for updating this Subscription. Note that you need to call Subscription.Unwrap() before calling this method if this Subscription was returned from a transaction, and the transaction was committed or rolled back.

type SubscriptionClient

type SubscriptionClient struct {
	// contains filtered or unexported fields
}

SubscriptionClient is a client for the Subscription schema.

func NewSubscriptionClient

func NewSubscriptionClient(c config) *SubscriptionClient

NewSubscriptionClient returns a client for the Subscription from the given config.

func (*SubscriptionClient) Create

Create returns a builder for creating a Subscription entity.

func (*SubscriptionClient) CreateBulk

func (c *SubscriptionClient) CreateBulk(builders ...*SubscriptionCreate) *SubscriptionCreateBulk

CreateBulk returns a builder for creating a bulk of Subscription entities.

func (*SubscriptionClient) Delete

Delete returns a delete builder for Subscription.

func (*SubscriptionClient) DeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*SubscriptionClient) DeleteOneID

func (c *SubscriptionClient) DeleteOneID(id xid.ID) *SubscriptionDeleteOne

DeleteOne returns a builder for deleting the given entity by its id.

func (*SubscriptionClient) Get

Get returns a Subscription entity by its id.

func (*SubscriptionClient) GetX

GetX is like Get, but panics if an error occurs.

func (*SubscriptionClient) Hooks

func (c *SubscriptionClient) Hooks() []Hook

Hooks returns the client hooks.

func (*SubscriptionClient) Query

Query returns a query builder for Subscription.

func (*SubscriptionClient) QueryAccount

func (c *SubscriptionClient) QueryAccount(s *Subscription) *AccountQuery

QueryAccount queries the account edge of a Subscription.

func (*SubscriptionClient) QueryNotifications

func (c *SubscriptionClient) QueryNotifications(s *Subscription) *NotificationQuery

QueryNotifications queries the notifications edge of a Subscription.

func (*SubscriptionClient) Update

Update returns an update builder for Subscription.

func (*SubscriptionClient) UpdateOne

UpdateOne returns an update builder for the given entity.

func (*SubscriptionClient) UpdateOneID

func (c *SubscriptionClient) UpdateOneID(id xid.ID) *SubscriptionUpdateOne

UpdateOneID returns an update builder for the given id.

func (*SubscriptionClient) Use

func (c *SubscriptionClient) Use(hooks ...Hook)

Use adds a list of mutation hooks to the hooks stack. A call to `Use(f, g, h)` equals to `subscription.Hooks(f(g(h())))`.

type SubscriptionCreate

type SubscriptionCreate struct {
	// contains filtered or unexported fields
}

SubscriptionCreate is the builder for creating a Subscription entity.

func (*SubscriptionCreate) AddNotificationIDs

func (sc *SubscriptionCreate) AddNotificationIDs(ids ...xid.ID) *SubscriptionCreate

AddNotificationIDs adds the "notifications" edge to the Notification entity by IDs.

func (*SubscriptionCreate) AddNotifications

func (sc *SubscriptionCreate) AddNotifications(n ...*Notification) *SubscriptionCreate

AddNotifications adds the "notifications" edges to the Notification entity.

func (*SubscriptionCreate) Exec

func (sc *SubscriptionCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*SubscriptionCreate) ExecX

func (sc *SubscriptionCreate) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*SubscriptionCreate) Mutation

func (sc *SubscriptionCreate) Mutation() *SubscriptionMutation

Mutation returns the SubscriptionMutation object of the builder.

func (*SubscriptionCreate) OnConflict

OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause of the `INSERT` statement. For example:

client.Subscription.Create().
	SetCreatedAt(v).
	OnConflict(
		// Update the row with the new values
		// the was proposed for insertion.
		sql.ResolveWithNewValues(),
	).
	// Override some of the fields with custom
	// update values.
	Update(func(u *ent.SubscriptionUpsert) {
		SetCreatedAt(v+v).
	}).
	Exec(ctx)

func (*SubscriptionCreate) OnConflictColumns

func (sc *SubscriptionCreate) OnConflictColumns(columns ...string) *SubscriptionUpsertOne

OnConflictColumns calls `OnConflict` and configures the columns as conflict target. Using this option is equivalent to using:

client.Subscription.Create().
	OnConflict(sql.ConflictColumns(columns...)).
	Exec(ctx)

func (*SubscriptionCreate) Save

Save creates the Subscription in the database.

func (*SubscriptionCreate) SaveX

SaveX calls Save and panics if Save returns an error.

func (*SubscriptionCreate) SetAccount

func (sc *SubscriptionCreate) SetAccount(a *Account) *SubscriptionCreate

SetAccount sets the "account" edge to the Account entity.

func (*SubscriptionCreate) SetAccountID

func (sc *SubscriptionCreate) SetAccountID(id xid.ID) *SubscriptionCreate

SetAccountID sets the "account" edge to the Account entity by ID.

func (*SubscriptionCreate) SetCreatedAt

func (sc *SubscriptionCreate) SetCreatedAt(t time.Time) *SubscriptionCreate

SetCreatedAt sets the "created_at" field.

func (*SubscriptionCreate) SetID

SetID sets the "id" field.

func (*SubscriptionCreate) SetNillableAccountID

func (sc *SubscriptionCreate) SetNillableAccountID(id *xid.ID) *SubscriptionCreate

SetNillableAccountID sets the "account" edge to the Account entity by ID if the given value is not nil.

func (*SubscriptionCreate) SetNillableCreatedAt

func (sc *SubscriptionCreate) SetNillableCreatedAt(t *time.Time) *SubscriptionCreate

SetNillableCreatedAt sets the "created_at" field if the given value is not nil.

func (*SubscriptionCreate) SetNillableID

func (sc *SubscriptionCreate) SetNillableID(x *xid.ID) *SubscriptionCreate

SetNillableID sets the "id" field if the given value is not nil.

func (*SubscriptionCreate) SetRefersTo

func (sc *SubscriptionCreate) SetRefersTo(s string) *SubscriptionCreate

SetRefersTo sets the "refers_to" field.

func (*SubscriptionCreate) SetRefersType

func (sc *SubscriptionCreate) SetRefersType(s string) *SubscriptionCreate

SetRefersType sets the "refers_type" field.

type SubscriptionCreateBulk

type SubscriptionCreateBulk struct {
	// contains filtered or unexported fields
}

SubscriptionCreateBulk is the builder for creating many Subscription entities in bulk.

func (*SubscriptionCreateBulk) Exec

Exec executes the query.

func (*SubscriptionCreateBulk) ExecX

func (scb *SubscriptionCreateBulk) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*SubscriptionCreateBulk) OnConflict

OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause of the `INSERT` statement. For example:

client.Subscription.CreateBulk(builders...).
	OnConflict(
		// Update the row with the new values
		// the was proposed for insertion.
		sql.ResolveWithNewValues(),
	).
	// Override some of the fields with custom
	// update values.
	Update(func(u *ent.SubscriptionUpsert) {
		SetCreatedAt(v+v).
	}).
	Exec(ctx)

func (*SubscriptionCreateBulk) OnConflictColumns

func (scb *SubscriptionCreateBulk) OnConflictColumns(columns ...string) *SubscriptionUpsertBulk

OnConflictColumns calls `OnConflict` and configures the columns as conflict target. Using this option is equivalent to using:

client.Subscription.Create().
	OnConflict(sql.ConflictColumns(columns...)).
	Exec(ctx)

func (*SubscriptionCreateBulk) Save

Save creates the Subscription entities in the database.

func (*SubscriptionCreateBulk) SaveX

SaveX is like Save, but panics if an error occurs.

type SubscriptionDelete

type SubscriptionDelete struct {
	// contains filtered or unexported fields
}

SubscriptionDelete is the builder for deleting a Subscription entity.

func (*SubscriptionDelete) Exec

func (sd *SubscriptionDelete) Exec(ctx context.Context) (int, error)

Exec executes the deletion query and returns how many vertices were deleted.

func (*SubscriptionDelete) ExecX

func (sd *SubscriptionDelete) ExecX(ctx context.Context) int

ExecX is like Exec, but panics if an error occurs.

func (*SubscriptionDelete) Where

Where appends a list predicates to the SubscriptionDelete builder.

type SubscriptionDeleteOne

type SubscriptionDeleteOne struct {
	// contains filtered or unexported fields
}

SubscriptionDeleteOne is the builder for deleting a single Subscription entity.

func (*SubscriptionDeleteOne) Exec

func (sdo *SubscriptionDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*SubscriptionDeleteOne) ExecX

func (sdo *SubscriptionDeleteOne) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

type SubscriptionEdges

type SubscriptionEdges struct {
	// Account holds the value of the account edge.
	Account *Account `json:"account,omitempty"`
	// Notifications holds the value of the notifications edge.
	Notifications []*Notification `json:"notifications,omitempty"`
	// contains filtered or unexported fields
}

SubscriptionEdges holds the relations/edges for other nodes in the graph.

func (SubscriptionEdges) AccountOrErr

func (e SubscriptionEdges) AccountOrErr() (*Account, error)

AccountOrErr returns the Account value or an error if the edge was not loaded in eager-loading, or loaded but was not found.

func (SubscriptionEdges) NotificationsOrErr

func (e SubscriptionEdges) NotificationsOrErr() ([]*Notification, error)

NotificationsOrErr returns the Notifications value or an error if the edge was not loaded in eager-loading.

type SubscriptionGroupBy

type SubscriptionGroupBy struct {
	// contains filtered or unexported fields
}

SubscriptionGroupBy is the group-by builder for Subscription entities.

func (*SubscriptionGroupBy) Aggregate

func (sgb *SubscriptionGroupBy) Aggregate(fns ...AggregateFunc) *SubscriptionGroupBy

Aggregate adds the given aggregation functions to the group-by query.

func (*SubscriptionGroupBy) Bool

func (s *SubscriptionGroupBy) Bool(ctx context.Context) (_ bool, err error)

Bool returns a single bool from a selector. It is only allowed when selecting one field.

func (*SubscriptionGroupBy) BoolX

func (s *SubscriptionGroupBy) BoolX(ctx context.Context) bool

BoolX is like Bool, but panics if an error occurs.

func (*SubscriptionGroupBy) Bools

func (s *SubscriptionGroupBy) Bools(ctx context.Context) ([]bool, error)

Bools returns list of bools from a selector. It is only allowed when selecting one field.

func (*SubscriptionGroupBy) BoolsX

func (s *SubscriptionGroupBy) BoolsX(ctx context.Context) []bool

BoolsX is like Bools, but panics if an error occurs.

func (*SubscriptionGroupBy) Float64

func (s *SubscriptionGroupBy) Float64(ctx context.Context) (_ float64, err error)

Float64 returns a single float64 from a selector. It is only allowed when selecting one field.

func (*SubscriptionGroupBy) Float64X

func (s *SubscriptionGroupBy) Float64X(ctx context.Context) float64

Float64X is like Float64, but panics if an error occurs.

func (*SubscriptionGroupBy) Float64s

func (s *SubscriptionGroupBy) Float64s(ctx context.Context) ([]float64, error)

Float64s returns list of float64s from a selector. It is only allowed when selecting one field.

func (*SubscriptionGroupBy) Float64sX

func (s *SubscriptionGroupBy) Float64sX(ctx context.Context) []float64

Float64sX is like Float64s, but panics if an error occurs.

func (*SubscriptionGroupBy) Int

func (s *SubscriptionGroupBy) Int(ctx context.Context) (_ int, err error)

Int returns a single int from a selector. It is only allowed when selecting one field.

func (*SubscriptionGroupBy) IntX

func (s *SubscriptionGroupBy) IntX(ctx context.Context) int

IntX is like Int, but panics if an error occurs.

func (*SubscriptionGroupBy) Ints

func (s *SubscriptionGroupBy) Ints(ctx context.Context) ([]int, error)

Ints returns list of ints from a selector. It is only allowed when selecting one field.

func (*SubscriptionGroupBy) IntsX

func (s *SubscriptionGroupBy) IntsX(ctx context.Context) []int

IntsX is like Ints, but panics if an error occurs.

func (*SubscriptionGroupBy) Scan

func (sgb *SubscriptionGroupBy) Scan(ctx context.Context, v interface{}) error

Scan applies the group-by query and scans the result into the given value.

func (*SubscriptionGroupBy) ScanX

func (s *SubscriptionGroupBy) ScanX(ctx context.Context, v interface{})

ScanX is like Scan, but panics if an error occurs.

func (*SubscriptionGroupBy) String

func (s *SubscriptionGroupBy) String(ctx context.Context) (_ string, err error)

String returns a single string from a selector. It is only allowed when selecting one field.

func (*SubscriptionGroupBy) StringX

func (s *SubscriptionGroupBy) StringX(ctx context.Context) string

StringX is like String, but panics if an error occurs.

func (*SubscriptionGroupBy) Strings

func (s *SubscriptionGroupBy) Strings(ctx context.Context) ([]string, error)

Strings returns list of strings from a selector. It is only allowed when selecting one field.

func (*SubscriptionGroupBy) StringsX

func (s *SubscriptionGroupBy) StringsX(ctx context.Context) []string

StringsX is like Strings, but panics if an error occurs.

type SubscriptionMutation

type SubscriptionMutation struct {
	// contains filtered or unexported fields
}

SubscriptionMutation represents an operation that mutates the Subscription nodes in the graph.

func (*SubscriptionMutation) AccountCleared

func (m *SubscriptionMutation) AccountCleared() bool

AccountCleared reports if the "account" edge to the Account entity was cleared.

func (*SubscriptionMutation) AccountID

func (m *SubscriptionMutation) AccountID() (id xid.ID, exists bool)

AccountID returns the "account" edge ID in the mutation.

func (*SubscriptionMutation) AccountIDs

func (m *SubscriptionMutation) AccountIDs() (ids []xid.ID)

AccountIDs returns the "account" edge IDs in the mutation. Note that IDs always returns len(IDs) <= 1 for unique edges, and you should use AccountID instead. It exists only for internal usage by the builders.

func (*SubscriptionMutation) AddField

func (m *SubscriptionMutation) 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 (*SubscriptionMutation) AddNotificationIDs

func (m *SubscriptionMutation) AddNotificationIDs(ids ...xid.ID)

AddNotificationIDs adds the "notifications" edge to the Notification entity by ids.

func (*SubscriptionMutation) AddedEdges

func (m *SubscriptionMutation) AddedEdges() []string

AddedEdges returns all edge names that were set/added in this mutation.

func (*SubscriptionMutation) AddedField

func (m *SubscriptionMutation) 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 (*SubscriptionMutation) AddedFields

func (m *SubscriptionMutation) AddedFields() []string

AddedFields returns all numeric fields that were incremented/decremented during this mutation.

func (*SubscriptionMutation) AddedIDs

func (m *SubscriptionMutation) AddedIDs(name string) []ent.Value

AddedIDs returns all IDs (to other nodes) that were added for the given edge name in this mutation.

func (*SubscriptionMutation) ClearAccount

func (m *SubscriptionMutation) ClearAccount()

ClearAccount clears the "account" edge to the Account entity.

func (*SubscriptionMutation) ClearEdge

func (m *SubscriptionMutation) 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 (*SubscriptionMutation) ClearField

func (m *SubscriptionMutation) 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 (*SubscriptionMutation) ClearNotifications

func (m *SubscriptionMutation) ClearNotifications()

ClearNotifications clears the "notifications" edge to the Notification entity.

func (*SubscriptionMutation) ClearedEdges

func (m *SubscriptionMutation) ClearedEdges() []string

ClearedEdges returns all edge names that were cleared in this mutation.

func (*SubscriptionMutation) ClearedFields

func (m *SubscriptionMutation) ClearedFields() []string

ClearedFields returns all nullable fields that were cleared during this mutation.

func (SubscriptionMutation) Client

func (m SubscriptionMutation) 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 (*SubscriptionMutation) CreatedAt

func (m *SubscriptionMutation) CreatedAt() (r time.Time, exists bool)

CreatedAt returns the value of the "created_at" field in the mutation.

func (*SubscriptionMutation) EdgeCleared

func (m *SubscriptionMutation) EdgeCleared(name string) bool

EdgeCleared returns a boolean which indicates if the edge with the given name was cleared in this mutation.

func (*SubscriptionMutation) Field

func (m *SubscriptionMutation) 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 (*SubscriptionMutation) FieldCleared

func (m *SubscriptionMutation) FieldCleared(name string) bool

FieldCleared returns a boolean indicating if a field with the given name was cleared in this mutation.

func (*SubscriptionMutation) Fields

func (m *SubscriptionMutation) 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 (*SubscriptionMutation) ID

func (m *SubscriptionMutation) ID() (id xid.ID, 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 (*SubscriptionMutation) IDs

func (m *SubscriptionMutation) IDs(ctx context.Context) ([]xid.ID, 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 (*SubscriptionMutation) NotificationsCleared

func (m *SubscriptionMutation) NotificationsCleared() bool

NotificationsCleared reports if the "notifications" edge to the Notification entity was cleared.

func (*SubscriptionMutation) NotificationsIDs

func (m *SubscriptionMutation) NotificationsIDs() (ids []xid.ID)

NotificationsIDs returns the "notifications" edge IDs in the mutation.

func (*SubscriptionMutation) OldCreatedAt

func (m *SubscriptionMutation) OldCreatedAt(ctx context.Context) (v time.Time, err error)

OldCreatedAt returns the old "created_at" field's value of the Subscription entity. If the Subscription 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 (*SubscriptionMutation) OldField

func (m *SubscriptionMutation) 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 (*SubscriptionMutation) OldRefersTo

func (m *SubscriptionMutation) OldRefersTo(ctx context.Context) (v string, err error)

OldRefersTo returns the old "refers_to" field's value of the Subscription entity. If the Subscription 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 (*SubscriptionMutation) OldRefersType

func (m *SubscriptionMutation) OldRefersType(ctx context.Context) (v string, err error)

OldRefersType returns the old "refers_type" field's value of the Subscription entity. If the Subscription 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 (*SubscriptionMutation) Op

func (m *SubscriptionMutation) Op() Op

Op returns the operation name.

func (*SubscriptionMutation) RefersTo

func (m *SubscriptionMutation) RefersTo() (r string, exists bool)

RefersTo returns the value of the "refers_to" field in the mutation.

func (*SubscriptionMutation) RefersType

func (m *SubscriptionMutation) RefersType() (r string, exists bool)

RefersType returns the value of the "refers_type" field in the mutation.

func (*SubscriptionMutation) RemoveNotificationIDs

func (m *SubscriptionMutation) RemoveNotificationIDs(ids ...xid.ID)

RemoveNotificationIDs removes the "notifications" edge to the Notification entity by IDs.

func (*SubscriptionMutation) RemovedEdges

func (m *SubscriptionMutation) RemovedEdges() []string

RemovedEdges returns all edge names that were removed in this mutation.

func (*SubscriptionMutation) RemovedIDs

func (m *SubscriptionMutation) 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 (*SubscriptionMutation) RemovedNotificationsIDs

func (m *SubscriptionMutation) RemovedNotificationsIDs() (ids []xid.ID)

RemovedNotifications returns the removed IDs of the "notifications" edge to the Notification entity.

func (*SubscriptionMutation) ResetAccount

func (m *SubscriptionMutation) ResetAccount()

ResetAccount resets all changes to the "account" edge.

func (*SubscriptionMutation) ResetCreatedAt

func (m *SubscriptionMutation) ResetCreatedAt()

ResetCreatedAt resets all changes to the "created_at" field.

func (*SubscriptionMutation) ResetEdge

func (m *SubscriptionMutation) 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 (*SubscriptionMutation) ResetField

func (m *SubscriptionMutation) 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 (*SubscriptionMutation) ResetNotifications

func (m *SubscriptionMutation) ResetNotifications()

ResetNotifications resets all changes to the "notifications" edge.

func (*SubscriptionMutation) ResetRefersTo

func (m *SubscriptionMutation) ResetRefersTo()

ResetRefersTo resets all changes to the "refers_to" field.

func (*SubscriptionMutation) ResetRefersType

func (m *SubscriptionMutation) ResetRefersType()

ResetRefersType resets all changes to the "refers_type" field.

func (*SubscriptionMutation) SetAccountID

func (m *SubscriptionMutation) SetAccountID(id xid.ID)

SetAccountID sets the "account" edge to the Account entity by id.

func (*SubscriptionMutation) SetCreatedAt

func (m *SubscriptionMutation) SetCreatedAt(t time.Time)

SetCreatedAt sets the "created_at" field.

func (*SubscriptionMutation) SetField

func (m *SubscriptionMutation) 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 (*SubscriptionMutation) SetID

func (m *SubscriptionMutation) SetID(id xid.ID)

SetID sets the value of the id field. Note that this operation is only accepted on creation of Subscription entities.

func (*SubscriptionMutation) SetRefersTo

func (m *SubscriptionMutation) SetRefersTo(s string)

SetRefersTo sets the "refers_to" field.

func (*SubscriptionMutation) SetRefersType

func (m *SubscriptionMutation) SetRefersType(s string)

SetRefersType sets the "refers_type" field.

func (SubscriptionMutation) Tx

func (m SubscriptionMutation) Tx() (*Tx, error)

Tx returns an `ent.Tx` for mutations that were executed in transactions; it returns an error otherwise.

func (*SubscriptionMutation) Type

func (m *SubscriptionMutation) Type() string

Type returns the node type of this mutation (Subscription).

func (*SubscriptionMutation) Where

Where appends a list predicates to the SubscriptionMutation builder.

type SubscriptionQuery

type SubscriptionQuery struct {
	// contains filtered or unexported fields
}

SubscriptionQuery is the builder for querying Subscription entities.

func (*SubscriptionQuery) All

func (sq *SubscriptionQuery) All(ctx context.Context) ([]*Subscription, error)

All executes the query and returns a list of Subscriptions.

func (*SubscriptionQuery) AllX

func (sq *SubscriptionQuery) AllX(ctx context.Context) []*Subscription

AllX is like All, but panics if an error occurs.

func (*SubscriptionQuery) Clone

func (sq *SubscriptionQuery) Clone() *SubscriptionQuery

Clone returns a duplicate of the SubscriptionQuery builder, including all associated steps. It can be used to prepare common query builders and use them differently after the clone is made.

func (*SubscriptionQuery) Count

func (sq *SubscriptionQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*SubscriptionQuery) CountX

func (sq *SubscriptionQuery) CountX(ctx context.Context) int

CountX is like Count, but panics if an error occurs.

func (*SubscriptionQuery) Exist

func (sq *SubscriptionQuery) Exist(ctx context.Context) (bool, error)

Exist returns true if the query has elements in the graph.

func (*SubscriptionQuery) ExistX

func (sq *SubscriptionQuery) ExistX(ctx context.Context) bool

ExistX is like Exist, but panics if an error occurs.

func (*SubscriptionQuery) First

func (sq *SubscriptionQuery) First(ctx context.Context) (*Subscription, error)

First returns the first Subscription entity from the query. Returns a *NotFoundError when no Subscription was found.

func (*SubscriptionQuery) FirstID

func (sq *SubscriptionQuery) FirstID(ctx context.Context) (id xid.ID, err error)

FirstID returns the first Subscription ID from the query. Returns a *NotFoundError when no Subscription ID was found.

func (*SubscriptionQuery) FirstIDX

func (sq *SubscriptionQuery) FirstIDX(ctx context.Context) xid.ID

FirstIDX is like FirstID, but panics if an error occurs.

func (*SubscriptionQuery) FirstX

func (sq *SubscriptionQuery) FirstX(ctx context.Context) *Subscription

FirstX is like First, but panics if an error occurs.

func (*SubscriptionQuery) GroupBy

func (sq *SubscriptionQuery) GroupBy(field string, fields ...string) *SubscriptionGroupBy

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 {
	CreatedAt time.Time `json:"created_at,omitempty"`
	Count int `json:"count,omitempty"`
}

client.Subscription.Query().
	GroupBy(subscription.FieldCreatedAt).
	Aggregate(model.Count()).
	Scan(ctx, &v)

func (*SubscriptionQuery) IDs

func (sq *SubscriptionQuery) IDs(ctx context.Context) ([]xid.ID, error)

IDs executes the query and returns a list of Subscription IDs.

func (*SubscriptionQuery) IDsX

func (sq *SubscriptionQuery) IDsX(ctx context.Context) []xid.ID

IDsX is like IDs, but panics if an error occurs.

func (*SubscriptionQuery) Limit

func (sq *SubscriptionQuery) Limit(limit int) *SubscriptionQuery

Limit adds a limit step to the query.

func (*SubscriptionQuery) Modify

func (sq *SubscriptionQuery) Modify(modifiers ...func(s *sql.Selector)) *SubscriptionSelect

Modify adds a query modifier for attaching custom logic to queries.

func (*SubscriptionQuery) Offset

func (sq *SubscriptionQuery) Offset(offset int) *SubscriptionQuery

Offset adds an offset step to the query.

func (*SubscriptionQuery) Only

Only returns a single Subscription entity found by the query, ensuring it only returns one. Returns a *NotSingularError when more than one Subscription entity is found. Returns a *NotFoundError when no Subscription entities are found.

func (*SubscriptionQuery) OnlyID

func (sq *SubscriptionQuery) OnlyID(ctx context.Context) (id xid.ID, err error)

OnlyID is like Only, but returns the only Subscription ID in the query. Returns a *NotSingularError when more than one Subscription ID is found. Returns a *NotFoundError when no entities are found.

func (*SubscriptionQuery) OnlyIDX

func (sq *SubscriptionQuery) OnlyIDX(ctx context.Context) xid.ID

OnlyIDX is like OnlyID, but panics if an error occurs.

func (*SubscriptionQuery) OnlyX

OnlyX is like Only, but panics if an error occurs.

func (*SubscriptionQuery) Order

Order adds an order step to the query.

func (*SubscriptionQuery) QueryAccount

func (sq *SubscriptionQuery) QueryAccount() *AccountQuery

QueryAccount chains the current query on the "account" edge.

func (*SubscriptionQuery) QueryNotifications

func (sq *SubscriptionQuery) QueryNotifications() *NotificationQuery

QueryNotifications chains the current query on the "notifications" edge.

func (*SubscriptionQuery) Select

func (sq *SubscriptionQuery) Select(fields ...string) *SubscriptionSelect

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 {
	CreatedAt time.Time `json:"created_at,omitempty"`
}

client.Subscription.Query().
	Select(subscription.FieldCreatedAt).
	Scan(ctx, &v)

func (*SubscriptionQuery) Unique

func (sq *SubscriptionQuery) Unique(unique bool) *SubscriptionQuery

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 (*SubscriptionQuery) Where

Where adds a new predicate for the SubscriptionQuery builder.

func (*SubscriptionQuery) WithAccount

func (sq *SubscriptionQuery) WithAccount(opts ...func(*AccountQuery)) *SubscriptionQuery

WithAccount tells the query-builder to eager-load the nodes that are connected to the "account" edge. The optional arguments are used to configure the query builder of the edge.

func (*SubscriptionQuery) WithNotifications

func (sq *SubscriptionQuery) WithNotifications(opts ...func(*NotificationQuery)) *SubscriptionQuery

WithNotifications tells the query-builder to eager-load the nodes that are connected to the "notifications" edge. The optional arguments are used to configure the query builder of the edge.

type SubscriptionSelect

type SubscriptionSelect struct {
	*SubscriptionQuery
	// contains filtered or unexported fields
}

SubscriptionSelect is the builder for selecting fields of Subscription entities.

func (*SubscriptionSelect) Bool

func (s *SubscriptionSelect) Bool(ctx context.Context) (_ bool, err error)

Bool returns a single bool from a selector. It is only allowed when selecting one field.

func (*SubscriptionSelect) BoolX

func (s *SubscriptionSelect) BoolX(ctx context.Context) bool

BoolX is like Bool, but panics if an error occurs.

func (*SubscriptionSelect) Bools

func (s *SubscriptionSelect) Bools(ctx context.Context) ([]bool, error)

Bools returns list of bools from a selector. It is only allowed when selecting one field.

func (*SubscriptionSelect) BoolsX

func (s *SubscriptionSelect) BoolsX(ctx context.Context) []bool

BoolsX is like Bools, but panics if an error occurs.

func (*SubscriptionSelect) Float64

func (s *SubscriptionSelect) Float64(ctx context.Context) (_ float64, err error)

Float64 returns a single float64 from a selector. It is only allowed when selecting one field.

func (*SubscriptionSelect) Float64X

func (s *SubscriptionSelect) Float64X(ctx context.Context) float64

Float64X is like Float64, but panics if an error occurs.

func (*SubscriptionSelect) Float64s

func (s *SubscriptionSelect) Float64s(ctx context.Context) ([]float64, error)

Float64s returns list of float64s from a selector. It is only allowed when selecting one field.

func (*SubscriptionSelect) Float64sX

func (s *SubscriptionSelect) Float64sX(ctx context.Context) []float64

Float64sX is like Float64s, but panics if an error occurs.

func (*SubscriptionSelect) Int

func (s *SubscriptionSelect) Int(ctx context.Context) (_ int, err error)

Int returns a single int from a selector. It is only allowed when selecting one field.

func (*SubscriptionSelect) IntX

func (s *SubscriptionSelect) IntX(ctx context.Context) int

IntX is like Int, but panics if an error occurs.

func (*SubscriptionSelect) Ints

func (s *SubscriptionSelect) Ints(ctx context.Context) ([]int, error)

Ints returns list of ints from a selector. It is only allowed when selecting one field.

func (*SubscriptionSelect) IntsX

func (s *SubscriptionSelect) IntsX(ctx context.Context) []int

IntsX is like Ints, but panics if an error occurs.

func (*SubscriptionSelect) Modify

func (ss *SubscriptionSelect) Modify(modifiers ...func(s *sql.Selector)) *SubscriptionSelect

Modify adds a query modifier for attaching custom logic to queries.

func (*SubscriptionSelect) Scan

func (ss *SubscriptionSelect) Scan(ctx context.Context, v interface{}) error

Scan applies the selector query and scans the result into the given value.

func (*SubscriptionSelect) ScanX

func (s *SubscriptionSelect) ScanX(ctx context.Context, v interface{})

ScanX is like Scan, but panics if an error occurs.

func (*SubscriptionSelect) String

func (s *SubscriptionSelect) String(ctx context.Context) (_ string, err error)

String returns a single string from a selector. It is only allowed when selecting one field.

func (*SubscriptionSelect) StringX

func (s *SubscriptionSelect) StringX(ctx context.Context) string

StringX is like String, but panics if an error occurs.

func (*SubscriptionSelect) Strings

func (s *SubscriptionSelect) Strings(ctx context.Context) ([]string, error)

Strings returns list of strings from a selector. It is only allowed when selecting one field.

func (*SubscriptionSelect) StringsX

func (s *SubscriptionSelect) StringsX(ctx context.Context) []string

StringsX is like Strings, but panics if an error occurs.

type SubscriptionUpdate

type SubscriptionUpdate struct {
	// contains filtered or unexported fields
}

SubscriptionUpdate is the builder for updating Subscription entities.

func (*SubscriptionUpdate) AddNotificationIDs

func (su *SubscriptionUpdate) AddNotificationIDs(ids ...xid.ID) *SubscriptionUpdate

AddNotificationIDs adds the "notifications" edge to the Notification entity by IDs.

func (*SubscriptionUpdate) AddNotifications

func (su *SubscriptionUpdate) AddNotifications(n ...*Notification) *SubscriptionUpdate

AddNotifications adds the "notifications" edges to the Notification entity.

func (*SubscriptionUpdate) ClearAccount

func (su *SubscriptionUpdate) ClearAccount() *SubscriptionUpdate

ClearAccount clears the "account" edge to the Account entity.

func (*SubscriptionUpdate) ClearNotifications

func (su *SubscriptionUpdate) ClearNotifications() *SubscriptionUpdate

ClearNotifications clears all "notifications" edges to the Notification entity.

func (*SubscriptionUpdate) Exec

func (su *SubscriptionUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*SubscriptionUpdate) ExecX

func (su *SubscriptionUpdate) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*SubscriptionUpdate) Modify

func (su *SubscriptionUpdate) Modify(modifiers ...func(u *sql.UpdateBuilder)) *SubscriptionUpdate

Modify adds a statement modifier for attaching custom logic to the UPDATE statement.

func (*SubscriptionUpdate) Mutation

func (su *SubscriptionUpdate) Mutation() *SubscriptionMutation

Mutation returns the SubscriptionMutation object of the builder.

func (*SubscriptionUpdate) RemoveNotificationIDs

func (su *SubscriptionUpdate) RemoveNotificationIDs(ids ...xid.ID) *SubscriptionUpdate

RemoveNotificationIDs removes the "notifications" edge to Notification entities by IDs.

func (*SubscriptionUpdate) RemoveNotifications

func (su *SubscriptionUpdate) RemoveNotifications(n ...*Notification) *SubscriptionUpdate

RemoveNotifications removes "notifications" edges to Notification entities.

func (*SubscriptionUpdate) Save

func (su *SubscriptionUpdate) Save(ctx context.Context) (int, error)

Save executes the query and returns the number of nodes affected by the update operation.

func (*SubscriptionUpdate) SaveX

func (su *SubscriptionUpdate) SaveX(ctx context.Context) int

SaveX is like Save, but panics if an error occurs.

func (*SubscriptionUpdate) SetAccount

func (su *SubscriptionUpdate) SetAccount(a *Account) *SubscriptionUpdate

SetAccount sets the "account" edge to the Account entity.

func (*SubscriptionUpdate) SetAccountID

func (su *SubscriptionUpdate) SetAccountID(id xid.ID) *SubscriptionUpdate

SetAccountID sets the "account" edge to the Account entity by ID.

func (*SubscriptionUpdate) SetNillableAccountID

func (su *SubscriptionUpdate) SetNillableAccountID(id *xid.ID) *SubscriptionUpdate

SetNillableAccountID sets the "account" edge to the Account entity by ID if the given value is not nil.

func (*SubscriptionUpdate) SetRefersTo

func (su *SubscriptionUpdate) SetRefersTo(s string) *SubscriptionUpdate

SetRefersTo sets the "refers_to" field.

func (*SubscriptionUpdate) SetRefersType

func (su *SubscriptionUpdate) SetRefersType(s string) *SubscriptionUpdate

SetRefersType sets the "refers_type" field.

func (*SubscriptionUpdate) Where

Where appends a list predicates to the SubscriptionUpdate builder.

type SubscriptionUpdateOne

type SubscriptionUpdateOne struct {
	// contains filtered or unexported fields
}

SubscriptionUpdateOne is the builder for updating a single Subscription entity.

func (*SubscriptionUpdateOne) AddNotificationIDs

func (suo *SubscriptionUpdateOne) AddNotificationIDs(ids ...xid.ID) *SubscriptionUpdateOne

AddNotificationIDs adds the "notifications" edge to the Notification entity by IDs.

func (*SubscriptionUpdateOne) AddNotifications

func (suo *SubscriptionUpdateOne) AddNotifications(n ...*Notification) *SubscriptionUpdateOne

AddNotifications adds the "notifications" edges to the Notification entity.

func (*SubscriptionUpdateOne) ClearAccount

func (suo *SubscriptionUpdateOne) ClearAccount() *SubscriptionUpdateOne

ClearAccount clears the "account" edge to the Account entity.

func (*SubscriptionUpdateOne) ClearNotifications

func (suo *SubscriptionUpdateOne) ClearNotifications() *SubscriptionUpdateOne

ClearNotifications clears all "notifications" edges to the Notification entity.

func (*SubscriptionUpdateOne) Exec

func (suo *SubscriptionUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*SubscriptionUpdateOne) ExecX

func (suo *SubscriptionUpdateOne) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*SubscriptionUpdateOne) Modify

func (suo *SubscriptionUpdateOne) Modify(modifiers ...func(u *sql.UpdateBuilder)) *SubscriptionUpdateOne

Modify adds a statement modifier for attaching custom logic to the UPDATE statement.

func (*SubscriptionUpdateOne) Mutation

Mutation returns the SubscriptionMutation object of the builder.

func (*SubscriptionUpdateOne) RemoveNotificationIDs

func (suo *SubscriptionUpdateOne) RemoveNotificationIDs(ids ...xid.ID) *SubscriptionUpdateOne

RemoveNotificationIDs removes the "notifications" edge to Notification entities by IDs.

func (*SubscriptionUpdateOne) RemoveNotifications

func (suo *SubscriptionUpdateOne) RemoveNotifications(n ...*Notification) *SubscriptionUpdateOne

RemoveNotifications removes "notifications" edges to Notification entities.

func (*SubscriptionUpdateOne) Save

Save executes the query and returns the updated Subscription entity.

func (*SubscriptionUpdateOne) SaveX

SaveX is like Save, but panics if an error occurs.

func (*SubscriptionUpdateOne) Select

func (suo *SubscriptionUpdateOne) Select(field string, fields ...string) *SubscriptionUpdateOne

Select allows selecting one or more fields (columns) of the returned entity. The default is selecting all fields defined in the entity schema.

func (*SubscriptionUpdateOne) SetAccount

SetAccount sets the "account" edge to the Account entity.

func (*SubscriptionUpdateOne) SetAccountID

func (suo *SubscriptionUpdateOne) SetAccountID(id xid.ID) *SubscriptionUpdateOne

SetAccountID sets the "account" edge to the Account entity by ID.

func (*SubscriptionUpdateOne) SetNillableAccountID

func (suo *SubscriptionUpdateOne) SetNillableAccountID(id *xid.ID) *SubscriptionUpdateOne

SetNillableAccountID sets the "account" edge to the Account entity by ID if the given value is not nil.

func (*SubscriptionUpdateOne) SetRefersTo

func (suo *SubscriptionUpdateOne) SetRefersTo(s string) *SubscriptionUpdateOne

SetRefersTo sets the "refers_to" field.

func (*SubscriptionUpdateOne) SetRefersType

func (suo *SubscriptionUpdateOne) SetRefersType(s string) *SubscriptionUpdateOne

SetRefersType sets the "refers_type" field.

type SubscriptionUpsert

type SubscriptionUpsert struct {
	*sql.UpdateSet
}

SubscriptionUpsert is the "OnConflict" setter.

func (*SubscriptionUpsert) SetCreatedAt

func (u *SubscriptionUpsert) SetCreatedAt(v time.Time) *SubscriptionUpsert

SetCreatedAt sets the "created_at" field.

func (*SubscriptionUpsert) SetRefersTo

func (u *SubscriptionUpsert) SetRefersTo(v string) *SubscriptionUpsert

SetRefersTo sets the "refers_to" field.

func (*SubscriptionUpsert) SetRefersType

func (u *SubscriptionUpsert) SetRefersType(v string) *SubscriptionUpsert

SetRefersType sets the "refers_type" field.

func (*SubscriptionUpsert) UpdateCreatedAt

func (u *SubscriptionUpsert) UpdateCreatedAt() *SubscriptionUpsert

UpdateCreatedAt sets the "created_at" field to the value that was provided on create.

func (*SubscriptionUpsert) UpdateRefersTo

func (u *SubscriptionUpsert) UpdateRefersTo() *SubscriptionUpsert

UpdateRefersTo sets the "refers_to" field to the value that was provided on create.

func (*SubscriptionUpsert) UpdateRefersType

func (u *SubscriptionUpsert) UpdateRefersType() *SubscriptionUpsert

UpdateRefersType sets the "refers_type" field to the value that was provided on create.

type SubscriptionUpsertBulk

type SubscriptionUpsertBulk struct {
	// contains filtered or unexported fields
}

SubscriptionUpsertBulk is the builder for "upsert"-ing a bulk of Subscription nodes.

func (*SubscriptionUpsertBulk) DoNothing

DoNothing configures the conflict_action to `DO NOTHING`. Supported only by SQLite and PostgreSQL.

func (*SubscriptionUpsertBulk) Exec

Exec executes the query.

func (*SubscriptionUpsertBulk) ExecX

func (u *SubscriptionUpsertBulk) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*SubscriptionUpsertBulk) Ignore

Ignore sets each column to itself in case of conflict. Using this option is equivalent to using:

client.Subscription.Create().
	OnConflict(sql.ResolveWithIgnore()).
	Exec(ctx)

func (*SubscriptionUpsertBulk) SetCreatedAt

SetCreatedAt sets the "created_at" field.

func (*SubscriptionUpsertBulk) SetRefersTo

SetRefersTo sets the "refers_to" field.

func (*SubscriptionUpsertBulk) SetRefersType

SetRefersType sets the "refers_type" field.

func (*SubscriptionUpsertBulk) Update

Update allows overriding fields `UPDATE` values. See the SubscriptionCreateBulk.OnConflict documentation for more info.

func (*SubscriptionUpsertBulk) UpdateCreatedAt

func (u *SubscriptionUpsertBulk) UpdateCreatedAt() *SubscriptionUpsertBulk

UpdateCreatedAt sets the "created_at" field to the value that was provided on create.

func (*SubscriptionUpsertBulk) UpdateNewValues

func (u *SubscriptionUpsertBulk) UpdateNewValues() *SubscriptionUpsertBulk

UpdateNewValues updates the mutable fields using the new values that were set on create. Using this option is equivalent to using:

client.Subscription.Create().
	OnConflict(
		sql.ResolveWithNewValues(),
		sql.ResolveWith(func(u *sql.UpdateSet) {
			u.SetIgnore(subscription.FieldID)
		}),
	).
	Exec(ctx)

func (*SubscriptionUpsertBulk) UpdateRefersTo

func (u *SubscriptionUpsertBulk) UpdateRefersTo() *SubscriptionUpsertBulk

UpdateRefersTo sets the "refers_to" field to the value that was provided on create.

func (*SubscriptionUpsertBulk) UpdateRefersType

func (u *SubscriptionUpsertBulk) UpdateRefersType() *SubscriptionUpsertBulk

UpdateRefersType sets the "refers_type" field to the value that was provided on create.

type SubscriptionUpsertOne

type SubscriptionUpsertOne struct {
	// contains filtered or unexported fields
}

SubscriptionUpsertOne is the builder for "upsert"-ing

one Subscription node.

func (*SubscriptionUpsertOne) DoNothing

DoNothing configures the conflict_action to `DO NOTHING`. Supported only by SQLite and PostgreSQL.

func (*SubscriptionUpsertOne) Exec

Exec executes the query.

func (*SubscriptionUpsertOne) ExecX

func (u *SubscriptionUpsertOne) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*SubscriptionUpsertOne) ID

func (u *SubscriptionUpsertOne) ID(ctx context.Context) (id xid.ID, err error)

Exec executes the UPSERT query and returns the inserted/updated ID.

func (*SubscriptionUpsertOne) IDX

IDX is like ID, but panics if an error occurs.

func (*SubscriptionUpsertOne) Ignore

Ignore sets each column to itself in case of conflict. Using this option is equivalent to using:

client.Subscription.Create().
    OnConflict(sql.ResolveWithIgnore()).
    Exec(ctx)

func (*SubscriptionUpsertOne) SetCreatedAt

SetCreatedAt sets the "created_at" field.

func (*SubscriptionUpsertOne) SetRefersTo

SetRefersTo sets the "refers_to" field.

func (*SubscriptionUpsertOne) SetRefersType

func (u *SubscriptionUpsertOne) SetRefersType(v string) *SubscriptionUpsertOne

SetRefersType sets the "refers_type" field.

func (*SubscriptionUpsertOne) Update

Update allows overriding fields `UPDATE` values. See the SubscriptionCreate.OnConflict documentation for more info.

func (*SubscriptionUpsertOne) UpdateCreatedAt

func (u *SubscriptionUpsertOne) UpdateCreatedAt() *SubscriptionUpsertOne

UpdateCreatedAt sets the "created_at" field to the value that was provided on create.

func (*SubscriptionUpsertOne) UpdateNewValues

func (u *SubscriptionUpsertOne) UpdateNewValues() *SubscriptionUpsertOne

UpdateNewValues updates the mutable fields using the new values that were set on create except the ID field. Using this option is equivalent to using:

client.Subscription.Create().
	OnConflict(
		sql.ResolveWithNewValues(),
		sql.ResolveWith(func(u *sql.UpdateSet) {
			u.SetIgnore(subscription.FieldID)
		}),
	).
	Exec(ctx)

func (*SubscriptionUpsertOne) UpdateRefersTo

func (u *SubscriptionUpsertOne) UpdateRefersTo() *SubscriptionUpsertOne

UpdateRefersTo sets the "refers_to" field to the value that was provided on create.

func (*SubscriptionUpsertOne) UpdateRefersType

func (u *SubscriptionUpsertOne) UpdateRefersType() *SubscriptionUpsertOne

UpdateRefersType sets the "refers_type" field to the value that was provided on create.

type Subscriptions

type Subscriptions []*Subscription

Subscriptions is a parsable slice of Subscription.

type Tag

type Tag struct {

	// ID of the ent.
	ID xid.ID `json:"id,omitempty"`
	// CreatedAt holds the value of the "created_at" field.
	CreatedAt time.Time `json:"created_at,omitempty"`
	// Name holds the value of the "name" field.
	Name string `json:"name,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the TagQuery when eager-loading is set.
	Edges TagEdges `json:"edges"`
	// contains filtered or unexported fields
}

Tag is the model entity for the Tag schema.

func (*Tag) QueryAccounts

func (t *Tag) QueryAccounts() *AccountQuery

QueryAccounts queries the "accounts" edge of the Tag entity.

func (*Tag) QueryPosts

func (t *Tag) QueryPosts() *PostQuery

QueryPosts queries the "posts" edge of the Tag entity.

func (*Tag) String

func (t *Tag) String() string

String implements the fmt.Stringer.

func (*Tag) Unwrap

func (t *Tag) Unwrap() *Tag

Unwrap unwraps the Tag 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 (*Tag) Update

func (t *Tag) Update() *TagUpdateOne

Update returns a builder for updating this Tag. Note that you need to call Tag.Unwrap() before calling this method if this Tag was returned from a transaction, and the transaction was committed or rolled back.

type TagClient

type TagClient struct {
	// contains filtered or unexported fields
}

TagClient is a client for the Tag schema.

func NewTagClient

func NewTagClient(c config) *TagClient

NewTagClient returns a client for the Tag from the given config.

func (*TagClient) Create

func (c *TagClient) Create() *TagCreate

Create returns a builder for creating a Tag entity.

func (*TagClient) CreateBulk

func (c *TagClient) CreateBulk(builders ...*TagCreate) *TagCreateBulk

CreateBulk returns a builder for creating a bulk of Tag entities.

func (*TagClient) Delete

func (c *TagClient) Delete() *TagDelete

Delete returns a delete builder for Tag.

func (*TagClient) DeleteOne

func (c *TagClient) DeleteOne(t *Tag) *TagDeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*TagClient) DeleteOneID

func (c *TagClient) DeleteOneID(id xid.ID) *TagDeleteOne

DeleteOne returns a builder for deleting the given entity by its id.

func (*TagClient) Get

func (c *TagClient) Get(ctx context.Context, id xid.ID) (*Tag, error)

Get returns a Tag entity by its id.

func (*TagClient) GetX

func (c *TagClient) GetX(ctx context.Context, id xid.ID) *Tag

GetX is like Get, but panics if an error occurs.

func (*TagClient) Hooks

func (c *TagClient) Hooks() []Hook

Hooks returns the client hooks.

func (*TagClient) Query

func (c *TagClient) Query() *TagQuery

Query returns a query builder for Tag.

func (*TagClient) QueryAccounts

func (c *TagClient) QueryAccounts(t *Tag) *AccountQuery

QueryAccounts queries the accounts edge of a Tag.

func (*TagClient) QueryPosts

func (c *TagClient) QueryPosts(t *Tag) *PostQuery

QueryPosts queries the posts edge of a Tag.

func (*TagClient) Update

func (c *TagClient) Update() *TagUpdate

Update returns an update builder for Tag.

func (*TagClient) UpdateOne

func (c *TagClient) UpdateOne(t *Tag) *TagUpdateOne

UpdateOne returns an update builder for the given entity.

func (*TagClient) UpdateOneID

func (c *TagClient) UpdateOneID(id xid.ID) *TagUpdateOne

UpdateOneID returns an update builder for the given id.

func (*TagClient) Use

func (c *TagClient) Use(hooks ...Hook)

Use adds a list of mutation hooks to the hooks stack. A call to `Use(f, g, h)` equals to `tag.Hooks(f(g(h())))`.

type TagCreate

type TagCreate struct {
	// contains filtered or unexported fields
}

TagCreate is the builder for creating a Tag entity.

func (*TagCreate) AddAccountIDs

func (tc *TagCreate) AddAccountIDs(ids ...xid.ID) *TagCreate

AddAccountIDs adds the "accounts" edge to the Account entity by IDs.

func (*TagCreate) AddAccounts

func (tc *TagCreate) AddAccounts(a ...*Account) *TagCreate

AddAccounts adds the "accounts" edges to the Account entity.

func (*TagCreate) AddPostIDs

func (tc *TagCreate) AddPostIDs(ids ...xid.ID) *TagCreate

AddPostIDs adds the "posts" edge to the Post entity by IDs.

func (*TagCreate) AddPosts

func (tc *TagCreate) AddPosts(p ...*Post) *TagCreate

AddPosts adds the "posts" edges to the Post entity.

func (*TagCreate) Exec

func (tc *TagCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*TagCreate) ExecX

func (tc *TagCreate) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*TagCreate) Mutation

func (tc *TagCreate) Mutation() *TagMutation

Mutation returns the TagMutation object of the builder.

func (*TagCreate) OnConflict

func (tc *TagCreate) OnConflict(opts ...sql.ConflictOption) *TagUpsertOne

OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause of the `INSERT` statement. For example:

client.Tag.Create().
	SetCreatedAt(v).
	OnConflict(
		// Update the row with the new values
		// the was proposed for insertion.
		sql.ResolveWithNewValues(),
	).
	// Override some of the fields with custom
	// update values.
	Update(func(u *ent.TagUpsert) {
		SetCreatedAt(v+v).
	}).
	Exec(ctx)

func (*TagCreate) OnConflictColumns

func (tc *TagCreate) OnConflictColumns(columns ...string) *TagUpsertOne

OnConflictColumns calls `OnConflict` and configures the columns as conflict target. Using this option is equivalent to using:

client.Tag.Create().
	OnConflict(sql.ConflictColumns(columns...)).
	Exec(ctx)

func (*TagCreate) Save

func (tc *TagCreate) Save(ctx context.Context) (*Tag, error)

Save creates the Tag in the database.

func (*TagCreate) SaveX

func (tc *TagCreate) SaveX(ctx context.Context) *Tag

SaveX calls Save and panics if Save returns an error.

func (*TagCreate) SetCreatedAt

func (tc *TagCreate) SetCreatedAt(t time.Time) *TagCreate

SetCreatedAt sets the "created_at" field.

func (*TagCreate) SetID

func (tc *TagCreate) SetID(x xid.ID) *TagCreate

SetID sets the "id" field.

func (*TagCreate) SetName

func (tc *TagCreate) SetName(s string) *TagCreate

SetName sets the "name" field.

func (*TagCreate) SetNillableCreatedAt

func (tc *TagCreate) SetNillableCreatedAt(t *time.Time) *TagCreate

SetNillableCreatedAt sets the "created_at" field if the given value is not nil.

func (*TagCreate) SetNillableID

func (tc *TagCreate) SetNillableID(x *xid.ID) *TagCreate

SetNillableID sets the "id" field if the given value is not nil.

type TagCreateBulk

type TagCreateBulk struct {
	// contains filtered or unexported fields
}

TagCreateBulk is the builder for creating many Tag entities in bulk.

func (*TagCreateBulk) Exec

func (tcb *TagCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*TagCreateBulk) ExecX

func (tcb *TagCreateBulk) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*TagCreateBulk) OnConflict

func (tcb *TagCreateBulk) OnConflict(opts ...sql.ConflictOption) *TagUpsertBulk

OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause of the `INSERT` statement. For example:

client.Tag.CreateBulk(builders...).
	OnConflict(
		// Update the row with the new values
		// the was proposed for insertion.
		sql.ResolveWithNewValues(),
	).
	// Override some of the fields with custom
	// update values.
	Update(func(u *ent.TagUpsert) {
		SetCreatedAt(v+v).
	}).
	Exec(ctx)

func (*TagCreateBulk) OnConflictColumns

func (tcb *TagCreateBulk) OnConflictColumns(columns ...string) *TagUpsertBulk

OnConflictColumns calls `OnConflict` and configures the columns as conflict target. Using this option is equivalent to using:

client.Tag.Create().
	OnConflict(sql.ConflictColumns(columns...)).
	Exec(ctx)

func (*TagCreateBulk) Save

func (tcb *TagCreateBulk) Save(ctx context.Context) ([]*Tag, error)

Save creates the Tag entities in the database.

func (*TagCreateBulk) SaveX

func (tcb *TagCreateBulk) SaveX(ctx context.Context) []*Tag

SaveX is like Save, but panics if an error occurs.

type TagDelete

type TagDelete struct {
	// contains filtered or unexported fields
}

TagDelete is the builder for deleting a Tag entity.

func (*TagDelete) Exec

func (td *TagDelete) Exec(ctx context.Context) (int, error)

Exec executes the deletion query and returns how many vertices were deleted.

func (*TagDelete) ExecX

func (td *TagDelete) ExecX(ctx context.Context) int

ExecX is like Exec, but panics if an error occurs.

func (*TagDelete) Where

func (td *TagDelete) Where(ps ...predicate.Tag) *TagDelete

Where appends a list predicates to the TagDelete builder.

type TagDeleteOne

type TagDeleteOne struct {
	// contains filtered or unexported fields
}

TagDeleteOne is the builder for deleting a single Tag entity.

func (*TagDeleteOne) Exec

func (tdo *TagDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*TagDeleteOne) ExecX

func (tdo *TagDeleteOne) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

type TagEdges

type TagEdges struct {
	// Posts holds the value of the posts edge.
	Posts []*Post `json:"posts,omitempty"`
	// Accounts holds the value of the accounts edge.
	Accounts []*Account `json:"accounts,omitempty"`
	// contains filtered or unexported fields
}

TagEdges holds the relations/edges for other nodes in the graph.

func (TagEdges) AccountsOrErr

func (e TagEdges) AccountsOrErr() ([]*Account, error)

AccountsOrErr returns the Accounts value or an error if the edge was not loaded in eager-loading.

func (TagEdges) PostsOrErr

func (e TagEdges) PostsOrErr() ([]*Post, error)

PostsOrErr returns the Posts value or an error if the edge was not loaded in eager-loading.

type TagGroupBy

type TagGroupBy struct {
	// contains filtered or unexported fields
}

TagGroupBy is the group-by builder for Tag entities.

func (*TagGroupBy) Aggregate

func (tgb *TagGroupBy) Aggregate(fns ...AggregateFunc) *TagGroupBy

Aggregate adds the given aggregation functions to the group-by query.

func (*TagGroupBy) Bool

func (s *TagGroupBy) Bool(ctx context.Context) (_ bool, err error)

Bool returns a single bool from a selector. It is only allowed when selecting one field.

func (*TagGroupBy) BoolX

func (s *TagGroupBy) BoolX(ctx context.Context) bool

BoolX is like Bool, but panics if an error occurs.

func (*TagGroupBy) Bools

func (s *TagGroupBy) Bools(ctx context.Context) ([]bool, error)

Bools returns list of bools from a selector. It is only allowed when selecting one field.

func (*TagGroupBy) BoolsX

func (s *TagGroupBy) BoolsX(ctx context.Context) []bool

BoolsX is like Bools, but panics if an error occurs.

func (*TagGroupBy) Float64

func (s *TagGroupBy) Float64(ctx context.Context) (_ float64, err error)

Float64 returns a single float64 from a selector. It is only allowed when selecting one field.

func (*TagGroupBy) Float64X

func (s *TagGroupBy) Float64X(ctx context.Context) float64

Float64X is like Float64, but panics if an error occurs.

func (*TagGroupBy) Float64s

func (s *TagGroupBy) Float64s(ctx context.Context) ([]float64, error)

Float64s returns list of float64s from a selector. It is only allowed when selecting one field.

func (*TagGroupBy) Float64sX

func (s *TagGroupBy) Float64sX(ctx context.Context) []float64

Float64sX is like Float64s, but panics if an error occurs.

func (*TagGroupBy) Int

func (s *TagGroupBy) Int(ctx context.Context) (_ int, err error)

Int returns a single int from a selector. It is only allowed when selecting one field.

func (*TagGroupBy) IntX

func (s *TagGroupBy) IntX(ctx context.Context) int

IntX is like Int, but panics if an error occurs.

func (*TagGroupBy) Ints

func (s *TagGroupBy) Ints(ctx context.Context) ([]int, error)

Ints returns list of ints from a selector. It is only allowed when selecting one field.

func (*TagGroupBy) IntsX

func (s *TagGroupBy) IntsX(ctx context.Context) []int

IntsX is like Ints, but panics if an error occurs.

func (*TagGroupBy) Scan

func (tgb *TagGroupBy) Scan(ctx context.Context, v interface{}) error

Scan applies the group-by query and scans the result into the given value.

func (*TagGroupBy) ScanX

func (s *TagGroupBy) ScanX(ctx context.Context, v interface{})

ScanX is like Scan, but panics if an error occurs.

func (*TagGroupBy) String

func (s *TagGroupBy) String(ctx context.Context) (_ string, err error)

String returns a single string from a selector. It is only allowed when selecting one field.

func (*TagGroupBy) StringX

func (s *TagGroupBy) StringX(ctx context.Context) string

StringX is like String, but panics if an error occurs.

func (*TagGroupBy) Strings

func (s *TagGroupBy) Strings(ctx context.Context) ([]string, error)

Strings returns list of strings from a selector. It is only allowed when selecting one field.

func (*TagGroupBy) StringsX

func (s *TagGroupBy) StringsX(ctx context.Context) []string

StringsX is like Strings, but panics if an error occurs.

type TagMutation

type TagMutation struct {
	// contains filtered or unexported fields
}

TagMutation represents an operation that mutates the Tag nodes in the graph.

func (*TagMutation) AccountsCleared

func (m *TagMutation) AccountsCleared() bool

AccountsCleared reports if the "accounts" edge to the Account entity was cleared.

func (*TagMutation) AccountsIDs

func (m *TagMutation) AccountsIDs() (ids []xid.ID)

AccountsIDs returns the "accounts" edge IDs in the mutation.

func (*TagMutation) AddAccountIDs

func (m *TagMutation) AddAccountIDs(ids ...xid.ID)

AddAccountIDs adds the "accounts" edge to the Account entity by ids.

func (*TagMutation) AddField

func (m *TagMutation) 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 (*TagMutation) AddPostIDs

func (m *TagMutation) AddPostIDs(ids ...xid.ID)

AddPostIDs adds the "posts" edge to the Post entity by ids.

func (*TagMutation) AddedEdges

func (m *TagMutation) AddedEdges() []string

AddedEdges returns all edge names that were set/added in this mutation.

func (*TagMutation) AddedField

func (m *TagMutation) 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 (*TagMutation) AddedFields

func (m *TagMutation) AddedFields() []string

AddedFields returns all numeric fields that were incremented/decremented during this mutation.

func (*TagMutation) AddedIDs

func (m *TagMutation) AddedIDs(name string) []ent.Value

AddedIDs returns all IDs (to other nodes) that were added for the given edge name in this mutation.

func (*TagMutation) ClearAccounts

func (m *TagMutation) ClearAccounts()

ClearAccounts clears the "accounts" edge to the Account entity.

func (*TagMutation) ClearEdge

func (m *TagMutation) 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 (*TagMutation) ClearField

func (m *TagMutation) 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 (*TagMutation) ClearPosts

func (m *TagMutation) ClearPosts()

ClearPosts clears the "posts" edge to the Post entity.

func (*TagMutation) ClearedEdges

func (m *TagMutation) ClearedEdges() []string

ClearedEdges returns all edge names that were cleared in this mutation.

func (*TagMutation) ClearedFields

func (m *TagMutation) ClearedFields() []string

ClearedFields returns all nullable fields that were cleared during this mutation.

func (TagMutation) Client

func (m TagMutation) 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 (*TagMutation) CreatedAt

func (m *TagMutation) CreatedAt() (r time.Time, exists bool)

CreatedAt returns the value of the "created_at" field in the mutation.

func (*TagMutation) EdgeCleared

func (m *TagMutation) EdgeCleared(name string) bool

EdgeCleared returns a boolean which indicates if the edge with the given name was cleared in this mutation.

func (*TagMutation) Field

func (m *TagMutation) 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 (*TagMutation) FieldCleared

func (m *TagMutation) FieldCleared(name string) bool

FieldCleared returns a boolean indicating if a field with the given name was cleared in this mutation.

func (*TagMutation) Fields

func (m *TagMutation) 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 (*TagMutation) ID

func (m *TagMutation) ID() (id xid.ID, 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 (*TagMutation) IDs

func (m *TagMutation) IDs(ctx context.Context) ([]xid.ID, 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 (*TagMutation) Name

func (m *TagMutation) Name() (r string, exists bool)

Name returns the value of the "name" field in the mutation.

func (*TagMutation) OldCreatedAt

func (m *TagMutation) OldCreatedAt(ctx context.Context) (v time.Time, err error)

OldCreatedAt returns the old "created_at" field's value of the Tag entity. If the Tag 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 (*TagMutation) OldField

func (m *TagMutation) 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 (*TagMutation) OldName

func (m *TagMutation) OldName(ctx context.Context) (v string, err error)

OldName returns the old "name" field's value of the Tag entity. If the Tag 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 (*TagMutation) Op

func (m *TagMutation) Op() Op

Op returns the operation name.

func (*TagMutation) PostsCleared

func (m *TagMutation) PostsCleared() bool

PostsCleared reports if the "posts" edge to the Post entity was cleared.

func (*TagMutation) PostsIDs

func (m *TagMutation) PostsIDs() (ids []xid.ID)

PostsIDs returns the "posts" edge IDs in the mutation.

func (*TagMutation) RemoveAccountIDs

func (m *TagMutation) RemoveAccountIDs(ids ...xid.ID)

RemoveAccountIDs removes the "accounts" edge to the Account entity by IDs.

func (*TagMutation) RemovePostIDs

func (m *TagMutation) RemovePostIDs(ids ...xid.ID)

RemovePostIDs removes the "posts" edge to the Post entity by IDs.

func (*TagMutation) RemovedAccountsIDs

func (m *TagMutation) RemovedAccountsIDs() (ids []xid.ID)

RemovedAccounts returns the removed IDs of the "accounts" edge to the Account entity.

func (*TagMutation) RemovedEdges

func (m *TagMutation) RemovedEdges() []string

RemovedEdges returns all edge names that were removed in this mutation.

func (*TagMutation) RemovedIDs

func (m *TagMutation) 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 (*TagMutation) RemovedPostsIDs

func (m *TagMutation) RemovedPostsIDs() (ids []xid.ID)

RemovedPosts returns the removed IDs of the "posts" edge to the Post entity.

func (*TagMutation) ResetAccounts

func (m *TagMutation) ResetAccounts()

ResetAccounts resets all changes to the "accounts" edge.

func (*TagMutation) ResetCreatedAt

func (m *TagMutation) ResetCreatedAt()

ResetCreatedAt resets all changes to the "created_at" field.

func (*TagMutation) ResetEdge

func (m *TagMutation) 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 (*TagMutation) ResetField

func (m *TagMutation) 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 (*TagMutation) ResetName

func (m *TagMutation) ResetName()

ResetName resets all changes to the "name" field.

func (*TagMutation) ResetPosts

func (m *TagMutation) ResetPosts()

ResetPosts resets all changes to the "posts" edge.

func (*TagMutation) SetCreatedAt

func (m *TagMutation) SetCreatedAt(t time.Time)

SetCreatedAt sets the "created_at" field.

func (*TagMutation) SetField

func (m *TagMutation) 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 (*TagMutation) SetID

func (m *TagMutation) SetID(id xid.ID)

SetID sets the value of the id field. Note that this operation is only accepted on creation of Tag entities.

func (*TagMutation) SetName

func (m *TagMutation) SetName(s string)

SetName sets the "name" field.

func (TagMutation) Tx

func (m TagMutation) Tx() (*Tx, error)

Tx returns an `ent.Tx` for mutations that were executed in transactions; it returns an error otherwise.

func (*TagMutation) Type

func (m *TagMutation) Type() string

Type returns the node type of this mutation (Tag).

func (*TagMutation) Where

func (m *TagMutation) Where(ps ...predicate.Tag)

Where appends a list predicates to the TagMutation builder.

type TagQuery

type TagQuery struct {
	// contains filtered or unexported fields
}

TagQuery is the builder for querying Tag entities.

func (*TagQuery) All

func (tq *TagQuery) All(ctx context.Context) ([]*Tag, error)

All executes the query and returns a list of Tags.

func (*TagQuery) AllX

func (tq *TagQuery) AllX(ctx context.Context) []*Tag

AllX is like All, but panics if an error occurs.

func (*TagQuery) Clone

func (tq *TagQuery) Clone() *TagQuery

Clone returns a duplicate of the TagQuery builder, including all associated steps. It can be used to prepare common query builders and use them differently after the clone is made.

func (*TagQuery) Count

func (tq *TagQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*TagQuery) CountX

func (tq *TagQuery) CountX(ctx context.Context) int

CountX is like Count, but panics if an error occurs.

func (*TagQuery) Exist

func (tq *TagQuery) Exist(ctx context.Context) (bool, error)

Exist returns true if the query has elements in the graph.

func (*TagQuery) ExistX

func (tq *TagQuery) ExistX(ctx context.Context) bool

ExistX is like Exist, but panics if an error occurs.

func (*TagQuery) First

func (tq *TagQuery) First(ctx context.Context) (*Tag, error)

First returns the first Tag entity from the query. Returns a *NotFoundError when no Tag was found.

func (*TagQuery) FirstID

func (tq *TagQuery) FirstID(ctx context.Context) (id xid.ID, err error)

FirstID returns the first Tag ID from the query. Returns a *NotFoundError when no Tag ID was found.

func (*TagQuery) FirstIDX

func (tq *TagQuery) FirstIDX(ctx context.Context) xid.ID

FirstIDX is like FirstID, but panics if an error occurs.

func (*TagQuery) FirstX

func (tq *TagQuery) FirstX(ctx context.Context) *Tag

FirstX is like First, but panics if an error occurs.

func (*TagQuery) GroupBy

func (tq *TagQuery) GroupBy(field string, fields ...string) *TagGroupBy

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 {
	CreatedAt time.Time `json:"created_at,omitempty"`
	Count int `json:"count,omitempty"`
}

client.Tag.Query().
	GroupBy(tag.FieldCreatedAt).
	Aggregate(model.Count()).
	Scan(ctx, &v)

func (*TagQuery) IDs

func (tq *TagQuery) IDs(ctx context.Context) ([]xid.ID, error)

IDs executes the query and returns a list of Tag IDs.

func (*TagQuery) IDsX

func (tq *TagQuery) IDsX(ctx context.Context) []xid.ID

IDsX is like IDs, but panics if an error occurs.

func (*TagQuery) Limit

func (tq *TagQuery) Limit(limit int) *TagQuery

Limit adds a limit step to the query.

func (*TagQuery) Modify

func (tq *TagQuery) Modify(modifiers ...func(s *sql.Selector)) *TagSelect

Modify adds a query modifier for attaching custom logic to queries.

func (*TagQuery) Offset

func (tq *TagQuery) Offset(offset int) *TagQuery

Offset adds an offset step to the query.

func (*TagQuery) Only

func (tq *TagQuery) Only(ctx context.Context) (*Tag, error)

Only returns a single Tag entity found by the query, ensuring it only returns one. Returns a *NotSingularError when more than one Tag entity is found. Returns a *NotFoundError when no Tag entities are found.

func (*TagQuery) OnlyID

func (tq *TagQuery) OnlyID(ctx context.Context) (id xid.ID, err error)

OnlyID is like Only, but returns the only Tag ID in the query. Returns a *NotSingularError when more than one Tag ID is found. Returns a *NotFoundError when no entities are found.

func (*TagQuery) OnlyIDX

func (tq *TagQuery) OnlyIDX(ctx context.Context) xid.ID

OnlyIDX is like OnlyID, but panics if an error occurs.

func (*TagQuery) OnlyX

func (tq *TagQuery) OnlyX(ctx context.Context) *Tag

OnlyX is like Only, but panics if an error occurs.

func (*TagQuery) Order

func (tq *TagQuery) Order(o ...OrderFunc) *TagQuery

Order adds an order step to the query.

func (*TagQuery) QueryAccounts

func (tq *TagQuery) QueryAccounts() *AccountQuery

QueryAccounts chains the current query on the "accounts" edge.

func (*TagQuery) QueryPosts

func (tq *TagQuery) QueryPosts() *PostQuery

QueryPosts chains the current query on the "posts" edge.

func (*TagQuery) Select

func (tq *TagQuery) Select(fields ...string) *TagSelect

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 {
	CreatedAt time.Time `json:"created_at,omitempty"`
}

client.Tag.Query().
	Select(tag.FieldCreatedAt).
	Scan(ctx, &v)

func (*TagQuery) Unique

func (tq *TagQuery) Unique(unique bool) *TagQuery

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 (*TagQuery) Where

func (tq *TagQuery) Where(ps ...predicate.Tag) *TagQuery

Where adds a new predicate for the TagQuery builder.

func (*TagQuery) WithAccounts

func (tq *TagQuery) WithAccounts(opts ...func(*AccountQuery)) *TagQuery

WithAccounts tells the query-builder to eager-load the nodes that are connected to the "accounts" edge. The optional arguments are used to configure the query builder of the edge.

func (*TagQuery) WithPosts

func (tq *TagQuery) WithPosts(opts ...func(*PostQuery)) *TagQuery

WithPosts tells the query-builder to eager-load the nodes that are connected to the "posts" edge. The optional arguments are used to configure the query builder of the edge.

type TagSelect

type TagSelect struct {
	*TagQuery
	// contains filtered or unexported fields
}

TagSelect is the builder for selecting fields of Tag entities.

func (*TagSelect) Bool

func (s *TagSelect) Bool(ctx context.Context) (_ bool, err error)

Bool returns a single bool from a selector. It is only allowed when selecting one field.

func (*TagSelect) BoolX

func (s *TagSelect) BoolX(ctx context.Context) bool

BoolX is like Bool, but panics if an error occurs.

func (*TagSelect) Bools

func (s *TagSelect) Bools(ctx context.Context) ([]bool, error)

Bools returns list of bools from a selector. It is only allowed when selecting one field.

func (*TagSelect) BoolsX

func (s *TagSelect) BoolsX(ctx context.Context) []bool

BoolsX is like Bools, but panics if an error occurs.

func (*TagSelect) Float64

func (s *TagSelect) Float64(ctx context.Context) (_ float64, err error)

Float64 returns a single float64 from a selector. It is only allowed when selecting one field.

func (*TagSelect) Float64X

func (s *TagSelect) Float64X(ctx context.Context) float64

Float64X is like Float64, but panics if an error occurs.

func (*TagSelect) Float64s

func (s *TagSelect) Float64s(ctx context.Context) ([]float64, error)

Float64s returns list of float64s from a selector. It is only allowed when selecting one field.

func (*TagSelect) Float64sX

func (s *TagSelect) Float64sX(ctx context.Context) []float64

Float64sX is like Float64s, but panics if an error occurs.

func (*TagSelect) Int

func (s *TagSelect) Int(ctx context.Context) (_ int, err error)

Int returns a single int from a selector. It is only allowed when selecting one field.

func (*TagSelect) IntX

func (s *TagSelect) IntX(ctx context.Context) int

IntX is like Int, but panics if an error occurs.

func (*TagSelect) Ints

func (s *TagSelect) Ints(ctx context.Context) ([]int, error)

Ints returns list of ints from a selector. It is only allowed when selecting one field.

func (*TagSelect) IntsX

func (s *TagSelect) IntsX(ctx context.Context) []int

IntsX is like Ints, but panics if an error occurs.

func (*TagSelect) Modify

func (ts *TagSelect) Modify(modifiers ...func(s *sql.Selector)) *TagSelect

Modify adds a query modifier for attaching custom logic to queries.

func (*TagSelect) Scan

func (ts *TagSelect) Scan(ctx context.Context, v interface{}) error

Scan applies the selector query and scans the result into the given value.

func (*TagSelect) ScanX

func (s *TagSelect) ScanX(ctx context.Context, v interface{})

ScanX is like Scan, but panics if an error occurs.

func (*TagSelect) String

func (s *TagSelect) String(ctx context.Context) (_ string, err error)

String returns a single string from a selector. It is only allowed when selecting one field.

func (*TagSelect) StringX

func (s *TagSelect) StringX(ctx context.Context) string

StringX is like String, but panics if an error occurs.

func (*TagSelect) Strings

func (s *TagSelect) Strings(ctx context.Context) ([]string, error)

Strings returns list of strings from a selector. It is only allowed when selecting one field.

func (*TagSelect) StringsX

func (s *TagSelect) StringsX(ctx context.Context) []string

StringsX is like Strings, but panics if an error occurs.

type TagUpdate

type TagUpdate struct {
	// contains filtered or unexported fields
}

TagUpdate is the builder for updating Tag entities.

func (*TagUpdate) AddAccountIDs

func (tu *TagUpdate) AddAccountIDs(ids ...xid.ID) *TagUpdate

AddAccountIDs adds the "accounts" edge to the Account entity by IDs.

func (*TagUpdate) AddAccounts

func (tu *TagUpdate) AddAccounts(a ...*Account) *TagUpdate

AddAccounts adds the "accounts" edges to the Account entity.

func (*TagUpdate) AddPostIDs

func (tu *TagUpdate) AddPostIDs(ids ...xid.ID) *TagUpdate

AddPostIDs adds the "posts" edge to the Post entity by IDs.

func (*TagUpdate) AddPosts

func (tu *TagUpdate) AddPosts(p ...*Post) *TagUpdate

AddPosts adds the "posts" edges to the Post entity.

func (*TagUpdate) ClearAccounts

func (tu *TagUpdate) ClearAccounts() *TagUpdate

ClearAccounts clears all "accounts" edges to the Account entity.

func (*TagUpdate) ClearPosts

func (tu *TagUpdate) ClearPosts() *TagUpdate

ClearPosts clears all "posts" edges to the Post entity.

func (*TagUpdate) Exec

func (tu *TagUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*TagUpdate) ExecX

func (tu *TagUpdate) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*TagUpdate) Modify

func (tu *TagUpdate) Modify(modifiers ...func(u *sql.UpdateBuilder)) *TagUpdate

Modify adds a statement modifier for attaching custom logic to the UPDATE statement.

func (*TagUpdate) Mutation

func (tu *TagUpdate) Mutation() *TagMutation

Mutation returns the TagMutation object of the builder.

func (*TagUpdate) RemoveAccountIDs

func (tu *TagUpdate) RemoveAccountIDs(ids ...xid.ID) *TagUpdate

RemoveAccountIDs removes the "accounts" edge to Account entities by IDs.

func (*TagUpdate) RemoveAccounts

func (tu *TagUpdate) RemoveAccounts(a ...*Account) *TagUpdate

RemoveAccounts removes "accounts" edges to Account entities.

func (*TagUpdate) RemovePostIDs

func (tu *TagUpdate) RemovePostIDs(ids ...xid.ID) *TagUpdate

RemovePostIDs removes the "posts" edge to Post entities by IDs.

func (*TagUpdate) RemovePosts

func (tu *TagUpdate) RemovePosts(p ...*Post) *TagUpdate

RemovePosts removes "posts" edges to Post entities.

func (*TagUpdate) Save

func (tu *TagUpdate) Save(ctx context.Context) (int, error)

Save executes the query and returns the number of nodes affected by the update operation.

func (*TagUpdate) SaveX

func (tu *TagUpdate) SaveX(ctx context.Context) int

SaveX is like Save, but panics if an error occurs.

func (*TagUpdate) Where

func (tu *TagUpdate) Where(ps ...predicate.Tag) *TagUpdate

Where appends a list predicates to the TagUpdate builder.

type TagUpdateOne

type TagUpdateOne struct {
	// contains filtered or unexported fields
}

TagUpdateOne is the builder for updating a single Tag entity.

func (*TagUpdateOne) AddAccountIDs

func (tuo *TagUpdateOne) AddAccountIDs(ids ...xid.ID) *TagUpdateOne

AddAccountIDs adds the "accounts" edge to the Account entity by IDs.

func (*TagUpdateOne) AddAccounts

func (tuo *TagUpdateOne) AddAccounts(a ...*Account) *TagUpdateOne

AddAccounts adds the "accounts" edges to the Account entity.

func (*TagUpdateOne) AddPostIDs

func (tuo *TagUpdateOne) AddPostIDs(ids ...xid.ID) *TagUpdateOne

AddPostIDs adds the "posts" edge to the Post entity by IDs.

func (*TagUpdateOne) AddPosts

func (tuo *TagUpdateOne) AddPosts(p ...*Post) *TagUpdateOne

AddPosts adds the "posts" edges to the Post entity.

func (*TagUpdateOne) ClearAccounts

func (tuo *TagUpdateOne) ClearAccounts() *TagUpdateOne

ClearAccounts clears all "accounts" edges to the Account entity.

func (*TagUpdateOne) ClearPosts

func (tuo *TagUpdateOne) ClearPosts() *TagUpdateOne

ClearPosts clears all "posts" edges to the Post entity.

func (*TagUpdateOne) Exec

func (tuo *TagUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*TagUpdateOne) ExecX

func (tuo *TagUpdateOne) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*TagUpdateOne) Modify

func (tuo *TagUpdateOne) Modify(modifiers ...func(u *sql.UpdateBuilder)) *TagUpdateOne

Modify adds a statement modifier for attaching custom logic to the UPDATE statement.

func (*TagUpdateOne) Mutation

func (tuo *TagUpdateOne) Mutation() *TagMutation

Mutation returns the TagMutation object of the builder.

func (*TagUpdateOne) RemoveAccountIDs

func (tuo *TagUpdateOne) RemoveAccountIDs(ids ...xid.ID) *TagUpdateOne

RemoveAccountIDs removes the "accounts" edge to Account entities by IDs.

func (*TagUpdateOne) RemoveAccounts

func (tuo *TagUpdateOne) RemoveAccounts(a ...*Account) *TagUpdateOne

RemoveAccounts removes "accounts" edges to Account entities.

func (*TagUpdateOne) RemovePostIDs

func (tuo *TagUpdateOne) RemovePostIDs(ids ...xid.ID) *TagUpdateOne

RemovePostIDs removes the "posts" edge to Post entities by IDs.

func (*TagUpdateOne) RemovePosts

func (tuo *TagUpdateOne) RemovePosts(p ...*Post) *TagUpdateOne

RemovePosts removes "posts" edges to Post entities.

func (*TagUpdateOne) Save

func (tuo *TagUpdateOne) Save(ctx context.Context) (*Tag, error)

Save executes the query and returns the updated Tag entity.

func (*TagUpdateOne) SaveX

func (tuo *TagUpdateOne) SaveX(ctx context.Context) *Tag

SaveX is like Save, but panics if an error occurs.

func (*TagUpdateOne) Select

func (tuo *TagUpdateOne) Select(field string, fields ...string) *TagUpdateOne

Select allows selecting one or more fields (columns) of the returned entity. The default is selecting all fields defined in the entity schema.

type TagUpsert

type TagUpsert struct {
	*sql.UpdateSet
}

TagUpsert is the "OnConflict" setter.

func (*TagUpsert) SetCreatedAt

func (u *TagUpsert) SetCreatedAt(v time.Time) *TagUpsert

SetCreatedAt sets the "created_at" field.

func (*TagUpsert) SetName

func (u *TagUpsert) SetName(v string) *TagUpsert

SetName sets the "name" field.

func (*TagUpsert) UpdateCreatedAt

func (u *TagUpsert) UpdateCreatedAt() *TagUpsert

UpdateCreatedAt sets the "created_at" field to the value that was provided on create.

func (*TagUpsert) UpdateName

func (u *TagUpsert) UpdateName() *TagUpsert

UpdateName sets the "name" field to the value that was provided on create.

type TagUpsertBulk

type TagUpsertBulk struct {
	// contains filtered or unexported fields
}

TagUpsertBulk is the builder for "upsert"-ing a bulk of Tag nodes.

func (*TagUpsertBulk) DoNothing

func (u *TagUpsertBulk) DoNothing() *TagUpsertBulk

DoNothing configures the conflict_action to `DO NOTHING`. Supported only by SQLite and PostgreSQL.

func (*TagUpsertBulk) Exec

func (u *TagUpsertBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*TagUpsertBulk) ExecX

func (u *TagUpsertBulk) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*TagUpsertBulk) Ignore

func (u *TagUpsertBulk) Ignore() *TagUpsertBulk

Ignore sets each column to itself in case of conflict. Using this option is equivalent to using:

client.Tag.Create().
	OnConflict(sql.ResolveWithIgnore()).
	Exec(ctx)

func (*TagUpsertBulk) SetCreatedAt

func (u *TagUpsertBulk) SetCreatedAt(v time.Time) *TagUpsertBulk

SetCreatedAt sets the "created_at" field.

func (*TagUpsertBulk) SetName

func (u *TagUpsertBulk) SetName(v string) *TagUpsertBulk

SetName sets the "name" field.

func (*TagUpsertBulk) Update

func (u *TagUpsertBulk) Update(set func(*TagUpsert)) *TagUpsertBulk

Update allows overriding fields `UPDATE` values. See the TagCreateBulk.OnConflict documentation for more info.

func (*TagUpsertBulk) UpdateCreatedAt

func (u *TagUpsertBulk) UpdateCreatedAt() *TagUpsertBulk

UpdateCreatedAt sets the "created_at" field to the value that was provided on create.

func (*TagUpsertBulk) UpdateName

func (u *TagUpsertBulk) UpdateName() *TagUpsertBulk

UpdateName sets the "name" field to the value that was provided on create.

func (*TagUpsertBulk) UpdateNewValues

func (u *TagUpsertBulk) UpdateNewValues() *TagUpsertBulk

UpdateNewValues updates the mutable fields using the new values that were set on create. Using this option is equivalent to using:

client.Tag.Create().
	OnConflict(
		sql.ResolveWithNewValues(),
		sql.ResolveWith(func(u *sql.UpdateSet) {
			u.SetIgnore(tag.FieldID)
		}),
	).
	Exec(ctx)

type TagUpsertOne

type TagUpsertOne struct {
	// contains filtered or unexported fields
}

TagUpsertOne is the builder for "upsert"-ing

one Tag node.

func (*TagUpsertOne) DoNothing

func (u *TagUpsertOne) DoNothing() *TagUpsertOne

DoNothing configures the conflict_action to `DO NOTHING`. Supported only by SQLite and PostgreSQL.

func (*TagUpsertOne) Exec

func (u *TagUpsertOne) Exec(ctx context.Context) error

Exec executes the query.

func (*TagUpsertOne) ExecX

func (u *TagUpsertOne) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*TagUpsertOne) ID

func (u *TagUpsertOne) ID(ctx context.Context) (id xid.ID, err error)

Exec executes the UPSERT query and returns the inserted/updated ID.

func (*TagUpsertOne) IDX

func (u *TagUpsertOne) IDX(ctx context.Context) xid.ID

IDX is like ID, but panics if an error occurs.

func (*TagUpsertOne) Ignore

func (u *TagUpsertOne) Ignore() *TagUpsertOne

Ignore sets each column to itself in case of conflict. Using this option is equivalent to using:

client.Tag.Create().
    OnConflict(sql.ResolveWithIgnore()).
    Exec(ctx)

func (*TagUpsertOne) SetCreatedAt

func (u *TagUpsertOne) SetCreatedAt(v time.Time) *TagUpsertOne

SetCreatedAt sets the "created_at" field.

func (*TagUpsertOne) SetName

func (u *TagUpsertOne) SetName(v string) *TagUpsertOne

SetName sets the "name" field.

func (*TagUpsertOne) Update

func (u *TagUpsertOne) Update(set func(*TagUpsert)) *TagUpsertOne

Update allows overriding fields `UPDATE` values. See the TagCreate.OnConflict documentation for more info.

func (*TagUpsertOne) UpdateCreatedAt

func (u *TagUpsertOne) UpdateCreatedAt() *TagUpsertOne

UpdateCreatedAt sets the "created_at" field to the value that was provided on create.

func (*TagUpsertOne) UpdateName

func (u *TagUpsertOne) UpdateName() *TagUpsertOne

UpdateName sets the "name" field to the value that was provided on create.

func (*TagUpsertOne) UpdateNewValues

func (u *TagUpsertOne) UpdateNewValues() *TagUpsertOne

UpdateNewValues updates the mutable fields using the new values that were set on create except the ID field. Using this option is equivalent to using:

client.Tag.Create().
	OnConflict(
		sql.ResolveWithNewValues(),
		sql.ResolveWith(func(u *sql.UpdateSet) {
			u.SetIgnore(tag.FieldID)
		}),
	).
	Exec(ctx)

type Tags

type Tags []*Tag

Tags is a parsable slice of Tag.

type Tx

type Tx struct {

	// Account is the client for interacting with the Account builders.
	Account *AccountClient
	// Authentication is the client for interacting with the Authentication builders.
	Authentication *AuthenticationClient
	// Category is the client for interacting with the Category builders.
	Category *CategoryClient
	// Notification is the client for interacting with the Notification builders.
	Notification *NotificationClient
	// Post is the client for interacting with the Post builders.
	Post *PostClient
	// React is the client for interacting with the React builders.
	React *ReactClient
	// Role is the client for interacting with the Role builders.
	Role *RoleClient
	// Subscription is the client for interacting with the Subscription builders.
	Subscription *SubscriptionClient
	// Tag is the client for interacting with the Tag builders.
	Tag *TagClient
	// contains filtered or unexported fields
}

Tx is a transactional client that is created by calling Client.Tx().

func TxFromContext

func TxFromContext(ctx context.Context) *Tx

TxFromContext returns a Tx stored inside a context, or nil if there isn't one.

func (*Tx) Client

func (tx *Tx) Client() *Client

Client returns a Client that binds to current transaction.

func (*Tx) Commit

func (tx *Tx) Commit() error

Commit commits the transaction.

func (*Tx) OnCommit

func (tx *Tx) OnCommit(f CommitHook)

OnCommit adds a hook to call on commit.

func (*Tx) OnRollback

func (tx *Tx) OnRollback(f RollbackHook)

OnRollback adds a hook to call on rollback.

func (*Tx) Rollback

func (tx *Tx) Rollback() error

Rollback rollbacks the transaction.

type ValidationError

type ValidationError struct {
	Name string // Field or edge name.
	// contains filtered or unexported fields
}

ValidationError returns when validating a field or edge fails.

func (*ValidationError) Error

func (e *ValidationError) Error() string

Error implements the error interface.

func (*ValidationError) Unwrap

func (e *ValidationError) Unwrap() error

Unwrap implements the errors.Wrapper interface.

type Value

type Value = ent.Value

ent aliases to avoid import conflicts in user's code.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL